From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02A1DC00140 for ; Mon, 15 Aug 2022 20:04:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232220AbiHOUE5 (ORCPT ); Mon, 15 Aug 2022 16:04:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232283AbiHOUE0 (ORCPT ); Mon, 15 Aug 2022 16:04:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA9197E332; Mon, 15 Aug 2022 11:54:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 76B00B81057; Mon, 15 Aug 2022 18:54:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB7D7C433C1; Mon, 15 Aug 2022 18:54:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589661; bh=0WIsGfkGmo3rleNMjmcotW8pvToMNo8P/dtxwlRRp4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QcDtOO0RLbnHCP/3R/SswllSeLN9c8+A63MA11kO6s8aYE/c4Y1hHm5CN4IwSRNwm 1G2b+snJXXdOjSB5UDA3C1s6FmFcokCI1r6LcgrOxS1WuMF7pSb9Szo/Ev2pEKCBic oyWuZz+NUwAlbELnpGWEOkpdVVbKJgHdY10n3uZU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fangrui Song , Nick Desaulniers , Linus Torvalds , Jens Axboe Subject: [PATCH 5.18 0001/1095] Makefile: link with -z noexecstack --no-warn-rwx-segments Date: Mon, 15 Aug 2022 19:50:00 +0200 Message-Id: <20220815180429.333167455@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nick Desaulniers commit 0d362be5b14200b77ecc2127936a5ff82fbffe41 upstream. Users of GNU ld (BFD) from binutils 2.39+ will observe multiple instances of a new warning when linking kernels in the form: ld: warning: vmlinux: missing .note.GNU-stack section implies executable = stack ld: NOTE: This behaviour is deprecated and will be removed in a future ve= rsion of the linker ld: warning: vmlinux has a LOAD segment with RWX permissions Generally, we would like to avoid the stack being executable. Because there could be a need for the stack to be executable, assembler sources have to opt-in to this security feature via explicit creation of the .note.GNU-stack feature (which compilers create by default) or command line flag --noexecstack. Or we can simply tell the linker the production of such sections is irrelevant and to link the stack as --noexecstack. LLVM's LLD linker defaults to -z noexecstack, so this flag isn't strictly necessary when linking with LLD, only BFD, but it doesn't hurt to be explicit here for all linkers IMO. --no-warn-rwx-segments is currently BFD specific and only available in the current latest release, so it's wrapped in an ld-option check. While the kernel makes extensive usage of ELF sections, it doesn't use permissions from ELF segments. Link: https://lore.kernel.org/linux-block/3af4127a-f453-4cf7-f133-a181cce06= f73@kernel.dk/ Link: https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommit;h=3Dba951= afb99912da01a6e8434126b8fac7aa75107 Link: https://github.com/llvm/llvm-project/issues/57009 Reported-and-tested-by: Jens Axboe Suggested-by: Fangrui Song Signed-off-by: Nick Desaulniers Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) --- a/Makefile +++ b/Makefile @@ -1031,6 +1031,11 @@ KBUILD_CFLAGS +=3D $(KCFLAGS) KBUILD_LDFLAGS_MODULE +=3D --build-id=3Dsha1 LDFLAGS_vmlinux +=3D --build-id=3Dsha1 =20 +KBUILD_LDFLAGS +=3D -z noexecstack +ifeq ($(CONFIG_LD_IS_BFD),y) +KBUILD_LDFLAGS +=3D $(call ld-option,--no-warn-rwx-segments) +endif + ifeq ($(CONFIG_STRIP_ASM_SYMS),y) LDFLAGS_vmlinux +=3D $(call ld-option, -X,) endif From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB409C00140 for ; Mon, 15 Aug 2022 20:07:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243806AbiHOUHq (ORCPT ); Mon, 15 Aug 2022 16:07:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346176AbiHOUGO (ORCPT ); Mon, 15 Aug 2022 16:06:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6F7E81698; Mon, 15 Aug 2022 11:55:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 881D06125E; Mon, 15 Aug 2022 18:54:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D722C433D6; Mon, 15 Aug 2022 18:54:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589695; bh=9oKqhmwN4AKakxaJwaUN3W6bPQ1UeHS2y21A6FGtcaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bxxvwr+88wAOpFhluwFxohjWSb89auHUyTPks3YMnwZbi/IgP+MwC96Es86dPk/zo aAS73yHs7UapZxU8pBX0HY7Qdcha9zEC6qryhMGgKPb9cKXJHY8xubDzLigfulMJEx 0wK+QZKOZ4Zt5JPYnNlQjdsT5Zhww/rHSL3wBmOc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fangrui Song , Nick Desaulniers , Linus Torvalds , Jens Axboe Subject: [PATCH 5.18 0002/1095] x86: link vdso and boot with -z noexecstack --no-warn-rwx-segments Date: Mon, 15 Aug 2022 19:50:01 +0200 Message-Id: <20220815180429.383780689@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nick Desaulniers commit ffcf9c5700e49c0aee42dcba9a12ba21338e8136 upstream. Users of GNU ld (BFD) from binutils 2.39+ will observe multiple instances of a new warning when linking kernels in the form: ld: warning: arch/x86/boot/pmjump.o: missing .note.GNU-stack section impl= ies executable stack ld: NOTE: This behaviour is deprecated and will be removed in a future ve= rsion of the linker ld: warning: arch/x86/boot/compressed/vmlinux has a LOAD segment with RWX= permissions Generally, we would like to avoid the stack being executable. Because there could be a need for the stack to be executable, assembler sources have to opt-in to this security feature via explicit creation of the .note.GNU-stack feature (which compilers create by default) or command line flag --noexecstack. Or we can simply tell the linker the production of such sections is irrelevant and to link the stack as --noexecstack. LLVM's LLD linker defaults to -z noexecstack, so this flag isn't strictly necessary when linking with LLD, only BFD, but it doesn't hurt to be explicit here for all linkers IMO. --no-warn-rwx-segments is currently BFD specific and only available in the current latest release, so it's wrapped in an ld-option check. While the kernel makes extensive usage of ELF sections, it doesn't use permissions from ELF segments. Link: https://lore.kernel.org/linux-block/3af4127a-f453-4cf7-f133-a181cce06= f73@kernel.dk/ Link: https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommit;h=3Dba951= afb99912da01a6e8434126b8fac7aa75107 Link: https://github.com/llvm/llvm-project/issues/57009 Reported-and-tested-by: Jens Axboe Suggested-by: Fangrui Song Signed-off-by: Nick Desaulniers Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/boot/Makefile | 2 +- arch/x86/boot/compressed/Makefile | 4 ++++ arch/x86/entry/vdso/Makefile | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile @@ -103,7 +103,7 @@ $(obj)/zoffset.h: $(obj)/compressed/vmli AFLAGS_header.o +=3D -I$(objtree)/$(obj) $(obj)/header.o: $(obj)/zoffset.h =20 -LDFLAGS_setup.elf :=3D -m elf_i386 -T +LDFLAGS_setup.elf :=3D -m elf_i386 -z noexecstack -T $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE $(call if_changed,ld) =20 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -69,6 +69,10 @@ LDFLAGS_vmlinux :=3D -pie $(call ld-option ifdef CONFIG_LD_ORPHAN_WARN LDFLAGS_vmlinux +=3D --orphan-handling=3Dwarn endif +LDFLAGS_vmlinux +=3D -z noexecstack +ifeq ($(CONFIG_LD_IS_BFD),y) +LDFLAGS_vmlinux +=3D $(call ld-option,--no-warn-rwx-segments) +endif LDFLAGS_vmlinux +=3D -T =20 hostprogs :=3D mkpiggy --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile @@ -179,7 +179,7 @@ quiet_cmd_vdso =3D VDSO $@ sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' =20 VDSO_LDFLAGS =3D -shared --hash-style=3Dboth --build-id=3Dsha1 \ - $(call ld-option, --eh-frame-hdr) -Bsymbolic + $(call ld-option, --eh-frame-hdr) -Bsymbolic -z noexecstack GCOV_PROFILE :=3D n =20 quiet_cmd_vdso_and_check =3D VDSO $@ From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08F27C00140 for ; Mon, 15 Aug 2022 20:08:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345919AbiHOUIV (ORCPT ); Mon, 15 Aug 2022 16:08:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346390AbiHOUGj (ORCPT ); Mon, 15 Aug 2022 16:06:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C58A912AA6; Mon, 15 Aug 2022 11:55:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 700D0B81057; Mon, 15 Aug 2022 18:55:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1625C43145; Mon, 15 Aug 2022 18:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589722; bh=i/IqNC9sKyzc2Gi0Ic4dqxmktUixRmto/+KsH9OoTSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a3Bj4jEkBBS7ZpT2VHEEbWNXTWGFIvscuvV5TgXvCWMpSPA+0/lr3GcdQ+QpSzCjq mkQwrPvhKN8zjBoOhP7Y0LD20OhmqkTyYJVD5w7b15choDPcvGf6cKePTofjPdvz/Z dII9CdwJI1v/h0nKpdZC8DCjokk2gcAvxIM6EiMc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.18 0003/1095] Revert "pNFS: nfs3_set_ds_client should set NFS_CS_NOPING" Date: Mon, 15 Aug 2022 19:50:02 +0200 Message-Id: <20220815180429.424056333@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Trond Myklebust commit 9597152d98840c2517230740952df97cfcc07e2f upstream. This reverts commit c6eb58435b98bd843d3179664a0195ff25adb2c3. If a transport is down, then we want to fail over to other transports if they are listed in the GETDEVICEINFO reply. Fixes: c6eb58435b98 ("pNFS: nfs3_set_ds_client should set NFS_CS_NOPING") Cc: stable@vger.kernel.org # 5.11.x Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/nfs/nfs3client.c | 1 - 1 file changed, 1 deletion(-) --- a/fs/nfs/nfs3client.c +++ b/fs/nfs/nfs3client.c @@ -108,7 +108,6 @@ struct nfs_client *nfs3_set_ds_client(st if (mds_srv->flags & NFS_MOUNT_NORESVPORT) __set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags); =20 - __set_bit(NFS_CS_NOPING, &cl_init.init_flags); __set_bit(NFS_CS_DS, &cl_init.init_flags); =20 /* Use the MDS nfs_client cl_ipaddr. */ From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56B7CC00140 for ; Mon, 15 Aug 2022 20:08:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243592AbiHOUIt (ORCPT ); Mon, 15 Aug 2022 16:08:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244054AbiHOUHx (ORCPT ); Mon, 15 Aug 2022 16:07:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A1AC402CD; Mon, 15 Aug 2022 11:55:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 55656B8105C; Mon, 15 Aug 2022 18:55:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C856CC433C1; Mon, 15 Aug 2022 18:55:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589725; bh=rgVZ0QPFNWmFUdSoYFtBcF4v79wbdPH3MlDMPbj3SaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vc4QjLGc3MIrF9ZPS8FTtoVmaakAOESj0DbC3Gv/0EmOFNIT5J4XXnrbzAPy5He4l 2gqKH85Pt9AhRV5WYM8H6V4DPpAwsbDUHnEIQEjfHo8KvlUuJ6YBC/e3pn2PBqOKqZ MPA5OZb//WPhrIbfsNwELNSvyRZ1ZYRTXsou8TrU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.18 0004/1095] scsi: Revert "scsi: qla2xxx: Fix disk failure to rediscover" Date: Mon, 15 Aug 2022 19:50:03 +0200 Message-Id: <20220815180429.464204939@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nilesh Javali commit 5bc7b01c513a4a9b4cfe306e8d1720cfcfd3b8a3 upstream. This fixes the regression of NVMe discovery failure during driver load time. This reverts commit 6a45c8e137d4e2c72eecf1ac7cf64f2fdfcead99. Link: https://lore.kernel.org/r/20220713052045.10683-2-njavali@marvell.com Cc: stable@vger.kernel.org Reviewed-by: Himanshu Madhani Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_init.c | 5 ++--- drivers/scsi/qla2xxx/qla_nvme.c | 5 ----- 2 files changed, 2 insertions(+), 8 deletions(-) --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -5767,8 +5767,6 @@ qla2x00_reg_remote_port(scsi_qla_host_t if (atomic_read(&fcport->state) =3D=3D FCS_ONLINE) return; =20 - qla2x00_set_fcport_state(fcport, FCS_ONLINE); - rport_ids.node_name =3D wwn_to_u64(fcport->node_name); rport_ids.port_name =3D wwn_to_u64(fcport->port_name); rport_ids.port_id =3D fcport->d_id.b.domain << 16 | @@ -5869,7 +5867,6 @@ qla2x00_update_fcport(scsi_qla_host_t *v qla2x00_reg_remote_port(vha, fcport); break; case MODE_TARGET: - qla2x00_set_fcport_state(fcport, FCS_ONLINE); if (!vha->vha_tgt.qla_tgt->tgt_stop && !vha->vha_tgt.qla_tgt->tgt_stopped) qlt_fc_port_added(vha, fcport); @@ -5887,6 +5884,8 @@ qla2x00_update_fcport(scsi_qla_host_t *v if (NVME_TARGET(vha->hw, fcport)) qla_nvme_register_remote(vha, fcport); =20 + qla2x00_set_fcport_state(fcport, FCS_ONLINE); + if (IS_IIDMA_CAPABLE(vha->hw) && vha->hw->flags.gpsc_supported) { if (fcport->id_changed) { fcport->id_changed =3D 0; --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -37,11 +37,6 @@ int qla_nvme_register_remote(struct scsi (fcport->nvme_flag & NVME_FLAG_REGISTERED)) return 0; =20 - if (atomic_read(&fcport->state) =3D=3D FCS_ONLINE) - return 0; - - qla2x00_set_fcport_state(fcport, FCS_ONLINE); - fcport->nvme_flag &=3D ~NVME_FLAG_RESETTING; =20 memset(&req, 0, sizeof(struct nvme_fc_port_info)); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F984C00140 for ; Mon, 15 Aug 2022 20:09:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240217AbiHOUJJ (ORCPT ); Mon, 15 Aug 2022 16:09:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240602AbiHOUIf (ORCPT ); Mon, 15 Aug 2022 16:08:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7510C481DE; Mon, 15 Aug 2022 11:55:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 85008B810A0; Mon, 15 Aug 2022 18:55:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFDD1C433C1; Mon, 15 Aug 2022 18:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589728; bh=ROX/1QPSrkWehly//Z9ez2AbVEnBFV5ns4JBLQV7t80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kWc0s1yua8+4Hda6KKCExzIzpCUFhmThZ/sQB7qvkz7K9hVe9jdrLexBbq5YB+syq c9vN9TZFN6AiWBmOHb+aJh0qMvB6nWlprrbI30+h3RVAlyLEmr1Qbi9DY2AkO1YhMR lerZqfBzS+oJ3ibamLPoHxOk/cDMftvIMBfaMRT8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.18 0005/1095] pNFS/flexfiles: Report RDMA connection errors to the server Date: Mon, 15 Aug 2022 19:50:04 +0200 Message-Id: <20220815180429.511045249@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Trond Myklebust commit 7836d75467e9d214bdf5c693b32721de729a6e38 upstream. The RPC/RDMA driver will return -EPROTO and -ENODEV as connection errors under certain circumstances. Make sure that we handle them and report them to the server. If not, we can end up cycling forever in a LAYOUTGET/LAYOUTRETURN loop. Fixes: a12f996d3413 ("NFSv4/pNFS: Use connections to a DS that are all of t= he same protocol family") Cc: stable@vger.kernel.org # 5.11.x Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/nfs/flexfilelayout/flexfilelayout.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -1131,6 +1131,8 @@ static int ff_layout_async_handle_error_ case -EIO: case -ETIMEDOUT: case -EPIPE: + case -EPROTO: + case -ENODEV: dprintk("%s DS connection error %d\n", __func__, task->tk_status); nfs4_delete_deviceid(devid->ld, devid->nfs_client, @@ -1236,6 +1238,8 @@ static void ff_layout_io_track_ds_error( case -ENOBUFS: case -EPIPE: case -EPERM: + case -EPROTO: + case -ENODEV: *op_status =3D status =3D NFS4ERR_NXIO; break; case -EACCES: From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24E14C00140 for ; Mon, 15 Aug 2022 20:09:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345937AbiHOUJH (ORCPT ); Mon, 15 Aug 2022 16:09:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233446AbiHOUI3 (ORCPT ); Mon, 15 Aug 2022 16:08:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C2D66C76A; Mon, 15 Aug 2022 11:55:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5C088B81082; Mon, 15 Aug 2022 18:55:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD5C1C433D6; Mon, 15 Aug 2022 18:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589731; bh=BvMF84voORROuVgcMzmIIaN6ggLX6ZNUuH8cGR75ojU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B1EXtkMGpZwc1S672JQL76sk08W0hDBg81WO5xdTyYOcTWg7EkQficnPkv3Gv1YO5 ftt6iMmh4Rja+SPVpj98qBpNXf33mza33XzQZmAx3raCc4hDQL92dri8nEIw91Wixj +LCVAd7f2D1A18Vef5tsd9H0UUG4uUshFPcVsrOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever Subject: [PATCH 5.18 0006/1095] NFSD: Clean up the show_nf_flags() macro Date: Mon, 15 Aug 2022 19:50:05 +0200 Message-Id: <20220815180429.565386008@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chuck Lever commit bb283ca18d1e67c82d22a329c96c9d6036a74790 upstream. The flags are defined using C macros, so TRACE_DEFINE_ENUM is unnecessary. Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/nfsd/trace.h | 6 ------ 1 file changed, 6 deletions(-) --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -692,12 +692,6 @@ DEFINE_CLID_EVENT(confirmed_r); /* * from fs/nfsd/filecache.h */ -TRACE_DEFINE_ENUM(NFSD_FILE_HASHED); -TRACE_DEFINE_ENUM(NFSD_FILE_PENDING); -TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_READ); -TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_WRITE); -TRACE_DEFINE_ENUM(NFSD_FILE_REFERENCED); - #define show_nf_flags(val) \ __print_flags(val, "|", \ { 1 << NFSD_FILE_HASHED, "HASHED" }, \ From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B847EC00140 for ; Mon, 15 Aug 2022 20:09:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241079AbiHOUJR (ORCPT ); Mon, 15 Aug 2022 16:09:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240495AbiHOUIg (ORCPT ); Mon, 15 Aug 2022 16:08:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E4FF6D540; Mon, 15 Aug 2022 11:55:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EC9C36123D; Mon, 15 Aug 2022 18:55:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7F68C433D6; Mon, 15 Aug 2022 18:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589734; bh=nn6sIa4BYZyKOQW1zlH9MzcJGUv54KSwFmdGAddyjIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gJmjqPGBkCt5AmoaxFotXm7CQUMolEpUO5ArQWCcjr5bk4xuPSmRbky20KxwiZRtP rnw97P54yBjPcEv2LUcJUBE3rL5DaHWP9g8KX5rt2iRj1/X0k2TWWgfBH2P5d3J+GO EGbKxJc/l+V2bb+8Fqp73lAngolWJgYVCozgrRlc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornieskaia , Jeff Layton , Chuck Lever Subject: [PATCH 5.18 0007/1095] nfsd: eliminate the NFSD_FILE_BREAK_* flags Date: Mon, 15 Aug 2022 19:50:06 +0200 Message-Id: <20220815180429.604972860@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff Layton commit 23ba98de6dcec665e15c0ca19244379bb0d30932 upstream. We had a report from the spring Bake-a-thon of data corruption in some nfstest_interop tests. Looking at the traces showed the NFS server allowing a v3 WRITE to proceed while a read delegation was still outstanding. Currently, we only set NFSD_FILE_BREAK_* flags if NFSD_MAY_NOT_BREAK_LEASE was set when we call nfsd_file_alloc. NFSD_MAY_NOT_BREAK_LEASE was intended to be set when finding files for COMMIT ops, where we need a writeable filehandle but don't need to break read leases. It doesn't make any sense to consult that flag when allocating a file since the file may be used on subsequent calls where we do want to break the lease (and the usage of it here seems to be reverse from what it should be anyway). Also, after calling nfsd_open_break_lease, we don't want to clear the BREAK_* bits. A lease could end up being set on it later (more than once) and we need to be able to break those leases as well. This means that the NFSD_FILE_BREAK_* flags now just mirror NFSD_MAY_{READ,WRITE} flags, so there's no need for them at all. Just drop those flags and unconditionally call nfsd_open_break_lease every time. Reported-by: Olga Kornieskaia Link: https://bugzilla.redhat.com/show_bug.cgi?id=3D2107360 Fixes: 65294c1f2c5e (nfsd: add a new struct file caching facility to nfsd) Cc: # 5.4.x : bb283ca18d1e NFSD: Clean up the show= _nf_flags() macro Cc: # 5.4.x Signed-off-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/nfsd/filecache.c | 22 +--------------------- fs/nfsd/filecache.h | 4 +--- fs/nfsd/trace.h | 2 -- 3 files changed, 2 insertions(+), 26 deletions(-) --- a/fs/nfsd/filecache.c +++ b/fs/nfsd/filecache.c @@ -183,12 +183,6 @@ nfsd_file_alloc(struct inode *inode, uns nf->nf_hashval =3D hashval; refcount_set(&nf->nf_ref, 1); nf->nf_may =3D may & NFSD_FILE_MAY_MASK; - if (may & NFSD_MAY_NOT_BREAK_LEASE) { - if (may & NFSD_MAY_WRITE) - __set_bit(NFSD_FILE_BREAK_WRITE, &nf->nf_flags); - if (may & NFSD_MAY_READ) - __set_bit(NFSD_FILE_BREAK_READ, &nf->nf_flags); - } nf->nf_mark =3D NULL; trace_nfsd_file_alloc(nf); } @@ -954,21 +948,7 @@ wait_for_construction: =20 this_cpu_inc(nfsd_file_cache_hits); =20 - if (!(may_flags & NFSD_MAY_NOT_BREAK_LEASE)) { - bool write =3D (may_flags & NFSD_MAY_WRITE); - - if (test_bit(NFSD_FILE_BREAK_READ, &nf->nf_flags) || - (test_bit(NFSD_FILE_BREAK_WRITE, &nf->nf_flags) && write)) { - status =3D nfserrno(nfsd_open_break_lease( - file_inode(nf->nf_file), may_flags)); - if (status =3D=3D nfs_ok) { - clear_bit(NFSD_FILE_BREAK_READ, &nf->nf_flags); - if (write) - clear_bit(NFSD_FILE_BREAK_WRITE, - &nf->nf_flags); - } - } - } + status =3D nfserrno(nfsd_open_break_lease(file_inode(nf->nf_file), may_fl= ags)); out: if (status =3D=3D nfs_ok) { *pnf =3D nf; --- a/fs/nfsd/filecache.h +++ b/fs/nfsd/filecache.h @@ -37,9 +37,7 @@ struct nfsd_file { struct net *nf_net; #define NFSD_FILE_HASHED (0) #define NFSD_FILE_PENDING (1) -#define NFSD_FILE_BREAK_READ (2) -#define NFSD_FILE_BREAK_WRITE (3) -#define NFSD_FILE_REFERENCED (4) +#define NFSD_FILE_REFERENCED (2) unsigned long nf_flags; struct inode *nf_inode; unsigned int nf_hashval; --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -696,8 +696,6 @@ DEFINE_CLID_EVENT(confirmed_r); __print_flags(val, "|", \ { 1 << NFSD_FILE_HASHED, "HASHED" }, \ { 1 << NFSD_FILE_PENDING, "PENDING" }, \ - { 1 << NFSD_FILE_BREAK_READ, "BREAK_READ" }, \ - { 1 << NFSD_FILE_BREAK_WRITE, "BREAK_WRITE" }, \ { 1 << NFSD_FILE_REFERENCED, "REFERENCED"}) =20 DECLARE_EVENT_CLASS(nfsd_file_class, From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBB09C00140 for ; Mon, 15 Aug 2022 20:09:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243284AbiHOUJY (ORCPT ); Mon, 15 Aug 2022 16:09:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241516AbiHOUIj (ORCPT ); Mon, 15 Aug 2022 16:08:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D73F47BBD; Mon, 15 Aug 2022 11:55:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DD86361029; Mon, 15 Aug 2022 18:55:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF02CC433D7; Mon, 15 Aug 2022 18:55:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589737; bh=OulFKFL7KovR2r6EPGY1gNLGYVPmkKMFn3kUuRZ3tqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1y4FZRLJPPrXP6TM6rliXQJnkVjNDpRBJObdD3abZ2sUKbsDMW0brfCIaL5i+Oro0 R89DktmuDP3ZpcNsjSTeEsKBNKOgtksgiBy7M+9S64eu32kyMyTyUsqyY8gNLwFu1d uWycqn+RDYhlsQawGbSdWx9/K5Vok6MWf9Fihlj4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.18 0008/1095] ALSA: usb-audio: Add quirk for Behringer UMC202HD Date: Mon, 15 Aug 2022 19:50:07 +0200 Message-Id: <20220815180429.656661393@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai commit e086c37f876fd1f551e2b4f9be97d4a1923cd219 upstream. Just like other Behringer models, UMC202HD (USB ID 1397:0507) requires the quirk for the stable streaming, too. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=3D215934 Cc: Link: https://lore.kernel.org/r/20220722143948.29804-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+) --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1843,6 +1843,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x1395, 0x740a, /* Sennheiser DECT */ QUIRK_FLAG_GET_SAMPLE_RATE), + DEVICE_FLG(0x1397, 0x0507, /* Behringer UMC202HD */ + QUIRK_FLAG_PLAYBACK_FIRST | QUIRK_FLAG_GENERIC_IMPLICIT_FB), DEVICE_FLG(0x1397, 0x0508, /* Behringer UMC204HD */ QUIRK_FLAG_PLAYBACK_FIRST | QUIRK_FLAG_GENERIC_IMPLICIT_FB), DEVICE_FLG(0x1397, 0x0509, /* Behringer UMC404HD */ From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8239BC00140 for ; Mon, 15 Aug 2022 20:09:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243620AbiHOUJg (ORCPT ); Mon, 15 Aug 2022 16:09:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243473AbiHOUIo (ORCPT ); Mon, 15 Aug 2022 16:08:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE9A482F9E; Mon, 15 Aug 2022 11:55:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D662D611ED; Mon, 15 Aug 2022 18:55:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D893AC433D6; Mon, 15 Aug 2022 18:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589740; bh=bIhvwJ0cO3l3RJdTOuGmzssh9wbYGfWA10vvMIuUm+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n8qV2fvkzZW6BXCinxDryItaj+UfvDSPaH4tdZEexGImWRiuvIuV7OLasrAO3Zovg EM60ISy4D0nznJyPupZ+ocl/kZcj06XxqOkhMg7SBNCxLcFwI2aPPQpkGCx0DI/WEx nMmK7V0CAkdQwatqPMFYpoiQbUPKDXGmq3EmCcMA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Takashi Iwai Subject: [PATCH 5.18 0009/1095] ALSA: bcd2000: Fix a UAF bug on the error path of probing Date: Mon, 15 Aug 2022 19:50:08 +0200 Message-Id: <20220815180429.695236203@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheyu Ma commit ffb2759df7efbc00187bfd9d1072434a13a54139 upstream. When the driver fails in snd_card_register() at probe time, it will free the 'bcd2k->midi_out_urb' before killing it, which may cause a UAF bug. The following log can reveal it: [ 50.727020] BUG: KASAN: use-after-free in bcd2000_input_complete+0x1f1/0= x2e0 [snd_bcd2000] [ 50.727623] Read of size 8 at addr ffff88810fab0e88 by task swapper/4/0 [ 50.729530] Call Trace: [ 50.732899] bcd2000_input_complete+0x1f1/0x2e0 [snd_bcd2000] Fix this by adding usb_kill_urb() before usb_free_urb(). Fixes: b47a22290d58 ("ALSA: MIDI driver for Behringer BCD2000 USB device") Signed-off-by: Zheyu Ma Cc: Link: https://lore.kernel.org/r/20220715010515.2087925-1-zheyuma97@gmail.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/usb/bcd2000/bcd2000.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/sound/usb/bcd2000/bcd2000.c +++ b/sound/usb/bcd2000/bcd2000.c @@ -348,7 +348,8 @@ static int bcd2000_init_midi(struct bcd2 static void bcd2000_free_usb_related_resources(struct bcd2000 *bcd2k, struct usb_interface *interface) { - /* usb_kill_urb not necessary, urb is aborted automatically */ + usb_kill_urb(bcd2k->midi_out_urb); + usb_kill_urb(bcd2k->midi_in_urb); =20 usb_free_urb(bcd2k->midi_out_urb); usb_free_urb(bcd2k->midi_in_urb); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95BD2C00140 for ; Mon, 15 Aug 2022 20:05:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229882AbiHOUFC (ORCPT ); Mon, 15 Aug 2022 16:05:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345851AbiHOUEd (ORCPT ); Mon, 15 Aug 2022 16:04:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9EC47E811; Mon, 15 Aug 2022 11:54:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 732B3B810A1; Mon, 15 Aug 2022 18:54:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4C2BC433D6; Mon, 15 Aug 2022 18:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589664; bh=IRM5qCrAuEhQTcKNPhCPmPKbR9Vm7+BGI5WzTw2siqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B4ZDrzb2CY5pYGBBiBrNkFvuURtv7jgoErxz5o661zLIDIBDkekuvAxaIgHzWXRgW +qgMbF3s+RrbmpTYVwbP/dDg+xE9Ww7CU5Zh/l4mClHBaWMR0ku6vxWdiRTDNzFj0x KKwbkq93dqIEAO0TDsDC2VXMWJpvH9KpB8r7i/uA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tim Crawford , Takashi Iwai Subject: [PATCH 5.18 0010/1095] ALSA: hda/realtek: Add quirk for Clevo NV45PZ Date: Mon, 15 Aug 2022 19:50:09 +0200 Message-Id: <20220815180429.741750838@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tim Crawford commit be561ffad708f0cee18aee4231f80ffafaf7a419 upstream. Fixes headset detection on Clevo NV45PZ. Signed-off-by: Tim Crawford Cc: Link: https://lore.kernel.org/r/20220731032243.4300-1-tcrawford@system76.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9255,6 +9255,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_N= O_PRESENCE), SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_N= O_PRESENCE), + SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_N= O_PRESENCE), SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_N= O_PRESENCE), From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E328DC00140 for ; Mon, 15 Aug 2022 20:04:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233157AbiHOUEv (ORCPT ); Mon, 15 Aug 2022 16:04:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241793AbiHOUES (ORCPT ); Mon, 15 Aug 2022 16:04:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A553F7E81F; Mon, 15 Aug 2022 11:54:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 895B4B810A4; Mon, 15 Aug 2022 18:54:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC809C43470; Mon, 15 Aug 2022 18:54:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589667; bh=uZyPPgotAGd7RCkMIzeaOQViKLRTRkhZOvqxuCGRMrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yqbPkBoVCssLXlDAkxF+hrxfjHBtTz3p54Uoz8tQXdxelO1CDYSqH8aioxpPXAro+ A4s7SiXXFqUPtzLOOvCG5E/tbRmkytOguAMFXrAwdvoy7oZ2UuKv5sN/YJKdOY6Fr4 9D62vXKKqPYHcLKiyHj5GrUEDgMxXx1ku+W4LKks= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ivan Hasenkampf , Takashi Iwai Subject: [PATCH 5.18 0011/1095] ALSA: hda/realtek: Add quirk for HP Spectre x360 15-eb0xxx Date: Mon, 15 Aug 2022 19:50:10 +0200 Message-Id: <20220815180429.789553229@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ivan Hasenkampf commit 24df5428ef9d1ca1edd54eca7eb667110f2dfae3 upstream. Fixes speaker output on HP Spectre x360 15-eb0xxx [ re-sorted in SSID order by tiwai ] Signed-off-by: Ivan Hasenkampf Cc: Link: https://lore.kernel.org/r/20220803164001.290394-1-ivan.hasenkampf@gma= il.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9096,6 +9096,8 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GP= IO_AMP_INIT), SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO= ), + SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_H= P_SPECTRE_X360_EB1), + SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_H= P_SPECTRE_X360_EB1), SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285= _FIXUP_HP_GPIO_AMP_INIT), SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", AL= C285_FIXUP_HP_GPIO_AMP_INIT), SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO= _LED), From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64B1CC25B08 for ; Mon, 15 Aug 2022 20:05:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243863AbiHOUFb (ORCPT ); Mon, 15 Aug 2022 16:05:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243529AbiHOUEk (ORCPT ); Mon, 15 Aug 2022 16:04:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AAEB7FE41; Mon, 15 Aug 2022 11:54:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0968B61029; Mon, 15 Aug 2022 18:54:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F100EC433D7; Mon, 15 Aug 2022 18:54:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589670; bh=UKoz1PGPR+E+r9maSyIwijWrm6IDiVNZfDrz561NEUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jXV6p5fzexoIxPkOp3TDn+y2UgDaYm8BwxEgrIfnCa6CASi18tlRLlAJeq0Jc16Wu N5y0zna/AzHh1iWJcDqWuxtMMKGePAKvsSPppwINCaOw1jF/RbitUdpMY7HgRjgzCo vSy8FziK60kcdiZS8et2oq7ykeiUBnHSIqRgQOyw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philipp Jungkamp , Takashi Iwai Subject: [PATCH 5.18 0012/1095] ALSA: hda/realtek: Add quirk for Lenovo Yoga9 14IAP7 Date: Mon, 15 Aug 2022 19:50:11 +0200 Message-Id: <20220815180429.829496146@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Philipp Jungkamp commit 3790a3d6dbbc48e30586e9c3fc752a00e2e11946 upstream. The Lenovo Yoga 9 14IAP7 is set up similarly to the Thinkpad X1 7th and 8th Gen. It also has the speakers attached to NID 0x14 and the bass speakers to NID 0x17, but here the codec misreports the NID 0x17 as unconnected. The pincfg and hda verbs connect and activate the bass speaker amplifiers, but the generic driver will connect them to NID 0x06 which has no volume control. Set connection list/preferred connections is required to gain volume control. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=3D208555 Signed-off-by: Philipp Jungkamp Cc: Link: https://lore.kernel.org/r/20220729162103.6062-1-p.jungkamp@gmx.net Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 109 +++++++++++++++++++++++++++++++++++++= +++++ 1 file changed, 109 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6839,6 +6839,43 @@ static void alc_fixup_dell4_mic_no_prese } } =20 +static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec, + const struct hda_fixup *fix, int action) +{ + /* + * The Pin Complex 0x17 for the bass speakers is wrongly reported as + * unconnected. + */ + static const struct hda_pintbl pincfgs[] =3D { + { 0x17, 0x90170121 }, + { } + }; + /* + * Avoid DAC 0x06 and 0x08, as they have no volume controls. + * DAC 0x02 and 0x03 would be fine. + */ + static const hda_nid_t conn[] =3D { 0x02, 0x03 }; + /* + * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DA= C 0x02. + * Headphones (0x21) are connected to DAC 0x03. + */ + static const hda_nid_t preferred_pairs[] =3D { + 0x14, 0x02, + 0x17, 0x02, + 0x21, 0x03, + 0 + }; + struct alc_spec *spec =3D codec->spec; + + switch (action) { + case HDA_FIXUP_ACT_PRE_PROBE: + snd_hda_apply_pincfgs(codec, pincfgs); + snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); + spec->gen.preferred_dacs =3D preferred_pairs; + break; + } +} + enum { ALC269_FIXUP_GPIO2, ALC269_FIXUP_SONY_VAIO, @@ -7075,6 +7112,8 @@ enum { ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED, ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED, ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE, + ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK, + ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, }; =20 /* A special fixup for Lenovo C940 and Yoga Duet 7; @@ -8917,6 +8956,74 @@ static const struct hda_fixup alc269_fix .chained =3D true, .chain_id =3D ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC }, + [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] =3D { + .type =3D HDA_FIXUP_VERBS, + .v.verbs =3D (const struct hda_verb[]) { + // enable left speaker + { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x41 }, + + { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0xc }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x1a }, + { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, + + { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0xf }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x42 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, + + { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x10 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x40 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, + + { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, + + // enable right speaker + { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x46 }, + + { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0xc }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x2a }, + { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, + + { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0xf }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x46 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, + + { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x10 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x44 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, + + { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, + + { }, + }, + }, + [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] =3D { + .type =3D HDA_FIXUP_FUNC, + .v.func =3D alc287_fixup_yoga9_14iap7_bass_spk_pin, + .chained =3D true, + .chain_id =3D ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK, + }, }; =20 static const struct snd_pci_quirk alc269_fixup_tbl[] =3D { @@ -9370,6 +9477,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET= _MIC), SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET= _MIC), SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_= THINKSTATION_P340), + SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_1= 4IAP7_BASS_SPK_PIN), SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga DuetITL 2021", ALC287_FIXUP_YO= GA7_14ITL_SPEAKERS), SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_1= 5IMHG05_SPEAKERS), SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_L= ENOVO_C940_DUET7), @@ -9615,6 +9723,7 @@ static const struct hda_model_fixup alc2 {.id =3D ALC285_FIXUP_HP_SPECTRE_X360, .name =3D "alc285-hp-spectre-x360"= }, {.id =3D ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name =3D "alc285-hp-spectre-x= 360-eb1"}, {.id =3D ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name =3D "alc287-ideapad-bas= s-spk-amp"}, + {.id =3D ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name =3D "alc287-yoga9-= bass-spk-pin"}, {.id =3D ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name =3D "alc623-lenovo-= thinkstation-p340"}, {.id =3D ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name =3D "alc255-acer-head= phone-and-mic"}, {.id =3D ALC285_FIXUP_HP_GPIO_AMP_INIT, .name =3D "alc285-hp-amp-init"}, From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBDA0C00140 for ; Mon, 15 Aug 2022 20:05:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344022AbiHOUFh (ORCPT ); Mon, 15 Aug 2022 16:05:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244283AbiHOUEm (ORCPT ); Mon, 15 Aug 2022 16:04:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 325587FE7A; Mon, 15 Aug 2022 11:54:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6025F61232; Mon, 15 Aug 2022 18:54:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EC34C433C1; Mon, 15 Aug 2022 18:54:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589673; bh=A2T5wdmGF4aULUtI8KpEZm75T/Ycw//PdyT8oKjiM4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JnRWLv5RbCsElQMzGykShcNxcWJjY1OhPB9bB+N2QkUJZthXWSr3wea6uv6DIu0Dn 7YwV3ItlhYN8b0ni2Dqqh95lJ5ceDh2JsrxSOS2eIgoStWKUKb5Jzl+MlZ1K3vtaD7 fQR52G8eRdNXIz8Xm/oaxIusTc256RVyeaOkLfaA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syed sabakareem , Mario Limonciello , David Korth , Mark Brown Subject: [PATCH 5.18 0013/1095] ASoC: amd: yc: Update DMI table entries Date: Mon, 15 Aug 2022 19:50:12 +0200 Message-Id: <20220815180429.877047670@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: syed sabakareem commit be0aa8d4b0fcb4532bf7973141e911998ab39508 upstream. Removed intel DMI product id's 21AW/21AX/21D8/21D9/21BN/21BQ in DMI table and updated DMI entry for AMD platform X13 Gen 3 platform 21CM/21CN. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216267 Signed-off-by: syed sabakareem Reviewed-by: Mario Limonciello Reported-by: David Korth Fixes: fa991481b8b2 ("ASoC: amd: add YC machine driver using dmic") Link: https://lore.kernel.org/r/20220722134603.316668-1-Syed.SabaKareem@amd= .com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/amd/yc/acp6x-mach.c | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) --- a/sound/soc/amd/yc/acp6x-mach.c +++ b/sound/soc/amd/yc/acp6x-mach.c @@ -104,28 +104,14 @@ static const struct dmi_system_id yc_acp .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), - DMI_MATCH(DMI_PRODUCT_NAME, "21AW"), + DMI_MATCH(DMI_PRODUCT_NAME, "21CM"), } }, { .driver_data =3D &acp6x_card, .matches =3D { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), - DMI_MATCH(DMI_PRODUCT_NAME, "21AX"), - } - }, - { - .driver_data =3D &acp6x_card, - .matches =3D { - DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), - DMI_MATCH(DMI_PRODUCT_NAME, "21BN"), - } - }, - { - .driver_data =3D &acp6x_card, - .matches =3D { - DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), - DMI_MATCH(DMI_PRODUCT_NAME, "21BQ"), + DMI_MATCH(DMI_PRODUCT_NAME, "21CN"), } }, { @@ -156,20 +142,6 @@ static const struct dmi_system_id yc_acp DMI_MATCH(DMI_PRODUCT_NAME, "21CL"), } }, - { - .driver_data =3D &acp6x_card, - .matches =3D { - DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), - DMI_MATCH(DMI_PRODUCT_NAME, "21D8"), - } - }, - { - .driver_data =3D &acp6x_card, - .matches =3D { - DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), - DMI_MATCH(DMI_PRODUCT_NAME, "21D9"), - } - }, {} }; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34838C25B0E for ; Mon, 15 Aug 2022 20:07:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241127AbiHOUHG (ORCPT ); Mon, 15 Aug 2022 16:07:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240027AbiHOUFS (ORCPT ); Mon, 15 Aug 2022 16:05:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0D9180490; Mon, 15 Aug 2022 11:54:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8E3D56125D; Mon, 15 Aug 2022 18:54:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8139AC433C1; Mon, 15 Aug 2022 18:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589677; bh=gqZqvMMoU9PCHolnyKg7cH/DHSogTy0MjLC2kf95GtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SID/xHa3D7nI/xGYQ0HJuzGPEzguYC9fgwliQeL+8pA2ys+JWTv8BUKia64uPhxvq 9cBaFUSfy1LrLsyklyeMMJJ8xvwArJU90JbQug4ye6d6m6bHC2BdA9VabaYIF6GN63 veX/CFtToGW9mZYEFUw7NE9gp7h5NO7XuF+NMx9Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeongik Cha , Johannes Berg Subject: [PATCH 5.18 0014/1095] wifi: mac80211_hwsim: fix race condition in pending packet Date: Mon, 15 Aug 2022 19:50:13 +0200 Message-Id: <20220815180429.910345761@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeongik Cha commit 4ee186fa7e40ae06ebbfbad77e249e3746e14114 upstream. A pending packet uses a cookie as an unique key, but it can be duplicated because it didn't use atomic operators. And also, a pending packet can be null in hwsim_tx_info_frame_received_nl due to race condition with mac80211_hwsim_stop. For this, * Use an atomic type and operator for a cookie * Add a lock around the loop for pending packets Signed-off-by: Jeongik Cha Link: https://lore.kernel.org/r/20220704084354.3556326-1-jeongik@google.com Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/mac80211_hwsim.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -680,7 +680,7 @@ struct mac80211_hwsim_data { bool ps_poll_pending; struct dentry *debugfs; =20 - uintptr_t pending_cookie; + atomic64_t pending_cookie; struct sk_buff_head pending; /* packets pending */ /* * Only radios in the same group can communicate together (the @@ -1347,7 +1347,7 @@ static void mac80211_hwsim_tx_frame_nl(s int i; struct hwsim_tx_rate tx_attempts[IEEE80211_TX_MAX_RATES]; struct hwsim_tx_rate_flag tx_attempts_flags[IEEE80211_TX_MAX_RATES]; - uintptr_t cookie; + u64 cookie; =20 if (data->ps !=3D PS_DISABLED) hdr->frame_control |=3D cpu_to_le16(IEEE80211_FCTL_PM); @@ -1416,8 +1416,7 @@ static void mac80211_hwsim_tx_frame_nl(s goto nla_put_failure; =20 /* We create a cookie to identify this skb */ - data->pending_cookie++; - cookie =3D data->pending_cookie; + cookie =3D (u64)atomic64_inc_return(&data->pending_cookie); info->rate_driver_data[0] =3D (void *)cookie; if (nla_put_u64_64bit(skb, HWSIM_ATTR_COOKIE, cookie, HWSIM_ATTR_PAD)) goto nla_put_failure; @@ -4080,6 +4079,7 @@ static int hwsim_tx_info_frame_received_ const u8 *src; unsigned int hwsim_flags; int i; + unsigned long flags; bool found =3D false; =20 if (!info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER] || @@ -4107,18 +4107,20 @@ static int hwsim_tx_info_frame_received_ } =20 /* look for the skb matching the cookie passed back from user */ + spin_lock_irqsave(&data2->pending.lock, flags); skb_queue_walk_safe(&data2->pending, skb, tmp) { u64 skb_cookie; =20 txi =3D IEEE80211_SKB_CB(skb); - skb_cookie =3D (u64)(uintptr_t)txi->rate_driver_data[0]; + skb_cookie =3D (u64)txi->rate_driver_data[0]; =20 if (skb_cookie =3D=3D ret_skb_cookie) { - skb_unlink(skb, &data2->pending); + __skb_unlink(skb, &data2->pending); found =3D true; break; } } + spin_unlock_irqrestore(&data2->pending.lock, flags); =20 /* not found */ if (!found) From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7723C00140 for ; Mon, 15 Aug 2022 20:07:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239719AbiHOUHB (ORCPT ); Mon, 15 Aug 2022 16:07:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231231AbiHOUEv (ORCPT ); Mon, 15 Aug 2022 16:04:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28E22804AA; Mon, 15 Aug 2022 11:54:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4AE24B810A0; Mon, 15 Aug 2022 18:54:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B9CCC433C1; Mon, 15 Aug 2022 18:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589680; bh=hFyo2XgHTNhpFAos2x6onS2Xb8rlO70wxV1epeC4aZ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kgOV8c9iKHI6+8SaOxA0eYbE4ZjaDpSN9VU1ZYjqHTDMMXJYzpLdUuRJfFPkAEfWc wXBB0CTVPpqRAChde//8YhLMCBZhtgf/NLmZ88Yl8dmhVHCnWvJNUbmm41OrcDRm3o +73vrN2OxkxqFPHQMK+6B1AyXCCYQOaYfHbzWys0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Johannes Berg , Jeongik Cha Subject: [PATCH 5.18 0015/1095] wifi: mac80211_hwsim: add back erroneously removed cast Date: Mon, 15 Aug 2022 19:50:14 +0200 Message-Id: <20220815180429.957757907@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg commit 58b6259d820d63c2adf1c7541b54cce5a2ae6073 upstream. The robots report that we're now casting to a differently sized integer, which is correct, and the previous patch had erroneously removed it. Reported-by: kernel test robot Fixes: 4ee186fa7e40 ("wifi: mac80211_hwsim: fix race condition in pending p= acket") Signed-off-by: Johannes Berg Cc: Jeongik Cha Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/mac80211_hwsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -4112,7 +4112,7 @@ static int hwsim_tx_info_frame_received_ u64 skb_cookie; =20 txi =3D IEEE80211_SKB_CB(skb); - skb_cookie =3D (u64)txi->rate_driver_data[0]; + skb_cookie =3D (u64)(uintptr_t)txi->rate_driver_data[0]; =20 if (skb_cookie =3D=3D ret_skb_cookie) { __skb_unlink(skb, &data2->pending); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13202C00140 for ; Mon, 15 Aug 2022 20:07:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242253AbiHOUHK (ORCPT ); Mon, 15 Aug 2022 16:07:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239498AbiHOUFR (ORCPT ); Mon, 15 Aug 2022 16:05:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C75C8050B; Mon, 15 Aug 2022 11:54:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9D83D611ED; Mon, 15 Aug 2022 18:54:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A51A9C433D6; Mon, 15 Aug 2022 18:54:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589683; bh=XMq0FBzvSm4d8cWudGci6m9/G5bGsS5YAQg6qKRSLiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=08GVdfU/QzjeWZ+cQ+emkV+rvqs3ogLjdiC+74yHOLpBOpzZVpAZXB14piDQOs/NL RnLUBTH4nLodE8ZY7WMxj8aTsAWAc4lge4z8z6uNv8yGfhjg/U1n31B6yVlqtJb5LA EmrCnX+PIEpzRNuFJq0eM9j8yFyiCxiAKfPA1phg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Jeongik Cha Subject: [PATCH 5.18 0016/1095] wifi: mac80211_hwsim: use 32-bit skb cookie Date: Mon, 15 Aug 2022 19:50:15 +0200 Message-Id: <20220815180430.006130243@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg commit cc5250cdb43d444061412df7fae72d2b4acbdf97 upstream. We won't really have enough skbs to need a 64-bit cookie, and on 32-bit platforms storing the 64-bit cookie into the void *rate_driver_data doesn't work anyway. Switch back to using just a 32-bit cookie and uintptr_t for the type to avoid compiler warnings about all this. Fixes: 4ee186fa7e40 ("wifi: mac80211_hwsim: fix race condition in pending p= acket") Signed-off-by: Johannes Berg Cc: Jeongik Cha Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/mac80211_hwsim.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -680,7 +680,7 @@ struct mac80211_hwsim_data { bool ps_poll_pending; struct dentry *debugfs; =20 - atomic64_t pending_cookie; + atomic_t pending_cookie; struct sk_buff_head pending; /* packets pending */ /* * Only radios in the same group can communicate together (the @@ -1347,7 +1347,7 @@ static void mac80211_hwsim_tx_frame_nl(s int i; struct hwsim_tx_rate tx_attempts[IEEE80211_TX_MAX_RATES]; struct hwsim_tx_rate_flag tx_attempts_flags[IEEE80211_TX_MAX_RATES]; - u64 cookie; + uintptr_t cookie; =20 if (data->ps !=3D PS_DISABLED) hdr->frame_control |=3D cpu_to_le16(IEEE80211_FCTL_PM); @@ -1416,7 +1416,7 @@ static void mac80211_hwsim_tx_frame_nl(s goto nla_put_failure; =20 /* We create a cookie to identify this skb */ - cookie =3D (u64)atomic64_inc_return(&data->pending_cookie); + cookie =3D atomic_inc_return(&data->pending_cookie); info->rate_driver_data[0] =3D (void *)cookie; if (nla_put_u64_64bit(skb, HWSIM_ATTR_COOKIE, cookie, HWSIM_ATTR_PAD)) goto nla_put_failure; @@ -4109,10 +4109,10 @@ static int hwsim_tx_info_frame_received_ /* look for the skb matching the cookie passed back from user */ spin_lock_irqsave(&data2->pending.lock, flags); skb_queue_walk_safe(&data2->pending, skb, tmp) { - u64 skb_cookie; + uintptr_t skb_cookie; =20 txi =3D IEEE80211_SKB_CB(skb); - skb_cookie =3D (u64)(uintptr_t)txi->rate_driver_data[0]; + skb_cookie =3D (uintptr_t)txi->rate_driver_data[0]; =20 if (skb_cookie =3D=3D ret_skb_cookie) { __skb_unlink(skb, &data2->pending); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EA8EC00140 for ; Mon, 15 Aug 2022 20:07:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243299AbiHOUHO (ORCPT ); Mon, 15 Aug 2022 16:07:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244080AbiHOUFn (ORCPT ); Mon, 15 Aug 2022 16:05:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B23968050D; Mon, 15 Aug 2022 11:54:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CEE5861029; Mon, 15 Aug 2022 18:54:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B133CC433D6; Mon, 15 Aug 2022 18:54:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589686; bh=qpyjHBlNmvh5qz8ZjsmPzt6EGeEiWMCvxwoRJDS94vo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=juQNrNZSTQ9pcxyiFMcpimCcn3AuqdoWRaB9IfsuJ+oxfYS5SM5HmN04KVxHjvuU/ vyYWEHlBpcs3HPYIlZ/kJq+2h4MkoN+uWsWd1DXZFZJ2NOtthjA361w6O8s+rcId0I DBN2e/d1w5EEq0R4wfg18D3NzG2cLwZBI1l3JyWg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , "Matthew Wilcox (Oracle)" , Linus Torvalds Subject: [PATCH 5.18 0017/1095] add barriers to buffer_uptodate and set_buffer_uptodate Date: Mon, 15 Aug 2022 19:50:16 +0200 Message-Id: <20220815180430.048003332@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka commit d4252071b97d2027d246f6a82cbee4d52f618b47 upstream. Let's have a look at this piece of code in __bread_slow: get_bh(bh); bh->b_end_io =3D end_buffer_read_sync; submit_bh(REQ_OP_READ, 0, bh); wait_on_buffer(bh); if (buffer_uptodate(bh)) return bh; Neither wait_on_buffer nor buffer_uptodate contain any memory barrier. Consequently, if someone calls sb_bread and then reads the buffer data, the read of buffer data may be executed before wait_on_buffer(bh) on architectures with weak memory ordering and it may return invalid data. Fix this bug by adding a memory barrier to set_buffer_uptodate and an acquire barrier to buffer_uptodate (in a similar way as folio_test_uptodate and folio_mark_uptodate). Signed-off-by: Mikulas Patocka Reviewed-by: Matthew Wilcox (Oracle) Cc: stable@vger.kernel.org Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/buffer_head.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -117,7 +117,6 @@ static __always_inline int test_clear_bu * of the form "mark_buffer_foo()". These are higher-level functions which * do something in addition to setting a b_state bit. */ -BUFFER_FNS(Uptodate, uptodate) BUFFER_FNS(Dirty, dirty) TAS_BUFFER_FNS(Dirty, dirty) BUFFER_FNS(Lock, locked) @@ -135,6 +134,30 @@ BUFFER_FNS(Meta, meta) BUFFER_FNS(Prio, prio) BUFFER_FNS(Defer_Completion, defer_completion) =20 +static __always_inline void set_buffer_uptodate(struct buffer_head *bh) +{ + /* + * make it consistent with folio_mark_uptodate + * pairs with smp_load_acquire in buffer_uptodate + */ + smp_mb__before_atomic(); + set_bit(BH_Uptodate, &bh->b_state); +} + +static __always_inline void clear_buffer_uptodate(struct buffer_head *bh) +{ + clear_bit(BH_Uptodate, &bh->b_state); +} + +static __always_inline int buffer_uptodate(const struct buffer_head *bh) +{ + /* + * make it consistent with folio_test_uptodate + * pairs with smp_mb__before_atomic in set_buffer_uptodate + */ + return (smp_load_acquire(&bh->b_state) & (1UL << BH_Uptodate)) !=3D 0; +} + #define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) =20 /* If we *know* page->private refers to buffer_heads */ From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BCDBC00140 for ; Mon, 15 Aug 2022 20:07:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242336AbiHOUH2 (ORCPT ); Mon, 15 Aug 2022 16:07:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345997AbiHOUFz (ORCPT ); Mon, 15 Aug 2022 16:05:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE5E880F73; Mon, 15 Aug 2022 11:54:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5176BB810A0; Mon, 15 Aug 2022 18:54:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B921C433C1; Mon, 15 Aug 2022 18:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589690; bh=2aMAS6nnDE24Xxc3BAWnHHAWPjrQi/Hpa0MkJi+LjSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dno4jnR6SlUp2YUQG245vrG4siDJafxSjea1TMs3LxAUWiPvGraXhuBgEG3S8/LUg jl4KNl1hzHsUZbu4ZaZbNMCoSw0ctjqYRpu685LuIhShL5GyIG9HEQdsY4PM59xHWa QJcQMlLKycjyzvZzG+43vVQrVgNzTr1clRt5vPr4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kasiak , Jeff Layton , Chuck Lever Subject: [PATCH 5.18 0018/1095] lockd: detect and reject lock arguments that overflow Date: Mon, 15 Aug 2022 19:50:17 +0200 Message-Id: <20220815180430.097981703@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff Layton commit 6930bcbfb6ceda63e298c6af6d733ecdf6bd4cde upstream. lockd doesn't currently vet the start and length in nlm4 requests like it should, and can end up generating lock requests with arguments that overflow when passed to the filesystem. The NLM4 protocol uses unsigned 64-bit arguments for both start and length, whereas struct file_lock tracks the start and end as loff_t values. By the time we get around to calling nlm4svc_retrieve_args, we've lost the information that would allow us to determine if there was an overflow. Start tracking the actual start and len for NLM4 requests in the nlm_lock. In nlm4svc_retrieve_args, vet these values to ensure they won't cause an overflow, and return NLM4_FBIG if they do. Link: https://bugzilla.linux-nfs.org/show_bug.cgi?id=3D392 Reported-by: Jan Kasiak Signed-off-by: Jeff Layton Signed-off-by: Chuck Lever Cc: # 5.14+ Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/lockd/svc4proc.c | 8 ++++++++ fs/lockd/xdr4.c | 19 ++----------------- include/linux/lockd/xdr.h | 2 ++ 3 files changed, 12 insertions(+), 17 deletions(-) --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c @@ -32,6 +32,10 @@ nlm4svc_retrieve_args(struct svc_rqst *r if (!nlmsvc_ops) return nlm_lck_denied_nolocks; =20 + if (lock->lock_start > OFFSET_MAX || + (lock->lock_len && ((lock->lock_len - 1) > (OFFSET_MAX - lock->lock_s= tart)))) + return nlm4_fbig; + /* Obtain host handle */ if (!(host =3D nlmsvc_lookup_host(rqstp, lock->caller, lock->len)) || (argp->monitor && nsm_monitor(host) < 0)) @@ -50,6 +54,10 @@ nlm4svc_retrieve_args(struct svc_rqst *r /* Set up the missing parts of the file_lock structure */ lock->fl.fl_file =3D file->f_file[mode]; lock->fl.fl_pid =3D current->tgid; + lock->fl.fl_start =3D (loff_t)lock->lock_start; + lock->fl.fl_end =3D lock->lock_len ? + (loff_t)(lock->lock_start + lock->lock_len - 1) : + OFFSET_MAX; lock->fl.fl_lmops =3D &nlmsvc_lock_operations; nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid); if (!lock->fl.fl_owner) { --- a/fs/lockd/xdr4.c +++ b/fs/lockd/xdr4.c @@ -20,13 +20,6 @@ =20 #include "svcxdr.h" =20 -static inline loff_t -s64_to_loff_t(__s64 offset) -{ - return (loff_t)offset; -} - - static inline s64 loff_t_to_s64(loff_t offset) { @@ -70,8 +63,6 @@ static bool svcxdr_decode_lock(struct xdr_stream *xdr, struct nlm_lock *lock) { struct file_lock *fl =3D &lock->fl; - u64 len, start; - s64 end; =20 if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len)) return false; @@ -81,20 +72,14 @@ svcxdr_decode_lock(struct xdr_stream *xd return false; if (xdr_stream_decode_u32(xdr, &lock->svid) < 0) return false; - if (xdr_stream_decode_u64(xdr, &start) < 0) + if (xdr_stream_decode_u64(xdr, &lock->lock_start) < 0) return false; - if (xdr_stream_decode_u64(xdr, &len) < 0) + if (xdr_stream_decode_u64(xdr, &lock->lock_len) < 0) return false; =20 locks_init_lock(fl); fl->fl_flags =3D FL_POSIX; fl->fl_type =3D F_RDLCK; - end =3D start + len - 1; - fl->fl_start =3D s64_to_loff_t(start); - if (len =3D=3D 0 || end < 0) - fl->fl_end =3D OFFSET_MAX; - else - fl->fl_end =3D s64_to_loff_t(end); =20 return true; } --- a/include/linux/lockd/xdr.h +++ b/include/linux/lockd/xdr.h @@ -41,6 +41,8 @@ struct nlm_lock { struct nfs_fh fh; struct xdr_netobj oh; u32 svid; + u64 lock_start; + u64 lock_len; struct file_lock fl; }; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEF2FC00140 for ; Mon, 15 Aug 2022 20:07:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243454AbiHOUHU (ORCPT ); Mon, 15 Aug 2022 16:07:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345945AbiHOUFv (ORCPT ); Mon, 15 Aug 2022 16:05:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1612547B9B; Mon, 15 Aug 2022 11:54:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 623C6B810C5; Mon, 15 Aug 2022 18:54:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE5FAC433D6; Mon, 15 Aug 2022 18:54:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589693; bh=s9bXR2LcdQjUHgWzlKWD/cjyM09nvznL3+43Lz274b4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fFDSfh+B9SM9sx8Yvqqcl26oogsvqOKgNi/wIC+uscvWbShDEcPfUH4Z3F20wI1JZ dKfN93J4iWuonFa2pgvZevgIM9BC4d5NkxNRG7LVNqvFZjEMfiqllokNyMtZoN05Yg a7DlKyx8oPmlcDdN7bmr8rhnxJQSon1H8Zmmp5BU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maximilian Luz , Jiri Kosina Subject: [PATCH 5.18 0019/1095] HID: hid-input: add Surface Go battery quirk Date: Mon, 15 Aug 2022 19:50:18 +0200 Message-Id: <20220815180430.139759532@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maximilian Luz commit db925d809011c37b246434fdce71209fc2e6c0c2 upstream. Similar to the Surface Go (1), the (Elantech) touchscreen/digitizer in the Surface Go 2 mistakenly reports the battery of the stylus. Instead of over the touchscreen device, battery information is provided via bluetooth and the touchscreen device reports an empty battery. Apply the HID_BATTERY_QUIRK_IGNORE quirk to ignore this battery and prevent the erroneous low battery warnings. Cc: stable@vger.kernel.org Signed-off-by: Maximilian Luz Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-input.c | 2 ++ 2 files changed, 3 insertions(+) --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -413,6 +413,7 @@ #define USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN 0x2544 #define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706 #define I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN 0x261A +#define I2C_DEVICE_ID_SURFACE_GO2_TOUCHSCREEN 0x2A1C =20 #define USB_VENDOR_ID_ELECOM 0x056e #define USB_DEVICE_ID_ELECOM_BM084 0x0061 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -381,6 +381,8 @@ static const struct hid_device_id hid_ba HID_BATTERY_QUIRK_IGNORE }, { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN= ), HID_BATTERY_QUIRK_IGNORE }, + { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_SURFACE_GO2_TOUCHSCREE= N), + HID_BATTERY_QUIRK_IGNORE }, {} }; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E88DEC00140 for ; Mon, 15 Aug 2022 20:07:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230136AbiHOUHm (ORCPT ); Mon, 15 Aug 2022 16:07:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346058AbiHOUGA (ORCPT ); Mon, 15 Aug 2022 16:06:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9843481B02; Mon, 15 Aug 2022 11:55:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 45FC8B8105C; Mon, 15 Aug 2022 18:55:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0CA0C433D7; Mon, 15 Aug 2022 18:54:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589699; bh=4WBlhzPsjfVj1rRFmuAP5awjPtNhQi4gcsTz5aOQEgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aWYApASO/dsnHAGhXRDvtJqaIwS5Lt5xu7YLNjsRz/eL2uk3Yt2gnBYNQ9lDmwjNk zprJ43RM9OPS6vTor4MTGrDNJpRSE8Yrx0i/IiCA3teCve+BP+gOfKi+ST8vI7ZmTp HcsmEu6eufxyFDSb3bU5Gm28lqbg95/JCjClx8fs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Daniel J. Ogorchock" , Guenter Roeck , Dmitry Torokhov , Jiri Kosina Subject: [PATCH 5.18 0020/1095] HID: nintendo: Add missing array termination Date: Mon, 15 Aug 2022 19:50:19 +0200 Message-Id: <20220815180430.187702863@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guenter Roeck commit ab5f3404b7762b88403fbddbdda6b1b464bd6cbc upstream. joycon_dpad_inputs_jc[] is unterminated. This may result in odd warnings such as input: input_set_capability: invalid code 3077588140 for type 1 or in kernel crashes in nintendo_hid_probe(). Terminate the array to fix the problem. Fixes: 2af16c1f846bd ("HID: nintendo: add nintendo switch controller driver= ") Cc: Daniel J. Ogorchock Signed-off-by: Guenter Roeck Reviewed-by: Dmitry Torokhov Cc: stable@vger.kernel.org Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hid/hid-nintendo.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/hid/hid-nintendo.c +++ b/drivers/hid/hid-nintendo.c @@ -1586,6 +1586,7 @@ static const unsigned int joycon_button_ /* We report joy-con d-pad inputs as buttons and pro controller as a hat. = */ static const unsigned int joycon_dpad_inputs_jc[] =3D { BTN_DPAD_UP, BTN_DPAD_DOWN, BTN_DPAD_LEFT, BTN_DPAD_RIGHT, + 0 /* 0 signals end of array */ }; =20 static int joycon_input_create(struct joycon_ctlr *ctlr) From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 679BAC00140 for ; Mon, 15 Aug 2022 20:07:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231255AbiHOUHw (ORCPT ); Mon, 15 Aug 2022 16:07:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346239AbiHOUGT (ORCPT ); Mon, 15 Aug 2022 16:06:19 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3824F81B23; Mon, 15 Aug 2022 11:55:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id D8D90CE1277; Mon, 15 Aug 2022 18:55:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0B10C433C1; Mon, 15 Aug 2022 18:55:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589702; bh=llpMxHGJXWP5cf7sbBkd+Qs7oAxQTdYK6TfLN8Q4UGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W9bib26XbqEtKdeUdCbNdlNK7pzPAQ0oos6O1T0etLamGVaz2zF0TkviN0K4xhXNg buEeEfSIiq36iE3xb+O4SAj9dqV5bdEbBX1w0HWNczjznZ/MfmbbeJNdtd6Bq8cpoW 53aeL3rAvuOYeiS1oEFSmgOfRy2+zEtFn6WJSv2Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ping Cheng , Jason Gerecke , Jiri Kosina Subject: [PATCH 5.18 0021/1095] HID: wacom: Only report rotation for art pen Date: Mon, 15 Aug 2022 19:50:20 +0200 Message-Id: <20220815180430.226829268@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ping Cheng commit 7ccced33a0ba39b0103ae1dfbf7f1dffdc0a1bc2 upstream. The generic routine, wacom_wac_pen_event, turns rotation value 90 degree anti-clockwise before posting the events. This non-zero event trggers a non-zero ABS_Z event for non art pen tools. However, HID_DG_TWIST is only supported by art pen. [jkosina@suse.cz: fix build: add missing brace] Cc: stable@vger.kernel.org Signed-off-by: Ping Cheng Reviewed-by: Jason Gerecke Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hid/wacom_wac.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -638,9 +638,26 @@ static int wacom_intuos_id_mangle(int to return (tool_id & ~0xFFF) << 4 | (tool_id & 0xFFF); } =20 +static bool wacom_is_art_pen(int tool_id) +{ + bool is_art_pen =3D false; + + switch (tool_id) { + case 0x885: /* Intuos3 Marker Pen */ + case 0x804: /* Intuos4/5 13HD/24HD Marker Pen */ + case 0x10804: /* Intuos4/5 13HD/24HD Art Pen */ + is_art_pen =3D true; + break; + } + return is_art_pen; +} + static int wacom_intuos_get_tool_type(int tool_id) { - int tool_type; + int tool_type =3D BTN_TOOL_PEN; + + if (wacom_is_art_pen(tool_id)) + return tool_type; =20 switch (tool_id) { case 0x812: /* Inking pen */ @@ -655,12 +672,9 @@ static int wacom_intuos_get_tool_type(in case 0x852: case 0x823: /* Intuos3 Grip Pen */ case 0x813: /* Intuos3 Classic Pen */ - case 0x885: /* Intuos3 Marker Pen */ case 0x802: /* Intuos4/5 13HD/24HD General Pen */ - case 0x804: /* Intuos4/5 13HD/24HD Marker Pen */ case 0x8e2: /* IntuosHT2 pen */ case 0x022: - case 0x10804: /* Intuos4/5 13HD/24HD Art Pen */ case 0x10842: /* MobileStudio Pro Pro Pen slim */ case 0x14802: /* Intuos4/5 13HD/24HD Classic Pen */ case 0x16802: /* Cintiq 13HD Pro Pen */ @@ -718,10 +732,6 @@ static int wacom_intuos_get_tool_type(in case 0x10902: /* Intuos4/5 13HD/24HD Airbrush */ tool_type =3D BTN_TOOL_AIRBRUSH; break; - - default: /* Unknown tool */ - tool_type =3D BTN_TOOL_PEN; - break; } return tool_type; } @@ -2323,6 +2333,9 @@ static void wacom_wac_pen_event(struct h } return; case HID_DG_TWIST: + /* don't modify the value if the pen doesn't support the feature */ + if (!wacom_is_art_pen(wacom_wac->id[0])) return; + /* * Userspace expects pen twist to have its zero point when * the buttons/finger is on the tablet's left. HID values From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4D50C25B0E for ; Mon, 15 Aug 2022 20:08:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343772AbiHOUII (ORCPT ); Mon, 15 Aug 2022 16:08:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346304AbiHOUG0 (ORCPT ); Mon, 15 Aug 2022 16:06:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 935DA80F77; Mon, 15 Aug 2022 11:55:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 514B9611ED; Mon, 15 Aug 2022 18:55:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFF3FC433D6; Mon, 15 Aug 2022 18:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589705; bh=Midk8NCdapzF7mpuCT2GeB9SbLt2pycW50mobOPAZLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KCxe2JvPTYKbbRZ/tIO8nKi9DSao1464uaTPMdV+vfpigSCz5gtrRkVJN/2dZRc1N UXe+P6V8z5FRXtbm+hvu9OU/LgNZyXr0fnwX8l7FBFtLSWBcPJGKFpv7h4EIzlC237 +ZpDVjKsq02v3S+AmzlKziyQM7WhH6vza623h68E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ping Cheng , Jason Gerecke , Jiri Kosina Subject: [PATCH 5.18 0022/1095] HID: wacom: Dont register pad_input for touch switch Date: Mon, 15 Aug 2022 19:50:21 +0200 Message-Id: <20220815180430.271523309@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ping Cheng commit d6b675687a4ab4dba684716d97c8c6f81bf10905 upstream. Touch switch state is received through WACOM_PAD_FIELD. However, it is reported by touch_input. Don't register pad_input if no other pad events require the interface. Cc: stable@vger.kernel.org Signed-off-by: Ping Cheng Reviewed-by: Jason Gerecke Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hid/wacom_sys.c | 2 +- drivers/hid/wacom_wac.c | 43 +++++++++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 19 deletions(-) --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -2121,7 +2121,7 @@ static int wacom_register_inputs(struct =20 error =3D wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac); if (error) { - /* no pad in use on this interface */ + /* no pad events using this interface */ input_free_device(pad_input_dev); wacom_wac->pad_input =3D NULL; pad_input_dev =3D NULL; --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2017,7 +2017,6 @@ static void wacom_wac_pad_usage_mapping( wacom_wac->has_mute_touch_switch =3D true; usage->type =3D EV_SW; usage->code =3D SW_MUTE_DEVICE; - features->device_type |=3D WACOM_DEVICETYPE_PAD; break; case WACOM_HID_WD_TOUCHSTRIP: wacom_map_usage(input, usage, field, EV_ABS, ABS_RX, 0); @@ -2097,6 +2096,30 @@ static void wacom_wac_pad_event(struct h wacom_wac->hid_data.inrange_state |=3D value; } =20 + /* Process touch switch state first since it is reported through touch in= terface, + * which is indepentent of pad interface. In the case when there are no o= ther pad + * events, the pad interface will not even be created. + */ + if ((equivalent_usage =3D=3D WACOM_HID_WD_MUTE_DEVICE) || + (equivalent_usage =3D=3D WACOM_HID_WD_TOUCHONOFF)) { + if (wacom_wac->shared->touch_input) { + bool *is_touch_on =3D &wacom_wac->shared->is_touch_on; + + if (equivalent_usage =3D=3D WACOM_HID_WD_MUTE_DEVICE && value) + *is_touch_on =3D !(*is_touch_on); + else if (equivalent_usage =3D=3D WACOM_HID_WD_TOUCHONOFF) + *is_touch_on =3D value; + + input_report_switch(wacom_wac->shared->touch_input, + SW_MUTE_DEVICE, !(*is_touch_on)); + input_sync(wacom_wac->shared->touch_input); + } + return; + } + + if (!input) + return; + switch (equivalent_usage) { case WACOM_HID_WD_TOUCHRING: /* @@ -2132,22 +2155,6 @@ static void wacom_wac_pad_event(struct h input_event(input, usage->type, usage->code, 0); break; =20 - case WACOM_HID_WD_MUTE_DEVICE: - case WACOM_HID_WD_TOUCHONOFF: - if (wacom_wac->shared->touch_input) { - bool *is_touch_on =3D &wacom_wac->shared->is_touch_on; - - if (equivalent_usage =3D=3D WACOM_HID_WD_MUTE_DEVICE && value) - *is_touch_on =3D !(*is_touch_on); - else if (equivalent_usage =3D=3D WACOM_HID_WD_TOUCHONOFF) - *is_touch_on =3D value; - - input_report_switch(wacom_wac->shared->touch_input, - SW_MUTE_DEVICE, !(*is_touch_on)); - input_sync(wacom_wac->shared->touch_input); - } - break; - case WACOM_HID_WD_MODE_CHANGE: if (wacom_wac->is_direct_mode !=3D value) { wacom_wac->is_direct_mode =3D value; @@ -2808,7 +2815,7 @@ void wacom_wac_event(struct hid_device * /* usage tests must precede field tests */ if (WACOM_BATTERY_USAGE(usage)) wacom_wac_battery_event(hdev, field, usage, value); - else if (WACOM_PAD_FIELD(field) && wacom->wacom_wac.pad_input) + else if (WACOM_PAD_FIELD(field)) wacom_wac_pad_event(hdev, field, usage, value); else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) wacom_wac_pen_event(hdev, field, usage, value); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 627FCC00140 for ; Mon, 15 Aug 2022 20:08:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241983AbiHOUIB (ORCPT ); Mon, 15 Aug 2022 16:08:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346281AbiHOUGY (ORCPT ); Mon, 15 Aug 2022 16:06:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55FC882746; Mon, 15 Aug 2022 11:55:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3C6346125F; Mon, 15 Aug 2022 18:55:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D8A4C433D6; Mon, 15 Aug 2022 18:55:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589708; bh=xk5weKLElopg822jWZDDlH2ickDhjXnskd5/YunhLns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XojDrGvC8axA0qrO2mrR2iUOQ4yV/AIQPTrbgdeVsrGt2219Ws+13K9sT5btt8xWa e9dKT+ExeDYIxj6OrtAnbwasLlalLOmPxYLO3/9YQSYIZ7rAm4ogBLF579B92OChTZ Tbahwk4JmP9uZMl8XKmTGlApiHEYOJHe9g6sWsn8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lei Wang , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.18 0023/1095] KVM: nVMX: Snapshot pre-VM-Enter BNDCFGS for !nested_run_pending case Date: Mon, 15 Aug 2022 19:50:22 +0200 Message-Id: <20220815180430.314059193@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit fa578398a0ba2c079fa1170da21fa5baae0cedb2 upstream. If a nested run isn't pending, snapshot vmcs01.GUEST_BNDCFGS irrespective of whether or not VM_ENTRY_LOAD_BNDCFGS is set in vmcs12. When restoring nested state, e.g. after migration, without a nested run pending, prepare_vmcs02() will propagate nested.vmcs01_guest_bndcfgs to vmcs02, i.e. will load garbage/zeros into vmcs02.GUEST_BNDCFGS. If userspace restores nested state before MSRs, then loading garbage is a non-issue as loading BNDCFGS will also update vmcs02. But if usersepace restores MSRs first, then KVM is responsible for propagating L2's value, which is actually thrown into vmcs01, into vmcs02. Restoring L2 MSRs into vmcs01, i.e. loading all MSRs before nested state is all kinds of bizarre and ideally would not be supported. Sadly, some VMMs do exactly that and rely on KVM to make things work. Note, there's still a lurking SMM bug, as propagating vmcs01.GUEST_BNDFGS to vmcs02 across RSM may corrupt L2's BNDCFGS. But KVM's entire VMX+SMM emulation is flawed as SMI+RSM should not toouch _any_ VMCS when use the "default treatment of SMIs", i.e. when not using an SMI Transfer Monitor. Link: https://lore.kernel.org/all/Yobt1XwOfb5M6Dfa@google.com Fixes: 62cf9bd8118c ("KVM: nVMX: Fix emulation of VM_ENTRY_LOAD_BNDCFGS") Cc: stable@vger.kernel.org Cc: Lei Wang Signed-off-by: Sean Christopherson Message-Id: <20220614215831.3762138-2-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -3381,7 +3381,8 @@ enum nvmx_vmentry_status nested_vmx_ente if (!(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS)) vmx->nested.vmcs01_debugctl =3D vmcs_read64(GUEST_IA32_DEBUGCTL); if (kvm_mpx_supported() && - !(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS)) + (!vmx->nested.nested_run_pending || + !(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS))) vmx->nested.vmcs01_guest_bndcfgs =3D vmcs_read64(GUEST_BNDCFGS); =20 /* From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 462B0C3F6B0 for ; Mon, 15 Aug 2022 20:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239942AbiHOUH6 (ORCPT ); Mon, 15 Aug 2022 16:07:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346254AbiHOUGU (ORCPT ); Mon, 15 Aug 2022 16:06:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DB2E8284C; Mon, 15 Aug 2022 11:55:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4B6516123D; Mon, 15 Aug 2022 18:55:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D879C433D7; Mon, 15 Aug 2022 18:55:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589711; bh=KWqI2ePOpoE/aKn9QsoqOkzYg6rD54Cwvqu/xPV9oCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EgXns0iL4M6bLaS/kes7kxfrAvG2hq4oINMeDUmaxxQMNW7q3inwWt5GsbHd3svZt haLktkeEE/8/Pgt3+K66qCYG9MstdMxcY9r4fRCxSPay3OG+D7KDbtyqnj4gGfC5kl Gl/HnkECv+4k9QRCDQ5DDHeRcuRLvnUVtcYQh1nQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.18 0024/1095] KVM: nVMX: Snapshot pre-VM-Enter DEBUGCTL for !nested_run_pending case Date: Mon, 15 Aug 2022 19:50:23 +0200 Message-Id: <20220815180430.362954403@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit 764643a6be07445308e492a528197044c801b3ba upstream. If a nested run isn't pending, snapshot vmcs01.GUEST_IA32_DEBUGCTL irrespective of whether or not VM_ENTRY_LOAD_DEBUG_CONTROLS is set in vmcs12. When restoring nested state, e.g. after migration, without a nested run pending, prepare_vmcs02() will propagate nested.vmcs01_debugctl to vmcs02, i.e. will load garbage/zeros into vmcs02.GUEST_IA32_DEBUGCTL. If userspace restores nested state before MSRs, then loading garbage is a non-issue as loading DEBUGCTL will also update vmcs02. But if usersepace restores MSRs first, then KVM is responsible for propagating L2's value, which is actually thrown into vmcs01, into vmcs02. Restoring L2 MSRs into vmcs01, i.e. loading all MSRs before nested state is all kinds of bizarre and ideally would not be supported. Sadly, some VMMs do exactly that and rely on KVM to make things work. Note, there's still a lurking SMM bug, as propagating vmcs01's DEBUGCTL to vmcs02 across RSM may corrupt L2's DEBUGCTL. But KVM's entire VMX+SMM emulation is flawed as SMI+RSM should not toouch _any_ VMCS when use the "default treatment of SMIs", i.e. when not using an SMI Transfer Monitor. Link: https://lore.kernel.org/all/Yobt1XwOfb5M6Dfa@google.com Fixes: 8fcc4b5923af ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220614215831.3762138-3-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -3378,7 +3378,8 @@ enum nvmx_vmentry_status nested_vmx_ente if (likely(!evaluate_pending_interrupts) && kvm_vcpu_apicv_active(vcpu)) evaluate_pending_interrupts |=3D vmx_has_apicv_interrupt(vcpu); =20 - if (!(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS)) + if (!vmx->nested.nested_run_pending || + !(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS)) vmx->nested.vmcs01_debugctl =3D vmcs_read64(GUEST_IA32_DEBUGCTL); if (kvm_mpx_supported() && (!vmx->nested.nested_run_pending || From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1FF9C00140 for ; Mon, 15 Aug 2022 20:08:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345897AbiHOUIL (ORCPT ); Mon, 15 Aug 2022 16:08:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346363AbiHOUGe (ORCPT ); Mon, 15 Aug 2022 16:06:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38EA0DC3; Mon, 15 Aug 2022 11:55:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C1BBA6123D; Mon, 15 Aug 2022 18:55:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B216CC433C1; Mon, 15 Aug 2022 18:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589715; bh=jqCkmllESG5lVOy33f/raGcUAAs+RXsT2zDA2SMd8tg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R/WA7Z0nZiwaXJvNzzfTBN4sIFGNJT2sfd15bbtv7w59iz0Ar9AdzcSQTSqKe6M3k RyHbiwycFZpO2wu1Ffs0j+5KsPd1ChMF5SKkNYFjN+q6l5dQ5pzmEHuHitvggLRKma wuHfp4cTqBjvwHCy3B3yOuSdSYGl6pMdCIhIEG1U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , "Maciej S. Szmigiero" , Paolo Bonzini Subject: [PATCH 5.18 0025/1095] KVM: SVM: Dont BUG if userspace injects an interrupt with GIF=0 Date: Mon, 15 Aug 2022 19:50:24 +0200 Message-Id: <20220815180430.395391433@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maciej S. Szmigiero commit f17c31c48e5cde9895a491d91c424eeeada3e134 upstream. Don't BUG/WARN on interrupt injection due to GIF being cleared, since it's trivial for userspace to force the situation via KVM_SET_VCPU_EVENTS (even if having at least a WARN there would be correct for KVM internally generated injections). kernel BUG at arch/x86/kvm/svm/svm.c:3386! invalid opcode: 0000 [#1] SMP CPU: 15 PID: 926 Comm: smm_test Not tainted 5.17.0-rc3+ #264 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 RIP: 0010:svm_inject_irq+0xab/0xb0 [kvm_amd] Code: <0f> 0b 0f 1f 00 0f 1f 44 00 00 80 3d ac b3 01 00 00 55 48 89 f5 53 RSP: 0018:ffffc90000b37d88 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff88810a234ac0 RCX: 0000000000000006 RDX: 0000000000000000 RSI: ffffc90000b37df7 RDI: ffff88810a234ac0 RBP: ffffc90000b37df7 R08: ffff88810a1fa410 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: ffff888109571000 R14: ffff88810a234ac0 R15: 0000000000000000 FS: 0000000001821380(0000) GS:ffff88846fdc0000(0000) knlGS:0000000000000= 000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f74fc550008 CR3: 000000010a6fe000 CR4: 0000000000350ea0 Call Trace: inject_pending_event+0x2f7/0x4c0 [kvm] kvm_arch_vcpu_ioctl_run+0x791/0x17a0 [kvm] kvm_vcpu_ioctl+0x26d/0x650 [kvm] __x64_sys_ioctl+0x82/0xb0 do_syscall_64+0x3b/0xc0 entry_SYSCALL_64_after_hwframe+0x44/0xae Fixes: 219b65dcf6c0 ("KVM: SVM: Improve nested interrupt injection") Cc: stable@vger.kernel.org Co-developed-by: Sean Christopherson Signed-off-by: Sean Christopherson Signed-off-by: Maciej S. Szmigiero Message-Id: <35426af6e123cbe91ec7ce5132ce72521f02b1b5.1651440202.git.maciej= .szmigiero@oracle.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/svm/svm.c | 2 -- 1 file changed, 2 deletions(-) --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -3305,8 +3305,6 @@ static void svm_inject_irq(struct kvm_vc { struct vcpu_svm *svm =3D to_svm(vcpu); =20 - BUG_ON(!(gif_set(svm))); - trace_kvm_inj_virq(vcpu->arch.interrupt.nr); ++vcpu->stat.irq_injections; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD7D0C00140 for ; Mon, 15 Aug 2022 20:08:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242082AbiHOUIR (ORCPT ); Mon, 15 Aug 2022 16:08:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346381AbiHOUGi (ORCPT ); Mon, 15 Aug 2022 16:06:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E68522BD2; Mon, 15 Aug 2022 11:55:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 99CD9611ED; Mon, 15 Aug 2022 18:55:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82C6EC433D6; Mon, 15 Aug 2022 18:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589719; bh=/aQnZQ5JFG9L15x7QKi8JUfhjGN48NNx0wirGU2yGxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y0f7VTWC4syI/7z+h/90eEbCsA84pAq8P9KTeE1mB9rciar2sOwVVEOvAG8YRb1gm ZCxHSj+SOETtuiJV6KEMuYVS+cBfMbGWnYg/007U/fIV+gix+n/6Gcc0k3IvojeyRY C9S8HOj4gXpE6z724LRog1VKptrzjnxqWRVqweIs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nico Boehr , Claudio Imbrenda , Janosch Frank , Christian Borntraeger Subject: [PATCH 5.18 0026/1095] KVM: s390: pv: dont present the ecall interrupt twice Date: Mon, 15 Aug 2022 19:50:25 +0200 Message-Id: <20220815180430.438032854@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nico Boehr commit c3f0e5fd2d33d80c5a5a8b5e5d2bab2841709cc8 upstream. When the SIGP interpretation facility is present and a VCPU sends an ecall to another VCPU in enabled wait, the sending VCPU receives a 56 intercept (partial execution), so KVM can wake up the receiving CPU. Note that the SIGP interpretation facility will take care of the interrupt delivery and KVM's only job is to wake the receiving VCPU. For PV, the sending VCPU will receive a 108 intercept (pv notify) and should continue like in the non-PV case, i.e. wake the receiving VCPU. For PV and non-PV guests the interrupt delivery will occur through the SIGP interpretation facility on SIE entry when SIE finds the X bit in the status field set. However, in handle_pv_notification(), there was no special handling for SIGP, which leads to interrupt injection being requested by KVM for the next SIE entry. This results in the interrupt being delivered twice: once by the SIGP interpretation facility and once by KVM through the IICTL. Add the necessary special handling in handle_pv_notification(), similar to handle_partial_execution(), which simply wakes the receiving VCPU and leave interrupt delivery to the SIGP interpretation facility. In contrast to external calls, emergency calls are not interpreted but also cause a 108 intercept, which is why we still need to call handle_instruction() for SIGP orders other than ecall. Since kvm_s390_handle_sigp_pei() is now called for all SIGP orders which cause a 108 intercept - even if they are actually handled by handle_instruction() - move the tracepoint in kvm_s390_handle_sigp_pei() to avoid possibly confusing trace messages. Signed-off-by: Nico Boehr Cc: # 5.7 Fixes: da24a0cc58ed ("KVM: s390: protvirt: Instruction emulation") Reviewed-by: Claudio Imbrenda Reviewed-by: Janosch Frank Reviewed-by: Christian Borntraeger Link: https://lore.kernel.org/r/20220718130434.73302-1-nrb@linux.ibm.com Message-Id: <20220718130434.73302-1-nrb@linux.ibm.com> Signed-off-by: Claudio Imbrenda Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/s390/kvm/intercept.c | 15 +++++++++++++++ arch/s390/kvm/sigp.c | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) --- a/arch/s390/kvm/intercept.c +++ b/arch/s390/kvm/intercept.c @@ -528,12 +528,27 @@ static int handle_pv_uvc(struct kvm_vcpu =20 static int handle_pv_notification(struct kvm_vcpu *vcpu) { + int ret; + if (vcpu->arch.sie_block->ipa =3D=3D 0xb210) return handle_pv_spx(vcpu); if (vcpu->arch.sie_block->ipa =3D=3D 0xb220) return handle_pv_sclp(vcpu); if (vcpu->arch.sie_block->ipa =3D=3D 0xb9a4) return handle_pv_uvc(vcpu); + if (vcpu->arch.sie_block->ipa >> 8 =3D=3D 0xae) { + /* + * Besides external call, other SIGP orders also cause a + * 108 (pv notify) intercept. In contrast to external call, + * these orders need to be emulated and hence the appropriate + * place to handle them is in handle_instruction(). + * So first try kvm_s390_handle_sigp_pei() and if that isn't + * successful, go on with handle_instruction(). + */ + ret =3D kvm_s390_handle_sigp_pei(vcpu); + if (!ret) + return ret; + } =20 return handle_instruction(vcpu); } --- a/arch/s390/kvm/sigp.c +++ b/arch/s390/kvm/sigp.c @@ -480,9 +480,9 @@ int kvm_s390_handle_sigp_pei(struct kvm_ struct kvm_vcpu *dest_vcpu; u8 order_code =3D kvm_s390_get_base_disp_rs(vcpu, NULL); =20 - trace_kvm_s390_handle_sigp_pei(vcpu, order_code, cpu_addr); - if (order_code =3D=3D SIGP_EXTERNAL_CALL) { + trace_kvm_s390_handle_sigp_pei(vcpu, order_code, cpu_addr); + dest_vcpu =3D kvm_get_vcpu_by_id(vcpu->kvm, cpu_addr); BUG_ON(dest_vcpu =3D=3D NULL); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCECCC25B08 for ; Mon, 15 Aug 2022 20:19:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346182AbiHOUT1 (ORCPT ); Mon, 15 Aug 2022 16:19:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346283AbiHOULI (ORCPT ); Mon, 15 Aug 2022 16:11:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0636C19285; Mon, 15 Aug 2022 11:57:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C442E6126D; Mon, 15 Aug 2022 18:57:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8A4FC433D7; Mon, 15 Aug 2022 18:57:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589851; bh=KKc5u0c4svxwVAcIxxjFmvahLmLCXSorZlxcM4OLRUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HZEm9ZVsImEKThcmT4hmWlp6hPSAHG2+5KrBP5qpVtJsAXDbPcOdXUYG7ul4NPZkL K2FxoZWgBZs926qpGEt7/CUOhdy2svaZUaMjqluWltjFa9wXfEdyD7OcTUuNGTXzHl oEnnYAviDNDsDjNCL8UkjNTvi/odPTt9EqqUx9/k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.18 0027/1095] KVM: Drop unused @gpa param from gfn=>pfn caches __release_gpc() helper Date: Mon, 15 Aug 2022 19:50:26 +0200 Message-Id: <20220815180430.481743335@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit 345b0fd6fe5f66dfe841bad0b39dd11a5672df68 upstream. Drop the @pga param from __release_gpc() and rename the helper to make it more obvious that the cache itself is not being released. The helper will be reused by a future commit to release a pfn+khva combination that is _never_ associated with the cache, at which point the current name would go from slightly misleading to blatantly wrong. No functional change intended. Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220429210025.3293691-4-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- virt/kvm/pfncache.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) --- a/virt/kvm/pfncache.c +++ b/virt/kvm/pfncache.c @@ -95,7 +95,7 @@ bool kvm_gfn_to_pfn_cache_check(struct k } EXPORT_SYMBOL_GPL(kvm_gfn_to_pfn_cache_check); =20 -static void __release_gpc(struct kvm *kvm, kvm_pfn_t pfn, void *khva, gpa_= t gpa) +static void gpc_release_pfn_and_khva(struct kvm *kvm, kvm_pfn_t pfn, void = *khva) { /* Unmap the old page if it was mapped before, and release it */ if (!is_error_noslot_pfn(pfn)) { @@ -146,7 +146,6 @@ int kvm_gfn_to_pfn_cache_refresh(struct unsigned long page_offset =3D gpa & ~PAGE_MASK; kvm_pfn_t old_pfn, new_pfn; unsigned long old_uhva; - gpa_t old_gpa; void *old_khva; bool old_valid; int ret =3D 0; @@ -160,7 +159,6 @@ int kvm_gfn_to_pfn_cache_refresh(struct =20 write_lock_irq(&gpc->lock); =20 - old_gpa =3D gpc->gpa; old_pfn =3D gpc->pfn; old_khva =3D gpc->khva - offset_in_page(gpc->khva); old_uhva =3D gpc->uhva; @@ -244,7 +242,7 @@ int kvm_gfn_to_pfn_cache_refresh(struct out: write_unlock_irq(&gpc->lock); =20 - __release_gpc(kvm, old_pfn, old_khva, old_gpa); + gpc_release_pfn_and_khva(kvm, old_pfn, old_khva); =20 return ret; } @@ -254,14 +252,12 @@ void kvm_gfn_to_pfn_cache_unmap(struct k { void *old_khva; kvm_pfn_t old_pfn; - gpa_t old_gpa; =20 write_lock_irq(&gpc->lock); =20 gpc->valid =3D false; =20 old_khva =3D gpc->khva - offset_in_page(gpc->khva); - old_gpa =3D gpc->gpa; old_pfn =3D gpc->pfn; =20 /* @@ -273,7 +269,7 @@ void kvm_gfn_to_pfn_cache_unmap(struct k =20 write_unlock_irq(&gpc->lock); =20 - __release_gpc(kvm, old_pfn, old_khva, old_gpa); + gpc_release_pfn_and_khva(kvm, old_pfn, old_khva); } EXPORT_SYMBOL_GPL(kvm_gfn_to_pfn_cache_unmap); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94F22C00140 for ; Mon, 15 Aug 2022 20:09:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346019AbiHOUJ5 (ORCPT ); Mon, 15 Aug 2022 16:09:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240020AbiHOUJF (ORCPT ); Mon, 15 Aug 2022 16:09:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7571F2663; Mon, 15 Aug 2022 11:55:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E2C19B8109E; Mon, 15 Aug 2022 18:55:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49302C433C1; Mon, 15 Aug 2022 18:55:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589747; bh=hVge2b40hrymoACoRoPHQOleTSb2rRVyOkW4WS8IgBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ubVuyo+HMWd8fssHjtNrvIyrbdpZ51Ym5GNvJEQz8ruZzTFbsTHLT03HsonuB31mU E0znBIokEuS+gJGxFUrh/xx2UewWWx2DtyCINFwqTgcusP2B+vmB6TyxggflZRld+B hAaE7y31tbSVZzgxa1rAmY08l3hveNRrSetq3Awc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.18 0028/1095] KVM: Put the extra pfn reference when reusing a pfn in the gpc cache Date: Mon, 15 Aug 2022 19:50:27 +0200 Message-Id: <20220815180430.527997742@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit 3dddf65b4f4c451c345d34ae85bdf1791a746e49 upstream. Put the struct page reference to pfn acquired by hva_to_pfn() when the old and new pfns for a gfn=3D>pfn cache match. The cache already has a reference via the old/current pfn, and will only put one reference when the cache is done with the pfn. Fixes: 982ed0de4753 ("KVM: Reinstate gfn_to_pfn_cache with invalidation sup= port") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220429210025.3293691-5-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- virt/kvm/pfncache.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/virt/kvm/pfncache.c +++ b/virt/kvm/pfncache.c @@ -206,6 +206,14 @@ int kvm_gfn_to_pfn_cache_refresh(struct =20 if (gpc->usage & KVM_HOST_USES_PFN) { if (new_pfn =3D=3D old_pfn) { + /* + * Reuse the existing pfn and khva, but put the + * reference acquired hva_to_pfn_retry(); the + * cache still holds a reference to the pfn + * from the previous refresh. + */ + gpc_release_pfn_and_khva(kvm, new_pfn, NULL); + new_khva =3D old_khva; old_pfn =3D KVM_PFN_ERR_FAULT; old_khva =3D NULL; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3307FC2BB41 for ; Mon, 15 Aug 2022 20:16:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346597AbiHOUQN (ORCPT ); Mon, 15 Aug 2022 16:16:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346016AbiHOUJv (ORCPT ); Mon, 15 Aug 2022 16:09:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8D8B631E; Mon, 15 Aug 2022 11:56:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5303FB8105C; Mon, 15 Aug 2022 18:56:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94DB7C433C1; Mon, 15 Aug 2022 18:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589782; bh=qQyraYE4LbhTbwMvV6lt7Z7x61Pv/yXQ96/5OMaQNNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rO/jRrMmgFF6FQtbzDSnuLQHlXKfr2dNMaYdKEFoUABta23KXHXjRynW/bz53qw6t mYwvK+pUIPKr8Dv73hvOsJRH3eRar0Bm16izF0Aldk46LNUae0NboQscjAc7L3oy0X cOjJkCJs9gxTyqE6WG3kM+vI6moLubGow3Sca6Fc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lai Jiangshan , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.18 0029/1095] KVM: Fully serialize gfn=>pfn cache refresh via mutex Date: Mon, 15 Aug 2022 19:50:28 +0200 Message-Id: <20220815180430.572594455@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit 93984f19e7bce4c18084a6ef3dacafb155b806ed upstream. Protect gfn=3D>pfn cache refresh with a mutex to fully serialize refreshes. The refresh logic doesn't protect against - concurrent unmaps, or refreshes with different GPAs (which may or may not happen in practice, for example if a cache is only used under vcpu->mutex; but it's allowed in the code) - a false negative on the memslot generation. If the first refresh sees a stale memslot generation, it will refresh the hva and generation before moving on to the hva=3D>pfn translation. If it then drops gpc->lock, a different user of the cache can come along, acquire gpc->lock, see that the memslot generation is fresh, and skip the hva=3D>pfn update due to the userspace address also matching (because it too was updated). The refresh path can already sleep during hva=3D>pfn resolution, so wrap the refresh with a mutex to ensure that any given refresh runs to completion before other callers can start their refresh. Cc: stable@vger.kernel.org Cc: Lai Jiangshan Signed-off-by: Sean Christopherson Message-Id: <20220429210025.3293691-7-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/kvm_types.h | 2 ++ virt/kvm/pfncache.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) --- a/include/linux/kvm_types.h +++ b/include/linux/kvm_types.h @@ -19,6 +19,7 @@ struct kvm_memslots; enum kvm_mr_change; =20 #include +#include #include #include =20 @@ -69,6 +70,7 @@ struct gfn_to_pfn_cache { struct kvm_vcpu *vcpu; struct list_head list; rwlock_t lock; + struct mutex refresh_lock; void *khva; kvm_pfn_t pfn; enum pfn_cache_usage usage; --- a/virt/kvm/pfncache.c +++ b/virt/kvm/pfncache.c @@ -157,6 +157,13 @@ int kvm_gfn_to_pfn_cache_refresh(struct if (page_offset + len > PAGE_SIZE) return -EINVAL; =20 + /* + * If another task is refreshing the cache, wait for it to complete. + * There is no guarantee that concurrent refreshes will see the same + * gpa, memslots generation, etc..., so they must be fully serialized. + */ + mutex_lock(&gpc->refresh_lock); + write_lock_irq(&gpc->lock); =20 old_pfn =3D gpc->pfn; @@ -250,6 +257,8 @@ int kvm_gfn_to_pfn_cache_refresh(struct out: write_unlock_irq(&gpc->lock); =20 + mutex_unlock(&gpc->refresh_lock); + gpc_release_pfn_and_khva(kvm, old_pfn, old_khva); =20 return ret; @@ -261,6 +270,7 @@ void kvm_gfn_to_pfn_cache_unmap(struct k void *old_khva; kvm_pfn_t old_pfn; =20 + mutex_lock(&gpc->refresh_lock); write_lock_irq(&gpc->lock); =20 gpc->valid =3D false; @@ -276,6 +286,7 @@ void kvm_gfn_to_pfn_cache_unmap(struct k gpc->pfn =3D KVM_PFN_ERR_FAULT; =20 write_unlock_irq(&gpc->lock); + mutex_unlock(&gpc->refresh_lock); =20 gpc_release_pfn_and_khva(kvm, old_pfn, old_khva); } @@ -290,6 +301,7 @@ int kvm_gfn_to_pfn_cache_init(struct kvm =20 if (!gpc->active) { rwlock_init(&gpc->lock); + mutex_init(&gpc->refresh_lock); =20 gpc->khva =3D NULL; gpc->pfn =3D KVM_PFN_ERR_FAULT; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E460C00140 for ; Mon, 15 Aug 2022 20:20:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346424AbiHOUUL (ORCPT ); Mon, 15 Aug 2022 16:20:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346194AbiHOULD (ORCPT ); Mon, 15 Aug 2022 16:11:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E06C7AE4B; Mon, 15 Aug 2022 11:57:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F334B810A0; Mon, 15 Aug 2022 18:56:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B04FDC433D6; Mon, 15 Aug 2022 18:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589817; bh=YJ/dercJx3qtjQAaXxELHElcUTf1JjMCwNg9MoggzA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NqqZvGHxwhvXKtKMTAfyjFup8IrrR2A8PqUwTKN1gSVNYno7g50sRs6MaadH/tDZH ns2/ap/g5XPRDoT69nti/Uy+7OgEUJ2Hs63+5nFHEgt1QOrUlxRc3qXwX48waL9mVs k3wmu0Y6m7DbSFwB3tdIhqVZnY7E4i0fJX8WYnCI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Woodhouse , Mingwei Zhang , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.18 0030/1095] KVM: Fix multiple races in gfn=>pfn cache refresh Date: Mon, 15 Aug 2022 19:50:29 +0200 Message-Id: <20220815180430.617761731@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson commit 58cd407ca4c6278cf9f9d09a2e663bf645b0c982 upstream. Rework the gfn=3D>pfn cache (gpc) refresh logic to address multiple races between the cache itself, and between the cache and mmu_notifier events. The existing refresh code attempts to guard against races with the mmu_notifier by speculatively marking the cache valid, and then marking it invalid if a mmu_notifier invalidation occurs. That handles the case where an invalidation occurs between dropping and re-acquiring gpc->lock, but it doesn't handle the scenario where the cache is refreshed after the cache was invalidated by the notifier, but before the notifier elevates mmu_notifier_count. The gpc refresh can't use the "retry" helper as its invalidation occurs _before_ mmu_notifier_count is elevated and before mmu_notifier_range_start is set/updated. CPU0 CPU1 ---- ---- gfn_to_pfn_cache_invalidate_start() | -> gpc->valid =3D false; kvm_gfn_to_pfn_cache_refresh() | |-> gpc->valid =3D true; hva_to_pfn_retry() | -> acquire kvm->mmu_lock kvm->mmu_notifier_count =3D=3D= 0 mmu_seq =3D=3D kvm->mmu_notifi= er_seq drop kvm->mmu_lock return pfn 'X' acquire kvm->mmu_lock kvm_inc_notifier_count() drop kvm->mmu_lock() kernel frees pfn 'X' kvm_gfn_to_pfn_cache_check() | |-> gpc->valid =3D=3D true caller accesses freed pfn 'X' Key off of mn_active_invalidate_count to detect that a pfncache refresh needs to wait for an in-progress mmu_notifier invalidation. While mn_active_invalidate_count is not guaranteed to be stable, it is guaranteed to be elevated prior to an invalidation acquiring gpc->lock, so either the refresh will see an active invalidation and wait, or the invalidation will run after the refresh completes. Speculatively marking the cache valid is itself flawed, as a concurrent kvm_gfn_to_pfn_cache_check() would see a valid cache with stale pfn/khva values. The KVM Xen use case explicitly allows/wants multiple users; even though the caches are allocated per vCPU, __kvm_xen_has_interrupt() can read a different vCPU (or vCPUs). Address this race by invalidating the cache prior to dropping gpc->lock (this is made possible by fixing the above mmu_notifier race). Complicating all of this is the fact that both the hva=3D>pfn resolution and mapping of the kernel address can sleep, i.e. must be done outside of gpc->lock. Fix the above races in one fell swoop, trying to fix each individual race is largely pointless and essentially impossible to test, e.g. closing one hole just shifts the focus to the other hole. Fixes: 982ed0de4753 ("KVM: Reinstate gfn_to_pfn_cache with invalidation sup= port") Cc: stable@vger.kernel.org Cc: David Woodhouse Cc: Mingwei Zhang Signed-off-by: Sean Christopherson Message-Id: <20220429210025.3293691-8-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- virt/kvm/kvm_main.c | 9 ++ virt/kvm/pfncache.c | 193 ++++++++++++++++++++++++++++++++---------------= ----- 2 files changed, 131 insertions(+), 71 deletions(-) --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -724,6 +724,15 @@ static int kvm_mmu_notifier_invalidate_r kvm->mn_active_invalidate_count++; spin_unlock(&kvm->mn_invalidate_lock); =20 + /* + * Invalidate pfn caches _before_ invalidating the secondary MMUs, i.e. + * before acquiring mmu_lock, to avoid holding mmu_lock while acquiring + * each cache's lock. There are relatively few caches in existence at + * any given time, and the caches themselves can check for hva overlap, + * i.e. don't need to rely on memslot overlap checks for performance. + * Because this runs without holding mmu_lock, the pfn caches must use + * mn_active_invalidate_count (see above) instead of mmu_notifier_count. + */ gfn_to_pfn_cache_invalidate_start(kvm, range->start, range->end, hva_range.may_block); =20 --- a/virt/kvm/pfncache.c +++ b/virt/kvm/pfncache.c @@ -112,31 +112,122 @@ static void gpc_release_pfn_and_khva(str } } =20 -static kvm_pfn_t hva_to_pfn_retry(struct kvm *kvm, unsigned long uhva) +static inline bool mmu_notifier_retry_cache(struct kvm *kvm, unsigned long= mmu_seq) { + /* + * mn_active_invalidate_count acts for all intents and purposes + * like mmu_notifier_count here; but the latter cannot be used + * here because the invalidation of caches in the mmu_notifier + * event occurs _before_ mmu_notifier_count is elevated. + * + * Note, it does not matter that mn_active_invalidate_count + * is not protected by gpc->lock. It is guaranteed to + * be elevated before the mmu_notifier acquires gpc->lock, and + * isn't dropped until after mmu_notifier_seq is updated. + */ + if (kvm->mn_active_invalidate_count) + return true; + + /* + * Ensure mn_active_invalidate_count is read before + * mmu_notifier_seq. This pairs with the smp_wmb() in + * mmu_notifier_invalidate_range_end() to guarantee either the + * old (non-zero) value of mn_active_invalidate_count or the + * new (incremented) value of mmu_notifier_seq is observed. + */ + smp_rmb(); + return kvm->mmu_notifier_seq !=3D mmu_seq; +} + +static kvm_pfn_t hva_to_pfn_retry(struct kvm *kvm, struct gfn_to_pfn_cache= *gpc) +{ + /* Note, the new page offset may be different than the old! */ + void *old_khva =3D gpc->khva - offset_in_page(gpc->khva); + kvm_pfn_t new_pfn =3D KVM_PFN_ERR_FAULT; + void *new_khva =3D NULL; unsigned long mmu_seq; - kvm_pfn_t new_pfn; - int retry; + + lockdep_assert_held(&gpc->refresh_lock); + + lockdep_assert_held_write(&gpc->lock); + + /* + * Invalidate the cache prior to dropping gpc->lock, the gpa=3D>uhva + * assets have already been updated and so a concurrent check() from a + * different task may not fail the gpa/uhva/generation checks. + */ + gpc->valid =3D false; =20 do { mmu_seq =3D kvm->mmu_notifier_seq; smp_rmb(); =20 + write_unlock_irq(&gpc->lock); + + /* + * If the previous iteration "failed" due to an mmu_notifier + * event, release the pfn and unmap the kernel virtual address + * from the previous attempt. Unmapping might sleep, so this + * needs to be done after dropping the lock. Opportunistically + * check for resched while the lock isn't held. + */ + if (new_pfn !=3D KVM_PFN_ERR_FAULT) { + /* + * Keep the mapping if the previous iteration reused + * the existing mapping and didn't create a new one. + */ + if (new_khva =3D=3D old_khva) + new_khva =3D NULL; + + gpc_release_pfn_and_khva(kvm, new_pfn, new_khva); + + cond_resched(); + } + /* We always request a writeable mapping */ - new_pfn =3D hva_to_pfn(uhva, false, NULL, true, NULL); + new_pfn =3D hva_to_pfn(gpc->uhva, false, NULL, true, NULL); if (is_error_noslot_pfn(new_pfn)) - break; + goto out_error; + + /* + * Obtain a new kernel mapping if KVM itself will access the + * pfn. Note, kmap() and memremap() can both sleep, so this + * too must be done outside of gpc->lock! + */ + if (gpc->usage & KVM_HOST_USES_PFN) { + if (new_pfn =3D=3D gpc->pfn) { + new_khva =3D old_khva; + } else if (pfn_valid(new_pfn)) { + new_khva =3D kmap(pfn_to_page(new_pfn)); +#ifdef CONFIG_HAS_IOMEM + } else { + new_khva =3D memremap(pfn_to_hpa(new_pfn), PAGE_SIZE, MEMREMAP_WB); +#endif + } + if (!new_khva) { + kvm_release_pfn_clean(new_pfn); + goto out_error; + } + } + + write_lock_irq(&gpc->lock); =20 - KVM_MMU_READ_LOCK(kvm); - retry =3D mmu_notifier_retry_hva(kvm, mmu_seq, uhva); - KVM_MMU_READ_UNLOCK(kvm); - if (!retry) - break; + /* + * Other tasks must wait for _this_ refresh to complete before + * attempting to refresh. + */ + WARN_ON_ONCE(gpc->valid); + } while (mmu_notifier_retry_cache(kvm, mmu_seq)); + + gpc->valid =3D true; + gpc->pfn =3D new_pfn; + gpc->khva =3D new_khva + (gpc->gpa & ~PAGE_MASK); + return 0; =20 - cond_resched(); - } while (1); +out_error: + write_lock_irq(&gpc->lock); =20 - return new_pfn; + return -EFAULT; } =20 int kvm_gfn_to_pfn_cache_refresh(struct kvm *kvm, struct gfn_to_pfn_cache = *gpc, @@ -147,7 +238,6 @@ int kvm_gfn_to_pfn_cache_refresh(struct kvm_pfn_t old_pfn, new_pfn; unsigned long old_uhva; void *old_khva; - bool old_valid; int ret =3D 0; =20 /* @@ -169,7 +259,6 @@ int kvm_gfn_to_pfn_cache_refresh(struct old_pfn =3D gpc->pfn; old_khva =3D gpc->khva - offset_in_page(gpc->khva); old_uhva =3D gpc->uhva; - old_valid =3D gpc->valid; =20 /* If the userspace HVA is invalid, refresh that first */ if (gpc->gpa !=3D gpa || gpc->generation !=3D slots->generation || @@ -182,7 +271,6 @@ int kvm_gfn_to_pfn_cache_refresh(struct gpc->uhva =3D gfn_to_hva_memslot(gpc->memslot, gfn); =20 if (kvm_is_error_hva(gpc->uhva)) { - gpc->pfn =3D KVM_PFN_ERR_FAULT; ret =3D -EFAULT; goto out; } @@ -194,60 +282,8 @@ int kvm_gfn_to_pfn_cache_refresh(struct * If the userspace HVA changed or the PFN was already invalid, * drop the lock and do the HVA to PFN lookup again. */ - if (!old_valid || old_uhva !=3D gpc->uhva) { - unsigned long uhva =3D gpc->uhva; - void *new_khva =3D NULL; - - /* Placeholders for "hva is valid but not yet mapped" */ - gpc->pfn =3D KVM_PFN_ERR_FAULT; - gpc->khva =3D NULL; - gpc->valid =3D true; - - write_unlock_irq(&gpc->lock); - - new_pfn =3D hva_to_pfn_retry(kvm, uhva); - if (is_error_noslot_pfn(new_pfn)) { - ret =3D -EFAULT; - goto map_done; - } - - if (gpc->usage & KVM_HOST_USES_PFN) { - if (new_pfn =3D=3D old_pfn) { - /* - * Reuse the existing pfn and khva, but put the - * reference acquired hva_to_pfn_retry(); the - * cache still holds a reference to the pfn - * from the previous refresh. - */ - gpc_release_pfn_and_khva(kvm, new_pfn, NULL); - - new_khva =3D old_khva; - old_pfn =3D KVM_PFN_ERR_FAULT; - old_khva =3D NULL; - } else if (pfn_valid(new_pfn)) { - new_khva =3D kmap(pfn_to_page(new_pfn)); -#ifdef CONFIG_HAS_IOMEM - } else { - new_khva =3D memremap(pfn_to_hpa(new_pfn), PAGE_SIZE, MEMREMAP_WB); -#endif - } - if (new_khva) - new_khva +=3D page_offset; - else - ret =3D -EFAULT; - } - - map_done: - write_lock_irq(&gpc->lock); - if (ret) { - gpc->valid =3D false; - gpc->pfn =3D KVM_PFN_ERR_FAULT; - gpc->khva =3D NULL; - } else { - /* At this point, gpc->valid may already have been cleared */ - gpc->pfn =3D new_pfn; - gpc->khva =3D new_khva; - } + if (!gpc->valid || old_uhva !=3D gpc->uhva) { + ret =3D hva_to_pfn_retry(kvm, gpc); } else { /* If the HVA=E2=86=92PFN mapping was already valid, don't unmap it. */ old_pfn =3D KVM_PFN_ERR_FAULT; @@ -255,11 +291,26 @@ int kvm_gfn_to_pfn_cache_refresh(struct } =20 out: + /* + * Invalidate the cache and purge the pfn/khva if the refresh failed. + * Some/all of the uhva, gpa, and memslot generation info may still be + * valid, leave it as is. + */ + if (ret) { + gpc->valid =3D false; + gpc->pfn =3D KVM_PFN_ERR_FAULT; + gpc->khva =3D NULL; + } + + /* Snapshot the new pfn before dropping the lock! */ + new_pfn =3D gpc->pfn; + write_unlock_irq(&gpc->lock); =20 mutex_unlock(&gpc->refresh_lock); =20 - gpc_release_pfn_and_khva(kvm, old_pfn, old_khva); + if (old_pfn !=3D new_pfn) + gpc_release_pfn_and_khva(kvm, old_pfn, old_khva); =20 return ret; } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E95B8C25B08 for ; Mon, 15 Aug 2022 20:20:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231329AbiHOUUS (ORCPT ); Mon, 15 Aug 2022 16:20:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346233AbiHOULF (ORCPT ); Mon, 15 Aug 2022 16:11:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73F6AB851; Mon, 15 Aug 2022 11:57:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2EC36B810A2; Mon, 15 Aug 2022 18:57:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F002C433D6; Mon, 15 Aug 2022 18:57:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589832; bh=gzYtX3jUM3PkHakrG20VtWROjOwHdudeIMY7TqfKmB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eF9+YqtInlOupS+mxqqmxYFJrNBG5bIZhlwP6ImxI0emnSOle/Nrq0zIYPa6VUhm9 U0ITn0AwismzK8yhE9PPRryQawbLTi0aq7ASQ4MKZjjjFwvwzhyV3dAXjWK2BnNGya DKTFE00FAuPYdBLPK2o2xUWMs7e3eUrCM2OIBDKg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.18 0031/1095] KVM: Do not incorporate page offset into gfn=>pfn cache user address Date: Mon, 15 Aug 2022 19:50:30 +0200 Message-Id: <20220815180430.657525381@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit 3ba2c95ea180740b16281fa43a3ee5f47279c0ed upstream. Don't adjust the userspace address in the gfn=3D>pfn cache by the page offset from the gpa. KVM should never use the user address directly, and all KVM operations that translate a user address to something else require the user address to be page aligned. Ignoring the offset will allow the cache to reuse a gfn=3D>hva translation in the unlikely event that the page offset of the gpa changes, but the gfn does not. And more importantly, not having to (un)adjust the user address will simplify a future bug fix. Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220429210025.3293691-6-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- virt/kvm/pfncache.c | 2 -- 1 file changed, 2 deletions(-) --- a/virt/kvm/pfncache.c +++ b/virt/kvm/pfncache.c @@ -274,8 +274,6 @@ int kvm_gfn_to_pfn_cache_refresh(struct ret =3D -EFAULT; goto out; } - - gpc->uhva +=3D page_offset; } =20 /* From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E20FFC25B0E for ; Mon, 15 Aug 2022 20:13:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239558AbiHOUNy (ORCPT ); Mon, 15 Aug 2022 16:13:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346244AbiHOULF (ORCPT ); Mon, 15 Aug 2022 16:11:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADB2DBC95; Mon, 15 Aug 2022 11:57:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A363B810A0; Mon, 15 Aug 2022 18:57:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1AE3C433D7; Mon, 15 Aug 2022 18:57:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589836; bh=xRlSvPTUNVqSQdwqQEuW5opyzEu8swTmbFnmAaZ7pcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o8BEsY5pAXFitbb1AM/UBI6mfmagvlQ1OOrkWxKZWW1hQd3+I1FVkQq9nO5BYbi8T rNGQ0ffvg7nR45D3tU/R+wVcXswxpU1DnMJhQP+tSEcY7w2WbcKTgjcMiQKsmS77+8 0gVH34ALysXrHp2MIXFhxW4JolFnk2ZwqTyLwb8Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.18 0032/1095] KVM: x86: Split kvm_is_valid_cr4() and export only the non-vendor bits Date: Mon, 15 Aug 2022 19:50:31 +0200 Message-Id: <20220815180430.701684167@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit c33f6f2228fe8517e38941a508e9f905f99ecba9 upstream. Split the common x86 parts of kvm_is_valid_cr4(), i.e. the reserved bits checks, into a separate helper, __kvm_is_valid_cr4(), and export only the inner helper to vendor code in order to prevent nested VMX from calling back into vmx_is_valid_cr4() via kvm_is_valid_cr4(). On SVM, this is a nop as SVM doesn't place any additional restrictions on CR4. On VMX, this is also currently a nop, but only because nested VMX is missing checks on reserved CR4 bits for nested VM-Enter. That bug will be fixed in a future patch, and could simply use kvm_is_valid_cr4() as-is, but nVMX has _another_ bug where VMXON emulation doesn't enforce VMX's restrictions on CR0/CR4. The cleanest and most intuitive way to fix the VMXON bug is to use nested_host_cr{0,4}_valid(). If the CR4 variant routes through kvm_is_valid_cr4(), using nested_host_cr4_valid() won't do the right thing for the VMXON case as vmx_is_valid_cr4() enforces VMX's restrictions if and only if the vCPU is post-VMXON. Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220607213604.3346000-2-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/svm/nested.c | 3 ++- arch/x86/kvm/vmx/vmx.c | 4 ++-- arch/x86/kvm/x86.c | 12 +++++++++--- arch/x86/kvm/x86.h | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -292,7 +292,8 @@ static bool __nested_vmcb_check_save(str return false; } =20 - if (CC(!kvm_is_valid_cr4(vcpu, save->cr4))) + /* Note, SVM doesn't have any additional restrictions on CR4. */ + if (CC(!__kvm_is_valid_cr4(vcpu, save->cr4))) return false; =20 if (CC(!kvm_valid_efer(vcpu, save->efer))) --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -3230,8 +3230,8 @@ static bool vmx_is_valid_cr4(struct kvm_ { /* * We operate under the default treatment of SMM, so VMX cannot be - * enabled under SMM. Note, whether or not VMXE is allowed at all is - * handled by kvm_is_valid_cr4(). + * enabled under SMM. Note, whether or not VMXE is allowed at all, + * i.e. is a reserved bit, is handled by common x86 code. */ if ((cr4 & X86_CR4_VMXE) && is_smm(vcpu)) return false; --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1066,7 +1066,7 @@ int kvm_emulate_xsetbv(struct kvm_vcpu * } EXPORT_SYMBOL_GPL(kvm_emulate_xsetbv); =20 -bool kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) +bool __kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) { if (cr4 & cr4_reserved_bits) return false; @@ -1074,9 +1074,15 @@ bool kvm_is_valid_cr4(struct kvm_vcpu *v if (cr4 & vcpu->arch.cr4_guest_rsvd_bits) return false; =20 - return static_call(kvm_x86_is_valid_cr4)(vcpu, cr4); + return true; +} +EXPORT_SYMBOL_GPL(__kvm_is_valid_cr4); + +static bool kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) +{ + return __kvm_is_valid_cr4(vcpu, cr4) && + static_call(kvm_x86_is_valid_cr4)(vcpu, cr4); } -EXPORT_SYMBOL_GPL(kvm_is_valid_cr4); =20 void kvm_post_set_cr4(struct kvm_vcpu *vcpu, unsigned long old_cr4, unsign= ed long cr4) { --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h @@ -407,7 +407,7 @@ static inline void kvm_machine_check(voi void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu); void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu); int kvm_spec_ctrl_test_value(u64 value); -bool kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4); +bool __kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4); int kvm_handle_memory_failure(struct kvm_vcpu *vcpu, int r, struct x86_exception *e); int kvm_handle_invpcid(struct kvm_vcpu *vcpu, unsigned long type, gva_t gv= a); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0BDBC00140 for ; Mon, 15 Aug 2022 20:19:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243471AbiHOUTn (ORCPT ); Mon, 15 Aug 2022 16:19:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346242AbiHOULF (ORCPT ); Mon, 15 Aug 2022 16:11:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E23D0DF92; Mon, 15 Aug 2022 11:57:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 87FE0B810A0; Mon, 15 Aug 2022 18:57:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A63EC433D7; Mon, 15 Aug 2022 18:57:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589839; bh=JbjzGDK/6oWRWWX56VmfeVahv0aGIsrHygSR1O+Mupw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gOVBsEq+Qzu2OmUq4AbFDg2bdc72h2xUuY657fbqHbOIK6lHDLg8AUeVXbSikHnjl Po9N+R3VKAzZUC4wNnqieTZfWDNSBiMbhw8JGEwRykHQzlkk3Hyff3O8pIhORTcnpf 7woQ48wdNtwojg4GRD6FkPPM6te21s4uKOkhelQk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Matlack , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.18 0033/1095] KVM: nVMX: Let userspace set nVMX MSR to any _host_ supported value Date: Mon, 15 Aug 2022 19:50:32 +0200 Message-Id: <20220815180430.748811196@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit f8ae08f9789ad59d318ea75b570caa454aceda81 upstream. Restrict the nVMX MSRs based on KVM's config, not based on the guest's current config. Using the guest's config to audit the new config prevents userspace from restoring the original config (KVM's config) if at any point in the past the guest's config was restricted in any way. Fixes: 62cc6b9dc61e ("KVM: nVMX: support restore of VMX capability MSRs") Cc: stable@vger.kernel.org Cc: David Matlack Signed-off-by: Sean Christopherson Message-Id: <20220607213604.3346000-6-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.c | 70 ++++++++++++++++++++++++-----------------= ----- 1 file changed, 37 insertions(+), 33 deletions(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -1224,7 +1224,7 @@ static int vmx_restore_vmx_basic(struct BIT_ULL(49) | BIT_ULL(54) | BIT_ULL(55) | /* reserved */ BIT_ULL(31) | GENMASK_ULL(47, 45) | GENMASK_ULL(63, 56); - u64 vmx_basic =3D vmx->nested.msrs.basic; + u64 vmx_basic =3D vmcs_config.nested.basic; =20 if (!is_bitwise_subset(vmx_basic, data, feature_and_reserved)) return -EINVAL; @@ -1247,36 +1247,42 @@ static int vmx_restore_vmx_basic(struct return 0; } =20 -static int -vmx_restore_control_msr(struct vcpu_vmx *vmx, u32 msr_index, u64 data) +static void vmx_get_control_msr(struct nested_vmx_msrs *msrs, u32 msr_inde= x, + u32 **low, u32 **high) { - u64 supported; - u32 *lowp, *highp; - switch (msr_index) { case MSR_IA32_VMX_TRUE_PINBASED_CTLS: - lowp =3D &vmx->nested.msrs.pinbased_ctls_low; - highp =3D &vmx->nested.msrs.pinbased_ctls_high; + *low =3D &msrs->pinbased_ctls_low; + *high =3D &msrs->pinbased_ctls_high; break; case MSR_IA32_VMX_TRUE_PROCBASED_CTLS: - lowp =3D &vmx->nested.msrs.procbased_ctls_low; - highp =3D &vmx->nested.msrs.procbased_ctls_high; + *low =3D &msrs->procbased_ctls_low; + *high =3D &msrs->procbased_ctls_high; break; case MSR_IA32_VMX_TRUE_EXIT_CTLS: - lowp =3D &vmx->nested.msrs.exit_ctls_low; - highp =3D &vmx->nested.msrs.exit_ctls_high; + *low =3D &msrs->exit_ctls_low; + *high =3D &msrs->exit_ctls_high; break; case MSR_IA32_VMX_TRUE_ENTRY_CTLS: - lowp =3D &vmx->nested.msrs.entry_ctls_low; - highp =3D &vmx->nested.msrs.entry_ctls_high; + *low =3D &msrs->entry_ctls_low; + *high =3D &msrs->entry_ctls_high; break; case MSR_IA32_VMX_PROCBASED_CTLS2: - lowp =3D &vmx->nested.msrs.secondary_ctls_low; - highp =3D &vmx->nested.msrs.secondary_ctls_high; + *low =3D &msrs->secondary_ctls_low; + *high =3D &msrs->secondary_ctls_high; break; default: BUG(); } +} + +static int +vmx_restore_control_msr(struct vcpu_vmx *vmx, u32 msr_index, u64 data) +{ + u32 *lowp, *highp; + u64 supported; + + vmx_get_control_msr(&vmcs_config.nested, msr_index, &lowp, &highp); =20 supported =3D vmx_control_msr(*lowp, *highp); =20 @@ -1288,6 +1294,7 @@ vmx_restore_control_msr(struct vcpu_vmx if (!is_bitwise_subset(supported, data, GENMASK_ULL(63, 32))) return -EINVAL; =20 + vmx_get_control_msr(&vmx->nested.msrs, msr_index, &lowp, &highp); *lowp =3D data; *highp =3D data >> 32; return 0; @@ -1301,10 +1308,8 @@ static int vmx_restore_vmx_misc(struct v BIT_ULL(28) | BIT_ULL(29) | BIT_ULL(30) | /* reserved */ GENMASK_ULL(13, 9) | BIT_ULL(31); - u64 vmx_misc; - - vmx_misc =3D vmx_control_msr(vmx->nested.msrs.misc_low, - vmx->nested.msrs.misc_high); + u64 vmx_misc =3D vmx_control_msr(vmcs_config.nested.misc_low, + vmcs_config.nested.misc_high); =20 if (!is_bitwise_subset(vmx_misc, data, feature_and_reserved_bits)) return -EINVAL; @@ -1332,10 +1337,8 @@ static int vmx_restore_vmx_misc(struct v =20 static int vmx_restore_vmx_ept_vpid_cap(struct vcpu_vmx *vmx, u64 data) { - u64 vmx_ept_vpid_cap; - - vmx_ept_vpid_cap =3D vmx_control_msr(vmx->nested.msrs.ept_caps, - vmx->nested.msrs.vpid_caps); + u64 vmx_ept_vpid_cap =3D vmx_control_msr(vmcs_config.nested.ept_caps, + vmcs_config.nested.vpid_caps); =20 /* Every bit is either reserved or a feature bit. */ if (!is_bitwise_subset(vmx_ept_vpid_cap, data, -1ULL)) @@ -1346,20 +1349,21 @@ static int vmx_restore_vmx_ept_vpid_cap( return 0; } =20 -static int vmx_restore_fixed0_msr(struct vcpu_vmx *vmx, u32 msr_index, u64= data) +static u64 *vmx_get_fixed0_msr(struct nested_vmx_msrs *msrs, u32 msr_index) { - u64 *msr; - switch (msr_index) { case MSR_IA32_VMX_CR0_FIXED0: - msr =3D &vmx->nested.msrs.cr0_fixed0; - break; + return &msrs->cr0_fixed0; case MSR_IA32_VMX_CR4_FIXED0: - msr =3D &vmx->nested.msrs.cr4_fixed0; - break; + return &msrs->cr4_fixed0; default: BUG(); } +} + +static int vmx_restore_fixed0_msr(struct vcpu_vmx *vmx, u32 msr_index, u64= data) +{ + const u64 *msr =3D vmx_get_fixed0_msr(&vmcs_config.nested, msr_index); =20 /* * 1 bits (which indicates bits which "must-be-1" during VMX operation) @@ -1368,7 +1372,7 @@ static int vmx_restore_fixed0_msr(struct if (!is_bitwise_subset(data, *msr, -1ULL)) return -EINVAL; =20 - *msr =3D data; + *vmx_get_fixed0_msr(&vmx->nested.msrs, msr_index) =3D data; return 0; } =20 @@ -1429,7 +1433,7 @@ int vmx_set_vmx_msr(struct kvm_vcpu *vcp vmx->nested.msrs.vmcs_enum =3D data; return 0; case MSR_IA32_VMX_VMFUNC: - if (data & ~vmx->nested.msrs.vmfunc_controls) + if (data & ~vmcs_config.nested.vmfunc_controls) return -EINVAL; vmx->nested.msrs.vmfunc_controls =3D data; return 0; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FEB8C00140 for ; Mon, 15 Aug 2022 20:14:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230148AbiHOUOo (ORCPT ); Mon, 15 Aug 2022 16:14:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346252AbiHOULF (ORCPT ); Mon, 15 Aug 2022 16:11:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24332F5B1; Mon, 15 Aug 2022 11:57:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A0FF26122B; Mon, 15 Aug 2022 18:57:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93178C433C1; Mon, 15 Aug 2022 18:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589842; bh=RIXvlqtErnqUU+6Rz5r6bqonG4MImcLLPCMCxhVxYak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tqGkbgvEZ/o9lOfx40o80z6FKF6ELopALkQS2HdJay9YVqtz/hhUopdEuh6cCbEF7 KWXKsZfkn7lHSm1nKx2C9RW05yDkToFVizFeiOOCk18iZlo1bN5GRsApsgQKpJv4Hj B7K60YOB0IKNsxpicBNiVG3dy6qM9SJYc1RFjono= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.18 0034/1095] KVM: nVMX: Account for KVM reserved CR4 bits in consistency checks Date: Mon, 15 Aug 2022 19:50:33 +0200 Message-Id: <20220815180430.794025583@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit ca58f3aa53d165afe4ab74c755bc2f6d168617ac upstream. Check that the guest (L2) and host (L1) CR4 values that would be loaded by nested VM-Enter and VM-Exit respectively are valid with respect to KVM's (L0 host) allowed CR4 bits. Failure to check KVM reserved bits would allow L1 to load an illegal CR4 (or trigger hardware VM-Fail or failed VM-Entry) by massaging guest CPUID to allow features that are not supported by KVM. Amusingly, KVM itself is an accomplice in its doom, as KVM adjusts L1's MSR_IA32_VMX_CR4_FIXED1 to allow L1 to enable bits for L2 based on L1's CPUID model. Note, although nested_{guest,host}_cr4_valid() are _currently_ used if and only if the vCPU is post-VMXON (nested.vmxon =3D=3D true), that may not be true in the future, e.g. emulating VMXON has a bug where it doesn't check the allowed/required CR0/CR4 bits. Cc: stable@vger.kernel.org Fixes: 3899152ccbf4 ("KVM: nVMX: fix checks on CR{0,4} during virtual VMX o= peration") Signed-off-by: Sean Christopherson Message-Id: <20220607213604.3346000-3-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/vmx/nested.h +++ b/arch/x86/kvm/vmx/nested.h @@ -281,7 +281,8 @@ static inline bool nested_cr4_valid(stru u64 fixed0 =3D to_vmx(vcpu)->nested.msrs.cr4_fixed0; u64 fixed1 =3D to_vmx(vcpu)->nested.msrs.cr4_fixed1; =20 - return fixed_bits_valid(val, fixed0, fixed1); + return fixed_bits_valid(val, fixed0, fixed1) && + __kvm_is_valid_cr4(vcpu, val); } =20 /* No difference in the restrictions on guest and host CR4 in VMX operatio= n. */ From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB393C282E7 for ; Mon, 15 Aug 2022 20:16:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346549AbiHOUQJ (ORCPT ); Mon, 15 Aug 2022 16:16:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346247AbiHOULF (ORCPT ); Mon, 15 Aug 2022 16:11:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01F082873A; Mon, 15 Aug 2022 11:57:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 884B7B8109E; Mon, 15 Aug 2022 18:57:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE1A3C43470; Mon, 15 Aug 2022 18:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589845; bh=2CHC3svalq1Gyf9BQX3NmCndAGt4dNGgpMfHUiU2LWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kqRdFrQFyIwV0TVTsVorGSyqsEHMcQN1x7xRewh4LaaPdlatKoYMIMq6MsKiwk/de 1HKIyrw8cZel7kBtR3h8+Eh2+MuF1eAXLivzVlr1kmh7F8pjbBEKKKtwi5BTUc1hpn d5bZF1UA9qBhQ/WdfmRyG5OCJZzcacc4XU+81SVU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Li , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.18 0035/1095] KVM: nVMX: Inject #UD if VMXON is attempted with incompatible CR0/CR4 Date: Mon, 15 Aug 2022 19:50:34 +0200 Message-Id: <20220815180430.838822104@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit c7d855c2aff2d511fd60ee2e356134c4fb394799 upstream. Inject a #UD if L1 attempts VMXON with a CR0 or CR4 that is disallowed per the associated nested VMX MSRs' fixed0/1 settings. KVM cannot rely on hardware to perform the checks, even for the few checks that have higher priority than VM-Exit, as (a) KVM may have forced CR0/CR4 bits in hardware while running the guest, (b) there may incompatible CR0/CR4 bits that have lower priority than VM-Exit, e.g. CR0.NE, and (c) userspace may have further restricted the allowed CR0/CR4 values by manipulating the guest's nested VMX MSRs. Note, despite a very strong desire to throw shade at Jim, commit 70f3aac964ae ("kvm: nVMX: Remove superfluous VMX instruction fault checks") is not to blame for the buggy behavior (though the comment...). That commit only removed the CR0.PE, EFLAGS.VM, and COMPATIBILITY mode checks (though it did erroneously drop the CPL check, but that has already been remedied). KVM may force CR0.PE=3D1, but will do so only when also forcing EFLAGS.VM=3D1 to emulate Real Mode, i.e. hardware will still #UD. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216033 Fixes: ec378aeef9df ("KVM: nVMX: Implement VMXON and VMXOFF") Reported-by: Eric Li Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220607213604.3346000-4-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -4973,20 +4973,25 @@ static int handle_vmon(struct kvm_vcpu * | FEAT_CTL_VMX_ENABLED_OUTSIDE_SMX; =20 /* - * The Intel VMX Instruction Reference lists a bunch of bits that are - * prerequisite to running VMXON, most notably cr4.VMXE must be set to - * 1 (see vmx_is_valid_cr4() for when we allow the guest to set this). - * Otherwise, we should fail with #UD. But most faulting conditions - * have already been checked by hardware, prior to the VM-exit for - * VMXON. We do test guest cr4.VMXE because processor CR4 always has - * that bit set to 1 in non-root mode. + * Note, KVM cannot rely on hardware to perform the CR0/CR4 #UD checks + * that have higher priority than VM-Exit (see Intel SDM's pseudocode + * for VMXON), as KVM must load valid CR0/CR4 values into hardware while + * running the guest, i.e. KVM needs to check the _guest_ values. + * + * Rely on hardware for the other two pre-VM-Exit checks, !VM86 and + * !COMPATIBILITY modes. KVM may run the guest in VM86 to emulate Real + * Mode, but KVM will never take the guest out of those modes. */ - if (!kvm_read_cr4_bits(vcpu, X86_CR4_VMXE)) { + if (!nested_host_cr0_valid(vcpu, kvm_read_cr0(vcpu)) || + !nested_host_cr4_valid(vcpu, kvm_read_cr4(vcpu))) { kvm_queue_exception(vcpu, UD_VECTOR); return 1; } =20 - /* CPL=3D0 must be checked manually. */ + /* + * CPL=3D0 and all other checks that are lower priority than VM-Exit must + * be checked manually. + */ if (vmx_get_cpl(vcpu)) { kvm_inject_gp(vcpu, 0); return 1; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7D05C25B08 for ; Mon, 15 Aug 2022 20:16:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231728AbiHOUQy (ORCPT ); Mon, 15 Aug 2022 16:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346256AbiHOULG (ORCPT ); Mon, 15 Aug 2022 16:11:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BB2B2A719; Mon, 15 Aug 2022 11:57:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C6FAF61268; Mon, 15 Aug 2022 18:57:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C90D2C433B5; Mon, 15 Aug 2022 18:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589848; bh=0qhytQhAGsmyQiX8PjVBdYkViWXICbwq786/9Rnsrzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m49RwZ7L3kyMWVvJx83XWgtU4k78lkf5/cCJlObk+mW9rhTzHgqunNY+ZxKv1gbUt 2jXXveIPynh4AQUM53YtqZOGwYrMc/9LP6HS7PuVnozUKvfTG9k8PLEvgIasGsQmtZ 4WC29+fm1PkrFDoyfz7Hnlth8XKgdX2HeKQvkkNQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+760a73552f47a8cd0fd9@syzkaller.appspotmail.com, Tetsuo Handa , Hou Wenlong , Sean Christopherson , Maxim Levitsky Subject: [PATCH 5.18 0036/1095] KVM: x86: Mark TSS busy during LTR emulation _after_ all fault checks Date: Mon, 15 Aug 2022 19:50:35 +0200 Message-Id: <20220815180430.879250866@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit ec6e4d863258d4bfb36d48d5e3ef68140234d688 upstream. Wait to mark the TSS as busy during LTR emulation until after all fault checks for the LTR have passed. Specifically, don't mark the TSS busy if the new TSS base is non-canonical. Opportunistically drop the one-off !seg_desc.PRESENT check for TR as the only reason for the early check was to avoid marking a !PRESENT TSS as busy, i.e. the common !PRESENT is now done before setting the busy bit. Fixes: e37a75a13cda ("KVM: x86: Emulator ignores LDTR/TR extended base on L= LDT/LTR") Reported-by: syzbot+760a73552f47a8cd0fd9@syzkaller.appspotmail.com Cc: stable@vger.kernel.org Cc: Tetsuo Handa Cc: Hou Wenlong Signed-off-by: Sean Christopherson Reviewed-by: Maxim Levitsky Link: https://lore.kernel.org/r/20220711232750.1092012-2-seanjc@google.com Signed-off-by: Sean Christopherson Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/emulate.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1687,16 +1687,6 @@ static int __load_segment_descriptor(str case VCPU_SREG_TR: if (seg_desc.s || (seg_desc.type !=3D 1 && seg_desc.type !=3D 9)) goto exception; - if (!seg_desc.p) { - err_vec =3D NP_VECTOR; - goto exception; - } - old_desc =3D seg_desc; - seg_desc.type |=3D 2; /* busy */ - ret =3D ctxt->ops->cmpxchg_emulated(ctxt, desc_addr, &old_desc, &seg_des= c, - sizeof(seg_desc), &ctxt->exception); - if (ret !=3D X86EMUL_CONTINUE) - return ret; break; case VCPU_SREG_LDTR: if (seg_desc.s || seg_desc.type !=3D 2) @@ -1737,6 +1727,15 @@ static int __load_segment_descriptor(str ((u64)base3 << 32), ctxt)) return emulate_gp(ctxt, 0); } + + if (seg =3D=3D VCPU_SREG_TR) { + old_desc =3D seg_desc; + seg_desc.type |=3D 2; /* busy */ + ret =3D ctxt->ops->cmpxchg_emulated(ctxt, desc_addr, &old_desc, &seg_des= c, + sizeof(seg_desc), &ctxt->exception); + if (ret !=3D X86EMUL_CONTINUE) + return ret; + } load: ctxt->ops->set_segment(ctxt, selector, &seg_desc, base3, seg); if (desc) From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87C92C25B0E for ; Mon, 15 Aug 2022 20:09:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239648AbiHOUJv (ORCPT ); Mon, 15 Aug 2022 16:09:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345858AbiHOUJD (ORCPT ); Mon, 15 Aug 2022 16:09:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 486AC48CB3; Mon, 15 Aug 2022 11:55:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6F9BC6123D; Mon, 15 Aug 2022 18:55:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59BDBC433D6; Mon, 15 Aug 2022 18:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589750; bh=97zjYBB23BfRBu0CCZkuOZde815VbzM7pC1v+wXwUcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lt+a6b3Z+vwqaw3z2UduD6NZH4NcIrmEACAy8uUvzckYcuuuVo+6g3CY9j/e36I5T aTVEksEdlGiss1xJyg8GUOd333XjET/zSnB19Y7Oj//9SLyE8hirZ1y9yFKKA43r59 uKqlSOS1y5N6NX53Z8q2SrU9YvBbJqgCytbO9/0g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Maxim Levitsky Subject: [PATCH 5.18 0037/1095] KVM: x86: Set error code to segment selector on LLDT/LTR non-canonical #GP Date: Mon, 15 Aug 2022 19:50:36 +0200 Message-Id: <20220815180430.925274525@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit 2626206963ace9e8bf92b6eea5ff78dd674c555c upstream. When injecting a #GP on LLDT/LTR due to a non-canonical LDT/TSS base, set the error code to the selector. Intel SDM's says nothing about the #GP, but AMD's APM explicitly states that both LLDT and LTR set the error code to the selector, not zero. Note, a non-canonical memory operand on LLDT/LTR does generate a #GP(0), but the KVM code in question is specific to the base from the descriptor. Fixes: e37a75a13cda ("KVM: x86: Emulator ignores LDTR/TR extended base on L= LDT/LTR") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Reviewed-by: Maxim Levitsky Link: https://lore.kernel.org/r/20220711232750.1092012-3-seanjc@google.com Signed-off-by: Sean Christopherson Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/emulate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1724,8 +1724,8 @@ static int __load_segment_descriptor(str if (ret !=3D X86EMUL_CONTINUE) return ret; if (emul_is_noncanonical_address(get_desc_base(&seg_desc) | - ((u64)base3 << 32), ctxt)) - return emulate_gp(ctxt, 0); + ((u64)base3 << 32), ctxt)) + return emulate_gp(ctxt, err_code); } =20 if (seg =3D=3D VCPU_SREG_TR) { From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C71BBC00140 for ; Mon, 15 Aug 2022 20:10:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230194AbiHOUKQ (ORCPT ); Mon, 15 Aug 2022 16:10:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345945AbiHOUJI (ORCPT ); Mon, 15 Aug 2022 16:09:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DEB448E8B; Mon, 15 Aug 2022 11:55:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5BEC2B81082; Mon, 15 Aug 2022 18:55:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 584BEC433D7; Mon, 15 Aug 2022 18:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589753; bh=0Vf1LBb2tevvjfeLXP55gJuVlTgflOIAvvALnHmU5zI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pwP21o0rg3LTYQxU5rl2s1gghj97M0N4oVZ+ZzvjXZdUfRzTKPczm8B+DB3Ft4Fmg s7u9yEy8II8s/OdKvvsttYjalHNv+mETTAusFcb89fsL47EsS9KcZJMKFpusO2vANU fF85eJhQrO66SosnLZCybgsoRJpuUu6sr4/TxXlA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vitaly Kuznetsov , Maxim Levitsky , Sean Christopherson Subject: [PATCH 5.18 0038/1095] KVM: nVMX: Always enable TSC scaling for L2 when it was enabled for L1 Date: Mon, 15 Aug 2022 19:50:37 +0200 Message-Id: <20220815180430.975118197@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vitaly Kuznetsov commit 156b9d76e8822f2956c15029acf2d4b171502f3a upstream. Windows 10/11 guests with Hyper-V role (WSL2) enabled are observed to hang upon boot or shortly after when a non-default TSC frequency was set for L1. The issue is observed on a host where TSC scaling is supported. The problem appears to be that Windows doesn't use TSC scaling for its guests, even when the feature is advertised, and KVM filters SECONDARY_EXEC_TSC_SCALING out when creating L2 controls from L1's VMCS. This leads to L2 running with the default frequency (matching host's) while L1 is running with an altered one. Keep SECONDARY_EXEC_TSC_SCALING in secondary exec controls for L2 when it was set for L1. TSC_MULTIPLIER is already correctly computed and written by prepare_vmcs02(). Signed-off-by: Vitaly Kuznetsov Fixes: d041b5ea93352b ("KVM: nVMX: Enable nested TSC scaling") Cc: stable@vger.kernel.org Reviewed-by: Maxim Levitsky Link: https://lore.kernel.org/r/20220712135009.952805-1-vkuznets@redhat.com Signed-off-by: Sean Christopherson Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.c | 1 - 1 file changed, 1 deletion(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -2283,7 +2283,6 @@ static void prepare_vmcs02_early(struct SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY | SECONDARY_EXEC_APIC_REGISTER_VIRT | SECONDARY_EXEC_ENABLE_VMFUNC | - SECONDARY_EXEC_TSC_SCALING | SECONDARY_EXEC_DESC); =20 if (nested_cpu_has(vmcs12, From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98611C00140 for ; Mon, 15 Aug 2022 20:18:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230397AbiHOUSM (ORCPT ); Mon, 15 Aug 2022 16:18:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231645AbiHOUJ1 (ORCPT ); Mon, 15 Aug 2022 16:09:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E745E83F13; Mon, 15 Aug 2022 11:56:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 35A35B8105C; Mon, 15 Aug 2022 18:55:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D315C433B5; Mon, 15 Aug 2022 18:55:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589756; bh=ykdKXs4qXCQoLzzTkpAnTym0LPHlNozcDOaKd/4WEhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0mwq2KFQEUUdbj+L1/uXCiALmqZYwKc/vQbqI9ITomoAPMjuZgaiXvfImSbG2dvSD rlLT4Nmk14QHFBwPdeYMOcRypy0qbsB8m5Jxb2EhveeeCTjSwnW+Bh9RdCNH+kHIF6 GK/sHsOKdpQKjFHNUGzDvr5PG3MCb5UBOLjw3AaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Huang , Michael Roth , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.18 0039/1095] KVM: x86: Tag kvm_mmu_x86_module_init() with __init Date: Mon, 15 Aug 2022 19:50:38 +0200 Message-Id: <20220815180431.026391216@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit 982bae43f11c37b51d2f1961bb25ef7cac3746fa upstream. Mark kvm_mmu_x86_module_init() with __init, the entire reason it exists is to initialize variables when kvm.ko is loaded, i.e. it must never be called after module initialization. Fixes: 1d0e84806047 ("KVM: x86/mmu: Resolve nx_huge_pages when kvm.ko is lo= aded") Cc: stable@vger.kernel.org Reviewed-by: Kai Huang Tested-by: Michael Roth Signed-off-by: Sean Christopherson Message-Id: <20220803224957.1285926-2-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/mmu/mmu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1588,7 +1588,7 @@ static inline int kvm_arch_flush_remote_ #define kvm_arch_pmi_in_guest(vcpu) \ ((vcpu) && (vcpu)->arch.handling_intr_from_guest) =20 -void kvm_mmu_x86_module_init(void); +void __init kvm_mmu_x86_module_init(void); int kvm_mmu_vendor_module_init(void); void kvm_mmu_vendor_module_exit(void); =20 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -6264,7 +6264,7 @@ static int set_nx_huge_pages(const char * nx_huge_pages needs to be resolved to true/false when kvm.ko is loaded,= as * its default value of -1 is technically undefined behavior for a boolean. */ -void kvm_mmu_x86_module_init(void) +void __init kvm_mmu_x86_module_init(void) { if (nx_huge_pages =3D=3D -1) __set_nx_huge_pages(get_nx_auto_mode()); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45107C00140 for ; Mon, 15 Aug 2022 20:16:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229585AbiHOUPh (ORCPT ); Mon, 15 Aug 2022 16:15:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242663AbiHOUJd (ORCPT ); Mon, 15 Aug 2022 16:09:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 169DB83F25; Mon, 15 Aug 2022 11:56:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7A286B81082; Mon, 15 Aug 2022 18:56:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7508BC433C1; Mon, 15 Aug 2022 18:55:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589759; bh=ii10Fs2g9tmcQoujzfpb1e/bISm5/ymiR4b6QYyeZEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CvCVoxssRdoRGe+8pq7PZo7pRe59BE7zxg1VHZh8i7ois8r6oosgSbPW0rjfQNvry b0WTeUeL6/EDzgr3KvyE5iYPhijpfPTjeYEkc9xEPb33876ivClECJbZQfOwWmYXFV 5VuhnyxJi6FkPLX4MIJCVQMN+RgRL+CdSS6E20cg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Woodhouse , Paolo Bonzini Subject: [PATCH 5.18 0040/1095] KVM: x86: do not report preemption if the steal time cache is stale Date: Mon, 15 Aug 2022 19:50:39 +0200 Message-Id: <20220815180431.074751502@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini commit c3c28d24d910a746b02f496d190e0e8c6560224b upstream. Commit 7e2175ebd695 ("KVM: x86: Fix recording of guest steal time / preempted status", 2021-11-11) open coded the previous call to kvm_map_gfn, but in doing so it dropped the comparison between the cached guest physical address and the one in the MSR. This cause an incorrect cache hit if the guest modifies the steal time address while the memslots remain the same. This can happen with kexec, in which case the preempted bit is written at the address used by the old kernel instead of the old one. Cc: David Woodhouse Cc: stable@vger.kernel.org Fixes: 7e2175ebd695 ("KVM: x86: Fix recording of guest steal time / preempt= ed status") Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/x86.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4614,6 +4614,7 @@ static void kvm_steal_time_set_preempted struct kvm_steal_time __user *st; struct kvm_memslots *slots; static const u8 preempted =3D KVM_VCPU_PREEMPTED; + gpa_t gpa =3D vcpu->arch.st.msr_val & KVM_STEAL_VALID_BITS; =20 /* * The vCPU can be marked preempted if and only if the VM-Exit was on @@ -4641,6 +4642,7 @@ static void kvm_steal_time_set_preempted slots =3D kvm_memslots(vcpu->kvm); =20 if (unlikely(slots->generation !=3D ghc->generation || + gpa !=3D ghc->gpa || kvm_is_error_hva(ghc->hva) || !ghc->memslot)) return; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40203C2BB41 for ; Mon, 15 Aug 2022 20:17:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239413AbiHOUQ7 (ORCPT ); Mon, 15 Aug 2022 16:16:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242804AbiHOUJd (ORCPT ); Mon, 15 Aug 2022 16:09:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0A2A83F27; Mon, 15 Aug 2022 11:56:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7875661269; Mon, 15 Aug 2022 18:56:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F037C4347C; Mon, 15 Aug 2022 18:56:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589762; bh=UerYEdi2BJaXW/viwnJ9EWi8N9rrZIUY1Zl3yZjqTMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xtM2EoDcPxlpiJBxlcfAJt2TpdmAjdefOWTu0/oZWlbDhAzot8DFdW/2L5YdnuFK2 Rq9JadkfRu39xe3dXgpk2y7dwZXTUI2ieD7jeh6ryVx7NlErEzJrCVXmz0+tzV5dXA VVG9KhxTi8yQaqZtwm2Dr4I8ZH07ZHDV8nNDyPIY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Young , Xiaoying Yan , David Woodhouse , Paolo Bonzini , "Dr . David Alan Gilbert" Subject: [PATCH 5.18 0041/1095] KVM: x86: revalidate steal time cache if MSR value changes Date: Mon, 15 Aug 2022 19:50:40 +0200 Message-Id: <20220815180431.127649155@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini commit 901d3765fa804ce42812f1d5b1f3de2dfbb26723 upstream. Commit 7e2175ebd695 ("KVM: x86: Fix recording of guest steal time / preempted status", 2021-11-11) open coded the previous call to kvm_map_gfn, but in doing so it dropped the comparison between the cached guest physical address and the one in the MSR. This cause an incorrect cache hit if the guest modifies the steal time address while the memslots remain the same. This can happen with kexec, in which case the steal time data is written at the address used by the old kernel instead of the old one. While at it, rename the variable from gfn to gpa since it is a plain physical address and not a right-shifted one. Reported-by: Dave Young Reported-by: Xiaoying Yan Analyzed-by: Dr. David Alan Gilbert Cc: David Woodhouse Cc: stable@vger.kernel.org Fixes: 7e2175ebd695 ("KVM: x86: Fix recording of guest steal time / preempt= ed status") Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/x86.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3367,6 +3367,7 @@ static void record_steal_time(struct kvm struct gfn_to_hva_cache *ghc =3D &vcpu->arch.st.cache; struct kvm_steal_time __user *st; struct kvm_memslots *slots; + gpa_t gpa =3D vcpu->arch.st.msr_val & KVM_STEAL_VALID_BITS; u64 steal; u32 version; =20 @@ -3384,13 +3385,12 @@ static void record_steal_time(struct kvm slots =3D kvm_memslots(vcpu->kvm); =20 if (unlikely(slots->generation !=3D ghc->generation || + gpa !=3D ghc->gpa || kvm_is_error_hva(ghc->hva) || !ghc->memslot)) { - gfn_t gfn =3D vcpu->arch.st.msr_val & KVM_STEAL_VALID_BITS; - /* We rely on the fact that it fits in a single page. */ BUILD_BUG_ON((sizeof(*st) - 1) & KVM_STEAL_VALID_BITS); =20 - if (kvm_gfn_to_hva_cache_init(vcpu->kvm, ghc, gfn, sizeof(*st)) || + if (kvm_gfn_to_hva_cache_init(vcpu->kvm, ghc, gpa, sizeof(*st)) || kvm_is_error_hva(ghc->hva) || !ghc->memslot) return; } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC835C25B08 for ; Mon, 15 Aug 2022 20:13:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242900AbiHOUNc (ORCPT ); Mon, 15 Aug 2022 16:13:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243972AbiHOUJg (ORCPT ); Mon, 15 Aug 2022 16:09:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F02ED299; Mon, 15 Aug 2022 11:56:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8E1D06125B; Mon, 15 Aug 2022 18:56:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98F76C433B5; Mon, 15 Aug 2022 18:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589766; bh=ELjryB8FWGLugOIuSJFH96NH9H+/KyRj7dUBAwO2eqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1MpXWzROWKlrW4HGu4RpcppXzG7R/HtVbiF7UIo2YN/djlo/TgKRh8AsjuJY/6Tlz JnDrXMTtJ2XMO0rhZDLIYe/9g5CZcSVM9azQPx3eMIQ6QilHz3MOa5EFEWvnyNrkWv QHLDSMTxuq/hjEl2MOFzt2qJiNp5H0v83TLEt2Xc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.18 0042/1095] ALSA: hda/conexant: Add quirk for LENOVO 20149 Notebook model Date: Mon, 15 Aug 2022 19:50:41 +0200 Message-Id: <20220815180431.175225230@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit f83bb2592482fe94c6eea07a8121763c80f36ce5 upstream. There is another LENOVO 20149 (Type1Sku0) Notebook model with CX20590, the device PCI SSID is 17aa:3977, which headphones are not responding, that requires the quirk CXT_PINCFG_LENOVO_NOTEBOOK. Add the corresponding entry to the quirk table. Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220808073406.19460-1-tangmeng@uniontech.c= om Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_conexant.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -222,6 +222,7 @@ enum { CXT_PINCFG_LEMOTE_A1205, CXT_PINCFG_COMPAQ_CQ60, CXT_FIXUP_STEREO_DMIC, + CXT_PINCFG_LENOVO_NOTEBOOK, CXT_FIXUP_INC_MIC_BOOST, CXT_FIXUP_HEADPHONE_MIC_PIN, CXT_FIXUP_HEADPHONE_MIC, @@ -772,6 +773,14 @@ static const struct hda_fixup cxt_fixups .type =3D HDA_FIXUP_FUNC, .v.func =3D cxt_fixup_stereo_dmic, }, + [CXT_PINCFG_LENOVO_NOTEBOOK] =3D { + .type =3D HDA_FIXUP_PINS, + .v.pins =3D (const struct hda_pintbl[]) { + { 0x1a, 0x05d71030 }, + { } + }, + .chain_id =3D CXT_FIXUP_STEREO_DMIC, + }, [CXT_FIXUP_INC_MIC_BOOST] =3D { .type =3D HDA_FIXUP_FUNC, .v.func =3D cxt5066_increase_mic_boost, @@ -971,7 +980,7 @@ static const struct snd_pci_quirk cxt506 SND_PCI_QUIRK(0x17aa, 0x3905, "Lenovo G50-30", CXT_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), - SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMI= C), + SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_PINCFG_LENOVO_NO= TEBOOK), SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI), From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D2ADC00140 for ; Mon, 15 Aug 2022 20:16:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346645AbiHOUQR (ORCPT ); Mon, 15 Aug 2022 16:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243473AbiHOUJh (ORCPT ); Mon, 15 Aug 2022 16:09:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5627844D1; Mon, 15 Aug 2022 11:56:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5D1A26123D; Mon, 15 Aug 2022 18:56:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A95DAC43142; Mon, 15 Aug 2022 18:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589769; bh=5T9sZsUjVjATFoJV6q2ZZ2gMz8QuQmNVK0O3y/brn4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TBwgeNjsWhISEosYxjGbSRoh1CQm5wBA2QAZBolGp3+12cDSQYxwuGEst/kgs0dgm K+Fh/S3Z3LUtR0VOZsOrfwYSCeROpFsHerEc285xhU8dBjhjvSf2KeICcV3qFTKpVf D3rSHR41kSw3iFVKLCCv/z2fIohsRHP40iqP3Rp4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Allen Ballway , Takashi Iwai Subject: [PATCH 5.18 0043/1095] ALSA: hda/cirrus - support for iMac 12,1 model Date: Mon, 15 Aug 2022 19:50:42 +0200 Message-Id: <20220815180431.225529328@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Allen Ballway commit 74bba640d69914cf832b87f6bbb700e5ba430672 upstream. The 12,1 model requires the same configuration as the 12,2 model to enable headphones but has a different codec SSID. Adds 12,1 SSID for matching quirk. [ re-sorted in SSID order by tiwai ] Signed-off-by: Allen Ballway Cc: Link: https://lore.kernel.org/r/20220810152701.1.I902c2e591bbf8de9acb649d13= 22fa1f291849266@changeid Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_cirrus.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c @@ -395,6 +395,7 @@ static const struct snd_pci_quirk cs420x =20 /* codec SSID */ SND_PCI_QUIRK(0x106b, 0x0600, "iMac 14,1", CS420X_IMAC27_122), + SND_PCI_QUIRK(0x106b, 0x0900, "iMac 12,1", CS420X_IMAC27_122), SND_PCI_QUIRK(0x106b, 0x1c00, "MacBookPro 8,1", CS420X_MBP81), SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122), SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101), From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A3A3C00140 for ; Mon, 15 Aug 2022 20:22:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346533AbiHOUUg (ORCPT ); Mon, 15 Aug 2022 16:20:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344832AbiHOUJo (ORCPT ); Mon, 15 Aug 2022 16:09:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99FA72705; Mon, 15 Aug 2022 11:56:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 20E876125B; Mon, 15 Aug 2022 18:56:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12D3DC433C1; Mon, 15 Aug 2022 18:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589772; bh=vojduCioZU72AP6BPNWFv/LPak1ZFP+99zslQ2g/d1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cz4b/OhWC1sH5Xsa9C13Si3QrSe47usrNhbWqX6Z53ulJ7/1R00e/VLJssV+NxfKo oYSPR6JkfOxfw00asrI+DYoOqgU1CUvusILFbBYrYK+iRxHr8E9C5dLC9II808VE7w befD0/6wPCNf4lRvuNjlqYgzSPpmCkAXYqjAkXRg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.18 0044/1095] ALSA: hda/realtek: Add quirk for another Asus K42JZ model Date: Mon, 15 Aug 2022 19:50:43 +0200 Message-Id: <20220815180431.275083033@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit f882c4bef9cb914d9f7be171afb10ed26536bfa7 upstream. There is another Asus K42JZ model with the PCI SSID 1043:1313 that requires the quirk ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE. Add the corresponding entry to the quirk table. Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220805074534.20003-1-tangmeng@uniontech.c= om Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6931,6 +6931,7 @@ enum { ALC269_FIXUP_LIMIT_INT_MIC_BOOST, ALC269VB_FIXUP_ASUS_ZENBOOK, ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, + ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE, ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED, ALC269VB_FIXUP_ORDISSIMO_EVE2, ALC283_FIXUP_CHROME_BOOK, @@ -7518,6 +7519,15 @@ static const struct hda_fixup alc269_fix .chained =3D true, .chain_id =3D ALC269VB_FIXUP_ASUS_ZENBOOK, }, + [ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] =3D { + .type =3D HDA_FIXUP_PINS, + .v.pins =3D (const struct hda_pintbl[]) { + { 0x18, 0x01a110f0 }, /* use as headset mic */ + { } + }, + .chained =3D true, + .chain_id =3D ALC269_FIXUP_HEADSET_MIC + }, [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] =3D { .type =3D HDA_FIXUP_FUNC, .v.func =3D alc269_fixup_limit_int_mic_boost, @@ -9289,6 +9299,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_M= IC_NO_PRESENCE), SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PR= ESENCE), SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_Z= ENBOOK), SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_Z= ENBOOK_UX31A), From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B12ABC32763 for ; Mon, 15 Aug 2022 20:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347150AbiHOUQu (ORCPT ); Mon, 15 Aug 2022 16:16:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345876AbiHOUJs (ORCPT ); Mon, 15 Aug 2022 16:09:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 964C860D1; Mon, 15 Aug 2022 11:56:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 33AFB6123D; Mon, 15 Aug 2022 18:56:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22DA0C433D7; Mon, 15 Aug 2022 18:56:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589775; bh=2s6DLnBMZjpDPk2dGSvozIT9Ci6o/Qk7OdSE3YjsmmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BJdO86NdPkkEcOcVxkUo9AOtbTu/00uhfPWBByrsyhB+10JOOn2hcA9To4YWpeJjh z+ZUGIY8Bk+XoH8Lhev/5qDXgF7oQkksEEfOI3V+XRDp/0Aoxy88j7Rr8DSKLlFiKA Rk3w1LDrKX3VV7oQxcFt+qHWsnwksklW4SJdjcOE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bedant Patnaik , Takashi Iwai Subject: [PATCH 5.18 0045/1095] ALSA: hda/realtek: Add a quirk for HP OMEN 15 (8786) mute LED Date: Mon, 15 Aug 2022 19:50:44 +0200 Message-Id: <20220815180431.311522894@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bedant Patnaik commit 30267718fe2d4dbea49015b022f6f1fe16ca31ab upstream. Board ID 8786 seems to be another variant of the Omen 15 that needs ALC285_FIXUP_HP_MUTE_LED for working mute LED. Signed-off-by: Bedant Patnaik Cc: Link: https://lore.kernel.org/r/20220809142455.6473-1-bedant.patnaik@gmail.= com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9230,6 +9230,7 @@ static const struct snd_pci_quirk alc269 ALC285_FIXUP_HP_GPIO_AMP_INIT), SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation", ALC285_FIXUP_HP_GPIO_AMP_INIT), + SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED), From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5CC2C28B2B for ; Mon, 15 Aug 2022 20:16:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346513AbiHOUP7 (ORCPT ); Mon, 15 Aug 2022 16:15:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230373AbiHOUJv (ORCPT ); Mon, 15 Aug 2022 16:09:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6165FBEC; Mon, 15 Aug 2022 11:56:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F20FCB8105C; Mon, 15 Aug 2022 18:56:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 679B6C433D6; Mon, 15 Aug 2022 18:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589778; bh=xiETIeoHQ+5PvRfu22IMJsts+TQDJtrJiMNFQMjmY/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vCER2ETAsNBI0rP6Ji98Uerro/fVTjJ4GEPlTtd/+PeBW9qxgve9Bjwcwgnydr5nU W9HtE1iSd9P7ZEV/4Mc6RpoVCgvWjYSGDPNPH431m0T9KV+1zMXL+yUr38PEjhAlmv dBB9gue+6YiSylya+LF8OK5Vxeqo1SjXiiFHYYeA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Jiri Slaby , Tetsuo Handa Subject: [PATCH 5.18 0046/1095] tty: vt: initialize unicode screen buffer Date: Mon, 15 Aug 2022 19:50:45 +0200 Message-Id: <20220815180431.351866108@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tetsuo Handa commit af77c56aa35325daa2bc2bed5c2ebf169be61b86 upstream. syzbot reports kernel infoleak at vcs_read() [1], for buffer can be read immediately after resize operation. Initialize buffer using kzalloc(). ---------- #include #include #include #include int main(int argc, char *argv[]) { struct fb_var_screeninfo var =3D { }; const int fb_fd =3D open("/dev/fb0", 3); ioctl(fb_fd, FBIOGET_VSCREENINFO, &var); var.yres =3D 0x21; ioctl(fb_fd, FBIOPUT_VSCREENINFO, &var); return read(open("/dev/vcsu", O_RDONLY), &var, sizeof(var)) =3D=3D -1; } ---------- Link: https://syzkaller.appspot.com/bug?extid=3D31a641689d43387f05d3 [1] Cc: stable Reported-by: syzbot Reviewed-by: Jiri Slaby Signed-off-by: Tetsuo Handa Link: https://lore.kernel.org/r/4ef053cf-e796-fb5e-58b7-3ae58242a4ad@I-love= .SAKURA.ne.jp Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/vt/vt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -344,7 +344,7 @@ static struct uni_screen *vc_uniscr_allo /* allocate everything in one go */ memsize =3D cols * rows * sizeof(char32_t); memsize +=3D rows * sizeof(char32_t *); - p =3D vmalloc(memsize); + p =3D vzalloc(memsize); if (!p) return NULL; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A136CC00140 for ; Mon, 15 Aug 2022 20:18:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244255AbiHOUSa (ORCPT ); Mon, 15 Aug 2022 16:18:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243999AbiHOUKj (ORCPT ); Mon, 15 Aug 2022 16:10:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 833296424; Mon, 15 Aug 2022 11:56:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 35BF9B81057; Mon, 15 Aug 2022 18:56:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3002C433C1; Mon, 15 Aug 2022 18:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589785; bh=e1bcoMHQ8z6gZIrlyNFmAhWYxrybUozV7Q7y76/g4bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LfmRNZF+NPwRTssJk7wrAMdfKhXqB7a9Ox3e4dk2aa5Glhf+X/4Yd3xwSpmYOY2DL Z5OUxC3WwM5DL2xGVLhD9W9zdAy/UeVRWV32QdkkGOEALL1bUPLWy05rQw92DVf4YG RBcsNjgxWHaLXNR0FulE2iGfyj6bnC++ETgMZLlY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Jeff Layton , Namjae Jeon , stable@kernel.org, Alexander Viro , Steve French , Hyunchul Lee , Chuck Lever , Dave Wysochanski , Linus Torvalds Subject: [PATCH 5.18 0047/1095] vfs: Check the truncate maximum size in inode_newsize_ok() Date: Mon, 15 Aug 2022 19:50:46 +0200 Message-Id: <20220815180431.398765259@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Howells commit e2ebff9c57fe4eb104ce4768f6ebcccf76bef849 upstream. If something manages to set the maximum file size to MAX_OFFSET+1, this can cause the xfs and ext4 filesystems at least to become corrupt. Ordinarily, the kernel protects against userspace trying this by checking the value early in the truncate() and ftruncate() system calls calls - but there are at least two places that this check is bypassed: (1) Cachefiles will round up the EOF of the backing file to DIO block size so as to allow DIO on the final block - but this might push the offset negative. It then calls notify_change(), but this inadvertently bypasses the checking. This can be triggered if someone puts an 8EiB-1 file on a server for someone else to try and access by, say, nfs. (2) ksmbd doesn't check the value it is given in set_end_of_file_info() and then calls vfs_truncate() directly - which also bypasses the check. In both cases, it is potentially possible for a network filesystem to cause a disk filesystem to be corrupted: cachefiles in the client's cache filesystem; ksmbd in the server's filesystem. nfsd is okay as it checks the value, but we can then remove this check too. Fix this by adding a check to inode_newsize_ok(), as called from setattr_prepare(), thereby catching the issue as filesystems set up to perform the truncate with minimal opportunity for bypassing the new check. Fixes: 1f08c925e7a3 ("cachefiles: Implement backing file wrangling") Fixes: f44158485826 ("cifsd: add file operations") Signed-off-by: David Howells Reported-by: Jeff Layton Tested-by: Jeff Layton Reviewed-by: Namjae Jeon Cc: stable@kernel.org Acked-by: Alexander Viro cc: Steve French cc: Hyunchul Lee cc: Chuck Lever cc: Dave Wysochanski Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/attr.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/attr.c +++ b/fs/attr.c @@ -184,6 +184,8 @@ EXPORT_SYMBOL(setattr_prepare); */ int inode_newsize_ok(const struct inode *inode, loff_t offset) { + if (offset < 0) + return -EINVAL; if (inode->i_size < offset) { unsigned long limit; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A835FC3F6B0 for ; Mon, 15 Aug 2022 20:16:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346453AbiHOUPt (ORCPT ); Mon, 15 Aug 2022 16:15:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244539AbiHOUKk (ORCPT ); Mon, 15 Aug 2022 16:10:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B30D6433; Mon, 15 Aug 2022 11:56:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DE6A7B81057; Mon, 15 Aug 2022 18:56:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6333C433D6; Mon, 15 Aug 2022 18:56:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589788; bh=9AXtdf7iMYEPfVdm49C8RitZ4xqPwFJVJ81OSCHZxDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kc0BI7Z/0KUTmuYCsoTYxrBql3AOaVrT+w3NkVdtj0+nfg6FMk/61AvAwetYbDh1D bjlQXlW4WpZ0OvLpns43ymmc6WzCtUQ9gGQO1wAK1gDiArDR5VlBsKVAvVCXs/NheA TqXUwnRz4Svb7p7ClfLafS3wKmCr6jn0PqqM6kmM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Christian Brauner (Microsoft)" , "Darrick J. Wong" , Yang Xu , Jeff Layton Subject: [PATCH 5.18 0048/1095] fs: Add missing umask strip in vfs_tmpfile Date: Mon, 15 Aug 2022 19:50:47 +0200 Message-Id: <20220815180431.439109572@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Xu commit ac6800e279a22b28f4fc21439843025a0d5bf03e upstream. All creation paths except for O_TMPFILE handle umask in the vfs directly if the filesystem doesn't support or enable POSIX ACLs. If the filesystem does then umask handling is deferred until posix_acl_create(). Because, O_TMPFILE misses umask handling in the vfs it will not honor umask settings. Fix this by adding the missing umask handling. Link: https://lore.kernel.org/r/1657779088-2242-2-git-send-email-xuyang2018= .jy@fujitsu.com Fixes: 60545d0d4610 ("[O_TMPFILE] it's still short a few helpers, but infra= structure should be OK now...") Cc: # 4.19+ Reported-by: Christian Brauner (Microsoft) Reviewed-by: Darrick J. Wong Reviewed-and-Tested-by: Jeff Layton Acked-by: Christian Brauner (Microsoft) Signed-off-by: Yang Xu Signed-off-by: Christian Brauner (Microsoft) Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/namei.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/namei.c +++ b/fs/namei.c @@ -3571,6 +3571,8 @@ struct dentry *vfs_tmpfile(struct user_n child =3D d_alloc(dentry, &slash_name); if (unlikely(!child)) goto out_err; + if (!IS_POSIXACL(dir)) + mode &=3D ~current_umask(); error =3D dir->i_op->tmpfile(mnt_userns, dir, child, mode); if (error) goto out_err; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5071AC00140 for ; Mon, 15 Aug 2022 20:14:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232389AbiHOUOs (ORCPT ); Mon, 15 Aug 2022 16:14:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346050AbiHOUKn (ORCPT ); Mon, 15 Aug 2022 16:10:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 976192606; Mon, 15 Aug 2022 11:56:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 547A1B81057; Mon, 15 Aug 2022 18:56:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80E9EC433D6; Mon, 15 Aug 2022 18:56:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589792; bh=aEfeu9f1lMXq8ZH7oRYczw5jkBVwbMgOJJdgiuGDQx4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UQYQf6eNVGDTQ6XJEWX/pkRHwsto9xiN963OGO3K9AQ+eRUfEUEzVMXM0VyAN41VY TcM/chTtDzZyvFrEKrIazqsDePhvbLyoy+u8QHgp8iossHutFtNJLCkWVodIvPcZaT A5RJKKDSnYUX9xjLyYXj3k/q0qNlWdtkcT7WrdL8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Di Shen , "Rafael J. Wysocki" Subject: [PATCH 5.18 0049/1095] thermal: sysfs: Fix cooling_device_stats_setup() error code path Date: Mon, 15 Aug 2022 19:50:48 +0200 Message-Id: <20220815180431.491568771@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki commit d5a8aa5d7d80d21ab6b266f1bed4194b61746199 upstream. If cooling_device_stats_setup() fails to create the stats object, it must clear the last slot in cooling_device_attr_groups that was initially empty (so as to make it possible to add stats attributes to the cooling device attribute groups). Failing to do so may cause the stats attributes to be created by mistake for a device that doesn't have a stats object, because the slot in question might be populated previously during the registration of another cooling device. Fixes: 8ea229511e06 ("thermal: Add cooling device's statistics in sysfs") Reported-by: Di Shen Tested-by: Di Shen Cc: 4.17+ # 4.17+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/thermal/thermal_sysfs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -813,12 +813,13 @@ static const struct attribute_group cool =20 static void cooling_device_stats_setup(struct thermal_cooling_device *cdev) { + const struct attribute_group *stats_attr_group =3D NULL; struct cooling_dev_stats *stats; unsigned long states; int var; =20 if (cdev->ops->get_max_state(cdev, &states)) - return; + goto out; =20 states++; /* Total number of states is highest state + 1 */ =20 @@ -828,7 +829,7 @@ static void cooling_device_stats_setup(s =20 stats =3D kzalloc(var, GFP_KERNEL); if (!stats) - return; + goto out; =20 stats->time_in_state =3D (ktime_t *)(stats + 1); stats->trans_table =3D (unsigned int *)(stats->time_in_state + states); @@ -838,9 +839,12 @@ static void cooling_device_stats_setup(s =20 spin_lock_init(&stats->lock); =20 + stats_attr_group =3D &cooling_device_stats_attr_group; + +out: /* Fill the empty slot left in cooling_device_attr_groups */ var =3D ARRAY_SIZE(cooling_device_attr_groups) - 2; - cooling_device_attr_groups[var] =3D &cooling_device_stats_attr_group; + cooling_device_attr_groups[var] =3D stats_attr_group; } =20 static void cooling_device_stats_destroy(struct thermal_cooling_device *cd= ev) From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72FA0C25B0E for ; Mon, 15 Aug 2022 20:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346376AbiHOUOb (ORCPT ); Mon, 15 Aug 2022 16:14:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346064AbiHOUKo (ORCPT ); Mon, 15 Aug 2022 16:10:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7B6A2AE4; Mon, 15 Aug 2022 11:56:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 81B20B8109E; Mon, 15 Aug 2022 18:56:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB916C433C1; Mon, 15 Aug 2022 18:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589795; bh=srz8143zkM9lvsMiZNve4c7EgZK6tCW2Vj7c/1l3Lv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h4fNn/jtTJe6G/tub84XLj2DDCB76NTr3VcvA4mERo7xCEN5T66C0tgs1IDIOTy/m 3b+hoGb8FDhAiW36fLOSnU3WIKMdt6fYXpsTU/26r0BNJR1Udemkuyutn/9rjfMddq jfaUuGNwORmc6UJcAtZjOcARZ6tkCMdXxkJmQopQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Helge Deller Subject: [PATCH 5.18 0050/1095] fbcon: Fix boundary checks for fbcon=vc:n1-n2 parameters Date: Mon, 15 Aug 2022 19:50:49 +0200 Message-Id: <20220815180431.544474353@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Helge Deller commit cad564ca557f8d3bb3b1fa965d9a2b3f6490ec69 upstream. The user may use the fbcon=3Dvc:- option to tell fbcon to take over the given range (n1...n2) of consoles. The value for n1 and n2 needs to be a positive number and up to (MAX_NR_CONSOLES - 1). The given values were not fully checked against those boundaries yet. To fix the issue, convert first_fb_vc and last_fb_vc to unsigned integers and check them against the upper boundary, and make sure that first_fb_vc is smaller than last_fb_vc. Cc: stable@vger.kernel.org # v4.19+ Reviewed-by: Daniel Vetter Signed-off-by: Helge Deller Link: https://patchwork.freedesktop.org/patch/msgid/YpkYRMojilrtZIgM@p100 Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/video/fbdev/core/fbcon.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -115,8 +115,8 @@ static int logo_lines; enums. */ static int logo_shown =3D FBCON_LOGO_CANSHOW; /* console mappings */ -static int first_fb_vc; -static int last_fb_vc =3D MAX_NR_CONSOLES - 1; +static unsigned int first_fb_vc; +static unsigned int last_fb_vc =3D MAX_NR_CONSOLES - 1; static int fbcon_is_default =3D 1;=20 static int primary_device =3D -1; static int fbcon_has_console_bind; @@ -464,10 +464,12 @@ static int __init fb_console_setup(char options +=3D 3; if (*options) first_fb_vc =3D simple_strtoul(options, &options, 10) - 1; - if (first_fb_vc < 0) + if (first_fb_vc >=3D MAX_NR_CONSOLES) first_fb_vc =3D 0; if (*options++ =3D=3D '-') last_fb_vc =3D simple_strtoul(options, &options, 10) - 1; + if (last_fb_vc < first_fb_vc || last_fb_vc >=3D MAX_NR_CONSOLES) + last_fb_vc =3D MAX_NR_CONSOLES - 1; fbcon_is_default =3D 0;=20 continue; } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D0A7C00140 for ; Mon, 15 Aug 2022 20:17:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239441AbiHOURO (ORCPT ); Mon, 15 Aug 2022 16:17:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346093AbiHOUKr (ORCPT ); Mon, 15 Aug 2022 16:10:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0A9D6447; Mon, 15 Aug 2022 11:56:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9BCF3B81082; Mon, 15 Aug 2022 18:56:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFACEC433C1; Mon, 15 Aug 2022 18:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589798; bh=d0+uaXnzk2ajdnldlX+pjv1VYjPMK/590gVPt1rVsX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XoLjRUXAxQjNDyxEBuy6lR4PV6DrwjmK9NmRPtcCNn/gg3pawfxE6LjQVSxI4RbcV UD4xkJeqcOfjAQNg2Cgkp/2Mcza+45SfzIIeIJVUCp6+sJytucDgEIisRRrBx2qszo fhp+uBfmcV2O2UXHL/f9UaxnDOBwEexRft+mHYy0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Helge Deller Subject: [PATCH 5.18 0051/1095] fbcon: Fix accelerated fbdev scrolling while logo is still shown Date: Mon, 15 Aug 2022 19:50:50 +0200 Message-Id: <20220815180431.588084175@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Helge Deller commit 3866cba87dcd0162fb41e9b3b653d0af68fad5ec upstream. There is no need to directly skip over to the SCROLL_REDRAW case while the logo is still shown. When using DRM, this change has no effect because the code will reach the SCROLL_REDRAW case immediately anyway. But if you run an accelerated fbdev driver and have FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION enabled, console scrolling is slowed down by factors so that it feels as if you use a 9600 baud terminal. So, drop those unnecessary checks and speed up fbdev console acceleration during bootup. Cc: stable@vger.kernel.org # v5.10+ Acked-by: Daniel Vetter Signed-off-by: Helge Deller Link: https://patchwork.freedesktop.org/patch/msgid/YpkYxk7wsBPx3po+@p100 Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/video/fbdev/core/fbcon.c | 4 ---- 1 file changed, 4 deletions(-) --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -1706,8 +1706,6 @@ static bool fbcon_scroll(struct vc_data case SM_UP: if (count > vc->vc_rows) /* Maximum realistic size */ count =3D vc->vc_rows; - if (logo_shown >=3D 0) - goto redraw_up; switch (fb_scrollmode(p)) { case SCROLL_MOVE: fbcon_redraw_blit(vc, info, p, t, b - t - count, @@ -1796,8 +1794,6 @@ static bool fbcon_scroll(struct vc_data case SM_DOWN: if (count > vc->vc_rows) /* Maximum realistic size */ count =3D vc->vc_rows; - if (logo_shown >=3D 0) - goto redraw_down; switch (fb_scrollmode(p)) { case SCROLL_MOVE: fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B070EC2BB43 for ; Mon, 15 Aug 2022 20:16:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346900AbiHOUQb (ORCPT ); Mon, 15 Aug 2022 16:16:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346108AbiHOUKr (ORCPT ); Mon, 15 Aug 2022 16:10:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AD8F64ED; Mon, 15 Aug 2022 11:56:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D6D35B8105C; Mon, 15 Aug 2022 18:56:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C1A5C433C1; Mon, 15 Aug 2022 18:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589801; bh=pTtIM64RdILeVy25ARrvbKCjUMJ6DkCoiulUOCyVutE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o81CxyRpGLO6VdE3NnJ464wgUFLyFobjOzhuyM0mdsbGRNtlZM0ixrKN2gwfcJf/G xrsX9XE4d9xe96AQbBoKogtYGGeEGTGlpPRs7dNmJIPIY3qgjs+IQgl7jWJceKu4oa pORoMxS03lVPAlHN0kTvLIh8xBo1xPf/NPQiJYIg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn , Oleksij Rempel , Lukas Wunner , Oliver Neukum , Jakub Kicinski Subject: [PATCH 5.18 0052/1095] usbnet: Fix linkwatch use-after-free on disconnect Date: Mon, 15 Aug 2022 19:50:51 +0200 Message-Id: <20220815180431.625608326@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Wunner commit a69e617e533edddf3fa3123149900f36e0a6dc74 upstream. usbnet uses the work usbnet_deferred_kevent() to perform tasks which may sleep. On disconnect, completion of the work was originally awaited in ->ndo_stop(). But in 2003, that was moved to ->disconnect() by historic commit "[PATCH] USB: usbnet, prevent exotic rtnl deadlock": https://git.kernel.org/tglx/history/c/0f138bbfd83c The change was made because back then, the kernel's workqueue implementation did not allow waiting for a single work. One had to wait for completion of *all* work by calling flush_scheduled_work(), and that could deadlock when waiting for usbnet_deferred_kevent() with rtnl_mutex held in ->ndo_stop(). The commit solved one problem but created another: It causes a use-after-free in USB Ethernet drivers aqc111.c, asix_devices.c, ax88179_178a.c, ch9200.c and smsc75xx.c: * If the drivers receive a link change interrupt immediately before disconnect, they raise EVENT_LINK_RESET in their (non-sleepable) ->status() callback and schedule usbnet_deferred_kevent(). * usbnet_deferred_kevent() invokes the driver's ->link_reset() callback, which calls netif_carrier_{on,off}(). * That in turn schedules the work linkwatch_event(). Because usbnet_deferred_kevent() is awaited after unregister_netdev(), netif_carrier_{on,off}() may operate on an unregistered netdev and linkwatch_event() may run after free_netdev(), causing a use-after-free. In 2010, usbnet was changed to only wait for a single instance of usbnet_deferred_kevent() instead of *all* work by commit 23f333a2bfaf ("drivers/net: don't use flush_scheduled_work()"). Unfortunately the commit neglected to move the wait back to ->ndo_stop(). Rectify that omission at long last. Reported-by: Jann Horn Link: https://lore.kernel.org/netdev/CAG48ez0MHBbENX5gCdHAUXZ7h7s20LnepBF-p= a5M=3D7Bi-jZrEA@mail.gmail.com/ Reported-by: Oleksij Rempel Link: https://lore.kernel.org/netdev/20220315113841.GA22337@pengutronix.de/ Signed-off-by: Lukas Wunner Cc: stable@vger.kernel.org Acked-by: Oliver Neukum Link: https://lore.kernel.org/r/d1c87ebe9fc502bffcd1576e238d685ad08321e4.16= 55987888.git.lukas@wunner.de Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/usb/usbnet.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -849,13 +849,11 @@ int usbnet_stop (struct net_device *net) =20 mpn =3D !test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags); =20 - /* deferred work (task, timer, softirq) must also stop. - * can't flush_scheduled_work() until we drop rtnl (later), - * else workers could deadlock; so make workers a NOP. - */ + /* deferred work (timer, softirq, task) must also stop */ dev->flags =3D 0; del_timer_sync (&dev->delay); tasklet_kill (&dev->bh); + cancel_work_sync(&dev->kevent); if (!pm) usb_autopm_put_interface(dev->intf); =20 @@ -1619,8 +1617,6 @@ void usbnet_disconnect (struct usb_inter net =3D dev->net; unregister_netdev (net); =20 - cancel_work_sync(&dev->kevent); - usb_scuttle_anchored_urbs(&dev->deferred); =20 if (dev->driver_info->unbind) From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D304C32757 for ; Mon, 15 Aug 2022 20:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347036AbiHOUQp (ORCPT ); Mon, 15 Aug 2022 16:16:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346112AbiHOUKs (ORCPT ); Mon, 15 Aug 2022 16:10:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 692FB64FD; Mon, 15 Aug 2022 11:56:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 12D0EB81082; Mon, 15 Aug 2022 18:56:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3E7FC433D6; Mon, 15 Aug 2022 18:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589804; bh=Wujj5i866p9om6sVU/5OKGHjwQgKQ35nherAfS8OOgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1b69kOmwzoLvxg5QBId2FYNh3F2K8WOv2CwxLMH5rW1jGGb7dbQr5jYWrgZgSGJou uT4beftPI9j4XOxXxrr3Qn2UQ07G+sexqf2sxCHXtp9+S4EZJhVbEpsZIHqpZFCLXa 7NKgoAK8Cg/q4NGlFW98l1X6Ht4uYqxY1UjHYfK8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Layton , "Christian Brauner (Microsoft)" , Al Viro , stable@kernel.org Subject: [PATCH 5.18 0053/1095] fix short copy handling in copy_mc_pipe_to_iter() Date: Mon, 15 Aug 2022 19:50:52 +0200 Message-Id: <20220815180431.667421965@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Al Viro commit c3497fd009ef2c59eea60d21c3ac22de3585ed7d upstream. Unlike other copying operations on ITER_PIPE, copy_mc_to_iter() can result in a short copy. In that case we need to trim the unused buffers, as well as the length of partially filled one - it's not enough to set ->head, ->iov_offset and ->count to reflect how much had we copied. Not hard to fix, fortunately... I'd put a helper (pipe_discard_from(pipe, head)) into pipe_fs_i.h, rather than iov_iter.c - it has nothing to do with iov_iter and having it will allow us to avoid an ugly kludge in fs/splice.c. We could put it into lib/iov_iter.c for now and move it later, but I don't see the point going that way... Cc: stable@kernel.org # 4.19+ Fixes: ca146f6f091e "lib/iov_iter: Fix pipe handling in _copy_to_iter_mcsaf= e()" Reviewed-by: Jeff Layton Reviewed-by: Christian Brauner (Microsoft) Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/pipe_fs_i.h | 9 +++++++++ lib/iov_iter.c | 15 +++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h @@ -229,6 +229,15 @@ static inline bool pipe_buf_try_steal(st return buf->ops->try_steal(pipe, buf); } =20 +static inline void pipe_discard_from(struct pipe_inode_info *pipe, + unsigned int old_head) +{ + unsigned int mask =3D pipe->ring_size - 1; + + while (pipe->head > old_head) + pipe_buf_release(pipe, &pipe->bufs[--pipe->head & mask]); +} + /* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual memory allocation, whereas PIPE_BUF makes atomicity guarantees. */ #define PIPE_SIZE PAGE_SIZE --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -689,6 +689,7 @@ static size_t copy_mc_pipe_to_iter(const struct pipe_inode_info *pipe =3D i->pipe; unsigned int p_mask =3D pipe->ring_size - 1; unsigned int i_head; + unsigned int valid =3D pipe->head; size_t n, off, xfer =3D 0; =20 if (!sanity(i)) @@ -702,11 +703,17 @@ static size_t copy_mc_pipe_to_iter(const rem =3D copy_mc_to_kernel(p + off, addr + xfer, chunk); chunk -=3D rem; kunmap_local(p); - i->head =3D i_head; - i->iov_offset =3D off + chunk; - xfer +=3D chunk; - if (rem) + if (chunk) { + i->head =3D i_head; + i->iov_offset =3D off + chunk; + xfer +=3D chunk; + valid =3D i_head + 1; + } + if (rem) { + pipe->bufs[i_head & p_mask].len -=3D rem; + pipe_discard_from(pipe, valid); break; + } n -=3D chunk; off =3D 0; i_head++; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B503C2BB43 for ; Mon, 15 Aug 2022 20:13:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343556AbiHOUNT (ORCPT ); Mon, 15 Aug 2022 16:13:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346161AbiHOUKz (ORCPT ); Mon, 15 Aug 2022 16:10:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47F657670; Mon, 15 Aug 2022 11:56:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0857EB8109E; Mon, 15 Aug 2022 18:56:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3069FC433C1; Mon, 15 Aug 2022 18:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589807; bh=oaG8uRFFATYpJIIbw+3NNlxAQIMb14Wg6pkWXbXB2uw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NLArbumIyyQIwgSxpDdUDl07W53UIOTHHAcxcZ0WnqYJcjKNEi1W3M5M0+SQi97db DDqtH1PtzaNAAvb4BhnIdgvQx/Zx9nK1lhtDyvsHS6z1JQOE4XZ6t/hHqnljFIJQ8g kQ2FXWQYAlpdePPxPslP88f0PomNGQDzP+rCd+Uw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Nguyen , David Rientjes , Peter Gonda , John Allen , Herbert Xu Subject: [PATCH 5.18 0054/1095] crypto: ccp - Use kzalloc for sev ioctl interfaces to prevent kernel memory leak Date: Mon, 15 Aug 2022 19:50:53 +0200 Message-Id: <20220815180431.705430741@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Allen commit 13dc15a3f5fd7f884e4bfa8c011a0ae868df12ae upstream. For some sev ioctl interfaces, input may be passed that is less than or equal to SEV_FW_BLOB_MAX_SIZE, but larger than the data that PSP firmware returns. In this case, kmalloc will allocate memory that is the size of the input rather than the size of the data. Since PSP firmware doesn't fully overwrite the buffer, the sev ioctl interfaces with the issue may return uninitialized slab memory. Currently, all of the ioctl interfaces in the ccp driver are safe, but to prevent future problems, change all ioctl interfaces that allocate memory with kmalloc to use kzalloc and memset the data buffer to zero in sev_ioctl_do_platform_status. Fixes: 38103671aad3 ("crypto: ccp: Use the stack and common buffer for stat= us commands") Fixes: e799035609e15 ("crypto: ccp: Implement SEV_PEK_CSR ioctl command") Fixes: 76a2b524a4b1d ("crypto: ccp: Implement SEV_PDH_CERT_EXPORT ioctl com= mand") Fixes: d6112ea0cb344 ("crypto: ccp - introduce SEV_GET_ID2 command") Cc: stable@vger.kernel.org Reported-by: Andy Nguyen Suggested-by: David Rientjes Suggested-by: Peter Gonda Signed-off-by: John Allen Reviewed-by: Peter Gonda Acked-by: David Rientjes Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/crypto/ccp/sev-dev.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -577,6 +577,8 @@ static int sev_ioctl_do_platform_status( struct sev_user_data_status data; int ret; =20 + memset(&data, 0, sizeof(data)); + ret =3D __sev_do_cmd_locked(SEV_CMD_PLATFORM_STATUS, &data, &argp->error); if (ret) return ret; @@ -630,7 +632,7 @@ static int sev_ioctl_do_pek_csr(struct s if (input.length > SEV_FW_BLOB_MAX_SIZE) return -EFAULT; =20 - blob =3D kmalloc(input.length, GFP_KERNEL); + blob =3D kzalloc(input.length, GFP_KERNEL); if (!blob) return -ENOMEM; =20 @@ -854,7 +856,7 @@ static int sev_ioctl_do_get_id2(struct s input_address =3D (void __user *)input.address; =20 if (input.address && input.length) { - id_blob =3D kmalloc(input.length, GFP_KERNEL); + id_blob =3D kzalloc(input.length, GFP_KERNEL); if (!id_blob) return -ENOMEM; =20 @@ -973,14 +975,14 @@ static int sev_ioctl_do_pdh_export(struc if (input.cert_chain_len > SEV_FW_BLOB_MAX_SIZE) return -EFAULT; =20 - pdh_blob =3D kmalloc(input.pdh_cert_len, GFP_KERNEL); + pdh_blob =3D kzalloc(input.pdh_cert_len, GFP_KERNEL); if (!pdh_blob) return -ENOMEM; =20 data.pdh_cert_address =3D __psp_pa(pdh_blob); data.pdh_cert_len =3D input.pdh_cert_len; =20 - cert_blob =3D kmalloc(input.cert_chain_len, GFP_KERNEL); + cert_blob =3D kzalloc(input.cert_chain_len, GFP_KERNEL); if (!cert_blob) { ret =3D -ENOMEM; goto e_free_pdh; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C223C25B08 for ; Mon, 15 Aug 2022 20:17:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243408AbiHOURq (ORCPT ); Mon, 15 Aug 2022 16:17:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346175AbiHOUK7 (ORCPT ); Mon, 15 Aug 2022 16:10:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C28635598; Mon, 15 Aug 2022 11:56:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 567506125B; Mon, 15 Aug 2022 18:56:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52D2BC433D7; Mon, 15 Aug 2022 18:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589810; bh=pqBJ1NWS1RN2vBwc3PaPKuwfdOzMrRfU7YsQ6GivFJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=twz3rajwPB3oZ/nul8KbjYFrlrB4YQ6FuOHzyMnjhar8LSJ4/igoyO0UfrouT64iQ tbnGE2gLotss/ZSuUVEzSohBi6zE7khBXibZvfa5ZVyx6OV7W2e63qb7hyhd+uzBoz tYYJBjMuvCr0/LJUCz7kRNY1f1yqwAR6Ao9xqvIQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hongbo Yin , Jiachen Zhang , Tianci Zhang , Miklos Szeredi Subject: [PATCH 5.18 0055/1095] ovl: drop WARN_ON() dentry is NULL in ovl_encode_fh() Date: Mon, 15 Aug 2022 19:50:54 +0200 Message-Id: <20220815180431.744923553@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiachen Zhang commit dd524b7f317de8d31d638cbfdc7be4cf9b770e42 upstream. Some code paths cannot guarantee the inode have any dentry alias. So WARN_ON() all !dentry may flood the kernel logs. For example, when an overlayfs inode is watched by inotifywait (1), and someone is trying to read the /proc/$(pidof inotifywait)/fdinfo/INOTIFY_FD, at that time if the dentry has been reclaimed by kernel (such as echo 2 > /proc/sys/vm/drop_caches), there will be a WARN_ON(). The printed call stack would be like: ? show_mark_fhandle+0xf0/0xf0 show_mark_fhandle+0x4a/0xf0 ? show_mark_fhandle+0xf0/0xf0 ? seq_vprintf+0x30/0x50 ? seq_printf+0x53/0x70 ? show_mark_fhandle+0xf0/0xf0 inotify_fdinfo+0x70/0x90 show_fdinfo.isra.4+0x53/0x70 seq_show+0x130/0x170 seq_read+0x153/0x440 vfs_read+0x94/0x150 ksys_read+0x5f/0xe0 do_syscall_64+0x59/0x1e0 entry_SYSCALL_64_after_hwframe+0x44/0xa9 So let's drop WARN_ON() to avoid kernel log flooding. Reported-by: Hongbo Yin Signed-off-by: Jiachen Zhang Signed-off-by: Tianci Zhang Fixes: 8ed5eec9d6c4 ("ovl: encode pure upper file handles") Cc: # v4.16 Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/overlayfs/export.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/overlayfs/export.c +++ b/fs/overlayfs/export.c @@ -259,7 +259,7 @@ static int ovl_encode_fh(struct inode *i return FILEID_INVALID; =20 dentry =3D d_find_any_alias(inode); - if (WARN_ON(!dentry)) + if (!dentry) return FILEID_INVALID; =20 bytes =3D ovl_dentry_to_fid(ofs, dentry, fid, buflen); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 214EBC00140 for ; Mon, 15 Aug 2022 20:19:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346278AbiHOUTs (ORCPT ); Mon, 15 Aug 2022 16:19:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346199AbiHOULD (ORCPT ); Mon, 15 Aug 2022 16:11:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6166595AB; Mon, 15 Aug 2022 11:56:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 04674B8109E; Mon, 15 Aug 2022 18:56:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85881C433C1; Mon, 15 Aug 2022 18:56:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589814; bh=7M4uIosGCQ+JVXn5ixS/gPXhPLLzxgVy6nzH25ETjwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QbAPji8LjhG8H/w3nZZNAp7qjnTX7s/eKd3E9lpHSMZ0v7oeeV8kk3s5CrqnN6Cwa AS64QYv7Q+8UnCQWbaVWLQzPt9JV7a6zSv5JFTwVVUJ4nRLYHlFuxAYMUds2FCv08p TTAa5veIBJCq/llzbG5UgHZ32FA2QYZ3sqJW1WfM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 5.18 0056/1095] parisc: Fix device names in /proc/iomem Date: Mon, 15 Aug 2022 19:50:55 +0200 Message-Id: <20220815180431.782149817@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Helge Deller commit cab56b51ec0e69128909cef4650e1907248d821b upstream. Fix the output of /proc/iomem to show the real hardware device name including the pa_pathname, e.g. "Merlin 160 Core Centronics [8:16:0]". Up to now only the pa_pathname ("[8:16.0]") was shown. Signed-off-by: Helge Deller Cc: # v4.9+ Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/parisc/kernel/drivers.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/arch/parisc/kernel/drivers.c +++ b/arch/parisc/kernel/drivers.c @@ -520,7 +520,6 @@ alloc_pa_dev(unsigned long hpa, struct h dev->id.hversion_rev =3D iodc_data[1] & 0x0f; dev->id.sversion =3D ((iodc_data[4] & 0x0f) << 16) | (iodc_data[5] << 8) | iodc_data[6]; - dev->hpa.name =3D parisc_pathname(dev); dev->hpa.start =3D hpa; /* This is awkward. The STI spec says that gfx devices may occupy * 32MB or 64MB. Unfortunately, we don't know how to tell whether @@ -534,10 +533,10 @@ alloc_pa_dev(unsigned long hpa, struct h dev->hpa.end =3D hpa + 0xfff; } dev->hpa.flags =3D IORESOURCE_MEM; - name =3D parisc_hardware_description(&dev->id); - if (name) { - strlcpy(dev->name, name, sizeof(dev->name)); - } + dev->hpa.name =3D dev->name; + name =3D parisc_hardware_description(&dev->id) ? : "unknown"; + snprintf(dev->name, sizeof(dev->name), "%s [%s]", + name, parisc_pathname(dev)); =20 /* Silently fail things like mouse ports which are subsumed within * the keyboard controller From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A82CAC25B0E for ; Mon, 15 Aug 2022 20:19:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241928AbiHOUTZ (ORCPT ); Mon, 15 Aug 2022 16:19:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346206AbiHOULD (ORCPT ); Mon, 15 Aug 2022 16:11:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5829AAE4D; Mon, 15 Aug 2022 11:57:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E8AE961268; Mon, 15 Aug 2022 18:57:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA03FC433B5; Mon, 15 Aug 2022 18:56:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589820; bh=uIHdBK00fuRJ0+kcdtpWQyECMj7ez0aq6V3wiv+dffw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LPlFhqbXAa65bSBD3qkEBiFV3DV6gmfPMZFXCP7xbm5tcgWsoJX9j9SYyXv2A2vzU au1sAAKnWv9jWl8y0OmG2WgEF3AoDkPiYyeKtwTCPcapcUIg31y5sN5s9rikI3xZex L4Q1ai3g0tUuGYcJ1D7T7TqjgWSj/CbF+vDu6i5Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller , kernel test robot Subject: [PATCH 5.18 0057/1095] parisc: Drop pa_swapper_pg_lock spinlock Date: Mon, 15 Aug 2022 19:50:56 +0200 Message-Id: <20220815180431.831310995@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Helge Deller commit 3fbc9a7de0564c55d8a9584c9cd2c9dfe6bd6d43 upstream. This spinlock was dropped with commit b7795074a046 ("parisc: Optimize per-pagetable spinlocks") in kernel v5.12. Remove it to silence a sparse warning. Signed-off-by: Helge Deller Reported-by: kernel test robot Cc: # v5.12+ Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/parisc/kernel/cache.c | 3 --- 1 file changed, 3 deletions(-) --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c @@ -50,9 +50,6 @@ void flush_instruction_cache_local(void) */ DEFINE_SPINLOCK(pa_tlb_flush_lock); =20 -/* Swapper page setup lock. */ -DEFINE_SPINLOCK(pa_swapper_pg_lock); - #if defined(CONFIG_64BIT) && defined(CONFIG_SMP) int pa_serialize_tlb_flushes __ro_after_init; #endif From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3005C00140 for ; Mon, 15 Aug 2022 20:14:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243601AbiHOUO5 (ORCPT ); Mon, 15 Aug 2022 16:14:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346203AbiHOULD (ORCPT ); Mon, 15 Aug 2022 16:11:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DDC2AE5C; Mon, 15 Aug 2022 11:57:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 207DC6125B; Mon, 15 Aug 2022 18:57:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 109D4C433C1; Mon, 15 Aug 2022 18:57:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589823; bh=Muz+6devd5UaSOJcMQZ9LRIIl260cRIsDAwDtiF54MI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fzPgYHccgP7nM9JLM5Zrzt6MYqglc3H1To23HmEZltBrWANjDAtSsMiASMVN95opi XrKAPzRjv3PQA6kbjBHvuC/Vj/BFAaQUjvnq9jj6mfUrHnzdIwbEM0l6rmsSBFU3c4 qJoGDZVmvMLCmrFpFLa7CsWojO6ZFu0T/njFDhY8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , William Dean , Helge Deller Subject: [PATCH 5.18 0058/1095] parisc: Check the return value of ioremap() in lba_driver_probe() Date: Mon, 15 Aug 2022 19:50:57 +0200 Message-Id: <20220815180431.876467103@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Dean commit cf59f34d7f978d14d6520fd80a78a5ad5cb8abf8 upstream. The function ioremap() in lba_driver_probe() can fail, so its return value should be checked. Fixes: 4bdc0d676a643 ("remove ioremap_nocache and devm_ioremap_nocache") Reported-by: Hacash Robot Signed-off-by: William Dean Signed-off-by: Helge Deller Cc: # v5.6+ Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/parisc/lba_pci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c @@ -1476,9 +1476,13 @@ lba_driver_probe(struct parisc_device *d u32 func_class; void *tmp_obj; char *version; - void __iomem *addr =3D ioremap(dev->hpa.start, 4096); + void __iomem *addr; int max; =20 + addr =3D ioremap(dev->hpa.start, 4096); + if (addr =3D=3D NULL) + return -ENOMEM; + /* Read HW Rev First */ func_class =3D READ_REG32(addr + LBA_FCLASS); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87E39C28B2B for ; Mon, 15 Aug 2022 20:14:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346357AbiHOUO1 (ORCPT ); Mon, 15 Aug 2022 16:14:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346214AbiHOULD (ORCPT ); Mon, 15 Aug 2022 16:11:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DF7AAE77; Mon, 15 Aug 2022 11:57:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1B49F6125B; Mon, 15 Aug 2022 18:57:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 223E3C433D6; Mon, 15 Aug 2022 18:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589826; bh=7pMGTLfm7+yf402Et0WC41HMCYeZJIfscGaDIL9XAwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YyciSNjTFsVI903KLmbs2BIgr4Ob/GesIhUJtBubxDfUypYJSwgl8FY+NqKFjugRk E3qhbQM+/ZGyZBlKicbhZm1oGoW1QJsUWuDBa5KnwWL4/QaE/iYwjfz1/KAcf3AbP3 s5sqhBm7gLYEHWwEJu47dLC46VsZnKGYSSBEllyk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 5.18 0059/1095] parisc: io_pgetevents_time64() needs compat syscall in 32-bit compat mode Date: Mon, 15 Aug 2022 19:50:58 +0200 Message-Id: <20220815180431.926297776@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Helge Deller commit 6431e92fc827bdd2d28f79150d90415ba9ce0d21 upstream. For all syscalls in 32-bit compat mode on 64-bit kernels the upper 32-bits of the 64-bit registers are zeroed out, so a negative 32-bit signed value will show up as positive 64-bit signed value. This behaviour breaks the io_pgetevents_time64() syscall which expects signed 64-bit values for the "min_nr" and "nr" parameters. Fix this by switching to the compat_sys_io_pgetevents_time64() syscall, which uses "compat_long_t" types for those parameters. Cc: # v5.1+ Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/parisc/kernel/syscalls/syscall.tbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/parisc/kernel/syscalls/syscall.tbl +++ b/arch/parisc/kernel/syscalls/syscall.tbl @@ -413,7 +413,7 @@ 412 32 utimensat_time64 sys_utimensat sys_utimensat 413 32 pselect6_time64 sys_pselect6 compat_sys_pselect6_time64 414 32 ppoll_time64 sys_ppoll compat_sys_ppoll_time64 -416 32 io_pgetevents_time64 sys_io_pgetevents sys_io_pgetevents +416 32 io_pgetevents_time64 sys_io_pgetevents compat_sys_io_pgetevents_t= ime64 417 32 recvmmsg_time64 sys_recvmmsg compat_sys_recvmmsg_time64 418 32 mq_timedsend_time64 sys_mq_timedsend sys_mq_timedsend 419 32 mq_timedreceive_time64 sys_mq_timedreceive sys_mq_timedreceive From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84996C00140 for ; Mon, 15 Aug 2022 20:15:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232770AbiHOUPD (ORCPT ); Mon, 15 Aug 2022 16:15:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346226AbiHOULE (ORCPT ); Mon, 15 Aug 2022 16:11:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B5AAB7F8; Mon, 15 Aug 2022 11:57:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BF030B810A0; Mon, 15 Aug 2022 18:57:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3360DC43470; Mon, 15 Aug 2022 18:57:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589829; bh=h2a++vB7rUxdHLPrp5od/YYDptU4FG5vuzzKULCmoS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KHAgyWzUb0eDv+obPCHFY4Kk9AUn1vw3u6iKNZvvxAvAthv7ZHCK3NJLkiELbb7ue w+Ru1AbTMkpSoIDfrtGe1yjABYTF3AA63AAbu/SXJTWn535GP4aNxsHzYGFdOTvUwP 1BubqN/gVZ9ZtMSk2FHfuIlaAF3qjd0G/aqVDgp8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yipeng Zou , Guo Ren , Palmer Dabbelt Subject: [PATCH 5.18 0060/1095] riscv:uprobe fix SR_SPIE set/clear handling Date: Mon, 15 Aug 2022 19:50:59 +0200 Message-Id: <20220815180431.979677244@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yipeng Zou commit 3dbe5829408bc1586f75b4667ef60e5aab0209c7 upstream. In riscv the process of uprobe going to clear spie before exec the origin insn,and set spie after that.But When access the page which origin insn has been placed a page fault may happen and irq was disabled in arch_uprobe_pre_xol function,It cause a WARN as follows. There is no need to clear/set spie in arch_uprobe_pre/post/abort_xol. We can just remove it. [ 31.684157] BUG: sleeping function called from invalid context at kernel= /locking/rwsem.c:1488 [ 31.684677] in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 76, n= ame: work [ 31.684929] preempt_count: 0, expected: 0 [ 31.685969] CPU: 2 PID: 76 Comm: work Tainted: G [ 31.686542] Hardware name: riscv-virtio,qemu (DT) [ 31.686797] Call Trace: [ 31.687053] [] dump_backtrace+0x30/0x38 [ 31.687699] [] show_stack+0x40/0x4c [ 31.688141] [] dump_stack_lvl+0x44/0x5c [ 31.688396] [] dump_stack+0x18/0x20 [ 31.688653] [] __might_resched+0x114/0x122 [ 31.688948] [] __might_sleep+0x50/0x7a [ 31.689435] [] down_read+0x30/0x130 [ 31.689728] [] do_page_fault+0x166/x446 [ 31.689997] [] ret_from_exception+0x0/0xc Fixes: 74784081aac8 ("riscv: Add uprobes supported") Signed-off-by: Yipeng Zou Reviewed-by: Guo Ren Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220721065820.245755-1-zouyipeng@huawei.com Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/riscv/kernel/probes/uprobes.c | 6 ------ 1 file changed, 6 deletions(-) --- a/arch/riscv/kernel/probes/uprobes.c +++ b/arch/riscv/kernel/probes/uprobes.c @@ -59,8 +59,6 @@ int arch_uprobe_pre_xol(struct arch_upro =20 instruction_pointer_set(regs, utask->xol_vaddr); =20 - regs->status &=3D ~SR_SPIE; - return 0; } =20 @@ -72,8 +70,6 @@ int arch_uprobe_post_xol(struct arch_upr =20 instruction_pointer_set(regs, utask->vaddr + auprobe->insn_size); =20 - regs->status |=3D SR_SPIE; - return 0; } =20 @@ -111,8 +107,6 @@ void arch_uprobe_abort_xol(struct arch_u * address. */ instruction_pointer_set(regs, utask->vaddr); - - regs->status &=3D ~SR_SPIE; } =20 bool arch_uretprobe_is_alive(struct return_instance *ret, enum rp_check ct= x, From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C490C25B0E for ; Mon, 15 Aug 2022 20:23:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346792AbiHOUXI (ORCPT ); Mon, 15 Aug 2022 16:23:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243704AbiHOUNR (ORCPT ); Mon, 15 Aug 2022 16:13:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18B628E440; Mon, 15 Aug 2022 11:59:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 665F4B8110A; Mon, 15 Aug 2022 18:59:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEE98C433D7; Mon, 15 Aug 2022 18:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589950; bh=PnK96AcJoNH02OrlMKcpheKhKI/ZKO5ifjdCqo9v2nI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2hiM3OAwNFzaHj3URPxpAl979YhbT3BBIibv3TiLBd00VyZSAE7+TgndvMnrtecKn bZ5jyGYzC/Rbn8UJe6/8oHdwq3r0aPTwwZP/9gnqZEUCCSgRetQZ8sUCPytF9xdZp5 /ZIW4L+cpedi+kCKegb0/e2adYXgf+XTE1NCPFWM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Lifu , Ben Dooks , Palmer Dabbelt Subject: [PATCH 5.18 0061/1095] riscv: lib: uaccess: fix CSR_STATUS SR_SUM bit Date: Mon, 15 Aug 2022 19:51:00 +0200 Message-Id: <20220815180432.031795086@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chen Lifu commit c08b4848f596fd95543197463b5162bd7bab2442 upstream. Since commit 5d8544e2d007 ("RISC-V: Generic library routines and assembly") and commit ebcbd75e3962 ("riscv: Fix the bug in memory access fixup code"), if __clear_user and __copy_user return from an fixup branch, CSR_STATUS SR_SUM bit will be set, it is a vulnerability, so that S-mode memory accesses to pages that are accessible by U-mode will success. Disable S-mode access to U-mode memory should clear SR_SUM bit. Fixes: 5d8544e2d007 ("RISC-V: Generic library routines and assembly") Fixes: ebcbd75e3962 ("riscv: Fix the bug in memory access fixup code") Signed-off-by: Chen Lifu Reviewed-by: Ben Dooks Link: https://lore.kernel.org/r/20220615014714.1650349-1-chenlifu@huawei.com Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/riscv/lib/uaccess.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/riscv/lib/uaccess.S +++ b/arch/riscv/lib/uaccess.S @@ -175,7 +175,7 @@ ENTRY(__asm_copy_from_user) /* Exception fixup code */ 10: /* Disable access to user memory */ - csrs CSR_STATUS, t6 + csrc CSR_STATUS, t6 mv a0, t5 ret ENDPROC(__asm_copy_to_user) @@ -227,7 +227,7 @@ ENTRY(__clear_user) /* Exception fixup code */ 11: /* Disable access to user memory */ - csrs CSR_STATUS, t6 + csrc CSR_STATUS, t6 mv a0, a1 ret ENDPROC(__clear_user) From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC9CCC25B0E for ; Mon, 15 Aug 2022 20:22:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346574AbiHOUUm (ORCPT ); Mon, 15 Aug 2022 16:20:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346373AbiHOULP (ORCPT ); Mon, 15 Aug 2022 16:11:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEBD42B63D; Mon, 15 Aug 2022 11:57:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B01AFB810CC; Mon, 15 Aug 2022 18:57:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA187C433C1; Mon, 15 Aug 2022 18:57:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589854; bh=MqXDXlZKe82M+ZSR3HvDR2TXSZqOQYNlIWIzz4zgi5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OYN4Cuqjz/HC3wkXNBs6lCKviGkRpsKrBw+4ftuqkq1qb3QNRPqDE4iGRToKRPG9R p457fbm/1PEMtoLKsNtys19u4xyfSIPrrq+z14R3jHamm1/h8c4HvqdR7SUIiUCz8P lkOMLyAKIvsp2/RRKUg0PYs+lBHT33AnC4aKj2iI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Atul Khare , Conor Dooley , Krzysztof Kozlowski , Palmer Dabbelt Subject: [PATCH 5.18 0062/1095] dt-bindings: riscv: fix SiFive l2-caches cache-sets Date: Mon, 15 Aug 2022 19:51:01 +0200 Message-Id: <20220815180432.066936189@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Conor Dooley commit b60cf8e59e61133b6c9514ff8d8c8d7049d040ef upstream. Fix device tree schema validation error messages for the SiFive Unmatched: ' cache-sets:0:0: 1024 was expected'. The existing bindings allow for just 1024 cache-sets but the fu740 on Unmatched the has 2048 cache-sets. The ISA itself permits any arbitrary power of two, however this is not supported by dt-schema. The RTL for the IP, to which the number of cache-sets is a tunable parameter, has been released publicly so speculatively adding a small number of "reasonable" values seems unwise also. Instead, as the binding only supports two distinct controllers: add 2048 and explicitly lock it to the fu740's l2 cache while limiting 1024 to the l2 cache on the fu540. Fixes: af951c3a113b ("dt-bindings: riscv: Update l2 cache DT documentation = to add support for SiFive FU740") Reported-by: Atul Khare Signed-off-by: Conor Dooley Reviewed-by: Krzysztof Kozlowski Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220803185359.942928-1-mail@conchuod.ie Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- Documentation/devicetree/bindings/riscv/sifive-l2-cache.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/Documentation/devicetree/bindings/riscv/sifive-l2-cache.yaml +++ b/Documentation/devicetree/bindings/riscv/sifive-l2-cache.yaml @@ -46,7 +46,7 @@ properties: const: 2 =20 cache-sets: - const: 1024 + enum: [1024, 2048] =20 cache-size: const: 2097152 @@ -84,6 +84,8 @@ then: description: | Must contain entries for DirError, DataError and DataFail signals. maxItems: 3 + cache-sets: + const: 1024 =20 else: properties: @@ -91,6 +93,8 @@ else: description: | Must contain entries for DirError, DataError, DataFail, DirFail si= gnals. minItems: 4 + cache-sets: + const: 2048 =20 additionalProperties: false From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49A30C28B2B for ; Mon, 15 Aug 2022 20:14:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344268AbiHOUOS (ORCPT ); Mon, 15 Aug 2022 16:14:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346685AbiHOUL6 (ORCPT ); Mon, 15 Aug 2022 16:11:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D93784ED8; Mon, 15 Aug 2022 11:58:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 73F396126A; Mon, 15 Aug 2022 18:58:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80F5BC433D7; Mon, 15 Aug 2022 18:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589887; bh=OJljRTS4HyrlDm+ltcUSILqSsYkZQZT6YDGYiSn4cUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LZBTZsnghi95o2DQwA062C4wlxLF5dNPQNZIDn2+npXRqymO1qM/OUVTAoXtjdekv frW78oxzGMNJWT5DvZU1bVxVQkooDkNhxj/4j5HPkKLHuQs2dq08K6H6t61XoN0jyk exqlovFKQwRC5r+EhFzMSur3n8RflOEP/0GOqlBk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Kettenis , Palmer Dabbelt Subject: [PATCH 5.18 0063/1095] riscv: dts: starfive: correct number of external interrupts Date: Mon, 15 Aug 2022 19:51:02 +0200 Message-Id: <20220815180432.107680149@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Kettenis commit a208acf0eac857dc8cdaddd63a4e18ed03f91786 upstream. The PLIC integrated on the Vic_U7_Core integrated on the StarFive JH7100 SoC actually supports 133 external interrupts. 127 of these are exposed to the outside world; the remainder are used by other devices that are part of the core-complex such as the L2 cache controller. But all 133 interrupts are external interrupts as far as the PLIC is concerned. Fix the property so that the driver can manage these additional interrupts, which is important since the interrupts for the L2 cache controller are enabled by default. Fixes: ec85362fb121 ("RISC-V: Add initial StarFive JH7100 device tree") Signed-off-by: Mark Kettenis Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220707185529.19509-1-kettenis@openbsd.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/riscv/boot/dts/starfive/jh7100.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/riscv/boot/dts/starfive/jh7100.dtsi +++ b/arch/riscv/boot/dts/starfive/jh7100.dtsi @@ -118,7 +118,7 @@ interrupt-controller; #address-cells =3D <0>; #interrupt-cells =3D <1>; - riscv,ndev =3D <127>; + riscv,ndev =3D <133>; }; =20 clkgen: clock-controller@11800000 { From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 083BFC25B0E for ; Mon, 15 Aug 2022 20:19:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239464AbiHOUTO (ORCPT ); Mon, 15 Aug 2022 16:19:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346983AbiHOUMn (ORCPT ); Mon, 15 Aug 2022 16:12:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7553B89914; Mon, 15 Aug 2022 11:58:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9F112B8109E; Mon, 15 Aug 2022 18:58:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B4EAC433D7; Mon, 15 Aug 2022 18:58:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589920; bh=AG+Uiec8voQAxe4xbm6dYZ5iaa1ZLFeWAYPNJDAg5og=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PuCNnrSiZPSVQpD9Ssf528fKP+CTepLhKvVFMcpbUMBlSVDcXdLCFgzGUUtroaSP2 q0a2DnOt/QBwcltrt41+jID0tjFhNtZn4x4bbRbV80ZJVmhamDPHK+eXghOXLF4ebq KU8nnPo8PBW2TsdS3lyMZLlyuBujq7lk5/XqjOVM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Dooks , Palmer Dabbelt Subject: [PATCH 5.18 0064/1095] RISC-V: cpu_ops_spinwait.c should include head.h Date: Mon, 15 Aug 2022 19:51:03 +0200 Message-Id: <20220815180432.143299948@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ben Dooks commit e4aa991c05aedc3ead92d1352af86db74090dc3c upstream. Running sparse shows cpu_ops_spinwait.c is missing two definitions found in head.h, so include it to stop the following warnings: arch/riscv/kernel/cpu_ops_spinwait.c:15:6: warning: symbol '__cpu_spinwait_= stack_pointer' was not declared. Should it be static? arch/riscv/kernel/cpu_ops_spinwait.c:16:6: warning: symbol '__cpu_spinwait_= task_pointer' was not declared. Should it be static? Signed-off-by: Ben Dooks Link: https://lore.kernel.org/r/20220713215306.94675-1-ben.dooks@sifive.com Fixes: c78f94f35cf6 ("RISC-V: Use __cpu_up_stack/task_pointer only for spin= wait method") Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/riscv/kernel/cpu_ops_spinwait.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/riscv/kernel/cpu_ops_spinwait.c +++ b/arch/riscv/kernel/cpu_ops_spinwait.c @@ -11,6 +11,8 @@ #include #include =20 +#include "head.h" + const struct cpu_operations cpu_ops_spinwait; void *__cpu_spinwait_stack_pointer[NR_CPUS] __section(".data"); void *__cpu_spinwait_task_pointer[NR_CPUS] __section(".data"); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82851C28B2C for ; Mon, 15 Aug 2022 20:16:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346692AbiHOUQT (ORCPT ); Mon, 15 Aug 2022 16:16:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347046AbiHOUMt (ORCPT ); Mon, 15 Aug 2022 16:12:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 298328A6F6; Mon, 15 Aug 2022 11:58:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6655B6126A; Mon, 15 Aug 2022 18:58:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 745F3C433D6; Mon, 15 Aug 2022 18:58:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589931; bh=+GXNjbHUTKV1L2+1A30K3LneaVHLN5tQdbVxlRebuCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YFzGYtgJUEbaydHODiXDRUORx151z2ZMoi1Au3+lqTvxAYbYI79OzX5GY48P7778t TUWrm7SM+QeChE5J8CzTbPk2PMVqY8yWNij8pSJmJvu5GrPdtSTQtu61SHV9STAFIW fVuBHxrk9tmrtrFWgMlemADOfr4l3HcgNGOQKjCo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Dooks , Palmer Dabbelt Subject: [PATCH 5.18 0065/1095] RISC-V: Declare cpu_ops_spinwait in Date: Mon, 15 Aug 2022 19:51:04 +0200 Message-Id: <20220815180432.187936691@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ben Dooks commit da6d2128e56a50a0d497c8e41ca1d33d88bcc0aa upstream. The cpu_ops_spinwait is used in a couple of places in arch/riscv and is causing a sparse warning due to no declaration. Add this to with the others to fix the following: arch/riscv/kernel/cpu_ops_spinwait.c:16:29: warning: symbol 'cpu_ops_spinwa= it' was not declared. Should it be static? Signed-off-by: Ben Dooks Link: https://lore.kernel.org/r/20220714071811.187491-1-ben.dooks@sifive.com [Palmer: Drop the extern from cpu_ops.c] Fixes: 2ffc48fc7071 ("RISC-V: Move spinwait booting method to its own confi= g") Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/riscv/include/asm/cpu_ops.h | 1 + arch/riscv/kernel/cpu_ops.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/riscv/include/asm/cpu_ops.h b/arch/riscv/include/asm/cpu_= ops.h index 134590f1b843..aa128466c4d4 100644 --- a/arch/riscv/include/asm/cpu_ops.h +++ b/arch/riscv/include/asm/cpu_ops.h @@ -38,6 +38,7 @@ struct cpu_operations { #endif }; =20 +extern const struct cpu_operations cpu_ops_spinwait; extern const struct cpu_operations *cpu_ops[NR_CPUS]; void __init cpu_set_ops(int cpu); =20 diff --git a/arch/riscv/kernel/cpu_ops.c b/arch/riscv/kernel/cpu_ops.c index 170d07e57721..f92c0e6eddb1 100644 --- a/arch/riscv/kernel/cpu_ops.c +++ b/arch/riscv/kernel/cpu_ops.c @@ -15,9 +15,7 @@ const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init; =20 extern const struct cpu_operations cpu_ops_sbi; -#ifdef CONFIG_RISCV_BOOT_SPINWAIT -extern const struct cpu_operations cpu_ops_spinwait; -#else +#ifndef CONFIG_RISCV_BOOT_SPINWAIT const struct cpu_operations cpu_ops_spinwait =3D { .name =3D "", .cpu_prepare =3D NULL, --=20 2.37.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C749DC3F6B0 for ; Mon, 15 Aug 2022 20:22:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346628AbiHOUUs (ORCPT ); Mon, 15 Aug 2022 16:20:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347062AbiHOUMv (ORCPT ); Mon, 15 Aug 2022 16:12:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C9BD8B997; Mon, 15 Aug 2022 11:58:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BE3986126A; Mon, 15 Aug 2022 18:58:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6630CC4347C; Mon, 15 Aug 2022 18:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589935; bh=O4b+wZIdNDyRYvQfOFHRVJytBEWmlO6Mx0dPFE9bktY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J8C9bwCB4IXG2bKQLuENpUTwmCWWXJCJgEJ5cMluXgFlNhXJ6ruX21mR4ArqEJ8ZL +yj8kDlyYgtUn6gGUxLmzkcUMwnd7wURYPHMZkfPe55kByfVJjlAlcafvJMrbpHaXA ShmaqUhkabB3Q2jVdFdrRCaXQ7rKFVw8B9PbspG4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guo Ren , Heiko Stuebner , Atish Patra , Xianting Tian , Palmer Dabbelt Subject: [PATCH 5.18 0066/1095] RISC-V: kexec: Fixup use of smp_processor_id() in preemptible context Date: Mon, 15 Aug 2022 19:51:05 +0200 Message-Id: <20220815180432.236381906@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xianting Tian commit 357628e68f5c08ad578a718dc62a0031e06dbe91 upstream. Use __smp_processor_id() to avoid check the preemption context when CONFIG_DEBUG_PREEMPT enabled, as we will enter crash kernel and no return. Without the patch, [ 103.781044] sysrq: Trigger a crash [ 103.784625] Kernel panic - not syncing: sysrq triggered crash [ 103.837634] CPU1: off [ 103.889668] CPU2: off [ 103.933479] CPU3: off [ 103.939424] Starting crashdump kernel... [ 103.943442] BUG: using smp_processor_id() in preemptible [00000000] code= : sh/346 [ 103.950884] caller is debug_smp_processor_id+0x1c/0x26 [ 103.956051] CPU: 0 PID: 346 Comm: sh Kdump: loaded Not tainted 5.10.113-= 00002-gce03f03bf4ec-dirty #149 [ 103.965355] Call Trace: [ 103.967805] [] walk_stackframe+0x0/0xa2 [ 103.973206] [] show_stack+0x32/0x3e [ 103.978258] [] dump_stack_lvl+0x72/0x8e [ 103.983655] [] dump_stack+0x14/0x1c [ 103.988705] [] check_preemption_disabled+0x9e/0xaa [ 103.995057] [] debug_smp_processor_id+0x1c/0x26 [ 104.001150] [] machine_kexec+0x22/0xd0 [ 104.006463] [] __crash_kexec+0x6a/0xa4 [ 104.011774] [] panic+0xfc/0x2b0 [ 104.016480] [] sysrq_reset_seq_param_set+0x0/0x70 [ 104.022745] [] __handle_sysrq+0x8c/0x154 [ 104.028229] [] write_sysrq_trigger+0x5a/0x6a [ 104.034061] [] proc_reg_write+0x58/0xd4 [ 104.039459] [] vfs_write+0x7e/0x254 [ 104.044509] [] ksys_write+0x58/0xbe [ 104.049558] [] sys_write+0xe/0x16 [ 104.054434] [] ret_from_syscall+0x0/0x2 [ 104.067863] Will call new kernel at ecc00000 from hart id 0 [ 104.074939] FDT image at fc5ee000 [ 104.079523] Bye... With the patch we can got clear output, [ 67.740553] sysrq: Trigger a crash [ 67.744166] Kernel panic - not syncing: sysrq triggered crash [ 67.809123] CPU1: off [ 67.865210] CPU2: off [ 67.909075] CPU3: off [ 67.919123] Starting crashdump kernel... [ 67.924900] Will call new kernel at ecc00000 from hart id 0 [ 67.932045] FDT image at fc5ee000 [ 67.935560] Bye... Fixes: 0e105f1d0037 ("riscv: use hart id instead of cpu id on machine_kexec= ") Reviewed-by: Guo Ren Reviewed-by: Heiko Stuebner Reviewed-by: Atish Patra Signed-off-by: Xianting Tian Link: https://lore.kernel.org/r/20220811074150.3020189-2-xianting.tian@linu= x.alibaba.com Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/riscv/kernel/machine_kexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/riscv/kernel/machine_kexec.c +++ b/arch/riscv/kernel/machine_kexec.c @@ -171,7 +171,7 @@ machine_kexec(struct kimage *image) struct kimage_arch *internal =3D &image->arch; unsigned long jump_addr =3D (unsigned long) image->start; unsigned long first_ind_entry =3D (unsigned long) &image->head; - unsigned long this_cpu_id =3D smp_processor_id(); + unsigned long this_cpu_id =3D __smp_processor_id(); unsigned long this_hart_id =3D cpuid_to_hartid_map(this_cpu_id); unsigned long fdt_addr =3D internal->fdt_addr; void *control_code_buffer =3D page_address(image->control_code_page); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9BB9C25B08 for ; Mon, 15 Aug 2022 20:22:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243701AbiHOUWb (ORCPT ); Mon, 15 Aug 2022 16:22:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347083AbiHOUMy (ORCPT ); Mon, 15 Aug 2022 16:12:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52BC38A6EE; Mon, 15 Aug 2022 11:58:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CBF99611D6; Mon, 15 Aug 2022 18:58:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2174C433D6; Mon, 15 Aug 2022 18:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589938; bh=LU2fEskL360umWFlN8+Fi86O9Ob59Gb0BLic/uzlf5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=spD+OLVyP33/5l4c2z1IgtyhYwoD9cZOJIUjVDbXn1SNmi0bt7sb4qYkuoX123rt7 +yh+IMq/pBHMNLEILP3YSHpRFrr3OnCrM0NQaJRXzoDWgs/znmtiuEIOgOHElZMrXf a9KGs75iZqNW1Q/GIqMUm/YsFr2b4753VmbJ7dQs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xianting Tian , Palmer Dabbelt , Guo Ren Subject: [PATCH 5.18 0067/1095] RISC-V: Fixup get incorrect user mode PC for kernel mode regs Date: Mon, 15 Aug 2022 19:51:06 +0200 Message-Id: <20220815180432.282222448@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xianting Tian commit 59c026c359c30f116fef6ee958e24d04983efbb0 upstream. When use 'echo c > /proc/sysrq-trigger' to trigger kdump, riscv_crash_save_= regs() will be called to save regs for vmcore, we found "epc" value 00ffffffa55374= 00 is not a valid kernel virtual address, but is a user virtual address. Other regs(eg, ra, sp, gp...) are correct kernel virtual address. Actually 0x00ffffffb0dd9400 is the user mode PC of 'PID: 113 Comm: sh', whi= ch is saved in the task's stack. [ 21.201701] CPU: 0 PID: 113 Comm: sh Kdump: loaded Not tainted 5.18.9 #45 [ 21.201979] Hardware name: riscv-virtio,qemu (DT) [ 21.202160] epc : 00ffffffa5537400 ra : ffffffff80088640 sp : ff20000010= 333b90 [ 21.202435] gp : ffffffff810dde38 tp : ff6000000226c200 t0 : ffffffff80= 32be7c [ 21.202707] t1 : 0720072007200720 t2 : 30203a7375746174 s0 : ff20000010= 333cf0 [ 21.202973] s1 : 0000000000000000 a0 : ff20000010333b98 a1 : 0000000000= 000001 [ 21.203243] a2 : 0000000000000010 a3 : 0000000000000000 a4 : 28c8f0aeff= ea4e00 [ 21.203519] a5 : 28c8f0aeffea4e00 a6 : 0000000000000009 a7 : ffffffff80= 35c9b8 [ 21.203794] s2 : ffffffff810df0a8 s3 : ffffffff810df718 s4 : ff20000010= 333b98 [ 21.204062] s5 : 0000000000000000 s6 : 0000000000000007 s7 : ffffffff80= c4a468 [ 21.204331] s8 : 00ffffffef451410 s9 : 0000000000000007 s10: 00aaaaaac0= 510700 [ 21.204606] s11: 0000000000000001 t3 : ff60000001218f00 t4 : ff60000001= 218f00 [ 21.204876] t5 : ff60000001218000 t6 : ff200000103338b8 [ 21.205079] status: 0000000200000020 badaddr: 0000000000000000 cause: 00= 00000000000008 With the incorrect PC, the backtrace showed by crash tool as below, the fir= st stack frame is abnormal, crash> bt PID: 113 TASK: ff60000002269600 CPU: 0 COMMAND: "sh" #0 [ff2000001039bb90] __efistub_.Ldebug_info0 at 00ffffffa5537400 <-- Abno= rmal #1 [ff2000001039bcf0] panic at ffffffff806578ba #2 [ff2000001039bd50] sysrq_reset_seq_param_set at ffffffff8038c030 #3 [ff2000001039bda0] __handle_sysrq at ffffffff8038c5f8 #4 [ff2000001039be00] write_sysrq_trigger at ffffffff8038cad8 #5 [ff2000001039be20] proc_reg_write at ffffffff801b7edc #6 [ff2000001039be40] vfs_write at ffffffff80152ba6 #7 [ff2000001039be80] ksys_write at ffffffff80152ece #8 [ff2000001039bed0] sys_write at ffffffff80152f46 With the patch, we can get current kernel mode PC, the output as below, [ 17.607658] CPU: 0 PID: 113 Comm: sh Kdump: loaded Not tainted 5.18.9 #42 [ 17.607937] Hardware name: riscv-virtio,qemu (DT) [ 17.608150] epc : ffffffff800078f8 ra : ffffffff8008862c sp : ff20000010= 333b90 [ 17.608441] gp : ffffffff810dde38 tp : ff6000000226c200 t0 : ffffffff80= 32be68 [ 17.608741] t1 : 0720072007200720 t2 : 666666666666663c s0 : ff20000010= 333cf0 [ 17.609025] s1 : 0000000000000000 a0 : ff20000010333b98 a1 : 0000000000= 000001 [ 17.609320] a2 : 0000000000000010 a3 : 0000000000000000 a4 : 0000000000= 000000 [ 17.609601] a5 : ff60000001c78000 a6 : 000000000000003c a7 : ffffffff80= 35c9a4 [ 17.609894] s2 : ffffffff810df0a8 s3 : ffffffff810df718 s4 : ff20000010= 333b98 [ 17.610186] s5 : 0000000000000000 s6 : 0000000000000007 s7 : ffffffff80= c4a468 [ 17.610469] s8 : 00ffffffca281410 s9 : 0000000000000007 s10: 00aaaaaab5= bb6700 [ 17.610755] s11: 0000000000000001 t3 : ff60000001218f00 t4 : ff60000001= 218f00 [ 17.611041] t5 : ff60000001218000 t6 : ff20000010333988 [ 17.611255] status: 0000000200000020 badaddr: 0000000000000000 cause: 00= 00000000000008 With the correct PC, the backtrace showed by crash tool as below, crash> bt PID: 113 TASK: ff6000000226c200 CPU: 0 COMMAND: "sh" #0 [ff20000010333b90] riscv_crash_save_regs at ffffffff800078f8 <--- Normal #1 [ff20000010333cf0] panic at ffffffff806578c6 #2 [ff20000010333d50] sysrq_reset_seq_param_set at ffffffff8038c03c #3 [ff20000010333da0] __handle_sysrq at ffffffff8038c604 #4 [ff20000010333e00] write_sysrq_trigger at ffffffff8038cae4 #5 [ff20000010333e20] proc_reg_write at ffffffff801b7ee8 #6 [ff20000010333e40] vfs_write at ffffffff80152bb2 #7 [ff20000010333e80] ksys_write at ffffffff80152eda #8 [ff20000010333ed0] sys_write at ffffffff80152f52 Fixes: e53d28180d4d ("RISC-V: Add kdump support") Co-developed-by: Guo Ren Signed-off-by: Xianting Tian Link: https://lore.kernel.org/r/20220811074150.3020189-3-xianting.tian@linu= x.alibaba.com Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/riscv/kernel/crash_save_regs.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/riscv/kernel/crash_save_regs.S +++ b/arch/riscv/kernel/crash_save_regs.S @@ -44,7 +44,7 @@ SYM_CODE_START(riscv_crash_save_regs) REG_S t6, PT_T6(a0) /* x31 */ =20 csrr t1, CSR_STATUS - csrr t2, CSR_EPC + auipc t2, 0x0 csrr t3, CSR_TVAL csrr t4, CSR_CAUSE From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B361C25B0E for ; Mon, 15 Aug 2022 20:22:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240534AbiHOUW0 (ORCPT ); Mon, 15 Aug 2022 16:22:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347119AbiHOUNC (ORCPT ); Mon, 15 Aug 2022 16:13:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6C2E8C037; Mon, 15 Aug 2022 11:59:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 90D31B8109E; Mon, 15 Aug 2022 18:59:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CAF6CC433D7; Mon, 15 Aug 2022 18:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589941; bh=CGaPG4NbzAJR1W5yUiOR1a8R5WwVoE9UDU1lzpnZMCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qQP0x2NJjAjdMUhg99JiE6QCSV9muF4c5KJvZFsgwHcqPmPtTL3vywqCZxo1HHTBo u/nWWocMQpxFul3xmNWhbiquheX6H8kMGtbbWJm9I7e74Lo27IVFh+1EBHj53r5LBp fifWkzfWpMAsDRExRm69Uc8qTslZusbipIbvzBJY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xianting Tian , Palmer Dabbelt Subject: [PATCH 5.18 0068/1095] RISC-V: Fixup schedule out issue in machine_crash_shutdown() Date: Mon, 15 Aug 2022 19:51:07 +0200 Message-Id: <20220815180432.329986550@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xianting Tian commit ad943893d5f1d0aeea892bf7b781cf8062b36d58 upstream. Current task of executing crash kexec will be schedule out when panic is triggered by RCU Stall, as it needs to wait rcu completion. It lead to inability to enter the crash system. The implementation of machine_crash_shutdown() is non-standard for RISC-V according to other Arch's implementation(eg, x86, arm64), we need to send IPI to stop secondary harts. [224521.877268] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks: [224521.883471] rcu: 0-...0: (3 GPs behind) idle=3Dcfa/0/0x1 softirq=3D396= 8793/3968793 fqs=3D2495 [224521.891742] (detected by 2, t=3D5255 jiffies, g=3D60855593, q=3D328) [224521.897754] Task dump for CPU 0: [224521.901074] task:swapper/0 state:R running task stack: 0 pid: = 0 ppid: 0 flags:0x00000008 [224521.911090] Call Trace: [224521.913638] [] __schedule+0x208/0x5ea [224521.918957] Kernel panic - not syncing: RCU Stall [224521.923773] bad: scheduling from the idle thread! [224521.928571] CPU: 2 PID: 0 Comm: swapper/2 Kdump: loaded Tainted: G O = 5.10.113-yocto-standard #1 [224521.938658] Call Trace: [224521.941200] [] walk_stackframe+0x0/0xaa [224521.946689] [] show_stack+0x32/0x3e [224521.951830] [] dump_stack_lvl+0x7e/0xa2 [224521.957317] [] dump_stack+0x14/0x1c [224521.962459] [] dequeue_task_idle+0x2c/0x40 [224521.968207] [] __schedule+0x41e/0x5ea [224521.973520] [] schedule+0x34/0xe4 [224521.978487] [] schedule_timeout+0xc6/0x170 [224521.984234] [] wait_for_completion+0x98/0xf2 [224521.990157] [] __wait_rcu_gp+0x148/0x14a [224521.995733] [] synchronize_rcu+0x5c/0x66 [224522.001307] [] rcu_sync_enter+0x54/0xe6 [224522.006795] [] percpu_down_write+0x32/0x11c [224522.012629] [] _cpu_down+0x92/0x21a [224522.017771] [] smp_shutdown_nonboot_cpus+0x90/0x118 [224522.024299] [] machine_crash_shutdown+0x30/0x4a [224522.030483] [] __crash_kexec+0x62/0xa6 [224522.035884] [] panic+0xfa/0x2b6 [224522.040678] [] rcu_sched_clock_irq+0xc26/0xcb8 [224522.046774] [] update_process_times+0x62/0x8a [224522.052785] [] tick_sched_timer+0x9e/0x102 [224522.058533] [] __hrtimer_run_queues+0x16a/0x318 [224522.064716] [] hrtimer_interrupt+0xd4/0x228 [224522.070551] [] riscv_timer_interrupt+0x3c/0x48 [224522.076646] [] handle_percpu_devid_irq+0xb0/0x24c [224522.083004] [] __handle_domain_irq+0xa8/0x122 [224522.089014] [] riscv_intc_irq+0x38/0x60 [224522.094501] [] ret_from_exception+0x0/0xc [224522.100161] [] rcu_eqs_enter.constprop.0+0x8c/0xb8 With the patch, it can enter crash system when RCU Stall occur. Fixes: e53d28180d4d ("RISC-V: Add kdump support") Signed-off-by: Xianting Tian Link: https://lore.kernel.org/r/20220811074150.3020189-4-xianting.tian@linu= x.alibaba.com Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/riscv/kernel/machine_kexec.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) --- a/arch/riscv/kernel/machine_kexec.c +++ b/arch/riscv/kernel/machine_kexec.c @@ -138,19 +138,37 @@ void machine_shutdown(void) #endif } =20 +/* Override the weak function in kernel/panic.c */ +void crash_smp_send_stop(void) +{ + static int cpus_stopped; + + /* + * This function can be called twice in panic path, but obviously + * we execute this only once. + */ + if (cpus_stopped) + return; + + smp_send_stop(); + cpus_stopped =3D 1; +} + /* * machine_crash_shutdown - Prepare to kexec after a kernel crash * * This function is called by crash_kexec just before machine_kexec - * below and its goal is similar to machine_shutdown, but in case of - * a kernel crash. Since we don't handle such cases yet, this function - * is empty. + * and its goal is to shutdown non-crashing cpus and save registers. */ void machine_crash_shutdown(struct pt_regs *regs) { + local_irq_disable(); + + /* shutdown non-crashing cpus */ + crash_smp_send_stop(); + crash_save_cpu(regs, smp_processor_id()); - machine_shutdown(); pr_info("Starting crashdump kernel...\n"); } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7ECFEC25B08 for ; Mon, 15 Aug 2022 20:22:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346233AbiHOUWg (ORCPT ); Mon, 15 Aug 2022 16:22:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347153AbiHOUNF (ORCPT ); Mon, 15 Aug 2022 16:13:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0E948C456; Mon, 15 Aug 2022 11:59:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 86E1AB81106; Mon, 15 Aug 2022 18:59:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBF0BC433C1; Mon, 15 Aug 2022 18:59:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589944; bh=pLjjybbwiDt2+1ukD/u8ibPOrZ5Ksz4JOuFjMAdZSTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s1vBtTPNaiIL1xGE4SrK/TTCTmRMBX2cuvKO1R/FE8OBDlka1PHBr1Xxl64RbRve9 qEQS7W4gO41hXhMNauSda8ksc6CtserYHl7orslis9tYW+7pStpj0sPqLuZrWG1Nsn +JQUALjMp4pwHjQYqoxkHVylqZFaFyOdTaJTrHuY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Atish Patra , Guo Ren , Palmer Dabbelt Subject: [PATCH 5.18 0069/1095] RISC-V: Fix counter restart during overflow for RV32 Date: Mon, 15 Aug 2022 19:51:08 +0200 Message-Id: <20220815180432.374524594@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Atish Patra commit acc1b919f47926b089be21b8aaa29ec91fef0aa2 upstream. Pass the upper half of the initial value of the counter correctly for RV32. Fixes: 4905ec2fb7e6 ("RISC-V: Add sscofpmf extension support") Signed-off-by: Atish Patra Reviewed-by: Guo Ren Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220711174632.4186047-2-atishp@rivosinc.com Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/perf/riscv_pmu_sbi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c index dca3537a8dcc..0cb694b794ae 100644 --- a/drivers/perf/riscv_pmu_sbi.c +++ b/drivers/perf/riscv_pmu_sbi.c @@ -525,8 +525,13 @@ static inline void pmu_sbi_start_overflow_mask(struct = riscv_pmu *pmu, hwc =3D &event->hw; max_period =3D riscv_pmu_ctr_get_width_mask(event); init_val =3D local64_read(&hwc->prev_count) & max_period; +#if defined(CONFIG_32BIT) + sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, idx, 1, + flag, init_val, init_val >> 32, 0); +#else sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, idx, 1, flag, init_val, 0, 0); +#endif } ctr_ovf_mask =3D ctr_ovf_mask >> 1; idx++; --=20 2.37.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B23DEC00140 for ; Mon, 15 Aug 2022 20:22:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346650AbiHOUWs (ORCPT ); Mon, 15 Aug 2022 16:22:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242813AbiHOUNO (ORCPT ); Mon, 15 Aug 2022 16:13:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5900132EF3; Mon, 15 Aug 2022 11:59:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 86F70B810C5; Mon, 15 Aug 2022 18:59:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE280C433C1; Mon, 15 Aug 2022 18:59:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589947; bh=hFLdWtZlm6m47mimf7VH2hREI4jtWZfe2DLf4xlZbfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oyr1DeKiXKi+f8q6NKgzXKdQJWpBpsjp+cRa8cZffpH2HpAjw0VQacGDYXPBv++fR hqqpyHiXj6BYJ6mG/OmYAXY7lWFfQVbolwolnwEBOKmVY64OF9bqSoOyrgmg2t+7Hm 2V+XlX8juld8ud1xPfnWXDJymRV0L4lxJMYtVKHA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Atish Patra , Palmer Dabbelt Subject: [PATCH 5.18 0070/1095] RISC-V: Fix SBI PMU calls for RV32 Date: Mon, 15 Aug 2022 19:51:09 +0200 Message-Id: <20220815180432.414248634@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Atish Patra commit 0209b5830bea42dd3ce33ab0397231e67ec3b751 upstream. Some of the SBI PMU calls does not pass 64bit arguments correctly and not under RV32 compile time flags. Currently, this doesn't create any incorrect results as RV64 ignores any value in the additional register and qemu doesn't support raw events. Fix those SBI calls in order to set correct values for RV32. Fixes: e9991434596f ("RISC-V: Add perf platform driver based on SBI PMU ext= ension") Signed-off-by: Atish Patra Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220711174632.4186047-4-atishp@rivosinc.com Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/perf/riscv_pmu_sbi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c index 3735337a4cfb..bae614c73b14 100644 --- a/drivers/perf/riscv_pmu_sbi.c +++ b/drivers/perf/riscv_pmu_sbi.c @@ -274,8 +274,13 @@ static int pmu_sbi_ctr_get_idx(struct perf_event *even= t) cflags |=3D SBI_PMU_CFG_FLAG_SET_UINH; =20 /* retrieve the available counter index */ +#if defined(CONFIG_32BIT) + ret =3D sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_CFG_MATCH, cbase, cmas= k, + cflags, hwc->event_base, hwc->config, hwc->config >> 32); +#else ret =3D sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_CFG_MATCH, cbase, cmas= k, cflags, hwc->event_base, hwc->config, 0); +#endif if (ret.error) { pr_debug("Not able to find a counter for event %lx config %llx\n", hwc->event_base, hwc->config); @@ -417,8 +422,13 @@ static void pmu_sbi_ctr_start(struct perf_event *event= , u64 ival) struct hw_perf_event *hwc =3D &event->hw; unsigned long flag =3D SBI_PMU_START_FLAG_SET_INIT_VALUE; =20 +#if defined(CONFIG_32BIT) ret =3D sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, hwc->idx, 1, flag, ival, ival >> 32, 0); +#else + ret =3D sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, hwc->idx, + 1, flag, ival, 0, 0); +#endif if (ret.error && (ret.error !=3D SBI_ERR_ALREADY_STARTED)) pr_err("Starting counter idx %d failed with error %d\n", hwc->idx, sbi_err_map_linux_errno(ret.error)); --=20 2.37.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DF29C00140 for ; Mon, 15 Aug 2022 20:15:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240906AbiHOUPY (ORCPT ); Mon, 15 Aug 2022 16:15:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346363AbiHOULP (ORCPT ); Mon, 15 Aug 2022 16:11:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45C3F31373; Mon, 15 Aug 2022 11:57:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3C8F460A71; Mon, 15 Aug 2022 18:57:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 068E6C433C1; Mon, 15 Aug 2022 18:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589857; bh=tMbRNLEwJhzBn3I2NtkHXpA8he1iH1lPv6QR3bX1QbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ke0btZn/ca66Ownbl3i4AXFvJjcvxFenmxyFsprPYeJTEELnF2C2CFFmac9qwvSg7 /9cS9yuFRL3ASECkQS90TcHdAGP1iNAwKf4nHjymdk201MNE+ZLBA7+9pGhVEeVrJT CICbQPur37iF0iDyThQnwWoTsA2jfV621SqZQHNs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anup Patel , Atish Patra , Guo Ren , Palmer Dabbelt Subject: [PATCH 5.18 0071/1095] RISC-V: Update user page mapping only once during start Date: Mon, 15 Aug 2022 19:51:10 +0200 Message-Id: <20220815180432.452222140@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Atish Patra commit 133a6d1fe7d7ad8393af025c4dde379c0616661f upstream. Currently, riscv_pmu_event_set_period updates the userpage mapping. However, the caller of riscv_pmu_event_set_period should update the userpage mapping because the counter can not be updated/started from set_period function in counter overflow path. Invoke the perf_event_update_userpage at the caller so that it doesn't get invoked twice during counter start path. Fixes: f5bfa23f576f ("RISC-V: Add a perf core library for pmu drivers") Reviewed-by: Anup Patel Signed-off-by: Atish Patra Reviewed-by: Guo Ren Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220711174632.4186047-3-atishp@rivosinc.com Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/perf/riscv_pmu.c | 1 - drivers/perf/riscv_pmu_sbi.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) --- a/drivers/perf/riscv_pmu.c +++ b/drivers/perf/riscv_pmu.c @@ -170,7 +170,6 @@ int riscv_pmu_event_set_period(struct pe left =3D (max_period >> 1); =20 local64_set(&hwc->prev_count, (u64)-left); - perf_event_update_userpage(event); =20 return overflow; } --- a/drivers/perf/riscv_pmu_sbi.c +++ b/drivers/perf/riscv_pmu_sbi.c @@ -542,6 +542,7 @@ static inline void pmu_sbi_start_overflo sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, idx, 1, flag, init_val, 0, 0); #endif + perf_event_update_userpage(event); } ctr_ovf_mask =3D ctr_ovf_mask >> 1; idx++; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79A7CC28B2B for ; Mon, 15 Aug 2022 20:14:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346333AbiHOUOX (ORCPT ); Mon, 15 Aug 2022 16:14:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346431AbiHOULU (ORCPT ); Mon, 15 Aug 2022 16:11:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 374F632B9A; Mon, 15 Aug 2022 11:57:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2243F6125B; Mon, 15 Aug 2022 18:57:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27A63C433C1; Mon, 15 Aug 2022 18:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589860; bh=mxHoA8HG0mqTSRKkAGXxJHbnm4nk9/fztONrA5Rp2+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n8fswHK713Aj/T7slF511fdDYZb4t/mPs+zAQwFOQDgEVN6Lw3r6/lO0IoIGOmTuF gUD5X/xaaQaXmPuq9q++VzNQ+DKsCAZrwrTtLeXjAy8DC5oOru+vPlAt62jraQhYgv H497psJsTGJTkusy+clDR5Z6mtDff8jhfC+F7Dng= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guo Ren , Heiko Stuebner , Xianting Tian , Palmer Dabbelt Subject: [PATCH 5.18 0072/1095] RISC-V: Add modules to virtual kernel memory layout dump Date: Mon, 15 Aug 2022 19:51:11 +0200 Message-Id: <20220815180432.501038672@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xianting Tian commit f9293ad46d8ba9909187a37b7215324420ad4596 upstream. Modules always live before the kernel, MODULES_END is fixed but MODULES_VADDR isn't fixed, it depends on the kernel size. Let's add it to virtual kernel memory layout dump. As MODULES is only defined for CONFIG_64BIT, so we dump it when CONFIG_64BIT=3Dy. eg, MODULES_VADDR - MODULES_END 0xffffffff01133000 - 0xffffffff80000000 Reviewed-by: Guo Ren Reviewed-by: Heiko Stuebner Signed-off-by: Xianting Tian Link: https://lore.kernel.org/r/20220811074150.3020189-5-xianting.tian@linu= x.alibaba.com Cc: stable@vger.kernel.org Fixes: 2bfc6cd81bd1 ("riscv: Move kernel mapping outside of linear mapping") Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/riscv/mm/init.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -99,6 +99,10 @@ static void __init print_vm_layout(void) (unsigned long)VMEMMAP_END); print_mlm("vmalloc", (unsigned long)VMALLOC_START, (unsigned long)VMALLOC_END); +#ifdef CONFIG_64BIT + print_mlm("modules", (unsigned long)MODULES_VADDR, + (unsigned long)MODULES_END); +#endif print_mlm("lowmem", (unsigned long)PAGE_OFFSET, (unsigned long)high_memory); if (IS_ENABLED(CONFIG_64BIT)) { From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D02A1C2BB9D for ; Mon, 15 Aug 2022 20:16:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346950AbiHOUQf (ORCPT ); Mon, 15 Aug 2022 16:16:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346465AbiHOUL1 (ORCPT ); Mon, 15 Aug 2022 16:11:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A69AC32EC8; Mon, 15 Aug 2022 11:57:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 16531B81057; Mon, 15 Aug 2022 18:57:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BAB6C43140; Mon, 15 Aug 2022 18:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589863; bh=l0t7eNncgRAPZynlvUSG53rLZJLTg+ipE9Z/Sl0djqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GgVWqmwnvWqx+vhs+Gb+KnTEjG9g0RqavLa00TQUum8lIhUdo395CBXwhxIXuWj5h cHB0u+DgikCulSVLml0rLeV98oSkQz5oF2/WBbkHnZlr5URDEWyKhfklKSSs5I85lo WrOP25G989yTPGWksm7wF6JqNFjTSnfuFQWGL0L8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Palmer Dabbelt Subject: [PATCH 5.18 0073/1095] wireguard: selftests: set CONFIG_NONPORTABLE on riscv32 Date: Mon, 15 Aug 2022 19:51:12 +0200 Message-Id: <20220815180432.535168786@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld commit 9019b4f6d9bd88524ecd95420cf9cd4aaed7a125 upstream. When the CONFIG_PORTABLE/CONFIG_NONPORTABLE switches were added, various configs were updated, but the wireguard config was forgotten about. This leads to unbootable test kernels, causing CI fails. Add CONFIG_NONPORTABLE=3Dy to the wireguard test suite configuration for riscv32. Fixes: 44c1e84a38a0 ("RISC-V: Add CONFIG_{NON,}PORTABLE") Signed-off-by: Jason A. Donenfeld Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220809145757.83673-1-Jason@zx2c4.com Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/testing/selftests/wireguard/qemu/arch/riscv32.config | 1 + 1 file changed, 1 insertion(+) --- a/tools/testing/selftests/wireguard/qemu/arch/riscv32.config +++ b/tools/testing/selftests/wireguard/qemu/arch/riscv32.config @@ -1,3 +1,4 @@ +CONFIG_NONPORTABLE=3Dy CONFIG_ARCH_RV32I=3Dy CONFIG_MMU=3Dy CONFIG_FPU=3Dy From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17B8FC282E7 for ; Mon, 15 Aug 2022 20:13:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346227AbiHOUNW (ORCPT ); Mon, 15 Aug 2022 16:13:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346498AbiHOULa (ORCPT ); Mon, 15 Aug 2022 16:11:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D50B148E8C; Mon, 15 Aug 2022 11:57:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F03C5B81082; Mon, 15 Aug 2022 18:57:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56C7BC43140; Mon, 15 Aug 2022 18:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589866; bh=lyksit9egkFgQzevi8lT0Oeq5R1tu5DzG6yzRvGK+bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SjU6+90tOHUf63uoiwgQy29OBhfMyeh5sTHFvrm0sIQBaCF7pm7BhMHNfehTQwac3 04b0Px0b50IzPGeZ6HUCjC6JF7Si1k8PGpFZ20+LLlxmCDkO2jHGPSltYvbi1TJO7z X6hvnhAWdbTdzhMyZlL0/BxB+HQRVSed7U9xmXtY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathew McBride , Alexandre Belloni Subject: [PATCH 5.18 0074/1095] rtc: rx8025: fix 12/24 hour mode detection on RX-8035 Date: Mon, 15 Aug 2022 19:51:13 +0200 Message-Id: <20220815180432.583993518@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mathew McBride commit 71af91565052214ad86f288e0d8ffb165f790995 upstream. The 12/24hr flag in the RX-8035 can be found in the hour register, instead of the CTRL1 on the RX-8025. This was overlooked when support for the RX-8035 was added, and was causing read errors when the hour register 'overflowed'. To deal with the relevant register not always being visible in the relevant functions, determine the 12/24 mode at startup and store it in the driver state. Signed-off-by: Mathew McBride Fixes: f120e2e33ac8 ("rtc: rx8025: implement RX-8035 support") Cc: stable@vger.kernel.org Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20220706074236.24011-1-matt@traverse.com.au Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/rtc/rtc-rx8025.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) --- a/drivers/rtc/rtc-rx8025.c +++ b/drivers/rtc/rtc-rx8025.c @@ -55,6 +55,8 @@ #define RX8025_BIT_CTRL2_XST BIT(5) #define RX8025_BIT_CTRL2_VDET BIT(6) =20 +#define RX8035_BIT_HOUR_1224 BIT(7) + /* Clock precision adjustment */ #define RX8025_ADJ_RESOLUTION 3050 /* in ppb */ #define RX8025_ADJ_DATA_MAX 62 @@ -78,6 +80,7 @@ struct rx8025_data { struct rtc_device *rtc; enum rx_model model; u8 ctrl1; + int is_24; }; =20 static s32 rx8025_read_reg(const struct i2c_client *client, u8 number) @@ -226,7 +229,7 @@ static int rx8025_get_time(struct device =20 dt->tm_sec =3D bcd2bin(date[RX8025_REG_SEC] & 0x7f); dt->tm_min =3D bcd2bin(date[RX8025_REG_MIN] & 0x7f); - if (rx8025->ctrl1 & RX8025_BIT_CTRL1_1224) + if (rx8025->is_24) dt->tm_hour =3D bcd2bin(date[RX8025_REG_HOUR] & 0x3f); else dt->tm_hour =3D bcd2bin(date[RX8025_REG_HOUR] & 0x1f) % 12 @@ -254,7 +257,7 @@ static int rx8025_set_time(struct device */ date[RX8025_REG_SEC] =3D bin2bcd(dt->tm_sec); date[RX8025_REG_MIN] =3D bin2bcd(dt->tm_min); - if (rx8025->ctrl1 & RX8025_BIT_CTRL1_1224) + if (rx8025->is_24) date[RX8025_REG_HOUR] =3D bin2bcd(dt->tm_hour); else date[RX8025_REG_HOUR] =3D (dt->tm_hour >=3D 12 ? 0x20 : 0) @@ -279,6 +282,7 @@ static int rx8025_init_client(struct i2c struct rx8025_data *rx8025 =3D i2c_get_clientdata(client); u8 ctrl[2], ctrl2; int need_clear =3D 0; + int hour_reg; int err; =20 err =3D rx8025_read_regs(client, RX8025_REG_CTRL1, 2, ctrl); @@ -303,6 +307,16 @@ static int rx8025_init_client(struct i2c =20 err =3D rx8025_write_reg(client, RX8025_REG_CTRL2, ctrl2); } + + if (rx8025->model =3D=3D model_rx_8035) { + /* In RX-8035, 12/24 flag is in the hour register */ + hour_reg =3D rx8025_read_reg(client, RX8025_REG_HOUR); + if (hour_reg < 0) + return hour_reg; + rx8025->is_24 =3D (hour_reg & RX8035_BIT_HOUR_1224); + } else { + rx8025->is_24 =3D (ctrl[1] & RX8025_BIT_CTRL1_1224); + } out: return err; } @@ -329,7 +343,7 @@ static int rx8025_read_alarm(struct devi /* Hardware alarms precision is 1 minute! */ t->time.tm_sec =3D 0; t->time.tm_min =3D bcd2bin(ald[0] & 0x7f); - if (rx8025->ctrl1 & RX8025_BIT_CTRL1_1224) + if (rx8025->is_24) t->time.tm_hour =3D bcd2bin(ald[1] & 0x3f); else t->time.tm_hour =3D bcd2bin(ald[1] & 0x1f) % 12 @@ -350,7 +364,7 @@ static int rx8025_set_alarm(struct devic int err; =20 ald[0] =3D bin2bcd(t->time.tm_min); - if (rx8025->ctrl1 & RX8025_BIT_CTRL1_1224) + if (rx8025->is_24) ald[1] =3D bin2bcd(t->time.tm_hour); else ald[1] =3D (t->time.tm_hour >=3D 12 ? 0x20 : 0) From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5512FC25B0E for ; Mon, 15 Aug 2022 20:17:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346794AbiHOUQZ (ORCPT ); Mon, 15 Aug 2022 16:16:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346540AbiHOULl (ORCPT ); Mon, 15 Aug 2022 16:11:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18AAB48EBF; Mon, 15 Aug 2022 11:57:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0261CB810D5; Mon, 15 Aug 2022 18:57:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56BC6C433C1; Mon, 15 Aug 2022 18:57:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589869; bh=Rb/9eQRLbUfd2fRzgGAKHPh1034WETbV1eA+5pMP7DU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qji79SbvIucD0sW+OvZKuFeKHBpocmX+NIePYyzueR49AUQLSA1Kh5P4Ag9HLOLIL vGb5b47++w3Gury5C2Oz7XEjDCfgufFSxEUo2tBmTaesNsiUg3nv58bz8GHq5ka5fH wTrpDrjZ9LzxOdo+L7WLLINKT6D3/qEUComomoHs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , =?UTF-8?q?Christian=20K=C3=B6nig?= , Dmitry Osipenko , Daniel Vetter Subject: [PATCH 5.18 0075/1095] drm/gem: Properly annotate WW context on drm_gem_lock_reservations() error Date: Mon, 15 Aug 2022 19:51:14 +0200 Message-Id: <20220815180432.632763251@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Osipenko commit 2939deac1fa220bc82b89235f146df1d9b52e876 upstream. Use ww_acquire_fini() in the error code paths. Otherwise lockdep thinks that lock is held when lock's memory is freed after the drm_gem_lock_reservations() error. The ww_acquire_context needs to be annotated as "released", which fixes the noisy "WARNING: held lock freed!" splat of VirtIO-GPU driver with CONFIG_DEBUG_MUTEXES=3Dy and enabled lockde= p. Cc: stable@vger.kernel.org Fixes: 7edc3e3b975b5 ("drm: Add helpers for locking an array of BO reservat= ions.") Reviewed-by: Thomas Hellstr=C3=B6m Reviewed-by: Christian K=C3=B6nig Signed-off-by: Dmitry Osipenko Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20220630200405.1883897-= 2-dmitry.osipenko@collabora.com Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/drm_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -1225,7 +1225,7 @@ retry: ret =3D dma_resv_lock_slow_interruptible(obj->resv, acquire_ctx); if (ret) { - ww_acquire_done(acquire_ctx); + ww_acquire_fini(acquire_ctx); return ret; } } @@ -1250,7 +1250,7 @@ retry: goto retry; } =20 - ww_acquire_done(acquire_ctx); + ww_acquire_fini(acquire_ctx); return ret; } } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 878C6C25B0E for ; Mon, 15 Aug 2022 20:16:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346276AbiHOUPo (ORCPT ); Mon, 15 Aug 2022 16:15:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346562AbiHOULn (ORCPT ); Mon, 15 Aug 2022 16:11:43 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9086C491C8; Mon, 15 Aug 2022 11:57:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id A7E2CCE129D; Mon, 15 Aug 2022 18:57:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62D8DC433C1; Mon, 15 Aug 2022 18:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589872; bh=Qk6A5z5Pblx3Ub+fE3xuwH7Ai2Bhm0bhJE/MIKtqHqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IcuoVy93Fsj2RmE9W9/mt/+Mh6pK0FW6AwJNUOgoGvm6q/aTkKFQrp+Dl8Kqu641S LPe/wsWsdkXVC0aLC3YH2l99TQVTLQklWUUCDsuZNHgAqh+RwYOW8Ep97vU+3xiBOS 7N/FCVm+qF9BX8Lag8pFBzUgbIZqYE1LQEB8x34U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Daniel Vetter Subject: [PATCH 5.18 0076/1095] drm/shmem-helper: Add missing vunmap on error Date: Mon, 15 Aug 2022 19:51:15 +0200 Message-Id: <20220815180432.679327225@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Osipenko commit df4aaf015775221dde8a51ee09edb919981f091e upstream. The vmapping of dma-buf may succeed, but DRM SHMEM rejects the IOMEM mapping, and thus, drm_gem_shmem_vmap_locked() should unvmap the IOMEM before erroring out. Cc: stable@vger.kernel.org Fixes: 49a3f51dfeee ("drm/gem: Use struct dma_buf_map in GEM vmap ops and c= onvert GEM backends") Signed-off-by: Dmitry Osipenko Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20220630200058.1883506-= 2-dmitry.osipenko@collabora.com Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/drm_gem_shmem_helper.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -302,6 +302,7 @@ static int drm_gem_shmem_vmap_locked(str ret =3D dma_buf_vmap(obj->import_attach->dmabuf, map); if (!ret) { if (WARN_ON(map->is_iomem)) { + dma_buf_vunmap(obj->import_attach->dmabuf, map); ret =3D -EIO; goto err_put_pages; } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86953C25B08 for ; Mon, 15 Aug 2022 20:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242713AbiHOURd (ORCPT ); Mon, 15 Aug 2022 16:17:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346601AbiHOULr (ORCPT ); Mon, 15 Aug 2022 16:11:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A49C491E1; Mon, 15 Aug 2022 11:57:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 772AAB810C6; Mon, 15 Aug 2022 18:57:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAD52C433C1; Mon, 15 Aug 2022 18:57:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589876; bh=F/80Z00HgPKwa+mQQROHnQglAMuvNfxtONvqOduOywU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LAkSq+mz0P6BCYD8BwZOHyKZvOU1V0hwLybNMG+dsPIzvMH/FG8rUinb8HjUWebWl feQdww8wSRhaLiZcnX8XtJEEgKjSH7lQeDNBfYHXvhK4Az27MLb3xKogondaR5jgMB TzocfwtP5Ki8DL9SOp6sAem9j13G3lsCENVggFTE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Phil Elwell , Maxime Ripard Subject: [PATCH 5.18 0077/1095] drm/vc4: hdmi: Disable audio if dmas property is present but empty Date: Mon, 15 Aug 2022 19:51:16 +0200 Message-Id: <20220815180432.721242684@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Phil Elwell commit db2b927f8668adf3ac765e0921cd2720f5c04172 upstream. The dmas property is used to hold the dmaengine channel used for audio output. Older device trees were missing that property, so if it's not there we disable the audio output entirely. However, some overlays have set an empty value to that property, mostly to workaround the fact that overlays cannot remove a property. Let's add a test for that case and if it's empty, let's disable it as well. Cc: Signed-off-by: Phil Elwell Link: https://lore.kernel.org/r/20220613144800.326124-18-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_hdmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -1705,12 +1705,12 @@ static int vc4_hdmi_audio_init(struct vc struct device *dev =3D &vc4_hdmi->pdev->dev; struct platform_device *codec_pdev; const __be32 *addr; - int index; + int index, len; int ret; =20 - if (!of_find_property(dev->of_node, "dmas", NULL)) { + if (!of_find_property(dev->of_node, "dmas", &len) || !len) { dev_warn(dev, - "'dmas' DT property is missing, no HDMI audio\n"); + "'dmas' DT property is missing or empty, no HDMI audio\n"); return 0; } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3A5EC00140 for ; Mon, 15 Aug 2022 20:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242426AbiHOURY (ORCPT ); Mon, 15 Aug 2022 16:17:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346652AbiHOULy (ORCPT ); Mon, 15 Aug 2022 16:11:54 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C86E49B4A; Mon, 15 Aug 2022 11:58:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id AF4B3CE129B; Mon, 15 Aug 2022 18:58:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 974D5C433C1; Mon, 15 Aug 2022 18:57:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589879; bh=DlTQ8VDIbg09Ihg4xGaCCRBq46cuKg5QQPnMUByFDZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vj0HfIDBTrCRqSMUgSPcKzM0bMCWHMNX45xuSdd3SSs1dENItYyU8H7qaWqwt1lLS oIXHlzzI3XAT8WcMJmYlw0yHDGuxie8y3tjtQ38izColecYYiLOhTCf1hYCJKJnMz7 iKdRp1xp/1pKdXRgWop6QhvXXzP+2JnWv8EUy5CQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Cercueil , Sam Ravnborg , Christophe Branchereau Subject: [PATCH 5.18 0078/1095] drm/ingenic: Use the highest possible DMA burst size Date: Mon, 15 Aug 2022 19:51:17 +0200 Message-Id: <20220815180432.756102850@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Cercueil commit f0dce5c4fdaf9e98dd2755ffb1363822854b6287 upstream. Until now, when running at the maximum resolution of 1280x720 at 32bpp on the JZ4770 SoC the output was garbled, the X/Y position of the top-left corner of the framebuffer warping to a random position with the whole image being offset accordingly, every time a new frame was being submitted. This problem can be eliminated by using a bigger burst size for the DMA. Set in each soc_info structure the maximum burst size supported by the corresponding SoC, and use it in the driver. Set the new value using regmap_update_bits() instead of regmap_set_bits(), since we do want to override the old value of the burst size. (Note that regmap_set_bits() wasn't really valid before for the same reason, but it never seemed to be a problem). Cc: Fixes: 90b86fcc47b4 ("DRM: Add KMS driver for the Ingenic JZ47xx SoCs") Signed-off-by: Paul Cercueil Link: https://patchwork.freedesktop.org/patch/msgid/20220702230727.66704-1-= paul@crapouillou.net Acked-by: Sam Ravnborg Tested-by: Christophe Branchereau Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 10 ++++++++-- drivers/gpu/drm/ingenic/ingenic-drm.h | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -69,6 +69,7 @@ struct jz_soc_info { bool map_noncoherent; bool use_extended_hwdesc; bool plane_f0_not_working; + u32 max_burst; unsigned int max_width, max_height; const u32 *formats_f0, *formats_f1; unsigned int num_formats_f0, num_formats_f1; @@ -308,8 +309,9 @@ static void ingenic_drm_crtc_update_timi regmap_write(priv->map, JZ_REG_LCD_REV, mode->htotal << 16); } =20 - regmap_set_bits(priv->map, JZ_REG_LCD_CTRL, - JZ_LCD_CTRL_OFUP | JZ_LCD_CTRL_BURST_16); + regmap_update_bits(priv->map, JZ_REG_LCD_CTRL, + JZ_LCD_CTRL_OFUP | JZ_LCD_CTRL_BURST_MASK, + JZ_LCD_CTRL_OFUP | priv->soc_info->max_burst); =20 /* * IPU restart - specify how much time the LCDC will wait before @@ -1480,6 +1482,7 @@ static const struct jz_soc_info jz4740_s .map_noncoherent =3D false, .max_width =3D 800, .max_height =3D 600, + .max_burst =3D JZ_LCD_CTRL_BURST_16, .formats_f1 =3D jz4740_formats, .num_formats_f1 =3D ARRAY_SIZE(jz4740_formats), /* JZ4740 has only one plane */ @@ -1491,6 +1494,7 @@ static const struct jz_soc_info jz4725b_ .map_noncoherent =3D false, .max_width =3D 800, .max_height =3D 600, + .max_burst =3D JZ_LCD_CTRL_BURST_16, .formats_f1 =3D jz4725b_formats_f1, .num_formats_f1 =3D ARRAY_SIZE(jz4725b_formats_f1), .formats_f0 =3D jz4725b_formats_f0, @@ -1503,6 +1507,7 @@ static const struct jz_soc_info jz4770_s .map_noncoherent =3D true, .max_width =3D 1280, .max_height =3D 720, + .max_burst =3D JZ_LCD_CTRL_BURST_64, .formats_f1 =3D jz4770_formats_f1, .num_formats_f1 =3D ARRAY_SIZE(jz4770_formats_f1), .formats_f0 =3D jz4770_formats_f0, @@ -1517,6 +1522,7 @@ static const struct jz_soc_info jz4780_s .plane_f0_not_working =3D true, /* REVISIT */ .max_width =3D 4096, .max_height =3D 2048, + .max_burst =3D JZ_LCD_CTRL_BURST_64, .formats_f1 =3D jz4770_formats_f1, .num_formats_f1 =3D ARRAY_SIZE(jz4770_formats_f1), .formats_f0 =3D jz4770_formats_f0, --- a/drivers/gpu/drm/ingenic/ingenic-drm.h +++ b/drivers/gpu/drm/ingenic/ingenic-drm.h @@ -106,6 +106,9 @@ #define JZ_LCD_CTRL_BURST_4 (0x0 << 28) #define JZ_LCD_CTRL_BURST_8 (0x1 << 28) #define JZ_LCD_CTRL_BURST_16 (0x2 << 28) +#define JZ_LCD_CTRL_BURST_32 (0x3 << 28) +#define JZ_LCD_CTRL_BURST_64 (0x4 << 28) +#define JZ_LCD_CTRL_BURST_MASK (0x7 << 28) #define JZ_LCD_CTRL_RGB555 BIT(27) #define JZ_LCD_CTRL_OFUP BIT(26) #define JZ_LCD_CTRL_FRC_GRAYSCALE_16 (0x0 << 24) From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BB48C2BB45 for ; Mon, 15 Aug 2022 20:16:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346848AbiHOUQ2 (ORCPT ); Mon, 15 Aug 2022 16:16:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346648AbiHOULy (ORCPT ); Mon, 15 Aug 2022 16:11:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A275549B52; Mon, 15 Aug 2022 11:58:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3EB7DB810A1; Mon, 15 Aug 2022 18:58:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68762C433C1; Mon, 15 Aug 2022 18:58:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589882; bh=VZdlmM1yI6DDiCaE7reYOZ8qKqKYhTpxSZQNW8mwYrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=msGIP1HDYk5KxLDjeDYGm0Gcx986g/CmOgNmmDjEnqOqiWJ3xR9EYcAFsjmDXaqzS T4ErQ9dHYoFbzdvfSLHK9wL5TsWG0HYl/UhYQhJPJ4aCPJbOH5OKxtePBVWhSCp0ax 2RM2v36czVcDkWPBBU6iomT6U/GxkPWDUJlKqVkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Zimmermann , Deepak Rawat , Maarten Lankhorst , Maxime Ripard , linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org, Maxime Ripard , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= Subject: [PATCH 5.18 0079/1095] drm/hyperv-drm: Include framebuffer and EDID headers Date: Mon, 15 Aug 2022 19:51:18 +0200 Message-Id: <20220815180432.787310852@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Zimmermann commit 009a3a52791f31c57d755a73f6bc66fbdd8bd76c upstream. Fix a number of compile errors by including the correct header files. Examples are shown below. ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c: In function 'hyperv_blit_= to_vram_rect': ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c:25:48: error: invalid use = of undefined type 'struct drm_framebuffer' 25 | struct hyperv_drm_device *hv =3D to_hv(fb->dev); | ^~ ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c: In function 'hyperv_conne= ctor_get_modes': ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c:59:17: error: implicit dec= laration of function 'drm_add_modes_noedid' [-Werror=3Dimplicit-function-de= claration] 59 | count =3D drm_add_modes_noedid(connector, | ^~~~~~~~~~~~~~~~~~~~ ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c:62:9: error: implicit decl= aration of function 'drm_set_preferred_mode'; did you mean 'drm_mm_reserve_= node'? [-Werror=3Dimplicit-function-declaration] 62 | drm_set_preferred_mode(connector, hv->preferred_width, | ^~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Thomas Zimmermann Fixes: 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic video= device") Fixes: 720cf96d8fec ("drm: Drop drm_framebuffer.h from drm_crtc.h") Fixes: 255490f9150d ("drm: Drop drm_edid.h from drm_crtc.h") Cc: Deepak Rawat Cc: Thomas Zimmermann Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: linux-hyperv@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: # v5.14+ Acked-by: Maxime Ripard Reviewed-by: Ville Syrj=C3=A4l=C3=A4 Link: https://patchwork.freedesktop.org/patch/msgid/20220622083413.12573-1-= tzimmermann@suse.de Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +++ b/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c @@ -7,9 +7,11 @@ =20 #include #include +#include #include #include #include +#include #include #include #include From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E58BEC00140 for ; Mon, 15 Aug 2022 20:15:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242768AbiHOUPR (ORCPT ); Mon, 15 Aug 2022 16:15:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346654AbiHOULy (ORCPT ); Mon, 15 Aug 2022 16:11:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A4D549B58; Mon, 15 Aug 2022 11:58:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A399561230; Mon, 15 Aug 2022 18:58:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 904FEC433C1; Mon, 15 Aug 2022 18:58:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589885; bh=38z5+1E7HVbT6HeQjqkDPqJFtUVE6OakjVGr/qrHk+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kqS50959rYDnVY3joO1MRhORVfdAV7912OYyR7NqXgeMKzpiMteVXeIXMLbbRUkl7 clcTVPTzNIG13WAtDtEyfCa2qTZUC9o9Clp9LGHm/Euk2WtcLLHu+kWOIgDRT8rDOq fIQY6jUSU4hcyXTdFyMkj5ZuTmMfVIx+uy3i6Kzk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Timur Tabi , Karol Herbst , Lyude Paul Subject: [PATCH 5.18 0080/1095] drm/nouveau: fix another off-by-one in nvbios_addr Date: Mon, 15 Aug 2022 19:51:19 +0200 Message-Id: <20220815180432.833787907@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Timur Tabi commit c441d28945fb113220d48d6c86ebc0b090a2b677 upstream. This check determines whether a given address is part of image 0 or image 1. Image 1 starts at offset image0_size, so that address should be included. Fixes: 4d4e9907ff572 ("drm/nouveau/bios: guard against out-of-bounds access= es to image") Cc: # v4.8+ Signed-off-by: Timur Tabi Reviewed-by: Karol Herbst Signed-off-by: Lyude Paul Link: https://patchwork.freedesktop.org/patch/msgid/20220511163716.3520591-= 1-ttabi@nvidia.com Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c @@ -33,7 +33,7 @@ nvbios_addr(struct nvkm_bios *bios, u32 { u32 p =3D *addr; =20 - if (*addr > bios->image0_size && bios->imaged_addr) { + if (*addr >=3D bios->image0_size && bios->imaged_addr) { *addr -=3D bios->image0_size; *addr +=3D bios->imaged_addr; } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F738C2BBC5 for ; Mon, 15 Aug 2022 20:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347085AbiHOUQr (ORCPT ); Mon, 15 Aug 2022 16:16:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346697AbiHOUMA (ORCPT ); Mon, 15 Aug 2022 16:12:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAB7285A8B; Mon, 15 Aug 2022 11:58:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7434E61274; Mon, 15 Aug 2022 18:58:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77768C433C1; Mon, 15 Aug 2022 18:58:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589890; bh=V1Q9LMJoIqpGyydO3a1zid7QGNBisxqlZD0J0mhVsWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J2T+G2RiNpuX1vXQhg4Dz+fKIYzlyb1iFClXiXFYgpiqqrnj/ZNBUabeS8lUBXa+b q2fy9C6tjZvwEO8FpTy3Ltoe5iwJSe74bwThAu/tOFr1kyT1BPMc/mSP9pazV2+n+s PMFRE3+gA/blOsfMmi9G559pOHed9R2OAkjLYm3Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , David Airlie , Hans de Goede Subject: [PATCH 5.18 0081/1095] drm/nouveau: Dont pm_runtime_put_sync(), only pm_runtime_put_autosuspend() Date: Mon, 15 Aug 2022 19:51:20 +0200 Message-Id: <20220815180432.872099520@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lyude Paul commit c96cfaf8fc02d4bb70727dfa7ce7841a3cff9be2 upstream. While trying to fix another issue, it occurred to me that I don't actually think there is any situation where we want pm_runtime_put() in nouveau to be synchronous. In fact, this kind of just seems like it would cause issues where we may unexpectedly block a thread we don't expect to be blocked. So, let's only use pm_runtime_put_autosuspend(). Changes since v1: * Use pm_runtime_put_autosuspend(), not pm_runtime_put() Signed-off-by: Lyude Paul Reviewed-by: David Airlie Fixes: 3a6536c51d5d ("drm/nouveau: Intercept ACPI_VIDEO_NOTIFY_PROBE") Cc: Hans de Goede Cc: # v4.10+ Link: https://patchwork.freedesktop.org/patch/msgid/20220714174234.949259-3= -lyude@redhat.com Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/nouveau/nouveau_display.c | 2 +- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -515,7 +515,7 @@ nouveau_display_hpd_work(struct work_str =20 pm_runtime_mark_last_busy(drm->dev->dev); noop: - pm_runtime_put_sync(drm->dev->dev); + pm_runtime_put_autosuspend(dev->dev); } =20 #ifdef CONFIG_ACPI --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c @@ -466,7 +466,7 @@ nouveau_fbcon_set_suspend_work(struct wo if (state =3D=3D FBINFO_STATE_RUNNING) { nouveau_fbcon_hotplug_resume(drm->fbcon); pm_runtime_mark_last_busy(drm->dev->dev); - pm_runtime_put_sync(drm->dev->dev); + pm_runtime_put_autosuspend(drm->dev->dev); } } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF782C2BB47 for ; Mon, 15 Aug 2022 20:16:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346993AbiHOUQj (ORCPT ); Mon, 15 Aug 2022 16:16:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346712AbiHOUMC (ORCPT ); Mon, 15 Aug 2022 16:12:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B04E184EFE; Mon, 15 Aug 2022 11:58:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8F11561267; Mon, 15 Aug 2022 18:58:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 802F7C433C1; Mon, 15 Aug 2022 18:58:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589894; bh=Dc4YOQQ6zjvzDoMoV0wOA2bk8tMQqRdubB3LBNCpDCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h0qKciH1KGscbrYdNhDnLkQRGAwG1EtyEelZ2x7szrELU9nm4nVXR1lKTOqEJTO7Z ip7w/00mFVtx2yG3NB1aW3Hhdi9ZtseZuFeY4UQpV6No6J5reFB6gZL5cWxNnLBigz lU5OQ83a5BzTAkbRx8M+5XdCHEoUgw8YcgwCD+iQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , David Airlie Subject: [PATCH 5.18 0082/1095] drm/nouveau/acpi: Dont print error when we get -EINPROGRESS from pm_runtime Date: Mon, 15 Aug 2022 19:51:21 +0200 Message-Id: <20220815180432.911868080@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lyude Paul commit 53c26181950ddc3c8ace3c0939c89e9c4d8deeb9 upstream. Since this isn't actually a failure. Signed-off-by: Lyude Paul Reviewed-by: David Airlie Fixes: 79e765ad665d ("drm/nouveau/drm/nouveau: Prevent handling ACPI HPD ev= ents too early") Cc: # v4.19+ Link: https://patchwork.freedesktop.org/patch/msgid/20220714174234.949259-2= -lyude@redhat.com Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/nouveau/nouveau_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -537,7 +537,7 @@ nouveau_display_acpi_ntfy(struct notifie * it's own hotplug events. */ pm_runtime_put_autosuspend(drm->dev->dev); - } else if (ret =3D=3D 0) { + } else if (ret =3D=3D 0 || ret =3D=3D -EINPROGRESS) { /* We've started resuming the GPU already, so * it will handle scheduling a full reprobe * itself From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69F15C00140 for ; Mon, 15 Aug 2022 20:17:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346733AbiHOUQX (ORCPT ); Mon, 15 Aug 2022 16:16:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346772AbiHOUMK (ORCPT ); Mon, 15 Aug 2022 16:12:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 712E485FAF; Mon, 15 Aug 2022 11:58:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4917BB8109E; Mon, 15 Aug 2022 18:58:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90CACC433C1; Mon, 15 Aug 2022 18:58:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589897; bh=y5dOMvY/vtWmTZ442l2tNq7mMPfl2pLTBxrmgWBug+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1055WH18Hcli+c3zty9pKhxzp1JbRu/d7svU3iDuWwl55o/SqJaJNOf40sAo4AtA8 UvEsCNQseGwq11o4CfWToJZKfj5mV+9veK/lR50Cx9dQiCSwSxze84DiGwo1bMktOc byjVMnAG9cwmzaNrqum1lp9fDxbiIXczvx1z7Ock= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , David Airlie Subject: [PATCH 5.18 0083/1095] drm/nouveau/kms: Fix failure path for creating DP connectors Date: Mon, 15 Aug 2022 19:51:22 +0200 Message-Id: <20220815180432.951391700@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lyude Paul commit ca0367ca5d9216644b41f86348d6661f8d9e32d8 upstream. It looks like that when we moved nouveau over to using drm_dp_aux_init() and registering it's aux bus during late connector registration, we totally forgot to fix the failure codepath in nouveau_connector_create() - as it still seems to assume that drm_dp_aux_init() can fail (it can't). So, let's fix that and also add a missing check to ensure that we've properly allocated nv_connector->aux.name while we're at it. Signed-off-by: Lyude Paul Reviewed-by: David Airlie Fixes: fd43ad9d47e7 ("drm/nouveau/kms/nv50-: Move AUX adapter reg to connec= tor late register/early unregister") Cc: # v5.14+ Link: https://patchwork.freedesktop.org/patch/msgid/20220526204313.656473-1= -lyude@redhat.com Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/nouveau/nouveau_connector.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -1361,13 +1361,11 @@ nouveau_connector_create(struct drm_devi snprintf(aux_name, sizeof(aux_name), "sor-%04x-%04x", dcbe->hasht, dcbe->hashm); nv_connector->aux.name =3D kstrdup(aux_name, GFP_KERNEL); - drm_dp_aux_init(&nv_connector->aux); - if (ret) { - NV_ERROR(drm, "Failed to init AUX adapter for sor-%04x-%04x: %d\n", - dcbe->hasht, dcbe->hashm, ret); + if (!nv_connector->aux.name) { kfree(nv_connector); - return ERR_PTR(ret); + return ERR_PTR(-ENOMEM); } + drm_dp_aux_init(&nv_connector->aux); fallthrough; default: funcs =3D &nouveau_connector_funcs; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84254C00140 for ; Mon, 15 Aug 2022 20:20:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244980AbiHOUU1 (ORCPT ); Mon, 15 Aug 2022 16:20:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346804AbiHOUMU (ORCPT ); Mon, 15 Aug 2022 16:12:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F315C86889; Mon, 15 Aug 2022 11:58:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 33950B81082; Mon, 15 Aug 2022 18:58:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80488C433D7; Mon, 15 Aug 2022 18:58:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589899; bh=lVE6si0vEtraGgGv0n6yqWBROaRF84v5MFZZ0BLmqaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yVPUzozC9ET22ebSsaF++vGN8bAGiVA0lkjwhpHshWeq5ZlK7UainGlNQEg8aKaLc 1xBD/PVnIg6C2FIWXMWK7BGcuDqvIY+k+tfUpnGqahPBwF1oineuwk1ZRAf5MynjPw fRXXN7JnYOXEtwRHjbVwPwllklDsN4ZBYKkVyUlA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Thierry Reding Subject: [PATCH 5.18 0084/1095] drm/tegra: Fix vmapping of prime buffers Date: Mon, 15 Aug 2022 19:51:23 +0200 Message-Id: <20220815180433.003947828@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Osipenko commit c7860cbee9989882d2908682526a5ef617523cfe upstream. The code assumes that Tegra GEM is permanently vmapped, which is not true for the scattered buffers. After converting Tegra video decoder driver to V4L API, we're now getting a BUG_ON from dma-buf core on playing video using libvdpau-tegra on T30+ because tegra_gem_prime_vmap() sets vaddr to NULL. Older pre-V4L video decoder driver wasn't vmapping dma-bufs. Fix it by actually vmapping the exported GEMs. Cc: stable@vger.kernel.org Signed-off-by: Dmitry Osipenko Signed-off-by: Thierry Reding Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/tegra/gem.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -704,14 +704,23 @@ static int tegra_gem_prime_vmap(struct d { struct drm_gem_object *gem =3D buf->priv; struct tegra_bo *bo =3D to_tegra_bo(gem); + void *vaddr; =20 - iosys_map_set_vaddr(map, bo->vaddr); + vaddr =3D tegra_bo_mmap(&bo->base); + if (IS_ERR(vaddr)) + return PTR_ERR(vaddr); + + iosys_map_set_vaddr(map, vaddr); =20 return 0; } =20 static void tegra_gem_prime_vunmap(struct dma_buf *buf, struct iosys_map *= map) { + struct drm_gem_object *gem =3D buf->priv; + struct tegra_bo *bo =3D to_tegra_bo(gem); + + tegra_bo_munmap(&bo->base, map->vaddr); } =20 static const struct dma_buf_ops tegra_gem_prime_dmabuf_ops =3D { From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D32CFC00140 for ; Mon, 15 Aug 2022 20:20:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346343AbiHOUT6 (ORCPT ); Mon, 15 Aug 2022 16:19:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346809AbiHOUMV (ORCPT ); Mon, 15 Aug 2022 16:12:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B2F386891; Mon, 15 Aug 2022 11:58:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 60B6361280; Mon, 15 Aug 2022 18:58:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63316C43470; Mon, 15 Aug 2022 18:58:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589902; bh=z5P5iOpHw9o5eHJmvlNNQbVx8HFSYja93QJ6343QSNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B2jxVl0W4VTD72HirGPc5g5ZE2EYH92zpVpw/oJkBSifXhGzyToA3ft3cyq2voC06 D8B6TtqayYJH55x1LLzDwgMtyIjaCqATgZY2E8okCQS2aYj2G6LRRdinmMXq6EXraq V7QtbHWBbtB76FF3UYDn8xsb5VH+wtFGnBmoer1o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leo Li , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= Subject: [PATCH 5.18 0085/1095] drm/amdgpu: Check BOs requested pinning domains against its preferred_domains Date: Mon, 15 Aug 2022 19:51:24 +0200 Message-Id: <20220815180433.042800016@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leo Li commit f5ba14043621f4afdf3ad5f92ee2d8dbebbe4340 upstream. When pinning a buffer, we should check to see if there are any additional restrictions imposed by bo->preferred_domains. This will prevent the BO from being moved to an invalid domain when pinning. For example, this can happen if the user requests to create a BO in GTT domain for display scanout. amdgpu_dm will allow pinning to either VRAM or GTT domains, since DCN can scanout from either or. However, in amdgpu_bo_pin_restricted(), pinning to VRAM is preferred if there is adequate carveout. This can lead to pinning to VRAM despite the user requesting GTT placement for the BO. v2: Allow the kernel to override the domain, which can happen when exporting a BO to a V4L camera (for example). Signed-off-by: Leo Li Reviewed-by: Alex Deucher Reviewed-by: Christian K=C3=B6nig Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -882,6 +882,10 @@ int amdgpu_bo_pin_restricted(struct amdg if (WARN_ON_ONCE(min_offset > max_offset)) return -EINVAL; =20 + /* Check domain to be pinned to against preferred domains */ + if (bo->preferred_domains & domain) + domain =3D bo->preferred_domains & domain; + /* A shared bo cannot be migrated to VRAM */ if (bo->tbo.base.import_attach) { if (domain & AMDGPU_GEM_DOMAIN_GTT) From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4AC4C00140 for ; Mon, 15 Aug 2022 20:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233232AbiHOURC (ORCPT ); Mon, 15 Aug 2022 16:17:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346854AbiHOUM1 (ORCPT ); Mon, 15 Aug 2022 16:12:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2199E868AE; Mon, 15 Aug 2022 11:58:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 516F0B8109E; Mon, 15 Aug 2022 18:58:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E79CC43140; Mon, 15 Aug 2022 18:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589906; bh=bbVsRIqTI1GSTDz6iyNeKhJVxzu66G+MMgt+l3ahHlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kUDGnki0j6D6mz0ToaALLuD0RGGLeCYb90uusv1/jEJQnvDn36whs3cFu+v9+21em 3mvlmV08ULetDQa+rfqQ+SJQfjy4zpsxPTWGFw0VoXUpyMmMdyRHZ3J0urV3snge0R 09uUe5y5qmTJ9YSghozVex4JvVKyqWddTwQ7ISHM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+f264bffdfbd5614f3bb2@syzkaller.appspotmail.com, Tadeusz Struk , Andrii Nakryiko Subject: [PATCH 5.18 0086/1095] bpf: Fix KASAN use-after-free Read in compute_effective_progs Date: Mon, 15 Aug 2022 19:51:25 +0200 Message-Id: <20220815180433.075915918@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tadeusz Struk commit 4c46091ee985ae84c60c5e95055d779fcd291d87 upstream. Syzbot found a Use After Free bug in compute_effective_progs(). The reproducer creates a number of BPF links, and causes a fault injected alloc to fail, while calling bpf_link_detach on them. Link detach triggers the link to be freed by bpf_link_free(), which calls __cgroup_bpf_detach() and update_effective_progs(). If the memory allocation in this function fails, the function restores the pointer to the bpf_cgroup_link on the cgroup list, but the memory gets freed just after it returns. After this, every subsequent call to update_effective_progs() causes this already deallocated pointer to be dereferenced in prog_list_length(), and triggers KASAN UAF error. To fix this issue don't preserve the pointer to the prog or link in the list, but remove it and replace it with a dummy prog without shrinking the table. The subsequent call to __cgroup_bpf_detach() or __cgroup_bpf_detach() will correct it. Fixes: af6eea57437a ("bpf: Implement bpf_link-based cgroup BPF program atta= chment") Reported-by: Signed-off-by: Tadeusz Struk Signed-off-by: Andrii Nakryiko Cc: Link: https://syzkaller.appspot.com/bug?id=3D8ebf179a95c2a2670f7cf1ba62429e= c044369db4 Link: https://lore.kernel.org/bpf/20220517180420.87954-1-tadeusz.struk@lina= ro.org Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/bpf/cgroup.c | 70 ++++++++++++++++++++++++++++++++++++++++++++---= ----- 1 file changed, 60 insertions(+), 10 deletions(-) --- a/kernel/bpf/cgroup.c +++ b/kernel/bpf/cgroup.c @@ -748,6 +748,60 @@ static struct bpf_prog_list *find_detach } =20 /** + * purge_effective_progs() - After compute_effective_progs fails to alloc = new + * cgrp->bpf.inactive table we can recover by + * recomputing the array in place. + * + * @cgrp: The cgroup which descendants to travers + * @prog: A program to detach or NULL + * @link: A link to detach or NULL + * @atype: Type of detach operation + */ +static void purge_effective_progs(struct cgroup *cgrp, struct bpf_prog *pr= og, + struct bpf_cgroup_link *link, + enum cgroup_bpf_attach_type atype) +{ + struct cgroup_subsys_state *css; + struct bpf_prog_array *progs; + struct bpf_prog_list *pl; + struct list_head *head; + struct cgroup *cg; + int pos; + + /* recompute effective prog array in place */ + css_for_each_descendant_pre(css, &cgrp->self) { + struct cgroup *desc =3D container_of(css, struct cgroup, self); + + if (percpu_ref_is_zero(&desc->bpf.refcnt)) + continue; + + /* find position of link or prog in effective progs array */ + for (pos =3D 0, cg =3D desc; cg; cg =3D cgroup_parent(cg)) { + if (pos && !(cg->bpf.flags[atype] & BPF_F_ALLOW_MULTI)) + continue; + + head =3D &cg->bpf.progs[atype]; + list_for_each_entry(pl, head, node) { + if (!prog_list_prog(pl)) + continue; + if (pl->prog =3D=3D prog && pl->link =3D=3D link) + goto found; + pos++; + } + } +found: + BUG_ON(!cg); + progs =3D rcu_dereference_protected( + desc->bpf.effective[atype], + lockdep_is_held(&cgroup_mutex)); + + /* Remove the program from the array */ + WARN_ONCE(bpf_prog_array_delete_safe_at(progs, pos), + "Failed to purge a prog from array at index %d", pos); + } +} + +/** * __cgroup_bpf_detach() - Detach the program or link from a cgroup, and * propagate the change to descendants * @cgrp: The cgroup which descendants to traverse @@ -766,7 +820,6 @@ static int __cgroup_bpf_detach(struct cg struct bpf_prog_list *pl; struct list_head *progs; u32 flags; - int err; =20 atype =3D to_cgroup_bpf_attach_type(type); if (atype < 0) @@ -788,9 +841,12 @@ static int __cgroup_bpf_detach(struct cg pl->prog =3D NULL; pl->link =3D NULL; =20 - err =3D update_effective_progs(cgrp, atype); - if (err) - goto cleanup; + if (update_effective_progs(cgrp, atype)) { + /* if update effective array failed replace the prog with a dummy prog*/ + pl->prog =3D old_prog; + pl->link =3D link; + purge_effective_progs(cgrp, old_prog, link, atype); + } =20 /* now can actually delete it from this cgroup list */ list_del(&pl->node); @@ -802,12 +858,6 @@ static int __cgroup_bpf_detach(struct cg bpf_prog_put(old_prog); static_branch_dec(&cgroup_bpf_enabled_key[atype]); return 0; - -cleanup: - /* restore back prog or link */ - pl->prog =3D old_prog; - pl->link =3D link; - return err; } =20 static int cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog, From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C613C282E7 for ; Mon, 15 Aug 2022 20:14:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243816AbiHOUOO (ORCPT ); Mon, 15 Aug 2022 16:14:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346870AbiHOUM3 (ORCPT ); Mon, 15 Aug 2022 16:12:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B821686C07; Mon, 15 Aug 2022 11:58:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E43FDB81082; Mon, 15 Aug 2022 18:58:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5103BC433D7; Mon, 15 Aug 2022 18:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589908; bh=JjfQgWZfUGBd8O4hLqu/UYGvGZuqcHisNT5EruWowCw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bXcjM3GZBTrVUXgG3hPLtOf0Yn1TU72x0NsTPXU0vptJOe7HjPaswn1dk+UyO1qxa 0vbJUE6J5p3x0S399bp0GZ3nRL/04ecvwzGzPzVv1PwFnQXv0en0PMCvrBQBM5KVKU Zytf7FNoziyihec9uLUzMO+TD8HlGVxL0RpP3U1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qu Wenruo , David Sterba Subject: [PATCH 5.18 0087/1095] btrfs: reject log replay if there is unsupported RO compat flag Date: Mon, 15 Aug 2022 19:51:26 +0200 Message-Id: <20220815180433.111113001@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qu Wenruo commit dc4d31684974d140250f3ee612c3f0cab13b3146 upstream. [BUG] If we have a btrfs image with dirty log, along with an unsupported RO compatible flag: log_root 30474240 ... compat_flags 0x0 compat_ro_flags 0x40000003 ( FREE_SPACE_TREE | FREE_SPACE_TREE_VALID | unknown flag: 0x40000000 ) Then even if we can only mount it RO, we will still cause metadata update for log replay: BTRFS info (device dm-1): flagging fs with big metadata feature BTRFS info (device dm-1): using free space tree BTRFS info (device dm-1): has skinny extents BTRFS info (device dm-1): start tree-log replay This is definitely against RO compact flag requirement. [CAUSE] RO compact flag only forces us to do RO mount, but we will still do log replay for plain RO mount. Thus this will result us to do log replay and update metadata. This can be very problematic for new RO compat flag, for example older kernel can not understand v2 cache, and if we allow metadata update on RO mount and invalidate/corrupt v2 cache. [FIX] Just reject the mount unless rescue=3Dnologreplay is provided: BTRFS error (device dm-1): cannot replay dirty log with unsupport optiona= l features (0x40000000), try rescue=3Dnologreplay instead We don't want to set rescue=3Dnologreply directly, as this would make the end user to read the old data, and cause confusion. Since the such case is really rare, we're mostly fine to just reject the mount with an error message, which also includes the proper workaround. CC: stable@vger.kernel.org #4.9+ Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/disk-io.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3654,6 +3654,20 @@ int __cold open_ctree(struct super_block err =3D -EINVAL; goto fail_alloc; } + /* + * We have unsupported RO compat features, although RO mounted, we + * should not cause any metadata write, including log replay. + * Or we could screw up whatever the new feature requires. + */ + if (unlikely(features && btrfs_super_log_root(disk_super) && + !btrfs_test_opt(fs_info, NOLOGREPLAY))) { + btrfs_err(fs_info, +"cannot replay dirty log with unsupported compat_ro features (0x%llx), try= rescue=3Dnologreplay", + features); + err =3D -EINVAL; + goto fail_alloc; + } + =20 if (sectorsize < PAGE_SIZE) { struct btrfs_subpage_info *subpage_info; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1529C25B08 for ; Mon, 15 Aug 2022 20:15:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241901AbiHOUPN (ORCPT ); Mon, 15 Aug 2022 16:15:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346900AbiHOUMd (ORCPT ); Mon, 15 Aug 2022 16:12:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84F1A86C38; Mon, 15 Aug 2022 11:58:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E40A1B81057; Mon, 15 Aug 2022 18:58:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F5C7C433D7; Mon, 15 Aug 2022 18:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589911; bh=/ETDo4V7GPQUwRsVjK5Nh+gt4dXLrxqWmPgcWmO53ls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aRh52GAfvQ8BQbWCv6E1jkUy3/QNZdetCC0m+dExgKkcc7VjHkockHz4WN4tPcEGm h6JcNaxfJ8pTD2tsS+xoxlkRHqqiJUGkZxFdAU7L73tcfkmzAyBpIPe/bPmBkC1qG8 07xLaDq+Ry9RkwzZveU1iOwYh2+P5m0mFBh9whRI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kitaina , Amit Kumar Mahapatra , Miquel Raynal Subject: [PATCH 5.18 0088/1095] mtd: rawnand: arasan: Fix clock rate in NV-DDR Date: Mon, 15 Aug 2022 19:51:27 +0200 Message-Id: <20220815180433.154443347@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Olga Kitaina commit e16eceea863b417fd328588b1be1a79de0bc937f upstream. According to the Arasan NAND controller spec, the flash clock rate for SDR must be <=3D 100 MHz, while for NV-DDR it must be the same as the rate of t= he CLK line for the mode. The driver previously always set 100 MHz for NV-DDR, which would result in incorrect behavior for NV-DDR modes 0-4. The appropriate clock rate can be calculated from the NV-DDR timing parameters as 1/tCK, or for rates measured in picoseconds, 10^12 / nand_nvddr_timings->tCK_min. Fixes: 197b88fecc50 ("mtd: rawnand: arasan: Add new Arasan NAND controller") CC: stable@vger.kernel.org # 5.8+ Signed-off-by: Olga Kitaina Signed-off-by: Amit Kumar Mahapatra Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220628154824.12222-3-amit.kumar-m= ahapatra@xilinx.com Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mtd/nand/raw/arasan-nand-controller.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/mtd/nand/raw/arasan-nand-controller.c +++ b/drivers/mtd/nand/raw/arasan-nand-controller.c @@ -1043,7 +1043,13 @@ static int anfc_setup_interface(struct n DQS_BUFF_SEL_OUT(dqs_mode); } =20 - anand->clk =3D ANFC_XLNX_SDR_DFLT_CORE_CLK; + if (nand_interface_is_sdr(conf)) { + anand->clk =3D ANFC_XLNX_SDR_DFLT_CORE_CLK; + } else { + /* ONFI timings are defined in picoseconds */ + anand->clk =3D div_u64((u64)NSEC_PER_SEC * 1000, + conf->timings.nvddr.tCK_min); + } =20 /* * Due to a hardware bug in the ZynqMP SoC, SDR timing modes 0-1 work From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84660C00140 for ; Mon, 15 Aug 2022 20:17:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232958AbiHOURH (ORCPT ); Mon, 15 Aug 2022 16:17:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346913AbiHOUMg (ORCPT ); Mon, 15 Aug 2022 16:12:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A53788DC4; Mon, 15 Aug 2022 11:58:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 40B6460A71; Mon, 15 Aug 2022 18:58:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B27BC433D7; Mon, 15 Aug 2022 18:58:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589914; bh=90TsjMqOUNEM4+jK+tHM4C/XBOy4yWf55oPYVu5rl94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HAjyvGFBO5y0wfhd2WeZOkJ+Tr7mZwYjKJGPrm4+s8QsfnQEJJm2I6q9VrCTN+MGG ygvtT+hZgTk11LtZZmf+YWnvamcnR3agvAEYIVKnvoxR2vMv7owF5xMcGsxXQU+/3J JuYn7tBlQ8Av/ycigeZ9+6C+B46BiY1NsWlNMxV0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amit Kumar Mahapatra , Miquel Raynal Subject: [PATCH 5.18 0089/1095] mtd: rawnand: arasan: Update NAND bus clock instead of system clock Date: Mon, 15 Aug 2022 19:51:28 +0200 Message-Id: <20220815180433.195876501@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Amit Kumar Mahapatra commit 7499bfeedb47efc1ee4dc793b92c610d46e6d6a6 upstream. In current implementation the Arasan NAND driver is updating the system clock(i.e., anand->clk) in accordance to the timing modes (i.e., SDR or NVDDR). But as per the Arasan NAND controller spec the flash clock or the NAND bus clock(i.e., nfc->bus_clk), need to be updated instead. This patch keeps the system clock unchanged and updates the NAND bus clock as per the timing modes. Fixes: 197b88fecc50 ("mtd: rawnand: arasan: Add new Arasan NAND controller") CC: stable@vger.kernel.org # 5.8+ Signed-off-by: Amit Kumar Mahapatra Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220628154824.12222-2-amit.kumar-m= ahapatra@xilinx.com Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mtd/nand/raw/arasan-nand-controller.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/mtd/nand/raw/arasan-nand-controller.c +++ b/drivers/mtd/nand/raw/arasan-nand-controller.c @@ -347,17 +347,17 @@ static int anfc_select_target(struct nan =20 /* Update clock frequency */ if (nfc->cur_clk !=3D anand->clk) { - clk_disable_unprepare(nfc->controller_clk); - ret =3D clk_set_rate(nfc->controller_clk, anand->clk); + clk_disable_unprepare(nfc->bus_clk); + ret =3D clk_set_rate(nfc->bus_clk, anand->clk); if (ret) { dev_err(nfc->dev, "Failed to change clock rate\n"); return ret; } =20 - ret =3D clk_prepare_enable(nfc->controller_clk); + ret =3D clk_prepare_enable(nfc->bus_clk); if (ret) { dev_err(nfc->dev, - "Failed to re-enable the controller clock\n"); + "Failed to re-enable the bus clock\n"); return ret; } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7990C25B08 for ; Mon, 15 Aug 2022 20:16:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346479AbiHOUPz (ORCPT ); Mon, 15 Aug 2022 16:15:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346963AbiHOUMl (ORCPT ); Mon, 15 Aug 2022 16:12:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8244B89827; Mon, 15 Aug 2022 11:58:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E3C9DB810A1; Mon, 15 Aug 2022 18:58:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47208C43142; Mon, 15 Aug 2022 18:58:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589917; bh=36kaqV//Q65MyMm68X4c+Dpwi17dNDifBxO1QrGo2o8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D7kHjiszInBAchIMzJFdati7s7AnQ5L5TY1yGaFUj27YrgQ5HVpC6ScBa++UQa+sj vy1WhvdcB8iVKGkwIU9FO16Nv53NiRgDvVRl7fbqLDvhQboVe6rxC6AHOYHziTLFcF cwqLgMqWx2UdR4DZwSgbyKWb/qEVOKyYYly6qaAM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Beichler , Richard Weinberger Subject: [PATCH 5.18 0090/1095] um: Remove straying parenthesis Date: Mon, 15 Aug 2022 19:51:29 +0200 Message-Id: <20220815180433.237855478@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Benjamin Beichler commit c6496e0a4a90d8149203c16323cff3fa46e422e7 upstream. Commit e3a33af812c6 ("um: fix and optimize xor select template for CONFIG64= and timetravel mode") caused a build regression when CONFIG_XOR_BLOCKS and CONFIG_UML_TIME_TRAVEL= _SUPPORT are selected. Fix it by removing the straying parenthesis. Cc: stable@vger.kernel.org Fixes: e3a33af812c6 ("um: fix and optimize xor select template for CONFIG64= and timetravel mode") Signed-off-by: Benjamin Beichler [rw: Added commit message] Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/um/include/asm/xor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/um/include/asm/xor.h +++ b/arch/um/include/asm/xor.h @@ -18,7 +18,7 @@ #undef XOR_SELECT_TEMPLATE /* pick an arbitrary one - measuring isn't possible with inf-cpu */ #define XOR_SELECT_TEMPLATE(x) \ - (time_travel_mode =3D=3D TT_MODE_INFCPU ? TT_CPU_INF_XOR_DEFAULT : x)) + (time_travel_mode =3D=3D TT_MODE_INFCPU ? TT_CPU_INF_XOR_DEFAULT : x) #endif =20 #endif From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E16CDC00140 for ; Mon, 15 Aug 2022 20:17:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241913AbiHOURv (ORCPT ); Mon, 15 Aug 2022 16:17:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347013AbiHOUMq (ORCPT ); Mon, 15 Aug 2022 16:12:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14A2289934; Mon, 15 Aug 2022 11:58:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7AAAEB810A2; Mon, 15 Aug 2022 18:58:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3349C433D7; Mon, 15 Aug 2022 18:58:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589923; bh=qFEqlYR364zAMF8tGKZfx7jNJoYRaN3R5KeD+djXNmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PENRnJYZmvBDnx18ONxylWX75ngg04y8xxyg4dj/P8fETtMFR5Pj8RGUHRiyExz0S 9fpdRwt8jHJKsZDg5ZbVWdy/pI2VN2w550lfCgpXY0mfWb/QW+VqEjqLASIPdFHqrQ 9tvYc1UGn5q0bGN+1OmehnR9oUOf7hdstBm5CHNI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Anton Ivanov , "Jason A. Donenfeld" Subject: [PATCH 5.18 0091/1095] um: seed rng using host OS rng Date: Mon, 15 Aug 2022 19:51:30 +0200 Message-Id: <20220815180433.291146539@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld commit 0b9ba6135d7f18b82f3d8bebb55ded725ba88e0e upstream. UML generally does not provide access to special CPU instructions like RDRAND, and execution tends to be rather deterministic, with no real hardware interrupts, making good randomness really very hard, if not all together impossible. Not only is this a security eyebrow raiser, but it's also quite annoying when trying to do various pieces of UML-based automation that takes a long time to boot, if ever. Fix this by trivially calling getrandom() in the host and using that seed as "bootloader randomness", which initializes the rng immediately at UML boot. The old behavior can be restored the same way as on any other arch, by way of CONFIG_TRUST_BOOTLOADER_RANDOMNESS=3Dn or random.trust_bootloader=3D0. So seen from that perspective, this just makes UML act like other archs, which is positive in its own right. Additionally, wire up arch_get_random_{int,long}() in the same way, so that reseeds can also make use of the host RNG, controllable by CONFIG_TRUST_CPU_RANDOMNESS and random.trust_cpu, per usual. Cc: stable@vger.kernel.org Acked-by: Johannes Berg Acked-By: Anton Ivanov Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/um/include/asm/archrandom.h | 30 ++++++++++++++++++++++++++++++ arch/um/include/shared/os.h | 7 +++++++ arch/um/kernel/um_arch.c | 8 ++++++++ arch/um/os-Linux/util.c | 6 ++++++ 4 files changed, 51 insertions(+) create mode 100644 arch/um/include/asm/archrandom.h --- /dev/null +++ b/arch/um/include/asm/archrandom.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_UM_ARCHRANDOM_H__ +#define __ASM_UM_ARCHRANDOM_H__ + +#include + +/* This is from , but better not to #include that in a global header= here. */ +ssize_t os_getrandom(void *buf, size_t len, unsigned int flags); + +static inline bool __must_check arch_get_random_long(unsigned long *v) +{ + return os_getrandom(v, sizeof(*v), 0) =3D=3D sizeof(*v); +} + +static inline bool __must_check arch_get_random_int(unsigned int *v) +{ + return os_getrandom(v, sizeof(*v), 0) =3D=3D sizeof(*v); +} + +static inline bool __must_check arch_get_random_seed_long(unsigned long *v) +{ + return false; +} + +static inline bool __must_check arch_get_random_seed_int(unsigned int *v) +{ + return false; +} + +#endif --- a/arch/um/include/shared/os.h +++ b/arch/um/include/shared/os.h @@ -11,6 +11,12 @@ #include #include #include +/* This is to get size_t */ +#ifndef __UM_HOST__ +#include +#else +#include +#endif =20 #define CATCH_EINTR(expr) while ((errno =3D 0, ((expr) < 0)) && (errno =3D= =3D EINTR)) =20 @@ -243,6 +249,7 @@ extern void stack_protections(unsigned l extern int raw(int fd); extern void setup_machinename(char *machine_out); extern void setup_hostinfo(char *buf, int len); +extern ssize_t os_getrandom(void *buf, size_t len, unsigned int flags); extern void os_dump_core(void) __attribute__ ((noreturn)); extern void um_early_printk(const char *s, unsigned int n); extern void os_fix_helper_signals(void); --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -16,6 +16,7 @@ #include #include #include +#include =20 #include #include @@ -406,6 +407,8 @@ int __init __weak read_initrd(void) =20 void __init setup_arch(char **cmdline_p) { + u8 rng_seed[32]; + stack_protections((unsigned long) &init_thread_info); setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem); mem_total_pages(physmem_size, iomem_size, highmem); @@ -416,6 +419,11 @@ void __init setup_arch(char **cmdline_p) strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); *cmdline_p =3D command_line; setup_hostinfo(host_info, sizeof host_info); + + if (os_getrandom(rng_seed, sizeof(rng_seed), 0) =3D=3D sizeof(rng_seed)) { + add_bootloader_randomness(rng_seed, sizeof(rng_seed)); + memzero_explicit(rng_seed, sizeof(rng_seed)); + } } =20 void __init check_bugs(void) --- a/arch/um/os-Linux/util.c +++ b/arch/um/os-Linux/util.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include =20 @@ -96,6 +97,11 @@ static inline void __attribute__ ((noret exit(127); } =20 +ssize_t os_getrandom(void *buf, size_t len, unsigned int flags) +{ + return getrandom(buf, len, flags); +} + /* * UML helper threads must not handle SIGWINCH/INT/TERM */ From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DC89C00140 for ; Mon, 15 Aug 2022 20:19:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243450AbiHOUTj (ORCPT ); Mon, 15 Aug 2022 16:19:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347025AbiHOUMr (ORCPT ); Mon, 15 Aug 2022 16:12:47 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BFF289CF9; Mon, 15 Aug 2022 11:58:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id D3496CE129D; Mon, 15 Aug 2022 18:58:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCBB5C433D6; Mon, 15 Aug 2022 18:58:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589926; bh=/Uxe+l8gUs8wUOcFTLTxxqtvEkCdZRTt4cEZRSDrAr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZNhRrlm/FGMvlu6q1x775FKszWoxF7LcAAdXCnwLdCIuwQQL6LzNhpkP+YIyk0JJk fEwONfJPDZ2Gl7w2VIS5o25gSs41SNBEls7fR0cEbmNirv3FwGlL0Mq/lmejeJdryU s4a1yu3eE3q2ceJiHxeiaMHkd3aRBcSdrdNlTSvE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fawzi Khaber , Jean-Baptiste Maneyrol , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.18 0092/1095] iio: fix iio_format_avail_range() printing for none IIO_VAL_INT Date: Mon, 15 Aug 2022 19:51:31 +0200 Message-Id: <20220815180433.342708066@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fawzi Khaber commit 5e1f91850365de55ca74945866c002fda8f00331 upstream. iio_format_avail_range() should print range as follow [min, step, max], so the function was previously calling iio_format_list() with length =3D 3, length variable refers to the array size of values not the number of elements. In case of non IIO_VAL_INT values each element has integer part and decimal part. With length =3D 3 this would cause premature end of loop and result in printing only one element. Signed-off-by: Fawzi Khaber Signed-off-by: Jean-Baptiste Maneyrol Fixes: eda20ba1e25e ("iio: core: Consolidate iio_format_avail_{list,range}(= )") Link: https://lore.kernel.org/r/20220718130706.32571-1-jmaneyrol@invensense= .com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/industrialio-core.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -821,7 +821,23 @@ static ssize_t iio_format_avail_list(cha =20 static ssize_t iio_format_avail_range(char *buf, const int *vals, int type) { - return iio_format_list(buf, vals, type, 3, "[", "]"); + int length; + + /* + * length refers to the array size , not the number of elements. + * The purpose is to print the range [min , step ,max] so length should + * be 3 in case of int, and 6 for other types. + */ + switch (type) { + case IIO_VAL_INT: + length =3D 3; + break; + default: + length =3D 6; + break; + } + + return iio_format_list(buf, vals, type, length, "[", "]"); } =20 static ssize_t iio_read_channel_info_avail(struct device *dev, From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF6C7C3F6B0 for ; Mon, 15 Aug 2022 20:14:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240579AbiHOUOH (ORCPT ); Mon, 15 Aug 2022 16:14:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347039AbiHOUMs (ORCPT ); Mon, 15 Aug 2022 16:12:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE50E8A6DD; Mon, 15 Aug 2022 11:58:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 57934B8109E; Mon, 15 Aug 2022 18:58:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1272C433D7; Mon, 15 Aug 2022 18:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589929; bh=72iw2wQ65KIGB4P3ShPzgBQnjxHwzejp/XEhvwJNXXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a1XA/N6LgXn6nIa85f6a/k9Eztrr+RU0Tn4xxUv51wSgzk4NLdYa30J2CfJ1EA7DC 4BueSnOY6XVrZ6/WmkyiwogTBiu4zISeb5S0ANTElkwzIieS+39t5ALZmsXUu93m6p QPfu4EiQwZuRqv9q7VoS9HvBzK4i1k63KubHKSck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.18 0093/1095] iio: light: isl29028: Fix the warning in isl29028_remove() Date: Mon, 15 Aug 2022 19:51:32 +0200 Message-Id: <20220815180433.391445328@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheyu Ma commit 06674fc7c003b9d0aa1d37fef7ab2c24802cc6ad upstream. The driver use the non-managed form of the register function in isl29028_remove(). To keep the release order as mirroring the ordering in probe, the driver should use non-managed form in probe, too. The following log reveals it: [ 32.374955] isl29028 0-0010: remove [ 32.376861] general protection fault, probably for non-canonical address= 0xdffffc0000000006: 0000 [#1] PREEMPT SMP KASAN PTI [ 32.377676] KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000= 000000037] [ 32.379432] RIP: 0010:kernfs_find_and_get_ns+0x28/0xe0 [ 32.385461] Call Trace: [ 32.385807] sysfs_unmerge_group+0x59/0x110 [ 32.386110] dpm_sysfs_remove+0x58/0xc0 [ 32.386391] device_del+0x296/0xe50 [ 32.386959] cdev_device_del+0x1d/0xd0 [ 32.387231] devm_iio_device_unreg+0x27/0xb0 [ 32.387542] devres_release_group+0x319/0x3d0 [ 32.388162] i2c_device_remove+0x93/0x1f0 Fixes: 2db5054ac28d ("staging: iio: isl29028: add runtime power management = support") Signed-off-by: Zheyu Ma Link: https://lore.kernel.org/r/20220717004241.2281028-1-zheyuma97@gmail.com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/light/isl29028.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/iio/light/isl29028.c +++ b/drivers/iio/light/isl29028.c @@ -625,7 +625,7 @@ static int isl29028_probe(struct i2c_cli ISL29028_POWER_OFF_DELAY_MS); pm_runtime_use_autosuspend(&client->dev); =20 - ret =3D devm_iio_device_register(indio_dev->dev.parent, indio_dev); + ret =3D iio_device_register(indio_dev); if (ret < 0) { dev_err(&client->dev, "%s(): iio registration failed with error %d\n", From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC532C2BB45 for ; Mon, 15 Aug 2022 20:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347684AbiHOU0Z (ORCPT ); Mon, 15 Aug 2022 16:26:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346490AbiHOUUR (ORCPT ); Mon, 15 Aug 2022 16:20:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0396C979E8; Mon, 15 Aug 2022 12:00:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 40621B8105C; Mon, 15 Aug 2022 19:00:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98324C433C1; Mon, 15 Aug 2022 19:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590050; bh=lg2+YsXQQBrsQ6BLKQMFy06zfZHh2gbqSTZ/yvTb1h8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h3/CIWrBJiGGYCHnzeq9G3ivdPTXTr6ri1R4IENQMbmg55APL+zWWk+KLhew7IKFM +aS2DtqT6xdZCPMk7uMz57i6ncnjLp2BW3XkviF6noMsYXmVq8p/rZ9M+palZLKHRc gfkiKbda2C4GsBeEVkuQh+kyNoPP5hDEY5a2XQx4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" Subject: [PATCH 5.18 0094/1095] scsi: lpfc: Remove extra atomic_inc on cmd_pending in queuecommand after VMID Date: Mon, 15 Aug 2022 19:51:33 +0200 Message-Id: <20220815180433.431250368@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart commit 0948a9c5386095baae4012190a6b65aba684a907 upstream. VMID introduced an extra increment of cmd_pending, causing double-counting of the I/O. The normal increment ios performed in lpfc_get_scsi_buf. Link: https://lore.kernel.org/r/20220701211425.2708-5-jsmart2021@gmail.com Fixes: 33c79741deaf ("scsi: lpfc: vmid: Introduce VMID in I/O path") Cc: # v5.14+ Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/lpfc/lpfc_scsi.c | 1 - 1 file changed, 1 deletion(-) --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -5710,7 +5710,6 @@ lpfc_queuecommand(struct Scsi_Host *shos cur_iocbq->cmd_flag |=3D LPFC_IO_VMID; } } - atomic_inc(&ndlp->cmd_pending); =20 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS if (unlikely(phba->hdwqstat_on & LPFC_CHECK_SCSI_IO)) From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 259DCC25B08 for ; Mon, 15 Aug 2022 20:23:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346953AbiHOUXT (ORCPT ); Mon, 15 Aug 2022 16:23:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346168AbiHOUNW (ORCPT ); Mon, 15 Aug 2022 16:13:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E0C82CCB0; Mon, 15 Aug 2022 11:59:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4D601B8105C; Mon, 15 Aug 2022 18:59:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FEFCC433C1; Mon, 15 Aug 2022 18:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589953; bh=FCZJ64ZHrBJjqGiO5HLV86I4585tFnOWrrqpvlSA5CU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tnEGnSC2JecTIt5zubs8Q2CMJ9ansVSdFdHI90hbOszZhPvFECi+nm6RwN27E0+6o HNj9uC3pKgGAOHsAUi58/1sXyYguDJT8t+7VFF6uRdzxakhyNwiWVUxnYC+eRYNNmr ZgxFADbAx3GJm+HDnKScQui/mQB0g9T5x7uwTfsY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Gilbert , Tony Battersby , "Martin K. Petersen" Subject: [PATCH 5.18 0095/1095] scsi: sg: Allow waiting for commands to complete on removed device Date: Mon, 15 Aug 2022 19:51:34 +0200 Message-Id: <20220815180433.481409028@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tony Battersby commit 3455607fd7be10b449f5135c00dc306b85dc0d21 upstream. When a SCSI device is removed while in active use, currently sg will immediately return -ENODEV on any attempt to wait for active commands that were sent before the removal. This is problematic for commands that use SG_FLAG_DIRECT_IO since the data buffer may still be in use by the kernel when userspace frees or reuses it after getting ENODEV, leading to corrupted userspace memory (in the case of READ-type commands) or corrupted data being sent to the device (in the case of WRITE-type commands). This has been seen in practice when logging out of a iscsi_tcp session, where the iSCSI driver may still be processing commands after the device has been marked for removal. Change the policy to allow userspace to wait for active sg commands even when the device is being removed. Return -ENODEV only when there are no more responses to read. Link: https://lore.kernel.org/r/5ebea46f-fe83-2d0b-233d-d0dcb362dd0a@cybern= etics.com Cc: Acked-by: Douglas Gilbert Signed-off-by: Tony Battersby Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/sg.c | 53 +++++++++++++++++++++++++++++++++----------------= ---- 1 file changed, 33 insertions(+), 20 deletions(-) --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -195,7 +195,7 @@ static void sg_link_reserve(Sg_fd * sfp, static void sg_unlink_reserve(Sg_fd * sfp, Sg_request * srp); static Sg_fd *sg_add_sfp(Sg_device * sdp); static void sg_remove_sfp(struct kref *); -static Sg_request *sg_get_rq_mark(Sg_fd * sfp, int pack_id); +static Sg_request *sg_get_rq_mark(Sg_fd * sfp, int pack_id, bool *busy); static Sg_request *sg_add_request(Sg_fd * sfp); static int sg_remove_request(Sg_fd * sfp, Sg_request * srp); static Sg_device *sg_get_dev(int dev); @@ -444,6 +444,7 @@ sg_read(struct file *filp, char __user * Sg_fd *sfp; Sg_request *srp; int req_pack_id =3D -1; + bool busy; sg_io_hdr_t *hp; struct sg_header *old_hdr; int retval; @@ -466,20 +467,16 @@ sg_read(struct file *filp, char __user * if (retval) return retval; =20 - srp =3D sg_get_rq_mark(sfp, req_pack_id); + srp =3D sg_get_rq_mark(sfp, req_pack_id, &busy); if (!srp) { /* now wait on packet to arrive */ - if (atomic_read(&sdp->detaching)) - return -ENODEV; if (filp->f_flags & O_NONBLOCK) return -EAGAIN; retval =3D wait_event_interruptible(sfp->read_wait, - (atomic_read(&sdp->detaching) || - (srp =3D sg_get_rq_mark(sfp, req_pack_id)))); - if (atomic_read(&sdp->detaching)) - return -ENODEV; - if (retval) - /* -ERESTARTSYS as signal hit process */ - return retval; + ((srp =3D sg_get_rq_mark(sfp, req_pack_id, &busy)) || + (!busy && atomic_read(&sdp->detaching)))); + if (!srp) + /* signal or detaching */ + return retval ? retval : -ENODEV; } if (srp->header.interface_id !=3D '\0') return sg_new_read(sfp, buf, count, srp); @@ -939,9 +936,7 @@ sg_ioctl_common(struct file *filp, Sg_de if (result < 0) return result; result =3D wait_event_interruptible(sfp->read_wait, - (srp_done(sfp, srp) || atomic_read(&sdp->detaching))); - if (atomic_read(&sdp->detaching)) - return -ENODEV; + srp_done(sfp, srp)); write_lock_irq(&sfp->rq_list_lock); if (srp->done) { srp->done =3D 2; @@ -2078,19 +2073,28 @@ sg_unlink_reserve(Sg_fd * sfp, Sg_reques } =20 static Sg_request * -sg_get_rq_mark(Sg_fd * sfp, int pack_id) +sg_get_rq_mark(Sg_fd * sfp, int pack_id, bool *busy) { Sg_request *resp; unsigned long iflags; =20 + *busy =3D false; write_lock_irqsave(&sfp->rq_list_lock, iflags); list_for_each_entry(resp, &sfp->rq_list, entry) { - /* look for requests that are ready + not SG_IO owned */ - if ((1 =3D=3D resp->done) && (!resp->sg_io_owned) && + /* look for requests that are not SG_IO owned */ + if ((!resp->sg_io_owned) && ((-1 =3D=3D pack_id) || (resp->header.pack_id =3D=3D pack_id))) { - resp->done =3D 2; /* guard against other readers */ - write_unlock_irqrestore(&sfp->rq_list_lock, iflags); - return resp; + switch (resp->done) { + case 0: /* request active */ + *busy =3D true; + break; + case 1: /* request done; response ready to return */ + resp->done =3D 2; /* guard against other readers */ + write_unlock_irqrestore(&sfp->rq_list_lock, iflags); + return resp; + case 2: /* response already being returned */ + break; + } } } write_unlock_irqrestore(&sfp->rq_list_lock, iflags); @@ -2144,6 +2148,15 @@ sg_remove_request(Sg_fd * sfp, Sg_reques res =3D 1; } write_unlock_irqrestore(&sfp->rq_list_lock, iflags); + + /* + * If the device is detaching, wakeup any readers in case we just + * removed the last response, which would leave nothing for them to + * return other than -ENODEV. + */ + if (unlikely(atomic_read(&sfp->parentdp->detaching))) + wake_up_interruptible_all(&sfp->read_wait); + return res; } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EEFAC00140 for ; Mon, 15 Aug 2022 20:24:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344016AbiHOUYZ (ORCPT ); Mon, 15 Aug 2022 16:24:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346717AbiHOUQV (ORCPT ); Mon, 15 Aug 2022 16:16:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 064CF33377; Mon, 15 Aug 2022 11:59:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6E4DA61230; Mon, 15 Aug 2022 18:59:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B6FAC433D6; Mon, 15 Aug 2022 18:59:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589985; bh=yipSsG5HGqLWCzVO8/t+Fk5ZL9AUOX5sgnOuLHAIuGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LaeUnb6OOTC8/hpSXbSntZRIQ3UzrUaXGEoNVb2WnI+FG/D++gZzxtjv9Py2COpbC HbnmcBY/NJbxVCmDG0DDhDIVWOrX4/qVvPXY3L3C0mj1K40dhXRpLfttLhaMP4HJL2 gP6Ru1EOY9ghTAMfEER5vSSAGciSt+KN1fw0WlME= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Bikash Hazarika , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.18 0096/1095] scsi: qla2xxx: Fix incorrect display of max frame size Date: Mon, 15 Aug 2022 19:51:35 +0200 Message-Id: <20220815180433.522636453@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bikash Hazarika commit cf3b4fb655796674e605268bd4bfb47a47c8bce6 upstream. Replace display field with the correct field. Link: https://lore.kernel.org/r/20220713052045.10683-3-njavali@marvell.com Fixes: 8777e4314d39 ("scsi: qla2xxx: Migrate NVME N2N handling into state m= achine") Cc: stable@vger.kernel.org Reviewed-by: Himanshu Madhani Signed-off-by: Bikash Hazarika Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_def.h | 1 + drivers/scsi/qla2xxx/qla_gs.c | 9 +++------ drivers/scsi/qla2xxx/qla_init.c | 2 ++ drivers/scsi/qla2xxx/qla_isr.c | 4 +--- 4 files changed, 7 insertions(+), 9 deletions(-) --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3975,6 +3975,7 @@ struct qla_hw_data { /* SRB cache. */ #define SRB_MIN_REQ 128 mempool_t *srb_mempool; + u8 port_name[WWN_SIZE]; =20 volatile struct { uint32_t mbox_int :1; --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -1596,7 +1596,6 @@ qla2x00_hba_attributes(scsi_qla_host_t * unsigned int callopt) { struct qla_hw_data *ha =3D vha->hw; - struct init_cb_24xx *icb24 =3D (void *)ha->init_cb; struct new_utsname *p_sysid =3D utsname(); struct ct_fdmi_hba_attr *eiter; uint16_t alen; @@ -1758,8 +1757,8 @@ qla2x00_hba_attributes(scsi_qla_host_t * /* MAX CT Payload Length */ eiter =3D entries + size; eiter->type =3D cpu_to_be16(FDMI_HBA_MAXIMUM_CT_PAYLOAD_LENGTH); - eiter->a.max_ct_len =3D cpu_to_be32(le16_to_cpu(IS_FWI2_CAPABLE(ha) ? - icb24->frame_payload_size : ha->init_cb->frame_payload_size)); + eiter->a.max_ct_len =3D cpu_to_be32(ha->frame_payload_size >> 2); + alen =3D sizeof(eiter->a.max_ct_len); alen +=3D FDMI_ATTR_TYPELEN(eiter); eiter->len =3D cpu_to_be16(alen); @@ -1851,7 +1850,6 @@ qla2x00_port_attributes(scsi_qla_host_t unsigned int callopt) { struct qla_hw_data *ha =3D vha->hw; - struct init_cb_24xx *icb24 =3D (void *)ha->init_cb; struct new_utsname *p_sysid =3D utsname(); char *hostname =3D p_sysid ? p_sysid->nodename : fc_host_system_hostname(vha->host); @@ -1903,8 +1901,7 @@ qla2x00_port_attributes(scsi_qla_host_t /* Max frame size. */ eiter =3D entries + size; eiter->type =3D cpu_to_be16(FDMI_PORT_MAX_FRAME_SIZE); - eiter->a.max_frame_size =3D cpu_to_be32(le16_to_cpu(IS_FWI2_CAPABLE(ha) ? - icb24->frame_payload_size : ha->init_cb->frame_payload_size)); + eiter->a.max_frame_size =3D cpu_to_be32(ha->frame_payload_size); alen =3D sizeof(eiter->a.max_frame_size); alen +=3D FDMI_ATTR_TYPELEN(eiter); eiter->len =3D cpu_to_be16(alen); --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -4509,6 +4509,8 @@ qla2x00_init_rings(scsi_qla_host_t *vha) BIT_6) !=3D 0; ql_dbg(ql_dbg_init, vha, 0x00bc, "FA-WWPN Support: %s.\n", (ha->flags.fawwpn_enabled) ? "enabled" : "disabled"); + /* Init_cb will be reused for other command(s). Save a backup copy of p= ort_name */ + memcpy(ha->port_name, ha->init_cb->port_name, WWN_SIZE); } =20 /* ELS pass through payload is limit by frame size. */ --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -1354,9 +1354,7 @@ skip_rio: if (!vha->vp_idx) { if (ha->flags.fawwpn_enabled && (ha->current_topology =3D=3D ISP_CFG_F)) { - void *wwpn =3D ha->init_cb->port_name; - - memcpy(vha->port_name, wwpn, WWN_SIZE); + memcpy(vha->port_name, ha->port_name, WWN_SIZE); fc_host_port_name(vha->host) =3D wwn_to_u64(vha->port_name); ql_dbg(ql_dbg_init + ql_dbg_verbose, From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C458BC25B0E for ; Mon, 15 Aug 2022 20:25:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347416AbiHOUZ1 (ORCPT ); Mon, 15 Aug 2022 16:25:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241843AbiHOURH (ORCPT ); Mon, 15 Aug 2022 16:17:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 807E3C6B; Mon, 15 Aug 2022 12:00:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 277B7611D6; Mon, 15 Aug 2022 19:00:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29782C433B5; Mon, 15 Aug 2022 19:00:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590019; bh=zEedom811/5se5b7aljK1JSNDPwuR5xYRPX2z+nxSlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mxfC9WbYIpEwvB5LwhTpqJz8qo2qv61rJ+ZOMQmzPnn5+rVNby4Ui52L0IPJ1qt2y AcpaKat80pRWOUTRnrUmErTsyws2eAInOW8WSOrKAYFHphxQ6/m6O243/whRB2HW/h 9ZW2ECj2ME+w8p2GhC95bdQYucAnLJXaVCwH1VSU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Bikash Hazarika , Quinn Tran , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.18 0097/1095] scsi: qla2xxx: Zero undefined mailbox IN registers Date: Mon, 15 Aug 2022 19:51:36 +0200 Message-Id: <20220815180433.564851189@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bikash Hazarika commit 6c96a3c7d49593ef15805f5e497601c87695abc9 upstream. While requesting a new mailbox command, driver does not write any data to unused registers. Initialize the unused register value to zero while requesting a new mailbox command to prevent stale entry access by firmware. Link: https://lore.kernel.org/r/20220713052045.10683-4-njavali@marvell.com Cc: stable@vger.kernel.org Reviewed-by: Himanshu Madhani Signed-off-by: Bikash Hazarika Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_mbx.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -238,6 +238,8 @@ qla2x00_mailbox_command(scsi_qla_host_t ql_dbg(ql_dbg_mbx, vha, 0x1112, "mbox[%d]<-0x%04x\n", cnt, *iptr); wrt_reg_word(optr, *iptr); + } else { + wrt_reg_word(optr, 0); } =20 mboxes >>=3D 1; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A4C4C3F6B0 for ; Mon, 15 Aug 2022 20:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347492AbiHOUZw (ORCPT ); Mon, 15 Aug 2022 16:25:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243999AbiHOUSo (ORCPT ); Mon, 15 Aug 2022 16:18:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7DE145F43; Mon, 15 Aug 2022 12:00:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E5B56B810C5; Mon, 15 Aug 2022 19:00:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A3E9C433D6; Mon, 15 Aug 2022 19:00:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590031; bh=CBb0Nq4prmkpogVj+AXr6e4xJHBujYPfz49hr0sMgxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fQweulclZqzj9c9h3EUo78X+qrr6vsFVAxhMY1ERm/lp3+XC0RlfszWzS8b6vK4Oi PUOVNLZcs1u2y7ieqNiYdujJqPjGK25oqZk8tw4H83jGxtL6BT8iZXtBWumVLQWmlc 3mpC7S9HKWPv51sSgxCxi4wuIWDIDJ6Od9gUmDG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Vinod Koul Subject: [PATCH 5.18 0098/1095] soundwire: qcom: Check device status before reading devid Date: Mon, 15 Aug 2022 19:51:37 +0200 Message-Id: <20220815180433.612111006@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Srinivas Kandagatla commit aa1262ca66957183ea1fb32a067e145b995f3744 upstream. As per hardware datasheet its recommended that we check the device status before reading devid assigned by auto-enumeration. Without this patch we see SoundWire devices with invalid enumeration addresses on the bus. Cc: stable@vger.kernel.org Fixes: a6e6581942ca ("soundwire: qcom: add auto enumeration support") Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220706095644.5852-1-srinivas.kandagatla@l= inaro.org Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/soundwire/qcom.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -471,6 +471,10 @@ static int qcom_swrm_enumerate(struct sd char *buf1 =3D (char *)&val1, *buf2 =3D (char *)&val2; =20 for (i =3D 1; i <=3D SDW_MAX_DEVICES; i++) { + /* do not continue if the status is Not Present */ + if (!ctrl->status[i]) + continue; + /*SCP_Devid5 - Devid 4*/ ctrl->reg_read(ctrl, SWRM_ENUMERATOR_SLAVE_DEV_ID_1(i), &val1); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C0C1C28B2B for ; Mon, 15 Aug 2022 20:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347571AbiHOU0C (ORCPT ); Mon, 15 Aug 2022 16:26:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245711AbiHOUTI (ORCPT ); Mon, 15 Aug 2022 16:19:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1298679ECA; Mon, 15 Aug 2022 12:00:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EB332B8105C; Mon, 15 Aug 2022 19:00:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30F9CC433D6; Mon, 15 Aug 2022 19:00:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590034; bh=YaFyEq5TNnM0erthFu+YMa+BtPUKxaeMZE5sVwUj5uM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AFWDe0AN35OYAJ4gawyCvW7ZSW+XkdNbcZfe2n+4nRrKwRGTiYb2doTrAbO0qwr5M kE7PB452JkO/2vnaORIDeAGxQc4jfSgjn9ufW+BfjtAdkQEOl9r6M0q5DxmS+T/FyK GXRyzjD/T0WEvTP/j6FxlHW50SMyYsZd5dfQyZJA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Hyunchul Lee , Steve French , zdi-disclosures@trendmicro.com Subject: [PATCH 5.18 0099/1095] ksmbd: fix memory leak in smb2_handle_negotiate Date: Mon, 15 Aug 2022 19:51:38 +0200 Message-Id: <20220815180433.649914395@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namjae Jeon commit aa7253c2393f6dcd6a1468b0792f6da76edad917 upstream. The allocated memory didn't free under an error path in smb2_handle_negotiate(). Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-17815 Signed-off-by: Namjae Jeon Reviewed-by: Hyunchul Lee Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ksmbd/smb2pdu.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -1139,12 +1139,16 @@ int smb2_handle_negotiate(struct ksmbd_w status); rsp->hdr.Status =3D status; rc =3D -EINVAL; + kfree(conn->preauth_info); + conn->preauth_info =3D NULL; goto err_out; } =20 rc =3D init_smb3_11_server(conn); if (rc < 0) { rsp->hdr.Status =3D STATUS_INVALID_PARAMETER; + kfree(conn->preauth_info); + conn->preauth_info =3D NULL; goto err_out; } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFEF9C2BB43 for ; Mon, 15 Aug 2022 20:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347618AbiHOU0R (ORCPT ); Mon, 15 Aug 2022 16:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343928AbiHOUTY (ORCPT ); Mon, 15 Aug 2022 16:19:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD85780516; Mon, 15 Aug 2022 12:00:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F022EB81106; Mon, 15 Aug 2022 19:00:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EE71C433D6; Mon, 15 Aug 2022 19:00:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590037; bh=bqOWLUEtmJFZwXCw3UqJncyrYlm7mOE2OSE/xVhMHtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NqZaVyJzBqvjBFJeKFM9jOemJHD9cqZkrfvG1G+V0SonLdB/SRBTgApPrtcacAiSA w29w/h9eIVZIhdCYaOS6RIIxuZjdMiScUb+77qoghAW3TvodKnpmFbmdQ+szWob+a3 O5Gm0yzZNj+fE32rq7jSI+Ref9VfE4jICt2I1utQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunchul Lee , Namjae Jeon , Steve French , zdi-disclosures@trendmicro.com Subject: [PATCH 5.18 0100/1095] ksmbd: prevent out of bound read for SMB2_TREE_CONNNECT Date: Mon, 15 Aug 2022 19:51:39 +0200 Message-Id: <20220815180433.689786833@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hyunchul Lee commit 824d4f64c20093275f72fc8101394d75ff6a249e upstream. if Status is not 0 and PathLength is long, smb_strndup_from_utf16 could make out of bound read in smb2_tree_connnect. This bug can lead an oops looking something like: [ 1553.882047] BUG: KASAN: slab-out-of-bounds in smb_strndup_from_utf16+0x4= 69/0x4c0 [ksmbd] [ 1553.882064] Read of size 2 at addr ffff88802c4eda04 by task kworker/0:2/= 42805 ... [ 1553.882095] Call Trace: [ 1553.882098] [ 1553.882101] dump_stack_lvl+0x49/0x5f [ 1553.882107] print_report.cold+0x5e/0x5cf [ 1553.882112] ? smb_strndup_from_utf16+0x469/0x4c0 [ksmbd] [ 1553.882122] kasan_report+0xaa/0x120 [ 1553.882128] ? smb_strndup_from_utf16+0x469/0x4c0 [ksmbd] [ 1553.882139] __asan_report_load_n_noabort+0xf/0x20 [ 1553.882143] smb_strndup_from_utf16+0x469/0x4c0 [ksmbd] [ 1553.882155] ? smb_strtoUTF16+0x3b0/0x3b0 [ksmbd] [ 1553.882166] ? __kmalloc_node+0x185/0x430 [ 1553.882171] smb2_tree_connect+0x140/0xab0 [ksmbd] [ 1553.882185] handle_ksmbd_work+0x30e/0x1020 [ksmbd] [ 1553.882197] process_one_work+0x778/0x11c0 [ 1553.882201] ? _raw_spin_lock_irq+0x8e/0xe0 [ 1553.882206] worker_thread+0x544/0x1180 [ 1553.882209] ? __cpuidle_text_end+0x4/0x4 [ 1553.882214] kthread+0x282/0x320 [ 1553.882218] ? process_one_work+0x11c0/0x11c0 [ 1553.882221] ? kthread_complete_and_exit+0x30/0x30 [ 1553.882225] ret_from_fork+0x1f/0x30 [ 1553.882231] There is no need to check error request validation in server. This check allow invalid requests not to validate message. Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-17818 Signed-off-by: Hyunchul Lee Acked-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ksmbd/smb2misc.c | 5 ----- 1 file changed, 5 deletions(-) --- a/fs/ksmbd/smb2misc.c +++ b/fs/ksmbd/smb2misc.c @@ -90,11 +90,6 @@ static int smb2_get_data_area_len(unsign *off =3D 0; *len =3D 0; =20 - /* error reqeusts do not have data area */ - if (hdr->Status && hdr->Status !=3D STATUS_MORE_PROCESSING_REQUIRED && - (((struct smb2_err_rsp *)hdr)->StructureSize) =3D=3D SMB2_ERROR_STRUC= TURE_SIZE2_LE) - return ret; - /* * Following commands have data areas so we have to get the location * of the data buffer offset and data buffer length for the particular From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B39AC2BB41 for ; Mon, 15 Aug 2022 20:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347599AbiHOU0I (ORCPT ); Mon, 15 Aug 2022 16:26:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbiHOUTT (ORCPT ); Mon, 15 Aug 2022 16:19:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70E5D96768; Mon, 15 Aug 2022 12:00:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BCD8AB810A3; Mon, 15 Aug 2022 19:00:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0ABF6C433C1; Mon, 15 Aug 2022 19:00:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590040; bh=pEg1GtkK46egxGc6yKcxjHl9FylMjMsYz88rOu1nqA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H4Qnn4t0w4Qs1GyGD+AScyi2sduMHAqzKRmqZan8lZkvrEYYBliVO04CPt1jgWWGv 6SriNycXruxSoDFsw8WOx0DwjrlQAbTKKLM+6N3F5XXS/wgKdmseOHCMw3TnHoi2ww tm1kGXyLI8BGbvQIpt0gIt1lLjUrAfX5HEq95YEs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Hyunchul Lee , Steve French , zdi-disclosures@trendmicro.com Subject: [PATCH 5.18 0101/1095] ksmbd: fix use-after-free bug in smb2_tree_disconect Date: Mon, 15 Aug 2022 19:51:40 +0200 Message-Id: <20220815180433.723496121@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namjae Jeon commit cf6531d98190fa2cf92a6d8bbc8af0a4740a223c upstream. smb2_tree_disconnect() freed the struct ksmbd_tree_connect, but it left the dangling pointer. It can be accessed again under compound requests. This bug can lead an oops looking something link: [ 1685.468014 ] BUG: KASAN: use-after-free in ksmbd_tree_conn_disconnect+0x= 131/0x160 [ksmbd] [ 1685.468068 ] Read of size 4 at addr ffff888102172180 by task kworker/1:2= /4807 ... [ 1685.468130 ] Call Trace: [ 1685.468132 ] [ 1685.468135 ] dump_stack_lvl+0x49/0x5f [ 1685.468141 ] print_report.cold+0x5e/0x5cf [ 1685.468145 ] ? ksmbd_tree_conn_disconnect+0x131/0x160 [ksmbd] [ 1685.468157 ] kasan_report+0xaa/0x120 [ 1685.468194 ] ? ksmbd_tree_conn_disconnect+0x131/0x160 [ksmbd] [ 1685.468206 ] __asan_report_load4_noabort+0x14/0x20 [ 1685.468210 ] ksmbd_tree_conn_disconnect+0x131/0x160 [ksmbd] [ 1685.468222 ] smb2_tree_disconnect+0x175/0x250 [ksmbd] [ 1685.468235 ] handle_ksmbd_work+0x30e/0x1020 [ksmbd] [ 1685.468247 ] process_one_work+0x778/0x11c0 [ 1685.468251 ] ? _raw_spin_lock_irq+0x8e/0xe0 [ 1685.468289 ] worker_thread+0x544/0x1180 [ 1685.468293 ] ? __cpuidle_text_end+0x4/0x4 [ 1685.468297 ] kthread+0x282/0x320 [ 1685.468301 ] ? process_one_work+0x11c0/0x11c0 [ 1685.468305 ] ? kthread_complete_and_exit+0x30/0x30 [ 1685.468309 ] ret_from_fork+0x1f/0x30 Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-17816 Signed-off-by: Namjae Jeon Reviewed-by: Hyunchul Lee Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ksmbd/smb2pdu.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -2043,6 +2043,7 @@ int smb2_tree_disconnect(struct ksmbd_wo =20 ksmbd_close_tree_conn_fds(work); ksmbd_tree_conn_disconnect(sess, tcon); + work->tcon =3D NULL; return 0; } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6048C00140 for ; Mon, 15 Aug 2022 20:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347652AbiHOU0V (ORCPT ); Mon, 15 Aug 2022 16:26:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243358AbiHOUTg (ORCPT ); Mon, 15 Aug 2022 16:19:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30E7333407; Mon, 15 Aug 2022 12:00:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B15B6611D6; Mon, 15 Aug 2022 19:00:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57DC8C433D7; Mon, 15 Aug 2022 19:00:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590044; bh=l2IDL2KBGrj3x8xzq2I3IgJkpJLaKvGueU3MOoGhKWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ia1ydcffO4+bbEG8iFP4Y2u51Fi3NbfEwLfL4hA1JKTR9P6Hoq1xH+Kh7IeS3Qk34 Kbw6lBfyA31MWAsH25yTvmPiLBFac13ltmtm6xB5cf4bFOb24ull6iso2btsZ5JmgL gxXVM3NKNDYVPsY60EmJF2/kX++D07wU5IcscQgs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunchul Lee , Namjae Jeon , Steve French , zdi-disclosures@trendmicro.com Subject: [PATCH 5.18 0102/1095] ksmbd: fix heap-based overflow in set_ntacl_dacl() Date: Mon, 15 Aug 2022 19:51:41 +0200 Message-Id: <20220815180433.764223362@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namjae Jeon commit 8f0541186e9ad1b62accc9519cc2b7a7240272a7 upstream. The testcase use SMB2_SET_INFO_HE command to set a malformed file attribute under the label `security.NTACL`. SMB2_QUERY_INFO_HE command in testcase trigger the following overflow. [ 4712.003781] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ 4712.003790] BUG: KASAN: slab-out-of-bounds in build_sec_desc+0x842/0x1dd= 0 [ksmbd] [ 4712.003807] Write of size 1060 at addr ffff88801e34c068 by task kworker/= 0:0/4190 [ 4712.003813] CPU: 0 PID: 4190 Comm: kworker/0:0 Not tainted 5.19.0-rc5 #1 [ 4712.003850] Workqueue: ksmbd-io handle_ksmbd_work [ksmbd] [ 4712.003867] Call Trace: [ 4712.003870] [ 4712.003873] dump_stack_lvl+0x49/0x5f [ 4712.003935] print_report.cold+0x5e/0x5cf [ 4712.003972] ? ksmbd_vfs_get_sd_xattr+0x16d/0x500 [ksmbd] [ 4712.003984] ? cmp_map_id+0x200/0x200 [ 4712.003988] ? build_sec_desc+0x842/0x1dd0 [ksmbd] [ 4712.004000] kasan_report+0xaa/0x120 [ 4712.004045] ? build_sec_desc+0x842/0x1dd0 [ksmbd] [ 4712.004056] kasan_check_range+0x100/0x1e0 [ 4712.004060] memcpy+0x3c/0x60 [ 4712.004064] build_sec_desc+0x842/0x1dd0 [ksmbd] [ 4712.004076] ? parse_sec_desc+0x580/0x580 [ksmbd] [ 4712.004088] ? ksmbd_acls_fattr+0x281/0x410 [ksmbd] [ 4712.004099] smb2_query_info+0xa8f/0x6110 [ksmbd] [ 4712.004111] ? psi_group_change+0x856/0xd70 [ 4712.004148] ? update_load_avg+0x1c3/0x1af0 [ 4712.004152] ? asym_cpu_capacity_scan+0x5d0/0x5d0 [ 4712.004157] ? xas_load+0x23/0x300 [ 4712.004162] ? smb2_query_dir+0x1530/0x1530 [ksmbd] [ 4712.004173] ? _raw_spin_lock_bh+0xe0/0xe0 [ 4712.004179] handle_ksmbd_work+0x30e/0x1020 [ksmbd] [ 4712.004192] process_one_work+0x778/0x11c0 [ 4712.004227] ? _raw_spin_lock_irq+0x8e/0xe0 [ 4712.004231] worker_thread+0x544/0x1180 [ 4712.004234] ? __cpuidle_text_end+0x4/0x4 [ 4712.004239] kthread+0x282/0x320 [ 4712.004243] ? process_one_work+0x11c0/0x11c0 [ 4712.004246] ? kthread_complete_and_exit+0x30/0x30 [ 4712.004282] ret_from_fork+0x1f/0x30 This patch add the buffer validation for security descriptor that is stored by malformed SMB2_SET_INFO_HE command. and allocate large response buffer about SMB2_O_INFO_SECURITY file info class. Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-17771 Reviewed-by: Hyunchul Lee Signed-off-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ksmbd/smb2pdu.c | 39 ++++++++++----- fs/ksmbd/smbacl.c | 130 +++++++++++++++++++++++++++++++++++-------------= ----- fs/ksmbd/smbacl.h | 2=20 fs/ksmbd/vfs.c | 5 ++ 4 files changed, 119 insertions(+), 57 deletions(-) --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -535,9 +535,10 @@ int smb2_allocate_rsp_buf(struct ksmbd_w struct smb2_query_info_req *req; =20 req =3D smb2_get_msg(work->request_buf); - if (req->InfoType =3D=3D SMB2_O_INFO_FILE && - (req->FileInfoClass =3D=3D FILE_FULL_EA_INFORMATION || - req->FileInfoClass =3D=3D FILE_ALL_INFORMATION)) + if ((req->InfoType =3D=3D SMB2_O_INFO_FILE && + (req->FileInfoClass =3D=3D FILE_FULL_EA_INFORMATION || + req->FileInfoClass =3D=3D FILE_ALL_INFORMATION)) || + req->InfoType =3D=3D SMB2_O_INFO_SECURITY) sz =3D large_sz; } =20 @@ -2974,7 +2975,7 @@ int smb2_open(struct ksmbd_work *work) goto err_out; =20 rc =3D build_sec_desc(user_ns, - pntsd, NULL, + pntsd, NULL, 0, OWNER_SECINFO | GROUP_SECINFO | DACL_SECINFO, @@ -3819,6 +3820,15 @@ static int verify_info_level(int info_le return 0; } =20 +static int smb2_resp_buf_len(struct ksmbd_work *work, unsigned short hdr2_= len) +{ + int free_len; + + free_len =3D (int)(work->response_sz - + (get_rfc1002_len(work->response_buf) + 4)) - hdr2_len; + return free_len; +} + static int smb2_calc_max_out_buf_len(struct ksmbd_work *work, unsigned short hdr2_len, unsigned int out_buf_len) @@ -3828,9 +3838,7 @@ static int smb2_calc_max_out_buf_len(str if (out_buf_len > work->conn->vals->max_trans_size) return -EINVAL; =20 - free_len =3D (int)(work->response_sz - - (get_rfc1002_len(work->response_buf) + 4)) - - hdr2_len; + free_len =3D smb2_resp_buf_len(work, hdr2_len); if (free_len < 0) return -EINVAL; =20 @@ -5085,10 +5093,10 @@ static int smb2_get_info_sec(struct ksmb struct smb_ntsd *pntsd =3D (struct smb_ntsd *)rsp->Buffer, *ppntsd =3D NU= LL; struct smb_fattr fattr =3D {{0}}; struct inode *inode; - __u32 secdesclen; + __u32 secdesclen =3D 0; unsigned int id =3D KSMBD_NO_FID, pid =3D KSMBD_NO_FID; int addition_info =3D le32_to_cpu(req->AdditionalInformation); - int rc; + int rc =3D 0, ppntsd_size =3D 0; =20 if (addition_info & ~(OWNER_SECINFO | GROUP_SECINFO | DACL_SECINFO | PROTECTED_DACL_SECINFO | @@ -5134,11 +5142,14 @@ static int smb2_get_info_sec(struct ksmb =20 if (test_share_config_flag(work->tcon->share_conf, KSMBD_SHARE_FLAG_ACL_XATTR)) - ksmbd_vfs_get_sd_xattr(work->conn, user_ns, - fp->filp->f_path.dentry, &ppntsd); - - rc =3D build_sec_desc(user_ns, pntsd, ppntsd, addition_info, - &secdesclen, &fattr); + ppntsd_size =3D ksmbd_vfs_get_sd_xattr(work->conn, user_ns, + fp->filp->f_path.dentry, + &ppntsd); + + /* Check if sd buffer size exceeds response buffer size */ + if (smb2_resp_buf_len(work, 8) > ppntsd_size) + rc =3D build_sec_desc(user_ns, pntsd, ppntsd, ppntsd_size, + addition_info, &secdesclen, &fattr); posix_acl_release(fattr.cf_acls); posix_acl_release(fattr.cf_dacls); kfree(ppntsd); --- a/fs/ksmbd/smbacl.c +++ b/fs/ksmbd/smbacl.c @@ -690,6 +690,7 @@ posix_default_acl: static void set_ntacl_dacl(struct user_namespace *user_ns, struct smb_acl *pndacl, struct smb_acl *nt_dacl, + unsigned int aces_size, const struct smb_sid *pownersid, const struct smb_sid *pgrpsid, struct smb_fattr *fattr) @@ -703,9 +704,19 @@ static void set_ntacl_dacl(struct user_n if (nt_num_aces) { ntace =3D (struct smb_ace *)((char *)nt_dacl + sizeof(struct smb_acl)); for (i =3D 0; i < nt_num_aces; i++) { - memcpy((char *)pndace + size, ntace, le16_to_cpu(ntace->size)); - size +=3D le16_to_cpu(ntace->size); - ntace =3D (struct smb_ace *)((char *)ntace + le16_to_cpu(ntace->size)); + unsigned short nt_ace_size; + + if (offsetof(struct smb_ace, access_req) > aces_size) + break; + + nt_ace_size =3D le16_to_cpu(ntace->size); + if (nt_ace_size > aces_size) + break; + + memcpy((char *)pndace + size, ntace, nt_ace_size); + size +=3D nt_ace_size; + aces_size -=3D nt_ace_size; + ntace =3D (struct smb_ace *)((char *)ntace + nt_ace_size); num_aces++; } } @@ -878,7 +889,7 @@ int parse_sec_desc(struct user_namespace /* Convert permission bits from mode to equivalent CIFS ACL */ int build_sec_desc(struct user_namespace *user_ns, struct smb_ntsd *pntsd, struct smb_ntsd *ppntsd, - int addition_info, __u32 *secdesclen, + int ppntsd_size, int addition_info, __u32 *secdesclen, struct smb_fattr *fattr) { int rc =3D 0; @@ -938,15 +949,25 @@ int build_sec_desc(struct user_namespace =20 if (!ppntsd) { set_mode_dacl(user_ns, dacl_ptr, fattr); - } else if (!ppntsd->dacloffset) { - goto out; } else { struct smb_acl *ppdacl_ptr; + unsigned int dacl_offset =3D le32_to_cpu(ppntsd->dacloffset); + int ppdacl_size, ntacl_size =3D ppntsd_size - dacl_offset; + + if (!dacl_offset || + (dacl_offset + sizeof(struct smb_acl) > ppntsd_size)) + goto out; + + ppdacl_ptr =3D (struct smb_acl *)((char *)ppntsd + dacl_offset); + ppdacl_size =3D le16_to_cpu(ppdacl_ptr->size); + if (ppdacl_size > ntacl_size || + ppdacl_size < sizeof(struct smb_acl)) + goto out; =20 - ppdacl_ptr =3D (struct smb_acl *)((char *)ppntsd + - le32_to_cpu(ppntsd->dacloffset)); set_ntacl_dacl(user_ns, dacl_ptr, ppdacl_ptr, - nowner_sid_ptr, ngroup_sid_ptr, fattr); + ntacl_size - sizeof(struct smb_acl), + nowner_sid_ptr, ngroup_sid_ptr, + fattr); } pntsd->dacloffset =3D cpu_to_le32(offset); offset +=3D le16_to_cpu(dacl_ptr->size); @@ -980,24 +1001,31 @@ int smb_inherit_dacl(struct ksmbd_conn * struct smb_sid owner_sid, group_sid; struct dentry *parent =3D path->dentry->d_parent; struct user_namespace *user_ns =3D mnt_user_ns(path->mnt); - int inherited_flags =3D 0, flags =3D 0, i, ace_cnt =3D 0, nt_size =3D 0; - int rc =3D 0, num_aces, dacloffset, pntsd_type, acl_len; + int inherited_flags =3D 0, flags =3D 0, i, ace_cnt =3D 0, nt_size =3D 0, = pdacl_size; + int rc =3D 0, num_aces, dacloffset, pntsd_type, pntsd_size, acl_len, aces= _size; char *aces_base; bool is_dir =3D S_ISDIR(d_inode(path->dentry)->i_mode); =20 - acl_len =3D ksmbd_vfs_get_sd_xattr(conn, user_ns, - parent, &parent_pntsd); - if (acl_len <=3D 0) + pntsd_size =3D ksmbd_vfs_get_sd_xattr(conn, user_ns, + parent, &parent_pntsd); + if (pntsd_size <=3D 0) return -ENOENT; dacloffset =3D le32_to_cpu(parent_pntsd->dacloffset); - if (!dacloffset) { + if (!dacloffset || (dacloffset + sizeof(struct smb_acl) > pntsd_size)) { rc =3D -EINVAL; goto free_parent_pntsd; } =20 parent_pdacl =3D (struct smb_acl *)((char *)parent_pntsd + dacloffset); + acl_len =3D pntsd_size - dacloffset; num_aces =3D le32_to_cpu(parent_pdacl->num_aces); pntsd_type =3D le16_to_cpu(parent_pntsd->type); + pdacl_size =3D le16_to_cpu(parent_pdacl->size); + + if (pdacl_size > acl_len || pdacl_size < sizeof(struct smb_acl)) { + rc =3D -EINVAL; + goto free_parent_pntsd; + } =20 aces_base =3D kmalloc(sizeof(struct smb_ace) * num_aces * 2, GFP_KERNEL); if (!aces_base) { @@ -1008,11 +1036,23 @@ int smb_inherit_dacl(struct ksmbd_conn * aces =3D (struct smb_ace *)aces_base; parent_aces =3D (struct smb_ace *)((char *)parent_pdacl + sizeof(struct smb_acl)); + aces_size =3D acl_len - sizeof(struct smb_acl); =20 if (pntsd_type & DACL_AUTO_INHERITED) inherited_flags =3D INHERITED_ACE; =20 for (i =3D 0; i < num_aces; i++) { + int pace_size; + + if (offsetof(struct smb_ace, access_req) > aces_size) + break; + + pace_size =3D le16_to_cpu(parent_aces->size); + if (pace_size > aces_size) + break; + + aces_size -=3D pace_size; + flags =3D parent_aces->flags; if (!smb_inherit_flags(flags, is_dir)) goto pass; @@ -1057,8 +1097,7 @@ int smb_inherit_dacl(struct ksmbd_conn * aces =3D (struct smb_ace *)((char *)aces + le16_to_cpu(aces->size)); ace_cnt++; pass: - parent_aces =3D - (struct smb_ace *)((char *)parent_aces + le16_to_cpu(parent_aces->size)= ); + parent_aces =3D (struct smb_ace *)((char *)parent_aces + pace_size); } =20 if (nt_size > 0) { @@ -1153,7 +1192,7 @@ int smb_check_perm_dacl(struct ksmbd_con struct smb_ntsd *pntsd =3D NULL; struct smb_acl *pdacl; struct posix_acl *posix_acls; - int rc =3D 0, acl_size; + int rc =3D 0, pntsd_size, acl_size, aces_size, pdacl_size, dacl_offset; struct smb_sid sid; int granted =3D le32_to_cpu(*pdaccess & ~FILE_MAXIMAL_ACCESS_LE); struct smb_ace *ace; @@ -1162,37 +1201,33 @@ int smb_check_perm_dacl(struct ksmbd_con struct smb_ace *others_ace =3D NULL; struct posix_acl_entry *pa_entry; unsigned int sid_type =3D SIDOWNER; - char *end_of_acl; + unsigned short ace_size; =20 ksmbd_debug(SMB, "check permission using windows acl\n"); - acl_size =3D ksmbd_vfs_get_sd_xattr(conn, user_ns, - path->dentry, &pntsd); - if (acl_size <=3D 0 || !pntsd || !pntsd->dacloffset) { - kfree(pntsd); - return 0; - } + pntsd_size =3D ksmbd_vfs_get_sd_xattr(conn, user_ns, + path->dentry, &pntsd); + if (pntsd_size <=3D 0 || !pntsd) + goto err_out; + + dacl_offset =3D le32_to_cpu(pntsd->dacloffset); + if (!dacl_offset || + (dacl_offset + sizeof(struct smb_acl) > pntsd_size)) + goto err_out; =20 pdacl =3D (struct smb_acl *)((char *)pntsd + le32_to_cpu(pntsd->dacloffse= t)); - end_of_acl =3D ((char *)pntsd) + acl_size; - if (end_of_acl <=3D (char *)pdacl) { - kfree(pntsd); - return 0; - } + acl_size =3D pntsd_size - dacl_offset; + pdacl_size =3D le16_to_cpu(pdacl->size); =20 - if (end_of_acl < (char *)pdacl + le16_to_cpu(pdacl->size) || - le16_to_cpu(pdacl->size) < sizeof(struct smb_acl)) { - kfree(pntsd); - return 0; - } + if (pdacl_size > acl_size || pdacl_size < sizeof(struct smb_acl)) + goto err_out; =20 if (!pdacl->num_aces) { - if (!(le16_to_cpu(pdacl->size) - sizeof(struct smb_acl)) && + if (!(pdacl_size - sizeof(struct smb_acl)) && *pdaccess & ~(FILE_READ_CONTROL_LE | FILE_WRITE_DAC_LE)) { rc =3D -EACCES; goto err_out; } - kfree(pntsd); - return 0; + goto err_out; } =20 if (*pdaccess & FILE_MAXIMAL_ACCESS_LE) { @@ -1200,11 +1235,16 @@ int smb_check_perm_dacl(struct ksmbd_con DELETE; =20 ace =3D (struct smb_ace *)((char *)pdacl + sizeof(struct smb_acl)); + aces_size =3D acl_size - sizeof(struct smb_acl); for (i =3D 0; i < le32_to_cpu(pdacl->num_aces); i++) { + if (offsetof(struct smb_ace, access_req) > aces_size) + break; + ace_size =3D le16_to_cpu(ace->size); + if (ace_size > aces_size) + break; + aces_size -=3D ace_size; granted |=3D le32_to_cpu(ace->access_req); ace =3D (struct smb_ace *)((char *)ace + le16_to_cpu(ace->size)); - if (end_of_acl < (char *)ace) - goto err_out; } =20 if (!pdacl->num_aces) @@ -1216,7 +1256,15 @@ int smb_check_perm_dacl(struct ksmbd_con id_to_sid(uid, sid_type, &sid); =20 ace =3D (struct smb_ace *)((char *)pdacl + sizeof(struct smb_acl)); + aces_size =3D acl_size - sizeof(struct smb_acl); for (i =3D 0; i < le32_to_cpu(pdacl->num_aces); i++) { + if (offsetof(struct smb_ace, access_req) > aces_size) + break; + ace_size =3D le16_to_cpu(ace->size); + if (ace_size > aces_size) + break; + aces_size -=3D ace_size; + if (!compare_sids(&sid, &ace->sid) || !compare_sids(&sid_unix_NFS_mode, &ace->sid)) { found =3D 1; @@ -1226,8 +1274,6 @@ int smb_check_perm_dacl(struct ksmbd_con others_ace =3D ace; =20 ace =3D (struct smb_ace *)((char *)ace + le16_to_cpu(ace->size)); - if (end_of_acl < (char *)ace) - goto err_out; } =20 if (*pdaccess & FILE_MAXIMAL_ACCESS_LE && found) { --- a/fs/ksmbd/smbacl.h +++ b/fs/ksmbd/smbacl.h @@ -193,7 +193,7 @@ struct posix_acl_state { int parse_sec_desc(struct user_namespace *user_ns, struct smb_ntsd *pntsd, int acl_len, struct smb_fattr *fattr); int build_sec_desc(struct user_namespace *user_ns, struct smb_ntsd *pntsd, - struct smb_ntsd *ppntsd, int addition_info, + struct smb_ntsd *ppntsd, int ppntsd_size, int addition_info, __u32 *secdesclen, struct smb_fattr *fattr); int init_acl_state(struct posix_acl_state *state, int cnt); void free_acl_state(struct posix_acl_state *state); --- a/fs/ksmbd/vfs.c +++ b/fs/ksmbd/vfs.c @@ -1540,6 +1540,11 @@ int ksmbd_vfs_get_sd_xattr(struct ksmbd_ } =20 *pntsd =3D acl.sd_buf; + if (acl.sd_size < sizeof(struct smb_ntsd)) { + pr_err("sd size is invalid\n"); + goto out_free; + } + (*pntsd)->osidoffset =3D cpu_to_le32(le32_to_cpu((*pntsd)->osidoffset) - NDR_NTSD_OFFSETOF); (*pntsd)->gsidoffset =3D cpu_to_le32(le32_to_cpu((*pntsd)->gsidoffset) - From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 097E2C2BB47 for ; Mon, 15 Aug 2022 20:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347710AbiHOU01 (ORCPT ); Mon, 15 Aug 2022 16:26:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244271AbiHOUUS (ORCPT ); Mon, 15 Aug 2022 16:20:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E1269752E; Mon, 15 Aug 2022 12:00:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 55CD5B810A2; Mon, 15 Aug 2022 19:00:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADB15C433D6; Mon, 15 Aug 2022 19:00:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590047; bh=NNc+ZgAIT93P7mkNlp5ZcQKWVmmubeiDsVrAA3uW0tI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=raibYXxXixBdUcA6qrxsyyjul0o7n9gimVOxYBGYrFbJdCwhZXsQp9SuXUXWwEMNs s7T9KFZ/THMZcISdXQDF5QVCZBcP0e7DUmq030xNUKbmMYbTDJJG4SysWDt4M2dBbi 2XOt9frriEy5Ozo+0d+WVyQRYSdss3JufVaaXLE4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miklos Szeredi Subject: [PATCH 5.18 0103/1095] fuse: limit nsec Date: Mon, 15 Aug 2022 19:51:42 +0200 Message-Id: <20220815180433.813366081@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miklos Szeredi commit 47912eaa061a6a81e4aa790591a1874c650733c0 upstream. Limit nanoseconds to 0..999999999. Fixes: d8a5ba45457e ("[PATCH] FUSE - core") Cc: Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/fuse/inode.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -180,6 +180,12 @@ void fuse_change_attributes_common(struc inode->i_uid =3D make_kuid(fc->user_ns, attr->uid); inode->i_gid =3D make_kgid(fc->user_ns, attr->gid); inode->i_blocks =3D attr->blocks; + + /* Sanitize nsecs */ + attr->atimensec =3D min_t(u32, attr->atimensec, NSEC_PER_SEC - 1); + attr->mtimensec =3D min_t(u32, attr->mtimensec, NSEC_PER_SEC - 1); + attr->ctimensec =3D min_t(u32, attr->ctimensec, NSEC_PER_SEC - 1); + inode->i_atime.tv_sec =3D attr->atime; inode->i_atime.tv_nsec =3D attr->atimensec; /* mtime from server may be stale due to local buffered write */ From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 647D6C25B0E for ; Mon, 15 Aug 2022 20:23:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347041AbiHOUXZ (ORCPT ); Mon, 15 Aug 2022 16:23:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243590AbiHOUNh (ORCPT ); Mon, 15 Aug 2022 16:13:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3969F8F976; Mon, 15 Aug 2022 11:59:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 76D7CB81109; Mon, 15 Aug 2022 18:59:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A60B2C433D6; Mon, 15 Aug 2022 18:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589956; bh=qW6yXE9ud1P1tuP49WumpWs1UmmGtf+87D75l29Nzf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bMdV/wBXGzqSYufty5QjmTBb42VIuvTRpzjbMhVLtzQtnzD2oPJhSjRCu/Ch7k6We GQP9S7h9Iu+CWJkWYjLZCQs4FKvaPDGue6thLCanLypUegsJEQc0KhISXClCiUeNg0 1gj3qW6GBc6pBuCBY7YK0/4sF7hjgf+VzF/JOxPA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20Kohlsch=C3=BCtter?= , Miklos Szeredi Subject: [PATCH 5.18 0104/1095] fuse: ioctl: translate ENOSYS Date: Mon, 15 Aug 2022 19:51:43 +0200 Message-Id: <20220815180433.860641078@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miklos Szeredi commit 02c0cab8e7345b06f1c0838df444e2902e4138d3 upstream. Overlayfs may fail to complete updates when a filesystem lacks fileattr/xattr syscall support and responds with an ENOSYS error code, resulting in an unexpected "Function not implemented" error. This bug may occur with FUSE filesystems, such as davfs2. Steps to reproduce: # install davfs2, e.g., apk add davfs2 mkdir /test mkdir /test/lower /test/upper /test/work /test/mnt yes '' | mount -t davfs -o ro http://some-web-dav-server/path \ /test/lower mount -t overlay -o upperdir=3D/test/upper,lowerdir=3D/test/lower \ -o workdir=3D/test/work overlay /test/mnt # when "some-file" exists in the lowerdir, this fails with "Function # not implemented", with dmesg showing "overlayfs: failed to retrieve # lower fileattr (/some-file, err=3D-38)" touch /test/mnt/some-file The underlying cause of this regresion is actually in FUSE, which fails to translate the ENOSYS error code returned by userspace filesystem (which means that the ioctl operation is not supported) to ENOTTY. Reported-by: Christian Kohlsch=C3=BCtter Fixes: 72db82115d2b ("ovl: copy up sync/noatime fileattr flags") Fixes: 59efec7b9039 ("fuse: implement ioctl support") Cc: Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/fuse/ioctl.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) --- a/fs/fuse/ioctl.c +++ b/fs/fuse/ioctl.c @@ -9,6 +9,17 @@ #include #include =20 +static ssize_t fuse_send_ioctl(struct fuse_mount *fm, struct fuse_args *ar= gs) +{ + ssize_t ret =3D fuse_simple_request(fm, args); + + /* Translate ENOSYS, which shouldn't be returned from fs */ + if (ret =3D=3D -ENOSYS) + ret =3D -ENOTTY; + + return ret; +} + /* * CUSE servers compiled on 32bit broke on 64bit kernels because the * ABI was defined to be 'struct iovec' which is different on 32bit @@ -259,7 +270,7 @@ long fuse_do_ioctl(struct file *file, un ap.args.out_pages =3D true; ap.args.out_argvar =3D true; =20 - transferred =3D fuse_simple_request(fm, &ap.args); + transferred =3D fuse_send_ioctl(fm, &ap.args); err =3D transferred; if (transferred < 0) goto out; @@ -393,7 +404,7 @@ static int fuse_priv_ioctl(struct inode args.out_args[1].size =3D inarg.out_size; args.out_args[1].value =3D ptr; =20 - err =3D fuse_simple_request(fm, &args); + err =3D fuse_send_ioctl(fm, &args); if (!err) { if (outarg.result < 0) err =3D outarg.result; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39218C25B0E for ; Mon, 15 Aug 2022 20:23:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347115AbiHOUXb (ORCPT ); Mon, 15 Aug 2022 16:23:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243555AbiHOUOl (ORCPT ); Mon, 15 Aug 2022 16:14:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B987890199; Mon, 15 Aug 2022 11:59:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7144AB8109E; Mon, 15 Aug 2022 18:59:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C20A7C433C1; Mon, 15 Aug 2022 18:59:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589959; bh=Dh+emGNHm1D8DGNCBwnBuEUQw+j66ciJrWboMiUcFmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OH+OUO6RlatWLtZKS/GI4qptL3WxCUTm9YDXMKWTVXo9jwbIhowRvzVusZrqtjR4v eR5/53UDFEM6zKm4SPJRehjxwoz/YPI6m2dao4TcihnSpI/D7glk0W/SHBExaIbxHU qz9qmxYGY4nhTZzskoLgdKC6vifnzdUf48cBqx10= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+6e1efbd8efaaa6860e91@syzkaller.appspotmail.com, Miklos Szeredi Subject: [PATCH 5.18 0105/1095] fuse: write inode in fuse_release() Date: Mon, 15 Aug 2022 19:51:44 +0200 Message-Id: <20220815180433.905210062@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miklos Szeredi commit 035ff33cf4db101250fb980a3941bf078f37a544 upstream. A race between write(2) and close(2) allows pages to be dirtied after fuse_flush -> write_inode_now(). If these pages are not flushed from fuse_release(), then there might not be a writable open file later. So any remaining dirty pages must be written back before the file is released. This is a partial revert of the blamed commit. Reported-by: syzbot+6e1efbd8efaaa6860e91@syzkaller.appspotmail.com Fixes: 36ea23374d1f ("fuse: write inode in fuse_vma_close() instead of fuse= _release()") Cc: # v5.16 Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/fuse/file.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -338,6 +338,15 @@ static int fuse_open(struct inode *inode =20 static int fuse_release(struct inode *inode, struct file *file) { + struct fuse_conn *fc =3D get_fuse_conn(inode); + + /* + * Dirty pages might remain despite write_inode_now() call from + * fuse_flush() due to writes racing with the close. + */ + if (fc->writeback_cache) + write_inode_now(inode, 1); + fuse_release_common(file, false); =20 /* return value is ignored by VFS */ From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17DB8C00140 for ; Mon, 15 Aug 2022 20:23:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347146AbiHOUXf (ORCPT ); Mon, 15 Aug 2022 16:23:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241063AbiHOUO4 (ORCPT ); Mon, 15 Aug 2022 16:14:56 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2F929080B; Mon, 15 Aug 2022 11:59:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id AA4B0CE129C; Mon, 15 Aug 2022 18:59:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98D54C433C1; Mon, 15 Aug 2022 18:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589962; bh=bc9aM3xEe7Z2hNZa6nlp6Nn4q+qo2aKGf8HRiK9p9oA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SSGqoTvHb9J+b1n710sk9Xm5T2lYPEoGQg4MPAemihuI106FGTW8aOOU3m7xGag2g C/ua+BKdQuW6TjfVpjjaFwmWOQL0uhb+O9vZXxAnjCg+X3LRPMSc/g7y+J3IchSFxf 5bVp+NqpwYSumqGVK7uKALpF1R6pB9zu21WhxLCA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiachen Zhang , Miklos Szeredi Subject: [PATCH 5.18 0106/1095] fuse: fix deadlock between atomic O_TRUNC and page invalidation Date: Mon, 15 Aug 2022 19:51:45 +0200 Message-Id: <20220815180433.945250689@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miklos Szeredi commit 2fdbb8dd01556e1501132b5ad3826e8f71e24a8b upstream. fuse_finish_open() will be called with FUSE_NOWRITE set in case of atomic O_TRUNC open(), so commit 76224355db75 ("fuse: truncate pagecache on atomic_o_trunc") replaced invalidate_inode_pages2() by truncate_pagecache() in such a case to avoid the A-A deadlock. However, we found another A-B-B-A deadlock related to the case above, which will cause the xfstests generic/464 testcase hung in our virtio-fs test environment. For example, consider two processes concurrently open one same file, one with O_TRUNC and another without O_TRUNC. The deadlock case is described below, if open(O_TRUNC) is already set_nowrite(acquired A), and is trying to lock a page (acquiring B), open() could have held the page lock (acquired B), and waiting on the page writeback (acquiring A). This would lead to deadlocks. open(O_TRUNC) Reported-by: Jiachen Zhang Tested-by: Jiachen Zhang Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan ---------------------------------------------------------------- fuse_open_common inode_lock [C acquire] fuse_set_nowrite [A acquire] fuse_finish_open truncate_pagecache lock_page [B acquire] truncate_inode_page unlock_page [B release] fuse_release_nowrite [A release] inode_unlock [C release] ---------------------------------------------------------------- open() ---------------------------------------------------------------- fuse_open_common fuse_finish_open invalidate_inode_pages2 lock_page [B acquire] fuse_launder_page fuse_wait_on_page_writeback [A acquire & release] unlock_page [B release] ---------------------------------------------------------------- Besides this case, all calls of invalidate_inode_pages2() and invalidate_inode_pages2_range() in fuse code also can deadlock with open(O_TRUNC). Fix by moving the truncate_pagecache() call outside the nowrite protected region. The nowrite protection is only for delayed writeback (writeback_cache) case, where inode lock does not protect against truncation racing with writes on the server. Write syscalls racing with page cache truncation still get the inode lock protection. This patch also changes the order of filemap_invalidate_lock() vs. fuse_set_nowrite() in fuse_open_common(). This new order matches the order found in fuse_file_fallocate() and fuse_do_setattr(). Reported-by: Jiachen Zhang Tested-by: Jiachen Zhang Fixes: e4648309b85a ("fuse: truncate pending writes on O_TRUNC") Cc: Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/fuse/dir.c | 7 ++++++- fs/fuse/file.c | 30 +++++++++++++++++------------- 2 files changed, 23 insertions(+), 14 deletions(-) --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -537,6 +537,7 @@ static int fuse_create_open(struct inode struct fuse_file *ff; void *security_ctx =3D NULL; u32 security_ctxlen; + bool trunc =3D flags & O_TRUNC; =20 /* Userspace expects S_IFREG in create mode */ BUG_ON((mode & S_IFMT) !=3D S_IFREG); @@ -561,7 +562,7 @@ static int fuse_create_open(struct inode inarg.mode =3D mode; inarg.umask =3D current_umask(); =20 - if (fm->fc->handle_killpriv_v2 && (flags & O_TRUNC) && + if (fm->fc->handle_killpriv_v2 && trunc && !(flags & O_EXCL) && !capable(CAP_FSETID)) { inarg.open_flags |=3D FUSE_OPEN_KILL_SUIDGID; } @@ -623,6 +624,10 @@ static int fuse_create_open(struct inode } else { file->private_data =3D ff; fuse_finish_open(inode, file); + if (fm->fc->atomic_o_trunc && trunc) + truncate_pagecache(inode, 0); + else if (!(ff->open_flags & FOPEN_KEEP_CACHE)) + invalidate_inode_pages2(inode->i_mapping); } return err; =20 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -210,13 +210,9 @@ void fuse_finish_open(struct inode *inod fi->attr_version =3D atomic64_inc_return(&fc->attr_version); i_size_write(inode, 0); spin_unlock(&fi->lock); - truncate_pagecache(inode, 0); file_update_time(file); fuse_invalidate_attr_mask(inode, FUSE_STATX_MODSIZE); - } else if (!(ff->open_flags & FOPEN_KEEP_CACHE)) { - invalidate_inode_pages2(inode->i_mapping); } - if ((file->f_mode & FMODE_WRITE) && fc->writeback_cache) fuse_link_write_file(file); } @@ -239,30 +235,38 @@ int fuse_open_common(struct inode *inode if (err) return err; =20 - if (is_wb_truncate || dax_truncate) { + if (is_wb_truncate || dax_truncate) inode_lock(inode); - fuse_set_nowrite(inode); - } =20 if (dax_truncate) { filemap_invalidate_lock(inode->i_mapping); err =3D fuse_dax_break_layouts(inode, 0, 0); if (err) - goto out; + goto out_inode_unlock; } =20 + if (is_wb_truncate || dax_truncate) + fuse_set_nowrite(inode); + err =3D fuse_do_open(fm, get_node_id(inode), file, isdir); if (!err) fuse_finish_open(inode, file); =20 -out: + if (is_wb_truncate || dax_truncate) + fuse_release_nowrite(inode); + if (!err) { + struct fuse_file *ff =3D file->private_data; + + if (fc->atomic_o_trunc && (file->f_flags & O_TRUNC)) + truncate_pagecache(inode, 0); + else if (!(ff->open_flags & FOPEN_KEEP_CACHE)) + invalidate_inode_pages2(inode->i_mapping); + } if (dax_truncate) filemap_invalidate_unlock(inode->i_mapping); - - if (is_wb_truncate | dax_truncate) { - fuse_release_nowrite(inode); +out_inode_unlock: + if (is_wb_truncate || dax_truncate) inode_unlock(inode); - } =20 return err; } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D048FC00140 for ; Mon, 15 Aug 2022 20:23:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347202AbiHOUXi (ORCPT ); Mon, 15 Aug 2022 16:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346423AbiHOUPI (ORCPT ); Mon, 15 Aug 2022 16:15:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2C3C9082F; Mon, 15 Aug 2022 11:59:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2585DB8105C; Mon, 15 Aug 2022 18:59:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69FFEC433D6; Mon, 15 Aug 2022 18:59:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589964; bh=ptbstcd6stve8vBtBfyzgL8zEE8ay3I+XdRF4HhLEpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V7IJB+UwBwt4Qg9FxlKbaJsa0QDGCtunv1rOZLVZI+7tGdzdlMljTfH56LZwkMh8E Y/fa/DW2W22TbA5Sgi/vuWb/Bf7ov1gPLanNKs+69B7ts1hQgJdme960UpWOzU5V8F GoXigvGeibaD5HDugzjhr9sSfbmnyXVppdZA72H4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yi Guo , Nadav Haklai , Narendra Hadke , =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH 5.18 0107/1095] serial: mvebu-uart: uart2 error bits clearing Date: Mon, 15 Aug 2022 19:51:46 +0200 Message-Id: <20220815180433.993400408@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Narendra Hadke commit a7209541239e5dd44d981289e5f9059222d40fd1 upstream. For mvebu uart2, error bits are not cleared on buffer read. This causes interrupt loop and system hang. Cc: stable@vger.kernel.org Reviewed-by: Yi Guo Reviewed-by: Nadav Haklai Signed-off-by: Narendra Hadke Signed-off-by: Pali Roh=C3=A1r Link: https://lore.kernel.org/r/20220726091221.12358-1-pali@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/serial/mvebu-uart.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uar= t.c index 0429c2a54290..ff61a8d00014 100644 --- a/drivers/tty/serial/mvebu-uart.c +++ b/drivers/tty/serial/mvebu-uart.c @@ -265,6 +265,7 @@ static void mvebu_uart_rx_chars(struct uart_port *port,= unsigned int status) struct tty_port *tport =3D &port->state->port; unsigned char ch =3D 0; char flag =3D 0; + int ret; =20 do { if (status & STAT_RX_RDY(port)) { @@ -277,6 +278,16 @@ static void mvebu_uart_rx_chars(struct uart_port *port= , unsigned int status) port->icount.parity++; } =20 + /* + * For UART2, error bits are not cleared on buffer read. + * This causes interrupt loop and system hang. + */ + if (IS_EXTENDED(port) && (status & STAT_BRK_ERR)) { + ret =3D readl(port->membase + UART_STAT); + ret |=3D STAT_BRK_ERR; + writel(ret, port->membase + UART_STAT); + } + if (status & STAT_BRK_DET) { port->icount.brk++; status &=3D ~(STAT_FRM_ERR | STAT_PAR_ERR); --=20 2.37.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD319C25B08 for ; Mon, 15 Aug 2022 20:23:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347229AbiHOUXq (ORCPT ); Mon, 15 Aug 2022 16:23:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240035AbiHOUPN (ORCPT ); Mon, 15 Aug 2022 16:15:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 806DF4A82C; Mon, 15 Aug 2022 11:59:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9722A6123F; Mon, 15 Aug 2022 18:59:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87944C433C1; Mon, 15 Aug 2022 18:59:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589968; bh=D+Dn4DSG7CtoE5dAMQCIBmmF2VK22tGQodPP0fLyyzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K/1ZAW6Y0RqriZvijKbGTcIa8KkkKQNldk70qrKClxrxezHt3rH/AihDIx/ta7F50 3UtIDWMnzkmU9AMTAxen8fslPX27bDJsK5G75OLQ3qMS3EaOYLkK1onq2RNyOsXq44 mBSMCLamKDRb8c7OlqWxXC/ua+I1BntHAVBrqgcA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Song Liu , Jens Axboe Subject: [PATCH 5.18 0108/1095] md-raid: destroy the bitmap after destroying the thread Date: Mon, 15 Aug 2022 19:51:47 +0200 Message-Id: <20220815180434.037284488@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka commit e151db8ecfb019b7da31d076130a794574c89f6f upstream. When we ran the lvm test "shell/integrity-blocksize-3.sh" on a kernel with kasan, we got failure in write_page. The reason for the failure is that md_bitmap_destroy is called before destroying the thread and the thread may be waiting in the function write_page for the bio to complete. When the thread finishes waiting, it executes "if (test_bit(BITMAP_WRITE_ERROR, &bitmap->flags))", which triggers the kasan warning. Note that the commit 48df498daf62 that caused this bug claims that it is neede for md-cluster, you should check md-cluster and possibly find another bugfix for it. BUG: KASAN: use-after-free in write_page+0x18d/0x680 [md_mod] Read of size 8 at addr ffff889162030c78 by task mdX_raid1/5539 CPU: 10 PID: 5539 Comm: mdX_raid1 Not tainted 5.19.0-rc2 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/= 2014 Call Trace: dump_stack_lvl+0x34/0x44 print_report.cold+0x45/0x57a ? __lock_text_start+0x18/0x18 ? write_page+0x18d/0x680 [md_mod] kasan_report+0xa8/0xe0 ? write_page+0x18d/0x680 [md_mod] kasan_check_range+0x13f/0x180 write_page+0x18d/0x680 [md_mod] ? super_sync+0x4d5/0x560 [dm_raid] ? md_bitmap_file_kick+0xa0/0xa0 [md_mod] ? rs_set_dev_and_array_sectors+0x2e0/0x2e0 [dm_raid] ? mutex_trylock+0x120/0x120 ? preempt_count_add+0x6b/0xc0 ? preempt_count_sub+0xf/0xc0 md_update_sb+0x707/0xe40 [md_mod] md_reap_sync_thread+0x1b2/0x4a0 [md_mod] md_check_recovery+0x533/0x960 [md_mod] raid1d+0xc8/0x2a20 [raid1] ? var_wake_function+0xe0/0xe0 ? psi_group_change+0x411/0x500 ? preempt_count_sub+0xf/0xc0 ? _raw_spin_lock_irqsave+0x78/0xc0 ? __lock_text_start+0x18/0x18 ? raid1_end_read_request+0x2a0/0x2a0 [raid1] ? preempt_count_sub+0xf/0xc0 ? _raw_spin_unlock_irqrestore+0x19/0x40 ? del_timer_sync+0xa9/0x100 ? try_to_del_timer_sync+0xc0/0xc0 ? _raw_spin_lock_irqsave+0x78/0xc0 ? __lock_text_start+0x18/0x18 ? __list_del_entry_valid+0x68/0xa0 ? finish_wait+0xa3/0x100 md_thread+0x161/0x260 [md_mod] ? unregister_md_personality+0xa0/0xa0 [md_mod] ? _raw_spin_lock_irqsave+0x78/0xc0 ? prepare_to_wait_event+0x2c0/0x2c0 ? unregister_md_personality+0xa0/0xa0 [md_mod] kthread+0x148/0x180 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 Allocated by task 5522: kasan_save_stack+0x1e/0x40 __kasan_kmalloc+0x80/0xa0 md_bitmap_create+0xa8/0xe80 [md_mod] md_run+0x777/0x1300 [md_mod] raid_ctr+0x249c/0x4a30 [dm_raid] dm_table_add_target+0x2b0/0x620 [dm_mod] table_load+0x1c8/0x400 [dm_mod] ctl_ioctl+0x29e/0x560 [dm_mod] dm_compat_ctl_ioctl+0x7/0x20 [dm_mod] __do_compat_sys_ioctl+0xfa/0x160 do_syscall_64+0x90/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Freed by task 5680: kasan_save_stack+0x1e/0x40 kasan_set_track+0x21/0x40 kasan_set_free_info+0x20/0x40 __kasan_slab_free+0xf7/0x140 kfree+0x80/0x240 md_bitmap_free+0x1c3/0x280 [md_mod] __md_stop+0x21/0x120 [md_mod] md_stop+0x9/0x40 [md_mod] raid_dtr+0x1b/0x40 [dm_raid] dm_table_destroy+0x98/0x1e0 [dm_mod] __dm_destroy+0x199/0x360 [dm_mod] dev_remove+0x10c/0x160 [dm_mod] ctl_ioctl+0x29e/0x560 [dm_mod] dm_compat_ctl_ioctl+0x7/0x20 [dm_mod] __do_compat_sys_ioctl+0xfa/0x160 do_syscall_64+0x90/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org Fixes: 48df498daf62 ("md: move bitmap_destroy to the beginning of __md_stop= ") Signed-off-by: Song Liu Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/md/md.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -6259,11 +6259,11 @@ static void mddev_detach(struct mddev *m static void __md_stop(struct mddev *mddev) { struct md_personality *pers =3D mddev->pers; - md_bitmap_destroy(mddev); mddev_detach(mddev); /* Ensure ->event_work is done */ if (mddev->event_work.func) flush_workqueue(md_misc_wq); + md_bitmap_destroy(mddev); spin_lock(&mddev->lock); mddev->pers =3D NULL; spin_unlock(&mddev->lock); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 443B3C00140 for ; Mon, 15 Aug 2022 20:23:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347263AbiHOUXw (ORCPT ); Mon, 15 Aug 2022 16:23:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343749AbiHOUPj (ORCPT ); Mon, 15 Aug 2022 16:15:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45D2D910B5; Mon, 15 Aug 2022 11:59:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 765DC6126A; Mon, 15 Aug 2022 18:59:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79C80C433C1; Mon, 15 Aug 2022 18:59:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589970; bh=/OvjBTaF6tuUXJfZ1NG2vpAKUz/K79+3o68qDRtEEpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y12AkXrSauMoB8bogBLRBIfzrwOz3ds1aQg+kdbtnQlHuxJ5rPNjnE1buGeLV/p3J qsls7z36J3s7O26X8d42sdcebN7u5ODx55OL2sRs9Wayg53xau082mSluh0Dsx2bBd 5MMHLmiv1zrSBX0veajtUPP4EovoYHrbYgIbznS4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Song Liu , Jens Axboe Subject: [PATCH 5.18 0109/1095] md-raid10: fix KASAN warning Date: Mon, 15 Aug 2022 19:51:48 +0200 Message-Id: <20220815180434.091144563@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka commit d17f744e883b2f8d13cca252d71cfe8ace346f7d upstream. There's a KASAN warning in raid10_remove_disk when running the lvm test lvconvert-raid-reshape.sh. We fix this warning by verifying that the value "number" is valid. BUG: KASAN: slab-out-of-bounds in raid10_remove_disk+0x61/0x2a0 [raid10] Read of size 8 at addr ffff889108f3d300 by task mdX_raid10/124682 CPU: 3 PID: 124682 Comm: mdX_raid10 Not tainted 5.19.0-rc6 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/= 2014 Call Trace: dump_stack_lvl+0x34/0x44 print_report.cold+0x45/0x57a ? __lock_text_start+0x18/0x18 ? raid10_remove_disk+0x61/0x2a0 [raid10] kasan_report+0xa8/0xe0 ? raid10_remove_disk+0x61/0x2a0 [raid10] raid10_remove_disk+0x61/0x2a0 [raid10] Buffer I/O error on dev dm-76, logical block 15344, async page read ? __mutex_unlock_slowpath.constprop.0+0x1e0/0x1e0 remove_and_add_spares+0x367/0x8a0 [md_mod] ? super_written+0x1c0/0x1c0 [md_mod] ? mutex_trylock+0xac/0x120 ? _raw_spin_lock+0x72/0xc0 ? _raw_spin_lock_bh+0xc0/0xc0 md_check_recovery+0x848/0x960 [md_mod] raid10d+0xcf/0x3360 [raid10] ? sched_clock_cpu+0x185/0x1a0 ? rb_erase+0x4d4/0x620 ? var_wake_function+0xe0/0xe0 ? psi_group_change+0x411/0x500 ? preempt_count_sub+0xf/0xc0 ? _raw_spin_lock_irqsave+0x78/0xc0 ? __lock_text_start+0x18/0x18 ? raid10_sync_request+0x36c0/0x36c0 [raid10] ? preempt_count_sub+0xf/0xc0 ? _raw_spin_unlock_irqrestore+0x19/0x40 ? del_timer_sync+0xa9/0x100 ? try_to_del_timer_sync+0xc0/0xc0 ? _raw_spin_lock_irqsave+0x78/0xc0 ? __lock_text_start+0x18/0x18 ? _raw_spin_unlock_irq+0x11/0x24 ? __list_del_entry_valid+0x68/0xa0 ? finish_wait+0xa3/0x100 md_thread+0x161/0x260 [md_mod] ? unregister_md_personality+0xa0/0xa0 [md_mod] ? _raw_spin_lock_irqsave+0x78/0xc0 ? prepare_to_wait_event+0x2c0/0x2c0 ? unregister_md_personality+0xa0/0xa0 [md_mod] kthread+0x148/0x180 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 Allocated by task 124495: kasan_save_stack+0x1e/0x40 __kasan_kmalloc+0x80/0xa0 setup_conf+0x140/0x5c0 [raid10] raid10_run+0x4cd/0x740 [raid10] md_run+0x6f9/0x1300 [md_mod] raid_ctr+0x2531/0x4ac0 [dm_raid] dm_table_add_target+0x2b0/0x620 [dm_mod] table_load+0x1c8/0x400 [dm_mod] ctl_ioctl+0x29e/0x560 [dm_mod] dm_compat_ctl_ioctl+0x7/0x20 [dm_mod] __do_compat_sys_ioctl+0xfa/0x160 do_syscall_64+0x90/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Last potentially related work creation: kasan_save_stack+0x1e/0x40 __kasan_record_aux_stack+0x9e/0xc0 kvfree_call_rcu+0x84/0x480 timerfd_release+0x82/0x140 L __fput+0xfa/0x400 task_work_run+0x80/0xc0 exit_to_user_mode_prepare+0x155/0x160 syscall_exit_to_user_mode+0x12/0x40 do_syscall_64+0x42/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 __kasan_record_aux_stack+0x9e/0xc0 kvfree_call_rcu+0x84/0x480 timerfd_release+0x82/0x140 __fput+0xfa/0x400 task_work_run+0x80/0xc0 exit_to_user_mode_prepare+0x155/0x160 syscall_exit_to_user_mode+0x12/0x40 do_syscall_64+0x42/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 The buggy address belongs to the object at ffff889108f3d200 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 0 bytes to the right of 256-byte region [ffff889108f3d200, ffff889108f3d300) The buggy address belongs to the physical page: page:000000007ef2a34c refcount:1 mapcount:0 mapping:0000000000000000 index:= 0x0 pfn:0x1108f3c head:000000007ef2a34c order:2 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head|zone=3D2) raw: 4000000000010200 0000000000000000 dead000000000001 ffff889100042b40 raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff889108f3d200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff889108f3d280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff889108f3d300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff889108f3d380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff889108f3d400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org Signed-off-by: Song Liu Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/md/raid10.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -2157,9 +2157,12 @@ static int raid10_remove_disk(struct mdd int err =3D 0; int number =3D rdev->raid_disk; struct md_rdev **rdevp; - struct raid10_info *p =3D conf->mirrors + number; + struct raid10_info *p; =20 print_conf(conf); + if (unlikely(number >=3D mddev->raid_disks)) + return 0; + p =3D conf->mirrors + number; if (rdev =3D=3D p->rdev) rdevp =3D &p->rdev; else if (rdev =3D=3D p->replacement) From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB13BC00140 for ; Mon, 15 Aug 2022 20:24:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347289AbiHOUX6 (ORCPT ); Mon, 15 Aug 2022 16:23:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346442AbiHOUPq (ORCPT ); Mon, 15 Aug 2022 16:15:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F42B91D02; Mon, 15 Aug 2022 11:59:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 528736123F; Mon, 15 Aug 2022 18:59:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 536F1C433C1; Mon, 15 Aug 2022 18:59:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589973; bh=uwI7jOt3LUj5x/gvUBN4HIO7/wzxiNFPzitTcyPAavQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XwqYkVCIPh5kXbACtmlzGHthqnVMEM/Ozx5Mx0upP0meO3aj41CcaJfo2k2QDjNI/ PdA8bJuck9SL9RFlNa4ddZwqhOULSgUWCtoiHN6DuNiiDmxR8jdOkZyLP/06Wuk3x7 aXZ6Ku05YvXSTweTWh8pCZj+FpRXQY9IixobWVFo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Theodore Tso Subject: [PATCH 5.18 0110/1095] mbcache: dont reclaim used entries Date: Mon, 15 Aug 2022 19:51:49 +0200 Message-Id: <20220815180434.122910839@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara commit 58318914186c157477b978b1739dfe2f1b9dc0fe upstream. Do not reclaim entries that are currently used by somebody from a shrinker. Firstly, these entries are likely useful. Secondly, we will need to keep such entries to protect pending increment of xattr block refcount. CC: stable@vger.kernel.org Fixes: 82939d7999df ("ext4: convert to mbcache2") Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220712105436.32204-1-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/mbcache.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/fs/mbcache.c +++ b/fs/mbcache.c @@ -288,7 +288,7 @@ static unsigned long mb_cache_shrink(str while (nr_to_scan-- && !list_empty(&cache->c_list)) { entry =3D list_first_entry(&cache->c_list, struct mb_cache_entry, e_list); - if (entry->e_referenced) { + if (entry->e_referenced || atomic_read(&entry->e_refcnt) > 2) { entry->e_referenced =3D 0; list_move_tail(&entry->e_list, &cache->c_list); continue; @@ -302,6 +302,14 @@ static unsigned long mb_cache_shrink(str spin_unlock(&cache->c_list_lock); head =3D mb_cache_entry_head(cache, entry->e_key); hlist_bl_lock(head); + /* Now a reliable check if the entry didn't get used... */ + if (atomic_read(&entry->e_refcnt) > 2) { + hlist_bl_unlock(head); + spin_lock(&cache->c_list_lock); + list_add_tail(&entry->e_list, &cache->c_list); + cache->c_entry_count++; + continue; + } if (!hlist_bl_unhashed(&entry->e_hash_list)) { hlist_bl_del_init(&entry->e_hash_list); atomic_dec(&entry->e_refcnt); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97E92C25B08 for ; Mon, 15 Aug 2022 20:24:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347311AbiHOUYE (ORCPT ); Mon, 15 Aug 2022 16:24:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346595AbiHOUQM (ORCPT ); Mon, 15 Aug 2022 16:16:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AED0E915D9; Mon, 15 Aug 2022 11:59:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CE8E1B810A1; Mon, 15 Aug 2022 18:59:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D414C433C1; Mon, 15 Aug 2022 18:59:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589976; bh=nunt+JU2j4MkkLoTkzivF571n8HJ9HbPahxcqNDdBjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KYBsFPHxfvj1S9pTUf3+kCDID+7gZYQ8LNGu9BKczJuu66R1IfTEYp1QZoQpzwqLw hdqc/GZvnCGcw6ASaPNjC4bH2kahD62vvUb2GhJRZq+J41tXO6qYdjNxyps+VDHPEz u3xd9A8g32eekvY2QyzpXyPFyZLz4nhf/d/NaRv8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Theodore Tso Subject: [PATCH 5.18 0111/1095] mbcache: add functions to delete entry if unused Date: Mon, 15 Aug 2022 19:51:50 +0200 Message-Id: <20220815180434.171440965@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara commit 3dc96bba65f53daa217f0a8f43edad145286a8f5 upstream. Add function mb_cache_entry_delete_or_get() to delete mbcache entry if it is unused and also add a function to wait for entry to become unused - mb_cache_entry_wait_unused(). We do not share code between the two deleting function as one of them will go away soon. CC: stable@vger.kernel.org Fixes: 82939d7999df ("ext4: convert to mbcache2") Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220712105436.32204-2-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/mbcache.c | 66 +++++++++++++++++++++++++++++++++++++++++++= +++-- include/linux/mbcache.h | 10 ++++++- 2 files changed, 73 insertions(+), 3 deletions(-) --- a/fs/mbcache.c +++ b/fs/mbcache.c @@ -11,7 +11,7 @@ /* * Mbcache is a simple key-value store. Keys need not be unique, however * key-value pairs are expected to be unique (we use this fact in - * mb_cache_entry_delete()). + * mb_cache_entry_delete_or_get()). * * Ext2 and ext4 use this cache for deduplication of extended attribute bl= ocks. * Ext4 also uses it for deduplication of xattr values stored in inodes. @@ -125,6 +125,19 @@ void __mb_cache_entry_free(struct mb_cac } EXPORT_SYMBOL(__mb_cache_entry_free); =20 +/* + * mb_cache_entry_wait_unused - wait to be the last user of the entry + * + * @entry - entry to work on + * + * Wait to be the last user of the entry. + */ +void mb_cache_entry_wait_unused(struct mb_cache_entry *entry) +{ + wait_var_event(&entry->e_refcnt, atomic_read(&entry->e_refcnt) <=3D 3); +} +EXPORT_SYMBOL(mb_cache_entry_wait_unused); + static struct mb_cache_entry *__entry_find(struct mb_cache *cache, struct mb_cache_entry *entry, u32 key) @@ -217,7 +230,7 @@ out: } EXPORT_SYMBOL(mb_cache_entry_get); =20 -/* mb_cache_entry_delete - remove a cache entry +/* mb_cache_entry_delete - try to remove a cache entry * @cache - cache we work with * @key - key * @value - value @@ -254,6 +267,55 @@ void mb_cache_entry_delete(struct mb_cac } EXPORT_SYMBOL(mb_cache_entry_delete); =20 +/* mb_cache_entry_delete_or_get - remove a cache entry if it has no users + * @cache - cache we work with + * @key - key + * @value - value + * + * Remove entry from cache @cache with key @key and value @value. The remo= val + * happens only if the entry is unused. The function returns NULL in case = the + * entry was successfully removed or there's no entry in cache. Otherwise = the + * function grabs reference of the entry that we failed to delete because = it + * still has users and return it. + */ +struct mb_cache_entry *mb_cache_entry_delete_or_get(struct mb_cache *cache, + u32 key, u64 value) +{ + struct hlist_bl_node *node; + struct hlist_bl_head *head; + struct mb_cache_entry *entry; + + head =3D mb_cache_entry_head(cache, key); + hlist_bl_lock(head); + hlist_bl_for_each_entry(entry, node, head, e_hash_list) { + if (entry->e_key =3D=3D key && entry->e_value =3D=3D value) { + if (atomic_read(&entry->e_refcnt) > 2) { + atomic_inc(&entry->e_refcnt); + hlist_bl_unlock(head); + return entry; + } + /* We keep hash list reference to keep entry alive */ + hlist_bl_del_init(&entry->e_hash_list); + hlist_bl_unlock(head); + spin_lock(&cache->c_list_lock); + if (!list_empty(&entry->e_list)) { + list_del_init(&entry->e_list); + if (!WARN_ONCE(cache->c_entry_count =3D=3D 0, + "mbcache: attempt to decrement c_entry_count past zero")) + cache->c_entry_count--; + atomic_dec(&entry->e_refcnt); + } + spin_unlock(&cache->c_list_lock); + mb_cache_entry_put(cache, entry); + return NULL; + } + } + hlist_bl_unlock(head); + + return NULL; +} +EXPORT_SYMBOL(mb_cache_entry_delete_or_get); + /* mb_cache_entry_touch - cache entry got used * @cache - cache the entry belongs to * @entry - entry that got used --- a/include/linux/mbcache.h +++ b/include/linux/mbcache.h @@ -30,15 +30,23 @@ void mb_cache_destroy(struct mb_cache *c int mb_cache_entry_create(struct mb_cache *cache, gfp_t mask, u32 key, u64 value, bool reusable); void __mb_cache_entry_free(struct mb_cache_entry *entry); +void mb_cache_entry_wait_unused(struct mb_cache_entry *entry); static inline int mb_cache_entry_put(struct mb_cache *cache, struct mb_cache_entry *entry) { - if (!atomic_dec_and_test(&entry->e_refcnt)) + unsigned int cnt =3D atomic_dec_return(&entry->e_refcnt); + + if (cnt > 0) { + if (cnt <=3D 3) + wake_up_var(&entry->e_refcnt); return 0; + } __mb_cache_entry_free(entry); return 1; } =20 +struct mb_cache_entry *mb_cache_entry_delete_or_get(struct mb_cache *cache, + u32 key, u64 value); void mb_cache_entry_delete(struct mb_cache *cache, u32 key, u64 value); struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *cache, u32 key, u64 value); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F8AEC25B0E for ; Mon, 15 Aug 2022 20:24:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243512AbiHOUYV (ORCPT ); Mon, 15 Aug 2022 16:24:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346689AbiHOUQT (ORCPT ); Mon, 15 Aug 2022 16:16:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC1584A80A; Mon, 15 Aug 2022 11:59:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1DF72B8109E; Mon, 15 Aug 2022 18:59:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78E74C433C1; Mon, 15 Aug 2022 18:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589979; bh=OGvH2oC8IkGBDkmF6vOdjgA5GjQ+KpwMMXs63Zo55zs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=02ZOSK1bmrmub7g6Z9o/enHFCEpmH31OG5ZM+iU+WCq4i7hEYnL56Qcxck9TgR7rz HOJsNrEI8qKWkQVPr3JPV9pPFs/bLJ8Ocq27PPU+NPGBnAz1ElmUH+kcrN2LwrUN6U pt6H9AJujVu3uuSwdtxiN+31F9uqzfBoi0kcDkO4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , kernel test robot , Marek Vasut , Pengutronix Kernel Team , Michael Tretter , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH 5.18 0112/1095] media: isl7998x: select V4L2_FWNODE to fix build error Date: Mon, 15 Aug 2022 19:51:51 +0200 Message-Id: <20220815180434.217644852@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Randy Dunlap commit 81e005842d0b8167c059553a1c29c36d8a7a9329 upstream. Fix build error when VIDEO_ISL7998X=3Dy and V4L2_FWNODE=3Dm by selecting V4L2_FWNODE. microblaze-linux-ld: drivers/media/i2c/isl7998x.o: in function `isl7998x_pr= obe': (.text+0x8f4): undefined reference to `v4l2_fwnode_endpoint_parse' Cc: stable@vger.kernel.org # 5.18 and above Fixes: 51ef2be546e2 ("media: i2c: isl7998x: Add driver for Intersil ISL7998= x") Signed-off-by: Randy Dunlap Reported-by: kernel test robot Cc: Marek Vasut Cc: Pengutronix Kernel Team Reviewed-by: Michael Tretter Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/i2c/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 2b20aa6c37b1..c926e5d43820 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -1178,6 +1178,7 @@ config VIDEO_ISL7998X depends on OF_GPIO select MEDIA_CONTROLLER select VIDEO_V4L2_SUBDEV_API + select V4L2_FWNODE help Support for Intersil ISL7998x analog to MIPI-CSI2 or BT.656 decoder. --=20 2.37.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F0BEC00140 for ; Mon, 15 Aug 2022 20:24:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240844AbiHOUYJ (ORCPT ); Mon, 15 Aug 2022 16:24:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346693AbiHOUQT (ORCPT ); Mon, 15 Aug 2022 16:16:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F26A33409; Mon, 15 Aug 2022 11:59:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6EC8460A71; Mon, 15 Aug 2022 18:59:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68CDCC433C1; Mon, 15 Aug 2022 18:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589982; bh=sJwBtXUrD47c4QQvixP6qvX5NK11LGGDAI+blx1in/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=anerEXTXZCTJMtdDLFhCzwCJBiboCF5xjxfsX1gz/NeDN1Ug/jo92aiMmyPWny32k iLyT0cYwA36qjVgAoM8Ziy++IUQc6ZCNK9014JwKRlBWqP2u2ObYwoVYZekV7lQB+c 4iYWHFaBj+qZFw7vF91srEvzKuwWKEvfZ5BFh9mA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaomeng Tong , Mauro Carvalho Chehab Subject: [PATCH 5.18 0113/1095] media: [PATCH] pci: atomisp_cmd: fix three missing checks on list iterator Date: Mon, 15 Aug 2022 19:51:52 +0200 Message-Id: <20220815180434.258725850@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiaomeng Tong commit 09b204eb9de9fdf07d028c41c4331b5cfeb70dd7 upstream. The three bugs are here: __func__, s3a_buf->s3a_data->exp_id); __func__, md_buf->metadata->exp_id); __func__, dis_buf->dis_data->exp_id); The list iterator 's3a_buf/md_buf/dis_buf' will point to a bogus position containing HEAD if the list is empty or no element is found. This case must be checked before any use of the iterator, otherwise it will lead to a invalid memory access. To fix this bug, add an check. Use a new variable '*_iter' as the list iterator, while use the old variable '*_buf' as a dedicated pointer to point to the found element. Link: https://lore.kernel.org/linux-media/20220414041415.3342-1-xiam0nd.ton= g@gmail.com Cc: stable@vger.kernel.org Fixes: ad85094b293e4 ("Revert "media: staging: atomisp: Remove driver"") Signed-off-by: Xiaomeng Tong Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 57 +++++++++++++++----= ----- 1 file changed, 36 insertions(+), 21 deletions(-) --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -901,9 +901,9 @@ void atomisp_buf_done(struct atomisp_sub int err; unsigned long irqflags; struct ia_css_frame *frame =3D NULL; - struct atomisp_s3a_buf *s3a_buf =3D NULL, *_s3a_buf_tmp; - struct atomisp_dis_buf *dis_buf =3D NULL, *_dis_buf_tmp; - struct atomisp_metadata_buf *md_buf =3D NULL, *_md_buf_tmp; + struct atomisp_s3a_buf *s3a_buf =3D NULL, *_s3a_buf_tmp, *s3a_iter; + struct atomisp_dis_buf *dis_buf =3D NULL, *_dis_buf_tmp, *dis_iter; + struct atomisp_metadata_buf *md_buf =3D NULL, *_md_buf_tmp, *md_iter; enum atomisp_metadata_type md_type; struct atomisp_device *isp =3D asd->isp; struct v4l2_control ctrl; @@ -942,60 +942,75 @@ void atomisp_buf_done(struct atomisp_sub =20 switch (buf_type) { case IA_CSS_BUFFER_TYPE_3A_STATISTICS: - list_for_each_entry_safe(s3a_buf, _s3a_buf_tmp, + list_for_each_entry_safe(s3a_iter, _s3a_buf_tmp, &asd->s3a_stats_in_css, list) { - if (s3a_buf->s3a_data =3D=3D + if (s3a_iter->s3a_data =3D=3D buffer.css_buffer.data.stats_3a) { - list_del_init(&s3a_buf->list); - list_add_tail(&s3a_buf->list, + list_del_init(&s3a_iter->list); + list_add_tail(&s3a_iter->list, &asd->s3a_stats_ready); + s3a_buf =3D s3a_iter; break; } } =20 asd->s3a_bufs_in_css[css_pipe_id]--; atomisp_3a_stats_ready_event(asd, buffer.css_buffer.exp_id); - dev_dbg(isp->dev, "%s: s3a stat with exp_id %d is ready\n", - __func__, s3a_buf->s3a_data->exp_id); + if (s3a_buf) + dev_dbg(isp->dev, "%s: s3a stat with exp_id %d is ready\n", + __func__, s3a_buf->s3a_data->exp_id); + else + dev_dbg(isp->dev, "%s: s3a stat is ready with no exp_id found\n", + __func__); break; case IA_CSS_BUFFER_TYPE_METADATA: if (error) break; =20 md_type =3D atomisp_get_metadata_type(asd, css_pipe_id); - list_for_each_entry_safe(md_buf, _md_buf_tmp, + list_for_each_entry_safe(md_iter, _md_buf_tmp, &asd->metadata_in_css[md_type], list) { - if (md_buf->metadata =3D=3D + if (md_iter->metadata =3D=3D buffer.css_buffer.data.metadata) { - list_del_init(&md_buf->list); - list_add_tail(&md_buf->list, + list_del_init(&md_iter->list); + list_add_tail(&md_iter->list, &asd->metadata_ready[md_type]); + md_buf =3D md_iter; break; } } asd->metadata_bufs_in_css[stream_id][css_pipe_id]--; atomisp_metadata_ready_event(asd, md_type); - dev_dbg(isp->dev, "%s: metadata with exp_id %d is ready\n", - __func__, md_buf->metadata->exp_id); + if (md_buf) + dev_dbg(isp->dev, "%s: metadata with exp_id %d is ready\n", + __func__, md_buf->metadata->exp_id); + else + dev_dbg(isp->dev, "%s: metadata is ready with no exp_id found\n", + __func__); break; case IA_CSS_BUFFER_TYPE_DIS_STATISTICS: - list_for_each_entry_safe(dis_buf, _dis_buf_tmp, + list_for_each_entry_safe(dis_iter, _dis_buf_tmp, &asd->dis_stats_in_css, list) { - if (dis_buf->dis_data =3D=3D + if (dis_iter->dis_data =3D=3D buffer.css_buffer.data.stats_dvs) { spin_lock_irqsave(&asd->dis_stats_lock, irqflags); - list_del_init(&dis_buf->list); - list_add(&dis_buf->list, &asd->dis_stats); + list_del_init(&dis_iter->list); + list_add(&dis_iter->list, &asd->dis_stats); asd->params.dis_proj_data_valid =3D true; spin_unlock_irqrestore(&asd->dis_stats_lock, irqflags); + dis_buf =3D dis_iter; break; } } asd->dis_bufs_in_css--; - dev_dbg(isp->dev, "%s: dis stat with exp_id %d is ready\n", - __func__, dis_buf->dis_data->exp_id); + if (dis_buf) + dev_dbg(isp->dev, "%s: dis stat with exp_id %d is ready\n", + __func__, dis_buf->dis_data->exp_id); + else + dev_dbg(isp->dev, "%s: dis stat is ready with no exp_id found\n", + __func__); break; case IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME: case IA_CSS_BUFFER_TYPE_SEC_VF_OUTPUT_FRAME: From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89575C25B0E for ; Mon, 15 Aug 2022 20:24:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347165AbiHOUYd (ORCPT ); Mon, 15 Aug 2022 16:24:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346746AbiHOUQX (ORCPT ); Mon, 15 Aug 2022 16:16:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4AF032EF6; Mon, 15 Aug 2022 11:59:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 42285B81106; Mon, 15 Aug 2022 18:59:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87C4DC4315C; Mon, 15 Aug 2022 18:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589988; bh=xAgZioIB4x9uXAgmjXbNJvNDtCFdqwR8DK2FLyFyvU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zFdLiEiOOVYiUPDFrCwfh0FjJJAJQFeJuF5rvoHxA0/v3M+FvOq14CewvqmK4JnCr k1gH9TjvFkLHI/MYQoQhGj7t6tdedNK79fwHNweDCQF5vudYONinD0vZfr7fhYQw8/ 6lWR/m/nwEVGr3lDL/J+vHX5GRDaLLCY+BtIBsZw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Alexander Lobakin , Andy Shevchenko , Yury Norov Subject: [PATCH 5.18 0114/1095] ia64, processor: fix -Wincompatible-pointer-types in ia64_get_irr() Date: Mon, 15 Aug 2022 19:51:53 +0200 Message-Id: <20220815180434.299615939@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Lobakin commit e5a16a5c4602c119262f350274021f90465f479d upstream. test_bit(), as any other bitmap op, takes `unsigned long *` as a second argument (pointer to the actual bitmap), as any bitmap itself is an array of unsigned longs. However, the ia64_get_irr() code passes a ref to `u64` as a second argument. This works with the ia64 bitops implementation due to that they have `void *` as the second argument and then cast it later on. This works with the bitmap API itself due to that `unsigned long` has the same size on ia64 as `u64` (`unsigned long long`), but from the compiler PoV those two are different. Define @irr as `unsigned long` to fix that. That implies no functional changes. Has been hidden for 16 years! Fixes: a58786917ce2 ("[IA64] avoid broken SAL_CACHE_FLUSH implementations") Cc: stable@vger.kernel.org # 2.6.16+ Reported-by: kernel test robot Signed-off-by: Alexander Lobakin Reviewed-by: Andy Shevchenko Reviewed-by: Yury Norov Signed-off-by: Yury Norov Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/ia64/include/asm/processor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/ia64/include/asm/processor.h +++ b/arch/ia64/include/asm/processor.h @@ -538,7 +538,7 @@ ia64_get_irr(unsigned int vector) { unsigned int reg =3D vector / 64; unsigned int bit =3D vector % 64; - u64 irr; + unsigned long irr; =20 switch (reg) { case 0: irr =3D ia64_getreg(_IA64_REG_CR_IRR0); break; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A72C9C00140 for ; Mon, 15 Aug 2022 20:24:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347353AbiHOUY3 (ORCPT ); Mon, 15 Aug 2022 16:24:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346752AbiHOUQY (ORCPT ); Mon, 15 Aug 2022 16:16:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7E3294EF9; Mon, 15 Aug 2022 11:59:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9C0B560A71; Mon, 15 Aug 2022 18:59:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98A34C433D6; Mon, 15 Aug 2022 18:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589992; bh=tgAZZLOtvTzK6B6m7eubLYnPsAEOORCC/IPidUMHRu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PRGlOvb52zTabbA5VHR9DPTtcFl+U004epY6UavdYim83Wb4TIqdDdszRcY4Mb6tm zCHhlVArKyi43RBPohfGhEN/ZTm1qKLGtpzSHhvtS9pnXcVSiMrcgY2XxM6WsixhbO Jd/j4B6LY5VEvW0uwptnmTIYYr3Dv6FRUqi2vbls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Kees Cook , Michael Ellerman Subject: [PATCH 5.18 0115/1095] powerpc: Restore CONFIG_DEBUG_INFO in defconfigs Date: Mon, 15 Aug 2022 19:51:54 +0200 Message-Id: <20220815180434.342579097@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe Leroy commit 92f89ec1b534b6eca2b81bae97d30a786932f51a upstream. Commit f9b3cd245784 ("Kconfig.debug: make DEBUG_INFO selectable from a choice") broke the selection of CONFIG_DEBUG_INFO by powerpc defconfigs. It is now necessary to select one of the three DEBUG_INFO_DWARF* options to get DEBUG_INFO enabled. Replace DEBUG_INFO=3Dy by DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy in all defconfigs using the following command: sed -i s/DEBUG_INFO=3Dy/DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy/g `git grep = -l DEBUG_INFO arch/powerpc/configs/` Fixes: f9b3cd245784 ("Kconfig.debug: make DEBUG_INFO selectable from a choi= ce") Cc: stable@vger.kernel.org Signed-off-by: Christophe Leroy Reviewed-by: Kees Cook Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/98a4c2603bf9e4b776e219f5b8541d23aa24e854.16= 54930308.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/configs/44x/akebono_defconfig | 2 +- arch/powerpc/configs/44x/currituck_defconfig | 2 +- arch/powerpc/configs/44x/fsp2_defconfig | 2 +- arch/powerpc/configs/44x/iss476-smp_defconfig | 2 +- arch/powerpc/configs/44x/warp_defconfig | 2 +- arch/powerpc/configs/52xx/lite5200b_defconfig | 2 +- arch/powerpc/configs/52xx/motionpro_defconfig | 2 +- arch/powerpc/configs/52xx/tqm5200_defconfig | 2 +- arch/powerpc/configs/adder875_defconfig | 2 +- arch/powerpc/configs/ep8248e_defconfig | 2 +- arch/powerpc/configs/ep88xc_defconfig | 2 +- arch/powerpc/configs/fsl-emb-nonhw.config | 2 +- arch/powerpc/configs/mgcoge_defconfig | 2 +- arch/powerpc/configs/mpc5200_defconfig | 2 +- arch/powerpc/configs/mpc8272_ads_defconfig | 2 +- arch/powerpc/configs/mpc885_ads_defconfig | 2 +- arch/powerpc/configs/ppc6xx_defconfig | 2 +- arch/powerpc/configs/pq2fads_defconfig | 2 +- arch/powerpc/configs/ps3_defconfig | 2 +- arch/powerpc/configs/tqm8xx_defconfig | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) --- a/arch/powerpc/configs/44x/akebono_defconfig +++ b/arch/powerpc/configs/44x/akebono_defconfig @@ -118,7 +118,7 @@ CONFIG_CRAMFS=3Dy CONFIG_NLS_DEFAULT=3D"n" CONFIG_NLS_CODEPAGE_437=3Dy CONFIG_NLS_ISO8859_1=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_MAGIC_SYSRQ=3Dy CONFIG_DETECT_HUNG_TASK=3Dy CONFIG_XMON=3Dy --- a/arch/powerpc/configs/44x/currituck_defconfig +++ b/arch/powerpc/configs/44x/currituck_defconfig @@ -73,7 +73,7 @@ CONFIG_NFS_FS=3Dy CONFIG_NFS_V3_ACL=3Dy CONFIG_NFS_V4=3Dy CONFIG_NLS_DEFAULT=3D"n" -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_MAGIC_SYSRQ=3Dy CONFIG_DETECT_HUNG_TASK=3Dy CONFIG_XMON=3Dy --- a/arch/powerpc/configs/44x/fsp2_defconfig +++ b/arch/powerpc/configs/44x/fsp2_defconfig @@ -110,7 +110,7 @@ CONFIG_XZ_DEC=3Dy CONFIG_PRINTK_TIME=3Dy CONFIG_MESSAGE_LOGLEVEL_DEFAULT=3D3 CONFIG_DYNAMIC_DEBUG=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_MAGIC_SYSRQ=3Dy CONFIG_DETECT_HUNG_TASK=3Dy CONFIG_CRYPTO_CBC=3Dy --- a/arch/powerpc/configs/44x/iss476-smp_defconfig +++ b/arch/powerpc/configs/44x/iss476-smp_defconfig @@ -56,7 +56,7 @@ CONFIG_PROC_KCORE=3Dy CONFIG_TMPFS=3Dy CONFIG_CRAMFS=3Dy # CONFIG_NETWORK_FILESYSTEMS is not set -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_MAGIC_SYSRQ=3Dy CONFIG_DETECT_HUNG_TASK=3Dy CONFIG_PPC_EARLY_DEBUG=3Dy --- a/arch/powerpc/configs/44x/warp_defconfig +++ b/arch/powerpc/configs/44x/warp_defconfig @@ -88,7 +88,7 @@ CONFIG_NLS_UTF8=3Dy CONFIG_CRC_CCITT=3Dy CONFIG_CRC_T10DIF=3Dy CONFIG_PRINTK_TIME=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_DEBUG_FS=3Dy CONFIG_MAGIC_SYSRQ=3Dy CONFIG_DETECT_HUNG_TASK=3Dy --- a/arch/powerpc/configs/52xx/lite5200b_defconfig +++ b/arch/powerpc/configs/52xx/lite5200b_defconfig @@ -58,6 +58,6 @@ CONFIG_NFS_FS=3Dy CONFIG_NFS_V4=3Dy CONFIG_ROOT_NFS=3Dy CONFIG_PRINTK_TIME=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_DETECT_HUNG_TASK=3Dy # CONFIG_DEBUG_BUGVERBOSE is not set --- a/arch/powerpc/configs/52xx/motionpro_defconfig +++ b/arch/powerpc/configs/52xx/motionpro_defconfig @@ -84,7 +84,7 @@ CONFIG_ROOT_NFS=3Dy CONFIG_NLS_CODEPAGE_437=3Dy CONFIG_NLS_ISO8859_1=3Dy CONFIG_PRINTK_TIME=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_DETECT_HUNG_TASK=3Dy # CONFIG_DEBUG_BUGVERBOSE is not set CONFIG_CRYPTO_ECB=3Dy --- a/arch/powerpc/configs/52xx/tqm5200_defconfig +++ b/arch/powerpc/configs/52xx/tqm5200_defconfig @@ -85,7 +85,7 @@ CONFIG_ROOT_NFS=3Dy CONFIG_NLS_CODEPAGE_437=3Dy CONFIG_NLS_ISO8859_1=3Dy CONFIG_PRINTK_TIME=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_DETECT_HUNG_TASK=3Dy # CONFIG_DEBUG_BUGVERBOSE is not set CONFIG_CRYPTO_ECB=3Dy --- a/arch/powerpc/configs/adder875_defconfig +++ b/arch/powerpc/configs/adder875_defconfig @@ -45,7 +45,7 @@ CONFIG_CRAMFS=3Dy CONFIG_NFS_FS=3Dy CONFIG_ROOT_NFS=3Dy CONFIG_CRC32_SLICEBY4=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_DEBUG_FS=3Dy CONFIG_MAGIC_SYSRQ=3Dy CONFIG_DETECT_HUNG_TASK=3Dy --- a/arch/powerpc/configs/ep8248e_defconfig +++ b/arch/powerpc/configs/ep8248e_defconfig @@ -59,7 +59,7 @@ CONFIG_NLS_CODEPAGE_437=3Dy CONFIG_NLS_ASCII=3Dy CONFIG_NLS_ISO8859_1=3Dy CONFIG_NLS_UTF8=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_MAGIC_SYSRQ=3Dy # CONFIG_SCHED_DEBUG is not set CONFIG_BDI_SWITCH=3Dy --- a/arch/powerpc/configs/ep88xc_defconfig +++ b/arch/powerpc/configs/ep88xc_defconfig @@ -48,6 +48,6 @@ CONFIG_CRAMFS=3Dy CONFIG_NFS_FS=3Dy CONFIG_ROOT_NFS=3Dy CONFIG_CRC32_SLICEBY4=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_MAGIC_SYSRQ=3Dy CONFIG_DETECT_HUNG_TASK=3Dy --- a/arch/powerpc/configs/fsl-emb-nonhw.config +++ b/arch/powerpc/configs/fsl-emb-nonhw.config @@ -24,7 +24,7 @@ CONFIG_CRYPTO_PCBC=3Dm CONFIG_CRYPTO_SHA256=3Dy CONFIG_CRYPTO_SHA512=3Dy CONFIG_DEBUG_FS=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_DEBUG_KERNEL=3Dy CONFIG_DEBUG_SHIRQ=3Dy CONFIG_DETECT_HUNG_TASK=3Dy --- a/arch/powerpc/configs/mgcoge_defconfig +++ b/arch/powerpc/configs/mgcoge_defconfig @@ -73,7 +73,7 @@ CONFIG_NLS_CODEPAGE_437=3Dy CONFIG_NLS_ASCII=3Dy CONFIG_NLS_ISO8859_1=3Dy CONFIG_NLS_UTF8=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_DEBUG_FS=3Dy CONFIG_MAGIC_SYSRQ=3Dy # CONFIG_SCHED_DEBUG is not set --- a/arch/powerpc/configs/mpc5200_defconfig +++ b/arch/powerpc/configs/mpc5200_defconfig @@ -122,6 +122,6 @@ CONFIG_ROOT_NFS=3Dy CONFIG_NLS_CODEPAGE_437=3Dy CONFIG_NLS_ISO8859_1=3Dy CONFIG_PRINTK_TIME=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_DEBUG_KERNEL=3Dy CONFIG_DETECT_HUNG_TASK=3Dy --- a/arch/powerpc/configs/mpc8272_ads_defconfig +++ b/arch/powerpc/configs/mpc8272_ads_defconfig @@ -67,7 +67,7 @@ CONFIG_NLS_CODEPAGE_437=3Dy CONFIG_NLS_ASCII=3Dy CONFIG_NLS_ISO8859_1=3Dy CONFIG_NLS_UTF8=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_MAGIC_SYSRQ=3Dy CONFIG_DETECT_HUNG_TASK=3Dy CONFIG_BDI_SWITCH=3Dy --- a/arch/powerpc/configs/mpc885_ads_defconfig +++ b/arch/powerpc/configs/mpc885_ads_defconfig @@ -71,7 +71,7 @@ CONFIG_ROOT_NFS=3Dy CONFIG_CRYPTO=3Dy CONFIG_CRYPTO_DEV_TALITOS=3Dy CONFIG_CRC32_SLICEBY4=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_MAGIC_SYSRQ=3Dy CONFIG_DEBUG_FS=3Dy CONFIG_DEBUG_VM_PGTABLE=3Dy --- a/arch/powerpc/configs/ppc6xx_defconfig +++ b/arch/powerpc/configs/ppc6xx_defconfig @@ -1066,7 +1066,7 @@ CONFIG_NLS_ISO8859_14=3Dm CONFIG_NLS_ISO8859_15=3Dm CONFIG_NLS_KOI8_R=3Dm CONFIG_NLS_KOI8_U=3Dm -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_HEADERS_INSTALL=3Dy CONFIG_MAGIC_SYSRQ=3Dy CONFIG_DEBUG_KERNEL=3Dy --- a/arch/powerpc/configs/pq2fads_defconfig +++ b/arch/powerpc/configs/pq2fads_defconfig @@ -68,7 +68,7 @@ CONFIG_NLS_CODEPAGE_437=3Dy CONFIG_NLS_ASCII=3Dy CONFIG_NLS_ISO8859_1=3Dy CONFIG_NLS_UTF8=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_MAGIC_SYSRQ=3Dy CONFIG_DETECT_HUNG_TASK=3Dy # CONFIG_SCHED_DEBUG is not set --- a/arch/powerpc/configs/ps3_defconfig +++ b/arch/powerpc/configs/ps3_defconfig @@ -153,7 +153,7 @@ CONFIG_NLS_CODEPAGE_437=3Dy CONFIG_NLS_ISO8859_1=3Dy CONFIG_CRC_CCITT=3Dm CONFIG_CRC_T10DIF=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_MAGIC_SYSRQ=3Dy CONFIG_DEBUG_MEMORY_INIT=3Dy CONFIG_DEBUG_STACKOVERFLOW=3Dy --- a/arch/powerpc/configs/tqm8xx_defconfig +++ b/arch/powerpc/configs/tqm8xx_defconfig @@ -55,6 +55,6 @@ CONFIG_CRAMFS=3Dy CONFIG_NFS_FS=3Dy CONFIG_ROOT_NFS=3Dy CONFIG_CRC32_SLICEBY4=3Dy -CONFIG_DEBUG_INFO=3Dy +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_MAGIC_SYSRQ=3Dy CONFIG_DETECT_HUNG_TASK=3Dy From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9157AC25B08 for ; Mon, 15 Aug 2022 20:24:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347367AbiHOUYh (ORCPT ); Mon, 15 Aug 2022 16:24:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346783AbiHOUQZ (ORCPT ); Mon, 15 Aug 2022 16:16:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46E44956A4; Mon, 15 Aug 2022 11:59:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B7C1A61298; Mon, 15 Aug 2022 18:59:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABEC9C433C1; Mon, 15 Aug 2022 18:59:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589995; bh=DA07pS56JTqxEH7F9nSRAEZuGciygVBfy8ihzvPEWSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EILuBg0EXQ1NIPQ5XdKJcps3rWPjaljX1F/NO0ChS1GX0Lcz5tTPhNdcK82lcRSmY FY8Et3VhIh6tTJInLpL8Q7xx3Uc5S/nQjFgEwuwqUopKgyBXVsN2uMQS1pqvpUAneF YZGxEZr/VdLocHBvChrdC9XmUhjjBVpdVoiE1faU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman Subject: [PATCH 5.18 0116/1095] powerpc/64e: Fix early TLB miss with KUAP Date: Mon, 15 Aug 2022 19:51:55 +0200 Message-Id: <20220815180434.391862475@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe Leroy commit 09317643117ade87c03158341e87466413fa8f1a upstream. With KUAP, the TLB miss handler bails out when an access to user memory is performed with a nul TID. But the normal TLB miss routine which is only used early during boot does the check regardless for all memory areas, not only user memory. By chance there is no early IO or vmalloc access, but when KASAN come we will start having early TLB misses. Fix it by creating a special branch for user accesses similar to the one in the 'bolted' TLB miss handlers. Unfortunately SPRN_MAS1 is now read too early and there are no registers available to preserve it so it will be read a second time. Fixes: 57bc963837f5 ("powerpc/kuap: Wire-up KUAP on book3e/64") Cc: stable@vger.kernel.org Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/8d6c5859a45935d6e1a336da4dc20be421e8cea7.16= 56427701.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/mm/nohash/tlb_low_64e.S | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/mm/nohash/tlb_low_64e.S b/arch/powerpc/mm/nohash/= tlb_low_64e.S index 8b97c4acfebf..9e9ab3803fb2 100644 --- a/arch/powerpc/mm/nohash/tlb_low_64e.S +++ b/arch/powerpc/mm/nohash/tlb_low_64e.S @@ -583,7 +583,7 @@ itlb_miss_fault_e6500: */ rlwimi r11,r14,32-19,27,27 rlwimi r11,r14,32-16,19,19 - beq normal_tlb_miss + beq normal_tlb_miss_user /* XXX replace the RMW cycles with immediate loads + writes */ 1: mfspr r10,SPRN_MAS1 cmpldi cr0,r15,8 /* Check for vmalloc region */ @@ -626,7 +626,7 @@ itlb_miss_fault_e6500: =20 cmpldi cr0,r15,0 /* Check for user region */ std r14,EX_TLB_ESR(r12) /* write crazy -1 to frame */ - beq normal_tlb_miss + beq normal_tlb_miss_user =20 li r11,_PAGE_PRESENT|_PAGE_BAP_SX /* Base perm */ oris r11,r11,_PAGE_ACCESSED@h @@ -653,6 +653,12 @@ itlb_miss_fault_e6500: * r11 =3D PTE permission mask * r10 =3D crap (free to use) */ +normal_tlb_miss_user: +#ifdef CONFIG_PPC_KUAP + mfspr r14,SPRN_MAS1 + rlwinm. r14,r14,0,0x3fff0000 + beq- normal_tlb_miss_access_fault /* KUAP fault */ +#endif normal_tlb_miss: /* So we first construct the page table address. We do that by * shifting the bottom of the address (not the region ID) by @@ -683,11 +689,6 @@ finish_normal_tlb_miss: /* Check if required permissions are met */ andc. r15,r11,r14 bne- normal_tlb_miss_access_fault -#ifdef CONFIG_PPC_KUAP - mfspr r11,SPRN_MAS1 - rlwinm. r10,r11,0,0x3fff0000 - beq- normal_tlb_miss_access_fault /* KUAP fault */ -#endif =20 /* Now we build the MAS: * @@ -709,9 +710,7 @@ finish_normal_tlb_miss: rldicl r10,r14,64-8,64-8 cmpldi cr0,r10,BOOK3E_PAGESZ_4K beq- 1f -#ifndef CONFIG_PPC_KUAP mfspr r11,SPRN_MAS1 -#endif rlwimi r11,r14,31,21,24 rlwinm r11,r11,0,21,19 mtspr SPRN_MAS1,r11 --=20 2.37.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AB5CC00140 for ; Mon, 15 Aug 2022 20:24:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347227AbiHOUYn (ORCPT ); Mon, 15 Aug 2022 16:24:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346849AbiHOUQ2 (ORCPT ); Mon, 15 Aug 2022 16:16:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92B8595AD9; Mon, 15 Aug 2022 11:59:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B4D5D6123F; Mon, 15 Aug 2022 18:59:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B530CC433D6; Mon, 15 Aug 2022 18:59:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589998; bh=kydCZxS2HyPc3cC1Mr1++qUBFTk6gJM/dRcmOx+uCNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SnZM311yGOTryIeoOJFADGc5/YlUMIrtTEI7ORccnaXgbXrBRENULoaGSs2dISXq8 8SWgvIFQscsjUo2n61eJoKNuxNKJgAEk3lfajHzU6xA7nFUwdCotg+Vk+Hw+8FkW0L K9OaN5G37e/BwLoGCydIARFuB8bcIYm3KBMZLkAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Michael Ellerman Subject: [PATCH 5.18 0117/1095] powerpc/fsl-pci: Fix Class Code of PCIe Root Port Date: Mon, 15 Aug 2022 19:51:56 +0200 Message-Id: <20220815180434.428906712@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Roh=C3=A1r commit 0c551abfa004ce154d487d91777bf221c808a64f upstream. By default old pre-3.0 Freescale PCIe controllers reports invalid PCI Class Code 0x0b20 for PCIe Root Port. It can be seen by lspci -b output on P2020 board which has this pre-3.0 controller: $ lspci -bvnn 00:00.0 Power PC [0b20]: Freescale Semiconductor Inc P2020E [1957:0070] (= rev 21) !!! Invalid class 0b20 for header type 01 Capabilities: [4c] Express Root Port (Slot-), MSI 00 Fix this issue by programming correct PCI Class Code 0x0604 for PCIe Root Port to the Freescale specific PCIe register 0x474. With this change lspci -b output is: $ lspci -bvnn 00:00.0 PCI bridge [0604]: Freescale Semiconductor Inc P2020E [1957:0070]= (rev 21) (prog-if 00 [Normal decode]) Capabilities: [4c] Express Root Port (Slot-), MSI 00 Without any "Invalid class" error. So class code was properly reflected into standard (read-only) PCI register 0x08. Same fix is already implemented in U-Boot pcie_fsl.c driver in commit: http://source.denx.de/u-boot/u-boot/-/commit/d18d06ac35229345a0af80977a408c= fbe1d1015b Fix activated by U-Boot stay active also after booting Linux kernel. But boards which use older U-Boot version without that fix are affected and still require this fix. So implement this class code fix also in kernel fsl_pci.c driver. Cc: stable@vger.kernel.org Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220706101043.4867-1-pali@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/sysdev/fsl_pci.c | 8 ++++++++ arch/powerpc/sysdev/fsl_pci.h | 1 + 2 files changed, 9 insertions(+) --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c @@ -520,6 +520,7 @@ int fsl_add_bridge(struct platform_devic struct resource rsrc; const int *bus_range; u8 hdr_type, progif; + u32 class_code; struct device_node *dev; struct ccsr_pci __iomem *pci; u16 temp; @@ -593,6 +594,13 @@ int fsl_add_bridge(struct platform_devic PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS; if (fsl_pcie_check_link(hose)) hose->indirect_type |=3D PPC_INDIRECT_TYPE_NO_PCIE_LINK; + /* Fix Class Code to PCI_CLASS_BRIDGE_PCI_NORMAL for pre-3.0 controller = */ + if (in_be32(&pci->block_rev1) < PCIE_IP_REV_3_0) { + early_read_config_dword(hose, 0, 0, PCIE_FSL_CSR_CLASSCODE, &class_code= ); + class_code &=3D 0xff; + class_code |=3D PCI_CLASS_BRIDGE_PCI_NORMAL << 8; + early_write_config_dword(hose, 0, 0, PCIE_FSL_CSR_CLASSCODE, class_code= ); + } } else { /* * Set PBFR(PCI Bus Function Register)[10] =3D 1 to --- a/arch/powerpc/sysdev/fsl_pci.h +++ b/arch/powerpc/sysdev/fsl_pci.h @@ -18,6 +18,7 @@ struct platform_device; =20 #define PCIE_LTSSM 0x0404 /* PCIE Link Training and Status */ #define PCIE_LTSSM_L0 0x16 /* L0 state */ +#define PCIE_FSL_CSR_CLASSCODE 0x474 /* FSL GPEX CSR */ #define PCIE_IP_REV_2_2 0x02080202 /* PCIE IP block version Rev2.2 */ #define PCIE_IP_REV_3_0 0x02080300 /* PCIE IP block version Rev3.0 */ #define PIWAR_EN 0x80000000 /* Enable */ From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DC18C00140 for ; Mon, 15 Aug 2022 20:24:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347307AbiHOUYu (ORCPT ); Mon, 15 Aug 2022 16:24:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346975AbiHOUQh (ORCPT ); Mon, 15 Aug 2022 16:16:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F7C996740; Mon, 15 Aug 2022 12:00:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 894D4B810A1; Mon, 15 Aug 2022 19:00:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99F3BC433C1; Mon, 15 Aug 2022 19:00:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590001; bh=3C0nmz2bwUw/YhMXl/4vqecM80SkN232zvqvmAcwXbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IOd+G3luXMEBFXJ8K6iKlUb42v+B4AkADjdBqZtsAb0fPetkraMIPHJCuetAjGv44 CsoZUZrISIa5Zi4/aFDE0GaaX9MNe1jOUb80DpsrE78PAktHY5I88ldY2OGaAxRNO5 TTE/WWPwYEZ4J9MlxOypOr+27n+U2WAXiA71cP90= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman Subject: [PATCH 5.18 0118/1095] powerpc/ptdump: Fix display of RW pages on FSL_BOOK3E Date: Mon, 15 Aug 2022 19:51:57 +0200 Message-Id: <20220815180434.466780189@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe Leroy commit dd8de84b57b02ba9c1fe530a6d916c0853f136bd upstream. On FSL_BOOK3E, _PAGE_RW is defined with two bits, one for user and one for supervisor. As soon as one of the two bits is set, the page has to be display as RW. But the way it is implemented today requires both bits to be set in order to display it as RW. Instead of display RW when _PAGE_RW bits are set and R otherwise, reverse the logic and display R when _PAGE_RW bits are all 0 and RW otherwise. This change has no impact on other platforms as _PAGE_RW is a single bit on all of them. Fixes: 8eb07b187000 ("powerpc/mm: Dump linux pagetables") Cc: stable@vger.kernel.org Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/0c33b96317811edf691e81698aaee8fa45ec3449.16= 56427391.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/mm/ptdump/shared.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/arch/powerpc/mm/ptdump/shared.c +++ b/arch/powerpc/mm/ptdump/shared.c @@ -17,9 +17,9 @@ static const struct flag_info flag_array .clear =3D " ", }, { .mask =3D _PAGE_RW, - .val =3D _PAGE_RW, - .set =3D "rw", - .clear =3D "r ", + .val =3D 0, + .set =3D "r ", + .clear =3D "rw", }, { .mask =3D _PAGE_EXEC, .val =3D _PAGE_EXEC, From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61733C00140 for ; Mon, 15 Aug 2022 20:25:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347324AbiHOUZB (ORCPT ); Mon, 15 Aug 2022 16:25:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347070AbiHOUQq (ORCPT ); Mon, 15 Aug 2022 16:16:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2501D9676E; Mon, 15 Aug 2022 12:00:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 67601B81107; Mon, 15 Aug 2022 19:00:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5B27C433C1; Mon, 15 Aug 2022 19:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590004; bh=b09QnvDg7xfHPslMRVg7vHUSCPbJTeYQlqKvtTja7U4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iDGCABB0x9Bf7NiprYHOjZJu6ucO6Wuc5KvLGbxz7VYGRf9iQ4CuZusQrw1cSLNFn TWZwyhkVk9ClcFJGApSSlbY1d+I55wtVitLn2GzFPxG4XI4xmZhVm7D271sFz7w3eA zyVMbwreHFqme9BkYw5EMcu99Ym0BgyZGOvXYBTw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Michael Ellerman Subject: [PATCH 5.18 0119/1095] powerpc/powernv: Avoid crashing if rng is NULL Date: Mon, 15 Aug 2022 19:51:58 +0200 Message-Id: <20220815180434.515138467@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Ellerman commit 90b5d4fe0b3ba7f589c6723c6bfb559d9e83956a upstream. On a bare-metal Power8 system that doesn't have an "ibm,power-rng", a malicious QEMU and guest that ignore the absence of the KVM_CAP_PPC_HWRNG flag, and calls H_RANDOM anyway, will dereference a NULL pointer. In practice all Power8 machines have an "ibm,power-rng", but let's not rely on that, add a NULL check and early return in powernv_get_random_real_mode(). Fixes: e928e9cb3601 ("KVM: PPC: Book3S HV: Add fast real-mode H_RANDOM impl= ementation.") Cc: stable@vger.kernel.org # v4.1+ Signed-off-by: Jason A. Donenfeld Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220727143219.2684192-1-mpe@ellerman.id.au Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/platforms/powernv/rng.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/powerpc/platforms/powernv/rng.c +++ b/arch/powerpc/platforms/powernv/rng.c @@ -63,6 +63,8 @@ int powernv_get_random_real_mode(unsigne struct powernv_rng *rng; =20 rng =3D raw_cpu_read(powernv_rng); + if (!rng) + return 0; =20 *v =3D rng_whiten(rng, __raw_rm_readq(rng->regs_real)); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17E18C00140 for ; Mon, 15 Aug 2022 20:25:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343633AbiHOUZI (ORCPT ); Mon, 15 Aug 2022 16:25:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347112AbiHOUQs (ORCPT ); Mon, 15 Aug 2022 16:16:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8BAF96FC4; Mon, 15 Aug 2022 12:00:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 00E1CB8105C; Mon, 15 Aug 2022 19:00:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98016C43149; Mon, 15 Aug 2022 19:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590007; bh=wvc3E1EFaheSgEH27n9kYnhbwa1Gw0oOlNfHfE0HT7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YSHKh2ouC3HP6kv+VijJgiLKil2LKtJyoeaPSvW+4F9dO1Jaj1jxJLHbGD4CcwiBL 3qcPoHgQiJD8SgiKXwulhX8N5ZjiB55P1qytc9JacvmxTTnicsnTX5+bTsPs2TQeGP a7SuMUM/Ob4R6b+3I9hTheHOZGNueChSjQkh7kuU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huacai Chen , Thomas Bogendoerfer Subject: [PATCH 5.18 0120/1095] MIPS: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK Date: Mon, 15 Aug 2022 19:51:59 +0200 Message-Id: <20220815180434.552155382@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Huacai Chen commit e1a534f5d074db45ae5cbac41d8912b98e96a006 upstream. When CONFIG_CPUMASK_OFFSTACK and CONFIG_DEBUG_PER_CPU_MAPS is selected, cpu_max_bits_warn() generates a runtime warning similar as below while we show /proc/cpuinfo. Fix this by using nr_cpu_ids (the runtime limit) instead of NR_CPUS to iterate CPUs. [ 3.052463] ------------[ cut here ]------------ [ 3.059679] WARNING: CPU: 3 PID: 1 at include/linux/cpumask.h:108 show_c= puinfo+0x5e8/0x5f0 [ 3.070072] Modules linked in: efivarfs autofs4 [ 3.076257] CPU: 0 PID: 1 Comm: systemd Not tainted 5.19-rc5+ #1052 [ 3.084034] Hardware name: Loongson Loongson-3A4000-7A1000-1w-V0.1-CRB/L= oongson-LS3A4000-7A1000-1w-EVB-V1.21, BIOS Loongson-UDK2018-V2.0.04082-beta= 7 04/27 [ 3.099465] Stack : 9000000100157b08 9000000000f18530 9000000000cf846c 9= 000000100154000 [ 3.109127] 9000000100157a50 0000000000000000 9000000100157a58 9= 000000000ef7430 [ 3.118774] 90000001001578e8 0000000000000040 0000000000000020 f= fffffffffffffff [ 3.128412] 0000000000aaaaaa 1ab25f00eec96a37 900000010021de80 9= 00000000101c890 [ 3.138056] 0000000000000000 0000000000000000 0000000000000000 0= 000000000aaaaaa [ 3.147711] ffff8000339dc220 0000000000000001 0000000006ab4000 0= 000000000000000 [ 3.157364] 900000000101c998 0000000000000004 9000000000ef7430 0= 000000000000000 [ 3.167012] 0000000000000009 000000000000006c 0000000000000000 0= 000000000000000 [ 3.176641] 9000000000d3de08 9000000001639390 90000000002086d8 0= 0007ffff0080286 [ 3.186260] 00000000000000b0 0000000000000004 0000000000000000 0= 000000000071c1c [ 3.195868] ... [ 3.199917] Call Trace: [ 3.203941] [<98000000002086d8>] show_stack+0x38/0x14c [ 3.210666] [<9800000000cf846c>] dump_stack_lvl+0x60/0x88 [ 3.217625] [<980000000023d268>] __warn+0xd0/0x100 [ 3.223958] [<9800000000cf3c90>] warn_slowpath_fmt+0x7c/0xcc [ 3.231150] [<9800000000210220>] show_cpuinfo+0x5e8/0x5f0 [ 3.238080] [<98000000004f578c>] seq_read_iter+0x354/0x4b4 [ 3.245098] [<98000000004c2e90>] new_sync_read+0x17c/0x1c4 [ 3.252114] [<98000000004c5174>] vfs_read+0x138/0x1d0 [ 3.258694] [<98000000004c55f8>] ksys_read+0x70/0x100 [ 3.265265] [<9800000000cfde9c>] do_syscall+0x7c/0x94 [ 3.271820] [<9800000000202fe4>] handle_syscall+0xc4/0x160 [ 3.281824] ---[ end trace 8b484262b4b8c24c ]--- Cc: stable@vger.kernel.org Signed-off-by: Huacai Chen Signed-off-by: Thomas Bogendoerfer Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/mips/kernel/proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/mips/kernel/proc.c +++ b/arch/mips/kernel/proc.c @@ -311,7 +311,7 @@ static void *c_start(struct seq_file *m, { unsigned long i =3D *pos; =20 - return i < NR_CPUS ? (void *) (i + 1) : NULL; + return i < nr_cpu_ids ? (void *) (i + 1) : NULL; } =20 static void *c_next(struct seq_file *m, void *v, loff_t *pos) From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9CC8C25B08 for ; Mon, 15 Aug 2022 20:24:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243780AbiHOUY5 (ORCPT ); Mon, 15 Aug 2022 16:24:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347042AbiHOUQp (ORCPT ); Mon, 15 Aug 2022 16:16:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C977896FE4; Mon, 15 Aug 2022 12:00:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DF86DB8110A; Mon, 15 Aug 2022 19:00:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 361FDC433D6; Mon, 15 Aug 2022 19:00:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590010; bh=0LWknksfOpS8e6YkW3M3ixXPi6jwfA7UCN/Od+f5rkQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LW4WNO0JqQg4GqzQ3/TODac2zUDzjipazqWdK0XkebA5kPWxID4+gST7+z5wj+SXc cZ5C3aNSBL31pjamMn3eAJ6gIBRN1uJyV20X0Y/yCrwbUwQB3/4DBsi+tKJSqPyI2s LcFoPnoEiqeH7AcIsf0cEtXBc9iaq8YM2RkrXbRI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathieu Poirier , Mike Leach , Leo Yan , Suzuki K Poulose Subject: [PATCH 5.18 0121/1095] coresight: Clear the connection field properly Date: Mon, 15 Aug 2022 19:52:00 +0200 Message-Id: <20220815180434.591880012@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Suzuki K Poulose commit 2af89ebacf299b7fba5f3087d35e8a286ec33706 upstream. coresight devices track their connections (output connections) and hold a reference to the fwnode. When a device goes away, we walk through the devices on the coresight bus and make sure that the references are dropped. This happens both ways: a) For all output connections from the device, drop the reference to the target device via coresight_release_platform_data() b) Iterate over all the devices on the coresight bus and drop the reference to fwnode if *this* device is the target of the output connection, via coresight_remove_conns()->coresight_remove_match(). However, the coresight_remove_match() doesn't clear the fwnode field, after dropping the reference, this causes use-after-free and additional refcount drops on the fwnode. e.g., if we have two devices, A and B, with a connection, A -> B. If we remove B first, B would clear the reference on B, from A via coresight_remove_match(). But when A is removed, it still has a connection with fwnode still pointing to B. Thus it tries to drops the reference in coresight_release_platform_data(), raising the bells like : [ 91.990153] ------------[ cut here ]------------ [ 91.990163] refcount_t: addition on 0; use-after-free. [ 91.990212] WARNING: CPU: 0 PID: 461 at lib/refcount.c:25 refcount_warn_= saturate+0xa0/0x144 [ 91.990260] Modules linked in: coresight_funnel coresight_replicator cor= esight_etm4x(-) crct10dif_ce coresight ip_tables x_tables ipv6 [last unloaded: coresight_c= pu_debug] [ 91.990398] CPU: 0 PID: 461 Comm: rmmod Tainted: G W T 5.19= .0-rc2+ #53 [ 91.990418] Hardware name: ARM LTD ARM Juno Development Platform/ARM Jun= o Development Platform, BIOS EDK II Feb 1 2019 [ 91.990434] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE= =3D--) [ 91.990454] pc : refcount_warn_saturate+0xa0/0x144 [ 91.990476] lr : refcount_warn_saturate+0xa0/0x144 [ 91.990496] sp : ffff80000c843640 [ 91.990509] x29: ffff80000c843640 x28: ffff800009957c28 x27: ffff80000c8= 439a8 [ 91.990560] x26: ffff00097eff1990 x25: ffff8000092b6ad8 x24: ffff00097ef= f19a8 [ 91.990610] x23: ffff80000c8439a8 x22: 0000000000000000 x21: ffff80000c8= 439c2 [ 91.990659] x20: 0000000000000000 x19: ffff00097eff1a10 x18: ffff80000ab= 99c40 [ 91.990708] x17: 0000000000000000 x16: 0000000000000000 x15: ffff80000ab= f6fa0 [ 91.990756] x14: 000000000000001d x13: 0a2e656572662d72 x12: 657466612d6= 57375 [ 91.990805] x11: 203b30206e6f206e x10: 6f69746964646120 x9 : ffff8000081= aba28 [ 91.990854] x8 : 206e6f206e6f6974 x7 : 69646461203a745f x6 : 746e756f636= 66572 [ 91.990903] x5 : ffff00097648ec58 x4 : 0000000000000000 x3 : 00000000000= 00027 [ 91.990952] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0008026= 0ba00 [ 91.991000] Call trace: [ 91.991012] refcount_warn_saturate+0xa0/0x144 [ 91.991034] kobject_get+0xac/0xb0 [ 91.991055] of_node_get+0x2c/0x40 [ 91.991076] of_fwnode_get+0x40/0x60 [ 91.991094] fwnode_handle_get+0x3c/0x60 [ 91.991116] fwnode_get_nth_parent+0xf4/0x110 [ 91.991137] fwnode_full_name_string+0x48/0xc0 [ 91.991158] device_node_string+0x41c/0x530 [ 91.991178] pointer+0x320/0x3ec [ 91.991198] vsnprintf+0x23c/0x750 [ 91.991217] vprintk_store+0x104/0x4b0 [ 91.991238] vprintk_emit+0x8c/0x360 [ 91.991257] vprintk_default+0x44/0x50 [ 91.991276] vprintk+0xcc/0xf0 [ 91.991295] _printk+0x68/0x90 [ 91.991315] of_node_release+0x13c/0x14c [ 91.991334] kobject_put+0x98/0x114 [ 91.991354] of_node_put+0x24/0x34 [ 91.991372] of_fwnode_put+0x40/0x5c [ 91.991390] fwnode_handle_put+0x38/0x50 [ 91.991411] coresight_release_platform_data+0x74/0xb0 [coresight] [ 91.991472] coresight_unregister+0x64/0xcc [coresight] [ 91.991525] etm4_remove_dev+0x64/0x78 [coresight_etm4x] [ 91.991563] etm4_remove_amba+0x1c/0x2c [coresight_etm4x] [ 91.991598] amba_remove+0x3c/0x19c Reproducible by: (Build all coresight components as modules): #!/bin/sh while true do for m in tmc stm cpu_debug etm4x replicator funnel do modprobe coresight_${m} done for m in tmc stm cpu_debug etm4x replicator funnel do rmmode coresight_${m} done done Cc: stable@vger.kernel.org Cc: Mathieu Poirier Cc: Mike Leach Cc: Leo Yan Signed-off-by: Suzuki K Poulose Fixes: 37ea1ffddffa ("coresight: Use fwnode handle instead of device names") Link: https://lore.kernel.org/r/20220614214024.3005275-1-suzuki.poulose@arm= .com Signed-off-by: Mathieu Poirier Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hwtracing/coresight/coresight-core.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -1424,6 +1424,7 @@ static int coresight_remove_match(struct * platform data. */ fwnode_handle_put(conn->child_fwnode); + conn->child_fwnode =3D NULL; /* No need to continue */ break; } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28D5DC25B08 for ; Mon, 15 Aug 2022 20:25:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347410AbiHOUZS (ORCPT ); Mon, 15 Aug 2022 16:25:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240593AbiHOURE (ORCPT ); Mon, 15 Aug 2022 16:17:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24A40F48; Mon, 15 Aug 2022 12:00:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BD2F2B8110B; Mon, 15 Aug 2022 19:00:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25208C433B5; Mon, 15 Aug 2022 19:00:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590013; bh=FU1YbE1E2NkvVleTcRnvyZW61eUHNYJXk19HtY0RX9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bR9ieCzQucUwbzRG2hTXlxUYajypsp2tviRcVGbNG5VtJXm0stsxlc4UCnlfU9Mwf TdAAmFsgI9urgWZzFjZ/xnryuvenrVHAp5GaLwJqTksYr1qZ7qKg7/mIbrKQdvW662 +CjFroXSdGLVj+nEC4u8IyC+5en07boZh+nXTRqI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Pham , Linyu Yuan Subject: [PATCH 5.18 0122/1095] usb: typec: ucsi: Acknowledge the GET_ERROR_STATUS command completion Date: Mon, 15 Aug 2022 19:52:01 +0200 Message-Id: <20220815180434.641471278@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linyu Yuan commit a7dc438b5e446afcd1b3b6651da28271400722f2 upstream. We found PPM will not send any notification after it report error status and OPM issue GET_ERROR_STATUS command to read the details about error. According UCSI spec, PPM may clear the Error Status Data after the OPM has acknowledged the command completion. This change add operation to acknowledge the command completion from PPM. Fixes: bdc62f2bae8f (usb: typec: ucsi: Simplified registration and I/O API) Cc: # 5.10 Signed-off-by: Jack Pham Signed-off-by: Linyu Yuan Link: https://lore.kernel.org/r/1658817949-4632-1-git-send-email-quic_linyy= uan@quicinc.com Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/typec/ucsi/ucsi.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -76,6 +76,10 @@ static int ucsi_read_error(struct ucsi * if (ret) return ret; =20 + ret =3D ucsi_acknowledge_command(ucsi); + if (ret) + return ret; + switch (error) { case UCSI_ERROR_INCOMPATIBLE_PARTNER: return -EOPNOTSUPP; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26E26C25B08 for ; Mon, 15 Aug 2022 20:25:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347354AbiHOUZe (ORCPT ); Mon, 15 Aug 2022 16:25:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241742AbiHOURH (ORCPT ); Mon, 15 Aug 2022 16:17:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B15D101B; Mon, 15 Aug 2022 12:00:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 98E24B81115; Mon, 15 Aug 2022 19:00:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F369DC433B5; Mon, 15 Aug 2022 19:00:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590016; bh=fhXmri8Qjp0EzDtGXhrJdIiFlwZJ7xvylvHa/3A9hao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NbOMqqtCiV2KFUEkk28wbdP1LoSVoRWWuX009YA6PpOS2bbo4JDNme0TGtyPtvEhy GsayaaaaUi8UpCv7b73B4cxEmjRV9LBMLihS+7X9VmtBxJAGdI75WfEQxRHFOjCvk5 9J2tBjUZhsPee5fuDfwNI51yPkqAvFajZaHJzLTg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Alan Stern , Weitao Wang Subject: [PATCH 5.18 0123/1095] USB: HCD: Fix URB giveback issue in tasklet function Date: Mon, 15 Aug 2022 19:52:02 +0200 Message-Id: <20220815180434.674250255@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Weitao Wang commit 26c6c2f8a907c9e3a2f24990552a4d77235791e6 upstream. Usb core introduce the mechanism of giveback of URB in tasklet context to reduce hardware interrupt handling time. On some test situation(such as FIO with 4KB block size), when tasklet callback function called to giveback URB, interrupt handler add URB node to the bh->head list also. If check bh->head list again after finish all URB giveback of local_list, then it may introduce a "dynamic balance" between giveback URB and add URB to bh->head list. This tasklet callback function may not exit for a long time, which will cause other tasklet function calls to be delayed. Some real-time applications(such as KB and Mouse) will see noticeable lag. In order to prevent the tasklet function from occupying the cpu for a long time at a time, new URBS will not be added to the local_list even though the bh->head list is not empty. But also need to ensure the left URB giveback to be processed in time, so add a member high_prio for structure giveback_urb_bh to prioritize tasklet and schelule this tasklet again if bh->head list is not empty. At the same time, we are able to prioritize tasklet through structure member high_prio. So, replace the local high_prio_bh variable with this structure member in usb_hcd_giveback_urb. Fixes: 94dfd7edfd5c ("USB: HCD: support giveback of URB in tasklet context") Cc: stable Reviewed-by: Alan Stern Signed-off-by: Weitao Wang Link: https://lore.kernel.org/r/20220726074918.5114-1-WeitaoWang-oc@zhaoxin= .com Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/core/hcd.c | 26 +++++++++++++++----------- include/linux/usb/hcd.h | 1 + 2 files changed, 16 insertions(+), 11 deletions(-) --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -1691,7 +1691,6 @@ static void usb_giveback_urb_bh(struct t =20 spin_lock_irq(&bh->lock); bh->running =3D true; - restart: list_replace_init(&bh->head, &local_list); spin_unlock_irq(&bh->lock); =20 @@ -1705,10 +1704,17 @@ static void usb_giveback_urb_bh(struct t bh->completing_ep =3D NULL; } =20 - /* check if there are new URBs to giveback */ + /* + * giveback new URBs next time to prevent this function + * from not exiting for a long time. + */ spin_lock_irq(&bh->lock); - if (!list_empty(&bh->head)) - goto restart; + if (!list_empty(&bh->head)) { + if (bh->high_prio) + tasklet_hi_schedule(&bh->bh); + else + tasklet_schedule(&bh->bh); + } bh->running =3D false; spin_unlock_irq(&bh->lock); } @@ -1737,7 +1743,7 @@ static void usb_giveback_urb_bh(struct t void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, int status) { struct giveback_urb_bh *bh; - bool running, high_prio_bh; + bool running; =20 /* pass status to tasklet via unlinked */ if (likely(!urb->unlinked)) @@ -1748,13 +1754,10 @@ void usb_hcd_giveback_urb(struct usb_hcd return; } =20 - if (usb_pipeisoc(urb->pipe) || usb_pipeint(urb->pipe)) { + if (usb_pipeisoc(urb->pipe) || usb_pipeint(urb->pipe)) bh =3D &hcd->high_prio_bh; - high_prio_bh =3D true; - } else { + else bh =3D &hcd->low_prio_bh; - high_prio_bh =3D false; - } =20 spin_lock(&bh->lock); list_add_tail(&urb->urb_list, &bh->head); @@ -1763,7 +1766,7 @@ void usb_hcd_giveback_urb(struct usb_hcd =20 if (running) ; - else if (high_prio_bh) + else if (bh->high_prio) tasklet_hi_schedule(&bh->bh); else tasklet_schedule(&bh->bh); @@ -2959,6 +2962,7 @@ int usb_add_hcd(struct usb_hcd *hcd, =20 /* initialize tasklets */ init_giveback_urb_bh(&hcd->high_prio_bh); + hcd->high_prio_bh.high_prio =3D true; init_giveback_urb_bh(&hcd->low_prio_bh); =20 /* enable irqs just before we start the controller, --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -66,6 +66,7 @@ =20 struct giveback_urb_bh { bool running; + bool high_prio; spinlock_t lock; struct list_head head; struct tasklet_struct bh; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14C1EC25B0E for ; Mon, 15 Aug 2022 20:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347435AbiHOUZm (ORCPT ); Mon, 15 Aug 2022 16:25:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242729AbiHOURf (ORCPT ); Mon, 15 Aug 2022 16:17:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0A3B6420; Mon, 15 Aug 2022 12:00:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 061F361280; Mon, 15 Aug 2022 19:00:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08AB9C433B5; Mon, 15 Aug 2022 19:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590022; bh=AQoc+YaavwcFgbgCemNJ/K77IuFwFrWjNBQeM9fthTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cE6/5FdKmE+QedIGd9kBVfGbvzzEcNgksqAgOGBFnCqE+uwIBm2fk7GRbx0rz9CHv TxBDmrhw/gLFk8/OezN1K7AVGmfCRYGlwR7sRb890o+W1icfecH+mP5J4mOqIHcTHt /iU26nw0Y+9EbJy6mwH35iCaD4Up2fwGzsAkEWNE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ronald Wahl , Jose Alonso , "David S. Miller" Subject: [PATCH 5.18 0124/1095] Revert "net: usb: ax88179_178a needs FLAG_SEND_ZLP" Date: Mon, 15 Aug 2022 19:52:03 +0200 Message-Id: <20220815180434.716312912@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jose Alonso commit 6fd2c17fb6e02a8c0ab51df1cfec82ce96b8e83d upstream. This reverts commit 36a15e1cb134c0395261ba1940762703f778438c. The usage of FLAG_SEND_ZLP causes problems to other firmware/hardware versions that have no issues. The FLAG_SEND_ZLP is not safe to use in this context. See: https://patchwork.ozlabs.org/project/netdev/patch/1270599787.8900.8.camel@L= inuxdev4-laptop/#118378 The original problem needs another way to solve. Fixes: 36a15e1cb134 ("net: usb: ax88179_178a needs FLAG_SEND_ZLP") Cc: stable@vger.kernel.org Reported-by: Ronald Wahl Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216327 Link: https://bugs.archlinux.org/task/75491 Signed-off-by: Jose Alonso Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/usb/ax88179_178a.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -1801,7 +1801,7 @@ static const struct driver_info ax88179_ .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1814,7 +1814,7 @@ static const struct driver_info ax88178a .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1827,7 +1827,7 @@ static const struct driver_info cypress_ .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1840,7 +1840,7 @@ static const struct driver_info dlink_du .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1853,7 +1853,7 @@ static const struct driver_info sitecom_ .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1866,7 +1866,7 @@ static const struct driver_info samsung_ .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1879,7 +1879,7 @@ static const struct driver_info lenovo_i .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1892,7 +1892,7 @@ static const struct driver_info belkin_i .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1905,7 +1905,7 @@ static const struct driver_info toshiba_ .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1918,7 +1918,7 @@ static const struct driver_info mct_info .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1931,7 +1931,7 @@ static const struct driver_info at_umc20 .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1944,7 +1944,7 @@ static const struct driver_info at_umc20 .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1957,7 +1957,7 @@ static const struct driver_info at_umc20 .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29632C25B08 for ; Mon, 15 Aug 2022 20:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347463AbiHOUZr (ORCPT ); Mon, 15 Aug 2022 16:25:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243716AbiHOUSN (ORCPT ); Mon, 15 Aug 2022 16:18:13 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55D3C43E7B; Mon, 15 Aug 2022 12:00:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 8C977CE1267; Mon, 15 Aug 2022 19:00:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52601C433D6; Mon, 15 Aug 2022 19:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590025; bh=/nlk2RNgiWALLZkduIiOCkuWAgi6PpoVPN4WKKCrp3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zF/kDjt8qhkg/GX6zmooB6MG0ASioiYD2QR+ALQmIe3xMeI6hQzK4Qd5kTcERLQmG FgJmMxKWnB0dTLUANP1WKsLLHPxmXCk49vz+WJrZf95BGwtNbY2OCss557w/8xlili xZhf8L+VVD2Nowut5D4PayHJ2Dzrm1IUfM4HqaeE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryuta NAKANISHI , Kunihiko Hayashi , Arnd Bergmann Subject: [PATCH 5.18 0125/1095] ARM: dts: uniphier: Fix USB interrupts for PXs2 SoC Date: Mon, 15 Aug 2022 19:52:04 +0200 Message-Id: <20220815180434.759536778@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kunihiko Hayashi commit 9b0dc7abb5cc43a2dbf90690c3c6011dcadc574d upstream. An interrupt for USB device are shared with USB host. Set interrupt-names property to common "dwc_usb3" instead of "host" and "peripheral". Cc: stable@vger.kernel.org Fixes: 45be1573ad19 ("ARM: dts: uniphier: Add USB3 controller nodes") Reported-by: Ryuta NAKANISHI Signed-off-by: Kunihiko Hayashi Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/uniphier-pxs2.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/arch/arm/boot/dts/uniphier-pxs2.dtsi +++ b/arch/arm/boot/dts/uniphier-pxs2.dtsi @@ -597,8 +597,8 @@ compatible =3D "socionext,uniphier-dwc3", "snps,dwc3"; status =3D "disabled"; reg =3D <0x65a00000 0xcd00>; - interrupt-names =3D "host", "peripheral"; - interrupts =3D <0 134 4>, <0 135 4>; + interrupt-names =3D "dwc_usb3"; + interrupts =3D <0 134 4>; pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_usb0>, <&pinctrl_usb2>; clock-names =3D "ref", "bus_early", "suspend"; @@ -693,8 +693,8 @@ compatible =3D "socionext,uniphier-dwc3", "snps,dwc3"; status =3D "disabled"; reg =3D <0x65c00000 0xcd00>; - interrupt-names =3D "host", "peripheral"; - interrupts =3D <0 137 4>, <0 138 4>; + interrupt-names =3D "dwc_usb3"; + interrupts =3D <0 137 4>; pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_usb1>, <&pinctrl_usb3>; clock-names =3D "ref", "bus_early", "suspend"; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6689AC282E7 for ; Mon, 15 Aug 2022 20:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347546AbiHOUZ5 (ORCPT ); Mon, 15 Aug 2022 16:25:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241563AbiHOUSh (ORCPT ); Mon, 15 Aug 2022 16:18:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBDD845059; Mon, 15 Aug 2022 12:00:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5574C611D6; Mon, 15 Aug 2022 19:00:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CF24C433C1; Mon, 15 Aug 2022 19:00:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590028; bh=rkWXU3TEa6CIXUl/UnvFRmLkzh9CC0lIVI2ALWVyQsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HDrLiUkk0C38Exnzao9fL/LpbGKbnlv9dLlzIQpZPGECtxxeNjtY6roRKwYyuNaYt h0DhNLLtGoINc/o1GsesXzktjH9skLEn8awXzsBrjruCkon737iy9LXcLzrgGZhSm5 +j6Xo9k00DV3Ji13jZcge+hNByerAQ34ozbO6OsY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryuta NAKANISHI , Kunihiko Hayashi , Arnd Bergmann Subject: [PATCH 5.18 0126/1095] arm64: dts: uniphier: Fix USB interrupts for PXs3 SoC Date: Mon, 15 Aug 2022 19:52:05 +0200 Message-Id: <20220815180434.796543185@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kunihiko Hayashi commit fe17b91a7777df140d0f1433991da67ba658796c upstream. An interrupt for USB device are shared with USB host. Set interrupt-names property to common "dwc_usb3" instead of "host" and "peripheral". Cc: stable@vger.kernel.org Fixes: d7b9beb830d7 ("arm64: dts: uniphier: Add USB3 controller nodes") Reported-by: Ryuta NAKANISHI Signed-off-by: Kunihiko Hayashi Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi +++ b/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi @@ -599,8 +599,8 @@ compatible =3D "socionext,uniphier-dwc3", "snps,dwc3"; status =3D "disabled"; reg =3D <0x65a00000 0xcd00>; - interrupt-names =3D "host", "peripheral"; - interrupts =3D <0 134 4>, <0 135 4>; + interrupt-names =3D "dwc_usb3"; + interrupts =3D <0 134 4>; pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_usb0>, <&pinctrl_usb2>; clock-names =3D "ref", "bus_early", "suspend"; @@ -701,8 +701,8 @@ compatible =3D "socionext,uniphier-dwc3", "snps,dwc3"; status =3D "disabled"; reg =3D <0x65c00000 0xcd00>; - interrupt-names =3D "host", "peripheral"; - interrupts =3D <0 137 4>, <0 138 4>; + interrupt-names =3D "dwc_usb3"; + interrupts =3D <0 137 4>; pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_usb1>, <&pinctrl_usb3>; clock-names =3D "ref", "bus_early", "suspend"; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6CCEC00140 for ; Mon, 15 Aug 2022 20:32:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231721AbiHOUak (ORCPT ); Mon, 15 Aug 2022 16:30:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347331AbiHOUWS (ORCPT ); Mon, 15 Aug 2022 16:22:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 854922CCBF; Mon, 15 Aug 2022 12:02:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3C9D9B81062; Mon, 15 Aug 2022 19:02:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B30FC433C1; Mon, 15 Aug 2022 19:02:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590156; bh=IO9ap3hmjMTu+JcV3hDkZ5Y3LMiXumCCUXgCjw5opXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PlMewoO6S0orSvri4aj63cNOfxLRNtco1KmUbrETGIDFuBivshjftTLjZRK1mXc7H JIt57GWcQuQeIun8ATv2D+MQqZNuPz/CTEjLvmw8WsSkIn5wfip2jOtoGgTCay4pF8 pz4Qn7ix19FbFAkDfXrZWHAd68yYnyUWiO0dW4vA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , syzbot+b0de012ceb1e2a97891b@syzkaller.appspotmail.com Subject: [PATCH 5.18 0127/1095] USB: gadget: Fix use-after-free Read in usb_udc_uevent() Date: Mon, 15 Aug 2022 19:52:06 +0200 Message-Id: <20220815180434.838639592@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alan Stern commit 2191c00855b03aa59c20e698be713d952d51fc18 upstream. The syzbot fuzzer found a race between uevent callbacks and gadget driver unregistration that can cause a use-after-free bug: Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --------------------------------------------------------------- BUG: KASAN: use-after-free in usb_udc_uevent+0x11f/0x130 drivers/usb/gadget/udc/core.c:1732 Read of size 8 at addr ffff888078ce2050 by task udevd/2968 CPU: 1 PID: 2968 Comm: udevd Not tainted 5.19.0-rc4-next-20220628-syzkaller= #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Goo= gle 06/29/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:317 [inline] print_report.cold+0x2ba/0x719 mm/kasan/report.c:433 kasan_report+0xbe/0x1f0 mm/kasan/report.c:495 usb_udc_uevent+0x11f/0x130 drivers/usb/gadget/udc/core.c:1732 dev_uevent+0x290/0x770 drivers/base/core.c:2424 --------------------------------------------------------------- The bug occurs because usb_udc_uevent() dereferences udc->driver but does so without acquiring the udc_lock mutex, which protects this field. If the gadget driver is unbound from the udc concurrently with uevent processing, the driver structure may be accessed after it has been deallocated. To prevent the race, we make sure that the routine holds the mutex around the racing accesses. Link: CC: stable@vger.kernel.org # fc274c1e9973 Reported-and-tested-by: syzbot+b0de012ceb1e2a97891b@syzkaller.appspotmail.c= om Signed-off-by: Alan Stern Link: https://lore.kernel.org/r/YtlrnhHyrHsSky9m@rowland.harvard.edu Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/udc/core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -1745,13 +1745,14 @@ static int usb_udc_uevent(struct device return ret; } =20 - if (udc->driver) { + mutex_lock(&udc_lock); + if (udc->driver) ret =3D add_uevent_var(env, "USB_UDC_DRIVER=3D%s", udc->driver->function); - if (ret) { - dev_err(dev, "failed to add uevent USB_UDC_DRIVER\n"); - return ret; - } + mutex_unlock(&udc_lock); + if (ret) { + dev_err(dev, "failed to add uevent USB_UDC_DRIVER\n"); + return ret; } =20 return 0; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A1CCC28B2C for ; Mon, 15 Aug 2022 20:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347748AbiHOU0f (ORCPT ); Mon, 15 Aug 2022 16:26:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346519AbiHOUUU (ORCPT ); Mon, 15 Aug 2022 16:20:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85E2997D50; Mon, 15 Aug 2022 12:00:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 963136122B; Mon, 15 Aug 2022 19:00:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E544C433D7; Mon, 15 Aug 2022 19:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590053; bh=q6objEWJqQalE6qrNAA/Zzot4pb3FshImXwWMJLY6gM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ze2Y664KhBYGW1JCZoaNYQDpX/SUNK4+1LXNat03vUJvBVtraE/KVJVLbG84YoWc8 csSAS/UwZvbXt7vxixYIcLVP7OZq5v7Ps2lh7Iw1CaNqXyoDGl80V276Li9eqBU5zg +NNzCB8JHfhUBK0C0AVyHZ/JR87wSAaJ3W17vE2M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Michael Grzeschik Subject: [PATCH 5.18 0128/1095] usb: dwc3: gadget: refactor dwc3_repare_one_trb Date: Mon, 15 Aug 2022 19:52:07 +0200 Message-Id: <20220815180434.882377454@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Grzeschik commit 23385cec5f354794dadced7f28c31da7ae3eb54c upstream. The function __dwc3_prepare_one_trb has many parameters. Since it is only used in dwc3_prepare_one_trb there is no point in keeping the function. We merge both functions and get rid of the big list of parameters. Fixes: 40d829fb2ec6 ("usb: dwc3: gadget: Correct ISOC DATA PIDs for short p= ackets") Cc: stable Signed-off-by: Michael Grzeschik Link: https://lore.kernel.org/r/20220704141812.1532306-2-m.grzeschik@pengut= ronix.de Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/dwc3/gadget.c | 92 ++++++++++++++++++++---------------------= ----- 1 file changed, 40 insertions(+), 52 deletions(-) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1181,17 +1181,49 @@ static u32 dwc3_calc_trbs_left(struct dw return trbs_left; } =20 -static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *t= rb, - dma_addr_t dma, unsigned int length, unsigned int chain, - unsigned int node, unsigned int stream_id, - unsigned int short_not_ok, unsigned int no_interrupt, - unsigned int is_last, bool must_interrupt) +/** + * dwc3_prepare_one_trb - setup one TRB from one request + * @dep: endpoint for which this request is prepared + * @req: dwc3_request pointer + * @trb_length: buffer size of the TRB + * @chain: should this TRB be chained to the next? + * @node: only for isochronous endpoints. First TRB needs different type. + * @use_bounce_buffer: set to use bounce buffer + * @must_interrupt: set to interrupt on TRB completion + */ +static void dwc3_prepare_one_trb(struct dwc3_ep *dep, + struct dwc3_request *req, unsigned int trb_length, + unsigned int chain, unsigned int node, bool use_bounce_buffer, + bool must_interrupt) { + struct dwc3_trb *trb; + dma_addr_t dma; + unsigned int stream_id =3D req->request.stream_id; + unsigned int short_not_ok =3D req->request.short_not_ok; + unsigned int no_interrupt =3D req->request.no_interrupt; + unsigned int is_last =3D req->request.is_last; struct dwc3 *dwc =3D dep->dwc; struct usb_gadget *gadget =3D dwc->gadget; enum usb_device_speed speed =3D gadget->speed; =20 - trb->size =3D DWC3_TRB_SIZE_LENGTH(length); + if (use_bounce_buffer) + dma =3D dep->dwc->bounce_addr; + else if (req->request.num_sgs > 0) + dma =3D sg_dma_address(req->start_sg); + else + dma =3D req->request.dma; + + trb =3D &dep->trb_pool[dep->trb_enqueue]; + + if (!req->trb) { + dwc3_gadget_move_started_request(req); + req->trb =3D trb; + req->trb_dma =3D dwc3_trb_dma_offset(dep, trb); + } + + req->num_trbs++; + + trb->size =3D DWC3_TRB_SIZE_LENGTH(trb_length); trb->bpl =3D lower_32_bits(dma); trb->bph =3D upper_32_bits(dma); =20 @@ -1231,10 +1263,10 @@ static void __dwc3_prepare_one_trb(struc unsigned int mult =3D 2; unsigned int maxp =3D usb_endpoint_maxp(ep->desc); =20 - if (length <=3D (2 * maxp)) + if (trb_length <=3D (2 * maxp)) mult--; =20 - if (length <=3D maxp) + if (trb_length <=3D maxp) mult--; =20 trb->size |=3D DWC3_TRB_SIZE_PCM1(mult); @@ -1308,50 +1340,6 @@ static void __dwc3_prepare_one_trb(struc trace_dwc3_prepare_trb(dep, trb); } =20 -/** - * dwc3_prepare_one_trb - setup one TRB from one request - * @dep: endpoint for which this request is prepared - * @req: dwc3_request pointer - * @trb_length: buffer size of the TRB - * @chain: should this TRB be chained to the next? - * @node: only for isochronous endpoints. First TRB needs different type. - * @use_bounce_buffer: set to use bounce buffer - * @must_interrupt: set to interrupt on TRB completion - */ -static void dwc3_prepare_one_trb(struct dwc3_ep *dep, - struct dwc3_request *req, unsigned int trb_length, - unsigned int chain, unsigned int node, bool use_bounce_buffer, - bool must_interrupt) -{ - struct dwc3_trb *trb; - dma_addr_t dma; - unsigned int stream_id =3D req->request.stream_id; - unsigned int short_not_ok =3D req->request.short_not_ok; - unsigned int no_interrupt =3D req->request.no_interrupt; - unsigned int is_last =3D req->request.is_last; - - if (use_bounce_buffer) - dma =3D dep->dwc->bounce_addr; - else if (req->request.num_sgs > 0) - dma =3D sg_dma_address(req->start_sg); - else - dma =3D req->request.dma; - - trb =3D &dep->trb_pool[dep->trb_enqueue]; - - if (!req->trb) { - dwc3_gadget_move_started_request(req); - req->trb =3D trb; - req->trb_dma =3D dwc3_trb_dma_offset(dep, trb); - } - - req->num_trbs++; - - __dwc3_prepare_one_trb(dep, trb, dma, trb_length, chain, node, - stream_id, short_not_ok, no_interrupt, is_last, - must_interrupt); -} - static bool dwc3_needs_extra_trb(struct dwc3_ep *dep, struct dwc3_request = *req) { unsigned int maxp =3D usb_endpoint_maxp(dep->endpoint.desc); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F0C9C00140 for ; Mon, 15 Aug 2022 20:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346490AbiHOU1N (ORCPT ); Mon, 15 Aug 2022 16:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347238AbiHOUWH (ORCPT ); Mon, 15 Aug 2022 16:22:07 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A04B4B0C7; Mon, 15 Aug 2022 12:01:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 1426FCE129B; Mon, 15 Aug 2022 19:01:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9EA0C433D6; Mon, 15 Aug 2022 19:01:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590085; bh=BPy1qZmW6qarSAy4+2lCRNVA0QAUPJ9Z4/7km8FScoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B+VG5z9qS0dZOi0o31hoPF9u69dApR8nuv8es+JE0UGi1rMbaax/JhttkECt9o6ZV O2Zol7rSgMiYCNxK7voA0WBrVVFA9UAzrRPRuTl1z5+cwVGHlI9Gi4hHwhCROpUNso ySET9QCLzh/TnEufVRklZSCTy0BiICtv0MSw1Sjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Michael Grzeschik Subject: [PATCH 5.18 0129/1095] usb: dwc3: gadget: fix high speed multiplier setting Date: Mon, 15 Aug 2022 19:52:08 +0200 Message-Id: <20220815180434.916608675@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Grzeschik commit 8affe37c525d800a2628c4ecfaed13b77dc5634a upstream. For High-Speed Transfers the prepare_one_trb function is calculating the multiplier setting for the trb based on the length parameter of the trb currently prepared. This assumption is wrong. For trbs with a sg list, the length of the actual request has to be taken instead. Fixes: 40d829fb2ec6 ("usb: dwc3: gadget: Correct ISOC DATA PIDs for short p= ackets") Cc: stable Signed-off-by: Michael Grzeschik Link: https://lore.kernel.org/r/20220704141812.1532306-3-m.grzeschik@pengut= ronix.de Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/dwc3/gadget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1263,10 +1263,10 @@ static void dwc3_prepare_one_trb(struct unsigned int mult =3D 2; unsigned int maxp =3D usb_endpoint_maxp(ep->desc); =20 - if (trb_length <=3D (2 * maxp)) + if (req->request.length <=3D (2 * maxp)) mult--; =20 - if (trb_length <=3D maxp) + if (req->request.length <=3D maxp) mult--; =20 trb->size |=3D DWC3_TRB_SIZE_PCM1(mult); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69B7CC00140 for ; Mon, 15 Aug 2022 20:29:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345592AbiHOU3A (ORCPT ); Mon, 15 Aug 2022 16:29:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347285AbiHOUWL (ORCPT ); Mon, 15 Aug 2022 16:22:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 760C22C117; Mon, 15 Aug 2022 12:02:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 10EE461211; Mon, 15 Aug 2022 19:02:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AF85C433D6; Mon, 15 Aug 2022 19:01:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590119; bh=NENwG24tRUGPMj966BjJSCeyj20BLt/3D87ptVQFGCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z4HI2yUA8G/TaQylka42NWRHIlc1EUsRYW1qQ2w7COlBsuW0me5Gv50hFEv+vblDD vwN0AgUMjK1mp5J9tOJCiv7t8C6Fggb3f2MsQZ05NOCI1yrmLPCxG9uqHeo45wzhJM dsuhEOzaGhHZ1qH0yXulRaskbcabHozXpEjRlrvA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thadeu Lima de Souza Cascardo , Pablo Neira Ayuso Subject: [PATCH 5.18 0130/1095] netfilter: nf_tables: do not allow SET_ID to refer to another table Date: Mon, 15 Aug 2022 19:52:09 +0200 Message-Id: <20220815180434.957432855@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thadeu Lima de Souza Cascardo commit 470ee20e069a6d05ae549f7d0ef2bdbcee6a81b2 upstream. When doing lookups for sets on the same batch by using its ID, a set from a different table can be used. Then, when the table is removed, a reference to the set may be kept after the set is freed, leading to a potential use-after-free. When looking for sets by ID, use the table that was used for the lookup by name, and only return sets belonging to that same table. This fixes CVE-2022-2586, also reported as ZDI-CAN-17470. Reported-by: Team Orca of Sea Security (@seasecresponse) Fixes: 958bee14d071 ("netfilter: nf_tables: use new transaction infrastruct= ure to handle sets") Signed-off-by: Thadeu Lima de Souza Cascardo Cc: Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3840,6 +3840,7 @@ static struct nft_set *nft_set_lookup_by } =20 static struct nft_set *nft_set_lookup_byid(const struct net *net, + const struct nft_table *table, const struct nlattr *nla, u8 genmask) { struct nftables_pernet *nft_net =3D nft_pernet(net); @@ -3851,6 +3852,7 @@ static struct nft_set *nft_set_lookup_by struct nft_set *set =3D nft_trans_set(trans); =20 if (id =3D=3D nft_trans_set_id(trans) && + set->table =3D=3D table && nft_active_genmask(set, genmask)) return set; } @@ -3871,7 +3873,7 @@ struct nft_set *nft_set_lookup_global(co if (!nla_set_id) return set; =20 - set =3D nft_set_lookup_byid(net, nla_set_id, genmask); + set =3D nft_set_lookup_byid(net, table, nla_set_id, genmask); } return set; } From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6763C00140 for ; Mon, 15 Aug 2022 20:29:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346087AbiHOU3i (ORCPT ); Mon, 15 Aug 2022 16:29:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347309AbiHOUWP (ORCPT ); Mon, 15 Aug 2022 16:22:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2181333A3B; Mon, 15 Aug 2022 12:02:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B1B8461281; Mon, 15 Aug 2022 19:02:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C88DC433D6; Mon, 15 Aug 2022 19:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590138; bh=KXsiz/clbAFn5tBxvwlcvQAnIlwUuukB5cDniMj0fBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h3VGVVMwGUaW8RuWvSZu+uCfTIG+ghJKjTUlyLhp1CNN/68vX+8OeLwhW2TOnFUgD a3KP1cjKBieGsmmHGga4OKkPAMOQqAYS6MUaHSrF6BXQBz++3kpHPDCt/k/254p3LP YBDPH6HzvSLcb5J5ngGAcdYCzDJBz6Qlai/bgaX0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thadeu Lima de Souza Cascardo , Pablo Neira Ayuso Subject: [PATCH 5.18 0131/1095] netfilter: nf_tables: do not allow CHAIN_ID to refer to another table Date: Mon, 15 Aug 2022 19:52:10 +0200 Message-Id: <20220815180434.997918368@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thadeu Lima de Souza Cascardo commit 95f466d22364a33d183509629d0879885b4f547e upstream. When doing lookups for chains on the same batch by using its ID, a chain from a different table can be used. If a rule is added to a table but refers to a chain in a different table, it will be linked to the chain in table2, but would have expressions referring to objects in table1. Then, when table1 is removed, the rule will not be removed as its linked to a chain in table2. When expressions in the rule are processed or removed, that will lead to a use-after-free. When looking for chains by ID, use the table that was used for the lookup by name, and only return chains belonging to that same table. Fixes: 837830a4b439 ("netfilter: nf_tables: add NFTA_RULE_CHAIN_ID attribut= e") Signed-off-by: Thadeu Lima de Souza Cascardo Cc: Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -2472,6 +2472,7 @@ err: } =20 static struct nft_chain *nft_chain_lookup_byid(const struct net *net, + const struct nft_table *table, const struct nlattr *nla) { struct nftables_pernet *nft_net =3D nft_pernet(net); @@ -2482,6 +2483,7 @@ static struct nft_chain *nft_chain_looku struct nft_chain *chain =3D trans->ctx.chain; =20 if (trans->msg_type =3D=3D NFT_MSG_NEWCHAIN && + chain->table =3D=3D table && id =3D=3D nft_trans_chain_id(trans)) return chain; } @@ -3415,7 +3417,7 @@ static int nf_tables_newrule(struct sk_b return -EOPNOTSUPP; =20 } else if (nla[NFTA_RULE_CHAIN_ID]) { - chain =3D nft_chain_lookup_byid(net, nla[NFTA_RULE_CHAIN_ID]); + chain =3D nft_chain_lookup_byid(net, table, nla[NFTA_RULE_CHAIN_ID]); if (IS_ERR(chain)) { NL_SET_BAD_ATTR(extack, nla[NFTA_RULE_CHAIN_ID]); return PTR_ERR(chain); @@ -9597,7 +9599,7 @@ static int nft_verdict_init(const struct tb[NFTA_VERDICT_CHAIN], genmask); } else if (tb[NFTA_VERDICT_CHAIN_ID]) { - chain =3D nft_chain_lookup_byid(ctx->net, + chain =3D nft_chain_lookup_byid(ctx->net, ctx->table, tb[NFTA_VERDICT_CHAIN_ID]); if (IS_ERR(chain)) return PTR_ERR(chain); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52225C25B08 for ; Mon, 15 Aug 2022 20:29:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245311AbiHOU3t (ORCPT ); Mon, 15 Aug 2022 16:29:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347323AbiHOUWR (ORCPT ); Mon, 15 Aug 2022 16:22:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 470BB33E11; Mon, 15 Aug 2022 12:02:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C35E76129D; Mon, 15 Aug 2022 19:02:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3CFDC433D7; Mon, 15 Aug 2022 19:02:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590141; bh=BiXQP5hEwWxvNooIQ9QPaiV8PeDBluXIGABeLXn0BFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=teVndLtmCBIZEOhSn7ApbIAHYeeFm+AN0Q1nm/YICE32IGxvVibq4tAUELzM9bR1m /K1cWl2rRqlDAHQUakIcst7QzgUbWNDViBUE38flHPVl6b2srdl99XmT9eTS086i6T FNykxCkh9MUY40bih2m578pJ8FPmTKsGOr1tvPhQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thadeu Lima de Souza Cascardo , Pablo Neira Ayuso Subject: [PATCH 5.18 0132/1095] netfilter: nf_tables: do not allow RULE_ID to refer to another chain Date: Mon, 15 Aug 2022 19:52:11 +0200 Message-Id: <20220815180435.042410543@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thadeu Lima de Souza Cascardo commit 36d5b2913219ac853908b0f1c664345e04313856 upstream. When doing lookups for rules on the same batch by using its ID, a rule from a different chain can be used. If a rule is added to a chain but tries to be positioned next to a rule from a different chain, it will be linked to chain2, but the use counter on chain1 would be the one to be incremented. When looking for rules by ID, use the chain that was used for the lookup by name. The chain used in the context copied to the transaction needs to match that same chain. That way, struct nft_rule does not need to get enlarged with another member. Fixes: 1a94e38d254b ("netfilter: nf_tables: add NFTA_RULE_ID attribute") Fixes: 75dd48e2e420 ("netfilter: nf_tables: Support RULE_ID reference in ne= w rule") Signed-off-by: Thadeu Lima de Souza Cascardo Cc: Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3371,6 +3371,7 @@ static int nft_table_validate(struct net } =20 static struct nft_rule *nft_rule_lookup_byid(const struct net *net, + const struct nft_chain *chain, const struct nlattr *nla); =20 #define NFT_RULE_MAXEXPRS 128 @@ -3459,7 +3460,7 @@ static int nf_tables_newrule(struct sk_b return PTR_ERR(old_rule); } } else if (nla[NFTA_RULE_POSITION_ID]) { - old_rule =3D nft_rule_lookup_byid(net, nla[NFTA_RULE_POSITION_ID]); + old_rule =3D nft_rule_lookup_byid(net, chain, nla[NFTA_RULE_POSITION_ID= ]); if (IS_ERR(old_rule)) { NL_SET_BAD_ATTR(extack, nla[NFTA_RULE_POSITION_ID]); return PTR_ERR(old_rule); @@ -3604,6 +3605,7 @@ err_release_expr: } =20 static struct nft_rule *nft_rule_lookup_byid(const struct net *net, + const struct nft_chain *chain, const struct nlattr *nla) { struct nftables_pernet *nft_net =3D nft_pernet(net); @@ -3614,6 +3616,7 @@ static struct nft_rule *nft_rule_lookup_ struct nft_rule *rule =3D nft_trans_rule(trans); =20 if (trans->msg_type =3D=3D NFT_MSG_NEWRULE && + trans->ctx.chain =3D=3D chain && id =3D=3D nft_trans_rule_id(trans)) return rule; } @@ -3663,7 +3666,7 @@ static int nf_tables_delrule(struct sk_b =20 err =3D nft_delrule(&ctx, rule); } else if (nla[NFTA_RULE_ID]) { - rule =3D nft_rule_lookup_byid(net, nla[NFTA_RULE_ID]); + rule =3D nft_rule_lookup_byid(net, chain, nla[NFTA_RULE_ID]); if (IS_ERR(rule)) { NL_SET_BAD_ATTR(extack, nla[NFTA_RULE_ID]); return PTR_ERR(rule); From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55134C00140 for ; Mon, 15 Aug 2022 20:30:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345744AbiHOUaB (ORCPT ); Mon, 15 Aug 2022 16:30:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347327AbiHOUWR (ORCPT ); Mon, 15 Aug 2022 16:22:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EAF733E05; Mon, 15 Aug 2022 12:02:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9D3B861211; Mon, 15 Aug 2022 19:02:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E049C433C1; Mon, 15 Aug 2022 19:02:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590144; bh=1nyJF6tS4IDL2t+3hw/6H7P10fs3MNbMX922x6MthPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0ePCxzTclGBXUds528oE8Xre1xnG9L6qc9MuKjSOji2FNHkblKChcd5kS//Kd7PnJ BuT4sSNbiwTRbeAxuPW+v6eCRDkQE/hiWMjMqChxD1G2OFHKxBFwgInUMJxGYSb8f2 2IIZIHQ8jJcaitk/upUfN8ElNi4nJ57oigZtQITM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, mingi cho , Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 5.18 0133/1095] netfilter: nf_tables: fix null deref due to zeroed list head Date: Mon, 15 Aug 2022 19:52:12 +0200 Message-Id: <20220815180435.095772843@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal commit 580077855a40741cf511766129702d97ff02f4d9 upstream. In nf_tables_updtable, if nf_tables_table_enable returns an error, nft_trans_destroy is called to free the transaction object. nft_trans_destroy() calls list_del(), but the transaction was never placed on a list -- the list head is all zeroes, this results in a null dereference: BUG: KASAN: null-ptr-deref in nft_trans_destroy+0x26/0x59 Call Trace: nft_trans_destroy+0x26/0x59 nf_tables_newtable+0x4bc/0x9bc [..] Its sane to assume that nft_trans_destroy() can be called on the transaction object returned by nft_trans_alloc(), so make sure the list head is initialised. Fixes: 55dd6f93076b ("netfilter: nf_tables: use new transaction infrastruct= ure to handle table") Reported-by: mingi cho Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 1 + 1 file changed, 1 insertion(+) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -153,6 +153,7 @@ static struct nft_trans *nft_trans_alloc if (trans =3D=3D NULL) return NULL; =20 + INIT_LIST_HEAD(&trans->list); trans->msg_type =3D msg_type; trans->ctx =3D *ctx; From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6610C25B0E for ; Mon, 15 Aug 2022 20:29:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345210AbiHOU3y (ORCPT ); Mon, 15 Aug 2022 16:29:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347326AbiHOUWR (ORCPT ); Mon, 15 Aug 2022 16:22:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E21F33427; Mon, 15 Aug 2022 12:02:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ADDB661281; Mon, 15 Aug 2022 19:02:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D3CBC433D6; Mon, 15 Aug 2022 19:02:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590147; bh=uLFx4RHYD59OS7NFdOPVWAzPXWiJpunBElMg6vgcyso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CxVtU3AiDJQg3kdN3HuT9eAXfb0lka6ED/Bb8AVUgl9YL2NQIRIpmmap+pWJU2wDF PAXrgc2zy8X4cpo/tO6uQQMFD73D0NPxlYo9c4+qYt3ZSs3GQzgTCRLw3p7yruGk8V lMIbG385VteoWY/jI00BGzvyAYOqN5psB5qu9vu4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Segall , Shakeel Butt , Alexander Viro , Linus Torvalds , Eric Dumazet , Roman Penyaev , Jason Baron , Khazhismel Kumykov , Heiher , stable@kernel.org, Andrew Morton Subject: [PATCH 5.18 0134/1095] epoll: autoremove wakers even more aggressively Date: Mon, 15 Aug 2022 19:52:13 +0200 Message-Id: <20220815180435.143346938@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Benjamin Segall commit a16ceb13961068f7209e34d7984f8e42d2c06159 upstream. If a process is killed or otherwise exits while having active network connections and many threads waiting on epoll_wait, the threads will all be woken immediately, but not removed from ep->wq. Then when network traffic scans ep->wq in wake_up, every wakeup attempt will fail, and will not remove the entries from the list. This means that the cost of the wakeup attempt is far higher than usual, does not decrease, and this also competes with the dying threads trying to actually make progress and remove themselves from the wq. Handle this by removing visited epoll wq entries unconditionally, rather than only when the wakeup succeeds - the structure of ep_poll means that the only potential loss is the timed_out->eavail heuristic, which now can race and result in a redundant ep_send_events attempt. (But only when incoming data and a timeout actually race, not on every timeout) Shakeel added: : We are seeing this issue in production with real workloads and it has : caused hard lockups. Particularly network heavy workloads with a lot : of threads in epoll_wait() can easily trigger this issue if they get : killed (oom-killed in our case). Link: https://lkml.kernel.org/r/xm26fsjotqda.fsf@google.com Signed-off-by: Ben Segall Tested-by: Shakeel Butt Cc: Alexander Viro Cc: Linus Torvalds Cc: Shakeel Butt Cc: Eric Dumazet Cc: Roman Penyaev Cc: Jason Baron Cc: Khazhismel Kumykov Cc: Heiher Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/eventpoll.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1747,6 +1747,21 @@ static struct timespec64 *ep_timeout_to_ return to; } =20 +/* + * autoremove_wake_function, but remove even on failure to wake up, becaus= e we + * know that default_wake_function/ttwu will only fail if the thread is al= ready + * woken, and in that case the ep_poll loop will remove the entry anyways,= not + * try to reuse it. + */ +static int ep_autoremove_wake_function(struct wait_queue_entry *wq_entry, + unsigned int mode, int sync, void *key) +{ + int ret =3D default_wake_function(wq_entry, mode, sync, key); + + list_del_init(&wq_entry->entry); + return ret; +} + /** * ep_poll - Retrieves ready events, and delivers them to the caller-suppl= ied * event buffer. @@ -1828,8 +1843,15 @@ static int ep_poll(struct eventpoll *ep, * normal wakeup path no need to call __remove_wait_queue() * explicitly, thus ep->lock is not taken, which halts the * event delivery. + * + * In fact, we now use an even more aggressive function that + * unconditionally removes, because we don't reuse the wait + * entry between loop iterations. This lets us also avoid the + * performance issue if a process is killed, causing all of its + * threads to wake up without being removed normally. */ init_wait(&wait); + wait.func =3D ep_autoremove_wake_function; =20 write_lock_irq(&ep->lock); /* From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCA57C00140 for ; Mon, 15 Aug 2022 20:30:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345973AbiHOUaK (ORCPT ); Mon, 15 Aug 2022 16:30:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347330AbiHOUWR (ORCPT ); Mon, 15 Aug 2022 16:22:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DD5532EF7; Mon, 15 Aug 2022 12:02:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DC57361281; Mon, 15 Aug 2022 19:02:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA72BC433C1; Mon, 15 Aug 2022 19:02:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590150; bh=FWv5uPftX5X9X1NDJjuD0spInpQjykRjrgL+U5sBl1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ynkEIm4sXBHwhTxb8mNBxaOCAQrd3h87uk+F23agSmQcUEE09Ybv6GDfdJFuRW4Sd vIZ4LZoJoFftVI/S7x93PSzDV08pKjXIX38hCuH+gmacsUc6PS3Nj6yRQixBLkAKvW XChdpe0NJLPbC/BbJA+cewS9NvR1Mz6Op/6qOVdA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wyes Karny , Dave Hansen , Zhang Rui , Sasha Levin Subject: [PATCH 5.18 0135/1095] x86: Handle idle=nomwait cmdline properly for x86_idle Date: Mon, 15 Aug 2022 19:52:14 +0200 Message-Id: <20220815180435.181724081@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wyes Karny [ Upstream commit 8bcedb4ce04750e1ccc9a6b6433387f6a9166a56 ] When kernel is booted with idle=3Dnomwait do not use MWAIT as the default idle state. If the user boots the kernel with idle=3Dnomwait, it is a clear direction to not use mwait as the default idle state. However, the current code does not take this into consideration while selecting the default idle state on x86. Fix it by checking for the idle=3Dnomwait boot option in prefer_mwait_c1_over_halt(). Also update the documentation around idle=3Dnomwait appropriately. [ dhansen: tweak commit message ] Signed-off-by: Wyes Karny Signed-off-by: Dave Hansen Tested-by: Zhang Rui Link: https://lkml.kernel.org/r/fdc2dc2d0a1bc21c2f53d989ea2d2ee3ccbc0dbe.16= 54538381.git-series.wyes.karny@amd.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- Documentation/admin-guide/pm/cpuidle.rst | 15 +++++++++------ arch/x86/kernel/process.c | 9 ++++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Documentation/admin-guide/pm/cpuidle.rst b/Documentation/admin= -guide/pm/cpuidle.rst index aec2cd2aaea7..19754beb5a4e 100644 --- a/Documentation/admin-guide/pm/cpuidle.rst +++ b/Documentation/admin-guide/pm/cpuidle.rst @@ -612,8 +612,8 @@ the ``menu`` governor to be used on the systems that us= e the ``ladder`` governor by default this way, for example. =20 The other kernel command line parameters controlling CPU idle time managem= ent -described below are only relevant for the *x86* architecture and some of -them affect Intel processors only. +described below are only relevant for the *x86* architecture and references +to ``intel_idle`` affect Intel processors only. =20 The *x86* architecture support code recognizes three kernel command line options related to CPU idle time management: ``idle=3Dpoll``, ``idle=3Dhal= t``, @@ -635,10 +635,13 @@ idle, so it very well may hurt single-thread computat= ions performance as well as energy-efficiency. Thus using it for performance reasons may not be a goo= d idea at all.] =20 -The ``idle=3Dnomwait`` option disables the ``intel_idle`` driver and causes -``acpi_idle`` to be used (as long as all of the information needed by it is -there in the system's ACPI tables), but it is not allowed to use the -``MWAIT`` instruction of the CPUs to ask the hardware to enter idle states. +The ``idle=3Dnomwait`` option prevents the use of ``MWAIT`` instruction of +the CPU to enter idle states. When this option is used, the ``acpi_idle`` +driver will use the ``HLT`` instruction instead of ``MWAIT``. On systems +running Intel processors, this option disables the ``intel_idle`` driver +and forces the use of the ``acpi_idle`` driver instead. Note that in either +case, ``acpi_idle`` driver will function only if all the information needed +by it is in the system's ACPI tables. =20 In addition to the architecture-level kernel command line options affectin= g CPU idle time management, there are parameters affecting individual ``CPUIdle`` diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 622dc3673c37..8011536ba5c4 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -824,6 +824,10 @@ static void amd_e400_idle(void) */ static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c) { + /* User has disallowed the use of MWAIT. Fallback to HALT */ + if (boot_option_idle_override =3D=3D IDLE_NOMWAIT) + return 0; + if (c->x86_vendor !=3D X86_VENDOR_INTEL) return 0; =20 @@ -932,9 +936,8 @@ static int __init idle_setup(char *str) } else if (!strcmp(str, "nomwait")) { /* * If the boot option of "idle=3Dnomwait" is added, - * it means that mwait will be disabled for CPU C2/C3 - * states. In such case it won't touch the variable - * of boot_option_idle_override. + * it means that mwait will be disabled for CPU C1/C2/C3 + * states. */ boot_option_idle_override =3D IDLE_NOMWAIT; } else --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE230C00140 for ; Mon, 15 Aug 2022 20:30:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344907AbiHOUaS (ORCPT ); Mon, 15 Aug 2022 16:30:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347332AbiHOUWS (ORCPT ); Mon, 15 Aug 2022 16:22:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34FDE2CCBE; Mon, 15 Aug 2022 12:02:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B5B7261281; Mon, 15 Aug 2022 19:02:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A859EC433C1; Mon, 15 Aug 2022 19:02:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590153; bh=nogcyjDbxml/XTbmHH6bJemVBNIFkSKhtNm6psYUfCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OXfm5lzIk7WsMeVd/EmqW04KzcCDvvRCDx6f/gPMR8JjVudIUhIsJcHPTkKP1slq8 PqJrygYt+oKemwEI0+UOFjXx/OEvjt1CHAthebYJ4/QwWg1+9BR0PlJsAwdGmdCS8Y U+rGUKqnijNANg2Lijh+GJ2wWP5Z9zvhPTW152o0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Catalin Marinas , Ingo Molnar , "Peter Zijlstra (Intel)" , Thomas Gleixner , Will Deacon , Sasha Levin Subject: [PATCH 5.18 0136/1095] arch: make TRACE_IRQFLAGS_NMI_SUPPORT generic Date: Mon, 15 Aug 2022 19:52:15 +0200 Message-Id: <20220815180435.221415031@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Rutland [ Upstream commit 4510bffb4d0246cdcc1f14c7367c026b807a862d ] On most architectures, IRQ flag tracing is disabled in NMI context, and architectures need to define and select TRACE_IRQFLAGS_NMI_SUPPORT in order to enable this. Commit: 859d069ee1ddd878 ("lockdep: Prepare for NMI IRQ state tracking") Permitted IRQ flag tracing in NMI context, allowing lockdep to work in NMI context where an architecture had suitable entry logic. At the time, most architectures did not have such suitable entry logic, and this broke lockdep on such architectures. Thus, this was partially disabled in commit: ed00495333ccc80f ("locking/lockdep: Fix TRACE_IRQFLAGS vs. NMIs") ... with architectures needing to select TRACE_IRQFLAGS_NMI_SUPPORT to enable IRQ flag tracing in NMI context. Currently TRACE_IRQFLAGS_NMI_SUPPORT is defined under arch/x86/Kconfig.debug. Move it to arch/Kconfig so architectures can select it without having to provide their own definition. Since the regular TRACE_IRQFLAGS_SUPPORT is selected by arch/x86/Kconfig, the select of TRACE_IRQFLAGS_NMI_SUPPORT is moved there too. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Cc: Catalin Marinas Cc: Ingo Molnar Cc: Peter Zijlstra (Intel) Cc: Thomas Gleixner Cc: Will Deacon Link: https://lore.kernel.org/r/20220511131733.4074499-2-mark.rutland@arm.c= om Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/Kconfig | 3 +++ arch/x86/Kconfig | 1 + arch/x86/Kconfig.debug | 3 --- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 31c4fdc4a4ba..ab45e0f6c21b 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -214,6 +214,9 @@ config HAVE_FUNCTION_DESCRIPTORS config TRACE_IRQFLAGS_SUPPORT bool =20 +config TRACE_IRQFLAGS_NMI_SUPPORT + bool + # # An arch should select this if it provides all these things: # diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index ce1f5a876cfe..04a9865dbdbf 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -272,6 +272,7 @@ config X86 select SYSCTL_EXCEPTION_TRACE select THREAD_INFO_IN_TASK select TRACE_IRQFLAGS_SUPPORT + select TRACE_IRQFLAGS_NMI_SUPPORT select USER_STACKTRACE_SUPPORT select VIRT_TO_BUS select HAVE_ARCH_KCSAN if X86_64 diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index d3a6f74a94bd..d4d6db4dde22 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug @@ -1,8 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 =20 -config TRACE_IRQFLAGS_NMI_SUPPORT - def_bool y - config EARLY_PRINTK_USB bool =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FEACC2BBC5 for ; Mon, 15 Aug 2022 20:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347784AbiHOU0h (ORCPT ); Mon, 15 Aug 2022 16:26:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346705AbiHOUU6 (ORCPT ); Mon, 15 Aug 2022 16:20:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01EFF98593; Mon, 15 Aug 2022 12:00:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5478661296; Mon, 15 Aug 2022 19:00:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64917C433D7; Mon, 15 Aug 2022 19:00:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590055; bh=OXZCHrkyCbLkl9jdNZjncEsvl/fTVJvTADUZUqZjCQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aN1BkbY+KLSQkrTgvUEdYovoo16s5rceueAAgF3lQGRh3NBZKlEqgy+3QCNUbZqad dJ4RkAwJ9BeeRmdg+PdJFXp85KDe2bPlfYTiiKcdIckA7wnr/fHjl+as69LDyWfwJ8 ccAhNdp5Zhdwr6lPtK4TjvoV4lZQ3xgQkOy8hTSo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Francis Laniel , Will Deacon , Sasha Levin Subject: [PATCH 5.18 0137/1095] arm64: Do not forget syscall when starting a new thread. Date: Mon, 15 Aug 2022 19:52:16 +0200 Message-Id: <20220815180435.259796503@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Francis Laniel [ Upstream commit de6921856f99c11d3986c6702d851e1328d4f7f6 ] Enable tracing of the execve*() system calls with the syscalls:sys_exit_execve tracepoint by removing the call to forget_syscall() when starting a new thread and preserving the value of regs->syscallno across exec. Signed-off-by: Francis Laniel Link: https://lore.kernel.org/r/20220608162447.666494-2-flaniel@linux.micro= soft.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/include/asm/processor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/pr= ocessor.h index 6b1a12c23fe7..7058bf047fa5 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -250,8 +250,9 @@ void tls_preserve_current_state(void); =20 static inline void start_thread_common(struct pt_regs *regs, unsigned long= pc) { + s32 previous_syscall =3D regs->syscallno; memset(regs, 0, sizeof(*regs)); - forget_syscall(regs); + regs->syscallno =3D previous_syscall; regs->pc =3D pc; =20 if (system_uses_irq_prio_masking()) --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2121C00140 for ; Mon, 15 Aug 2022 20:27:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347033AbiHOU1R (ORCPT ); Mon, 15 Aug 2022 16:27:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346699AbiHOUU5 (ORCPT ); Mon, 15 Aug 2022 16:20:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3557798A45; Mon, 15 Aug 2022 12:01:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4798561299; Mon, 15 Aug 2022 19:00:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 221CFC43470; Mon, 15 Aug 2022 19:00:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590058; bh=8SMpDs+qLkU3eSZtrCGgQx5CHK2Yl0vTWXKJJG+w0B0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1P8R62ppPOJHtz/X9brhPbjSf22CeJsWGEM0cQJFRly50pbd7ohDIjx6UZ6/I1NcD 1Ed9HrxKXEnNkw8WHElZVd6eWZNfVkDIYxJk/kKXhPW/rIeveehyoZdRPgA90U5BSI 6GaFo99N1MeV/hysn66eCeEQ7twYgdJkHe2GJe+A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, hewenliang , Haibin Zhang , Catalin Marinas , Will Deacon , Sasha Levin Subject: [PATCH 5.18 0138/1095] arm64: fix oops in concurrently setting insn_emulation sysctls Date: Mon, 15 Aug 2022 19:52:17 +0200 Message-Id: <20220815180435.291761918@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: haibinzhang (=E5=BC=A0=E6=B5=B7=E6=96=8C) [ Upstream commit af483947d472eccb79e42059276c4deed76f99a6 ] emulation_proc_handler() changes table->data for proc_dointvec_minmax and can generate the following Oops if called concurrently with itself: | Unable to handle kernel NULL pointer dereference at virtual address 0000= 000000000010 | Internal error: Oops: 96000006 [#1] SMP | Call trace: | update_insn_emulation_mode+0xc0/0x148 | emulation_proc_handler+0x64/0xb8 | proc_sys_call_handler+0x9c/0xf8 | proc_sys_write+0x18/0x20 | __vfs_write+0x20/0x48 | vfs_write+0xe4/0x1d0 | ksys_write+0x70/0xf8 | __arm64_sys_write+0x20/0x28 | el0_svc_common.constprop.0+0x7c/0x1c0 | el0_svc_handler+0x2c/0xa0 | el0_svc+0x8/0x200 To fix this issue, keep the table->data as &insn->current_mode and use container_of() to retrieve the insn pointer. Another mutex is used to protect against the current_mode update but not for retrieving insn_emulation as table->data is no longer changing. Co-developed-by: hewenliang Signed-off-by: hewenliang Signed-off-by: Haibin Zhang Reviewed-by: Catalin Marinas Link: https://lore.kernel.org/r/20220128090324.2727688-1-hewenliang4@huawei= .com Link: https://lore.kernel.org/r/9A004C03-250B-46C5-BF39-782D7551B00E@tencen= t.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/kernel/armv8_deprecated.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8= _deprecated.c index 6875a16b09d2..fb0e7c7b2e20 100644 --- a/arch/arm64/kernel/armv8_deprecated.c +++ b/arch/arm64/kernel/armv8_deprecated.c @@ -59,6 +59,7 @@ struct insn_emulation { static LIST_HEAD(insn_emulation); static int nr_insn_emulated __initdata; static DEFINE_RAW_SPINLOCK(insn_emulation_lock); +static DEFINE_MUTEX(insn_emulation_mutex); =20 static void register_emulation_hooks(struct insn_emulation_ops *ops) { @@ -207,10 +208,10 @@ static int emulation_proc_handler(struct ctl_table *t= able, int write, loff_t *ppos) { int ret =3D 0; - struct insn_emulation *insn =3D (struct insn_emulation *) table->data; + struct insn_emulation *insn =3D container_of(table->data, struct insn_emu= lation, current_mode); enum insn_emulation_mode prev_mode =3D insn->current_mode; =20 - table->data =3D &insn->current_mode; + mutex_lock(&insn_emulation_mutex); ret =3D proc_dointvec_minmax(table, write, buffer, lenp, ppos); =20 if (ret || !write || prev_mode =3D=3D insn->current_mode) @@ -223,7 +224,7 @@ static int emulation_proc_handler(struct ctl_table *tab= le, int write, update_insn_emulation_mode(insn, INSN_UNDEF); } ret: - table->data =3D insn; + mutex_unlock(&insn_emulation_mutex); return ret; } =20 @@ -247,7 +248,7 @@ static void __init register_insn_emulation_sysctl(void) sysctl->maxlen =3D sizeof(int); =20 sysctl->procname =3D insn->ops->name; - sysctl->data =3D insn; + sysctl->data =3D &insn->current_mode; sysctl->extra1 =3D &insn->min; sysctl->extra2 =3D &insn->max; sysctl->proc_handler =3D emulation_proc_handler; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61C6AC25B08 for ; Mon, 15 Aug 2022 20:27:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347338AbiHOU1U (ORCPT ); Mon, 15 Aug 2022 16:27:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346913AbiHOUVe (ORCPT ); Mon, 15 Aug 2022 16:21:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C268698C83; Mon, 15 Aug 2022 12:01:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1720E61281; Mon, 15 Aug 2022 19:01:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C3F0C433D6; Mon, 15 Aug 2022 19:01:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590061; bh=vNUtB1P/IFS9iU1uA3u5SiDX2rmwure8KH5yPxre4No=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=We8ukadPaZi7gPRa2aIsi2l2rQ63WK9yS67nqCHdoaqz/60uwQ+DAgqASeckAg20v I5+KbxgIqfH//62dI0dO8PD0ziqHNnko+AWHhTaXGp9ICBQHABN6KZ3bkIZ/HJzsa0 DZQQr1/sC/0YJwg6ueNvIbXZvjhLA0o0HWhPb4Dk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Catalin Marinas , Will Deacon , Vincenzo Frascino , Andrey Konovalov , Peter Collingbourne , Sasha Levin Subject: [PATCH 5.18 0139/1095] arm64: kasan: Revert "arm64: mte: reset the page tag in page->flags" Date: Mon, 15 Aug 2022 19:52:18 +0200 Message-Id: <20220815180435.331228321@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Catalin Marinas [ Upstream commit 20794545c14692094a882d2221c251c4573e6adf ] This reverts commit e5b8d9218951e59df986f627ec93569a0d22149b. Pages mapped in user-space with PROT_MTE have the allocation tags either zeroed or copied/restored to some user values. In order for the kernel to access such pages via page_address(), resetting the tag in page->flags was necessary. This tag resetting was deferred to set_pte_at() -> mte_sync_page_tags() but it can race with another CPU reading the flags (via page_to_virt()): P0 (mte_sync_page_tags): P1 (memcpy from virt_to_page): Rflags!=3D0xff Wflags=3D0xff DMB (doesn't help) Wtags=3D0 Rtags=3D0 // fault Since now the post_alloc_hook() function resets the page->flags tag when unpoisoning is skipped for user pages (including the __GFP_ZEROTAGS case), revert the arm64 commit calling page_kasan_tag_reset(). Signed-off-by: Catalin Marinas Cc: Will Deacon Cc: Vincenzo Frascino Cc: Andrey Konovalov Cc: Peter Collingbourne Reviewed-by: Vincenzo Frascino Acked-by: Andrey Konovalov Link: https://lore.kernel.org/r/20220610152141.2148929-5-catalin.marinas@ar= m.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/kernel/hibernate.c | 5 ----- arch/arm64/kernel/mte.c | 9 --------- arch/arm64/mm/copypage.c | 9 --------- arch/arm64/mm/mteswap.c | 9 --------- 4 files changed, 32 deletions(-) diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c index 6328308be272..7754ef328657 100644 --- a/arch/arm64/kernel/hibernate.c +++ b/arch/arm64/kernel/hibernate.c @@ -300,11 +300,6 @@ static void swsusp_mte_restore_tags(void) unsigned long pfn =3D xa_state.xa_index; struct page *page =3D pfn_to_online_page(pfn); =20 - /* - * It is not required to invoke page_kasan_tag_reset(page) - * at this point since the tags stored in page->flags are - * already restored. - */ mte_restore_page_tags(page_address(page), tags); =20 mte_free_tag_storage(tags); diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c index d502703e8373..d565ae25e48f 100644 --- a/arch/arm64/kernel/mte.c +++ b/arch/arm64/kernel/mte.c @@ -47,15 +47,6 @@ static void mte_sync_page_tags(struct page *page, pte_t = old_pte, if (!pte_is_tagged) return; =20 - page_kasan_tag_reset(page); - /* - * We need smp_wmb() in between setting the flags and clearing the - * tags because if another thread reads page->flags and builds a - * tagged address out of it, there is an actual dependency to the - * memory access, but on the current thread we do not guarantee that - * the new page->flags are visible before the tags were updated. - */ - smp_wmb(); mte_clear_page_tags(page_address(page)); } =20 diff --git a/arch/arm64/mm/copypage.c b/arch/arm64/mm/copypage.c index 0dea80bf6de4..24913271e898 100644 --- a/arch/arm64/mm/copypage.c +++ b/arch/arm64/mm/copypage.c @@ -23,15 +23,6 @@ void copy_highpage(struct page *to, struct page *from) =20 if (system_supports_mte() && test_bit(PG_mte_tagged, &from->flags)) { set_bit(PG_mte_tagged, &to->flags); - page_kasan_tag_reset(to); - /* - * We need smp_wmb() in between setting the flags and clearing the - * tags because if another thread reads page->flags and builds a - * tagged address out of it, there is an actual dependency to the - * memory access, but on the current thread we do not guarantee that - * the new page->flags are visible before the tags were updated. - */ - smp_wmb(); mte_copy_page_tags(kto, kfrom); } } diff --git a/arch/arm64/mm/mteswap.c b/arch/arm64/mm/mteswap.c index a9e50e930484..4334dec93bd4 100644 --- a/arch/arm64/mm/mteswap.c +++ b/arch/arm64/mm/mteswap.c @@ -53,15 +53,6 @@ bool mte_restore_tags(swp_entry_t entry, struct page *pa= ge) if (!tags) return false; =20 - page_kasan_tag_reset(page); - /* - * We need smp_wmb() in between setting the flags and clearing the - * tags because if another thread reads page->flags and builds a - * tagged address out of it, there is an actual dependency to the - * memory access, but on the current thread we do not guarantee that - * the new page->flags are visible before the tags were updated. - */ - smp_wmb(); mte_restore_page_tags(page_address(page), tags); =20 return true; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E3A7C2BB9D for ; Mon, 15 Aug 2022 20:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347811AbiHOU0j (ORCPT ); Mon, 15 Aug 2022 16:26:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347077AbiHOUV5 (ORCPT ); Mon, 15 Aug 2022 16:21:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DE6298D24; Mon, 15 Aug 2022 12:01:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EBC89B810A1; Mon, 15 Aug 2022 19:01:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC971C433C1; Mon, 15 Aug 2022 19:01:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590064; bh=xExqZ2cjy5zyFW10bCJOCsLa1DT07p+HNJ7TEKasfsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yy2F37Kmgp6gDi/WpMfXTKK9lf2uOUF+4Zq+aZbJ/c/s5SxfcRUvmqqws09+g6Jig zCYb4v6CBHwkNyc3Qgk1RR1UljLpuIdH0bzH4M988Rrm7kA1J5AT1hqEUtsoYPVJ7O 1YzHfwxG07g9qKlUXRmJ/l6eFiy+Rxr1+Kp9MLjU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , James Morse , Will Deacon , Sasha Levin Subject: [PATCH 5.18 0140/1095] arm64: errata: Remove AES hwcap for COMPAT tasks Date: Mon, 15 Aug 2022 19:52:19 +0200 Message-Id: <20220815180435.366390465@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Morse [ Upstream commit 44b3834b2eed595af07021b1c64e6f9bc396398b ] Cortex-A57 and Cortex-A72 have an erratum where an interrupt that occurs between a pair of AES instructions in aarch32 mode may corrupt the ELR. The task will subsequently produce the wrong AES result. The AES instructions are part of the cryptographic extensions, which are optional. User-space software will detect the support for these instructions from the hwcaps. If the platform doesn't support these instructions a software implementation should be used. Remove the hwcap bits on affected parts to indicate user-space should not use the AES instructions. Acked-by: Ard Biesheuvel Signed-off-by: James Morse Link: https://lore.kernel.org/r/20220714161523.279570-3-james.morse@arm.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- Documentation/arm64/silicon-errata.rst | 4 ++++ arch/arm64/Kconfig | 16 ++++++++++++++++ arch/arm64/kernel/cpu_errata.c | 16 ++++++++++++++++ arch/arm64/kernel/cpufeature.c | 14 +++++++++++++- arch/arm64/tools/cpucaps | 1 + 5 files changed, 50 insertions(+), 1 deletion(-) diff --git a/Documentation/arm64/silicon-errata.rst b/Documentation/arm64/s= ilicon-errata.rst index d27db84d585e..0b4235b1f8c4 100644 --- a/Documentation/arm64/silicon-errata.rst +++ b/Documentation/arm64/silicon-errata.rst @@ -82,10 +82,14 @@ stable kernels. +----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A57 | #1319537 | ARM64_ERRATUM_13193= 67 | +----------------+-----------------+-----------------+--------------------= ---------+ +| ARM | Cortex-A57 | #1742098 | ARM64_ERRATUM_17420= 98 | ++----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A72 | #853709 | N/A = | +----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A72 | #1319367 | ARM64_ERRATUM_13193= 67 | +----------------+-----------------+-----------------+--------------------= ---------+ +| ARM | Cortex-A72 | #1655431 | ARM64_ERRATUM_17420= 98 | ++----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A73 | #858921 | ARM64_ERRATUM_85892= 1 | +----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A76 | #1188873,1418040| ARM64_ERRATUM_14180= 40 | diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 20ea89d9ac2f..b2d5a1e8eda3 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -500,6 +500,22 @@ config ARM64_ERRATUM_834220 =20 If unsure, say Y. =20 +config ARM64_ERRATUM_1742098 + bool "Cortex-A57/A72: 1742098: ELR recorded incorrectly on interrupt take= n between cryptographic instructions in a sequence" + depends on COMPAT + default y + help + This option removes the AES hwcap for aarch32 user-space to + workaround erratum 1742098 on Cortex-A57 and Cortex-A72. + + Affected parts may corrupt the AES state if an interrupt is + taken between a pair of AES instructions. These instructions + are only present if the cryptography extensions are present. + All software should have a fallback implementation for CPUs + that don't implement the cryptography extensions. + + If unsure, say Y. + config ARM64_ERRATUM_845719 bool "Cortex-A53: 845719: a load might read incorrect data" depends on COMPAT diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index a0f3d0aaa3c5..27baa41c46ca 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -395,6 +395,14 @@ static struct midr_range trbe_write_out_of_range_cpus[= ] =3D { }; #endif /* CONFIG_ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE */ =20 +#ifdef CONFIG_ARM64_ERRATUM_1742098 +static struct midr_range broken_aarch32_aes[] =3D { + MIDR_RANGE(MIDR_CORTEX_A57, 0, 1, 0xf, 0xf), + MIDR_ALL_VERSIONS(MIDR_CORTEX_A72), + {}, +}; +#endif /* CONFIG_ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE */ + const struct arm64_cpu_capabilities arm64_errata[] =3D { #ifdef CONFIG_ARM64_WORKAROUND_CLEAN_CACHE { @@ -657,6 +665,14 @@ const struct arm64_cpu_capabilities arm64_errata[] =3D= { /* Cortex-A510 r0p0 - r0p1 */ ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 1) }, +#endif +#ifdef CONFIG_ARM64_ERRATUM_1742098 + { + .desc =3D "ARM erratum 1742098", + .capability =3D ARM64_WORKAROUND_1742098, + CAP_MIDR_RANGE_LIST(broken_aarch32_aes), + .type =3D ARM64_CPUCAP_LOCAL_CPU_ERRATUM, + }, #endif { } diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 2cb9cc9e0eff..5357ba7ea3c7 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -79,6 +79,7 @@ #include #include #include +#include #include #include #include @@ -1921,6 +1922,14 @@ static void cpu_enable_mte(struct arm64_cpu_capabili= ties const *cap) } #endif /* CONFIG_ARM64_MTE */ =20 +static void elf_hwcap_fixup(void) +{ +#ifdef CONFIG_ARM64_ERRATUM_1742098 + if (cpus_have_const_cap(ARM64_WORKAROUND_1742098)) + compat_elf_hwcap2 &=3D ~COMPAT_HWCAP2_AES; +#endif /* ARM64_ERRATUM_1742098 */ +} + #ifdef CONFIG_KVM static bool is_kvm_protected_mode(const struct arm64_cpu_capabilities *ent= ry, int __unused) { @@ -3033,8 +3042,10 @@ void __init setup_cpu_features(void) setup_system_capabilities(); setup_elf_hwcaps(arm64_elf_hwcaps); =20 - if (system_supports_32bit_el0()) + if (system_supports_32bit_el0()) { setup_elf_hwcaps(compat_elf_hwcaps); + elf_hwcap_fixup(); + } =20 if (system_uses_ttbr0_pan()) pr_info("emulated: Privileged Access Never (PAN) using TTBR0_EL1 switchi= ng\n"); @@ -3086,6 +3097,7 @@ static int enable_mismatched_32bit_el0(unsigned int c= pu) cpu_active_mask); get_cpu_device(lucky_winner)->offline_disabled =3D true; setup_elf_hwcaps(compat_elf_hwcaps); + elf_hwcap_fixup(); pr_info("Asymmetric 32-bit EL0 support detected on CPU %u; CPU hot-unplug= disabled on CPU %u\n", cpu, lucky_winner); return 0; diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps index 3ed418f70e3b..8cd6088f8875 100644 --- a/arch/arm64/tools/cpucaps +++ b/arch/arm64/tools/cpucaps @@ -58,6 +58,7 @@ WORKAROUND_1418040 WORKAROUND_1463225 WORKAROUND_1508412 WORKAROUND_1542419 +WORKAROUND_1742098 WORKAROUND_1902691 WORKAROUND_2038923 WORKAROUND_2064142 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9B5FC00140 for ; Mon, 15 Aug 2022 20:27:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347372AbiHOU11 (ORCPT ); Mon, 15 Aug 2022 16:27:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347082AbiHOUV5 (ORCPT ); Mon, 15 Aug 2022 16:21:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC7A298D3A; Mon, 15 Aug 2022 12:01:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0E68B61230; Mon, 15 Aug 2022 19:01:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1689AC433D6; Mon, 15 Aug 2022 19:01:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590067; bh=Ll3VrOpxsVmeadqheby9L6HRHAFePhaWMYtkUoqpQtY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tSiP4VNKNnVW2y8TnavONPG1nQjNeI+AeKQM8mNUPkPDeH4EPYPURm08eP9rTP5AH i2cosss8il3yW3TYaYwA7rVZOHIgAzcdfb78ifC3F8HB7GeH/wW6zzFf5ahcAB5PqQ uIohsAwwWoRV+abtzwE97RDvNsgN6s3okldhMXRg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+d273f7d7f58afd93be48@syzkaller.appspotmail.com, Jan Kara , Sasha Levin Subject: [PATCH 5.18 0141/1095] ext2: Add more validity checks for inode counts Date: Mon, 15 Aug 2022 19:52:20 +0200 Message-Id: <20220815180435.414430515@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara [ Upstream commit fa78f336937240d1bc598db817d638086060e7e9 ] Add checks verifying number of inodes stored in the superblock matches the number computed from number of inodes per group. Also verify we have at least one block worth of inodes per group. This prevents crashes on corrupted filesystems. Reported-by: syzbot+d273f7d7f58afd93be48@syzkaller.appspotmail.com Signed-off-by: Jan Kara Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ext2/super.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fs/ext2/super.c b/fs/ext2/super.c index f6a19f6d9f6d..cdffa2a041af 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -1059,9 +1059,10 @@ static int ext2_fill_super(struct super_block *sb, v= oid *data, int silent) sbi->s_frags_per_group); goto failed_mount; } - if (sbi->s_inodes_per_group > sb->s_blocksize * 8) { + if (sbi->s_inodes_per_group < sbi->s_inodes_per_block || + sbi->s_inodes_per_group > sb->s_blocksize * 8) { ext2_msg(sb, KERN_ERR, - "error: #inodes per group too big: %lu", + "error: invalid #inodes per group: %lu", sbi->s_inodes_per_group); goto failed_mount; } @@ -1071,6 +1072,13 @@ static int ext2_fill_super(struct super_block *sb, v= oid *data, int silent) sbi->s_groups_count =3D ((le32_to_cpu(es->s_blocks_count) - le32_to_cpu(es->s_first_data_block) - 1) / EXT2_BLOCKS_PER_GROUP(sb)) + 1; + if ((u64)sbi->s_groups_count * sbi->s_inodes_per_group !=3D + le32_to_cpu(es->s_inodes_count)) { + ext2_msg(sb, KERN_ERR, "error: invalid #inodes: %u vs computed %llu", + le32_to_cpu(es->s_inodes_count), + (u64)sbi->s_groups_count * sbi->s_inodes_per_group); + goto failed_mount; + } db_count =3D (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / EXT2_DESC_PER_BLOCK(sb); sbi->s_group_desc =3D kmalloc_array(db_count, --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D8DEC32762 for ; Mon, 15 Aug 2022 20:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347848AbiHOU0n (ORCPT ); Mon, 15 Aug 2022 16:26:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347161AbiHOUV7 (ORCPT ); Mon, 15 Aug 2022 16:21:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2451F99266; Mon, 15 Aug 2022 12:01:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3582761296; Mon, 15 Aug 2022 19:01:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0116FC433D6; Mon, 15 Aug 2022 19:01:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590070; bh=Wsz5l7ex1PkMR1FcuYHdCreATWbyvIuUO8E5Bpd/vdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yZrSFuVT22hZa+Q2DhkuxysTQ8MIOhdTH8Ah65yyFdxDOaR3/lR0jgCMMWpstvuW/ +rVZieGcjlpuKpiW1dLg/Xx+CbEg9CfAE193jJmWmrcdLHPM3zHBnBz1YPT44T7+KJ art2TuC5ns62+e9HGyauUpFqSMJ4agHdy/jvp1aY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tim Chen , Peter Zijlstra , Chen Yu , Yicong Yang , Mohini Narkhede , K Prateek Nayak , Sasha Levin Subject: [PATCH 5.18 0142/1095] sched/fair: Introduce SIS_UTIL to search idle CPU based on sum of util_avg Date: Mon, 15 Aug 2022 19:52:21 +0200 Message-Id: <20220815180435.462070389@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chen Yu [ Upstream commit 70fb5ccf2ebb09a0c8ebba775041567812d45f86 ] [Problem Statement] select_idle_cpu() might spend too much time searching for an idle CPU, when the system is overloaded. The following histogram is the time spent in select_idle_cpu(), when running 224 instances of netperf on a system with 112 CPUs per LLC domain: @usecs: [0] 533 | = | [1] 5495 | = | [2, 4) 12008 | = | [4, 8) 239252 | = | [8, 16) 4041924 |@@@@@@@@@@@@@@ = | [16, 32) 12357398 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ = | [32, 64) 14820255 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@= @@@| [64, 128) 13047682 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ = | [128, 256) 8235013 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@ = | [256, 512) 4507667 |@@@@@@@@@@@@@@@ = | [512, 1K) 2600472 |@@@@@@@@@ = | [1K, 2K) 927912 |@@@ = | [2K, 4K) 218720 | = | [4K, 8K) 98161 | = | [8K, 16K) 37722 | = | [16K, 32K) 6715 | = | [32K, 64K) 477 | = | [64K, 128K) 7 | = | netperf latency usecs: =3D=3D=3D=3D=3D=3D=3D case load Lat_99th std% TCP_RR thread-224 257.39 ( 0.21) The time spent in select_idle_cpu() is visible to netperf and might have a = negative impact. [Symptom analysis] The patch [1] from Mel Gorman has been applied to track the efficiency of select_idle_sibling. Copy the indicators here: SIS Search Efficiency(se_eff%): A ratio expressed as a percentage of runqueues scanned versus idle CPUs found. A 100% efficiency indicates that the target, prev or recent CPU of a task was idle at wakeup. The lower the efficiency, the more runqueues were scanned before an idle CPU was found. SIS Domain Search Efficiency(dom_eff%): Similar, except only for the slower SIS patch. SIS Fast Success Rate(fast_rate%): Percentage of SIS that used target, prev or recent CPUs. SIS Success rate(success_rate%): Percentage of scans that found an idle CPU. The test is based on Aubrey's schedtests tool, including netperf, hackbench, schbench and tbench. Test on vanilla kernel: schedstat_parse.py -f netperf_vanilla.log case load se_eff% dom_eff% fast_rate% success_rate% TCP_RR 28 threads 99.978 18.535 99.995 100.000 TCP_RR 56 threads 99.397 5.671 99.964 100.000 TCP_RR 84 threads 21.721 6.818 73.632 100.000 TCP_RR 112 threads 12.500 5.533 59.000 100.000 TCP_RR 140 threads 8.524 4.535 49.020 100.000 TCP_RR 168 threads 6.438 3.945 40.309 99.999 TCP_RR 196 threads 5.397 3.718 32.320 99.982 TCP_RR 224 threads 4.874 3.661 25.775 99.767 UDP_RR 28 threads 99.988 17.704 99.997 100.000 UDP_RR 56 threads 99.528 5.977 99.970 100.000 UDP_RR 84 threads 24.219 6.992 76.479 100.000 UDP_RR 112 threads 13.907 5.706 62.538 100.000 UDP_RR 140 threads 9.408 4.699 52.519 100.000 UDP_RR 168 threads 7.095 4.077 44.352 100.000 UDP_RR 196 threads 5.757 3.775 35.764 99.991 UDP_RR 224 threads 5.124 3.704 28.748 99.860 schedstat_parse.py -f schbench_vanilla.log (each group has 28 tasks) case load se_eff% dom_eff% fast_rate% success_rate% normal 1 mthread 99.152 6.400 99.941 100.000 normal 2 mthreads 97.844 4.003 99.908 100.000 normal 3 mthreads 96.395 2.118 99.917 99.998 normal 4 mthreads 55.288 1.451 98.615 99.804 normal 5 mthreads 7.004 1.870 45.597 61.036 normal 6 mthreads 3.354 1.346 20.777 34.230 normal 7 mthreads 2.183 1.028 11.257 21.055 normal 8 mthreads 1.653 0.825 7.849 15.549 schedstat_parse.py -f hackbench_vanilla.log (each group has 28 tasks) case load se_eff% dom_eff% fast_rate% success_rate% process-pipe 1 group 99.991 7.692 99.999 10= 0.000 process-pipe 2 groups 99.934 4.615 99.997 10= 0.000 process-pipe 3 groups 99.597 3.198 99.987 10= 0.000 process-pipe 4 groups 98.378 2.464 99.958 10= 0.000 process-pipe 5 groups 27.474 3.653 89.811 9= 9.800 process-pipe 6 groups 20.201 4.098 82.763 9= 9.570 process-pipe 7 groups 16.423 4.156 77.398 9= 9.316 process-pipe 8 groups 13.165 3.920 72.232 9= 8.828 process-sockets 1 group 99.977 5.882 99.999 = 100.000 process-sockets 2 groups 99.927 5.505 99.996 = 100.000 process-sockets 3 groups 99.397 3.250 99.980 = 100.000 process-sockets 4 groups 79.680 4.258 98.864 = 99.998 process-sockets 5 groups 7.673 2.503 63.659 = 92.115 process-sockets 6 groups 4.642 1.584 58.946 = 88.048 process-sockets 7 groups 3.493 1.379 49.816 = 81.164 process-sockets 8 groups 3.015 1.407 40.845 = 75.500 threads-pipe 1 group 99.997 0.000 100.000 10= 0.000 threads-pipe 2 groups 99.894 2.932 99.997 10= 0.000 threads-pipe 3 groups 99.611 4.117 99.983 10= 0.000 threads-pipe 4 groups 97.703 2.624 99.937 10= 0.000 threads-pipe 5 groups 22.919 3.623 87.150 9= 9.764 threads-pipe 6 groups 18.016 4.038 80.491 9= 9.557 threads-pipe 7 groups 14.663 3.991 75.239 9= 9.247 threads-pipe 8 groups 12.242 3.808 70.651 9= 8.644 threads-sockets 1 group 99.990 6.667 99.999 = 100.000 threads-sockets 2 groups 99.940 5.114 99.997 = 100.000 threads-sockets 3 groups 99.469 4.115 99.977 = 100.000 threads-sockets 4 groups 87.528 4.038 99.400 = 100.000 threads-sockets 5 groups 6.942 2.398 59.244 = 88.337 threads-sockets 6 groups 4.359 1.954 49.448 = 87.860 threads-sockets 7 groups 2.845 1.345 41.198 = 77.102 threads-sockets 8 groups 2.871 1.404 38.512 = 74.312 schedstat_parse.py -f tbench_vanilla.log case load se_eff% dom_eff% fast_rate% success_rate% loopback 28 threads 99.976 18.369 99.995 100.000 loopback 56 threads 99.222 7.799 99.934 100.000 loopback 84 threads 19.723 6.819 70.215 100.000 loopback 112 threads 11.283 5.371 55.371 99.999 loopback 140 threads 0.000 0.000 0.000 0.000 loopback 168 threads 0.000 0.000 0.000 0.000 loopback 196 threads 0.000 0.000 0.000 0.000 loopback 224 threads 0.000 0.000 0.000 0.000 According to the test above, if the system becomes busy, the SIS Search Efficiency(se_eff%) drops significantly. Although some benchmarks would finally find an idle CPU(success_rate% =3D 100%), it is doubtful whether it is worth it to search the whole LLC domain. [Proposal] It would be ideal to have a crystal ball to answer this question: How many CPUs must a wakeup path walk down, before it can find an idle CPU? Many potential metrics could be used to predict the number. One candidate is the sum of util_avg in this LLC domain. The benefit of choosing util_avg is that it is a metric of accumulated historic activity, which seems to be smoother than instantaneous metrics (such as rq->nr_running). Besides, choosing the sum of util_avg would help predict the load of the LLC domain more precisely, because SIS_PROP uses one CPU's idle time to estimate the total LLC domain idle time. In summary, the lower the util_avg is, the more select_idle_cpu() should scan for idle CPU, and vice versa. When the sum of util_avg in this LLC domain hits 85% or above, the scan stops. The reason to choose 85% as the threshold is that this is the imbalance_pct(117) when a LLC sched group is overloaded. Introduce the quadratic function: y =3D SCHED_CAPACITY_SCALE - p * x^2 and y'=3D y / SCHED_CAPACITY_SCALE x is the ratio of sum_util compared to the CPU capacity: x =3D sum_util / (llc_weight * SCHED_CAPACITY_SCALE) y' is the ratio of CPUs to be scanned in the LLC domain, and the number of CPUs to scan is calculated by: nr_scan =3D llc_weight * y' Choosing quadratic function is because: [1] Compared to the linear function, it scans more aggressively when the sum_util is low. [2] Compared to the exponential function, it is easier to calculate. [3] It seems that there is no accurate mapping between the sum of util_avg and the number of CPUs to be scanned. Use heuristic scan for now. For a platform with 112 CPUs per LLC, the number of CPUs to scan is: sum_util% 0 5 15 25 35 45 55 65 75 85 86 ... scan_nr 112 111 108 102 93 81 65 47 25 1 0 ... For a platform with 16 CPUs per LLC, the number of CPUs to scan is: sum_util% 0 5 15 25 35 45 55 65 75 85 86 ... scan_nr 16 15 15 14 13 11 9 6 3 0 0 ... Furthermore, to minimize the overhead of calculating the metrics in select_idle_cpu(), borrow the statistics from periodic load balance. As mentioned by Abel, on a platform with 112 CPUs per LLC, the sum_util calculated by periodic load balance after 112 ms would decay to about 0.5 * 0.5 * 0.5 * 0.7 =3D 8.75%, thus bringing a delay in reflecting the latest utilization. But it is a trade-off. Checking the util_avg in newidle load balance would be more frequent, but it brings overhead - multiple CPUs write/read the per-LLC shared variable and introduces cache contention. Tim also mentioned that, it is allowed to be non-optimal in terms of scheduling for the short-term variations, but if there is a long-term trend in the load behavior, the scheduler can adjust for that. When SIS_UTIL is enabled, the select_idle_cpu() uses the nr_scan calculated by SIS_UTIL instead of the one from SIS_PROP. As Peter and Mel suggested, SIS_UTIL should be enabled by default. This patch is based on the util_avg, which is very sensitive to the CPU frequency invariance. There is an issue that, when the max frequency has been clamp, the util_avg would decay insanely fast when the CPU is idle. Commit addca285120b ("cpufreq: intel_pstate: Handle no_tur= bo in frequency invariance") could be used to mitigate this symptom, by adjust= ing the arch_max_freq_ratio when turbo is disabled. But this issue is still not thoroughly fixed, because the current code is unaware of the user-speci= fied max CPU frequency. [Test result] netperf and tbench were launched with 25% 50% 75% 100% 125% 150% 175% 200% of CPU number respectively. Hackbench and schbench were launched by 1, 2 ,4, 8 groups. Each test lasts for 100 seconds and repeats 3 times. The following is the benchmark result comparison between baseline:vanilla v5.19-rc1 and compare:patched kernel. Positive compare% indicates better performance. Each netperf test is a: netperf -4 -H 127.0.1 -t TCP/UDP_RR -c -C -l 100 netperf.throughput =3D=3D=3D=3D=3D=3D=3D case load baseline(std%) compare%( std%) TCP_RR 28 threads 1.00 ( 0.34) -0.16 ( 0.40) TCP_RR 56 threads 1.00 ( 0.19) -0.02 ( 0.20) TCP_RR 84 threads 1.00 ( 0.39) -0.47 ( 0.40) TCP_RR 112 threads 1.00 ( 0.21) -0.66 ( 0.22) TCP_RR 140 threads 1.00 ( 0.19) -0.69 ( 0.19) TCP_RR 168 threads 1.00 ( 0.18) -0.48 ( 0.18) TCP_RR 196 threads 1.00 ( 0.16) +194.70 ( 16.43) TCP_RR 224 threads 1.00 ( 0.16) +197.30 ( 7.85) UDP_RR 28 threads 1.00 ( 0.37) +0.35 ( 0.33) UDP_RR 56 threads 1.00 ( 11.18) -0.32 ( 0.21) UDP_RR 84 threads 1.00 ( 1.46) -0.98 ( 0.32) UDP_RR 112 threads 1.00 ( 28.85) -2.48 ( 19.61) UDP_RR 140 threads 1.00 ( 0.70) -0.71 ( 14.04) UDP_RR 168 threads 1.00 ( 14.33) -0.26 ( 11.16) UDP_RR 196 threads 1.00 ( 12.92) +186.92 ( 20.93) UDP_RR 224 threads 1.00 ( 11.74) +196.79 ( 18.62) Take the 224 threads as an example, the SIS search metrics changes are illustrated below: vanilla patched 4544492 +237.5% 15338634 sched_debug.cpu.sis_domain_se= arch.avg 38539 +39686.8% 15333634 sched_debug.cpu.sis_failed.avg 128300000 -87.9% 15551326 sched_debug.cpu.sis_scanned.a= vg 5842896 +162.7% 15347978 sched_debug.cpu.sis_search.avg There is -87.9% less CPU scans after patched, which indicates lower overhea= d. Besides, with this patch applied, there is -13% less rq lock contention in perf-profile.calltrace.cycles-pp._raw_spin_lock.raw_spin_rq_lock_nested .try_to_wake_up.default_wake_function.woken_wake_function. This might help explain the performance improvement - Because this patch al= lows the waking task to remain on the previous CPU, rather than grabbing other C= PUs' lock. Each hackbench test is a: hackbench -g $job --process/threads --pipe/sockets -l 1000000 -s 100 hackbench.throughput =3D=3D=3D=3D=3D=3D=3D=3D=3D case load baseline(std%) compare%( std%) process-pipe 1 group 1.00 ( 1.29) +0.57 ( 0.47) process-pipe 2 groups 1.00 ( 0.27) +0.77 ( 0.81) process-pipe 4 groups 1.00 ( 0.26) +1.17 ( 0.02) process-pipe 8 groups 1.00 ( 0.15) -4.79 ( 0.02) process-sockets 1 group 1.00 ( 0.63) -0.92 ( 0.13) process-sockets 2 groups 1.00 ( 0.03) -0.83 ( 0.14) process-sockets 4 groups 1.00 ( 0.40) +5.20 ( 0.26) process-sockets 8 groups 1.00 ( 0.04) +3.52 ( 0.03) threads-pipe 1 group 1.00 ( 1.28) +0.07 ( 0.14) threads-pipe 2 groups 1.00 ( 0.22) -0.49 ( 0.74) threads-pipe 4 groups 1.00 ( 0.05) +1.88 ( 0.13) threads-pipe 8 groups 1.00 ( 0.09) -4.90 ( 0.06) threads-sockets 1 group 1.00 ( 0.25) -0.70 ( 0.53) threads-sockets 2 groups 1.00 ( 0.10) -0.63 ( 0.26) threads-sockets 4 groups 1.00 ( 0.19) +11.92 ( 0.24) threads-sockets 8 groups 1.00 ( 0.08) +4.31 ( 0.11) Each tbench test is a: tbench -t 100 $job 127.0.0.1 tbench.throughput =3D=3D=3D=3D=3D=3D case load baseline(std%) compare%( std%) loopback 28 threads 1.00 ( 0.06) -0.14 ( 0.09) loopback 56 threads 1.00 ( 0.03) -0.04 ( 0.17) loopback 84 threads 1.00 ( 0.05) +0.36 ( 0.13) loopback 112 threads 1.00 ( 0.03) +0.51 ( 0.03) loopback 140 threads 1.00 ( 0.02) -1.67 ( 0.19) loopback 168 threads 1.00 ( 0.38) +1.27 ( 0.27) loopback 196 threads 1.00 ( 0.11) +1.34 ( 0.17) loopback 224 threads 1.00 ( 0.11) +1.67 ( 0.22) Each schbench test is a: schbench -m $job -t 28 -r 100 -s 30000 -c 30000 schbench.latency_90%_us =3D=3D=3D=3D=3D=3D=3D=3D case load baseline(std%) compare%( std%) normal 1 mthread 1.00 ( 31.22) -7.36 ( 20.25)* normal 2 mthreads 1.00 ( 2.45) -0.48 ( 1.79) normal 4 mthreads 1.00 ( 1.69) +0.45 ( 0.64) normal 8 mthreads 1.00 ( 5.47) +9.81 ( 14.28) *Consider the Standard Deviation, this -7.36% regression might not be valid. Also, a OLTP workload with a commercial RDBMS has been tested, and there is no significant change. There were concerns that unbalanced tasks among CPUs would cause problems. For example, suppose the LLC domain is composed of 8 CPUs, and 7 tasks are bound to CPU0~CPU6, while CPU7 is idle: CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7 util_avg 1024 1024 1024 1024 1024 1024 1024 0 Since the util_avg ratio is 87.5%( =3D 7/8 ), which is higher than 85%, select_idle_cpu() will not scan, thus CPU7 is undetected during scan. But according to Mel, it is unlikely the CPU7 will be idle all the time because CPU7 could pull some tasks via CPU_NEWLY_IDLE. lkp(kernel test robot) has reported a regression on stress-ng.sock on a very busy system. According to the sched_debug statistics, it might be caus= ed by SIS_UTIL terminates the scan and chooses a previous CPU earlier, and this might introduce more context switch, especially involuntary preemption, whi= ch impacts a busy stress-ng. This regression has shown that, not all benchmarks in every scenario benefit from idle CPU scan limit, and it needs further investigation. Besides, there is slight regression in hackbench's 16 groups case when the LLC domain has 16 CPUs. Prateek mentioned that we should scan aggressively in an LLC domain with 16 CPUs. Because the cost to search for an idle one among 16 CPUs is negligible. The current patch aims to propose a generic solution and only considers the util_avg. Something like the below could be applied on top of the current patch to fulfill the requirement: if (llc_weight <=3D 16) nr_scan =3D nr_scan * 32 / llc_weight; For LLC domain with 16 CPUs, the nr_scan will be expanded to 2 times large. The smaller the CPU number this LLC domain has, the larger nr_scan will be expanded. This needs further investigation. There is also ongoing work[2] from Abel to filter out the busy CPUs during wakeup, to further speed up the idle CPU scan. And it could be a following-= up optimization on top of this change. Suggested-by: Tim Chen Suggested-by: Peter Zijlstra Signed-off-by: Chen Yu Signed-off-by: Peter Zijlstra (Intel) Tested-by: Yicong Yang Tested-by: Mohini Narkhede Tested-by: K Prateek Nayak Link: https://lore.kernel.org/r/20220612163428.849378-1-yu.c.chen@intel.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/sched/topology.h | 1 + kernel/sched/fair.c | 87 ++++++++++++++++++++++++++++++++++ kernel/sched/features.h | 3 +- 3 files changed, 90 insertions(+), 1 deletion(-) diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index 56cffe42abbc..816df6cc444e 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -81,6 +81,7 @@ struct sched_domain_shared { atomic_t ref; atomic_t nr_busy_cpus; int has_idle_cores; + int nr_idle_scan; }; =20 struct sched_domain { diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index cc8daa3dcc8b..ef2d8690fe18 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6324,6 +6324,7 @@ static int select_idle_cpu(struct task_struct *p, str= uct sched_domain *sd, bool { struct cpumask *cpus =3D this_cpu_cpumask_var_ptr(select_idle_mask); int i, cpu, idle_cpu =3D -1, nr =3D INT_MAX; + struct sched_domain_shared *sd_share; struct rq *this_rq =3D this_rq(); int this =3D smp_processor_id(); struct sched_domain *this_sd; @@ -6363,6 +6364,17 @@ static int select_idle_cpu(struct task_struct *p, st= ruct sched_domain *sd, bool time =3D cpu_clock(this); } =20 + if (sched_feat(SIS_UTIL)) { + sd_share =3D rcu_dereference(per_cpu(sd_llc_shared, target)); + if (sd_share) { + /* because !--nr is the condition to stop scan */ + nr =3D READ_ONCE(sd_share->nr_idle_scan) + 1; + /* overloaded LLC is unlikely to have idle cpu/core */ + if (nr =3D=3D 1) + return -1; + } + } + for_each_cpu_wrap(cpu, cpus, target + 1) { if (has_idle_core) { i =3D select_idle_core(p, cpu, cpus, &idle_cpu); @@ -9253,6 +9265,77 @@ find_idlest_group(struct sched_domain *sd, struct ta= sk_struct *p, int this_cpu) return idlest; } =20 +static void update_idle_cpu_scan(struct lb_env *env, + unsigned long sum_util) +{ + struct sched_domain_shared *sd_share; + int llc_weight, pct; + u64 x, y, tmp; + /* + * Update the number of CPUs to scan in LLC domain, which could + * be used as a hint in select_idle_cpu(). The update of sd_share + * could be expensive because it is within a shared cache line. + * So the write of this hint only occurs during periodic load + * balancing, rather than CPU_NEWLY_IDLE, because the latter + * can fire way more frequently than the former. + */ + if (!sched_feat(SIS_UTIL) || env->idle =3D=3D CPU_NEWLY_IDLE) + return; + + llc_weight =3D per_cpu(sd_llc_size, env->dst_cpu); + if (env->sd->span_weight !=3D llc_weight) + return; + + sd_share =3D rcu_dereference(per_cpu(sd_llc_shared, env->dst_cpu)); + if (!sd_share) + return; + + /* + * The number of CPUs to search drops as sum_util increases, when + * sum_util hits 85% or above, the scan stops. + * The reason to choose 85% as the threshold is because this is the + * imbalance_pct(117) when a LLC sched group is overloaded. + * + * let y =3D SCHED_CAPACITY_SCALE - p * x^2 [1] + * and y'=3D y / SCHED_CAPACITY_SCALE + * + * x is the ratio of sum_util compared to the CPU capacity: + * x =3D sum_util / (llc_weight * SCHED_CAPACITY_SCALE) + * y' is the ratio of CPUs to be scanned in the LLC domain, + * and the number of CPUs to scan is calculated by: + * + * nr_scan =3D llc_weight * y' [2] + * + * When x hits the threshold of overloaded, AKA, when + * x =3D 100 / pct, y drops to 0. According to [1], + * p should be SCHED_CAPACITY_SCALE * pct^2 / 10000 + * + * Scale x by SCHED_CAPACITY_SCALE: + * x' =3D sum_util / llc_weight; [3] + * + * and finally [1] becomes: + * y =3D SCHED_CAPACITY_SCALE - + * x'^2 * pct^2 / (10000 * SCHED_CAPACITY_SCALE) [4] + * + */ + /* equation [3] */ + x =3D sum_util; + do_div(x, llc_weight); + + /* equation [4] */ + pct =3D env->sd->imbalance_pct; + tmp =3D x * x * pct * pct; + do_div(tmp, 10000 * SCHED_CAPACITY_SCALE); + tmp =3D min_t(long, tmp, SCHED_CAPACITY_SCALE); + y =3D SCHED_CAPACITY_SCALE - tmp; + + /* equation [2] */ + y *=3D llc_weight; + do_div(y, SCHED_CAPACITY_SCALE); + if ((int)y !=3D sd_share->nr_idle_scan) + WRITE_ONCE(sd_share->nr_idle_scan, (int)y); +} + /** * update_sd_lb_stats - Update sched_domain's statistics for load balancin= g. * @env: The load balancing environment. @@ -9265,6 +9348,7 @@ static inline void update_sd_lb_stats(struct lb_env *= env, struct sd_lb_stats *sd struct sched_group *sg =3D env->sd->groups; struct sg_lb_stats *local =3D &sds->local_stat; struct sg_lb_stats tmp_sgs; + unsigned long sum_util =3D 0; int sg_status =3D 0; =20 do { @@ -9297,6 +9381,7 @@ static inline void update_sd_lb_stats(struct lb_env *= env, struct sd_lb_stats *sd sds->total_load +=3D sgs->group_load; sds->total_capacity +=3D sgs->group_capacity; =20 + sum_util +=3D sgs->group_util; sg =3D sg->next; } while (sg !=3D env->sd->groups); =20 @@ -9322,6 +9407,8 @@ static inline void update_sd_lb_stats(struct lb_env *= env, struct sd_lb_stats *sd WRITE_ONCE(rd->overutilized, SG_OVERUTILIZED); trace_sched_overutilized_tp(rd, SG_OVERUTILIZED); } + + update_idle_cpu_scan(env, sum_util); } =20 #define NUMA_IMBALANCE_MIN 2 diff --git a/kernel/sched/features.h b/kernel/sched/features.h index 1cf435bbcd9c..ee7f23c76bd3 100644 --- a/kernel/sched/features.h +++ b/kernel/sched/features.h @@ -60,7 +60,8 @@ SCHED_FEAT(TTWU_QUEUE, true) /* * When doing wakeups, attempt to limit superfluous scans of the LLC domai= n. */ -SCHED_FEAT(SIS_PROP, true) +SCHED_FEAT(SIS_PROP, false) +SCHED_FEAT(SIS_UTIL, true) =20 /* * Issue a WARN when we do multiple update_rq_clock() calls --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86BF8C32757 for ; Mon, 15 Aug 2022 20:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347887AbiHOU0r (ORCPT ); Mon, 15 Aug 2022 16:26:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347184AbiHOUWB (ORCPT ); Mon, 15 Aug 2022 16:22:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18CF833417; Mon, 15 Aug 2022 12:01:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2FAA561299; Mon, 15 Aug 2022 19:01:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 350C1C433C1; Mon, 15 Aug 2022 19:01:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590073; bh=dL0Ydp8evCTHHeruYxpd94EwuBGQvyrxTcjrzl+PG+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cNYnvalNY1Hn21oB+J7U8AJZq+2W0bKB3TQG0BzzVZjaJ2PabWTBlFVwBX1x37lpD 1RN3waSnaCu0pAU9gAeiBA1U7dqM0Rzc6e3iFiSiICZIiqmCtkjaYPbvKow/1dAXbh zfv1Qlgb81s+2+6ZVzvpnjxDCqWZoMRqhb0ho1CI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antonio Borneo , Marc Zyngier , Sasha Levin Subject: [PATCH 5.18 0143/1095] genirq: Dont return error on missing optional irq_request_resources() Date: Mon, 15 Aug 2022 19:52:22 +0200 Message-Id: <20220815180435.501857120@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antonio Borneo [ Upstream commit 95001b756467ecc9f5973eb5e74e97699d9bbdf1 ] Function irq_chip::irq_request_resources() is reported as optional in the declaration of struct irq_chip. If the parent irq_chip does not implement it, we should ignore it and return. Don't return error if the functions is missing. Signed-off-by: Antonio Borneo Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220512160544.13561-1-antonio.borneo@foss.= st.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/irq/chip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 54af0deb239b..eb921485930f 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -1513,7 +1513,8 @@ int irq_chip_request_resources_parent(struct irq_data= *data) if (data->chip->irq_request_resources) return data->chip->irq_request_resources(data); =20 - return -ENOSYS; + /* no error on missing optional irq_chip::irq_request_resources */ + return 0; } EXPORT_SYMBOL_GPL(irq_chip_request_resources_parent); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B68A4C32765 for ; Mon, 15 Aug 2022 20:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347941AbiHOU06 (ORCPT ); Mon, 15 Aug 2022 16:26:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347193AbiHOUWC (ORCPT ); Mon, 15 Aug 2022 16:22:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8C674AD70; Mon, 15 Aug 2022 12:01:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0B13FB81107; Mon, 15 Aug 2022 19:01:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C883C433D6; Mon, 15 Aug 2022 19:01:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590076; bh=D/s5iHv5ysMovmW8o3ZkQG6IEKoY7QBzplDcxQg+tA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y0hi1ry20dz4FuS2u34+3+cxWBAa3PGytmOgzM5Dzn1/vFkflURdcLm6JBJ4uWxlJ QJ4MYOXfkE5ePOiQHxZKwR4H+raztO0lholVsjEESEzR+iHM+R1IUpcp0/3pNFdB1e ar5YAKmrcY75SEB5Kw0VfOdv35ZxYF6dVOX+ip3Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Samuel Holland , Marc Zyngier , Sasha Levin Subject: [PATCH 5.18 0144/1095] irqchip/mips-gic: Only register IPI domain when SMP is enabled Date: Mon, 15 Aug 2022 19:52:23 +0200 Message-Id: <20220815180435.551634534@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit 8190cc572981f2f13b6ffc26c7cfa7899e5d3ccc ] The MIPS GIC irqchip driver may be selected in a uniprocessor configuration, but it unconditionally registers an IPI domain. Limit the part of the driver dealing with IPIs to only be compiled when GENERIC_IRQ_IPI is enabled, which corresponds to an SMP configuration. Reported-by: kernel test robot Signed-off-by: Samuel Holland Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220701200056.46555-2-samuel@sholland.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/irqchip/Kconfig | 3 +- drivers/irqchip/irq-mips-gic.c | 80 +++++++++++++++++++++++----------- 2 files changed, 56 insertions(+), 27 deletions(-) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 15edb9a6fcae..d43d25a411dd 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -310,7 +310,8 @@ config KEYSTONE_IRQ =20 config MIPS_GIC bool - select GENERIC_IRQ_IPI + select GENERIC_IRQ_IPI if SMP + select IRQ_DOMAIN_HIERARCHY select MIPS_CM =20 config INGENIC_IRQ diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c index ff89b36267dd..8a9efb6ae587 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c @@ -52,13 +52,15 @@ static DEFINE_PER_CPU_READ_MOSTLY(unsigned long[GIC_MAX= _LONGS], pcpu_masks); =20 static DEFINE_SPINLOCK(gic_lock); static struct irq_domain *gic_irq_domain; -static struct irq_domain *gic_ipi_domain; static int gic_shared_intrs; static unsigned int gic_cpu_pin; static unsigned int timer_cpu_pin; static struct irq_chip gic_level_irq_controller, gic_edge_irq_controller; + +#ifdef CONFIG_GENERIC_IRQ_IPI static DECLARE_BITMAP(ipi_resrv, GIC_MAX_INTRS); static DECLARE_BITMAP(ipi_available, GIC_MAX_INTRS); +#endif /* CONFIG_GENERIC_IRQ_IPI */ =20 static struct gic_all_vpes_chip_data { u32 map; @@ -472,9 +474,11 @@ static int gic_irq_domain_map(struct irq_domain *d, un= signed int virq, u32 map; =20 if (hwirq >=3D GIC_SHARED_HWIRQ_BASE) { +#ifdef CONFIG_GENERIC_IRQ_IPI /* verify that shared irqs don't conflict with an IPI irq */ if (test_bit(GIC_HWIRQ_TO_SHARED(hwirq), ipi_resrv)) return -EBUSY; +#endif /* CONFIG_GENERIC_IRQ_IPI */ =20 err =3D irq_domain_set_hwirq_and_chip(d, virq, hwirq, &gic_level_irq_controller, @@ -567,6 +571,8 @@ static const struct irq_domain_ops gic_irq_domain_ops = =3D { .map =3D gic_irq_domain_map, }; =20 +#ifdef CONFIG_GENERIC_IRQ_IPI + static int gic_ipi_domain_xlate(struct irq_domain *d, struct device_node *= ctrlr, const u32 *intspec, unsigned int intsize, irq_hw_number_t *out_hwirq, @@ -670,6 +676,48 @@ static const struct irq_domain_ops gic_ipi_domain_ops = =3D { .match =3D gic_ipi_domain_match, }; =20 +static int gic_register_ipi_domain(struct device_node *node) +{ + struct irq_domain *gic_ipi_domain; + unsigned int v[2], num_ipis; + + gic_ipi_domain =3D irq_domain_add_hierarchy(gic_irq_domain, + IRQ_DOMAIN_FLAG_IPI_PER_CPU, + GIC_NUM_LOCAL_INTRS + gic_shared_intrs, + node, &gic_ipi_domain_ops, NULL); + if (!gic_ipi_domain) { + pr_err("Failed to add IPI domain"); + return -ENXIO; + } + + irq_domain_update_bus_token(gic_ipi_domain, DOMAIN_BUS_IPI); + + if (node && + !of_property_read_u32_array(node, "mti,reserved-ipi-vectors", v, 2)) { + bitmap_set(ipi_resrv, v[0], v[1]); + } else { + /* + * Reserve 2 interrupts per possible CPU/VP for use as IPIs, + * meeting the requirements of arch/mips SMP. + */ + num_ipis =3D 2 * num_possible_cpus(); + bitmap_set(ipi_resrv, gic_shared_intrs - num_ipis, num_ipis); + } + + bitmap_copy(ipi_available, ipi_resrv, GIC_MAX_INTRS); + + return 0; +} + +#else /* !CONFIG_GENERIC_IRQ_IPI */ + +static inline int gic_register_ipi_domain(struct device_node *node) +{ + return 0; +} + +#endif /* !CONFIG_GENERIC_IRQ_IPI */ + static int gic_cpu_startup(unsigned int cpu) { /* Enable or disable EIC */ @@ -688,11 +736,12 @@ static int gic_cpu_startup(unsigned int cpu) static int __init gic_of_init(struct device_node *node, struct device_node *parent) { - unsigned int cpu_vec, i, gicconfig, v[2], num_ipis; + unsigned int cpu_vec, i, gicconfig; unsigned long reserved; phys_addr_t gic_base; struct resource res; size_t gic_len; + int ret; =20 /* Find the first available CPU vector. */ i =3D 0; @@ -780,30 +829,9 @@ static int __init gic_of_init(struct device_node *node, return -ENXIO; } =20 - gic_ipi_domain =3D irq_domain_add_hierarchy(gic_irq_domain, - IRQ_DOMAIN_FLAG_IPI_PER_CPU, - GIC_NUM_LOCAL_INTRS + gic_shared_intrs, - node, &gic_ipi_domain_ops, NULL); - if (!gic_ipi_domain) { - pr_err("Failed to add IPI domain"); - return -ENXIO; - } - - irq_domain_update_bus_token(gic_ipi_domain, DOMAIN_BUS_IPI); - - if (node && - !of_property_read_u32_array(node, "mti,reserved-ipi-vectors", v, 2)) { - bitmap_set(ipi_resrv, v[0], v[1]); - } else { - /* - * Reserve 2 interrupts per possible CPU/VP for use as IPIs, - * meeting the requirements of arch/mips SMP. - */ - num_ipis =3D 2 * num_possible_cpus(); - bitmap_set(ipi_resrv, gic_shared_intrs - num_ipis, num_ipis); - } - - bitmap_copy(ipi_available, ipi_resrv, GIC_MAX_INTRS); + ret =3D gic_register_ipi_domain(node); + if (ret) + return ret; =20 board_bind_eic_interrupt =3D &gic_bind_eic_interrupt; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A59CDC32763 for ; Mon, 15 Aug 2022 20:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347919AbiHOU0t (ORCPT ); Mon, 15 Aug 2022 16:26:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347195AbiHOUWC (ORCPT ); Mon, 15 Aug 2022 16:22:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84A009927D; Mon, 15 Aug 2022 12:01:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D36B3B810A2; Mon, 15 Aug 2022 19:01:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E207C433D6; Mon, 15 Aug 2022 19:01:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590079; bh=iyij/7Rda9GzVqk1fhaYf1o1xG310pgMr6a/apnunPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0BDDDgIMCX4bD7Hd3tLgE3JZX+x++HnOO6eCDrdgrHh4lhbnf3NglVOqXPqvaqsnE YOY1N/LjwQjb5idN5GckaVIAACAEtcT+VAAXhX/PWo441nzZLJFlojJobgU/aGdxQ2 ZucGaB1PYJ44Qj/ndEQoZgI1yXL3xhhGzEA9Zc/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Samuel Holland , Marc Zyngier , Sasha Levin Subject: [PATCH 5.18 0145/1095] genirq: GENERIC_IRQ_IPI depends on SMP Date: Mon, 15 Aug 2022 19:52:24 +0200 Message-Id: <20220815180435.590938208@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit 0f5209fee90b4544c58b4278d944425292789967 ] The generic IPI code depends on the IRQ affinity mask being allocated and initialized. This will not be the case if SMP is disabled. Fix up the remaining driver that selected GENERIC_IRQ_IPI in a non-SMP config. Reported-by: kernel test robot Signed-off-by: Samuel Holland Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220701200056.46555-3-samuel@sholland.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/irqchip/Kconfig | 2 +- kernel/irq/Kconfig | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index d43d25a411dd..1af26c409cb1 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -177,7 +177,7 @@ config MADERA_IRQ config IRQ_MIPS_CPU bool select GENERIC_IRQ_CHIP - select GENERIC_IRQ_IPI if SYS_SUPPORTS_MULTITHREADING + select GENERIC_IRQ_IPI if SMP && SYS_SUPPORTS_MULTITHREADING select IRQ_DOMAIN select GENERIC_IRQ_EFFECTIVE_AFF_MASK =20 diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig index 10929eda9825..fc760d064a65 100644 --- a/kernel/irq/Kconfig +++ b/kernel/irq/Kconfig @@ -82,6 +82,7 @@ config IRQ_FASTEOI_HIERARCHY_HANDLERS # Generic IRQ IPI support config GENERIC_IRQ_IPI bool + depends on SMP select IRQ_DOMAIN_HIERARCHY =20 # Generic MSI interrupt support --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB757C32764 for ; Mon, 15 Aug 2022 20:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347970AbiHOU1A (ORCPT ); Mon, 15 Aug 2022 16:27:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347203AbiHOUWD (ORCPT ); Mon, 15 Aug 2022 16:22:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFCD14AD7E; Mon, 15 Aug 2022 12:01:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 02E1461211; Mon, 15 Aug 2022 19:01:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04A7CC433C1; Mon, 15 Aug 2022 19:01:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590082; bh=Us5azn9z/bhsRcCBR8T73DvmbNO0Qh6ELubzdyA/PTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dwID2QjVAtXv6De1QMr+StyzBtw5Scrq8snO1i0JkaFklodqpg01808lpE9HlwNFD dAiVrK5GTR2J0i9d2ojhUQw8KO8EoEbTj6jKFrpAqFI7AHy9M+i2+Lj07Z9n+je8ep 45YBR31ugOwqrowr5YgX+iCPifdQMuU2a+h1u6uU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Chen , Zhang Qiao , Vincent Guittot , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.18 0146/1095] sched/fair: fix case with reduced capacity CPU Date: Mon, 15 Aug 2022 19:52:25 +0200 Message-Id: <20220815180435.632793897@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Guittot [ Upstream commit c82a69629c53eda5233f13fc11c3c01585ef48a2 ] The capacity of the CPU available for CFS tasks can be reduced because of other activities running on the latter. In such case, it's worth trying to move CFS tasks on a CPU with more available capacity. The rework of the load balance has filtered the case when the CPU is classified to be fully busy but its capacity is reduced. Check if CPU's capacity is reduced while gathering load balance statistic and classify it group_misfit_task instead of group_fully_busy so we can try to move the load on another CPU. Reported-by: David Chen Reported-by: Zhang Qiao Signed-off-by: Vincent Guittot Signed-off-by: Peter Zijlstra (Intel) Tested-by: David Chen Tested-by: Zhang Qiao Link: https://lkml.kernel.org/r/20220708154401.21411-1-vincent.guittot@lina= ro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/sched/fair.c | 54 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ef2d8690fe18..46f6674a0979 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7628,8 +7628,8 @@ enum group_type { */ group_fully_busy, /* - * SD_ASYM_CPUCAPACITY only: One task doesn't fit with CPU's capacity - * and must be migrated to a more powerful CPU. + * One task doesn't fit with CPU's capacity and must be migrated to a + * more powerful CPU. */ group_misfit_task, /* @@ -8712,6 +8712,19 @@ sched_asym(struct lb_env *env, struct sd_lb_stats *s= ds, struct sg_lb_stats *sgs return sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu); } =20 +static inline bool +sched_reduced_capacity(struct rq *rq, struct sched_domain *sd) +{ + /* + * When there is more than 1 task, the group_overloaded case already + * takes care of cpu with reduced capacity + */ + if (rq->cfs.h_nr_running !=3D 1) + return false; + + return check_cpu_capacity(rq, sd); +} + /** * update_sg_lb_stats - Update sched_group's statistics for load balancing. * @env: The load balancing environment. @@ -8734,8 +8747,9 @@ static inline void update_sg_lb_stats(struct lb_env *= env, =20 for_each_cpu_and(i, sched_group_span(group), env->cpus) { struct rq *rq =3D cpu_rq(i); + unsigned long load =3D cpu_load(rq); =20 - sgs->group_load +=3D cpu_load(rq); + sgs->group_load +=3D load; sgs->group_util +=3D cpu_util_cfs(i); sgs->group_runnable +=3D cpu_runnable(rq); sgs->sum_h_nr_running +=3D rq->cfs.h_nr_running; @@ -8765,11 +8779,17 @@ static inline void update_sg_lb_stats(struct lb_env= *env, if (local_group) continue; =20 - /* Check for a misfit task on the cpu */ - if (env->sd->flags & SD_ASYM_CPUCAPACITY && - sgs->group_misfit_task_load < rq->misfit_task_load) { - sgs->group_misfit_task_load =3D rq->misfit_task_load; - *sg_status |=3D SG_OVERLOAD; + if (env->sd->flags & SD_ASYM_CPUCAPACITY) { + /* Check for a misfit task on the cpu */ + if (sgs->group_misfit_task_load < rq->misfit_task_load) { + sgs->group_misfit_task_load =3D rq->misfit_task_load; + *sg_status |=3D SG_OVERLOAD; + } + } else if ((env->idle !=3D CPU_NOT_IDLE) && + sched_reduced_capacity(rq, env->sd)) { + /* Check for a task running on a CPU with reduced capacity */ + if (sgs->group_misfit_task_load < load) + sgs->group_misfit_task_load =3D load; } } =20 @@ -8822,7 +8842,8 @@ static bool update_sd_pick_busiest(struct lb_env *env, * CPUs in the group should either be possible to resolve * internally or be covered by avg_load imbalance (eventually). */ - if (sgs->group_type =3D=3D group_misfit_task && + if ((env->sd->flags & SD_ASYM_CPUCAPACITY) && + (sgs->group_type =3D=3D group_misfit_task) && (!capacity_greater(capacity_of(env->dst_cpu), sg->sgc->max_capacity) = || sds->local_stat.group_type !=3D group_has_spare)) return false; @@ -9443,9 +9464,18 @@ static inline void calculate_imbalance(struct lb_env= *env, struct sd_lb_stats *s busiest =3D &sds->busiest_stat; =20 if (busiest->group_type =3D=3D group_misfit_task) { - /* Set imbalance to allow misfit tasks to be balanced. */ - env->migration_type =3D migrate_misfit; - env->imbalance =3D 1; + if (env->sd->flags & SD_ASYM_CPUCAPACITY) { + /* Set imbalance to allow misfit tasks to be balanced. */ + env->migration_type =3D migrate_misfit; + env->imbalance =3D 1; + } else { + /* + * Set load imbalance to allow moving task from cpu + * with reduced capacity. + */ + env->migration_type =3D migrate_load; + env->imbalance =3D busiest->group_misfit_task_load; + } return; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09410C00140 for ; Mon, 15 Aug 2022 20:27:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347387AbiHOU1c (ORCPT ); Mon, 15 Aug 2022 16:27:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347241AbiHOUWH (ORCPT ); Mon, 15 Aug 2022 16:22:07 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3C6A9A960; Mon, 15 Aug 2022 12:01:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id DDBA1CE12C1; Mon, 15 Aug 2022 19:01:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D61E4C433C1; Mon, 15 Aug 2022 19:01:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590088; bh=Vehy/BoBvNjd/WWLdoFvaGjwdX2Ws4HjflkU6Q6uxtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CfFb27pWvUr2Qb27pS7PgEsXqs6IrxFpc62eox0SSLs3olsfzGNnRkkYQEBOoBRbg IYEIXKDBdLu4aPDgBhNdqw30LgLlHVRT4DUO+pYF7grEDyK+neHWFo7ODHHcpnvBdj +/l6MUsBFOmkhjLi6xJszwiH/17GjoI62sXPGRK8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Keeping , "Peter Zijlstra (Intel)" , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.18 0147/1095] sched/core: Always flush pending blk_plug Date: Mon, 15 Aug 2022 19:52:26 +0200 Message-Id: <20220815180435.672142961@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Keeping [ Upstream commit 401e4963bf45c800e3e9ea0d3a0289d738005fd4 ] With CONFIG_PREEMPT_RT, it is possible to hit a deadlock between two normal priority tasks (SCHED_OTHER, nice level zero): INFO: task kworker/u8:0:8 blocked for more than 491 seconds. Not tainted 5.15.49-rt46 #1 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:kworker/u8:0 state:D stack: 0 pid: 8 ppid: 2 flags:0x000= 00000 Workqueue: writeback wb_workfn (flush-7:0) [] (__schedule) from [] (schedule+0xdc/0x134) [] (schedule) from [] (rt_mutex_slowlock_block.constpr= op.0+0xb8/0x174) [] (rt_mutex_slowlock_block.constprop.0) from [] +(rt_mutex_slowlock.constprop.0+0xac/0x174) [] (rt_mutex_slowlock.constprop.0) from [] (fat_write_= inode+0x34/0x54) [] (fat_write_inode) from [] (__writeback_single_inode= +0x354/0x3ec) [] (__writeback_single_inode) from [] (writeback_sb_in= odes+0x250/0x45c) [] (writeback_sb_inodes) from [] (__writeback_inodes_w= b+0x7c/0xb8) [] (__writeback_inodes_wb) from [] (wb_writeback+0x2c8= /0x2e4) [] (wb_writeback) from [] (wb_workfn+0x1a4/0x3e4) [] (wb_workfn) from [] (process_one_work+0x1fc/0x32c) [] (process_one_work) from [] (worker_thread+0x22c/0x2= d8) [] (worker_thread) from [] (kthread+0x16c/0x178) [] (kthread) from [] (ret_from_fork+0x14/0x38) Exception stack(0xc10e3fb0 to 0xc10e3ff8) 3fa0: 00000000 00000000 00000000 00000= 000 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000= 000 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 INFO: task tar:2083 blocked for more than 491 seconds. Not tainted 5.15.49-rt46 #1 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:tar state:D stack: 0 pid: 2083 ppid: 2082 flags:0x000= 00000 [] (__schedule) from [] (schedule+0xdc/0x134) [] (schedule) from [] (io_schedule+0x14/0x24) [] (io_schedule) from [] (bit_wait_io+0xc/0x30) [] (bit_wait_io) from [] (__wait_on_bit_lock+0x54/0xa8) [] (__wait_on_bit_lock) from [] (out_of_line_wait_on_b= it_lock+0x84/0xb0) [] (out_of_line_wait_on_bit_lock) from [] (fat_mirror_= bhs+0xa0/0x144) [] (fat_mirror_bhs) from [] (fat_alloc_clusters+0x138/= 0x2a4) [] (fat_alloc_clusters) from [] (fat_alloc_new_dir+0x3= 4/0x250) [] (fat_alloc_new_dir) from [] (vfat_mkdir+0x58/0x148) [] (vfat_mkdir) from [] (vfs_mkdir+0x68/0x98) [] (vfs_mkdir) from [] (do_mkdirat+0xb0/0xec) [] (do_mkdirat) from [] (ret_fast_syscall+0x0/0x1c) Exception stack(0xc2e1bfa8 to 0xc2e1bff0) bfa0: 01ee42f0 01ee4208 01ee42f0 000041ed 00000000 00004= 000 bfc0: 01ee42f0 01ee4208 00000000 00000027 01ee4302 00000004 000dcb00 01ee4= 190 bfe0: 000dc368 bed11924 0006d4b0 b6ebddfc Here the kworker is waiting on msdos_sb_info::s_lock which is held by tar which is in turn waiting for a buffer which is locked waiting to be flushed, but this operation is plugged in the kworker. The lock is a normal struct mutex, so tsk_is_pi_blocked() will always return false on !RT and thus the behaviour changes for RT. It seems that the intent here is to skip blk_flush_plug() in the case where a non-preemptible lock (such as a spinlock) has been converted to a rtmutex on RT, which is the case covered by the SM_RTLOCK_WAIT schedule flag. But sched_submit_work() is only called from schedule() which is never called in this scenario, so the check can simply be deleted. Looking at the history of the -rt patchset, in fact this change was present from v5.9.1-rt20 until being dropped in v5.13-rt1 as it was part of a larger patch [1] most of which was replaced by commit b4bfa3fcfe3b ("sched/core: Rework the __schedule() preempt argument"). As described in [1]: The schedule process must distinguish between blocking on a regular sleeping lock (rwsem and mutex) and a RT-only sleeping lock (spinlock and rwlock): - rwsem and mutex must flush block requests (blk_schedule_flush_plug()) even if blocked on a lock. This can not deadlock because this also happens for non-RT. There should be a warning if the scheduling point is within a RCU read section. - spinlock and rwlock must not flush block requests. This will deadlock if the callback attempts to acquire a lock which is already acquired. Similarly to being preempted, there should be no warning if the scheduling point is within a RCU read section. and with the tsk_is_pi_blocked() in the scheduler path, we hit the first issue. [1] https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/t= ree/patches/0022-locking-rtmutex-Use-custom-scheduling-function-for-s.patch= ?h=3Dlinux-5.10.y-rt-patches Signed-off-by: John Keeping Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Steven Rostedt (Google) Link: https://lkml.kernel.org/r/20220708162702.1758865-1-john@metanate.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/sched/rt.h | 8 -------- kernel/sched/core.c | 8 ++++++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h index e5af028c08b4..994c25640e15 100644 --- a/include/linux/sched/rt.h +++ b/include/linux/sched/rt.h @@ -39,20 +39,12 @@ static inline struct task_struct *rt_mutex_get_top_task= (struct task_struct *p) } extern void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi= _task); extern void rt_mutex_adjust_pi(struct task_struct *p); -static inline bool tsk_is_pi_blocked(struct task_struct *tsk) -{ - return tsk->pi_blocked_on !=3D NULL; -} #else static inline struct task_struct *rt_mutex_get_top_task(struct task_struct= *task) { return NULL; } # define rt_mutex_adjust_pi(p) do { } while (0) -static inline bool tsk_is_pi_blocked(struct task_struct *tsk) -{ - return false; -} #endif =20 extern void normalize_rt_tasks(void); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index dd11daa7a84b..6baf96d2fa39 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6460,8 +6460,12 @@ static inline void sched_submit_work(struct task_str= uct *tsk) io_wq_worker_sleeping(tsk); } =20 - if (tsk_is_pi_blocked(tsk)) - return; + /* + * spinlock and rwlock must not flush block requests. This will + * deadlock if the callback attempts to acquire a lock which is + * already acquired. + */ + SCHED_WARN_ON(current->__state & TASK_RTLOCK_WAIT); =20 /* * If we are going to sleep and we have plugged IO queued, --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12FCAC25B0E for ; Mon, 15 Aug 2022 20:27:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347423AbiHOU1j (ORCPT ); Mon, 15 Aug 2022 16:27:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347243AbiHOUWH (ORCPT ); Mon, 15 Aug 2022 16:22:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAF7F4B0D0; Mon, 15 Aug 2022 12:01:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A3505B810C6; Mon, 15 Aug 2022 19:01:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E80CFC433D6; Mon, 15 Aug 2022 19:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590091; bh=8FaatRZzs5J89s4nJSmm66AsNZkhJ2K5cP0SUBU4jF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XIK5FNJDBvOhGHNtKOoNgIHRX1k19Q8XZqO5h7mBGjlaIhdN1pwlAqxHrm82ANJo9 WqS6C04Eiv67wjpLJfjehVpM60AIJYt6wBkb4hld2f2xZj6/Lh85wMUiF4XpLDlY1b GHEbVjm2vUOS0OatdRYGnyvksHViunkDSI7Hkqtc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , William Dean , Marc Zyngier , Sasha Levin Subject: [PATCH 5.18 0148/1095] irqchip/mips-gic: Check the return value of ioremap() in gic_of_init() Date: Mon, 15 Aug 2022 19:52:27 +0200 Message-Id: <20220815180435.711531285@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Dean [ Upstream commit 71349cc85e5930dce78ed87084dee098eba24b59 ] The function ioremap() in gic_of_init() can fail, so its return value should be checked. Reported-by: Hacash Robot Signed-off-by: William Dean Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220723100128.2964304-1-williamsukatube@16= 3.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/irqchip/irq-mips-gic.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c index 8a9efb6ae587..1ba0f1555c80 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c @@ -783,6 +783,10 @@ static int __init gic_of_init(struct device_node *node, } =20 mips_gic_base =3D ioremap(gic_base, gic_len); + if (!mips_gic_base) { + pr_err("Failed to ioremap gic_base\n"); + return -ENOMEM; + } =20 gicconfig =3D read_gic_config(); gic_shared_intrs =3D FIELD_GET(GIC_CONFIG_NUMINTERRUPTS, gicconfig); --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4DA9C3F6B0 for ; Mon, 15 Aug 2022 20:28:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347448AbiHOU1y (ORCPT ); Mon, 15 Aug 2022 16:27:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347247AbiHOUWH (ORCPT ); Mon, 15 Aug 2022 16:22:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F9ED4B0EA; Mon, 15 Aug 2022 12:01:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3077EB81104; Mon, 15 Aug 2022 19:01:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BC20C433C1; Mon, 15 Aug 2022 19:01:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590094; bh=qD8iqtAHW8h3e52RnPcjZiRtkyWciAJc3DN0Ssk+n1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lm5aRglCIGukZ5D9BGDSIc6FSfY5mLE4O+XGcToM4IGj4tPTmvt01lPt9gWPZkiVg eD5hx5KFNdMCrg8Wia77+RcsY5h8SSGKT2RIBdPPlIUbSCSmmmUiUB9/oaLwbRKMF6 SxcaL5mheqyD/WDC36VAUntk9vBxYwNtp3O3MAA4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bruno Goncalves , Juri Lelli , Thomas Gleixner , Daniel Bristot de Oliveira , Valentin Schneider , Sasha Levin Subject: [PATCH 5.18 0149/1095] wait: Fix __wait_event_hrtimeout for RT/DL tasks Date: Mon, 15 Aug 2022 19:52:28 +0200 Message-Id: <20220815180435.753827740@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Juri Lelli [ Upstream commit cceeeb6a6d02e7b9a74ddd27a3225013b34174aa ] Changes to hrtimer mode (potentially made by __hrtimer_init_sleeper on PREEMPT_RT) are not visible to hrtimer_start_range_ns, thus not accounted for by hrtimer_start_expires call paths. In particular, __wait_event_hrtimeout suffers from this problem as we have, for example: fs/aio.c::read_events wait_event_interruptible_hrtimeout __wait_event_hrtimeout hrtimer_init_sleeper_on_stack <- this might "mode |=3D HRTIMER_MODE_H= ARD" on RT if task runs at RT/DL priority hrtimer_start_range_ns WARN_ON_ONCE(!(mode & HRTIMER_MODE_HARD) ^ !timer->is_hard) fires since the latter doesn't see the change of mode done by init_sleeper Fix it by making __wait_event_hrtimeout call hrtimer_sleeper_start_expires, which is aware of the special RT/DL case, instead of hrtimer_start_range_ns. Reported-by: Bruno Goncalves Signed-off-by: Juri Lelli Signed-off-by: Thomas Gleixner Reviewed-by: Daniel Bristot de Oliveira Reviewed-by: Valentin Schneider Link: https://lore.kernel.org/r/20220627095051.42470-1-juri.lelli@redhat.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/wait.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/linux/wait.h b/include/linux/wait.h index 851e07da2583..58cfbf81447c 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -544,10 +544,11 @@ do { \ \ hrtimer_init_sleeper_on_stack(&__t, CLOCK_MONOTONIC, \ HRTIMER_MODE_REL); \ - if ((timeout) !=3D KTIME_MAX) \ - hrtimer_start_range_ns(&__t.timer, timeout, \ - current->timer_slack_ns, \ - HRTIMER_MODE_REL); \ + if ((timeout) !=3D KTIME_MAX) { \ + hrtimer_set_expires_range_ns(&__t.timer, timeout, \ + current->timer_slack_ns); \ + hrtimer_sleeper_start_expires(&__t, HRTIMER_MODE_REL); \ + } \ \ __ret =3D ___wait_event(wq_head, condition, state, 0, 0, \ if (!__t.task) { \ --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98A08C25B08 for ; Mon, 15 Aug 2022 20:28:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242807AbiHOU2L (ORCPT ); Mon, 15 Aug 2022 16:28:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347251AbiHOUWI (ORCPT ); Mon, 15 Aug 2022 16:22:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 875B54B0EC; Mon, 15 Aug 2022 12:01:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2840FB81109; Mon, 15 Aug 2022 19:01:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67CCBC433C1; Mon, 15 Aug 2022 19:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590097; bh=iErS5oo2Oc5DNTVd9UDyKVUFsYmh4vo+LGU2SJ245lM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=csMYjMkNmU2D4IhPWzdUjfT43Doc8O0mQI3VNHdgOgDPoTudxho7BNvZtVSf/KrYM fuOsCV0C3otepc/+uV5O84oy2yGEw5wQx4hdxzZAS4JP/Ti/Uge74L5+cfJfZuKgZF gyTRaBP3WK1PsK0P5rLc0Ty3gv9lDYm4vPkAhkm8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 5.18 0150/1095] ARM: dts: imx6ul: add missing properties for sram Date: Mon, 15 Aug 2022 19:52:29 +0200 Message-Id: <20220815180435.799507233@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein [ Upstream commit 5655699cf5cff9f4c4ee703792156bdd05d1addf ] All 3 properties are required by sram.yaml. Fixes the dtbs_check warning: sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/imx6ul.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi index afeec01f6522..1d435a46fc5c 100644 --- a/arch/arm/boot/dts/imx6ul.dtsi +++ b/arch/arm/boot/dts/imx6ul.dtsi @@ -149,6 +149,9 @@ soc { ocram: sram@900000 { compatible =3D "mmio-sram"; reg =3D <0x00900000 0x20000>; + ranges =3D <0 0x00900000 0x20000>; + #address-cells =3D <1>; + #size-cells =3D <1>; }; =20 intc: interrupt-controller@a01000 { --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EBAFC282E7 for ; Mon, 15 Aug 2022 20:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345393AbiHOU2R (ORCPT ); Mon, 15 Aug 2022 16:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347255AbiHOUWI (ORCPT ); Mon, 15 Aug 2022 16:22:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF93C4B0DC; Mon, 15 Aug 2022 12:01:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6C3946129D; Mon, 15 Aug 2022 19:01:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62737C433D6; Mon, 15 Aug 2022 19:01:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590100; bh=i2jhH5/szEKqI2jW51v3Ub9wFARlUPzzK8ZZbQhSzOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j/E7/71hUpMa/DSN0octiUefP79CZglx7zaEOeqmj3lLj+wL+LZwir1FvXTF52kf5 AqHKo9HmKPeaPh9HJmN1yzD3a0qijlAo5MUSTeOYgQJN9nmu1tt2Ugt3jFK8yU+gmc TFPwFETKkYayJYLx2q7G5hZV6vL0Las66vr6VhUs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 5.18 0151/1095] ARM: dts: imx6ul: change operating-points to uint32-matrix Date: Mon, 15 Aug 2022 19:52:30 +0200 Message-Id: <20220815180435.833062162@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein [ Upstream commit edb67843983bbdf61b4c8c3c50618003d38bb4ae ] operating-points is a uint32-matrix as per opp-v1.yaml. Change it accordingly. While at it, change fsl,soc-operating-points as well, although there is no bindings file (yet). But they should have the same format. Fixes the dt_binding_check warning: cpu@0: operating-points:0: [696000, 1275000, 528000, 1175000, 396000, 1025000, 198000, 950000] is too long cpu@0: operating-points:0: Additional items are not allowed (528000, 1175000, 396000, 1025000, 198000, 950000 were unexpected) Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/imx6ul.dtsi | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi index 1d435a46fc5c..2fcbd9d91521 100644 --- a/arch/arm/boot/dts/imx6ul.dtsi +++ b/arch/arm/boot/dts/imx6ul.dtsi @@ -64,20 +64,18 @@ cpu0: cpu@0 { clock-frequency =3D <696000000>; clock-latency =3D <61036>; /* two CLK32 periods */ #cooling-cells =3D <2>; - operating-points =3D < + operating-points =3D /* kHz uV */ - 696000 1275000 - 528000 1175000 - 396000 1025000 - 198000 950000 - >; - fsl,soc-operating-points =3D < + <696000 1275000>, + <528000 1175000>, + <396000 1025000>, + <198000 950000>; + fsl,soc-operating-points =3D /* KHz uV */ - 696000 1275000 - 528000 1175000 - 396000 1175000 - 198000 1175000 - >; + <696000 1275000>, + <528000 1175000>, + <396000 1175000>, + <198000 1175000>; clocks =3D <&clks IMX6UL_CLK_ARM>, <&clks IMX6UL_CLK_PLL2_BUS>, <&clks IMX6UL_CLK_PLL2_PFD2>, --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CF1CC00140 for ; Mon, 15 Aug 2022 20:28:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344848AbiHOU2Y (ORCPT ); Mon, 15 Aug 2022 16:28:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347257AbiHOUWI (ORCPT ); Mon, 15 Aug 2022 16:22:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CC024B0FD; Mon, 15 Aug 2022 12:01:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4AF0EB810A1; Mon, 15 Aug 2022 19:01:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A68CC433C1; Mon, 15 Aug 2022 19:01:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590104; bh=H9BOwCrBvhJ2D/pmVP5DNxKN0ES8c7NcKffve4+d2QI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ixSfGsj0HRGeNoj65W6aeMM6mcUmYDQJ2CTZHgPIILMVS158YQXuRd4g3PcO5nikJ pQ+S30Yym5LgJWeet7NBxOJtPuR0m5gzS+7tMXw0brjW53xEIUgebOAVs/VPBmEvdM qnLCYZ/Kfn8i09qpz14xeySM4zXBkRfHt4wk/jkQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 5.18 0152/1095] ARM: dts: imx6ul: fix keypad compatible Date: Mon, 15 Aug 2022 19:52:31 +0200 Message-Id: <20220815180435.871283446@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein [ Upstream commit 7d15e0c9a515494af2e3199741cdac7002928a0e ] According to binding, the compatible shall only contain imx6ul and imx21 compatibles. Fixes the dt_binding_check warning: keypad@20b8000: compatible: 'oneOf' conditional failed, one must be fixed: ['fsl,imx6ul-kpp', 'fsl,imx6q-kpp', 'fsl,imx21-kpp'] is too long Additional items are not allowed ('fsl,imx6q-kpp', 'fsl,imx21-kpp' were unexpected) Additional items are not allowed ('fsl,imx21-kpp' was unexpected) 'fsl,imx21-kpp' was expected Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/imx6ul.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi index 2fcbd9d91521..df8b4ad62418 100644 --- a/arch/arm/boot/dts/imx6ul.dtsi +++ b/arch/arm/boot/dts/imx6ul.dtsi @@ -544,7 +544,7 @@ fec2: ethernet@20b4000 { }; =20 kpp: keypad@20b8000 { - compatible =3D "fsl,imx6ul-kpp", "fsl,imx6q-kpp", "fsl,imx21-kpp"; + compatible =3D "fsl,imx6ul-kpp", "fsl,imx21-kpp"; reg =3D <0x020b8000 0x4000>; interrupts =3D ; clocks =3D <&clks IMX6UL_CLK_KPP>; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC122C00140 for ; Mon, 15 Aug 2022 20:28:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346740AbiHOU2b (ORCPT ); Mon, 15 Aug 2022 16:28:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347258AbiHOUWJ (ORCPT ); Mon, 15 Aug 2022 16:22:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A97D4B484; Mon, 15 Aug 2022 12:01:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A611161296; Mon, 15 Aug 2022 19:01:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEE9FC433C1; Mon, 15 Aug 2022 19:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590107; bh=EixTL5yY3x6DpFjd9mtu7FvtvO6e++FT6rEJn0V1IyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mELj2/O8LoJS+J1ZLgkGSJZ/Ah76W2DNdOybKARD0B+wgdBp0xzWgYT3ilp+3ZpBI aSq/5GZrnm9igxAgrQVQbcX8ww3qjFS9pE5F+Z96t+jScXAvGam3HmqNbhydSqwxG4 /gQLlQXzbGpH8CJAuTPuXgXa7zrsDwKUMuLY0UrE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 5.18 0153/1095] ARM: dts: imx6ul: fix csi node compatible Date: Mon, 15 Aug 2022 19:52:32 +0200 Message-Id: <20220815180435.910855448@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein [ Upstream commit e0aca931a2c7c29c88ebf37f9c3cd045e083483d ] "fsl,imx6ul-csi" was never listed as compatible to "fsl,imx7-csi", neither in yaml bindings, nor previous txt binding. Remove the imx7 part. Fixes the dt schema check warning: csi@21c4000: compatible: 'oneOf' conditional failed, one must be fixed: ['fsl,imx6ul-csi', 'fsl,imx7-csi'] is too long Additional items are not allowed ('fsl,imx7-csi' was unexpected) 'fsl,imx8mm-csi' was expected Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/imx6ul.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi index df8b4ad62418..367657a9a99f 100644 --- a/arch/arm/boot/dts/imx6ul.dtsi +++ b/arch/arm/boot/dts/imx6ul.dtsi @@ -999,7 +999,7 @@ cpu_speed_grade: speed-grade@10 { }; =20 csi: csi@21c4000 { - compatible =3D "fsl,imx6ul-csi", "fsl,imx7-csi"; + compatible =3D "fsl,imx6ul-csi"; reg =3D <0x021c4000 0x4000>; interrupts =3D ; clocks =3D <&clks IMX6UL_CLK_CSI>; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDDD9C00140 for ; Mon, 15 Aug 2022 20:28:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345256AbiHOU2h (ORCPT ); Mon, 15 Aug 2022 16:28:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347264AbiHOUWJ (ORCPT ); Mon, 15 Aug 2022 16:22:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 275E84B48A; Mon, 15 Aug 2022 12:01:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B7B1561296; Mon, 15 Aug 2022 19:01:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8817C433D6; Mon, 15 Aug 2022 19:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590110; bh=kOSR+0U1mUJKjfVnIM3iHP1kjHk8W/lX2Xo52qIYRy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UKuifcaVpJntZ7a6Vs8zJn9fjM2RIsaoCARh7ZpNDHoKtNucATYyjNylGW2BVHWS2 Ms7jv2qXIZ7VFnQMIDD8bNPfTaJbdbk1MA5o5zeC7zfheIkJjStWkknBH1t6/lQtoD Z82LUo9yOw73g91VoR2geix5g45qJkfsi+5r1/VA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 5.18 0154/1095] ARM: dts: imx6ul: fix lcdif node compatible Date: Mon, 15 Aug 2022 19:52:33 +0200 Message-Id: <20220815180435.957334094@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein [ Upstream commit 1a884d17ca324531634cce82e9f64c0302bdf7de ] In yaml binding "fsl,imx6ul-lcdif" is listed as compatible to imx6sx-lcdif, but not imx28-lcdif. Change the list accordingly. Fixes the dt_binding_check warning: lcdif@21c8000: compatible: 'oneOf' conditional failed, one must be fixed: ['fsl,imx6ul-lcdif', 'fsl,imx28-lcdif'] is too long Additional items are not allowed ('fsl,imx28-lcdif' was unexpected) 'fsl,imx6ul-lcdif' is not one of ['fsl,imx23-lcdif', 'fsl,imx28-lcdif', 'fsl,imx6sx-lcdif'] 'fsl,imx6sx-lcdif' was expected Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/imx6ul.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi index 367657a9a99f..bc6548058d8c 100644 --- a/arch/arm/boot/dts/imx6ul.dtsi +++ b/arch/arm/boot/dts/imx6ul.dtsi @@ -1008,7 +1008,7 @@ csi: csi@21c4000 { }; =20 lcdif: lcdif@21c8000 { - compatible =3D "fsl,imx6ul-lcdif", "fsl,imx28-lcdif"; + compatible =3D "fsl,imx6ul-lcdif", "fsl,imx6sx-lcdif"; reg =3D <0x021c8000 0x4000>; interrupts =3D ; clocks =3D <&clks IMX6UL_CLK_LCDIF_PIX>, --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 648D8C00140 for ; Mon, 15 Aug 2022 20:28:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345683AbiHOU2u (ORCPT ); Mon, 15 Aug 2022 16:28:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347268AbiHOUWK (ORCPT ); Mon, 15 Aug 2022 16:22:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5154D2CDC0; Mon, 15 Aug 2022 12:01:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E2656612A0; Mon, 15 Aug 2022 19:01:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D33E3C433B5; Mon, 15 Aug 2022 19:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590113; bh=HopU/MPTRkH9+3zqqnsjOGCkMfvViXYpGAFABHbxMj4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mNyW74KVzKcd1RWp0vMAsP+hZa+mEG7oPYNsghgp369iDw8pOr4f6ndApes7W4T0L KGqJSLSmU6sI6xfThlaWSamJ3gEmQR+cyTKOgQLrU/IHcR7v/0JNoeTuAKJ3CGn6M5 d7w3qonOQfitdEeWc7sWOy9vKCGNj+xCjqkIZamY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 5.18 0155/1095] ARM: dts: imx6ul: fix qspi node compatible Date: Mon, 15 Aug 2022 19:52:34 +0200 Message-Id: <20220815180435.991326938@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein [ Upstream commit 0c6cf86e1ab433b2d421880fdd9c6e954f404948 ] imx6ul is not compatible to imx6sx, both have different erratas. Fixes the dt_binding_check warning: spi@21e0000: compatible: 'oneOf' conditional failed, one must be fixed: ['fsl,imx6ul-qspi', 'fsl,imx6sx-qspi'] is too long Additional items are not allowed ('fsl,imx6sx-qspi' was unexpected) 'fsl,imx6ul-qspi' is not one of ['fsl,ls1043a-qspi'] 'fsl,imx6ul-qspi' is not one of ['fsl,imx8mq-qspi'] 'fsl,ls1021a-qspi' was expected 'fsl,imx7d-qspi' was expected Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/imx6ul.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi index bc6548058d8c..eca8bf89ab88 100644 --- a/arch/arm/boot/dts/imx6ul.dtsi +++ b/arch/arm/boot/dts/imx6ul.dtsi @@ -1029,7 +1029,7 @@ pxp: pxp@21cc000 { qspi: spi@21e0000 { #address-cells =3D <1>; #size-cells =3D <0>; - compatible =3D "fsl,imx6ul-qspi", "fsl,imx6sx-qspi"; + compatible =3D "fsl,imx6ul-qspi"; reg =3D <0x021e0000 0x4000>, <0x60000000 0x10000000>; reg-names =3D "QuadSPI", "QuadSPI-memory"; interrupts =3D ; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6523DC00140 for ; Mon, 15 Aug 2022 20:28:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345130AbiHOU2p (ORCPT ); Mon, 15 Aug 2022 16:28:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347283AbiHOUWL (ORCPT ); Mon, 15 Aug 2022 16:22:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2296F33A16; Mon, 15 Aug 2022 12:01:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9A2DCB810A2; Mon, 15 Aug 2022 19:01:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0312CC433C1; Mon, 15 Aug 2022 19:01:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590116; bh=aDI9oW5FMeFpnrkw6D49LnTsjyQ1UqWavKcDu30KMDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NMNo2WF/DnP0j1Ipb2doo0DjteAxuudh8LyQ8iHLBSWE2CX7OZmCs5xojPDVWrDO4 lkEQNiTN9Ea2RQU3RNblI7flfCgxtPOnx7+9POAa7dO3yYTONPwUrk8Z9jeeuNOLm+ VInERiTSdTwjVQ5IogG/uRMdualpvDLgw+HrY3JM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Lamparter , Florian Fainelli , Sasha Levin Subject: [PATCH 5.18 0156/1095] ARM: dts: BCM5301X: Add DT for Meraki MR26 Date: Mon, 15 Aug 2022 19:52:35 +0200 Message-Id: <20220815180436.029782591@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Lamparter [ Upstream commit 935327a73553001f8d81375c76985d05f604507f ] Meraki MR26 is an EOL wireless access point featuring a PoE ethernet port and two dual-band 3x3 MIMO 802.11n radios and 1x1 dual-band WIFI dedicated to scanning. Thank you Amir for the unit and PSU. Hardware info: SOC : Broadcom BCM53015A1KFEBG (dual-core Cortex-A9 CPU at 800 MHz) RAM : SK Hynix Inc. H5TQ1G63EFR, 1 GBit DDR3 SDRAM =3D 128 MiB NAND : Spansion S34ML01G100TF100, 1 GBit SLC NAND Flash =3D 128 MiB ETH : 1 GBit Ethernet Port - PoE (TPS23754 PoE Interface) WIFI0 : Broadcom BCM43431KMLG, BCM43431 802.11 abgn (3x3:3) WIFI1 : Broadcom BCM43431KMLG, BCM43431 802.11 abgn (3x3:3) WIFI2 : Broadcom BCM43428 "Air Marshal" 802.11 abgn (1x1:1) BUTTON: One reset key behind a small hole next to the Ethernet Port LEDS : One amber (fault), one white (indicator) LED, separate RGB-LED MISC : Atmel AT24C64 8KiB EEPROM i2c : Ti INA219 26V, 12-bit, i2c output current/voltage/power monitor SERIAL: WARNING: The serial port needs a TTL/RS-232 3V3 level converter! The Serial setting is 115200-8-N-1. The board has a populated right angle 1x4 0.1" pinheader. The pinout is: VCC (next to J3, has the pin 1 indicator), RX, TX, GND. Odd stuff: - uboot does not support lzma compression, but gzip'd uImage/DTB work. - uboot claims to support FIT, but fails to pass the DTB to the kernel. Appending the dtb after the kernel image works. - RGB-controller is supported through an external userspace program. - The ubi partition contains a "board-config" volume. It stores the MAC Address (0x66 in binary) and Serial No. (0x7c alpha-numerical). - SoC's temperature sensor always reports that it is on fire. This causes the system to immediately shutdown! Looking at reported "418 degree Celsius" suggests that this sensor is not working. WIFI: b43 is able to initialize all three WIFIs @ 802.11bg. | b43-phy0: Broadcom 43431 WLAN found (core revision 29) | bcma-pci-bridge 0000:01:00.0: bus1: Switched to core: 0x812 | b43-phy0: Found PHY: Analog 9, Type 7 (HT), Revision 1 | b43-phy0: Found Radio: Manuf 0x17F, ID 0x2059, Revision 0, Version 1 | b43-phy0 warning: 5 GHz band is unsupported on this PHY | b43-phy1: Broadcom 43431 WLAN found (core revision 29) | bcma-pci-bridge 0001:01:00.0: bus2: Switched to core: 0x812 | b43-phy1: Found PHY: Analog 9, Type 7 (HT), Revision 1 | b43-phy1: Found Radio: Manuf 0x17F, ID 0x2059, Revision 0, Version 1 | b43-phy1 warning: 5 GHz band is unsupported on this PHY | b43-phy2: Broadcom 43228 WLAN found (core revision 30) | bcma-pci-bridge 0002:01:00.0: bus3: Switched to core: 0x812 | b43-phy2: Found PHY: Analog 9, Type 4 (N), Revision 16 | b43-phy2: Found Radio: Manuf 0x17F, ID 0x2057, Revision 9, Version 1 | Broadcom 43xx driver loaded [ Features: NL ] Signed-off-by: Christian Lamparter Signed-off-by: Florian Fainelli Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/bcm53015-meraki-mr26.dts | 166 +++++++++++++++++++++ 2 files changed, 167 insertions(+) create mode 100644 arch/arm/boot/dts/bcm53015-meraki-mr26.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 7c16f8a2b738..13d788d1e6dc 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -133,6 +133,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) +=3D \ bcm47094-luxul-xwr-3150-v1.dtb \ bcm47094-netgear-r8500.dtb \ bcm47094-phicomm-k3.dtb \ + bcm53015-meraki-mr26.dtb \ bcm53016-meraki-mr32.dtb \ bcm94708.dtb \ bcm94709.dtb \ diff --git a/arch/arm/boot/dts/bcm53015-meraki-mr26.dts b/arch/arm/boot/dts= /bcm53015-meraki-mr26.dts new file mode 100644 index 000000000000..14f58033efeb --- /dev/null +++ b/arch/arm/boot/dts/bcm53015-meraki-mr26.dts @@ -0,0 +1,166 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* + * Broadcom BCM470X / BCM5301X ARM platform code. + * DTS for Meraki MR26 / Codename: Venom + * + * Copyright (C) 2022 Christian Lamparter + */ + +/dts-v1/; + +#include "bcm4708.dtsi" +#include "bcm5301x-nand-cs0-bch8.dtsi" +#include + +/ { + compatible =3D "meraki,mr26", "brcm,bcm53015", "brcm,bcm4708"; + model =3D "Meraki MR26"; + + memory@0 { + reg =3D <0x00000000 0x08000000>; + device_type =3D "memory"; + }; + + leds { + compatible =3D "gpio-leds"; + + led-0 { + function =3D LED_FUNCTION_FAULT; + color =3D ; + gpios =3D <&chipcommon 13 GPIO_ACTIVE_HIGH>; + panic-indicator; + }; + led-1 { + function =3D LED_FUNCTION_INDICATOR; + color =3D ; + gpios =3D <&chipcommon 12 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible =3D "gpio-keys"; + #address-cells =3D <1>; + #size-cells =3D <0>; + + key-restart { + label =3D "Reset"; + linux,code =3D ; + gpios =3D <&chipcommon 11 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&uart0 { + clock-frequency =3D <50000000>; + /delete-property/ clocks; +}; + +&uart1 { + status =3D "disabled"; +}; + +&gmac0 { + status =3D "okay"; +}; + +&gmac1 { + status =3D "disabled"; +}; +&gmac2 { + status =3D "disabled"; +}; +&gmac3 { + status =3D "disabled"; +}; + +&nandcs { + nand-ecc-algo =3D "hw"; + + partitions { + compatible =3D "fixed-partitions"; + #address-cells =3D <0x1>; + #size-cells =3D <0x1>; + + partition@0 { + label =3D "u-boot"; + reg =3D <0x0 0x200000>; + read-only; + }; + + partition@200000 { + label =3D "u-boot-env"; + reg =3D <0x200000 0x200000>; + /* empty */ + }; + + partition@400000 { + label =3D "u-boot-backup"; + reg =3D <0x400000 0x200000>; + /* empty */ + }; + + partition@600000 { + label =3D "u-boot-env-backup"; + reg =3D <0x600000 0x200000>; + /* empty */ + }; + + partition@800000 { + label =3D "ubi"; + reg =3D <0x800000 0x7780000>; + }; + }; +}; + +&srab { + status =3D "okay"; + + ports { + port@0 { + reg =3D <0>; + label =3D "poe"; + }; + + port@5 { + reg =3D <5>; + label =3D "cpu"; + ethernet =3D <&gmac0>; + + fixed-link { + speed =3D <1000>; + duplex-full; + }; + }; + }; +}; + +&i2c0 { + status =3D "okay"; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&pinmux_i2c>; + + clock-frequency =3D <100000>; + + ina219@40 { + compatible =3D "ti,ina219"; /* PoE power */ + reg =3D <0x40>; + shunt-resistor =3D <60000>; /* =3D 60 mOhms */ + }; + + eeprom@56 { + compatible =3D "atmel,24c64"; + reg =3D <0x56>; + pagesize =3D <32>; + read-only; + #address-cells =3D <1>; + #size-cells =3D <1>; + + /* it's empty */ + }; +}; + +&thermal { + status =3D "disabled"; + /* does not work, reads 418 degree Celsius */ +}; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFBDEC00140 for ; Mon, 15 Aug 2022 20:29:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345285AbiHOU3U (ORCPT ); Mon, 15 Aug 2022 16:29:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347288AbiHOUWM (ORCPT ); Mon, 15 Aug 2022 16:22:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F4064B0E9; Mon, 15 Aug 2022 12:02:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C6996B810A1; Mon, 15 Aug 2022 19:02:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22404C433C1; Mon, 15 Aug 2022 19:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590122; bh=fbgxc8V8tdg0LFBq4Z4rM/C3lTyUixrych/GUw3V7aw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OUtlZT4Ijplfw5VAT50C/exJdxExAOOxZNYBQhZoFBMqiVGdWO2R8CFh1k1bNrSsP 3f419KSPiqnDUfFshzKtO7QE51jrmXP9MSwPNVPoJ+L+vSTNZdEUa/ShUjgD2FyvGq n3LQ+jdBdCYjpfmmVOgy3ufCEiJ7Qv+kL9vNODa8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Sasha Levin Subject: [PATCH 5.18 0157/1095] ARM: dts: ux500: Fix Janice accelerometer mounting matrix Date: Mon, 15 Aug 2022 19:52:36 +0200 Message-Id: <20220815180436.070537762@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij [ Upstream commit 013fda41c03e6bcb3dc416669187b609e9e5fdbc ] This was fixed wrong so fix it again. Now verified by using iio-sensor-proxy monitor-sensor test program. Link: https://lore.kernel.org/r/20220609083516.329281-1-linus.walleij@linar= o.org Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/ste-ux500-samsung-janice.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/ste-ux500-samsung-janice.dts b/arch/arm/boot= /dts/ste-ux500-samsung-janice.dts index 42762bfcd878..2069efb252a7 100644 --- a/arch/arm/boot/dts/ste-ux500-samsung-janice.dts +++ b/arch/arm/boot/dts/ste-ux500-samsung-janice.dts @@ -610,8 +610,8 @@ i2c-gate { accelerometer@8 { compatible =3D "bosch,bma222"; reg =3D <0x08>; - mount-matrix =3D "0", "1", "0", - "-1", "0", "0", + mount-matrix =3D "0", "-1", "0", + "1", "0", "0", "0", "0", "1"; vddio-supply =3D <&ab8500_ldo_aux2_reg>; // 1.8V vdd-supply =3D <&ab8500_ldo_aux1_reg>; // 3V --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E49EEC00140 for ; Mon, 15 Aug 2022 20:29:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345247AbiHOU3I (ORCPT ); Mon, 15 Aug 2022 16:29:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347287AbiHOUWM (ORCPT ); Mon, 15 Aug 2022 16:22:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66B144B491; Mon, 15 Aug 2022 12:02:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0540961281; Mon, 15 Aug 2022 19:02:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B90CC433C1; Mon, 15 Aug 2022 19:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590125; bh=IPKnMKxqQ68ddxiIaGT4Let7EggUGK/RSbRJiij+NcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RpQQU7ERYlD46RkxoyUCXTznUin2Bs4AWvpYlf4c8ViZidsvqzfVrkAqAvoJmuzvF Voo4pwIO9LTsYaYMmb3JcTrizcc7/5oojS4YwEI7PHim+lQu/v0YSEqxhZLec0qgfd toO0z7lGpKAuyHcDMDjvrCfkn/bOV3AakPSGc0Eo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Sasha Levin Subject: [PATCH 5.18 0158/1095] ARM: dts: ux500: Fix Codina accelerometer mounting matrix Date: Mon, 15 Aug 2022 19:52:37 +0200 Message-Id: <20220815180436.104329128@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij [ Upstream commit 0b2152e428ab91533a02888ff24e52e788dc4637 ] This was fixed wrong so fix it again. Now verified by using iio-sensor-proxy monitor-sensor test program. Link: https://lore.kernel.org/r/20220611204249.472250-1-linus.walleij@linar= o.org Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/ste-ux500-samsung-codina.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/ste-ux500-samsung-codina.dts b/arch/arm/boot= /dts/ste-ux500-samsung-codina.dts index 1c1725d31c7c..0a10fb0a3741 100644 --- a/arch/arm/boot/dts/ste-ux500-samsung-codina.dts +++ b/arch/arm/boot/dts/ste-ux500-samsung-codina.dts @@ -566,8 +566,8 @@ lisd3dh@19 { reg =3D <0x19>; vdd-supply =3D <&ab8500_ldo_aux1_reg>; // 3V vddio-supply =3D <&ab8500_ldo_aux2_reg>; // 1.8V - mount-matrix =3D "0", "-1", "0", - "1", "0", "0", + mount-matrix =3D "0", "1", "0", + "-1", "0", "0", "0", "0", "1"; }; }; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79959C00140 for ; Mon, 15 Aug 2022 20:29:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243012AbiHOU3Q (ORCPT ); Mon, 15 Aug 2022 16:29:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347292AbiHOUWM (ORCPT ); Mon, 15 Aug 2022 16:22:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F64430F77; Mon, 15 Aug 2022 12:02:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EF84761211; Mon, 15 Aug 2022 19:02:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0485AC433C1; Mon, 15 Aug 2022 19:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590128; bh=XCWAe+TX+STk2CgGyIQqKEwSwuQ88kPWq1dpJ9MZDvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ko3lxqMzr1gRxsYGrXmV3Uhe6dRj1dL1X1uU6p0j3z+IMqDONGdoLNfdXC44W5Jlt DZ0v3qVXSQRrCHmjkB/5vfYgn8HbWUyMISanm/dD0hak9GSz1bPZguk1BnRHtrdsSz ipVH0vVJXkNNy/RwyWJSxTIhOlpfcGhcKB2UZZx4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Sasha Levin Subject: [PATCH 5.18 0159/1095] ARM: dts: ux500: Fix Gavini accelerometer mounting matrix Date: Mon, 15 Aug 2022 19:52:38 +0200 Message-Id: <20220815180436.135677389@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij [ Upstream commit e24c75f02a81d6ddac0072cbd7a03e799c19d558 ] This was fixed wrong so fix it. Now verified by using iio-sensor-proxy monitor-sensor test program. Link: https://lore.kernel.org/r/20220611205138.491513-1-linus.walleij@linar= o.org Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/ste-ux500-samsung-gavini.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/ste-ux500-samsung-gavini.dts b/arch/arm/boot= /dts/ste-ux500-samsung-gavini.dts index fd170974765f..149838b5f9c1 100644 --- a/arch/arm/boot/dts/ste-ux500-samsung-gavini.dts +++ b/arch/arm/boot/dts/ste-ux500-samsung-gavini.dts @@ -523,8 +523,8 @@ i2c-gate { accelerometer@18 { compatible =3D "bosch,bma222e"; reg =3D <0x18>; - mount-matrix =3D "0", "1", "0", - "-1", "0", "0", + mount-matrix =3D "0", "-1", "0", + "1", "0", "0", "0", "0", "1"; vddio-supply =3D <&ab8500_ldo_aux2_reg>; // 1.8V vdd-supply =3D <&ab8500_ldo_aux1_reg>; // 3V --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E9F7C25B0E for ; Mon, 15 Aug 2022 20:29:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346120AbiHOU3Z (ORCPT ); Mon, 15 Aug 2022 16:29:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347295AbiHOUWN (ORCPT ); Mon, 15 Aug 2022 16:22:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C537C33378; Mon, 15 Aug 2022 12:02:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 528E461299; Mon, 15 Aug 2022 19:02:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15F60C433C1; Mon, 15 Aug 2022 19:02:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590131; bh=ck8ZbF58sP5kOpHI71GDLb8PqPzc7D5LC9zDS/+kP+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L0ajLr43ywuzHBU5Hz5U/BVwXVaOlNGIcACwGDlzBle3YZCzK1dQMGfKDpYuioBQb pY92jxVG6RnEtsmAaPxKhNEB2fzG/vTdmZhaeYynQhiEaU0OxmxBid2HL5IFj8Ozmm 1k35j/UCg3JsVLXkc9EECElvdHoPXIGV5DcIiwvg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Heidelberg , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0160/1095] arm64: dts: qcom: timer should use only 32-bit size Date: Mon, 15 Aug 2022 19:52:39 +0200 Message-Id: <20220815180436.185514993@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Heidelberg [ Upstream commit 458ebdbb8e5d596a462d8125cec74142ff5dfa97 ] There's no reason the timer needs > 32-bits of address or size. Since we using 32-bit size, we need to define ranges properly. Fixes warnings as: ``` arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dt.yaml: timer@17c90000: #si= ze-cells:0:0: 1 was expected From schema: Documentation/devicetree/bindings/timer/arm,arch_timer= _mmio.yaml ``` Signed-off-by: David Heidelberg Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220626105800.35586-1-david@ixit.cz Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/ipq6018.dtsi | 22 +++++++++++----------- arch/arm64/boot/dts/qcom/sc7180.dtsi | 22 +++++++++++----------- arch/arm64/boot/dts/qcom/sc7280.dtsi | 22 +++++++++++----------- arch/arm64/boot/dts/qcom/sdm845.dtsi | 22 +++++++++++----------- arch/arm64/boot/dts/qcom/sm6350.dtsi | 22 +++++++++++----------- arch/arm64/boot/dts/qcom/sm8150.dtsi | 22 +++++++++++----------- arch/arm64/boot/dts/qcom/sm8250.dtsi | 22 +++++++++++----------- arch/arm64/boot/dts/qcom/sm8350.dtsi | 22 +++++++++++----------- arch/arm64/boot/dts/qcom/sm8450.dtsi | 22 +++++++++++----------- 9 files changed, 99 insertions(+), 99 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/ipq6018.dtsi b/arch/arm64/boot/dts/qc= om/ipq6018.dtsi index aac56575e30d..5cdec104d899 100644 --- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi @@ -525,9 +525,9 @@ timer { }; =20 timer@b120000 { - #address-cells =3D <2>; - #size-cells =3D <2>; - ranges; + #address-cells =3D <1>; + #size-cells =3D <1>; + ranges =3D <0 0 0 0x10000000>; compatible =3D "arm,armv7-timer-mem"; reg =3D <0x0 0x0b120000 0x0 0x1000>; =20 @@ -535,49 +535,49 @@ frame@b120000 { frame-number =3D <0>; interrupts =3D , ; - reg =3D <0x0 0x0b121000 0x0 0x1000>, - <0x0 0x0b122000 0x0 0x1000>; + reg =3D <0x0b121000 0x1000>, + <0x0b122000 0x1000>; }; =20 frame@b123000 { frame-number =3D <1>; interrupts =3D ; - reg =3D <0x0 0xb123000 0x0 0x1000>; + reg =3D <0x0b123000 0x1000>; status =3D "disabled"; }; =20 frame@b124000 { frame-number =3D <2>; interrupts =3D ; - reg =3D <0x0 0x0b124000 0x0 0x1000>; + reg =3D <0x0b124000 0x1000>; status =3D "disabled"; }; =20 frame@b125000 { frame-number =3D <3>; interrupts =3D ; - reg =3D <0x0 0x0b125000 0x0 0x1000>; + reg =3D <0x0b125000 0x1000>; status =3D "disabled"; }; =20 frame@b126000 { frame-number =3D <4>; interrupts =3D ; - reg =3D <0x0 0x0b126000 0x0 0x1000>; + reg =3D <0x0b126000 0x1000>; status =3D "disabled"; }; =20 frame@b127000 { frame-number =3D <5>; interrupts =3D ; - reg =3D <0x0 0x0b127000 0x0 0x1000>; + reg =3D <0x0b127000 0x1000>; status =3D "disabled"; }; =20 frame@b128000 { frame-number =3D <6>; interrupts =3D ; - reg =3D <0x0 0x0b128000 0x0 0x1000>; + reg =3D <0x0b128000 0x1000>; status =3D "disabled"; }; }; diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qco= m/sc7180.dtsi index e1c46b80f14a..e9fb3c9a2d6e 100644 --- a/arch/arm64/boot/dts/qcom/sc7180.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi @@ -3388,9 +3388,9 @@ watchdog@17c10000 { }; =20 timer@17c20000{ - #address-cells =3D <2>; - #size-cells =3D <2>; - ranges; + #address-cells =3D <1>; + #size-cells =3D <1>; + ranges =3D <0 0 0 0x20000000>; compatible =3D "arm,armv7-timer-mem"; reg =3D <0 0x17c20000 0 0x1000>; =20 @@ -3398,49 +3398,49 @@ frame@17c21000 { frame-number =3D <0>; interrupts =3D , ; - reg =3D <0 0x17c21000 0 0x1000>, - <0 0x17c22000 0 0x1000>; + reg =3D <0x17c21000 0x1000>, + <0x17c22000 0x1000>; }; =20 frame@17c23000 { frame-number =3D <1>; interrupts =3D ; - reg =3D <0 0x17c23000 0 0x1000>; + reg =3D <0x17c23000 0x1000>; status =3D "disabled"; }; =20 frame@17c25000 { frame-number =3D <2>; interrupts =3D ; - reg =3D <0 0x17c25000 0 0x1000>; + reg =3D <0x17c25000 0x1000>; status =3D "disabled"; }; =20 frame@17c27000 { frame-number =3D <3>; interrupts =3D ; - reg =3D <0 0x17c27000 0 0x1000>; + reg =3D <0x17c27000 0x1000>; status =3D "disabled"; }; =20 frame@17c29000 { frame-number =3D <4>; interrupts =3D ; - reg =3D <0 0x17c29000 0 0x1000>; + reg =3D <0x17c29000 0x1000>; status =3D "disabled"; }; =20 frame@17c2b000 { frame-number =3D <5>; interrupts =3D ; - reg =3D <0 0x17c2b000 0 0x1000>; + reg =3D <0x17c2b000 0x1000>; status =3D "disabled"; }; =20 frame@17c2d000 { frame-number =3D <6>; interrupts =3D ; - reg =3D <0 0x17c2d000 0 0x1000>; + reg =3D <0x17c2d000 0x1000>; status =3D "disabled"; }; }; diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qco= m/sc7280.dtsi index f0b64be63c21..8a4fd614d0a1 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -4395,9 +4395,9 @@ watchdog@17c10000 { }; =20 timer@17c20000 { - #address-cells =3D <2>; - #size-cells =3D <2>; - ranges; + #address-cells =3D <1>; + #size-cells =3D <1>; + ranges =3D <0 0 0 0x20000000>; compatible =3D "arm,armv7-timer-mem"; reg =3D <0 0x17c20000 0 0x1000>; =20 @@ -4405,49 +4405,49 @@ frame@17c21000 { frame-number =3D <0>; interrupts =3D , ; - reg =3D <0 0x17c21000 0 0x1000>, - <0 0x17c22000 0 0x1000>; + reg =3D <0x17c21000 0x1000>, + <0x17c22000 0x1000>; }; =20 frame@17c23000 { frame-number =3D <1>; interrupts =3D ; - reg =3D <0 0x17c23000 0 0x1000>; + reg =3D <0x17c23000 0x1000>; status =3D "disabled"; }; =20 frame@17c25000 { frame-number =3D <2>; interrupts =3D ; - reg =3D <0 0x17c25000 0 0x1000>; + reg =3D <0x17c25000 0x1000>; status =3D "disabled"; }; =20 frame@17c27000 { frame-number =3D <3>; interrupts =3D ; - reg =3D <0 0x17c27000 0 0x1000>; + reg =3D <0x17c27000 0x1000>; status =3D "disabled"; }; =20 frame@17c29000 { frame-number =3D <4>; interrupts =3D ; - reg =3D <0 0x17c29000 0 0x1000>; + reg =3D <0x17c29000 0x1000>; status =3D "disabled"; }; =20 frame@17c2b000 { frame-number =3D <5>; interrupts =3D ; - reg =3D <0 0x17c2b000 0 0x1000>; + reg =3D <0x17c2b000 0x1000>; status =3D "disabled"; }; =20 frame@17c2d000 { frame-number =3D <6>; interrupts =3D ; - reg =3D <0 0x17c2d000 0 0x1000>; + reg =3D <0x17c2d000 0x1000>; status =3D "disabled"; }; }; diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qco= m/sdm845.dtsi index ad21cf465c98..cd0029ff8246 100644 --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi @@ -4942,9 +4942,9 @@ slimbam: dma-controller@17184000 { }; =20 timer@17c90000 { - #address-cells =3D <2>; - #size-cells =3D <2>; - ranges; + #address-cells =3D <1>; + #size-cells =3D <1>; + ranges =3D <0 0 0 0x20000000>; compatible =3D "arm,armv7-timer-mem"; reg =3D <0 0x17c90000 0 0x1000>; =20 @@ -4952,49 +4952,49 @@ frame@17ca0000 { frame-number =3D <0>; interrupts =3D , ; - reg =3D <0 0x17ca0000 0 0x1000>, - <0 0x17cb0000 0 0x1000>; + reg =3D <0x17ca0000 0x1000>, + <0x17cb0000 0x1000>; }; =20 frame@17cc0000 { frame-number =3D <1>; interrupts =3D ; - reg =3D <0 0x17cc0000 0 0x1000>; + reg =3D <0x17cc0000 0x1000>; status =3D "disabled"; }; =20 frame@17cd0000 { frame-number =3D <2>; interrupts =3D ; - reg =3D <0 0x17cd0000 0 0x1000>; + reg =3D <0x17cd0000 0x1000>; status =3D "disabled"; }; =20 frame@17ce0000 { frame-number =3D <3>; interrupts =3D ; - reg =3D <0 0x17ce0000 0 0x1000>; + reg =3D <0x17ce0000 0x1000>; status =3D "disabled"; }; =20 frame@17cf0000 { frame-number =3D <4>; interrupts =3D ; - reg =3D <0 0x17cf0000 0 0x1000>; + reg =3D <0x17cf0000 0x1000>; status =3D "disabled"; }; =20 frame@17d00000 { frame-number =3D <5>; interrupts =3D ; - reg =3D <0 0x17d00000 0 0x1000>; + reg =3D <0x17d00000 0x1000>; status =3D "disabled"; }; =20 frame@17d10000 { frame-number =3D <6>; interrupts =3D ; - reg =3D <0 0x17d10000 0 0x1000>; + reg =3D <0x17d10000 0x1000>; status =3D "disabled"; }; }; diff --git a/arch/arm64/boot/dts/qcom/sm6350.dtsi b/arch/arm64/boot/dts/qco= m/sm6350.dtsi index d7c9edff19f7..c31fe27a46f2 100644 --- a/arch/arm64/boot/dts/qcom/sm6350.dtsi +++ b/arch/arm64/boot/dts/qcom/sm6350.dtsi @@ -1090,57 +1090,57 @@ timer@17c20000 { compatible =3D "arm,armv7-timer-mem"; reg =3D <0x0 0x17c20000 0x0 0x1000>; clock-frequency =3D <19200000>; - #address-cells =3D <2>; - #size-cells =3D <2>; - ranges; + #address-cells =3D <1>; + #size-cells =3D <1>; + ranges =3D <0 0 0 0x20000000>; =20 frame@17c21000 { frame-number =3D <0>; interrupts =3D , ; - reg =3D <0x0 0x17c21000 0x0 0x1000>, - <0x0 0x17c22000 0x0 0x1000>; + reg =3D <0x17c21000 0x1000>, + <0x17c22000 0x1000>; }; =20 frame@17c23000 { frame-number =3D <1>; interrupts =3D ; - reg =3D <0x0 0x17c23000 0x0 0x1000>; + reg =3D <0x17c23000 0x1000>; status =3D "disabled"; }; =20 frame@17c25000 { frame-number =3D <2>; interrupts =3D ; - reg =3D <0x0 0x17c25000 0x0 0x1000>; + reg =3D <0x17c25000 0x1000>; status =3D "disabled"; }; =20 frame@17c27000 { frame-number =3D <3>; interrupts =3D ; - reg =3D <0x0 0x17c27000 0x0 0x1000>; + reg =3D <0x17c27000 0x1000>; status =3D "disabled"; }; =20 frame@17c29000 { frame-number =3D <4>; interrupts =3D ; - reg =3D <0x0 0x17c29000 0x0 0x1000>; + reg =3D <0x17c29000 0x1000>; status =3D "disabled"; }; =20 frame@17c2b000 { frame-number =3D <5>; interrupts =3D ; - reg =3D <0x0 0x17c2b000 0x0 0x1000>; + reg =3D <0x17c2b000 0x1000>; status =3D "disabled"; }; =20 frame@17c2d000 { frame-number =3D <6>; interrupts =3D ; - reg =3D <0x0 0x17c2d000 0x0 0x1000>; + reg =3D <0x17c2d000 0x1000>; status =3D "disabled"; }; }; diff --git a/arch/arm64/boot/dts/qcom/sm8150.dtsi b/arch/arm64/boot/dts/qco= m/sm8150.dtsi index 15f3bf2e7ea0..d4f288edf3c9 100644 --- a/arch/arm64/boot/dts/qcom/sm8150.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi @@ -3608,9 +3608,9 @@ watchdog@17c10000 { }; =20 timer@17c20000 { - #address-cells =3D <2>; - #size-cells =3D <2>; - ranges; + #address-cells =3D <1>; + #size-cells =3D <1>; + ranges =3D <0 0 0 0x20000000>; compatible =3D "arm,armv7-timer-mem"; reg =3D <0x0 0x17c20000 0x0 0x1000>; clock-frequency =3D <19200000>; @@ -3619,49 +3619,49 @@ frame@17c21000{ frame-number =3D <0>; interrupts =3D , ; - reg =3D <0x0 0x17c21000 0x0 0x1000>, - <0x0 0x17c22000 0x0 0x1000>; + reg =3D <0x17c21000 0x1000>, + <0x17c22000 0x1000>; }; =20 frame@17c23000 { frame-number =3D <1>; interrupts =3D ; - reg =3D <0x0 0x17c23000 0x0 0x1000>; + reg =3D <0x17c23000 0x1000>; status =3D "disabled"; }; =20 frame@17c25000 { frame-number =3D <2>; interrupts =3D ; - reg =3D <0x0 0x17c25000 0x0 0x1000>; + reg =3D <0x17c25000 0x1000>; status =3D "disabled"; }; =20 frame@17c27000 { frame-number =3D <3>; interrupts =3D ; - reg =3D <0x0 0x17c26000 0x0 0x1000>; + reg =3D <0x17c26000 0x1000>; status =3D "disabled"; }; =20 frame@17c29000 { frame-number =3D <4>; interrupts =3D ; - reg =3D <0x0 0x17c29000 0x0 0x1000>; + reg =3D <0x17c29000 0x1000>; status =3D "disabled"; }; =20 frame@17c2b000 { frame-number =3D <5>; interrupts =3D ; - reg =3D <0x0 0x17c2b000 0x0 0x1000>; + reg =3D <0x17c2b000 0x1000>; status =3D "disabled"; }; =20 frame@17c2d000 { frame-number =3D <6>; interrupts =3D ; - reg =3D <0x0 0x17c2d000 0x0 0x1000>; + reg =3D <0x17c2d000 0x1000>; status =3D "disabled"; }; }; diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qco= m/sm8250.dtsi index 1304b86af1a0..ed4e288c921f 100644 --- a/arch/arm64/boot/dts/qcom/sm8250.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi @@ -4528,9 +4528,9 @@ watchdog@17c10000 { }; =20 timer@17c20000 { - #address-cells =3D <2>; - #size-cells =3D <2>; - ranges; + #address-cells =3D <1>; + #size-cells =3D <1>; + ranges =3D <0 0 0 0x20000000>; compatible =3D "arm,armv7-timer-mem"; reg =3D <0x0 0x17c20000 0x0 0x1000>; clock-frequency =3D <19200000>; @@ -4539,49 +4539,49 @@ frame@17c21000 { frame-number =3D <0>; interrupts =3D , ; - reg =3D <0x0 0x17c21000 0x0 0x1000>, - <0x0 0x17c22000 0x0 0x1000>; + reg =3D <0x17c21000 0x1000>, + <0x17c22000 0x1000>; }; =20 frame@17c23000 { frame-number =3D <1>; interrupts =3D ; - reg =3D <0x0 0x17c23000 0x0 0x1000>; + reg =3D <0x17c23000 0x1000>; status =3D "disabled"; }; =20 frame@17c25000 { frame-number =3D <2>; interrupts =3D ; - reg =3D <0x0 0x17c25000 0x0 0x1000>; + reg =3D <0x17c25000 0x1000>; status =3D "disabled"; }; =20 frame@17c27000 { frame-number =3D <3>; interrupts =3D ; - reg =3D <0x0 0x17c27000 0x0 0x1000>; + reg =3D <0x17c27000 0x1000>; status =3D "disabled"; }; =20 frame@17c29000 { frame-number =3D <4>; interrupts =3D ; - reg =3D <0x0 0x17c29000 0x0 0x1000>; + reg =3D <0x17c29000 0x1000>; status =3D "disabled"; }; =20 frame@17c2b000 { frame-number =3D <5>; interrupts =3D ; - reg =3D <0x0 0x17c2b000 0x0 0x1000>; + reg =3D <0x17c2b000 0x1000>; status =3D "disabled"; }; =20 frame@17c2d000 { frame-number =3D <6>; interrupts =3D ; - reg =3D <0x0 0x17c2d000 0x0 0x1000>; + reg =3D <0x17c2d000 0x1000>; status =3D "disabled"; }; }; diff --git a/arch/arm64/boot/dts/qcom/sm8350.dtsi b/arch/arm64/boot/dts/qco= m/sm8350.dtsi index 20f850b94158..d843a550314a 100644 --- a/arch/arm64/boot/dts/qcom/sm8350.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8350.dtsi @@ -1752,9 +1752,9 @@ intc: interrupt-controller@17a00000 { =20 timer@17c20000 { compatible =3D "arm,armv7-timer-mem"; - #address-cells =3D <2>; - #size-cells =3D <2>; - ranges; + #address-cells =3D <1>; + #size-cells =3D <1>; + ranges =3D <0 0 0 0x20000000>; reg =3D <0x0 0x17c20000 0x0 0x1000>; clock-frequency =3D <19200000>; =20 @@ -1762,49 +1762,49 @@ frame@17c21000 { frame-number =3D <0>; interrupts =3D , ; - reg =3D <0x0 0x17c21000 0x0 0x1000>, - <0x0 0x17c22000 0x0 0x1000>; + reg =3D <0x17c21000 0x1000>, + <0x17c22000 0x1000>; }; =20 frame@17c23000 { frame-number =3D <1>; interrupts =3D ; - reg =3D <0x0 0x17c23000 0x0 0x1000>; + reg =3D <0x17c23000 0x1000>; status =3D "disabled"; }; =20 frame@17c25000 { frame-number =3D <2>; interrupts =3D ; - reg =3D <0x0 0x17c25000 0x0 0x1000>; + reg =3D <0x17c25000 0x1000>; status =3D "disabled"; }; =20 frame@17c27000 { frame-number =3D <3>; interrupts =3D ; - reg =3D <0x0 0x17c27000 0x0 0x1000>; + reg =3D <0x17c27000 0x1000>; status =3D "disabled"; }; =20 frame@17c29000 { frame-number =3D <4>; interrupts =3D ; - reg =3D <0x0 0x17c29000 0x0 0x1000>; + reg =3D <0x17c29000 0x1000>; status =3D "disabled"; }; =20 frame@17c2b000 { frame-number =3D <5>; interrupts =3D ; - reg =3D <0x0 0x17c2b000 0x0 0x1000>; + reg =3D <0x17c2b000 0x1000>; status =3D "disabled"; }; =20 frame@17c2d000 { frame-number =3D <6>; interrupts =3D ; - reg =3D <0x0 0x17c2d000 0x0 0x1000>; + reg =3D <0x17c2d000 0x1000>; status =3D "disabled"; }; }; diff --git a/arch/arm64/boot/dts/qcom/sm8450.dtsi b/arch/arm64/boot/dts/qco= m/sm8450.dtsi index 7a14eb89e4ca..e5fe694b7be6 100644 --- a/arch/arm64/boot/dts/qcom/sm8450.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8450.dtsi @@ -1203,9 +1203,9 @@ intc: interrupt-controller@17100000 { =20 timer@17420000 { compatible =3D "arm,armv7-timer-mem"; - #address-cells =3D <2>; - #size-cells =3D <2>; - ranges; + #address-cells =3D <1>; + #size-cells =3D <1>; + ranges =3D <0 0 0 0x20000000>; reg =3D <0x0 0x17420000 0x0 0x1000>; clock-frequency =3D <19200000>; =20 @@ -1213,49 +1213,49 @@ frame@17421000 { frame-number =3D <0>; interrupts =3D , ; - reg =3D <0x0 0x17421000 0x0 0x1000>, - <0x0 0x17422000 0x0 0x1000>; + reg =3D <0x17421000 0x1000>, + <0x17422000 0x1000>; }; =20 frame@17423000 { frame-number =3D <1>; interrupts =3D ; - reg =3D <0x0 0x17423000 0x0 0x1000>; + reg =3D <0x17423000 0x1000>; status =3D "disabled"; }; =20 frame@17425000 { frame-number =3D <2>; interrupts =3D ; - reg =3D <0x0 0x17425000 0x0 0x1000>; + reg =3D <0x17425000 0x1000>; status =3D "disabled"; }; =20 frame@17427000 { frame-number =3D <3>; interrupts =3D ; - reg =3D <0x0 0x17427000 0x0 0x1000>; + reg =3D <0x17427000 0x1000>; status =3D "disabled"; }; =20 frame@17429000 { frame-number =3D <4>; interrupts =3D ; - reg =3D <0x0 0x17429000 0x0 0x1000>; + reg =3D <0x17429000 0x1000>; status =3D "disabled"; }; =20 frame@1742b000 { frame-number =3D <5>; interrupts =3D ; - reg =3D <0x0 0x1742b000 0x0 0x1000>; + reg =3D <0x1742b000 0x1000>; status =3D "disabled"; }; =20 frame@1742d000 { frame-number =3D <6>; interrupts =3D ; - reg =3D <0x0 0x1742d000 0x0 0x1000>; + reg =3D <0x1742d000 0x1000>; status =3D "disabled"; }; }; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6031C00140 for ; Mon, 15 Aug 2022 20:29:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346716AbiHOU3l (ORCPT ); Mon, 15 Aug 2022 16:29:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347306AbiHOUWP (ORCPT ); Mon, 15 Aug 2022 16:22:15 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D46F33A31; Mon, 15 Aug 2022 12:02:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 9ACEACE129C; Mon, 15 Aug 2022 19:02:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80CC2C433C1; Mon, 15 Aug 2022 19:02:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590134; bh=Shks8rDUt6fwvZCiVNN+z/KX40yACmnhgAaxaywLQ9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eh8QpvKwqEBvRJjbEY+1SVpCjeNhIIdvuqm2fFxKPr+BNPKss7IdK1SvaXkqpfVG6 WYi9Xb8oA1k559ntLnmlIYH4XwJ+yCZPRvvDFtyvom7zDz1hVhVeIWR1acbehRN9M+ cCJtV+SMGSZB0wyKO8QB93Z+xzqYa567KtUt015Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Guo Mengqi , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0161/1095] spi: synquacer: Add missing clk_disable_unprepare() Date: Mon, 15 Aug 2022 19:52:40 +0200 Message-Id: <20220815180436.227010316@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guo Mengqi [ Upstream commit 917e43de2a56d9b82576f1cc94748261f1988458 ] Add missing clk_disable_unprepare() in synquacer_spi_resume(). Reported-by: Hulk Robot Signed-off-by: Guo Mengqi Link: https://lore.kernel.org/r/20220624005614.49434-1-guomengqi3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/spi/spi-synquacer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi-synquacer.c b/drivers/spi/spi-synquacer.c index ea706d9629cb..47cbe73137c2 100644 --- a/drivers/spi/spi-synquacer.c +++ b/drivers/spi/spi-synquacer.c @@ -783,6 +783,7 @@ static int __maybe_unused synquacer_spi_resume(struct d= evice *dev) =20 ret =3D synquacer_spi_enable(master); if (ret) { + clk_disable_unprepare(sspi->clk); dev_err(dev, "failed to enable spi (%d)\n", ret); return ret; } --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD048C00140 for ; Mon, 15 Aug 2022 20:34:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345898AbiHOUeS (ORCPT ); Mon, 15 Aug 2022 16:34:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346701AbiHOU23 (ORCPT ); Mon, 15 Aug 2022 16:28:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFDA0A1A5F; Mon, 15 Aug 2022 12:04:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 16022612AF; Mon, 15 Aug 2022 19:04:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07301C433B5; Mon, 15 Aug 2022 19:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590256; bh=uY13mo9qtASTnrLurEscpXAMDs4UVUh1xoWThPdMtxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wmPSmVORPm7BomJZbAjQuRYITAWdpdSYYeonylgVz8qcwfi5c2LDrR2zRABw8nOOu e3u9S6GdUV+AHKU2icY3fuhbtPTn7LtEBQTJafWPHImsfnN6e7HgJXCf3Aj5J8J37X oAcq6BEQXUingOzzseLb91iNAX++T7/ZfsA5VWjs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Tony Lindgren , Sasha Levin Subject: [PATCH 5.18 0162/1095] ARM: OMAP2+: display: Fix refcount leak bug Date: Mon, 15 Aug 2022 19:52:41 +0200 Message-Id: <20220815180436.271876476@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 50b87a32a79bca6e275918a711fb8cc55e16d739 ] In omapdss_init_fbdev(), of_find_node_by_name() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore. Signed-off-by: Liang He Message-Id: <20220617145803.4050918-1-windhl@126.com> Signed-off-by: Tony Lindgren Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/mach-omap2/display.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index 21413a9b7b6c..eb09a25e3b45 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c @@ -211,6 +211,7 @@ static int __init omapdss_init_fbdev(void) node =3D of_find_node_by_name(NULL, "omap4_padconf_global"); if (node) omap4_dsi_mux_syscon =3D syscon_node_to_regmap(node); + of_node_put(node); =20 return 0; } --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A77A6C00140 for ; Mon, 15 Aug 2022 20:32:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346579AbiHOUas (ORCPT ); Mon, 15 Aug 2022 16:30:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347334AbiHOUWS (ORCPT ); Mon, 15 Aug 2022 16:22:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C8B633E28; Mon, 15 Aug 2022 12:02:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7CCD061299; Mon, 15 Aug 2022 19:02:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73E55C433C1; Mon, 15 Aug 2022 19:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590158; bh=lN24LFKC2NWslvWPfsezsUuZEr7kWkBTZ/LrqMh9pO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u1d+tka8nSQhM7YiTcR76raVR8fY5Zjsw853qB9DNe8uQOxikMbk8eSpy68WrpGXm 4h/Vgi4sQhkqUtZHkLYQMoThsyEVkZ8ydDECVPs0+x3mqz6iXSHwn6UogwOv62JEOH yaAu8YoU7TDplHf3rpnh0Nm2OXsyyImmWTyFJXiA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Tony Lindgren , Sasha Levin Subject: [PATCH 5.18 0163/1095] ARM: OMAP2+: pdata-quirks: Fix refcount leak bug Date: Mon, 15 Aug 2022 19:52:42 +0200 Message-Id: <20220815180436.317297633@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 5cdbab96bab314c6f2f5e4e8b8a019181328bf5f ] In pdata_quirks_init_clocks(), the loop contains of_find_node_by_name() but without corresponding of_node_put(). Signed-off-by: Liang He Message-Id: <20220618020603.4055792-1-windhl@126.com> Signed-off-by: Tony Lindgren Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/mach-omap2/pdata-quirks.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata= -quirks.c index e7fd29a502a0..af9d8c432af0 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c @@ -551,6 +551,8 @@ pdata_quirks_init_clocks(const struct of_device_id *oma= p_dt_match_table) =20 of_platform_populate(np, omap_dt_match_table, omap_auxdata_lookup, NULL); + + of_node_put(np); } } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D65CC28B2B for ; Mon, 15 Aug 2022 20:32:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348065AbiHOUcC (ORCPT ); Mon, 15 Aug 2022 16:32:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347530AbiHOUZz (ORCPT ); Mon, 15 Aug 2022 16:25:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28F1E357CE; Mon, 15 Aug 2022 12:03:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0B3B161296; Mon, 15 Aug 2022 19:03:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 109D6C433D6; Mon, 15 Aug 2022 19:03:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590192; bh=XBYd5KmOyO7N25HDSPYLqT45ga2LwnRyBjaXX8A/4ks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w5xLvD7zErpaUOEfC+spg+kPlzmI0giqLLOE//KaJ751RKEazSPcuUEDQ2vuEm4ZI MGFuxbDtk8ubgxPZ8xQno3KVU4Oq5w7OuJGjzVSQgm+bcpZ5SqCBHk9eoh2gdKcos4 8g8jA72velU8SRgarUl0kiv/y7G6av9ocCvKzFSs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 0164/1095] ACPI: EC: Remove duplicate ThinkPad X1 Carbon 6th entry from DMI quirks Date: Mon, 15 Aug 2022 19:52:43 +0200 Message-Id: <20220815180436.367559933@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 0dd6db359e5f206cbf1dd1fd40dd211588cd2725 ] Somehow the "ThinkPad X1 Carbon 6th" entry ended up twice in the struct dmi_system_id acpi_ec_no_wakeup[] array. Remove one of the entries. Signed-off-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/acpi/ec.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index a1b871a418f8..f6a022892ee0 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -2207,13 +2207,6 @@ static const struct dmi_system_id acpi_ec_no_wakeup[= ] =3D { DMI_MATCH(DMI_PRODUCT_FAMILY, "Thinkpad X1 Carbon 6th"), }, }, - { - .ident =3D "ThinkPad X1 Carbon 6th", - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), - DMI_MATCH(DMI_PRODUCT_FAMILY, "ThinkPad X1 Carbon 6th"), - }, - }, { .ident =3D "ThinkPad X1 Yoga 3rd", .matches =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A95FC25B08 for ; Mon, 15 Aug 2022 20:33:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345243AbiHOUdY (ORCPT ); Mon, 15 Aug 2022 16:33:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347992AbiHOU1C (ORCPT ); Mon, 15 Aug 2022 16:27:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF528A00DF; Mon, 15 Aug 2022 12:04:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 42A88612B5; Mon, 15 Aug 2022 19:03:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4831CC433B5; Mon, 15 Aug 2022 19:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590225; bh=4aAKBapeGlYr3ggdBm1xQyeoLJA/6rHuTb/O96D0g/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=brxX6VMWyPNlT8m395jjG7FG0V3+HnepagraOu1DGXny6YFDGaLlc+CALtKd/+mGd 0dzNXUDJVBJ/ULHO5RBBLd44CPkzEVYzHEKSOFLMpiVrivs2BIIubOTRKuxuPCPCA3 D4g20K7rz6YW5IMasG0qIOkGUrEHUfGTkK9LP76s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Daniel Drake , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 0165/1095] ACPI: EC: Drop the EC_FLAGS_IGNORE_DSDT_GPE quirk Date: Mon, 15 Aug 2022 19:52:44 +0200 Message-Id: <20220815180436.418694243@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit f7090e0ef360d674f08a22fab90e4e209fb1f658 ] It seems that these quirks are no longer necessary since commit 69b957c26b32 ("ACPI: EC: Fix possible issues related to EC initialization order"), which has fixed this in a generic manner. There are 3 commits adding DMI entries with this quirk (adding multiple DMI entries per commit). 2/3 commits are from before the generic fix. Which leaves commit 6306f0431914 ("ACPI: EC: Make more Asus laptops use ECDT _GPE"), which was committed way after the generic fix. But this was just due to slow upstreaming of it. This commit stems from Endless from 15 Aug 2017 (committed upstream 20 May 2021): https://github.com/endlessm/linux/pull/288 The current code should work fine without this: 1. The EC_FLAGS_IGNORE_DSDT_GPE flag is only checked in ec_parse_device(), like this: if (boot_ec && boot_ec_is_ecdt && EC_FLAGS_IGNORE_DSDT_GPE) { ec->gpe =3D boot_ec->gpe; } else { /* parse GPE */ } 2. ec_parse_device() is only called from acpi_ec_add() and acpi_ec_dsdt_probe() 3. acpi_ec_dsdt_probe() starts with: if (boot_ec) return; so it only calls ec_parse_device() when boot_ec =3D=3D NULL, meaning th= at the quirk never triggers for this call. So only the call in acpi_ec_add() matters. 4. acpi_ec_add() does the following after the ec_parse_device() call: if (boot_ec && ec->command_addr =3D=3D boot_ec->command_addr && ec->data_addr =3D=3D boot_ec->data_addr && !EC_FLAGS_TRUST_DSDT_GPE) { /* * Trust PNP0C09 namespace location rather than * ECDT ID. But trust ECDT GPE rather than _GPE * because of ASUS quirks, so do not change * boot_ec->gpe to ec->gpe. */ boot_ec->handle =3D ec->handle; acpi_handle_debug(ec->handle, "duplicated.\n"); acpi_ec_free(ec); ec =3D boot_ec; } The quirk only matters if boot_ec !=3D NULL and EC_FLAGS_TRUST_DSDT_GPE is never set at the same time as EC_FLAGS_IGNORE_DSDT_GPE. That means that if the addresses match we always enter this if block and then only the ec->handle part of the data stored in ec by ec_parse_device() is used and the rest is thrown away, after which ec is made to point to boot_ec, at which point ec->gpe =3D=3D boot_ec->gpe, so the same result as with the quirk set, independent of the value of the quirk. Also note the comment in this block which indicates that the gpe result from ec_parse_device() is deliberately not taken to deal with buggy Asus laptops and all DMI quirks setting EC_FLAGS_IGNORE_DSDT_GPE are for Asus laptops. Based on the above I believe that unless on some quirked laptops the ECDT and DSDT EC addresses do not match we can drop the quirk. I've checked dmesg output to ensure the ECDT and DSDT EC addresses match for quirked models using https://linux-hardware.org hw-probe reports. I've been able to confirm that the addresses match for the following models this way: GL702VMK, X505BA, X505BP, X550VXK, X580VD. Whereas for the following models I could find any dmesg output: FX502VD, FX502VE, X542BA, X542BP. Note the models without dmesg all were submitted in patches with a batch of models and other models from the same batch checkout ok. This, combined with that all the code adding the quirks was written before the generic fix makes me believe that it is safe to remove this quirk now. Signed-off-by: Hans de Goede Reviewed-by: Daniel Drake Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/acpi/ec.c | 75 ++++++----------------------------------------- 1 file changed, 9 insertions(+), 66 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index f6a022892ee0..488c9ec0da0b 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -180,7 +180,6 @@ static struct workqueue_struct *ec_wq; static struct workqueue_struct *ec_query_wq; =20 static int EC_FLAGS_CORRECT_ECDT; /* Needs ECDT port address correction */ -static int EC_FLAGS_IGNORE_DSDT_GPE; /* Needs ECDT GPE as correction setti= ng */ static int EC_FLAGS_TRUST_DSDT_GPE; /* Needs DSDT GPE as correction settin= g */ static int EC_FLAGS_CLEAR_ON_RESUME; /* Needs acpi_ec_clear() on boot/resu= me */ =20 @@ -1407,24 +1406,16 @@ ec_parse_device(acpi_handle handle, u32 Level, void= *context, void **retval) if (ec->data_addr =3D=3D 0 || ec->command_addr =3D=3D 0) return AE_OK; =20 - if (boot_ec && boot_ec_is_ecdt && EC_FLAGS_IGNORE_DSDT_GPE) { - /* - * Always inherit the GPE number setting from the ECDT - * EC. - */ - ec->gpe =3D boot_ec->gpe; - } else { - /* Get GPE bit assignment (EC events). */ - /* TODO: Add support for _GPE returning a package */ - status =3D acpi_evaluate_integer(handle, "_GPE", NULL, &tmp); - if (ACPI_SUCCESS(status)) - ec->gpe =3D tmp; + /* Get GPE bit assignment (EC events). */ + /* TODO: Add support for _GPE returning a package */ + status =3D acpi_evaluate_integer(handle, "_GPE", NULL, &tmp); + if (ACPI_SUCCESS(status)) + ec->gpe =3D tmp; + /* + * Errors are non-fatal, allowing for ACPI Reduced Hardware + * platforms which use GpioInt instead of GPE. + */ =20 - /* - * Errors are non-fatal, allowing for ACPI Reduced Hardware - * platforms which use GpioInt instead of GPE. - */ - } /* Use the global lock for all EC transactions? */ tmp =3D 0; acpi_evaluate_integer(handle, "_GLK", NULL, &tmp); @@ -1862,60 +1853,12 @@ static int ec_honor_dsdt_gpe(const struct dmi_syste= m_id *id) return 0; } =20 -/* - * Some DSDTs contain wrong GPE setting. - * Asus FX502VD/VE, GL702VMK, X550VXK, X580VD - * https://bugzilla.kernel.org/show_bug.cgi?id=3D195651 - */ -static int ec_honor_ecdt_gpe(const struct dmi_system_id *id) -{ - pr_debug("Detected system needing ignore DSDT GPE setting.\n"); - EC_FLAGS_IGNORE_DSDT_GPE =3D 1; - return 0; -} - static const struct dmi_system_id ec_dmi_table[] __initconst =3D { { ec_correct_ecdt, "MSI MS-171F", { DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star"), DMI_MATCH(DMI_PRODUCT_NAME, "MS-171F"),}, NULL}, { - ec_honor_ecdt_gpe, "ASUS FX502VD", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "FX502VD"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUS FX502VE", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "FX502VE"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUS GL702VMK", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "GL702VMK"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X505BA", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "X505BA"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X505BP", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "X505BP"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X542BA", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "X542BA"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X542BP", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "X542BP"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUS X550VXK", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "X550VXK"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUS X580VD", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "X580VD"),}, NULL}, - { /* https://bugzilla.kernel.org/show_bug.cgi?id=3D209989 */ ec_honor_dsdt_gpe, "HP Pavilion Gaming Laptop 15-cx0xxx", { DMI_MATCH(DMI_SYS_VENDOR, "HP"), --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A062C25B08 for ; Mon, 15 Aug 2022 20:33:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345404AbiHOUd3 (ORCPT ); Mon, 15 Aug 2022 16:33:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347993AbiHOU1C (ORCPT ); Mon, 15 Aug 2022 16:27:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1288B9F766; Mon, 15 Aug 2022 12:04:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 88FA5612A0; Mon, 15 Aug 2022 19:03:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7673CC433D7; Mon, 15 Aug 2022 19:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590238; bh=zhcN5rVttKQpHt0Mnjwy+TDGMAsgje+gQlW+Ph9klbE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t2z2xdJV7OZbvBPHWYflgQE0eBkchv5hC7X4WqAHLn5qkVA5rqcneZUINl5tRaM1B AVZBNBgldRLzoov9tY84eHe12LYKBn0x1VOZ0YiiMIUZPZRzZE/0212kSorKmW1nks sD7xlpwCtDZqgukm/t80++3jb6gOWLLk1/azfOVw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manyi Li , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 0166/1095] ACPI: PM: save NVS memory for Lenovo G40-45 Date: Mon, 15 Aug 2022 19:52:45 +0200 Message-Id: <20220815180436.471713937@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Manyi Li [ Upstream commit 4b7ef7b05afcde44142225c184bf43a0cd9e2178 ] [821d6f0359b0614792ab8e2fb93b503e25a65079] is to make machines produced from 2012 to now not saving NVS region to accelerate S3. But, Lenovo G40-45, a platform released in 2015, still needs NVS memory saving during S3. A quirk is introduced for this platform. Signed-off-by: Manyi Li Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/acpi/sleep.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 3147702710af..1ec3238e2cdc 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -360,6 +360,14 @@ static const struct dmi_system_id acpisleep_dmi_table[= ] __initconst =3D { DMI_MATCH(DMI_PRODUCT_NAME, "80E3"), }, }, + { + .callback =3D init_nvs_save_s3, + .ident =3D "Lenovo G40-45", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "80E1"), + }, + }, /* * ThinkPad X1 Tablet(2016) cannot do suspend-to-idle using * the Low Power S0 Idle firmware interface (see --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CEA8C00140 for ; Mon, 15 Aug 2022 20:34:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345796AbiHOUeK (ORCPT ); Mon, 15 Aug 2022 16:34:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347476AbiHOU2B (ORCPT ); Mon, 15 Aug 2022 16:28:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C68CFA1D31; Mon, 15 Aug 2022 12:04:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5FFFFB81104; Mon, 15 Aug 2022 19:04:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0406C433D6; Mon, 15 Aug 2022 19:04:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590241; bh=Sja0o4WT94abP/9yeowwf/8JUqSGSH1x3gwkaizUJp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qUfcYe/V5LYMsAiQXvAd9ndpxuDwwfbBM850dtFvR2CrREFuJRZUSWdNeHwSNd1FW WGQqxppe51VP72+FzW1o5t2ALnU5fGx+R7wc7WLMy1l9VNdOxBqMRB7eKqjHgkTVp4 bgMbKisXyT27gU1ErEyZHrSEnzciYoOvTSHd0o3M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, huhai , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 0167/1095] ACPI: LPSS: Fix missing check in register_device_clock() Date: Mon, 15 Aug 2022 19:52:46 +0200 Message-Id: <20220815180436.516565608@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: huhai [ Upstream commit b4f1f61ed5928b1128e60e38d0dffa16966f06dc ] register_device_clock() misses a check for platform_device_register_simple(= ). Add a check to fix it. Signed-off-by: huhai Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/acpi/acpi_lpss.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index fbe0756259c5..c4d4d21391d7 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c @@ -422,6 +422,9 @@ static int register_device_clock(struct acpi_device *ad= ev, if (!lpss_clk_dev) lpt_register_clock_device(); =20 + if (IS_ERR(lpss_clk_dev)) + return PTR_ERR(lpss_clk_dev); + clk_data =3D platform_get_drvdata(lpss_clk_dev); if (!clk_data) return -ENODEV; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2BD8C282E7 for ; Mon, 15 Aug 2022 20:33:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244370AbiHOUdi (ORCPT ); Mon, 15 Aug 2022 16:33:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347112AbiHOU1R (ORCPT ); Mon, 15 Aug 2022 16:27:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED77CA00E3; Mon, 15 Aug 2022 12:04:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6F99EB81062; Mon, 15 Aug 2022 19:04:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6F5CC433D6; Mon, 15 Aug 2022 19:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590244; bh=PT+al3/X/j0Hg/eZTwUwoGO/zO2403tlyPrSpTLoZ2I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QOmNc5PclooqDcj1TElGjNXbiJTIyMYBV6IOwRn1Ov/LVT8pVkCCsCcavWnqxmT2x hNzp8ug/0RUOWKnE/nv0GjB2Rba+UooJ43rtp96rhkooqT/lhJ4h3Mo8fUfJeemxlN 18LAC1pzaSHXb2e60v5W/yuDdUMY/sbLVLutu5ZU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0168/1095] ARM: dts: qcom: sdx55: Fix the IRQ trigger type for UART Date: Mon, 15 Aug 2022 19:52:47 +0200 Message-Id: <20220815180436.560138832@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Manivannan Sadhasivam [ Upstream commit ae500b351ab0006d933d804a2b7507fe1e98cecc ] The trigger type should be LEVEL_HIGH. So fix it! Signed-off-by: Manivannan Sadhasivam Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220530080842.37024-2-manivannan.sadhasiva= m@linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-sdx55.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/qcom-sdx55.dtsi b/arch/arm/boot/dts/qcom-sdx= 55.dtsi index d455795da44c..b75e672c239d 100644 --- a/arch/arm/boot/dts/qcom-sdx55.dtsi +++ b/arch/arm/boot/dts/qcom-sdx55.dtsi @@ -206,7 +206,7 @@ gcc: clock-controller@100000 { blsp1_uart3: serial@831000 { compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; reg =3D <0x00831000 0x200>; - interrupts =3D ; + interrupts =3D ; clocks =3D <&gcc 30>, <&gcc 9>; clock-names =3D "core", "iface"; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0904C00140 for ; Mon, 15 Aug 2022 20:34:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344825AbiHOUeQ (ORCPT ); Mon, 15 Aug 2022 16:34:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345956AbiHOU2S (ORCPT ); Mon, 15 Aug 2022 16:28:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEEC6A0305; Mon, 15 Aug 2022 12:04:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BDE8661281; Mon, 15 Aug 2022 19:04:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABA74C433C1; Mon, 15 Aug 2022 19:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590247; bh=m7W2Uu+7QdsldiMwSIaJvP+5QGzHdK7f+nSQK7+tS2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nu0RKXMtDbCTcEK26fj5GvlDLs6Ie03kHCLT2fnKqxzUFa04s8LPZePmma5dxqBtF zi2D+bjBaT4GQApe1+x3NV/ZpjJwgNCrU/zGEaAVJ31OvZmK+q4aOg9oub7fKOIybD vIWm+MK/zODDp/ZsH2j24b2xwVWufx3LqwLeycsI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0169/1095] arm64: dts: qcom: add missing AOSS QMP compatible fallback Date: Mon, 15 Aug 2022 19:52:48 +0200 Message-Id: <20220815180436.603356159@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit 6ba93ba9f63fbc44c3a6af7fe6f2536d009cfd5a ] The AOSS QMP bindings expect all compatibles to be followed by fallback "qcom,aoss-qmp" because all of these are actually compatible with each other. This fixes dtbs_check warnings like: sm8250-hdk.dtb: power-controller@c300000: compatible: ['qcom,sm8250-aoss-= qmp'] is too short Signed-off-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220504131923.214367-6-krzysztof.kozlowski= @linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/sc7180.dtsi | 2 +- arch/arm64/boot/dts/qcom/sc7280.dtsi | 2 +- arch/arm64/boot/dts/qcom/sm8150.dtsi | 2 +- arch/arm64/boot/dts/qcom/sm8250.dtsi | 2 +- arch/arm64/boot/dts/qcom/sm8350.dtsi | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qco= m/sc7180.dtsi index e9fb3c9a2d6e..120db2d0a309 100644 --- a/arch/arm64/boot/dts/qcom/sc7180.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi @@ -3219,7 +3219,7 @@ aoss_reset: reset-controller@c2a0000 { }; =20 aoss_qmp: power-controller@c300000 { - compatible =3D "qcom,sc7180-aoss-qmp"; + compatible =3D "qcom,sc7180-aoss-qmp", "qcom,aoss-qmp"; reg =3D <0 0x0c300000 0 0x400>; interrupts =3D ; mboxes =3D <&apss_shared 0>; diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qco= m/sc7280.dtsi index 8a4fd614d0a1..7925c8561117 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -3467,7 +3467,7 @@ aoss_reset: reset-controller@c2a0000 { }; =20 aoss_qmp: power-controller@c300000 { - compatible =3D "qcom,sc7280-aoss-qmp"; + compatible =3D "qcom,sc7280-aoss-qmp", "qcom,aoss-qmp"; reg =3D <0 0x0c300000 0 0x400>; interrupts-extended =3D <&ipcc IPCC_CLIENT_AOP IPCC_MPROC_SIGNAL_GLINK_QMP diff --git a/arch/arm64/boot/dts/qcom/sm8150.dtsi b/arch/arm64/boot/dts/qco= m/sm8150.dtsi index d4f288edf3c9..6edb3986a473 100644 --- a/arch/arm64/boot/dts/qcom/sm8150.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi @@ -3382,7 +3382,7 @@ camnoc_virt: interconnect@ac00000 { }; =20 aoss_qmp: power-controller@c300000 { - compatible =3D "qcom,sm8150-aoss-qmp"; + compatible =3D "qcom,sm8150-aoss-qmp", "qcom,aoss-qmp"; reg =3D <0x0 0x0c300000 0x0 0x400>; interrupts =3D ; mboxes =3D <&apss_shared 0>; diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qco= m/sm8250.dtsi index ed4e288c921f..1d62b2130e04 100644 --- a/arch/arm64/boot/dts/qcom/sm8250.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi @@ -3475,7 +3475,7 @@ tsens1: thermal-sensor@c265000 { }; =20 aoss_qmp: power-controller@c300000 { - compatible =3D "qcom,sm8250-aoss-qmp"; + compatible =3D "qcom,sm8250-aoss-qmp", "qcom,aoss-qmp"; reg =3D <0 0x0c300000 0 0x400>; interrupts-extended =3D <&ipcc IPCC_CLIENT_AOP IPCC_MPROC_SIGNAL_GLINK_QMP diff --git a/arch/arm64/boot/dts/qcom/sm8350.dtsi b/arch/arm64/boot/dts/qco= m/sm8350.dtsi index d843a550314a..ee6c202ab68c 100644 --- a/arch/arm64/boot/dts/qcom/sm8350.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8350.dtsi @@ -1537,7 +1537,7 @@ tsens1: thermal-sensor@c265000 { }; =20 aoss_qmp: power-controller@c300000 { - compatible =3D "qcom,sm8350-aoss-qmp"; + compatible =3D "qcom,sm8350-aoss-qmp", "qcom,aoss-qmp"; reg =3D <0 0x0c300000 0 0x400>; interrupts-extended =3D <&ipcc IPCC_CLIENT_AOP IPCC_MPROC_SIGNAL_GLINK_= QMP IRQ_TYPE_EDGE_RISING>; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30FF8C25B08 for ; Mon, 15 Aug 2022 20:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345962AbiHOUe1 (ORCPT ); Mon, 15 Aug 2022 16:34:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346172AbiHOUae (ORCPT ); Mon, 15 Aug 2022 16:30:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7766BA2854; Mon, 15 Aug 2022 12:04:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8F5AFB810A2; Mon, 15 Aug 2022 19:04:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EED4DC433D6; Mon, 15 Aug 2022 19:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590250; bh=or9ghtm9eTD9b4MK7ycw9/x0MKycVDa98HnF9GQBIvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z6Ar4F4xtWZwG/aebH7PTfYai2xLyxz29uVc+2Qjj/PAbxBpi/m2BsNoTa2jy4Ap9 glr1wdYLJX0AhVwH++Ycpxso4vQ5QotC2kBhnkcDr0Zr5eS3CEmADUFQNwD85hbTMb rd3sJ5XoF+W5HYrDh7Zxbc4+P22cw3+pp0Bcx3Xc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Krzysztof Kozlowski , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0170/1095] arm64: dts: qcom: ipq8074: fix NAND node name Date: Mon, 15 Aug 2022 19:52:49 +0200 Message-Id: <20220815180436.654095684@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Marko [ Upstream commit b39961659ffc3c3a9e3d0d43b0476547b5f35d49 ] Per schema it should be nand-controller@79b0000 instead of nand@79b0000. Fix it to match nand-controller.yaml requirements. Signed-off-by: Robert Marko Reviewed-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220621120642.518575-1-robimarko@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/ipq8074.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qc= om/ipq8074.dtsi index 8d4e0e193439..664fba3632b1 100644 --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi @@ -534,7 +534,7 @@ qpic_bam: dma-controller@7984000 { status =3D "disabled"; }; =20 - qpic_nand: nand@79b0000 { + qpic_nand: nand-controller@79b0000 { compatible =3D "qcom,ipq8074-nand"; reg =3D <0x079b0000 0x10000>; #address-cells =3D <1>; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A959CC00140 for ; Mon, 15 Aug 2022 20:34:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345746AbiHOUeC (ORCPT ); Mon, 15 Aug 2022 16:34:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347477AbiHOU2B (ORCPT ); Mon, 15 Aug 2022 16:28:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2165AA0621; Mon, 15 Aug 2022 12:04:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E1E6C612AB; Mon, 15 Aug 2022 19:04:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0EE1C433B5; Mon, 15 Aug 2022 19:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590253; bh=rwkTHpB1djJ8Tb2+9cwpD8csB2WM2/iWjGaLWOtDMeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gsmmPNfAJfoJg8x23K0f/F8P7nzkKKYCH1/RNp+Royo5lhjD8EJOEL7I05IFMriwP /zW9i6apXN6w3rGx/TBiK5I8VR0jejPkEFcroLTKFuOm9oLShmv4qxNteBjzlDaASg 4z2gQALclU9XfeOfdo83C0FEmCFfyN05B1g/2Zrc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Holland , Jernej Skrabec , Sasha Levin Subject: [PATCH 5.18 0171/1095] arm64: dts: allwinner: a64: orangepi-win: Fix LED node name Date: Mon, 15 Aug 2022 19:52:50 +0200 Message-Id: <20220815180436.706085467@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit b8eb2df19fbf97aa1e950cf491232c2e3bef8357 ] "status" does not match any pattern in the gpio-leds binding. Rename the node to the preferred pattern. This fixes a `make dtbs_check` error. Signed-off-by: Samuel Holland Reviewed-by: Jernej Skrabec Signed-off-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220702132816.46456-1-samuel@sholland.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts b/ar= ch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts index c519d9fa6967..3d2c68d58f49 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts @@ -40,7 +40,7 @@ hdmi_con_in: endpoint { leds { compatible =3D "gpio-leds"; =20 - status { + led-0 { label =3D "orangepi:green:status"; gpios =3D <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */ }; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8749C3F6B0 for ; Mon, 15 Aug 2022 20:32:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347287AbiHOUbF (ORCPT ); Mon, 15 Aug 2022 16:31:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243760AbiHOUWT (ORCPT ); Mon, 15 Aug 2022 16:22:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5BD14B499; Mon, 15 Aug 2022 12:02:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 25CFFB810A2; Mon, 15 Aug 2022 19:02:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B1CFC433C1; Mon, 15 Aug 2022 19:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590161; bh=hwBSpc7erig/674qMUa5THYn7tKXm6QBe24djanajcU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jRt0IJPOXmG4sg6hQfTTgiTZMNiTFbYM7kmEQEqI83srg+W83LDVy2mh/5cGGi/D8 BwI+S3f0kbSS0LcfaIhvmZFe6kZa9huwP4epChwlEhDMhtKWtQrvpXWf9ocZjK3kLB ljQXWD5aBCIKsNer4VR6v150HXL7UyVrEBUl99NM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.18 0172/1095] ARM: shmobile: rcar-gen2: Increase refcount for new reference Date: Mon, 15 Aug 2022 19:52:51 +0200 Message-Id: <20220815180436.747934337@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 75a185fb92e58ccd3670258d8d3b826bd2fa6d29 ] In rcar_gen2_regulator_quirk(), for_each_matching_node_and_match() will automatically increase and decrease the refcount. However, we should call of_node_get() for the new reference created in 'quirk->np'. Besides, we also should call of_node_put() before the 'quirk' being freed. Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220701121804.234223-1-windhl@126.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c b/arch/arm/= mach-shmobile/regulator-quirk-rcar-gen2.c index 09ef73b99dd8..ba44cec5e59a 100644 --- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c +++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c @@ -125,6 +125,7 @@ static int regulator_quirk_notify(struct notifier_block= *nb, =20 list_for_each_entry_safe(pos, tmp, &quirk_list, list) { list_del(&pos->list); + of_node_put(pos->np); kfree(pos); } =20 @@ -174,11 +175,12 @@ static int __init rcar_gen2_regulator_quirk(void) memcpy(&quirk->i2c_msg, id->data, sizeof(quirk->i2c_msg)); =20 quirk->id =3D id; - quirk->np =3D np; + quirk->np =3D of_node_get(np); quirk->i2c_msg.addr =3D addr; =20 ret =3D of_irq_parse_one(np, 0, argsa); if (ret) { /* Skip invalid entry and continue */ + of_node_put(np); kfree(quirk); continue; } @@ -225,6 +227,7 @@ static int __init rcar_gen2_regulator_quirk(void) err_mem: list_for_each_entry_safe(pos, tmp, &quirk_list, list) { list_del(&pos->list); + of_node_put(pos->np); kfree(pos); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8112C28B2B for ; Mon, 15 Aug 2022 20:32:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347478AbiHOUbN (ORCPT ); Mon, 15 Aug 2022 16:31:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244614AbiHOUWc (ORCPT ); Mon, 15 Aug 2022 16:22:32 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A812033E34; Mon, 15 Aug 2022 12:02:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 83612CE129B; Mon, 15 Aug 2022 19:02:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BE10C43142; Mon, 15 Aug 2022 19:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590164; bh=698Flm7SpQJiRiiikVpbc456D/RJv3Ovb7vU4f/tM+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fnYB8+38G4WwMHUZpims+Asa6uQKyfNvT+zTSWoCY7N0L7Lspp64pxWBLAR0tfsxC cAy7MurHrTv20t6YyTVZY0bq0/EQxSDaeyCa1NNMj+GXi3LeP/vWjARsZApQcMuOF7 /IaNaHnvXy8ABBl9Cx6cEh8XTh2DtbK2srv+soRU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Lv Ruyi , Thierry Reding , Sasha Levin Subject: [PATCH 5.18 0173/1095] firmware: tegra: Fix error check return value of debugfs_create_file() Date: Mon, 15 Aug 2022 19:52:52 +0200 Message-Id: <20220815180436.793193204@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lv Ruyi [ Upstream commit afcdb8e55c91c6ff0700ab272fd0f74e899ab884 ] If an error occurs, debugfs_create_file() will return ERR_PTR(-ERROR), so use IS_ERR() to check it. Reported-by: Zeal Robot Signed-off-by: Lv Ruyi Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/firmware/tegra/bpmp-debugfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/firmware/tegra/bpmp-debugfs.c b/drivers/firmware/tegra= /bpmp-debugfs.c index fd89899aeeed..0c440afd5224 100644 --- a/drivers/firmware/tegra/bpmp-debugfs.c +++ b/drivers/firmware/tegra/bpmp-debugfs.c @@ -474,7 +474,7 @@ static int bpmp_populate_debugfs_inband(struct tegra_bp= mp *bpmp, mode |=3D attrs & DEBUGFS_S_IWUSR ? 0200 : 0; dentry =3D debugfs_create_file(name, mode, parent, bpmp, &bpmp_debug_fops); - if (!dentry) { + if (IS_ERR(dentry)) { err =3D -ENOMEM; goto out; } @@ -725,7 +725,7 @@ static int bpmp_populate_dir(struct tegra_bpmp *bpmp, s= truct seqbuf *seqbuf, =20 if (t & DEBUGFS_S_ISDIR) { dentry =3D debugfs_create_dir(name, parent); - if (!dentry) + if (IS_ERR(dentry)) return -ENOMEM; err =3D bpmp_populate_dir(bpmp, seqbuf, dentry, depth+1); if (err < 0) @@ -738,7 +738,7 @@ static int bpmp_populate_dir(struct tegra_bpmp *bpmp, s= truct seqbuf *seqbuf, dentry =3D debugfs_create_file(name, mode, parent, bpmp, &debugfs_fops); - if (!dentry) + if (IS_ERR(dentry)) return -ENOMEM; } } @@ -788,11 +788,11 @@ int tegra_bpmp_init_debugfs(struct tegra_bpmp *bpmp) return 0; =20 root =3D debugfs_create_dir("bpmp", NULL); - if (!root) + if (IS_ERR(root)) return -ENOMEM; =20 bpmp->debugfs_mirror =3D debugfs_create_dir("debug", root); - if (!bpmp->debugfs_mirror) { + if (IS_ERR(bpmp->debugfs_mirror)) { err =3D -ENOMEM; goto out; } --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 153F9C28B2C for ; Mon, 15 Aug 2022 20:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347582AbiHOUbZ (ORCPT ); Mon, 15 Aug 2022 16:31:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347172AbiHOUXg (ORCPT ); Mon, 15 Aug 2022 16:23:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 247A033A38; Mon, 15 Aug 2022 12:02:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 65A3CB810A2; Mon, 15 Aug 2022 19:02:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80322C433C1; Mon, 15 Aug 2022 19:02:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590167; bh=EU74vkKkp1wsrARBHmW0R9rKUvYeRIF5kWIHuk3CaDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G/quCe+ttvfyGFuQxzr+WP5Lp0XhwjBng6MEQsjUNKw8rfVTtdLap8Q5X40bjSgr+ yP8DY2NsjD9tDKPhxRR+pWmf8slvdVIAGc8tvI5tfUsfOkFl/xOqX/Byhy6EWw4bMU zwxSlX+T3+GHwQa0YObN3bn3pXd9QNBtIUXrInv8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Armin Wolf , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Guenter Roeck , Sasha Levin Subject: [PATCH 5.18 0174/1095] hwmon: (dell-smm) Add Dell XPS 13 7390 to fan control whitelist Date: Mon, 15 Aug 2022 19:52:53 +0200 Message-Id: <20220815180436.833058414@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Armin Wolf [ Upstream commit 385e5f57053ff293282fea84c1c27186d53f66e1 ] A user reported that the program dell-bios-fan-control worked on his Dell XPS 13 7390 to switch off automatic fan control. Since it uses the same mechanism as the dell_smm_hwmon module, add this model to the fan control whitelist. Compile-tested only. Signed-off-by: Armin Wolf Acked-by: Pali Roh=C3=A1r Link: https://lore.kernel.org/r/20220612041806.11367-1-W_Armin@gmx.de Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hwmon/dell-smm-hwmon.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index 84cb1ede7bc0..a0df9a0abeb9 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -1262,6 +1262,14 @@ static const struct dmi_system_id i8k_whitelist_fan_= control[] __initconst =3D { }, .driver_data =3D (void *)&i8k_fan_control_data[I8K_FAN_34A3_35A3], }, + { + .ident =3D "Dell XPS 13 7390", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "XPS 13 7390"), + }, + .driver_data =3D (void *)&i8k_fan_control_data[I8K_FAN_34A3_35A3], + }, { } }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A9A6C2BB41 for ; Mon, 15 Aug 2022 20:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347728AbiHOUbh (ORCPT ); Mon, 15 Aug 2022 16:31:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347299AbiHOUYD (ORCPT ); Mon, 15 Aug 2022 16:24:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B1894BD13; Mon, 15 Aug 2022 12:02:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 17400B81106; Mon, 15 Aug 2022 19:02:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 731C1C433D6; Mon, 15 Aug 2022 19:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590170; bh=oF4xWoSbIFPJ8tM34EAHPqzQikSWy54TF/PD7GuhNQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wvX2H23ZZTxMcm1eUSvDe8uovMMiCRiEazwRJfhCPjV3DXZJEib9LKsPwVnyf3wB/ yU8qYWmQan26AylFEvdw2O16LsiyFCM5z/qwQESJcDOTIJCqglse3P60O7N5P6/1vy TtGxw0TdCoZtjJUIr5IALxae8QZ88qWWgpQ+FQMQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , "Rafael J. Wysocki" , Sasha Levin , Ben Greening Subject: [PATCH 5.18 0175/1095] ACPI: video: Use native backlight on Dell Inspiron N4010 Date: Mon, 15 Aug 2022 19:52:54 +0200 Message-Id: <20220815180436.875092102@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit 03c440a26cba6cfa540d65924e9db86fcea362b2 ] The Dell Inspiron N4010 does not have ACPI backlight control, so acpi_video_get_backlight_type()'s heuristics return vendor as the type to use. But the vendor interface is broken, where as the native (intel_backlight) works well, add a quirk to use native. Link: https://lore.kernel.org/regressions/CALF=3D6jEe5G8+r1Wo0vvz4GjNQQhdkL= T5p8uCHn6ZXhg4nsOWow@mail.gmail.com/ Reported-and-tested-by: Ben Greening Signed-off-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/acpi/video_detect.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 6615f59ab7fd..5d7f38016a24 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -347,6 +347,14 @@ static const struct dmi_system_id video_detect_dmi_tab= le[] =3D { DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro12,1"), }, }, + { + .callback =3D video_detect_force_native, + /* Dell Inspiron N4010 */ + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron N4010"), + }, + }, { .callback =3D video_detect_force_native, /* Dell Vostro V131 */ --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A50CC2BB43 for ; Mon, 15 Aug 2022 20:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347657AbiHOUba (ORCPT ); Mon, 15 Aug 2022 16:31:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347181AbiHOUXg (ORCPT ); Mon, 15 Aug 2022 16:23:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B0684C62C; Mon, 15 Aug 2022 12:02:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 69442612A3; Mon, 15 Aug 2022 19:02:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DBCBC433D6; Mon, 15 Aug 2022 19:02:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590173; bh=4pNbcfBY7sSXixtKDEXaS8TRXL9OvdOoDNaQXO+z7ao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PIkT9X6+lbPJX3aZ7uZspuAcSjl76jlB2Hw9knZuoKBikP0WHj6sahWmZsy4K8EZK R99ERPdX4tmJRwoKZ8u9sQTr775jKHrMfXfP1ocmVN8s7MJOZUvhEXIzzqraCv6XdG ILmzacrCJGpG3nvAETKddt1CsagWPcHqEIcLbYMw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Guenter Roeck , Sasha Levin Subject: [PATCH 5.18 0176/1095] hwmon: (sht15) Fix wrong assumptions in device remove callback Date: Mon, 15 Aug 2022 19:52:55 +0200 Message-Id: <20220815180436.916251708@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 7d4edccc9bbfe1dcdff641343f7b0c6763fbe774 ] Taking a lock at the beginning of .remove() doesn't prevent new readers. With the existing approach it can happen, that a read occurs just when the lock was taken blocking the reader until the lock is released at the end of the remove callback which then accessed *data that is already freed then. To actually fix this problem the hwmon core needs some adaption. Until this is implemented take the optimistic approach of assuming that all readers are gone after hwmon_device_unregister() and sysfs_remove_group() as most other drivers do. (And once the core implements that, taking the lock would deadlock.) So drop the lock, move the reset to after device unregistration to keep the device in a workable state until it's deregistered. Also add a error message in case the reset fails and return 0 anyhow. (Returning an error code, doesn't stop the platform device unregistration and only results in a little helpful error message before the devm cleanup handlers are called.) Signed-off-by: Uwe Kleine-K=C3=B6nig Link: https://lore.kernel.org/r/20220725194344.150098-1-u.kleine-koenig@pen= gutronix.de Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hwmon/sht15.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c index 7f4a63959730..ae4d14257a11 100644 --- a/drivers/hwmon/sht15.c +++ b/drivers/hwmon/sht15.c @@ -1020,25 +1020,20 @@ static int sht15_probe(struct platform_device *pdev) static int sht15_remove(struct platform_device *pdev) { struct sht15_data *data =3D platform_get_drvdata(pdev); + int ret; =20 - /* - * Make sure any reads from the device are done and - * prevent new ones beginning - */ - mutex_lock(&data->read_lock); - if (sht15_soft_reset(data)) { - mutex_unlock(&data->read_lock); - return -EFAULT; - } hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(&pdev->dev.kobj, &sht15_attr_group); + + ret =3D sht15_soft_reset(data); + if (ret) + dev_err(&pdev->dev, "Failed to reset device (%pe)\n", ERR_PTR(ret)); + if (!IS_ERR(data->reg)) { regulator_unregister_notifier(data->reg, &data->nb); regulator_disable(data->reg); } =20 - mutex_unlock(&data->read_lock); - return 0; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FA6AC2BB47 for ; Mon, 15 Aug 2022 20:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347793AbiHOUbl (ORCPT ); Mon, 15 Aug 2022 16:31:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347386AbiHOUYv (ORCPT ); Mon, 15 Aug 2022 16:24:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A9329AFA7; Mon, 15 Aug 2022 12:03:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D6CB6612B3; Mon, 15 Aug 2022 19:02:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C31E7C433C1; Mon, 15 Aug 2022 19:02:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590177; bh=zHXXtMvGg4b4maDB7wqIZ15PbGofr2RdcvBPSMXAyHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H8MtgRRpJYksabGYujPWBWg6Dmg2V84azuzYRbTT4vOXyj8yTiKxbxjjf8Q9D1ZQS l/v+OlzBoeyp7chMqMfTLwywK/FmL4wGVJlbFfvMPDl0HTZhWTMkoEunx4Ke4he2P9 9ZSdNfokWf8hg2V9Riy7kenTvifCkvYC2LzxFtRM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 0177/1095] PM: hibernate: defer device probing when resuming from hibernation Date: Mon, 15 Aug 2022 19:52:56 +0200 Message-Id: <20220815180436.960044770@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tetsuo Handa [ Upstream commit 8386c414e27caba8501119948e9551e52b527f59 ] syzbot is reporting hung task at misc_open() [1], for there is a race window of AB-BA deadlock which involves probe_count variable. Currently wait_for_device_probe() from snapshot_open() from misc_open() can sleep forever with misc_mtx held if probe_count cannot become 0. When a device is probed by hub_event() work function, probe_count is incremented before the probe function starts, and probe_count is decremented after the probe function completed. There are three cases that can prevent probe_count from dropping to 0. (a) A device being probed stopped responding (i.e. broken/malicious hardware). (b) A process emulating a USB device using /dev/raw-gadget interface stopped responding for some reason. (c) New device probe requests keeps coming in before existing device probe requests complete. The phenomenon syzbot is reporting is (b). A process which is holding system_transition_mutex and misc_mtx is waiting for probe_count to become 0 inside wait_for_device_probe(), but the probe function which is called from hub_event() work function is waiting for the processes which are blocked at mutex_lock(&misc_mtx) to respond via /dev/raw-gadget interface. This patch mitigates (b) by deferring wait_for_device_probe() from snapshot_open() to snapshot_write() and snapshot_ioctl(). Please note that the possibility of (b) remains as long as any thread which is emulating a USB device via /dev/raw-gadget interface can be blocked by uninterruptible blocking operations (e.g. mutex_lock()). Please also note that (a) and (c) are not addressed. Regarding (c), we should change the code to wait for only one device which contains the image for resuming from hibernation. I don't know how to address (a), for use of timeout for wait_for_device_probe() might result in loss of user data in the image. Maybe we should require the userland to wait for the image device before opening /dev/snapshot interface. Link: https://syzkaller.appspot.com/bug?extid=3D358c9ab4c93da7b7238c [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Tested-by: syzbot Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/power/user.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kernel/power/user.c b/kernel/power/user.c index ad241b4ff64c..d43c2aa583b2 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c @@ -26,6 +26,7 @@ =20 #include "power.h" =20 +static bool need_wait; =20 static struct snapshot_data { struct snapshot_handle handle; @@ -78,7 +79,7 @@ static int snapshot_open(struct inode *inode, struct file= *filp) * Resuming. We may need to wait for the image device to * appear. */ - wait_for_device_probe(); + need_wait =3D true; =20 data->swap =3D -1; data->mode =3D O_WRONLY; @@ -168,6 +169,11 @@ static ssize_t snapshot_write(struct file *filp, const= char __user *buf, ssize_t res; loff_t pg_offp =3D *offp & ~PAGE_MASK; =20 + if (need_wait) { + wait_for_device_probe(); + need_wait =3D false; + } + lock_system_sleep(); =20 data =3D filp->private_data; @@ -244,6 +250,11 @@ static long snapshot_ioctl(struct file *filp, unsigned= int cmd, loff_t size; sector_t offset; =20 + if (need_wait) { + wait_for_device_probe(); + need_wait =3D false; + } + if (_IOC_TYPE(cmd) !=3D SNAPSHOT_IOC_MAGIC) return -ENOTTY; if (_IOC_NR(cmd) > SNAPSHOT_IOC_MAXNR) --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F69DC2BB45 for ; Mon, 15 Aug 2022 20:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347852AbiHOUbo (ORCPT ); Mon, 15 Aug 2022 16:31:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347346AbiHOUZH (ORCPT ); Mon, 15 Aug 2022 16:25:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 488AF9AFE3; Mon, 15 Aug 2022 12:03:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 20FD861281; Mon, 15 Aug 2022 19:03:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21E8FC433C1; Mon, 15 Aug 2022 19:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590180; bh=FlO2+rc4HsuR7lvaoZ66kubdG1FhTpV3XY3NhuCS+jk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bOF/BLmJ+js4eyKcO+h5vqvSV3K6g7PgMm71rRKG5WfEEDUCiufKCMR6CBJEVU4QJ PABaR7JzY4juvcZLxVXvdZd6cCmvccdRtow/JtWOJA7/KloAXxpQu7VypvyV5Nw0Do cjirQJZqLybdi4KQ70LyLfAPkcMhpUK4OCc7vvB8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiu Jianfeng , Paul Moore , Sasha Levin Subject: [PATCH 5.18 0178/1095] selinux: fix memleak in security_read_state_kernel() Date: Mon, 15 Aug 2022 19:52:57 +0200 Message-Id: <20220815180437.001001168@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiu Jianfeng [ Upstream commit 73de1befcc53a7c68b0c5e76b9b5ac41c517760f ] In this function, it directly returns the result of __security_read_policy without freeing the allocated memory in *data, cause memory leak issue, so free the memory if __security_read_policy failed. Signed-off-by: Xiu Jianfeng [PM: subject line tweak] Signed-off-by: Paul Moore Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- security/selinux/ss/services.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 6901dc07680d..cad54f454d01 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -4049,6 +4049,7 @@ int security_read_policy(struct selinux_state *state, int security_read_state_kernel(struct selinux_state *state, void **data, size_t *len) { + int err; struct selinux_policy *policy; =20 policy =3D rcu_dereference_protected( @@ -4061,5 +4062,11 @@ int security_read_state_kernel(struct selinux_state = *state, if (!*data) return -ENOMEM; =20 - return __security_read_policy(policy, *data, len); + err =3D __security_read_policy(policy, *data, len); + if (err) { + vfree(*data); + *data =3D NULL; + *len =3D 0; + } + return err; } --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2328C25B08 for ; Mon, 15 Aug 2022 20:32:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348030AbiHOUb6 (ORCPT ); Mon, 15 Aug 2022 16:31:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347525AbiHOUZz (ORCPT ); Mon, 15 Aug 2022 16:25:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36C6D9C225; Mon, 15 Aug 2022 12:03:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ACFE3B8107A; Mon, 15 Aug 2022 19:03:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05940C433C1; Mon, 15 Aug 2022 19:03:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590183; bh=VJCmYCac8+0GtJU2jX1P9L9/IdytulRpy/aYEWsiEso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xB+4q/Pd+DDRqUjc94LIz9JwVT8mNi3NQUrAXZ2mYotMUEkRC4KX6HSRm+ZVii3II Xvz72sGB2k37E4C1td7+0z5diWc2ZaUVRYGDX8rxapAy2wlZkNCSzXv3/wzKPbj77b /AtaRAOqm21RAn2PQwwOYPGgl/IvtdFptnGGSDoY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiu Jianfeng , Paul Moore , Sasha Levin Subject: [PATCH 5.18 0179/1095] selinux: Add boundary check in put_entry() Date: Mon, 15 Aug 2022 19:52:58 +0200 Message-Id: <20220815180437.044913329@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiu Jianfeng [ Upstream commit 15ec76fb29be31df2bccb30fc09875274cba2776 ] Just like next_entry(), boundary check is necessary to prevent memory out-of-bound access. Signed-off-by: Xiu Jianfeng Signed-off-by: Paul Moore Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- security/selinux/ss/policydb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/security/selinux/ss/policydb.h b/security/selinux/ss/policydb.h index c24d4e1063ea..ffc4e7bad205 100644 --- a/security/selinux/ss/policydb.h +++ b/security/selinux/ss/policydb.h @@ -370,6 +370,8 @@ static inline int put_entry(const void *buf, size_t byt= es, int num, struct polic { size_t len =3D bytes * num; =20 + if (len > fp->len) + return -EINVAL; memcpy(fp->data, buf, len); fp->data +=3D len; fp->len -=3D len; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1166AC28B2B for ; Mon, 15 Aug 2022 20:33:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344594AbiHOUc6 (ORCPT ); Mon, 15 Aug 2022 16:32:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347526AbiHOUZz (ORCPT ); Mon, 15 Aug 2022 16:25:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36FDD9C51A; Mon, 15 Aug 2022 12:03:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9D775B81107; Mon, 15 Aug 2022 19:03:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB140C433C1; Mon, 15 Aug 2022 19:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590186; bh=9JSTDmXy453rHTFb12rtKlZSkrD3HQt1RpXe4eSj4RY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nnJPVBeZJ6xFKtUGeAGIgu2k1lK/i4utPti+u5sE0Qgjhoyu/MrqHvLPSSn+6ubjb Wziy1iE+PpOcBk/k+9ngmCNMUYN/ggKf/niWfd2jDmQ2EHLznuF8C2RsABLK83eCBF BvLeAXYXGhU28b9/kP7tj8ZJ1gza0GpyskqPKlEg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , kasan-dev@googlegroups.com, Kees Cook , Sasha Levin Subject: [PATCH 5.18 0180/1095] kasan: test: Silence GCC 12 warnings Date: Mon, 15 Aug 2022 19:52:59 +0200 Message-Id: <20220815180437.088934858@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kees Cook [ Upstream commit aaf50b1969d7933a51ea421b11432a7fb90974e3 ] GCC 12 continues to get smarter about array accesses. The KASAN tests are expecting to explicitly test out-of-bounds conditions at run-time, so hide the variable from GCC, to avoid warnings like: ../lib/test_kasan.c: In function 'ksize_uaf': ../lib/test_kasan.c:790:61: warning: array subscript 120 is outside array b= ounds of 'void[120]' [-Warray-bounds] 790 | KUNIT_EXPECT_KASAN_FAIL(test, ((volatile char *)ptr)[size]); | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~ ../lib/test_kasan.c:97:9: note: in definition of macro 'KUNIT_EXPECT_KASAN_= FAIL' 97 | expression; \ | ^~~~~~~~~~ Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Dmitry Vyukov Cc: Vincenzo Frascino Cc: kasan-dev@googlegroups.com Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220608214024.1068451-1-keescook@chromium.= org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- lib/test_kasan.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index ad880231dfa8..630e0c31d7c2 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -131,6 +131,7 @@ static void kmalloc_oob_right(struct kunit *test) ptr =3D kmalloc(size, GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); /* * An unaligned access past the requested kmalloc size. * Only generic KASAN can precisely detect these. @@ -159,6 +160,7 @@ static void kmalloc_oob_left(struct kunit *test) ptr =3D kmalloc(size, GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); KUNIT_EXPECT_KASAN_FAIL(test, *ptr =3D *(ptr - 1)); kfree(ptr); } @@ -171,6 +173,7 @@ static void kmalloc_node_oob_right(struct kunit *test) ptr =3D kmalloc_node(size, GFP_KERNEL, 0); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); KUNIT_EXPECT_KASAN_FAIL(test, ptr[0] =3D ptr[size]); kfree(ptr); } @@ -191,6 +194,7 @@ static void kmalloc_pagealloc_oob_right(struct kunit *t= est) ptr =3D kmalloc(size, GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); KUNIT_EXPECT_KASAN_FAIL(test, ptr[size + OOB_TAG_OFF] =3D 0); =20 kfree(ptr); @@ -271,6 +275,7 @@ static void kmalloc_large_oob_right(struct kunit *test) ptr =3D kmalloc(size, GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); KUNIT_EXPECT_KASAN_FAIL(test, ptr[size] =3D 0); kfree(ptr); } @@ -410,6 +415,8 @@ static void kmalloc_oob_16(struct kunit *test) ptr2 =3D kmalloc(sizeof(*ptr2), GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2); =20 + OPTIMIZER_HIDE_VAR(ptr1); + OPTIMIZER_HIDE_VAR(ptr2); KUNIT_EXPECT_KASAN_FAIL(test, *ptr1 =3D *ptr2); kfree(ptr1); kfree(ptr2); @@ -756,6 +763,8 @@ static void ksize_unpoisons_memory(struct kunit *test) KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); real_size =3D ksize(ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); + /* This access shouldn't trigger a KASAN report. */ ptr[size] =3D 'x'; =20 @@ -778,6 +787,7 @@ static void ksize_uaf(struct kunit *test) KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); kfree(ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); KUNIT_EXPECT_KASAN_FAIL(test, ksize(ptr)); KUNIT_EXPECT_KASAN_FAIL(test, ((volatile char *)ptr)[0]); KUNIT_EXPECT_KASAN_FAIL(test, ((volatile char *)ptr)[size]); --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B5B0C2BB9D for ; Mon, 15 Aug 2022 20:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348009AbiHOUb4 (ORCPT ); Mon, 15 Aug 2022 16:31:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347520AbiHOUZz (ORCPT ); Mon, 15 Aug 2022 16:25:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB5369C8E9; Mon, 15 Aug 2022 12:03:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B526DB81109; Mon, 15 Aug 2022 19:03:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08EF9C433C1; Mon, 15 Aug 2022 19:03:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590189; bh=3ujAZeKEOLhx37OJc1LDzbpYlVYHE67f9O0jS+7wG8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ft5y9Pttgxu8NtJFZvnFtwfNYaHAHCHjzYd8q8/j2nTVfICEpEWVWBZrr3RJBdhGu 9ZZ5qqPZoApClQ7D9SPzrR57VB+JaWb6XrmVSC5QgucATOUiizrO+JouQPlc9Io56N 8SUWR7PTQdsEAnT9CYzHA4but6PZmtxePL2N3cvU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, madcatx@atlas.cz, jwrdegoede@fedoraproject.org, Mario Limonciello , Hans de Goede , Linus Walleij , Sasha Levin Subject: [PATCH 5.18 0181/1095] pinctrl: Dont allow PINCTRL_AMD to be a module Date: Mon, 15 Aug 2022 19:53:00 +0200 Message-Id: <20220815180437.131239314@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mario Limonciello [ Upstream commit 41ef3c1a6bb0fd4a3f81170dd17de3adbff80783 ] It was observed that by allowing pinctrl_amd to be loaded later in the boot process that interrupts sent to the GPIO controller early in the boot are not serviced. The kernel treats these as a spurious IRQ and disables the IRQ. This problem was exacerbated because it happened on a system with an encrypted partition so the kernel object was not accesssible for an extended period of time while waiting for a passphrase. To avoid this situation from occurring, stop allowing pinctrl-amd from being built as a module and instead require it to be built-in or disabled. Reported-by: madcatx@atlas.cz Suggested-by: jwrdegoede@fedoraproject.org Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216230 Signed-off-by: Mario Limonciello Acked-by: Hans de Goede Link: https://lore.kernel.org/r/20220713175950.964-1-mario.limonciello@amd.= com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pinctrl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index f52960d2dfbe..bff144c97e66 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig @@ -32,7 +32,7 @@ config DEBUG_PINCTRL Say Y here to add some extra checks and diagnostics to PINCTRL calls. =20 config PINCTRL_AMD - tristate "AMD GPIO pin control" + bool "AMD GPIO pin control" depends on HAS_IOMEM depends on ACPI || COMPILE_TEST select GPIOLIB --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 480A9C282E7 for ; Mon, 15 Aug 2022 20:33:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344852AbiHOUdE (ORCPT ); Mon, 15 Aug 2022 16:33:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347633AbiHOU0U (ORCPT ); Mon, 15 Aug 2022 16:26:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FFE39D11F; Mon, 15 Aug 2022 12:03:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2878D612A3; Mon, 15 Aug 2022 19:03:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16858C433D6; Mon, 15 Aug 2022 19:03:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590195; bh=G6z55BCnM9EFXJvqKHhQOx84UM7dS+cHpqatbRvC6C8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xg4c0M8HG8vVlDokI0CPtx/xDIZgVCP6fvMP64lRybwZpkckM0cMQ1LCOyeDGxNPP UFx6+xPGFZUijXGJE4g3n84B7D2En9p2JoXLE7gAlOWvLb8ks4teVDlfmsLV9L62zc aYwhvRDecBh60FqmdiUo2zc4JCRivYXoBLaUqqHM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, xinhui pan , =?UTF-8?q?Christian=20K=C3=B6nig?= , Felix Kuehling , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 0182/1095] drm/amdgpu: Remove one duplicated ef removal Date: Mon, 15 Aug 2022 19:53:01 +0200 Message-Id: <20220815180437.170658697@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: xinhui pan [ Upstream commit e1aadbab445b06e072013a1365fd0cf2aa25e843 ] That has been done in BO release notify. Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2074 Signed-off-by: xinhui pan Acked-by: Christian K=C3=B6nig Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu= /drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index f4509656ea8c..e9a8eb070766 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -1401,16 +1401,10 @@ void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_d= evice *adev, struct amdgpu_vm *vm) { struct amdkfd_process_info *process_info =3D vm->process_info; - struct amdgpu_bo *pd =3D vm->root.bo; =20 if (!process_info) return; =20 - /* Release eviction fence from PD */ - amdgpu_bo_reserve(pd, false); - amdgpu_bo_fence(pd, NULL, false); - amdgpu_bo_unreserve(pd); - /* Update process info */ mutex_lock(&process_info->lock); process_info->n_vms--; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDE86C3F6B0 for ; Mon, 15 Aug 2022 20:32:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347895AbiHOUbt (ORCPT ); Mon, 15 Aug 2022 16:31:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347497AbiHOUZx (ORCPT ); Mon, 15 Aug 2022 16:25:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CBDA9C2FA; Mon, 15 Aug 2022 12:03:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1D76061299; Mon, 15 Aug 2022 19:03:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26387C433D6; Mon, 15 Aug 2022 19:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590198; bh=8TuZYBANaANy8tBI2NDEhOSwYzvW/85ai8F71UZsmK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WRk/3aWfd19oT+8svzQTErB7sNeTlSmbjYbgcI/zylUmooPpxp7p5+U9U8e0FLP6t ktFVN6OO/WP/wQtQq+TRFzYc6LNkRw5UNVCfr67dGgvd7uubCJvatIDjoX8PrRAXho /RU1oMgPk5S8NNb0mTFNDhIhNG4nirfTlE5kBW10= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sudip Mukherjee , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0183/1095] powerpc/64s: Disable stack variable initialisation for prom_init Date: Mon, 15 Aug 2022 19:53:02 +0200 Message-Id: <20220815180437.214375030@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Ellerman [ Upstream commit be640317a1d0b9cf42fedb2debc2887a7cfa38de ] With GCC 12 allmodconfig prom_init fails to build: Error: External symbol 'memset' referenced from prom_init.c make[2]: *** [arch/powerpc/kernel/Makefile:204: arch/powerpc/kernel/prom_= init_check] Error 1 The allmodconfig build enables KASAN, so all calls to memset in prom_init should be converted to __memset by the #ifdefs in asm/string.h, because prom_init must use the non-KASAN instrumented versions. The build failure happens because there's a call to memset that hasn't been caught by the pre-processor and converted to __memset. Typically that's because it's a memset generated by the compiler itself, and that is the case here. With GCC 12, allmodconfig enables CONFIG_INIT_STACK_ALL_PATTERN, which causes the compiler to emit memset calls to initialise on-stack variables with a pattern. Because prom_init is non-user-facing boot-time only code, as a workaround just disable stack variable initialisation to unbreak the build. Reported-by: Sudip Mukherjee Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220718134418.354114-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/kernel/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 4ddd161aef32..63c384c3e6d4 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -20,6 +20,7 @@ CFLAGS_prom.o +=3D $(DISABLE_LATENT_ENTROPY_PLUGIN) CFLAGS_prom_init.o +=3D -fno-stack-protector CFLAGS_prom_init.o +=3D -DDISABLE_BRANCH_PROFILING CFLAGS_prom_init.o +=3D -ffreestanding +CFLAGS_prom_init.o +=3D $(call cc-option, -ftrivial-auto-var-init=3Duninit= ialized) =20 ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7A2AC32757 for ; Mon, 15 Aug 2022 20:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348123AbiHOUcI (ORCPT ); Mon, 15 Aug 2022 16:32:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347747AbiHOU0f (ORCPT ); Mon, 15 Aug 2022 16:26:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8BF79DB5E; Mon, 15 Aug 2022 12:03:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AED52B810A2; Mon, 15 Aug 2022 19:03:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 170B0C433C1; Mon, 15 Aug 2022 19:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590201; bh=DnYtPbjqI8A7s1DpXgqq9UjiYSjr7NuAbLDSButeqbE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kHbDQoQc7G5tqvgHzKul6LLRAxCgTUXnVTPU8Gs0/uhQvQaD9RnwvDaMEDkpj+1hd emTsUQIQGjXkHZQGFtuE7RHWhzMnbEy5hWxyw6IyIvKvU+6rrvtIuTe1G/fjG4ucDr JKWlKNdyju75seYCADb9Mn3ADQs9vrRbojd6INfk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biju Das , Geert Uytterhoeven , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0184/1095] spi: spi-rspi: Fix PIO fallback on RZ platforms Date: Mon, 15 Aug 2022 19:53:03 +0200 Message-Id: <20220815180437.252014191@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Biju Das [ Upstream commit b620aa3a7be346f04ae7789b165937615c6ee8d3 ] RSPI IP on RZ/{A, G2L} SoC's has the same signal for both interrupt and DMA transfer request. Setting DMARS register for DMA transfer makes the signal to work as a DMA transfer request signal and subsequent interrupt requests to the interrupt controller are masked. PIO fallback does not work as interrupt signal is disabled. This patch fixes this issue by re-enabling the interrupts by calling dmaengine_synchronize(). Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20220721143449.879257-1-biju.das.jz@bp.rene= sas.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/spi/spi-rspi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 7a014eeec2d0..411b1307b7fd 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c @@ -613,6 +613,10 @@ static int rspi_dma_transfer(struct rspi_data *rspi, s= truct sg_table *tx, rspi->dma_callbacked, HZ); if (ret > 0 && rspi->dma_callbacked) { ret =3D 0; + if (tx) + dmaengine_synchronize(rspi->ctlr->dma_tx); + if (rx) + dmaengine_synchronize(rspi->ctlr->dma_rx); } else { if (!ret) { dev_err(&rspi->ctlr->dev, "DMA timeout\n"); --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0BB8C32762 for ; Mon, 15 Aug 2022 20:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348093AbiHOUcE (ORCPT ); Mon, 15 Aug 2022 16:32:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347612AbiHOU0O (ORCPT ); Mon, 15 Aug 2022 16:26:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E059C4D4D1; Mon, 15 Aug 2022 12:03:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8683EB81062; Mon, 15 Aug 2022 19:03:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0E32C433C1; Mon, 15 Aug 2022 19:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590204; bh=KKtD5woFp4mx26d04LR6BTuiJ3NABKRQBnDLRu+qUrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z4aa3w5HdUCxnUsekevECizDERInYmaA4V83RnWlMnUgd35dIvp4U/O8KIFnYS22o uWnkCUDOM2tDFruNek8CCMlmWz+QHBiqrmJkml4yg4uTi0QxpANCP3BqLTLImVyioT Lm1avYeimIXCpps5a0YfcPl+BFjI0VpgDKHBSl1E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.18 0185/1095] netfilter: nf_tables: add rescheduling points during loop detection walks Date: Mon, 15 Aug 2022 19:53:04 +0200 Message-Id: <20220815180437.286523400@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit 81ea010667417ef3f218dfd99b69769fe66c2b67 ] Add explicit rescheduling points during ruleset walk. Switching to a faster algorithm is possible but this is a much smaller change, suitable for nf tree. Link: https://bugzilla.netfilter.org/show_bug.cgi?id=3D1460 Signed-off-by: Florian Westphal Acked-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 2b60923cf87b..7eac496961a7 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3343,6 +3343,8 @@ int nft_chain_validate(const struct nft_ctx *ctx, con= st struct nft_chain *chain) if (err < 0) return err; } + + cond_resched(); } =20 return 0; @@ -9371,9 +9373,13 @@ static int nf_tables_check_loops(const struct nft_ct= x *ctx, break; } } + + cond_resched(); } =20 list_for_each_entry(set, &ctx->table->sets, list) { + cond_resched(); + if (!nft_is_active_next(ctx->net, set)) continue; if (!(set->flags & NFT_SET_MAP) || --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 580C3C282E7 for ; Mon, 15 Aug 2022 20:32:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348254AbiHOUcW (ORCPT ); Mon, 15 Aug 2022 16:32:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347738AbiHOU0d (ORCPT ); Mon, 15 Aug 2022 16:26:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28F219DFA8; Mon, 15 Aug 2022 12:03:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E41F761299; Mon, 15 Aug 2022 19:03:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2C00C433D7; Mon, 15 Aug 2022 19:03:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590207; bh=pMLp0+qYNKEIUa9AGUAmCf0y2RNO1+e4eW/XAxC26Kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JbL9p6j4Cn0XwGsSWa21uXcOIMhAPMn0nMfW35ay8rAo8fpUYPCjYpaR+TIrBU6sE gl6RCpvWKQB6G1Vi0EMKW7Jxc/OFXQiDhDpVNjHHuZpzvym4fsf8wLxE1pBmK4iDaU asKUB/ZJLxLVo/tyVGgHw+7gbYf8XuLOgKwhMQwo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.18 0186/1095] netfilter: nft_queue: only allow supported familes and hooks Date: Mon, 15 Aug 2022 19:53:05 +0200 Message-Id: <20220815180437.333474752@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit 47f4f510ad586032b85c89a0773fbb011d412425 ] Trying to use 'queue' statement in ingress (for example) triggers a splat on reinject: WARNING: CPU: 3 PID: 1345 at net/netfilter/nf_queue.c:291 ... because nf_reinject cannot find the ruleset head. The netdev family doesn't support async resume at the moment anyway, so disallow loading such rulesets with a more appropriate error message. v2: add 'validate' callback and also check hook points, v1 did allow ingress use in 'table inet', but that doesn't work either. (Pablo) Signed-off-by: Florian Westphal Reviewed-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/netfilter/nft_queue.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/net/netfilter/nft_queue.c b/net/netfilter/nft_queue.c index 15e4b7640dc0..da29e92c03e2 100644 --- a/net/netfilter/nft_queue.c +++ b/net/netfilter/nft_queue.c @@ -68,6 +68,31 @@ static void nft_queue_sreg_eval(const struct nft_expr *e= xpr, regs->verdict.code =3D ret; } =20 +static int nft_queue_validate(const struct nft_ctx *ctx, + const struct nft_expr *expr, + const struct nft_data **data) +{ + static const unsigned int supported_hooks =3D ((1 << NF_INET_PRE_ROUTING)= | + (1 << NF_INET_LOCAL_IN) | + (1 << NF_INET_FORWARD) | + (1 << NF_INET_LOCAL_OUT) | + (1 << NF_INET_POST_ROUTING)); + + switch (ctx->family) { + case NFPROTO_IPV4: + case NFPROTO_IPV6: + case NFPROTO_INET: + case NFPROTO_BRIDGE: + break; + case NFPROTO_NETDEV: /* lacks okfn */ + fallthrough; + default: + return -EOPNOTSUPP; + } + + return nft_chain_validate_hooks(ctx->chain, supported_hooks); +} + static const struct nla_policy nft_queue_policy[NFTA_QUEUE_MAX + 1] =3D { [NFTA_QUEUE_NUM] =3D { .type =3D NLA_U16 }, [NFTA_QUEUE_TOTAL] =3D { .type =3D NLA_U16 }, @@ -164,6 +189,7 @@ static const struct nft_expr_ops nft_queue_ops =3D { .eval =3D nft_queue_eval, .init =3D nft_queue_init, .dump =3D nft_queue_dump, + .validate =3D nft_queue_validate, .reduce =3D NFT_REDUCE_READONLY, }; =20 @@ -173,6 +199,7 @@ static const struct nft_expr_ops nft_queue_sreg_ops =3D= { .eval =3D nft_queue_sreg_eval, .init =3D nft_queue_sreg_init, .dump =3D nft_queue_sreg_dump, + .validate =3D nft_queue_validate, .reduce =3D NFT_REDUCE_READONLY, }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DC5AC00140 for ; Mon, 15 Aug 2022 20:32:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348188AbiHOUcO (ORCPT ); Mon, 15 Aug 2022 16:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347773AbiHOU0g (ORCPT ); Mon, 15 Aug 2022 16:26:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 283269D8EA; Mon, 15 Aug 2022 12:03:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8B8A6B81104; Mon, 15 Aug 2022 19:03:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC9ADC433D6; Mon, 15 Aug 2022 19:03:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590210; bh=lC1PDtOD4kVcf3eDjo4yBR1rOPmdYM1OQZgn1WPyCNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PAKiQ437WzYGRrC5iEu9m5/We21gWPEaPUefQO177Sv2RTqfpqnAIBMhPEzmc9BEH QB4AGbHIG3knNgH/yBN7t9g8XfV3MyW0WPTST7XdHW/sUEi9f7QNUQ23NhoJ/fVZaA vOBxCInRmwbcbHL8D8/7HqGdW8UpXSocfE0N5spo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.18 0187/1095] ARM: findbit: fix overflowing offset Date: Mon, 15 Aug 2022 19:53:06 +0200 Message-Id: <20220815180437.378375053@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Russell King (Oracle) [ Upstream commit ec85bd369fd2bfaed6f45dd678706429d4f75b48 ] When offset is larger than the size of the bit array, we should not attempt to access the array as we can perform an access beyond the end of the array. Fix this by changing the pre-condition. Using "cmp r2, r1; bhs ..." covers us for the size =3D=3D 0 case, since this will always take the branch when r1 is zero, irrespective of the value of r2. This means we can fix this bug without adding any additional code! Tested-by: Guenter Roeck Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/lib/findbit.S | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index b5e8b9ae4c7d..7fd3600db8ef 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S @@ -40,8 +40,8 @@ ENDPROC(_find_first_zero_bit_le) * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int = offset) */ ENTRY(_find_next_zero_bit_le) - teq r1, #0 - beq 3b + cmp r2, r1 + bhs 3b ands ip, r2, #7 beq 1b @ If new byte, goto old routine ARM( ldrb r3, [r0, r2, lsr #3] ) @@ -81,8 +81,8 @@ ENDPROC(_find_first_bit_le) * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int = offset) */ ENTRY(_find_next_bit_le) - teq r1, #0 - beq 3b + cmp r2, r1 + bhs 3b ands ip, r2, #7 beq 1b @ If new byte, goto old routine ARM( ldrb r3, [r0, r2, lsr #3] ) @@ -115,8 +115,8 @@ ENTRY(_find_first_zero_bit_be) ENDPROC(_find_first_zero_bit_be) =20 ENTRY(_find_next_zero_bit_be) - teq r1, #0 - beq 3b + cmp r2, r1 + bhs 3b ands ip, r2, #7 beq 1b @ If new byte, goto old routine eor r3, r2, #0x18 @ big endian byte ordering @@ -149,8 +149,8 @@ ENTRY(_find_first_bit_be) ENDPROC(_find_first_bit_be) =20 ENTRY(_find_next_bit_be) - teq r1, #0 - beq 3b + cmp r2, r1 + bhs 3b ands ip, r2, #7 beq 1b @ If new byte, goto old routine eor r3, r2, #0x18 @ big endian byte ordering --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CEEDC25B08 for ; Mon, 15 Aug 2022 20:32:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348226AbiHOUcS (ORCPT ); Mon, 15 Aug 2022 16:32:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347763AbiHOU0f (ORCPT ); Mon, 15 Aug 2022 16:26:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C2079DB76; Mon, 15 Aug 2022 12:03:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E322FB81106; Mon, 15 Aug 2022 19:03:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBAEDC433D7; Mon, 15 Aug 2022 19:03:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590213; bh=YhgF2yt0u3VyqWuFgGE9+OCvXB5d0Chiy9PsctpcyxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bgZZRe9/m4bqmTRIwVi7p+nDO25+fr1qmKo8koR7GntlJxTWFtvyCXUKXIYPYlTj3 Q9hjHVl/ZyjnGSo18titpht8iFcIuzCuEkaEOduWjV20XoSUEPACu1IBaNiRRp3RfI aqg7LZcgJM/tzHGZzLQeOScMTsPD8GxFzbgShgRY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.18 0188/1095] meson-mx-socinfo: Fix refcount leak in meson_mx_socinfo_init Date: Mon, 15 Aug 2022 19:53:07 +0200 Message-Id: <20220815180437.418910785@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit a2106f38077e78afcb4bf98fdda3e162118cfb3d ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 5e68c0fc8df8 ("soc: amlogic: Add Meson6/Meson8/Meson8b/Meson8m2 SoC = Information driver") Signed-off-by: Miaoqian Lin Reviewed-by: Martin Blumenstingl Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20220524065729.33689-1-linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/soc/amlogic/meson-mx-socinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/amlogic/meson-mx-socinfo.c b/drivers/soc/amlogic/m= eson-mx-socinfo.c index 78f0f1aeca57..92125dd65f33 100644 --- a/drivers/soc/amlogic/meson-mx-socinfo.c +++ b/drivers/soc/amlogic/meson-mx-socinfo.c @@ -126,6 +126,7 @@ static int __init meson_mx_socinfo_init(void) np =3D of_find_matching_node(NULL, meson_mx_socinfo_analog_top_ids); if (np) { analog_top_regmap =3D syscon_node_to_regmap(np); + of_node_put(np); if (IS_ERR(analog_top_regmap)) return PTR_ERR(analog_top_regmap); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76847C282E7 for ; Mon, 15 Aug 2022 20:33:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244383AbiHOUcq (ORCPT ); Mon, 15 Aug 2022 16:32:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347881AbiHOU0q (ORCPT ); Mon, 15 Aug 2022 16:26:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2D9D9E2C0; Mon, 15 Aug 2022 12:03:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0484C612AB; Mon, 15 Aug 2022 19:03:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D56FC433C1; Mon, 15 Aug 2022 19:03:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590216; bh=XZ1fEXbihwMvZmm867y5/Z2A0UapQQWEVOY0NEtU6jA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z/E6z0CWyTesZ4bFOer7BlB2VJ3CqhL9KJMdc/c/J0QCTXxqAA1U5U06X8AELDfWn SM8SDaaYwiZ87lONNtUoBP0gBmCx1RcX4sLQY3H/iB4A9OGvAgEca/cVaDKwzXco+s qe6TfZ59DQMpnoQV19f+tHGWjTEYaALVY4QDcNjc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.18 0189/1095] arm64: dts: renesas: beacon: Fix regulator node names Date: Mon, 15 Aug 2022 19:53:08 +0200 Message-Id: <20220815180437.453022770@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Geert Uytterhoeven [ Upstream commit 7512af9f78dedea7e04225f665dad6750df7d095 ] Currently there are two nodes named "regulator_camera". This causes the former to be overwritten by the latter. Fix this by renaming them to unique names, using the preferred hyphen instead of an underscore. While at it, update the name of the audio regulator (which was added in the same commit) to use a hyphen. Fixes: a1d8a344f1ca0709 ("arm64: dts: renesas: Introduce r8a774a1-beacon-rz= g2m-kit") Signed-off-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/a9ac82bdf108162487289d091c53a9b3de393f13.16= 52263918.git.geert+renesas@glider.be Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi b/ar= ch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi index 5ad6cd1864c1..c289d2bb5122 100644 --- a/arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi +++ b/arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi @@ -146,7 +146,7 @@ rgb_panel: endpoint { }; }; =20 - reg_audio: regulator_audio { + reg_audio: regulator-audio { compatible =3D "regulator-fixed"; regulator-name =3D "audio-1.8V"; regulator-min-microvolt =3D <1800000>; @@ -174,7 +174,7 @@ reg_lcd_reset: regulator-lcd-reset { vin-supply =3D <®_lcd>; }; =20 - reg_cam0: regulator_camera { + reg_cam0: regulator-cam0 { compatible =3D "regulator-fixed"; regulator-name =3D "reg_cam0"; regulator-min-microvolt =3D <1800000>; @@ -183,7 +183,7 @@ reg_cam0: regulator_camera { enable-active-high; }; =20 - reg_cam1: regulator_camera { + reg_cam1: regulator-cam1 { compatible =3D "regulator-fixed"; regulator-name =3D "reg_cam1"; regulator-min-microvolt =3D <1800000>; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D72EC282E7 for ; Mon, 15 Aug 2022 20:32:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348153AbiHOUcL (ORCPT ); Mon, 15 Aug 2022 16:32:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347754AbiHOU0f (ORCPT ); Mon, 15 Aug 2022 16:26:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2C329DFB4; Mon, 15 Aug 2022 12:03:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 01704612A5; Mon, 15 Aug 2022 19:03:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF945C433C1; Mon, 15 Aug 2022 19:03:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590219; bh=trG8oyJvYdJGnFL4oAnns9pnq+hwSnbarSZgSlzOSAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A1XOta/xmxjPe8h6fNm88wGdhbzhjyoF/aWql8YfX/lBIJgUx90XHerl2Ekaa1xmU zXA5X0Gk4VG1WJv17fiI3Sec2spxxscmSK+TzwjKM+UF5fZAadmQxi4QQd+JmNKWQU beqvr99cTetQe2lyPzx2K7WR6E1AJj6acuchBMsM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0190/1095] spi: spi-altera-dfl: Fix an error handling path Date: Mon, 15 Aug 2022 19:53:09 +0200 Message-Id: <20220815180437.492814629@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 8e3ca32f46994e74b7f43c57731150b2aedb2630 ] The spi_alloc_master() call is not undone in all error handling paths. Moreover, there is no .remove function to release the allocated memory. In order to fix both this issues, switch to devm_spi_alloc_master(). This allows further simplification of the probe. Fixes: ba2fc167e944 ("spi: altera: Add DFL bus driver for Altera API Contro= ller") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/0607bb59f4073f86abe5c585d35245aef0b045c6.16= 53805901.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/spi/spi-altera-dfl.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/spi/spi-altera-dfl.c b/drivers/spi/spi-altera-dfl.c index ca40923258af..596e181ae136 100644 --- a/drivers/spi/spi-altera-dfl.c +++ b/drivers/spi/spi-altera-dfl.c @@ -128,9 +128,9 @@ static int dfl_spi_altera_probe(struct dfl_device *dfl_= dev) struct spi_master *master; struct altera_spi *hw; void __iomem *base; - int err =3D -ENODEV; + int err; =20 - master =3D spi_alloc_master(dev, sizeof(struct altera_spi)); + master =3D devm_spi_alloc_master(dev, sizeof(struct altera_spi)); if (!master) return -ENOMEM; =20 @@ -159,10 +159,9 @@ static int dfl_spi_altera_probe(struct dfl_device *dfl= _dev) altera_spi_init_master(master); =20 err =3D devm_spi_register_master(dev, master); - if (err) { - dev_err(dev, "%s failed to register spi master %d\n", __func__, err); - goto exit; - } + if (err) + return dev_err_probe(dev, err, "%s failed to register spi master\n", + __func__); =20 if (dfl_dev->revision =3D=3D FME_FEATURE_REV_MAX10_SPI_N5010) strscpy(board_info.modalias, "m10-n5010", SPI_NAME_SIZE); @@ -179,9 +178,6 @@ static int dfl_spi_altera_probe(struct dfl_device *dfl_= dev) } =20 return 0; -exit: - spi_master_put(master); - return err; } =20 static const struct dfl_device_id dfl_spi_altera_ids[] =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D58CCC25B0E for ; Mon, 15 Aug 2022 20:32:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348285AbiHOUc0 (ORCPT ); Mon, 15 Aug 2022 16:32:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347847AbiHOU0n (ORCPT ); Mon, 15 Aug 2022 16:26:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49DD99DB67; Mon, 15 Aug 2022 12:03:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DFDD0B81109; Mon, 15 Aug 2022 19:03:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36D8DC433C1; Mon, 15 Aug 2022 19:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590222; bh=4za+avW1T/NnoFjLu6YyZVhW3X3P6uxrYzP7gGEKha0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QpMOrj+eOG+3KO0qEOh0OA3j12LexheuouoYOwDqtMkfTuj1lpPOu6nJD6ubRyf75 /hXR5naac8huV+zkFaVwApwjbT9/UVc6a/fCQCA7CLN/Zt1tFomFMof34wDLyyGnmi dUDoQrOaAysHv3M15ZGNY0lqG7Snkp5QSJxgzP2M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Florian Fainelli , Sasha Levin Subject: [PATCH 5.18 0191/1095] ARM: bcm: Fix refcount leak in bcm_kona_smc_init Date: Mon, 15 Aug 2022 19:53:10 +0200 Message-Id: <20220815180437.522203928@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit cb23389a2458c2e4bfd6c86a513cbbe1c4d35e76 ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: b8eb35fd594a ("ARM: bcm281xx: Add L2 cache enable code") Signed-off-by: Miaoqian Lin Signed-off-by: Florian Fainelli Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/mach-bcm/bcm_kona_smc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_= smc.c index 43829e49ad93..347bfb7f03e2 100644 --- a/arch/arm/mach-bcm/bcm_kona_smc.c +++ b/arch/arm/mach-bcm/bcm_kona_smc.c @@ -52,6 +52,7 @@ int __init bcm_kona_smc_init(void) return -ENODEV; =20 prop_val =3D of_get_address(node, 0, &prop_size, NULL); + of_node_put(node); if (!prop_val) return -EINVAL; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAD12C25B08 for ; Mon, 15 Aug 2022 20:32:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243625AbiHOUcz (ORCPT ); Mon, 15 Aug 2022 16:32:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347942AbiHOU06 (ORCPT ); Mon, 15 Aug 2022 16:26:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF3299F0FD; Mon, 15 Aug 2022 12:03:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0B4BCB81062; Mon, 15 Aug 2022 19:03:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4124BC433C1; Mon, 15 Aug 2022 19:03:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590228; bh=mpaC7JTvOmrNnf3T/xWqblB2Q03w8cm7v5oJam1g27I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ow3VRmYYj3JtGEPKiXsTRyro6f1EY0iDKrx+U/R7ckRkM0ptXOQ9VXzuWtgYXw9IO B3A1zed6991BvVdalzSxxGB8GSj1FphsNOpTwvKum4dICFWgMpPhEwEsgO17QgzqX9 nZB3LO6H3n+EOKsezhufaB0K7ISJlGyTgg/okaqE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Guilherme G. Piccoli" , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 0192/1095] ACPI: processor/idle: Annotate more functions to live in cpuidle section Date: Mon, 15 Aug 2022 19:53:11 +0200 Message-Id: <20220815180437.570682105@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guilherme G. Piccoli [ Upstream commit 409dfdcaffb266acfc1f33529a26b1443c9332d4 ] Commit 6727ad9e206c ("nmi_backtrace: generate one-line reports for idle cpu= s") introduced a new text section called cpuidle; with that, we have a mechanism to add idling functions in such section and skip them from nmi_backtrace output, since they're useless and potentially flooding for such report. Happens that inlining might cause some real idle functions to end-up outside of such section; this is currently the case of ACPI processor_idle driver; the functions acpi_idle_enter_* do inline acpi_idle_do_entry(), hence they stay out of the cpuidle section. Fix that by marking such functions to also live in the cpuidle section. Fixes: 6727ad9e206c ("nmi_backtrace: generate one-line reports for idle cpu= s") Signed-off-by: Guilherme G. Piccoli Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/acpi/processor_idle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index eb95e188d62b..573ba7f617e8 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -602,7 +602,7 @@ static DEFINE_RAW_SPINLOCK(c3_lock); * @cx: Target state context * @index: index of target state */ -static int acpi_idle_enter_bm(struct cpuidle_driver *drv, +static int __cpuidle acpi_idle_enter_bm(struct cpuidle_driver *drv, struct acpi_processor *pr, struct acpi_processor_cx *cx, int index) @@ -659,7 +659,7 @@ static int acpi_idle_enter_bm(struct cpuidle_driver *dr= v, return index; } =20 -static int acpi_idle_enter(struct cpuidle_device *dev, +static int __cpuidle acpi_idle_enter(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { struct acpi_processor_cx *cx =3D per_cpu(acpi_cstate[index], dev->cpu); @@ -688,7 +688,7 @@ static int acpi_idle_enter(struct cpuidle_device *dev, return index; } =20 -static int acpi_idle_enter_s2idle(struct cpuidle_device *dev, +static int __cpuidle acpi_idle_enter_s2idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { struct acpi_processor_cx *cx =3D per_cpu(acpi_cstate[index], dev->cpu); --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F21FEC28B2B for ; Mon, 15 Aug 2022 20:33:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345089AbiHOUdI (ORCPT ); Mon, 15 Aug 2022 16:33:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348003AbiHOU1D (ORCPT ); Mon, 15 Aug 2022 16:27:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DB629F19D; Mon, 15 Aug 2022 12:03:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 348FE612BF; Mon, 15 Aug 2022 19:03:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2740AC433D7; Mon, 15 Aug 2022 19:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590231; bh=lwen1EgOL0WIJxndcyGGj6vv0zvik1mBKliZtD3eSSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UvQ08GC7njX0Ify50xXorXdBe6OQZUblw+wfOCJy5AAMfGqc4gIDwRQhDcb+oy9z6 KmVT0G1yjEkymGYxti/eYMl5X8HlWopXrzH7N99S5yGjWo8PSSF4BczHWN3p6ctz7R rbSZI9hFvbhnEqqS2DbWhvGf9YZUXakLYTCs7y20= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marcel Ziswiler , Shawn Guo , Sasha Levin Subject: [PATCH 5.18 0193/1095] ARM: dts: imx7d-colibri-emmc: add cpu1 supply Date: Mon, 15 Aug 2022 19:53:12 +0200 Message-Id: <20220815180437.605854399@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marcel Ziswiler [ Upstream commit ba28db60d34271e8a3cf4d7158d71607e8b1e57f ] Each cpu-core is supposed to list its supply separately, add supply for cpu1. Fixes: 2d7401f8632f ("ARM: dts: imx7d: Add cpu1 supply") Signed-off-by: Marcel Ziswiler Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/imx7d-colibri-emmc.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/imx7d-colibri-emmc.dtsi b/arch/arm/boot/dts/= imx7d-colibri-emmc.dtsi index af39e5370fa1..045e4413d339 100644 --- a/arch/arm/boot/dts/imx7d-colibri-emmc.dtsi +++ b/arch/arm/boot/dts/imx7d-colibri-emmc.dtsi @@ -13,6 +13,10 @@ memory@80000000 { }; }; =20 +&cpu1 { + cpu-supply =3D <®_DCDC2>; +}; + &gpio6 { gpio-line-names =3D "", "", --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60D67C00140 for ; Mon, 15 Aug 2022 20:33:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345648AbiHOUdu (ORCPT ); Mon, 15 Aug 2022 16:33:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347390AbiHOU1d (ORCPT ); Mon, 15 Aug 2022 16:27:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37F81A0608; Mon, 15 Aug 2022 12:04:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 474A961299; Mon, 15 Aug 2022 19:03:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B17DC433C1; Mon, 15 Aug 2022 19:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590234; bh=5H4tar8fnHRgidQpmaez/5zo8Yhc3S0NY+XkZsD8nr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pUyo0bgjO5a7IH1TQIunDGqbCWlAegPgs8uuOGaYWG2QJ4Byehjr7SIxalPyaCj03 xwihzFo0/AFP6fD0rWiuxEHXBVekQ5AGq3JenvSyan9M2oICh/rFRFlKCOlc4PGalL kpDxkQBLf4IxxpSgiKY2G7Ihd3z0773mq0uIH1lo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Renesas Vietnam via Yoshihiro Shimoda , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.18 0194/1095] soc: renesas: r8a779a0-sysc: Fix A2DP1 and A2CV[2357] PDR values Date: Mon, 15 Aug 2022 19:53:13 +0200 Message-Id: <20220815180437.654258777@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Geert Uytterhoeven [ Upstream commit bccceabb92ce8eb78bbf2de08308e2cc2761a2e5 ] The PDR values for the A2DP1 and A2CV[2357] power areas on R-Car V3U are incorrect (copied-and-pasted from A2DP0 and A2CV[0146]). Fix them. Reported-by: Renesas Vietnam via Yoshihiro Shimoda Fixes: 1b4298f000064cc2 ("soc: renesas: r8a779a0-sysc: Add r8a779a0 support= ") Signed-off-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/87bc2e70ba4082970cf8c65871beae4be3503189.16= 54696188.git.geert+renesas@glider.be Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/soc/renesas/r8a779a0-sysc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/soc/renesas/r8a779a0-sysc.c b/drivers/soc/renesas/r8a7= 79a0-sysc.c index fdfc857df334..04f1bc322ae7 100644 --- a/drivers/soc/renesas/r8a779a0-sysc.c +++ b/drivers/soc/renesas/r8a779a0-sysc.c @@ -57,11 +57,11 @@ static struct rcar_gen4_sysc_area r8a779a0_areas[] __in= itdata =3D { { "a2cv6", R8A779A0_PD_A2CV6, R8A779A0_PD_A3IR }, { "a2cn2", R8A779A0_PD_A2CN2, R8A779A0_PD_A3IR }, { "a2imp23", R8A779A0_PD_A2IMP23, R8A779A0_PD_A3IR }, - { "a2dp1", R8A779A0_PD_A2DP0, R8A779A0_PD_A3IR }, - { "a2cv2", R8A779A0_PD_A2CV0, R8A779A0_PD_A3IR }, - { "a2cv3", R8A779A0_PD_A2CV1, R8A779A0_PD_A3IR }, - { "a2cv5", R8A779A0_PD_A2CV4, R8A779A0_PD_A3IR }, - { "a2cv7", R8A779A0_PD_A2CV6, R8A779A0_PD_A3IR }, + { "a2dp1", R8A779A0_PD_A2DP1, R8A779A0_PD_A3IR }, + { "a2cv2", R8A779A0_PD_A2CV2, R8A779A0_PD_A3IR }, + { "a2cv3", R8A779A0_PD_A2CV3, R8A779A0_PD_A3IR }, + { "a2cv5", R8A779A0_PD_A2CV5, R8A779A0_PD_A3IR }, + { "a2cv7", R8A779A0_PD_A2CV7, R8A779A0_PD_A3IR }, { "a2cn1", R8A779A0_PD_A2CN1, R8A779A0_PD_A3IR }, { "a1cnn0", R8A779A0_PD_A1CNN0, R8A779A0_PD_A2CN0 }, { "a1cnn2", R8A779A0_PD_A1CNN2, R8A779A0_PD_A2CN2 }, --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA0A4C00140 for ; Mon, 15 Aug 2022 20:38:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345117AbiHOUiu (ORCPT ); Mon, 15 Aug 2022 16:38:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345848AbiHOUeL (ORCPT ); Mon, 15 Aug 2022 16:34:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6DBD4E608; Mon, 15 Aug 2022 12:06:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8F2E9B81104; Mon, 15 Aug 2022 19:06:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D00FBC433D6; Mon, 15 Aug 2022 19:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590360; bh=ROhcCfIKrzYI/OpUhfYzvakQSe0wUMT4P7K7njz8oqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ej5Zd1KCR2wofxg4dsAsMBEbPEdcWuYIa2muirWpxeowQYc6/TSY9Z3bvHlVuJrSo Q9dnN1RyoARgarOY4zNKwHMn5EXvopgXe6kckN1BLi20+oqoAheNeQW2+6GvnFku61 onFucHGOFAYB3oPOLH64C6jahu+78ReT0L1kso3g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.18 0195/1095] soc: amlogic: Fix refcount leak in meson-secure-pwrc.c Date: Mon, 15 Aug 2022 19:53:14 +0200 Message-Id: <20220815180437.699287177@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit d18529a4c12f66d83daac78045ea54063bd43257 ] In meson_secure_pwrc_probe(), there is a refcount leak in one fail path. Signed-off-by: Liang He Acked-by: Martin Blumenstingl Fixes: b3dde5013e13 ("soc: amlogic: Add support for Secure power domains co= ntroller") Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20220616144915.3988071-1-windhl@126.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/soc/amlogic/meson-secure-pwrc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soc/amlogic/meson-secure-pwrc.c b/drivers/soc/amlogic/= meson-secure-pwrc.c index a10a417a87db..e93518763526 100644 --- a/drivers/soc/amlogic/meson-secure-pwrc.c +++ b/drivers/soc/amlogic/meson-secure-pwrc.c @@ -152,8 +152,10 @@ static int meson_secure_pwrc_probe(struct platform_dev= ice *pdev) } =20 pwrc =3D devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); - if (!pwrc) + if (!pwrc) { + of_node_put(sm_np); return -ENOMEM; + } =20 pwrc->fw =3D meson_sm_get(sm_np); of_node_put(sm_np); --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC9E4C3F6B0 for ; Mon, 15 Aug 2022 20:37:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244331AbiHOUhy (ORCPT ); Mon, 15 Aug 2022 16:37:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347101AbiHOU2p (ORCPT ); Mon, 15 Aug 2022 16:28:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFF19402ED; Mon, 15 Aug 2022 12:04:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 45091612C5; Mon, 15 Aug 2022 19:04:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48950C433D6; Mon, 15 Aug 2022 19:04:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590259; bh=wo4l3src4p2Y6TKnCr9r6/z8QAnWWL3kywTWwoncKeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WplpO9Hf0zFcjneJxtOTZaQiaXKI470hR8o1fyAYhskIr8aHiYX2VA903Z/IUA9vJ J2dCdO+rU4NU9EHQRdyRhI5KkveLDVaUW8SLz9kaNpWckwui7+l5W4aKlu4qUe1xdo /wHjmJdNa3/qTWTPwM2eoQniBjzScQOH7VPBPn+M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Sasha Levin Subject: [PATCH 5.18 0196/1095] arm64: dts: renesas: Fix thermal-sensors on single-zone sensors Date: Mon, 15 Aug 2022 19:53:15 +0200 Message-Id: <20220815180437.734907497@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Geert Uytterhoeven [ Upstream commit 62e8a53431145e06e503b71625a34eaa87b72b2c ] "make dtbs_check": arch/arm64/boot/dts/renesas/r8a774c0-cat874.dtb: thermal-zones: cpu-the= rmal:thermal-sensors: [[74], [0]] is too long arch/arm64/boot/dts/renesas/r8a774c0-ek874.dtb: thermal-zones: cpu-ther= mal:thermal-sensors: [[79], [0]] is too long arch/arm64/boot/dts/renesas/r8a774c0-ek874-idk-2121wr.dtb: thermal-zone= s: cpu-thermal:thermal-sensors: [[82], [0]] is too long arch/arm64/boot/dts/renesas/r8a774c0-ek874-mipi-2.1.dtb: thermal-zones:= cpu-thermal:thermal-sensors: [[87], [0]] is too long arch/arm64/boot/dts/renesas/r8a77990-ebisu.dtb: thermal-zones: cpu-ther= mal:thermal-sensors: [[105], [0]] is too long From schema: Documentation/devicetree/bindings/thermal/thermal-zones.y= aml Indeed, the thermal sensors on R-Car E3 and RZ/G2E support only a single zone, hence #thermal-sensor-cells =3D <0>. Fix this by dropping the bogus zero cell from the thermal sensor specifiers. Fixes: 8fa7d18f9ee2dc20 ("arm64: dts: renesas: r8a77990: Create thermal zon= e to support IPA") Fixes: 8438bfda9d768157 ("arm64: dts: renesas: r8a774c0: Create thermal zon= e to support IPA") Signed-off-by: Geert Uytterhoeven Reviewed-by: Niklas S=C3=B6derlund Link: https://lore.kernel.org/r/28b812fdd1fc3698311fac984ab8b91d3d655c1c.16= 55301684.git.geert+renesas@glider.be Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/renesas/r8a774c0.dtsi | 2 +- arch/arm64/boot/dts/renesas/r8a77990.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi b/arch/arm64/boot/dt= s/renesas/r8a774c0.dtsi index e123c8d1bab9..337efbeda5a9 100644 --- a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi @@ -1956,7 +1956,7 @@ thermal-zones { cpu-thermal { polling-delay-passive =3D <250>; polling-delay =3D <0>; - thermal-sensors =3D <&thermal 0>; + thermal-sensors =3D <&thermal>; sustainable-power =3D <717>; =20 cooling-maps { diff --git a/arch/arm64/boot/dts/renesas/r8a77990.dtsi b/arch/arm64/boot/dt= s/renesas/r8a77990.dtsi index 7e0f1aab2135..155589f67e1b 100644 --- a/arch/arm64/boot/dts/renesas/r8a77990.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a77990.dtsi @@ -2117,7 +2117,7 @@ thermal-zones { cpu-thermal { polling-delay-passive =3D <250>; polling-delay =3D <0>; - thermal-sensors =3D <&thermal 0>; + thermal-sensors =3D <&thermal>; sustainable-power =3D <717>; =20 cooling-maps { --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6E6AC00140 for ; Mon, 15 Aug 2022 20:36:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346101AbiHOUfg (ORCPT ); Mon, 15 Aug 2022 16:35:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347733AbiHOUbh (ORCPT ); Mon, 15 Aug 2022 16:31:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52282A61D5; Mon, 15 Aug 2022 12:04:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0AD96612B7; Mon, 15 Aug 2022 19:04:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 152DBC433D7; Mon, 15 Aug 2022 19:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590294; bh=VYfBlipzcVbhm4a67MWNtWYnwO8/NK7weJw/0ZKExAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J4orDkO/ZRRYtwfjo2Nd+97vVF4zyY/xWUF8udH9IGvVwjaAEtP2c/xHxvaLez5cN Ypm5aiLJ2hZCqAZqNO5VI90ARWoTdZZu7rv6wN+PsCVkIP6tsclX2LkzzSjzUHgQE+ U9FuvtpGpVkJXDWh4xT7LzjSz3394UV9SOLok+P8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ahmad Fatoum , Max Krummenacher , Shawn Guo , Sasha Levin Subject: [PATCH 5.18 0197/1095] Revert "ARM: dts: imx6qdl-apalis: Avoid underscore in node name" Date: Mon, 15 Aug 2022 19:53:16 +0200 Message-Id: <20220815180437.778617589@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Max Krummenacher [ Upstream commit 9c0919acb3fa7c1a24e384ff912f2d88f060c373 ] The STMPE MFD device binding requires the child node to have a fixed name, i.e. with '_', not '-'. Otherwise the stmpe_adc, stmpe_touchscreen drivers will not be probed. Fixes: 56086b5e804f ("ARM: dts: imx6qdl-apalis: Avoid underscore in node na= me") Reviewed-by: Ahmad Fatoum Signed-off-by: Max Krummenacher Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/imx6qdl-apalis.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi b/arch/arm/boot/dts/imx6= qdl-apalis.dtsi index bd763bae596b..da919d0544a8 100644 --- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi +++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi @@ -315,7 +315,7 @@ stmpe811@41 { /* ADC conversion time: 80 clocks */ st,sample-time =3D <4>; =20 - stmpe_touchscreen: stmpe-touchscreen { + stmpe_touchscreen: stmpe_touchscreen { compatible =3D "st,stmpe-ts"; /* 8 sample average control */ st,ave-ctrl =3D <3>; @@ -332,7 +332,7 @@ stmpe_touchscreen: stmpe-touchscreen { st,touch-det-delay =3D <5>; }; =20 - stmpe_adc: stmpe-adc { + stmpe_adc: stmpe_adc { compatible =3D "st,stmpe-adc"; /* forbid to use ADC channels 3-0 (touch) */ st,norequest-mask =3D <0x0F>; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F203C00140 for ; Mon, 15 Aug 2022 20:38:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344672AbiHOUiD (ORCPT ); Mon, 15 Aug 2022 16:38:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348296AbiHOUc1 (ORCPT ); Mon, 15 Aug 2022 16:32:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACA4913F0F; Mon, 15 Aug 2022 12:05:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D2AB761299; Mon, 15 Aug 2022 19:05:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8C2BC433D6; Mon, 15 Aug 2022 19:05:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590329; bh=r8VC5k8yCnxrmhJJjc40MMt9lv8g2qFUnZotxUDIYhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s1m133Y9WgbzeidEUh86d8sbISjNrpGMyVczHLC+t5HHnI+bsB1MrwrtM0Ke5UxcU tnpIczr2dXquMMgoKYvkUHi3wDKxx1kg8v8A85Ccf6A8/QlxfwWdtJKJqo2JkEZ0bN u2InamQ1cCiteE8H9kJ91nWjPJPlpua9+3NQhgJE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Borislav Petkov , Sasha Levin Subject: [PATCH 5.18 0198/1095] x86/pmem: Fix platform-device leak in error path Date: Mon, 15 Aug 2022 19:53:17 +0200 Message-Id: <20220815180437.818621157@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold [ Upstream commit 229e73d46994f15314f58b2d39bf952111d89193 ] Make sure to free the platform device in the unlikely event that registration fails. Fixes: 7a67832c7e44 ("libnvdimm, e820: make CONFIG_X86_PMEM_LEGACY a trista= te option") Signed-off-by: Johan Hovold Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20220620140723.9810-1-johan@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kernel/pmem.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/pmem.c b/arch/x86/kernel/pmem.c index 6b07faaa1579..23154d24b117 100644 --- a/arch/x86/kernel/pmem.c +++ b/arch/x86/kernel/pmem.c @@ -27,6 +27,11 @@ static __init int register_e820_pmem(void) * simply here to trigger the module to load on demand. */ pdev =3D platform_device_alloc("e820_pmem", -1); - return platform_device_add(pdev); + + rc =3D platform_device_add(pdev); + if (rc) + platform_device_put(pdev); + + return rc; } device_initcall(register_e820_pmem); --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62A96C00140 for ; Mon, 15 Aug 2022 20:38:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345687AbiHOUiK (ORCPT ); Mon, 15 Aug 2022 16:38:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348372AbiHOUcg (ORCPT ); Mon, 15 Aug 2022 16:32:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17F524D818; Mon, 15 Aug 2022 12:05:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DACA4612A0; Mon, 15 Aug 2022 19:05:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9A3EC433C1; Mon, 15 Aug 2022 19:05:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590341; bh=mBoLFm9NwPRE3ZpSE3rj81+UytlL97KQIUPsRFMbypc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XV7JXeAgWe/hp2yKjTpGFYzOdCWfO8C4/sRc/jxEg8epZIZAwesotgEQW/lneyqY8 siFV1KsAXeR/Jhbb1nuMbcGELN/G63cnSooCdQmX9YbL3KERazEfSQNtfpCzv5I1Mx SKg5EUCgv05+NRPK2mq71cLXbwT0LgJQpY0H/eJA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.18 0199/1095] ARM: dts: ast2500-evb: fix board compatible Date: Mon, 15 Aug 2022 19:53:18 +0200 Message-Id: <20220815180437.868059004@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit 30b276fca5c0644f3cb17bceb1bd6a626c670184 ] The AST2500 EVB board should have dedicated compatible. Fixes: 02440622656d ("arm/dst: Add Aspeed ast2500 device tree") Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220529104928.79636-4-krzysztof.kozlowski@= linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/aspeed-ast2500-evb.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/aspeed-ast2500-evb.dts b/arch/arm/boot/dts/a= speed-ast2500-evb.dts index 1d24b394ea4c..a497dd135491 100644 --- a/arch/arm/boot/dts/aspeed-ast2500-evb.dts +++ b/arch/arm/boot/dts/aspeed-ast2500-evb.dts @@ -5,7 +5,7 @@ =20 / { model =3D "AST2500 EVB"; - compatible =3D "aspeed,ast2500"; + compatible =3D "aspeed,ast2500-evb", "aspeed,ast2500"; =20 aliases { serial4 =3D &uart5; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 336C7C00140 for ; Mon, 15 Aug 2022 20:38:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345123AbiHOUiT (ORCPT ); Mon, 15 Aug 2022 16:38:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348382AbiHOUch (ORCPT ); Mon, 15 Aug 2022 16:32:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 136EEA924F; Mon, 15 Aug 2022 12:05:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ACCF361299; Mon, 15 Aug 2022 19:05:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3075C433C1; Mon, 15 Aug 2022 19:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590344; bh=PvEgT27PxhUo4qWQYi1aKmUFsTOeY/X7J4jMRxHhYQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NZOioggYQHIQOhYTGbJI5BfQE8UVm9YMJABAydF1S3LEMu12A7MnuaVDOIC+uXiFK INhnTBAmhVsAmZZYOpuVS6Bi6++CvLskga43/eIPBx5qurJCH6jJutYWtmoKmAd+/d cqWOKtMbkFmsVNk8HHKZcvxXBOuYoTLLKC1AUJjg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.18 0200/1095] ARM: dts: ast2600-evb: fix board compatible Date: Mon, 15 Aug 2022 19:53:19 +0200 Message-Id: <20220815180437.914272953@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit aa5e06208500a0db41473caebdee5a2e81d5a277 ] The AST2600 EVB board should have dedicated compatible. Fixes: 2ca5646b5c2f ("ARM: dts: aspeed: Add AST2600 and EVB") Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220529104928.79636-5-krzysztof.kozlowski@= linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/aspeed-ast2600-evb.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/aspeed-ast2600-evb.dts b/arch/arm/boot/dts/a= speed-ast2600-evb.dts index 788448cdd6b3..b8e55bf167aa 100644 --- a/arch/arm/boot/dts/aspeed-ast2600-evb.dts +++ b/arch/arm/boot/dts/aspeed-ast2600-evb.dts @@ -8,7 +8,7 @@ =20 / { model =3D "AST2600 EVB"; - compatible =3D "aspeed,ast2600"; + compatible =3D "aspeed,ast2600-evb-a1", "aspeed,ast2600"; =20 aliases { serial4 =3D &uart5; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2120C00140 for ; Mon, 15 Aug 2022 20:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345136AbiHOUi2 (ORCPT ); Mon, 15 Aug 2022 16:38:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348399AbiHOUci (ORCPT ); Mon, 15 Aug 2022 16:32:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 847AAA99F8; Mon, 15 Aug 2022 12:05:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3884F61281; Mon, 15 Aug 2022 19:05:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 162FFC433C1; Mon, 15 Aug 2022 19:05:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590347; bh=jztBd4sZFkZnnNSyY7Gg8qvaMjbW9hiYtsi5arzlBw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PGGQ/w91uGC79X4Sa3TbrlnSolI+J+w6YoqefIvod/3sQwHleERA8GOhkYLYx4wJl g2w2DSVdSz2hkjy0nsHGkV2Fh3IdvpTTXHbktZ6h4aMsDel0JFfx7GsOJo9evWBA9e FFsP6SYJjg2U46wFadwDgWqjYiOHVDtMHTITuLG0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.18 0201/1095] ARM: dts: ast2600-evb-a1: fix board compatible Date: Mon, 15 Aug 2022 19:53:20 +0200 Message-Id: <20220815180437.953414089@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit 33c39140cc298e0d4e36083cb9a665a837773a60 ] The AST2600 EVB A1 board should have dedicated compatible. Fixes: a72955180372 ("ARM: dts: aspeed: ast2600evb: Add dts file for A1 and= A0") Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220529104928.79636-6-krzysztof.kozlowski@= linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/aspeed-ast2600-evb-a1.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/aspeed-ast2600-evb-a1.dts b/arch/arm/boot/dt= s/aspeed-ast2600-evb-a1.dts index dd7148060c4a..d0a5c2ff0fec 100644 --- a/arch/arm/boot/dts/aspeed-ast2600-evb-a1.dts +++ b/arch/arm/boot/dts/aspeed-ast2600-evb-a1.dts @@ -5,6 +5,7 @@ =20 / { model =3D "AST2600 A1 EVB"; + compatible =3D "aspeed,ast2600-evb-a1", "aspeed,ast2600"; =20 /delete-node/regulator-vcc-sdhci0; /delete-node/regulator-vcc-sdhci1; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14766C25B0E for ; Mon, 15 Aug 2022 20:38:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345217AbiHOUik (ORCPT ); Mon, 15 Aug 2022 16:38:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345635AbiHOUdt (ORCPT ); Mon, 15 Aug 2022 16:33:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FF29AA4EE; Mon, 15 Aug 2022 12:05:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0628DB81109; Mon, 15 Aug 2022 19:05:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C18EC433C1; Mon, 15 Aug 2022 19:05:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590350; bh=/Htb3ZOwxZsojfgr3qTTufDCDZpTC34cgAo3VeQ9GgI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aptPm6i/9V6FKJhoz1OQp5JBoj0H2hQwdB2y85bpe9KXYzfsrYD5wAhiHEe+JcACR Jt8PYekJv50kSKMDUQiwtCCX0lQ+X7dTNr2qI1GFAy3HTlnJrs1C9mB6RrVaY1Zx4i RIxrVQaNfzPWLaUmU+xLa48sClacVEsqeum88N/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , AngeloGioacchino Del Regno , Matthias Brugger , Sasha Levin Subject: [PATCH 5.18 0202/1095] arm64: dts: mt8192: Fix idle-states nodes naming scheme Date: Mon, 15 Aug 2022 19:53:21 +0200 Message-Id: <20220815180438.001732507@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: N=C3=ADcolas F. R. A. Prado [ Upstream commit 399e23ad51caaf62400a531c9268ad3c453c3d76 ] Tweak the name of the idle-states subnodes so that they follow the binding pattern, getting rid of dtbs_check warnings. Only the usage of "-" in the name was necessary, but "off" was also exchanged for "sleep" since that seems to be a more common wording in other dts files. Fixes: 9260918d3a4f ("arm64: dts: mt8192: Add cpu-idle-states") Signed-off-by: N=C3=ADcolas F. R. A. Prado Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220617233150.2466344-2-nfraprado@collabor= a.com Signed-off-by: Matthias Brugger Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/mediatek/mt8192.dtsi | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8192.dtsi b/arch/arm64/boot/dts= /mediatek/mt8192.dtsi index bcecc7484453..12972828832e 100644 --- a/arch/arm64/boot/dts/mediatek/mt8192.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8192.dtsi @@ -41,7 +41,7 @@ cpu0: cpu@0 { reg =3D <0x000>; enable-method =3D "psci"; clock-frequency =3D <1701000000>; - cpu-idle-states =3D <&cpuoff_l &clusteroff_l>; + cpu-idle-states =3D <&cpu_sleep_l &cluster_sleep_l>; next-level-cache =3D <&l2_0>; capacity-dmips-mhz =3D <530>; }; @@ -52,7 +52,7 @@ cpu1: cpu@100 { reg =3D <0x100>; enable-method =3D "psci"; clock-frequency =3D <1701000000>; - cpu-idle-states =3D <&cpuoff_l &clusteroff_l>; + cpu-idle-states =3D <&cpu_sleep_l &cluster_sleep_l>; next-level-cache =3D <&l2_0>; capacity-dmips-mhz =3D <530>; }; @@ -63,7 +63,7 @@ cpu2: cpu@200 { reg =3D <0x200>; enable-method =3D "psci"; clock-frequency =3D <1701000000>; - cpu-idle-states =3D <&cpuoff_l &clusteroff_l>; + cpu-idle-states =3D <&cpu_sleep_l &cluster_sleep_l>; next-level-cache =3D <&l2_0>; capacity-dmips-mhz =3D <530>; }; @@ -74,7 +74,7 @@ cpu3: cpu@300 { reg =3D <0x300>; enable-method =3D "psci"; clock-frequency =3D <1701000000>; - cpu-idle-states =3D <&cpuoff_l &clusteroff_l>; + cpu-idle-states =3D <&cpu_sleep_l &cluster_sleep_l>; next-level-cache =3D <&l2_0>; capacity-dmips-mhz =3D <530>; }; @@ -85,7 +85,7 @@ cpu4: cpu@400 { reg =3D <0x400>; enable-method =3D "psci"; clock-frequency =3D <2171000000>; - cpu-idle-states =3D <&cpuoff_b &clusteroff_b>; + cpu-idle-states =3D <&cpu_sleep_b &cluster_sleep_b>; next-level-cache =3D <&l2_1>; capacity-dmips-mhz =3D <1024>; }; @@ -96,7 +96,7 @@ cpu5: cpu@500 { reg =3D <0x500>; enable-method =3D "psci"; clock-frequency =3D <2171000000>; - cpu-idle-states =3D <&cpuoff_b &clusteroff_b>; + cpu-idle-states =3D <&cpu_sleep_b &cluster_sleep_b>; next-level-cache =3D <&l2_1>; capacity-dmips-mhz =3D <1024>; }; @@ -107,7 +107,7 @@ cpu6: cpu@600 { reg =3D <0x600>; enable-method =3D "psci"; clock-frequency =3D <2171000000>; - cpu-idle-states =3D <&cpuoff_b &clusteroff_b>; + cpu-idle-states =3D <&cpu_sleep_b &cluster_sleep_b>; next-level-cache =3D <&l2_1>; capacity-dmips-mhz =3D <1024>; }; @@ -118,7 +118,7 @@ cpu7: cpu@700 { reg =3D <0x700>; enable-method =3D "psci"; clock-frequency =3D <2171000000>; - cpu-idle-states =3D <&cpuoff_b &clusteroff_b>; + cpu-idle-states =3D <&cpu_sleep_b &cluster_sleep_b>; next-level-cache =3D <&l2_1>; capacity-dmips-mhz =3D <1024>; }; @@ -171,7 +171,7 @@ l3_0: l3-cache { =20 idle-states { entry-method =3D "arm,psci"; - cpuoff_l: cpuoff_l { + cpu_sleep_l: cpu-sleep-l { compatible =3D "arm,idle-state"; arm,psci-suspend-param =3D <0x00010001>; local-timer-stop; @@ -179,7 +179,7 @@ cpuoff_l: cpuoff_l { exit-latency-us =3D <140>; min-residency-us =3D <780>; }; - cpuoff_b: cpuoff_b { + cpu_sleep_b: cpu-sleep-b { compatible =3D "arm,idle-state"; arm,psci-suspend-param =3D <0x00010001>; local-timer-stop; @@ -187,7 +187,7 @@ cpuoff_b: cpuoff_b { exit-latency-us =3D <145>; min-residency-us =3D <720>; }; - clusteroff_l: clusteroff_l { + cluster_sleep_l: cluster-sleep-l { compatible =3D "arm,idle-state"; arm,psci-suspend-param =3D <0x01010002>; local-timer-stop; @@ -195,7 +195,7 @@ clusteroff_l: clusteroff_l { exit-latency-us =3D <155>; min-residency-us =3D <860>; }; - clusteroff_b: clusteroff_b { + cluster_sleep_b: cluster-sleep-b { compatible =3D "arm,idle-state"; arm,psci-suspend-param =3D <0x01010002>; local-timer-stop; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D439C00140 for ; Mon, 15 Aug 2022 20:38:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345377AbiHOUip (ORCPT ); Mon, 15 Aug 2022 16:38:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345658AbiHOUdu (ORCPT ); Mon, 15 Aug 2022 16:33:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEF3EAA4D7; Mon, 15 Aug 2022 12:05:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 284C6612A0; Mon, 15 Aug 2022 19:05:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AE66C433C1; Mon, 15 Aug 2022 19:05:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590353; bh=/Lpxmh6bFSCDVgKDrnaHp/eYLGjXz40Fzy1gOOKNKF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0xMzwWRCZyXozqBOo96/t9Wt83FLLPa6YFTjmzWhOHB/aD0cZpp0qigb+pgFBETOJ un8whgAkV0WkOnz2mqv7qaxFL1k9CDQe9WNpZBqGbUUAMYMBXm6yhm03gLJh66v6pF YoBGxnZKGPfu9Cvbxo6fvhiRA8WiMssxR0evJ9dE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , AngeloGioacchino Del Regno , Matthias Brugger , Sasha Levin Subject: [PATCH 5.18 0203/1095] arm64: dts: mt8192: Fix idle-states entry-method Date: Mon, 15 Aug 2022 19:53:22 +0200 Message-Id: <20220815180438.051533781@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: N=C3=ADcolas F. R. A. Prado [ Upstream commit 2e599740f7e423ee89fb027896cb2635dd43784f ] The entry-method property of the idle-states node should be "psci" as described in the idle-states binding, since this is already the value of enable-method in the CPU nodes. Fix it to get rid of a dtbs_check warning. Fixes: 9260918d3a4f ("arm64: dts: mt8192: Add cpu-idle-states") Signed-off-by: N=C3=ADcolas F. R. A. Prado Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220617233150.2466344-3-nfraprado@collabor= a.com Signed-off-by: Matthias Brugger Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/mediatek/mt8192.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8192.dtsi b/arch/arm64/boot/dts= /mediatek/mt8192.dtsi index 12972828832e..96439a4bce09 100644 --- a/arch/arm64/boot/dts/mediatek/mt8192.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8192.dtsi @@ -170,7 +170,7 @@ l3_0: l3-cache { }; =20 idle-states { - entry-method =3D "arm,psci"; + entry-method =3D "psci"; cpu_sleep_l: cpu-sleep-l { compatible =3D "arm,idle-state"; arm,psci-suspend-param =3D <0x00010001>; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 689B9C00140 for ; Mon, 15 Aug 2022 20:39:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345015AbiHOUi7 (ORCPT ); Mon, 15 Aug 2022 16:38:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241078AbiHOUeG (ORCPT ); Mon, 15 Aug 2022 16:34:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B7F52CC8C; Mon, 15 Aug 2022 12:05:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AAE71612D1; Mon, 15 Aug 2022 19:05:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34437C433D6; Mon, 15 Aug 2022 19:05:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590357; bh=+EDy0vEuWkj5EKJIzmOQjrMOTXoHW2iAKg6PACD+8ko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SoA1bX6QawQ2czaVzlSEZ/JtpJzaeKESZurqcL7Xo/ix7RzgiBjI/JtI/nyI9HRlN BmlEPmqi09nD8DjzrWNbmv33t0Yt7XT4qUocJ4K/+NlrOAold/iZN61BS5QO0A6zNa TA+RTqlwFSUSjLk5dTj3jG6dUbx4jV3Z06UHRFrI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Catalin Marinas , Ingo Molnar , "Peter Zijlstra (Intel)" , Thomas Gleixner , Will Deacon , Sasha Levin Subject: [PATCH 5.18 0204/1095] arm64: select TRACE_IRQFLAGS_NMI_SUPPORT Date: Mon, 15 Aug 2022 19:53:23 +0200 Message-Id: <20220815180438.099703461@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Rutland [ Upstream commit 3381da254fab37ba08c4b7c4f19b4ee28b1a27ec ] Due to an oversight, on arm64 lockdep IRQ state tracking doesn't work as intended in NMI context. This demonstrably results in bogus warnings from lockdep, and in theory could mask a variety of issues. On arm64, we've consistently tracked IRQ flag state for NMIs (and saved/restored the state of the interrupted context) since commit: f0cd5ac1e4c53cb6 ("arm64: entry: fix NMI {user, kernel}->kernel transitio= ns") That commit fixed most lockdep issues with NMI by virtue of the save/restore of the lockdep state of the interrupted context. However, for lockdep IRQ state tracking to consistently take effect in NMI context it has been necessary to select TRACE_IRQFLAGS_NMI_SUPPORT since commit: ed00495333ccc80f ("locking/lockdep: Fix TRACE_IRQFLAGS vs. NMIs") As arm64 does not select TRACE_IRQFLAGS_NMI_SUPPORT, this means that the lockdep state can be stale in NMI context, and some uses of that state can consume stale data. When an NMI is taken arm64 entry code will call arm64_enter_nmi(). This will enter NMI context via __nmi_enter() before calling lockdep_hardirqs_off() to inform lockdep that IRQs have been masked. Where TRACE_IRQFLAGS_NMI_SUPPORT is not selected, lockdep_hardirqs_off() will not update lockdep state if called in NMI context. Thus if IRQs were enabled in the original context, lockdep will continue to believe that IRQs are enabled despite the call to lockdep_hardirqs_off(). However, the lockdep_assert_*() checks do take effect in NMI context, and will consume the stale lockdep state. If an NMI is taken from a context which had IRQs enabled, and during the handling of the NMI something calls lockdep_assert_irqs_disabled(), this will result in a spurious warning based upon the stale lockdep state. This can be seen when using perf with GICv3 pseudo-NMIs. Within the perf NMI handler we may attempt a uaccess to record the userspace callchain, and is this faults the el1_abort() call in the nested context will call exit_to_kernel_mode() when returning, which has a lockdep_assert_irqs_disabled() assertion: | # ./perf record -a -g sh | ------------[ cut here ]------------ | WARNING: CPU: 0 PID: 164 at arch/arm64/kernel/entry-common.c:73 exit_to_k= ernel_mode+0x118/0x1ac | Modules linked in: | CPU: 0 PID: 164 Comm: perf Not tainted 5.18.0-rc5 #1 | Hardware name: linux,dummy-virt (DT) | pstate: 004003c5 (nzcv DAIF +PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) | pc : exit_to_kernel_mode+0x118/0x1ac | lr : el1_abort+0x80/0xbc | sp : ffff8000080039f0 | pmr_save: 000000f0 | x29: ffff8000080039f0 x28: ffff6831054e4980 x27: ffff683103adb400 | x26: 0000000000000000 x25: 0000000000000001 x24: 0000000000000001 | x23: 00000000804000c5 x22: 00000000000000c0 x21: 0000000000000001 | x20: ffffbd51e635ec44 x19: ffff800008003a60 x18: 0000000000000000 | x17: ffffaadf98d23000 x16: ffff800008004000 x15: 0000ffffd14f25c0 | x14: 0000000000000000 x13: 00000000000018eb x12: 0000000000000040 | x11: 000000000000001e x10: 000000002b820020 x9 : 0000000100110000 | x8 : 000000000045cac0 x7 : 0000ffffd14f25c0 x6 : ffffbd51e639b000 | x5 : 00000000000003e5 x4 : ffffbd51e58543b0 x3 : 0000000000000001 | x2 : ffffaadf98d23000 x1 : ffff6831054e4980 x0 : 0000000100110000 | Call trace: | exit_to_kernel_mode+0x118/0x1ac | el1_abort+0x80/0xbc | el1h_64_sync_handler+0xa4/0xd0 | el1h_64_sync+0x74/0x78 | __arch_copy_from_user+0xa4/0x230 | get_perf_callchain+0x134/0x1e4 | perf_callchain+0x7c/0xa0 | perf_prepare_sample+0x414/0x660 | perf_event_output_forward+0x80/0x180 | __perf_event_overflow+0x70/0x13c | perf_event_overflow+0x1c/0x30 | armv8pmu_handle_irq+0xe8/0x160 | armpmu_dispatch_irq+0x2c/0x70 | handle_percpu_devid_fasteoi_nmi+0x7c/0xbc | generic_handle_domain_nmi+0x3c/0x60 | gic_handle_irq+0x1dc/0x310 | call_on_irq_stack+0x2c/0x54 | do_interrupt_handler+0x80/0x94 | el1_interrupt+0xb0/0xe4 | el1h_64_irq_handler+0x18/0x24 | el1h_64_irq+0x74/0x78 | lockdep_hardirqs_off+0x50/0x120 | trace_hardirqs_off+0x38/0x214 | _raw_spin_lock_irq+0x98/0xa0 | pipe_read+0x1f8/0x404 | new_sync_read+0x140/0x150 | vfs_read+0x190/0x1dc | ksys_read+0xdc/0xfc | __arm64_sys_read+0x20/0x30 | invoke_syscall+0x48/0x114 | el0_svc_common.constprop.0+0x158/0x17c | do_el0_svc+0x28/0x90 | el0_svc+0x60/0x150 | el0t_64_sync_handler+0xa4/0x130 | el0t_64_sync+0x19c/0x1a0 | irq event stamp: 483 | hardirqs last enabled at (483): [] _raw_spin_unlock_ir= qrestore+0xa4/0xb0 | hardirqs last disabled at (482): [] _raw_spin_lock_irqs= ave+0xb0/0xb4 | softirqs last enabled at (468): [] put_cpu_fpsimd_cont= ext+0x28/0x70 | softirqs last disabled at (466): [] get_cpu_fpsimd_cont= ext+0x0/0x5c | ---[ end trace 0000000000000000 ]--- Note that as lockdep_assert_irqs_disabled() uses WARN_ON_ONCE(), and this uses a BRK, the warning is logged with the real PSTATE at the time of the warning, which clearly has DAIF.I set, meaning IRQs (and pseudo-NMIs) were definitely masked and the warning is spurious. Fix this by selecting TRACE_IRQFLAGS_NMI_SUPPORT such that the existing entry tracking takes effect, as we had originally intended when the arm64 entry code was fixed for transitions to/from NMI. Arguably the lockdep_assert_*() functions should have the same NMI checks as the rest of the code to prevent spurious warnings when TRACE_IRQFLAGS_NMI_SUPPORT is not selected, but the real fix for any architecture is to explicitly handle the transitions to/from NMI in the entry code. Fixes: f0cd5ac1e4c5 ("arm64: entry: fix NMI {user, kernel}->kernel transiti= ons") Signed-off-by: Mark Rutland Cc: Catalin Marinas Cc: Ingo Molnar Cc: Peter Zijlstra (Intel) Cc: Thomas Gleixner Cc: Will Deacon Link: https://lore.kernel.org/r/20220511131733.4074499-3-mark.rutland@arm.c= om Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index b2d5a1e8eda3..54cf6faf339c 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -223,6 +223,7 @@ config ARM64 select THREAD_INFO_IN_TASK select HAVE_ARCH_USERFAULTFD_MINOR if USERFAULTFD select TRACE_IRQFLAGS_SUPPORT + select TRACE_IRQFLAGS_NMI_SUPPORT help ARM 64-bit (AArch64) Linux support. =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCEDFC00140 for ; Mon, 15 Aug 2022 20:34:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243000AbiHOUes (ORCPT ); Mon, 15 Aug 2022 16:34:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347252AbiHOUbD (ORCPT ); Mon, 15 Aug 2022 16:31:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 099EFA4046; Mon, 15 Aug 2022 12:04:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 29256612BE; Mon, 15 Aug 2022 19:04:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31130C433D6; Mon, 15 Aug 2022 19:04:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590262; bh=PPKlFE3ND5uq7QSeTU/xSmPJVmUGIqw1ut9sjre9/U4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O8uJJzgCylHXMs+fhNWBa8Iqed9fKfOt4lAasuUOTqbuPlYbIUZ9jVOVuSkizm0hv KaShFFuO5/vzXEUDR6Gw0RXaTB7AHqb7Ksq06FhoD9GgVNW3wdL1K/XP/0DpTrprBH 2tlPr7C5bBNtUYrhAgseg58Hbl7Fuc2UecnLA2HA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandru Elisei , Will Deacon , Sasha Levin Subject: [PATCH 5.18 0205/1095] arm64: cpufeature: Allow different PMU versions in ID_DFR0_EL1 Date: Mon, 15 Aug 2022 19:53:24 +0200 Message-Id: <20220815180438.150739474@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexandru Elisei [ Upstream commit 506506cad3947b942425b119ffa2b06715d5d804 ] Commit b20d1ba3cf4b ("arm64: cpufeature: allow for version discrepancy in PMU implementations") made it possible to run Linux on a machine with PMUs with different versions without tainting the kernel. The patch relaxed the restriction only for the ID_AA64DFR0_EL1.PMUVer field, and missed doing the same for ID_DFR0_EL1.PerfMon , which also reports the PMU version, but for the AArch32 state. For example, with Linux running on two clusters with different PMU versions, the kernel is tainted when bringing up secondaries with the following message: [ 0.097027] smp: Bringing up secondary CPUs ... [..] [ 0.142805] Detected PIPT I-cache on CPU4 [ 0.142805] CPU features: SANITY CHECK: Unexpected variation in SYS_ID_D= FR0_EL1. Boot CPU: 0x00000004011088, CPU4: 0x00000005011088 [ 0.143555] CPU features: Unsupported CPU feature variation detected. [ 0.143702] GICv3: CPU4: found redistributor 10000 region 0:0x000000002f= 180000 [ 0.143702] GICv3: CPU4: using allocated LPI pending table @0x0000000880= 0d0000 [ 0.144888] CPU4: Booted secondary processor 0x0000010000 [0x410fd0f0] The boot CPU implements FEAT_PMUv3p1 (ID_DFR0_EL1.PerfMon, bits 27:24, is 0b0100), but CPU4, part of the other cluster, implements FEAT_PMUv3p4 (ID_DFR0_EL1.PerfMon =3D 0b0101). Treat the PerfMon field as FTR_NONSTRICT and FTR_EXACT to pass the sanity check and to match how PMUVer is treated for the 64bit ID register. Fixes: b20d1ba3cf4b ("arm64: cpufeature: allow for version discrepancy in P= MU implementations") Signed-off-by: Alexandru Elisei Link: https://lore.kernel.org/r/20220617111332.203061-1-alexandru.elisei@ar= m.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/kernel/cpufeature.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 5357ba7ea3c7..a54f34aa36e0 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -541,7 +541,7 @@ static const struct arm64_ftr_bits ftr_id_pfr2[] =3D { =20 static const struct arm64_ftr_bits ftr_id_dfr0[] =3D { /* [31:28] TraceFilt */ - S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_DFR0_PERFMON_= SHIFT, 4, 0xf), + S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_EXACT, ID_DFR0_PERFMON_SH= IFT, 4, 0), ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_DFR0_MPROFDBG_S= HIFT, 4, 0), ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_DFR0_MMAPTRC_SH= IFT, 4, 0), ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_DFR0_COPTRC_SHI= FT, 4, 0), --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BADB1C25B08 for ; Mon, 15 Aug 2022 20:34:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345999AbiHOUeh (ORCPT ); Mon, 15 Aug 2022 16:34:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347148AbiHOUbC (ORCPT ); Mon, 15 Aug 2022 16:31:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF985A4B08; Mon, 15 Aug 2022 12:04:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D4B8DB8110B; Mon, 15 Aug 2022 19:04:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 162A8C43143; Mon, 15 Aug 2022 19:04:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590265; bh=rx8tBdlS4PuAi21PIO2gDMc5pLYpRji2eOvSJm4wlIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z/m7xuqwdVqt/GuWUUdrckuIKkmB+39e+szujyx1l/o5mZQVZrYvIn+Ov6kLjOMhT Ed3VetFhJMeGmno86DzdCpqsG5rKHLTGRtCVJgVFmpeZSp8povM586lEzl+oo7vIMF IhJ/jZRmqidqHACHBWsTmer7cIw2NytPqXZsYwGg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.18 0206/1095] locking/lockdep: Fix lockdep_init_map_*() confusion Date: Mon, 15 Aug 2022 19:53:25 +0200 Message-Id: <20220815180438.193194149@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Zijlstra [ Upstream commit eae6d58d67d9739be5f7ae2dbead1d0ef6528243 ] Commit dfd5e3f5fe27 ("locking/lockdep: Mark local_lock_t") added yet another lockdep_init_map_*() variant, but forgot to update all the existing users of the most complicated version. This could lead to a loss of lock_type and hence an incorrect report. Given the relative rarity of both local_lock and these annotations, this is unlikely to happen in practise, still, best fix things. Fixes: dfd5e3f5fe27 ("locking/lockdep: Mark local_lock_t") Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/YqyEDtoan20K0CVD@worktop.programming.kicks-= ass.net Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/lockdep.h | 30 +++++++++++++++++------------- kernel/locking/lockdep.c | 7 ++++--- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 467b94257105..0a9afe84ea44 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h @@ -192,7 +192,7 @@ static inline void lockdep_init_map_waits(struct lockdep_map *lock, const char *name, struct lock_class_key *key, int subclass, u8 inner, u8 outer) { - lockdep_init_map_type(lock, name, key, subclass, inner, LD_WAIT_INV, LD_L= OCK_NORMAL); + lockdep_init_map_type(lock, name, key, subclass, inner, outer, LD_LOCK_NO= RMAL); } =20 static inline void @@ -215,24 +215,28 @@ static inline void lockdep_init_map(struct lockdep_ma= p *lock, const char *name, * or they are too narrow (they suffer from a false class-split): */ #define lockdep_set_class(lock, key) \ - lockdep_init_map_waits(&(lock)->dep_map, #key, key, 0, \ - (lock)->dep_map.wait_type_inner, \ - (lock)->dep_map.wait_type_outer) + lockdep_init_map_type(&(lock)->dep_map, #key, key, 0, \ + (lock)->dep_map.wait_type_inner, \ + (lock)->dep_map.wait_type_outer, \ + (lock)->dep_map.lock_type) =20 #define lockdep_set_class_and_name(lock, key, name) \ - lockdep_init_map_waits(&(lock)->dep_map, name, key, 0, \ - (lock)->dep_map.wait_type_inner, \ - (lock)->dep_map.wait_type_outer) + lockdep_init_map_type(&(lock)->dep_map, name, key, 0, \ + (lock)->dep_map.wait_type_inner, \ + (lock)->dep_map.wait_type_outer, \ + (lock)->dep_map.lock_type) =20 #define lockdep_set_class_and_subclass(lock, key, sub) \ - lockdep_init_map_waits(&(lock)->dep_map, #key, key, sub,\ - (lock)->dep_map.wait_type_inner, \ - (lock)->dep_map.wait_type_outer) + lockdep_init_map_type(&(lock)->dep_map, #key, key, sub, \ + (lock)->dep_map.wait_type_inner, \ + (lock)->dep_map.wait_type_outer, \ + (lock)->dep_map.lock_type) =20 #define lockdep_set_subclass(lock, sub) \ - lockdep_init_map_waits(&(lock)->dep_map, #lock, (lock)->dep_map.key, sub,\ - (lock)->dep_map.wait_type_inner, \ - (lock)->dep_map.wait_type_outer) + lockdep_init_map_type(&(lock)->dep_map, #lock, (lock)->dep_map.key, sub,\ + (lock)->dep_map.wait_type_inner, \ + (lock)->dep_map.wait_type_outer, \ + (lock)->dep_map.lock_type) =20 #define lockdep_set_novalidate_class(lock) \ lockdep_set_class_and_name(lock, &__lockdep_no_validate__, #lock) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index c06cab6546ed..e45ec82b42e6 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -5214,9 +5214,10 @@ __lock_set_class(struct lockdep_map *lock, const cha= r *name, return 0; } =20 - lockdep_init_map_waits(lock, name, key, 0, - lock->wait_type_inner, - lock->wait_type_outer); + lockdep_init_map_type(lock, name, key, 0, + lock->wait_type_inner, + lock->wait_type_outer, + lock->lock_type); class =3D register_lock_class(lock, subclass, 0); hlock->class_idx =3D class - lock_classes; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B59B2C00140 for ; Mon, 15 Aug 2022 20:35:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346051AbiHOUe7 (ORCPT ); Mon, 15 Aug 2022 16:34:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347318AbiHOUbG (ORCPT ); Mon, 15 Aug 2022 16:31:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77FB2A1D23; Mon, 15 Aug 2022 12:04:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D768C612A4; Mon, 15 Aug 2022 19:04:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A32D9C433D6; Mon, 15 Aug 2022 19:04:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590269; bh=prdicVcGBktfTngTfkb87k4cnTgWtyIR05o+Efpp1WQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qecz8u3/wRWQQDZb4QRSbHXA+sSpNoA3ex7kTjZ2TDr10+GyJvKwv+FhW3hrOpI9I b4b91jfUSiMeVJ6HkDXCS6WkSkmFLNkN2sRsuB+xJwgG/DLbvwmfW67nSYrhkjIdwJ /+MU+sOhiXhQaweiNtB1N24Aj3rwRd1I1mHYb+6E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Elder , Matthias Kaehlcke , Stephen Boyd , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0207/1095] arm64: dts: qcom: sc7180: Remove ipa_fw_mem node on trogdor Date: Mon, 15 Aug 2022 19:53:26 +0200 Message-Id: <20220815180438.233795321@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephen Boyd [ Upstream commit e60414644cf3a703e10ed4429c15263095945ffe ] We don't use this carveout on trogdor boards, and having it defined in the sc7180 SoC file causes an overlap message to be printed at boot. OF: reserved mem: OVERLAP DETECTED! memory@86000000 (0x0000000086000000--0x000000008ec00000) overlaps with mem= ory@8b700000 (0x000000008b700000--0x000000008b710000) Delete the node in the trogdor dtsi file to fix the overlap problem and remove the error message. Cc: Alex Elder Cc: Matthias Kaehlcke Fixes: 310b266655a3 ("arm64: dts: qcom: sc7180: define ipa_fw_mem node") Signed-off-by: Stephen Boyd Reviewed-by: Alex Elder Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220517193307.3034602-1-swboyd@chromium.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot= /dts/qcom/sc7180-trogdor.dtsi index 732e1181af48..262224504921 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi @@ -42,6 +42,7 @@ charger-crit { */ =20 /delete-node/ &hyp_mem; +/delete-node/ &ipa_fw_mem; /delete-node/ &xbl_mem; /delete-node/ &aop_mem; /delete-node/ &sec_apps_mem; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 099FCC00140 for ; Mon, 15 Aug 2022 20:35:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345340AbiHOUfE (ORCPT ); Mon, 15 Aug 2022 16:35:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347540AbiHOUbU (ORCPT ); Mon, 15 Aug 2022 16:31:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7AE1A50ED; Mon, 15 Aug 2022 12:04:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 62269612B5; Mon, 15 Aug 2022 19:04:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A98EC433D6; Mon, 15 Aug 2022 19:04:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590272; bh=cvYEl2v7R6jrqGqPloGDNravZIBuaPQgB2qMj5zfhmM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PZgu3G2vag+bSn9TX29XUVCUWCJPZVjC/UrC3xynzutRnHjOS/WJIFNYDcOh3cCJy ukqAMU67Wzc1FflQIYe2nLUM85I6gYkBdSqRljC6t6pEe+7lfYRv8VPO6kp0Pt49tM CaVjJsEmCGOqW+r3XBPXZl+0819bcgMGSdNQnfhE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Arnd Bergmann , Shawn Guo , Sasha Levin Subject: [PATCH 5.18 0208/1095] soc: fsl: guts: machine variable might be unset Date: Mon, 15 Aug 2022 19:53:27 +0200 Message-Id: <20220815180438.273750539@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Walle [ Upstream commit ab3f045774f704c4e7b6a878102f4e9d4ae7bc74 ] If both the model and the compatible properties are missing, then machine will not be set. Initialize it with NULL. Fixes: 34c1c21e94ac ("soc: fsl: fix section mismatch build warnings") Signed-off-by: Michael Walle Acked-by: Arnd Bergmann Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/soc/fsl/guts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c index 5ed2fc1c53a0..be18d46c7b0f 100644 --- a/drivers/soc/fsl/guts.c +++ b/drivers/soc/fsl/guts.c @@ -140,7 +140,7 @@ static int fsl_guts_probe(struct platform_device *pdev) struct device_node *root, *np =3D pdev->dev.of_node; struct device *dev =3D &pdev->dev; const struct fsl_soc_die_attr *soc_die; - const char *machine; + const char *machine =3D NULL; u32 svr; =20 /* Initialize guts */ --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFF44C25B08 for ; Mon, 15 Aug 2022 20:35:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346061AbiHOUfH (ORCPT ); Mon, 15 Aug 2022 16:35:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347635AbiHOUb1 (ORCPT ); Mon, 15 Aug 2022 16:31:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4B28A5988; Mon, 15 Aug 2022 12:04:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 19FC6B8110F; Mon, 15 Aug 2022 19:04:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 765B4C433C1; Mon, 15 Aug 2022 19:04:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590275; bh=2nSJYS2SJ8h0PWkngDu10ZIh+24L5ysWN8ONbY7NjPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QlcczhuTjLluU4it+8dHn4SoKVTCGVqeEjK72ZkIXARBUud/0TR6TGbmA4qSe6R7P c11zP+TXvn+qHzDrxVVObWasRY/ek7JXBT5RuP9fWaGVjuN8FDI1wm4MESokyw4uBH 3qpr+u6zX40SHaGe8cwwFGK3J+vUAWnWI6mRH20U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0209/1095] spi: s3c64xx: constify fsd_spi_port_config Date: Mon, 15 Aug 2022 19:53:28 +0200 Message-Id: <20220815180438.314163814@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit a813c47d22b0a0c51567292bc198a39bdcdc3799 ] All struct s3c64xx_spi_port_config should be const. Fixes: 4ebb15a15799 ("spi: s3c64xx: Add spi port configuration for Tesla FS= D SoC") Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220627094541.95166-1-krzysztof.kozlowski@= linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/spi/spi-s3c64xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index c26440e9058d..8fa21afc6a35 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1413,7 +1413,7 @@ static const struct s3c64xx_spi_port_config exynos543= 3_spi_port_config =3D { .quirks =3D S3C64XX_SPI_QUIRK_CS_AUTO, }; =20 -static struct s3c64xx_spi_port_config fsd_spi_port_config =3D { +static const struct s3c64xx_spi_port_config fsd_spi_port_config =3D { .fifo_lvl_mask =3D { 0x7f, 0x7f, 0x7f, 0x7f, 0x7f}, .rx_lvl_offset =3D 15, .tx_st_done =3D 25, --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB8B4C00140 for ; Mon, 15 Aug 2022 20:34:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241832AbiHOUe4 (ORCPT ); Mon, 15 Aug 2022 16:34:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347303AbiHOUbF (ORCPT ); Mon, 15 Aug 2022 16:31:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19BC6A4074; Mon, 15 Aug 2022 12:04:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7AFF0B8110A; Mon, 15 Aug 2022 19:04:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 852F3C433D6; Mon, 15 Aug 2022 19:04:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590279; bh=eSCLQPm4JrorGQH+yAQyQacLZ20uAQNUTy1284zWgFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2Md58umynxB6QaJ6PZPZO/olk7rEyh6KkuTBWoujwiGt9QDHtG8qtpJ70DGpZJyj5 RkIGYZgtKzvSrDgyXkPpcSraOuUAE3G/V0bOQSfbrrx8I/vtYK3QOAE8593FMpJZkx R15exNKP36d2rygbnPyMT8G/J2qpssi0e9xrJQsI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Keith Busch , Damien Le Moal , Christoph Hellwig , Johannes Thumshirn , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 0210/1095] block: fix infinite loop for invalid zone append Date: Mon, 15 Aug 2022 19:53:29 +0200 Message-Id: <20220815180438.357692738@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Keith Busch [ Upstream commit b82d9fa257cb3725c49d94d2aeafc4677c34448a ] Returning 0 early from __bio_iov_append_get_pages() for the max_append_sectors warning just creates an infinite loop since 0 means success, and the bio will never fill from the unadvancing iov_iter. We could turn the return into an error value, but it will already be turned into an error value later on, so just remove the warning. Clearly no one ever hit it anyway. Fixes: 0512a75b98f84 ("block: Introduce REQ_OP_ZONE_APPEND") Signed-off-by: Keith Busch Reviewed-by: Damien Le Moal Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Link: https://lore.kernel.org/r/20220610195830.3574005-2-kbusch@fb.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- block/bio.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/block/bio.c b/block/bio.c index d3ca79c3ebdf..fd73ee03d57e 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1199,9 +1199,6 @@ static int __bio_iov_append_get_pages(struct bio *bio= , struct iov_iter *iter) size_t offset; int ret =3D 0; =20 - if (WARN_ON_ONCE(!max_append_sectors)) - return 0; - /* * Move page array up in the allocated memory for the bio vecs as far as * possible so that we can start filling biovecs from the beginning --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A96FC25B0E for ; Mon, 15 Aug 2022 20:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345594AbiHOUfa (ORCPT ); Mon, 15 Aug 2022 16:35:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347702AbiHOUbg (ORCPT ); Mon, 15 Aug 2022 16:31:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EA6EA5C79; Mon, 15 Aug 2022 12:04:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 549CFB81104; Mon, 15 Aug 2022 19:04:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97BA4C433D6; Mon, 15 Aug 2022 19:04:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590282; bh=tJAnO42wOvjfzA6oc3W60FsYJ9qlzwG5YhKzZ2eZRWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G+4CLn8xKJiMuyGmrP+jK4dMPitMTOUZcxBrdh7NJHxLCRgBXusH8rdTzG7pIXtAS XBGK8g05jNJKIC6U4sYImTenO6Zd5x4gTVw8+wSd41Th3iI1yN8/04XELBre6MyUZq Q23ETHr5Xg/cRud9NMnRqXHHv5paXkb/b8f/OG/o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0211/1095] arm64: dts: qcom: sdm845-akatsuki: Round down l22a regulator voltage Date: Mon, 15 Aug 2022 19:53:30 +0200 Message-Id: <20220815180438.392245088@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marijn Suijten [ Upstream commit 4148a9eeb15152865d60b0913d96beb7ca166f9a ] 2700000 is not a multiple of pmic4_pldo's step size of 8000 (with base voltage 1664000), resulting in pm8998-rpmh-regulators not probing. Just as we did with MSM8998's Sony Yoshino Poplar [1], round the voltages down to err on the cautious side and leave a comment in place to document this discrepancy wrt downstream sources. [1]: https://lore.kernel.org/linux-arm-msm/20220507153627.1478268-1-marijn.= suijten@somainline.org/ Fixes: 30a7f99befc6 ("arm64: dts: qcom: Add support for SONY Xperia XZ2 / X= Z2C / XZ3 (Tama platform)") Signed-off-by: Marijn Suijten Reviewed-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220620211212.269956-1-marijn.suijten@soma= inline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../arm64/boot/dts/qcom/sdm845-sony-xperia-tama-akatsuki.dts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama-akatsuki.dts = b/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama-akatsuki.dts index 8a0d94e7f598..2f5e12deaada 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama-akatsuki.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama-akatsuki.dts @@ -19,8 +19,9 @@ &vreg_l14a_1p8 { }; =20 &vreg_l22a_2p8 { - regulator-min-microvolt =3D <2700000>; - regulator-max-microvolt =3D <2700000>; + /* Note: Round-down from 2700000 to be a multiple of PLDO step-size 8000 = */ + regulator-min-microvolt =3D <2696000>; + regulator-max-microvolt =3D <2696000>; }; =20 &vreg_l28a_2p8 { --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32996C00140 for ; Mon, 15 Aug 2022 20:35:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345682AbiHOUfW (ORCPT ); Mon, 15 Aug 2022 16:35:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347642AbiHOUb2 (ORCPT ); Mon, 15 Aug 2022 16:31:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A2BCA5734; Mon, 15 Aug 2022 12:04:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7835EB81112; Mon, 15 Aug 2022 19:04:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8B7AC433C1; Mon, 15 Aug 2022 19:04:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590285; bh=WhRZyNm85hHAhfQZlv4LwX5x4mHfMx4LZYDSrNaVto8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qwvFnkb5A2Tqb5ONHZ7M6QEexybVTxEzkCi+mDQ5OA+09xPRAlJtEYdimcjg/Gc04 aP7foJ+2r6qE70wMLfwSrJETPFWDaLGGaCqEr6imSjP1McxYtqDeMq1eHAqGjNngvR AUqj4TOcohLvofPDdSItCS3B67lU643fCPSpU4CQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0212/1095] ARM: dts: qcom: mdm9615: add missing PMIC GPIO reg Date: Mon, 15 Aug 2022 19:53:31 +0200 Message-Id: <20220815180438.433247186@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit dc590cdc31f636ea15658f1206c3e380a53fb78e ] 'reg' property is required in SSBI children: qcom-mdm9615-wp8548-mangoh-green.dtb: gpio@150: 'reg' is a required prope= rty Fixes: 2c5e596524e7 ("ARM: dts: Add MDM9615 dtsi") Signed-off-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220507194913.261121-11-krzysztof.kozlowsk= i@linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-mdm9615.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/qcom-mdm9615.dtsi b/arch/arm/boot/dts/qcom-m= dm9615.dtsi index 4d4f37cebf21..96a66862875c 100644 --- a/arch/arm/boot/dts/qcom-mdm9615.dtsi +++ b/arch/arm/boot/dts/qcom-mdm9615.dtsi @@ -321,6 +321,7 @@ rtc@11d { =20 pmicgpio: gpio@150 { compatible =3D "qcom,pm8018-gpio", "qcom,ssbi-gpio"; + reg =3D <0x150>; interrupt-controller; #interrupt-cells =3D <2>; gpio-controller; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94EEFC282E7 for ; Mon, 15 Aug 2022 20:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346266AbiHOUf7 (ORCPT ); Mon, 15 Aug 2022 16:35:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347800AbiHOUbm (ORCPT ); Mon, 15 Aug 2022 16:31:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A036A572B; Mon, 15 Aug 2022 12:04:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E3F26612AB; Mon, 15 Aug 2022 19:04:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5062C4347C; Mon, 15 Aug 2022 19:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590288; bh=ApGZls245OFaL4bZDd2zk1ckQldFOthVbDmUJI6iQH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p9WjxYuK7oxJqqZ28eDeb013dF9ogDS1Q35hO8mrknaZf2J2gUrp3hmPzNV59inR4 lnsGZlosub4fOZabtd/XS54u4aLnMUzbrm4LjIRafeLIqenjNByciNbQtERILCVzKs hQCJXjpJWoIacuEzvq4OaRSscrOeNZTPj1eFMfRQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Laurent Pinchart , Tony Lindgren , Sasha Levin Subject: [PATCH 5.18 0213/1095] ARM: OMAP2+: Fix refcount leak in omapdss_init_of Date: Mon, 15 Aug 2022 19:53:32 +0200 Message-Id: <20220815180438.480345517@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 9705db1eff38d6b9114121f9e253746199b759c9 ] omapdss_find_dss_of_node() calls of_find_compatible_node() to get device node. of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() in later error path and normal path. Fixes: e0c827aca0730 ("drm/omap: Populate DSS children in omapdss driver") Signed-off-by: Miaoqian Lin Message-Id: <20220601044858.3352-1-linmq006@gmail.com> Reviewed-by: Laurent Pinchart Signed-off-by: Tony Lindgren Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/mach-omap2/display.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index eb09a25e3b45..8d829f3dafe7 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c @@ -260,11 +260,13 @@ static int __init omapdss_init_of(void) =20 if (!pdev) { pr_err("Unable to find DSS platform device\n"); + of_node_put(node); return -ENODEV; } =20 r =3D of_platform_populate(node, NULL, NULL, &pdev->dev); put_device(&pdev->dev); + of_node_put(node); if (r) { pr_err("Unable to populate DSS submodule devices\n"); return r; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15CE0C00140 for ; Mon, 15 Aug 2022 20:35:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345466AbiHOUfO (ORCPT ); Mon, 15 Aug 2022 16:35:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347639AbiHOUb2 (ORCPT ); Mon, 15 Aug 2022 16:31:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A92FDA5C7D; Mon, 15 Aug 2022 12:04:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 812D1B81106; Mon, 15 Aug 2022 19:04:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9170C433D6; Mon, 15 Aug 2022 19:04:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590291; bh=omZ20BVuFxL1W05Lz9Iqe5y6+N9MFAhSKFKp3+JoWnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LZK8QbIZMS5dVFjm8lxfskJBfEH5meKSNRBrGYppXNvQtX5kYR/Xx47X63DJOwqTR C3Lx2JGLw2VUhxD6eDjYEqPmwxRX5CJYSL/fjPPeRzivxCK3tPhum7pUcpaLZ1R0eT iwHb3i5Y/A0rXEVJ737GNxwKskIgnFB/Mx4yP/Sk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Tony Lindgren , Sasha Levin Subject: [PATCH 5.18 0214/1095] ARM: OMAP2+: Fix refcount leak in omap3xxx_prm_late_init Date: Mon, 15 Aug 2022 19:53:33 +0200 Message-Id: <20220815180438.524821462@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 942228fbf5d4901112178b93d41225be7c0dd9de ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 1e037794f7f0 ("ARM: OMAP3+: PRM: register interrupt information from= DT") Signed-off-by: Miaoqian Lin Message-Id: <20220526073724.21169-1-linmq006@gmail.com> Signed-off-by: Tony Lindgren Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/mach-omap2/prm3xxx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c index 1b442b128569..63e73e9b82bc 100644 --- a/arch/arm/mach-omap2/prm3xxx.c +++ b/arch/arm/mach-omap2/prm3xxx.c @@ -708,6 +708,7 @@ static int omap3xxx_prm_late_init(void) } =20 irq_num =3D of_irq_get(np, 0); + of_node_put(np); if (irq_num =3D=3D -EPROBE_DEFER) return irq_num; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63AFFC3F6B0 for ; Mon, 15 Aug 2022 20:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346172AbiHOUfo (ORCPT ); Mon, 15 Aug 2022 16:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347778AbiHOUbl (ORCPT ); Mon, 15 Aug 2022 16:31:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88ABBA6C20; Mon, 15 Aug 2022 12:04:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 03F17B810A2; Mon, 15 Aug 2022 19:04:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1460EC433D6; Mon, 15 Aug 2022 19:04:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590297; bh=V9Vq7Xk3Jo007gvGsvMAVhk6e7S1ixt7asa34ghvP8Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MqcjCsLtd/IYHjp9fs7wjK8L186vfqlc1b8t9K/Lp5Q+i/KaUeCcXC8YGbY643rXW 2jX467ibJssF5Pxbi0iFRj36WISRDhScWbciTRvJzAyHbE8O9YVrbEMpBTJkv3u/G4 WUZ/NQmLJSouJKZMGFjbEjZbbAjbB3MeHMoe6SLM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Marijn Suijten , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0215/1095] arm64: dts: qcom: sdm630: disable GPU by default Date: Mon, 15 Aug 2022 19:53:34 +0200 Message-Id: <20220815180438.567607283@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Baryshkov [ Upstream commit 1c047919763b4548381d1ab3320af1df66ab83df ] The SoC's device tree file disables gpucc and adreno's SMMU by default. So let's disable the GPU too. Moreover it looks like SMMU might be not usable without additional patches (which means that GPU is unusable too). No board uses GPU at this moment. Fixes: 5cf69dcbec8b ("arm64: dts: qcom: sdm630: Add Adreno 508 GPU configur= ation") Reviewed-by: Konrad Dybcio Reviewed-by: Marijn Suijten Signed-off-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220521202708.1509308-4-dmitry.baryshkov@l= inaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/sdm630.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi b/arch/arm64/boot/dts/qco= m/sdm630.dtsi index 240293592ef9..45eaaa6a4a74 100644 --- a/arch/arm64/boot/dts/qcom/sdm630.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi @@ -1050,6 +1050,8 @@ adreno_gpu: gpu@5000000 { =20 operating-points-v2 =3D <&gpu_sdm630_opp_table>; =20 + status =3D "disabled"; + gpu_sdm630_opp_table: opp-table { compatible =3D "operating-points-v2"; opp-775000000 { --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A684C25B0E for ; Mon, 15 Aug 2022 20:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346126AbiHOUfj (ORCPT ); Mon, 15 Aug 2022 16:35:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347764AbiHOUbj (ORCPT ); Mon, 15 Aug 2022 16:31:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9140A6C04; Mon, 15 Aug 2022 12:05:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 275C6B81106; Mon, 15 Aug 2022 19:05:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57A40C433D6; Mon, 15 Aug 2022 19:05:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590300; bh=zAhGcQE+174dXkLy0fezgwNaPvsON5v/eY9gicyEFrM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zkKvBe2z81FDNED3FD7XAH394GfQ8ejJje9DW51XjyR4perWzTklILO4FU80/Uvfz 0XqJygj1vZa5bz9y+zA5B5FP5kb+O8nrosZw317XNVRI3sLu123HA0bxfMT4l9rd/o vmpNd0bGfdcOaogXT+YamuJtMwxx7B2Z+wuMChVE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Marijn Suijten , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0216/1095] arm64: dts: qcom: sdm630: fix the qusb2phy ref clock Date: Mon, 15 Aug 2022 19:53:35 +0200 Message-Id: <20220815180438.607999707@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Baryshkov [ Upstream commit 924bbd8dd60e094344711c3526a5b308d71dc008 ] According to the downstram DT file, the qusb2phy ref clock should be GCC_RX0_USB2_CLKREF_CLK, not GCC_RX1_USB2_CLKREF_CLK. Fixes: c65a4ed2ea8b ("arm64: dts: qcom: sdm630: Add USB configuration") Cc: Konrad Dybcio Reviewed-by: Konrad Dybcio Reviewed-by: Marijn Suijten Signed-off-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220521202708.1509308-5-dmitry.baryshkov@l= inaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/sdm630.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi b/arch/arm64/boot/dts/qco= m/sdm630.dtsi index 45eaaa6a4a74..984d212edae6 100644 --- a/arch/arm64/boot/dts/qcom/sdm630.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi @@ -1262,7 +1262,7 @@ qusb2phy: phy@c012000 { #phy-cells =3D <0>; =20 clocks =3D <&gcc GCC_USB_PHY_CFG_AHB2PHY_CLK>, - <&gcc GCC_RX1_USB2_CLKREF_CLK>; + <&gcc GCC_RX0_USB2_CLKREF_CLK>; clock-names =3D "cfg_ahb", "ref"; =20 resets =3D <&gcc GCC_QUSB2PHY_PRIM_BCR>; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8079AC25B08 for ; Mon, 15 Aug 2022 20:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346218AbiHOUft (ORCPT ); Mon, 15 Aug 2022 16:35:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347791AbiHOUbl (ORCPT ); Mon, 15 Aug 2022 16:31:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3622A74EA; Mon, 15 Aug 2022 12:05:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 78C8661299; Mon, 15 Aug 2022 19:05:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AB54C433D6; Mon, 15 Aug 2022 19:05:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590303; bh=QyjuRD1UJMTWHuxFByIUrxNrZbfWZm1mYHX3oaNQ10Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wb5YNuzOndses23cxcbpScLGmWsG9dWrloBbTdlgLl9mLH3ucLP32Pkz26F0ctAnZ mEK6M5pJWq/A/WcR67nNuap4YDhjfG5jUZBqzfNf6si9FqYHnSdqnBjHIe/Dk9Ej++ m+SY/hZZlRzprx4m3L4j5VQhFTtC+Tns304NmVcE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0217/1095] arm64: dts: qcom: sdm630: fix gpus interconnect path Date: Mon, 15 Aug 2022 19:53:36 +0200 Message-Id: <20220815180438.656300926@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Baryshkov [ Upstream commit 3cd1c4f41d64a40ea6bc4575ae28e37542123d77 ] ICC path for the GPU incorrectly states <&gnoc 1 &bimc 5>, which is a path from SLAVE_GNOC_BIMC to SLAVE_EBI. According to the downstream kernel sources, the GPU uses MASTER_OXILI here, which is equivalent to <&bimc 1 ...>. While we are at it, use defined names instead of the numbers for this interconnect path. Fixes: 5cf69dcbec8b ("arm64: dts: qcom: sdm630: Add Adreno 508 GPU configur= ation") Reported-by: Marijn Suijten Reviewed-by: Marijn Suijten Signed-off-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220521202708.1509308-8-dmitry.baryshkov@l= inaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/sdm630.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi b/arch/arm64/boot/dts/qco= m/sdm630.dtsi index 984d212edae6..a33638a1cb44 100644 --- a/arch/arm64/boot/dts/qcom/sdm630.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -1045,7 +1046,7 @@ adreno_gpu: gpu@5000000 { nvmem-cells =3D <&gpu_speed_bin>; nvmem-cell-names =3D "speed_bin"; =20 - interconnects =3D <&gnoc 1 &bimc 5>; + interconnects =3D <&bimc MASTER_OXILI &bimc SLAVE_EBI>; interconnect-names =3D "gfx-mem"; =20 operating-points-v2 =3D <&gpu_sdm630_opp_table>; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAE56C28B2C for ; Mon, 15 Aug 2022 20:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346323AbiHOUgE (ORCPT ); Mon, 15 Aug 2022 16:36:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348035AbiHOUb6 (ORCPT ); Mon, 15 Aug 2022 16:31:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02D23A8320; Mon, 15 Aug 2022 12:05:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 659BF612B7; Mon, 15 Aug 2022 19:05:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6800CC433D6; Mon, 15 Aug 2022 19:05:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590306; bh=wvNzw7DQdnhF+QKs3givu5smwTEe8WsQIiupZFUE5UM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xLu2xeZ7JTffgJzqhTpWagkgb4uiIuWrjWZo8E8KkrApvAwvoLYieW+QZQyNzH+Hr keSAFDfv4hUq1kz6OngpD23bYEMEiMioLavAeE/smh7Mu8pEOswHkSsuF2ZNsz4g+Y ZDRzgRhYvnjdO6ffP1St/XRhIjxTYiAFjHdKD5Ck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Dmitry Baryshkov , Marijn Suijten , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0218/1095] arm64: dts: qcom: sdm636-sony-xperia-ganges-mermaid: correct sdc2 pinconf Date: Mon, 15 Aug 2022 19:53:37 +0200 Message-Id: <20220815180438.699410254@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Baryshkov [ Upstream commit 3a04cec9cba393abfe70fc62e523f381c9baec2e ] Fix the device tree node in the &sdc2_state_on override. The sdm630 uses 'clk' rather than 'pinconf-clk'. Fixes: 4c1d849ec047 ("arm64: dts: qcom: sdm630-xperia: Retire sdm630-sony-x= peria-ganges.dtsi") Reviewed-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov Reviewed-by: Marijn Suijten Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220521202708.1509308-9-dmitry.baryshkov@l= inaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/sdm636-sony-xperia-ganges-mermaid.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sdm636-sony-xperia-ganges-mermaid.dts= b/arch/arm64/boot/dts/qcom/sdm636-sony-xperia-ganges-mermaid.dts index b96da53f2f1e..58f687fc49e0 100644 --- a/arch/arm64/boot/dts/qcom/sdm636-sony-xperia-ganges-mermaid.dts +++ b/arch/arm64/boot/dts/qcom/sdm636-sony-xperia-ganges-mermaid.dts @@ -19,7 +19,7 @@ / { }; =20 &sdc2_state_on { - pinconf-clk { + clk { drive-strength =3D <14>; }; }; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5EE8C2BB43 for ; Mon, 15 Aug 2022 20:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346488AbiHOUgO (ORCPT ); Mon, 15 Aug 2022 16:36:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348083AbiHOUcE (ORCPT ); Mon, 15 Aug 2022 16:32:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61374A8CC1; Mon, 15 Aug 2022 12:05:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 90549612BF; Mon, 15 Aug 2022 19:05:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93BACC433D6; Mon, 15 Aug 2022 19:05:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590311; bh=14BO3jFRo9LTUBo+dV5YyJ4Ptn7JKSUmnCiFGI1LRj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pduex8hPIBc+hnb9rJ9Y6N/TfN7l5SgexSyu3v2/bZcPj5pQ4VptcjRvXvwEm3V64 m9WO3mIbogD880TOqxcDn59NyTXBDowxBc0XHIei9spYP3iloPulP9+GFUOvfVeLI3 jIAH4PvGXqZuj/VgT9MxiRRuYLToqtEtdSkQFJtQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Michal Simek , Sasha Levin Subject: [PATCH 5.18 0219/1095] cpufreq: zynq: Fix refcount leak in zynq_get_revision Date: Mon, 15 Aug 2022 19:53:38 +0200 Message-Id: <20220815180438.748623275@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit d1ff2559cef0f6f8d97fba6337b28adb10689e16 ] of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes: 00f7dc636366 ("ARM: zynq: Add support for SOC_BUS") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220605082807.21526-1-linmq006@gmail.com Signed-off-by: Michal Simek Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/mach-zynq/common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index e1ca6a5732d2..15e8a321a713 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c @@ -77,6 +77,7 @@ static int __init zynq_get_revision(void) } =20 zynq_devcfg_base =3D of_iomap(np, 0); + of_node_put(np); if (!zynq_devcfg_base) { pr_err("%s: Unable to map I/O memory\n", __func__); return -1; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D201C00140 for ; Mon, 15 Aug 2022 20:37:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344520AbiHOUhH (ORCPT ); Mon, 15 Aug 2022 16:37:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348180AbiHOUcN (ORCPT ); Mon, 15 Aug 2022 16:32:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BA891015; Mon, 15 Aug 2022 12:05:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 376A7B81104; Mon, 15 Aug 2022 19:05:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D75CC433C1; Mon, 15 Aug 2022 19:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590313; bh=LxLBhQg37nYyCKF7FOM1vntAWlZt+MmydoeTWUDvHYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HieGVS6sktLbQfY94dALI/vrmfdm2NIJZtkDP2V4+qXIH2e9DM8DZz6GdSqM9ITPC eC06TQAwDipl/06vPsEdooV4OBAvFb4cHEahlg3u1ngrUIVTkjGVT0/MUk28W/cm5v Ty7L9xw72f6n7q1jlaa7w57tMHcVE37NdhwSVZjU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.18 0220/1095] arm64: dts: renesas: r8a779m8: Drop operating points above 1.5 GHz Date: Mon, 15 Aug 2022 19:53:39 +0200 Message-Id: <20220815180438.789946180@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Geert Uytterhoeven [ Upstream commit f48cb21a28c07d0754d5f2f85444cfb0e7b1fd05 ] The highest-performance mode for the Cortex-A57 CPU cores supported on R-Car H3Ne (R8A779M8) is the Power Optimized (1.5 GHz) mode. The Normal (1.6 GHz) and High Performance (1.7 GHz) modes are not supported. Hence drop the "turbo-mode" entries from the operating points table inherited from r8a77951.dtsi. Fixes: 6e87525d751fac57 ("arm64: dts: renesas: Add Renesas R8A779M8 SoC sup= port") Signed-off-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/aeb4530f7fbac8329b334dcb169382c836a5f32d.16= 55458564.git.geert+renesas@glider.be Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/renesas/r8a779m8.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/r8a779m8.dtsi b/arch/arm64/boot/dt= s/renesas/r8a779m8.dtsi index 752440b0c40f..750bd8ccdb7f 100644 --- a/arch/arm64/boot/dts/renesas/r8a779m8.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a779m8.dtsi @@ -10,3 +10,8 @@ / { compatible =3D "renesas,r8a779m8", "renesas,r8a7795"; }; + +&cluster0_opp { + /delete-node/ opp-1600000000; + /delete-node/ opp-1700000000; +}; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C09CEC28B2B for ; Mon, 15 Aug 2022 20:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346403AbiHOUgK (ORCPT ); Mon, 15 Aug 2022 16:36:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348096AbiHOUcE (ORCPT ); Mon, 15 Aug 2022 16:32:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 912B2EB8; Mon, 15 Aug 2022 12:05:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6793961299; Mon, 15 Aug 2022 19:05:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B367C433D7; Mon, 15 Aug 2022 19:05:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590316; bh=2pSFY/81R6SrMGfluQH+FRx7TgY2KjA23kBWHzmQv9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0RUiJqjW2Z4ezP2C4bmc5hSgfQwciCQjL2vPe//S8LMtZUB2qqgDhKr3JJ/ibFEQF L3OAqeYgWmeRngzK4UzAZI3CnhV0tj9lk9x3aYpWcH3AJelqEMzizQffhEwFqbrxtj QZVcHdW40jVawNyqaAqgIWmUiFvbC6pUmNQbnfzE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Paterson , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.18 0221/1095] arm64: dts: renesas: r9a07g054l2-smarc: Correct SoC name in comment Date: Mon, 15 Aug 2022 19:53:40 +0200 Message-Id: <20220815180438.841539077@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chris Paterson [ Upstream commit d1273f541ab409242e08da6bb836bb564021274c ] This dts is for the RZ/V2L SMARC EVK, not RZ/G2L. Fixes: f91c4c74796a ("arm64: dts: renesas: Add initial device tree for RZ/V= 2L SMARC EVK") Signed-off-by: Chris Paterson Link: https://lore.kernel.org/r/20220623103024.24222-1-chris.paterson2@rene= sas.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/renesas/r9a07g054l2-smarc.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/renesas/r9a07g054l2-smarc.dts b/arch/arm64= /boot/dts/renesas/r9a07g054l2-smarc.dts index fc334b4c2aa4..d2848cbfc6c0 100644 --- a/arch/arm64/boot/dts/renesas/r9a07g054l2-smarc.dts +++ b/arch/arm64/boot/dts/renesas/r9a07g054l2-smarc.dts @@ -1,6 +1,6 @@ // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /* - * Device Tree Source for the RZ/G2L SMARC EVK board + * Device Tree Source for the RZ/V2L SMARC EVK board * * Copyright (C) 2021 Renesas Electronics Corp. */ --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9BD0C3F6B0 for ; Mon, 15 Aug 2022 20:37:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344597AbiHOUhB (ORCPT ); Mon, 15 Aug 2022 16:37:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348109AbiHOUcF (ORCPT ); Mon, 15 Aug 2022 16:32:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78AC1630F; Mon, 15 Aug 2022 12:05:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5D56A612B7; Mon, 15 Aug 2022 19:05:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AEE5C4347C; Mon, 15 Aug 2022 19:05:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590319; bh=7IMHkxpzJbEEqhpqqBwGUo4MxQIucpgcfS9/3YmKOdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tcZcVZI4It8DtRUgSkMw9a2Ph8Vnal9M7cE+PDe52gF57uaSRqgh+pzrHoWwK7D25 Uww1bHog+ZOx5S2p/ngTivxskuCr/c1gAXzrUiTvLl0IWjUIgPwjXXDqa+bSfKKvyh JONZb0zHmc6jvjWBhhkPWwZErnQcyXoy4/69E6Zo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephan Gerhold , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0222/1095] regulator: qcom_smd: Fix pm8916_pldo range Date: Mon, 15 Aug 2022 19:53:41 +0200 Message-Id: <20220815180438.891101034@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephan Gerhold [ Upstream commit e8977917e116d1571dacb8e9864474551c1c12bd ] The PM8916 device specification [1] documents a programmable range of 1.75V to 3.337V with 12.5mV steps for the PMOS LDOs in PM8916. This range is also used when controlling the regulator directly using the qcom_spmi-regulator driver ("ult_pldo" there). However, for some reason the qcom_smd-regulator driver allows a much larger range for the same hardware component. This could be simply a typo, since the start of the range is essentially just missing a '1'. In practice this does not cause any major problems, since the driver just sends the actual voltage to the RPM firmware instead of making use of the incorrect voltage selector. Still, having the wrong range there is confusing and prevents the regulator core from validating requests correctly. [1]: https://developer.qualcomm.com/download/sd410/pm8916pm8916-1-power-man= agement-ic-device-specification.pdf Fixes: 57d6567680ed ("regulator: qcom-smd: Add PM8916 support") Signed-off-by: Stephan Gerhold Link: https://lore.kernel.org/r/20220623094614.1410180-2-stephan.gerhold@ke= rnkonzept.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/regulator/qcom_smd-regulator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qco= m_smd-regulator.c index 7dff94a2eb7e..0af8286e1b10 100644 --- a/drivers/regulator/qcom_smd-regulator.c +++ b/drivers/regulator/qcom_smd-regulator.c @@ -357,10 +357,10 @@ static const struct regulator_desc pm8941_switch =3D { =20 static const struct regulator_desc pm8916_pldo =3D { .linear_ranges =3D (struct linear_range[]) { - REGULATOR_LINEAR_RANGE(750000, 0, 208, 12500), + REGULATOR_LINEAR_RANGE(1750000, 0, 127, 12500), }, .n_linear_ranges =3D 1, - .n_voltages =3D 209, + .n_voltages =3D 128, .ops =3D &rpm_smps_ldo_ops, }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CC26C25B0E for ; Mon, 15 Aug 2022 20:37:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345652AbiHOUhV (ORCPT ); Mon, 15 Aug 2022 16:37:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348270AbiHOUcY (ORCPT ); Mon, 15 Aug 2022 16:32:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32A8ABF69; Mon, 15 Aug 2022 12:05:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D9CB3B81107; Mon, 15 Aug 2022 19:05:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 386C7C433D7; Mon, 15 Aug 2022 19:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590322; bh=K+svWRMsaEDa8GRYueGfU8Qrf+A3W7XHXheGz2uplTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y7dEWDRUUGy+bmQgZpEBs3dCusKhE5TNigGbss5QawP/LF9lJu0iQvheGH+1drxfH 0dmHUq1T+/1jRl/v+HJ3vR6ADeUHkoCOdHNmFpuhRTRuwlEg6YlPnBn1BsKEi2i45z x1vEjwj/Iq594w3KUu845z56yxiW8vOkjJgD3Zl0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tony Luck , Omar Avelar , Dan Williams , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 0223/1095] ACPI: APEI: Fix _EINJ vs EFI_MEMORY_SP Date: Mon, 15 Aug 2022 19:53:42 +0200 Message-Id: <20220815180438.934104323@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Williams [ Upstream commit b13a3e5fd40b7d1b394c5ecbb5eb301a4c38e7b2 ] When a platform marks a memory range as "special purpose" it is not onlined as System RAM by default. However, it is still suitable for error injection. Add IORES_DESC_SOFT_RESERVED to einj_error_inject() as a permissible memory type in the sanity checking of the arguments to _EINJ. Fixes: 262b45ae3ab4 ("x86/efi: EFI soft reservation to E820 enumeration") Reviewed-by: Tony Luck Reported-by: Omar Avelar Signed-off-by: Dan Williams Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/acpi/apei/einj.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 95cc2a9f3e05..49b5e317e916 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c @@ -546,6 +546,8 @@ static int einj_error_inject(u32 type, u32 flags, u64 p= aram1, u64 param2, !=3D REGION_INTERSECTS) && (region_intersects(base_addr, size, IORESOURCE_MEM, IORES_DESC_PERSI= STENT_MEMORY) !=3D REGION_INTERSECTS) && + (region_intersects(base_addr, size, IORESOURCE_MEM, IORES_DESC_SOFT_= RESERVED) + !=3D REGION_INTERSECTS) && !arch_is_platform_page(base_addr))) return -EINVAL; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F5BDC282E7 for ; Mon, 15 Aug 2022 20:37:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345486AbiHOUhN (ORCPT ); Mon, 15 Aug 2022 16:37:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348212AbiHOUcQ (ORCPT ); Mon, 15 Aug 2022 16:32:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B33D1DE84; Mon, 15 Aug 2022 12:05:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A167D612A0; Mon, 15 Aug 2022 19:05:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39C6BC433D6; Mon, 15 Aug 2022 19:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590326; bh=fYTU3xAkuYp+4+IwVoxMutIUJZyFE1eNTQZJ3+lhDbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aGuRQudkWTYkRJJNrn7rvmsXGA+u7z4CyHO6SKW/wn/tMHjTFVLEwoND3eyowNIbO V07WtAEyOorhyKT3ovLbRERog7M2KrSYGEMbU0Prth+qrVGqDRCdugSPhNUdfn9dX3 0osvhTMJN5/0js4oarHyoMQAiWp/GTg6zLr5Tx2I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0224/1095] ARM: dts: qcom: msm8974-lge-nexus5: move gpio-keys out of soc Date: Mon, 15 Aug 2022 19:53:43 +0200 Message-Id: <20220815180438.967772592@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit d3eff0e174e5feecb8f45cf630a30f47f02f921c ] The GPIO keys are not part of SoC and they should be defined inside of the root node. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220401201035.189106-5-krzysztof.kozlowski= @linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../qcom-msm8974-lge-nexus5-hammerhead.dts | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts b/arc= h/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts index 069136170198..6d5fb60e798f 100644 --- a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts +++ b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts @@ -19,6 +19,27 @@ chosen { stdout-path =3D "serial0:115200n8"; }; =20 + gpio-keys { + compatible =3D "gpio-keys"; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&gpio_keys_pin_a>; + + volume-up { + label =3D "volume_up"; + gpios =3D <&pm8941_gpios 2 GPIO_ACTIVE_LOW>; + linux,input-type =3D <1>; + linux,code =3D ; + }; + + volume-down { + label =3D "volume_down"; + gpios =3D <&pm8941_gpios 3 GPIO_ACTIVE_LOW>; + linux,input-type =3D <1>; + linux,code =3D ; + }; + }; + smd { rpm { rpm_requests { @@ -448,27 +469,6 @@ bcrmf@1 { }; }; =20 - gpio-keys { - compatible =3D "gpio-keys"; - - pinctrl-names =3D "default"; - pinctrl-0 =3D <&gpio_keys_pin_a>; - - volume-up { - label =3D "volume_up"; - gpios =3D <&pm8941_gpios 2 GPIO_ACTIVE_LOW>; - linux,input-type =3D <1>; - linux,code =3D ; - }; - - volume-down { - label =3D "volume_down"; - gpios =3D <&pm8941_gpios 3 GPIO_ACTIVE_LOW>; - linux,input-type =3D <1>; - linux,code =3D ; - }; - }; - serial@f9960000 { status =3D "okay"; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7461C25B08 for ; Mon, 15 Aug 2022 20:37:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345695AbiHOUhk (ORCPT ); Mon, 15 Aug 2022 16:37:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348271AbiHOUcZ (ORCPT ); Mon, 15 Aug 2022 16:32:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1E5D3C177; Mon, 15 Aug 2022 12:05:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BC98E612A0; Mon, 15 Aug 2022 19:05:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD08DC433D6; Mon, 15 Aug 2022 19:05:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590332; bh=8vSjHVpVmaE8n11iZ1ypcPCHI5yaSqylemBc/YbUFbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gsB5Ok1o9mAPDRy+ovbLb0S4NgCM21trbBgwieVkOXkNqogn2TJJNFp8qK9jwEQso xejfHRN8sDsNHY37M6LSQCiognftN8Qj3y0N09H4d79GDzPj6wXx8Wfep3DF0J+t50 aeoQiVxDSG43lV1sr3EhIJlqk/dJgx4jKvIWerSM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0225/1095] ARM: dts: qcom: msm8974-samsung-klte: move gpio-keys out of soc Date: Mon, 15 Aug 2022 19:53:44 +0200 Message-Id: <20220815180439.011443504@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit c19865df6b142276ec4371ad534a1eb6fef5782d ] The GPIO keys are not part of SoC and they should be defined inside of the root node. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220401201035.189106-6-krzysztof.kozlowski= @linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../boot/dts/qcom-msm8974-samsung-klte.dts | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts b/arch/arm/boo= t/dts/qcom-msm8974-samsung-klte.dts index 96e1c978b878..6e036a440532 100644 --- a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +++ b/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts @@ -20,6 +20,38 @@ chosen { stdout-path =3D "serial0:115200n8"; }; =20 + gpio-keys { + compatible =3D "gpio-keys"; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&gpio_keys_pin_a>; + + volume-down { + label =3D "volume_down"; + gpios =3D <&pma8084_gpios 2 GPIO_ACTIVE_LOW>; + linux,input-type =3D <1>; + linux,code =3D ; + debounce-interval =3D <15>; + }; + + home-key { + label =3D "home_key"; + gpios =3D <&pma8084_gpios 3 GPIO_ACTIVE_LOW>; + linux,input-type =3D <1>; + linux,code =3D ; + wakeup-source; + debounce-interval =3D <15>; + }; + + volume-up { + label =3D "volume_up"; + gpios =3D <&pma8084_gpios 5 GPIO_ACTIVE_LOW>; + linux,input-type =3D <1>; + linux,code =3D ; + debounce-interval =3D <15>; + }; + }; + smd { rpm { rpm_requests { @@ -347,38 +379,6 @@ bluetooth { }; }; =20 - gpio-keys { - compatible =3D "gpio-keys"; - - pinctrl-names =3D "default"; - pinctrl-0 =3D <&gpio_keys_pin_a>; - - volume-down { - label =3D "volume_down"; - gpios =3D <&pma8084_gpios 2 GPIO_ACTIVE_LOW>; - linux,input-type =3D <1>; - linux,code =3D ; - debounce-interval =3D <15>; - }; - - home-key { - label =3D "home_key"; - gpios =3D <&pma8084_gpios 3 GPIO_ACTIVE_LOW>; - linux,input-type =3D <1>; - linux,code =3D ; - wakeup-source; - debounce-interval =3D <15>; - }; - - volume-up { - label =3D "volume_up"; - gpios =3D <&pma8084_gpios 5 GPIO_ACTIVE_LOW>; - linux,input-type =3D <1>; - linux,code =3D ; - debounce-interval =3D <15>; - }; - }; - pinctrl@fd510000 { blsp2_uart8_pins_active: blsp2-uart8-pins-active { pins =3D "gpio45", "gpio46", "gpio47", "gpio48"; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6FA2C00140 for ; Mon, 15 Aug 2022 20:38:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345905AbiHOUh6 (ORCPT ); Mon, 15 Aug 2022 16:37:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348291AbiHOUc0 (ORCPT ); Mon, 15 Aug 2022 16:32:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 121125A2EC; Mon, 15 Aug 2022 12:05:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BAC81612AF; Mon, 15 Aug 2022 19:05:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC31DC433C1; Mon, 15 Aug 2022 19:05:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590335; bh=NpP1xSHXN7C1Bjs+TVA9esRLrTXCrQMqK4pxcramw2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c8UV2xKoLPRqnp0eHlKAH4xkktLJ+FWFc6NI3rPoA1dqqgwSEDJ7FT5tknVqI29X8 8/Oo5rLwGIP3kkW7G35LeQ4Tbp4/jAUbMYPXUOu4bLKhlYxWCJepRWqngLFxyWENrl NQVt0QdG4kHawWlT0R3At01fIQTb4LCMte1yXOgA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0226/1095] ARM: dts: qcom: do not use underscore in node name Date: Mon, 15 Aug 2022 19:53:45 +0200 Message-Id: <20220815180439.060686085@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit 43cdc159d203eb6d02b312409e634a3fa06632ac ] Align RPM requests node with DT schema by using hyphen instead of underscore. Signed-off-by: Krzysztof Kozlowski [bjorn: Fixed up qcom-{apq8074,msm8974}-*.dts to match the qcom-msm8974.dts= i] Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220401201035.189106-8-krzysztof.kozlowski= @linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-apq8064.dtsi | 8 ++++---- arch/arm/boot/dts/qcom-apq8074-dragonboard.dts | 2 +- arch/arm/boot/dts/qcom-apq8084.dtsi | 2 +- arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts | 2 +- arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts | 2 +- arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts | 2 +- arch/arm/boot/dts/qcom-msm8974-sony-xperia-amami.dts | 2 +- arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts | 2 +- arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts | 2 +- arch/arm/boot/dts/qcom-msm8974.dtsi | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-a= pq8064.dtsi index a1c8ae516d21..33a4d3441959 100644 --- a/arch/arm/boot/dts/qcom-apq8064.dtsi +++ b/arch/arm/boot/dts/qcom-apq8064.dtsi @@ -227,7 +227,7 @@ smem { smd { compatible =3D "qcom,smd"; =20 - modem@0 { + modem-edge { interrupts =3D <0 37 IRQ_TYPE_EDGE_RISING>; =20 qcom,ipc =3D <&l2cc 8 3>; @@ -236,7 +236,7 @@ modem@0 { status =3D "disabled"; }; =20 - q6@1 { + q6-edge { interrupts =3D <0 90 IRQ_TYPE_EDGE_RISING>; =20 qcom,ipc =3D <&l2cc 8 15>; @@ -245,7 +245,7 @@ q6@1 { status =3D "disabled"; }; =20 - dsps@3 { + dsps-edge { interrupts =3D <0 138 IRQ_TYPE_EDGE_RISING>; =20 qcom,ipc =3D <&sps_sic_non_secure 0x4080 0>; @@ -254,7 +254,7 @@ dsps@3 { status =3D "disabled"; }; =20 - riva@6 { + riva-edge { interrupts =3D <0 198 IRQ_TYPE_EDGE_RISING>; =20 qcom,ipc =3D <&l2cc 8 25>; diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts b/arch/arm/boot= /dts/qcom-apq8074-dragonboard.dts index 83793b835d40..e2b4e4fc6377 100644 --- a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts +++ b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts @@ -147,7 +147,7 @@ eeprom: eeprom@52 { =20 smd { rpm { - rpm_requests { + rpm-requests { pm8841-regulators { s1 { regulator-min-microvolt =3D <675000>; diff --git a/arch/arm/boot/dts/qcom-apq8084.dtsi b/arch/arm/boot/dts/qcom-a= pq8084.dtsi index 52240fc7a1a6..da50a1a0197f 100644 --- a/arch/arm/boot/dts/qcom-apq8084.dtsi +++ b/arch/arm/boot/dts/qcom-apq8084.dtsi @@ -470,7 +470,7 @@ rpm { qcom,ipc =3D <&apcs 8 0>; qcom,smd-edge =3D <15>; =20 - rpm_requests { + rpm-requests { compatible =3D "qcom,rpm-apq8084"; qcom,smd-channels =3D "rpm_requests"; =20 diff --git a/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts b/arch/arm/bo= ot/dts/qcom-msm8974-fairphone-fp2.dts index 6d77e0f8ca4d..9dbfc9f8646a 100644 --- a/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts +++ b/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts @@ -57,7 +57,7 @@ vibrator { =20 smd { rpm { - rpm_requests { + rpm-requests { pm8841-regulators { s1 { regulator-min-microvolt =3D <675000>; diff --git a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts b/arc= h/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts index 6d5fb60e798f..5fbdba73c07f 100644 --- a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts +++ b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts @@ -42,7 +42,7 @@ volume-down { =20 smd { rpm { - rpm_requests { + rpm-requests { pm8841-regulators { s1 { regulator-min-microvolt =3D <675000>; diff --git a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts b/arch/arm/boo= t/dts/qcom-msm8974-samsung-klte.dts index 6e036a440532..1f630120c01f 100644 --- a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +++ b/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts @@ -54,7 +54,7 @@ volume-up { =20 smd { rpm { - rpm_requests { + rpm-requests { pma8084-regulators { compatible =3D "qcom,rpm-pma8084-regulators"; status =3D "okay"; diff --git a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-amami.dts b/arch/ar= m/boot/dts/qcom-msm8974-sony-xperia-amami.dts index 79e2cfbbb1ba..8cace789fb26 100644 --- a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-amami.dts +++ b/arch/arm/boot/dts/qcom-msm8974-sony-xperia-amami.dts @@ -60,7 +60,7 @@ memory@0 { =20 smd { rpm { - rpm_requests { + rpm-requests { pm8841-regulators { s1 { regulator-min-microvolt =3D <675000>; diff --git a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts b/arch/a= rm/boot/dts/qcom-msm8974-sony-xperia-castor.dts index e66937e3f7dd..3c4a7d760ba9 100644 --- a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts +++ b/arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts @@ -55,7 +55,7 @@ volume-up { =20 smd { rpm { - rpm_requests { + rpm-requests { pm8941-regulators { vdd_l1_l3-supply =3D <&pm8941_s1>; vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; diff --git a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts b/arch/a= rm/boot/dts/qcom-msm8974-sony-xperia-honami.dts index a62e5c25b23c..f4a2e2560777 100644 --- a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts +++ b/arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts @@ -60,7 +60,7 @@ memory@0 { =20 smd { rpm { - rpm_requests { + rpm-requests { pm8841-regulators { s1 { regulator-min-microvolt =3D <675000>; diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-m= sm8974.dtsi index 412d94736c35..08497783757a 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -1614,7 +1614,7 @@ rpm { qcom,ipc =3D <&apcs 8 0>; qcom,smd-edge =3D <15>; =20 - rpm_requests { + rpm-requests { compatible =3D "qcom,rpm-msm8974"; qcom,smd-channels =3D "rpm_requests"; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A783C25B08 for ; Mon, 15 Aug 2022 20:38:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345607AbiHOUiH (ORCPT ); Mon, 15 Aug 2022 16:38:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348339AbiHOUcc (ORCPT ); Mon, 15 Aug 2022 16:32:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2FE185FB8; Mon, 15 Aug 2022 12:05:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A931E61281; Mon, 15 Aug 2022 19:05:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0D61C433C1; Mon, 15 Aug 2022 19:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590338; bh=esD0rQV8wZIFlZqYk+UwjZZhg1rXQIzw+OF5KHdrJ2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sGk5T7XgdkORR/MKiY6YNu4s55V8vwKODoa2xiQ9YBqiepJSINJ0gFT8KFeOXZVzB H2sT514gHmQ1SC4opFQnurHBPT0H9Xm0QgbTcyvIpYFZ9jz7nBJ9U8uX0iQFr5WRSr YGmG2vibE3NsvoEALAnMm4G94kItzSCJOtrRqXfM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0227/1095] ARM: dts: qcom-msm8974*: Fix UART naming Date: Mon, 15 Aug 2022 19:53:46 +0200 Message-Id: <20220815180439.107102982@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit b905c34ae7db6b564589f02fa7eac7afaa0294e9 ] It's either uart10, or blsp2_uart4, not blsp2_uart10, as there aren't 10 UARTs on BLSP2. Fix the naming to align with what's done in arm64/qcom. Signed-off-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220415115633.575010-4-konrad.dybcio@somai= nline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts | 6 +++--- arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts | 10 +++++----- arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts | 2 +- arch/arm/boot/dts/qcom-msm8974.dtsi | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts b/arc= h/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts index 5fbdba73c07f..dd2d0647d4be 100644 --- a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts +++ b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts @@ -12,7 +12,7 @@ / { =20 aliases { serial0 =3D &blsp1_uart1; - serial1 =3D &blsp2_uart10; + serial1 =3D &blsp2_uart4; }; =20 chosen { @@ -395,7 +395,7 @@ shutdown { }; }; =20 - blsp2_uart10_pin_a: blsp2-uart10-pin-active { + blsp2_uart4_pin_a: blsp2-uart4-pin-active { tx { pins =3D "gpio53"; function =3D "blsp_uart10"; @@ -473,7 +473,7 @@ serial@f9960000 { status =3D "okay"; =20 pinctrl-names =3D "default"; - pinctrl-0 =3D <&blsp2_uart10_pin_a>; + pinctrl-0 =3D <&blsp2_uart4_pin_a>; =20 bluetooth { compatible =3D "brcm,bcm43438-bt"; diff --git a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts b/arch/arm/boo= t/dts/qcom-msm8974-samsung-klte.dts index 1f630120c01f..95ae30d06554 100644 --- a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +++ b/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts @@ -358,13 +358,13 @@ serial@f991e000 { status =3D "okay"; }; =20 - /* blsp2_uart8 */ + /* blsp2_uart2 */ serial@f995e000 { status =3D "okay"; =20 pinctrl-names =3D "default", "sleep"; - pinctrl-0 =3D <&blsp2_uart8_pins_active>; - pinctrl-1 =3D <&blsp2_uart8_pins_sleep>; + pinctrl-0 =3D <&blsp2_uart2_pins_active>; + pinctrl-1 =3D <&blsp2_uart2_pins_sleep>; =20 bluetooth { compatible =3D "brcm,bcm43540-bt"; @@ -380,14 +380,14 @@ bluetooth { }; =20 pinctrl@fd510000 { - blsp2_uart8_pins_active: blsp2-uart8-pins-active { + blsp2_uart2_pins_active: blsp2-uart2-pins-active { pins =3D "gpio45", "gpio46", "gpio47", "gpio48"; function =3D "blsp_uart8"; drive-strength =3D <8>; bias-disable; }; =20 - blsp2_uart8_pins_sleep: blsp2-uart8-pins-sleep { + blsp2_uart2_pins_sleep: blsp2-uart2-pins-sleep { pins =3D "gpio45", "gpio46", "gpio47", "gpio48"; function =3D "gpio"; drive-strength =3D <2>; diff --git a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts b/arch/a= rm/boot/dts/qcom-msm8974-sony-xperia-castor.dts index 3c4a7d760ba9..e27b360951fd 100644 --- a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts +++ b/arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts @@ -11,7 +11,7 @@ / { =20 aliases { serial0 =3D &blsp1_uart2; - serial1 =3D &blsp2_uart7; + serial1 =3D &blsp2_uart1; }; =20 chosen { diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-m= sm8974.dtsi index 08497783757a..689ddaabf463 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -715,7 +715,7 @@ blsp1_uart2: serial@f991e000 { status =3D "disabled"; }; =20 - blsp2_uart7: serial@f995d000 { + blsp2_uart1: serial@f995d000 { compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; reg =3D <0xf995d000 0x1000>; interrupts =3D ; @@ -724,7 +724,7 @@ blsp2_uart7: serial@f995d000 { status =3D "disabled"; }; =20 - blsp2_uart8: serial@f995e000 { + blsp2_uart2: serial@f995e000 { compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; reg =3D <0xf995e000 0x1000>; interrupts =3D ; @@ -733,7 +733,7 @@ blsp2_uart8: serial@f995e000 { status =3D "disabled"; }; =20 - blsp2_uart10: serial@f9960000 { + blsp2_uart4: serial@f9960000 { compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; reg =3D <0xf9960000 0x1000>; interrupts =3D ; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00CFBC00140 for ; Mon, 15 Aug 2022 20:44:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345753AbiHOUop (ORCPT ); Mon, 15 Aug 2022 16:44:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347181AbiHOUmh (ORCPT ); Mon, 15 Aug 2022 16:42:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C990B2494; Mon, 15 Aug 2022 12:07:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AED4C61281; Mon, 15 Aug 2022 19:07:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4EAAC433D6; Mon, 15 Aug 2022 19:07:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590466; bh=nopleTF8fMQXk8bNd5NGN8KmEIJTFbLHWc4+tjhqO4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q6goLsMqFcY3YuMThpPIa2VHiIThBO3O/LqPhybCa+vPbyElQvZa4QktNq3CMtHDw e2JWFdI8xAF9dWYP6oU04vqzdTorAyU2IfZQX6zmrz/3QHTN7xJHMmmo/R9NRXtzwr i3yzmoW75hXTsU00ml04S9YBxiNYrLE5VHcnV/Yg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0228/1095] ARM: dts: qcom-msm8974*: Fix I2C labels Date: Mon, 15 Aug 2022 19:53:47 +0200 Message-Id: <20220815180439.156592149@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit bb167546d06847a8729c973fe5165a231fd5c39d ] Fix up the label names and add missing ones. Signed-off-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220415115633.575010-5-konrad.dybcio@somai= nline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-msm8974.dtsi | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-m= sm8974.dtsi index 689ddaabf463..6e99903bb5f9 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -959,7 +959,7 @@ msmgpio: pinctrl@fd510000 { interrupts =3D ; }; =20 - i2c@f9923000 { + blsp1_i2c1: i2c@f9923000 { status =3D "disabled"; compatible =3D "qcom,i2c-qup-v2.1.1"; reg =3D <0xf9923000 0x1000>; @@ -970,7 +970,7 @@ i2c@f9923000 { #size-cells =3D <0>; }; =20 - i2c@f9924000 { + blsp1_i2c2: i2c@f9924000 { status =3D "disabled"; compatible =3D "qcom,i2c-qup-v2.1.1"; reg =3D <0xf9924000 0x1000>; @@ -981,7 +981,7 @@ i2c@f9924000 { #size-cells =3D <0>; }; =20 - blsp_i2c3: i2c@f9925000 { + blsp1_i2c3: i2c@f9925000 { status =3D "disabled"; compatible =3D "qcom,i2c-qup-v2.1.1"; reg =3D <0xf9925000 0x1000>; @@ -992,7 +992,7 @@ blsp_i2c3: i2c@f9925000 { #size-cells =3D <0>; }; =20 - blsp_i2c6: i2c@f9928000 { + blsp1_i2c6: i2c@f9928000 { status =3D "disabled"; compatible =3D "qcom,i2c-qup-v2.1.1"; reg =3D <0xf9928000 0x1000>; @@ -1003,7 +1003,7 @@ blsp_i2c6: i2c@f9928000 { #size-cells =3D <0>; }; =20 - blsp_i2c8: i2c@f9964000 { + blsp2_i2c2: i2c@f9964000 { status =3D "disabled"; compatible =3D "qcom,i2c-qup-v2.1.1"; reg =3D <0xf9964000 0x1000>; @@ -1014,7 +1014,7 @@ blsp_i2c8: i2c@f9964000 { #size-cells =3D <0>; }; =20 - blsp_i2c11: i2c@f9967000 { + blsp2_i2c5: i2c@f9967000 { status =3D "disabled"; compatible =3D "qcom,i2c-qup-v2.1.1"; reg =3D <0xf9967000 0x1000>; @@ -1027,7 +1027,7 @@ blsp_i2c11: i2c@f9967000 { dma-names =3D "tx", "rx"; }; =20 - blsp_i2c12: i2c@f9968000 { + blsp2_i2c6: i2c@f9968000 { status =3D "disabled"; compatible =3D "qcom,i2c-qup-v2.1.1"; reg =3D <0xf9968000 0x1000>; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66FB4C00140 for ; Mon, 15 Aug 2022 20:39:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345433AbiHOUjD (ORCPT ); Mon, 15 Aug 2022 16:39:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345855AbiHOUeN (ORCPT ); Mon, 15 Aug 2022 16:34:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FE134E612; Mon, 15 Aug 2022 12:06:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E02B3612A0; Mon, 15 Aug 2022 19:06:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E260FC433D6; Mon, 15 Aug 2022 19:06:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590363; bh=piaSKTgFszLhRlG3ukpc4rqWWk26NNFQi+RoDH5l8MA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wy1aCVNSQbzRfqQXwQm6FFHwXAWLawMYl/RVcHU9gXD3GtabpPg/yYjR3e9a6qcxe yk5ig029f+yJ410hrDf/zVBmiOZj75ZwwgLnedW52cKpAxHA3Wgl7EUzXX8LZ2akzP VdcExnImNxEh5pE+bcrvptH3t+eqb/8KwJ2Z2aVE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0229/1095] ARM: dts: qcom-msm8974: Fix up mdss nodes Date: Mon, 15 Aug 2022 19:53:48 +0200 Message-Id: <20220815180439.205569121@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 4de36f7b6d0e7e792d36800ac6c5e3392b59573a ] Fix up formatting, move status=3Ddisabled to the end where it belongs, rename DSI PHY label to match newer DTs, use tabs where possible, unwrap lines where wrapping is not necessary and don't disable mdp, as MDSS is useless without it. Signed-off-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220415115633.575010-6-konrad.dybcio@somai= nline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-msm8974.dtsi | 77 +++++++++++++---------------- 1 file changed, 34 insertions(+), 43 deletions(-) diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-m= sm8974.dtsi index 6e99903bb5f9..2d54d18310da 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -1461,35 +1461,29 @@ opp-27000000 { }; =20 mdss: mdss@fd900000 { - status =3D "disabled"; - compatible =3D "qcom,mdss"; - reg =3D <0xfd900000 0x100>, - <0xfd924000 0x1000>; - reg-names =3D "mdss_phys", - "vbif_phys"; + reg =3D <0xfd900000 0x100>, <0xfd924000 0x1000>; + reg-names =3D "mdss_phys", "vbif_phys"; =20 power-domains =3D <&mmcc MDSS_GDSC>; =20 clocks =3D <&mmcc MDSS_AHB_CLK>, - <&mmcc MDSS_AXI_CLK>, - <&mmcc MDSS_VSYNC_CLK>; - clock-names =3D "iface", - "bus", - "vsync"; + <&mmcc MDSS_AXI_CLK>, + <&mmcc MDSS_VSYNC_CLK>; + clock-names =3D "iface", "bus", "vsync"; =20 interrupts =3D ; =20 interrupt-controller; #interrupt-cells =3D <1>; =20 + status =3D "disabled"; + #address-cells =3D <1>; #size-cells =3D <1>; ranges; =20 mdp: mdp@fd900000 { - status =3D "disabled"; - compatible =3D "qcom,mdp5"; reg =3D <0xfd900100 0x22000>; reg-names =3D "mdp_phys"; @@ -1501,10 +1495,7 @@ mdp: mdp@fd900000 { <&mmcc MDSS_AXI_CLK>, <&mmcc MDSS_MDP_CLK>, <&mmcc MDSS_VSYNC_CLK>; - clock-names =3D "iface", - "bus", - "core", - "vsync"; + clock-names =3D "iface", "bus", "core", "vsync"; =20 interconnects =3D <&mmssnoc MNOC_MAS_MDP_PORT0 &bimc BIMC_SLV_EBI_CH0>; interconnect-names =3D "mdp0-mem"; @@ -1523,8 +1514,6 @@ mdp5_intf1_out: endpoint { }; =20 dsi0: dsi@fd922800 { - status =3D "disabled"; - compatible =3D "qcom,mdss-dsi-ctrl"; reg =3D <0xfd922800 0x1f8>; reg-names =3D "dsi_ctrl"; @@ -1532,29 +1521,32 @@ dsi0: dsi@fd922800 { interrupt-parent =3D <&mdss>; interrupts =3D <4 IRQ_TYPE_LEVEL_HIGH>; =20 - assigned-clocks =3D <&mmcc BYTE0_CLK_SRC>, - <&mmcc PCLK0_CLK_SRC>; - assigned-clock-parents =3D <&dsi_phy0 0>, - <&dsi_phy0 1>; + assigned-clocks =3D <&mmcc BYTE0_CLK_SRC>, <&mmcc PCLK0_CLK_SRC>; + assigned-clock-parents =3D <&dsi0_phy 0>, <&dsi0_phy 1>; =20 clocks =3D <&mmcc MDSS_MDP_CLK>, - <&mmcc MDSS_AHB_CLK>, - <&mmcc MDSS_AXI_CLK>, - <&mmcc MDSS_BYTE0_CLK>, - <&mmcc MDSS_PCLK0_CLK>, - <&mmcc MDSS_ESC0_CLK>, - <&mmcc MMSS_MISC_AHB_CLK>; + <&mmcc MDSS_AHB_CLK>, + <&mmcc MDSS_AXI_CLK>, + <&mmcc MDSS_BYTE0_CLK>, + <&mmcc MDSS_PCLK0_CLK>, + <&mmcc MDSS_ESC0_CLK>, + <&mmcc MMSS_MISC_AHB_CLK>; clock-names =3D "mdp_core", - "iface", - "bus", - "byte", - "pixel", - "core", - "core_mmss"; - - phys =3D <&dsi_phy0>; + "iface", + "bus", + "byte", + "pixel", + "core", + "core_mmss"; + + phys =3D <&dsi0_phy>; phy-names =3D "dsi-phy"; =20 + status =3D "disabled"; + + #address-cells =3D <1>; + #size-cells =3D <0>; + ports { #address-cells =3D <1>; #size-cells =3D <0>; @@ -1574,23 +1566,22 @@ dsi0_out: endpoint { }; }; =20 - dsi_phy0: dsi-phy@fd922a00 { - status =3D "disabled"; - + dsi0_phy: dsi-phy@fd922a00 { compatible =3D "qcom,dsi-phy-28nm-hpm"; reg =3D <0xfd922a00 0xd4>, <0xfd922b00 0x280>, <0xfd922d80 0x30>; reg-names =3D "dsi_pll", - "dsi_phy", - "dsi_phy_regulator"; + "dsi_phy", + "dsi_phy_regulator"; =20 #clock-cells =3D <1>; #phy-cells =3D <0>; - qcom,dsi-phy-index =3D <0>; =20 clocks =3D <&mmcc MDSS_AHB_CLK>, <&xo_board>; clock-names =3D "iface", "ref"; + + status =3D "disabled"; }; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57938C3F6B0 for ; Mon, 15 Aug 2022 20:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346230AbiHOUlR (ORCPT ); Mon, 15 Aug 2022 16:41:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346097AbiHOUff (ORCPT ); Mon, 15 Aug 2022 16:35:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3EE82CCB1; Mon, 15 Aug 2022 12:06:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 531FC61281; Mon, 15 Aug 2022 19:06:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55A8CC433C1; Mon, 15 Aug 2022 19:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590399; bh=KllhjJV9VouH/3ISnHcF6h0zQoJcICFh8bxb8Ionq+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BYJMGEFOqQ9y3sCUX4y+80SVAnxnTQCivz91rOoobSkz8rjYiTzSUsRF9qoLjiN+4 Hjmog4cdGdjSsXlx5oGlpY/0GxHlAd17IACQKl4YrBfnDe5DQcNsbNCSkJ6dvX0rz/ 731TZeFZyrtSGGGFhzHTYiSsE2S1P/cyNrM5DPgw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0230/1095] ARM: dts: qcom-msm8974: Fix up SDHCI nodes Date: Mon, 15 Aug 2022 19:53:49 +0200 Message-Id: <20220815180439.252974319@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 64cf62683b5398e46cf967c308be95685137626a ] - Add missing labels (and remove their redefinition from klte) - Commonize bus-width - Add non-removable on sdhc_1, as it's supposed to have an eMMC on it Signed-off-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220415115633.575010-7-konrad.dybcio@somai= nline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts | 4 ++-- arch/arm/boot/dts/qcom-msm8974.dtsi | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts b/arch/arm/boo= t/dts/qcom-msm8974-samsung-klte.dts index 95ae30d06554..3ee2508b20fb 100644 --- a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +++ b/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts @@ -534,7 +534,7 @@ te { }; }; =20 - sdhc_1: sdhci@f9824900 { + sdhci@f9824900 { status =3D "okay"; =20 vmmc-supply =3D <&pma8084_l20>; @@ -547,7 +547,7 @@ sdhc_1: sdhci@f9824900 { pinctrl-0 =3D <&sdhc1_pin_a>; }; =20 - sdhc_2: sdhci@f9864900 { + sdhci@f9864900 { status =3D "okay"; =20 max-frequency =3D <100000000>; diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-m= sm8974.dtsi index 2d54d18310da..d8a1ba5b845c 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -742,7 +742,7 @@ blsp2_uart4: serial@f9960000 { status =3D "disabled"; }; =20 - sdhci@f9824900 { + sdhc_1: sdhci@f9824900 { compatible =3D "qcom,msm8974-sdhci", "qcom,sdhci-msm-v4"; reg =3D <0xf9824900 0x11c>, <0xf9824000 0x800>; reg-names =3D "hc_mem", "core_mem"; @@ -753,10 +753,13 @@ sdhci@f9824900 { <&gcc GCC_SDCC1_AHB_CLK>, <&xo_board>; clock-names =3D "core", "iface", "xo"; + bus-width =3D <8>; + non-removable; + status =3D "disabled"; }; =20 - sdhci@f9864900 { + sdhc_3: sdhci@f9864900 { compatible =3D "qcom,msm8974-sdhci", "qcom,sdhci-msm-v4"; reg =3D <0xf9864900 0x11c>, <0xf9864000 0x800>; reg-names =3D "hc_mem", "core_mem"; @@ -767,10 +770,12 @@ sdhci@f9864900 { <&gcc GCC_SDCC3_AHB_CLK>, <&xo_board>; clock-names =3D "core", "iface", "xo"; + bus-width =3D <4>; + status =3D "disabled"; }; =20 - sdhci@f98a4900 { + sdhc_2: sdhci@f98a4900 { compatible =3D "qcom,msm8974-sdhci", "qcom,sdhci-msm-v4"; reg =3D <0xf98a4900 0x11c>, <0xf98a4000 0x800>; reg-names =3D "hc_mem", "core_mem"; @@ -781,6 +786,8 @@ sdhci@f98a4900 { <&gcc GCC_SDCC2_AHB_CLK>, <&xo_board>; clock-names =3D "core", "iface", "xo"; + bus-width =3D <4>; + status =3D "disabled"; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71697C00140 for ; Mon, 15 Aug 2022 20:43:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345208AbiHOUnd (ORCPT ); Mon, 15 Aug 2022 16:43:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345710AbiHOUju (ORCPT ); Mon, 15 Aug 2022 16:39:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95758ABF1C; Mon, 15 Aug 2022 12:07:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DD8B6612CD; Mon, 15 Aug 2022 19:07:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0B2EC433C1; Mon, 15 Aug 2022 19:07:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590434; bh=L3ApvKRzOF3hbSDCVnYDFeM8CBFfmNYx6ZzEKkNECgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j/MWAWdYYvgwjwgrqyyZhxtkT6nB4j9x5W7vyp6SHZV04klyEf67K+Glcfy58TbA4 UPM/j503/Jm9W3RcfUyrvtot9Fz5dvl58Eb44DlBeyin+9O6sA4tWCqUEcDwYUkJP/ bsLI4QBUV6ZAJ31mw0sR1gCRdKhbPLMzRmLeWtqI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0231/1095] ARM: dts: qcom-msm8974*: Rename msmgpio to tlmm Date: Mon, 15 Aug 2022 19:53:50 +0200 Message-Id: <20220815180439.307388299@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 087c9704d5bb322dd5db52938416caeaf4cdc3c3 ] Rename the label to match new the style used in newer DTs. Signed-off-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220415115633.575010-8-konrad.dybcio@somai= nline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../arm/boot/dts/qcom-apq8074-dragonboard.dts | 2 +- .../boot/dts/qcom-msm8974-fairphone-fp2.dts | 2 +- .../qcom-msm8974-lge-nexus5-hammerhead.dts | 18 ++++++++--------- .../boot/dts/qcom-msm8974-samsung-klte.dts | 20 +++++++++---------- .../dts/qcom-msm8974-sony-xperia-amami.dts | 2 +- .../dts/qcom-msm8974-sony-xperia-castor.dts | 10 +++++----- .../dts/qcom-msm8974-sony-xperia-honami.dts | 4 ++-- arch/arm/boot/dts/qcom-msm8974.dtsi | 4 ++-- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts b/arch/arm/boot= /dts/qcom-apq8074-dragonboard.dts index e2b4e4fc6377..9076a24408c6 100644 --- a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts +++ b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts @@ -35,7 +35,7 @@ sdhci@f9824900 { }; =20 sdhci@f98a4900 { - cd-gpios =3D <&msmgpio 62 0x1>; + cd-gpios =3D <&tlmm 62 0x1>; pinctrl-names =3D "default"; pinctrl-0 =3D <&sdhc2_pin_a>, <&sdhc2_cd_pin_a>; bus-width =3D <4>; diff --git a/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts b/arch/arm/bo= ot/dts/qcom-msm8974-fairphone-fp2.dts index 9dbfc9f8646a..1e947bab06b6 100644 --- a/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts +++ b/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts @@ -51,7 +51,7 @@ volume-up { =20 vibrator { compatible =3D "gpio-vibrator"; - enable-gpios =3D <&msmgpio 86 GPIO_ACTIVE_HIGH>; + enable-gpios =3D <&tlmm 86 GPIO_ACTIVE_HIGH>; vcc-supply =3D <&pm8941_l18>; }; =20 diff --git a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts b/arc= h/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts index dd2d0647d4be..4154ffb207ac 100644 --- a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts +++ b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts @@ -250,7 +250,7 @@ vreg_wlan: wlan-regulator { regulator-min-microvolt =3D <3300000>; regulator-max-microvolt =3D <3300000>; =20 - gpio =3D <&msmgpio 26 GPIO_ACTIVE_HIGH>; + gpio =3D <&tlmm 26 GPIO_ACTIVE_HIGH>; enable-active-high; =20 pinctrl-names =3D "default"; @@ -482,9 +482,9 @@ bluetooth { pinctrl-names =3D "default"; pinctrl-0 =3D <&bt_pin>; =20 - host-wakeup-gpios =3D <&msmgpio 42 GPIO_ACTIVE_HIGH>; - device-wakeup-gpios =3D <&msmgpio 62 GPIO_ACTIVE_HIGH>; - shutdown-gpios =3D <&msmgpio 41 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios =3D <&tlmm 42 GPIO_ACTIVE_HIGH>; + device-wakeup-gpios =3D <&tlmm 62 GPIO_ACTIVE_HIGH>; + shutdown-gpios =3D <&tlmm 41 GPIO_ACTIVE_HIGH>; }; }; =20 @@ -522,7 +522,7 @@ i2c@f9968000 { mpu6515@68 { compatible =3D "invensense,mpu6515"; reg =3D <0x68>; - interrupts-extended =3D <&msmgpio 73 IRQ_TYPE_EDGE_FALLING>; + interrupts-extended =3D <&tlmm 73 IRQ_TYPE_EDGE_FALLING>; vddio-supply =3D <&pm8941_lvs1>; =20 pinctrl-names =3D "default"; @@ -538,7 +538,7 @@ i2c-gate { ak8963@f { compatible =3D "asahi-kasei,ak8963"; reg =3D <0x0f>; - gpios =3D <&msmgpio 67 0>; + gpios =3D <&tlmm 67 0>; vid-supply =3D <&pm8941_lvs1>; vdd-supply =3D <&pm8941_l17>; }; @@ -577,7 +577,7 @@ fuelgauge: max17048@36 { maxim,double-soc; maxim,rcomp =3D /bits/ 8 <0x4d>; =20 - interrupt-parent =3D <&msmgpio>; + interrupt-parent =3D <&tlmm>; interrupts =3D <9 IRQ_TYPE_LEVEL_LOW>; =20 pinctrl-names =3D "default"; @@ -600,7 +600,7 @@ synaptics@70 { compatible =3D "syna,rmi4-i2c"; reg =3D <0x70>; =20 - interrupts-extended =3D <&msmgpio 5 IRQ_TYPE_EDGE_FALLING>; + interrupts-extended =3D <&tlmm 5 IRQ_TYPE_EDGE_FALLING>; vdd-supply =3D <&pm8941_l22>; vio-supply =3D <&pm8941_lvs3>; =20 @@ -632,7 +632,7 @@ i2c@f9925000 { avago_apds993@39 { compatible =3D "avago,apds9930"; reg =3D <0x39>; - interrupts-extended =3D <&msmgpio 61 IRQ_TYPE_EDGE_FALLING>; + interrupts-extended =3D <&tlmm 61 IRQ_TYPE_EDGE_FALLING>; vdd-supply =3D <&pm8941_l17>; vddio-supply =3D <&pm8941_lvs1>; led-max-microamp =3D <100000>; diff --git a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts b/arch/arm/boo= t/dts/qcom-msm8974-samsung-klte.dts index 3ee2508b20fb..60244e0c37ba 100644 --- a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +++ b/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts @@ -247,8 +247,8 @@ i2c-gpio-touchkey { compatible =3D "i2c-gpio"; #address-cells =3D <1>; #size-cells =3D <0>; - sda-gpios =3D <&msmgpio 95 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; - scl-gpios =3D <&msmgpio 96 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + sda-gpios =3D <&tlmm 95 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios =3D <&tlmm 96 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; pinctrl-names =3D "default"; pinctrl-0 =3D <&i2c_touchkey_pins>; =20 @@ -272,8 +272,8 @@ i2c-gpio-led { compatible =3D "i2c-gpio"; #address-cells =3D <1>; #size-cells =3D <0>; - scl-gpios =3D <&msmgpio 121 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; - sda-gpios =3D <&msmgpio 120 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios =3D <&tlmm 121 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + sda-gpios =3D <&tlmm 120 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; pinctrl-names =3D "default"; pinctrl-0 =3D <&i2c_led_gpioex_pins>; =20 @@ -291,7 +291,7 @@ gpio_expander: gpio@20 { pinctrl-names =3D "default"; pinctrl-0 =3D <&gpioex_pin>; =20 - reset-gpios =3D <&msmgpio 145 GPIO_ACTIVE_LOW>; + reset-gpios =3D <&tlmm 145 GPIO_ACTIVE_LOW>; }; =20 led-controller@30 { @@ -371,9 +371,9 @@ bluetooth { max-speed =3D <3000000>; pinctrl-names =3D "default"; pinctrl-0 =3D <&bt_pins>; - device-wakeup-gpios =3D <&msmgpio 91 GPIO_ACTIVE_HIGH>; + device-wakeup-gpios =3D <&tlmm 91 GPIO_ACTIVE_HIGH>; shutdown-gpios =3D <&gpio_expander 9 GPIO_ACTIVE_HIGH>; - interrupt-parent =3D <&msmgpio>; + interrupt-parent =3D <&tlmm>; interrupts =3D <75 IRQ_TYPE_LEVEL_HIGH>; interrupt-names =3D "host-wakeup"; }; @@ -563,7 +563,7 @@ sdhci@f9864900 { */ pinctrl-names =3D "default"; pinctrl-0 =3D <&sdhc2_pin_a /* &sdhc2_cd_pin */>; - // cd-gpios =3D <&msmgpio 62 GPIO_ACTIVE_LOW>; + // cd-gpios =3D <&tlmm 62 GPIO_ACTIVE_LOW>; }; =20 sdhci@f98a4900 { @@ -587,7 +587,7 @@ wifi@1 { reg =3D <1>; compatible =3D "brcm,bcm4329-fmac"; =20 - interrupt-parent =3D <&msmgpio>; + interrupt-parent =3D <&tlmm>; interrupts =3D <92 IRQ_TYPE_LEVEL_HIGH>; interrupt-names =3D "host-wake"; =20 @@ -818,7 +818,7 @@ panel: panel@0 { vddr-supply =3D <&vreg_panel>; =20 reset-gpios =3D <&pma8084_gpios 17 GPIO_ACTIVE_LOW>; - te-gpios =3D <&msmgpio 12 GPIO_ACTIVE_HIGH>; + te-gpios =3D <&tlmm 12 GPIO_ACTIVE_HIGH>; =20 port { panel_in: endpoint { diff --git a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-amami.dts b/arch/ar= m/boot/dts/qcom-msm8974-sony-xperia-amami.dts index 8cace789fb26..6545917dd489 100644 --- a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-amami.dts +++ b/arch/arm/boot/dts/qcom-msm8974-sony-xperia-amami.dts @@ -280,7 +280,7 @@ sdhci@f98a4900 { vmmc-supply =3D <&pm8941_l21>; vqmmc-supply =3D <&pm8941_l13>; =20 - cd-gpios =3D <&msmgpio 62 GPIO_ACTIVE_LOW>; + cd-gpios =3D <&tlmm 62 GPIO_ACTIVE_LOW>; =20 pinctrl-names =3D "default"; pinctrl-0 =3D <&sdhc2_pin_a>, <&sdhc2_cd_pin_a>; diff --git a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts b/arch/a= rm/boot/dts/qcom-msm8974-sony-xperia-castor.dts index e27b360951fd..352689237140 100644 --- a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts +++ b/arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts @@ -239,7 +239,7 @@ vreg_bl_vddio: lcd-backlight-vddio { regulator-min-microvolt =3D <3150000>; regulator-max-microvolt =3D <3150000>; =20 - gpio =3D <&msmgpio 69 0>; + gpio =3D <&tlmm 69 0>; enable-active-high; =20 vin-supply =3D <&pm8941_s3>; @@ -323,7 +323,7 @@ sdhci@f98a4900 { vmmc-supply =3D <&pm8941_l21>; vqmmc-supply =3D <&pm8941_l13>; =20 - cd-gpios =3D <&msmgpio 62 GPIO_ACTIVE_LOW>; + cd-gpios =3D <&tlmm 62 GPIO_ACTIVE_LOW>; =20 pinctrl-names =3D "default"; pinctrl-0 =3D <&sdhc2_pin_a>, <&sdhc2_cd_pin_a>; @@ -351,8 +351,8 @@ bluetooth { <&bt_dev_wake_pin>, <&bt_reg_on_pin>; =20 - host-wakeup-gpios =3D <&msmgpio 95 GPIO_ACTIVE_HIGH>; - device-wakeup-gpios =3D <&msmgpio 96 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios =3D <&tlmm 95 GPIO_ACTIVE_HIGH>; + device-wakeup-gpios =3D <&tlmm 96 GPIO_ACTIVE_HIGH>; shutdown-gpios =3D <&pm8941_gpios 16 GPIO_ACTIVE_HIGH>; }; }; @@ -566,7 +566,7 @@ synaptics@2c { compatible =3D "syna,rmi4-i2c"; reg =3D <0x2c>; =20 - interrupt-parent =3D <&msmgpio>; + interrupt-parent =3D <&tlmm>; interrupts =3D <86 IRQ_TYPE_EDGE_FALLING>; =20 #address-cells =3D <1>; diff --git a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts b/arch/a= rm/boot/dts/qcom-msm8974-sony-xperia-honami.dts index f4a2e2560777..313c755f590f 100644 --- a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts +++ b/arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts @@ -305,7 +305,7 @@ sdhci@f98a4900 { vmmc-supply =3D <&pm8941_l21>; vqmmc-supply =3D <&pm8941_l13>; =20 - cd-gpios =3D <&msmgpio 62 GPIO_ACTIVE_LOW>; + cd-gpios =3D <&tlmm 62 GPIO_ACTIVE_LOW>; =20 pinctrl-names =3D "default"; pinctrl-0 =3D <&sdhc2_pin_a>, <&sdhc2_cd_pin_a>; @@ -331,7 +331,7 @@ synaptics@2c { compatible =3D "syna,rmi4-i2c"; reg =3D <0x2c>; =20 - interrupts-extended =3D <&msmgpio 61 IRQ_TYPE_EDGE_FALLING>; + interrupts-extended =3D <&tlmm 61 IRQ_TYPE_EDGE_FALLING>; =20 #address-cells =3D <1>; #size-cells =3D <0>; diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-m= sm8974.dtsi index d8a1ba5b845c..2182d2755926 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -955,11 +955,11 @@ wifi { }; }; =20 - msmgpio: pinctrl@fd510000 { + tlmm: pinctrl@fd510000 { compatible =3D "qcom,msm8974-pinctrl"; reg =3D <0xfd510000 0x4000>; gpio-controller; - gpio-ranges =3D <&msmgpio 0 0 146>; + gpio-ranges =3D <&tlmm 0 0 146>; #gpio-cells =3D <2>; interrupt-controller; #interrupt-cells =3D <2>; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0933C00140 for ; Mon, 15 Aug 2022 20:44:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345584AbiHOUoR (ORCPT ); Mon, 15 Aug 2022 16:44:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346701AbiHOUly (ORCPT ); Mon, 15 Aug 2022 16:41:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41DAF37FAB; Mon, 15 Aug 2022 12:07:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3621E61019; Mon, 15 Aug 2022 19:07:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC3FAC433C1; Mon, 15 Aug 2022 19:07:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590446; bh=xcqoyNeCZGUKnAm0ZNoqzjIJy8FHk8pmDFlWwIkilg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AwkhyNfr9p91sLnXIZzDhEXMWAHRrystBBwu2EB+0hv+VeyEORDGa3wUpAWSo68mP 8+TsiPXaV9tF0G8O5BscPFdCy2YP+muDAc9zeCpyI7qPk0sdMzorsYHayqMdqGJwgJ IaCsmYiMKMcVQligy/KOyreaUPk7Ry5cjGx5sjXc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0232/1095] ARM: dts: qcom-apq8074-dragonboard: Use &labels Date: Mon, 15 Aug 2022 19:53:51 +0200 Message-Id: <20220815180439.347551436@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 9f440d17e2309c7d14eba0898c775be6d6e6d6b7 ] Use &labels to align with the style used in new DTS and apply tiny style fixes. Signed-off-by: Konrad Dybcio [bjorn: Rebased ontop of Krzysztof's underscore fixes] Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220415115633.575010-9-konrad.dybcio@somai= nline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../arm/boot/dts/qcom-apq8074-dragonboard.dts | 605 +++++++++--------- arch/arm/boot/dts/qcom-msm8974.dtsi | 2 +- 2 files changed, 296 insertions(+), 311 deletions(-) diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts b/arch/arm/boot= /dts/qcom-apq8074-dragonboard.dts index 9076a24408c6..f114debe4d95 100644 --- a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts +++ b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts @@ -16,331 +16,316 @@ aliases { chosen { stdout-path =3D "serial0:115200n8"; }; +}; + +&blsp1_uart2 { + status =3D "okay"; +}; + +&blsp2_i2c5 { + status =3D "okay"; + clock-frequency =3D <200000>; + + pinctrl-0 =3D <&i2c11_pins>; + pinctrl-names =3D "default"; + + eeprom: eeprom@52 { + compatible =3D "atmel,24c128"; + reg =3D <0x52>; + pagesize =3D <32>; + read-only; + }; +}; + +&otg { + status =3D "okay"; =20 - soc { - serial@f991e000 { + phys =3D <&usb_hs2_phy>; + phy-select =3D <&tcsr 0xb000 1>; + extcon =3D <&smbb>, <&usb_id>; + vbus-supply =3D <&chg_otg>; + hnp-disable; + srp-disable; + adp-disable; + + ulpi { + phy@b { status =3D "okay"; + v3p3-supply =3D <&pm8941_l24>; + v1p8-supply =3D <&pm8941_l6>; + extcon =3D <&smbb>; + qcom,init-seq =3D /bits/ 8 <0x1 0x63>; + }; + }; +}; + +&rpm_requests { + pm8841-regulators { + pm8841_s1: s1 { + regulator-min-microvolt =3D <675000>; + regulator-max-microvolt =3D <1050000>; }; =20 - sdhci@f9824900 { - bus-width =3D <8>; - non-removable; - status =3D "okay"; + pm8841_s2: s2 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <1050000>; + }; + + pm8841_s3: s3 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <1050000>; + }; =20 - vmmc-supply =3D <&pm8941_l20>; - vqmmc-supply =3D <&pm8941_s3>; + pm8841_s4: s4 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <1050000>; + }; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc1_pin_a>; + pm8941-regulators { + vdd_l1_l3-supply =3D <&pm8941_s1>; + vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; + vdd_l4_l11-supply =3D <&pm8941_s1>; + vdd_l5_l7-supply =3D <&pm8941_s2>; + vdd_l6_l12_l14_l15-supply =3D <&pm8941_s2>; + vin_5vs-supply =3D <&pm8941_5v>; + + pm8941_s1: s1 { + regulator-min-microvolt =3D <1300000>; + regulator-max-microvolt =3D <1300000>; + regulator-always-on; + regulator-boot-on; }; =20 - sdhci@f98a4900 { - cd-gpios =3D <&tlmm 62 0x1>; - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc2_pin_a>, <&sdhc2_cd_pin_a>; - bus-width =3D <4>; - status =3D "okay"; + pm8941_s2: s2 { + regulator-min-microvolt =3D <2150000>; + regulator-max-microvolt =3D <2150000>; + regulator-boot-on; + }; =20 - vmmc-supply =3D <&pm8941_l21>; - vqmmc-supply =3D <&pm8941_l13>; + pm8941_s3: s3 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-always-on; + regulator-boot-on; }; =20 - usb@f9a55000 { - status =3D "okay"; - phys =3D <&usb_hs2_phy>; - phy-select =3D <&tcsr 0xb000 1>; - extcon =3D <&smbb>, <&usb_id>; - vbus-supply =3D <&chg_otg>; - hnp-disable; - srp-disable; - adp-disable; - ulpi { - phy@b { - status =3D "okay"; - v3p3-supply =3D <&pm8941_l24>; - v1p8-supply =3D <&pm8941_l6>; - extcon =3D <&smbb>; - qcom,init-seq =3D /bits/ 8 <0x1 0x63>; - }; - }; - }; - - - pinctrl@fd510000 { - i2c11_pins: i2c11 { - mux { - pins =3D "gpio83", "gpio84"; - function =3D "blsp_i2c11"; - }; - }; - - spi8_default: spi8_default { - mosi { - pins =3D "gpio45"; - function =3D "blsp_spi8"; - }; - miso { - pins =3D "gpio46"; - function =3D "blsp_spi8"; - }; - cs { - pins =3D "gpio47"; - function =3D "blsp_spi8"; - }; - clk { - pins =3D "gpio48"; - function =3D "blsp_spi8"; - }; - }; - - sdhc1_pin_a: sdhc1-pin-active { - clk { - pins =3D "sdc1_clk"; - drive-strength =3D <16>; - bias-disable; - }; - - cmd-data { - pins =3D "sdc1_cmd", "sdc1_data"; - drive-strength =3D <10>; - bias-pull-up; - }; - }; - - sdhc2_cd_pin_a: sdhc2-cd-pin-active { - pins =3D "gpio62"; - function =3D "gpio"; - - drive-strength =3D <2>; - bias-disable; - }; - - sdhc2_pin_a: sdhc2-pin-active { - clk { - pins =3D "sdc2_clk"; - drive-strength =3D <10>; - bias-disable; - }; - - cmd-data { - pins =3D "sdc2_cmd", "sdc2_data"; - drive-strength =3D <6>; - bias-pull-up; - }; - }; - }; - - i2c@f9967000 { - status =3D "okay"; - clock-frequency =3D <200000>; - pinctrl-0 =3D <&i2c11_pins>; - pinctrl-names =3D "default"; + pm8941_l1: l1 { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1225000>; + regulator-always-on; + regulator-boot-on; + }; + + pm8941_l2: l2 { + regulator-min-microvolt =3D <1200000>; + regulator-max-microvolt =3D <1200000>; + }; + + pm8941_l3: l3 { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1225000>; + }; + + pm8941_l4: l4 { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1225000>; + }; + + pm8941_l5: l5 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; + + pm8941_l6: l6 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-boot-on; + }; + + pm8941_l7: l7 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-boot-on; + }; + + pm8941_l8: l8 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; + + pm8941_l9: l9 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2950000>; + }; + + pm8941_l10: l10 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-always-on; + }; + + pm8941_l11: l11 { + regulator-min-microvolt =3D <1300000>; + regulator-max-microvolt =3D <1300000>; + }; + + pm8941_l12: l12 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-always-on; + regulator-boot-on; + }; + + pm8941_l13: l13 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2950000>; + regulator-boot-on; + }; + + pm8941_l14: l14 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; + + pm8941_l15: l15 { + regulator-min-microvolt =3D <2050000>; + regulator-max-microvolt =3D <2050000>; + }; + + pm8941_l16: l16 { + regulator-min-microvolt =3D <2700000>; + regulator-max-microvolt =3D <2700000>; + }; + + pm8941_l17: l17 { + regulator-min-microvolt =3D <2700000>; + regulator-max-microvolt =3D <2700000>; + }; + + pm8941_l18: l18 { + regulator-min-microvolt =3D <2850000>; + regulator-max-microvolt =3D <2850000>; + }; + + pm8941_l19: l19 { + regulator-min-microvolt =3D <3300000>; + regulator-max-microvolt =3D <3300000>; + regulator-always-on; + }; + + pm8941_l20: l20 { + regulator-min-microvolt =3D <2950000>; + regulator-max-microvolt =3D <2950000>; + regulator-system-load =3D <200000>; + regulator-allow-set-load; + regulator-boot-on; + }; + + pm8941_l21: l21 { + regulator-min-microvolt =3D <2950000>; + regulator-max-microvolt =3D <2950000>; + regulator-boot-on; + }; + + pm8941_l22: l22 { + regulator-min-microvolt =3D <3000000>; + regulator-max-microvolt =3D <3000000>; + }; + + pm8941_l23: l23 { + regulator-min-microvolt =3D <3000000>; + regulator-max-microvolt =3D <3000000>; + }; + + pm8941_l24: l24 { + regulator-min-microvolt =3D <3075000>; + regulator-max-microvolt =3D <3075000>; + regulator-boot-on; + }; + }; +}; + +&sdhc_1 { + status =3D "okay"; + + vmmc-supply =3D <&pm8941_l20>; + vqmmc-supply =3D <&pm8941_s3>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sdhc1_pin_a>; +}; + +&sdhc_2 { + status =3D "okay"; + cd-gpios =3D <&tlmm 62 0x1>; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sdhc2_pin_a>, <&sdhc2_cd_pin_a>; + + vmmc-supply =3D <&pm8941_l21>; + vqmmc-supply =3D <&pm8941_l13>; +}; + +&tlmm { + i2c11_pins: i2c11 { + mux { + pins =3D "gpio83", "gpio84"; + function =3D "blsp_i2c11"; + }; + }; + + spi8_default: spi8_default { + mosi { + pins =3D "gpio45"; + function =3D "blsp_spi8"; + }; + miso { + pins =3D "gpio46"; + function =3D "blsp_spi8"; + }; + cs { + pins =3D "gpio47"; + function =3D "blsp_spi8"; + }; + clk { + pins =3D "gpio48"; + function =3D "blsp_spi8"; + }; + }; + + sdhc1_pin_a: sdhc1-pin-active { + clk { + pins =3D "sdc1_clk"; + drive-strength =3D <16>; + bias-disable; + }; =20 - eeprom: eeprom@52 { - compatible =3D "atmel,24c128"; - reg =3D <0x52>; - pagesize =3D <32>; - read-only; - }; + cmd-data { + pins =3D "sdc1_cmd", "sdc1_data"; + drive-strength =3D <10>; + bias-pull-up; }; }; =20 - smd { - rpm { - rpm-requests { - pm8841-regulators { - s1 { - regulator-min-microvolt =3D <675000>; - regulator-max-microvolt =3D <1050000>; - }; - - s2 { - regulator-min-microvolt =3D <500000>; - regulator-max-microvolt =3D <1050000>; - }; - - s3 { - regulator-min-microvolt =3D <500000>; - regulator-max-microvolt =3D <1050000>; - }; - - s4 { - regulator-min-microvolt =3D <500000>; - regulator-max-microvolt =3D <1050000>; - }; - }; - - pm8941-regulators { - vdd_l1_l3-supply =3D <&pm8941_s1>; - vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; - vdd_l4_l11-supply =3D <&pm8941_s1>; - vdd_l5_l7-supply =3D <&pm8941_s2>; - vdd_l6_l12_l14_l15-supply =3D <&pm8941_s2>; - vin_5vs-supply =3D <&pm8941_5v>; - - s1 { - regulator-min-microvolt =3D <1300000>; - regulator-max-microvolt =3D <1300000>; - regulator-always-on; - regulator-boot-on; - }; - - s2 { - regulator-min-microvolt =3D <2150000>; - regulator-max-microvolt =3D <2150000>; - regulator-boot-on; - }; - - s3 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - regulator-always-on; - regulator-boot-on; - }; - - l1 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - - regulator-always-on; - regulator-boot-on; - }; - - l2 { - regulator-min-microvolt =3D <1200000>; - regulator-max-microvolt =3D <1200000>; - }; - - l3 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - }; - - l4 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - }; - - l5 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l6 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-boot-on; - }; - - l7 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-boot-on; - }; - - l8 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l9 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - }; - - l10 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - regulator-always-on; - }; - - l11 { - regulator-min-microvolt =3D <1300000>; - regulator-max-microvolt =3D <1300000>; - }; - - l12 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-always-on; - regulator-boot-on; - }; - - l13 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - - regulator-boot-on; - }; - - l14 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l15 { - regulator-min-microvolt =3D <2050000>; - regulator-max-microvolt =3D <2050000>; - }; - - l16 { - regulator-min-microvolt =3D <2700000>; - regulator-max-microvolt =3D <2700000>; - }; - - l17 { - regulator-min-microvolt =3D <2700000>; - regulator-max-microvolt =3D <2700000>; - }; - - l18 { - regulator-min-microvolt =3D <2850000>; - regulator-max-microvolt =3D <2850000>; - }; - - l19 { - regulator-min-microvolt =3D <3300000>; - regulator-max-microvolt =3D <3300000>; - regulator-always-on; - }; - - l20 { - regulator-min-microvolt =3D <2950000>; - regulator-max-microvolt =3D <2950000>; - - regulator-allow-set-load; - regulator-boot-on; - regulator-system-load =3D <200000>; - }; - - l21 { - regulator-min-microvolt =3D <2950000>; - regulator-max-microvolt =3D <2950000>; - - regulator-boot-on; - }; - - l22 { - regulator-min-microvolt =3D <3000000>; - regulator-max-microvolt =3D <3000000>; - }; - - l23 { - regulator-min-microvolt =3D <3000000>; - regulator-max-microvolt =3D <3000000>; - }; - - l24 { - regulator-min-microvolt =3D <3075000>; - regulator-max-microvolt =3D <3075000>; - - regulator-boot-on; - }; - }; - }; + sdhc2_cd_pin_a: sdhc2-cd-pin-active { + pins =3D "gpio62"; + function =3D "gpio"; + + drive-strength =3D <2>; + bias-disable; + }; + + sdhc2_pin_a: sdhc2-pin-active { + clk { + pins =3D "sdc2_clk"; + drive-strength =3D <10>; + bias-disable; + }; + + cmd-data { + pins =3D "sdc2_cmd", "sdc2_data"; + drive-strength =3D <6>; + bias-pull-up; }; }; }; diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-m= sm8974.dtsi index 2182d2755926..ad05f0665035 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -1612,7 +1612,7 @@ rpm { qcom,ipc =3D <&apcs 8 0>; qcom,smd-edge =3D <15>; =20 - rpm-requests { + rpm_requests: rpm-requests { compatible =3D "qcom,rpm-msm8974"; qcom,smd-channels =3D "rpm_requests"; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5956AC00140 for ; Mon, 15 Aug 2022 20:44:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345559AbiHOUoL (ORCPT ); Mon, 15 Aug 2022 16:44:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346006AbiHOUkz (ORCPT ); Mon, 15 Aug 2022 16:40:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44785AF0EC; Mon, 15 Aug 2022 12:07:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 32B94612D3; Mon, 15 Aug 2022 19:07:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38A4DC433D7; Mon, 15 Aug 2022 19:07:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590449; bh=nwGTDbmhz7lz1hU/LdXHRNjHbpqmF4gNeTYuKSTzrI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ezfxC/7y1adHiYuSFAMP53UFniW0H+KyJHYu1/Q5SqsdQ8o+wcbW8IjYaunPpgHsf XYouRqT75S45pwJtZasHtB0/nQFTCjGAT1eRlywiMXn3jJzGpHn+qcb30X/rKbWZoD hHdvRP9fLDcl+V39l9bP7KKSGIWksLXBqBwIk0cE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0233/1095] ARM: dts: qcom-msm8974-fp2: Use &labels Date: Mon, 15 Aug 2022 19:53:52 +0200 Message-Id: <20220815180439.394296060@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 409ab7dc57c41d9db54d221f4d247e229ba34cf9 ] Use &labels to align with the style used in new DTS and apply tiny style fixes. Signed-off-by: Konrad Dybcio [bjorn: Rebased on top of Krzysztof underscore fixes] Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220415115633.575010-10-konrad.dybcio@soma= inline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../boot/dts/qcom-msm8974-fairphone-fp2.dts | 577 +++++++++--------- arch/arm/boot/dts/qcom-msm8974.dtsi | 2 +- 2 files changed, 276 insertions(+), 303 deletions(-) diff --git a/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts b/arch/arm/bo= ot/dts/qcom-msm8974-fairphone-fp2.dts index 1e947bab06b6..38e48ea021d9 100644 --- a/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts +++ b/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts @@ -5,7 +5,6 @@ #include #include =20 - / { model =3D "Fairphone 2"; compatible =3D "fairphone,fp2", "qcom,msm8974"; @@ -54,356 +53,330 @@ vibrator { enable-gpios =3D <&tlmm 86 GPIO_ACTIVE_HIGH>; vcc-supply =3D <&pm8941_l18>; }; +}; + +&blsp1_uart2 { + status =3D "okay"; +}; + +&imem { + status =3D "okay"; + + reboot-mode { + mode-normal =3D <0x77665501>; + mode-bootloader =3D <0x77665500>; + mode-recovery =3D <0x77665502>; + }; +}; + +&otg { + status =3D "okay"; + + phys =3D <&usb_hs1_phy>; + phy-select =3D <&tcsr 0xb000 0>; + extcon =3D <&smbb>, <&usb_id>; + vbus-supply =3D <&chg_otg>; =20 - smd { - rpm { - rpm-requests { - pm8841-regulators { - s1 { - regulator-min-microvolt =3D <675000>; - regulator-max-microvolt =3D <1050000>; - }; - - s2 { - regulator-min-microvolt =3D <500000>; - regulator-max-microvolt =3D <1050000>; - }; - - s3 { - regulator-min-microvolt =3D <1050000>; - regulator-max-microvolt =3D <1050000>; - }; - }; - - pm8941-regulators { - vdd_l1_l3-supply =3D <&pm8941_s1>; - vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; - vdd_l4_l11-supply =3D <&pm8941_s1>; - vdd_l5_l7-supply =3D <&pm8941_s2>; - vdd_l6_l12_l14_l15-supply =3D <&pm8941_s2>; - vdd_l9_l10_l17_l22-supply =3D <&vreg_boost>; - vdd_l13_l20_l23_l24-supply =3D <&vreg_boost>; - vdd_l21-supply =3D <&vreg_boost>; - - s1 { - regulator-min-microvolt =3D <1300000>; - regulator-max-microvolt =3D <1300000>; - - regulator-always-on; - regulator-boot-on; - }; - - s2 { - regulator-min-microvolt =3D <2150000>; - regulator-max-microvolt =3D <2150000>; - - regulator-boot-on; - }; - - s3 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-always-on; - regulator-boot-on; - }; - - l1 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - - regulator-always-on; - regulator-boot-on; - }; - - l2 { - regulator-min-microvolt =3D <1200000>; - regulator-max-microvolt =3D <1200000>; - }; - - l3 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - }; - - l4 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - }; - - l5 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l6 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-boot-on; - }; - - l7 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-boot-on; - }; - - l8 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l9 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - }; - - l10 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - }; - - l11 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1350000>; - }; - - l12 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-always-on; - regulator-boot-on; - }; - - l13 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - - regulator-boot-on; - }; - - l14 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l15 { - regulator-min-microvolt =3D <2050000>; - regulator-max-microvolt =3D <2050000>; - }; - - l16 { - regulator-min-microvolt =3D <2700000>; - regulator-max-microvolt =3D <2700000>; - }; - - l17 { - regulator-min-microvolt =3D <2850000>; - regulator-max-microvolt =3D <2850000>; - }; - - l18 { - regulator-min-microvolt =3D <2850000>; - regulator-max-microvolt =3D <2850000>; - }; - - l19 { - regulator-min-microvolt =3D <2900000>; - regulator-max-microvolt =3D <3350000>; - }; - - l20 { - regulator-min-microvolt =3D <2950000>; - regulator-max-microvolt =3D <2950000>; - - regulator-boot-on; - regulator-system-load =3D <200000>; - regulator-allow-set-load; - }; - - l21 { - regulator-min-microvolt =3D <2950000>; - regulator-max-microvolt =3D <2950000>; - - regulator-boot-on; - }; - - l22 { - regulator-min-microvolt =3D <3000000>; - regulator-max-microvolt =3D <3300000>; - }; - - l23 { - regulator-min-microvolt =3D <3000000>; - regulator-max-microvolt =3D <3000000>; - }; - - l24 { - regulator-min-microvolt =3D <3075000>; - regulator-max-microvolt =3D <3075000>; - - regulator-boot-on; - }; - }; - }; + hnp-disable; + srp-disable; + adp-disable; + + ulpi { + phy@a { + status =3D "okay"; + + v1p8-supply =3D <&pm8941_l6>; + v3p3-supply =3D <&pm8941_l24>; + + extcon =3D <&smbb>; + qcom,init-seq =3D /bits/ 8 <0x1 0x64>; }; }; }; =20 -&soc { - serial@f991e000 { - status =3D "okay"; +&pm8941_gpios { + gpio_keys_pin_a: gpio-keys-active { + pins =3D "gpio1", "gpio2", "gpio5"; + function =3D "normal"; + + bias-pull-up; + power-source =3D ; }; +}; =20 - remoteproc@fb21b000 { - status =3D "okay"; +&pronto { + status =3D "okay"; =20 - vddmx-supply =3D <&pm8841_s1>; - vddcx-supply =3D <&pm8841_s2>; + vddmx-supply =3D <&pm8841_s1>; + vddcx-supply =3D <&pm8841_s2>; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&wcnss_pin_a>; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&wcnss_pin_a>; =20 - smd-edge { - qcom,remote-pid =3D <4>; - label =3D "pronto"; + smd-edge { + qcom,remote-pid =3D <4>; + label =3D "pronto"; =20 - wcnss { - status =3D "okay"; - }; + wcnss { + status =3D "okay"; }; }; +}; + +&rpm_requests { + pm8841-regulators { + pm8841_s1: s1 { + regulator-min-microvolt =3D <675000>; + regulator-max-microvolt =3D <1050000>; + }; =20 - pinctrl@fd510000 { - sdhc1_pin_a: sdhc1-pin-active { - clk { - pins =3D "sdc1_clk"; - drive-strength =3D <16>; - bias-disable; - }; + pm8841_s2: s2 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <1050000>; + }; =20 - cmd-data { - pins =3D "sdc1_cmd", "sdc1_data"; - drive-strength =3D <10>; - bias-pull-up; - }; + pm8841_s3: s3 { + regulator-min-microvolt =3D <1050000>; + regulator-max-microvolt =3D <1050000>; }; + }; =20 - sdhc2_pin_a: sdhc2-pin-active { - clk { - pins =3D "sdc2_clk"; - drive-strength =3D <10>; - bias-disable; - }; + pm8941-regulators { + vdd_l1_l3-supply =3D <&pm8941_s1>; + vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; + vdd_l4_l11-supply =3D <&pm8941_s1>; + vdd_l5_l7-supply =3D <&pm8941_s2>; + vdd_l6_l12_l14_l15-supply =3D <&pm8941_s2>; + vdd_l9_l10_l17_l22-supply =3D <&vreg_boost>; + vdd_l13_l20_l23_l24-supply =3D <&vreg_boost>; + vdd_l21-supply =3D <&vreg_boost>; + + pm8941_s1: s1 { + regulator-min-microvolt =3D <1300000>; + regulator-max-microvolt =3D <1300000>; + regulator-always-on; + regulator-boot-on; + }; =20 - cmd-data { - pins =3D "sdc2_cmd", "sdc2_data"; - drive-strength =3D <6>; - bias-pull-up; - }; + pm8941_s2: s2 { + regulator-min-microvolt =3D <2150000>; + regulator-max-microvolt =3D <2150000>; + regulator-boot-on; }; =20 - wcnss_pin_a: wcnss-pin-active { - wlan { - pins =3D "gpio36", "gpio37", "gpio38", "gpio39", "gpio40"; - function =3D "wlan"; + pm8941_s3: s3 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-always-on; + regulator-boot-on; + }; =20 - drive-strength =3D <6>; - bias-pull-down; - }; + pm8941_l1: l1 { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1225000>; + regulator-always-on; + regulator-boot-on; + }; =20 - bt { - pins =3D "gpio35", "gpio43", "gpio44"; - function =3D "bt"; + pm8941_l2: l2 { + regulator-min-microvolt =3D <1200000>; + regulator-max-microvolt =3D <1200000>; + }; =20 - drive-strength =3D <2>; - bias-pull-down; - }; + pm8941_l3: l3 { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1225000>; + }; =20 - fm { - pins =3D "gpio41", "gpio42"; - function =3D "fm"; + pm8941_l4: l4 { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1225000>; + }; =20 - drive-strength =3D <2>; - bias-pull-down; - }; + pm8941_l5: l5 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; }; - }; =20 - sdhci@f9824900 { - status =3D "okay"; + pm8941_l6: l6 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-boot-on; + }; =20 - vmmc-supply =3D <&pm8941_l20>; - vqmmc-supply =3D <&pm8941_s3>; + pm8941_l7: l7 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-boot-on; + }; =20 - bus-width =3D <8>; - non-removable; + pm8941_l8: l8 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc1_pin_a>; - }; + pm8941_l9: l9 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2950000>; + }; =20 - sdhci@f98a4900 { - status =3D "okay"; + pm8941_l10: l10 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2950000>; + }; =20 - vmmc-supply =3D <&pm8941_l21>; - vqmmc-supply =3D <&pm8941_l13>; + pm8941_l11: l11 { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1350000>; + }; =20 - bus-width =3D <4>; + pm8941_l12: l12 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-always-on; + regulator-boot-on; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc2_pin_a>; + pm8941_l13: l13 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2950000>; + regulator-boot-on; + }; + + pm8941_l14: l14 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; + + pm8941_l15: l15 { + regulator-min-microvolt =3D <2050000>; + regulator-max-microvolt =3D <2050000>; + }; + + pm8941_l16: l16 { + regulator-min-microvolt =3D <2700000>; + regulator-max-microvolt =3D <2700000>; + }; + + pm8941_l17: l17 { + regulator-min-microvolt =3D <2850000>; + regulator-max-microvolt =3D <2850000>; + }; + + pm8941_l18: l18 { + regulator-min-microvolt =3D <2850000>; + regulator-max-microvolt =3D <2850000>; + }; + + pm8941_l19: l19 { + regulator-min-microvolt =3D <2900000>; + regulator-max-microvolt =3D <3350000>; + }; + + pm8941_l20: l20 { + regulator-min-microvolt =3D <2950000>; + regulator-max-microvolt =3D <2950000>; + regulator-system-load =3D <200000>; + regulator-allow-set-load; + regulator-boot-on; + }; + + pm8941_l21: l21 { + regulator-min-microvolt =3D <2950000>; + regulator-max-microvolt =3D <2950000>; + regulator-boot-on; + }; + + pm8941_l22: l22 { + regulator-min-microvolt =3D <3000000>; + regulator-max-microvolt =3D <3300000>; + }; + + pm8941_l23: l23 { + regulator-min-microvolt =3D <3000000>; + regulator-max-microvolt =3D <3000000>; + }; + + pm8941_l24: l24 { + regulator-min-microvolt =3D <3075000>; + regulator-max-microvolt =3D <3075000>; + regulator-boot-on; + }; }; +}; =20 - usb@f9a55000 { - status =3D "okay"; +&sdhc_1 { + status =3D "okay"; =20 - phys =3D <&usb_hs1_phy>; - phy-select =3D <&tcsr 0xb000 0>; - extcon =3D <&smbb>, <&usb_id>; - vbus-supply =3D <&chg_otg>; + vmmc-supply =3D <&pm8941_l20>; + vqmmc-supply =3D <&pm8941_s3>; =20 - hnp-disable; - srp-disable; - adp-disable; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sdhc1_pin_a>; +}; + +&sdhc_2 { + status =3D "okay"; =20 - ulpi { - phy@a { - status =3D "okay"; + vmmc-supply =3D <&pm8941_l21>; + vqmmc-supply =3D <&pm8941_l13>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sdhc2_pin_a>; +}; =20 - v1p8-supply =3D <&pm8941_l6>; - v3p3-supply =3D <&pm8941_l24>; +&tlmm { + sdhc1_pin_a: sdhc1-pin-active { + clk { + pins =3D "sdc1_clk"; + drive-strength =3D <16>; + bias-disable; + }; =20 - extcon =3D <&smbb>; - qcom,init-seq =3D /bits/ 8 <0x1 0x64>; - }; + cmd-data { + pins =3D "sdc1_cmd", "sdc1_data"; + drive-strength =3D <10>; + bias-pull-up; }; }; =20 - imem@fe805000 { - status =3D "okay"; + sdhc2_pin_a: sdhc2-pin-active { + clk { + pins =3D "sdc2_clk"; + drive-strength =3D <10>; + bias-disable; + }; =20 - reboot-mode { - mode-normal =3D <0x77665501>; - mode-bootloader =3D <0x77665500>; - mode-recovery =3D <0x77665502>; + cmd-data { + pins =3D "sdc2_cmd", "sdc2_data"; + drive-strength =3D <6>; + bias-pull-up; }; }; -}; =20 -&spmi_bus { - pm8941@0 { - gpios@c000 { - gpio_keys_pin_a: gpio-keys-active { - pins =3D "gpio1", "gpio2", "gpio5"; - function =3D "normal"; + wcnss_pin_a: wcnss-pin-active { + wlan { + pins =3D "gpio36", "gpio37", "gpio38", "gpio39", "gpio40"; + function =3D "wlan"; + + drive-strength =3D <6>; + bias-pull-down; + }; + + bt { + pins =3D "gpio35", "gpio43", "gpio44"; + function =3D "bt"; + + drive-strength =3D <2>; + bias-pull-down; + }; + + fm { + pins =3D "gpio41", "gpio42"; + function =3D "fm"; =20 - bias-pull-up; - power-source =3D ; - }; + drive-strength =3D <2>; + bias-pull-down; }; }; }; diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-m= sm8974.dtsi index ad05f0665035..f1278d39ff6c 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -1592,7 +1592,7 @@ dsi0_phy: dsi-phy@fd922a00 { }; }; =20 - imem@fe805000 { + imem: imem@fe805000 { status =3D "disabled"; compatible =3D "syscon", "simple-mfd"; reg =3D <0xfe805000 0x1000>; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFF73C00140 for ; Mon, 15 Aug 2022 20:44:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345313AbiHOUo2 (ORCPT ); Mon, 15 Aug 2022 16:44:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346890AbiHOUmI (ORCPT ); Mon, 15 Aug 2022 16:42:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5B31B0882; Mon, 15 Aug 2022 12:07:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7CC9961281; Mon, 15 Aug 2022 19:07:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E24BC433D7; Mon, 15 Aug 2022 19:07:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590452; bh=KChbl8D172soweTaLOuQzVywfCKfzz0a4A4BYFp2+BA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GPNe3gxc4AJvP0S2ZnX7vOfqfqwNkdJcYBTcu6W79Zzy+emkWvSyJiMtJ4cHoGR5s rQJLP9LH00FXpg/liGmkQF03MDdWxWN381kGyI/cCkogXr+6Mri8n5hnQYnLEE1EX+ mU0/bc9Ag9ItFoAm3Hp8iaekaOoVPvpKrgZlBoy0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0234/1095] ARM: dts: qcom-msm8974-lge-nexus5: Use &labels Date: Mon, 15 Aug 2022 19:53:53 +0200 Message-Id: <20220815180439.447443752@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 1c1574e24990e9f9d753958745b8274874241158 ] Use &labels to align with the style used in new DTS and apply tiny style fixes. Signed-off-by: Konrad Dybcio [bjorn: Rebased on top of Krzysztof's fixes] Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220415115633.575010-11-konrad.dybcio@soma= inline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../qcom-msm8974-lge-nexus5-hammerhead.dts | 1110 ++++++++--------- 1 file changed, 536 insertions(+), 574 deletions(-) diff --git a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts b/arc= h/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts index 4154ffb207ac..a1cae3d453c2 100644 --- a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts +++ b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts @@ -40,209 +40,6 @@ volume-down { }; }; =20 - smd { - rpm { - rpm-requests { - pm8841-regulators { - s1 { - regulator-min-microvolt =3D <675000>; - regulator-max-microvolt =3D <1050000>; - }; - - s2 { - regulator-min-microvolt =3D <500000>; - regulator-max-microvolt =3D <1050000>; - }; - - s3 { - regulator-min-microvolt =3D <1050000>; - regulator-max-microvolt =3D <1050000>; - }; - - s4 { - regulator-min-microvolt =3D <815000>; - regulator-max-microvolt =3D <900000>; - }; - }; - - pm8941-regulators { - vdd_l1_l3-supply =3D <&pm8941_s1>; - vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; - vdd_l4_l11-supply =3D <&pm8941_s1>; - vdd_l5_l7-supply =3D <&pm8941_s2>; - vdd_l6_l12_l14_l15-supply =3D <&pm8941_s2>; - vdd_l8_l16_l18_l19-supply =3D <&vreg_vph_pwr>; - vdd_l9_l10_l17_l22-supply =3D <&vreg_boost>; - vdd_l13_l20_l23_l24-supply =3D <&vreg_boost>; - vdd_l21-supply =3D <&vreg_boost>; - - s1 { - regulator-min-microvolt =3D <1300000>; - regulator-max-microvolt =3D <1300000>; - - regulator-always-on; - regulator-boot-on; - }; - - s2 { - regulator-min-microvolt =3D <2150000>; - regulator-max-microvolt =3D <2150000>; - - regulator-boot-on; - }; - - s3 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-always-on; - regulator-boot-on; - }; - - l1 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - - regulator-always-on; - regulator-boot-on; - }; - - l2 { - regulator-min-microvolt =3D <1200000>; - regulator-max-microvolt =3D <1200000>; - }; - - l3 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - }; - - l4 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - }; - - l5 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l6 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-boot-on; - }; - - l7 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-boot-on; - }; - - l8 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l9 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - }; - - l10 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - }; - - l11 { - regulator-min-microvolt =3D <1300000>; - regulator-max-microvolt =3D <1300000>; - }; - - l12 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-always-on; - regulator-boot-on; - }; - - l13 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - - regulator-boot-on; - }; - - l14 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l15 { - regulator-min-microvolt =3D <2050000>; - regulator-max-microvolt =3D <2050000>; - }; - - l16 { - regulator-min-microvolt =3D <2700000>; - regulator-max-microvolt =3D <2700000>; - }; - - l17 { - regulator-min-microvolt =3D <2850000>; - regulator-max-microvolt =3D <2850000>; - }; - - l18 { - regulator-min-microvolt =3D <2850000>; - regulator-max-microvolt =3D <2850000>; - }; - - l19 { - regulator-min-microvolt =3D <3000000>; - regulator-max-microvolt =3D <3300000>; - }; - - l20 { - regulator-min-microvolt =3D <2950000>; - regulator-max-microvolt =3D <2950000>; - - regulator-boot-on; - regulator-system-load =3D <200000>; - regulator-allow-set-load; - }; - - l21 { - regulator-min-microvolt =3D <2950000>; - regulator-max-microvolt =3D <2950000>; - - regulator-boot-on; - }; - - l22 { - regulator-min-microvolt =3D <3000000>; - regulator-max-microvolt =3D <3300000>; - }; - - l23 { - regulator-min-microvolt =3D <3000000>; - regulator-max-microvolt =3D <3000000>; - }; - - l24 { - regulator-min-microvolt =3D <3075000>; - regulator-max-microvolt =3D <3075000>; - - regulator-boot-on; - }; - }; - }; - }; - }; - vreg_wlan: wlan-regulator { compatible =3D "regulator-fixed"; =20 @@ -258,504 +55,669 @@ vreg_wlan: wlan-regulator { }; }; =20 -&soc { - serial@f991d000 { - status =3D "okay"; +&blsp1_i2c1 { + status =3D "okay"; + clock-frequency =3D <100000>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&i2c1_pins>; + + charger: bq24192@6b { + compatible =3D "ti,bq24192"; + reg =3D <0x6b>; + interrupts-extended =3D <&spmi_bus 0 0xd5 0 IRQ_TYPE_EDGE_FALLING>; + + omit-battery-class; + + usb_otg_vbus: usb-otg-vbus { }; }; =20 - pinctrl@fd510000 { - sdhc1_pin_a: sdhc1-pin-active { - clk { - pins =3D "sdc1_clk"; - drive-strength =3D <16>; - bias-disable; - }; + fuelgauge: max17048@36 { + compatible =3D "maxim,max17048"; + reg =3D <0x36>; =20 - cmd-data { - pins =3D "sdc1_cmd", "sdc1_data"; - drive-strength =3D <10>; - bias-pull-up; - }; - }; + maxim,double-soc; + maxim,rcomp =3D /bits/ 8 <0x4d>; =20 - sdhc2_pin_a: sdhc2-pin-active { - clk { - pins =3D "sdc2_clk"; - drive-strength =3D <6>; - bias-disable; - }; + interrupt-parent =3D <&tlmm>; + interrupts =3D <9 IRQ_TYPE_LEVEL_LOW>; =20 - cmd-data { - pins =3D "sdc2_cmd", "sdc2_data"; - drive-strength =3D <6>; - bias-pull-up; - }; - }; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&fuelgauge_pin>; =20 - i2c1_pins: i2c1 { - mux { - pins =3D "gpio2", "gpio3"; - function =3D "blsp_i2c1"; + maxim,alert-low-soc-level =3D <2>; + }; +}; =20 - drive-strength =3D <2>; - bias-disable; - }; - }; +&blsp1_i2c2 { + status =3D "okay"; + clock-frequency =3D <355000>; =20 - i2c2_pins: i2c2 { - mux { - pins =3D "gpio6", "gpio7"; - function =3D "blsp_i2c2"; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&i2c2_pins>; =20 - drive-strength =3D <2>; - bias-disable; - }; + synaptics@70 { + compatible =3D "syna,rmi4-i2c"; + reg =3D <0x70>; + + interrupts-extended =3D <&tlmm 5 IRQ_TYPE_EDGE_FALLING>; + vdd-supply =3D <&pm8941_l22>; + vio-supply =3D <&pm8941_lvs3>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&touch_pin>; + + #address-cells =3D <1>; + #size-cells =3D <0>; + + rmi4-f01@1 { + reg =3D <0x1>; + syna,nosleep-mode =3D <1>; }; =20 - i2c3_pins: i2c3 { - mux { - pins =3D "gpio10", "gpio11"; - function =3D "blsp_i2c3"; - drive-strength =3D <2>; - bias-disable; - }; + rmi4-f12@12 { + reg =3D <0x12>; + syna,sensor-type =3D <1>; }; + }; +}; =20 - i2c11_pins: i2c11 { - mux { - pins =3D "gpio83", "gpio84"; - function =3D "blsp_i2c11"; +&blsp1_i2c3 { + status =3D "okay"; + clock-frequency =3D <100000>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&i2c3_pins>; + + avago_apds993@39 { + compatible =3D "avago,apds9930"; + reg =3D <0x39>; + interrupts-extended =3D <&tlmm 61 IRQ_TYPE_EDGE_FALLING>; + vdd-supply =3D <&pm8941_l17>; + vddio-supply =3D <&pm8941_lvs1>; + led-max-microamp =3D <100000>; + amstaos,proximity-diodes =3D <0>; + }; +}; =20 - drive-strength =3D <2>; - bias-disable; - }; +&blsp2_i2c5 { + status =3D "okay"; + clock-frequency =3D <355000>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&i2c11_pins>; + + led-controller@38 { + compatible =3D "ti,lm3630a"; + status =3D "okay"; + reg =3D <0x38>; + + #address-cells =3D <1>; + #size-cells =3D <0>; + + led@0 { + reg =3D <0>; + led-sources =3D <0 1>; + label =3D "lcd-backlight"; + default-brightness =3D <200>; }; + }; +}; + +&blsp2_i2c6 { + status =3D "okay"; + clock-frequency =3D <100000>; =20 - i2c12_pins: i2c12 { - mux { - pins =3D "gpio87", "gpio88"; - function =3D "blsp_i2c12"; - drive-strength =3D <2>; - bias-disable; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&i2c12_pins>; + + mpu6515@68 { + compatible =3D "invensense,mpu6515"; + reg =3D <0x68>; + interrupts-extended =3D <&tlmm 73 IRQ_TYPE_EDGE_FALLING>; + vddio-supply =3D <&pm8941_lvs1>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&mpu6515_pin>; + + mount-matrix =3D "0", "-1", "0", + "-1", "0", "0", + "0", "0", "1"; + + i2c-gate { + #address-cells =3D <1>; + #size-cells =3D <0>; + ak8963@f { + compatible =3D "asahi-kasei,ak8963"; + reg =3D <0x0f>; + gpios =3D <&tlmm 67 0>; + vid-supply =3D <&pm8941_lvs1>; + vdd-supply =3D <&pm8941_l17>; }; - }; =20 - mpu6515_pin: mpu6515 { - irq { - pins =3D "gpio73"; - function =3D "gpio"; - bias-disable; - input-enable; + bmp280@76 { + compatible =3D "bosch,bmp280"; + reg =3D <0x76>; + vdda-supply =3D <&pm8941_lvs1>; + vddd-supply =3D <&pm8941_l17>; }; }; + }; +}; =20 - touch_pin: touch { - int { - pins =3D "gpio5"; - function =3D "gpio"; +&blsp1_uart1 { + status =3D "okay"; +}; =20 - drive-strength =3D <2>; - bias-disable; - input-enable; - }; +&blsp2_uart4 { + status =3D "okay"; =20 - reset { - pins =3D "gpio8"; - function =3D "gpio"; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&blsp2_uart4_pin_a>; =20 - drive-strength =3D <2>; - bias-pull-up; - }; - }; + bluetooth { + compatible =3D "brcm,bcm43438-bt"; + max-speed =3D <3000000>; =20 - panel_pin: panel { - te { - pins =3D "gpio12"; - function =3D "mdp_vsync"; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&bt_pin>; =20 - drive-strength =3D <2>; - bias-disable; - }; - }; + host-wakeup-gpios =3D <&tlmm 42 GPIO_ACTIVE_HIGH>; + device-wakeup-gpios =3D <&tlmm 62 GPIO_ACTIVE_HIGH>; + shutdown-gpios =3D <&tlmm 41 GPIO_ACTIVE_HIGH>; + }; +}; =20 - bt_pin: bt { - hostwake { - pins =3D "gpio42"; - function =3D "gpio"; - }; +&dsi0 { + status =3D "okay"; =20 - devwake { - pins =3D "gpio62"; - function =3D "gpio"; - }; + vdda-supply =3D <&pm8941_l2>; + vdd-supply =3D <&pm8941_lvs3>; + vddio-supply =3D <&pm8941_l12>; + + panel: panel@0 { + reg =3D <0>; + compatible =3D "lg,acx467akm-7"; =20 - shutdown { - pins =3D "gpio41"; - function =3D "gpio"; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&panel_pin>; + + port { + panel_in: endpoint { + remote-endpoint =3D <&dsi0_out>; }; }; + }; +}; =20 - blsp2_uart4_pin_a: blsp2-uart4-pin-active { - tx { - pins =3D "gpio53"; - function =3D "blsp_uart10"; +&dsi0_out { + remote-endpoint =3D <&panel_in>; + data-lanes =3D <0 1 2 3>; +}; =20 - drive-strength =3D <2>; - bias-disable; - }; +&dsi0_phy { + status =3D "okay"; =20 - rx { - pins =3D "gpio54"; - function =3D "blsp_uart10"; + vddio-supply =3D <&pm8941_l12>; +}; =20 - drive-strength =3D <2>; - bias-pull-up; - }; +&mdss { + status =3D "okay"; +}; =20 - cts { - pins =3D "gpio55"; - function =3D "blsp_uart10"; +&otg { + status =3D "okay"; =20 - drive-strength =3D <2>; - bias-pull-up; - }; + phys =3D <&usb_hs1_phy>; + phy-select =3D <&tcsr 0xb000 0>; =20 - rts { - pins =3D "gpio56"; - function =3D "blsp_uart10"; + extcon =3D <&charger>, <&usb_id>; + vbus-supply =3D <&usb_otg_vbus>; =20 - drive-strength =3D <2>; - bias-disable; - }; + hnp-disable; + srp-disable; + adp-disable; + + ulpi { + phy@a { + status =3D "okay"; + + v1p8-supply =3D <&pm8941_l6>; + v3p3-supply =3D <&pm8941_l24>; + + qcom,init-seq =3D /bits/ 8 <0x1 0x64>; }; }; +}; =20 - sdhci@f9824900 { - status =3D "okay"; +&pm8941_gpios { + gpio_keys_pin_a: gpio-keys-active { + pins =3D "gpio2", "gpio3"; + function =3D "normal"; =20 - vmmc-supply =3D <&pm8941_l20>; - vqmmc-supply =3D <&pm8941_s3>; + bias-pull-up; + power-source =3D ; + }; =20 - bus-width =3D <8>; - non-removable; + fuelgauge_pin: fuelgauge-int { + pins =3D "gpio9"; + function =3D "normal"; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc1_pin_a>; + bias-disable; + input-enable; + power-source =3D ; }; =20 - sdhci@f98a4900 { - status =3D "okay"; + wlan_sleep_clk_pin: wl-sleep-clk { + pins =3D "gpio16"; + function =3D "func2"; + + output-high; + power-source =3D ; + }; =20 - max-frequency =3D <100000000>; - bus-width =3D <4>; - non-removable; - vmmc-supply =3D <&vreg_wlan>; - vqmmc-supply =3D <&pm8941_s3>; + wlan_regulator_pin: wl-reg-active { + pins =3D "gpio17"; + function =3D "normal"; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc2_pin_a>; + bias-disable; + power-source =3D ; + }; =20 - #address-cells =3D <1>; - #size-cells =3D <0>; + otg { + gpio-hog; + gpios =3D <35 GPIO_ACTIVE_HIGH>; + output-high; + line-name =3D "otg-gpio"; + }; +}; + +&rpm_requests { + pm8841-regulators { + pm8841_s1: s1 { + regulator-min-microvolt =3D <675000>; + regulator-max-microvolt =3D <1050000>; + }; =20 - bcrmf@1 { - compatible =3D "brcm,bcm4339-fmac", "brcm,bcm4329-fmac"; - reg =3D <1>; + pm8841_s2: s2 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <1050000>; + }; =20 - brcm,drive-strength =3D <10>; + pm8841_s3: s3 { + regulator-min-microvolt =3D <1050000>; + regulator-max-microvolt =3D <1050000>; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&wlan_sleep_clk_pin>; + pm8841_s4: s4 { + regulator-min-microvolt =3D <815000>; + regulator-max-microvolt =3D <900000>; }; }; =20 - serial@f9960000 { - status =3D "okay"; + pm8941-regulators { + vdd_l1_l3-supply =3D <&pm8941_s1>; + vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; + vdd_l4_l11-supply =3D <&pm8941_s1>; + vdd_l5_l7-supply =3D <&pm8941_s2>; + vdd_l6_l12_l14_l15-supply =3D <&pm8941_s2>; + vdd_l8_l16_l18_l19-supply =3D <&vreg_vph_pwr>; + vdd_l9_l10_l17_l22-supply =3D <&vreg_boost>; + vdd_l13_l20_l23_l24-supply =3D <&vreg_boost>; + vdd_l21-supply =3D <&vreg_boost>; + + pm8941_s1: s1 { + regulator-min-microvolt =3D <1300000>; + regulator-max-microvolt =3D <1300000>; + regulator-always-on; + regulator-boot-on; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&blsp2_uart4_pin_a>; + pm8941_s2: s2 { + regulator-min-microvolt =3D <2150000>; + regulator-max-microvolt =3D <2150000>; + regulator-boot-on; + }; =20 - bluetooth { - compatible =3D "brcm,bcm43438-bt"; - max-speed =3D <3000000>; + pm8941_s3: s3 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-always-on; + regulator-boot-on; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&bt_pin>; + pm8941_l1: l1 { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1225000>; + regulator-always-on; + regulator-boot-on; + }; =20 - host-wakeup-gpios =3D <&tlmm 42 GPIO_ACTIVE_HIGH>; - device-wakeup-gpios =3D <&tlmm 62 GPIO_ACTIVE_HIGH>; - shutdown-gpios =3D <&tlmm 41 GPIO_ACTIVE_HIGH>; + pm8941_l2: l2 { + regulator-min-microvolt =3D <1200000>; + regulator-max-microvolt =3D <1200000>; }; - }; =20 - i2c@f9967000 { - status =3D "okay"; - pinctrl-names =3D "default"; - pinctrl-0 =3D <&i2c11_pins>; - clock-frequency =3D <355000>; - qcom,src-freq =3D <50000000>; + pm8941_l3: l3 { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1225000>; + }; =20 - led-controller@38 { - compatible =3D "ti,lm3630a"; - status =3D "okay"; - reg =3D <0x38>; + pm8941_l4: l4 { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1225000>; + }; =20 - #address-cells =3D <1>; - #size-cells =3D <0>; + pm8941_l5: l5 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; =20 - led@0 { - reg =3D <0>; - led-sources =3D <0 1>; - label =3D "lcd-backlight"; - default-brightness =3D <200>; - }; + pm8941_l6: l6 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-boot-on; }; - }; =20 - i2c@f9968000 { - status =3D "okay"; - pinctrl-names =3D "default"; - pinctrl-0 =3D <&i2c12_pins>; - clock-frequency =3D <100000>; - qcom,src-freq =3D <50000000>; - - mpu6515@68 { - compatible =3D "invensense,mpu6515"; - reg =3D <0x68>; - interrupts-extended =3D <&tlmm 73 IRQ_TYPE_EDGE_FALLING>; - vddio-supply =3D <&pm8941_lvs1>; - - pinctrl-names =3D "default"; - pinctrl-0 =3D <&mpu6515_pin>; - - mount-matrix =3D "0", "-1", "0", - "-1", "0", "0", - "0", "0", "1"; - - i2c-gate { - #address-cells =3D <1>; - #size-cells =3D <0>; - ak8963@f { - compatible =3D "asahi-kasei,ak8963"; - reg =3D <0x0f>; - gpios =3D <&tlmm 67 0>; - vid-supply =3D <&pm8941_lvs1>; - vdd-supply =3D <&pm8941_l17>; - }; - - bmp280@76 { - compatible =3D "bosch,bmp280"; - reg =3D <0x76>; - vdda-supply =3D <&pm8941_lvs1>; - vddd-supply =3D <&pm8941_l17>; - }; - }; + pm8941_l7: l7 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-boot-on; }; - }; =20 - i2c@f9923000 { - status =3D "okay"; - pinctrl-names =3D "default"; - pinctrl-0 =3D <&i2c1_pins>; - clock-frequency =3D <100000>; - qcom,src-freq =3D <50000000>; + pm8941_l8: l8 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; =20 - charger: bq24192@6b { - compatible =3D "ti,bq24192"; - reg =3D <0x6b>; - interrupts-extended =3D <&spmi_bus 0 0xd5 0 IRQ_TYPE_EDGE_FALLING>; + pm8941_l9: l9 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2950000>; + }; =20 - omit-battery-class; + pm8941_l10: l10 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2950000>; + }; =20 - usb_otg_vbus: usb-otg-vbus { }; + pm8941_l11: l11 { + regulator-min-microvolt =3D <1300000>; + regulator-max-microvolt =3D <1300000>; }; =20 - fuelgauge: max17048@36 { - compatible =3D "maxim,max17048"; - reg =3D <0x36>; + pm8941_l12: l12 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-always-on; + regulator-boot-on; + }; + + pm8941_l13: l13 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2950000>; + regulator-boot-on; + }; + + pm8941_l14: l14 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; + + pm8941_l15: l15 { + regulator-min-microvolt =3D <2050000>; + regulator-max-microvolt =3D <2050000>; + }; + + pm8941_l16: l16 { + regulator-min-microvolt =3D <2700000>; + regulator-max-microvolt =3D <2700000>; + }; + + pm8941_l17: l17 { + regulator-min-microvolt =3D <2850000>; + regulator-max-microvolt =3D <2850000>; + }; + + pm8941_l18: l18 { + regulator-min-microvolt =3D <2850000>; + regulator-max-microvolt =3D <2850000>; + }; + + pm8941_l19: l19 { + regulator-min-microvolt =3D <3000000>; + regulator-max-microvolt =3D <3300000>; + }; =20 - maxim,double-soc; - maxim,rcomp =3D /bits/ 8 <0x4d>; + pm8941_l20: l20 { + regulator-min-microvolt =3D <2950000>; + regulator-max-microvolt =3D <2950000>; + regulator-system-load =3D <200000>; + regulator-allow-set-load; + regulator-boot-on; + }; + + pm8941_l21: l21 { + regulator-min-microvolt =3D <2950000>; + regulator-max-microvolt =3D <2950000>; + regulator-boot-on; + }; =20 - interrupt-parent =3D <&tlmm>; - interrupts =3D <9 IRQ_TYPE_LEVEL_LOW>; + pm8941_l22: l22 { + regulator-min-microvolt =3D <3000000>; + regulator-max-microvolt =3D <3300000>; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&fuelgauge_pin>; + pm8941_l23: l23 { + regulator-min-microvolt =3D <3000000>; + regulator-max-microvolt =3D <3000000>; + }; =20 - maxim,alert-low-soc-level =3D <2>; + pm8941_l24: l24 { + regulator-min-microvolt =3D <3075000>; + regulator-max-microvolt =3D <3075000>; + regulator-boot-on; }; }; +}; =20 - i2c@f9924000 { - status =3D "okay"; +&sdhc_1 { + status =3D "okay"; =20 - clock-frequency =3D <355000>; - qcom,src-freq =3D <50000000>; + vmmc-supply =3D <&pm8941_l20>; + vqmmc-supply =3D <&pm8941_s3>; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&i2c2_pins>; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sdhc1_pin_a>; +}; =20 - synaptics@70 { - compatible =3D "syna,rmi4-i2c"; - reg =3D <0x70>; +&sdhc_2 { + status =3D "okay"; =20 - interrupts-extended =3D <&tlmm 5 IRQ_TYPE_EDGE_FALLING>; - vdd-supply =3D <&pm8941_l22>; - vio-supply =3D <&pm8941_lvs3>; + max-frequency =3D <100000000>; + vmmc-supply =3D <&vreg_wlan>; + vqmmc-supply =3D <&pm8941_s3>; + non-removable; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&touch_pin>; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sdhc2_pin_a>; =20 - #address-cells =3D <1>; - #size-cells =3D <0>; + #address-cells =3D <1>; + #size-cells =3D <0>; =20 - rmi4-f01@1 { - reg =3D <0x1>; - syna,nosleep-mode =3D <1>; - }; + bcrmf@1 { + compatible =3D "brcm,bcm4339-fmac", "brcm,bcm4329-fmac"; + reg =3D <1>; =20 - rmi4-f12@12 { - reg =3D <0x12>; - syna,sensor-type =3D <1>; - }; + brcm,drive-strength =3D <10>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&wlan_sleep_clk_pin>; + }; +}; + +&tlmm { + sdhc1_pin_a: sdhc1-pin-active { + clk { + pins =3D "sdc1_clk"; + drive-strength =3D <16>; + bias-disable; + }; + + cmd-data { + pins =3D "sdc1_cmd", "sdc1_data"; + drive-strength =3D <10>; + bias-pull-up; }; }; =20 - i2c@f9925000 { - status =3D "okay"; - pinctrl-names =3D "default"; - pinctrl-0 =3D <&i2c3_pins>; - clock-frequency =3D <100000>; - qcom,src-freq =3D <50000000>; + sdhc2_pin_a: sdhc2-pin-active { + clk { + pins =3D "sdc2_clk"; + drive-strength =3D <6>; + bias-disable; + }; =20 - avago_apds993@39 { - compatible =3D "avago,apds9930"; - reg =3D <0x39>; - interrupts-extended =3D <&tlmm 61 IRQ_TYPE_EDGE_FALLING>; - vdd-supply =3D <&pm8941_l17>; - vddio-supply =3D <&pm8941_lvs1>; - led-max-microamp =3D <100000>; - amstaos,proximity-diodes =3D <0>; + cmd-data { + pins =3D "sdc2_cmd", "sdc2_data"; + drive-strength =3D <6>; + bias-pull-up; }; }; =20 - usb@f9a55000 { - status =3D "okay"; + i2c1_pins: i2c1 { + mux { + pins =3D "gpio2", "gpio3"; + function =3D "blsp_i2c1"; =20 - phys =3D <&usb_hs1_phy>; - phy-select =3D <&tcsr 0xb000 0>; + drive-strength =3D <2>; + bias-disable; + }; + }; =20 - extcon =3D <&charger>, <&usb_id>; - vbus-supply =3D <&usb_otg_vbus>; + i2c2_pins: i2c2 { + mux { + pins =3D "gpio6", "gpio7"; + function =3D "blsp_i2c2"; =20 - hnp-disable; - srp-disable; - adp-disable; + drive-strength =3D <2>; + bias-disable; + }; + }; =20 - ulpi { - phy@a { - status =3D "okay"; + i2c3_pins: i2c3 { + mux { + pins =3D "gpio10", "gpio11"; + function =3D "blsp_i2c3"; + drive-strength =3D <2>; + bias-disable; + }; + }; =20 - v1p8-supply =3D <&pm8941_l6>; - v3p3-supply =3D <&pm8941_l24>; + i2c11_pins: i2c11 { + mux { + pins =3D "gpio83", "gpio84"; + function =3D "blsp_i2c11"; =20 - qcom,init-seq =3D /bits/ 8 <0x1 0x64>; - }; + drive-strength =3D <2>; + bias-disable; }; }; =20 - mdss@fd900000 { - status =3D "okay"; + i2c12_pins: i2c12 { + mux { + pins =3D "gpio87", "gpio88"; + function =3D "blsp_i2c12"; + drive-strength =3D <2>; + bias-disable; + }; + }; =20 - mdp@fd900000 { - status =3D "okay"; + mpu6515_pin: mpu6515 { + irq { + pins =3D "gpio73"; + function =3D "gpio"; + bias-disable; + input-enable; }; + }; =20 - dsi@fd922800 { - status =3D "okay"; + touch_pin: touch { + int { + pins =3D "gpio5"; + function =3D "gpio"; =20 - vdda-supply =3D <&pm8941_l2>; - vdd-supply =3D <&pm8941_lvs3>; - vddio-supply =3D <&pm8941_l12>; + drive-strength =3D <2>; + bias-disable; + input-enable; + }; =20 - #address-cells =3D <1>; - #size-cells =3D <0>; + reset { + pins =3D "gpio8"; + function =3D "gpio"; =20 - ports { - port@1 { - endpoint { - remote-endpoint =3D <&panel_in>; - data-lanes =3D <0 1 2 3>; - }; - }; - }; + drive-strength =3D <2>; + bias-pull-up; + }; + }; =20 - panel: panel@0 { - reg =3D <0>; - compatible =3D "lg,acx467akm-7"; + panel_pin: panel { + te { + pins =3D "gpio12"; + function =3D "mdp_vsync"; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&panel_pin>; + drive-strength =3D <2>; + bias-disable; + }; + }; =20 - port { - panel_in: endpoint { - remote-endpoint =3D <&dsi0_out>; - }; - }; - }; + bt_pin: bt { + hostwake { + pins =3D "gpio42"; + function =3D "gpio"; }; =20 - dsi-phy@fd922a00 { - status =3D "okay"; + devwake { + pins =3D "gpio62"; + function =3D "gpio"; + }; =20 - vddio-supply =3D <&pm8941_l12>; + shutdown { + pins =3D "gpio41"; + function =3D "gpio"; }; }; -}; =20 -&spmi_bus { - pm8941@0 { - gpios@c000 { - gpio_keys_pin_a: gpio-keys-active { - pins =3D "gpio2", "gpio3"; - function =3D "normal"; + blsp2_uart4_pin_a: blsp2-uart4-pin-active { + tx { + pins =3D "gpio53"; + function =3D "blsp_uart10"; =20 - bias-pull-up; - power-source =3D ; - }; - - fuelgauge_pin: fuelgauge-int { - pins =3D "gpio9"; - function =3D "normal"; + drive-strength =3D <2>; + bias-disable; + }; =20 - bias-disable; - input-enable; - power-source =3D ; - }; + rx { + pins =3D "gpio54"; + function =3D "blsp_uart10"; =20 - wlan_sleep_clk_pin: wl-sleep-clk { - pins =3D "gpio16"; - function =3D "func2"; + drive-strength =3D <2>; + bias-pull-up; + }; =20 - output-high; - power-source =3D ; - }; + cts { + pins =3D "gpio55"; + function =3D "blsp_uart10"; =20 - wlan_regulator_pin: wl-reg-active { - pins =3D "gpio17"; - function =3D "normal"; + drive-strength =3D <2>; + bias-pull-up; + }; =20 - bias-disable; - power-source =3D ; - }; + rts { + pins =3D "gpio56"; + function =3D "blsp_uart10"; =20 - otg { - gpio-hog; - gpios =3D <35 GPIO_ACTIVE_HIGH>; - output-high; - line-name =3D "otg-gpio"; - }; + drive-strength =3D <2>; + bias-disable; }; }; }; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC7A3C3F6B0 for ; Mon, 15 Aug 2022 20:45:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345573AbiHOUpF (ORCPT ); Mon, 15 Aug 2022 16:45:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347065AbiHOUmT (ORCPT ); Mon, 15 Aug 2022 16:42:19 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A317B14EF; Mon, 15 Aug 2022 12:07:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 1E8D3CE10E7; Mon, 15 Aug 2022 19:07:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5EE3C433D6; Mon, 15 Aug 2022 19:07:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590456; bh=IlBtRUe7fQ991zsBoGn2EV5UFBHqP9Ucl3aDHFynZMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DFAyQ6dczbPixNRXsL1+s5cV0TwW4YFQj2nKB//+FmQrWGGoHxhwUnmwRCTxZqGMK YMVuiaLa2GrqW4XX6T0potui4bSLQvRndQagvgKcCUGNk06EbNlOgIAt9FgMwaDeyL rwfwvwKaP4YcYO8A/yNt81Lepc+iU4gG7fuGB268= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0235/1095] ARM: dts: qcom-msm8974-klte: Use &labels Date: Mon, 15 Aug 2022 19:53:54 +0200 Message-Id: <20220815180439.496470595@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 1d59524b9181e17110ae7b809c62a6a66f336fd6 ] Use &labels to align with the style used in new DTS and apply tiny style fixes. Signed-off-by: Konrad Dybcio [bjorn: Rebased on top of Krzysztof's fixes] Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220415115633.575010-12-konrad.dybcio@soma= inline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../boot/dts/qcom-msm8974-samsung-klte.dts | 1202 ++++++++--------- arch/arm/boot/dts/qcom-msm8974.dtsi | 4 +- 2 files changed, 585 insertions(+), 621 deletions(-) diff --git a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts b/arch/arm/boo= t/dts/qcom-msm8974-samsung-klte.dts index 60244e0c37ba..3b1ea8c24f57 100644 --- a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +++ b/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts @@ -13,7 +13,7 @@ / { aliases { serial0 =3D &blsp1_uart1; mmc0 =3D &sdhc_1; /* SDC1 eMMC slot */ - mmc1 =3D &sdhc_2; /* SDC2 SD card slot */ + mmc1 =3D &sdhc_3; /* SDC2 SD card slot */ }; =20 chosen { @@ -52,197 +52,6 @@ volume-up { }; }; =20 - smd { - rpm { - rpm-requests { - pma8084-regulators { - compatible =3D "qcom,rpm-pma8084-regulators"; - status =3D "okay"; - - pma8084_s1: s1 { - regulator-min-microvolt =3D <675000>; - regulator-max-microvolt =3D <1050000>; - regulator-always-on; - }; - - pma8084_s2: s2 { - regulator-min-microvolt =3D <500000>; - regulator-max-microvolt =3D <1050000>; - }; - - pma8084_s3: s3 { - regulator-min-microvolt =3D <1300000>; - regulator-max-microvolt =3D <1300000>; - }; - - pma8084_s4: s4 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - pma8084_s5: s5 { - regulator-min-microvolt =3D <2150000>; - regulator-max-microvolt =3D <2150000>; - }; - - pma8084_s6: s6 { - regulator-min-microvolt =3D <1050000>; - regulator-max-microvolt =3D <1050000>; - }; - - pma8084_l1: l1 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - }; - - pma8084_l2: l2 { - regulator-min-microvolt =3D <1200000>; - regulator-max-microvolt =3D <1200000>; - }; - - pma8084_l3: l3 { - regulator-min-microvolt =3D <1050000>; - regulator-max-microvolt =3D <1200000>; - }; - - pma8084_l4: l4 { - regulator-min-microvolt =3D <1200000>; - regulator-max-microvolt =3D <1225000>; - }; - - pma8084_l5: l5 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - pma8084_l6: l6 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - pma8084_l7: l7 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - pma8084_l8: l8 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - pma8084_l9: l9 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - }; - - pma8084_l10: l10 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - }; - - pma8084_l11: l11 { - regulator-min-microvolt =3D <1300000>; - regulator-max-microvolt =3D <1300000>; - }; - - pma8084_l12: l12 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - regulator-always-on; - }; - - pma8084_l13: l13 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - }; - - pma8084_l14: l14 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - pma8084_l15: l15 { - regulator-min-microvolt =3D <2050000>; - regulator-max-microvolt =3D <2050000>; - }; - - pma8084_l16: l16 { - regulator-min-microvolt =3D <2700000>; - regulator-max-microvolt =3D <2700000>; - }; - - pma8084_l17: l17 { - regulator-min-microvolt =3D <2850000>; - regulator-max-microvolt =3D <2850000>; - }; - - pma8084_l18: l18 { - regulator-min-microvolt =3D <2850000>; - regulator-max-microvolt =3D <2850000>; - }; - - pma8084_l19: l19 { - regulator-min-microvolt =3D <3300000>; - regulator-max-microvolt =3D <3300000>; - }; - - pma8084_l20: l20 { - regulator-min-microvolt =3D <2950000>; - regulator-max-microvolt =3D <2950000>; - - regulator-allow-set-load; - regulator-system-load =3D <200000>; - }; - - pma8084_l21: l21 { - regulator-min-microvolt =3D <2950000>; - regulator-max-microvolt =3D <2950000>; - - regulator-allow-set-load; - regulator-system-load =3D <200000>; - }; - - pma8084_l22: l22 { - regulator-min-microvolt =3D <3000000>; - regulator-max-microvolt =3D <3300000>; - }; - - pma8084_l23: l23 { - regulator-min-microvolt =3D <3000000>; - regulator-max-microvolt =3D <3000000>; - }; - - pma8084_l24: l24 { - regulator-min-microvolt =3D <3075000>; - regulator-max-microvolt =3D <3075000>; - }; - - pma8084_l25: l25 { - regulator-min-microvolt =3D <2100000>; - regulator-max-microvolt =3D <2100000>; - }; - - pma8084_l26: l26 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2050000>; - }; - - pma8084_l27: l27 { - regulator-min-microvolt =3D <1000000>; - regulator-max-microvolt =3D <1225000>; - }; - - pma8084_lvs1: lvs1 {}; - pma8084_lvs2: lvs2 {}; - pma8084_lvs3: lvs3 {}; - pma8084_lvs4: lvs4 {}; - - pma8084_5vs1: 5vs1 {}; - }; - }; - }; - }; - i2c-gpio-touchkey { compatible =3D "i2c-gpio"; #address-cells =3D <1>; @@ -347,562 +156,717 @@ vreg_panel: panel-regulator { }; =20 /delete-node/ vreg-boost; - - adsp-pil { - cx-supply =3D <&pma8084_s2>; - }; }; =20 -&soc { - serial@f991e000 { - status =3D "okay"; - }; +&blsp1_i2c2 { + status =3D "okay"; =20 - /* blsp2_uart2 */ - serial@f995e000 { - status =3D "okay"; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&i2c2_pins>; =20 - pinctrl-names =3D "default", "sleep"; - pinctrl-0 =3D <&blsp2_uart2_pins_active>; - pinctrl-1 =3D <&blsp2_uart2_pins_sleep>; + touchscreen@20 { + compatible =3D "syna,rmi4-i2c"; + reg =3D <0x20>; =20 - bluetooth { - compatible =3D "brcm,bcm43540-bt"; - max-speed =3D <3000000>; - pinctrl-names =3D "default"; - pinctrl-0 =3D <&bt_pins>; - device-wakeup-gpios =3D <&tlmm 91 GPIO_ACTIVE_HIGH>; - shutdown-gpios =3D <&gpio_expander 9 GPIO_ACTIVE_HIGH>; - interrupt-parent =3D <&tlmm>; - interrupts =3D <75 IRQ_TYPE_LEVEL_HIGH>; - interrupt-names =3D "host-wakeup"; - }; - }; + interrupt-parent =3D <&pma8084_gpios>; + interrupts =3D <8 IRQ_TYPE_EDGE_FALLING>; =20 - pinctrl@fd510000 { - blsp2_uart2_pins_active: blsp2-uart2-pins-active { - pins =3D "gpio45", "gpio46", "gpio47", "gpio48"; - function =3D "blsp_uart8"; - drive-strength =3D <8>; - bias-disable; + vdd-supply =3D <&max77826_ldo13>; + vio-supply =3D <&pma8084_lvs2>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&touch_pin>; + + syna,startup-delay-ms =3D <100>; + + #address-cells =3D <1>; + #size-cells =3D <0>; + + rmi4-f01@1 { + reg =3D <0x1>; + syna,nosleep-mode =3D <1>; }; =20 - blsp2_uart2_pins_sleep: blsp2-uart2-pins-sleep { - pins =3D "gpio45", "gpio46", "gpio47", "gpio48"; - function =3D "gpio"; - drive-strength =3D <2>; - bias-pull-down; + rmi4-f12@12 { + reg =3D <0x12>; + syna,sensor-type =3D <1>; }; + }; +}; + +&blsp1_i2c6 { + status =3D "okay"; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&i2c6_pins>; =20 - bt_pins: bt-pins { - hostwake { - pins =3D "gpio75"; - function =3D "gpio"; - drive-strength =3D <16>; - input-enable; + pmic@60 { + reg =3D <0x60>; + compatible =3D "maxim,max77826"; + + regulators { + max77826_ldo1: LDO1 { + regulator-min-microvolt =3D <1200000>; + regulator-max-microvolt =3D <1200000>; }; =20 - devwake { - pins =3D "gpio91"; - function =3D "gpio"; - drive-strength =3D <2>; + max77826_ldo2: LDO2 { + regulator-min-microvolt =3D <1000000>; + regulator-max-microvolt =3D <1000000>; }; - }; =20 - sdhc1_pin_a: sdhc1-pin-active { - clk { - pins =3D "sdc1_clk"; - drive-strength =3D <4>; - bias-disable; + max77826_ldo3: LDO3 { + regulator-min-microvolt =3D <1200000>; + regulator-max-microvolt =3D <1200000>; }; =20 - cmd-data { - pins =3D "sdc1_cmd", "sdc1_data"; - drive-strength =3D <4>; - bias-pull-up; + max77826_ldo4: LDO4 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; }; - }; =20 - sdhc2_pin_a: sdhc2-pin-active { - clk-cmd-data { - pins =3D "gpio35", "gpio36", "gpio37", "gpio38", - "gpio39", "gpio40"; - function =3D "sdc3"; - drive-strength =3D <8>; - bias-disable; + max77826_ldo5: LDO5 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; }; - }; =20 - sdhc2_cd_pin: sdhc2-cd { - pins =3D "gpio62"; - function =3D "gpio"; + max77826_ldo6: LDO6 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <3300000>; + }; =20 - drive-strength =3D <2>; - bias-disable; - }; + max77826_ldo7: LDO7 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; =20 - sdhc3_pin_a: sdhc3-pin-active { - clk { - pins =3D "sdc2_clk"; - drive-strength =3D <6>; - bias-disable; + max77826_ldo8: LDO8 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <3300000>; }; =20 - cmd-data { - pins =3D "sdc2_cmd", "sdc2_data"; - drive-strength =3D <6>; - bias-pull-up; + max77826_ldo9: LDO9 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; }; - }; =20 - i2c2_pins: i2c2 { - mux { - pins =3D "gpio6", "gpio7"; - function =3D "blsp_i2c2"; + max77826_ldo10: LDO10 { + regulator-min-microvolt =3D <2800000>; + regulator-max-microvolt =3D <2950000>; + }; =20 - drive-strength =3D <2>; - bias-disable; + max77826_ldo11: LDO11 { + regulator-min-microvolt =3D <2700000>; + regulator-max-microvolt =3D <2950000>; }; - }; =20 - i2c6_pins: i2c6 { - mux { - pins =3D "gpio29", "gpio30"; - function =3D "blsp_i2c6"; + max77826_ldo12: LDO12 { + regulator-min-microvolt =3D <2500000>; + regulator-max-microvolt =3D <3300000>; + }; =20 - drive-strength =3D <2>; - bias-disable; + max77826_ldo13: LDO13 { + regulator-min-microvolt =3D <3300000>; + regulator-max-microvolt =3D <3300000>; }; - }; =20 - i2c12_pins: i2c12 { - mux { - pins =3D "gpio87", "gpio88"; - function =3D "blsp_i2c12"; + max77826_ldo14: LDO14 { + regulator-min-microvolt =3D <3300000>; + regulator-max-microvolt =3D <3300000>; + }; =20 - drive-strength =3D <2>; - bias-disable; + max77826_ldo15: LDO15 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; }; - }; =20 - i2c_touchkey_pins: i2c-touchkey { - mux { - pins =3D "gpio95", "gpio96"; - function =3D "gpio"; - input-enable; - bias-pull-up; + max77826_buck: BUCK { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1225000>; }; - }; =20 - i2c_led_gpioex_pins: i2c-led-gpioex { - mux { - pins =3D "gpio120", "gpio121"; - function =3D "gpio"; - input-enable; - bias-pull-down; + max77826_buckboost: BUCKBOOST { + regulator-min-microvolt =3D <3400000>; + regulator-max-microvolt =3D <3400000>; }; }; + }; +}; =20 - gpioex_pin: gpioex { - res { - pins =3D "gpio145"; - function =3D "gpio"; +&blsp1_uart2 { + status =3D "okay"; +}; =20 - bias-pull-up; - drive-strength =3D <2>; - }; - }; +&blsp2_i2c6 { + status =3D "okay"; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&i2c12_pins>; + + fuelgauge@36 { + compatible =3D "maxim,max17048"; + reg =3D <0x36>; + + maxim,double-soc; + maxim,rcomp =3D /bits/ 8 <0x56>; + + interrupt-parent =3D <&pma8084_gpios>; + interrupts =3D <21 IRQ_TYPE_LEVEL_LOW>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&fuelgauge_pin>; + }; +}; =20 - wifi_pin: wifi { - int { - pins =3D "gpio92"; - function =3D "gpio"; +&blsp2_uart2 { + status =3D "okay"; =20 - input-enable; - bias-pull-down; + pinctrl-names =3D "default", "sleep"; + pinctrl-0 =3D <&blsp2_uart2_pins_active>; + pinctrl-1 =3D <&blsp2_uart2_pins_sleep>; + + bluetooth { + compatible =3D "brcm,bcm43540-bt"; + max-speed =3D <3000000>; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&bt_pins>; + device-wakeup-gpios =3D <&tlmm 91 GPIO_ACTIVE_HIGH>; + shutdown-gpios =3D <&gpio_expander 9 GPIO_ACTIVE_HIGH>; + interrupt-parent =3D <&tlmm>; + interrupts =3D <75 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names =3D "host-wakeup"; + }; +}; + +&dsi0 { + status =3D "okay"; + + vdda-supply =3D <&pma8084_l2>; + vdd-supply =3D <&pma8084_l22>; + vddio-supply =3D <&pma8084_l12>; + + panel: panel@0 { + reg =3D <0>; + compatible =3D "samsung,s6e3fa2"; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&panel_te_pin &panel_rst_pin>; + + iovdd-supply =3D <&pma8084_lvs4>; + vddr-supply =3D <&vreg_panel>; + + reset-gpios =3D <&pma8084_gpios 17 GPIO_ACTIVE_LOW>; + te-gpios =3D <&tlmm 12 GPIO_ACTIVE_HIGH>; + + port { + panel_in: endpoint { + remote-endpoint =3D <&dsi0_out>; }; }; + }; +}; =20 - panel_te_pin: panel { - te { - pins =3D "gpio12"; - function =3D "mdp_vsync"; +&dsi0_out { + remote-endpoint =3D <&panel_in>; + data-lanes =3D <0 1 2 3>; +}; =20 - drive-strength =3D <2>; - bias-disable; - }; +&dsi0_phy { + status =3D "okay"; + + vddio-supply =3D <&pma8084_l12>; +}; + +&gpu { + status =3D "okay"; +}; + +&mdss { + status =3D "okay"; +}; + +&otg { + status =3D "okay"; + + phys =3D <&usb_hs1_phy>; + phy-select =3D <&tcsr 0xb000 0>; + + hnp-disable; + srp-disable; + adp-disable; + + ulpi { + phy@a { + status =3D "okay"; + + v1p8-supply =3D <&pma8084_l6>; + v3p3-supply =3D <&pma8084_l24>; + + qcom,init-seq =3D /bits/ 8 <0x1 0x64>; }; }; +}; =20 - sdhci@f9824900 { - status =3D "okay"; +&pma8084_gpios { + gpio_keys_pin_a: gpio-keys-active { + pins =3D "gpio2", "gpio3", "gpio5"; + function =3D "normal"; =20 - vmmc-supply =3D <&pma8084_l20>; - vqmmc-supply =3D <&pma8084_s4>; + bias-pull-up; + power-source =3D ; + }; =20 - bus-width =3D <8>; - non-removable; + touchkey_pin: touchkey-int-pin { + pins =3D "gpio6"; + function =3D "normal"; + bias-disable; + input-enable; + power-source =3D ; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc1_pin_a>; + touch_pin: touchscreen-int-pin { + pins =3D "gpio8"; + function =3D "normal"; + bias-disable; + input-enable; + power-source =3D ; }; =20 - sdhci@f9864900 { - status =3D "okay"; + panel_en_pin: panel-en-pin { + pins =3D "gpio14"; + function =3D "normal"; + bias-pull-up; + power-source =3D ; + qcom,drive-strength =3D ; + }; =20 - max-frequency =3D <100000000>; + wlan_sleep_clk_pin: wlan-sleep-clk-pin { + pins =3D "gpio16"; + function =3D "func2"; =20 - vmmc-supply =3D <&pma8084_l21>; - vqmmc-supply =3D <&pma8084_l13>; + output-high; + power-source =3D ; + qcom,drive-strength =3D ; + }; =20 - bus-width =3D <4>; + panel_rst_pin: panel-rst-pin { + pins =3D "gpio17"; + function =3D "normal"; + bias-disable; + power-source =3D ; + qcom,drive-strength =3D ; + }; =20 - /* cd-gpio is intentionally disabled. If enabled, an SD card - * present during boot is not initialized correctly. Without - * cd-gpios the driver resorts to polling, so hotplug works. - */ - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc2_pin_a /* &sdhc2_cd_pin */>; - // cd-gpios =3D <&tlmm 62 GPIO_ACTIVE_LOW>; + fuelgauge_pin: fuelgauge-int-pin { + pins =3D "gpio21"; + function =3D "normal"; + bias-disable; + input-enable; + power-source =3D ; }; +}; =20 - sdhci@f98a4900 { - status =3D "okay"; +&remoteproc_adsp { + cx-supply =3D <&pma8084_s2>; +}; =20 - #address-cells =3D <1>; - #size-cells =3D <0>; +&remoteproc_mss { + cx-supply =3D <&pma8084_s2>; + mss-supply =3D <&pma8084_s6>; + mx-supply =3D <&pma8084_s1>; + pll-supply =3D <&pma8084_l12>; +}; =20 - max-frequency =3D <100000000>; +&rpm_requests { + pma8084-regulators { + compatible =3D "qcom,rpm-pma8084-regulators"; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc3_pin_a>; + pma8084_s1: s1 { + regulator-min-microvolt =3D <675000>; + regulator-max-microvolt =3D <1050000>; + regulator-always-on; + }; =20 - vmmc-supply =3D <&vreg_wlan>; - vqmmc-supply =3D <&pma8084_s4>; + pma8084_s2: s2 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <1050000>; + }; =20 - bus-width =3D <4>; - non-removable; + pma8084_s3: s3 { + regulator-min-microvolt =3D <1300000>; + regulator-max-microvolt =3D <1300000>; + }; =20 - wifi@1 { - reg =3D <1>; - compatible =3D "brcm,bcm4329-fmac"; + pma8084_s4: s4 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; =20 - interrupt-parent =3D <&tlmm>; - interrupts =3D <92 IRQ_TYPE_LEVEL_HIGH>; - interrupt-names =3D "host-wake"; + pma8084_s5: s5 { + regulator-min-microvolt =3D <2150000>; + regulator-max-microvolt =3D <2150000>; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&wlan_sleep_clk_pin &wifi_pin>; + pma8084_s6: s6 { + regulator-min-microvolt =3D <1050000>; + regulator-max-microvolt =3D <1050000>; }; - }; =20 - usb@f9a55000 { - status =3D "okay"; + pma8084_l1: l1 { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1225000>; + }; =20 - phys =3D <&usb_hs1_phy>; - phy-select =3D <&tcsr 0xb000 0>; - /*extcon =3D <&smbb>, <&usb_id>;*/ - /*vbus-supply =3D <&chg_otg>;*/ + pma8084_l2: l2 { + regulator-min-microvolt =3D <1200000>; + regulator-max-microvolt =3D <1200000>; + }; =20 - hnp-disable; - srp-disable; - adp-disable; + pma8084_l3: l3 { + regulator-min-microvolt =3D <1050000>; + regulator-max-microvolt =3D <1200000>; + }; =20 - ulpi { - phy@a { - status =3D "okay"; + pma8084_l4: l4 { + regulator-min-microvolt =3D <1200000>; + regulator-max-microvolt =3D <1225000>; + }; =20 - v1p8-supply =3D <&pma8084_l6>; - v3p3-supply =3D <&pma8084_l24>; + pma8084_l5: l5 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; =20 - /*extcon =3D <&smbb>;*/ - qcom,init-seq =3D /bits/ 8 <0x1 0x64>; - }; + pma8084_l6: l6 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; }; - }; =20 - i2c@f9924000 { - status =3D "okay"; + pma8084_l7: l7 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&i2c2_pins>; + pma8084_l8: l8 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; =20 - touchscreen@20 { - compatible =3D "syna,rmi4-i2c"; - reg =3D <0x20>; + pma8084_l9: l9 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2950000>; + }; =20 - interrupt-parent =3D <&pma8084_gpios>; - interrupts =3D <8 IRQ_TYPE_EDGE_FALLING>; + pma8084_l10: l10 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2950000>; + }; =20 - vdd-supply =3D <&max77826_ldo13>; - vio-supply =3D <&pma8084_lvs2>; + pma8084_l11: l11 { + regulator-min-microvolt =3D <1300000>; + regulator-max-microvolt =3D <1300000>; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&touch_pin>; + pma8084_l12: l12 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-always-on; + }; =20 - syna,startup-delay-ms =3D <100>; + pma8084_l13: l13 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2950000>; + }; =20 - #address-cells =3D <1>; - #size-cells =3D <0>; + pma8084_l14: l14 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; =20 - rmi4-f01@1 { - reg =3D <0x1>; - syna,nosleep-mode =3D <1>; - }; + pma8084_l15: l15 { + regulator-min-microvolt =3D <2050000>; + regulator-max-microvolt =3D <2050000>; + }; =20 - rmi4-f12@12 { - reg =3D <0x12>; - syna,sensor-type =3D <1>; - }; + pma8084_l16: l16 { + regulator-min-microvolt =3D <2700000>; + regulator-max-microvolt =3D <2700000>; }; - }; =20 - i2c@f9928000 { - status =3D "okay"; + pma8084_l17: l17 { + regulator-min-microvolt =3D <2850000>; + regulator-max-microvolt =3D <2850000>; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&i2c6_pins>; - - pmic@60 { - reg =3D <0x60>; - compatible =3D "maxim,max77826"; - - regulators { - max77826_ldo1: LDO1 { - regulator-min-microvolt =3D <1200000>; - regulator-max-microvolt =3D <1200000>; - }; - - max77826_ldo2: LDO2 { - regulator-min-microvolt =3D <1000000>; - regulator-max-microvolt =3D <1000000>; - }; - - max77826_ldo3: LDO3 { - regulator-min-microvolt =3D <1200000>; - regulator-max-microvolt =3D <1200000>; - }; - - max77826_ldo4: LDO4 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - max77826_ldo5: LDO5 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - max77826_ldo6: LDO6 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <3300000>; - }; - - max77826_ldo7: LDO7 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - max77826_ldo8: LDO8 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <3300000>; - }; - - max77826_ldo9: LDO9 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - max77826_ldo10: LDO10 { - regulator-min-microvolt =3D <2800000>; - regulator-max-microvolt =3D <2950000>; - }; - - max77826_ldo11: LDO11 { - regulator-min-microvolt =3D <2700000>; - regulator-max-microvolt =3D <2950000>; - }; - - max77826_ldo12: LDO12 { - regulator-min-microvolt =3D <2500000>; - regulator-max-microvolt =3D <3300000>; - }; - - max77826_ldo13: LDO13 { - regulator-min-microvolt =3D <3300000>; - regulator-max-microvolt =3D <3300000>; - }; - - max77826_ldo14: LDO14 { - regulator-min-microvolt =3D <3300000>; - regulator-max-microvolt =3D <3300000>; - }; - - max77826_ldo15: LDO15 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - max77826_buck: BUCK { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - }; - - max77826_buckboost: BUCKBOOST { - regulator-min-microvolt =3D <3400000>; - regulator-max-microvolt =3D <3400000>; - }; - }; + pma8084_l18: l18 { + regulator-min-microvolt =3D <2850000>; + regulator-max-microvolt =3D <2850000>; }; - }; =20 - i2c@f9968000 { - status =3D "okay"; + pma8084_l19: l19 { + regulator-min-microvolt =3D <3300000>; + regulator-max-microvolt =3D <3300000>; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&i2c12_pins>; + pma8084_l20: l20 { + regulator-min-microvolt =3D <2950000>; + regulator-max-microvolt =3D <2950000>; + regulator-system-load =3D <200000>; + regulator-allow-set-load; + }; =20 - fuelgauge@36 { - compatible =3D "maxim,max17048"; - reg =3D <0x36>; + pma8084_l21: l21 { + regulator-min-microvolt =3D <2950000>; + regulator-max-microvolt =3D <2950000>; + regulator-system-load =3D <200000>; + regulator-allow-set-load; + }; =20 - maxim,double-soc; - maxim,rcomp =3D /bits/ 8 <0x56>; + pma8084_l22: l22 { + regulator-min-microvolt =3D <3000000>; + regulator-max-microvolt =3D <3300000>; + }; =20 - interrupt-parent =3D <&pma8084_gpios>; - interrupts =3D <21 IRQ_TYPE_LEVEL_LOW>; + pma8084_l23: l23 { + regulator-min-microvolt =3D <3000000>; + regulator-max-microvolt =3D <3000000>; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&fuelgauge_pin>; + pma8084_l24: l24 { + regulator-min-microvolt =3D <3075000>; + regulator-max-microvolt =3D <3075000>; }; + + pma8084_l25: l25 { + regulator-min-microvolt =3D <2100000>; + regulator-max-microvolt =3D <2100000>; + }; + + pma8084_l26: l26 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2050000>; + }; + + pma8084_l27: l27 { + regulator-min-microvolt =3D <1000000>; + regulator-max-microvolt =3D <1225000>; + }; + + pma8084_lvs1: lvs1 {}; + pma8084_lvs2: lvs2 {}; + pma8084_lvs3: lvs3 {}; + pma8084_lvs4: lvs4 {}; + + pma8084_5vs1: 5vs1 {}; }; +}; + +&sdhc_1 { + status =3D "okay"; + + vmmc-supply =3D <&pma8084_l20>; + vqmmc-supply =3D <&pma8084_s4>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sdhc1_pin_a>; +}; + +&sdhc_2 { + status =3D "okay"; + max-frequency =3D <100000000>; =20 - adreno@fdb00000 { - status =3D "ok"; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sdhc3_pin_a>; + + vmmc-supply =3D <&vreg_wlan>; + vqmmc-supply =3D <&pma8084_s4>; + + non-removable; + + #address-cells =3D <1>; + #size-cells =3D <0>; + + wifi@1 { + reg =3D <1>; + compatible =3D "brcm,bcm4329-fmac"; + + interrupt-parent =3D <&tlmm>; + interrupts =3D <92 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names =3D "host-wake"; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&wlan_sleep_clk_pin &wifi_pin>; }; +}; =20 - mdss@fd900000 { - status =3D "ok"; +&sdhc_3 { + status =3D "okay"; + max-frequency =3D <100000000>; + + vmmc-supply =3D <&pma8084_l21>; + vqmmc-supply =3D <&pma8084_l13>; + + /* + * cd-gpio is intentionally disabled. If enabled, an SD card + * present during boot is not initialized correctly. Without + * cd-gpios the driver resorts to polling, so hotplug works. + */ + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sdhc2_pin_a /* &sdhc2_cd_pin */>; + /* cd-gpios =3D <&tlmm 62 GPIO_ACTIVE_LOW>; */ +}; =20 - mdp@fd900000 { - status =3D "ok"; - }; +&tlmm { + blsp2_uart2_pins_active: blsp2-uart2-pins-active { + pins =3D "gpio45", "gpio46", "gpio47", "gpio48"; + function =3D "blsp_uart8"; + drive-strength =3D <8>; + bias-disable; + }; =20 - dsi@fd922800 { - status =3D "ok"; + blsp2_uart2_pins_sleep: blsp2-uart2-pins-sleep { + pins =3D "gpio45", "gpio46", "gpio47", "gpio48"; + function =3D "gpio"; + drive-strength =3D <2>; + bias-pull-down; + }; =20 - vdda-supply =3D <&pma8084_l2>; - vdd-supply =3D <&pma8084_l22>; - vddio-supply =3D <&pma8084_l12>; + bt_pins: bt-pins { + hostwake { + pins =3D "gpio75"; + function =3D "gpio"; + drive-strength =3D <16>; + input-enable; + }; =20 - #address-cells =3D <1>; - #size-cells =3D <0>; + devwake { + pins =3D "gpio91"; + function =3D "gpio"; + drive-strength =3D <2>; + }; + }; =20 - ports { - port@1 { - endpoint { - remote-endpoint =3D <&panel_in>; - data-lanes =3D <0 1 2 3>; - }; - }; - }; + sdhc1_pin_a: sdhc1-pin-active { + clk { + pins =3D "sdc1_clk"; + drive-strength =3D <4>; + bias-disable; + }; =20 - panel: panel@0 { - reg =3D <0>; - compatible =3D "samsung,s6e3fa2"; + cmd-data { + pins =3D "sdc1_cmd", "sdc1_data"; + drive-strength =3D <4>; + bias-pull-up; + }; + }; + + sdhc2_pin_a: sdhc2-pin-active { + clk-cmd-data { + pins =3D "gpio35", "gpio36", "gpio37", "gpio38", + "gpio39", "gpio40"; + function =3D "sdc3"; + drive-strength =3D <8>; + bias-disable; + }; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&panel_te_pin &panel_rst_pin>; + sdhc2_cd_pin: sdhc2-cd { + pins =3D "gpio62"; + function =3D "gpio"; =20 - iovdd-supply =3D <&pma8084_lvs4>; - vddr-supply =3D <&vreg_panel>; + drive-strength =3D <2>; + bias-disable; + }; =20 - reset-gpios =3D <&pma8084_gpios 17 GPIO_ACTIVE_LOW>; - te-gpios =3D <&tlmm 12 GPIO_ACTIVE_HIGH>; + sdhc3_pin_a: sdhc3-pin-active { + clk { + pins =3D "sdc2_clk"; + drive-strength =3D <6>; + bias-disable; + }; =20 - port { - panel_in: endpoint { - remote-endpoint =3D <&dsi0_out>; - }; - }; - }; + cmd-data { + pins =3D "sdc2_cmd", "sdc2_data"; + drive-strength =3D <6>; + bias-pull-up; }; + }; =20 - dsi-phy@fd922a00 { - status =3D "ok"; + i2c2_pins: i2c2 { + mux { + pins =3D "gpio6", "gpio7"; + function =3D "blsp_i2c2"; =20 - vddio-supply =3D <&pma8084_l12>; + drive-strength =3D <2>; + bias-disable; }; }; =20 - remoteproc@fc880000 { - cx-supply =3D <&pma8084_s2>; - mss-supply =3D <&pma8084_s6>; - mx-supply =3D <&pma8084_s1>; - pll-supply =3D <&pma8084_l12>; + i2c6_pins: i2c6 { + mux { + pins =3D "gpio29", "gpio30"; + function =3D "blsp_i2c6"; + + drive-strength =3D <2>; + bias-disable; + }; }; -}; =20 -&spmi_bus { - pma8084@0 { - gpios@c000 { - gpio_keys_pin_a: gpio-keys-active { - pins =3D "gpio2", "gpio3", "gpio5"; - function =3D "normal"; + i2c12_pins: i2c12 { + mux { + pins =3D "gpio87", "gpio88"; + function =3D "blsp_i2c12"; =20 - bias-pull-up; - power-source =3D ; - }; + drive-strength =3D <2>; + bias-disable; + }; + }; =20 - touchkey_pin: touchkey-int-pin { - pins =3D "gpio6"; - function =3D "normal"; - bias-disable; - input-enable; - power-source =3D ; - }; + i2c_touchkey_pins: i2c-touchkey { + mux { + pins =3D "gpio95", "gpio96"; + function =3D "gpio"; + input-enable; + bias-pull-up; + }; + }; =20 - touch_pin: touchscreen-int-pin { - pins =3D "gpio8"; - function =3D "normal"; - bias-disable; - input-enable; - power-source =3D ; - }; + i2c_led_gpioex_pins: i2c-led-gpioex { + mux { + pins =3D "gpio120", "gpio121"; + function =3D "gpio"; + input-enable; + bias-pull-down; + }; + }; =20 - panel_en_pin: panel-en-pin { - pins =3D "gpio14"; - function =3D "normal"; - bias-pull-up; - power-source =3D ; - qcom,drive-strength =3D ; - }; + gpioex_pin: gpioex { + res { + pins =3D "gpio145"; + function =3D "gpio"; =20 - wlan_sleep_clk_pin: wlan-sleep-clk-pin { - pins =3D "gpio16"; - function =3D "func2"; + bias-pull-up; + drive-strength =3D <2>; + }; + }; =20 - output-high; - power-source =3D ; - qcom,drive-strength =3D ; - }; + wifi_pin: wifi { + int { + pins =3D "gpio92"; + function =3D "gpio"; =20 - panel_rst_pin: panel-rst-pin { - pins =3D "gpio17"; - function =3D "normal"; - bias-disable; - power-source =3D ; - qcom,drive-strength =3D ; - }; + input-enable; + bias-pull-down; + }; + }; =20 + panel_te_pin: panel { + te { + pins =3D "gpio12"; + function =3D "mdp_vsync"; =20 - fuelgauge_pin: fuelgauge-int-pin { - pins =3D "gpio21"; - function =3D "normal"; - bias-disable; - input-enable; - power-source =3D ; - }; + drive-strength =3D <2>; + bias-disable; }; }; }; diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-m= sm8974.dtsi index f1278d39ff6c..ea3491d47b9f 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -341,7 +341,7 @@ timer { clock-frequency =3D <19200000>; }; =20 - adsp-pil { + remoteproc_adsp: adsp-pil { compatible =3D "qcom,msm8974-adsp-pil"; =20 interrupts-extended =3D <&intc GIC_SPI 162 IRQ_TYPE_EDGE_RISING>, @@ -842,7 +842,7 @@ rng@f9bff000 { clock-names =3D "core"; }; =20 - remoteproc@fc880000 { + remoteproc_mss: remoteproc@fc880000 { compatible =3D "qcom,msm8974-mss-pil"; reg =3D <0xfc880000 0x100>, <0xfc820000 0x020>; reg-names =3D "qdsp6", "rmb"; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1163C00140 for ; Mon, 15 Aug 2022 20:44:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345348AbiHOUoi (ORCPT ); Mon, 15 Aug 2022 16:44:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347112AbiHOUmc (ORCPT ); Mon, 15 Aug 2022 16:42:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0898BB1BAB; Mon, 15 Aug 2022 12:07:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F2967B8107A; Mon, 15 Aug 2022 19:07:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0B87C433D6; Mon, 15 Aug 2022 19:07:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590459; bh=2WUnxokAmj9BtEtPVK6uCCp8plAA180/96F5ztbrp40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ixthag+vcI57zcsu0zoBbt/F400+dirFFqg0vxTiCQkV0QembcTeDAX0aJUEpZCnm OqSwIgZQaamppMK2g6uI14rENY19tU92h7/BifTtg70OZQXiEJYvcvD/2s+QYXc+CP kD9mRURCR2C7ceseoi5DANfx0iyDBCe8kF4vlT/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0236/1095] ARM: dts: qcom-msm8974-{"hon","am"}ami: Commonize and modernize the DTs Date: Mon, 15 Aug 2022 19:53:55 +0200 Message-Id: <20220815180439.537472543@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 5c554c2d67a8c6c43a1fb542cbc73c33ff04c344 ] Sony Xperia Z1 and Z1 compact are almost identical, and that shows in their DTs. Commonize the repeating parts and modernize the DTs to use labels. As a bonus, Z1C gains touchscreen support in this commit, as it was present on Z1 already. Signed-off-by: Konrad Dybcio [bjorn: Rebased on top of Krzysztof's fixes] Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220415115633.575010-13-konrad.dybcio@soma= inline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../dts/qcom-msm8974-sony-xperia-amami.dts | 432 +--------------- .../dts/qcom-msm8974-sony-xperia-honami.dts | 479 +----------------- .../dts/qcom-msm8974-sony-xperia-rhine.dtsi | 449 ++++++++++++++++ arch/arm/boot/dts/qcom-pm8941.dtsi | 2 +- 4 files changed, 456 insertions(+), 906 deletions(-) create mode 100644 arch/arm/boot/dts/qcom-msm8974-sony-xperia-rhine.dtsi diff --git a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-amami.dts b/arch/ar= m/boot/dts/qcom-msm8974-sony-xperia-amami.dts index 6545917dd489..68d5626bf491 100644 --- a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-amami.dts +++ b/arch/arm/boot/dts/qcom-msm8974-sony-xperia-amami.dts @@ -1,435 +1,13 @@ // SPDX-License-Identifier: GPL-2.0 -#include "qcom-msm8974.dtsi" -#include "qcom-pm8841.dtsi" -#include "qcom-pm8941.dtsi" -#include -#include -#include +#include "qcom-msm8974-sony-xperia-rhine.dtsi" =20 / { model =3D "Sony Xperia Z1 Compact"; compatible =3D "sony,xperia-amami", "qcom,msm8974"; - - aliases { - serial0 =3D &blsp1_uart2; - }; - - chosen { - stdout-path =3D "serial0:115200n8"; - }; - - gpio-keys { - compatible =3D "gpio-keys"; - - pinctrl-names =3D "default"; - pinctrl-0 =3D <&gpio_keys_pin_a>; - - volume-down { - label =3D "volume_down"; - gpios =3D <&pm8941_gpios 2 GPIO_ACTIVE_LOW>; - linux,input-type =3D <1>; - linux,code =3D ; - }; - - camera-snapshot { - label =3D "camera_snapshot"; - gpios =3D <&pm8941_gpios 3 GPIO_ACTIVE_LOW>; - linux,input-type =3D <1>; - linux,code =3D ; - }; - - camera-focus { - label =3D "camera_focus"; - gpios =3D <&pm8941_gpios 4 GPIO_ACTIVE_LOW>; - linux,input-type =3D <1>; - linux,code =3D ; - }; - - volume-up { - label =3D "volume_up"; - gpios =3D <&pm8941_gpios 5 GPIO_ACTIVE_LOW>; - linux,input-type =3D <1>; - linux,code =3D ; - }; - }; - - memory@0 { - reg =3D <0 0x40000000>, <0x40000000 0x40000000>; - device_type =3D "memory"; - }; - - smd { - rpm { - rpm-requests { - pm8841-regulators { - s1 { - regulator-min-microvolt =3D <675000>; - regulator-max-microvolt =3D <1050000>; - }; - - s2 { - regulator-min-microvolt =3D <500000>; - regulator-max-microvolt =3D <1050000>; - }; - - s3 { - regulator-min-microvolt =3D <500000>; - regulator-max-microvolt =3D <1050000>; - }; - - s4 { - regulator-min-microvolt =3D <500000>; - regulator-max-microvolt =3D <1050000>; - }; - }; - - pm8941-regulators { - vdd_l1_l3-supply =3D <&pm8941_s1>; - vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; - vdd_l4_l11-supply =3D <&pm8941_s1>; - vdd_l5_l7-supply =3D <&pm8941_s2>; - vdd_l6_l12_l14_l15-supply =3D <&pm8941_s2>; - vdd_l9_l10_l17_l22-supply =3D <&vreg_boost>; - vdd_l13_l20_l23_l24-supply =3D <&vreg_boost>; - vdd_l21-supply =3D <&vreg_boost>; - - s1 { - regulator-min-microvolt =3D <1300000>; - regulator-max-microvolt =3D <1300000>; - regulator-always-on; - regulator-boot-on; - }; - - s2 { - regulator-min-microvolt =3D <2150000>; - regulator-max-microvolt =3D <2150000>; - regulator-boot-on; - }; - - s3 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - regulator-always-on; - regulator-boot-on; - }; - - s4 { - regulator-min-microvolt =3D <5000000>; - regulator-max-microvolt =3D <5000000>; - }; - - l1 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - - regulator-always-on; - regulator-boot-on; - }; - - l2 { - regulator-min-microvolt =3D <1200000>; - regulator-max-microvolt =3D <1200000>; - }; - - l3 { - regulator-min-microvolt =3D <1200000>; - regulator-max-microvolt =3D <1200000>; - }; - - l4 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - }; - - l5 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l6 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-boot-on; - }; - - l7 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-boot-on; - }; - - l8 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l9 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - }; - - l11 { - regulator-min-microvolt =3D <1300000>; - regulator-max-microvolt =3D <1350000>; - }; - - l12 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-always-on; - regulator-boot-on; - }; - - l13 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - - regulator-boot-on; - }; - - l14 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l15 { - regulator-min-microvolt =3D <2050000>; - regulator-max-microvolt =3D <2050000>; - }; - - l16 { - regulator-min-microvolt =3D <2700000>; - regulator-max-microvolt =3D <2700000>; - }; - - l17 { - regulator-min-microvolt =3D <2700000>; - regulator-max-microvolt =3D <2700000>; - }; - - l18 { - regulator-min-microvolt =3D <2850000>; - regulator-max-microvolt =3D <2850000>; - }; - - l19 { - regulator-min-microvolt =3D <3300000>; - regulator-max-microvolt =3D <3300000>; - }; - - l20 { - regulator-min-microvolt =3D <2950000>; - regulator-max-microvolt =3D <2950000>; - - regulator-allow-set-load; - regulator-boot-on; - regulator-system-load =3D <200000>; - }; - - l21 { - regulator-min-microvolt =3D <2950000>; - regulator-max-microvolt =3D <2950000>; - - regulator-boot-on; - }; - - l22 { - regulator-min-microvolt =3D <3000000>; - regulator-max-microvolt =3D <3000000>; - }; - - l23 { - regulator-min-microvolt =3D <2800000>; - regulator-max-microvolt =3D <2800000>; - }; - - l24 { - regulator-min-microvolt =3D <3075000>; - regulator-max-microvolt =3D <3075000>; - - regulator-boot-on; - }; - }; - }; - }; - }; }; =20 -&soc { - sdhci@f9824900 { - status =3D "okay"; - - vmmc-supply =3D <&pm8941_l20>; - vqmmc-supply =3D <&pm8941_s3>; - - bus-width =3D <8>; - non-removable; - - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc1_pin_a>; - }; - - sdhci@f98a4900 { - status =3D "okay"; - - bus-width =3D <4>; - - vmmc-supply =3D <&pm8941_l21>; - vqmmc-supply =3D <&pm8941_l13>; - - cd-gpios =3D <&tlmm 62 GPIO_ACTIVE_LOW>; - - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc2_pin_a>, <&sdhc2_cd_pin_a>; - }; - - serial@f991e000 { - status =3D "okay"; - - pinctrl-names =3D "default"; - pinctrl-0 =3D <&blsp1_uart2_pin_a>; - }; - - - pinctrl@fd510000 { - blsp1_uart2_pin_a: blsp1-uart2-pin-active { - rx { - pins =3D "gpio5"; - function =3D "blsp_uart2"; - - drive-strength =3D <2>; - bias-pull-up; - }; - - tx { - pins =3D "gpio4"; - function =3D "blsp_uart2"; - - drive-strength =3D <4>; - bias-disable; - }; - }; - - i2c2_pins: i2c2 { - mux { - pins =3D "gpio6", "gpio7"; - function =3D "blsp_i2c2"; - - drive-strength =3D <2>; - bias-disable; - }; - }; - - sdhc1_pin_a: sdhc1-pin-active { - clk { - pins =3D "sdc1_clk"; - drive-strength =3D <16>; - bias-disable; - }; - - cmd-data { - pins =3D "sdc1_cmd", "sdc1_data"; - drive-strength =3D <10>; - bias-pull-up; - }; - }; - - sdhc2_cd_pin_a: sdhc2-cd-pin-active { - pins =3D "gpio62"; - function =3D "gpio"; - - drive-strength =3D <2>; - bias-disable; - }; - - sdhc2_pin_a: sdhc2-pin-active { - clk { - pins =3D "sdc2_clk"; - drive-strength =3D <10>; - bias-disable; - }; - - cmd-data { - pins =3D "sdc2_cmd", "sdc2_data"; - drive-strength =3D <6>; - bias-pull-up; - }; - }; - }; - - dma-controller@f9944000 { - qcom,controlled-remotely; - }; - - usb@f9a55000 { - status =3D "okay"; - - phys =3D <&usb_hs1_phy>; - phy-select =3D <&tcsr 0xb000 0>; - extcon =3D <&smbb>, <&usb_id>; - vbus-supply =3D <&chg_otg>; - - hnp-disable; - srp-disable; - adp-disable; - - ulpi { - phy@a { - status =3D "okay"; - - v1p8-supply =3D <&pm8941_l6>; - v3p3-supply =3D <&pm8941_l24>; - - extcon =3D <&smbb>; - qcom,init-seq =3D /bits/ 8 <0x1 0x64>; - }; - }; - }; -}; - -&spmi_bus { - pm8941@0 { - charger@1000 { - qcom,fast-charge-safe-current =3D <1300000>; - qcom,fast-charge-current-limit =3D <1300000>; - qcom,dc-current-limit =3D <1300000>; - qcom,fast-charge-safe-voltage =3D <4400000>; - qcom,fast-charge-high-threshold-voltage =3D <4350000>; - qcom,fast-charge-low-threshold-voltage =3D <3400000>; - qcom,auto-recharge-threshold-voltage =3D <4200000>; - qcom,minimum-input-voltage =3D <4300000>; - }; - - gpios@c000 { - gpio_keys_pin_a: gpio-keys-active { - pins =3D "gpio2", "gpio3", "gpio4", "gpio5"; - function =3D "normal"; - - bias-pull-up; - power-source =3D ; - }; - }; - - coincell@2800 { - status =3D "okay"; - qcom,rset-ohms =3D <2100>; - qcom,vset-millivolts =3D <3000>; - }; - }; - - pm8941@1 { - wled@d800 { - status =3D "okay"; - - qcom,cs-out; - qcom,current-limit =3D <20>; - qcom,current-boost-limit =3D <805>; - qcom,switching-freq =3D <1600>; - qcom,ovp =3D <29>; - qcom,num-strings =3D <2>; - }; - }; +&smbb { + qcom,fast-charge-safe-current =3D <1300000>; + qcom,fast-charge-current-limit =3D <1300000>; + qcom,dc-current-limit =3D <1300000>; }; diff --git a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts b/arch/a= rm/boot/dts/qcom-msm8974-sony-xperia-honami.dts index 313c755f590f..ea6a941d8f8c 100644 --- a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts +++ b/arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts @@ -1,484 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 -#include "qcom-msm8974.dtsi" -#include "qcom-pm8841.dtsi" -#include "qcom-pm8941.dtsi" -#include -#include -#include +#include "qcom-msm8974-sony-xperia-rhine.dtsi" =20 / { model =3D "Sony Xperia Z1"; compatible =3D "sony,xperia-honami", "qcom,msm8974"; - - aliases { - serial0 =3D &blsp1_uart2; - }; - - chosen { - stdout-path =3D "serial0:115200n8"; - }; - - gpio-keys { - compatible =3D "gpio-keys"; - - pinctrl-names =3D "default"; - pinctrl-0 =3D <&gpio_keys_pin_a>; - - volume-down { - label =3D "volume_down"; - gpios =3D <&pm8941_gpios 2 GPIO_ACTIVE_LOW>; - linux,input-type =3D <1>; - linux,code =3D ; - }; - - camera-snapshot { - label =3D "camera_snapshot"; - gpios =3D <&pm8941_gpios 3 GPIO_ACTIVE_LOW>; - linux,input-type =3D <1>; - linux,code =3D ; - }; - - camera-focus { - label =3D "camera_focus"; - gpios =3D <&pm8941_gpios 4 GPIO_ACTIVE_LOW>; - linux,input-type =3D <1>; - linux,code =3D ; - }; - - volume-up { - label =3D "volume_up"; - gpios =3D <&pm8941_gpios 5 GPIO_ACTIVE_LOW>; - linux,input-type =3D <1>; - linux,code =3D ; - }; - }; - - memory@0 { - reg =3D <0 0x40000000>, <0x40000000 0x40000000>; - device_type =3D "memory"; - }; - - smd { - rpm { - rpm-requests { - pm8841-regulators { - s1 { - regulator-min-microvolt =3D <675000>; - regulator-max-microvolt =3D <1050000>; - }; - - s2 { - regulator-min-microvolt =3D <500000>; - regulator-max-microvolt =3D <1050000>; - }; - - s3 { - regulator-min-microvolt =3D <500000>; - regulator-max-microvolt =3D <1050000>; - }; - - s4 { - regulator-min-microvolt =3D <500000>; - regulator-max-microvolt =3D <1050000>; - }; - }; - - pm8941-regulators { - vdd_l1_l3-supply =3D <&pm8941_s1>; - vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; - vdd_l4_l11-supply =3D <&pm8941_s1>; - vdd_l5_l7-supply =3D <&pm8941_s2>; - vdd_l6_l12_l14_l15-supply =3D <&pm8941_s2>; - vdd_l9_l10_l17_l22-supply =3D <&vreg_boost>; - vdd_l13_l20_l23_l24-supply =3D <&vreg_boost>; - vdd_l21-supply =3D <&vreg_boost>; - - s1 { - regulator-min-microvolt =3D <1300000>; - regulator-max-microvolt =3D <1300000>; - regulator-always-on; - regulator-boot-on; - }; - - s2 { - regulator-min-microvolt =3D <2150000>; - regulator-max-microvolt =3D <2150000>; - regulator-boot-on; - }; - - s3 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - regulator-always-on; - regulator-boot-on; - }; - - s4 { - regulator-min-microvolt =3D <5000000>; - regulator-max-microvolt =3D <5000000>; - }; - - l1 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - - regulator-always-on; - regulator-boot-on; - }; - - l2 { - regulator-min-microvolt =3D <1200000>; - regulator-max-microvolt =3D <1200000>; - }; - - l3 { - regulator-min-microvolt =3D <1200000>; - regulator-max-microvolt =3D <1200000>; - }; - - l4 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - }; - - l5 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l6 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-boot-on; - }; - - l7 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-boot-on; - }; - - l8 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l9 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - }; - - l11 { - regulator-min-microvolt =3D <1300000>; - regulator-max-microvolt =3D <1350000>; - }; - - l12 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-always-on; - regulator-boot-on; - }; - - l13 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - - regulator-boot-on; - }; - - l14 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l15 { - regulator-min-microvolt =3D <2050000>; - regulator-max-microvolt =3D <2050000>; - }; - - l16 { - regulator-min-microvolt =3D <2700000>; - regulator-max-microvolt =3D <2700000>; - }; - - l17 { - regulator-min-microvolt =3D <2700000>; - regulator-max-microvolt =3D <2700000>; - }; - - l18 { - regulator-min-microvolt =3D <2850000>; - regulator-max-microvolt =3D <2850000>; - }; - - l19 { - regulator-min-microvolt =3D <3300000>; - regulator-max-microvolt =3D <3300000>; - }; - - l20 { - regulator-min-microvolt =3D <2950000>; - regulator-max-microvolt =3D <2950000>; - - regulator-allow-set-load; - regulator-boot-on; - regulator-system-load =3D <200000>; - }; - - l21 { - regulator-min-microvolt =3D <2950000>; - regulator-max-microvolt =3D <2950000>; - - regulator-boot-on; - }; - - l22 { - regulator-min-microvolt =3D <3000000>; - regulator-max-microvolt =3D <3000000>; - }; - - l23 { - regulator-min-microvolt =3D <2800000>; - regulator-max-microvolt =3D <2800000>; - }; - - l24 { - regulator-min-microvolt =3D <3075000>; - regulator-max-microvolt =3D <3075000>; - - regulator-boot-on; - }; - }; - }; - }; - }; -}; - -&soc { - usb@f9a55000 { - status =3D "okay"; - - phys =3D <&usb_hs1_phy>; - phy-select =3D <&tcsr 0xb000 0>; - extcon =3D <&smbb>, <&usb_id>; - vbus-supply =3D <&chg_otg>; - - hnp-disable; - srp-disable; - adp-disable; - - ulpi { - phy@a { - status =3D "okay"; - - v1p8-supply =3D <&pm8941_l6>; - v3p3-supply =3D <&pm8941_l24>; - - extcon =3D <&smbb>; - qcom,init-seq =3D /bits/ 8 <0x1 0x64>; - }; - }; - }; - - sdhci@f9824900 { - status =3D "okay"; - - vmmc-supply =3D <&pm8941_l20>; - vqmmc-supply =3D <&pm8941_s3>; - - bus-width =3D <8>; - non-removable; - - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc1_pin_a>; - }; - - sdhci@f98a4900 { - status =3D "okay"; - - bus-width =3D <4>; - - vmmc-supply =3D <&pm8941_l21>; - vqmmc-supply =3D <&pm8941_l13>; - - cd-gpios =3D <&tlmm 62 GPIO_ACTIVE_LOW>; - - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc2_pin_a>, <&sdhc2_cd_pin_a>; - }; - - serial@f991e000 { - status =3D "okay"; - - pinctrl-names =3D "default"; - pinctrl-0 =3D <&blsp1_uart2_pin_a>; - }; - - i2c@f9924000 { - status =3D "okay"; - - clock-frequency =3D <355000>; - qcom,src-freq =3D <50000000>; - - pinctrl-names =3D "default"; - pinctrl-0 =3D <&i2c2_pins>; - - synaptics@2c { - compatible =3D "syna,rmi4-i2c"; - reg =3D <0x2c>; - - interrupts-extended =3D <&tlmm 61 IRQ_TYPE_EDGE_FALLING>; - - #address-cells =3D <1>; - #size-cells =3D <0>; - - vdd-supply =3D <&pm8941_l22>; - vio-supply =3D <&pm8941_lvs3>; - - pinctrl-names =3D "default"; - pinctrl-0 =3D <&ts_int_pin>; - - syna,startup-delay-ms =3D <10>; - - rmi4-f01@1 { - reg =3D <0x1>; - syna,nosleep-mode =3D <1>; - }; - - rmi4-f11@11 { - reg =3D <0x11>; - touchscreen-inverted-x; - syna,sensor-type =3D <1>; - }; - }; - }; - - pinctrl@fd510000 { - blsp1_uart2_pin_a: blsp1-uart2-pin-active { - rx { - pins =3D "gpio5"; - function =3D "blsp_uart2"; - - drive-strength =3D <2>; - bias-pull-up; - }; - - tx { - pins =3D "gpio4"; - function =3D "blsp_uart2"; - - drive-strength =3D <4>; - bias-disable; - }; - }; - - i2c2_pins: i2c2 { - mux { - pins =3D "gpio6", "gpio7"; - function =3D "blsp_i2c2"; - - drive-strength =3D <2>; - bias-disable; - }; - }; - - sdhc1_pin_a: sdhc1-pin-active { - clk { - pins =3D "sdc1_clk"; - drive-strength =3D <16>; - bias-disable; - }; - - cmd-data { - pins =3D "sdc1_cmd", "sdc1_data"; - drive-strength =3D <10>; - bias-pull-up; - }; - }; - - sdhc2_cd_pin_a: sdhc2-cd-pin-active { - pins =3D "gpio62"; - function =3D "gpio"; - - drive-strength =3D <2>; - bias-disable; - }; - - sdhc2_pin_a: sdhc2-pin-active { - clk { - pins =3D "sdc2_clk"; - drive-strength =3D <10>; - bias-disable; - }; - - cmd-data { - pins =3D "sdc2_cmd", "sdc2_data"; - drive-strength =3D <6>; - bias-pull-up; - }; - }; - - ts_int_pin: touch-int { - pin { - pins =3D "gpio61"; - function =3D "gpio"; - - drive-strength =3D <2>; - bias-disable; - input-enable; - }; - }; - }; - - dma-controller@f9944000 { - qcom,controlled-remotely; - }; -}; - -&spmi_bus { - pm8941@0 { - charger@1000 { - qcom,fast-charge-safe-current =3D <1500000>; - qcom,fast-charge-current-limit =3D <1500000>; - qcom,dc-current-limit =3D <1800000>; - qcom,fast-charge-safe-voltage =3D <4400000>; - qcom,fast-charge-high-threshold-voltage =3D <4350000>; - qcom,fast-charge-low-threshold-voltage =3D <3400000>; - qcom,auto-recharge-threshold-voltage =3D <4200000>; - qcom,minimum-input-voltage =3D <4300000>; - }; - - gpios@c000 { - gpio_keys_pin_a: gpio-keys-active { - pins =3D "gpio2", "gpio3", "gpio4", "gpio5"; - function =3D "normal"; - - bias-pull-up; - power-source =3D ; - }; - }; - - coincell@2800 { - status =3D "okay"; - qcom,rset-ohms =3D <2100>; - qcom,vset-millivolts =3D <3000>; - }; - }; - - pm8941@1 { - wled@d800 { - status =3D "okay"; - - qcom,cs-out; - qcom,current-limit =3D <20>; - qcom,current-boost-limit =3D <805>; - qcom,switching-freq =3D <1600>; - qcom,ovp =3D <29>; - qcom,num-strings =3D <2>; - }; - }; }; diff --git a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-rhine.dtsi b/arch/a= rm/boot/dts/qcom-msm8974-sony-xperia-rhine.dtsi new file mode 100644 index 000000000000..87ec3694add9 --- /dev/null +++ b/arch/arm/boot/dts/qcom-msm8974-sony-xperia-rhine.dtsi @@ -0,0 +1,449 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "qcom-msm8974.dtsi" +#include "qcom-pm8841.dtsi" +#include "qcom-pm8941.dtsi" +#include +#include +#include + +/ { + aliases { + serial0 =3D &blsp1_uart2; + }; + + chosen { + stdout-path =3D "serial0:115200n8"; + }; + + gpio-keys { + compatible =3D "gpio-keys"; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&gpio_keys_pin_a>; + + volume-down { + label =3D "volume_down"; + gpios =3D <&pm8941_gpios 2 GPIO_ACTIVE_LOW>; + linux,input-type =3D <1>; + linux,code =3D ; + }; + + camera-snapshot { + label =3D "camera_snapshot"; + gpios =3D <&pm8941_gpios 3 GPIO_ACTIVE_LOW>; + linux,input-type =3D <1>; + linux,code =3D ; + }; + + camera-focus { + label =3D "camera_focus"; + gpios =3D <&pm8941_gpios 4 GPIO_ACTIVE_LOW>; + linux,input-type =3D <1>; + linux,code =3D ; + }; + + volume-up { + label =3D "volume_up"; + gpios =3D <&pm8941_gpios 5 GPIO_ACTIVE_LOW>; + linux,input-type =3D <1>; + linux,code =3D ; + }; + }; +}; + +&blsp1_i2c2 { + status =3D "okay"; + clock-frequency =3D <355000>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&i2c2_pins>; + + synaptics@2c { + compatible =3D "syna,rmi4-i2c"; + reg =3D <0x2c>; + + interrupts-extended =3D <&tlmm 61 IRQ_TYPE_EDGE_FALLING>; + + #address-cells =3D <1>; + #size-cells =3D <0>; + + vdd-supply =3D <&pm8941_l22>; + vio-supply =3D <&pm8941_lvs3>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&ts_int_pin>; + + syna,startup-delay-ms =3D <10>; + + rmi4-f01@1 { + reg =3D <0x1>; + syna,nosleep-mode =3D <1>; + }; + + rmi4-f11@11 { + reg =3D <0x11>; + touchscreen-inverted-x; + syna,sensor-type =3D <1>; + }; + }; +}; + +&blsp1_uart2 { + status =3D "okay"; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&blsp1_uart2_pin_a>; +}; + +&blsp2_dma { + qcom,controlled-remotely; +}; + +&otg { + status =3D "okay"; + + phys =3D <&usb_hs1_phy>; + phy-select =3D <&tcsr 0xb000 0>; + extcon =3D <&smbb>, <&usb_id>; + vbus-supply =3D <&chg_otg>; + + hnp-disable; + srp-disable; + adp-disable; + + ulpi { + phy@a { + status =3D "okay"; + + v1p8-supply =3D <&pm8941_l6>; + v3p3-supply =3D <&pm8941_l24>; + + extcon =3D <&smbb>; + qcom,init-seq =3D /bits/ 8 <0x1 0x64>; + }; + }; +}; + +&pm8941_coincell { + status =3D "okay"; + qcom,rset-ohms =3D <2100>; + qcom,vset-millivolts =3D <3000>; +}; + +&pm8941_gpios { + gpio_keys_pin_a: gpio-keys-active { + pins =3D "gpio2", "gpio3", "gpio4", "gpio5"; + function =3D "normal"; + + bias-pull-up; + power-source =3D ; + }; +}; + +&pm8941_wled { + status =3D "okay"; + + qcom,cs-out; + qcom,current-limit =3D <20>; + qcom,current-boost-limit =3D <805>; + qcom,switching-freq =3D <1600>; + qcom,ovp =3D <29>; + qcom,num-strings =3D <2>; +}; + +&rpm_requests { + pm8841-regulators { + pm8841_s1: s1 { + regulator-min-microvolt =3D <675000>; + regulator-max-microvolt =3D <1050000>; + }; + + pm8841_s2: s2 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <1050000>; + }; + + pm8841_s3: s3 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <1050000>; + }; + + pm8841_s4: s4 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <1050000>; + }; + }; + + pm8941-regulators { + vdd_l1_l3-supply =3D <&pm8941_s1>; + vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; + vdd_l4_l11-supply =3D <&pm8941_s1>; + vdd_l5_l7-supply =3D <&pm8941_s2>; + vdd_l6_l12_l14_l15-supply =3D <&pm8941_s2>; + vdd_l9_l10_l17_l22-supply =3D <&vreg_boost>; + vdd_l13_l20_l23_l24-supply =3D <&vreg_boost>; + vdd_l21-supply =3D <&vreg_boost>; + + pm8941_s1: s1 { + regulator-min-microvolt =3D <1300000>; + regulator-max-microvolt =3D <1300000>; + regulator-always-on; + regulator-boot-on; + }; + + pm8941_s2: s2 { + regulator-min-microvolt =3D <2150000>; + regulator-max-microvolt =3D <2150000>; + regulator-boot-on; + }; + + pm8941_s3: s3 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-always-on; + regulator-boot-on; + }; + + pm8941_s4: s4 { + regulator-min-microvolt =3D <5000000>; + regulator-max-microvolt =3D <5000000>; + }; + + pm8941_l1: l1 { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1225000>; + regulator-always-on; + regulator-boot-on; + }; + + pm8941_l2: l2 { + regulator-min-microvolt =3D <1200000>; + regulator-max-microvolt =3D <1200000>; + }; + + pm8941_l3: l3 { + regulator-min-microvolt =3D <1200000>; + regulator-max-microvolt =3D <1200000>; + }; + + pm8941_l4: l4 { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1225000>; + }; + + pm8941_l5: l5 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; + + pm8941_l6: l6 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-boot-on; + }; + + pm8941_l7: l7 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-boot-on; + }; + + pm8941_l8: l8 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; + + pm8941_l9: l9 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2950000>; + }; + + pm8941_l11: l11 { + regulator-min-microvolt =3D <1300000>; + regulator-max-microvolt =3D <1350000>; + }; + + pm8941_l12: l12 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-always-on; + regulator-boot-on; + }; + + pm8941_l13: l13 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2950000>; + regulator-boot-on; + }; + + pm8941_l14: l14 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; + + pm8941_l15: l15 { + regulator-min-microvolt =3D <2050000>; + regulator-max-microvolt =3D <2050000>; + }; + + pm8941_l16: l16 { + regulator-min-microvolt =3D <2700000>; + regulator-max-microvolt =3D <2700000>; + }; + + pm8941_l17: l17 { + regulator-min-microvolt =3D <2700000>; + regulator-max-microvolt =3D <2700000>; + }; + + pm8941_l18: l18 { + regulator-min-microvolt =3D <2850000>; + regulator-max-microvolt =3D <2850000>; + }; + + pm8941_l19: l19 { + regulator-min-microvolt =3D <3300000>; + regulator-max-microvolt =3D <3300000>; + }; + + pm8941_l20: l20 { + regulator-min-microvolt =3D <2950000>; + regulator-max-microvolt =3D <2950000>; + regulator-system-load =3D <200000>; + regulator-allow-set-load; + regulator-boot-on; + }; + + pm8941_l21: l21 { + regulator-min-microvolt =3D <2950000>; + regulator-max-microvolt =3D <2950000>; + regulator-boot-on; + }; + + pm8941_l22: l22 { + regulator-min-microvolt =3D <3000000>; + regulator-max-microvolt =3D <3000000>; + }; + + pm8941_l23: l23 { + regulator-min-microvolt =3D <2800000>; + regulator-max-microvolt =3D <2800000>; + }; + + pm8941_l24: l24 { + regulator-min-microvolt =3D <3075000>; + regulator-max-microvolt =3D <3075000>; + regulator-boot-on; + }; + }; +}; + +&sdhc_1 { + status =3D "okay"; + + vmmc-supply =3D <&pm8941_l20>; + vqmmc-supply =3D <&pm8941_s3>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sdhc1_pin_a>; +}; + +&sdhc_2 { + status =3D "okay"; + + vmmc-supply =3D <&pm8941_l21>; + vqmmc-supply =3D <&pm8941_l13>; + + cd-gpios =3D <&tlmm 62 GPIO_ACTIVE_LOW>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sdhc2_pin_a>, <&sdhc2_cd_pin_a>; +}; + +&smbb { + qcom,fast-charge-safe-current =3D <1500000>; + qcom,fast-charge-current-limit =3D <1500000>; + qcom,dc-current-limit =3D <1800000>; + qcom,fast-charge-safe-voltage =3D <4400000>; + qcom,fast-charge-high-threshold-voltage =3D <4350000>; + qcom,fast-charge-low-threshold-voltage =3D <3400000>; + qcom,auto-recharge-threshold-voltage =3D <4200000>; + qcom,minimum-input-voltage =3D <4300000>; +}; + +&tlmm { + ts_int_pin: touch-int { + pin { + pins =3D "gpio61"; + function =3D "gpio"; + + drive-strength =3D <2>; + bias-disable; + input-enable; + }; + }; + + blsp1_uart2_pin_a: blsp1-uart2-pin-active { + rx { + pins =3D "gpio5"; + function =3D "blsp_uart2"; + + drive-strength =3D <2>; + bias-pull-up; + }; + + tx { + pins =3D "gpio4"; + function =3D "blsp_uart2"; + + drive-strength =3D <4>; + bias-disable; + }; + }; + + i2c2_pins: i2c2 { + mux { + pins =3D "gpio6", "gpio7"; + function =3D "blsp_i2c2"; + + drive-strength =3D <2>; + bias-disable; + }; + }; + + sdhc1_pin_a: sdhc1-pin-active { + clk { + pins =3D "sdc1_clk"; + drive-strength =3D <16>; + bias-disable; + }; + + cmd-data { + pins =3D "sdc1_cmd", "sdc1_data"; + drive-strength =3D <10>; + bias-pull-up; + }; + }; + + sdhc2_cd_pin_a: sdhc2-cd-pin-active { + pins =3D "gpio62"; + function =3D "gpio"; + + drive-strength =3D <2>; + bias-disable; + }; + + sdhc2_pin_a: sdhc2-pin-active { + clk { + pins =3D "sdc2_clk"; + drive-strength =3D <10>; + bias-disable; + }; + + cmd-data { + pins =3D "sdc2_cmd", "sdc2_data"; + drive-strength =3D <6>; + bias-pull-up; + }; + }; +}; diff --git a/arch/arm/boot/dts/qcom-pm8941.dtsi b/arch/arm/boot/dts/qcom-pm= 8941.dtsi index da00b8f5eecd..cdd2bdb77b32 100644 --- a/arch/arm/boot/dts/qcom-pm8941.dtsi +++ b/arch/arm/boot/dts/qcom-pm8941.dtsi @@ -131,7 +131,7 @@ pm8941_iadc: iadc@3600 { qcom,external-resistor-micro-ohms =3D <10000>; }; =20 - coincell@2800 { + pm8941_coincell: coincell@2800 { compatible =3D "qcom,pm8941-coincell"; reg =3D <0x2800>; status =3D "disabled"; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 268BDC00140 for ; Mon, 15 Aug 2022 20:44:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344978AbiHOUoc (ORCPT ); Mon, 15 Aug 2022 16:44:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347128AbiHOUme (ORCPT ); Mon, 15 Aug 2022 16:42:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AC5C2FE; Mon, 15 Aug 2022 12:07:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A11CC612A0; Mon, 15 Aug 2022 19:07:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7000CC433C1; Mon, 15 Aug 2022 19:07:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590463; bh=dd2zDPf4tKX4sc/1OT8zO9hK9p9xmQ1IbCHvn+n/yGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aYBgh2GPAgS3c4hIRuZaI6RvX76vXV7ZH1+BX7WfS5QRuw+yhn9NjXJHLrH72BWUu vtXaZqN5Alk7pyEUynZu/E4kbU6izJ+M8O7u6/6EjSjwdhfIVr57RN63pSJt14Yvkb fOojAeUytTMmmDTtTZNyukWrrU+/E7KfeT6PugFs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0237/1095] ARM: dts: qcom-msm8974-castor: Use &labels Date: Mon, 15 Aug 2022 19:53:56 +0200 Message-Id: <20220815180439.590264499@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 598a1e333224e73ae8f078ed6aa8dcd416cfb490 ] Use &labels to align with the style used in new DTS and apply tiny style fixes. Signed-off-by: Konrad Dybcio [bjorn: Rebased ontop of Krzysztof's fixes] Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220415115633.575010-14-konrad.dybcio@soma= inline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../dts/qcom-msm8974-sony-xperia-castor.dts | 988 +++++++++--------- 1 file changed, 481 insertions(+), 507 deletions(-) diff --git a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts b/arch/a= rm/boot/dts/qcom-msm8974-sony-xperia-castor.dts index 352689237140..687f6149268c 100644 --- a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts +++ b/arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts @@ -53,186 +53,6 @@ volume-up { }; }; =20 - smd { - rpm { - rpm-requests { - pm8941-regulators { - vdd_l1_l3-supply =3D <&pm8941_s1>; - vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; - vdd_l4_l11-supply =3D <&pm8941_s1>; - vdd_l5_l7-supply =3D <&pm8941_s2>; - vdd_l6_l12_l14_l15-supply =3D <&pm8941_s2>; - vdd_l9_l10_l17_l22-supply =3D <&vreg_boost>; - vdd_l13_l20_l23_l24-supply =3D <&vreg_boost>; - vdd_l21-supply =3D <&vreg_boost>; - - s1 { - regulator-min-microvolt =3D <1300000>; - regulator-max-microvolt =3D <1300000>; - regulator-always-on; - regulator-boot-on; - }; - - s2 { - regulator-min-microvolt =3D <2150000>; - regulator-max-microvolt =3D <2150000>; - regulator-boot-on; - }; - - s3 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - regulator-always-on; - regulator-boot-on; - - regulator-system-load =3D <154000>; - }; - - s4 { - regulator-min-microvolt =3D <5000000>; - regulator-max-microvolt =3D <5000000>; - }; - - l1 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - - regulator-always-on; - regulator-boot-on; - }; - - l2 { - regulator-min-microvolt =3D <1200000>; - regulator-max-microvolt =3D <1200000>; - }; - - l3 { - regulator-min-microvolt =3D <1200000>; - regulator-max-microvolt =3D <1200000>; - }; - - l4 { - regulator-min-microvolt =3D <1225000>; - regulator-max-microvolt =3D <1225000>; - }; - - l5 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l6 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-boot-on; - }; - - l7 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-boot-on; - }; - - l8 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l9 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - }; - - l11 { - regulator-min-microvolt =3D <1300000>; - regulator-max-microvolt =3D <1350000>; - }; - - l12 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - - regulator-always-on; - regulator-boot-on; - }; - - l13 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <2950000>; - - regulator-boot-on; - }; - - l14 { - regulator-min-microvolt =3D <1800000>; - regulator-max-microvolt =3D <1800000>; - }; - - l15 { - regulator-min-microvolt =3D <2050000>; - regulator-max-microvolt =3D <2050000>; - }; - - l16 { - regulator-min-microvolt =3D <2700000>; - regulator-max-microvolt =3D <2700000>; - }; - - l17 { - regulator-min-microvolt =3D <2700000>; - regulator-max-microvolt =3D <2700000>; - }; - - l18 { - regulator-min-microvolt =3D <2850000>; - regulator-max-microvolt =3D <2850000>; - }; - - l19 { - regulator-min-microvolt =3D <2850000>; - regulator-max-microvolt =3D <2850000>; - }; - - l20 { - regulator-min-microvolt =3D <2950000>; - regulator-max-microvolt =3D <2950000>; - - regulator-allow-set-load; - regulator-boot-on; - regulator-allow-set-load; - regulator-system-load =3D <500000>; - }; - - l21 { - regulator-min-microvolt =3D <2950000>; - regulator-max-microvolt =3D <2950000>; - - regulator-boot-on; - }; - - l22 { - regulator-min-microvolt =3D <3000000>; - regulator-max-microvolt =3D <3000000>; - }; - - l23 { - regulator-min-microvolt =3D <2800000>; - regulator-max-microvolt =3D <2800000>; - }; - - l24 { - regulator-min-microvolt =3D <3075000>; - regulator-max-microvolt =3D <3075000>; - - regulator-boot-on; - }; - }; - }; - }; - }; - vreg_bl_vddio: lcd-backlight-vddio { compatible =3D "regulator-fixed"; regulator-name =3D "vreg_bl_vddio"; @@ -277,447 +97,601 @@ vreg_wlan: wlan-regulator { }; }; =20 -&soc { - sdhci@f9824900 { - status =3D "okay"; +&blsp1_uart2 { + status =3D "okay"; =20 - vmmc-supply =3D <&pm8941_l20>; - vqmmc-supply =3D <&pm8941_s3>; - - bus-width =3D <8>; - non-removable; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&blsp1_uart2_pin_a>; +}; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc1_pin_a>; - }; +&blsp2_i2c2 { + status =3D "okay"; + clock-frequency =3D <355000>; =20 - sdhci@f9864900 { - status =3D "okay"; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&i2c8_pins>; =20 - max-frequency =3D <100000000>; - non-removable; - vmmc-supply =3D <&vreg_wlan>; + synaptics@2c { + compatible =3D "syna,rmi4-i2c"; + reg =3D <0x2c>; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc3_pin_a>; + interrupt-parent =3D <&tlmm>; + interrupts =3D <86 IRQ_TYPE_EDGE_FALLING>; =20 #address-cells =3D <1>; #size-cells =3D <0>; =20 - bcrmf@1 { - compatible =3D "brcm,bcm4339-fmac", "brcm,bcm4329-fmac"; - reg =3D <1>; + vdd-supply =3D <&pm8941_l22>; + vio-supply =3D <&pm8941_lvs3>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&ts_int_pin>; =20 - brcm,drive-strength =3D <10>; + syna,startup-delay-ms =3D <10>; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&wlan_sleep_clk_pin>; + rmi-f01@1 { + reg =3D <0x1>; + syna,nosleep =3D <1>; }; - }; =20 - sdhci@f98a4900 { - status =3D "okay"; + rmi-f11@11 { + reg =3D <0x11>; + syna,f11-flip-x =3D <1>; + syna,sensor-type =3D <1>; + }; + }; +}; =20 - bus-width =3D <4>; +&blsp2_i2c5 { + status =3D "okay"; + clock-frequency =3D <355000>; =20 - vmmc-supply =3D <&pm8941_l21>; - vqmmc-supply =3D <&pm8941_l13>; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&i2c11_pins>; =20 - cd-gpios =3D <&tlmm 62 GPIO_ACTIVE_LOW>; + lp8566_wled: backlight@2c { + compatible =3D "ti,lp8556"; + reg =3D <0x2c>; + power-supply =3D <&vreg_bl_vddio>; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&sdhc2_pin_a>, <&sdhc2_cd_pin_a>; + bl-name =3D "backlight"; + dev-ctrl =3D /bits/ 8 <0x05>; + init-brt =3D /bits/ 8 <0x3f>; + rom_a0h { + rom-addr =3D /bits/ 8 <0xa0>; + rom-val =3D /bits/ 8 <0xff>; + }; + rom_a1h { + rom-addr =3D /bits/ 8 <0xa1>; + rom-val =3D /bits/ 8 <0x3f>; + }; + rom_a2h { + rom-addr =3D /bits/ 8 <0xa2>; + rom-val =3D /bits/ 8 <0x20>; + }; + rom_a3h { + rom-addr =3D /bits/ 8 <0xa3>; + rom-val =3D /bits/ 8 <0x5e>; + }; + rom_a4h { + rom-addr =3D /bits/ 8 <0xa4>; + rom-val =3D /bits/ 8 <0x02>; + }; + rom_a5h { + rom-addr =3D /bits/ 8 <0xa5>; + rom-val =3D /bits/ 8 <0x04>; + }; + rom_a6h { + rom-addr =3D /bits/ 8 <0xa6>; + rom-val =3D /bits/ 8 <0x80>; + }; + rom_a7h { + rom-addr =3D /bits/ 8 <0xa7>; + rom-val =3D /bits/ 8 <0xf7>; + }; + rom_a9h { + rom-addr =3D /bits/ 8 <0xa9>; + rom-val =3D /bits/ 8 <0x80>; + }; + rom_aah { + rom-addr =3D /bits/ 8 <0xaa>; + rom-val =3D /bits/ 8 <0x0f>; + }; + rom_aeh { + rom-addr =3D /bits/ 8 <0xae>; + rom-val =3D /bits/ 8 <0x0f>; + }; }; +}; + +&blsp2_uart1 { + status =3D "okay"; =20 - serial@f991e000 { - status =3D "okay"; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&blsp2_uart7_pin_a>; + + bluetooth { + compatible =3D "brcm,bcm43438-bt"; + max-speed =3D <3000000>; =20 pinctrl-names =3D "default"; - pinctrl-0 =3D <&blsp1_uart2_pin_a>; + pinctrl-0 =3D <&bt_host_wake_pin>, + <&bt_dev_wake_pin>, + <&bt_reg_on_pin>; + + host-wakeup-gpios =3D <&tlmm 95 GPIO_ACTIVE_HIGH>; + device-wakeup-gpios =3D <&tlmm 96 GPIO_ACTIVE_HIGH>; + shutdown-gpios =3D <&pm8941_gpios 16 GPIO_ACTIVE_HIGH>; }; +}; =20 - serial@f995d000 { - status =3D "ok"; +&otg { + status =3D "okay"; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&blsp2_uart7_pin_a>; + phys =3D <&usb_hs1_phy>; + phy-select =3D <&tcsr 0xb000 0>; + extcon =3D <&smbb>, <&usb_id>; + vbus-supply =3D <&chg_otg>; =20 - bluetooth { - compatible =3D "brcm,bcm43438-bt"; - max-speed =3D <3000000>; + hnp-disable; + srp-disable; + adp-disable; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&bt_host_wake_pin>, - <&bt_dev_wake_pin>, - <&bt_reg_on_pin>; + ulpi { + phy@a { + status =3D "okay"; =20 - host-wakeup-gpios =3D <&tlmm 95 GPIO_ACTIVE_HIGH>; - device-wakeup-gpios =3D <&tlmm 96 GPIO_ACTIVE_HIGH>; - shutdown-gpios =3D <&pm8941_gpios 16 GPIO_ACTIVE_HIGH>; + v1p8-supply =3D <&pm8941_l6>; + v3p3-supply =3D <&pm8941_l24>; + + extcon =3D <&smbb>; + qcom,init-seq =3D /bits/ 8 <0x1 0x64>; }; }; +}; =20 - usb@f9a55000 { - status =3D "okay"; +&pm8941_coincell { + status =3D "okay"; =20 - phys =3D <&usb_hs1_phy>; - phy-select =3D <&tcsr 0xb000 0>; - extcon =3D <&smbb>, <&usb_id>; - vbus-supply =3D <&chg_otg>; + qcom,rset-ohms =3D <2100>; + qcom,vset-millivolts =3D <3000>; +}; =20 - hnp-disable; - srp-disable; - adp-disable; +&pm8941_gpios { + gpio_keys_pin_a: gpio-keys-active { + pins =3D "gpio2", "gpio5"; + function =3D "normal"; =20 - ulpi { - phy@a { - status =3D "okay"; + bias-pull-up; + power-source =3D ; + }; =20 - v1p8-supply =3D <&pm8941_l6>; - v3p3-supply =3D <&pm8941_l24>; + bt_reg_on_pin: bt-reg-on { + pins =3D "gpio16"; + function =3D "normal"; =20 - extcon =3D <&smbb>; - qcom,init-seq =3D /bits/ 8 <0x1 0x64>; - }; - }; + output-low; + power-source =3D ; }; =20 - pinctrl@fd510000 { - blsp1_uart2_pin_a: blsp1-uart2-pin-active { - rx { - pins =3D "gpio5"; - function =3D "blsp_uart2"; + wlan_sleep_clk_pin: wl-sleep-clk { + pins =3D "gpio17"; + function =3D "func2"; =20 - drive-strength =3D <2>; - bias-pull-up; - }; + output-high; + power-source =3D ; + }; =20 - tx { - pins =3D "gpio4"; - function =3D "blsp_uart2"; + wlan_regulator_pin: wl-reg-active { + pins =3D "gpio18"; + function =3D "normal"; =20 - drive-strength =3D <4>; - bias-disable; - }; - }; + bias-disable; + power-source =3D ; + }; =20 - blsp2_uart7_pin_a: blsp2-uart7-pin-active { - tx { - pins =3D "gpio41"; - function =3D "blsp_uart7"; + lcd_dcdc_en_pin_a: lcd-dcdc-en-active { + pins =3D "gpio20"; + function =3D "normal"; =20 - drive-strength =3D <2>; - bias-disable; - }; + bias-disable; + power-source =3D ; + input-disable; + output-low; + }; =20 - rx { - pins =3D "gpio42"; - function =3D "blsp_uart7"; +}; =20 - drive-strength =3D <2>; - bias-pull-up; - }; +&rpm_requests { + pm8941-regulators { + vdd_l1_l3-supply =3D <&pm8941_s1>; + vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; + vdd_l4_l11-supply =3D <&pm8941_s1>; + vdd_l5_l7-supply =3D <&pm8941_s2>; + vdd_l6_l12_l14_l15-supply =3D <&pm8941_s2>; + vdd_l9_l10_l17_l22-supply =3D <&vreg_boost>; + vdd_l13_l20_l23_l24-supply =3D <&vreg_boost>; + vdd_l21-supply =3D <&vreg_boost>; + + pm8941_s1: s1 { + regulator-min-microvolt =3D <1300000>; + regulator-max-microvolt =3D <1300000>; + regulator-always-on; + regulator-boot-on; + }; =20 - cts { - pins =3D "gpio43"; - function =3D "blsp_uart7"; + pm8941_s2: s2 { + regulator-min-microvolt =3D <2150000>; + regulator-max-microvolt =3D <2150000>; + regulator-boot-on; + }; =20 - drive-strength =3D <2>; - bias-pull-up; - }; + pm8941_s3: s3 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-system-load =3D <154000>; + regulator-always-on; + regulator-boot-on; + }; =20 - rts { - pins =3D "gpio44"; - function =3D "blsp_uart7"; + pm8941_s4: s4 { + regulator-min-microvolt =3D <5000000>; + regulator-max-microvolt =3D <5000000>; + }; =20 - drive-strength =3D <2>; - bias-disable; - }; + pm8941_l1: l1 { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1225000>; + regulator-always-on; + regulator-boot-on; }; =20 - i2c8_pins: i2c8 { - mux { - pins =3D "gpio47", "gpio48"; - function =3D "blsp_i2c8"; + pm8941_l2: l2 { + regulator-min-microvolt =3D <1200000>; + regulator-max-microvolt =3D <1200000>; + }; =20 - drive-strength =3D <2>; - bias-disable; - }; + pm8941_l3: l3 { + regulator-min-microvolt =3D <1200000>; + regulator-max-microvolt =3D <1200000>; }; =20 - i2c11_pins: i2c11 { - mux { - pins =3D "gpio83", "gpio84"; - function =3D "blsp_i2c11"; + pm8941_l4: l4 { + regulator-min-microvolt =3D <1225000>; + regulator-max-microvolt =3D <1225000>; + }; =20 - drive-strength =3D <2>; - bias-disable; - }; + pm8941_l5: l5 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; }; =20 - lcd_backlight_en_pin_a: lcd-backlight-vddio { - pins =3D "gpio69"; - drive-strength =3D <10>; - output-low; - bias-disable; + pm8941_l6: l6 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-boot-on; }; =20 - sdhc1_pin_a: sdhc1-pin-active { - clk { - pins =3D "sdc1_clk"; - drive-strength =3D <16>; - bias-disable; - }; + pm8941_l7: l7 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-boot-on; + }; =20 - cmd-data { - pins =3D "sdc1_cmd", "sdc1_data"; - drive-strength =3D <10>; - bias-pull-up; - }; + pm8941_l8: l8 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; }; =20 - sdhc2_cd_pin_a: sdhc2-cd-pin-active { - pins =3D "gpio62"; - function =3D "gpio"; + pm8941_l9: l9 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2950000>; + }; =20 - drive-strength =3D <2>; - bias-disable; - }; + pm8941_l11: l11 { + regulator-min-microvolt =3D <1300000>; + regulator-max-microvolt =3D <1350000>; + }; =20 - sdhc2_pin_a: sdhc2-pin-active { - clk { - pins =3D "sdc2_clk"; - drive-strength =3D <6>; - bias-disable; - }; + pm8941_l12: l12 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-always-on; + regulator-boot-on; + }; =20 - cmd-data { - pins =3D "sdc2_cmd", "sdc2_data"; - drive-strength =3D <6>; - bias-pull-up; - }; + pm8941_l13: l13 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <2950000>; + regulator-boot-on; }; =20 - sdhc3_pin_a: sdhc3-pin-active { - clk { - pins =3D "gpio40"; - function =3D "sdc3"; + pm8941_l14: l14 { + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + }; =20 - drive-strength =3D <10>; - bias-disable; - }; + pm8941_l15: l15 { + regulator-min-microvolt =3D <2050000>; + regulator-max-microvolt =3D <2050000>; + }; =20 - cmd { - pins =3D "gpio39"; - function =3D "sdc3"; + pm8941_l16: l16 { + regulator-min-microvolt =3D <2700000>; + regulator-max-microvolt =3D <2700000>; + }; + + pm8941_l17: l17 { + regulator-min-microvolt =3D <2700000>; + regulator-max-microvolt =3D <2700000>; + }; =20 - drive-strength =3D <10>; - bias-pull-up; - }; + pm8941_l18: l18 { + regulator-min-microvolt =3D <2850000>; + regulator-max-microvolt =3D <2850000>; + }; =20 - data { - pins =3D "gpio35", "gpio36", "gpio37", "gpio38"; - function =3D "sdc3"; + pm8941_l19: l19 { + regulator-min-microvolt =3D <2850000>; + regulator-max-microvolt =3D <2850000>; + }; =20 - drive-strength =3D <10>; - bias-pull-up; - }; + pm8941_l20: l20 { + regulator-min-microvolt =3D <2950000>; + regulator-max-microvolt =3D <2950000>; + regulator-system-load =3D <500000>; + regulator-allow-set-load; + regulator-boot-on; }; =20 - ts_int_pin: synaptics { - pin { - pins =3D "gpio86"; - function =3D "gpio"; + pm8941_l21: l21 { + regulator-min-microvolt =3D <2950000>; + regulator-max-microvolt =3D <2950000>; + regulator-boot-on; + }; =20 - drive-strength =3D <2>; - bias-disable; - input-enable; - }; + pm8941_l22: l22 { + regulator-min-microvolt =3D <3000000>; + regulator-max-microvolt =3D <3000000>; }; =20 - bt_host_wake_pin: bt-host-wake { - pins =3D "gpio95"; - function =3D "gpio"; + pm8941_l23: l23 { + regulator-min-microvolt =3D <2800000>; + regulator-max-microvolt =3D <2800000>; + }; =20 - drive-strength =3D <2>; - bias-disable; - output-low; + pm8941_l24: l24 { + regulator-min-microvolt =3D <3075000>; + regulator-max-microvolt =3D <3075000>; + regulator-boot-on; }; + }; +}; =20 - bt_dev_wake_pin: bt-dev-wake { - pins =3D "gpio96"; - function =3D "gpio"; +&sdhc_1 { + status =3D "okay"; + + vmmc-supply =3D <&pm8941_l20>; + vqmmc-supply =3D <&pm8941_s3>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sdhc1_pin_a>; +}; + +&sdhc_2 { + status =3D "okay"; + + vmmc-supply =3D <&pm8941_l21>; + vqmmc-supply =3D <&pm8941_l13>; + + cd-gpios =3D <&tlmm 62 GPIO_ACTIVE_LOW>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sdhc2_pin_a>, <&sdhc2_cd_pin_a>; +}; + +&sdhc_3 { + status =3D "okay"; + + max-frequency =3D <100000000>; + vmmc-supply =3D <&vreg_wlan>; + non-removable; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sdhc3_pin_a>; + + #address-cells =3D <1>; + #size-cells =3D <0>; + + bcrmf@1 { + compatible =3D "brcm,bcm4339-fmac", "brcm,bcm4329-fmac"; + reg =3D <1>; + + brcm,drive-strength =3D <10>; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&wlan_sleep_clk_pin>; + }; +}; + +&smbb { + qcom,fast-charge-safe-current =3D <1500000>; + qcom,fast-charge-current-limit =3D <1500000>; + qcom,dc-current-limit =3D <1800000>; + qcom,fast-charge-safe-voltage =3D <4400000>; + qcom,fast-charge-high-threshold-voltage =3D <4350000>; + qcom,fast-charge-low-threshold-voltage =3D <3400000>; + qcom,auto-recharge-threshold-voltage =3D <4200000>; + qcom,minimum-input-voltage =3D <4300000>; +}; + +&tlmm { + blsp1_uart2_pin_a: blsp1-uart2-pin-active { + rx { + pins =3D "gpio5"; + function =3D "blsp_uart2"; =20 drive-strength =3D <2>; + bias-pull-up; + }; + + tx { + pins =3D "gpio4"; + function =3D "blsp_uart2"; + + drive-strength =3D <4>; bias-disable; }; }; =20 - i2c@f9964000 { - status =3D "okay"; + blsp2_uart7_pin_a: blsp2-uart7-pin-active { + tx { + pins =3D "gpio41"; + function =3D "blsp_uart7"; =20 - clock-frequency =3D <355000>; - qcom,src-freq =3D <50000000>; - - pinctrl-names =3D "default"; - pinctrl-0 =3D <&i2c8_pins>; + drive-strength =3D <2>; + bias-disable; + }; =20 - synaptics@2c { - compatible =3D "syna,rmi4-i2c"; - reg =3D <0x2c>; + rx { + pins =3D "gpio42"; + function =3D "blsp_uart7"; =20 - interrupt-parent =3D <&tlmm>; - interrupts =3D <86 IRQ_TYPE_EDGE_FALLING>; + drive-strength =3D <2>; + bias-pull-up; + }; =20 - #address-cells =3D <1>; - #size-cells =3D <0>; + cts { + pins =3D "gpio43"; + function =3D "blsp_uart7"; =20 - vdd-supply =3D <&pm8941_l22>; - vio-supply =3D <&pm8941_lvs3>; + drive-strength =3D <2>; + bias-pull-up; + }; =20 - pinctrl-names =3D "default"; - pinctrl-0 =3D <&ts_int_pin>; + rts { + pins =3D "gpio44"; + function =3D "blsp_uart7"; =20 - syna,startup-delay-ms =3D <10>; + drive-strength =3D <2>; + bias-disable; + }; + }; =20 - rmi-f01@1 { - reg =3D <0x1>; - syna,nosleep =3D <1>; - }; + i2c8_pins: i2c8 { + mux { + pins =3D "gpio47", "gpio48"; + function =3D "blsp_i2c8"; =20 - rmi-f11@11 { - reg =3D <0x11>; - syna,f11-flip-x =3D <1>; - syna,sensor-type =3D <1>; - }; + drive-strength =3D <2>; + bias-disable; }; }; =20 - i2c@f9967000 { - status =3D "okay"; - pinctrl-names =3D "default"; - pinctrl-0 =3D <&i2c11_pins>; - clock-frequency =3D <355000>; - qcom,src-freq =3D <50000000>; - - lp8566_wled: backlight@2c { - compatible =3D "ti,lp8556"; - reg =3D <0x2c>; - power-supply =3D <&vreg_bl_vddio>; - - bl-name =3D "backlight"; - dev-ctrl =3D /bits/ 8 <0x05>; - init-brt =3D /bits/ 8 <0x3f>; - rom_a0h { - rom-addr =3D /bits/ 8 <0xa0>; - rom-val =3D /bits/ 8 <0xff>; - }; - rom_a1h { - rom-addr =3D /bits/ 8 <0xa1>; - rom-val =3D /bits/ 8 <0x3f>; - }; - rom_a2h { - rom-addr =3D /bits/ 8 <0xa2>; - rom-val =3D /bits/ 8 <0x20>; - }; - rom_a3h { - rom-addr =3D /bits/ 8 <0xa3>; - rom-val =3D /bits/ 8 <0x5e>; - }; - rom_a4h { - rom-addr =3D /bits/ 8 <0xa4>; - rom-val =3D /bits/ 8 <0x02>; - }; - rom_a5h { - rom-addr =3D /bits/ 8 <0xa5>; - rom-val =3D /bits/ 8 <0x04>; - }; - rom_a6h { - rom-addr =3D /bits/ 8 <0xa6>; - rom-val =3D /bits/ 8 <0x80>; - }; - rom_a7h { - rom-addr =3D /bits/ 8 <0xa7>; - rom-val =3D /bits/ 8 <0xf7>; - }; - rom_a9h { - rom-addr =3D /bits/ 8 <0xa9>; - rom-val =3D /bits/ 8 <0x80>; - }; - rom_aah { - rom-addr =3D /bits/ 8 <0xaa>; - rom-val =3D /bits/ 8 <0x0f>; - }; - rom_aeh { - rom-addr =3D /bits/ 8 <0xae>; - rom-val =3D /bits/ 8 <0x0f>; - }; + i2c11_pins: i2c11 { + mux { + pins =3D "gpio83", "gpio84"; + function =3D "blsp_i2c11"; + + drive-strength =3D <2>; + bias-disable; }; }; -}; =20 -&spmi_bus { - pm8941@0 { - charger@1000 { - qcom,fast-charge-safe-current =3D <1500000>; - qcom,fast-charge-current-limit =3D <1500000>; - qcom,dc-current-limit =3D <1800000>; - qcom,fast-charge-safe-voltage =3D <4400000>; - qcom,fast-charge-high-threshold-voltage =3D <4350000>; - qcom,fast-charge-low-threshold-voltage =3D <3400000>; - qcom,auto-recharge-threshold-voltage =3D <4200000>; - qcom,minimum-input-voltage =3D <4300000>; + lcd_backlight_en_pin_a: lcd-backlight-vddio { + pins =3D "gpio69"; + drive-strength =3D <10>; + output-low; + bias-disable; + }; + + sdhc1_pin_a: sdhc1-pin-active { + clk { + pins =3D "sdc1_clk"; + drive-strength =3D <16>; + bias-disable; }; =20 - gpios@c000 { - gpio_keys_pin_a: gpio-keys-active { - pins =3D "gpio2", "gpio5"; - function =3D "normal"; + cmd-data { + pins =3D "sdc1_cmd", "sdc1_data"; + drive-strength =3D <10>; + bias-pull-up; + }; + }; =20 - bias-pull-up; - power-source =3D ; - }; + sdhc2_cd_pin_a: sdhc2-cd-pin-active { + pins =3D "gpio62"; + function =3D "gpio"; =20 - bt_reg_on_pin: bt-reg-on { - pins =3D "gpio16"; - function =3D "normal"; + drive-strength =3D <2>; + bias-disable; + }; =20 - output-low; - power-source =3D ; - }; + sdhc2_pin_a: sdhc2-pin-active { + clk { + pins =3D "sdc2_clk"; + drive-strength =3D <6>; + bias-disable; + }; =20 - wlan_sleep_clk_pin: wl-sleep-clk { - pins =3D "gpio17"; - function =3D "func2"; + cmd-data { + pins =3D "sdc2_cmd", "sdc2_data"; + drive-strength =3D <6>; + bias-pull-up; + }; + }; =20 - output-high; - power-source =3D ; - }; + sdhc3_pin_a: sdhc3-pin-active { + clk { + pins =3D "gpio40"; + function =3D "sdc3"; =20 - wlan_regulator_pin: wl-reg-active { - pins =3D "gpio18"; - function =3D "normal"; + drive-strength =3D <10>; + bias-disable; + }; =20 - bias-disable; - power-source =3D ; - }; + cmd { + pins =3D "gpio39"; + function =3D "sdc3"; =20 - lcd_dcdc_en_pin_a: lcd-dcdc-en-active { - pins =3D "gpio20"; - function =3D "normal"; + drive-strength =3D <10>; + bias-pull-up; + }; =20 - bias-disable; - power-source =3D ; - input-disable; - output-low; - }; + data { + pins =3D "gpio35", "gpio36", "gpio37", "gpio38"; + function =3D "sdc3"; =20 + drive-strength =3D <10>; + bias-pull-up; }; + }; =20 - coincell@2800 { - status =3D "okay"; - qcom,rset-ohms =3D <2100>; - qcom,vset-millivolts =3D <3000>; + ts_int_pin: synaptics { + pin { + pins =3D "gpio86"; + function =3D "gpio"; + + drive-strength =3D <2>; + bias-disable; + input-enable; }; }; + + bt_host_wake_pin: bt-host-wake { + pins =3D "gpio95"; + function =3D "gpio"; + + drive-strength =3D <2>; + bias-disable; + output-low; + }; + + bt_dev_wake_pin: bt-dev-wake { + pins =3D "gpio96"; + function =3D "gpio"; + + drive-strength =3D <2>; + bias-disable; + }; }; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45FAAC00140 for ; Mon, 15 Aug 2022 20:39:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345478AbiHOUjJ (ORCPT ); Mon, 15 Aug 2022 16:39:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345910AbiHOUeT (ORCPT ); Mon, 15 Aug 2022 16:34:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5BD82AE23; Mon, 15 Aug 2022 12:06:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 45DBA61299; Mon, 15 Aug 2022 19:06:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26A2BC433D6; Mon, 15 Aug 2022 19:06:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590366; bh=0b0R6RaL4DcQ7B6NQpB2BTI806Onu2sADIXafVLrug0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pffOw2tNFBoBeUHssfOJOc9JgDU14JeRB0y2tN+mf/QQb9o9VyAG0cvbw+rrl6LeC 9qpvGNtxFNGff7H9LLvfmmEHw2AqKmiM8Yan9uHUk22/++nl7la86MSElTs6oDS1Zu 6MpUyPgLJ9EU5SQRzzbVBYY0+M6r+ZlH0X3zLCpg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0238/1095] ARM: dts: qcom-msm8974: Convert ADSP to a MMIO device Date: Mon, 15 Aug 2022 19:53:57 +0200 Message-Id: <20220815180439.629057638@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit 2daa785817dd35172b856c30fc5148b2773b6891 ] The cx-supply has been removed as it's supposed to be set on a per-board basis. Signed-off-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220415115633.575010-17-konrad.dybcio@soma= inline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-msm8974.dtsi | 60 ++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-m= sm8974.dtsi index ea3491d47b9f..e6c9782e4670 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -341,36 +341,6 @@ timer { clock-frequency =3D <19200000>; }; =20 - remoteproc_adsp: adsp-pil { - compatible =3D "qcom,msm8974-adsp-pil"; - - interrupts-extended =3D <&intc GIC_SPI 162 IRQ_TYPE_EDGE_RISING>, - <&adsp_smp2p_in 0 IRQ_TYPE_EDGE_RISING>, - <&adsp_smp2p_in 1 IRQ_TYPE_EDGE_RISING>, - <&adsp_smp2p_in 2 IRQ_TYPE_EDGE_RISING>, - <&adsp_smp2p_in 3 IRQ_TYPE_EDGE_RISING>; - interrupt-names =3D "wdog", "fatal", "ready", "handover", "stop-ack"; - - cx-supply =3D <&pm8841_s2>; - - clocks =3D <&xo_board>; - clock-names =3D "xo"; - - memory-region =3D <&adsp_region>; - - qcom,smem-states =3D <&adsp_smp2p_out 0>; - qcom,smem-state-names =3D "stop"; - - smd-edge { - interrupts =3D ; - - qcom,ipc =3D <&apcs 8 8>; - qcom,smd-edge =3D <1>; - - label =3D "lpass"; - }; - }; - smem { compatible =3D "qcom,smem"; =20 @@ -1592,6 +1562,36 @@ dsi0_phy: dsi-phy@fd922a00 { }; }; =20 + remoteproc_adsp: remoteproc@fe200000 { + compatible =3D "qcom,msm8974-adsp-pil"; + reg =3D <0xfe200000 0x100>; + + interrupts-extended =3D <&intc GIC_SPI 162 IRQ_TYPE_EDGE_RISING>, + <&adsp_smp2p_in 0 IRQ_TYPE_EDGE_RISING>, + <&adsp_smp2p_in 1 IRQ_TYPE_EDGE_RISING>, + <&adsp_smp2p_in 2 IRQ_TYPE_EDGE_RISING>, + <&adsp_smp2p_in 3 IRQ_TYPE_EDGE_RISING>; + interrupt-names =3D "wdog", "fatal", "ready", "handover", "stop-ack"; + + clocks =3D <&xo_board>; + clock-names =3D "xo"; + + memory-region =3D <&adsp_region>; + + qcom,smem-states =3D <&adsp_smp2p_out 0>; + qcom,smem-state-names =3D "stop"; + + smd-edge { + interrupts =3D ; + + qcom,ipc =3D <&apcs 8 8>; + qcom,smd-edge =3D <1>; + label =3D "lpass"; + #address-cells =3D <1>; + #size-cells =3D <0>; + }; + }; + imem: imem@fe805000 { status =3D "disabled"; compatible =3D "syscon", "simple-mfd"; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 759CCC00140 for ; Mon, 15 Aug 2022 20:39:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344188AbiHOUjg (ORCPT ); Mon, 15 Aug 2022 16:39:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346014AbiHOUei (ORCPT ); Mon, 15 Aug 2022 16:34:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AD2EAB4C9; Mon, 15 Aug 2022 12:06:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AC4E9B8107A; Mon, 15 Aug 2022 19:06:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D8A8C433D6; Mon, 15 Aug 2022 19:06:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590370; bh=wRmXQviFxT6g0FVIEJvYD6FwmG24ifCxQkYvt241vig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GiUGP86VqhaRy26EIO7PtWIgLnQ/Jpyj164KQ4rE5vFCSievM789H99XS18OhIMmF rd0ykuXc81wH4CvygzKwH/NoEKW7SghWxHWgDrzw5f/IgspgEaeisdzmDC9/GvNE9N 5fdrludYwMOFVQdO1FdtteP0ye979faeMFrEV/Gw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0239/1095] ARM: dts: qcom-msm8974: Sort and clean up nodes Date: Mon, 15 Aug 2022 19:53:58 +0200 Message-Id: <20220815180439.671219266@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit f300826d27be7f7f671c922bf57007c98c683590 ] - Remove regulators from the SoC DTSI - cpu_pmu{} -> pmu{} - move modem/iris regulators out of here; only FP2 used them - tcsr_mutex is moved out of /soc Signed-off-by: Konrad Dybcio [bjorn: Rebased on top of Krzysztof's fixes] Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220415115633.575010-18-konrad.dybcio@soma= inline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../arm/boot/dts/qcom-apq8074-dragonboard.dts | 4 + .../boot/dts/qcom-msm8974-fairphone-fp2.dts | 12 + .../qcom-msm8974-lge-nexus5-hammerhead.dts | 7 + .../dts/qcom-msm8974-sony-xperia-castor.dts | 4 + .../dts/qcom-msm8974-sony-xperia-rhine.dtsi | 6 + arch/arm/boot/dts/qcom-msm8974.dtsi | 1414 ++++++++--------- 6 files changed, 709 insertions(+), 738 deletions(-) diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts b/arch/arm/boot= /dts/qcom-apq8074-dragonboard.dts index f114debe4d95..f47020cf7a90 100644 --- a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts +++ b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts @@ -61,6 +61,8 @@ phy@b { =20 &rpm_requests { pm8841-regulators { + compatible =3D "qcom,rpm-pm8841-regulators"; + pm8841_s1: s1 { regulator-min-microvolt =3D <675000>; regulator-max-microvolt =3D <1050000>; @@ -83,6 +85,8 @@ pm8841_s4: s4 { }; =20 pm8941-regulators { + compatible =3D "qcom,rpm-pm8941-regulators"; + vdd_l1_l3-supply =3D <&pm8941_s1>; vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; vdd_l4_l11-supply =3D <&pm8941_s1>; diff --git a/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts b/arch/arm/bo= ot/dts/qcom-msm8974-fairphone-fp2.dts index 38e48ea021d9..d6799a1b820b 100644 --- a/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts +++ b/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts @@ -109,10 +109,18 @@ &pronto { =20 vddmx-supply =3D <&pm8841_s1>; vddcx-supply =3D <&pm8841_s2>; + vddpx-supply =3D <&pm8941_s3>; =20 pinctrl-names =3D "default"; pinctrl-0 =3D <&wcnss_pin_a>; =20 + iris { + vddxo-supply =3D <&pm8941_l6>; + vddrfa-supply =3D <&pm8941_l11>; + vddpa-supply =3D <&pm8941_l19>; + vdddig-supply =3D <&pm8941_s3>; + }; + smd-edge { qcom,remote-pid =3D <4>; label =3D "pronto"; @@ -125,6 +133,8 @@ wcnss { =20 &rpm_requests { pm8841-regulators { + compatible =3D "qcom,rpm-pm8841-regulators"; + pm8841_s1: s1 { regulator-min-microvolt =3D <675000>; regulator-max-microvolt =3D <1050000>; @@ -142,6 +152,8 @@ pm8841_s3: s3 { }; =20 pm8941-regulators { + compatible =3D "qcom,rpm-pm8941-regulators"; + vdd_l1_l3-supply =3D <&pm8941_s1>; vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; vdd_l4_l11-supply =3D <&pm8941_s1>; diff --git a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts b/arc= h/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts index a1cae3d453c2..6537950c30ba 100644 --- a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts +++ b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts @@ -334,6 +334,8 @@ otg { =20 &rpm_requests { pm8841-regulators { + compatible =3D "qcom,rpm-pm8841-regulators"; + pm8841_s1: s1 { regulator-min-microvolt =3D <675000>; regulator-max-microvolt =3D <1050000>; @@ -356,6 +358,8 @@ pm8841_s4: s4 { }; =20 pm8941-regulators { + compatible =3D "qcom,rpm-pm8941-regulators"; + vdd_l1_l3-supply =3D <&pm8941_s1>; vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; vdd_l4_l11-supply =3D <&pm8941_s1>; @@ -517,6 +521,9 @@ pm8941_l24: l24 { regulator-max-microvolt =3D <3075000>; regulator-boot-on; }; + + pm8941_lvs1: lvs1 {}; + pm8941_lvs3: lvs3 {}; }; }; =20 diff --git a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts b/arch/a= rm/boot/dts/qcom-msm8974-sony-xperia-castor.dts index 687f6149268c..b8b6447b3217 100644 --- a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts +++ b/arch/arm/boot/dts/qcom-msm8974-sony-xperia-castor.dts @@ -304,6 +304,8 @@ lcd_dcdc_en_pin_a: lcd-dcdc-en-active { =20 &rpm_requests { pm8941-regulators { + compatible =3D "qcom,rpm-pm8941-regulators"; + vdd_l1_l3-supply =3D <&pm8941_s1>; vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; vdd_l4_l11-supply =3D <&pm8941_s1>; @@ -465,6 +467,8 @@ pm8941_l24: l24 { regulator-max-microvolt =3D <3075000>; regulator-boot-on; }; + + pm8941_lvs3: lvs3 {}; }; }; =20 diff --git a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-rhine.dtsi b/arch/a= rm/boot/dts/qcom-msm8974-sony-xperia-rhine.dtsi index 87ec3694add9..870e0aeb4d05 100644 --- a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-rhine.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974-sony-xperia-rhine.dtsi @@ -153,6 +153,8 @@ &pm8941_wled { =20 &rpm_requests { pm8841-regulators { + compatible =3D "qcom,rpm-pm8841-regulators"; + pm8841_s1: s1 { regulator-min-microvolt =3D <675000>; regulator-max-microvolt =3D <1050000>; @@ -175,6 +177,8 @@ pm8841_s4: s4 { }; =20 pm8941-regulators { + compatible =3D "qcom,rpm-pm8941-regulators"; + vdd_l1_l3-supply =3D <&pm8941_s1>; vdd_l2_lvs1_2_3-supply =3D <&pm8941_s3>; vdd_l4_l11-supply =3D <&pm8941_s1>; @@ -335,6 +339,8 @@ pm8941_l24: l24 { regulator-max-microvolt =3D <3075000>; regulator-boot-on; }; + + pm8941_lvs3: lvs3 {}; }; }; =20 diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-m= sm8974.dtsi index e6c9782e4670..0091a4c29fff 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -16,57 +16,17 @@ / { compatible =3D "qcom,msm8974"; interrupt-parent =3D <&intc>; =20 - reserved-memory { - #address-cells =3D <1>; - #size-cells =3D <1>; - ranges; - - mpss_region: mpss@8000000 { - reg =3D <0x08000000 0x5100000>; - no-map; - }; - - mba_region: mba@d100000 { - reg =3D <0x0d100000 0x100000>; - no-map; - }; - - wcnss_region: wcnss@d200000 { - reg =3D <0x0d200000 0xa00000>; - no-map; - }; - - adsp_region: adsp@dc00000 { - reg =3D <0x0dc00000 0x1900000>; - no-map; - }; - - venus@f500000 { - reg =3D <0x0f500000 0x500000>; - no-map; - }; - - smem_region: smem@fa00000 { - reg =3D <0xfa00000 0x200000>; - no-map; - }; - - tz@fc00000 { - reg =3D <0x0fc00000 0x160000>; - no-map; - }; - - rfsa@fd60000 { - reg =3D <0x0fd60000 0x20000>; - no-map; + clocks { + xo_board: xo_board { + compatible =3D "fixed-clock"; + #clock-cells =3D <0>; + clock-frequency =3D <19200000>; }; =20 - rmtfs@fd80000 { - compatible =3D "qcom,rmtfs-mem"; - reg =3D <0x0fd80000 0x180000>; - no-map; - - qcom,client-id =3D <1>; + sleep_clk: sleep_clk { + compatible =3D "fixed-clock"; + #clock-cells =3D <0>; + clock-frequency =3D <32768>; }; }; =20 @@ -136,211 +96,78 @@ CPU_SPC: spc { }; }; =20 + firmware { + scm { + compatible =3D "qcom,scm"; + clocks =3D <&gcc GCC_CE1_CLK>, <&gcc GCC_CE1_AXI_CLK>, <&gcc GCC_CE1_AH= B_CLK>; + clock-names =3D "core", "bus", "iface"; + }; + }; + memory { device_type =3D "memory"; reg =3D <0x0 0x0>; }; =20 - thermal-zones { - cpu0-thermal { - polling-delay-passive =3D <250>; - polling-delay =3D <1000>; - - thermal-sensors =3D <&tsens 5>; - - trips { - cpu_alert0: trip0 { - temperature =3D <75000>; - hysteresis =3D <2000>; - type =3D "passive"; - }; - cpu_crit0: trip1 { - temperature =3D <110000>; - hysteresis =3D <2000>; - type =3D "critical"; - }; - }; - }; - - cpu1-thermal { - polling-delay-passive =3D <250>; - polling-delay =3D <1000>; - - thermal-sensors =3D <&tsens 6>; - - trips { - cpu_alert1: trip0 { - temperature =3D <75000>; - hysteresis =3D <2000>; - type =3D "passive"; - }; - cpu_crit1: trip1 { - temperature =3D <110000>; - hysteresis =3D <2000>; - type =3D "critical"; - }; - }; - }; - - cpu2-thermal { - polling-delay-passive =3D <250>; - polling-delay =3D <1000>; + pmu { + compatible =3D "qcom,krait-pmu"; + interrupts =3D ; + }; =20 - thermal-sensors =3D <&tsens 7>; + reserved-memory { + #address-cells =3D <1>; + #size-cells =3D <1>; + ranges; =20 - trips { - cpu_alert2: trip0 { - temperature =3D <75000>; - hysteresis =3D <2000>; - type =3D "passive"; - }; - cpu_crit2: trip1 { - temperature =3D <110000>; - hysteresis =3D <2000>; - type =3D "critical"; - }; - }; + mpss_region: mpss@8000000 { + reg =3D <0x08000000 0x5100000>; + no-map; }; =20 - cpu3-thermal { - polling-delay-passive =3D <250>; - polling-delay =3D <1000>; - - thermal-sensors =3D <&tsens 8>; - - trips { - cpu_alert3: trip0 { - temperature =3D <75000>; - hysteresis =3D <2000>; - type =3D "passive"; - }; - cpu_crit3: trip1 { - temperature =3D <110000>; - hysteresis =3D <2000>; - type =3D "critical"; - }; - }; + mba_region: mba@d100000 { + reg =3D <0x0d100000 0x100000>; + no-map; }; =20 - q6-dsp-thermal { - polling-delay-passive =3D <250>; - polling-delay =3D <1000>; - - thermal-sensors =3D <&tsens 1>; - - trips { - q6_dsp_alert0: trip-point0 { - temperature =3D <90000>; - hysteresis =3D <2000>; - type =3D "hot"; - }; - }; + wcnss_region: wcnss@d200000 { + reg =3D <0x0d200000 0xa00000>; + no-map; }; =20 - modemtx-thermal { - polling-delay-passive =3D <250>; - polling-delay =3D <1000>; - - thermal-sensors =3D <&tsens 2>; - - trips { - modemtx_alert0: trip-point0 { - temperature =3D <90000>; - hysteresis =3D <2000>; - type =3D "hot"; - }; - }; + adsp_region: adsp@dc00000 { + reg =3D <0x0dc00000 0x1900000>; + no-map; }; =20 - video-thermal { - polling-delay-passive =3D <250>; - polling-delay =3D <1000>; - - thermal-sensors =3D <&tsens 3>; - - trips { - video_alert0: trip-point0 { - temperature =3D <95000>; - hysteresis =3D <2000>; - type =3D "hot"; - }; - }; + venus_region: memory@f500000 { + reg =3D <0x0f500000 0x500000>; + no-map; }; =20 - wlan-thermal { - polling-delay-passive =3D <250>; - polling-delay =3D <1000>; - - thermal-sensors =3D <&tsens 4>; - - trips { - wlan_alert0: trip-point0 { - temperature =3D <105000>; - hysteresis =3D <2000>; - type =3D "hot"; - }; - }; + smem_region: smem@fa00000 { + reg =3D <0xfa00000 0x200000>; + no-map; }; =20 - gpu-top-thermal { - polling-delay-passive =3D <250>; - polling-delay =3D <1000>; - - thermal-sensors =3D <&tsens 9>; - - trips { - gpu1_alert0: trip-point0 { - temperature =3D <90000>; - hysteresis =3D <2000>; - type =3D "hot"; - }; - }; + tz_region: memory@fc00000 { + reg =3D <0x0fc00000 0x160000>; + no-map; }; =20 - gpu-bottom-thermal { - polling-delay-passive =3D <250>; - polling-delay =3D <1000>; - - thermal-sensors =3D <&tsens 10>; - - trips { - gpu2_alert0: trip-point0 { - temperature =3D <90000>; - hysteresis =3D <2000>; - type =3D "hot"; - }; - }; + rfsa_mem: memory@fd60000 { + reg =3D <0x0fd60000 0x20000>; + no-map; }; - }; - - cpu-pmu { - compatible =3D "qcom,krait-pmu"; - interrupts =3D ; - }; =20 - clocks { - xo_board: xo_board { - compatible =3D "fixed-clock"; - #clock-cells =3D <0>; - clock-frequency =3D <19200000>; - }; + rmtfs@fd80000 { + compatible =3D "qcom,rmtfs-mem"; + reg =3D <0x0fd80000 0x180000>; + no-map; =20 - sleep_clk: sleep_clk { - compatible =3D "fixed-clock"; - #clock-cells =3D <0>; - clock-frequency =3D <32768>; + qcom,client-id =3D <1>; }; }; =20 - timer { - compatible =3D "arm,armv7-timer"; - interrupts =3D , - , - , - ; - clock-frequency =3D <19200000>; - }; - smem { compatible =3D "qcom,smem"; =20 @@ -467,11 +294,23 @@ wcnss_smsm: wcnss@7 { }; }; =20 - firmware { - scm { - compatible =3D "qcom,scm"; - clocks =3D <&gcc GCC_CE1_CLK>, <&gcc GCC_CE1_AXI_CLK>, <&gcc GCC_CE1_AH= B_CLK>; - clock-names =3D "core", "bus", "iface"; + smd { + compatible =3D "qcom,smd"; + + rpm { + interrupts =3D ; + qcom,ipc =3D <&apcs 8 0>; + qcom,smd-edge =3D <15>; + + rpm_requests: rpm_requests { + compatible =3D "qcom,rpm-msm8974"; + qcom,smd-channels =3D "rpm_requests"; + + rpmcc: clock-controller { + compatible =3D "qcom,rpmcc-msm8974", "qcom,rpmcc"; + #clock-cells =3D <1>; + }; + }; }; }; =20 @@ -494,31 +333,6 @@ apcs: syscon@f9011000 { reg =3D <0xf9011000 0x1000>; }; =20 - qfprom: qfprom@fc4bc000 { - #address-cells =3D <1>; - #size-cells =3D <1>; - compatible =3D "qcom,qfprom"; - reg =3D <0xfc4bc000 0x1000>; - tsens_calib: calib@d0 { - reg =3D <0xd0 0x18>; - }; - tsens_backup: backup@440 { - reg =3D <0x440 0x10>; - }; - }; - - tsens: thermal-sensor@fc4a9000 { - compatible =3D "qcom,msm8974-tsens"; - reg =3D <0xfc4a9000 0x1000>, /* TM */ - <0xfc4a8000 0x1000>; /* SROT */ - nvmem-cells =3D <&tsens_calib>, <&tsens_backup>; - nvmem-cell-names =3D "calib", "calib_backup"; - #qcom,sensors =3D <11>; - interrupts =3D ; - interrupt-names =3D "uplow"; - #thermal-sensor-cells =3D <1>; - }; - timer@f9020000 { #address-cells =3D <1>; #size-cells =3D <1>; @@ -624,94 +438,6 @@ acc3: clock-controller@f90b8000 { reg =3D <0xf90b8000 0x1000>, <0xf9008000 0x1000>; }; =20 - restart@fc4ab000 { - compatible =3D "qcom,pshold"; - reg =3D <0xfc4ab000 0x4>; - }; - - gcc: clock-controller@fc400000 { - compatible =3D "qcom,gcc-msm8974"; - #clock-cells =3D <1>; - #reset-cells =3D <1>; - #power-domain-cells =3D <1>; - reg =3D <0xfc400000 0x4000>; - }; - - tcsr: syscon@fd4a0000 { - compatible =3D "syscon"; - reg =3D <0xfd4a0000 0x10000>; - }; - - tcsr_mutex_block: syscon@fd484000 { - compatible =3D "syscon"; - reg =3D <0xfd484000 0x2000>; - }; - - mmcc: clock-controller@fd8c0000 { - compatible =3D "qcom,mmcc-msm8974"; - #clock-cells =3D <1>; - #reset-cells =3D <1>; - #power-domain-cells =3D <1>; - reg =3D <0xfd8c0000 0x6000>; - }; - - tcsr_mutex: tcsr-mutex { - compatible =3D "qcom,tcsr-mutex"; - syscon =3D <&tcsr_mutex_block 0 0x80>; - - #hwlock-cells =3D <1>; - }; - - rpm_msg_ram: memory@fc428000 { - compatible =3D "qcom,rpm-msg-ram"; - reg =3D <0xfc428000 0x4000>; - }; - - blsp1_uart1: serial@f991d000 { - compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; - reg =3D <0xf991d000 0x1000>; - interrupts =3D ; - clocks =3D <&gcc GCC_BLSP1_UART1_APPS_CLK>, <&gcc GCC_BLSP1_AHB_CLK>; - clock-names =3D "core", "iface"; - status =3D "disabled"; - }; - - blsp1_uart2: serial@f991e000 { - compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; - reg =3D <0xf991e000 0x1000>; - interrupts =3D ; - clocks =3D <&gcc GCC_BLSP1_UART2_APPS_CLK>, <&gcc GCC_BLSP1_AHB_CLK>; - clock-names =3D "core", "iface"; - status =3D "disabled"; - }; - - blsp2_uart1: serial@f995d000 { - compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; - reg =3D <0xf995d000 0x1000>; - interrupts =3D ; - clocks =3D <&gcc GCC_BLSP2_UART1_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>; - clock-names =3D "core", "iface"; - status =3D "disabled"; - }; - - blsp2_uart2: serial@f995e000 { - compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; - reg =3D <0xf995e000 0x1000>; - interrupts =3D ; - clocks =3D <&gcc GCC_BLSP2_UART2_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>; - clock-names =3D "core", "iface"; - status =3D "disabled"; - }; - - blsp2_uart4: serial@f9960000 { - compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; - reg =3D <0xf9960000 0x1000>; - interrupts =3D ; - clocks =3D <&gcc GCC_BLSP2_UART4_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>; - clock-names =3D "core", "iface"; - status =3D "disabled"; - }; - sdhc_1: sdhci@f9824900 { compatible =3D "qcom,msm8974-sdhci", "qcom,sdhci-msm-v4"; reg =3D <0xf9824900 0x11c>, <0xf9824000 0x800>; @@ -758,182 +484,25 @@ sdhc_2: sdhci@f98a4900 { clock-names =3D "core", "iface", "xo"; bus-width =3D <4>; =20 - status =3D "disabled"; - }; - - otg: usb@f9a55000 { - compatible =3D "qcom,ci-hdrc"; - reg =3D <0xf9a55000 0x200>, - <0xf9a55200 0x200>; - interrupts =3D ; - clocks =3D <&gcc GCC_USB_HS_AHB_CLK>, - <&gcc GCC_USB_HS_SYSTEM_CLK>; - clock-names =3D "iface", "core"; - assigned-clocks =3D <&gcc GCC_USB_HS_SYSTEM_CLK>; - assigned-clock-rates =3D <75000000>; - resets =3D <&gcc GCC_USB_HS_BCR>; - reset-names =3D "core"; - phy_type =3D "ulpi"; - dr_mode =3D "otg"; - ahb-burst-config =3D <0>; - phy-names =3D "usb-phy"; - status =3D "disabled"; - #reset-cells =3D <1>; - - ulpi { - usb_hs1_phy: phy@a { - compatible =3D "qcom,usb-hs-phy-msm8974", - "qcom,usb-hs-phy"; - #phy-cells =3D <0>; - clocks =3D <&xo_board>, <&gcc GCC_USB2A_PHY_SLEEP_CLK>; - clock-names =3D "ref", "sleep"; - resets =3D <&gcc GCC_USB2A_PHY_BCR>, <&otg 0>; - reset-names =3D "phy", "por"; - status =3D "disabled"; - }; - - usb_hs2_phy: phy@b { - compatible =3D "qcom,usb-hs-phy-msm8974", - "qcom,usb-hs-phy"; - #phy-cells =3D <0>; - clocks =3D <&xo_board>, <&gcc GCC_USB2B_PHY_SLEEP_CLK>; - clock-names =3D "ref", "sleep"; - resets =3D <&gcc GCC_USB2B_PHY_BCR>, <&otg 1>; - reset-names =3D "phy", "por"; - status =3D "disabled"; - }; - }; - }; - - rng@f9bff000 { - compatible =3D "qcom,prng"; - reg =3D <0xf9bff000 0x200>; - clocks =3D <&gcc GCC_PRNG_AHB_CLK>; - clock-names =3D "core"; - }; - - remoteproc_mss: remoteproc@fc880000 { - compatible =3D "qcom,msm8974-mss-pil"; - reg =3D <0xfc880000 0x100>, <0xfc820000 0x020>; - reg-names =3D "qdsp6", "rmb"; - - interrupts-extended =3D <&intc GIC_SPI 24 IRQ_TYPE_EDGE_RISING>, - <&modem_smp2p_in 0 IRQ_TYPE_EDGE_RISING>, - <&modem_smp2p_in 1 IRQ_TYPE_EDGE_RISING>, - <&modem_smp2p_in 2 IRQ_TYPE_EDGE_RISING>, - <&modem_smp2p_in 3 IRQ_TYPE_EDGE_RISING>; - interrupt-names =3D "wdog", "fatal", "ready", "handover", "stop-ack"; - - clocks =3D <&gcc GCC_MSS_Q6_BIMC_AXI_CLK>, - <&gcc GCC_MSS_CFG_AHB_CLK>, - <&gcc GCC_BOOT_ROM_AHB_CLK>, - <&xo_board>; - clock-names =3D "iface", "bus", "mem", "xo"; - - resets =3D <&gcc GCC_MSS_RESTART>; - reset-names =3D "mss_restart"; - - cx-supply =3D <&pm8841_s2>; - mss-supply =3D <&pm8841_s3>; - mx-supply =3D <&pm8841_s1>; - pll-supply =3D <&pm8941_l12>; - - qcom,halt-regs =3D <&tcsr_mutex_block 0x1180 0x1200 0x1280>; - - qcom,smem-states =3D <&modem_smp2p_out 0>; - qcom,smem-state-names =3D "stop"; - - mba { - memory-region =3D <&mba_region>; - }; - - mpss { - memory-region =3D <&mpss_region>; - }; - - smd-edge { - interrupts =3D ; - - qcom,ipc =3D <&apcs 8 12>; - qcom,smd-edge =3D <0>; - - label =3D "modem"; - }; - }; - - pronto: remoteproc@fb21b000 { - compatible =3D "qcom,pronto-v2-pil", "qcom,pronto"; - reg =3D <0xfb204000 0x2000>, <0xfb202000 0x1000>, <0xfb21b000 0x3000>; - reg-names =3D "ccu", "dxe", "pmu"; - - memory-region =3D <&wcnss_region>; - - interrupts-extended =3D <&intc GIC_SPI 149 IRQ_TYPE_EDGE_RISING>, - <&wcnss_smp2p_in 0 IRQ_TYPE_EDGE_RISING>, - <&wcnss_smp2p_in 1 IRQ_TYPE_EDGE_RISING>, - <&wcnss_smp2p_in 2 IRQ_TYPE_EDGE_RISING>, - <&wcnss_smp2p_in 3 IRQ_TYPE_EDGE_RISING>; - interrupt-names =3D "wdog", "fatal", "ready", "handover", "stop-ack"; - - vddpx-supply =3D <&pm8941_s3>; - - qcom,smem-states =3D <&wcnss_smp2p_out 0>; - qcom,smem-state-names =3D "stop"; - - status =3D "disabled"; - - iris { - compatible =3D "qcom,wcn3680"; - - clocks =3D <&rpmcc RPM_SMD_CXO_A2>; - clock-names =3D "xo"; - - vddxo-supply =3D <&pm8941_l6>; - vddrfa-supply =3D <&pm8941_l11>; - vddpa-supply =3D <&pm8941_l19>; - vdddig-supply =3D <&pm8941_s3>; - }; - - smd-edge { - interrupts =3D ; - - qcom,ipc =3D <&apcs 8 17>; - qcom,smd-edge =3D <6>; - - wcnss { - compatible =3D "qcom,wcnss"; - qcom,smd-channels =3D "WCNSS_CTRL"; - status =3D "disabled"; - - qcom,mmio =3D <&pronto>; - - bt { - compatible =3D "qcom,wcnss-bt"; - }; - - wifi { - compatible =3D "qcom,wcnss-wlan"; - - interrupts =3D , - ; - interrupt-names =3D "tx", "rx"; + status =3D "disabled"; + }; =20 - qcom,smem-states =3D <&apps_smsm 10>, <&apps_smsm 9>; - qcom,smem-state-names =3D "tx-enable", "tx-rings-empty"; - }; - }; - }; + blsp1_uart1: serial@f991d000 { + compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; + reg =3D <0xf991d000 0x1000>; + interrupts =3D ; + clocks =3D <&gcc GCC_BLSP1_UART1_APPS_CLK>, <&gcc GCC_BLSP1_AHB_CLK>; + clock-names =3D "core", "iface"; + status =3D "disabled"; }; =20 - tlmm: pinctrl@fd510000 { - compatible =3D "qcom,msm8974-pinctrl"; - reg =3D <0xfd510000 0x4000>; - gpio-controller; - gpio-ranges =3D <&tlmm 0 0 146>; - #gpio-cells =3D <2>; - interrupt-controller; - #interrupt-cells =3D <2>; - interrupts =3D ; + blsp1_uart2: serial@f991e000 { + compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; + reg =3D <0xf991e000 0x1000>; + interrupts =3D ; + clocks =3D <&gcc GCC_BLSP1_UART2_APPS_CLK>, <&gcc GCC_BLSP1_AHB_CLK>; + clock-names =3D "core", "iface"; + status =3D "disabled"; }; =20 blsp1_i2c1: i2c@f9923000 { @@ -980,6 +549,43 @@ blsp1_i2c6: i2c@f9928000 { #size-cells =3D <0>; }; =20 + blsp2_dma: dma-controller@f9944000 { + compatible =3D "qcom,bam-v1.4.0"; + reg =3D <0xf9944000 0x19000>; + interrupts =3D ; + clocks =3D <&gcc GCC_BLSP2_AHB_CLK>; + clock-names =3D "bam_clk"; + #dma-cells =3D <1>; + qcom,ee =3D <0>; + }; + + blsp2_uart1: serial@f995d000 { + compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; + reg =3D <0xf995d000 0x1000>; + interrupts =3D ; + clocks =3D <&gcc GCC_BLSP2_UART1_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>; + clock-names =3D "core", "iface"; + status =3D "disabled"; + }; + + blsp2_uart2: serial@f995e000 { + compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; + reg =3D <0xf995e000 0x1000>; + interrupts =3D ; + clocks =3D <&gcc GCC_BLSP2_UART2_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>; + clock-names =3D "core", "iface"; + status =3D "disabled"; + }; + + blsp2_uart4: serial@f9960000 { + compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; + reg =3D <0xf9960000 0x1000>; + interrupts =3D ; + clocks =3D <&gcc GCC_BLSP2_UART4_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>; + clock-names =3D "core", "iface"; + status =3D "disabled"; + }; + blsp2_i2c2: i2c@f9964000 { status =3D "disabled"; compatible =3D "qcom,i2c-qup-v2.1.1"; @@ -1015,93 +621,110 @@ blsp2_i2c6: i2c@f9968000 { #size-cells =3D <0>; }; =20 - spmi_bus: spmi@fc4cf000 { - compatible =3D "qcom,spmi-pmic-arb"; - reg-names =3D "core", "intr", "cnfg"; - reg =3D <0xfc4cf000 0x1000>, - <0xfc4cb000 0x1000>, - <0xfc4ca000 0x1000>; - interrupt-names =3D "periph_irq"; - interrupts =3D ; - qcom,ee =3D <0>; - qcom,channel =3D <0>; - #address-cells =3D <2>; - #size-cells =3D <0>; - interrupt-controller; - #interrupt-cells =3D <4>; + otg: usb@f9a55000 { + compatible =3D "qcom,ci-hdrc"; + reg =3D <0xf9a55000 0x200>, + <0xf9a55200 0x200>; + interrupts =3D ; + clocks =3D <&gcc GCC_USB_HS_AHB_CLK>, + <&gcc GCC_USB_HS_SYSTEM_CLK>; + clock-names =3D "iface", "core"; + assigned-clocks =3D <&gcc GCC_USB_HS_SYSTEM_CLK>; + assigned-clock-rates =3D <75000000>; + resets =3D <&gcc GCC_USB_HS_BCR>; + reset-names =3D "core"; + phy_type =3D "ulpi"; + dr_mode =3D "otg"; + ahb-burst-config =3D <0>; + phy-names =3D "usb-phy"; + status =3D "disabled"; + #reset-cells =3D <1>; + + ulpi { + usb_hs1_phy: phy@a { + compatible =3D "qcom,usb-hs-phy-msm8974", + "qcom,usb-hs-phy"; + #phy-cells =3D <0>; + clocks =3D <&xo_board>, <&gcc GCC_USB2A_PHY_SLEEP_CLK>; + clock-names =3D "ref", "sleep"; + resets =3D <&gcc GCC_USB2A_PHY_BCR>, <&otg 0>; + reset-names =3D "phy", "por"; + status =3D "disabled"; + }; + + usb_hs2_phy: phy@b { + compatible =3D "qcom,usb-hs-phy-msm8974", + "qcom,usb-hs-phy"; + #phy-cells =3D <0>; + clocks =3D <&xo_board>, <&gcc GCC_USB2B_PHY_SLEEP_CLK>; + clock-names =3D "ref", "sleep"; + resets =3D <&gcc GCC_USB2B_PHY_BCR>, <&otg 1>; + reset-names =3D "phy", "por"; + status =3D "disabled"; + }; + }; }; =20 - blsp2_dma: dma-controller@f9944000 { - compatible =3D "qcom,bam-v1.4.0"; - reg =3D <0xf9944000 0x19000>; - interrupts =3D ; - clocks =3D <&gcc GCC_BLSP2_AHB_CLK>; - clock-names =3D "bam_clk"; - #dma-cells =3D <1>; - qcom,ee =3D <0>; + rng@f9bff000 { + compatible =3D "qcom,prng"; + reg =3D <0xf9bff000 0x200>; + clocks =3D <&gcc GCC_PRNG_AHB_CLK>; + clock-names =3D "core"; }; =20 - etr@fc322000 { - compatible =3D "arm,coresight-tmc", "arm,primecell"; - reg =3D <0xfc322000 0x1000>; + pronto: remoteproc@fb21b000 { + compatible =3D "qcom,pronto-v2-pil", "qcom,pronto"; + reg =3D <0xfb204000 0x2000>, <0xfb202000 0x1000>, <0xfb21b000 0x3000>; + reg-names =3D "ccu", "dxe", "pmu"; =20 - clocks =3D <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; - clock-names =3D "apb_pclk", "atclk"; + memory-region =3D <&wcnss_region>; =20 - in-ports { - port { - etr_in: endpoint { - remote-endpoint =3D <&replicator_out0>; - }; - }; - }; - }; + interrupts-extended =3D <&intc GIC_SPI 149 IRQ_TYPE_EDGE_RISING>, + <&wcnss_smp2p_in 0 IRQ_TYPE_EDGE_RISING>, + <&wcnss_smp2p_in 1 IRQ_TYPE_EDGE_RISING>, + <&wcnss_smp2p_in 2 IRQ_TYPE_EDGE_RISING>, + <&wcnss_smp2p_in 3 IRQ_TYPE_EDGE_RISING>; + interrupt-names =3D "wdog", "fatal", "ready", "handover", "stop-ack"; =20 - tpiu@fc318000 { - compatible =3D "arm,coresight-tpiu", "arm,primecell"; - reg =3D <0xfc318000 0x1000>; + qcom,smem-states =3D <&wcnss_smp2p_out 0>; + qcom,smem-state-names =3D "stop"; =20 - clocks =3D <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; - clock-names =3D "apb_pclk", "atclk"; + status =3D "disabled"; =20 - in-ports { - port { - tpiu_in: endpoint { - remote-endpoint =3D <&replicator_out1>; - }; - }; + iris { + compatible =3D "qcom,wcn3680"; + + clocks =3D <&rpmcc RPM_SMD_CXO_A2>; + clock-names =3D "xo"; }; - }; =20 - replicator@fc31c000 { - compatible =3D "arm,coresight-dynamic-replicator", "arm,primecell"; - reg =3D <0xfc31c000 0x1000>; + smd-edge { + interrupts =3D ; =20 - clocks =3D <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; - clock-names =3D "apb_pclk", "atclk"; + qcom,ipc =3D <&apcs 8 17>; + qcom,smd-edge =3D <6>; =20 - out-ports { - #address-cells =3D <1>; - #size-cells =3D <0>; + wcnss { + compatible =3D "qcom,wcnss"; + qcom,smd-channels =3D "WCNSS_CTRL"; + status =3D "disabled"; =20 - port@0 { - reg =3D <0>; - replicator_out0: endpoint { - remote-endpoint =3D <&etr_in>; - }; - }; - port@1 { - reg =3D <1>; - replicator_out1: endpoint { - remote-endpoint =3D <&tpiu_in>; + qcom,mmio =3D <&pronto>; + + bt { + compatible =3D "qcom,wcnss-bt"; }; - }; - }; =20 - in-ports { - port { - replicator_in: endpoint { - remote-endpoint =3D <&etf_out>; + wifi { + compatible =3D "qcom,wcnss-wlan"; + + interrupts =3D , + ; + interrupt-names =3D "tx", "rx"; + + qcom,smem-states =3D <&apps_smsm 10>, <&apps_smsm 9>; + qcom,smem-state-names =3D "tx-enable", + "tx-rings-empty"; }; }; }; @@ -1131,37 +754,19 @@ etf_in: endpoint { }; }; =20 - funnel@fc31b000 { - compatible =3D "arm,coresight-dynamic-funnel", "arm,primecell"; - reg =3D <0xfc31b000 0x1000>; + tpiu@fc318000 { + compatible =3D "arm,coresight-tpiu", "arm,primecell"; + reg =3D <0xfc318000 0x1000>; =20 clocks =3D <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; clock-names =3D "apb_pclk", "atclk"; =20 in-ports { - #address-cells =3D <1>; - #size-cells =3D <0>; - - /* - * Not described input ports: - * 0 - connected trought funnel to Audio, Modem and - * Resource and Power Manager CPU's - * 2...7 - not-connected - */ - port@1 { - reg =3D <1>; - merger_in1: endpoint { - remote-endpoint =3D <&funnel1_out>; - }; - }; - }; - - out-ports { port { - merger_out: endpoint { - remote-endpoint =3D <&etf_in>; + tpiu_in: endpoint { + remote-endpoint =3D <&replicator_out1>; }; - }; + }; }; }; =20 @@ -1203,9 +808,9 @@ funnel1_out: endpoint { }; }; =20 - funnel@fc345000 { /* KPSS funnel only 4 inputs are used */ + funnel@fc31b000 { compatible =3D "arm,coresight-dynamic-funnel", "arm,primecell"; - reg =3D <0xfc345000 0x1000>; + reg =3D <0xfc31b000 0x1000>; =20 clocks =3D <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; clock-names =3D "apb_pclk", "atclk"; @@ -1214,36 +819,74 @@ in-ports { #address-cells =3D <1>; #size-cells =3D <0>; =20 + /* + * Not described input ports: + * 0 - connected trought funnel to Audio, Modem and + * Resource and Power Manager CPU's + * 2...7 - not-connected + */ + port@1 { + reg =3D <1>; + merger_in1: endpoint { + remote-endpoint =3D <&funnel1_out>; + }; + }; + }; + + out-ports { + port { + merger_out: endpoint { + remote-endpoint =3D <&etf_in>; + }; + }; + }; + }; + + replicator@fc31c000 { + compatible =3D "arm,coresight-dynamic-replicator", "arm,primecell"; + reg =3D <0xfc31c000 0x1000>; + + clocks =3D <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names =3D "apb_pclk", "atclk"; + + out-ports { + #address-cells =3D <1>; + #size-cells =3D <0>; + port@0 { reg =3D <0>; - kpss_in0: endpoint { - remote-endpoint =3D <&etm0_out>; + replicator_out0: endpoint { + remote-endpoint =3D <&etr_in>; }; }; port@1 { reg =3D <1>; - kpss_in1: endpoint { - remote-endpoint =3D <&etm1_out>; - }; - }; - port@2 { - reg =3D <2>; - kpss_in2: endpoint { - remote-endpoint =3D <&etm2_out>; + replicator_out1: endpoint { + remote-endpoint =3D <&tpiu_in>; }; }; - port@3 { - reg =3D <3>; - kpss_in3: endpoint { - remote-endpoint =3D <&etm3_out>; + }; + + in-ports { + port { + replicator_in: endpoint { + remote-endpoint =3D <&etf_out>; }; }; }; + }; =20 - out-ports { + etr@fc322000 { + compatible =3D "arm,coresight-tmc", "arm,primecell"; + reg =3D <0xfc322000 0x1000>; + + clocks =3D <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names =3D "apb_pclk", "atclk"; + + in-ports { port { - kpss_out: endpoint { - remote-endpoint =3D <&funnel1_in5>; + etr_in: endpoint { + remote-endpoint =3D <&replicator_out0>; }; }; }; @@ -1321,25 +964,66 @@ etm3_out: endpoint { }; }; =20 - ocmem@fdd00000 { - compatible =3D "qcom,msm8974-ocmem"; - reg =3D <0xfdd00000 0x2000>, - <0xfec00000 0x180000>; - reg-names =3D "ctrl", - "mem"; - clocks =3D <&rpmcc RPM_SMD_OCMEMGX_CLK>, - <&mmcc OCMEMCX_OCMEMNOC_CLK>; - clock-names =3D "core", - "iface"; + /* KPSS funnel, only 4 inputs are used */ + funnel@fc345000 { + compatible =3D "arm,coresight-dynamic-funnel", "arm,primecell"; + reg =3D <0xfc345000 0x1000>; =20 - #address-cells =3D <1>; - #size-cells =3D <1>; + clocks =3D <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names =3D "apb_pclk", "atclk"; =20 - gmu_sram: gmu-sram@0 { - reg =3D <0x0 0x100000>; + in-ports { + #address-cells =3D <1>; + #size-cells =3D <0>; + + port@0 { + reg =3D <0>; + kpss_in0: endpoint { + remote-endpoint =3D <&etm0_out>; + }; + }; + port@1 { + reg =3D <1>; + kpss_in1: endpoint { + remote-endpoint =3D <&etm1_out>; + }; + }; + port@2 { + reg =3D <2>; + kpss_in2: endpoint { + remote-endpoint =3D <&etm2_out>; + }; + }; + port@3 { + reg =3D <3>; + kpss_in3: endpoint { + remote-endpoint =3D <&etm3_out>; + }; + }; + }; + + out-ports { + port { + kpss_out: endpoint { + remote-endpoint =3D <&funnel1_in5>; + }; + }; }; }; =20 + gcc: clock-controller@fc400000 { + compatible =3D "qcom,gcc-msm8974"; + #clock-cells =3D <1>; + #reset-cells =3D <1>; + #power-domain-cells =3D <1>; + reg =3D <0xfc400000 0x4000>; + }; + + rpm_msg_ram: memory@fc428000 { + compatible =3D "qcom,rpm-msg-ram"; + reg =3D <0xfc428000 0x4000>; + }; + bimc: interconnect@fc380000 { reg =3D <0xfc380000 0x6a000>; compatible =3D "qcom,msm8974-bimc"; @@ -1394,47 +1078,123 @@ cnoc: interconnect@fc480000 { <&rpmcc RPM_SMD_CNOC_A_CLK>; }; =20 - gpu: adreno@fdb00000 { - status =3D "disabled"; + tsens: thermal-sensor@fc4a9000 { + compatible =3D "qcom,msm8974-tsens"; + reg =3D <0xfc4a9000 0x1000>, /* TM */ + <0xfc4a8000 0x1000>; /* SROT */ + nvmem-cells =3D <&tsens_calib>, <&tsens_backup>; + nvmem-cell-names =3D "calib", "calib_backup"; + #qcom,sensors =3D <11>; + interrupts =3D ; + interrupt-names =3D "uplow"; + #thermal-sensor-cells =3D <1>; + }; =20 - compatible =3D "qcom,adreno-330.1", - "qcom,adreno"; - reg =3D <0xfdb00000 0x10000>; - reg-names =3D "kgsl_3d0_reg_memory"; - interrupts =3D ; - interrupt-names =3D "kgsl_3d0_irq"; - clock-names =3D "core", - "iface", - "mem_iface"; - clocks =3D <&mmcc OXILI_GFX3D_CLK>, - <&mmcc OXILICX_AHB_CLK>, - <&mmcc OXILICX_AXI_CLK>; - sram =3D <&gmu_sram>; - power-domains =3D <&mmcc OXILICX_GDSC>; - operating-points-v2 =3D <&gpu_opp_table>; + restart@fc4ab000 { + compatible =3D "qcom,pshold"; + reg =3D <0xfc4ab000 0x4>; + }; =20 - interconnects =3D <&mmssnoc MNOC_MAS_GRAPHICS_3D &bimc BIMC_SLV_EBI_CH0= >, - <&ocmemnoc OCMEM_VNOC_MAS_GFX3D &ocmemnoc OCMEM_SLV_OCMEM>; - interconnect-names =3D "gfx-mem", - "ocmem"; + qfprom: qfprom@fc4bc000 { + #address-cells =3D <1>; + #size-cells =3D <1>; + compatible =3D "qcom,qfprom"; + reg =3D <0xfc4bc000 0x1000>; + tsens_calib: calib@d0 { + reg =3D <0xd0 0x18>; + }; + tsens_backup: backup@440 { + reg =3D <0x440 0x10>; + }; + }; =20 - // iommus =3D <&gpu_iommu 0>; + spmi_bus: spmi@fc4cf000 { + compatible =3D "qcom,spmi-pmic-arb"; + reg-names =3D "core", "intr", "cnfg"; + reg =3D <0xfc4cf000 0x1000>, + <0xfc4cb000 0x1000>, + <0xfc4ca000 0x1000>; + interrupt-names =3D "periph_irq"; + interrupts =3D ; + qcom,ee =3D <0>; + qcom,channel =3D <0>; + #address-cells =3D <2>; + #size-cells =3D <0>; + interrupt-controller; + #interrupt-cells =3D <4>; + }; =20 - gpu_opp_table: opp_table { - compatible =3D "operating-points-v2"; + remoteproc_mss: remoteproc@fc880000 { + compatible =3D "qcom,msm8974-mss-pil"; + reg =3D <0xfc880000 0x100>, <0xfc820000 0x020>; + reg-names =3D "qdsp6", "rmb"; =20 - opp-320000000 { - opp-hz =3D /bits/ 64 <320000000>; - }; + interrupts-extended =3D <&intc GIC_SPI 24 IRQ_TYPE_EDGE_RISING>, + <&modem_smp2p_in 0 IRQ_TYPE_EDGE_RISING>, + <&modem_smp2p_in 1 IRQ_TYPE_EDGE_RISING>, + <&modem_smp2p_in 2 IRQ_TYPE_EDGE_RISING>, + <&modem_smp2p_in 3 IRQ_TYPE_EDGE_RISING>; + interrupt-names =3D "wdog", "fatal", "ready", "handover", "stop-ack"; =20 - opp-200000000 { - opp-hz =3D /bits/ 64 <200000000>; - }; + clocks =3D <&gcc GCC_MSS_Q6_BIMC_AXI_CLK>, + <&gcc GCC_MSS_CFG_AHB_CLK>, + <&gcc GCC_BOOT_ROM_AHB_CLK>, + <&xo_board>; + clock-names =3D "iface", "bus", "mem", "xo"; + + resets =3D <&gcc GCC_MSS_RESTART>; + reset-names =3D "mss_restart"; + + qcom,halt-regs =3D <&tcsr_mutex_block 0x1180 0x1200 0x1280>; + + qcom,smem-states =3D <&modem_smp2p_out 0>; + qcom,smem-state-names =3D "stop"; + + mba { + memory-region =3D <&mba_region>; + }; + + mpss { + memory-region =3D <&mpss_region>; + }; + + smd-edge { + interrupts =3D ; + + qcom,ipc =3D <&apcs 8 12>; + qcom,smd-edge =3D <0>; + + label =3D "modem"; + }; + }; + + tcsr_mutex_block: syscon@fd484000 { + compatible =3D "syscon"; + reg =3D <0xfd484000 0x2000>; + }; + + tcsr: syscon@fd4a0000 { + compatible =3D "syscon"; + reg =3D <0xfd4a0000 0x10000>; + }; + + tlmm: pinctrl@fd510000 { + compatible =3D "qcom,msm8974-pinctrl"; + reg =3D <0xfd510000 0x4000>; + gpio-controller; + gpio-ranges =3D <&tlmm 0 0 146>; + #gpio-cells =3D <2>; + interrupt-controller; + #interrupt-cells =3D <2>; + interrupts =3D ; + }; =20 - opp-27000000 { - opp-hz =3D /bits/ 64 <27000000>; - }; - }; + mmcc: clock-controller@fd8c0000 { + compatible =3D "qcom,mmcc-msm8974"; + #clock-cells =3D <1>; + #reset-cells =3D <1>; + #power-domain-cells =3D <1>; + reg =3D <0xfd8c0000 0x6000>; }; =20 mdss: mdss@fd900000 { @@ -1562,6 +1322,65 @@ dsi0_phy: dsi-phy@fd922a00 { }; }; =20 + gpu: adreno@fdb00000 { + compatible =3D "qcom,adreno-330.1", "qcom,adreno"; + reg =3D <0xfdb00000 0x10000>; + reg-names =3D "kgsl_3d0_reg_memory"; + + interrupts =3D ; + interrupt-names =3D "kgsl_3d0_irq"; + + clocks =3D <&mmcc OXILI_GFX3D_CLK>, + <&mmcc OXILICX_AHB_CLK>, + <&mmcc OXILICX_AXI_CLK>; + clock-names =3D "core", "iface", "mem_iface"; + + sram =3D <&gmu_sram>; + power-domains =3D <&mmcc OXILICX_GDSC>; + operating-points-v2 =3D <&gpu_opp_table>; + + interconnects =3D <&mmssnoc MNOC_MAS_GRAPHICS_3D &bimc BIMC_SLV_EBI_CH0= >, + <&ocmemnoc OCMEM_VNOC_MAS_GFX3D &ocmemnoc OCMEM_SLV_OCMEM>; + interconnect-names =3D "gfx-mem", "ocmem"; + + // iommus =3D <&gpu_iommu 0>; + + status =3D "disabled"; + + gpu_opp_table: opp_table { + compatible =3D "operating-points-v2"; + + opp-320000000 { + opp-hz =3D /bits/ 64 <320000000>; + }; + + opp-200000000 { + opp-hz =3D /bits/ 64 <200000000>; + }; + + opp-27000000 { + opp-hz =3D /bits/ 64 <27000000>; + }; + }; + }; + + ocmem@fdd00000 { + compatible =3D "qcom,msm8974-ocmem"; + reg =3D <0xfdd00000 0x2000>, + <0xfec00000 0x180000>; + reg-names =3D "ctrl", "mem"; + clocks =3D <&rpmcc RPM_SMD_OCMEMGX_CLK>, + <&mmcc OCMEMCX_OCMEMNOC_CLK>; + clock-names =3D "core", "iface"; + + #address-cells =3D <1>; + #size-cells =3D <1>; + + gmu_sram: gmu-sram@0 { + reg =3D <0x0 0x100000>; + }; + }; + remoteproc_adsp: remoteproc@fe200000 { compatible =3D "qcom,msm8974-adsp-pil"; reg =3D <0xfe200000 0x100>; @@ -1604,76 +1423,194 @@ reboot-mode { }; }; =20 - smd { - compatible =3D "qcom,smd"; + tcsr_mutex: tcsr-mutex { + compatible =3D "qcom,tcsr-mutex"; + syscon =3D <&tcsr_mutex_block 0 0x80>; =20 - rpm { - interrupts =3D ; - qcom,ipc =3D <&apcs 8 0>; - qcom,smd-edge =3D <15>; + #hwlock-cells =3D <1>; + }; =20 - rpm_requests: rpm-requests { - compatible =3D "qcom,rpm-msm8974"; - qcom,smd-channels =3D "rpm_requests"; + thermal-zones { + cpu0-thermal { + polling-delay-passive =3D <250>; + polling-delay =3D <1000>; =20 - rpmcc: clock-controller { - compatible =3D "qcom,rpmcc-msm8974", "qcom,rpmcc"; - #clock-cells =3D <1>; + thermal-sensors =3D <&tsens 5>; + + trips { + cpu_alert0: trip0 { + temperature =3D <75000>; + hysteresis =3D <2000>; + type =3D "passive"; + }; + cpu_crit0: trip1 { + temperature =3D <110000>; + hysteresis =3D <2000>; + type =3D "critical"; + }; + }; + }; + + cpu1-thermal { + polling-delay-passive =3D <250>; + polling-delay =3D <1000>; + + thermal-sensors =3D <&tsens 6>; + + trips { + cpu_alert1: trip0 { + temperature =3D <75000>; + hysteresis =3D <2000>; + type =3D "passive"; + }; + cpu_crit1: trip1 { + temperature =3D <110000>; + hysteresis =3D <2000>; + type =3D "critical"; + }; + }; + }; + + cpu2-thermal { + polling-delay-passive =3D <250>; + polling-delay =3D <1000>; + + thermal-sensors =3D <&tsens 7>; + + trips { + cpu_alert2: trip0 { + temperature =3D <75000>; + hysteresis =3D <2000>; + type =3D "passive"; + }; + cpu_crit2: trip1 { + temperature =3D <110000>; + hysteresis =3D <2000>; + type =3D "critical"; + }; + }; + }; + + cpu3-thermal { + polling-delay-passive =3D <250>; + polling-delay =3D <1000>; + + thermal-sensors =3D <&tsens 8>; + + trips { + cpu_alert3: trip0 { + temperature =3D <75000>; + hysteresis =3D <2000>; + type =3D "passive"; + }; + cpu_crit3: trip1 { + temperature =3D <110000>; + hysteresis =3D <2000>; + type =3D "critical"; + }; + }; + }; + + q6-dsp-thermal { + polling-delay-passive =3D <250>; + polling-delay =3D <1000>; + + thermal-sensors =3D <&tsens 1>; + + trips { + q6_dsp_alert0: trip-point0 { + temperature =3D <90000>; + hysteresis =3D <2000>; + type =3D "hot"; + }; + }; + }; + + modemtx-thermal { + polling-delay-passive =3D <250>; + polling-delay =3D <1000>; + + thermal-sensors =3D <&tsens 2>; + + trips { + modemtx_alert0: trip-point0 { + temperature =3D <90000>; + hysteresis =3D <2000>; + type =3D "hot"; + }; + }; + }; + + video-thermal { + polling-delay-passive =3D <250>; + polling-delay =3D <1000>; + + thermal-sensors =3D <&tsens 3>; + + trips { + video_alert0: trip-point0 { + temperature =3D <95000>; + hysteresis =3D <2000>; + type =3D "hot"; + }; + }; + }; + + wlan-thermal { + polling-delay-passive =3D <250>; + polling-delay =3D <1000>; + + thermal-sensors =3D <&tsens 4>; + + trips { + wlan_alert0: trip-point0 { + temperature =3D <105000>; + hysteresis =3D <2000>; + type =3D "hot"; }; + }; + }; + + gpu-top-thermal { + polling-delay-passive =3D <250>; + polling-delay =3D <1000>; + + thermal-sensors =3D <&tsens 9>; =20 - pm8841-regulators { - compatible =3D "qcom,rpm-pm8841-regulators"; - - pm8841_s1: s1 {}; - pm8841_s2: s2 {}; - pm8841_s3: s3 {}; - pm8841_s4: s4 {}; - pm8841_s5: s5 {}; - pm8841_s6: s6 {}; - pm8841_s7: s7 {}; - pm8841_s8: s8 {}; + trips { + gpu1_alert0: trip-point0 { + temperature =3D <90000>; + hysteresis =3D <2000>; + type =3D "hot"; }; + }; + }; + + gpu-bottom-thermal { + polling-delay-passive =3D <250>; + polling-delay =3D <1000>; + + thermal-sensors =3D <&tsens 10>; =20 - pm8941-regulators { - compatible =3D "qcom,rpm-pm8941-regulators"; - - pm8941_s1: s1 {}; - pm8941_s2: s2 {}; - pm8941_s3: s3 {}; - - pm8941_l1: l1 {}; - pm8941_l2: l2 {}; - pm8941_l3: l3 {}; - pm8941_l4: l4 {}; - pm8941_l5: l5 {}; - pm8941_l6: l6 {}; - pm8941_l7: l7 {}; - pm8941_l8: l8 {}; - pm8941_l9: l9 {}; - pm8941_l10: l10 {}; - pm8941_l11: l11 {}; - pm8941_l12: l12 {}; - pm8941_l13: l13 {}; - pm8941_l14: l14 {}; - pm8941_l15: l15 {}; - pm8941_l16: l16 {}; - pm8941_l17: l17 {}; - pm8941_l18: l18 {}; - pm8941_l19: l19 {}; - pm8941_l20: l20 {}; - pm8941_l21: l21 {}; - pm8941_l22: l22 {}; - pm8941_l23: l23 {}; - pm8941_l24: l24 {}; - - pm8941_lvs1: lvs1 {}; - pm8941_lvs2: lvs2 {}; - pm8941_lvs3: lvs3 {}; + trips { + gpu2_alert0: trip-point0 { + temperature =3D <90000>; + hysteresis =3D <2000>; + type =3D "hot"; }; }; }; }; =20 + timer { + compatible =3D "arm,armv7-timer"; + interrupts =3D , + , + , + ; + clock-frequency =3D <19200000>; + }; + vreg_boost: vreg-boost { compatible =3D "regulator-fixed"; =20 @@ -1690,6 +1627,7 @@ vreg_boost: vreg-boost { pinctrl-names =3D "default"; pinctrl-0 =3D <&boost_bypass_n_pin>; }; + vreg_vph_pwr: vreg-vph-pwr { compatible =3D "regulator-fixed"; regulator-name =3D "vph-pwr"; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5509C25B08 for ; Mon, 15 Aug 2022 20:39:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244933AbiHOUjW (ORCPT ); Mon, 15 Aug 2022 16:39:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346007AbiHOUei (ORCPT ); Mon, 15 Aug 2022 16:34:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCF994D16B; Mon, 15 Aug 2022 12:06:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 755F2B81104; Mon, 15 Aug 2022 19:06:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5D37C433D6; Mon, 15 Aug 2022 19:06:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590374; bh=eYdIiq6i7+oz5kC9QwEqKLyINkLBLeu8q8JqoqMwYYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ukW9UwdhDLduxJyF34lC/+cNsy/6OSCliNuOAgmzK4bxEsfxvPM3KBJOiSiSbaBPH wRIddZuURn8ICYRGIEdSjdqs6GFKqCUmYKVMkvAbAB/o4tzWsgJCWjFKa76MQ5cedS 7K1QcrLp2Hw9mtM7wCU0zfCyt0ezY4lZrYa6lDPM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luca Weiss , Krzysztof Kozlowski , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0240/1095] ARM: dts: qcom-msm8974: fix irq type on blsp2_uart1 Date: Mon, 15 Aug 2022 19:53:59 +0200 Message-Id: <20220815180439.717676342@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luca Weiss [ Upstream commit ab1489017aa7a9f02e24bee73cf9ec8079cd3909 ] IRQ_TYPE_NONE is invalid, so use the correct interrupt type. Signed-off-by: Luca Weiss Fixes: b05f82b152c9 ("ARM: dts: qcom: msm8974: Add blsp2_uart7 for bluetoot= h on sirius") Reviewed-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220522083618.17894-1-luca@z3ntu.xyz Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-msm8974.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-m= sm8974.dtsi index 0091a4c29fff..ed3e46e7f96d 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -562,7 +562,7 @@ blsp2_dma: dma-controller@f9944000 { blsp2_uart1: serial@f995d000 { compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; reg =3D <0xf995d000 0x1000>; - interrupts =3D ; + interrupts =3D ; clocks =3D <&gcc GCC_BLSP2_UART1_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>; clock-names =3D "core", "iface"; status =3D "disabled"; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E261CC00140 for ; Mon, 15 Aug 2022 20:39:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345533AbiHOUjj (ORCPT ); Mon, 15 Aug 2022 16:39:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346029AbiHOUej (ORCPT ); Mon, 15 Aug 2022 16:34:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07FE74D803; Mon, 15 Aug 2022 12:06:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 943DE61299; Mon, 15 Aug 2022 19:06:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0BDDC433C1; Mon, 15 Aug 2022 19:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590378; bh=f1QHJkEWBxe0y7ULk3wzJybIZKZvXufJ0WmRnppxYtk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AkBMkvzmyZRCgRsybAnR6VBa73mZ0dXecyUeELJEPrZjWutpvrfZRq4wyPthHMR2s FshSrVJ/QMyFA5rFpuNEKnQhbaey+BGpAM7RyQl2myx6s518UH9lbg/acjTJRqoqfH 5a6eRDkjPndc/Mi9xJ3G1/MYvBDZgOAOsDXypF28= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jing Leng , Masahiro Yamada , Sasha Levin Subject: [PATCH 5.18 0241/1095] kbuild: Fix include path in scripts/Makefile.modpost Date: Mon, 15 Aug 2022 19:54:00 +0200 Message-Id: <20220815180439.757015907@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jing Leng [ Upstream commit 23a0cb8e3225122496bfa79172005c587c2d64bf ] When building an external module, if users don't need to separate the compilation output and source code, they run the following command: "make -C $(LINUX_SRC_DIR) M=3D$(PWD)". At this point, "$(KBUILD_EXTMOD)" and "$(src)" are the same. If they need to separate them, they run "make -C $(KERNEL_SRC_DIR) O=3D$(KERNEL_OUT_DIR) M=3D$(OUT_DIR) src=3D$(PWD)". Before running the command, they need to copy "Kbuild" or "Makefile" to "$(OUT_DIR)" to prevent compilation failure. So the kernel should change the included path to avoid the copy operation. Signed-off-by: Jing Leng [masahiro: I do not think "M=3D$(OUT_DIR) src=3D$(PWD)" is the official way, but this patch is a nice clean up anyway.] Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- scripts/Makefile.modpost | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 48585c4d04ad..0273bf7375e2 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -87,8 +87,7 @@ obj :=3D $(KBUILD_EXTMOD) src :=3D $(obj) =20 # Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS -include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \ - $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile) +include $(if $(wildcard $(src)/Kbuild), $(src)/Kbuild, $(src)/Makefile) =20 # modpost option for external modules MODPOST +=3D -e --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3181CC00140 for ; Mon, 15 Aug 2022 20:39:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345651AbiHOUjq (ORCPT ); Mon, 15 Aug 2022 16:39:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345380AbiHOUfE (ORCPT ); Mon, 15 Aug 2022 16:35:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8134ABD5F; Mon, 15 Aug 2022 12:06:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 62476B81062; Mon, 15 Aug 2022 19:06:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4B20C433D6; Mon, 15 Aug 2022 19:06:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590381; bh=lroM00tmODnDQFpUqqoc3y+4ybOKRk44pC+oLOaX9v4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1l9b9tKZ5nOtY46Sv0rXvm0cMHWDvH7vkV43zVKDoFRj9nV3hxTe02LVbAV4+VjGV cp+YZ5ABBZotjod9HzEKEYsBTDZ2N/pb3FmZqUd75n/WOCOibRMY4VnscnM7NsyrY1 3PSzXg7j8PxGxcsESz9aBA+Y7wuNS25HBMaDebWo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Vorwerk , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.18 0242/1095] iio: core: fix a few code style issues Date: Mon, 15 Aug 2022 19:54:01 +0200 Message-Id: <20220815180439.791950834@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Vorwerk [ Upstream commit f4decb4c6e374a4ded59a6a76b8236695e44d8bc ] * Fix indent in else statement * Remove unnecessary 'else' after 'break' * Remove space in '* attr' Signed-off-by: Alexander Vorwerk Link: https://lore.kernel.org/r/20220312180343.8935-1-alexander.vorwerk@stu= d.uni-goettingen.de Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/industrialio-buffer.c | 4 ++-- drivers/iio/industrialio-core.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-b= uffer.c index b078eb2f3c9d..01369973329a 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -915,7 +915,7 @@ static int iio_verify_update(struct iio_dev *indio_dev, if (scan_mask =3D=3D NULL) return -EINVAL; } else { - scan_mask =3D compound_mask; + scan_mask =3D compound_mask; } =20 config->scan_bytes =3D iio_compute_scan_bytes(indio_dev, @@ -1649,7 +1649,7 @@ static int __iio_buffer_alloc_sysfs_and_mask(struct i= io_buffer *buffer, } =20 attrn =3D buffer_attrcount + scan_el_attrcount + ARRAY_SIZE(iio_buffer_at= trs); - attr =3D kcalloc(attrn + 1, sizeof(* attr), GFP_KERNEL); + attr =3D kcalloc(attrn + 1, sizeof(*attr), GFP_KERNEL); if (!attr) { ret =3D -ENOMEM; goto error_free_scan_mask; diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-cor= e.c index 58d1180f4f61..b2d2b42614d3 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -908,8 +908,7 @@ static int __iio_str_to_fixpoint(const char *str, int f= ract_mult, } else if (*str =3D=3D '\n') { if (*(str + 1) =3D=3D '\0') break; - else - return -EINVAL; + return -EINVAL; } else if (!strncmp(str, " dB", sizeof(" dB") - 1) && scale_db) { /* Ignore the dB suffix */ str +=3D sizeof(" dB") - 1; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7123C2BB43 for ; Mon, 15 Aug 2022 20:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346536AbiHOUlk (ORCPT ); Mon, 15 Aug 2022 16:41:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345149AbiHOUfT (ORCPT ); Mon, 15 Aug 2022 16:35:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBFE3371A9; Mon, 15 Aug 2022 12:06:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 91CBCB81104; Mon, 15 Aug 2022 19:06:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC26DC433C1; Mon, 15 Aug 2022 19:06:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590384; bh=CBgb56HFKBmdWIWJ/wiKMtuMrogElOROawwgv/vqOZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yWJbzjvrDSJcqTgOPu/wmgfy2ksplL9vrknXwdakFAHj8hL/Yl/GHBs2UBGxcIHW7 OxJybGhwsLchzn9cxLoVCtqn6r2xmFT11nGqS1jzDuV9VuzXGo3kOLOgV6/a8SIyBT kYPrXAVIhZtdnTs+c4quu0M830kxvx/7lDrXU21k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 0243/1095] ia64: fix typos in comments Date: Mon, 15 Aug 2022 19:54:02 +0200 Message-Id: <20220815180439.831224468@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Julia Lawall [ Upstream commit 0af96a024f524a5318485cbada73ab7d874895d4 ] Various spelling mistakes in comments. Detected with the help of Coccinelle. Link: https://lkml.kernel.org/r/20220318103729.157574-1-Julia.Lawall@inria.= fr Signed-off-by: Julia Lawall Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/ia64/kernel/palinfo.c | 2 +- arch/ia64/kernel/traps.c | 2 +- arch/ia64/mm/init.c | 2 +- arch/ia64/mm/tlb.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c index 64189f04c1a4..b9ae093bfe37 100644 --- a/arch/ia64/kernel/palinfo.c +++ b/arch/ia64/kernel/palinfo.c @@ -120,7 +120,7 @@ static const char *mem_attrib[]=3D{ * Input: * - a pointer to a buffer to hold the string * - a 64-bit vector - * Ouput: + * Output: * - a pointer to the end of the buffer * */ diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c index 753642366e12..53735b1d1be3 100644 --- a/arch/ia64/kernel/traps.c +++ b/arch/ia64/kernel/traps.c @@ -309,7 +309,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, uns= igned long isr) /* * Lower 4 bits are used as a count. Upper bits are a sequence * number that is updated when count is reset. The cmpxchg will - * fail is seqno has changed. This minimizes mutiple cpus + * fail is seqno has changed. This minimizes multiple cpus * resetting the count. */ if (current_jiffies > last.time) diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c index 5d165607bf35..7ae1244ed8ec 100644 --- a/arch/ia64/mm/init.c +++ b/arch/ia64/mm/init.c @@ -451,7 +451,7 @@ mem_init (void) memblock_free_all(); =20 /* - * For fsyscall entrpoints with no light-weight handler, use the ordinary + * For fsyscall entrypoints with no light-weight handler, use the ordinary * (heavy-weight) handler, but mark it by setting bit 0, so the fsyscall = entry * code can tell them apart. */ diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c index 135b5135cace..ca060e7a2a46 100644 --- a/arch/ia64/mm/tlb.c +++ b/arch/ia64/mm/tlb.c @@ -174,7 +174,7 @@ __setup("nptcg=3D", set_nptcg); * override table (in which case we should ignore the value from * PAL_VM_SUMMARY). * - * Kernel parameter "nptcg=3D" overrides maximum number of simultanesous p= tc.g + * Kernel parameter "nptcg=3D" overrides maximum number of simultaneous pt= c.g * purges defined in either PAL_VM_SUMMARY or PAL override table. In this = case, * we should ignore the value from either PAL_VM_SUMMARY or PAL override t= able. * @@ -516,7 +516,7 @@ int ia64_itr_entry(u64 target_mask, u64 va, u64 pte, u6= 4 log_size) if (i >=3D per_cpu(ia64_tr_num, cpu)) return -EBUSY; =20 - /*Record tr info for mca hander use!*/ + /*Record tr info for mca handler use!*/ if (i > per_cpu(ia64_tr_used, cpu)) per_cpu(ia64_tr_used, cpu) =3D i; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7320C2BB45 for ; Mon, 15 Aug 2022 20:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346493AbiHOUlf (ORCPT ); Mon, 15 Aug 2022 16:41:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345694AbiHOUfW (ORCPT ); Mon, 15 Aug 2022 16:35:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A4D84E632; Mon, 15 Aug 2022 12:06:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EB76B61019; Mon, 15 Aug 2022 19:06:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8276C433D6; Mon, 15 Aug 2022 19:06:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590387; bh=j55TNd95ho6ZbsHNHDPW0cph+TjLYNpouX6nY95nTmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0oVKIhpISZ0Gevu9AhBtkFwWAQIKOwihP/4gRr7Y9Q7kpSKqcikNNuP+GnTRLrsOb QptKy+Pp2qVzSN8FdFJyHgBeAKlbXHjPxGYTyNACLuupMTYXA6WvM46/0F0lN4GjLY jOxjMGCyHKEm2I7hDlm0Wagg1cl5nXFvIl525vmY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Brian Masney , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0244/1095] soc: qcom: ocmem: Fix refcount leak in of_get_ocmem Date: Mon, 15 Aug 2022 19:54:03 +0200 Message-Id: <20220815180439.880980484@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 92a563fcf14b3093226fb36f12e9b5cf630c5a5d ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. of_node_put() will check NULL pointer. Fixes: 88c1e9404f1d ("soc: qcom: add OCMEM driver") Signed-off-by: Miaoqian Lin Reviewed-by: Brian Masney Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220602042430.1114-1-linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/soc/qcom/ocmem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/soc/qcom/ocmem.c b/drivers/soc/qcom/ocmem.c index 97fd24c178f8..c92d26b73e6f 100644 --- a/drivers/soc/qcom/ocmem.c +++ b/drivers/soc/qcom/ocmem.c @@ -194,14 +194,17 @@ struct ocmem *of_get_ocmem(struct device *dev) devnode =3D of_parse_phandle(dev->of_node, "sram", 0); if (!devnode || !devnode->parent) { dev_err(dev, "Cannot look up sram phandle\n"); + of_node_put(devnode); return ERR_PTR(-ENODEV); } =20 pdev =3D of_find_device_by_node(devnode->parent); if (!pdev) { dev_err(dev, "Cannot find device node %s\n", devnode->name); + of_node_put(devnode); return ERR_PTR(-EPROBE_DEFER); } + of_node_put(devnode); =20 ocmem =3D platform_get_drvdata(pdev); if (!ocmem) { --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2285C00140 for ; Mon, 15 Aug 2022 20:43:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345929AbiHOUkm (ORCPT ); Mon, 15 Aug 2022 16:40:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345000AbiHOUfY (ORCPT ); Mon, 15 Aug 2022 16:35:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69AF52AE39; Mon, 15 Aug 2022 12:06:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0865261281; Mon, 15 Aug 2022 19:06:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A715C433D6; Mon, 15 Aug 2022 19:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590390; bh=T8AMqL1bI2nByzhLxcyPhAwx+e3draOCLCZ86QLTzuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n78bBB+13YmSCJc/oii4UF4Fi9lwYLpsG4q8ro2RdLZjwuSsuQpm8efkpK7nj7BdX NF41+A11qlTjxT8MXOH01200lIaJgSsvV+idfkn70t4hKOnk/OeSzb9lKvhL6b4G27 ftRH2g3nqf+a4BwTO3XgxF0KWan0u1HqX8ajrbHE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0245/1095] soc: qcom: aoss: Fix refcount leak in qmp_cooling_devices_register Date: Mon, 15 Aug 2022 19:54:04 +0200 Message-Id: <20220815180439.925219341@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit e6e0951414a314e7db3e9e24fd924b3e15515288 ] Every iteration of for_each_available_child_of_node() decrements the reference count of the previous node. When breaking early from a for_each_available_child_of_node() loop, we need to explicitly call of_node_put() on the child node. Add missing of_node_put() to avoid refcount leak. Fixes: 05589b30b21a ("soc: qcom: Extend AOSS QMP driver to support resource= s that are used to wake up the SoC.") Signed-off-by: Miaoqian Lin Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220606064252.42595-1-linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/soc/qcom/qcom_aoss.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c index a59bb34e5eba..18c856056475 100644 --- a/drivers/soc/qcom/qcom_aoss.c +++ b/drivers/soc/qcom/qcom_aoss.c @@ -399,8 +399,10 @@ static int qmp_cooling_devices_register(struct qmp *qm= p) continue; ret =3D qmp_cooling_device_add(qmp, &qmp->cooling_devs[count++], child); - if (ret) + if (ret) { + of_node_put(child); goto unroll; + } } =20 if (!count) --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9258C00140 for ; Mon, 15 Aug 2022 20:40:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345538AbiHOUkc (ORCPT ); Mon, 15 Aug 2022 16:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346079AbiHOUf0 (ORCPT ); Mon, 15 Aug 2022 16:35:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFF9A2AE31; Mon, 15 Aug 2022 12:06:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4D4DE612A0; Mon, 15 Aug 2022 19:06:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38F3DC433C1; Mon, 15 Aug 2022 19:06:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590393; bh=TsPnHu1UXHbWPwLLScYxhp6RvVMszap/m+Uy0kSwgTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K+HapOe/A1lvyk6jI/WjIwvytW8Hs48K4gkNxfHTESWqG0gLJG0CErp0C8bkNy77Q kCw0BjQVPu63Iasm7fgyc3ZQZSO/LMmAfQsrxSJVS4sxeSY3x2MZ97zWH1uQ4as+Dg eA+oMMEMh/bomWsl4SeQX+wbVGaWCnLpdwt4pQkI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Luca Weiss , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0246/1095] ARM: dts: qcom: msm8974: add required ranges to OCMEM Date: Mon, 15 Aug 2022 19:54:05 +0200 Message-Id: <20220815180439.968387380@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit 7a16ea7f3a5ec0f30b146b058c273b7a9c8ceadf ] The OCMEM bindings require ranges property. Fixes: a2cc991ed634 ("ARM: dts: qcom: msm8974: add ocmem node") Signed-off-by: Krzysztof Kozlowski Reviewed-by: Luca Weiss Tested-by: Luca Weiss Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220607171848.535128-7-krzysztof.kozlowski= @linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-msm8974.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-m= sm8974.dtsi index ed3e46e7f96d..7a25d313e4fb 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -1369,6 +1369,7 @@ ocmem@fdd00000 { reg =3D <0xfdd00000 0x2000>, <0xfec00000 0x180000>; reg-names =3D "ctrl", "mem"; + ranges =3D <0 0xfec00000 0x180000>; clocks =3D <&rpmcc RPM_SMD_OCMEMGX_CLK>, <&mmcc OCMEMCX_OCMEMNOC_CLK>; clock-names =3D "core", "iface"; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67E38C28B2B for ; Mon, 15 Aug 2022 20:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346289AbiHOUlW (ORCPT ); Mon, 15 Aug 2022 16:41:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346090AbiHOUff (ORCPT ); Mon, 15 Aug 2022 16:35:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47A8C2AE32; Mon, 15 Aug 2022 12:06:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 060FBB810A2; Mon, 15 Aug 2022 19:06:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A0D6C433D6; Mon, 15 Aug 2022 19:06:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590396; bh=gpfEd0DEpMYvC47OF/ZHghExQA0IRRvZ33c8l3jT4wo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0DLfnNgfEMcSvV2vsSKwBuGllhwmQE0L+w0c6R+5duDPHxOqJADAaTrVq627mywe4 MTeGAO67dFRrwGyVGmXt9pYvaDYW2GKMVS9vBAqjCySW5O16Uv6o0s16LveczQXPFy OkUa9vi+bq2Psoj/gZOGI/ARifb8xl8URc/CaoVs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0247/1095] ARM: dts: qcom: pm8841: add required thermal-sensor-cells Date: Mon, 15 Aug 2022 19:54:06 +0200 Message-Id: <20220815180440.004564354@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit e2759fa0676c9a32bbddb9aff955b54bb35066ad ] The PM8841 temperature sensor has to define thermal-sensor-cells. Fixes: dab8134ca072 ("ARM: dts: qcom: Add PM8841 functions device nodes") Signed-off-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220608112702.80873-2-krzysztof.kozlowski@= linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-pm8841.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/qcom-pm8841.dtsi b/arch/arm/boot/dts/qcom-pm= 8841.dtsi index 2caf71eacb52..b5cdde034d18 100644 --- a/arch/arm/boot/dts/qcom-pm8841.dtsi +++ b/arch/arm/boot/dts/qcom-pm8841.dtsi @@ -24,6 +24,7 @@ temp-alarm@2400 { compatible =3D "qcom,spmi-temp-alarm"; reg =3D <0x2400>; interrupts =3D <4 0x24 0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells =3D <0>; }; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 891E3C2BB41 for ; Mon, 15 Aug 2022 20:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346362AbiHOUl0 (ORCPT ); Mon, 15 Aug 2022 16:41:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346098AbiHOUff (ORCPT ); Mon, 15 Aug 2022 16:35:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E47DE2AE3A; Mon, 15 Aug 2022 12:06:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 822E661019; Mon, 15 Aug 2022 19:06:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F1A4C433D6; Mon, 15 Aug 2022 19:06:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590402; bh=mxljtDHMst5iwqEorc0AT/oDFsf1xLqdqqSlxIcDaPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zmks4f3fQmOMKXXz5MFXoAmKtXVIFKpn4cQhrs8ygKeZQMY2RGEOZnmN1rbveBpIX x9AavJWf7uR091NJcTiNh1uWdClO2ZJuMtOzp2NcFb0vo694FNBzCs32PVFKPq/qu+ WsWJBfEp15gE3Cnjcyh/8G26GZyQPjYcKX1U4hnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Yang Yingliang , John Garry , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 0248/1095] bus: hisi_lpc: fix missing platform_device_put() in hisi_lpc_acpi_probe() Date: Mon, 15 Aug 2022 19:54:07 +0200 Message-Id: <20220815180440.034340010@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit 54872fea6a5ac967ec2272aea525d1438ac6735a ] In error case in hisi_lpc_acpi_probe() after calling platform_device_add(), hisi_lpc_acpi_remove() can't release the failed 'pdev', so it will be leak, call platform_device_put() to fix this problem. I'v constructed this error case and tested this patch on D05 board. Fixes: 99c0228d6ff1 ("HISI LPC: Re-Add ACPI child enumeration support") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Acked-by: John Garry Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/bus/hisi_lpc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c index 378f5d62a991..e7eaa8784fee 100644 --- a/drivers/bus/hisi_lpc.c +++ b/drivers/bus/hisi_lpc.c @@ -503,13 +503,13 @@ static int hisi_lpc_acpi_probe(struct device *hostdev) { struct acpi_device *adev =3D ACPI_COMPANION(hostdev); struct acpi_device *child; + struct platform_device *pdev; int ret; =20 /* Only consider the children of the host */ list_for_each_entry(child, &adev->children, node) { const char *hid =3D acpi_device_hid(child); const struct hisi_lpc_acpi_cell *cell; - struct platform_device *pdev; const struct resource *res; bool found =3D false; int num_res; @@ -571,22 +571,24 @@ static int hisi_lpc_acpi_probe(struct device *hostdev) =20 ret =3D platform_device_add_resources(pdev, res, num_res); if (ret) - goto fail; + goto fail_put_device; =20 ret =3D platform_device_add_data(pdev, cell->pdata, cell->pdata_size); if (ret) - goto fail; + goto fail_put_device; =20 ret =3D platform_device_add(pdev); if (ret) - goto fail; + goto fail_put_device; =20 acpi_device_set_enumerated(child); } =20 return 0; =20 +fail_put_device: + platform_device_put(pdev); fail: hisi_lpc_acpi_remove(hostdev); return ret; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97CB8C28B2C for ; Mon, 15 Aug 2022 20:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346449AbiHOUla (ORCPT ); Mon, 15 Aug 2022 16:41:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346149AbiHOUfn (ORCPT ); Mon, 15 Aug 2022 16:35:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 918BC2CE18; Mon, 15 Aug 2022 12:06:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 46C37B8107A; Mon, 15 Aug 2022 19:06:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A964C433C1; Mon, 15 Aug 2022 19:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590406; bh=NXZMVp/XCIifham+N8UhWhA8PlWuq+NgCw/dNZwr9+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cuFHOgvFoxmUlHRjVEfACosbqiDBERuKWTaXJsUw0HIDXi+MrGH3ZfV2zN2jzUuVC ruARYvY+czoutyAmGecLF6RFKhaEHHVOfEjO9cSRRpSejDnRHPjq5EOaQy8S0uWVbw 64R1JxSo2oDzsDBlDz+41gtfsCYxULbD5mn3AHsQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Rasmus Villemoes , Nick Desaulniers , Vitor Massaru Iha , "Gustavo A. R. Silva" , Daniel Latypov , Kees Cook , Sasha Levin Subject: [PATCH 5.18 0249/1095] lib: overflow: Do not define 64-bit tests on 32-bit Date: Mon, 15 Aug 2022 19:54:08 +0200 Message-Id: <20220815180440.063954007@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kees Cook [ Upstream commit 6a022dd29f2cefbac4895a34e2e1f14b2d12d819 ] The 64-bit overflow tests will trigger 64-bit division on 32-bit hosts, which is not currently used anywhere in the kernel, and tickles bugs in at least Clang 13 and earlier: https://github.com/ClangBuiltLinux/linux/issues/1636 In reality, there shouldn't be a reason to not build the 64-bit test cases on 32-bit systems, so these #ifdefs can be removed once the minimum Clang version reaches 13. In the meantime, silence W=3D1 warnings given by the current code: ../lib/overflow_kunit.c:191:19: warning: 's64_tests' defined but not used [= -Wunused-const-variable=3D] 191 | DEFINE_TEST_ARRAY(s64) =3D { | ^~~ ../lib/overflow_kunit.c:24:11: note: in definition of macro 'DEFINE_TEST_AR= RAY' 24 | } t ## _tests[] | ^ ../lib/overflow_kunit.c:94:19: warning: 'u64_tests' defined but not used [-= Wunused-const-variable=3D] 94 | DEFINE_TEST_ARRAY(u64) =3D { | ^~~ ../lib/overflow_kunit.c:24:11: note: in definition of macro 'DEFINE_TEST_AR= RAY' 24 | } t ## _tests[] | ^ Reported-by: kernel test robot Link: https://lore.kernel.org/lkml/202205110324.7GrtxG8u-lkp@intel.com Fixes: 455a35a6cdb6 ("lib: add runtime test of check_*_overflow functions") Cc: Rasmus Villemoes Cc: Nick Desaulniers Cc: Vitor Massaru Iha Cc: "Gustavo A. R. Silva" Tested-by: Daniel Latypov Link: https://lore.kernel.org/lkml/CAGS_qxokQAjQRip2vPi80toW7hmBnXf=3DKMTNT= 51B1wuDqSZuVQ@mail.gmail.com Signed-off-by: Kees Cook Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- lib/overflow_kunit.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/overflow_kunit.c b/lib/overflow_kunit.c index 475f0c064bf6..7e3e43679b73 100644 --- a/lib/overflow_kunit.c +++ b/lib/overflow_kunit.c @@ -91,6 +91,7 @@ DEFINE_TEST_ARRAY(u32) =3D { {-4U, 5U, 1U, -9U, -20U, true, false, true}, }; =20 +#if BITS_PER_LONG =3D=3D 64 DEFINE_TEST_ARRAY(u64) =3D { {0, 0, 0, 0, 0, false, false, false}, {1, 1, 2, 0, 1, false, false, false}, @@ -114,6 +115,7 @@ DEFINE_TEST_ARRAY(u64) =3D { false, true, false}, {-15ULL, 10ULL, -5ULL, -25ULL, -150ULL, false, false, true}, }; +#endif =20 DEFINE_TEST_ARRAY(s8) =3D { {0, 0, 0, 0, 0, false, false, false}, @@ -188,6 +190,8 @@ DEFINE_TEST_ARRAY(s32) =3D { {S32_MIN, S32_MIN, 0, 0, 0, true, false, true}, {S32_MAX, S32_MAX, -2, 0, 1, true, false, true}, }; + +#if BITS_PER_LONG =3D=3D 64 DEFINE_TEST_ARRAY(s64) =3D { {0, 0, 0, 0, 0, false, false, false}, =20 @@ -216,6 +220,7 @@ DEFINE_TEST_ARRAY(s64) =3D { {-128, -1, -129, -127, 128, false, false, false}, {0, -S64_MAX, -S64_MAX, S64_MAX, 0, false, false, false}, }; +#endif =20 #define check_one_op(t, fmt, op, sym, a, b, r, of) do { \ t _r; \ @@ -650,6 +655,7 @@ static struct kunit_case overflow_test_cases[] =3D { KUNIT_CASE(s16_overflow_test), KUNIT_CASE(u32_overflow_test), KUNIT_CASE(s32_overflow_test), +/* Clang 13 and earlier generate unwanted libcalls on 32-bit. */ #if BITS_PER_LONG =3D=3D 64 KUNIT_CASE(u64_overflow_test), KUNIT_CASE(s64_overflow_test), --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E57B2C2BB9D for ; Mon, 15 Aug 2022 20:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346581AbiHOUls (ORCPT ); Mon, 15 Aug 2022 16:41:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346260AbiHOUf6 (ORCPT ); Mon, 15 Aug 2022 16:35:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C6E92CDFB; Mon, 15 Aug 2022 12:06:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 53279B81062; Mon, 15 Aug 2022 19:06:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAC3AC433C1; Mon, 15 Aug 2022 19:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590409; bh=qvJ6CSHoffT99ctcnfN/FArQviAOFzwCtP0KVNA+j7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N7oagBSN/PpNyd9afCF2YHOJPIL4W7J6AwnOnQ1woFUDeD6E6ginSPHbPN5AlRolU qkOSPER4ElD1EEEXhkUBPTFgZ9tjc2BJNl1/gPJaWjTioK9BdyS7omMrZLm+aCqXiB Q8ohkhH20ea1xKxARmtJ7GwzDbbQ99QS4YcPbO24= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Xiu Jianfeng , "GONG, Ruiqi" , Kees Cook , Sasha Levin , GONG@vger.kernel.org Subject: [PATCH 5.18 0250/1095] stack: Declare {randomize_,}kstack_offset to fix Sparse warnings Date: Mon, 15 Aug 2022 19:54:09 +0200 Message-Id: <20220815180440.093887422@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: GONG, Ruiqi [ Upstream commit 375561bd6195a31bf4c109732bd538cb97a941f4 ] Fix the following Sparse warnings that got noticed when the PPC-dev patchwork was checking another patch (see the link below): init/main.c:862:1: warning: symbol 'randomize_kstack_offset' was not declar= ed. Should it be static? init/main.c:864:1: warning: symbol 'kstack_offset' was not declared. Should= it be static? Which in fact are triggered on all architectures that have HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET support (for instances x86, arm64 etc). Link: https://lore.kernel.org/lkml/e7b0d68b-914d-7283-827c-101988923929@hua= wei.com/T/#m49b2d4490121445ce4bf7653500aba59eefcb67f Cc: Christophe Leroy Cc: Xiu Jianfeng Signed-off-by: GONG, Ruiqi Reviewed-by: Christophe Leroy Fixes: 39218ff4c625 ("stack: Optionally randomize kernel stack offset each = syscall") Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220629060423.2515693-1-gongruiqi1@huawei.= com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- init/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/init/main.c b/init/main.c index 80bd217dd35e..1e866b31bf19 100644 --- a/init/main.c +++ b/init/main.c @@ -99,6 +99,7 @@ #include #include #include +#include #include =20 #include --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 084E0C2BB47 for ; Mon, 15 Aug 2022 20:43:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346675AbiHOUlx (ORCPT ); Mon, 15 Aug 2022 16:41:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346687AbiHOUgb (ORCPT ); Mon, 15 Aug 2022 16:36:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C4F94E843; Mon, 15 Aug 2022 12:06:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5BB1CB810A2; Mon, 15 Aug 2022 19:06:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BFF3C433C1; Mon, 15 Aug 2022 19:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590412; bh=lyE0Uoi4jt5cS3p9ntPQyP0WH2gJ35GJtynLlM09Ihs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cf0JdUihryG0f5wKx6B/Vqm1vx918XsgVjBtk1pPhBg4tMOBOlHEA4HtedDa8RLYp iV4dMfxJkbjXDmmk2TTyi0FS2S1MO4yRLMDf1npnjyO2tkbXSdGjyz7ClmmG40FlND E7DztCp5TB5XdLWXz2c10/II0/BupBhCz27FpNPI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sireesh Kodali , Krzysztof Kozlowski , Stephan Gerhold , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0251/1095] arm64: dts: qcom: msm8916: Fix typo in pronto remoteproc node Date: Mon, 15 Aug 2022 19:54:10 +0200 Message-Id: <20220815180440.142752756@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sireesh Kodali [ Upstream commit 5458d6f2827cd30218570f266b8d238417461f2f ] The smem-state properties for the pronto node were incorrectly labelled, reading `qcom,state*` rather than `qcom,smem-state*`. Fix that, allowing the stop state to be used. Fixes: 88106096cbf8 ("ARM: dts: msm8916: Add and enable wcnss node") Signed-off-by: Sireesh Kodali Reviewed-by: Krzysztof Kozlowski Reviewed-by: Stephan Gerhold Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220526141740.15834-3-sireeshkodali1@gmail= .com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/msm8916.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qc= om/msm8916.dtsi index e34963505e07..7ecd747dc624 100644 --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -1758,8 +1758,8 @@ pronto: remoteproc@a21b000 { <&rpmpd MSM8916_VDDMX>; power-domain-names =3D "cx", "mx"; =20 - qcom,state =3D <&wcnss_smp2p_out 0>; - qcom,state-names =3D "stop"; + qcom,smem-states =3D <&wcnss_smp2p_out 0>; + qcom,smem-state-names =3D "stop"; =20 pinctrl-names =3D "default"; pinctrl-0 =3D <&wcnss_pin_a>; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27AF4C32757 for ; Mon, 15 Aug 2022 20:43:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346741AbiHOUl6 (ORCPT ); Mon, 15 Aug 2022 16:41:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346778AbiHOUgi (ORCPT ); Mon, 15 Aug 2022 16:36:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BBC34E852; Mon, 15 Aug 2022 12:06:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 97A4661299; Mon, 15 Aug 2022 19:06:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D143C433C1; Mon, 15 Aug 2022 19:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590415; bh=yC+VSmPMf/FABXJ3eAcT1Ky9QRksUqiRrbWGIp/BIj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KXtkYuywnegnru14cY69oHtccKtHMJ5ovnt8p+VHtV2d6Oc7LO2d+n0FIek7Li0p9 m2HqRq7enr0lBIQmLSVvQ7WPuYaY8PeokJotKUlguYrSXHBAJ+GnJZs0ir3QW0URix IM/8WUyAyD5xnLmFqgq48a0FQD2PVM8YJ6vVU1vY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephane Eranian , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.18 0252/1095] perf/core: Add perf_clear_branch_entry_bitfields() helper Date: Mon, 15 Aug 2022 19:54:11 +0200 Message-Id: <20220815180440.172989977@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephane Eranian [ Upstream commit bfe4daf850f45d92dcd3da477f0b0456620294c3 ] Make it simpler to reset all the info fields on the perf_branch_entry by adding a helper inline function. The goal is to centralize the initialization to avoid missing a field in case more are added. Signed-off-by: Stephane Eranian Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20220322221517.2510440-2-eranian@google.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/events/intel/lbr.c | 36 +++++++++++++++++------------------- include/linux/perf_event.h | 16 ++++++++++++++++ 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c index 1f156098a5bf..4f70fb6c2c1e 100644 --- a/arch/x86/events/intel/lbr.c +++ b/arch/x86/events/intel/lbr.c @@ -769,6 +769,7 @@ void intel_pmu_lbr_disable_all(void) void intel_pmu_lbr_read_32(struct cpu_hw_events *cpuc) { unsigned long mask =3D x86_pmu.lbr_nr - 1; + struct perf_branch_entry *br =3D cpuc->lbr_entries; u64 tos =3D intel_pmu_lbr_tos(); int i; =20 @@ -784,15 +785,11 @@ void intel_pmu_lbr_read_32(struct cpu_hw_events *cpuc) =20 rdmsrl(x86_pmu.lbr_from + lbr_idx, msr_lastbranch.lbr); =20 - cpuc->lbr_entries[i].from =3D msr_lastbranch.from; - cpuc->lbr_entries[i].to =3D msr_lastbranch.to; - cpuc->lbr_entries[i].mispred =3D 0; - cpuc->lbr_entries[i].predicted =3D 0; - cpuc->lbr_entries[i].in_tx =3D 0; - cpuc->lbr_entries[i].abort =3D 0; - cpuc->lbr_entries[i].cycles =3D 0; - cpuc->lbr_entries[i].type =3D 0; - cpuc->lbr_entries[i].reserved =3D 0; + perf_clear_branch_entry_bitfields(br); + + br->from =3D msr_lastbranch.from; + br->to =3D msr_lastbranch.to; + br++; } cpuc->lbr_stack.nr =3D i; cpuc->lbr_stack.hw_idx =3D tos; @@ -807,6 +804,7 @@ void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc) { bool need_info =3D false, call_stack =3D false; unsigned long mask =3D x86_pmu.lbr_nr - 1; + struct perf_branch_entry *br =3D cpuc->lbr_entries; u64 tos =3D intel_pmu_lbr_tos(); int i; int out =3D 0; @@ -878,15 +876,14 @@ void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc) if (abort && x86_pmu.lbr_double_abort && out > 0) out--; =20 - cpuc->lbr_entries[out].from =3D from; - cpuc->lbr_entries[out].to =3D to; - cpuc->lbr_entries[out].mispred =3D mis; - cpuc->lbr_entries[out].predicted =3D pred; - cpuc->lbr_entries[out].in_tx =3D in_tx; - cpuc->lbr_entries[out].abort =3D abort; - cpuc->lbr_entries[out].cycles =3D cycles; - cpuc->lbr_entries[out].type =3D 0; - cpuc->lbr_entries[out].reserved =3D 0; + perf_clear_branch_entry_bitfields(br+out); + br[out].from =3D from; + br[out].to =3D to; + br[out].mispred =3D mis; + br[out].predicted =3D pred; + br[out].in_tx =3D in_tx; + br[out].abort =3D abort; + br[out].cycles =3D cycles; out++; } cpuc->lbr_stack.nr =3D out; @@ -951,6 +948,8 @@ static void intel_pmu_store_lbr(struct cpu_hw_events *c= puc, to =3D rdlbr_to(i, lbr); info =3D rdlbr_info(i, lbr); =20 + perf_clear_branch_entry_bitfields(e); + e->from =3D from; e->to =3D to; e->mispred =3D get_lbr_mispred(info); @@ -959,7 +958,6 @@ static void intel_pmu_store_lbr(struct cpu_hw_events *c= puc, e->abort =3D !!(info & LBR_INFO_ABORT); e->cycles =3D get_lbr_cycles(info); e->type =3D get_lbr_br_type(info); - e->reserved =3D 0; } =20 cpuc->lbr_stack.nr =3D i; diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index af97dd427501..a411080d5169 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1063,6 +1063,22 @@ static inline void perf_sample_data_init(struct perf= _sample_data *data, data->txn =3D 0; } =20 +/* + * Clear all bitfields in the perf_branch_entry. + * The to and from fields are not cleared because they are + * systematically modified by caller. + */ +static inline void perf_clear_branch_entry_bitfields(struct perf_branch_en= try *br) +{ + br->mispred =3D 0; + br->predicted =3D 0; + br->in_tx =3D 0; + br->abort =3D 0; + br->cycles =3D 0; + br->type =3D 0; + br->reserved =3D 0; +} + extern void perf_output_sample(struct perf_output_handle *handle, struct perf_event_header *header, struct perf_sample_data *data, --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36C58C2BBC5 for ; Mon, 15 Aug 2022 20:43:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346817AbiHOUmE (ORCPT ); Mon, 15 Aug 2022 16:42:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345187AbiHOUhH (ORCPT ); Mon, 15 Aug 2022 16:37:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2375BABF12; Mon, 15 Aug 2022 12:07:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 43314B81062; Mon, 15 Aug 2022 19:06:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96231C433D6; Mon, 15 Aug 2022 19:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590418; bh=4u9rt+QdDkILcLD1KYvH6bN5uEpsuSs4RqAANrQI8zM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m7eAMUjg5Goi/srgmpbrriyx7zf8GRcifBibL1xwp/RBcHJU68XlokQOQ3yBE5DZ0 OhPD8kcp5dLR2i9cZQxEGMkfomO3yPdoBY3FfFLwp6YvUSyCNQNuFck40/DUDZOrTM oSUMhpuwzLeMyLx51arUZpbJxUKRf71Hc9+ON9HY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chanho Park , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.18 0253/1095] arm64: dts: exynosautov9: correct spi11 pin names Date: Mon, 15 Aug 2022 19:54:12 +0200 Message-Id: <20220815180440.211407251@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chanho Park [ Upstream commit ba205449828f47f80532a1453beef5eed2982176 ] They should be started with "gpp5-". Fixes: 31bbac5263aa ("arm64: dts: exynos: add initial support for exynosaut= ov9 SoC") Signed-off-by: Chanho Park Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220627005832.8709-1-chanho61.park@samsung= .com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/exynos/exynosautov9-pinctrl.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/boot/dts/exynos/exynosautov9-pinctrl.dtsi b/arch/ar= m64/boot/dts/exynos/exynosautov9-pinctrl.dtsi index ef0349d1c3d0..68f4a0fae7cf 100644 --- a/arch/arm64/boot/dts/exynos/exynosautov9-pinctrl.dtsi +++ b/arch/arm64/boot/dts/exynos/exynosautov9-pinctrl.dtsi @@ -1089,21 +1089,21 @@ spi10_cs_func: spi10-cs-func-pins { =20 /* PERIC1 USI11_SPI */ spi11_bus: spi11-pins { - samsung,pins =3D "gpp3-6", "gpp3-5", "gpp3-4"; + samsung,pins =3D "gpp5-6", "gpp5-5", "gpp5-4"; samsung,pin-function =3D ; samsung,pin-pud =3D ; samsung,pin-drv =3D ; }; =20 spi11_cs: spi11-cs-pins { - samsung,pins =3D "gpp3-7"; + samsung,pins =3D "gpp5-7"; samsung,pin-function =3D ; samsung,pin-pud =3D ; samsung,pin-drv =3D ; }; =20 spi11_cs_func: spi11-cs-func-pins { - samsung,pins =3D "gpp3-7"; + samsung,pins =3D "gpp5-7"; samsung,pin-function =3D ; samsung,pin-pud =3D ; samsung,pin-drv =3D ; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BA9AC32763 for ; Mon, 15 Aug 2022 20:43:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346893AbiHOUmI (ORCPT ); Mon, 15 Aug 2022 16:42:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345642AbiHOUhT (ORCPT ); Mon, 15 Aug 2022 16:37:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97FC4ABF36; Mon, 15 Aug 2022 12:07:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CF28E61019; Mon, 15 Aug 2022 19:07:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF038C433C1; Mon, 15 Aug 2022 19:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590421; bh=3mOblT3WWCqHpamng/ifMwZwt9N/Hcq6obNiMPcRVuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FAXfW2tqy0zwI91PKK5i581dmFEHjZqFbhBuwyc3iRrht8QCxgI273c9yDG52nFY/ KRZ5UGlDyiSXflgJWLtGWemuZcaYqggMgEhP/RiWDdGhDNaacZWPpOIJXqaMtI1TOd 8PHdvc4Kvo9RIq86ldnvKGcEOfY9GGnWK1OY+h/U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Auger , Jin Liu , Jean-Philippe Brucker , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 0254/1095] ACPI: VIOT: Fix ACS setup Date: Mon, 15 Aug 2022 19:54:13 +0200 Message-Id: <20220815180440.256760198@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Auger [ Upstream commit 3dcb861dbc6ab101838a1548b1efddd00ca3c3ec ] Currently acpi_viot_init() gets called after the pci device has been scanned and pci_enable_acs() has been called. So pci_request_acs() fails to be taken into account leading to wrong single iommu group topologies when dealing with multi-function root ports for instance. We cannot simply move the acpi_viot_init() earlier, similarly as the IORT init because the VIOT parsing relies on the pci scan. However we can detect VIOT is present earlier and in such a case, request ACS. Introduce a new acpi_viot_early_init() routine that allows to call pci_request_acs() before the scan. While at it, guard the call to pci_request_acs() with #ifdef CONFIG_PCI. Fixes: 3cf485540e7b ("ACPI: Add driver for the VIOT table") Signed-off-by: Eric Auger Reported-by: Jin Liu Reviewed-by: Jean-Philippe Brucker Tested-by: Jean-Philippe Brucker Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/acpi/bus.c | 1 + drivers/acpi/viot.c | 26 ++++++++++++++++++++------ include/linux/acpi_viot.h | 2 ++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 6c735cfa7d43..ef7858393a3c 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -1373,6 +1373,7 @@ static int __init acpi_init(void) =20 pci_mmcfg_late_init(); acpi_iort_init(); + acpi_viot_early_init(); acpi_hest_init(); acpi_ghes_init(); acpi_scan_init(); diff --git a/drivers/acpi/viot.c b/drivers/acpi/viot.c index d2256326c73a..647f11cf165d 100644 --- a/drivers/acpi/viot.c +++ b/drivers/acpi/viot.c @@ -248,6 +248,26 @@ static int __init viot_parse_node(const struct acpi_vi= ot_header *hdr) return ret; } =20 +/** + * acpi_viot_early_init - Test the presence of VIOT and enable ACS + * + * If the VIOT does exist, ACS must be enabled. This cannot be + * done in acpi_viot_init() which is called after the bus scan + */ +void __init acpi_viot_early_init(void) +{ +#ifdef CONFIG_PCI + acpi_status status; + struct acpi_table_header *hdr; + + status =3D acpi_get_table(ACPI_SIG_VIOT, 0, &hdr); + if (ACPI_FAILURE(status)) + return; + pci_request_acs(); + acpi_put_table(hdr); +#endif +} + /** * acpi_viot_init - Parse the VIOT table * @@ -319,12 +339,6 @@ static int viot_pci_dev_iommu_init(struct pci_dev *pde= v, u16 dev_id, void *data) epid =3D ((domain_nr - ep->segment_start) << 16) + dev_id - ep->bdf_start + ep->endpoint_id; =20 - /* - * If we found a PCI range managed by the viommu, we're - * the one that has to request ACS. - */ - pci_request_acs(); - return viot_dev_iommu_init(&pdev->dev, ep->viommu, epid); } diff --git a/include/linux/acpi_viot.h b/include/linux/acpi_viot.h index 1eb8ee5b0e5f..a5a122431563 100644 --- a/include/linux/acpi_viot.h +++ b/include/linux/acpi_viot.h @@ -6,9 +6,11 @@ #include =20 #ifdef CONFIG_ACPI_VIOT +void __init acpi_viot_early_init(void); void __init acpi_viot_init(void); int viot_iommu_configure(struct device *dev); #else +static inline void acpi_viot_early_init(void) {} static inline void acpi_viot_init(void) {} static inline int viot_iommu_configure(struct device *dev) { --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AEBCC28B2C for ; Mon, 15 Aug 2022 20:43:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345077AbiHOUn2 (ORCPT ); Mon, 15 Aug 2022 16:43:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233790AbiHOUiB (ORCPT ); Mon, 15 Aug 2022 16:38:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 364DFADCD2; Mon, 15 Aug 2022 12:07:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 82940B8107A; Mon, 15 Aug 2022 19:07:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC54BC433C1; Mon, 15 Aug 2022 19:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590424; bh=UZHIizdr5sPbVxj0LzXonL82Cx1mUWDggRzlm6WmWnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X6eKU8KKluitpny5kHUmavvvWOFIYhS0agsXC9uUUni41BRg/f4KIGLfYDSUkLVA5 cURRMqrKboNLvB+8eEAwrXMI0P7Dqq55Wu1t8HUQmwFkeGORRQ+jeydhVHMSKU2ZaB FnzES02kwLk1RGzwesFoWEOroOKsCBebaR3I2T1o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0255/1095] arm64: dts: qcom: sm6125: Move sdc2 pinctrl from seine-pdx201 to sm6125 Date: Mon, 15 Aug 2022 19:54:14 +0200 Message-Id: <20220815180440.305485923@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marijn Suijten [ Upstream commit 6990640a93ba4e76dd62ca3ea1082a7354db09d7 ] Both the sdc2-on and sdc2-off pinctrl nodes are used by the sdhci@4784000 node in sm6125.dtsi. Surprisingly sdc2-off is defined in sm6125, yet its sdc2-on counterpart is only defined in board-specific DT for the Sony Seine PDX201 board/device resulting in an "undefined label &sdc2_state_on" error if sm6125.dtsi were included elsewhere. This sm6125 base dtsi should not rely on externally defined labels; the properties referencing it should then also be written externally. Since the sdc2-on pin configuration is board-independent just like sdc2-off, move it from seine-pdx201.dts into sm6125.dtsi. The SDCard-detect pin (gpio98) is however board-specific, and remains as an overwrite in seine-pdx201.dts for both the on and off state. As a drive-by cleanup, reorder bias- and drive-strength properties. Fixes: cff4bbaf2a2d ("arm64: dts: qcom: Add support for SM6125") Fixes: 82e1783890b7 ("arm64: dts: qcom: sm6125: Add support for Sony Xperia= 10II") Signed-off-by: Marijn Suijten Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220508100336.127176-1-marijn.suijten@soma= inline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../qcom/sm6125-sony-xperia-seine-pdx201.dts | 34 +++++-------------- arch/arm64/boot/dts/qcom/sm6125.dtsi | 24 +++++++++++-- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts b= /arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts index 871ccbba445b..4916e6c8b625 100644 --- a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts +++ b/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts @@ -91,8 +91,16 @@ &hsusb_phy1 { &sdc2_state_off { sd-cd { pins =3D "gpio98"; + drive-strength =3D <2>; bias-disable; + }; +}; + +&sdc2_state_on { + sd-cd { + pins =3D "gpio98"; drive-strength =3D <2>; + bias-pull-up; }; }; =20 @@ -102,32 +110,6 @@ &sdhc_1 { =20 &tlmm { gpio-reserved-ranges =3D <22 2>, <28 6>; - - sdc2_state_on: sdc2-on { - clk { - pins =3D "sdc2_clk"; - bias-disable; - drive-strength =3D <16>; - }; - - cmd { - pins =3D "sdc2_cmd"; - bias-pull-up; - drive-strength =3D <10>; - }; - - data { - pins =3D "sdc2_data"; - bias-pull-up; - drive-strength =3D <10>; - }; - - sd-cd { - pins =3D "gpio98"; - bias-pull-up; - drive-strength =3D <2>; - }; - }; }; =20 &usb3 { diff --git a/arch/arm64/boot/dts/qcom/sm6125.dtsi b/arch/arm64/boot/dts/qco= m/sm6125.dtsi index e81b2a7794fb..3fadf5196c4d 100644 --- a/arch/arm64/boot/dts/qcom/sm6125.dtsi +++ b/arch/arm64/boot/dts/qcom/sm6125.dtsi @@ -389,20 +389,40 @@ tlmm: pinctrl@500000 { sdc2_state_off: sdc2-off { clk { pins =3D "sdc2_clk"; - bias-disable; drive-strength =3D <2>; + bias-disable; }; =20 cmd { pins =3D "sdc2_cmd"; + drive-strength =3D <2>; bias-pull-up; + }; + + data { + pins =3D "sdc2_data"; drive-strength =3D <2>; + bias-pull-up; + }; + }; + + sdc2_state_on: sdc2-on { + clk { + pins =3D "sdc2_clk"; + drive-strength =3D <16>; + bias-disable; + }; + + cmd { + pins =3D "sdc2_cmd"; + drive-strength =3D <10>; + bias-pull-up; }; =20 data { pins =3D "sdc2_data"; + drive-strength =3D <10>; bias-pull-up; - drive-strength =3D <2>; }; }; }; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D826FC28B2C for ; Mon, 15 Aug 2022 20:43:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344755AbiHOUnZ (ORCPT ); Mon, 15 Aug 2022 16:43:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345874AbiHOUhw (ORCPT ); Mon, 15 Aug 2022 16:37:52 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0C5FAE20B; Mon, 15 Aug 2022 12:07:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id AE54FCE1087; Mon, 15 Aug 2022 19:07:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DEBCC433C1; Mon, 15 Aug 2022 19:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590428; bh=O3JKpxMBdBMlzcnXK+pT01181eyK9/vtz6/V4r6tbU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uj+/OKeWj9JvscvpFcqswh6JmkEWLV0ZJbSaw5mzBOout4d9oScOcX5HNDCMYIU7G Vmm/qIr8P83tBzyfmwybzh18rfe/yJ6LjLDjumSlYhnruwfRLyBKizqf7lYGsGNi5n 3Ra7xzkOnB3znDrpv+7MKUduNDxG1WstFHdmfruk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0256/1095] arm64: dts: qcom: sm6125: Append -state suffix to pinctrl nodes Date: Mon, 15 Aug 2022 19:54:15 +0200 Message-Id: <20220815180440.335917253@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marijn Suijten [ Upstream commit cbfb5668aece448877fa7826cde81c9d06f4a4ac ] According to qcom,sm6125-pinctrl.yaml all nodes inside the tlmm must be suffixed by -state: qcom/sm6125-sony-xperia-seine-pdx201.dtb: pinctrl@500000: 'sdc2-off', '= sdc2-on' do not match any of the regexes: '-state$', 'pinctrl-[0-9]+' The label names have been updated to match, going from sdc2_state_X to sdc2_X_state. Fixes: cff4bbaf2a2d ("arm64: dts: qcom: Add support for SM6125") Fixes: 82e1783890b7 ("arm64: dts: qcom: sm6125: Add support for Sony Xperia= 10II") Signed-off-by: Marijn Suijten Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220508100336.127176-2-marijn.suijten@soma= inline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts | 4 ++-- arch/arm64/boot/dts/qcom/sm6125.dtsi | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts b= /arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts index 4916e6c8b625..038970c0b68e 100644 --- a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts +++ b/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts @@ -88,7 +88,7 @@ &hsusb_phy1 { status =3D "okay"; }; =20 -&sdc2_state_off { +&sdc2_off_state { sd-cd { pins =3D "gpio98"; drive-strength =3D <2>; @@ -96,7 +96,7 @@ sd-cd { }; }; =20 -&sdc2_state_on { +&sdc2_on_state { sd-cd { pins =3D "gpio98"; drive-strength =3D <2>; diff --git a/arch/arm64/boot/dts/qcom/sm6125.dtsi b/arch/arm64/boot/dts/qco= m/sm6125.dtsi index 3fadf5196c4d..e601b9bfdc04 100644 --- a/arch/arm64/boot/dts/qcom/sm6125.dtsi +++ b/arch/arm64/boot/dts/qcom/sm6125.dtsi @@ -386,7 +386,7 @@ tlmm: pinctrl@500000 { interrupt-controller; #interrupt-cells =3D <2>; =20 - sdc2_state_off: sdc2-off { + sdc2_off_state: sdc2-off-state { clk { pins =3D "sdc2_clk"; drive-strength =3D <2>; @@ -406,7 +406,7 @@ data { }; }; =20 - sdc2_state_on: sdc2-on { + sdc2_on_state: sdc2-on-state { clk { pins =3D "sdc2_clk"; drive-strength =3D <16>; @@ -490,8 +490,8 @@ sdhc_2: sdhci@4784000 { <&xo_board>; clock-names =3D "iface", "core", "xo"; =20 - pinctrl-0 =3D <&sdc2_state_on>; - pinctrl-1 =3D <&sdc2_state_off>; + pinctrl-0 =3D <&sdc2_on_state>; + pinctrl-1 =3D <&sdc2_off_state>; pinctrl-names =3D "default", "sleep"; =20 power-domains =3D <&rpmpd SM6125_VDDCX>; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F9C8C00140 for ; Mon, 15 Aug 2022 20:43:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345378AbiHOUni (ORCPT ); Mon, 15 Aug 2022 16:43:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345194AbiHOUjw (ORCPT ); Mon, 15 Aug 2022 16:39:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2B5DAE222; Mon, 15 Aug 2022 12:07:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C0F0861019; Mon, 15 Aug 2022 19:07:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE5CDC433C1; Mon, 15 Aug 2022 19:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590431; bh=xHJUJwpKHAC+e9emaowpBnNgdWEKlSRsQ5QR4/3UQYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xs3cywuGt1aejfJwuCicexj68rU1/iSW+NaNGO7m7luLvQkIfbsMHtbtpD2RfBNdK X7z529m7tTJtmkGJUHYY1vTkoJ3ldJ0FODMHI4Hn4Ayx3quUzMQ8KpsiigcnfMqx/D nPNeVS2OLxVXrYKrpGJ268zCuDOBzzlr4LgSI3Jk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0257/1095] arm64: dts: qcom: msm8996: correct #clock-cells for QMP PHY nodes Date: Mon, 15 Aug 2022 19:54:16 +0200 Message-Id: <20220815180440.377834433@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Baryshkov [ Upstream commit b874fff9a7683df30e5aff16d5a85b1f8a43aa5d ] The commit 82d61e19fccb ("arm64: dts: qcom: msm8996: Move '#clock-cells' to QMP PHY child node") moved the '#clock-cells' properties to the child nodes. However it missed the fact that the property must have been set to <0> (as all pipe clocks use of_clk_hw_simple_get as the xlate function. Also the mentioned commit didn't add '#clock-cells' properties to second and third PCIe PHY nodes. Correct both these mistakes: - Set '#clock-cells' to <0>, - Add the property to pciephy_1 and pciephy_2 nodes. Fixes: 82d61e19fccb ("arm64: dts: qcom: msm8996: Move '#clock-cells' to QMP= PHY child node") Signed-off-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220620071936.1558906-3-dmitry.baryshkov@l= inaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/msm8996.dtsi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qc= om/msm8996.dtsi index b9a48cfd760f..078edf46de2b 100644 --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi @@ -603,7 +603,7 @@ pciephy_0: phy@35000 { <0x00035400 0x1dc>; #phy-cells =3D <0>; =20 - #clock-cells =3D <1>; + #clock-cells =3D <0>; clock-output-names =3D "pcie_0_pipe_clk_src"; clocks =3D <&gcc GCC_PCIE_0_PIPE_CLK>; clock-names =3D "pipe0"; @@ -617,6 +617,7 @@ pciephy_1: phy@36000 { <0x00036400 0x1dc>; #phy-cells =3D <0>; =20 + #clock-cells =3D <0>; clock-output-names =3D "pcie_1_pipe_clk_src"; clocks =3D <&gcc GCC_PCIE_1_PIPE_CLK>; clock-names =3D "pipe1"; @@ -630,6 +631,7 @@ pciephy_2: phy@37000 { <0x00037400 0x1dc>; #phy-cells =3D <0>; =20 + #clock-cells =3D <0>; clock-output-names =3D "pcie_2_pipe_clk_src"; clocks =3D <&gcc GCC_PCIE_2_PIPE_CLK>; clock-names =3D "pipe2"; @@ -2659,7 +2661,7 @@ ssusb_phy_0: phy@7410200 { <0x07410600 0x1a8>; #phy-cells =3D <0>; =20 - #clock-cells =3D <1>; + #clock-cells =3D <0>; clock-output-names =3D "usb3_phy_pipe_clk_src"; clocks =3D <&gcc GCC_USB3_PHY_PIPE_CLK>; clock-names =3D "pipe0"; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 113ADC25B08 for ; Mon, 15 Aug 2022 20:43:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344979AbiHOUno (ORCPT ); Mon, 15 Aug 2022 16:43:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345786AbiHOUjx (ORCPT ); Mon, 15 Aug 2022 16:39:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81B2AAED82; Mon, 15 Aug 2022 12:07:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C194EB81107; Mon, 15 Aug 2022 19:07:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB854C433C1; Mon, 15 Aug 2022 19:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590437; bh=z1ZB++8FbLhpxiPezMZYl+ulr53Ss6UfSvXyYxPc2Vw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cM326932xDwxuXqWl7c5cwWWm8lDiKbji/czXuan8F9TtJeZRx/2l4lD/qyG3a6Nv FY7R3eienB+4rTYztFIyFRzjgz3urA1bNJEDyk+BPx2c426B2MhfJ8JJjHP28cdqH+ ArFZ1QztwB5T8nPgey2Ff7ZP/MLstIL3MPE5Va8E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0258/1095] arm64: dts: qcom: sc7280: drop PCIe PHY clock index Date: Mon, 15 Aug 2022 19:54:17 +0200 Message-Id: <20220815180440.423509547@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold [ Upstream commit 531c738fb36069d60aff267a0b25533a35d59fd0 ] The QMP PCIe PHY provides a single clock so drop the redundant clock index. Signed-off-by: Johan Hovold Fixes: bd7d507935ca ("arm64: dts: qcom: sc7280: Add pcie clock support") Fixes: 92e0ee9f83b3 ("arm64: dts: qcom: sc7280: Add PCIe and PHY related n= odes") Reviewed-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220705114032.22787-2-johan+linaro@kernel.= org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/sc7280.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qco= m/sc7280.dtsi index 7925c8561117..86898d0b4124 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -810,7 +810,7 @@ gcc: clock-controller@100000 { reg =3D <0 0x00100000 0 0x1f0000>; clocks =3D <&rpmhcc RPMH_CXO_CLK>, <&rpmhcc RPMH_CXO_CLK_A>, <&sleep_clk>, - <0>, <&pcie1_lane 0>, + <0>, <&pcie1_lane>, <0>, <0>, <0>, <0>; clock-names =3D "bi_tcxo", "bi_tcxo_ao", "sleep_clk", "pcie_0_pipe_clk", "pcie_1_pipe_clk", @@ -1914,7 +1914,7 @@ pcie1_lane: lanes@1c0e200 { clock-names =3D "pipe0"; =20 #phy-cells =3D <0>; - #clock-cells =3D <1>; + #clock-cells =3D <0>; clock-output-names =3D "pcie_1_pipe_clk"; }; }; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 782D9C00140 for ; Mon, 15 Aug 2022 20:43:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345186AbiHOUnz (ORCPT ); Mon, 15 Aug 2022 16:43:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345809AbiHOUkR (ORCPT ); Mon, 15 Aug 2022 16:40:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3127AF0CC; Mon, 15 Aug 2022 12:07:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 13DC561299; Mon, 15 Aug 2022 19:07:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4BCAC433C1; Mon, 15 Aug 2022 19:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590440; bh=j3q2RM54N4zh3E4cFLxCi/a/CNl0om9qOSQz/gllIZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tdYFZb55NO6lG8F6hJin0g2NytTLrbAa8c4M/2GxW+FdeTtUYkTYAPguafVfkr8dg LcWsR2aQ9+n7gmTVD1mvZ9Q2ltqOQ0iQv9jM202KHDnZHaBHGfKYrZABwcwhpSU8nO JVaWdWYLPyPfDpFXbax0GUCsWDlWdx43m7ReTJ5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0259/1095] arm64: dts: qcom: sm8250: add missing PCIe PHY clock-cells Date: Mon, 15 Aug 2022 19:54:18 +0200 Message-Id: <20220815180440.461565404@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold [ Upstream commit d9fd162ce764c227fcfd4242f6c1639895a9481f ] Add the missing '#clock-cells' properties to the PCIe QMP PHY nodes. Signed-off-by: Johan Hovold Fixes: e53bdfc00977 ("arm64: dts: qcom: sm8250: Add PCIe support") Reviewed-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220705114032.22787-3-johan+linaro@kernel.= org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/sm8250.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qco= m/sm8250.dtsi index 1d62b2130e04..9afd8b3da3a1 100644 --- a/arch/arm64/boot/dts/qcom/sm8250.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi @@ -1883,6 +1883,8 @@ pcie0_lane: phy@1c06200 { clock-names =3D "pipe0"; =20 #phy-cells =3D <0>; + + #clock-cells =3D <0>; clock-output-names =3D "pcie_0_pipe_clk"; }; }; @@ -1989,6 +1991,8 @@ pcie1_lane: phy@1c0e200 { clock-names =3D "pipe0"; =20 #phy-cells =3D <0>; + + #clock-cells =3D <0>; clock-output-names =3D "pcie_1_pipe_clk"; }; }; @@ -2095,6 +2099,8 @@ pcie2_lane: phy@1c16200 { clock-names =3D "pipe0"; =20 #phy-cells =3D <0>; + + #clock-cells =3D <0>; clock-output-names =3D "pcie_2_pipe_clk"; }; }; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9D39C00140 for ; Mon, 15 Aug 2022 20:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345517AbiHOUoC (ORCPT ); Mon, 15 Aug 2022 16:44:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345716AbiHOUkV (ORCPT ); Mon, 15 Aug 2022 16:40:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94394AF0F5; Mon, 15 Aug 2022 12:07:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CA2C761281; Mon, 15 Aug 2022 19:07:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D87F9C433D6; Mon, 15 Aug 2022 19:07:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590443; bh=wx3Pqq+F2h2jfSI8/LFoPCkQS2DBaKaEJmT2ns3U6iY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vaxvNLAuhysmiUBxDU3CL44Rm9Fzrpxp1DbTq8Fc0c8Msv2bkK7L6+2onJpLH0YcS qULJSh8I7GdC5UKG7MhuDZDdgcrNezrMZF84b3aX9FaXbo9lpJOuUPx521nbW7SuLx syFzRGLyTEcQcbO2AAoUWcAXwy47IaKhHsTSStKg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, INAGAKI Hiroshi , Nick Hainke , Matthias Brugger , Sasha Levin Subject: [PATCH 5.18 0260/1095] arm64: dts: mt7622: fix BPI-R64 WPS button Date: Mon, 15 Aug 2022 19:54:19 +0200 Message-Id: <20220815180440.497785898@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nick Hainke [ Upstream commit c98e6e683632386a3bd284acda4342e68aec4c41 ] The bananapi R64 (BPI-R64) experiences wrong WPS button signals. In OpenWrt pushing the WPS button while powering on the device will set it to recovery mode. Currently, this also happens without any user interaction. In particular, the wrong signals appear while booting the device or restarting it, e.g. after doing a system upgrade. If the device is in recovery mode the user needs to manually power cycle or restart it. The official BPI-R64 sources set the WPS button to GPIO_ACTIVE_LOW in the device tree. This setting seems to suppress the unwanted WPS button press signals. So this commit changes the button from GPIO_ACTIVE_HIGH to GPIO_ACTIVE_LOW. The official BPI-R64 sources can be found on https://github.com/BPI-SINOVOIP/BPI-R64-openwrt Fixes: 0b6286dd96c0 ("arm64: dts: mt7622: add bananapi BPI-R64 board") Suggested-by: INAGAKI Hiroshi Signed-off-by: Nick Hainke Link: https://lore.kernel.org/r/20220630111746.4098-1-vincent@systemli.org Signed-off-by: Matthias Brugger Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts b/arc= h/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts index 2b9bf8dd14ec..7538918c7a82 100644 --- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts @@ -49,7 +49,7 @@ factory { wps { label =3D "wps"; linux,code =3D ; - gpios =3D <&pio 102 GPIO_ACTIVE_HIGH>; + gpios =3D <&pio 102 GPIO_ACTIVE_LOW>; }; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE834C25B0E for ; Mon, 15 Aug 2022 20:52:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346167AbiHOUwL (ORCPT ); Mon, 15 Aug 2022 16:52:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346052AbiHOUuU (ORCPT ); Mon, 15 Aug 2022 16:50:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A241B9FB1; Mon, 15 Aug 2022 12:09:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CF9986009B; Mon, 15 Aug 2022 19:09:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE69EC433C1; Mon, 15 Aug 2022 19:09:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590570; bh=eyMwQc20GKsAVRNIZgBdwEAk8Ebl8Yb+E2k1OqTmU7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sc73cpFmRYG4y2mWRu82jxOvxydCQLDLgU9x/V2jSjeUw0lKdy6nTvaqIQRDfyVH9 1bJm6+GHlvWfJPPXg0EZVqAm+84+e+V9r1kUgfUtu7iWnQ4NDVHc7FZ2EF0TRgPKGF uCOp6aOqj8B0tdMjEcBX3v1RijRMSm3nSPYyh63c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikko Perttunen , Yousaf Kaukab , Thierry Reding , Sasha Levin Subject: [PATCH 5.18 0261/1095] arm64: tegra: Mark BPMP channels as no-memory-wc Date: Mon, 15 Aug 2022 19:54:20 +0200 Message-Id: <20220815180440.548386034@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikko Perttunen [ Upstream commit 61192a9d8a6367ae1b8234876941b037910a2459 ] The Tegra SYSRAM contains regions access to which is restricted to certain hardware blocks on the system, and speculative accesses to those will cause issues. Patch 'misc: sram: Only map reserved areas in Tegra SYSRAM' attempted to resolve this by only mapping the regions specified in the device tree on the assumption that there are no such restricted areas within the 64K-aligned area of memory that contains the memory we wish to map. Turns out this assumption is wrong, as there are such areas above the 4K pages described in the device trees. As such, we need to use the bigger hammer that is no-memory-wc, which causes the memory to be mapped as Device memory to which speculative accesses are disallowed. As such, the previous patch in the series, 'firmware: tegra: bpmp: do only aligned access to IPC memory area', is required with this patch to make the BPMP driver only issue aligned memory accesses as those are also required with Device memory. Fixes: fec29bf04994 ("misc: sram: Only map reserved areas in Tegra SYSRAM") Signed-off-by: Mikko Perttunen Reviewed-by: Yousaf Kaukab Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/nvidia/tegra186.dtsi | 1 + arch/arm64/boot/dts/nvidia/tegra194.dtsi | 1 + arch/arm64/boot/dts/nvidia/tegra234.dtsi | 1 + 3 files changed, 3 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra186.dtsi b/arch/arm64/boot/dts= /nvidia/tegra186.dtsi index e9b40f5d79ec..77c597a6386f 100644 --- a/arch/arm64/boot/dts/nvidia/tegra186.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra186.dtsi @@ -1807,6 +1807,7 @@ sram@30000000 { #address-cells =3D <1>; #size-cells =3D <1>; ranges =3D <0x0 0x0 0x30000000 0x50000>; + no-memory-wc; =20 cpu_bpmp_tx: sram@4e000 { reg =3D <0x4e000 0x1000>; diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts= /nvidia/tegra194.dtsi index 751ebe5e9506..61465eb6cccd 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -2648,6 +2648,7 @@ sram@40000000 { #address-cells =3D <1>; #size-cells =3D <1>; ranges =3D <0x0 0x0 0x40000000 0x50000>; + no-memory-wc; =20 cpu_bpmp_tx: sram@4e000 { reg =3D <0x4e000 0x1000>; diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts= /nvidia/tegra234.dtsi index aaace605bdaa..9916b87fa83f 100644 --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi @@ -1264,6 +1264,7 @@ sram@40000000 { #address-cells =3D <1>; #size-cells =3D <1>; ranges =3D <0x0 0x0 0x40000000 0x80000>; + no-memory-wc; =20 cpu_bpmp_tx: sram@70000 { reg =3D <0x70000 0x1000>; --=20 2.35.1 From nobody Fri Oct 24 20:17:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30DB7C25B08 for ; Mon, 15 Aug 2022 20:44:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345476AbiHOUou (ORCPT ); Mon, 15 Aug 2022 16:44:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347277AbiHOUml (ORCPT ); Mon, 15 Aug 2022 16:42:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA822B275F; Mon, 15 Aug 2022 12:07:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9C839B81107; Mon, 15 Aug 2022 19:07:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C537BC433D7; Mon, 15 Aug 2022 19:07:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590469; bh=PTajQ6vCQBXIMFfY1mQIEBHxTvgpJvmAcciNKVsTvXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k18h7JrVkdRP5erXxnNFlENekOtv6w6tklXAYWsWuQAoH+OcKzqEmLEQ4icaV3Ufa eAqHIlXnOe8s2AjUI8mQAVCm4+SuaWGOcDyHQ61TMfsUhcBNzCZKQsYDAQHVc3K96j wFyIYiR5TaU81hnognWg1EOPcpydMKw5DlgZPwfU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Tam=C3=A1s=20Sz=C5=B1cs?= , Thierry Reding , Sasha Levin Subject: [PATCH 5.18 0262/1095] arm64: tegra: Fix SDMMC1 CD on P2888 Date: Mon, 15 Aug 2022 19:54:21 +0200 Message-Id: <20220815180440.591852741@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tam=C3=A1s Sz=C5=B1cs [ Upstream commit b415bb7c976f1d595ed752001c0938f702645dab ] Hook SDMMC1 CD up with CVM GPIO02 (SOC_GPIO11) used for card detection on J4 (uSD socket) on the carrier. Fixes: ef633bfc21e9 ("arm64: tegra: Enable card detect for SD card on P2888= ") Signed-off-by: Tam=C3=A1s Sz=C5=B1cs Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi b/arch/arm64/bo= ot/dts/nvidia/tegra194-p2888.dtsi index a7d7cfd66379..b0f9393dd39c 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi @@ -75,7 +75,7 @@ eeprom@50 { =20 /* SDMMC1 (SD/MMC) */ mmc@3400000 { - cd-gpios =3D <&gpio TEGRA194_MAIN_GPIO(A, 0) GPIO_ACTIVE_LOW>; + cd-gpios =3D <&gpio TEGRA194_MAIN_GPIO(G, 7) GPIO_ACTIVE_LOW>; }; =20 /* SDMMC4 (eMMC) */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 283F9C25B08 for ; Mon, 15 Aug 2022 20:47:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345793AbiHOUrI (ORCPT ); Mon, 15 Aug 2022 16:47:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345895AbiHOUpN (ORCPT ); Mon, 15 Aug 2022 16:45:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D061B69DC; Mon, 15 Aug 2022 12:08:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 35F33B81109; Mon, 15 Aug 2022 19:08:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D41AC433D7; Mon, 15 Aug 2022 19:08:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590503; bh=iX+5KEpxJzjiGKEqljQi558Jg2Yeyr5xlw5iP2CRKK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ij8H25rsEty8GQlc0duet/gxeXxZ8EjYDQ3RQGZ9Jj20temLc2dV0cAcRDPaw3V35 MXYsaQydTW+VSiTHqgHpDf6n1QlYvpbxuNaQn7hY3H4MFkVEXr5xIDEdOcRbLeLbKZ YvbofzSb39pye1DNwehY/vYO4E3xJN23AsoShYzk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Johan Hovold , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0263/1095] arm64: dts: qcom: sc7280: fix PCIe clock reference Date: Mon, 15 Aug 2022 19:54:22 +0200 Message-Id: <20220815180440.627111474@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold [ Upstream commit 330fc08dbdd913ac37a31f8aec1a88f68e39ae39 ] The recent commit that dropped the PCIe PHY clock index failed to update the PCIe node reference. Fixes: 531c738fb360 ("arm64: dts: qcom: sc7280: drop PCIe PHY clock index") Reported-by: Dmitry Baryshkov Signed-off-by: Johan Hovold Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220707064222.15717-1-johan+linaro@kernel.= org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/sc7280.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qco= m/sc7280.dtsi index 86898d0b4124..793ac9715da2 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -1839,7 +1839,7 @@ pcie1: pci@1c08000 { =20 clocks =3D <&gcc GCC_PCIE_1_PIPE_CLK>, <&gcc GCC_PCIE_1_PIPE_CLK_SRC>, - <&pcie1_lane 0>, + <&pcie1_lane>, <&rpmhcc RPMH_CXO_CLK>, <&gcc GCC_PCIE_1_AUX_CLK>, <&gcc GCC_PCIE_1_CFG_AHB_CLK>, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEA86C25B08 for ; Mon, 15 Aug 2022 20:49:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345996AbiHOUta (ORCPT ); Mon, 15 Aug 2022 16:49:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346584AbiHOUs1 (ORCPT ); Mon, 15 Aug 2022 16:48:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A70CCB8F0D; Mon, 15 Aug 2022 12:09:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BE41BB81106; Mon, 15 Aug 2022 19:09:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2469DC433C1; Mon, 15 Aug 2022 19:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590539; bh=dC3DNuwK+mEw99lMl/mt9cbWGoqxAMyTQd+LbtZwKyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l/xJm9MxQVD4dr/fQBCzIJL3zGriHhm7NaCGlvRRoXvYE7sB9yozci2vrK1jQISnj U9ijWmr2sDD5Ilf1yEDwRp8SiO7DVArW/TdS7ldYy2kFsaBP93M9+TZcdCcDWEvKEL 2H5A17xZZlxL+7gIn+cnGNyFIPOkdNYcxK4vRR30= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yuwen Chen , Gao Xiang , Sasha Levin Subject: [PATCH 5.18 0264/1095] erofs: wake up all waiters after z_erofs_lzma_head ready Date: Mon, 15 Aug 2022 19:54:23 +0200 Message-Id: <20220815180440.666998143@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yuwen Chen [ Upstream commit 2df7c4bd7c1d2bc5ece5e9ed19dbd386810c2a65 ] When the user mounts the erofs second times, the decompression thread may hung. The problem happens due to a sequence of steps like the following: 1) Task A called z_erofs_load_lzma_config which obtain all of the node from the z_erofs_lzma_head. 2) At this time, task B called the z_erofs_lzma_decompress and wanted to get a node. But the z_erofs_lzma_head was empty, the Task B had to sleep. 3) Task A release nodes and push nodes into the z_erofs_lzma_head. But task B was still sleeping. One example report when the hung happens: task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000 Workqueue: erofs_unzipd z_erofs_decompressqueue_work Call Trace: __schedule+0x281/0x760 schedule+0x49/0xb0 z_erofs_lzma_decompress+0x4bc/0x580 ? cpu_core_flags+0x10/0x10 z_erofs_decompress_pcluster+0x49b/0xba0 ? __update_load_avg_se+0x2b0/0x330 ? __update_load_avg_se+0x2b0/0x330 ? update_load_avg+0x5f/0x690 ? update_load_avg+0x5f/0x690 ? set_next_entity+0xbd/0x110 ? _raw_spin_unlock+0xd/0x20 z_erofs_decompress_queue.isra.0+0x2e/0x50 z_erofs_decompressqueue_work+0x30/0x60 process_one_work+0x1d3/0x3a0 worker_thread+0x45/0x3a0 ? process_one_work+0x3a0/0x3a0 kthread+0xe2/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30 Signed-off-by: Yuwen Chen Fixes: 622ceaddb764 ("erofs: lzma compression support") Reviewed-by: Gao Xiang Link: https://lore.kernel.org/r/20220626224041.4288-1-chenyuwen1@meizu.com Signed-off-by: Gao Xiang Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/erofs/decompressor_lzma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c index 05a3063cf2bc..5e59b3f523eb 100644 --- a/fs/erofs/decompressor_lzma.c +++ b/fs/erofs/decompressor_lzma.c @@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb, DBG_BUGON(z_erofs_lzma_head); z_erofs_lzma_head =3D head; spin_unlock(&z_erofs_lzma_lock); + wake_up_all(&z_erofs_lzma_wq); =20 z_erofs_lzma_max_dictsize =3D dict_size; mutex_unlock(&lzma_resize_mutex); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E08AAC25B0E for ; Mon, 15 Aug 2022 20:50:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346265AbiHOUuG (ORCPT ); Mon, 15 Aug 2022 16:50:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346250AbiHOUtX (ORCPT ); Mon, 15 Aug 2022 16:49:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1926B8F01; Mon, 15 Aug 2022 12:09:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E9B1B60A52; Mon, 15 Aug 2022 19:09:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D16FAC433C1; Mon, 15 Aug 2022 19:09:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590552; bh=kuSPsuod3nFFBwRzP14Dq+MMwRDfrosp/7NOt14u+p4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L09ghtYh5RaLjXMthYB/9GHF8azEJL9YIPE+iiErTqJ56ylsa1lNHfX9REhP0IVMH 6y4BqhjEPQLElFoLI2GdItUh6efEnYC+ooADw+BT+EOUgLhV+/HCb4B5MSPlQ8t8w2 IOqiyAeGHp4UFR7K1RMFTHa6ZttA0K50XHuUZC+8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Jinbao , Gao Xiang , Sasha Levin Subject: [PATCH 5.18 0265/1095] erofs: avoid consecutive detection for Highmem memory Date: Mon, 15 Aug 2022 19:54:24 +0200 Message-Id: <20220815180440.711719977@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gao Xiang [ Upstream commit 448b5a1548d87c246c3d0c3df8480d3c6eb6c11a ] Currently, vmap()s are avoided if physical addresses are consecutive for decompressed buffers. I observed that is very common for 4KiB pclusters since the numbers of decompressed pages are almost 2 or 3. However, such detection doesn't work for Highmem pages on 32-bit machines, let's fix it now. Reported-by: Liu Jinbao Fixes: 7fc45dbc938a ("staging: erofs: introduce generic decompression backe= nd") Link: https://lore.kernel.org/r/20220708101001.21242-1-hsiangkao@linux.alib= aba.com Signed-off-by: Gao Xiang Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/erofs/decompressor.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c index 0e0d1fc0f130..9bbd9a59426b 100644 --- a/fs/erofs/decompressor.c +++ b/fs/erofs/decompressor.c @@ -93,14 +93,18 @@ static int z_erofs_lz4_prepare_dstpages(struct z_erofs_= lz4_decompress_ctx *ctx, =20 if (page) { __clear_bit(j, bounced); - if (kaddr) { - if (kaddr + PAGE_SIZE =3D=3D page_address(page)) + if (!PageHighMem(page)) { + if (!i) { + kaddr =3D page_address(page); + continue; + } + if (kaddr && + kaddr + PAGE_SIZE =3D=3D page_address(page)) { kaddr +=3D PAGE_SIZE; - else - kaddr =3D NULL; - } else if (!i) { - kaddr =3D page_address(page); + continue; + } } + kaddr =3D NULL; continue; } kaddr =3D NULL; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC9ACC25B08 for ; Mon, 15 Aug 2022 20:50:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346089AbiHOUuW (ORCPT ); Mon, 15 Aug 2022 16:50:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245187AbiHOUt1 (ORCPT ); Mon, 15 Aug 2022 16:49:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7785B958F; Mon, 15 Aug 2022 12:09:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E031260ACE; Mon, 15 Aug 2022 19:09:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAEB0C433D7; Mon, 15 Aug 2022 19:09:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590555; bh=t4VfIFbTd+hOKtBrkZrnhvdPwL/KK5ZpeGv/LvfhQqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V4gajcr0VIqq6ErcuZ3hlPM5xE0sC4vr8EmYAjGqWoS1W+AxUAdEI6MvnnvgIVLKG tjzEMvEmH6LTQiugzDchmbfvKVIYOMrljIGo2IX5rAoCt0mvx4OGF5Tac22+L3O80m U64nsDjwslKGK1FCae+dMJPOxYx6AlJe1trfelGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0266/1095] spi: Return deferred probe error when controller isnt yet available Date: Mon, 15 Aug 2022 19:54:25 +0200 Message-Id: <20220815180440.746497365@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andy Shevchenko [ Upstream commit 9c22ec4ac27bcc5a54dd406da168f403327a5b55 ] If the controller is not available, it might be in the future and we would like to re-probe the peripheral again. For that purpose return deferred probe. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=3D215993 Fixes: 87e59b36e5e2 ("spi: Support selection of the index of the ACPI Spi R= esource before alloc") Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220709212956.25530-1-andriy.shevchenko@li= nux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/spi/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 2e6d6bbeb784..e1065768c537 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2416,7 +2416,7 @@ static int acpi_spi_add_resource(struct acpi_resource= *ares, void *data) =20 ctlr =3D acpi_spi_find_controller_by_adev(adev); if (!ctlr) - return -ENODEV; + return -EPROBE_DEFER; =20 lookup->ctlr =3D ctlr; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9C24C25B0E for ; Mon, 15 Aug 2022 20:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346235AbiHOUu1 (ORCPT ); Mon, 15 Aug 2022 16:50:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346042AbiHOUtb (ORCPT ); Mon, 15 Aug 2022 16:49:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EDA4B95A5; Mon, 15 Aug 2022 12:09:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EDD4D60BC2; Mon, 15 Aug 2022 19:09:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAAD9C433D7; Mon, 15 Aug 2022 19:09:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590558; bh=HKEPZdH7dHXhOAmPXvweHSiuwJ2DvZSpsN7WJIndf8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gcXJyxvtIquKrih6nu66MMl7cQrYWnUJLjSe7dM4xUhDChn1yGdU9oXbD/Gemm7o+ nwC75lpffX8fBQ/261RHW2v+ApSV8YZJ+634Ypl/k0lnFq72RaZUljtGt+MnlEeK7f izQIpK7cwnhFskntQu1Qhl+cC5SKPNxzkj9ZRhu8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yi Zhang , Ming Lei , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 0267/1095] blk-mq: dont create hctx debugfs dir until q->debugfs_dir is created Date: Mon, 15 Aug 2022 19:54:26 +0200 Message-Id: <20220815180440.794310899@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Lei [ Upstream commit f3ec5d11554778c24ac8915e847223ed71d104fc ] blk_mq_debugfs_register_hctx() can be called by blk_mq_update_nr_hw_queues when gendisk isn't added yet, such as nvme tcp. Fixes the warning of 'debugfs: Directory 'hctx0' with parent '/' already pr= esent!' which can be observed reliably when running blktests nvme/005. Fixes: 6cfc0081b046 ("blk-mq: no need to check return value of debugfs_crea= te functions") Reported-by: Yi Zhang Signed-off-by: Ming Lei Tested-by: Yi Zhang Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20220711090808.259682-1-ming.lei@redhat.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- block/blk-mq-debugfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index aa0349e9f083..34bee263936c 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -737,6 +737,9 @@ void blk_mq_debugfs_register_hctx(struct request_queue = *q, char name[20]; int i; =20 + if (!q->debugfs_dir) + return; + snprintf(name, sizeof(name), "hctx%u", hctx->queue_num); hctx->debugfs_dir =3D debugfs_create_dir(name, q->debugfs_dir); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4EFEC25B08 for ; Mon, 15 Aug 2022 20:50:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346243AbiHOUuc (ORCPT ); Mon, 15 Aug 2022 16:50:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346463AbiHOUtr (ORCPT ); Mon, 15 Aug 2022 16:49:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 761C3B99C9; Mon, 15 Aug 2022 12:09:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E9C8F6009B; Mon, 15 Aug 2022 19:09:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB00FC433C1; Mon, 15 Aug 2022 19:09:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590561; bh=qTrRxe6w0Z+uWcp4krLAZw9IEg3f36QngPy9the/PDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RR9n2RopVLfeNM5Coh0nIT70Pp5Xq5g19Km4hPIUPTSmMAIvZ3a9S4AHnFM9C1xUN 8O0D4tR+aY75yZVAm53axqIPA8ksnYo7e4KHnobGTqvtsrDuY0QFYz3oDzzUNpF0Sn EqBV4VOVJ6wpZ04xa+BoJw11pZ+kntreS9w+VuIE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nandhini Srikandan , Serge Semin , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0268/1095] spi: dw: Fix IP-core versions macro Date: Mon, 15 Aug 2022 19:54:27 +0200 Message-Id: <20220815180440.831764142@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nandhini Srikandan [ Upstream commit 5d76b7509cb223e94ff73a672273e58f1957ac68 ] Add the missing underscore in IP version macro to avoid compilation issue. The macro is used for IP version comparison in the current patchset. Fixes: 2cc8d9227bbb ("spi: dw: Introduce Synopsys IP-core versions interfac= e") Signed-off-by: Nandhini Srikandan Acked-by: Serge Semin Link: https://lore.kernel.org/r/20220713042223.1458-2-nandhini.srikandan@in= tel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/spi/spi-dw.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h index d5ee5130601e..79d853f6d192 100644 --- a/drivers/spi/spi-dw.h +++ b/drivers/spi/spi-dw.h @@ -23,7 +23,7 @@ ((_dws)->ip =3D=3D DW_ ## _ip ## _ID) =20 #define __dw_spi_ver_cmp(_dws, _ip, _ver, _op) \ - (dw_spi_ip_is(_dws, _ip) && (_dws)->ver _op DW_ ## _ip ## _ver) + (dw_spi_ip_is(_dws, _ip) && (_dws)->ver _op DW_ ## _ip ## _ ## _ver) =20 #define dw_spi_ver_is(_dws, _ip, _ver) __dw_spi_ver_cmp(_dws, _ip, _ver, = =3D=3D) =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3EDCC28B2B for ; Mon, 15 Aug 2022 20:52:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346032AbiHOUwD (ORCPT ); Mon, 15 Aug 2022 16:52:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346288AbiHOUuH (ORCPT ); Mon, 15 Aug 2022 16:50:07 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EC92B99FA; Mon, 15 Aug 2022 12:09:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id D72E0CE12C4; Mon, 15 Aug 2022 19:09:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C76F3C433C1; Mon, 15 Aug 2022 19:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590564; bh=3fm56voGlBMufrAF3Z9RjuxGbxgbRM8mf6liRp3l0UQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cdnytPmzWAriUYc1/gIGLM7jsV2nxFI6IVulP00y/iGCVBQhDYwiEO0LDpPMB+uXC cET0Pi+1ny2w6uViasEqrhXGjXf9AvCg6eTRljnYy/1Dt/q0EcTATdcDGejLa0wI0j 4wHw1th4BSE08h7fWHRje6uYOzITpqffCl43xVqQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Conor Dooley , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0269/1095] spi: Fix simplification of devm_spi_register_controller Date: Mon, 15 Aug 2022 19:54:28 +0200 Message-Id: <20220815180440.876024149@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit 43cc5a0afe4184a7fafe1eba32b5a11bb69c9ce0 ] This reverts commit 59ebbe40fb51 ("spi: simplify devm_spi_register_controller"). If devm_add_action() fails in devm_add_action_or_reset(), devm_spi_unregister() will be called, it decreases the refcount of 'ctlr->dev' to 0, then it will cause uaf in the drivers that calling spi_put_controller() in error path. Fixes: 59ebbe40fb51 ("spi: simplify devm_spi_register_controller") Signed-off-by: Yang Yingliang Reviewed-by: Conor Dooley Link: https://lore.kernel.org/r/20220712135504.1055688-1-yangyingliang@huaw= ei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/spi/spi.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index e1065768c537..6a8850e62078 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3068,9 +3068,9 @@ int spi_register_controller(struct spi_controller *ct= lr) } EXPORT_SYMBOL_GPL(spi_register_controller); =20 -static void devm_spi_unregister(void *ctlr) +static void devm_spi_unregister(struct device *dev, void *res) { - spi_unregister_controller(ctlr); + spi_unregister_controller(*(struct spi_controller **)res); } =20 /** @@ -3089,13 +3089,22 @@ static void devm_spi_unregister(void *ctlr) int devm_spi_register_controller(struct device *dev, struct spi_controller *ctlr) { + struct spi_controller **ptr; int ret; =20 + ptr =3D devres_alloc(devm_spi_unregister, sizeof(*ptr), GFP_KERNEL); + if (!ptr) + return -ENOMEM; + ret =3D spi_register_controller(ctlr); - if (ret) - return ret; + if (!ret) { + *ptr =3D ctlr; + devres_add(dev, ptr); + } else { + devres_free(ptr); + } =20 - return devm_add_action_or_reset(dev, devm_spi_unregister, ctlr); + return ret; } EXPORT_SYMBOL_GPL(devm_spi_register_controller); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B5BFC282E7 for ; Mon, 15 Aug 2022 20:52:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346083AbiHOUwH (ORCPT ); Mon, 15 Aug 2022 16:52:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344794AbiHOUuH (ORCPT ); Mon, 15 Aug 2022 16:50:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF612B941D; Mon, 15 Aug 2022 12:09:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D451860ACE; Mon, 15 Aug 2022 19:09:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE3B5C433D7; Mon, 15 Aug 2022 19:09:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590567; bh=/uKj4bZT2Rz2nPV+izWAzKndVaMfU7WxZb3+M0tctJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lhnZMuiURcUKhKWlhwRNlZMK/lkJQShhA9IC957u7Wb4pZaSD4T6s+pB3K8rDOocm oWreS3Mt5YgBCNty8CXJpgW/1dI6D+LuU8cjxJPA0XeH5gP0xiL/V9WzY2KFQ77hq1 NFeKjuR2aXxdqO3CCoWip/bdXWHg35mLustLui3U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0270/1095] spi: tegra20-slink: fix UAF in tegra_slink_remove() Date: Mon, 15 Aug 2022 19:54:29 +0200 Message-Id: <20220815180440.927393378@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit 7e9984d183bb1e99e766c5c2b950ff21f7f7b6c0 ] After calling spi_unregister_master(), the refcount of master will be decrease to 0, and it will be freed in spi_controller_release(), the device data also will be freed, so it will lead a UAF when using 'tspi'. To fix this, get the master before unregister and put it when finish using it. Fixes: 26c863418221 ("spi: tegra20-slink: Don't use resource-managed spi_re= gister helper") Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20220713094024.1508869-1-yangyingliang@huaw= ei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/spi/spi-tegra20-slink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slin= k.c index 80c3787deea9..c91c226be69e 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c @@ -1137,7 +1137,7 @@ static int tegra_slink_probe(struct platform_device *= pdev) =20 static int tegra_slink_remove(struct platform_device *pdev) { - struct spi_master *master =3D platform_get_drvdata(pdev); + struct spi_master *master =3D spi_master_get(platform_get_drvdata(pdev)); struct tegra_slink_data *tspi =3D spi_master_get_devdata(master); =20 spi_unregister_master(master); @@ -1152,6 +1152,7 @@ static int tegra_slink_remove(struct platform_device = *pdev) if (tspi->rx_dma_chan) tegra_slink_deinit_dma_param(tspi, true); =20 + spi_master_put(master); return 0; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B56CCC00140 for ; Mon, 15 Aug 2022 20:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344686AbiHOUp2 (ORCPT ); Mon, 15 Aug 2022 16:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347731AbiHOUnF (ORCPT ); Mon, 15 Aug 2022 16:43:05 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F5B7B2879; Mon, 15 Aug 2022 12:07:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id D37FBCE1082; Mon, 15 Aug 2022 19:07:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C52D6C433C1; Mon, 15 Aug 2022 19:07:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590472; bh=fCYDI+F88UGUTrDjbcNz8uPK++EHHjAD50nTwpOJZGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mPGVADW0QB9+owDFtgF8Kz8m3GEjF8dETJn0v5b9vIr6+EkqjjmhRmo5RxvookjtF BqV2d/uwPwBz+u3BIcBmkZGJso0obKDBERXfQZ86tC5Se6Za/tK+tJZp31H3pfrWQb EhwhpjoVH4RifZvErbsH/hCHMnGHgVDUA4dGFtd8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Armin Wolf , Hans de Goede , Guenter Roeck , Sasha Levin Subject: [PATCH 5.18 0271/1095] hwmon: (sch56xx-common) Add DMI override table Date: Mon, 15 Aug 2022 19:54:30 +0200 Message-Id: <20220815180440.967279788@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Armin Wolf [ Upstream commit fd2d53c367ae9983c2100ac733a834e0c79d7537 ] Some devices like the Fujitsu Celsius W380 do contain a working sch56xx hardware monitoring device, but do not contain the necessary DMI onboard device. Do not check for the presence of an suitable onboard device on these machines. The list of affected machines was created using data collected by the Linux Hardware Project. Tested on a Fujitsu Esprimo P720, but sadly not on a affected machine. Fixes: 393935baa45e (hwmon: (sch56xx-common) Add automatic module loading o= n supported devices) Signed-off-by: Armin Wolf Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20220604220200.2567-1-W_Armin@gmx.de Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hwmon/sch56xx-common.c | 44 ++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c index 3ece53adabd6..de3a0886c2f7 100644 --- a/drivers/hwmon/sch56xx-common.c +++ b/drivers/hwmon/sch56xx-common.c @@ -523,6 +523,28 @@ static int __init sch56xx_device_add(int address, cons= t char *name) return PTR_ERR_OR_ZERO(sch56xx_pdev); } =20 +static const struct dmi_system_id sch56xx_dmi_override_table[] __initconst= =3D { + { + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), + DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS W380"), + }, + }, + { + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), + DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO P710"), + }, + }, + { + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), + DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO E9900"), + }, + }, + { } +}; + /* For autoloading only */ static const struct dmi_system_id sch56xx_dmi_table[] __initconst =3D { { @@ -543,16 +565,18 @@ static int __init sch56xx_init(void) if (!dmi_check_system(sch56xx_dmi_table)) return -ENODEV; =20 - /* - * Some machines like the Esprimo P720 and Esprimo C700 have - * onboard devices named " Antiope"/" Theseus" instead of - * "Antiope"/"Theseus", so we need to check for both. - */ - if (!dmi_find_device(DMI_DEV_TYPE_OTHER, "Antiope", NULL) && - !dmi_find_device(DMI_DEV_TYPE_OTHER, " Antiope", NULL) && - !dmi_find_device(DMI_DEV_TYPE_OTHER, "Theseus", NULL) && - !dmi_find_device(DMI_DEV_TYPE_OTHER, " Theseus", NULL)) - return -ENODEV; + if (!dmi_check_system(sch56xx_dmi_override_table)) { + /* + * Some machines like the Esprimo P720 and Esprimo C700 have + * onboard devices named " Antiope"/" Theseus" instead of + * "Antiope"/"Theseus", so we need to check for both. + */ + if (!dmi_find_device(DMI_DEV_TYPE_OTHER, "Antiope", NULL) && + !dmi_find_device(DMI_DEV_TYPE_OTHER, " Antiope", NULL) && + !dmi_find_device(DMI_DEV_TYPE_OTHER, "Theseus", NULL) && + !dmi_find_device(DMI_DEV_TYPE_OTHER, " Theseus", NULL)) + return -ENODEV; + } } =20 /* --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C2C4C00140 for ; Mon, 15 Aug 2022 20:45:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345565AbiHOUo5 (ORCPT ); Mon, 15 Aug 2022 16:44:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347418AbiHOUms (ORCPT ); Mon, 15 Aug 2022 16:42:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22C1FB2D8C; Mon, 15 Aug 2022 12:07:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0BB0C61267; Mon, 15 Aug 2022 19:07:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8C0DC433D6; Mon, 15 Aug 2022 19:07:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590475; bh=IKW68nveAglgeNnym+vgT6nzaVOyqVoVUfARrjdeb+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y1wXMgnUvRo22haBHJ9aY6pCNbEebZT9uRL101UWsPcPjlOvXYOw2culHu6IVWcq/ z7FOYXqzYTRFfyKVf+vch+kwgiBf4rAYWJKP1DtOSdej3ePK6jhn4oi1mAwaLU+GjW AYmNky/fhL6EbAJKDoNNtUw1RTnyEBEFQw8HX4sU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Guenter Roeck , Sasha Levin Subject: [PATCH 5.18 0272/1095] hwmon: (drivetemp) Add module alias Date: Mon, 15 Aug 2022 19:54:31 +0200 Message-Id: <20220815180441.005801701@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij [ Upstream commit 5918036cfa8ded7aa8094db70295011ce2275447 ] Adding a MODULE_ALIAS() to drivetemp will make the driver easier for modprobe to autoprobe. Signed-off-by: Linus Walleij Link: https://lore.kernel.org/r/20220712214624.1845158-1-linus.walleij@lina= ro.org Fixes: 5b46903d8bf3 ("hwmon: Driver for disk and solid state drives with te= mperature sensors") Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hwmon/drivetemp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hwmon/drivetemp.c b/drivers/hwmon/drivetemp.c index 1eb37106a220..5bac2b0fc7bb 100644 --- a/drivers/hwmon/drivetemp.c +++ b/drivers/hwmon/drivetemp.c @@ -621,3 +621,4 @@ module_exit(drivetemp_exit); MODULE_AUTHOR("Guenter Roeck "); MODULE_DESCRIPTION("Hard drive temperature monitor"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:drivetemp"); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6540C00140 for ; Mon, 15 Aug 2022 20:45:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233313AbiHOUpT (ORCPT ); Mon, 15 Aug 2022 16:45:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347520AbiHOUmx (ORCPT ); Mon, 15 Aug 2022 16:42:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F5E9B3B3C; Mon, 15 Aug 2022 12:08:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A5287B81107; Mon, 15 Aug 2022 19:07:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05BE3C433C1; Mon, 15 Aug 2022 19:07:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590478; bh=4fhb2oIdanX65ZK+ytJhPxGiRtvlMXTbF5uBC4SK5Cg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C7XWL34Ya64m5V1zRTULeSy18uHFlmp0/Jz8u6V1yLp2Ov7aUyAerHlhjgoHuiUob uSELAWXcmt8BIKz27iMNEtMWeaKgnRMtzmPG3IE/GygKb9avY5X4EfB6Ib/GyVmWTo 9hYXSb+RohFcOvkQzpqzsvwpwG8deWXnydl1xq0w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Junichi Nomura , Mike Snitzer , Mike Christie , Li Zefan , Chaitanya Kulkarni , Bart Van Assche , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 0273/1095] blktrace: Trace remapped requests correctly Date: Mon, 15 Aug 2022 19:54:32 +0200 Message-Id: <20220815180441.043539071@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit 22c80aac882f712897b88b7ea8f5a74ea19019df ] Trace the remapped operation and its flags instead of only the data direction of remapped operations. This issue was detected by analyzing the warnings reported by sparse related to the new blk_opf_t type. Reviewed-by: Jun'ichi Nomura Cc: Mike Snitzer Cc: Mike Christie Cc: Li Zefan Cc: Chaitanya Kulkarni Fixes: 1b9a9ab78b0a ("blktrace: use op accessors") Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20220714180729.1065367-11-bvanassche@acm.org Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/trace/blktrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 4d5629196d01..f22219495541 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1059,7 +1059,7 @@ static void blk_add_trace_rq_remap(void *ignore, stru= ct request *rq, dev_t dev, r.sector_from =3D cpu_to_be64(from); =20 __blk_add_trace(bt, blk_rq_pos(rq), blk_rq_bytes(rq), - rq_data_dir(rq), 0, BLK_TA_REMAP, 0, + req_op(rq), rq->cmd_flags, BLK_TA_REMAP, 0, sizeof(r), &r, blk_trace_request_get_cgid(rq)); rcu_read_unlock(); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 902D9C00140 for ; Mon, 15 Aug 2022 20:46:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345204AbiHOUph (ORCPT ); Mon, 15 Aug 2022 16:45:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347730AbiHOUnF (ORCPT ); Mon, 15 Aug 2022 16:43:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EF64B276E; Mon, 15 Aug 2022 12:08:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D8FB2612D4; Mon, 15 Aug 2022 19:08:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A791AC433C1; Mon, 15 Aug 2022 19:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590482; bh=f2ZDIQR03Ul4WMl90N5wWSJrgIfPJ5LQWqEKoR7ldPo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G6qTJA4n/NZTxepLKBpsgyVxdRx9frFp/Ji1q2Z3Gx3HCiIvf3HCN2EWRL2ls3491 uEjmTlWUUzmkdGOkAkOBwPM+aPrqEdaSJ2u5kyS97bgtsKooN98e2cyr5BOBFUrDGd pf+7luojfFJCdw13j8tcVNzAewiE0zP2+nUZDmBc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hsin-Yi Wang , AngeloGioacchino Del Regno , Ulf Hansson , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 0274/1095] PM: domains: Ensure genpd_debugfs_dir exists before remove Date: Mon, 15 Aug 2022 19:54:33 +0200 Message-Id: <20220815180441.088467642@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hsin-Yi Wang [ Upstream commit 37101d3c719386040ded735a5ec06974f1d94d1f ] Both genpd_debug_add() and genpd_debug_remove() may be called indirectly by other drivers while genpd_debugfs_dir is not yet set. For example, drivers can call pm_genpd_init() in probe or pm_genpd_init() in probe fail/cleanup path: pm_genpd_init() --> genpd_debug_add() pm_genpd_remove() --> genpd_remove() --> genpd_debug_remove() At this time, genpd_debug_init() may not yet be called. genpd_debug_add() checks that if genpd_debugfs_dir is NULL, it will return directly. Make sure this is also checked in pm_genpd_remove(), otherwise components under debugfs root which has the same name as other components under pm_genpd may be accidentally removed, since NULL represents debugfs root. Fixes: 718072ceb211 ("PM: domains: create debugfs nodes when adding power d= omains") Signed-off-by: Hsin-Yi Wang Reviewed-by: Greg Kroah-Hartman Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Ulf Hansson Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/base/power/domain.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index f0e4b0ea93e8..59a706a126e5 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -219,6 +219,9 @@ static void genpd_debug_remove(struct generic_pm_domain= *genpd) { struct dentry *d; =20 + if (!genpd_debugfs_dir) + return; + d =3D debugfs_lookup(genpd->name, genpd_debugfs_dir); debugfs_remove(d); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85375C00140 for ; Mon, 15 Aug 2022 20:45:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344467AbiHOUpW (ORCPT ); Mon, 15 Aug 2022 16:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347686AbiHOUnD (ORCPT ); Mon, 15 Aug 2022 16:43:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A7CCB56C5; Mon, 15 Aug 2022 12:08:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B5A98B81062; Mon, 15 Aug 2022 19:08:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE8FBC433C1; Mon, 15 Aug 2022 19:08:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590485; bh=RJpMtkSYG/vXtAkOfRgXlbOp7ynizIaZM8ijsH0shiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QslqtIYRUkBewZbgB+JBPr1ED1tJPygrOmVuDK13eG0BjbJ/kYBYt0vqumMWzal6i AJCylFKoxSZ2u1skNaLy6Trvcn2dZzDcFGqEzGS/vkWq/VxZf9vc6apnO0pkEpmKCo rNn9OYdnznEOoPBH5NSY4TXjRv0z/aZQmHGgW6s0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.18 0275/1095] dm writecache: return void from functions Date: Mon, 15 Aug 2022 19:54:34 +0200 Message-Id: <20220815180441.138418446@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka [ Upstream commit 9bc0c92e4b82adb017026dbb2aa816b1ac2bef31 ] The functions writecache_map_remap_origin and writecache_bio_copy_ssd only return a single value, thus they can be made to return void. This helps simplify the following IO accounting changes. Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/md/dm-writecache.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index 5630b470ba42..688b6b3bcd7b 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -1328,8 +1328,8 @@ enum wc_map_op { WC_MAP_ERROR, }; =20 -static enum wc_map_op writecache_map_remap_origin(struct dm_writecache *wc= , struct bio *bio, - struct wc_entry *e) +static void writecache_map_remap_origin(struct dm_writecache *wc, struct b= io *bio, + struct wc_entry *e) { if (e) { sector_t next_boundary =3D @@ -1337,8 +1337,6 @@ static enum wc_map_op writecache_map_remap_origin(str= uct dm_writecache *wc, stru if (next_boundary < bio->bi_iter.bi_size >> SECTOR_SHIFT) dm_accept_partial_bio(bio, next_boundary); } - - return WC_MAP_REMAP_ORIGIN; } =20 static enum wc_map_op writecache_map_read(struct dm_writecache *wc, struct= bio *bio) @@ -1365,14 +1363,15 @@ static enum wc_map_op writecache_map_read(struct dm= _writecache *wc, struct bio * map_op =3D WC_MAP_REMAP; } } else { - map_op =3D writecache_map_remap_origin(wc, bio, e); + writecache_map_remap_origin(wc, bio, e); + map_op =3D WC_MAP_REMAP_ORIGIN; } =20 return map_op; } =20 -static enum wc_map_op writecache_bio_copy_ssd(struct dm_writecache *wc, st= ruct bio *bio, - struct wc_entry *e, bool search_used) +static void writecache_bio_copy_ssd(struct dm_writecache *wc, struct bio *= bio, + struct wc_entry *e, bool search_used) { unsigned bio_size =3D wc->block_size; sector_t start_cache_sec =3D cache_sector(wc, e); @@ -1418,8 +1417,6 @@ static enum wc_map_op writecache_bio_copy_ssd(struct = dm_writecache *wc, struct b } else { writecache_schedule_autocommit(wc); } - - return WC_MAP_REMAP; } =20 static enum wc_map_op writecache_map_write(struct dm_writecache *wc, struc= t bio *bio) @@ -1457,7 +1454,8 @@ static enum wc_map_op writecache_map_write(struct dm_= writecache *wc, struct bio direct_write: wc->stats.writes_around++; e =3D writecache_find_entry(wc, bio->bi_iter.bi_sector, WFE_RETURN_FOL= LOWING); - return writecache_map_remap_origin(wc, bio, e); + writecache_map_remap_origin(wc, bio, e); + return WC_MAP_REMAP_ORIGIN; } wc->stats.writes_blocked_on_freelist++; writecache_wait_on_freelist(wc); @@ -1468,10 +1466,12 @@ static enum wc_map_op writecache_map_write(struct d= m_writecache *wc, struct bio wc->uncommitted_blocks++; wc->stats.writes_allocate++; bio_copy: - if (WC_MODE_PMEM(wc)) + if (WC_MODE_PMEM(wc)) { bio_copy_block(wc, bio, memory_data(wc, e)); - else - return writecache_bio_copy_ssd(wc, bio, e, search_used); + } else { + writecache_bio_copy_ssd(wc, bio, e, search_used); + return WC_MAP_REMAP; + } } while (bio->bi_iter.bi_size); =20 if (unlikely(bio->bi_opf & REQ_FUA || wc->uncommitted_blocks >=3D wc->aut= ocommit_blocks)) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36955C00140 for ; Mon, 15 Aug 2022 20:47:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233389AbiHOUpk (ORCPT ); Mon, 15 Aug 2022 16:45:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347788AbiHOUnM (ORCPT ); Mon, 15 Aug 2022 16:43:12 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D14BB5E53; Mon, 15 Aug 2022 12:08:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 2276CCE10E7; Mon, 15 Aug 2022 19:08:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E905AC433D6; Mon, 15 Aug 2022 19:08:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590488; bh=KdT6OdPtJ0WC0bsnZs/Ssa740D193ke143bebXcN3r4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UHzSWUXhn3QvA/HoPmseQO0N0ZZxuM4iQNR955aIBjBly9eanxg8Qr49MzqDr2mGu phBaEumIfnzO3+GWvMs6c2VqVIDQbMYJtyiHXTh3zfnBXPJoLej9m7IvG9CFyjX4Jt 0hofN3+Rfo9ru8z3WK5XxeXVqcpLnoCuLv7jZ2sY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.18 0276/1095] dm writecache: count number of blocks read, not number of read bios Date: Mon, 15 Aug 2022 19:54:35 +0200 Message-Id: <20220815180441.187748615@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka [ Upstream commit 2c6e755b49d273243431f5f1184654e71221fc78 ] Change dm-writecache, so that it counts the number of blocks read instead of the number of read bios. Bios can be split and requeued using the dm_accept_partial_bio function, so counting bios caused inaccurate results. Fixes: e3a35d03407c ("dm writecache: add event counters") Reported-by: Yu Kuai Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- Documentation/admin-guide/device-mapper/writecache.rst | 4 ++-- drivers/md/dm-writecache.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/device-mapper/writecache.rst b/Docum= entation/admin-guide/device-mapper/writecache.rst index 10429779a91a..7bead3b52690 100644 --- a/Documentation/admin-guide/device-mapper/writecache.rst +++ b/Documentation/admin-guide/device-mapper/writecache.rst @@ -78,8 +78,8 @@ Status: 2. the number of blocks 3. the number of free blocks 4. the number of blocks under writeback -5. the number of read requests -6. the number of read requests that hit the cache +5. the number of read blocks +6. the number of read blocks that hit the cache 7. the number of write requests 8. the number of write requests that hit uncommitted block 9. the number of write requests that hit committed block diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index 688b6b3bcd7b..3bec493cccb2 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -1364,6 +1364,7 @@ static enum wc_map_op writecache_map_read(struct dm_w= ritecache *wc, struct bio * } } else { writecache_map_remap_origin(wc, bio, e); + wc->stats.reads +=3D (bio->bi_iter.bi_size - wc->block_size) >> wc->bloc= k_size_bits; map_op =3D WC_MAP_REMAP_ORIGIN; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9834C3F6B0 for ; Mon, 15 Aug 2022 20:46:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345097AbiHOUqz (ORCPT ); Mon, 15 Aug 2022 16:46:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345464AbiHOUn4 (ORCPT ); Mon, 15 Aug 2022 16:43:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 887FCB5E67; Mon, 15 Aug 2022 12:08:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9EBF3B8107A; Mon, 15 Aug 2022 19:08:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E28F5C433C1; Mon, 15 Aug 2022 19:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590491; bh=rbSoHySHO4jMvEXKq37KUby7dmBgoSKFMYmjaT4M5W8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kvmdbwP5THZqeziZMQAPDFHtUTkWTBNctBiD0sxagHJaSykEYDB/OXe8tGfUPSznI TQBA28XOMQSF7rQBWXFV6fDE7PAHaG1K0KBLX23/LHAQ9H2X5UOydrQTanDVdr0hO+ Q6VANwE8tO+L1NSSoPhhsa4bbBZJk7Yhf8GiYAPY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.18 0277/1095] dm writecache: count number of blocks written, not number of write bios Date: Mon, 15 Aug 2022 19:54:36 +0200 Message-Id: <20220815180441.230632036@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka [ Upstream commit b2676e1482af89714af6988ce5d31a84692e2530 ] Change dm-writecache, so that it counts the number of blocks written instead of the number of write bios. Bios can be split and requeued using the dm_accept_partial_bio function, so counting bios caused inaccurate results. Fixes: e3a35d03407c ("dm writecache: add event counters") Reported-by: Yu Kuai Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../admin-guide/device-mapper/writecache.rst | 10 +++++----- drivers/md/dm-writecache.c | 12 +++++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Documentation/admin-guide/device-mapper/writecache.rst b/Docum= entation/admin-guide/device-mapper/writecache.rst index 7bead3b52690..6c9a2c74df8a 100644 --- a/Documentation/admin-guide/device-mapper/writecache.rst +++ b/Documentation/admin-guide/device-mapper/writecache.rst @@ -80,11 +80,11 @@ Status: 4. the number of blocks under writeback 5. the number of read blocks 6. the number of read blocks that hit the cache -7. the number of write requests -8. the number of write requests that hit uncommitted block -9. the number of write requests that hit committed block -10. the number of write requests that bypass the cache -11. the number of write requests that are allocated in the cache +7. the number of write blocks +8. the number of write blocks that hit uncommitted block +9. the number of write blocks that hit committed block +10. the number of write blocks that bypass the cache +11. the number of write blocks that are allocated in the cache 12. the number of write requests that are blocked on the freelist 13. the number of flush requests 14. the number of discard requests diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index 3bec493cccb2..98df6327990a 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -1412,6 +1412,9 @@ static void writecache_bio_copy_ssd(struct dm_writeca= che *wc, struct bio *bio, bio->bi_iter.bi_sector =3D start_cache_sec; dm_accept_partial_bio(bio, bio_size >> SECTOR_SHIFT); =20 + wc->stats.writes +=3D bio->bi_iter.bi_size >> wc->block_size_bits; + wc->stats.writes_allocate +=3D (bio->bi_iter.bi_size - wc->block_size) >>= wc->block_size_bits; + if (unlikely(wc->uncommitted_blocks >=3D wc->autocommit_blocks)) { wc->uncommitted_blocks =3D 0; queue_work(wc->writeback_wq, &wc->flush_work); @@ -1427,9 +1430,10 @@ static enum wc_map_op writecache_map_write(struct dm= _writecache *wc, struct bio do { bool found_entry =3D false; bool search_used =3D false; - wc->stats.writes++; - if (writecache_has_error(wc)) + if (writecache_has_error(wc)) { + wc->stats.writes +=3D bio->bi_iter.bi_size >> wc->block_size_bits; return WC_MAP_ERROR; + } e =3D writecache_find_entry(wc, bio->bi_iter.bi_sector, 0); if (e) { if (!writecache_entry_is_committed(wc, e)) { @@ -1453,9 +1457,10 @@ static enum wc_map_op writecache_map_write(struct dm= _writecache *wc, struct bio if (unlikely(!e)) { if (!WC_MODE_PMEM(wc) && !found_entry) { direct_write: - wc->stats.writes_around++; e =3D writecache_find_entry(wc, bio->bi_iter.bi_sector, WFE_RETURN_FOL= LOWING); writecache_map_remap_origin(wc, bio, e); + wc->stats.writes_around +=3D bio->bi_iter.bi_size >> wc->block_size_bi= ts; + wc->stats.writes +=3D bio->bi_iter.bi_size >> wc->block_size_bits; return WC_MAP_REMAP_ORIGIN; } wc->stats.writes_blocked_on_freelist++; @@ -1469,6 +1474,7 @@ static enum wc_map_op writecache_map_write(struct dm_= writecache *wc, struct bio bio_copy: if (WC_MODE_PMEM(wc)) { bio_copy_block(wc, bio, memory_data(wc, e)); + wc->stats.writes++; } else { writecache_bio_copy_ssd(wc, bio, e, search_used); return WC_MAP_REMAP; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2E07C00140 for ; Mon, 15 Aug 2022 20:47:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346082AbiHOUrY (ORCPT ); Mon, 15 Aug 2022 16:47:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344933AbiHOUpa (ORCPT ); Mon, 15 Aug 2022 16:45:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75C9BB5E7E; Mon, 15 Aug 2022 12:08:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CB3BDB81106; Mon, 15 Aug 2022 19:08:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19853C433C1; Mon, 15 Aug 2022 19:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590494; bh=VgMoTdeM27KVRPXO4E7YPhY2Lw8hSEWmBEss6I8f9bw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zkuzDjsflpkzmchny+a8FdG8ff9zXnCAQzepkIsmDl8w16QQPWiD+h5QdTK5h9cjB kByDvqVGOIGvRksUoFCbkcZJdZZL7kMAVd7UKlRihtb4cI7wEohig3ZLNH3y1RbBPP Z+MPBraf3h+HcKfHrVIBizPyFXR7tAk1CUAmc+YY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.18 0278/1095] dm writecache: count number of blocks discarded, not number of discard bios Date: Mon, 15 Aug 2022 19:54:37 +0200 Message-Id: <20220815180441.281543770@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka [ Upstream commit 2ee73ef60db4d79b9f9b8cd501e8188b5179449f ] Change dm-writecache, so that it counts the number of blocks discarded instead of the number of discard bios. Make it consistent with the read and write statistics counters that were changed to count the number of blocks instead of bios. Fixes: e3a35d03407c ("dm writecache: add event counters") Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- Documentation/admin-guide/device-mapper/writecache.rst | 2 +- drivers/md/dm-writecache.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/device-mapper/writecache.rst b/Docum= entation/admin-guide/device-mapper/writecache.rst index 6c9a2c74df8a..724e028d1858 100644 --- a/Documentation/admin-guide/device-mapper/writecache.rst +++ b/Documentation/admin-guide/device-mapper/writecache.rst @@ -87,7 +87,7 @@ Status: 11. the number of write blocks that are allocated in the cache 12. the number of write requests that are blocked on the freelist 13. the number of flush requests -14. the number of discard requests +14. the number of discarded blocks =20 Messages: flush diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index 98df6327990a..e5acb393f70b 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -1513,7 +1513,7 @@ static enum wc_map_op writecache_map_flush(struct dm_= writecache *wc, struct bio =20 static enum wc_map_op writecache_map_discard(struct dm_writecache *wc, str= uct bio *bio) { - wc->stats.discards++; + wc->stats.discards +=3D bio->bi_iter.bi_size >> wc->block_size_bits; =20 if (writecache_has_error(wc)) return WC_MAP_ERROR; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49772C00140 for ; Mon, 15 Aug 2022 20:47:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345571AbiHOUrB (ORCPT ); Mon, 15 Aug 2022 16:47:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345694AbiHOUo3 (ORCPT ); Mon, 15 Aug 2022 16:44:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D800EB6016; Mon, 15 Aug 2022 12:08:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B52386069F; Mon, 15 Aug 2022 19:08:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DA92C4314C; Mon, 15 Aug 2022 19:08:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590498; bh=rO6j8LMjktGpC8KRSmNNYA45x/kxmmEIE5Y/UjH+cug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SlBUa6fT6v2913QBWofRH8bPIwWHT8a5uQjz8bTu4FGrlSZahFinn48wu00pkJ0bb yL0UBOMyYdGb7m4qcmfr2ZeaQGerm4KooK81McJWy8eDmU64EBZHKWhAyyXggakp/i KOUFLxKuBGUbaOKpJhit3iE9VTN4v0fby4Sx2ILM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0279/1095] regulator: of: Fix refcount leak bug in of_get_regulation_constraints() Date: Mon, 15 Aug 2022 19:54:38 +0200 Message-Id: <20220815180441.317863224@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 66efb665cd5ad69b27dca8571bf89fc6b9c628a4 ] We should call the of_node_put() for the reference returned by of_get_child_by_name() which has increased the refcount. Fixes: 40e20d68bb3f ("regulator: of: Add support for parsing regulator_stat= e for suspend state") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220715111027.391032-1-windhl@126.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/regulator/of_regulator.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regula= tor.c index f54d4f176882..e12b681c72e5 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -264,8 +264,12 @@ static int of_get_regulation_constraints(struct device= *dev, } =20 suspend_np =3D of_get_child_by_name(np, regulator_states[i]); - if (!suspend_np || !suspend_state) + if (!suspend_np) continue; + if (!suspend_state) { + of_node_put(suspend_np); + continue; + } =20 if (!of_property_read_u32(suspend_np, "regulator-mode", &pval)) { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27212C00140 for ; Mon, 15 Aug 2022 20:47:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345658AbiHOUrF (ORCPT ); Mon, 15 Aug 2022 16:47:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345228AbiHOUoq (ORCPT ); Mon, 15 Aug 2022 16:44:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07C46B603A; Mon, 15 Aug 2022 12:08:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4945BB81104; Mon, 15 Aug 2022 19:08:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86968C433D6; Mon, 15 Aug 2022 19:08:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590500; bh=UVGljkG5EKmxr9mq0ibBIU6gvDealofYMdBg/P96AB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wKNwSfrlDQyzOHgcwxTBR/l+P215j1b8pApinrDuRiVmbFtts+/IdgQ24ag5qb1g0 52q4bY7+KsE0oP5saUNHJX1qN5kPUWTDaPIqmQ4EC5yxnZ2/HRWcaN8Gp5FvPdSDhM va/yYT41Z/GLXPxg3J6RmwjYKXteV4G/KCrgGMlM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0280/1095] soc: qcom: Make QCOM_RPMPD depend on PM Date: Mon, 15 Aug 2022 19:54:39 +0200 Message-Id: <20220815180441.363580949@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Konrad Dybcio [ Upstream commit a6232f2aa99ce470799992e99e0012945bb5308f ] QCOM_RPMPD requires PM_GENERIC_DOMAINS/_OF, which in turns requires CONFIG_PM. I forgot about the latter in my earlier patch (it's still in -next as of the time of committing, hence no Fixes: tag). Fix it. Reported-by: kernel test robot Signed-off-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220707212158.32684-1-konrad.dybcio@somain= line.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/soc/qcom/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index e718b8735444..4472fb22ba04 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -129,6 +129,7 @@ config QCOM_RPMHPD =20 config QCOM_RPMPD tristate "Qualcomm RPM Power domain driver" + depends on PM depends on QCOM_SMD_RPM help QCOM RPM Power domain driver to support power-domains with --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94530C25B08 for ; Mon, 15 Aug 2022 20:47:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346038AbiHOUrS (ORCPT ); Mon, 15 Aug 2022 16:47:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345977AbiHOUpQ (ORCPT ); Mon, 15 Aug 2022 16:45:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DCD4B69F0; Mon, 15 Aug 2022 12:08:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 12179B810A3; Mon, 15 Aug 2022 19:08:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59607C433C1; Mon, 15 Aug 2022 19:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590506; bh=7+4TTr1XgtVkKwsjolZt4mKrV4XkFbm+qewfYpPUtQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zOyojdbeTtl0ETxdJHm7z0pIxdZAGaQHaxA+kB9Uo2u9BvDTYnmaNp2Mt4QzPJmMQ Q73H/JevF5WyzJALoeD2XjQzFUXPjVJvOSN+1VSPLxaTa6000G9CrFXzAkj8bXLE+p MFVEquh3Mj3d/eBxdt6Fs9jYQkjCbvO4vc6yCZkE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Parikshit Pareek , Eric Chanudet , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0281/1095] soc: qcom: socinfo: Fix the id of SA8540P SoC Date: Mon, 15 Aug 2022 19:54:40 +0200 Message-Id: <20220815180441.409785368@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Parikshit Pareek [ Upstream commit 5bed21af0005cc7d8bb05d2c4a63afbcede23382 ] Change the id of SA8540P to its correct value, i.e., 461. Also, map the id 460 to its correct values, i.e. SA8295P. Fixes: 76ee15ae1b13 ("soc: qcom: socinfo: Add some more PMICs and SoCs") Signed-off-by: Parikshit Pareek Reviewed-by: Eric Chanudet Tested-by: Eric Chanudet Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220711083957.12091-1-quic_ppareek@quicinc= .com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/soc/qcom/socinfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index 8b38d134720a..f6879983da69 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -328,7 +328,8 @@ static const struct soc_id soc_id[] =3D { { 455, "QRB5165" }, { 457, "SM8450" }, { 459, "SM7225" }, - { 460, "SA8540P" }, + { 460, "SA8295P" }, + { 461, "SA8540P" }, { 480, "SM8450" }, }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C12A8C00140 for ; Mon, 15 Aug 2022 20:47:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345966AbiHOUrM (ORCPT ); Mon, 15 Aug 2022 16:47:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344556AbiHOUpR (ORCPT ); Mon, 15 Aug 2022 16:45:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79A43B69FA; Mon, 15 Aug 2022 12:08:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 66583601BF; Mon, 15 Aug 2022 19:08:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D504C433D6; Mon, 15 Aug 2022 19:08:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590509; bh=RyfyMD2avYPrcXzgnjWluHibnunGgUa10wADbejMdW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zDB6zkXY8xoFsHZ12BT3WO2/nGU53PVAvHNENiwkIQrmFEyMjrAhuTa7xUZj2xvR2 nwQydnPJrqF9BIxNkZ3NbyRlJzXMyRrHNABhRtW5AjRSzV30nu1YYTvlPH8kVjoxYF 8+wqhO5pG8kJGZelSvoVwm1RpIVeThqPTqZ574Ow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Marijn Suijten , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0282/1095] arm64: dts: qcom: msm8998: Make regulator voltages multiple of step-size Date: Mon, 15 Aug 2022 19:54:41 +0200 Message-Id: <20220815180441.446306699@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marijn Suijten [ Upstream commit 2aa54fa87cca1fa43870a9caf4fcce00eb087fa5 ] These voltages are not a multiple of the given step-size 8000 (with base voltage 1664000) in pm8998_pldo, resulting in PLDO regulators l18 and l22 failing to validate and in turn not probing the rpm-pm8998-regulator driver: l18: unsupportable voltage constraints 2856000-2848000uV qcom_rpm_smd_regulator rpm-glink:rpm-requests:pm8998-regulators: l18: d= evm_regulator_register() failed, ret=3D-22 Round the voltages down for the sake of erring on the safe side, leaving a comment in place to document this discrepancy wrt downstream sources. Fixes: 390883af89d2 ("arm64: dts: qcom: msm8998: Introduce support for Sony= Yoshino platform") Reported-by: Konrad Dybcio Signed-off-by: Marijn Suijten Reviewed-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220507153627.1478268-1-marijn.suijten@som= ainline.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../dts/qcom/msm8998-sony-xperia-yoshino-poplar.dts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/msm8998-sony-xperia-yoshino-poplar.dt= s b/arch/arm64/boot/dts/qcom/msm8998-sony-xperia-yoshino-poplar.dts index 4a1f98a21031..c21333aa73c2 100644 --- a/arch/arm64/boot/dts/qcom/msm8998-sony-xperia-yoshino-poplar.dts +++ b/arch/arm64/boot/dts/qcom/msm8998-sony-xperia-yoshino-poplar.dts @@ -26,11 +26,13 @@ &lab { }; =20 &vreg_l18a_2p85 { - regulator-min-microvolt =3D <2850000>; - regulator-max-microvolt =3D <2850000>; + /* Note: Round-down from 2850000 to be a multiple of PLDO step-size 8000 = */ + regulator-min-microvolt =3D <2848000>; + regulator-max-microvolt =3D <2848000>; }; =20 &vreg_l22a_2p85 { - regulator-min-microvolt =3D <2700000>; - regulator-max-microvolt =3D <2700000>; + /* Note: Round-down from 2700000 to be a multiple of PLDO step-size 8000 = */ + regulator-min-microvolt =3D <2696000>; + regulator-max-microvolt =3D <2696000>; }; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3C41C00140 for ; Mon, 15 Aug 2022 20:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346285AbiHOUrd (ORCPT ); Mon, 15 Aug 2022 16:47:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346553AbiHOUqY (ORCPT ); Mon, 15 Aug 2022 16:46:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80871B69D6; Mon, 15 Aug 2022 12:08:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5C93FB81109; Mon, 15 Aug 2022 19:08:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BED6C433C1; Mon, 15 Aug 2022 19:08:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590513; bh=AqWw4NkX98xkqBjylREhBx6pgKkIJpx7teXTXimUm/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y9xkU811CY2W6gqk3nGGRbOHXmzFBk7MMtbGbRAk25rdn1IXFzDWouQtC0dzkRdHz m7vAd4RbEBpNkKje44Ux3Q77Sq5D7bKuueM2xl36AGuoPqi14MW3mC/p3Mwu9YiqP6 zxmGG6z09EWD6Ce6qCLtNHbwFkIdtPoiRzSwZ5g4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sumit Garg , Daniel Thompson , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0283/1095] arm64: dts: qcom: qcs404: Fix incorrect USB2 PHYs assignment Date: Mon, 15 Aug 2022 19:54:42 +0200 Message-Id: <20220815180441.489375888@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sumit Garg [ Upstream commit 58577966a42fc0b660b5e2c7c9e5a2241363ea83 ] Currently the DT for QCS404 SoC has setup for 2 USB2 PHYs with one each assigned to USB3 controller and USB2 controller. This assignment is incorrect which only works by luck: as when each USB HCI comes up it configures the *other* controllers PHY which is enough to make them happy. If, for any reason, we were to disable one of the controllers then both would stop working. This was a difficult inconsistency to be caught which was found while trying to enable USB support in u-boot. So with all the required drivers ported to u-boot, I couldn't get the same USB storage device enumerated in u-boot which was being enumerated fine by the kernel. The root cause of the problem came out to be that I wasn't enabling USB2 PHY: "usb2_phy_prim" in u-boot. Then I realised that via simply disabling the same USB2 PHY currently assigned to USB2 host controller in the kernel disabled enumeration for USB3 host controller as well. So fix this inconsistency by correctly assigning USB2 PHYs. Fixes: 9375e7d719b3 ("arm64: dts: qcom: qcs404: Add USB devices and PHYs") Signed-off-by: Sumit Garg Reviewed-by: Daniel Thompson Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220711083038.1518529-1-sumit.garg@linaro.= org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/qcs404.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qco= m/qcs404.dtsi index 3f06f7cd3cf2..65d71adee345 100644 --- a/arch/arm64/boot/dts/qcom/qcs404.dtsi +++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi @@ -548,7 +548,7 @@ dwc3@7580000 { compatible =3D "snps,dwc3"; reg =3D <0x07580000 0xcd00>; interrupts =3D ; - phys =3D <&usb2_phy_sec>, <&usb3_phy>; + phys =3D <&usb2_phy_prim>, <&usb3_phy>; phy-names =3D "usb2-phy", "usb3-phy"; snps,has-lpm-erratum; snps,hird-threshold =3D /bits/ 8 <0x10>; @@ -577,7 +577,7 @@ dwc3@78c0000 { compatible =3D "snps,dwc3"; reg =3D <0x078c0000 0xcc00>; interrupts =3D ; - phys =3D <&usb2_phy_prim>; + phys =3D <&usb2_phy_sec>; phy-names =3D "usb2-phy"; snps,has-lpm-erratum; snps,hird-threshold =3D /bits/ 8 <0x10>; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B29AEC25B08 for ; Mon, 15 Aug 2022 20:47:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346530AbiHOUrh (ORCPT ); Mon, 15 Aug 2022 16:47:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346739AbiHOUqj (ORCPT ); Mon, 15 Aug 2022 16:46:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 499E3B6D35; Mon, 15 Aug 2022 12:08:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D86C2606A1; Mon, 15 Aug 2022 19:08:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C21E9C433D6; Mon, 15 Aug 2022 19:08:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590516; bh=S479fwfCAHX9xtmUdxRoDRXhSxE0n2j7OXnPombf3gM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=npAJCvbAWoh1pN1V1kQVkqF3Mz6jM0k524g52OeLW2mTT+hH4WRLsmhAocuQK7RfC 8TR/OXHDkQaZ4nxipQy1oPFv33K9zrCO/P9rFNaw7jVLjFqr3wFh7fcJFl/J2qi9/U VCTAOJAWddRqnNnHs12tdWv0TAfO7i9/ga24WH0U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luca Weiss , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0284/1095] ARM: dts: qcom: msm8974-FP2: Add supplies for remoteprocs Date: Mon, 15 Aug 2022 19:54:43 +0200 Message-Id: <20220815180441.533759595@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luca Weiss [ Upstream commit fb5e339fb1bc9eb7f34b341d995e4ab39c03588e ] Those were removed from msm8974.dtsi as part of a recent cleanup commit, so add them back for FP2. Signed-off-by: Luca Weiss Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220421214243.352469-3-luca@z3ntu.xyz Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts b/arch/arm/bo= ot/dts/qcom-msm8974-fairphone-fp2.dts index d6799a1b820b..32975f56f896 100644 --- a/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts +++ b/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts @@ -131,6 +131,17 @@ wcnss { }; }; =20 +&remoteproc_adsp { + cx-supply =3D <&pm8841_s2>; +}; + +&remoteproc_mss { + cx-supply =3D <&pm8841_s2>; + mss-supply =3D <&pm8841_s3>; + mx-supply =3D <&pm8841_s1>; + pll-supply =3D <&pm8941_l12>; +}; + &rpm_requests { pm8841-regulators { compatible =3D "qcom,rpm-pm8841-regulators"; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DBA8C00140 for ; Mon, 15 Aug 2022 20:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346589AbiHOUrs (ORCPT ); Mon, 15 Aug 2022 16:47:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346769AbiHOUqk (ORCPT ); Mon, 15 Aug 2022 16:46:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 517CEB7296; Mon, 15 Aug 2022 12:08:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 45ABD6077B; Mon, 15 Aug 2022 19:08:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DC1AC433D6; Mon, 15 Aug 2022 19:08:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590519; bh=mq+CtN7rPgtSlZEf05FUxvje3ElW+F118U2FUc+iF8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ofZqYMqaKvOAAiWLrYfS2nvQmEfXrUpqID0yzvVpTHzlNKxTacEh8K3LuTkHRRkyO DijhdwVh2JFf46wncWsribDppE+NbqmTqqZm9xoSh6XSuyzZ6R2lWCWZJ5v0b6kVHn TJJEFdlSiti56Y0BS0nkzb6U9TUiQ/THxjpS8ESo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luca Weiss , Konrad Dybcio , Stephan Gerhold , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0285/1095] ARM: dts: qcom: msm8974: Disable remoteprocs by default Date: Mon, 15 Aug 2022 19:54:44 +0200 Message-Id: <20220815180441.583050835@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephan Gerhold [ Upstream commit 8d8be8dd7c1f5d50f84ecc7a6a41962da48c6164 ] The remoteproc configuration in qcom-msm8974.dtsi is incomplete because it lacks the regulator supplies that should be added in the board DT files. Some of the msm8974 boards are currently missing the regulator supplies and should have the remoteprocs disabled to avoid making use of the incomplete configuration. This also fixes dtbs_check warnings after moving "qcom,msm8974-mss-pil" to DT schema, which rightfully complains that the -supply properties are missing for some boards: qcom-apq8074-dragonboard.dtb: remoteproc@fc880000: 'pll-supply' is a required property From schema: remoteproc/qcom,msm8916-mss-pil.yaml remoteproc@fc880000: 'mss-supply' is a required property From schema: remoteproc/qcom,msm8916-mss-pil.yaml remoteproc@fc880000: 'oneOf' conditional failed, one must be fixed: 'power-domains' is a required property 'power-domain-names' is a required property, or 'cx-supply' is a required property 'mx-supply' is a required property Cc: Luca Weiss Cc: Konrad Dybcio Fixes: f300826d27be ("ARM: dts: qcom-msm8974: Sort and clean up nodes") Signed-off-by: Stephan Gerhold Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220712124421.3129206-4-stephan.gerhold@ke= rnkonzept.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts | 2 ++ arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts | 2 ++ arch/arm/boot/dts/qcom-msm8974.dtsi | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts b/arch/arm/bo= ot/dts/qcom-msm8974-fairphone-fp2.dts index 32975f56f896..085591183592 100644 --- a/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts +++ b/arch/arm/boot/dts/qcom-msm8974-fairphone-fp2.dts @@ -132,10 +132,12 @@ wcnss { }; =20 &remoteproc_adsp { + status =3D "okay"; cx-supply =3D <&pm8841_s2>; }; =20 &remoteproc_mss { + status =3D "okay"; cx-supply =3D <&pm8841_s2>; mss-supply =3D <&pm8841_s3>; mx-supply =3D <&pm8841_s1>; diff --git a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts b/arch/arm/boo= t/dts/qcom-msm8974-samsung-klte.dts index 3b1ea8c24f57..9ef5a68747f1 100644 --- a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +++ b/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts @@ -467,10 +467,12 @@ fuelgauge_pin: fuelgauge-int-pin { }; =20 &remoteproc_adsp { + status =3D "okay"; cx-supply =3D <&pma8084_s2>; }; =20 &remoteproc_mss { + status =3D "okay"; cx-supply =3D <&pma8084_s2>; mss-supply =3D <&pma8084_s6>; mx-supply =3D <&pma8084_s1>; diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-m= sm8974.dtsi index 7a25d313e4fb..05a36566bd52 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -1150,6 +1150,8 @@ remoteproc_mss: remoteproc@fc880000 { qcom,smem-states =3D <&modem_smp2p_out 0>; qcom,smem-state-names =3D "stop"; =20 + status =3D "disabled"; + mba { memory-region =3D <&mba_region>; }; @@ -1401,6 +1403,8 @@ remoteproc_adsp: remoteproc@fe200000 { qcom,smem-states =3D <&adsp_smp2p_out 0>; qcom,smem-state-names =3D "stop"; =20 + status =3D "disabled"; + smd-edge { interrupts =3D ; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 361B9C25B0E for ; Mon, 15 Aug 2022 20:48:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346322AbiHOUsH (ORCPT ); Mon, 15 Aug 2022 16:48:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346890AbiHOUqs (ORCPT ); Mon, 15 Aug 2022 16:46:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6C6BB72B0; Mon, 15 Aug 2022 12:08:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9F2E160B0F; Mon, 15 Aug 2022 19:08:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 593CFC433C1; Mon, 15 Aug 2022 19:08:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590523; bh=N9TJ94ZoPUoNsloQHfrpn0GyEU2bxkyC7I82FkaGEUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oWI+EoLdVadgnG349ZNHflt2Q8QNiagpJ3UmorDedCRm5cJdF61OMYjMy3j0nvzlE Nyd+M6yUGEW/xdI8bkJ0OOx1JP/Gol1aiq9BdhE7lbvaB4j58PWcJFuOxpdcsVKbPN ywQAaOh3Wie+1tAOnbo19OueRgzFpEcrNGUQrCx8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xu Qiang , Marc Zyngier , Sasha Levin Subject: [PATCH 5.18 0286/1095] irqdomain: Report irq number for NOMAP domains Date: Mon, 15 Aug 2022 19:54:45 +0200 Message-Id: <20220815180441.621576748@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xu Qiang [ Upstream commit 6f194c99f466147148cc08452718b46664112548 ] When using a NOMAP domain, __irq_resolve_mapping() doesn't store the Linux IRQ number at the address optionally provided by the caller. While this isn't a huge deal (the returned value is guaranteed to the hwirq that was passed as a parameter), let's honour the letter of the API by writing the expected value. Fixes: d22558dd0a6c (=E2=80=9Cirqdomain: Introduce irq_resolve_mapping()=E2= =80=9D) Signed-off-by: Xu Qiang [maz: commit message] Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220719063641.56541-2-xuqiang36@huawei.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/irq/irqdomain.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index d5ce96510549..481abb885d61 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -910,6 +910,8 @@ struct irq_desc *__irq_resolve_mapping(struct irq_domai= n *domain, data =3D irq_domain_get_irq_data(domain, hwirq); if (data && data->hwirq =3D=3D hwirq) desc =3D irq_data_to_desc(data); + if (irq && desc) + *irq =3D hwirq; } =20 return desc; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62338C00140 for ; Mon, 15 Aug 2022 20:48:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345995AbiHOUsZ (ORCPT ); Mon, 15 Aug 2022 16:48:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345597AbiHOUrC (ORCPT ); Mon, 15 Aug 2022 16:47:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95449B7ED4; Mon, 15 Aug 2022 12:08:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4889960ACE; Mon, 15 Aug 2022 19:08:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B644DC4314E; Mon, 15 Aug 2022 19:08:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590526; bh=e2sA2q9BXuqDigMphbszovvhi7P2aY88fo3nVbXcMPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H+foGp0D1BLdMd3Fqy+FFdqUuttC5g1aYliAkoNRWVj67ZLLVHGTh2YDvg86kw8bv byjgAj5jamIu7Tnw6rcLxqYt05x6YEyNjqX4C5Twf/AMY+U2hTPFv0RcOPo0FaTkSq iJgdFrd/yGvopJVjMV1FcVI/ur19VSlGpBcwgXUY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Atish Patra , Andrew Jones , Will Deacon , Sasha Levin Subject: [PATCH 5.18 0287/1095] perf: RISC-V: Add of_node_put() when breaking out of for_each_of_cpu_node() Date: Mon, 15 Aug 2022 19:54:46 +0200 Message-Id: <20220815180441.663955223@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 491f10d08fdae10a177edf6af4f43b83b293114b ] In pmu_sbi_setup_irqs(), we should call of_node_put() for the 'cpu' when breaking out of for_each_of_cput_node() as its refcount will be automatically increased and decreased during the iteration. Fixes: 4905ec2fb7e6 ("RISC-V: Add sscofpmf extension support") Signed-off-by: Liang He Reviewed-by: Atish Patra Reviewed-by: Andrew Jones Link: https://lore.kernel.org/r/20220715130330.443363-1-windhl@126.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/perf/riscv_pmu_sbi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c index fab0dd497393..77b826d6c05b 100644 --- a/drivers/perf/riscv_pmu_sbi.c +++ b/drivers/perf/riscv_pmu_sbi.c @@ -682,12 +682,15 @@ static int pmu_sbi_setup_irqs(struct riscv_pmu *pmu, = struct platform_device *pde child =3D of_get_compatible_child(cpu, "riscv,cpu-intc"); if (!child) { pr_err("Failed to find INTC node\n"); + of_node_put(cpu); return -ENODEV; } domain =3D irq_find_host(child); of_node_put(child); - if (domain) + if (domain) { + of_node_put(cpu); break; + } } if (!domain) { pr_err("Failed to find INTC IRQ root domain\n"); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5D00C00140 for ; Mon, 15 Aug 2022 20:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346005AbiHOUsv (ORCPT ); Mon, 15 Aug 2022 16:48:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346083AbiHOUr0 (ORCPT ); Mon, 15 Aug 2022 16:47:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 455F5B81D3; Mon, 15 Aug 2022 12:08:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D78E960693; Mon, 15 Aug 2022 19:08:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5469C433C1; Mon, 15 Aug 2022 19:08:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590530; bh=++qsWt1DL6oWKd3JaboveuwvHLNQYA78aUrwPZqxMDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eKsb1rpA9KmpG4M3eNE55p5GI4RYIpfrokBoxU3njKlnxwMJez6IFb44wbikI3W7u p97SmmnUVrdqhkP6KFyIiWCQO1vekS5F33WZkBUV/4O3WlfnPl1VcrERbZgrD0GRxo BixYdpIKkhUXSvWxzp2zHi12G8qgape7T5pEQ49c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Mark Rutland , Alexey Budankov , linux-arm-kernel@lists.infradead.org, German Gomez , Anshuman Khandual , Suzuki K Poulose , Sasha Levin Subject: [PATCH 5.18 0288/1095] drivers/perf: arm_spe: Fix consistency of SYS_PMSCR_EL1.CX Date: Mon, 15 Aug 2022 19:54:47 +0200 Message-Id: <20220815180441.705548857@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Anshuman Khandual [ Upstream commit 92f2b8bafa3d6e89c750e9d301a8b7ab76aaa8b6 ] The arm_spe_pmu driver will enable SYS_PMSCR_EL1.CX in order to add CONTEXT packets into the traces, if the owner of the perf event runs with required capabilities i.e CAP_PERFMON or CAP_SYS_ADMIN via perfmon_capable() helper. The value of this bit is computed in the arm_spe_event_to_pmscr() function but the check for capabilities happens in the pmu event init callback i.e arm_spe_pmu_event_init(). This suggests that the value of the CX bit should remain consistent for the duration of the perf session. However, the function arm_spe_event_to_pmscr() may be called later during the event start callback i.e arm_spe_pmu_start() when the "current" process is not the owner of the perf session, hence the CX bit setting is currently not consistent. One way to fix this, is by caching the required value of the CX bit during the initialization of the PMU event, so that it remains consistent for the duration of the session. It uses currently unused 'event->hw.flags' element to cache perfmon_capable() value, which can be referred during event start callback to compute SYS_PMSCR_EL1.CX. This ensures consistent availability of context packets in the trace as per event owner capabilities. Drop BIT(SYS_PMSCR_EL1_CX_SHIFT) check in arm_spe_pmu_event_init(), because now CX bit cannot be set in arm_spe_event_to_pmscr() with perfmon_capable() disabled. Cc: Will Deacon Cc: Mark Rutland Cc: Alexey Budankov Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Fixes: d5d9696b0380 ("drivers/perf: Add support for ARMv8.2 Statistical Pro= filing Extension") Reported-by: German Gomez Signed-off-by: Anshuman Khandual Reviewed-by: Suzuki K Poulose Link: https://lore.kernel.org/r/20220714061302.2715102-1-anshuman.khandual@= arm.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/perf/arm_spe_pmu.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c index d44bcc29d99c..cd5945e17fdf 100644 --- a/drivers/perf/arm_spe_pmu.c +++ b/drivers/perf/arm_spe_pmu.c @@ -39,6 +39,24 @@ #include #include =20 +/* + * Cache if the event is allowed to trace Context information. + * This allows us to perform the check, i.e, perfmon_capable(), + * in the context of the event owner, once, during the event_init(). + */ +#define SPE_PMU_HW_FLAGS_CX BIT(0) + +static void set_spe_event_has_cx(struct perf_event *event) +{ + if (IS_ENABLED(CONFIG_PID_IN_CONTEXTIDR) && perfmon_capable()) + event->hw.flags |=3D SPE_PMU_HW_FLAGS_CX; +} + +static bool get_spe_event_has_cx(struct perf_event *event) +{ + return !!(event->hw.flags & SPE_PMU_HW_FLAGS_CX); +} + #define ARM_SPE_BUF_PAD_BYTE 0 =20 struct arm_spe_pmu_buf { @@ -272,7 +290,7 @@ static u64 arm_spe_event_to_pmscr(struct perf_event *ev= ent) if (!attr->exclude_kernel) reg |=3D BIT(SYS_PMSCR_EL1_E1SPE_SHIFT); =20 - if (IS_ENABLED(CONFIG_PID_IN_CONTEXTIDR) && perfmon_capable()) + if (get_spe_event_has_cx(event)) reg |=3D BIT(SYS_PMSCR_EL1_CX_SHIFT); =20 return reg; @@ -709,10 +727,10 @@ static int arm_spe_pmu_event_init(struct perf_event *= event) !(spe_pmu->features & SPE_PMU_FEAT_FILT_LAT)) return -EOPNOTSUPP; =20 + set_spe_event_has_cx(event); reg =3D arm_spe_event_to_pmscr(event); if (!perfmon_capable() && (reg & (BIT(SYS_PMSCR_EL1_PA_SHIFT) | - BIT(SYS_PMSCR_EL1_CX_SHIFT) | BIT(SYS_PMSCR_EL1_PCT_SHIFT)))) return -EACCES; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 080FDC00140 for ; Mon, 15 Aug 2022 20:49:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346158AbiHOUtD (ORCPT ); Mon, 15 Aug 2022 16:49:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346225AbiHOUsC (ORCPT ); Mon, 15 Aug 2022 16:48:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64AF7B81D5; Mon, 15 Aug 2022 12:08:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 180AE60BB7; Mon, 15 Aug 2022 19:08:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F17EAC433D7; Mon, 15 Aug 2022 19:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590533; bh=PVYg95K8bXaoHjFJOyN20GMXbqmpewhDRkPDYP4bChg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1zPrQ4zjpHjmecvBuTpFVDHB1zjJL3Y2P8uCIyiosYms6sl/NfXCoOPMnjiDhsAP0 BKQMTsmRbfKVgozMzVftsRIEvy5CWp/LzOROaRWxX3UnTmCdBBenlnST3JnYqDbGEF 8GiOsXiHClVWBgXUEPVpgOmrzKDJhNYrrWBpGMJI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Saenz Julienne , "Peter Zijlstra (Intel)" , Valentin Schneider , Phil Auld , Sasha Levin Subject: [PATCH 5.18 0289/1095] nohz/full, sched/rt: Fix missed tick-reenabling bug in dequeue_task_rt() Date: Mon, 15 Aug 2022 19:54:48 +0200 Message-Id: <20220815180441.752250231@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Saenz Julienne [ Upstream commit 5c66d1b9b30f737fcef85a0b75bfe0590e16b62a ] dequeue_task_rt() only decrements 'rt_rq->rt_nr_running' after having called sched_update_tick_dependency() preventing it from re-enabling the tick on systems that no longer have pending SCHED_RT tasks but have multiple runnable SCHED_OTHER tasks: dequeue_task_rt() dequeue_rt_entity() dequeue_rt_stack() dequeue_top_rt_rq() sub_nr_running() // decrements rq->nr_running sched_update_tick_dependency() sched_can_stop_tick() // checks rq->rt.rt_nr_running, ... __dequeue_rt_entity() dec_rt_tasks() // decrements rq->rt.rt_nr_running ... Every other scheduler class performs the operation in the opposite order, and sched_update_tick_dependency() expects the values to be updated as such. So avoid the misbehaviour by inverting the order in which the above operations are performed in the RT scheduler. Fixes: 76d92ac305f2 ("sched: Migrate sched to use new tick dependency mask = model") Signed-off-by: Nicolas Saenz Julienne Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Valentin Schneider Reviewed-by: Phil Auld Link: https://lore.kernel.org/r/20220628092259.330171-1-nsaenzju@redhat.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/sched/rt.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 7891c0f0e1ff..907a5d7507a8 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -430,7 +430,7 @@ static inline void rt_queue_push_tasks(struct rq *rq) #endif /* CONFIG_SMP */ =20 static void enqueue_top_rt_rq(struct rt_rq *rt_rq); -static void dequeue_top_rt_rq(struct rt_rq *rt_rq); +static void dequeue_top_rt_rq(struct rt_rq *rt_rq, unsigned int count); =20 static inline int on_rt_rq(struct sched_rt_entity *rt_se) { @@ -551,7 +551,7 @@ static void sched_rt_rq_dequeue(struct rt_rq *rt_rq) rt_se =3D rt_rq->tg->rt_se[cpu]; =20 if (!rt_se) { - dequeue_top_rt_rq(rt_rq); + dequeue_top_rt_rq(rt_rq, rt_rq->rt_nr_running); /* Kick cpufreq (see the comment in kernel/sched/sched.h). */ cpufreq_update_util(rq_of_rt_rq(rt_rq), 0); } @@ -637,7 +637,7 @@ static inline void sched_rt_rq_enqueue(struct rt_rq *rt= _rq) =20 static inline void sched_rt_rq_dequeue(struct rt_rq *rt_rq) { - dequeue_top_rt_rq(rt_rq); + dequeue_top_rt_rq(rt_rq, rt_rq->rt_nr_running); } =20 static inline int rt_rq_throttled(struct rt_rq *rt_rq) @@ -1039,7 +1039,7 @@ static void update_curr_rt(struct rq *rq) } =20 static void -dequeue_top_rt_rq(struct rt_rq *rt_rq) +dequeue_top_rt_rq(struct rt_rq *rt_rq, unsigned int count) { struct rq *rq =3D rq_of_rt_rq(rt_rq); =20 @@ -1050,7 +1050,7 @@ dequeue_top_rt_rq(struct rt_rq *rt_rq) =20 BUG_ON(!rq->nr_running); =20 - sub_nr_running(rq, rt_rq->rt_nr_running); + sub_nr_running(rq, count); rt_rq->rt_queued =3D 0; =20 } @@ -1436,18 +1436,21 @@ static void __dequeue_rt_entity(struct sched_rt_ent= ity *rt_se, unsigned int flag static void dequeue_rt_stack(struct sched_rt_entity *rt_se, unsigned int f= lags) { struct sched_rt_entity *back =3D NULL; + unsigned int rt_nr_running; =20 for_each_sched_rt_entity(rt_se) { rt_se->back =3D back; back =3D rt_se; } =20 - dequeue_top_rt_rq(rt_rq_of_se(back)); + rt_nr_running =3D rt_rq_of_se(back)->rt_nr_running; =20 for (rt_se =3D back; rt_se; rt_se =3D rt_se->back) { if (on_rt_rq(rt_se)) __dequeue_rt_entity(rt_se, flags); } + + dequeue_top_rt_rq(rt_rq_of_se(back), rt_nr_running); } =20 static void enqueue_rt_entity(struct sched_rt_entity *rt_se, unsigned int = flags) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EB41C00140 for ; Mon, 15 Aug 2022 20:49:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346213AbiHOUtH (ORCPT ); Mon, 15 Aug 2022 16:49:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345739AbiHOUsK (ORCPT ); Mon, 15 Aug 2022 16:48:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75B7EB81F6; Mon, 15 Aug 2022 12:08:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AAAF4B810A3; Mon, 15 Aug 2022 19:08:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 146E3C43140; Mon, 15 Aug 2022 19:08:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590536; bh=eUGW2Is/pHYPEz+f+EhA8vgHM3cR2Z6ILuc72rM9470=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zzsiYBh9uRsa0/DVWkpZJxakOhJGf1OvJ+cvUq1GegMgM91MFCHbhHjuNlrzlZ29U BzisaSfNahYLw5va8cv2TQTlaf5Eh7f3hXP6Grz5hhJ+kyev/Z6Fc7KLxAwC9k6F2X 49BTGsQlOaVP1ikpzei3czf4uweC4G31TjA6Vt2Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephane Eranian , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.18 0290/1095] x86/extable: Fix ex_handler_msr() print condition Date: Mon, 15 Aug 2022 19:54:49 +0200 Message-Id: <20220815180441.790987652@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Zijlstra [ Upstream commit a1a5482a2c6e38a3ebed32e571625c56a8cc41a6 ] On Fri, Jun 17, 2022 at 02:08:52PM +0300, Stephane Eranian wrote: > Some changes to the way invalid MSR accesses are reported by the > kernel is causing some problems with messages printed on the > console. > > We have seen several cases of ex_handler_msr() printing invalid MSR > accesses once but the callstack multiple times causing confusion on > the console. > The problem here is that another earlier commit (5.13): > > a358f40600b3 ("once: implement DO_ONCE_LITE for non-fast-path "do once" f= unctionality") > > Modifies all the pr_*_once() calls to always return true claiming > that no caller is ever checking the return value of the functions. > > This is why we are seeing the callstack printed without the > associated printk() msg. Extract the ONCE_IF(cond) part into __ONCE_LTE_IF() and use that to implement DO_ONCE_LITE_IF() and fix the extable code. Fixes: a358f40600b3 ("once: implement DO_ONCE_LITE for non-fast-path "do on= ce" functionality") Reported-by: Stephane Eranian Signed-off-by: Peter Zijlstra (Intel) Tested-by: Stephane Eranian Link: https://lkml.kernel.org/r/YqyVFsbviKjVGGZ9@worktop.programming.kicks-= ass.net Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/mm/extable.c | 16 +++++++++------- include/linux/once_lite.h | 20 ++++++++++++++++---- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c index dba2197c05c3..331310c29349 100644 --- a/arch/x86/mm/extable.c +++ b/arch/x86/mm/extable.c @@ -94,16 +94,18 @@ static bool ex_handler_copy(const struct exception_tabl= e_entry *fixup, static bool ex_handler_msr(const struct exception_table_entry *fixup, struct pt_regs *regs, bool wrmsr, bool safe, int reg) { - if (!safe && wrmsr && - pr_warn_once("unchecked MSR access error: WRMSR to 0x%x (tried to wri= te 0x%08x%08x) at rIP: 0x%lx (%pS)\n", - (unsigned int)regs->cx, (unsigned int)regs->dx, - (unsigned int)regs->ax, regs->ip, (void *)regs->ip)) + if (__ONCE_LITE_IF(!safe && wrmsr)) { + pr_warn("unchecked MSR access error: WRMSR to 0x%x (tried to write 0x%08= x%08x) at rIP: 0x%lx (%pS)\n", + (unsigned int)regs->cx, (unsigned int)regs->dx, + (unsigned int)regs->ax, regs->ip, (void *)regs->ip); show_stack_regs(regs); + } =20 - if (!safe && !wrmsr && - pr_warn_once("unchecked MSR access error: RDMSR from 0x%x at rIP: 0x%= lx (%pS)\n", - (unsigned int)regs->cx, regs->ip, (void *)regs->ip)) + if (__ONCE_LITE_IF(!safe && !wrmsr)) { + pr_warn("unchecked MSR access error: RDMSR from 0x%x at rIP: 0x%lx (%pS)= \n", + (unsigned int)regs->cx, regs->ip, (void *)regs->ip); show_stack_regs(regs); + } =20 if (!wrmsr) { /* Pretend that the read succeeded and returned 0. */ diff --git a/include/linux/once_lite.h b/include/linux/once_lite.h index 861e606b820f..b7bce4983638 100644 --- a/include/linux/once_lite.h +++ b/include/linux/once_lite.h @@ -9,15 +9,27 @@ */ #define DO_ONCE_LITE(func, ...) \ DO_ONCE_LITE_IF(true, func, ##__VA_ARGS__) -#define DO_ONCE_LITE_IF(condition, func, ...) \ + +#define __ONCE_LITE_IF(condition) \ ({ \ static bool __section(".data.once") __already_done; \ - bool __ret_do_once =3D !!(condition); \ + bool __ret_cond =3D !!(condition); \ + bool __ret_once =3D false; \ \ - if (unlikely(__ret_do_once && !__already_done)) { \ + if (unlikely(__ret_cond && !__already_done)) { \ __already_done =3D true; \ - func(__VA_ARGS__); \ + __ret_once =3D true; \ } \ + unlikely(__ret_once); \ + }) + +#define DO_ONCE_LITE_IF(condition, func, ...) \ + ({ \ + bool __ret_do_once =3D !!(condition); \ + \ + if (__ONCE_LITE_IF(__ret_do_once)) \ + func(__VA_ARGS__); \ + \ unlikely(__ret_do_once); \ }) =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9730AC00140 for ; Mon, 15 Aug 2022 20:49:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346414AbiHOUtl (ORCPT ); Mon, 15 Aug 2022 16:49:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345628AbiHOUsr (ORCPT ); Mon, 15 Aug 2022 16:48:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12DC7B8F1F; Mon, 15 Aug 2022 12:09:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3589460BBF; Mon, 15 Aug 2022 19:09:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20395C433D7; Mon, 15 Aug 2022 19:09:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590542; bh=b73m9hpZsq1LPof4CJ65b/MGPVplSqIlbYsDVlENReA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H0BVWg85ek9rDqxammAbu0q/Acsp01NELHopSR9PBk6Po7efX4Vr8JuO3Q0WMQL8H KIu6w16gkHc9UxsJiS+XJQSglxuCuXBadSKHPy7FBYTy52UVo0cYa4nD92dFzmfVIV CAb05D0mkqXUY563gX1eHPBLUpjJ8MoCv0bUkGyc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jens Axboe , Sasha Levin Subject: [PATCH 5.18 0291/1095] io_uring: move to separate directory Date: Mon, 15 Aug 2022 19:54:50 +0200 Message-Id: <20220815180441.830696103@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jens Axboe [ Upstream commit ed29b0b4fd835b058ddd151c49d021e28d631ee6 ] In preparation for splitting io_uring up a bit, move it into its own top level directory. It didn't really belong in fs/ anyway, as it's not a file system only API. This adds io_uring/ and moves the core files in there, and updates the MAINTAINERS file for the new location. Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- MAINTAINERS | 7 +------ Makefile | 1 + fs/Makefile | 2 -- io_uring/Makefile | 6 ++++++ {fs =3D> io_uring}/io-wq.c | 0 {fs =3D> io_uring}/io-wq.h | 0 {fs =3D> io_uring}/io_uring.c | 2 +- kernel/sched/core.c | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 io_uring/Makefile rename {fs =3D> io_uring}/io-wq.c (100%) rename {fs =3D> io_uring}/io-wq.h (100%) rename {fs =3D> io_uring}/io_uring.c (99%) diff --git a/MAINTAINERS b/MAINTAINERS index 2b70e2d21405..c7c7a96b62a8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7599,9 +7599,6 @@ F: include/linux/fs.h F: include/linux/fs_types.h F: include/uapi/linux/fs.h F: include/uapi/linux/openat2.h -X: fs/io-wq.c -X: fs/io-wq.h -X: fs/io_uring.c =20 FINTEK F75375S HARDWARE MONITOR AND FAN CONTROLLER DRIVER M: Riku Voipio @@ -10277,9 +10274,7 @@ L: io-uring@vger.kernel.org S: Maintained T: git git://git.kernel.dk/linux-block T: git git://git.kernel.dk/liburing -F: fs/io-wq.c -F: fs/io-wq.h -F: fs/io_uring.c +F: io_uring/ F: include/linux/io_uring.h F: include/uapi/linux/io_uring.h F: tools/io_uring/ diff --git a/Makefile b/Makefile index 13dd4bd226cb..90e2129a3b80 100644 --- a/Makefile +++ b/Makefile @@ -1100,6 +1100,7 @@ export MODULES_NSDEPS :=3D $(extmod_prefix)modules.ns= deps ifeq ($(KBUILD_EXTMOD),) core-y +=3D kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ core-$(CONFIG_BLOCK) +=3D block/ +core-$(CONFIG_IO_URING) +=3D io_uring/ =20 vmlinux-dirs :=3D $(patsubst %/,%,$(filter %/, \ $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ diff --git a/fs/Makefile b/fs/Makefile index 208a74e0b00e..93b80529f8e8 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -34,8 +34,6 @@ obj-$(CONFIG_TIMERFD) +=3D timerfd.o obj-$(CONFIG_EVENTFD) +=3D eventfd.o obj-$(CONFIG_USERFAULTFD) +=3D userfaultfd.o obj-$(CONFIG_AIO) +=3D aio.o -obj-$(CONFIG_IO_URING) +=3D io_uring.o -obj-$(CONFIG_IO_WQ) +=3D io-wq.o obj-$(CONFIG_FS_DAX) +=3D dax.o obj-$(CONFIG_FS_ENCRYPTION) +=3D crypto/ obj-$(CONFIG_FS_VERITY) +=3D verity/ diff --git a/io_uring/Makefile b/io_uring/Makefile new file mode 100644 index 000000000000..3680425df947 --- /dev/null +++ b/io_uring/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for io_uring + +obj-$(CONFIG_IO_URING) +=3D io_uring.o +obj-$(CONFIG_IO_WQ) +=3D io-wq.o diff --git a/fs/io-wq.c b/io_uring/io-wq.c similarity index 100% rename from fs/io-wq.c rename to io_uring/io-wq.c diff --git a/fs/io-wq.h b/io_uring/io-wq.h similarity index 100% rename from fs/io-wq.h rename to io_uring/io-wq.h diff --git a/fs/io_uring.c b/io_uring/io_uring.c similarity index 99% rename from fs/io_uring.c rename to io_uring/io_uring.c index 3d97372e811e..b25e59da129f 100644 --- a/fs/io_uring.c +++ b/io_uring/io_uring.c @@ -86,7 +86,7 @@ =20 #include =20 -#include "internal.h" +#include "../fs/internal.h" #include "io-wq.h" =20 #define IORING_MAX_ENTRIES 32768 diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 6baf96d2fa39..72b2f277b0dd 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -88,7 +88,7 @@ #include "stats.h" =20 #include "../workqueue_internal.h" -#include "../../fs/io-wq.h" +#include "../../io_uring/io-wq.h" #include "../smpboot.h" =20 /* --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5795C00140 for ; Mon, 15 Aug 2022 20:49:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346107AbiHOUth (ORCPT ); Mon, 15 Aug 2022 16:49:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346596AbiHOUs2 (ORCPT ); Mon, 15 Aug 2022 16:48:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80365DFFE; Mon, 15 Aug 2022 12:09:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 59DCF60693; Mon, 15 Aug 2022 19:09:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49252C433C1; Mon, 15 Aug 2022 19:09:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590545; bh=xMtcPeQKe46Skuop9aELY3NS1lc3uk2hAW+vMw8BryU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YV5sYK657DkVWGY0/yZFGn9sFyrBRuuonuWW22IQjXrRXXqAOw+dC1FGg2XpAYkUN gkP801xGnwMtLDE8Ymb9+PkJH+qaO5TclpXSHhBRs2OASey3eVJbr0XM6VeNWXtE/T pXNP0rEJ51puE75dLbMc4ktb/SsHQ1Fo1YNs8qFs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hannes Reinecke , Himanshu Madhani , Christoph Hellwig , Muneendra Kumar , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0292/1095] scsi: nvme-fc: Add new routine nvme_fc_io_getuuid() Date: Mon, 15 Aug 2022 19:54:51 +0200 Message-Id: <20220815180441.871915550@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Muneendra Kumar [ Upstream commit 827fc630e4c8087df5a8e8ee013b686bd6f13736 ] Add nvme_fc_io_getuuid() to the nvme-fc transport. The routine is invoked by the FC LLDD on a per-I/O request basis. The routine translates from the FC-specific request structure to the bio and the cgroup structure in order to obtain the FC appid stored in the cgroup structure. If a value is not set or a bio is not found, a NULL appid (aka uuid) will be returned to the LLDD. Link: https://lore.kernel.org/r/20220519123110.17361-2-jsmart2021@gmail.com Reviewed-by: Hannes Reinecke Reviewed-by: Himanshu Madhani Acked-by: Christoph Hellwig Signed-off-by: Muneendra Kumar Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/nvme/host/fc.c | 18 ++++++++++++++++++ include/linux/nvme-fc-driver.h | 14 ++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 080f85f4105f..05f9da251758 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -1899,6 +1899,24 @@ nvme_fc_ctrl_ioerr_work(struct work_struct *work) nvme_fc_error_recovery(ctrl, "transport detected io error"); } =20 +/* + * nvme_fc_io_getuuid - Routine called to get the appid field + * associated with request by the lldd + * @req:IO request from nvme fc to driver + * Returns: UUID if there is an appid associated with VM or + * NULL if the user/libvirt has not set the appid to VM + */ +char *nvme_fc_io_getuuid(struct nvmefc_fcp_req *req) +{ + struct nvme_fc_fcp_op *op =3D fcp_req_to_fcp_op(req); + struct request *rq =3D op->rq; + + if (!IS_ENABLED(CONFIG_BLK_CGROUP_FC_APPID) || !rq->bio) + return NULL; + return blkcg_get_fc_appid(rq->bio); +} +EXPORT_SYMBOL_GPL(nvme_fc_io_getuuid); + static void nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) { diff --git a/include/linux/nvme-fc-driver.h b/include/linux/nvme-fc-driver.h index 5358a5facdee..fa092b9be2fd 100644 --- a/include/linux/nvme-fc-driver.h +++ b/include/linux/nvme-fc-driver.h @@ -564,6 +564,15 @@ int nvme_fc_rcv_ls_req(struct nvme_fc_remote_port *rem= oteport, void *lsreqbuf, u32 lsreqbuf_len); =20 =20 +/* + * Routine called to get the appid field associated with request by the ll= dd + * + * If the return value is NULL : the user/libvirt has not set the appid to= VM + * If the return value is non-zero: Returns the appid associated with VM + * + * @req: IO request from nvme fc to driver + */ +char *nvme_fc_io_getuuid(struct nvmefc_fcp_req *req); =20 /* * *************** LLDD FC-NVME Target/Subsystem API *************** @@ -1048,5 +1057,10 @@ int nvmet_fc_rcv_fcp_req(struct nvmet_fc_target_port= *tgtport, =20 void nvmet_fc_rcv_fcp_abort(struct nvmet_fc_target_port *tgtport, struct nvmefc_tgt_fcp_req *fcpreq); +/* + * add a define, visible to the compiler, that indicates support + * for feature. Allows for conditional compilation in LLDDs. + */ +#define NVME_FC_FEAT_UUID 0x0001 =20 #endif /* _NVME_FC_DRIVER_H */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93F4BC00140 for ; Mon, 15 Aug 2022 20:49:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345345AbiHOUtt (ORCPT ); Mon, 15 Aug 2022 16:49:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346151AbiHOUtC (ORCPT ); Mon, 15 Aug 2022 16:49:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D705B81E0; Mon, 15 Aug 2022 12:09:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 627646069E; Mon, 15 Aug 2022 19:09:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A63AC433C1; Mon, 15 Aug 2022 19:09:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590548; bh=+iw9H9HE5DC6fgpz+aGX4rOtBTIwTitF/Aqy17elXPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mnh3u/gqYL36Y3vsVffq/sZwf28uprhqXEe2TJD5VWIyCZZb8n5o5Gb6rwIOC3Iao i9n1DNHbVP4EyBdgiCrX6ga4ojg8eo3hlRqixw1/+7oATLYp+ozlCazlZH4sYNK/hR TqND1JJ8Q8YUoAxieKO19WNULeiWa7yNZT7PlyiI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joey Gouly , Marc Zyngier , Catalin Marinas , Sasha Levin Subject: [PATCH 5.18 0293/1095] arm64: Expand ESR_ELx_WFx_ISS_TI to match its ARMv8.7 definition Date: Mon, 15 Aug 2022 19:54:52 +0200 Message-Id: <20220815180441.903354670@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marc Zyngier [ Upstream commit 6a437208cb942a2dd98f7e1c3fd347ed3d425ffc ] Starting with FEAT_WFXT in ARMv8.7, the TI field in the ISS that is reported on a WFx trap is expanded by one bit to allow the description of WFET and WFIT. Special care is taken to exclude the WFxT bit from the mask used to match WFI so that it also matches WFIT when trapped from EL0. Reviewed-by: Joey Gouly Signed-off-by: Marc Zyngier Acked-by: Catalin Marinas Link: https://lore.kernel.org/r/20220419182755.601427-2-maz@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/include/asm/esr.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h index d52a0b269ee8..65c2201b11b2 100644 --- a/arch/arm64/include/asm/esr.h +++ b/arch/arm64/include/asm/esr.h @@ -133,7 +133,8 @@ #define ESR_ELx_CV (UL(1) << 24) #define ESR_ELx_COND_SHIFT (20) #define ESR_ELx_COND_MASK (UL(0xF) << ESR_ELx_COND_SHIFT) -#define ESR_ELx_WFx_ISS_TI (UL(1) << 0) +#define ESR_ELx_WFx_ISS_TI (UL(3) << 0) +#define ESR_ELx_WFx_ISS_WFxT (UL(2) << 0) #define ESR_ELx_WFx_ISS_WFI (UL(0) << 0) #define ESR_ELx_WFx_ISS_WFE (UL(1) << 0) #define ESR_ELx_xVC_IMM_MASK ((1UL << 16) - 1) @@ -146,7 +147,8 @@ #define DISR_EL1_ESR_MASK (ESR_ELx_AET | ESR_ELx_EA | ESR_ELx_FSC) =20 /* ESR value templates for specific events */ -#define ESR_ELx_WFx_MASK (ESR_ELx_EC_MASK | ESR_ELx_WFx_ISS_TI) +#define ESR_ELx_WFx_MASK (ESR_ELx_EC_MASK | \ + (ESR_ELx_WFx_ISS_TI & ~ESR_ELx_WFx_ISS_WFxT)) #define ESR_ELx_WFx_WFI_VAL ((ESR_ELx_EC_WFx << ESR_ELx_EC_SHIFT) | \ ESR_ELx_WFx_ISS_WFI) =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42F55C28B2B for ; Mon, 15 Aug 2022 20:56:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243558AbiHOU45 (ORCPT ); Mon, 15 Aug 2022 16:56:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346668AbiHOUzb (ORCPT ); Mon, 15 Aug 2022 16:55:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB7F83B964; Mon, 15 Aug 2022 12:11:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 07E2EB810C6; Mon, 15 Aug 2022 19:11:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56386C433D6; Mon, 15 Aug 2022 19:11:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590675; bh=KCCnZy4VwddJyPRUyy8fpAUc4A0puR9fu+CDJ3uYcRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aLcEz57tHSTZyZnV4rlAO3tz1BANASbdkPYFU59XMrjRzGlRcoqJn3qTKJY0lDGcG 20XG2vin9r2QGub1iZvqRrUqI6nAtUKZgUtHxz/+fNDmQFoj5zf2WgiQ2T0SMxUSzg tA1A1w/EGvAG8bxNYUXYv5o/q1TSrsIG4pdhp2Bc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Michal=20Koutn=C3=BD?= , Roman Gushchin , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 0294/1095] io_uring: Dont require reinitable percpu_ref Date: Mon, 15 Aug 2022 19:54:53 +0200 Message-Id: <20220815180441.942422287@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michal Koutn=C3=BD [ Upstream commit 48904229928d941ce1db181b991948387ab463cd ] The commit 8bb649ee1da3 ("io_uring: remove ring quiesce for io_uring_register") removed the worklow relying on reinit/resurrection of the percpu_ref, hence, initialization with that requested is a relic. This is based on code review, this causes no real bug (and theoretically can't). Technically it's a revert of commit 214828962dea ("io_uring: initialize percpu refcounters using PERCU_REF_ALLOW_REINIT") but since the flag omission is now justified, I'm not making this a revert. Fixes: 8bb649ee1da3 ("io_uring: remove ring quiesce for io_uring_register") Signed-off-by: Michal Koutn=C3=BD Acked-by: Roman Gushchin Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- io_uring/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index b25e59da129f..2dd6731c1022 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1576,7 +1576,7 @@ static __cold struct io_ring_ctx *io_ring_ctx_alloc(s= truct io_uring_params *p) INIT_LIST_HEAD(&ctx->io_buffers[i]); =20 if (percpu_ref_init(&ctx->refs, io_ring_ctx_ref_free, - PERCPU_REF_ALLOW_REINIT, GFP_KERNEL)) + 0, GFP_KERNEL)) goto err; =20 ctx->flags =3D p->flags; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE56BC25B0E for ; Mon, 15 Aug 2022 20:52:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346292AbiHOUwY (ORCPT ); Mon, 15 Aug 2022 16:52:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345880AbiHOUub (ORCPT ); Mon, 15 Aug 2022 16:50:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEE70BA9D1; Mon, 15 Aug 2022 12:09:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A1BF8B81115; Mon, 15 Aug 2022 19:09:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7655C433C1; Mon, 15 Aug 2022 19:09:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590573; bh=4zHJyk7rxxViGtfeCsyafRUduSS2cv1pFUD28Yv+0IM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mpQy/a768VjhE7oKMiwUCui3CGXidgqd5uZRnkgBnaULTB/52eDE8e+of+Aa81/gi e3hlcA8c7xTh4eSVzCp4sZrEZYob4n+AgR5m91ZdE9zuUF6VaCrN6gBaTBdJYyu+21 yPZZe3Vxivx4Jzjqz7dfMf4y8hELplss3dUMi3Kw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YiFei Zhu , Kees Cook , Sasha Levin Subject: [PATCH 5.18 0295/1095] selftests/seccomp: Fix compile warning when CC=clang Date: Mon, 15 Aug 2022 19:54:54 +0200 Message-Id: <20220815180441.980828101@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: YiFei Zhu [ Upstream commit 3ce4b78f73e8e00fb86bad67ee7f6fe12019707e ] clang has -Wconstant-conversion by default, and the constant 0xAAAAAAAAA (9 As) being converted to an int, which is generally 32 bits, results in the compile warning: clang -Wl,-no-as-needed -Wall -isystem ../../../../usr/include/ -lpthrea= d seccomp_bpf.c -lcap -o seccomp_bpf seccomp_bpf.c:812:67: warning: implicit conversion from 'long' to 'int' c= hanges value from 45812984490 to -1431655766 [-Wconstant-conversion] int kill =3D kill_how =3D=3D KILL_PROCESS ? SECCOMP_RET_KILL_PROC= ESS : 0xAAAAAAAAA; ~~~~ = ^~~~~~~~~~~ 1 warning generated. -1431655766 is the expected truncation, 0xAAAAAAAA (8 As), so use this directly in the code to avoid the warning. Fixes: 3932fcecd962 ("selftests/seccomp: Add test for unknown SECCOMP_RET k= ill behavior") Signed-off-by: YiFei Zhu Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220526223407.1686936-1-zhuyifei@google.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/testing/selftests/seccomp/seccomp_bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/= selftests/seccomp/seccomp_bpf.c index 313bb0cbfb1e..6f65eeb6a3dd 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -802,7 +802,7 @@ void kill_thread_or_group(struct __test_metadata *_meta= data, .len =3D (unsigned short)ARRAY_SIZE(filter_thread), .filter =3D filter_thread, }; - int kill =3D kill_how =3D=3D KILL_PROCESS ? SECCOMP_RET_KILL_PROCESS : 0x= AAAAAAAAA; + int kill =3D kill_how =3D=3D KILL_PROCESS ? SECCOMP_RET_KILL_PROCESS : 0x= AAAAAAAA; struct sock_filter filter_process[] =3D { BPF_STMT(BPF_LD|BPF_W|BPF_ABS, offsetof(struct seccomp_data, nr)), --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 470E2C00140 for ; Mon, 15 Aug 2022 20:53:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346661AbiHOUxb (ORCPT ); Mon, 15 Aug 2022 16:53:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347121AbiHOUvd (ORCPT ); Mon, 15 Aug 2022 16:51:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 462A3BCC26; Mon, 15 Aug 2022 12:10:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B709CB81104; Mon, 15 Aug 2022 19:10:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 105C1C433C1; Mon, 15 Aug 2022 19:10:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590608; bh=2KW1HM963k7v+bwEDDz4Yh4oQrYctMijf1hKLtDHh9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WtW1FsDlO2Gti7+QwplS2oBJz7XOLTAAVrYIPg+FtjsoRvIihiAFlsu/UlQldJDco WrxSXUGE4rejIDCOmGMIqeuQpXWT0ZIcFjxxwO9fnDB79fL7Ni88bJweSNqSsMW0X9 2pvBQFY4+2LieIJdzaNyDggI8HZv4tHG/Y1uqG/4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Markus Mayer , Florian Fainelli , Sumeet Pawnikar , =?UTF-8?q?Alejandro=20Gonz=C3=A1lez?= , Daniel Lezcano , Sasha Levin Subject: [PATCH 5.18 0296/1095] thermal/tools/tmon: Include pthread and time headers in tmon.h Date: Mon, 15 Aug 2022 19:54:55 +0200 Message-Id: <20220815180442.013503829@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Mayer [ Upstream commit 0cf51bfe999524377fbb71becb583b4ca6d07cfc ] Include sys/time.h and pthread.h in tmon.h, so that types "pthread_mutex_t" and "struct timeval tv" are known when tmon.h references them. Without these headers, compiling tmon against musl-libc will fail with these errors: In file included from sysfs.c:31:0: tmon.h:47:8: error: unknown type name 'pthread_mutex_t' extern pthread_mutex_t input_lock; ^~~~~~~~~~~~~~~ make[3]: *** [: sysfs.o] Error 1 make[3]: *** Waiting for unfinished jobs.... In file included from tui.c:31:0: tmon.h:54:17: error: field 'tv' has incomplete type struct timeval tv; ^~ make[3]: *** [: tui.o] Error 1 make[2]: *** [Makefile:83: tmon] Error 2 Signed-off-by: Markus Mayer Acked-by: Florian Fainelli Reviewed-by: Sumeet Pawnikar Acked-by: Alejandro Gonz=C3=A1lez Tested-by: Alejandro Gonz=C3=A1lez Fixes: 94f69966faf8 ("tools/thermal: Introduce tmon, a tool for thermal su= bsystem") Link: https://lore.kernel.org/r/20220718031040.44714-1-f.fainelli@gmail.com Signed-off-by: Daniel Lezcano Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/thermal/tmon/tmon.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/thermal/tmon/tmon.h b/tools/thermal/tmon/tmon.h index c9066ec104dd..44d16d778f04 100644 --- a/tools/thermal/tmon/tmon.h +++ b/tools/thermal/tmon/tmon.h @@ -27,6 +27,9 @@ #define NR_LINES_TZDATA 1 #define TMON_LOG_FILE "/var/tmp/tmon.log" =20 +#include +#include + extern unsigned long ticktime; extern double time_elapsed; extern unsigned long target_temp_user; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8810FC00140 for ; Mon, 15 Aug 2022 20:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241436AbiHOUyj (ORCPT ); Mon, 15 Aug 2022 16:54:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346758AbiHOUyD (ORCPT ); Mon, 15 Aug 2022 16:54:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F1663A4A5; Mon, 15 Aug 2022 12:10:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 337B160EEE; Mon, 15 Aug 2022 19:10:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 242B4C433D7; Mon, 15 Aug 2022 19:10:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590641; bh=MQPmSWW6qeTKmvxX5Idg4ZN9rJsHVGsA5UzbeucL58s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KKn8DHCgI1dbV5KK5J2/NtEQAQMDTXn3t90mZM29qedn27oUtvIHr0SFuT32YTDDe 5yyLAYJCv7adyZtXS1JrtJCG/x8Ad4YWhVNSQ69sptdmpaOHL/hhOmbkluvUys1Veu PwBSle+NlyKDLiMyz6atAllrwaSTA02AvFNLD/c4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Snitzer , Sasha Levin Subject: [PATCH 5.18 0297/1095] dm: return early from dm_pr_call() if DM device is suspended Date: Mon, 15 Aug 2022 19:54:56 +0200 Message-Id: <20220815180442.052684666@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mike Snitzer [ Upstream commit e120a5f1e78fab6223544e425015f393d90d6f0d ] Otherwise PR ops may be issued while the broader DM device is being reconfigured, etc. Fixes: 9c72bad1f31a ("dm: call PR reserve/unreserve on each underlying devi= ce") Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/md/dm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index f01d33bc3613..e0e28a3203f8 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2955,6 +2955,11 @@ static int dm_call_pr(struct block_device *bdev, ite= rate_devices_callout_fn fn, goto out; ti =3D dm_table_get_target(table, 0); =20 + if (dm_suspended_md(md)) { + ret =3D -EAGAIN; + goto out; + } + ret =3D -EINVAL; if (!ti->type->iterate_devices) goto out; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2270FC00140 for ; Mon, 15 Aug 2022 20:55:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240173AbiHOUzN (ORCPT ); Mon, 15 Aug 2022 16:55:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346316AbiHOUyI (ORCPT ); Mon, 15 Aug 2022 16:54:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0D9B40BE4; Mon, 15 Aug 2022 12:10:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 462EA60BB5; Mon, 15 Aug 2022 19:10:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CB34C433C1; Mon, 15 Aug 2022 19:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590657; bh=vrIzN52GEEHh/T0R5cqvOZOYcnv5hQLjIKksDxnlmEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F31StDHArfmopv0xywsziVMsMX8GLfooG1yybw+fPa12p5pqVXA4y3qcqaujdlQZq B60n6baxzFLCFbvH2knMuFltsNz0DIvjKijznFf0MmACnntiVtvTWqSysHXv+QaiVI 14Db8LU06h6NhfSt1ECOc7Oy/eBX9gTU2/wHR7mk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Emil Renner Berthing , Thierry Reding , Sasha Levin Subject: [PATCH 5.18 0298/1095] pwm: sifive: Simplify offset calculation for PWMCMP registers Date: Mon, 15 Aug 2022 19:54:57 +0200 Message-Id: <20220815180442.092452046@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 20550a61880fc55e68a0d290ad195b74729c0e7b ] Instead of explicitly using PWM_SIFIVE_PWMCMP0 + pwm->hwpwm * PWM_SIFIVE_SIZE_PWMCMP for each access to one of the PWMCMP registers, introduce a macro that takes the hwpwm id as parameter. For the register definition using a plain 4 instead of the cpp constant PWM_SIFIVE_SIZE_PWMCMP is easier to read, so define the offset macro without the constant. The latter can then be dropped as there are no users left. Signed-off-by: Uwe Kleine-K=C3=B6nig Tested-by: Emil Renner Berthing Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pwm/pwm-sifive.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c index 253c4a17d255..a55f7345dc87 100644 --- a/drivers/pwm/pwm-sifive.c +++ b/drivers/pwm/pwm-sifive.c @@ -23,7 +23,7 @@ #define PWM_SIFIVE_PWMCFG 0x0 #define PWM_SIFIVE_PWMCOUNT 0x8 #define PWM_SIFIVE_PWMS 0x10 -#define PWM_SIFIVE_PWMCMP0 0x20 +#define PWM_SIFIVE_PWMCMP(i) (0x20 + 4 * (i)) =20 /* PWMCFG fields */ #define PWM_SIFIVE_PWMCFG_SCALE GENMASK(3, 0) @@ -36,8 +36,6 @@ #define PWM_SIFIVE_PWMCFG_GANG BIT(24) #define PWM_SIFIVE_PWMCFG_IP BIT(28) =20 -/* PWM_SIFIVE_SIZE_PWMCMP is used to calculate offset for pwmcmpX register= s */ -#define PWM_SIFIVE_SIZE_PWMCMP 4 #define PWM_SIFIVE_CMPWIDTH 16 #define PWM_SIFIVE_DEFAULT_PERIOD 10000000 =20 @@ -112,8 +110,7 @@ static void pwm_sifive_get_state(struct pwm_chip *chip,= struct pwm_device *pwm, struct pwm_sifive_ddata *ddata =3D pwm_sifive_chip_to_ddata(chip); u32 duty, val; =20 - duty =3D readl(ddata->regs + PWM_SIFIVE_PWMCMP0 + - pwm->hwpwm * PWM_SIFIVE_SIZE_PWMCMP); + duty =3D readl(ddata->regs + PWM_SIFIVE_PWMCMP(pwm->hwpwm)); =20 state->enabled =3D duty > 0; =20 @@ -194,8 +191,7 @@ static int pwm_sifive_apply(struct pwm_chip *chip, stru= ct pwm_device *pwm, pwm_sifive_update_clock(ddata, clk_get_rate(ddata->clk)); } =20 - writel(frac, ddata->regs + PWM_SIFIVE_PWMCMP0 + - pwm->hwpwm * PWM_SIFIVE_SIZE_PWMCMP); + writel(frac, ddata->regs + PWM_SIFIVE_PWMCMP(pwm->hwpwm)); =20 if (state->enabled !=3D enabled) pwm_sifive_enable(chip, state->enabled); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC633C25B0E for ; Mon, 15 Aug 2022 20:56:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346777AbiHOUzr (ORCPT ); Mon, 15 Aug 2022 16:55:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346773AbiHOUyt (ORCPT ); Mon, 15 Aug 2022 16:54:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89DA3BFA90; Mon, 15 Aug 2022 12:11:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 43AAD60BAF; Mon, 15 Aug 2022 19:11:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A2B0C433D6; Mon, 15 Aug 2022 19:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590660; bh=aeRuvv4n+RQx3rdfldF9GjNSj+5s1DQan1L3wad8ZI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BwsZCqggWxxvyInvQrBwVIEQiXwnOHxO0OmCh232GBVAlwAj47yb8JHHTZo9KN0Hi F2wvqJ5w9Yor6jQHvDAUTAzsGrJmOQV7co1N2QtLkTlqTPEqHCjTNMgJ2T4THNgOon KoSlZFgM31OddLExU297v9LDGzxEt+XK1cPxAMoo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Emil Renner Berthing , Thierry Reding , Sasha Levin Subject: [PATCH 5.18 0299/1095] pwm: sifive: Ensure the clk is enabled exactly once per running PWM Date: Mon, 15 Aug 2022 19:54:58 +0200 Message-Id: <20220815180442.145155594@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit ace41d7564e655c39f709a78c035188a460c7cbd ] .apply() assumes the clk to be for a given PWM iff the PWM is enabled. So make sure this is the case when .probe() completes. And in .remove() disable the according number of times. This fixes a clk enable/disable imbalance, if some PWMs are already running at probe time. Fixes: 9e37a53eb051 (pwm: sifive: Add a driver for SiFive SoC PWM) Signed-off-by: Uwe Kleine-K=C3=B6nig Tested-by: Emil Renner Berthing Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pwm/pwm-sifive.c | 46 ++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c index a55f7345dc87..3936fda53366 100644 --- a/drivers/pwm/pwm-sifive.c +++ b/drivers/pwm/pwm-sifive.c @@ -229,6 +229,8 @@ static int pwm_sifive_probe(struct platform_device *pde= v) struct pwm_sifive_ddata *ddata; struct pwm_chip *chip; int ret; + u32 val; + unsigned int enabled_pwms =3D 0, enabled_clks =3D 1; =20 ddata =3D devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); if (!ddata) @@ -255,6 +257,33 @@ static int pwm_sifive_probe(struct platform_device *pd= ev) return ret; } =20 + val =3D readl(ddata->regs + PWM_SIFIVE_PWMCFG); + if (val & PWM_SIFIVE_PWMCFG_EN_ALWAYS) { + unsigned int i; + + for (i =3D 0; i < chip->npwm; ++i) { + val =3D readl(ddata->regs + PWM_SIFIVE_PWMCMP(i)); + if (val > 0) + ++enabled_pwms; + } + } + + /* The clk should be on once for each running PWM. */ + if (enabled_pwms) { + while (enabled_clks < enabled_pwms) { + /* This is not expected to fail as the clk is already on */ + ret =3D clk_enable(ddata->clk); + if (unlikely(ret)) { + dev_err_probe(dev, ret, "Failed to enable clk\n"); + goto disable_clk; + } + ++enabled_clks; + } + } else { + clk_disable(ddata->clk); + enabled_clks =3D 0; + } + /* Watch for changes to underlying clock frequency */ ddata->notifier.notifier_call =3D pwm_sifive_clock_notifier; ret =3D clk_notifier_register(ddata->clk, &ddata->notifier); @@ -277,7 +306,11 @@ static int pwm_sifive_probe(struct platform_device *pd= ev) unregister_clk: clk_notifier_unregister(ddata->clk, &ddata->notifier); disable_clk: - clk_disable_unprepare(ddata->clk); + while (enabled_clks) { + clk_disable(ddata->clk); + --enabled_clks; + } + clk_unprepare(ddata->clk); =20 return ret; } @@ -285,21 +318,16 @@ static int pwm_sifive_probe(struct platform_device *p= dev) static int pwm_sifive_remove(struct platform_device *dev) { struct pwm_sifive_ddata *ddata =3D platform_get_drvdata(dev); - bool is_enabled =3D false; struct pwm_device *pwm; int ch; =20 for (ch =3D 0; ch < ddata->chip.npwm; ch++) { pwm =3D &ddata->chip.pwms[ch]; - if (pwm->state.enabled) { - is_enabled =3D true; - break; - } + if (pwm->state.enabled) + clk_disable(ddata->clk); } - if (is_enabled) - clk_disable(ddata->clk); =20 - clk_disable_unprepare(ddata->clk); + clk_unprepare(ddata->clk); pwmchip_remove(&ddata->chip); clk_notifier_unregister(ddata->clk, &ddata->notifier); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC708C00140 for ; Mon, 15 Aug 2022 20:55:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240629AbiHOUzZ (ORCPT ); Mon, 15 Aug 2022 16:55:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346668AbiHOUyP (ORCPT ); Mon, 15 Aug 2022 16:54:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ABF82B194; Mon, 15 Aug 2022 12:11:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 493AC6069E; Mon, 15 Aug 2022 19:11:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F7CFC433C1; Mon, 15 Aug 2022 19:11:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590663; bh=phN+qSxQHO3xHdsp0Cmw0hMbLrUCSsjAQLXTncAvUFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qnQAPmum1MN7kLtjOPgzsN5NYJwPtu+1nO5uS850+Ghtgfp372YCd0wqg3tPZgFs4 UPUVpZmCPEHPDanDHTeDURtHlJL7Ac13jIau/bzbgfZaCiEyFJ1AecHdrnAIK7aRaL 03RrVzlATk6rhFq54fvpFgjCyRSJeDoWDZowxq4A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Emil Renner Berthing , Thierry Reding , Sasha Levin Subject: [PATCH 5.18 0300/1095] pwm: sifive: Shut down hardware only after pwmchip_remove() completed Date: Mon, 15 Aug 2022 19:54:59 +0200 Message-Id: <20220815180442.192147527@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 2375e964d541bb09158cd2dff67b5d74e8de61cd ] The PWMs are expected to be functional until pwmchip_remove() is called. So disable the clks only afterwards. Fixes: 9e37a53eb051 ("pwm: sifive: Add a driver for SiFive SoC PWM") Signed-off-by: Uwe Kleine-K=C3=B6nig Tested-by: Emil Renner Berthing Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pwm/pwm-sifive.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c index 3936fda53366..58347fcd4812 100644 --- a/drivers/pwm/pwm-sifive.c +++ b/drivers/pwm/pwm-sifive.c @@ -321,6 +321,9 @@ static int pwm_sifive_remove(struct platform_device *de= v) struct pwm_device *pwm; int ch; =20 + pwmchip_remove(&ddata->chip); + clk_notifier_unregister(ddata->clk, &ddata->notifier); + for (ch =3D 0; ch < ddata->chip.npwm; ch++) { pwm =3D &ddata->chip.pwms[ch]; if (pwm->state.enabled) @@ -328,8 +331,6 @@ static int pwm_sifive_remove(struct platform_device *de= v) } =20 clk_unprepare(ddata->clk); - pwmchip_remove(&ddata->chip); - clk_notifier_unregister(ddata->clk, &ddata->notifier); =20 return 0; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04794C25B0E for ; Mon, 15 Aug 2022 20:56:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244085AbiHOU4r (ORCPT ); Mon, 15 Aug 2022 16:56:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245561AbiHOUzT (ORCPT ); Mon, 15 Aug 2022 16:55:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B9253AE5E; Mon, 15 Aug 2022 12:11:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 21BA160693; Mon, 15 Aug 2022 19:11:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07B08C433D6; Mon, 15 Aug 2022 19:11:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590666; bh=tyewOjfDvcMDuNc0n8mcfNqZN/2ho/mbC0GukSH0x9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FIrke1DWN1P2PSWw28oqW5/K+s39w3ToeKznsZnT/RmqFtN+LpAMugP/3LJTWxCr/ 5w56ZYECDSCkXlQKYPSc31fw/sWJw3VbOvkPgr54aBBUU2iJXAv1mNbWEWhEdKcQZs WRep0pbszTQFTI90M5t7w3AHYNz2fvZ16kh9Mkbk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Thierry Reding , Sasha Levin Subject: [PATCH 5.18 0301/1095] pwm: lpc18xx: Fix period handling Date: Mon, 15 Aug 2022 19:55:00 +0200 Message-Id: <20220815180442.224324010@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 8933d30c5f468d6cc1e4bf9bb535149da35f202e ] The calculation: val =3D (u64)NSEC_PER_SEC * LPC18XX_PWM_TIMER_MAX; do_div(val, lpc18xx_pwm->clk_rate); lpc18xx_pwm->max_period_ns =3D val; is bogus because with NSEC_PER_SEC =3D 1000000000, LPC18XX_PWM_TIMER_MAX =3D 0xffffffff and clk_rate < NSEC_PER_SEC this overflows the (on lpc18xx (i.e. ARM32) 32 bit wide) unsigned int .max_period_ns. This results (dependant of the actual clk rate) in an arbitrary limitation of the maximal period. E.g. for clkrate =3D 333333333 (Hz) we get max_period_ns =3D 9 instead of 12884901897. So make .max_period_ns an u64 and pass period and duty as u64 to not discard relevant digits. And also make use of mul_u64_u64_div_u64() which prevents all overflows assuming clk_rate < NSEC_PER_SEC. Fixes: 841e6f90bb78 ("pwm: NXP LPC18xx PWM/SCT driver") Signed-off-by: Uwe Kleine-K=C3=B6nig Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pwm/pwm-lpc18xx-sct.c | 55 +++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c index b909096dba2f..43b5509dde51 100644 --- a/drivers/pwm/pwm-lpc18xx-sct.c +++ b/drivers/pwm/pwm-lpc18xx-sct.c @@ -98,7 +98,7 @@ struct lpc18xx_pwm_chip { unsigned long clk_rate; unsigned int period_ns; unsigned int min_period_ns; - unsigned int max_period_ns; + u64 max_period_ns; unsigned int period_event; unsigned long event_map; struct mutex res_lock; @@ -145,40 +145,48 @@ static void lpc18xx_pwm_set_conflict_res(struct lpc18= xx_pwm_chip *lpc18xx_pwm, mutex_unlock(&lpc18xx_pwm->res_lock); } =20 -static void lpc18xx_pwm_config_period(struct pwm_chip *chip, int period_ns) +static void lpc18xx_pwm_config_period(struct pwm_chip *chip, u64 period_ns) { struct lpc18xx_pwm_chip *lpc18xx_pwm =3D to_lpc18xx_pwm_chip(chip); - u64 val; + u32 val; =20 - val =3D (u64)period_ns * lpc18xx_pwm->clk_rate; - do_div(val, NSEC_PER_SEC); + /* + * With clk_rate < NSEC_PER_SEC this cannot overflow. + * With period_ns < max_period_ns this also fits into an u32. + * As period_ns >=3D min_period_ns =3D DIV_ROUND_UP(NSEC_PER_SEC, lpc18xx= _pwm->clk_rate); + * we have val >=3D 1. + */ + val =3D mul_u64_u64_div_u64(period_ns, lpc18xx_pwm->clk_rate, NSEC_PER_SE= C); =20 lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_MATCH(lpc18xx_pwm->period_event), - (u32)val - 1); + val - 1); =20 lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_MATCHREL(lpc18xx_pwm->period_event), - (u32)val - 1); + val - 1); } =20 static void lpc18xx_pwm_config_duty(struct pwm_chip *chip, - struct pwm_device *pwm, int duty_ns) + struct pwm_device *pwm, u64 duty_ns) { struct lpc18xx_pwm_chip *lpc18xx_pwm =3D to_lpc18xx_pwm_chip(chip); struct lpc18xx_pwm_data *lpc18xx_data =3D &lpc18xx_pwm->channeldata[pwm->= hwpwm]; - u64 val; + u32 val; =20 - val =3D (u64)duty_ns * lpc18xx_pwm->clk_rate; - do_div(val, NSEC_PER_SEC); + /* + * With clk_rate < NSEC_PER_SEC this cannot overflow. + * With duty_ns <=3D period_ns < max_period_ns this also fits into an u32. + */ + val =3D mul_u64_u64_div_u64(duty_ns, lpc18xx_pwm->clk_rate, NSEC_PER_SEC); =20 lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_MATCH(lpc18xx_data->duty_event), - (u32)val); + val); =20 lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_MATCHREL(lpc18xx_data->duty_event), - (u32)val); + val); } =20 static int lpc18xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pw= m, @@ -360,12 +368,27 @@ static int lpc18xx_pwm_probe(struct platform_device *= pdev) goto disable_pwmclk; } =20 + /* + * If clkrate is too fast, the calculations in .apply() might overflow. + */ + if (lpc18xx_pwm->clk_rate > NSEC_PER_SEC) { + ret =3D dev_err_probe(&pdev->dev, -EINVAL, "pwm clock to fast\n"); + goto disable_pwmclk; + } + + /* + * If clkrate is too fast, the calculations in .apply() might overflow. + */ + if (lpc18xx_pwm->clk_rate > NSEC_PER_SEC) { + ret =3D dev_err_probe(&pdev->dev, -EINVAL, "pwm clock to fast\n"); + goto disable_pwmclk; + } + mutex_init(&lpc18xx_pwm->res_lock); mutex_init(&lpc18xx_pwm->period_lock); =20 - val =3D (u64)NSEC_PER_SEC * LPC18XX_PWM_TIMER_MAX; - do_div(val, lpc18xx_pwm->clk_rate); - lpc18xx_pwm->max_period_ns =3D val; + lpc18xx_pwm->max_period_ns =3D + mul_u64_u64_div_u64(NSEC_PER_SEC, LPC18XX_PWM_TIMER_MAX, lpc18xx_pwm->cl= k_rate); =20 lpc18xx_pwm->min_period_ns =3D DIV_ROUND_UP(NSEC_PER_SEC, lpc18xx_pwm->clk_rate); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9876CC2BBC5 for ; Mon, 15 Aug 2022 21:04:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243520AbiHOVE2 (ORCPT ); Mon, 15 Aug 2022 17:04:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346677AbiHOUzb (ORCPT ); Mon, 15 Aug 2022 16:55:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 858483B94C; Mon, 15 Aug 2022 12:11:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D73460BB5; Mon, 15 Aug 2022 19:11:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1868FC433C1; Mon, 15 Aug 2022 19:11:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590669; bh=hP/9KZye9mvWkD+qnzNh7Mn9ujOi/BfJgmHbNS6xy7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ntO2nN81cF3GIceOa6Qc/Bs2VhqrJ+37ThCcVIOl6Md60UfAqth2Rj9YbLDI4MU/4 wMJ/dUyH0kxyI3NFnT7OYsazHM+VQ00X9mA1VsIoBS3RK3p92ftvKEEzUPq1z/H+UQ jxP+XOFJ/ezfAvbbVRsSs0txfIfiZee1iDuUcm1w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.18 0302/1095] drm/meson: Fix refcount leak in meson_encoder_hdmi_init Date: Mon, 15 Aug 2022 19:55:01 +0200 Message-Id: <20220815180442.263636035@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 7381076809586528e2a812a709e2758916318a99 ] of_find_device_by_node() takes reference, we should use put_device() to release it when not need anymore. Add missing put_device() in error path to avoid refcount leak. Fixes: 0af5e0b41110 ("drm/meson: encoder_hdmi: switch to bridge DRM_BRIDGE_= ATTACH_NO_CONNECTOR") Signed-off-by: Miaoqian Lin Reviewed-by: Martin Blumenstingl Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220511054052.51981-1-= linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/m= eson/meson_encoder_hdmi.c index 5e306de6f485..de87f02cd388 100644 --- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c +++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c @@ -435,8 +435,10 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) cec_fill_conn_info_from_drm(&conn_info, meson_encoder_hdmi->connector); =20 notifier =3D cec_notifier_conn_register(&pdev->dev, NULL, &conn_info); - if (!notifier) + if (!notifier) { + put_device(&pdev->dev); return -ENOMEM; + } =20 meson_encoder_hdmi->cec_notifier =3D notifier; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFFB6C00140 for ; Mon, 15 Aug 2022 20:57:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240946AbiHOU5G (ORCPT ); Mon, 15 Aug 2022 16:57:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346834AbiHOUzz (ORCPT ); Mon, 15 Aug 2022 16:55:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D2ACBFE9D; Mon, 15 Aug 2022 12:11:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0B153B810A3; Mon, 15 Aug 2022 19:11:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43DE9C433C1; Mon, 15 Aug 2022 19:11:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590672; bh=EycReFXUTuN8kGxk+znQDQO0kila6gKFLFqmORdtqFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w7E6Wrb8vL7Hit+k8WC9eR+UCfsnvq0Wp0tK5EdW5GowsWpAW+PVz9dSyUisC1CgN yh2USwrhxqBKCu8kvBNuiZe5eqV0IYpKGNE5U+TJq3ZdSq6+xIHSC2SPzin58a6dhq Q+zBolzNi4ix2xHclREFojxeKb1w3iUzZHASWUqg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , Dmitry Baryshkov , Sasha Levin Subject: [PATCH 5.18 0303/1095] drm/dp: Export symbol / kerneldoc fixes for DP AUX bus Date: Mon, 15 Aug 2022 19:55:02 +0200 Message-Id: <20220815180442.306248039@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Douglas Anderson [ Upstream commit 39c28cdfb719f0e306b447f0827dfd712f81858b ] While working on the DP AUX bus code I found a few small things that should be fixed. Namely the non-devm version of of_dp_aux_populate_ep_devices() was missing an export. There was also an extra blank line in a kerneldoc and a kerneldoc that incorrectly documented a return value. Fix these. Fixes: aeb33699fc2c ("drm: Introduce the DP AUX bus") Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Baryshkov Link: https://patchwork.freedesktop.org/patch/msgid/20220510122726.v3.1.Ia9= 1f4849adfc5eb9da1eb37ba79aa65fb3c95a0f@changeid Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/dp/drm_dp_aux_bus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/dp/drm_dp_aux_bus.c b/drivers/gpu/drm/dp/drm_d= p_aux_bus.c index 415afce3cf96..5f06bc0a34ac 100644 --- a/drivers/gpu/drm/dp/drm_dp_aux_bus.c +++ b/drivers/gpu/drm/dp/drm_dp_aux_bus.c @@ -66,7 +66,6 @@ static int dp_aux_ep_probe(struct device *dev) * @dev: The device to remove. * * Calls through to the endpoint driver remove. - * */ static void dp_aux_ep_remove(struct device *dev) { @@ -120,8 +119,6 @@ ATTRIBUTE_GROUPS(dp_aux_ep_dev); /** * dp_aux_ep_dev_release() - Free memory for the dp_aux_ep device * @dev: The device to free. - * - * Return: 0 if no error or negative error code. */ static void dp_aux_ep_dev_release(struct device *dev) { @@ -256,6 +253,7 @@ int of_dp_aux_populate_ep_devices(struct drm_dp_aux *au= x) =20 return 0; } +EXPORT_SYMBOL_GPL(of_dp_aux_populate_ep_devices); =20 static void of_dp_aux_depopulate_ep_devices_void(void *data) { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 167ACC25B0E for ; Mon, 15 Aug 2022 20:52:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346348AbiHOUwb (ORCPT ); Mon, 15 Aug 2022 16:52:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346310AbiHOUui (ORCPT ); Mon, 15 Aug 2022 16:50:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04939BA9D9; Mon, 15 Aug 2022 12:09:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 15C2A6069E; Mon, 15 Aug 2022 19:09:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D338EC433D6; Mon, 15 Aug 2022 19:09:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590576; bh=Ro6xxxF1fVuz0fJmCgBArPo/LziyaAhePT/yijdPk/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SBZ7vpvh90d75KTn+VlbKfR/17GmH0Ug/6KY0pE1UfNkQWUFLYAphAXHy2W8tgn8W UkLLEgHjUKNmRCzbKLRgJWy2jqGl2FDAKGzgCyEOlCdPvRufa7w6tAhefBlaS0082e QKWYD+H1xiqpoCWCS51scnP7K5KC/fpRuGQrOD3E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Marek Vasut , Jonas Karlman , Laurent Pinchart , Maxime Ripard , Neil Armstrong , Sam Ravnborg , Robert Foss , Sasha Levin Subject: [PATCH 5.18 0304/1095] drm/bridge: tc358767: Move (e)DP bridge endpoint parsing into dedicated function Date: Mon, 15 Aug 2022 19:55:03 +0200 Message-Id: <20220815180442.353613337@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marek Vasut [ Upstream commit 8478095a8c4bcea3c83b0767d6c9127434160761 ] The TC358767/TC358867/TC9595 are all capable of operating in multiple modes, DPI-to-(e)DP, DSI-to-(e)DP, DSI-to-DPI. Only the first mode is currently supported. In order to support the rest of the modes without making the tc_probe() overly long, split the bridge endpoint parsing into dedicated function, where the necessary logic to detect the bridge mode based on which endpoints are connected, can be implemented. Reviewed-by: Lucas Stach Tested-by: Lucas Stach # In both DPI to eDP and DS= I to DPI mode. Signed-off-by: Marek Vasut Cc: Jonas Karlman Cc: Laurent Pinchart Cc: Maxime Ripard Cc: Neil Armstrong Cc: Sam Ravnborg Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220329085015.39159-7-= marex@denx.de Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/tc358767.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc3= 58767.c index c23e0abc65e8..835a146a0196 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1549,19 +1549,12 @@ static irqreturn_t tc_irq_handler(int irq, void *ar= g) return IRQ_HANDLED; } =20 -static int tc_probe(struct i2c_client *client, const struct i2c_device_id = *id) +static int tc_probe_edp_bridge_endpoint(struct tc_data *tc) { - struct device *dev =3D &client->dev; + struct device *dev =3D tc->dev; struct drm_panel *panel; - struct tc_data *tc; int ret; =20 - tc =3D devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL); - if (!tc) - return -ENOMEM; - - tc->dev =3D dev; - /* port@2 is the output port */ ret =3D drm_of_find_panel_or_bridge(dev->of_node, 2, 0, &panel, NULL); if (ret && ret !=3D -ENODEV) @@ -1580,6 +1573,25 @@ static int tc_probe(struct i2c_client *client, const= struct i2c_device_id *id) tc->bridge.type =3D DRM_MODE_CONNECTOR_DisplayPort; } =20 + return ret; +} + +static int tc_probe(struct i2c_client *client, const struct i2c_device_id = *id) +{ + struct device *dev =3D &client->dev; + struct tc_data *tc; + int ret; + + tc =3D devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL); + if (!tc) + return -ENOMEM; + + tc->dev =3D dev; + + ret =3D tc_probe_edp_bridge_endpoint(tc); + if (ret) + return ret; + /* Shut down GPIO is optional */ tc->sd_gpio =3D devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); if (IS_ERR(tc->sd_gpio)) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 663D8C00140 for ; Mon, 15 Aug 2022 20:52:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344094AbiHOUwl (ORCPT ); Mon, 15 Aug 2022 16:52:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346569AbiHOUus (ORCPT ); Mon, 15 Aug 2022 16:50:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D8E8BA9F3; Mon, 15 Aug 2022 12:09:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3E8DC60BD8; Mon, 15 Aug 2022 19:09:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2462C433C1; Mon, 15 Aug 2022 19:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590579; bh=+8Q92+MH6sqv7j0NhspQcG/PhDxZECR6G5xE4YY1TWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zVcGnxbgWdYxuPFst7wZYfkZ3Qo2m8NBs+8qXupTUF3rue4v3VYd5vpgNRJUY0rm8 emEYAjXyDc7DQm6mZqnjoPKH7SagL20UONgH/uKwjyA6jI0E++8gZoh++9oTW8wHKl 4zuwUPJMet7Nz2B0jeUe4MEX0V0Ei1hfKaVngQA4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Marek Vasut , Jonas Karlman , Laurent Pinchart , Maxime Ripard , Neil Armstrong , Robert Foss , Sam Ravnborg , Sasha Levin Subject: [PATCH 5.18 0305/1095] drm/bridge: tc358767: Make sure Refclk clock are enabled Date: Mon, 15 Aug 2022 19:55:04 +0200 Message-Id: <20220815180442.405202606@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marek Vasut [ Upstream commit 0b4c48f3e315d172e4cc06e10f2c8ba180788baf ] The Refclk may be supplied by SoC clock output instead of crystal oscillator, make sure the clock are enabled before any other action is performed with the bridge chip, otherwise it may either fail to operate at all, or miss reset GPIO toggle. Reviewed-by: Lucas Stach Fixes: 7caff0fc4296e ("drm/bridge: tc358767: Add DPI to eDP bridge driver") Signed-off-by: Marek Vasut Cc: Jonas Karlman Cc: Laurent Pinchart Cc: Lucas Stach Cc: Marek Vasut Cc: Maxime Ripard Cc: Neil Armstrong Cc: Robert Foss Cc: Sam Ravnborg Reviewed-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20220520121543.11550-1-= marex@denx.de Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/tc358767.c | 32 ++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc3= 58767.c index 835a146a0196..5a51c1699b29 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1576,6 +1576,13 @@ static int tc_probe_edp_bridge_endpoint(struct tc_da= ta *tc) return ret; } =20 +static void tc_clk_disable(void *data) +{ + struct clk *refclk =3D data; + + clk_disable_unprepare(refclk); +} + static int tc_probe(struct i2c_client *client, const struct i2c_device_id = *id) { struct device *dev =3D &client->dev; @@ -1592,6 +1599,24 @@ static int tc_probe(struct i2c_client *client, const= struct i2c_device_id *id) if (ret) return ret; =20 + tc->refclk =3D devm_clk_get(dev, "ref"); + if (IS_ERR(tc->refclk)) { + ret =3D PTR_ERR(tc->refclk); + dev_err(dev, "Failed to get refclk: %d\n", ret); + return ret; + } + + ret =3D clk_prepare_enable(tc->refclk); + if (ret) + return ret; + + ret =3D devm_add_action_or_reset(dev, tc_clk_disable, tc->refclk); + if (ret) + return ret; + + /* tRSTW =3D 100 cycles , at 13 MHz that is ~7.69 us */ + usleep_range(10, 15); + /* Shut down GPIO is optional */ tc->sd_gpio =3D devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); if (IS_ERR(tc->sd_gpio)) @@ -1612,13 +1637,6 @@ static int tc_probe(struct i2c_client *client, const= struct i2c_device_id *id) usleep_range(5000, 10000); } =20 - tc->refclk =3D devm_clk_get(dev, "ref"); - if (IS_ERR(tc->refclk)) { - ret =3D PTR_ERR(tc->refclk); - dev_err(dev, "Failed to get refclk: %d\n", ret); - return ret; - } - tc->regmap =3D devm_regmap_init_i2c(client, &tc_regmap_config); if (IS_ERR(tc->regmap)) { ret =3D PTR_ERR(tc->regmap); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE542C25B0E for ; Mon, 15 Aug 2022 20:52:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346447AbiHOUwo (ORCPT ); Mon, 15 Aug 2022 16:52:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346557AbiHOUur (ORCPT ); Mon, 15 Aug 2022 16:50:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F74ABB02A; Mon, 15 Aug 2022 12:09:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 43CB3B81104; Mon, 15 Aug 2022 19:09:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 732DFC433C1; Mon, 15 Aug 2022 19:09:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590582; bh=YUgwdv0ha6GfdedNy50XsgnM/nrwLiae3iEawstv30M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TPffX3D2H8t0AOsSlaO/ZkQdMTGW/A7lKhH2If9mnZ0tEww6frJld+myYFSi9LHwN iM+uroDfbKk4fNsLJa8HYDkKECP2Bthxy6/cfbzg8ouc5pQkBvIfSmCBfbspHHIQH9 DKv0HRghT3DX0JRJprN1NnLajeSWNaGnd8YlM7Yk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Steev Klimaszewski , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0306/1095] ath10k: do not enforce interrupt trigger type Date: Mon, 15 Aug 2022 19:55:05 +0200 Message-Id: <20220815180442.454980721@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit 1ee6c5abebd3cacf2ac4378d0ed4f57fd4850421 ] Interrupt line can be configured on different hardware in different way, even inverted. Therefore driver should not enforce specific trigger type - edge rising - but instead rely on Devicetree to configure it. All Qualcomm DTSI with WCN3990 define the interrupt type as level high, so the mismatch between DTSI and driver causes rebind issues: $ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/unbind $ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/bind [ 44.763114] irq: type mismatch, failed to map hwirq-446 for interrupt-= controller@17a00000! [ 44.763130] ath10k_snoc 18800000.wifi: error -ENXIO: IRQ index 0 not f= ound [ 44.763140] ath10k_snoc 18800000.wifi: failed to initialize resource: = -6 Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.2.0.c8-00009-QCAHLSWSC8180XMTPLZ-1 Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1 Fixes: c963a683e701 ("ath10k: add resource init and deinit for WCN3990") Signed-off-by: Krzysztof Kozlowski Tested-by: Steev Klimaszewski Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220513151516.357549-1-krzysztof.kozlowski= @linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/ath/ath10k/snoc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/= ath/ath10k/snoc.c index 8328966a0471..603dc7bebc0c 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -1249,13 +1249,12 @@ static void ath10k_snoc_init_napi(struct ath10k *ar) static int ath10k_snoc_request_irq(struct ath10k *ar) { struct ath10k_snoc *ar_snoc =3D ath10k_snoc_priv(ar); - int irqflags =3D IRQF_TRIGGER_RISING; int ret, id; =20 for (id =3D 0; id < CE_COUNT_MAX; id++) { ret =3D request_irq(ar_snoc->ce_irqs[id].irq_line, - ath10k_snoc_per_engine_handler, - irqflags, ce_name[id], ar); + ath10k_snoc_per_engine_handler, 0, + ce_name[id], ar); if (ret) { ath10k_err(ar, "failed to register IRQ handler for CE %d: %d\n", --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0339CC00140 for ; Mon, 15 Aug 2022 20:52:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346481AbiHOUwt (ORCPT ); Mon, 15 Aug 2022 16:52:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346622AbiHOUuv (ORCPT ); Mon, 15 Aug 2022 16:50:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A5CABB03D; Mon, 15 Aug 2022 12:09:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6F4EFB81113; Mon, 15 Aug 2022 19:09:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E001C433C1; Mon, 15 Aug 2022 19:09:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590586; bh=ru6vFrd9wIut4anM86CYO7qaBPUlxfhQhV5tiIGlSqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VWgiNop76vltyU7v3bY2QR6aP1vegm5PpMTzebfvtyfETwfekeSNIG601gW4fA60r CDRccjDMjGXBXcZgAeuDVWmk4MLhMIbxMXziIrRkbhIn5iCFFUy+JBGtXTWKGy2Hix TuGtgNsauHgSCnMWAXYnQo4pUT2Q6zd8xvqL2RD4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yongqin Liu , Amit Pundir , Peter Collingbourne , Vinod Koul , Bjorn Andersson , Robert Foss , kernel-team@android.com, John Stultz , Sasha Levin Subject: [PATCH 5.18 0307/1095] drm/bridge: lt9611: Use both bits for HDMI sensing Date: Mon, 15 Aug 2022 19:55:06 +0200 Message-Id: <20220815180442.506681558@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Stultz [ Upstream commit 649eb3828fb22e829e222ebd83f4e11dc503a565 ] In commit 19cf41b64e3b ("lontium-lt9611: check a different register bit for HDMI sensing"), the bit flag used to detect HDMI cable connect was switched from BIT(2) to BIT(0) to improve compatibility with some monitors that didn't seem to set BIT(2). However, with that change, I've seen occasional issues where the detection failed, because BIT(2) was set, but not BIT(0). Unfortunately, as I understand it, the bits and their function was never clearly documented. So lets instead check both (BIT(2) | BIT(0)) when checking the register. Cc: Yongqin Liu Cc: Amit Pundir Cc: Peter Collingbourne Cc: Vinod Koul Cc: Bjorn Andersson Cc: Robert Foss Cc: kernel-team@android.com Fixes: 19cf41b64e3b ("lontium-lt9611: check a different register bit for HD= MI sensing") Signed-off-by: John Stultz Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220511012612.3297577-= 2-jstultz@google.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/lontium-lt9611.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/brid= ge/lontium-lt9611.c index 63df2e8a8abc..21d1e1465981 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -586,7 +586,7 @@ lt9611_connector_detect(struct drm_connector *connector= , bool force) int connected =3D 0; =20 regmap_read(lt9611->regmap, 0x825e, ®_val); - connected =3D (reg_val & BIT(0)); + connected =3D (reg_val & (BIT(2) | BIT(0))); =20 lt9611->status =3D connected ? connector_status_connected : connector_status_disconnected; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D001C00140 for ; Mon, 15 Aug 2022 20:52:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346528AbiHOUw4 (ORCPT ); Mon, 15 Aug 2022 16:52:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346862AbiHOUvI (ORCPT ); Mon, 15 Aug 2022 16:51:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0127BB6AE; Mon, 15 Aug 2022 12:09:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 98B12B810C6; Mon, 15 Aug 2022 19:09:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D80B9C433D6; Mon, 15 Aug 2022 19:09:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590589; bh=aDKi8r+Ka7824Zy81hOI8/sqQakOv5cZuDn04XHuXOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WB9AR4wtNO7+mYKngDfiDsr4zAEUhcID7ekWyS5qSNoOARuAFUdSh1Nznpqq8sfks LmoMROw4kznseLlSf6r9cnRhF8CKFvH1ydS+by5mNe2oWgCIuQVDKB3SqGDBR5Jhtp QsORMPTqKS7sm5svIDX1RdZQ5EELDSQGrAtSp68o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Javier Martinez Canillas , Geert Uytterhoeven , David Lechner , Sasha Levin Subject: [PATCH 5.18 0308/1095] drm/st7735r: Fix module autoloading for Okaya RH128128T Date: Mon, 15 Aug 2022 19:55:07 +0200 Message-Id: <20220815180442.547058193@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Javier Martinez Canillas [ Upstream commit 9ad6f181ad9a19a26bda73a7b199df44ccfcdaba ] The SPI core always reports a "MODALIAS=3Dspi:", even if the device was registered via OF. This means that the st7735r.ko module won't autoload if a DT has a node with a compatible "okaya,rh128128t" string. In that case, kmod expects a "MODALIAS=3Dof:N*T*Cokaya,rh128128t" uevent but instead will get a "MODALIAS=3Dspi:rh128128t", which is not present in the list of aliases: $ modinfo drivers/gpu/drm/tiny/st7735r.ko | grep alias alias: of:N*T*Cokaya,rh128128tC* alias: of:N*T*Cokaya,rh128128t alias: of:N*T*Cjianda,jd-t18003-t01C* alias: of:N*T*Cjianda,jd-t18003-t01 alias: spi:jd-t18003-t01 To workaround this issue, add in the SPI table an entry for that device. Fixes: d1d511d516f7 ("drm: tiny: st7735r: Add support for Okaya RH128128T") Signed-off-by: Javier Martinez Canillas Reviewed-by: Geert Uytterhoeven Acked-by: David Lechner Link: https://patchwork.freedesktop.org/patch/msgid/20220520091602.179078-1= -javierm@redhat.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/tiny/st7735r.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/tiny/st7735r.c b/drivers/gpu/drm/tiny/st7735r.c index 29d618093e94..e0f02d367d88 100644 --- a/drivers/gpu/drm/tiny/st7735r.c +++ b/drivers/gpu/drm/tiny/st7735r.c @@ -174,6 +174,7 @@ MODULE_DEVICE_TABLE(of, st7735r_of_match); =20 static const struct spi_device_id st7735r_id[] =3D { { "jd-t18003-t01", (uintptr_t)&jd_t18003_t01_cfg }, + { "rh128128t", (uintptr_t)&rh128128t_cfg }, { }, }; MODULE_DEVICE_TABLE(spi, st7735r_id); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA320C00140 for ; Mon, 15 Aug 2022 20:52:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346550AbiHOUw6 (ORCPT ); Mon, 15 Aug 2022 16:52:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346859AbiHOUvI (ORCPT ); Mon, 15 Aug 2022 16:51:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE631BBA60; Mon, 15 Aug 2022 12:09:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8C173B810A3; Mon, 15 Aug 2022 19:09:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6DF0C433C1; Mon, 15 Aug 2022 19:09:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590592; bh=676krTAO+HL4576ThtRweo4aBukNbMS1ytPm871r0PQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zm+oY3s93kxGGazV8TkSVcLDTUD/Uwdr7a6lXMzQ8VUTNKt+nQwqIrV2A9Veb0ACW qs47BajCU7PofWZRmnf44lWCmzQPJ99vCiNPcQWQFi3chREGQ/BzjrCufx/Q/ZHnnh UddswtWgdFlpJBpBjUQJxLtmHPAJ3pDmMGQlKDjg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Gao Chao , Douglas Anderson , Sasha Levin Subject: [PATCH 5.18 0309/1095] drm/panel: Fix build error when CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20=y && CONFIG_DRM_DISPLAY_HELPER=m Date: Mon, 15 Aug 2022 19:55:08 +0200 Message-Id: <20220815180442.585574345@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gao Chao [ Upstream commit a67664860f7833015a683ea295f7c79ac2901332 ] If CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20=3Dy && CONFIG_DRM_DISPLAY_HELPER=3Dm, bulding fails: drivers/gpu/drm/panel/panel-samsung-atna33xc20.o: In function `atana33xc20_= probe': panel-samsung-atna33xc20.c:(.text+0x744): undefined reference to `drm_panel_dp_aux_backlight' make: *** [vmlinux] Error 1 Let CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20 select DRM_DISPLAY_DP_HELPER and CONFIG_DRM_DISPLAY_HELPER to fix this error. Fixes: 32ce3b320343 ("drm/panel: atna33xc20: Introduce the Samsung ATNA33XC= 20 panel") Reported-by: Hulk Robot Signed-off-by: Gao Chao Reviewed-by: Douglas Anderson Signed-off-by: Douglas Anderson Link: https://patchwork.freedesktop.org/patch/msgid/20220524024551.539-1-ga= ochao49@huawei.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/panel/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index ddf5f38e8731..abc5271af4eb 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -428,6 +428,8 @@ config DRM_PANEL_SAMSUNG_ATNA33XC20 depends on OF depends on BACKLIGHT_CLASS_DEVICE depends on PM + select DRM_DISPLAY_DP_HELPER + select DRM_DISPLAY_HELPER select DRM_DP_AUX_BUS help DRM panel driver for the Samsung ATNA33XC20 panel. This panel can't --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E46BC00140 for ; Mon, 15 Aug 2022 20:53:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346586AbiHOUxF (ORCPT ); Mon, 15 Aug 2022 16:53:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346896AbiHOUvN (ORCPT ); Mon, 15 Aug 2022 16:51:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6720CBBA7B; Mon, 15 Aug 2022 12:09:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CD83360BB5; Mon, 15 Aug 2022 19:09:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D235FC433C1; Mon, 15 Aug 2022 19:09:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590595; bh=LMkp6NyyuV2Ez/uJw716SkPh5MsLtM2lf94sqx8wvtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NPkYTJG/JnE0pMXmKDQSv/+1qAaOMKijsIiICyo1/BFnUVAgOBJD7o3ISqd45Y89O 1Q6jxcD7tr+noNx5Q0EL3iCOAsGVXvg5lWtGTFY5SrZDCsA2Ip2sAScokmNyP7PXo4 i+hcq1gYTWt7+2DvyIhWWGW6gZzKK1XP+rheSM9I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0310/1095] wifi: rtlwifi: fix error codes in rtl_debugfs_set_write_h2c() Date: Mon, 15 Aug 2022 19:55:09 +0200 Message-Id: <20220815180442.629180620@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit b88d28146c30a8e14f0f012d56ebf19b68a348f4 ] If the copy_from_user() fails or the user gives invalid date then the correct thing to do is to return a negative error code. (Currently it returns success). I made a copy additional related cleanups: 1) There is no need to check "buffer" for NULL. That's handled by copy_from_user(). 2) The "h2c_len" variable cannot be negative because it is unsigned and because sscanf() does not return negative error codes. Fixes: 610247f46feb ("rtlwifi: Improve debugging by using debugfs") Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YoOLnDkHgVltyXK7@kili Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/realtek/rtlwifi/debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/debug.c b/drivers/net/wir= eless/realtek/rtlwifi/debug.c index 901cdfe3723c..0b1bc04cb6ad 100644 --- a/drivers/net/wireless/realtek/rtlwifi/debug.c +++ b/drivers/net/wireless/realtek/rtlwifi/debug.c @@ -329,8 +329,8 @@ static ssize_t rtl_debugfs_set_write_h2c(struct file *f= ilp, =20 tmp_len =3D (count > sizeof(tmp) - 1 ? sizeof(tmp) - 1 : count); =20 - if (!buffer || copy_from_user(tmp, buffer, tmp_len)) - return count; + if (copy_from_user(tmp, buffer, tmp_len)) + return -EFAULT; =20 tmp[tmp_len] =3D '\0'; =20 @@ -340,8 +340,8 @@ static ssize_t rtl_debugfs_set_write_h2c(struct file *f= ilp, &h2c_data[4], &h2c_data[5], &h2c_data[6], &h2c_data[7]); =20 - if (h2c_len <=3D 0) - return count; + if (h2c_len =3D=3D 0) + return -EINVAL; =20 for (i =3D 0; i < h2c_len; i++) h2c_data_packed[i] =3D (u8)h2c_data[i]; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09A8CC00140 for ; Mon, 15 Aug 2022 20:53:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346632AbiHOUxW (ORCPT ); Mon, 15 Aug 2022 16:53:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347071AbiHOUv2 (ORCPT ); Mon, 15 Aug 2022 16:51:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6B5DBC132; Mon, 15 Aug 2022 12:10:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 085ABB8111D; Mon, 15 Aug 2022 19:10:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C826C433C1; Mon, 15 Aug 2022 19:09:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590598; bh=z0WCtzWyS+jOwGpNrrIHrFVwGek7uF+4CfKOIqfi9QQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r/Xz8RMlsF7KR9uww9g+TC837/hZWO6ZPMtK8aZw4puL8g95Ms+5mAWiu1Jam/eJb OB27Q1KoVgq+4ajUIWbZZod3zO3dTWOIxQgad5QbGP9cHjVxDxDTT6ryaG/VSpn24G U+bVt8iO3+mRWLqxOf0cEpGsgDi84hXxIE7rBuAg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ajay Singh , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0311/1095] wifi: wilc1000: use correct sequence of RESET for chip Power-UP/Down Date: Mon, 15 Aug 2022 19:55:10 +0200 Message-Id: <20220815180442.678122503@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ajay Singh [ Upstream commit fcf690b0b47494df51d214db5c5a714a400b0257 ] For power-up sequence, WILC expects RESET set to high 5ms after making chip_en(enable) so corrected chip power-up sequence by making RESET high. For Power-Down sequence, the correct sequence make RESET and CHIP_EN low without any extra delay. Fixes: ec031ac4792c ("wilc1000: Add reset/enable GPIO support to SPI driver= ") Signed-off-by: Ajay Singh Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220524120606.9675-1-ajay.kathat@microchip= .com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/microchip/wilc1000/spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/microchip/wilc1000/spi.c b/drivers/net/wi= reless/microchip/wilc1000/spi.c index 18420e954402..2ae8dd3411ac 100644 --- a/drivers/net/wireless/microchip/wilc1000/spi.c +++ b/drivers/net/wireless/microchip/wilc1000/spi.c @@ -191,11 +191,11 @@ static void wilc_wlan_power(struct wilc *wilc, bool o= n) /* assert ENABLE: */ gpiod_set_value(gpios->enable, 1); mdelay(5); - /* deassert RESET: */ - gpiod_set_value(gpios->reset, 0); - } else { /* assert RESET: */ gpiod_set_value(gpios->reset, 1); + } else { + /* deassert RESET: */ + gpiod_set_value(gpios->reset, 0); /* deassert ENABLE: */ gpiod_set_value(gpios->enable, 0); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8629DC00140 for ; Mon, 15 Aug 2022 20:53:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346618AbiHOUxR (ORCPT ); Mon, 15 Aug 2022 16:53:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347051AbiHOUv0 (ORCPT ); Mon, 15 Aug 2022 16:51:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AFE6BC82A; Mon, 15 Aug 2022 12:10:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 52E79B81115; Mon, 15 Aug 2022 19:10:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F9B5C433C1; Mon, 15 Aug 2022 19:10:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590602; bh=EuIl50u1Y7763hUPBX+PqMAXEsT4n+GSbJIVGt9vLho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KMG1SP8elsfrRA4eExefljOV0ZFiJ4AebFSIC+vxmGcSHNzDO1izPb8W138L44pwc YlL0bRkGXm4Y0kreZ9dKSQg98VzmrGZGK8WRJEUA4PNLGCnCqaXCb+zhBGKP7B1cxO 8xR37et9TufkXNoP+DDC5NZBhF0H09zx14rlWsqo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0312/1095] ath11k: fix netdev open race Date: Mon, 15 Aug 2022 19:55:11 +0200 Message-Id: <20220815180442.713143049@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold [ Upstream commit d4ba1ff87b17e81686ada8f429300876f55f95ad ] Make sure to allocate resources needed before registering the device. This specifically avoids having a racing open() trigger a BUG_ON() in mod_timer() when ath11k_mac_op_start() is called before the mon_reap_timer as been set up. I did not see this issue with next-20220310, but I hit it on every probe with next-20220511. Perhaps some timing changed in between. Here's the backtrace: [ 51.346947] kernel BUG at kernel/time/timer.c:990! [ 51.346958] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ... [ 51.578225] Call trace: [ 51.583293] __mod_timer+0x298/0x390 [ 51.589518] mod_timer+0x14/0x20 [ 51.595368] ath11k_mac_op_start+0x41c/0x4a0 [ath11k] [ 51.603165] drv_start+0x38/0x60 [mac80211] [ 51.610110] ieee80211_do_open+0x29c/0x7d0 [mac80211] [ 51.617945] ieee80211_open+0x60/0xb0 [mac80211] [ 51.625311] __dev_open+0x100/0x1c0 [ 51.631420] __dev_change_flags+0x194/0x210 [ 51.638214] dev_change_flags+0x24/0x70 [ 51.644646] do_setlink+0x228/0xdb0 [ 51.650723] __rtnl_newlink+0x460/0x830 [ 51.657162] rtnl_newlink+0x4c/0x80 [ 51.663229] rtnetlink_rcv_msg+0x124/0x390 [ 51.669917] netlink_rcv_skb+0x58/0x130 [ 51.676314] rtnetlink_rcv+0x18/0x30 [ 51.682460] netlink_unicast+0x250/0x310 [ 51.688960] netlink_sendmsg+0x19c/0x3e0 [ 51.695458] ____sys_sendmsg+0x220/0x290 [ 51.701938] ___sys_sendmsg+0x7c/0xc0 [ 51.708148] __sys_sendmsg+0x68/0xd0 [ 51.714254] __arm64_sys_sendmsg+0x28/0x40 [ 51.720900] invoke_syscall+0x48/0x120 Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_L= ITE-3 Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Fixes: 840c36fa727a ("ath11k: dp: stop rx pktlog before suspend") Signed-off-by: Johan Hovold Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220517103436.15867-1-johan+linaro@kernel.= org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/ath/ath11k/core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/= ath/ath11k/core.c index 90a5df1fbdbd..0106e529f3c5 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -903,23 +903,23 @@ static int ath11k_core_pdev_create(struct ath11k_base= *ab) return ret; } =20 - ret =3D ath11k_mac_register(ab); + ret =3D ath11k_dp_pdev_alloc(ab); if (ret) { - ath11k_err(ab, "failed register the radio with mac80211: %d\n", ret); + ath11k_err(ab, "failed to attach DP pdev: %d\n", ret); goto err_pdev_debug; } =20 - ret =3D ath11k_dp_pdev_alloc(ab); + ret =3D ath11k_mac_register(ab); if (ret) { - ath11k_err(ab, "failed to attach DP pdev: %d\n", ret); - goto err_mac_unregister; + ath11k_err(ab, "failed register the radio with mac80211: %d\n", ret); + goto err_dp_pdev_free; } =20 ret =3D ath11k_thermal_register(ab); if (ret) { ath11k_err(ab, "could not register thermal device: %d\n", ret); - goto err_dp_pdev_free; + goto err_mac_unregister; } =20 ret =3D ath11k_spectral_init(ab); @@ -932,10 +932,10 @@ static int ath11k_core_pdev_create(struct ath11k_base= *ab) =20 err_thermal_unregister: ath11k_thermal_unregister(ab); -err_dp_pdev_free: - ath11k_dp_pdev_free(ab); err_mac_unregister: ath11k_mac_unregister(ab); +err_dp_pdev_free: + ath11k_dp_pdev_free(ab); err_pdev_debug: ath11k_debugfs_pdev_destroy(ab); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C773C00140 for ; Mon, 15 Aug 2022 20:53:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346603AbiHOUxK (ORCPT ); Mon, 15 Aug 2022 16:53:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347024AbiHOUvZ (ORCPT ); Mon, 15 Aug 2022 16:51:25 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F842BCC1A; Mon, 15 Aug 2022 12:10:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 93EFBCE10E7; Mon, 15 Aug 2022 19:10:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A908DC433C1; Mon, 15 Aug 2022 19:10:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590605; bh=RQSpplCUBZl1qVgA2uUkWWTBCxAn4COWpO14K6KXJUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cEOinR+bvDtNbpw+BZHqY5M4/7F7raUxAgtlLtDI4ObfxSMIRH+Bm00oeRecy4o3y rHS4O0LvrpLaM14l4ZhIrLGeWteNWPqgb96zqKcDRADIlkheOvEhK4Ri7J2JwZmPGn apwGStsds6jqjDxgsYxmzI3q5gnBMpeANcLg4+VY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0313/1095] ath11k: fix IRQ affinity warning on shutdown Date: Mon, 15 Aug 2022 19:55:12 +0200 Message-Id: <20220815180442.750719081@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold [ Upstream commit 3bd0c69653ac636eae8872aacdcd4156f772f928 ] Make sure to clear the IRQ affinity hint also on shutdown to avoid triggering a WARN_ON_ONCE() in __free_irq() when stopping MHI while using a single MSI vector. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_L= ITE-3 Fixes: e94b07493da3 ("ath11k: Set IRQ affinity to CPU0 in case of one MSI v= ector") Signed-off-by: Johan Hovold Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220523143258.24818-1-johan+linaro@kernel.= org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/ath/ath11k/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/a= th/ath11k/pci.c index 8a3ff12057e8..e2382c8595b6 100644 --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c @@ -1566,7 +1566,9 @@ static void ath11k_pci_remove(struct pci_dev *pdev) static void ath11k_pci_shutdown(struct pci_dev *pdev) { struct ath11k_base *ab =3D pci_get_drvdata(pdev); + struct ath11k_pci *ab_pci =3D ath11k_pci_priv(ab); =20 + ath11k_pci_set_irq_affinity_hint(ab_pci, NULL); ath11k_pci_power_down(ab); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 927C8C00140 for ; Mon, 15 Aug 2022 20:53:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346647AbiHOUx2 (ORCPT ); Mon, 15 Aug 2022 16:53:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347072AbiHOUv2 (ORCPT ); Mon, 15 Aug 2022 16:51:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBF75BC12B; Mon, 15 Aug 2022 12:10:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EDEE460693; Mon, 15 Aug 2022 19:10:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00CA4C433D7; Mon, 15 Aug 2022 19:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590611; bh=VBA4o0Mb7y8Az4iYRvFH18ZYSc8JyfxdBkwdZbQ+Q28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qKDWCppXw/WjLlz5Uy+tXPVcpyxH3PYjfxaIQL+zZlhQrvmZ2ddNJyG0X/wUleBbd YB9orDKWdsCemE8yUNPApIjsScCUeDGJ2k79Xx6NlVSFdnAl/XfFBm68MYsS2EQ3lv aCbTbWpCjqIjKOb/SBKpE/utioMaoP0qUIbyNq1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunhao Tian , =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= , Sasha Levin Subject: [PATCH 5.18 0314/1095] drm/mipi-dbi: align max_chunk to 2 in spi_transfer Date: Mon, 15 Aug 2022 19:55:13 +0200 Message-Id: <20220815180442.789065395@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunhao Tian [ Upstream commit 435c249008cba04ed6a7975e9411f3b934620204 ] In __spi_validate, there's a validation that no partial transfers are accepted (xfer->len % w_size must be zero). When max_chunk is not a multiple of bpw (e.g. max_chunk =3D 65535, bpw =3D 16), the transfer will be rejected. This patch aligns max_chunk to 2 bytes (the maximum value of bpw is 16), so that no partial transfer will occur. Fixes: d23d4d4dac01 ("drm/tinydrm: Move tinydrm_spi_transfer()") Signed-off-by: Yunhao Tian Signed-off-by: Noralf Tr=C3=B8nnes Link: https://patchwork.freedesktop.org/patch/msgid/20220510030219.2486687-= 1-t123yh.xyz@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/drm_mipi_dbi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c index 9314f2ead79f..09e4edb5a992 100644 --- a/drivers/gpu/drm/drm_mipi_dbi.c +++ b/drivers/gpu/drm/drm_mipi_dbi.c @@ -1199,6 +1199,13 @@ int mipi_dbi_spi_transfer(struct spi_device *spi, u3= 2 speed_hz, size_t chunk; int ret; =20 + /* In __spi_validate, there's a validation that no partial transfers + * are accepted (xfer->len % w_size must be zero). + * Here we align max_chunk to multiple of 2 (16bits), + * to prevent transfers from being rejected. + */ + max_chunk =3D ALIGN_DOWN(max_chunk, 2); + spi_message_init_with_transfers(&m, &tr, 1); =20 while (len) { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAF9FC25B08 for ; Mon, 15 Aug 2022 20:53:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233227AbiHOUxi (ORCPT ); Mon, 15 Aug 2022 16:53:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347327AbiHOUvw (ORCPT ); Mon, 15 Aug 2022 16:51:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CBCE5F9C; Mon, 15 Aug 2022 12:10:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 14B1D60BBF; Mon, 15 Aug 2022 19:10:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02F91C433D6; Mon, 15 Aug 2022 19:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590614; bh=6xO0dtf62kZWzM4FlVGVCYWpoIe5YdSyyqKESUm66QE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GaYjfbmlaWs3zLHFqg5sNELk1/+CK9qEKX6TUK22cs42GODVy3dJCTDUlWki5zo5J 4jYL/H5J/z3ry639+5j2CL8uWtO6TadddxV3t4gvINlEFyXG407GCiZ9sfp1yfBaFE n3+t3cNt1zhi/6pOXbtZ3XDRV4BdxVjRpRY9Y8Ik= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yuntao Wang , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.18 0315/1095] selftests/bpf: Fix test_run logic in fexit_stress.c Date: Mon, 15 Aug 2022 19:55:14 +0200 Message-Id: <20220815180442.825390550@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yuntao Wang [ Upstream commit eb7b36ce47f830a01ad9405e673b563cc3638d5d ] In the commit da00d2f117a0 ("bpf: Add test ops for BPF_PROG_TYPE_TRACING"), the bpf_fentry_test1 function was moved into bpf_prog_test_run_tracing(), which is the test_run function of the tracing BPF programs. Thus calling 'bpf_prog_test_run_opts(filter_fd, &topts)' will not trigger bpf_fentry_test1 function as filter_fd is a sk_filter BPF program. Fix it by replacing filter_fd with fexit_fd in the bpf_prog_test_run_opts() function. Fixes: da00d2f117a0 ("bpf: Add test ops for BPF_PROG_TYPE_TRACING") Signed-off-by: Yuntao Wang Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20220521151329.648013-1-ytcoode@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../selftests/bpf/prog_tests/fexit_stress.c | 32 +++---------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/fexit_stress.c b/tools/= testing/selftests/bpf/prog_tests/fexit_stress.c index 3ee2107bbf7a..58b03d1a70c8 100644 --- a/tools/testing/selftests/bpf/prog_tests/fexit_stress.c +++ b/tools/testing/selftests/bpf/prog_tests/fexit_stress.c @@ -7,11 +7,9 @@ =20 void test_fexit_stress(void) { - char test_skb[128] =3D {}; int fexit_fd[CNT] =3D {}; int link_fd[CNT] =3D {}; - char error[4096]; - int err, i, filter_fd; + int err, i; =20 const struct bpf_insn trace_program[] =3D { BPF_MOV64_IMM(BPF_REG_0, 0), @@ -20,25 +18,9 @@ void test_fexit_stress(void) =20 LIBBPF_OPTS(bpf_prog_load_opts, trace_opts, .expected_attach_type =3D BPF_TRACE_FEXIT, - .log_buf =3D error, - .log_size =3D sizeof(error), ); =20 - const struct bpf_insn skb_program[] =3D { - BPF_MOV64_IMM(BPF_REG_0, 0), - BPF_EXIT_INSN(), - }; - - LIBBPF_OPTS(bpf_prog_load_opts, skb_opts, - .log_buf =3D error, - .log_size =3D sizeof(error), - ); - - LIBBPF_OPTS(bpf_test_run_opts, topts, - .data_in =3D test_skb, - .data_size_in =3D sizeof(test_skb), - .repeat =3D 1, - ); + LIBBPF_OPTS(bpf_test_run_opts, topts); =20 err =3D libbpf_find_vmlinux_btf_id("bpf_fentry_test1", trace_opts.expected_attach_type); @@ -58,15 +40,9 @@ void test_fexit_stress(void) goto out; } =20 - filter_fd =3D bpf_prog_load(BPF_PROG_TYPE_SOCKET_FILTER, NULL, "GPL", - skb_program, sizeof(skb_program) / sizeof(struct bpf_insn), - &skb_opts); - if (!ASSERT_GE(filter_fd, 0, "test_program_loaded")) - goto out; + err =3D bpf_prog_test_run_opts(fexit_fd[0], &topts); + ASSERT_OK(err, "bpf_prog_test_run_opts"); =20 - err =3D bpf_prog_test_run_opts(filter_fd, &topts); - close(filter_fd); - CHECK_FAIL(err); out: for (i =3D 0; i < CNT; i++) { if (link_fd[i]) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 655A6C00140 for ; Mon, 15 Aug 2022 20:53:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346743AbiHOUx4 (ORCPT ); Mon, 15 Aug 2022 16:53:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347392AbiHOUvz (ORCPT ); Mon, 15 Aug 2022 16:51:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC7C0B876; Mon, 15 Aug 2022 12:10:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6429860BB5; Mon, 15 Aug 2022 19:10:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6923FC433D7; Mon, 15 Aug 2022 19:10:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590617; bh=Y9GDYJGTUHPrxHBpY+wSUMwQDWvSENsK0Fje2HaRYaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NXfm54cJaQqY14HEiSlzv9r+ve3uero0bFueBwjSElaDXjVaLyDkrImTgyi2oQVn1 zfABVPzve6ev4jk8IBVaI97mdkneWLRFiUhPdaGGve6iUZxBI0c5mC2OpG5lRqX67y wu33AMkRnfk8yWq4u1p//YrbPNh/XX5ieESUwKNo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Martin KaFai Lau , Song Liu , Sasha Levin Subject: [PATCH 5.18 0316/1095] selftests/bpf: Fix tc_redirect_dtime Date: Mon, 15 Aug 2022 19:55:15 +0200 Message-Id: <20220815180442.863797763@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Martin KaFai Lau [ Upstream commit e6ff92f41b65fce07365f1066fb13b5e42aca08d ] tc_redirect_dtime was reported flaky from time to time. It always fails at the udp test and complains about the bpf@tc-ingress got a skb->tstamp when handling udp packet. It is unexpected because the skb->tstamp should have been cleared when crossing different netns. The most likely cause is that the skb is actually a tcp packet from the earlier tcp test. It could be the final TCP_FIN handling. This patch tightens the skb->tstamp check in the bpf prog. It ensures the skb is the current testing traffic. First, it checks that skb matches the IPPROTO of the running test (i.e. tcp vs udp). Second, it checks the server port (dst_ns_port). The server port is unique for each test (50000 + test_enum). Also fixed a typo in test_udp_dtime(): s/P100/P101/ Fixes: c803475fd8dd ("bpf: selftests: test skb->tstamp in redirect_neigh") Reported-by: Andrii Nakryiko Signed-off-by: Martin KaFai Lau Signed-off-by: Andrii Nakryiko Acked-by: Song Liu Link: https://lore.kernel.org/bpf/20220601234050.2572671-1-kafai@fb.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../selftests/bpf/prog_tests/tc_redirect.c | 8 +-- .../selftests/bpf/progs/test_tc_dtime.c | 53 ++++++++++++++++++- 2 files changed, 55 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/tc_redirect.c b/tools/t= esting/selftests/bpf/prog_tests/tc_redirect.c index 7ad66a247c02..b2e415647bd7 100644 --- a/tools/testing/selftests/bpf/prog_tests/tc_redirect.c +++ b/tools/testing/selftests/bpf/prog_tests/tc_redirect.c @@ -646,7 +646,7 @@ static void test_tcp_clear_dtime(struct test_tc_dtime *= skel) __u32 *errs =3D skel->bss->errs[t]; =20 skel->bss->test =3D t; - test_inet_dtime(AF_INET6, SOCK_STREAM, IP6_DST, 0); + test_inet_dtime(AF_INET6, SOCK_STREAM, IP6_DST, 50000 + t); =20 ASSERT_EQ(dtimes[INGRESS_FWDNS_P100], 0, dtime_cnt_str(t, INGRESS_FWDNS_P100)); @@ -683,7 +683,7 @@ static void test_tcp_dtime(struct test_tc_dtime *skel, = int family, bool bpf_fwd) errs =3D skel->bss->errs[t]; =20 skel->bss->test =3D t; - test_inet_dtime(family, SOCK_STREAM, addr, 0); + test_inet_dtime(family, SOCK_STREAM, addr, 50000 + t); =20 /* fwdns_prio100 prog does not read delivery_time_type, so * kernel puts the (rcv) timetamp in __sk_buff->tstamp @@ -715,13 +715,13 @@ static void test_udp_dtime(struct test_tc_dtime *skel= , int family, bool bpf_fwd) errs =3D skel->bss->errs[t]; =20 skel->bss->test =3D t; - test_inet_dtime(family, SOCK_DGRAM, addr, 0); + test_inet_dtime(family, SOCK_DGRAM, addr, 50000 + t); =20 ASSERT_EQ(dtimes[INGRESS_FWDNS_P100], 0, dtime_cnt_str(t, INGRESS_FWDNS_P100)); /* non mono delivery time is not forwarded */ ASSERT_EQ(dtimes[INGRESS_FWDNS_P101], 0, - dtime_cnt_str(t, INGRESS_FWDNS_P100)); + dtime_cnt_str(t, INGRESS_FWDNS_P101)); for (i =3D EGRESS_FWDNS_P100; i < SET_DTIME; i++) ASSERT_GT(dtimes[i], 0, dtime_cnt_str(t, i)); =20 diff --git a/tools/testing/selftests/bpf/progs/test_tc_dtime.c b/tools/test= ing/selftests/bpf/progs/test_tc_dtime.c index 06f300d06dbd..b596479a9ebe 100644 --- a/tools/testing/selftests/bpf/progs/test_tc_dtime.c +++ b/tools/testing/selftests/bpf/progs/test_tc_dtime.c @@ -11,6 +11,8 @@ #include #include #include +#include +#include #include #include #include @@ -115,6 +117,19 @@ static bool bpf_fwd(void) return test < TCP_IP4_RT_FWD; } =20 +static __u8 get_proto(void) +{ + switch (test) { + case UDP_IP4: + case UDP_IP6: + case UDP_IP4_RT_FWD: + case UDP_IP6_RT_FWD: + return IPPROTO_UDP; + default: + return IPPROTO_TCP; + } +} + /* -1: parse error: TC_ACT_SHOT * 0: not testing traffic: TC_ACT_OK * >0: first byte is the inet_proto, second byte has the netns @@ -122,11 +137,16 @@ static bool bpf_fwd(void) */ static int skb_get_type(struct __sk_buff *skb) { + __u16 dst_ns_port =3D __bpf_htons(50000 + test); void *data_end =3D ctx_ptr(skb->data_end); void *data =3D ctx_ptr(skb->data); __u8 inet_proto =3D 0, ns =3D 0; struct ipv6hdr *ip6h; + __u16 sport, dport; struct iphdr *iph; + struct tcphdr *th; + struct udphdr *uh; + void *trans; =20 switch (skb->protocol) { case __bpf_htons(ETH_P_IP): @@ -138,6 +158,7 @@ static int skb_get_type(struct __sk_buff *skb) else if (iph->saddr =3D=3D ip4_dst) ns =3D DST_NS; inet_proto =3D iph->protocol; + trans =3D iph + 1; break; case __bpf_htons(ETH_P_IPV6): ip6h =3D data + sizeof(struct ethhdr); @@ -148,15 +169,43 @@ static int skb_get_type(struct __sk_buff *skb) else if (v6_equal(ip6h->saddr, (struct in6_addr)ip6_dst)) ns =3D DST_NS; inet_proto =3D ip6h->nexthdr; + trans =3D ip6h + 1; break; default: return 0; } =20 - if ((inet_proto !=3D IPPROTO_TCP && inet_proto !=3D IPPROTO_UDP) || !ns) + /* skb is not from src_ns or dst_ns. + * skb is not the testing IPPROTO. + */ + if (!ns || inet_proto !=3D get_proto()) return 0; =20 - return (ns << 8 | inet_proto); + switch (inet_proto) { + case IPPROTO_TCP: + th =3D trans; + if (th + 1 > data_end) + return -1; + sport =3D th->source; + dport =3D th->dest; + break; + case IPPROTO_UDP: + uh =3D trans; + if (uh + 1 > data_end) + return -1; + sport =3D uh->source; + dport =3D uh->dest; + break; + default: + return 0; + } + + /* The skb is the testing traffic */ + if ((ns =3D=3D SRC_NS && dport =3D=3D dst_ns_port) || + (ns =3D=3D DST_NS && sport =3D=3D dst_ns_port)) + return (ns << 8 | inet_proto); + + return 0; } =20 /* format: direction@iface@netns --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6918AC00140 for ; Mon, 15 Aug 2022 20:53:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346718AbiHOUxr (ORCPT ); Mon, 15 Aug 2022 16:53:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347331AbiHOUvx (ORCPT ); Mon, 15 Aug 2022 16:51:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEF0164C6; Mon, 15 Aug 2022 12:10:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ECF81B8110A; Mon, 15 Aug 2022 19:10:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62675C433D7; Mon, 15 Aug 2022 19:10:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590620; bh=UiuXq+O+TWvZvtGWtPyiiBd9mUZBPmF5j2zcrxg92eI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tBsjXT47vG67w0yBk8kPCwwlqrg1P9VjJap+Q8oddo3RfdHjf2VIPO95sV4D8ym+W P2XwnKs2IpLafT8cWfJSHqPtgvGoIMXYoUtWGiuefv1T0DkNZoKp600T6vf9SNlSyv Ud9N1BO85k+J1xwcdv1W5B/pPG/F+XLZyXU+yaHk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Ansuel Marangi , Jeff Johnson , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0317/1095] ath11k: fix missing skb drop on htc_tx_completion error Date: Mon, 15 Aug 2022 19:55:16 +0200 Message-Id: <20220815180442.908369248@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian 'Ansuel' Marangi [ Upstream commit e5646fe3b7ef739c392e59da7db6adf5e1fdef42 ] On htc_tx_completion error the skb is not dropped. This is wrong since the completion_handler logic expect the skb to be consumed anyway even when an error is triggered. Not freeing the skb on error is a memory leak since the skb won't be freed anywere else. Correctly free the packet on eid >=3D ATH11K_HTC_EP_COUNT before returning. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1 Fixes: f951380a6022 ("ath11k: Disabling credit flow for WMI path") Signed-off-by: Christian 'Ansuel' Marangi Reviewed-by: Jeff Johnson Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220528142516.20819-2-ansuelsmth@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/ath/ath11k/htc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/htc.c b/drivers/net/wireless/a= th/ath11k/htc.c index 6913b7494b9b..2de1e953a539 100644 --- a/drivers/net/wireless/ath/ath11k/htc.c +++ b/drivers/net/wireless/ath/ath11k/htc.c @@ -258,8 +258,10 @@ void ath11k_htc_tx_completion_handler(struct ath11k_ba= se *ab, u8 eid; =20 eid =3D ATH11K_SKB_CB(skb)->eid; - if (eid >=3D ATH11K_HTC_EP_COUNT) + if (eid >=3D ATH11K_HTC_EP_COUNT) { + dev_kfree_skb_any(skb); return; + } =20 ep =3D &htc->endpoint[eid]; spin_lock_bh(&htc->tx_lock); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39973C00140 for ; Mon, 15 Aug 2022 20:53:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346730AbiHOUxv (ORCPT ); Mon, 15 Aug 2022 16:53:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347339AbiHOUvx (ORCPT ); Mon, 15 Aug 2022 16:51:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20FFC65B5; Mon, 15 Aug 2022 12:10:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4C6A060EEE; Mon, 15 Aug 2022 19:10:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50B28C433D6; Mon, 15 Aug 2022 19:10:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590623; bh=SRi8kUHq7tGKlhz6xYUk1plavmbnQCBV5VrKeiUxa6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kcXZZRIY3PK5/4zZUZLKdWa1U/ZLlKN8i2+ZjKW5wrcLwLJjZFVRGPzgKzYjGwYDa kdZMA3i3mnMHRwSbO/ZSS+Kd8vKP1oUQz38WOBtFE5M+9bzRrdoAV3JvC1aXJGF0L4 sD7F0X6//uzVADppk5jT89XDtYyR1e0n/yEKwTbY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manikanta Pubbisetty , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0318/1095] ath11k: Fix incorrect debug_mask mappings Date: Mon, 15 Aug 2022 19:55:17 +0200 Message-Id: <20220815180442.941259834@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Manikanta Pubbisetty [ Upstream commit 9331f7d3c54a263bede5055e106e40b28d0bd937 ] Currently a couple of debug_mask entries are mapped to the same value, this could enable unintended driver logging. If enabling DP_TX logs was the intention, then this could also enable PCI logs flooding the dmesg buffer or vice versa. Fix this by correctly assigning the debug masks. Found during code review. Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 Fixes: aa2092a9bab3f ("ath11k: add raw mode and software crypto support") Signed-off-by: Manikanta Pubbisetty Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220602115621.15339-1-quic_mpubbise@quicin= c.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/ath/ath11k/debug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/debug.h b/drivers/net/wireless= /ath/ath11k/debug.h index fbbd5fe02aa8..91545640c47b 100644 --- a/drivers/net/wireless/ath/ath11k/debug.h +++ b/drivers/net/wireless/ath/ath11k/debug.h @@ -23,8 +23,8 @@ enum ath11k_debug_mask { ATH11K_DBG_TESTMODE =3D 0x00000400, ATH11k_DBG_HAL =3D 0x00000800, ATH11K_DBG_PCI =3D 0x00001000, - ATH11K_DBG_DP_TX =3D 0x00001000, - ATH11K_DBG_DP_RX =3D 0x00002000, + ATH11K_DBG_DP_TX =3D 0x00002000, + ATH11K_DBG_DP_RX =3D 0x00004000, ATH11K_DBG_ANY =3D 0xffffffff, }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C420DC00140 for ; Mon, 15 Aug 2022 20:54:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244151AbiHOUyZ (ORCPT ); Mon, 15 Aug 2022 16:54:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346569AbiHOUw7 (ORCPT ); Mon, 15 Aug 2022 16:52:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0402F4B0E8; Mon, 15 Aug 2022 12:10:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 40C866009B; Mon, 15 Aug 2022 19:10:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A91EC433D6; Mon, 15 Aug 2022 19:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590626; bh=I+I2wzV0Z+MxOytYnSFYZBmG2OVavB/tYy6DM0PO2BQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cDkPbZgyaTElTHmR4cDusjzci2npgby3UmINYeZ04GKYYk/dMMw7DY1xoFzOeYuKh 3QY+JkdbmmHa06xKevHGeWG7NlCoq8Elfortc47a76cf6gAbk49fzpNsIS2wgEGiV7 +WCqhpIWchVpHIERYsoqMF+Ic5aJH9Z3CM8RAUc0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manikanta Pubbisetty , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0319/1095] ath11k: Avoid REO CMD failed prints during firmware recovery Date: Mon, 15 Aug 2022 19:55:18 +0200 Message-Id: <20220815180442.983210975@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Manikanta Pubbisetty [ Upstream commit 0ab52b2bd7be8fd49c8ade7703c1faa15359c6c5 ] Currently when firmware recovery is in progress, we do not queue REO commands to the firmware, instead -ESHUTDOWN will be returned to the caller leading to a failure print on the console. The REO command in the problem scenario is sent for all tids of a peer in which case we will have 16 failure prints on the console for a single peer. For an AP usecase, this count would be even higher in a worst case scenario. Since these commands are bound to fail during firmware recovery, it is better to avoid printing these failures and thereby avoid message flooding on the console. Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 Fixes: 8ee8d38ca472 ("ath11k: Fix crash during firmware recovery on reo cmd= ring access") Signed-off-by: Manikanta Pubbisetty Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220602122929.18896-1-quic_mpubbise@quicin= c.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/ath/ath11k/dp_rx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless= /ath/ath11k/dp_rx.c index 049774cc158c..b3e133add1ce 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -835,8 +835,9 @@ void ath11k_peer_rx_tid_delete(struct ath11k *ar, HAL_REO_CMD_UPDATE_RX_QUEUE, &cmd, ath11k_dp_rx_tid_del_func); if (ret) { - ath11k_err(ar->ab, "failed to send HAL_REO_CMD_UPDATE_RX_QUEUE cmd, tid = %d (%d)\n", - tid, ret); + if (ret !=3D -ESHUTDOWN) + ath11k_err(ar->ab, "failed to send HAL_REO_CMD_UPDATE_RX_QUEUE cmd, tid= %d (%d)\n", + tid, ret); dma_unmap_single(ar->ab->dev, rx_tid->paddr, rx_tid->size, DMA_BIDIRECTIONAL); kfree(rx_tid->vaddr); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5A45C282E7 for ; Mon, 15 Aug 2022 20:54:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346516AbiHOUyO (ORCPT ); Mon, 15 Aug 2022 16:54:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346411AbiHOUwf (ORCPT ); Mon, 15 Aug 2022 16:52:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 459C3BCC36; Mon, 15 Aug 2022 12:10:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 25E5660EDA; Mon, 15 Aug 2022 19:10:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12C5CC433C1; Mon, 15 Aug 2022 19:10:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590629; bh=sFF/GLrtKkldifMSHkZh0cLIrumrBiRtQIFmzUP1GiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xD7U4pbpHpk08CyqOrYx+iIl3WjG0bfeHxf1KJxOGkpeewiRJ6CGJcC1RxLjSZoYB 7fcBwqSq12vdI7k8cVPBWcmK9rx6yTskLv1Qun/e33MKWwzJXSeXDxqYtW0jYznWPo FwFiRq9SSqubIFTlFaCQG6xZQkM2ujkF85hD4W1c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kodanev , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 0320/1095] drm/radeon: fix potential buffer overflow in ni_set_mc_special_registers() Date: Mon, 15 Aug 2022 19:55:19 +0200 Message-Id: <20220815180443.028776021@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexey Kodanev [ Upstream commit 136f614931a2bb73616b292cf542da3a18daefd5 ] The last case label can write two buffers 'mc_reg_address[j]' and 'mc_data[j]' with 'j' offset equal to SMC_NISLANDS_MC_REGISTER_ARRAY_SIZE since there are no checks for this value in both case labels after the last 'j++'. Instead of changing '>' to '>=3D' there, add the bounds check at the start of the second 'case' (the first one already has it). Also, remove redundant last checks for 'j' index bigger than array size. The expression is always false. Moreover, before or after the patch 'table->last' can be equal to SMC_NISLANDS_MC_REGISTER_ARRAY_SIZE and it seems it can be a valid value. Detected using the static analysis tool - Svace. Fixes: 69e0b57a91ad ("drm/radeon/kms: add dpm support for cayman (v5)") Signed-off-by: Alexey Kodanev Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/radeon/ni_dpm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dp= m.c index 769f666335ac..672d2239293e 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c @@ -2741,10 +2741,10 @@ static int ni_set_mc_special_registers(struct radeo= n_device *rdev, table->mc_reg_table_entry[k].mc_data[j] |=3D 0x100; } j++; - if (j > SMC_NISLANDS_MC_REGISTER_ARRAY_SIZE) - return -EINVAL; break; case MC_SEQ_RESERVE_M >> 2: + if (j >=3D SMC_NISLANDS_MC_REGISTER_ARRAY_SIZE) + return -EINVAL; temp_reg =3D RREG32(MC_PMG_CMD_MRS1); table->mc_reg_address[j].s1 =3D MC_PMG_CMD_MRS1 >> 2; table->mc_reg_address[j].s0 =3D MC_SEQ_PMG_CMD_MRS1_LP >> 2; @@ -2753,8 +2753,6 @@ static int ni_set_mc_special_registers(struct radeon_= device *rdev, (temp_reg & 0xffff0000) | (table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff); j++; - if (j > SMC_NISLANDS_MC_REGISTER_ARRAY_SIZE) - return -EINVAL; break; default: break; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E8DBC00140 for ; Mon, 15 Aug 2022 20:54:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243353AbiHOUyW (ORCPT ); Mon, 15 Aug 2022 16:54:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344371AbiHOUwn (ORCPT ); Mon, 15 Aug 2022 16:52:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 953D49FAB1; Mon, 15 Aug 2022 12:10:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2E5C160EDD; Mon, 15 Aug 2022 19:10:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 211BAC433D6; Mon, 15 Aug 2022 19:10:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590632; bh=qj9zv4Asp2qcYhRvdIM8lQqz0pcfMVMfTnPtvOnYLNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v/+hV1yoOLPpi424f4RLY/uyCAtuApiFQy1lkQsstt35koLFhAhgwPbitJJs2hx6s ge9qtCaktFiQYuQ3Wg+TCXlsqItDTGBWz/1FZEdwrtv4fprRQivWjeeLBw7QeJaxje qzUHXLxSnxbtrDou/foCwwC9YDuPTBd8Jf89/b6U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jitao Shi , Xinlei Lee , Rex-BC Chen , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.18 0321/1095] drm/mediatek: Modify dsi funcs to atomic operations Date: Mon, 15 Aug 2022 19:55:20 +0200 Message-Id: <20220815180443.077044401@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xinlei Lee [ Upstream commit 7f6335c6a258edf4d5ff1b904bc033188dc7b48b ] Because .enable & .disable are deprecated. Use .atomic_enable & .atomic_disable instead. Link: https://patchwork.kernel.org/project/linux-mediatek/patch/1653012007-= 11854-2-git-send-email-xinlei.lee@mediatek.com/ Signed-off-by: Jitao Shi Signed-off-by: Xinlei Lee Reviewed-by: Rex-BC Chen Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/= mtk_dsi.c index ccb0511b9cd5..7a98ae100c06 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -751,14 +751,16 @@ static void mtk_dsi_bridge_mode_set(struct drm_bridge= *bridge, drm_display_mode_to_videomode(adjusted, &dsi->vm); } =20 -static void mtk_dsi_bridge_disable(struct drm_bridge *bridge) +static void mtk_dsi_bridge_atomic_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct mtk_dsi *dsi =3D bridge_to_dsi(bridge); =20 mtk_output_dsi_disable(dsi); } =20 -static void mtk_dsi_bridge_enable(struct drm_bridge *bridge) +static void mtk_dsi_bridge_atomic_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct mtk_dsi *dsi =3D bridge_to_dsi(bridge); =20 @@ -767,8 +769,8 @@ static void mtk_dsi_bridge_enable(struct drm_bridge *br= idge) =20 static const struct drm_bridge_funcs mtk_dsi_bridge_funcs =3D { .attach =3D mtk_dsi_bridge_attach, - .disable =3D mtk_dsi_bridge_disable, - .enable =3D mtk_dsi_bridge_enable, + .atomic_disable =3D mtk_dsi_bridge_atomic_disable, + .atomic_enable =3D mtk_dsi_bridge_atomic_enable, .mode_set =3D mtk_dsi_bridge_mode_set, }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D699CC25B08 for ; Mon, 15 Aug 2022 20:54:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346229AbiHOUyy (ORCPT ); Mon, 15 Aug 2022 16:54:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346078AbiHOUyF (ORCPT ); Mon, 15 Aug 2022 16:54:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7891ABD113; Mon, 15 Aug 2022 12:10:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2877360693; Mon, 15 Aug 2022 19:10:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32209C433C1; Mon, 15 Aug 2022 19:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590635; bh=mEJcYFqxbaLpd70A3pl4J4Nih1wGRQcFljgUuJNShsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KQ0A8LBV5ZefFQzipieclZ3vMHqkZ5orn0ednu917IeaiY30aPUeAIo05JDUXOWVC JKT0ObauP88vvIFOBL4Bx4S9Eq9Fhs+EgngMiB3kSbcyo/1ROadqK1x7LSmOXsuwof f2uE50WJpTzpXauTa6lpojuu3hWqQYY4uEqhm7OQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jitao Shi , Xinlei Lee , AngeloGioacchino Del Regno , Rex-BC Chen , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.18 0322/1095] drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs Date: Mon, 15 Aug 2022 19:55:21 +0200 Message-Id: <20220815180443.115017259@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jitao Shi [ Upstream commit cde7e2e35c2866d22a3a012e72a41052dfcc255d ] In order to match the changes of "Use the drm_panel_bridge API", the poweron/poweroff of dsi is extracted from enable/disable and defined as new funcs (atomic_pre_enable/atomic_post_disable). Since dsi_poweron is moved from dsi_enable to pre_enable function, in order to avoid poweron failure, the operation of dsi register fails to cause bus hang. Therefore, the protection mechanism is added to the dsi_enable function. Fixes: 2dd8075d2185 ("drm/mediatek: mtk_dsi: Use the drm_panel_bridge API") Link: https://patchwork.kernel.org/project/linux-mediatek/patch/1653012007-= 11854-3-git-send-email-xinlei.lee@mediatek.com/ Signed-off-by: Jitao Shi Signed-off-by: Xinlei Lee Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Rex-BC Chen Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/mediatek/mtk_dsi.c | 53 +++++++++++++++++++----------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/= mtk_dsi.c index 7a98ae100c06..3a6ee6e9ad2c 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -679,16 +679,6 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi) if (--dsi->refcount !=3D 0) return; =20 - /* - * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since - * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), - * which needs irq for vblank, and mtk_dsi_stop() will disable irq. - * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(), - * after dsi is fully set. - */ - mtk_dsi_stop(dsi); - - mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500); mtk_dsi_reset_engine(dsi); mtk_dsi_lane0_ulp_mode_enter(dsi); mtk_dsi_clk_ulp_mode_enter(dsi); @@ -703,17 +693,9 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi) =20 static void mtk_output_dsi_enable(struct mtk_dsi *dsi) { - int ret; - if (dsi->enabled) return; =20 - ret =3D mtk_dsi_poweron(dsi); - if (ret < 0) { - DRM_ERROR("failed to power on dsi\n"); - return; - } - mtk_dsi_set_mode(dsi); mtk_dsi_clk_hs_mode(dsi, 1); =20 @@ -727,7 +709,16 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi) if (!dsi->enabled) return; =20 - mtk_dsi_poweroff(dsi); + /* + * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since + * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), + * which needs irq for vblank, and mtk_dsi_stop() will disable irq. + * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(), + * after dsi is fully set. + */ + mtk_dsi_stop(dsi); + + mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500); =20 dsi->enabled =3D false; } @@ -764,13 +755,37 @@ static void mtk_dsi_bridge_atomic_enable(struct drm_b= ridge *bridge, { struct mtk_dsi *dsi =3D bridge_to_dsi(bridge); =20 + if (dsi->refcount =3D=3D 0) + return; + mtk_output_dsi_enable(dsi); } =20 +static void mtk_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) +{ + struct mtk_dsi *dsi =3D bridge_to_dsi(bridge); + int ret; + + ret =3D mtk_dsi_poweron(dsi); + if (ret < 0) + DRM_ERROR("failed to power on dsi\n"); +} + +static void mtk_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) +{ + struct mtk_dsi *dsi =3D bridge_to_dsi(bridge); + + mtk_dsi_poweroff(dsi); +} + static const struct drm_bridge_funcs mtk_dsi_bridge_funcs =3D { .attach =3D mtk_dsi_bridge_attach, .atomic_disable =3D mtk_dsi_bridge_atomic_disable, .atomic_enable =3D mtk_dsi_bridge_atomic_enable, + .atomic_pre_enable =3D mtk_dsi_bridge_atomic_pre_enable, + .atomic_post_disable =3D mtk_dsi_bridge_atomic_post_disable, .mode_set =3D mtk_dsi_bridge_mode_set, }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B66AC00140 for ; Mon, 15 Aug 2022 20:54:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344716AbiHOUy1 (ORCPT ); Mon, 15 Aug 2022 16:54:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346562AbiHOUw6 (ORCPT ); Mon, 15 Aug 2022 16:52:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8674F6443; Mon, 15 Aug 2022 12:10:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D2A14B81109; Mon, 15 Aug 2022 19:10:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20C0EC433C1; Mon, 15 Aug 2022 19:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590638; bh=VTOtyVBISkeg2LXdvA8xIlbkH26cTOLWS3LXku/n0/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YT9bGNZPjFfY6mKC5DpC6BcU2lsM9F/K+6tW9f7wbK2yOp+t4TjhRXq1WOltX3dFD VpeBeovovTMFBPelWkQR2Ly9YkRcNHKMEWvJLVFlwCIcMjthhYecj4to4RZwAa6XGE f9mZnVlIVY4eYGLBtOJx8NY6al2fCV3QwjGk8dPQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jitao Shi , Xinlei Lee , Rex-BC Chen , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.18 0323/1095] drm/mediatek: Add pull-down MIPI operation in mtk_dsi_poweroff function Date: Mon, 15 Aug 2022 19:55:22 +0200 Message-Id: <20220815180443.146895295@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xinlei Lee [ Upstream commit fa5d0a0205c34734c5b8daa77e39ac2817f63a10 ] In the dsi_enable function, mtk_dsi_rxtx_control is to pull up the MIPI signal operation. Before dsi_disable, MIPI should also be pulled down by writing a register instead of disabling dsi. If disable dsi without pulling the mipi signal low, the value of the register will still maintain the setting of the mipi signal being pulled high. After resume, even if the mipi signal is not pulled high, it will still be in the high state. Fixes: 2e54c14e310f ("drm/mediatek: Add DSI sub driver") Link: https://patchwork.kernel.org/project/linux-mediatek/patch/1653012007-= 11854-5-git-send-email-xinlei.lee@mediatek.com/ Signed-off-by: Jitao Shi Signed-off-by: Xinlei Lee Reviewed-by: Rex-BC Chen Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/= mtk_dsi.c index 3a6ee6e9ad2c..f0f523bdafb8 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -682,6 +682,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi) mtk_dsi_reset_engine(dsi); mtk_dsi_lane0_ulp_mode_enter(dsi); mtk_dsi_clk_ulp_mode_enter(dsi); + /* set the lane number as 0 to pull down mipi */ + writel(0, dsi->regs + DSI_TXRX_CTRL); =20 mtk_dsi_disable(dsi); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E46CC00140 for ; Mon, 15 Aug 2022 20:55:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245186AbiHOUz2 (ORCPT ); Mon, 15 Aug 2022 16:55:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346677AbiHOUyP (ORCPT ); Mon, 15 Aug 2022 16:54:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1379CBE4D5; Mon, 15 Aug 2022 12:11:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 44F3BB810A3; Mon, 15 Aug 2022 19:10:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D0C9C433C1; Mon, 15 Aug 2022 19:10:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590644; bh=bwO1Mm4K1TDzi0Wmw7DeJjExMDBZD3OMknw3wAmxiZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qadc7zT1/V6qERdkAcoFH7MR09tW2vtqgYeL6I982X6GLTW81bAS8z9QP4b2zSQ/7 QiZ5J80AuPTAmh7U/Om1gxWDvqtO+vz/8ZDLrUWmhUwFHkdU5TyIYWs2++0oaQ5B3k 4J42hAZl3vFezddTUdIUbNpO22SRB79eQDM9sYgg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.18 0324/1095] drm/meson: encoder_cvbs: Fix refcount leak in meson_encoder_cvbs_init Date: Mon, 15 Aug 2022 19:55:23 +0200 Message-Id: <20220815180443.193159994@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 7d255ddbbf679aa47e041cbf68520fd985ed2279 ] of_graph_get_remote_node() returns remote device nodepointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes: 318ba02cd8a8 ("drm/meson: encoder_cvbs: switch to bridge with ATTACH= _NO_CONNECTOR") Signed-off-by: Miaoqian Lin Reviewed-by: Martin Blumenstingl Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220601033927.47814-2-= linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/meson/meson_encoder_cvbs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/meson/meson_encoder_cvbs.c b/drivers/gpu/drm/m= eson/meson_encoder_cvbs.c index fd8db97ba8ba..8110a6e39320 100644 --- a/drivers/gpu/drm/meson/meson_encoder_cvbs.c +++ b/drivers/gpu/drm/meson/meson_encoder_cvbs.c @@ -238,6 +238,7 @@ int meson_encoder_cvbs_init(struct meson_drm *priv) } =20 meson_encoder_cvbs->next_bridge =3D of_drm_find_bridge(remote); + of_node_put(remote); if (!meson_encoder_cvbs->next_bridge) { dev_err(priv->dev, "Failed to find CVBS Connector bridge\n"); return -EPROBE_DEFER; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ADE3C25B08 for ; Mon, 15 Aug 2022 20:55:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346303AbiHOUzD (ORCPT ); Mon, 15 Aug 2022 16:55:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346180AbiHOUyG (ORCPT ); Mon, 15 Aug 2022 16:54:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49391A8966; Mon, 15 Aug 2022 12:10:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8A6AE60ACE; Mon, 15 Aug 2022 19:10:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91718C433C1; Mon, 15 Aug 2022 19:10:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590648; bh=N836QlaP8EZTDQ0E+HF1nAvtsij5ua2T/dw7TqgbLH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GqLDgwQC9AdglK0AhRfAmYBdGeBuXC4ZgkzHOEzK0tsiZKVVxTa1MB1Z8cJWtJw6D B5Zmq9+WMxNB/HWaSaIxN4f9wCc55xB83oXbNVYEF+iWdXBNot26iycXd8c9qwtAJy fPO4fWWahLAE0ke2z3aoO8iuLDKSno1kAdxvTwDg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.18 0325/1095] drm/meson: encoder_hdmi: Fix refcount leak in meson_encoder_hdmi_init Date: Mon, 15 Aug 2022 19:55:24 +0200 Message-Id: <20220815180443.235697319@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit d82a5a4aae9d0203234737caed1bf470aa317568 ] of_graph_get_remote_node() returns remote device nodepointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes: e67f6037ae1b ("drm/meson: split out encoder from meson_dw_hdmi") Signed-off-by: Miaoqian Lin Reviewed-by: Martin Blumenstingl Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220601033927.47814-3-= linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/m= eson/meson_encoder_hdmi.c index de87f02cd388..a7692584487c 100644 --- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c +++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c @@ -365,7 +365,8 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) meson_encoder_hdmi->next_bridge =3D of_drm_find_bridge(remote); if (!meson_encoder_hdmi->next_bridge) { dev_err(priv->dev, "Failed to find HDMI transceiver bridge\n"); - return -EPROBE_DEFER; + ret =3D -EPROBE_DEFER; + goto err_put_node; } =20 /* HDMI Encoder Bridge */ @@ -383,7 +384,7 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) DRM_MODE_ENCODER_TMDS); if (ret) { dev_err(priv->dev, "Failed to init HDMI encoder: %d\n", ret); - return ret; + goto err_put_node; } =20 meson_encoder_hdmi->encoder.possible_crtcs =3D BIT(0); @@ -393,7 +394,7 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) { dev_err(priv->dev, "Failed to attach bridge: %d\n", ret); - return ret; + goto err_put_node; } =20 /* Initialize & attach Bridge Connector */ @@ -401,7 +402,8 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) &meson_encoder_hdmi->encoder); if (IS_ERR(meson_encoder_hdmi->connector)) { dev_err(priv->dev, "Unable to create HDMI bridge connector\n"); - return PTR_ERR(meson_encoder_hdmi->connector); + ret =3D PTR_ERR(meson_encoder_hdmi->connector); + goto err_put_node; } drm_connector_attach_encoder(meson_encoder_hdmi->connector, &meson_encoder_hdmi->encoder); @@ -428,6 +430,7 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) meson_encoder_hdmi->connector->ycbcr_420_allowed =3D true; =20 pdev =3D of_find_device_by_node(remote); + of_node_put(remote); if (pdev) { struct cec_connector_info conn_info; struct cec_notifier *notifier; @@ -446,4 +449,8 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) dev_dbg(priv->dev, "HDMI encoder initialized\n"); =20 return 0; + +err_put_node: + of_node_put(remote); + return ret; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20E06C00140 for ; Mon, 15 Aug 2022 20:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346428AbiHOUzT (ORCPT ); Mon, 15 Aug 2022 16:55:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346761AbiHOUyM (ORCPT ); Mon, 15 Aug 2022 16:54:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45197BE4DF; Mon, 15 Aug 2022 12:11:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3AC32B8110A; Mon, 15 Aug 2022 19:10:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98A61C433D7; Mon, 15 Aug 2022 19:10:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590651; bh=QZhC4OWnf79y4pgVUj71VLW5Nv7lL1FdigrexeGZP/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JD4PwPNfldsNFxi18K02zzL/mjWHfCegrHmavUCrujpGOcgTrZkrbyzeBK36Wh8+/ BYjlQc1isGDTbw+GPN85QNxNve+KhpouR1ALh1dvpvQFjMiP+Rgv9uXD3V2TonzMzI 7nLBrk/Eu9Oh/FlqCJJMFA40SKdCe6PwSl+WuGwM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bjorn Andersson , Neil Armstrong , Robert Foss , Sasha Levin Subject: [PATCH 5.18 0326/1095] drm/bridge: lt9611uxc: Cancel only drivers work Date: Mon, 15 Aug 2022 19:55:25 +0200 Message-Id: <20220815180443.275948975@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bjorn Andersson [ Upstream commit dfa687bffc8a4a21ed929c7dececf01b8f1f52ee ] During device remove care needs to be taken that no work is pending before it removes the underlying DRM bridge etc, but this can be done on the specific work rather than waiting for the flush of the system-wide workqueue. Fixes: bc6fa8676ebb ("drm/bridge/lontium-lt9611uxc: move HPD notification o= ut of IRQ handler") Signed-off-by: Bjorn Andersson Reviewed-by: Neil Armstrong Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220601233818.1877963-= 1-bjorn.andersson@linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/b= ridge/lontium-lt9611uxc.c index 3d62e6bf6892..310b3b194491 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c @@ -982,7 +982,7 @@ static int lt9611uxc_remove(struct i2c_client *client) struct lt9611uxc *lt9611uxc =3D i2c_get_clientdata(client); =20 disable_irq(client->irq); - flush_scheduled_work(); + cancel_work_sync(<9611uxc->work); lt9611uxc_audio_exit(lt9611uxc); drm_bridge_remove(<9611uxc->bridge); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36F81C2BB41 for ; Mon, 15 Aug 2022 20:56:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239475AbiHOU4o (ORCPT ); Mon, 15 Aug 2022 16:56:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233730AbiHOUyw (ORCPT ); Mon, 15 Aug 2022 16:54:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FDE6BE4F7; Mon, 15 Aug 2022 12:11:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5163AB81113; Mon, 15 Aug 2022 19:10:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95858C433C1; Mon, 15 Aug 2022 19:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590654; bh=S/qUgiOb7gvhSDYcpoVyel7diGhJ8zcEJdnPWh7FNVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mtd9YdJcDBU9COR+tfzeWUxwxbcjP1T3fezEpRs8mjIGsdvdXs8Wf3xYjw0HV/b8S i7tUWn9VsopskkoqYMSs8RTrreyE9vyFUVypWuSur2vQjCKIY2R5R+1glsGdQ+WE2M +69ImtWihdsqwDTYdGnSt+PQp/9KKRXNVi9b+uto= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tali Perry , Tyrone Ting , Andy Shevchenko , Wolfram Sang , Sasha Levin Subject: [PATCH 5.18 0327/1095] i2c: npcm: Remove own slave addresses 2:10 Date: Mon, 15 Aug 2022 19:55:26 +0200 Message-Id: <20220815180443.313367078@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tali Perry [ Upstream commit 47d506d1a28fd10a9fb1f33df5622d88fae72095 ] NPCM can support up to 10 own slave addresses. In practice, only one address is actually being used. In order to access addresses 2 and above, need to switch register banks. The switch needs spinlock. To avoid using spinlock for this useless feature removed support of SA >=3D 2. Also fix returned slave event enum. Remove some comment since the bank selection is not required. The bank selection is not required since the supported slave addresses are reduced. Fixes: 56a1485b102e ("i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver") Signed-off-by: Tali Perry Signed-off-by: Tyrone Ting Reviewed-by: Andy Shevchenko Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/i2c/busses/i2c-npcm7xx.c | 41 +++++++++++++------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm= 7xx.c index 743ac20a405c..bc462d257baa 100644 --- a/drivers/i2c/busses/i2c-npcm7xx.c +++ b/drivers/i2c/busses/i2c-npcm7xx.c @@ -123,11 +123,11 @@ enum i2c_addr { * Since the addr regs are sprinkled all over the address space, * use this array to get the address or each register. */ -#define I2C_NUM_OWN_ADDR 10 +#define I2C_NUM_OWN_ADDR 2 +#define I2C_NUM_OWN_ADDR_SUPPORTED 2 + static const int npcm_i2caddr[I2C_NUM_OWN_ADDR] =3D { - NPCM_I2CADDR1, NPCM_I2CADDR2, NPCM_I2CADDR3, NPCM_I2CADDR4, - NPCM_I2CADDR5, NPCM_I2CADDR6, NPCM_I2CADDR7, NPCM_I2CADDR8, - NPCM_I2CADDR9, NPCM_I2CADDR10, + NPCM_I2CADDR1, NPCM_I2CADDR2, }; #endif =20 @@ -391,14 +391,10 @@ static void npcm_i2c_disable(struct npcm_i2c *bus) #if IS_ENABLED(CONFIG_I2C_SLAVE) int i; =20 - /* select bank 0 for I2C addresses */ - npcm_i2c_select_bank(bus, I2C_BANK_0); - /* Slave addresses removal */ - for (i =3D I2C_SLAVE_ADDR1; i < I2C_NUM_OWN_ADDR; i++) + for (i =3D I2C_SLAVE_ADDR1; i < I2C_NUM_OWN_ADDR_SUPPORTED; i++) iowrite8(0, bus->reg + npcm_i2caddr[i]); =20 - npcm_i2c_select_bank(bus, I2C_BANK_1); #endif /* Disable module */ i2cctl2 =3D ioread8(bus->reg + NPCM_I2CCTL2); @@ -603,8 +599,7 @@ static int npcm_i2c_slave_enable(struct npcm_i2c *bus, = enum i2c_addr addr_type, i2cctl1 &=3D ~NPCM_I2CCTL1_GCMEN; iowrite8(i2cctl1, bus->reg + NPCM_I2CCTL1); return 0; - } - if (addr_type =3D=3D I2C_ARP_ADDR) { + } else if (addr_type =3D=3D I2C_ARP_ADDR) { i2cctl3 =3D ioread8(bus->reg + NPCM_I2CCTL3); if (enable) i2cctl3 |=3D I2CCTL3_ARPMEN; @@ -613,16 +608,16 @@ static int npcm_i2c_slave_enable(struct npcm_i2c *bus= , enum i2c_addr addr_type, iowrite8(i2cctl3, bus->reg + NPCM_I2CCTL3); return 0; } + if (addr_type > I2C_SLAVE_ADDR2 && addr_type <=3D I2C_SLAVE_ADDR10) + dev_err(bus->dev, "try to enable more than 2 SA not supported\n"); + if (addr_type >=3D I2C_ARP_ADDR) return -EFAULT; - /* select bank 0 for address 3 to 10 */ - if (addr_type > I2C_SLAVE_ADDR2) - npcm_i2c_select_bank(bus, I2C_BANK_0); + /* Set and enable the address */ iowrite8(sa_reg, bus->reg + npcm_i2caddr[addr_type]); npcm_i2c_slave_int_enable(bus, enable); - if (addr_type > I2C_SLAVE_ADDR2) - npcm_i2c_select_bank(bus, I2C_BANK_1); + return 0; } #endif @@ -843,15 +838,11 @@ static u8 npcm_i2c_get_slave_addr(struct npcm_i2c *bu= s, enum i2c_addr addr_type) { u8 slave_add; =20 - /* select bank 0 for address 3 to 10 */ - if (addr_type > I2C_SLAVE_ADDR2) - npcm_i2c_select_bank(bus, I2C_BANK_0); + if (addr_type > I2C_SLAVE_ADDR2 && addr_type <=3D I2C_SLAVE_ADDR10) + dev_err(bus->dev, "get slave: try to use more than 2 SA not supported\n"= ); =20 slave_add =3D ioread8(bus->reg + npcm_i2caddr[(int)addr_type]); =20 - if (addr_type > I2C_SLAVE_ADDR2) - npcm_i2c_select_bank(bus, I2C_BANK_1); - return slave_add; } =20 @@ -861,12 +852,12 @@ static int npcm_i2c_remove_slave_addr(struct npcm_i2c= *bus, u8 slave_add) =20 /* Set the enable bit */ slave_add |=3D 0x80; - npcm_i2c_select_bank(bus, I2C_BANK_0); - for (i =3D I2C_SLAVE_ADDR1; i < I2C_NUM_OWN_ADDR; i++) { + + for (i =3D I2C_SLAVE_ADDR1; i < I2C_NUM_OWN_ADDR_SUPPORTED; i++) { if (ioread8(bus->reg + npcm_i2caddr[i]) =3D=3D slave_add) iowrite8(0, bus->reg + npcm_i2caddr[i]); } - npcm_i2c_select_bank(bus, I2C_BANK_1); + return 0; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C6FBC25B08 for ; Mon, 15 Aug 2022 21:02:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244873AbiHOVCn (ORCPT ); Mon, 15 Aug 2022 17:02:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243990AbiHOVAY (ORCPT ); Mon, 15 Aug 2022 17:00:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53DBFC3F78; Mon, 15 Aug 2022 12:13:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 80FA9B81113; Mon, 15 Aug 2022 19:13:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB9B1C433D6; Mon, 15 Aug 2022 19:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590780; bh=Y2uiP0tWBwL6vxqhyLR7WjAMopNb9WKuAgmZ1YDI9Ts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EATJtiTTJbxQdoapJ55ndWb9BiYW5TfV1PCMvR8oAAgIK55hOcjg3Oe3LFC8lEHPG gP6h3bAZCd/z92x+rd3jwyOAvgE70ErplFHfsO+hyDQ/RnpDJEuMYVwjLNxapedA0J eVjF+BcUkRhb54XJm0sglQ+2O/B7nKbLygfos5o0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tali Perry , Tyrone Ting , Andy Shevchenko , Wolfram Sang , Sasha Levin Subject: [PATCH 5.18 0328/1095] i2c: npcm: Correct slave role behavior Date: Mon, 15 Aug 2022 19:55:27 +0200 Message-Id: <20220815180443.359172851@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tali Perry [ Upstream commit d7aa1b149b8fc04d802879cf4662010aa4a42deb ] Correct the slave transaction logic to be compatible with the generic slave backend driver. Fixes: 56a1485b102e ("i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver") Signed-off-by: Tali Perry Signed-off-by: Tyrone Ting Reviewed-by: Andy Shevchenko Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/i2c/busses/i2c-npcm7xx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm= 7xx.c index bc462d257baa..9f0462fb2504 100644 --- a/drivers/i2c/busses/i2c-npcm7xx.c +++ b/drivers/i2c/busses/i2c-npcm7xx.c @@ -912,11 +912,15 @@ static int npcm_i2c_slave_get_wr_buf(struct npcm_i2c = *bus) for (i =3D 0; i < I2C_HW_FIFO_SIZE; i++) { if (bus->slv_wr_size >=3D I2C_HW_FIFO_SIZE) break; - i2c_slave_event(bus->slave, I2C_SLAVE_READ_REQUESTED, &value); + if (bus->state =3D=3D I2C_SLAVE_MATCH) { + i2c_slave_event(bus->slave, I2C_SLAVE_READ_REQUESTED, &value); + bus->state =3D I2C_OPER_STARTED; + } else { + i2c_slave_event(bus->slave, I2C_SLAVE_READ_PROCESSED, &value); + } ind =3D (bus->slv_wr_ind + bus->slv_wr_size) % I2C_HW_FIFO_SIZE; bus->slv_wr_buf[ind] =3D value; bus->slv_wr_size++; - i2c_slave_event(bus->slave, I2C_SLAVE_READ_PROCESSED, &value); } return I2C_HW_FIFO_SIZE - ret; } @@ -964,7 +968,6 @@ static void npcm_i2c_slave_xmit(struct npcm_i2c *bus, u= 16 nwrite, if (nwrite =3D=3D 0) return; =20 - bus->state =3D I2C_OPER_STARTED; bus->operation =3D I2C_WRITE_OPER; =20 /* get the next buffer */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85A73C00140 for ; Mon, 15 Aug 2022 20:57:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242562AbiHOU5B (ORCPT ); Mon, 15 Aug 2022 16:57:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346763AbiHOUzo (ORCPT ); Mon, 15 Aug 2022 16:55:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C4623B96B; Mon, 15 Aug 2022 12:11:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5EFC66069E; Mon, 15 Aug 2022 19:11:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 607BBC433D6; Mon, 15 Aug 2022 19:11:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590678; bh=7R7XRJk9VX5l9JuQ7DA+8HY+77GdZP4j+qwtfoEEtrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wmuvr6vYJa5iJo5+wL8n30+aJjMHr+gDSCyPsb/ujDhOH+mJRPf5E7AoPKGk3OWpr cBx/Q6z0c177qh8TVxNtLVK8AcZcRlzSHHb8qY5qDD1bfY8PMQhFLiZUQXa1UIgIMg M9E/n1yAS8SbWSYDx79isaaL1Zum5nrcjA6vhlLg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Fabio Estevam , Wolfram Sang , Sasha Levin Subject: [PATCH 5.18 0329/1095] i2c: mxs: Silence a clang warning Date: Mon, 15 Aug 2022 19:55:28 +0200 Message-Id: <20220815180443.399753755@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabio Estevam [ Upstream commit 3d43273d7d1e1a5374d531e901d3c537b4c97bbf ] Change the of_device_get_match_data() cast to (uintptr_t) to silence the following clang warning: drivers/i2c/busses/i2c-mxs.c:802:18: warning: cast to smaller integer type = 'enum mxs_i2c_devtype' from 'const void *' [-Wvoid-pointer-to-enum-cast] Reported-by: kernel test robot Fixes: c32abd8b5691 ("i2c: mxs: Remove unneeded platform_device_id") Signed-off-by: Fabio Estevam Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/i2c/busses/i2c-mxs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 864a3f1bd4e1..68f67d084c63 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c @@ -799,7 +799,7 @@ static int mxs_i2c_probe(struct platform_device *pdev) if (!i2c) return -ENOMEM; =20 - i2c->dev_type =3D (enum mxs_i2c_devtype)of_device_get_match_data(&pdev->d= ev); + i2c->dev_type =3D (uintptr_t)of_device_get_match_data(&pdev->dev); =20 i2c->regs =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(i2c->regs)) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96C24C00140 for ; Mon, 15 Aug 2022 20:58:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232245AbiHOU6V (ORCPT ); Mon, 15 Aug 2022 16:58:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347018AbiHOU4N (ORCPT ); Mon, 15 Aug 2022 16:56:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A1472DA8E; Mon, 15 Aug 2022 12:11:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3757A60BC2; Mon, 15 Aug 2022 19:11:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41571C433C1; Mon, 15 Aug 2022 19:11:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590714; bh=qd7DGm7gGOW9kfEJ46D2NiTS3ftZuyV6LqQZH+9ayTg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IN/vwRZReM78KSPc4Nqn6idmUscBBNNR5TMiWhK/KRLHrlZTKb1AHLMz+jUGy+P0V 1zTj2kpY6Ptgc42v8yLi9l7br5gAuYUVY4MyvSH0z0xTc6bn00pAiMT3o5RmlDpMYR UyqLmsFSM4rCwD+v04UpxRtvz2+U9KmvW36Bvamw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaomeng Tong , Chia-I Wu , Gerd Hoffmann , Sasha Levin Subject: [PATCH 5.18 0330/1095] virtio-gpu: fix a missing check to avoid NULL dereference Date: Mon, 15 Aug 2022 19:55:29 +0200 Message-Id: <20220815180443.434668603@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiaomeng Tong [ Upstream commit bd63f11f4c3c46afec07d821f74736161ff6e526 ] 'cache_ent' could be set NULL inside virtio_gpu_cmd_get_capset() and it will lead to a NULL dereference by a lately use of it (i.e., ptr =3D cache_ent->caps_cache). Fix it with a NULL check. Fixes: 62fb7a5e10962 ("virtio-gpu: add 3d/virgl support") Signed-off-by: Xiaomeng Tong Reviewed-by: Chia-I Wu Link: http://patchwork.freedesktop.org/patch/msgid/20220327050945.1614-1-xi= am0nd.tong@gmail.com [ kraxel: minor codestyle fixup ] Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virti= o/virtgpu_ioctl.c index c708bab555c6..10f080060923 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -579,8 +579,10 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device= *dev, spin_unlock(&vgdev->display_info_lock); =20 /* not in cache - need to talk to hw */ - virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver, - &cache_ent); + ret =3D virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver, + &cache_ent); + if (ret) + return ret; virtio_gpu_notify(vgdev); =20 copy_exit: --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61748C00140 for ; Mon, 15 Aug 2022 20:59:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239772AbiHOU7W (ORCPT ); Mon, 15 Aug 2022 16:59:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245616AbiHOU5d (ORCPT ); Mon, 15 Aug 2022 16:57:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F78CC0E70; Mon, 15 Aug 2022 12:12:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 61E8960ED3; Mon, 15 Aug 2022 19:12:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 582FAC433D6; Mon, 15 Aug 2022 19:12:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590748; bh=8wmv2mpi8sUIIu/K8J/rRbiyFnvYWdh1DOEZEe1g1cw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y81LozF5T9LYLXNL91gSztuxk/cASvtFHEpXXY/1vBcMqjsJPpIuzi5gKsiRn9xOg g4YpGR5J3I46apOv6o1w0gsoU1aDB7k0Mm5rtCjn/p1hwBdI/u3ssspD/3OwYaNHbh NS8KWJBLvFMI71pZCSQ9G+Jh4f+QMnpHeh6jea9A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Gerd Hoffmann , Sasha Levin Subject: [PATCH 5.18 0331/1095] drm/virtio: Fix NULL vs IS_ERR checking in virtio_gpu_object_shmem_init Date: Mon, 15 Aug 2022 19:55:30 +0200 Message-Id: <20220815180443.479575554@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit c24968734abfed81c8f93dc5f44a7b7a9aecadfa ] Since drm_prime_pages_to_sg() function return error pointers. The drm_gem_shmem_get_sg_table() function returns error pointers too. Using IS_ERR() to check the return value to fix this. Fixes: 2f2aa13724d5 ("drm/virtio: move virtio_gpu_mem_entry initialization = to new function") Signed-off-by: Miaoqian Lin Link: http://patchwork.freedesktop.org/patch/msgid/20220602104223.54527-1-l= inmq006@gmail.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/virtio/virtgpu_object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virt= io/virtgpu_object.c index f293e6ad52da..1cc8f3fc8e4b 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -168,9 +168,9 @@ static int virtio_gpu_object_shmem_init(struct virtio_g= pu_device *vgdev, * since virtio_gpu doesn't support dma-buf import from other devices. */ shmem->pages =3D drm_gem_shmem_get_sg_table(&bo->base); - if (!shmem->pages) { + if (IS_ERR(shmem->pages)) { drm_gem_shmem_unpin(&bo->base); - return -EINVAL; + return PTR_ERR(shmem->pages); } =20 if (use_dma_api) { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B879C00140 for ; Mon, 15 Aug 2022 20:59:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241284AbiHOU7y (ORCPT ); Mon, 15 Aug 2022 16:59:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243237AbiHOU7P (ORCPT ); Mon, 15 Aug 2022 16:59:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D9B1C12F5; Mon, 15 Aug 2022 12:12:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8B563B81115; Mon, 15 Aug 2022 19:12:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D167EC433C1; Mon, 15 Aug 2022 19:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590761; bh=lk2zibXRueDTL0wCxC95DGvLzHBQdWK43EkDL47d7qM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c0d0IdKouN+C0e8LSqdlOI+U0EKfz9wp9URgllk7W0wSU02H2s+zD9H7SDIDhvKcm zfWIZu/dYuJZG0YizTao3+A141CxYABo5GP3CaJfFwPTFdGpMA/pZXV/LOMNIYN4cZ Qv2hfSLXQGBjT9tDxfhSxE8GwYNrsT8JFAi6K8/M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antonio Borneo , Kieran Bingham , Robert Foss , Sasha Levin Subject: [PATCH 5.18 0332/1095] drm: adv7511: override i2c address of cec before accessing it Date: Mon, 15 Aug 2022 19:55:31 +0200 Message-Id: <20220815180443.526274369@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antonio Borneo [ Upstream commit 9cc4853e4781bf0dd0f35355dc92d97c9da02f5d ] Commit 680532c50bca ("drm: adv7511: Add support for i2c_new_secondary_device") allows a device tree node to override the default addresses of the secondary i2c devices. This is useful for solving address conflicts on the i2c bus. In adv7511_init_cec_regmap() the new i2c address of cec device is read from device tree and immediately accessed, well before it is written in the proper register to override the default address. This can cause an i2c error during probe and a consequent probe failure. Once the new i2c address is read from the device tree, override the default address before any attempt to access the cec. Tested with adv7533 and stm32mp157f. Signed-off-by: Antonio Borneo Fixes: 680532c50bca ("drm: adv7511: Add support for i2c_new_secondary_devic= e") Reviewed-by: Kieran Bingham Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220607213144.427177-1= -antonio.borneo@foss.st.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm= /bridge/adv7511/adv7511_drv.c index 668dcefbae17..fba6ad3bb6ad 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1060,6 +1060,10 @@ static int adv7511_init_cec_regmap(struct adv7511 *a= dv) ADV7511_CEC_I2C_ADDR_DEFAULT); if (IS_ERR(adv->i2c_cec)) return PTR_ERR(adv->i2c_cec); + + regmap_write(adv->regmap, ADV7511_REG_CEC_I2C_ADDR, + adv->i2c_cec->addr << 1); + i2c_set_clientdata(adv->i2c_cec, adv); =20 adv->regmap_cec =3D devm_regmap_init_i2c(adv->i2c_cec, @@ -1264,9 +1268,6 @@ static int adv7511_probe(struct i2c_client *i2c, cons= t struct i2c_device_id *id) if (ret) goto err_i2c_unregister_packet; =20 - regmap_write(adv7511->regmap, ADV7511_REG_CEC_I2C_ADDR, - adv7511->i2c_cec->addr << 1); - INIT_WORK(&adv7511->hpd_work, adv7511_hpd_work); =20 if (i2c->irq) { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E39AC00140 for ; Mon, 15 Aug 2022 21:02:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245262AbiHOVAe (ORCPT ); Mon, 15 Aug 2022 17:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244628AbiHOU7f (ORCPT ); Mon, 15 Aug 2022 16:59:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33E33C2E8C; Mon, 15 Aug 2022 12:12:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4B0276069E; Mon, 15 Aug 2022 19:12:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51C6BC433C1; Mon, 15 Aug 2022 19:12:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590764; bh=h5vc3yvXunEp0SALg3u9XixYh+znlF9+B4f8XKf+EY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LeMMLWqNTGFpCuAF+WHxo5+qzpkYZlF7GP+UUtaQrqyhu/3GOkNKlCDdj6Nh69s5V Ozfqmgptq6QkIMbWfIKPfl58G9PGRLCdNpiDvpECWjAWK39cAuWtf3OoljRld1luNz Y8AZQ4o9NzXNzxWOeM6iZ7/TKSCTwFQSTd2ZhgXo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Corentin Labbe , Herbert Xu , Sasha Levin Subject: [PATCH 5.18 0333/1095] crypto: sun8i-ss - do not allocate memory when handling hash requests Date: Mon, 15 Aug 2022 19:55:32 +0200 Message-Id: <20220815180443.573724777@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Corentin Labbe [ Upstream commit 8eec4563f152981a441693fc97c5459843dc5e6e ] Instead of allocate memory on each requests, it is easier to pre-allocate buffers. This made error path easier. Signed-off-by: Corentin Labbe Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c | 10 ++++++++++ drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 15 +++------------ drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h | 4 ++++ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c b/drivers/cr= ypto/allwinner/sun8i-ss/sun8i-ss-core.c index 657530578643..786b6f5cf300 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c @@ -486,6 +486,16 @@ static int allocate_flows(struct sun8i_ss_dev *ss) goto error_engine; } =20 + /* the padding could be up to two block. */ + ss->flows[i].pad =3D devm_kmalloc(ss->dev, SHA256_BLOCK_SIZE * 2, + GFP_KERNEL | GFP_DMA); + if (!ss->flows[i].pad) + goto error_engine; + ss->flows[i].result =3D devm_kmalloc(ss->dev, SHA256_DIGEST_SIZE, + GFP_KERNEL | GFP_DMA); + if (!ss->flows[i].result) + goto error_engine; + ss->flows[i].engine =3D crypto_engine_alloc_init(ss->dev, true); if (!ss->flows[i].engine) { dev_err(ss->dev, "Cannot allocate engine\n"); diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c b/drivers/cr= ypto/allwinner/sun8i-ss/sun8i-ss-hash.c index ca4f280af35d..f89a580618aa 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c @@ -342,18 +342,11 @@ int sun8i_ss_hash_run(struct crypto_engine *engine, v= oid *breq) if (digestsize =3D=3D SHA224_DIGEST_SIZE) digestsize =3D SHA256_DIGEST_SIZE; =20 - /* the padding could be up to two block. */ - pad =3D kzalloc(algt->alg.hash.halg.base.cra_blocksize * 2, GFP_KERNEL | = GFP_DMA); - if (!pad) - return -ENOMEM; + result =3D ss->flows[rctx->flow].result; + pad =3D ss->flows[rctx->flow].pad; + memset(pad, 0, algt->alg.hash.halg.base.cra_blocksize * 2); bf =3D (__le32 *)pad; =20 - result =3D kzalloc(digestsize, GFP_KERNEL | GFP_DMA); - if (!result) { - kfree(pad); - return -ENOMEM; - } - for (i =3D 0; i < MAX_SG; i++) { rctx->t_dst[i].addr =3D 0; rctx->t_dst[i].len =3D 0; @@ -449,8 +442,6 @@ int sun8i_ss_hash_run(struct crypto_engine *engine, voi= d *breq) =20 memcpy(areq->result, result, algt->alg.hash.halg.digestsize); theend: - kfree(pad); - kfree(result); local_bh_disable(); crypto_finalize_hash_request(engine, breq, err); local_bh_enable(); diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h b/drivers/crypto/= allwinner/sun8i-ss/sun8i-ss.h index 57ada8653855..eb82ee5345ae 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h @@ -123,6 +123,8 @@ struct sginfo { * @stat_req: number of request done by this flow * @iv: list of IV to use for each step * @biv: buffer which contain the backuped IV + * @pad: padding buffer for hash operations + * @result: buffer for storing the result of hash operations */ struct sun8i_ss_flow { struct crypto_engine *engine; @@ -130,6 +132,8 @@ struct sun8i_ss_flow { int status; u8 *iv[MAX_SG]; u8 *biv; + void *pad; + void *result; #ifdef CONFIG_CRYPTO_DEV_SUN8I_SS_DEBUG unsigned long stat_req; #endif --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 344A2C00140 for ; Mon, 15 Aug 2022 21:00:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243502AbiHOVAX (ORCPT ); Mon, 15 Aug 2022 17:00:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243880AbiHOU7e (ORCPT ); Mon, 15 Aug 2022 16:59:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74EFBC2EAD; Mon, 15 Aug 2022 12:12:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A8ADF6009B; Mon, 15 Aug 2022 19:12:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95999C433D6; Mon, 15 Aug 2022 19:12:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590768; bh=KH+LbbLmVGf4w93XlXej3XCKb8SjTDmLrLAJpeWu4S8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vqn3L++T/WtGd+TbQItxjrIt+ZOJJ7rhMJAsLRkKxHD7ZLgRJ6nlwXx0T/kwokJdB O3YE+hapKAWYUo20PayOPq2thrHSWVkRKMb5fnGcg/6qAnaq2lFDUfx0upKhSa/HG3 CR7w+FG7EtKiumvRO+aASI3RXS35WZq463jGFm/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Corentin Labbe , Herbert Xu , Sasha Levin Subject: [PATCH 5.18 0334/1095] crypto: sun8i-ss - fix error codes in allocate_flows() Date: Mon, 15 Aug 2022 19:55:33 +0200 Message-Id: <20220815180443.623676001@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit d2765e1b9ac4b2d5a5d5bf17f468c9b3566c3770 ] These failure paths should return -ENOMEM. Currently they return success. Fixes: 359e893e8af4 ("crypto: sun8i-ss - rework handling of IV") Fixes: 8eec4563f152 ("crypto: sun8i-ss - do not allocate memory when handli= ng hash requests") Signed-off-by: Dan Carpenter Acked-by: Corentin Labbe Tested-by: Corentin Labbe Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../crypto/allwinner/sun8i-ss/sun8i-ss-core.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c b/drivers/cr= ypto/allwinner/sun8i-ss/sun8i-ss-core.c index 786b6f5cf300..47b5828e35c3 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c @@ -476,25 +476,33 @@ static int allocate_flows(struct sun8i_ss_dev *ss) =20 ss->flows[i].biv =3D devm_kmalloc(ss->dev, AES_BLOCK_SIZE, GFP_KERNEL | GFP_DMA); - if (!ss->flows[i].biv) + if (!ss->flows[i].biv) { + err =3D -ENOMEM; goto error_engine; + } =20 for (j =3D 0; j < MAX_SG; j++) { ss->flows[i].iv[j] =3D devm_kmalloc(ss->dev, AES_BLOCK_SIZE, GFP_KERNEL | GFP_DMA); - if (!ss->flows[i].iv[j]) + if (!ss->flows[i].iv[j]) { + err =3D -ENOMEM; goto error_engine; + } } =20 /* the padding could be up to two block. */ ss->flows[i].pad =3D devm_kmalloc(ss->dev, SHA256_BLOCK_SIZE * 2, GFP_KERNEL | GFP_DMA); - if (!ss->flows[i].pad) + if (!ss->flows[i].pad) { + err =3D -ENOMEM; goto error_engine; + } ss->flows[i].result =3D devm_kmalloc(ss->dev, SHA256_DIGEST_SIZE, GFP_KERNEL | GFP_DMA); - if (!ss->flows[i].result) + if (!ss->flows[i].result) { + err =3D -ENOMEM; goto error_engine; + } =20 ss->flows[i].engine =3D crypto_engine_alloc_init(ss->dev, true); if (!ss->flows[i].engine) { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 068F0C28B2B for ; Mon, 15 Aug 2022 21:02:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242849AbiHOVC1 (ORCPT ); Mon, 15 Aug 2022 17:02:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243401AbiHOU7t (ORCPT ); Mon, 15 Aug 2022 16:59:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCDCEC3F42; Mon, 15 Aug 2022 12:12:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B61796009B; Mon, 15 Aug 2022 19:12:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B304DC433D6; Mon, 15 Aug 2022 19:12:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590771; bh=PbMFbN05pqb5amj2QXqI2mgSacN5B6a8jKrPwhiOtOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jivtlsj+SrmdfvnUh4BXC/8fs5sD0dpTsviPdV+C4ARkt6QiPLq6fnMpqGd61xZ/Z eTdeQUT485B+eXmm4Mlw4jLzrBbU7ORiLc1DH1/2jBFIYOwdTGSTpR6tzdq06oqPgj 3WLTqVWGF63OhlzC4D08aJOaPx+1Jzf8TVPSCYIA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Shakeel Butt , Soheil Hassas Yeganeh , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0335/1095] net: fix sk_wmem_schedule() and sk_rmem_schedule() errors Date: Mon, 15 Aug 2022 19:55:34 +0200 Message-Id: <20220815180443.661703788@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet [ Upstream commit 7c80b038d23e1f4c7fcc311f43f83b8c60e7fb80 ] If sk->sk_forward_alloc is 150000, and we need to schedule 150001 bytes, we want to allocate 1 byte more (rounded up to one page), instead of 150001 :/ Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Eric Dumazet Reviewed-by: Shakeel Butt Acked-by: Soheil Hassas Yeganeh Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/net/sock.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index 9563a093fdfc..aab25d1806a9 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1557,19 +1557,23 @@ static inline bool sk_has_account(struct sock *sk) =20 static inline bool sk_wmem_schedule(struct sock *sk, int size) { + int delta; + if (!sk_has_account(sk)) return true; - return size <=3D sk->sk_forward_alloc || - __sk_mem_schedule(sk, size, SK_MEM_SEND); + delta =3D size - sk->sk_forward_alloc; + return delta <=3D 0 || __sk_mem_schedule(sk, delta, SK_MEM_SEND); } =20 static inline bool sk_rmem_schedule(struct sock *sk, struct sk_buff *skb, int size) { + int delta; + if (!sk_has_account(sk)) return true; - return size <=3D sk->sk_forward_alloc || - __sk_mem_schedule(sk, size, SK_MEM_RECV) || + delta =3D size - sk->sk_forward_alloc; + return delta <=3D 0 || __sk_mem_schedule(sk, delta, SK_MEM_RECV) || skb_pfmemalloc(skb); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7900FC00140 for ; Mon, 15 Aug 2022 21:02:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243879AbiHOVCe (ORCPT ); Mon, 15 Aug 2022 17:02:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242376AbiHOU7u (ORCPT ); Mon, 15 Aug 2022 16:59:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85EB7501B3; Mon, 15 Aug 2022 12:12:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 74412B81106; Mon, 15 Aug 2022 19:12:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA563C433D7; Mon, 15 Aug 2022 19:12:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590774; bh=3ZYxbQiv8c/G+ELwnuTgMqLcylJFVaNM0i2o3i5VtNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TQZx5fTYoi0YPlXRjMuHUWAsIULJGyizNCTl5XbXKxnEXwvbFICvPjnZg9wK0JDFr NufPvLwXQZms0BSyR2aNZtIOgngZMS892ZXxXEfsoWRaRKf5d0aITJFgHxRT6b3FRT bbZBjWOzdsIlxwBQI494bpv0y8ehnS9DAzAUDItw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Staudt , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.18 0336/1095] can: netlink: allow configuring of fixed bit rates without need for do_set_bittiming callback Date: Mon, 15 Aug 2022 19:55:35 +0200 Message-Id: <20220815180443.704217883@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marc Kleine-Budde [ Upstream commit 7e193a42c37cf40eba8ac5af2d5e8eeb8b9506f9 ] Usually CAN devices support configurable bit rates. The limits are defined by struct can_priv::bittiming_const. Another way is to implement the struct can_priv::do_set_bittiming callback. If the bit rate is configured via netlink, the can_changelink() function checks that either can_priv::bittiming_const or struct can_priv::do_set_bittiming is implemented. In commit 431af779256c ("can: dev: add CAN interface API for fixed bitrates") an API for configuring bit rates on CAN interfaces that only support fixed bit rates was added. The supported bit rates are defined by struct can_priv::bitrate_const. However the above mentioned commit forgot to add the struct can_priv::bitrate_const to the check in can_changelink(). In order to avoid to implement a no-op can_priv::do_set_bittiming callback on devices with fixed bit rates, extend the check in can_changelink() accordingly. Link: https://lore.kernel.org/all/20220611144248.3924903-1-mkl@pengutronix.= de Fixes: 431af779256c ("can: dev: add CAN interface API for fixed bitrates") Reported-by: Max Staudt Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/can/dev/netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/dev/netlink.c b/drivers/net/can/dev/netlink.c index 7633d98e3912..667ddd28fcdc 100644 --- a/drivers/net/can/dev/netlink.c +++ b/drivers/net/can/dev/netlink.c @@ -176,7 +176,8 @@ static int can_changelink(struct net_device *dev, struc= t nlattr *tb[], * directly via do_set_bitrate(). Bail out if neither * is given. */ - if (!priv->bittiming_const && !priv->do_set_bittiming) + if (!priv->bittiming_const && !priv->do_set_bittiming && + !priv->bitrate_const) return -EOPNOTSUPP; =20 memcpy(&bt, nla_data(data[IFLA_CAN_BITTIMING]), sizeof(bt)); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F378C25B0E for ; Mon, 15 Aug 2022 21:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244258AbiHOVCj (ORCPT ); Mon, 15 Aug 2022 17:02:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240957AbiHOVAI (ORCPT ); Mon, 15 Aug 2022 17:00:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA83250704; Mon, 15 Aug 2022 12:12:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CBDF560EDA; Mon, 15 Aug 2022 19:12:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CAD60C433D6; Mon, 15 Aug 2022 19:12:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590777; bh=FU27mNks8W5srJ5JvNYi5+dQrXnSsKiy73X4z1VGlp4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iNCqtNY7+f9WWtDbZK0mfu1MQZnDGNmGe0q0Gc57ygT6Ucv+g4yMQ1VVsD7NKLxxJ vtnBwKN6Ux6FIOHplAG30jMzwW2jfamoBxvAh7BDEvvsnksuIsQdoNySS2w0ZNehhw l0vQciFnO7h7YCVCm404yzOaINb/0jLiJOonUjns= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Andr=C3=A9=20Almeida?= , Tales Lelo da Aparecida , Melissa Wen , Sasha Levin Subject: [PATCH 5.18 0337/1095] drm/vkms: check plane_composer->map[0] before using it Date: Mon, 15 Aug 2022 19:55:36 +0200 Message-Id: <20220815180443.743885616@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tales Lelo da Aparecida [ Upstream commit 24f6fe3226c6f9f1b8406311a96b59c6e650b707 ] Fix a copypasta error. The caller of compose_plane() already checks primary_composer->map. In contrast, plane_composer->map is never verified here before handling. Fixes: 7938f4218168 ("dma-buf-map: Rename to iosys-map") Reviewed-by: Andr=C3=A9 Almeida Signed-off-by: Tales Lelo da Aparecida Signed-off-by: Melissa Wen Link: https://patchwork.freedesktop.org/patch/msgid/20220415111300.61013-2-= tales.aparecida@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vkms/vkms_composer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vk= ms_composer.c index c6a1036bf2ea..b47ac170108c 100644 --- a/drivers/gpu/drm/vkms/vkms_composer.c +++ b/drivers/gpu/drm/vkms/vkms_composer.c @@ -157,7 +157,7 @@ static void compose_plane(struct vkms_composer *primary= _composer, void *vaddr; void (*pixel_blend)(const u8 *p_src, u8 *p_dst); =20 - if (WARN_ON(iosys_map_is_null(&primary_composer->map[0]))) + if (WARN_ON(iosys_map_is_null(&plane_composer->map[0]))) return; =20 vaddr =3D plane_composer->map[0].vaddr; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E826CC00140 for ; Mon, 15 Aug 2022 20:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240943AbiHOU5L (ORCPT ); Mon, 15 Aug 2022 16:57:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346821AbiHOUzy (ORCPT ); Mon, 15 Aug 2022 16:55:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80C70BFEAE; Mon, 15 Aug 2022 12:11:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 54C2060ABC; Mon, 15 Aug 2022 19:11:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55B63C433D6; Mon, 15 Aug 2022 19:11:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590681; bh=Y90tnlUVSUiStAoCfOycRQTm2/CT4hSOvEKma5fE894=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P2HaOv1Y19g8t3iZ7OsxvQVTOsqHjeDf0GBeYrHo7n815qvROuZ4iznpNZMg8G7+W osIZ0uSCmLwl26kuyr4WQKSnQnl/DOyxJViI17BcgSOhRgbhad/rKVk5HTOVhwB/SZ orJbYZvQi0l2JXgbpZDfjbvGbiTGPJUi62FahorI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Staudt , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.18 0338/1095] can: netlink: allow configuring of fixed data bit rates without need for do_set_data_bittiming callback Date: Mon, 15 Aug 2022 19:55:37 +0200 Message-Id: <20220815180443.783890554@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marc Kleine-Budde [ Upstream commit ec30c109391c5eac9b1d689a61e4bfed88148947 ] This patch is similar to 7e193a42c37c ("can: netlink: allow configuring of fixed bit rates without need for do_set_bittiming callback") but for data bit rates instead of bit rates. Usually CAN devices support configurable data bit rates. The limits are defined by struct can_priv::data_bittiming_const. Another way is to implement the struct can_priv::do_set_data_bittiming callback. If the bit rate is configured via netlink, the can_changelink() function checks that either can_priv::data_bittiming_const or struct can_priv::do_set_data_bittiming is implemented. In commit 431af779256c ("can: dev: add CAN interface API for fixed bitrates") an API for configuring bit rates on CAN interfaces that only support fixed bit rates was added. The supported bit rates are defined by struct can_priv::bitrate_const. However the above mentioned commit forgot to add the struct can_priv::data_bitrate_const to the check in can_changelink(). In order to avoid to implement a no-op can_priv::do_set_data_bittiming callback on devices with fixed data bit rates, extend the check in can_changelink() accordingly. Link: https://lore.kernel.org/all/20220613143633.4151884-1-mkl@pengutronix.= de Fixes: 431af779256c ("can: dev: add CAN interface API for fixed bitrates") Acked-by: Max Staudt Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/can/dev/netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/dev/netlink.c b/drivers/net/can/dev/netlink.c index 667ddd28fcdc..037824011266 100644 --- a/drivers/net/can/dev/netlink.c +++ b/drivers/net/can/dev/netlink.c @@ -279,7 +279,8 @@ static int can_changelink(struct net_device *dev, struc= t nlattr *tb[], * directly via do_set_bitrate(). Bail out if neither * is given. */ - if (!priv->data_bittiming_const && !priv->do_set_data_bittiming) + if (!priv->data_bittiming_const && !priv->do_set_data_bittiming && + !priv->data_bitrate_const) return -EOPNOTSUPP; =20 memcpy(&dbt, nla_data(data[IFLA_CAN_DATA_BITTIMING]), --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD257C00140 for ; Mon, 15 Aug 2022 20:57:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243831AbiHOU5V (ORCPT ); Mon, 15 Aug 2022 16:57:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346888AbiHOUz7 (ORCPT ); Mon, 15 Aug 2022 16:55:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEA87C04CF; Mon, 15 Aug 2022 12:11:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 31D2CB81062; Mon, 15 Aug 2022 19:11:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72AAEC433D6; Mon, 15 Aug 2022 19:11:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590684; bh=oB7dM72XMNQQt8sfgtaPMnMcpQan2i1lyVARTUxw0Sc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=byYV0QcSuKq7WsG1pzBEMCkjTJ31cTtjQ0xgmn96BW+fJvHOCJhdWHL76hurITZmf jB4wTyjJIu5hG9L4nSk9VXcit7kW7i397Imi8+6QNGUEIJDijCMPQv5gOuInweYRqL Oa7w1HLfkAuUctSy3VJaTfaVgJnZcXJ19EZt6E7s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheng Bin , Robert Foss , Sasha Levin Subject: [PATCH 5.18 0339/1095] drm/bridge: it6505: Add missing CRYPTO_HASH dependency Date: Mon, 15 Aug 2022 19:55:38 +0200 Message-Id: <20220815180443.821131249@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheng Bin [ Upstream commit abf0ba5a34eae0d7359228f4319a6659676fbd0a ] The driver uses crypto hash functions so it needs to select CRYPTO_HASH. This fixes build errors: drivers/gpu/drm/bridge/ite-it6505.o: in function `it6505_hdcp_wait_ksv_list= ': ite-it6505.c:(.text+0x4c26): undefined reference to `crypto_alloc_shash' ite-it6505.c:(.text+0x4c6d): undefined reference to `crypto_shash_digest' ite-it6505.c:(.text+0x4c7d): undefined reference to `crypto_destroy_tfm' ite-it6505.c:(.text+0x4d69): undefined reference to `crypto_destroy_tfm' Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") Signed-off-by: Zheng Bin Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220613150653.1310029-= 1-zhengbin13@huawei.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index be2fc4791c1d..7d152cc6f837 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -82,6 +82,8 @@ config DRM_ITE_IT6505 select DRM_KMS_HELPER select DRM_DP_HELPER select EXTCON + select CRYPTO + select CRYPTO_HASH help ITE IT6505 DisplayPort bridge chip driver. =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1FCFC00140 for ; Mon, 15 Aug 2022 21:05:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233342AbiHOVEd (ORCPT ); Mon, 15 Aug 2022 17:04:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346899AbiHOU4A (ORCPT ); Mon, 15 Aug 2022 16:56:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1120042AF7; Mon, 15 Aug 2022 12:11:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AC8496069E; Mon, 15 Aug 2022 19:11:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B82CC433D7; Mon, 15 Aug 2022 19:11:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590688; bh=gCasWjXfyVMddZoYuo5MwQA3iAWTIDwFsCXYGZBFCo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tXBigGMnYSr8eHb0xvt2C8V6c/8ezIcc668vLHfypVomXulpSei7TK469IOq6J18s Qbdb1BORGKDEHxax5HEpQ26VDDrm1rEryYsbRjZU8oTngbHY+0z9TYBppO126Cuh11 h4N2Y3ZC3mAXfJDyQRydWjkt0j6Rt63jWyzGmPHo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xu Wang , Wolfram Sang , Sasha Levin Subject: [PATCH 5.18 0340/1095] i2c: Fix a potential use after free Date: Mon, 15 Aug 2022 19:55:39 +0200 Message-Id: <20220815180443.862632134@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xu Wang [ Upstream commit e4c72c06c367758a14f227c847f9d623f1994ecf ] Free the adap structure only after we are done using it. This patch just moves the put_device() down a bit to avoid the use after free. Fixes: 611e12ea0f12 ("i2c: core: manage i2c bus device refcount in i2c_[get= |put]_adapter") Signed-off-by: Xu Wang [wsa: added comment to the code, added Fixes tag] Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/i2c/i2c-core-base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index d43db2c3876e..19a317fdcf5b 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -2467,8 +2467,9 @@ void i2c_put_adapter(struct i2c_adapter *adap) if (!adap) return; =20 - put_device(&adap->dev); module_put(adap->owner); + /* Should be last, otherwise we risk use-after-free with 'adap' */ + put_device(&adap->dev); } EXPORT_SYMBOL(i2c_put_adapter); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D451EC00140 for ; Mon, 15 Aug 2022 20:57:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241512AbiHOU5Z (ORCPT ); Mon, 15 Aug 2022 16:57:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346917AbiHOU4C (ORCPT ); Mon, 15 Aug 2022 16:56:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C555A48E82; Mon, 15 Aug 2022 12:11:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 81C35B81109; Mon, 15 Aug 2022 19:11:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD6B4C433D7; Mon, 15 Aug 2022 19:11:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590692; bh=rG5TxObyUf1LId3LHy8gMxxLmgk02vTuSArN1/uPQjw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2fCMLLoQL95FIwCZWLkLHmvjxeD1SLbDvpOmle2lt7JttbhF3yGuUJYnrcN8jWlzP widQzy8sM9hRuzKAyI4N3tLaqdB0064xv+Ad8S74zmCBFJaH7GJ2eWJ++2A+jdw2Fr z60ZOhVAyNDgi/RswppCVrui+JieidCTLk+PMlRM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Soheil Hassas Yeganeh , Wei Wang , Shakeel Butt , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 0341/1095] tcp: fix possible freeze in tx path under memory pressure Date: Mon, 15 Aug 2022 19:55:40 +0200 Message-Id: <20220815180443.908916463@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet [ Upstream commit 849b425cd091e1804af964b771761cfbefbafb43 ] Blamed commit only dealt with applications issuing small writes. Issue here is that we allow to force memory schedule for the sk_buff allocation, but we have no guarantee that sendmsg() is able to copy some payload in it. In this patch, I make sure the socket can use up to tcp_wmem[0] bytes. For example, if we consider tcp_wmem[0] =3D 4096 (default on x86), and initial skb->truesize being 1280, tcp_sendmsg() is able to copy up to 2816 bytes under memory pressure. Before this patch a sendmsg() sending more than 2816 bytes would either block forever (if persistent memory pressure), or return -EAGAIN. For bigger MTU networks, it is advised to increase tcp_wmem[0] to avoid sending too small packets. v2: deal with zero copy paths. Fixes: 8e4d980ac215 ("tcp: fix behavior for epoll edge trigger") Signed-off-by: Eric Dumazet Acked-by: Soheil Hassas Yeganeh Reviewed-by: Wei Wang Reviewed-by: Shakeel Butt Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/ipv4/tcp.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 91735d631a28..51116166e3d2 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -953,6 +953,23 @@ static int tcp_downgrade_zcopy_pure(struct sock *sk, s= truct sk_buff *skb) return 0; } =20 +static int tcp_wmem_schedule(struct sock *sk, int copy) +{ + int left; + + if (likely(sk_wmem_schedule(sk, copy))) + return copy; + + /* We could be in trouble if we have nothing queued. + * Use whatever is left in sk->sk_forward_alloc and tcp_wmem[0] + * to guarantee some progress. + */ + left =3D sock_net(sk)->ipv4.sysctl_tcp_wmem[0] - sk->sk_wmem_queued; + if (left > 0) + sk_forced_mem_schedule(sk, min(left, copy)); + return min(copy, sk->sk_forward_alloc); +} + static struct sk_buff *tcp_build_frag(struct sock *sk, int size_goal, int = flags, struct page *page, int offset, size_t *size) { @@ -988,7 +1005,11 @@ static struct sk_buff *tcp_build_frag(struct sock *sk= , int size_goal, int flags, tcp_mark_push(tp, skb); goto new_segment; } - if (tcp_downgrade_zcopy_pure(sk, skb) || !sk_wmem_schedule(sk, copy)) + if (tcp_downgrade_zcopy_pure(sk, skb)) + return NULL; + + copy =3D tcp_wmem_schedule(sk, copy); + if (!copy) return NULL; =20 if (can_coalesce) { @@ -1337,8 +1358,11 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghd= r *msg, size_t size) =20 copy =3D min_t(int, copy, pfrag->size - pfrag->offset); =20 - if (tcp_downgrade_zcopy_pure(sk, skb) || - !sk_wmem_schedule(sk, copy)) + if (tcp_downgrade_zcopy_pure(sk, skb)) + goto wait_for_space; + + copy =3D tcp_wmem_schedule(sk, copy); + if (!copy) goto wait_for_space; =20 err =3D skb_copy_to_page_nocache(sk, &msg->msg_iter, skb, @@ -1365,7 +1389,8 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr= *msg, size_t size) skb_shinfo(skb)->flags |=3D SKBFL_PURE_ZEROCOPY; =20 if (!skb_zcopy_pure(skb)) { - if (!sk_wmem_schedule(sk, copy)) + copy =3D tcp_wmem_schedule(sk, copy); + if (!copy) goto wait_for_space; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 668A1C00140 for ; Mon, 15 Aug 2022 20:57:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238886AbiHOU5h (ORCPT ); Mon, 15 Aug 2022 16:57:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346931AbiHOU4C (ORCPT ); Mon, 15 Aug 2022 16:56:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE8E24F196; Mon, 15 Aug 2022 12:11:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 78886B810A3; Mon, 15 Aug 2022 19:11:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE827C433B5; Mon, 15 Aug 2022 19:11:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590695; bh=65ljVjHidvP03ijUNO/zjfxop07YULtw68E7rTTUr9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=daz7cqvfAvSkCXJ6qB38vPUZuKa4t0T54BL66TewtDr1IhCks1sQtnCe4B38IM9tG 4yp6oKfwHyVYE33GZv5cFB7a1qccPp25vZ+qbSadg5NS4Cnjm3RmoWAXZvMZLYYsTN UcwpV03+xDhPkP6CT35x90qReQ88/7o3TysNK/LQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Khoroshilov , Corentin Labbe , Herbert Xu , Sasha Levin Subject: [PATCH 5.18 0342/1095] crypto: sun8i-ss - fix infinite loop in sun8i_ss_setup_ivs() Date: Mon, 15 Aug 2022 19:55:41 +0200 Message-Id: <20220815180443.950668835@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexey Khoroshilov [ Upstream commit d61a7b3decf7f0cf4121a7204303deefd2c7151b ] There is no i decrement in while (i >=3D 0) loop. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Alexey Khoroshilov Fixes: 359e893e8af4 ("crypto: sun8i-ss - rework handling of IV") Acked-by: Corentin Labbe Tested-by: Corentin Labbe Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c b/drivers/= crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c index 70e2e6e37389..3c46ad8c3a1c 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c @@ -151,6 +151,7 @@ static int sun8i_ss_setup_ivs(struct skcipher_request *= areq) while (i >=3D 0) { dma_unmap_single(ss->dev, rctx->p_iv[i], ivsize, DMA_TO_DEVICE); memzero_explicit(sf->iv[i], ivsize); + i--; } return err; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C173C00140 for ; Mon, 15 Aug 2022 20:57:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233609AbiHOU5c (ORCPT ); Mon, 15 Aug 2022 16:57:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346951AbiHOU4H (ORCPT ); Mon, 15 Aug 2022 16:56:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B579A2DA94; Mon, 15 Aug 2022 12:11:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 78FE2B810A3; Mon, 15 Aug 2022 19:11:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6595C433C1; Mon, 15 Aug 2022 19:11:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590698; bh=7ZxS7jGKRr+fV61GISzQduPft6Zbuh8vkk9x+jopIpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iiy+/usMntatwr9Ke/HL5uVe+wo4heayKeEBlRqgI3moHY2ed1HXZMOy8oKhxzT3Y dgqg+noK96oHvAUpAgoVcZAl9JDxQPfshU4/8neRxM+paN386yBraDnqNNsAVrtITO r1LubfjpdV3syMyEUelXAN4nbe+TWh8bxKE+ohF4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleksij Rempel , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 0343/1095] net: ag71xx: fix discards const qualifier warning Date: Mon, 15 Aug 2022 19:55:42 +0200 Message-Id: <20220815180443.994844594@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Oleksij Rempel [ Upstream commit 225b0ed27e6ac523e5e98e7395392446859c7f20 ] Current kernel will compile this driver with warnings. This patch will fix it. drivers/net/ethernet/atheros/ag71xx.c: In function 'ag71xx_fast_reset': drivers/net/ethernet/atheros/ag71xx.c:996:31: warning: passing argument 2 o= f 'ag71xx_hw_set _macaddr' discards 'const' qualifier from pointer target type [-Wdiscarded-= qualifiers] 996 | ag71xx_hw_set_macaddr(ag, dev->dev_addr); | ~~~^~~~~~~~~~ drivers/net/ethernet/atheros/ag71xx.c:951:69: note: expected 'unsigned char= *' but argument is of type 'const unsigned char *' 951 | static void ag71xx_hw_set_macaddr(struct ag71xx *ag, unsigned char = *mac) | ~~~~~~~~~~~~~~= ~^~~ drivers/net/ethernet/atheros/ag71xx.c: In function 'ag71xx_open': drivers/net/ethernet/atheros/ag71xx.c:1441:32: warning: passing argument 2 = of 'ag71xx_hw_se t_macaddr' discards 'const' qualifier from pointer target type [-Wdiscarded= -qualifiers] 1441 | ag71xx_hw_set_macaddr(ag, ndev->dev_addr); | ~~~~^~~~~~~~~~ drivers/net/ethernet/atheros/ag71xx.c:951:69: note: expected 'unsigned char= *' but argument is of type 'const unsigned char *' 951 | static void ag71xx_hw_set_macaddr(struct ag71xx *ag, unsigned char = *mac) | ~~~~~~~~~~~~~~= ~^~~ Fixes: adeef3e32146 ("net: constify netdev->dev_addr") Signed-off-by: Oleksij Rempel Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/atheros/ag71xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/a= theros/ag71xx.c index ec167af0e3b2..5041265f4226 100644 --- a/drivers/net/ethernet/atheros/ag71xx.c +++ b/drivers/net/ethernet/atheros/ag71xx.c @@ -946,7 +946,7 @@ static unsigned int ag71xx_max_frame_len(unsigned int m= tu) return ETH_HLEN + VLAN_HLEN + mtu + ETH_FCS_LEN; } =20 -static void ag71xx_hw_set_macaddr(struct ag71xx *ag, unsigned char *mac) +static void ag71xx_hw_set_macaddr(struct ag71xx *ag, const unsigned char *= mac) { u32 t; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 830B3C25B0E for ; Mon, 15 Aug 2022 21:05:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232797AbiHOVEn (ORCPT ); Mon, 15 Aug 2022 17:04:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346965AbiHOU4I (ORCPT ); Mon, 15 Aug 2022 16:56:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E54D481CB; Mon, 15 Aug 2022 12:11:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 08EE160ABC; Mon, 15 Aug 2022 19:11:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E86BDC433D6; Mon, 15 Aug 2022 19:11:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590701; bh=pJ98IA2Nc9gmThZy8YlW3t8HOL5gw1uEYSlhD1p4PNc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WwoqNlf7usGdg9bd13JqGuIRpgVvczdiD9hZqbEdwZfziOvobmujgs/d5CWgq3h5J jvyVCBOwCPasuTRi9SHMoMp/kOcXq80R0ogC1vMi2sPYeuxgJGf9ZqLAysZsYUvTBP ysXUM2X2oER3xv7eAX5Cj/LGLrAL4IaCOUTr8+ug= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 0344/1095] raw: use more conventional iterators Date: Mon, 15 Aug 2022 19:55:43 +0200 Message-Id: <20220815180444.028255775@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet [ Upstream commit ba44f8182ec299c5d1c8a72fc0fde4ec127b5a6d ] In order to prepare the following patch, I change raw v4 & v6 code to use more conventional iterators. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/net/raw.h | 5 +-- include/net/rawv6.h | 6 +-- net/ipv4/raw.c | 93 ++++++++++++++------------------------- net/ipv4/raw_diag.c | 33 +++++++------- net/ipv6/raw.c | 105 ++++++++++++++++---------------------------- 5 files changed, 92 insertions(+), 150 deletions(-) diff --git a/include/net/raw.h b/include/net/raw.h index c51a635671a7..6324965779ec 100644 --- a/include/net/raw.h +++ b/include/net/raw.h @@ -20,9 +20,8 @@ extern struct proto raw_prot; =20 extern struct raw_hashinfo raw_v4_hashinfo; -struct sock *__raw_v4_lookup(struct net *net, struct sock *sk, - unsigned short num, __be32 raddr, - __be32 laddr, int dif, int sdif); +bool raw_v4_match(struct net *net, struct sock *sk, unsigned short num, + __be32 raddr, __be32 laddr, int dif, int sdif); =20 int raw_abort(struct sock *sk, int err); void raw_icmp_error(struct sk_buff *, int, u32); diff --git a/include/net/rawv6.h b/include/net/rawv6.h index 53d86b6055e8..c48c1298699a 100644 --- a/include/net/rawv6.h +++ b/include/net/rawv6.h @@ -5,9 +5,9 @@ #include =20 extern struct raw_hashinfo raw_v6_hashinfo; -struct sock *__raw_v6_lookup(struct net *net, struct sock *sk, - unsigned short num, const struct in6_addr *loc_addr, - const struct in6_addr *rmt_addr, int dif, int sdif); +bool raw_v6_match(struct net *net, struct sock *sk, unsigned short num, + const struct in6_addr *loc_addr, + const struct in6_addr *rmt_addr, int dif, int sdif); =20 int raw_abort(struct sock *sk, int err); =20 diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index c9dd9603f2e7..e9b8bb1e5fb0 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -117,24 +117,19 @@ void raw_unhash_sk(struct sock *sk) } EXPORT_SYMBOL_GPL(raw_unhash_sk); =20 -struct sock *__raw_v4_lookup(struct net *net, struct sock *sk, - unsigned short num, __be32 raddr, __be32 laddr, - int dif, int sdif) +bool raw_v4_match(struct net *net, struct sock *sk, unsigned short num, + __be32 raddr, __be32 laddr, int dif, int sdif) { - sk_for_each_from(sk) { - struct inet_sock *inet =3D inet_sk(sk); - - if (net_eq(sock_net(sk), net) && inet->inet_num =3D=3D num && - !(inet->inet_daddr && inet->inet_daddr !=3D raddr) && - !(inet->inet_rcv_saddr && inet->inet_rcv_saddr !=3D laddr) && - raw_sk_bound_dev_eq(net, sk->sk_bound_dev_if, dif, sdif)) - goto found; /* gotcha */ - } - sk =3D NULL; -found: - return sk; + struct inet_sock *inet =3D inet_sk(sk); + + if (net_eq(sock_net(sk), net) && inet->inet_num =3D=3D num && + !(inet->inet_daddr && inet->inet_daddr !=3D raddr) && + !(inet->inet_rcv_saddr && inet->inet_rcv_saddr !=3D laddr) && + raw_sk_bound_dev_eq(net, sk->sk_bound_dev_if, dif, sdif)) + return true; + return false; } -EXPORT_SYMBOL_GPL(__raw_v4_lookup); +EXPORT_SYMBOL_GPL(raw_v4_match); =20 /* * 0 - deliver @@ -168,23 +163,21 @@ static int icmp_filter(const struct sock *sk, const s= truct sk_buff *skb) */ static int raw_v4_input(struct sk_buff *skb, const struct iphdr *iph, int = hash) { + struct net *net =3D dev_net(skb->dev); int sdif =3D inet_sdif(skb); int dif =3D inet_iif(skb); - struct sock *sk; struct hlist_head *head; int delivered =3D 0; - struct net *net; + struct sock *sk; =20 - read_lock(&raw_v4_hashinfo.lock); head =3D &raw_v4_hashinfo.ht[hash]; if (hlist_empty(head)) - goto out; - - net =3D dev_net(skb->dev); - sk =3D __raw_v4_lookup(net, __sk_head(head), iph->protocol, - iph->saddr, iph->daddr, dif, sdif); - - while (sk) { + return 0; + read_lock(&raw_v4_hashinfo.lock); + sk_for_each(sk, head) { + if (!raw_v4_match(net, sk, iph->protocol, + iph->saddr, iph->daddr, dif, sdif)) + continue; delivered =3D 1; if ((iph->protocol !=3D IPPROTO_ICMP || !icmp_filter(sk, skb)) && ip_mc_sf_allow(sk, iph->daddr, iph->saddr, @@ -195,31 +188,16 @@ static int raw_v4_input(struct sk_buff *skb, const st= ruct iphdr *iph, int hash) if (clone) raw_rcv(sk, clone); } - sk =3D __raw_v4_lookup(net, sk_next(sk), iph->protocol, - iph->saddr, iph->daddr, - dif, sdif); } -out: read_unlock(&raw_v4_hashinfo.lock); return delivered; } =20 int raw_local_deliver(struct sk_buff *skb, int protocol) { - int hash; - struct sock *raw_sk; - - hash =3D protocol & (RAW_HTABLE_SIZE - 1); - raw_sk =3D sk_head(&raw_v4_hashinfo.ht[hash]); - - /* If there maybe a raw socket we must check - if not we - * don't care less - */ - if (raw_sk && !raw_v4_input(skb, ip_hdr(skb), hash)) - raw_sk =3D NULL; - - return raw_sk !=3D NULL; + int hash =3D protocol & (RAW_HTABLE_SIZE - 1); =20 + return raw_v4_input(skb, ip_hdr(skb), hash); } =20 static void raw_err(struct sock *sk, struct sk_buff *skb, u32 info) @@ -286,29 +264,24 @@ static void raw_err(struct sock *sk, struct sk_buff *= skb, u32 info) =20 void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info) { - int hash; - struct sock *raw_sk; + struct net *net =3D dev_net(skb->dev);; + int dif =3D skb->dev->ifindex; + int sdif =3D inet_sdif(skb); + struct hlist_head *head; const struct iphdr *iph; - struct net *net; + struct sock *sk; + int hash; =20 hash =3D protocol & (RAW_HTABLE_SIZE - 1); + head =3D &raw_v4_hashinfo.ht[hash]; =20 read_lock(&raw_v4_hashinfo.lock); - raw_sk =3D sk_head(&raw_v4_hashinfo.ht[hash]); - if (raw_sk) { - int dif =3D skb->dev->ifindex; - int sdif =3D inet_sdif(skb); - + sk_for_each(sk, head) { iph =3D (const struct iphdr *)skb->data; - net =3D dev_net(skb->dev); - - while ((raw_sk =3D __raw_v4_lookup(net, raw_sk, protocol, - iph->daddr, iph->saddr, - dif, sdif)) !=3D NULL) { - raw_err(raw_sk, skb, info); - raw_sk =3D sk_next(raw_sk); - iph =3D (const struct iphdr *)skb->data; - } + if (!raw_v4_match(net, sk, iph->protocol, + iph->saddr, iph->daddr, dif, sdif)) + continue; + raw_err(sk, skb, info); } read_unlock(&raw_v4_hashinfo.lock); } diff --git a/net/ipv4/raw_diag.c b/net/ipv4/raw_diag.c index ccacbde30a2c..b6d92dc7b051 100644 --- a/net/ipv4/raw_diag.c +++ b/net/ipv4/raw_diag.c @@ -34,31 +34,30 @@ raw_get_hashinfo(const struct inet_diag_req_v2 *r) * use helper to figure it out. */ =20 -static struct sock *raw_lookup(struct net *net, struct sock *from, - const struct inet_diag_req_v2 *req) +static bool raw_lookup(struct net *net, struct sock *sk, + const struct inet_diag_req_v2 *req) { struct inet_diag_req_raw *r =3D (void *)req; - struct sock *sk =3D NULL; =20 if (r->sdiag_family =3D=3D AF_INET) - sk =3D __raw_v4_lookup(net, from, r->sdiag_raw_protocol, - r->id.idiag_dst[0], - r->id.idiag_src[0], - r->id.idiag_if, 0); + return raw_v4_match(net, sk, r->sdiag_raw_protocol, + r->id.idiag_dst[0], + r->id.idiag_src[0], + r->id.idiag_if, 0); #if IS_ENABLED(CONFIG_IPV6) else - sk =3D __raw_v6_lookup(net, from, r->sdiag_raw_protocol, - (const struct in6_addr *)r->id.idiag_src, - (const struct in6_addr *)r->id.idiag_dst, - r->id.idiag_if, 0); + return raw_v6_match(net, sk, r->sdiag_raw_protocol, + (const struct in6_addr *)r->id.idiag_src, + (const struct in6_addr *)r->id.idiag_dst, + r->id.idiag_if, 0); #endif - return sk; + return false; } =20 static struct sock *raw_sock_get(struct net *net, const struct inet_diag_r= eq_v2 *r) { struct raw_hashinfo *hashinfo =3D raw_get_hashinfo(r); - struct sock *sk =3D NULL, *s; + struct sock *sk; int slot; =20 if (IS_ERR(hashinfo)) @@ -66,9 +65,8 @@ static struct sock *raw_sock_get(struct net *net, const s= truct inet_diag_req_v2 =20 read_lock(&hashinfo->lock); for (slot =3D 0; slot < RAW_HTABLE_SIZE; slot++) { - sk_for_each(s, &hashinfo->ht[slot]) { - sk =3D raw_lookup(net, s, r); - if (sk) { + sk_for_each(sk, &hashinfo->ht[slot]) { + if (raw_lookup(net, sk, r)) { /* * Grab it and keep until we fill * diag meaage to be reported, so @@ -81,10 +79,11 @@ static struct sock *raw_sock_get(struct net *net, const= struct inet_diag_req_v2 } } } + sk =3D ERR_PTR(-ENOENT); out_unlock: read_unlock(&hashinfo->lock); =20 - return sk ? sk : ERR_PTR(-ENOENT); + return sk; } =20 static int raw_diag_dump_one(struct netlink_callback *cb, diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 8bb41f3b246a..33a779723262 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -66,41 +66,27 @@ struct raw_hashinfo raw_v6_hashinfo =3D { }; EXPORT_SYMBOL_GPL(raw_v6_hashinfo); =20 -struct sock *__raw_v6_lookup(struct net *net, struct sock *sk, - unsigned short num, const struct in6_addr *loc_addr, - const struct in6_addr *rmt_addr, int dif, int sdif) +bool raw_v6_match(struct net *net, struct sock *sk, unsigned short num, + const struct in6_addr *loc_addr, + const struct in6_addr *rmt_addr, int dif, int sdif) { - bool is_multicast =3D ipv6_addr_is_multicast(loc_addr); - - sk_for_each_from(sk) - if (inet_sk(sk)->inet_num =3D=3D num) { - - if (!net_eq(sock_net(sk), net)) - continue; - - if (!ipv6_addr_any(&sk->sk_v6_daddr) && - !ipv6_addr_equal(&sk->sk_v6_daddr, rmt_addr)) - continue; - - if (!raw_sk_bound_dev_eq(net, sk->sk_bound_dev_if, - dif, sdif)) - continue; - - if (!ipv6_addr_any(&sk->sk_v6_rcv_saddr)) { - if (ipv6_addr_equal(&sk->sk_v6_rcv_saddr, loc_addr)) - goto found; - if (is_multicast && - inet6_mc_check(sk, loc_addr, rmt_addr)) - goto found; - continue; - } - goto found; - } - sk =3D NULL; -found: - return sk; + if (inet_sk(sk)->inet_num !=3D num || + !net_eq(sock_net(sk), net) || + (!ipv6_addr_any(&sk->sk_v6_daddr) && + !ipv6_addr_equal(&sk->sk_v6_daddr, rmt_addr)) || + !raw_sk_bound_dev_eq(net, sk->sk_bound_dev_if, + dif, sdif)) + return false; + + if (ipv6_addr_any(&sk->sk_v6_rcv_saddr) || + ipv6_addr_equal(&sk->sk_v6_rcv_saddr, loc_addr) || + (ipv6_addr_is_multicast(loc_addr) && + inet6_mc_check(sk, loc_addr, rmt_addr))) + return true; + + return false; } -EXPORT_SYMBOL_GPL(__raw_v6_lookup); +EXPORT_SYMBOL_GPL(raw_v6_match); =20 /* * 0 - deliver @@ -156,31 +142,28 @@ EXPORT_SYMBOL(rawv6_mh_filter_unregister); */ static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr) { + struct net *net =3D dev_net(skb->dev); const struct in6_addr *saddr; const struct in6_addr *daddr; + struct hlist_head *head; struct sock *sk; bool delivered =3D false; __u8 hash; - struct net *net; =20 saddr =3D &ipv6_hdr(skb)->saddr; daddr =3D saddr + 1; =20 hash =3D nexthdr & (RAW_HTABLE_SIZE - 1); - + head =3D &raw_v6_hashinfo.ht[hash]; + if (hlist_empty(head)) + return false; read_lock(&raw_v6_hashinfo.lock); - sk =3D sk_head(&raw_v6_hashinfo.ht[hash]); - - if (!sk) - goto out; - - net =3D dev_net(skb->dev); - sk =3D __raw_v6_lookup(net, sk, nexthdr, daddr, saddr, - inet6_iif(skb), inet6_sdif(skb)); - - while (sk) { + sk_for_each(sk, head) { int filtered; =20 + if (!raw_v6_match(net, sk, nexthdr, daddr, saddr, + inet6_iif(skb), inet6_sdif(skb))) + continue; delivered =3D true; switch (nexthdr) { case IPPROTO_ICMPV6: @@ -219,23 +202,14 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int= nexthdr) rawv6_rcv(sk, clone); } } - sk =3D __raw_v6_lookup(net, sk_next(sk), nexthdr, daddr, saddr, - inet6_iif(skb), inet6_sdif(skb)); } -out: read_unlock(&raw_v6_hashinfo.lock); return delivered; } =20 bool raw6_local_deliver(struct sk_buff *skb, int nexthdr) { - struct sock *raw_sk; - - raw_sk =3D sk_head(&raw_v6_hashinfo.ht[nexthdr & (RAW_HTABLE_SIZE - 1)]); - if (raw_sk && !ipv6_raw_deliver(skb, nexthdr)) - raw_sk =3D NULL; - - return raw_sk !=3D NULL; + return ipv6_raw_deliver(skb, nexthdr); } =20 /* This cleans up af_inet6 a bit. -DaveM */ @@ -361,28 +335,25 @@ static void rawv6_err(struct sock *sk, struct sk_buff= *skb, void raw6_icmp_error(struct sk_buff *skb, int nexthdr, u8 type, u8 code, int inner_offset, __be32 info) { + const struct in6_addr *saddr, *daddr; + struct net *net =3D dev_net(skb->dev); + struct hlist_head *head; struct sock *sk; int hash; - const struct in6_addr *saddr, *daddr; - struct net *net; =20 hash =3D nexthdr & (RAW_HTABLE_SIZE - 1); - + head =3D &raw_v6_hashinfo.ht[hash]; read_lock(&raw_v6_hashinfo.lock); - sk =3D sk_head(&raw_v6_hashinfo.ht[hash]); - if (sk) { + sk_for_each(sk, head) { /* Note: ipv6_hdr(skb) !=3D skb->data */ const struct ipv6hdr *ip6h =3D (const struct ipv6hdr *)skb->data; saddr =3D &ip6h->saddr; daddr =3D &ip6h->daddr; - net =3D dev_net(skb->dev); =20 - while ((sk =3D __raw_v6_lookup(net, sk, nexthdr, saddr, daddr, - inet6_iif(skb), inet6_iif(skb)))) { - rawv6_err(sk, skb, NULL, type, code, - inner_offset, info); - sk =3D sk_next(sk); - } + if (!raw_v6_match(net, sk, nexthdr, &ip6h->saddr, &ip6h->daddr, + inet6_iif(skb), inet6_iif(skb))) + continue; + rawv6_err(sk, skb, NULL, type, code, inner_offset, info); } read_unlock(&raw_v6_hashinfo.lock); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43224C00140 for ; Mon, 15 Aug 2022 20:57:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245672AbiHOU5s (ORCPT ); Mon, 15 Aug 2022 16:57:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346983AbiHOU4J (ORCPT ); Mon, 15 Aug 2022 16:56:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBA6F2DA88; Mon, 15 Aug 2022 12:11:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4A76F60693; Mon, 15 Aug 2022 19:11:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11300C433D7; Mon, 15 Aug 2022 19:11:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590704; bh=8UcBo53sMfjxfeAF7UoJhNhP7I5Km6M2V0AnJV4gYI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wgZQ4usTvij2hsBxE8qcL5kkB2679tsh3110WzAtfeWxBjUt7984mnVwpUoMke9ce RGpUGJr62mFnUAxFqDISdF47eT1ZM/aL29/iKLMH1UgnIJNdQnK3jW5pPibEGL0yEx BlmZHKAb7HH7tdWzpxEKdjiWjIy5PkppIfsNhxck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 0345/1095] raw: convert raw sockets to RCU Date: Mon, 15 Aug 2022 19:55:44 +0200 Message-Id: <20220815180444.065817818@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet [ Upstream commit 0daf07e527095e64ee8927ce297ab626643e9f51 ] Using rwlock in networking code is extremely risky. writers can starve if enough readers are constantly grabing the rwlock. I thought rwlock were at fault and sent this patch: https://lkml.org/lkml/2022/6/17/272 But Peter and Linus essentially told me rwlock had to be unfair. We need to get rid of rwlock in networking code. Without this fix, following script triggers soft lockups: for i in {1..48} do ping -f -n -q 127.0.0.1 & sleep 0.1 done Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/net/raw.h | 11 +++++- include/net/rawv6.h | 1 + net/ipv4/af_inet.c | 2 ++ net/ipv4/raw.c | 83 +++++++++++++++++++++------------------------ net/ipv4/raw_diag.c | 22 +++++++----- net/ipv6/af_inet6.c | 3 ++ net/ipv6/raw.c | 28 +++++++-------- 7 files changed, 80 insertions(+), 70 deletions(-) diff --git a/include/net/raw.h b/include/net/raw.h index 6324965779ec..537d9d1df890 100644 --- a/include/net/raw.h +++ b/include/net/raw.h @@ -33,9 +33,18 @@ int raw_rcv(struct sock *, struct sk_buff *); =20 struct raw_hashinfo { rwlock_t lock; - struct hlist_head ht[RAW_HTABLE_SIZE]; + struct hlist_nulls_head ht[RAW_HTABLE_SIZE]; }; =20 +static inline void raw_hashinfo_init(struct raw_hashinfo *hashinfo) +{ + int i; + + rwlock_init(&hashinfo->lock); + for (i =3D 0; i < RAW_HTABLE_SIZE; i++) + INIT_HLIST_NULLS_HEAD(&hashinfo->ht[i], i); +} + #ifdef CONFIG_PROC_FS int raw_proc_init(void); void raw_proc_exit(void); diff --git a/include/net/rawv6.h b/include/net/rawv6.h index c48c1298699a..bc70909625f6 100644 --- a/include/net/rawv6.h +++ b/include/net/rawv6.h @@ -3,6 +3,7 @@ #define _NET_RAWV6_H =20 #include +#include =20 extern struct raw_hashinfo raw_v6_hashinfo; bool raw_v6_match(struct net *net, struct sock *sk, unsigned short num, diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 5c207367b3b4..9a70032625af 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1920,6 +1920,8 @@ static int __init inet_init(void) =20 sock_skb_cb_check_size(sizeof(struct inet_skb_parm)); =20 + raw_hashinfo_init(&raw_v4_hashinfo); + rc =3D proto_register(&tcp_prot, 1); if (rc) goto out; diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index e9b8bb1e5fb0..2961421dfa68 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -85,20 +85,19 @@ struct raw_frag_vec { int hlen; }; =20 -struct raw_hashinfo raw_v4_hashinfo =3D { - .lock =3D __RW_LOCK_UNLOCKED(raw_v4_hashinfo.lock), -}; +struct raw_hashinfo raw_v4_hashinfo; EXPORT_SYMBOL_GPL(raw_v4_hashinfo); =20 int raw_hash_sk(struct sock *sk) { struct raw_hashinfo *h =3D sk->sk_prot->h.raw_hash; - struct hlist_head *head; + struct hlist_nulls_head *hlist; =20 - head =3D &h->ht[inet_sk(sk)->inet_num & (RAW_HTABLE_SIZE - 1)]; + hlist =3D &h->ht[inet_sk(sk)->inet_num & (RAW_HTABLE_SIZE - 1)]; =20 write_lock_bh(&h->lock); - sk_add_node(sk, head); + hlist_nulls_add_head_rcu(&sk->sk_nulls_node, hlist); + sock_set_flag(sk, SOCK_RCU_FREE); write_unlock_bh(&h->lock); sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); =20 @@ -111,7 +110,7 @@ void raw_unhash_sk(struct sock *sk) struct raw_hashinfo *h =3D sk->sk_prot->h.raw_hash; =20 write_lock_bh(&h->lock); - if (sk_del_node_init(sk)) + if (__sk_nulls_del_node_init_rcu(sk)) sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); write_unlock_bh(&h->lock); } @@ -164,17 +163,16 @@ static int icmp_filter(const struct sock *sk, const s= truct sk_buff *skb) static int raw_v4_input(struct sk_buff *skb, const struct iphdr *iph, int = hash) { struct net *net =3D dev_net(skb->dev); + struct hlist_nulls_head *hlist; + struct hlist_nulls_node *hnode; int sdif =3D inet_sdif(skb); int dif =3D inet_iif(skb); - struct hlist_head *head; int delivered =3D 0; struct sock *sk; =20 - head =3D &raw_v4_hashinfo.ht[hash]; - if (hlist_empty(head)) - return 0; - read_lock(&raw_v4_hashinfo.lock); - sk_for_each(sk, head) { + hlist =3D &raw_v4_hashinfo.ht[hash]; + rcu_read_lock(); + hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) { if (!raw_v4_match(net, sk, iph->protocol, iph->saddr, iph->daddr, dif, sdif)) continue; @@ -189,7 +187,7 @@ static int raw_v4_input(struct sk_buff *skb, const stru= ct iphdr *iph, int hash) raw_rcv(sk, clone); } } - read_unlock(&raw_v4_hashinfo.lock); + rcu_read_unlock(); return delivered; } =20 @@ -265,25 +263,26 @@ static void raw_err(struct sock *sk, struct sk_buff *= skb, u32 info) void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info) { struct net *net =3D dev_net(skb->dev);; + struct hlist_nulls_head *hlist; + struct hlist_nulls_node *hnode; int dif =3D skb->dev->ifindex; int sdif =3D inet_sdif(skb); - struct hlist_head *head; const struct iphdr *iph; struct sock *sk; int hash; =20 hash =3D protocol & (RAW_HTABLE_SIZE - 1); - head =3D &raw_v4_hashinfo.ht[hash]; + hlist =3D &raw_v4_hashinfo.ht[hash]; =20 - read_lock(&raw_v4_hashinfo.lock); - sk_for_each(sk, head) { + rcu_read_lock(); + hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) { iph =3D (const struct iphdr *)skb->data; if (!raw_v4_match(net, sk, iph->protocol, iph->saddr, iph->daddr, dif, sdif)) continue; raw_err(sk, skb, info); } - read_unlock(&raw_v4_hashinfo.lock); + rcu_read_unlock(); } =20 static int raw_rcv_skb(struct sock *sk, struct sk_buff *skb) @@ -945,44 +944,41 @@ struct proto raw_prot =3D { }; =20 #ifdef CONFIG_PROC_FS -static struct sock *raw_get_first(struct seq_file *seq) +static struct sock *raw_get_first(struct seq_file *seq, int bucket) { - struct sock *sk; struct raw_hashinfo *h =3D pde_data(file_inode(seq->file)); struct raw_iter_state *state =3D raw_seq_private(seq); + struct hlist_nulls_head *hlist; + struct hlist_nulls_node *hnode; + struct sock *sk; =20 - for (state->bucket =3D 0; state->bucket < RAW_HTABLE_SIZE; + for (state->bucket =3D bucket; state->bucket < RAW_HTABLE_SIZE; ++state->bucket) { - sk_for_each(sk, &h->ht[state->bucket]) + hlist =3D &h->ht[state->bucket]; + hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) { if (sock_net(sk) =3D=3D seq_file_net(seq)) - goto found; + return sk; + } } - sk =3D NULL; -found: - return sk; + return NULL; } =20 static struct sock *raw_get_next(struct seq_file *seq, struct sock *sk) { - struct raw_hashinfo *h =3D pde_data(file_inode(seq->file)); struct raw_iter_state *state =3D raw_seq_private(seq); =20 do { - sk =3D sk_next(sk); -try_again: - ; + sk =3D sk_nulls_next(sk); } while (sk && sock_net(sk) !=3D seq_file_net(seq)); =20 - if (!sk && ++state->bucket < RAW_HTABLE_SIZE) { - sk =3D sk_head(&h->ht[state->bucket]); - goto try_again; - } + if (!sk) + return raw_get_first(seq, state->bucket + 1); return sk; } =20 static struct sock *raw_get_idx(struct seq_file *seq, loff_t pos) { - struct sock *sk =3D raw_get_first(seq); + struct sock *sk =3D raw_get_first(seq, 0); =20 if (sk) while (pos && (sk =3D raw_get_next(seq, sk)) !=3D NULL) @@ -991,11 +987,9 @@ static struct sock *raw_get_idx(struct seq_file *seq, = loff_t pos) } =20 void *raw_seq_start(struct seq_file *seq, loff_t *pos) - __acquires(&h->lock) + __acquires(RCU) { - struct raw_hashinfo *h =3D pde_data(file_inode(seq->file)); - - read_lock(&h->lock); + rcu_read_lock(); return *pos ? raw_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; } EXPORT_SYMBOL_GPL(raw_seq_start); @@ -1005,7 +999,7 @@ void *raw_seq_next(struct seq_file *seq, void *v, loff= _t *pos) struct sock *sk; =20 if (v =3D=3D SEQ_START_TOKEN) - sk =3D raw_get_first(seq); + sk =3D raw_get_first(seq, 0); else sk =3D raw_get_next(seq, v); ++*pos; @@ -1014,11 +1008,9 @@ void *raw_seq_next(struct seq_file *seq, void *v, lo= ff_t *pos) EXPORT_SYMBOL_GPL(raw_seq_next); =20 void raw_seq_stop(struct seq_file *seq, void *v) - __releases(&h->lock) + __releases(RCU) { - struct raw_hashinfo *h =3D pde_data(file_inode(seq->file)); - - read_unlock(&h->lock); + rcu_read_unlock(); } EXPORT_SYMBOL_GPL(raw_seq_stop); =20 @@ -1080,6 +1072,7 @@ static __net_initdata struct pernet_operations raw_ne= t_ops =3D { =20 int __init raw_proc_init(void) { + return register_pernet_subsys(&raw_net_ops); } =20 diff --git a/net/ipv4/raw_diag.c b/net/ipv4/raw_diag.c index b6d92dc7b051..5f208e840d85 100644 --- a/net/ipv4/raw_diag.c +++ b/net/ipv4/raw_diag.c @@ -57,31 +57,32 @@ static bool raw_lookup(struct net *net, struct sock *sk, static struct sock *raw_sock_get(struct net *net, const struct inet_diag_r= eq_v2 *r) { struct raw_hashinfo *hashinfo =3D raw_get_hashinfo(r); + struct hlist_nulls_head *hlist; + struct hlist_nulls_node *hnode; struct sock *sk; int slot; =20 if (IS_ERR(hashinfo)) return ERR_CAST(hashinfo); =20 - read_lock(&hashinfo->lock); + rcu_read_lock(); for (slot =3D 0; slot < RAW_HTABLE_SIZE; slot++) { - sk_for_each(sk, &hashinfo->ht[slot]) { + hlist =3D &hashinfo->ht[slot]; + hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) { if (raw_lookup(net, sk, r)) { /* * Grab it and keep until we fill - * diag meaage to be reported, so + * diag message to be reported, so * caller should call sock_put then. - * We can do that because we're keeping - * hashinfo->lock here. */ - sock_hold(sk); - goto out_unlock; + if (refcount_inc_not_zero(&sk->sk_refcnt)) + goto out_unlock; } } } sk =3D ERR_PTR(-ENOENT); out_unlock: - read_unlock(&hashinfo->lock); + rcu_read_unlock(); =20 return sk; } @@ -141,6 +142,8 @@ static void raw_diag_dump(struct sk_buff *skb, struct n= etlink_callback *cb, struct raw_hashinfo *hashinfo =3D raw_get_hashinfo(r); struct net *net =3D sock_net(skb->sk); struct inet_diag_dump_data *cb_data; + struct hlist_nulls_head *hlist; + struct hlist_nulls_node *hnode; int num, s_num, slot, s_slot; struct sock *sk =3D NULL; struct nlattr *bc; @@ -157,7 +160,8 @@ static void raw_diag_dump(struct sk_buff *skb, struct n= etlink_callback *cb, for (slot =3D s_slot; slot < RAW_HTABLE_SIZE; s_num =3D 0, slot++) { num =3D 0; =20 - sk_for_each(sk, &hashinfo->ht[slot]) { + hlist =3D &hashinfo->ht[slot]; + hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) { struct inet_sock *inet =3D inet_sk(sk); =20 if (!net_eq(sock_net(sk), net)) diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index ef1e6545d869..095298c5727a 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -63,6 +63,7 @@ #include #include #include +#include =20 #include #include @@ -1074,6 +1075,8 @@ static int __init inet6_init(void) goto out; } =20 + raw_hashinfo_init(&raw_v6_hashinfo); + err =3D proto_register(&tcpv6_prot, 1); if (err) goto out; diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 33a779723262..9f0aafc778ce 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -61,9 +61,7 @@ =20 #define ICMPV6_HDRLEN 4 /* ICMPv6 header, RFC 4443 Section 2.1 */ =20 -struct raw_hashinfo raw_v6_hashinfo =3D { - .lock =3D __RW_LOCK_UNLOCKED(raw_v6_hashinfo.lock), -}; +struct raw_hashinfo raw_v6_hashinfo; EXPORT_SYMBOL_GPL(raw_v6_hashinfo); =20 bool raw_v6_match(struct net *net, struct sock *sk, unsigned short num, @@ -143,9 +141,10 @@ EXPORT_SYMBOL(rawv6_mh_filter_unregister); static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr) { struct net *net =3D dev_net(skb->dev); + struct hlist_nulls_head *hlist; + struct hlist_nulls_node *hnode; const struct in6_addr *saddr; const struct in6_addr *daddr; - struct hlist_head *head; struct sock *sk; bool delivered =3D false; __u8 hash; @@ -154,11 +153,9 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int = nexthdr) daddr =3D saddr + 1; =20 hash =3D nexthdr & (RAW_HTABLE_SIZE - 1); - head =3D &raw_v6_hashinfo.ht[hash]; - if (hlist_empty(head)) - return false; - read_lock(&raw_v6_hashinfo.lock); - sk_for_each(sk, head) { + hlist =3D &raw_v6_hashinfo.ht[hash]; + rcu_read_lock(); + hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) { int filtered; =20 if (!raw_v6_match(net, sk, nexthdr, daddr, saddr, @@ -203,7 +200,7 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int n= exthdr) } } } - read_unlock(&raw_v6_hashinfo.lock); + rcu_read_unlock(); return delivered; } =20 @@ -337,14 +334,15 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr, { const struct in6_addr *saddr, *daddr; struct net *net =3D dev_net(skb->dev); - struct hlist_head *head; + struct hlist_nulls_head *hlist; + struct hlist_nulls_node *hnode; struct sock *sk; int hash; =20 hash =3D nexthdr & (RAW_HTABLE_SIZE - 1); - head =3D &raw_v6_hashinfo.ht[hash]; - read_lock(&raw_v6_hashinfo.lock); - sk_for_each(sk, head) { + hlist =3D &raw_v6_hashinfo.ht[hash]; + rcu_read_lock(); + hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) { /* Note: ipv6_hdr(skb) !=3D skb->data */ const struct ipv6hdr *ip6h =3D (const struct ipv6hdr *)skb->data; saddr =3D &ip6h->saddr; @@ -355,7 +353,7 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr, continue; rawv6_err(sk, skb, NULL, type, code, inner_offset, info); } - read_unlock(&raw_v6_hashinfo.lock); + rcu_read_unlock(); } =20 static inline int rawv6_rcv_skb(struct sock *sk, struct sk_buff *skb) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB77EC25B0E for ; Mon, 15 Aug 2022 20:57:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243446AbiHOU5l (ORCPT ); Mon, 15 Aug 2022 16:57:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346987AbiHOU4K (ORCPT ); Mon, 15 Aug 2022 16:56:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F07062D1E6; Mon, 15 Aug 2022 12:11:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8DCFF60ABC; Mon, 15 Aug 2022 19:11:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E9BFC433D6; Mon, 15 Aug 2022 19:11:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590708; bh=QBGjRJFtEU+iElACBkJr5j4kRG4AHRygAmG1sCA7G9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MTWWs3AL2OrfdSCgcFodbikH1OxYLFz7pXDBX+mvrkWPMK5T6RBHCbsPbriVYoJPU pyNtqYsC0bRM8p9KDUCN8P4PXBEQxMpSV1TznWPflX23cwI7u+dGuaKTAZeZPLPfQ2 MB+BV9vFNNFCxkMM+xEeMTMH1pJoDgcE7ePApwJU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 0346/1095] raw: Fix mixed declarations error in raw_icmp_error(). Date: Mon, 15 Aug 2022 19:55:45 +0200 Message-Id: <20220815180444.104879966@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kuniyuki Iwashima [ Upstream commit 5da39e31b1b0eb62b8ed369ad9615da850239e9e ] The trailing semicolon causes a compiler error, so let's remove it. net/ipv4/raw.c: In function =E2=80=98raw_icmp_error=E2=80=99: net/ipv4/raw.c:266:2: error: ISO C90 forbids mixed declarations and code [-= Werror=3Ddeclaration-after-statement] 266 | struct hlist_nulls_head *hlist; | ^~~~~~ Fixes: ba44f8182ec2 ("raw: use more conventional iterators") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/ipv4/raw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 2961421dfa68..0d534f4720c4 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -262,7 +262,7 @@ static void raw_err(struct sock *sk, struct sk_buff *sk= b, u32 info) =20 void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info) { - struct net *net =3D dev_net(skb->dev);; + struct net *net =3D dev_net(skb->dev); struct hlist_nulls_head *hlist; struct hlist_nulls_node *hnode; int dif =3D skb->dev->ifindex; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49F49C00140 for ; Mon, 15 Aug 2022 20:58:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231553AbiHOU6N (ORCPT ); Mon, 15 Aug 2022 16:58:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347007AbiHOU4L (ORCPT ); Mon, 15 Aug 2022 16:56:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A5C23C15E; Mon, 15 Aug 2022 12:11:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5ACE8B810A3; Mon, 15 Aug 2022 19:11:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0AAFC433C1; Mon, 15 Aug 2022 19:11:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590711; bh=yoQg6NKdMlJWBXAeCm7pQmdhWY0gthNK7cvvUtgPvxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HaEyb97Xx8tDya1NemuXuHw7u9z2tnzBiJ8tbwHY5pZkVUgA4SLUNwLCkpKcuxvqH oOPkKM+PTi5Dzvcmeo9Z53LbkPL2YHjjd3qv9UL9TWy5Ms4OajZW7PLOq2uvK8O0/L HzW/GVwqDL/W6Swu8G9RqoQ9At2PMcRgiRcnfqc4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Eugen Hristev , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0347/1095] media: atmel: atmel-sama7g5-isc: fix warning in configs without OF Date: Mon, 15 Aug 2022 19:55:46 +0200 Message-Id: <20220815180444.139026910@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eugen Hristev [ Upstream commit b2bae4b8e637dd751d27918a6b27bd5abcd08859 ] All warnings (new ones prefixed by >>): >> drivers/media/platform/atmel/atmel-sama7g5-isc.c:610:34: warning: unused= variable 'microchip_xisc_of_match' [-Wunused-const-variable] static const struct of_device_id microchip_xisc_of_match[] =3D { ^ 13 warnings generated. vim +/microchip_xisc_of_match +610 drivers/media/platform/atmel/atmel-sama7= g5-isc.c 609 > 610 static const struct of_device_id microchip_xisc_of_match[] =3D { 611 { .compatible =3D "microchip,sama7g5-isc" }, 612 { } 613 }; 614 MODULE_DEVICE_TABLE(of, microchip_xisc_of_match); 615 Fixed warning by guarding the atmel_isc_of_match by CONFIG_OF. Reported-by: kernel test robot Fixes: c9aa973884a1 ("media: atmel: atmel-isc: add microchip-xisc driver") Signed-off-by: Eugen Hristev Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/atmel/atmel-sama7g5-isc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/atmel/atmel-sama7g5-isc.c b/drivers/med= ia/platform/atmel/atmel-sama7g5-isc.c index 07a80b08bc54..e292a8d790a3 100644 --- a/drivers/media/platform/atmel/atmel-sama7g5-isc.c +++ b/drivers/media/platform/atmel/atmel-sama7g5-isc.c @@ -612,11 +612,13 @@ static const struct dev_pm_ops microchip_xisc_dev_pm_= ops =3D { SET_RUNTIME_PM_OPS(xisc_runtime_suspend, xisc_runtime_resume, NULL) }; =20 +#if IS_ENABLED(CONFIG_OF) static const struct of_device_id microchip_xisc_of_match[] =3D { { .compatible =3D "microchip,sama7g5-isc" }, { } }; MODULE_DEVICE_TABLE(of, microchip_xisc_of_match); +#endif =20 static struct platform_driver microchip_xisc_driver =3D { .probe =3D microchip_xisc_probe, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7A25C00140 for ; Mon, 15 Aug 2022 20:58:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244220AbiHOU6b (ORCPT ); Mon, 15 Aug 2022 16:58:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347024AbiHOU4N (ORCPT ); Mon, 15 Aug 2022 16:56:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA3134F1AD; Mon, 15 Aug 2022 12:11:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 470AD60693; Mon, 15 Aug 2022 19:11:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51967C433C1; Mon, 15 Aug 2022 19:11:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590717; bh=zfIZ+r3tJPCB2oToX0Vxr7pLYk/MjTYFsb8+1JVJSZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PqChKhPQ35WExOwi5LtjIPShv6SdSYClI4o05YcnsuRC2+xvCWVb9sgU4WG5A0yaF kCknJe2dusXOkfX8jTWvvyloqNfedy0JVV27vNx1ALIGWWLj11ufLPUoNbaS0LjZJl 8bk7NAH9f+HhTJ8buDNZgi7oz5VxsYj9GezxgfLA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0348/1095] media: camss: csid: fix wrong size passed to devm_kmalloc_array() Date: Mon, 15 Aug 2022 19:55:47 +0200 Message-Id: <20220815180444.171369033@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit 4c25384d136642d72098e36201ca988533e73065 ] 'supplies' is a pointer, the real size of struct regulator_bulk_data should be pass to devm_kmalloc_array(). Fixes: 0d8140179715 ("media: camss: Add regulator_bulk support") Signed-off-by: Yang Yingliang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/qcom/camss/camss-csid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media= /platform/qcom/camss/camss-csid.c index f993f349b66b..80628801cf09 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -666,7 +666,7 @@ int msm_csid_subdev_init(struct camss *camss, struct cs= id_device *csid, if (csid->num_supplies) { csid->supplies =3D devm_kmalloc_array(camss->dev, csid->num_supplies, - sizeof(csid->supplies), + sizeof(*csid->supplies), GFP_KERNEL); if (!csid->supplies) return -ENOMEM; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90BB5C00140 for ; Mon, 15 Aug 2022 20:58:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244340AbiHOU6g (ORCPT ); Mon, 15 Aug 2022 16:58:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347032AbiHOU4O (ORCPT ); Mon, 15 Aug 2022 16:56:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1ABB02D1D2; Mon, 15 Aug 2022 12:12:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AC65760BDE; Mon, 15 Aug 2022 19:12:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64CD7C433C1; Mon, 15 Aug 2022 19:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590721; bh=waPJhJ6SojFPzfGmvO2QfFFRmbu4h7chPRsAD9faz1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j27v1TT15eWZB+430UZS3ddchi/QsUD5HlpUMtQ68pKv+Hrz9q8IqOc4M4PqBvKFo t4uTRX37wCfN80FIZso3n3xavpniY9YV6BBQv5BysH+RzVhCjTvbhBCC3zVGCoNtGL y9rXj3nOeyjkyahDA89rc7FOHx1vYrtaJe56miCk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0349/1095] media: tw686x: Register the irq at the end of probe Date: Mon, 15 Aug 2022 19:55:48 +0200 Message-Id: <20220815180444.211191813@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheyu Ma [ Upstream commit fb730334e0f759d00f72168fbc555e5a95e35210 ] We got the following warning when booting the kernel: [ 3.243674] INFO: trying to register non-static key. [ 3.243922] The code is fine but needs lockdep annotation, or maybe [ 3.244230] you didn't initialize this object before use? [ 3.245642] Call Trace: [ 3.247836] lock_acquire+0xff/0x2d0 [ 3.248727] tw686x_audio_irq+0x1a5/0xcc0 [tw686x] [ 3.249211] tw686x_irq+0x1f9/0x480 [tw686x] The lock 'vc->qlock' will be initialized in tw686x_video_init(), but the driver registers the irq before calling the tw686x_video_init(), and we got the warning. Fix this by registering the irq at the end of probe Fixes: 704a84ccdbf1 ("[media] media: Support Intersil/Techwell TW686x-based= video capture cards") Signed-off-by: Zheyu Ma Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/pci/tw686x/tw686x-core.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/media/pci/tw686x/tw686x-core.c b/drivers/media/pci/tw6= 86x/tw686x-core.c index 6676e069b515..384d38754a4b 100644 --- a/drivers/media/pci/tw686x/tw686x-core.c +++ b/drivers/media/pci/tw686x/tw686x-core.c @@ -315,13 +315,6 @@ static int tw686x_probe(struct pci_dev *pci_dev, =20 spin_lock_init(&dev->lock); =20 - err =3D request_irq(pci_dev->irq, tw686x_irq, IRQF_SHARED, - dev->name, dev); - if (err < 0) { - dev_err(&pci_dev->dev, "unable to request interrupt\n"); - goto iounmap; - } - timer_setup(&dev->dma_delay_timer, tw686x_dma_delay, 0); =20 /* @@ -333,18 +326,23 @@ static int tw686x_probe(struct pci_dev *pci_dev, err =3D tw686x_video_init(dev); if (err) { dev_err(&pci_dev->dev, "can't register video\n"); - goto free_irq; + goto iounmap; } =20 err =3D tw686x_audio_init(dev); if (err) dev_warn(&pci_dev->dev, "can't register audio\n"); =20 + err =3D request_irq(pci_dev->irq, tw686x_irq, IRQF_SHARED, + dev->name, dev); + if (err < 0) { + dev_err(&pci_dev->dev, "unable to request interrupt\n"); + goto iounmap; + } + pci_set_drvdata(pci_dev, dev); return 0; =20 -free_irq: - free_irq(pci_dev->irq, dev); iounmap: pci_iounmap(pci_dev, dev->mmio); free_region: --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48C5CC25B08 for ; Mon, 15 Aug 2022 20:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233603AbiHOU6l (ORCPT ); Mon, 15 Aug 2022 16:58:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347038AbiHOU4O (ORCPT ); Mon, 15 Aug 2022 16:56:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CDCE3C172; Mon, 15 Aug 2022 12:12:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CCDD560BC2; Mon, 15 Aug 2022 19:12:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3C48C433D6; Mon, 15 Aug 2022 19:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590724; bh=7ipuau29OrxC/JxYf2KFZ2+Br8E6WRvnE93hYM3LSwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a5LfUXwd7uLT0eudp5Y6skffQ9vSEPzvEK749bwgvp4cKT36W2GvMpg1nnYCXmhM7 WxKAt10YNg0sZV/FClXXbyHUErSUCMqb1rWnVV35kOm0gm7EajRNCr0KlDYrgyoTtK 4D+6ZvrBgso2KfJ7AsTik6MtWQaEGlpugC5ytjTM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0350/1095] media: amphion: return error if format is unsupported by vpu Date: Mon, 15 Aug 2022 19:55:49 +0200 Message-Id: <20220815180444.248436828@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit a3a2efca36a3a1ddba229a7be7991e8b5de4ac35 ] return error if format is unsupported by vpu, otherwise the vpu will be stalled at decoding Fixes: 3cd084519c6f9 ("media: amphion: add vpu v4l2 m2m support") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/amphion/vpu_malone.c | 2 ++ drivers/media/platform/amphion/vpu_v4l2.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/amphion/vpu_malone.c b/drivers/media/pl= atform/amphion/vpu_malone.c index 446a9de0cc11..d91be0ece961 100644 --- a/drivers/media/platform/amphion/vpu_malone.c +++ b/drivers/media/platform/amphion/vpu_malone.c @@ -609,6 +609,8 @@ static int vpu_malone_set_params(struct vpu_shared_addr= *shared, enum vpu_malone_format malone_format; =20 malone_format =3D vpu_malone_format_remap(params->codec_format); + if (WARN_ON(malone_format =3D=3D MALONE_FMT_NULL)) + return -EINVAL; iface->udata_buffer[instance].base =3D params->udata.base; iface->udata_buffer[instance].slot_size =3D params->udata.size; =20 diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/plat= form/amphion/vpu_v4l2.c index 9c0704cd5766..4183a3994d30 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -440,10 +440,12 @@ static int vpu_vb2_start_streaming(struct vb2_queue *= q, unsigned int count) fmt->sizeimage[1], fmt->bytesperline[1], fmt->sizeimage[2], fmt->bytesperline[2], q->num_buffers); - call_void_vop(inst, start, q->type); + ret =3D call_vop(inst, start, q->type); vb2_clear_last_buffer_dequeued(q); + if (ret) + vpu_vb2_buffers_return(inst, q->type, VB2_BUF_STATE_QUEUED); =20 - return 0; + return ret; } =20 static void vpu_vb2_stop_streaming(struct vb2_queue *q) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9919BC3F6B0 for ; Mon, 15 Aug 2022 21:05:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242291AbiHOVEr (ORCPT ); Mon, 15 Aug 2022 17:04:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347049AbiHOU4P (ORCPT ); Mon, 15 Aug 2022 16:56:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BFBE4F688; Mon, 15 Aug 2022 12:12:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BE9C2B81106; Mon, 15 Aug 2022 19:12:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CEBFC433D6; Mon, 15 Aug 2022 19:12:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590727; bh=hHCohr2pvT6665QyvBJWeiuo0wm6VPzuTJD4FG3o8RE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u1C9dhP18lb6YuSI3CL+RapagO/UAKjuIjpoZmJuMif6+W9JsuYzdEoYPRk596BuC kDwunPAtk0YvlYE13obUUV++hpAGNuXbzrtqhNLbR3lzzwkvLnh+iihpSpjRzVCw+E VLeNrzIOjVfhgbQ6K6ZTZiMPeV2LN9BcQSsVK4bI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Gaignard , Nicolas Dufresne , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0351/1095] media: Hantro: Correct G2 init qp field Date: Mon, 15 Aug 2022 19:55:50 +0200 Message-Id: <20220815180444.286333757@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Benjamin Gaignard [ Upstream commit 300065f966d30baa59a13849753305aac8c320c3 ] Documentation said that g2 init_qp field use bits 24 to 30 of the 8th register. Change the field mask to be able to set 7 bits and not only 6 of them. Conformance test INITQP_B_Main10_Sony_1 decoding is OK with this patch. Fixes: cb5dd5a0fa518 ("media: hantro: Introduce G2/HEVC decoder") Signed-off-by: Benjamin Gaignard Reviewed-by: Nicolas Dufresne Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/staging/media/hantro/hantro_g2_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/hantro/hantro_g2_regs.h b/drivers/stagin= g/media/hantro/hantro_g2_regs.h index b7c6f9877b9d..0f43516d0805 100644 --- a/drivers/staging/media/hantro/hantro_g2_regs.h +++ b/drivers/staging/media/hantro/hantro_g2_regs.h @@ -107,7 +107,7 @@ =20 #define g2_start_code_e G2_DEC_REG(10, 31, 0x1) #define g2_init_qp_old G2_DEC_REG(10, 25, 0x3f) -#define g2_init_qp G2_DEC_REG(10, 24, 0x3f) +#define g2_init_qp G2_DEC_REG(10, 24, 0x7f) #define g2_num_tile_cols_old G2_DEC_REG(10, 20, 0x1f) #define g2_num_tile_cols G2_DEC_REG(10, 19, 0x1f) #define g2_num_tile_rows_old G2_DEC_REG(10, 15, 0x1f) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA082C00140 for ; Mon, 15 Aug 2022 20:58:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243627AbiHOU6p (ORCPT ); Mon, 15 Aug 2022 16:58:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347080AbiHOU4R (ORCPT ); Mon, 15 Aug 2022 16:56:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CB2D4F6BD; Mon, 15 Aug 2022 12:12:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1D9EB81106; Mon, 15 Aug 2022 19:12:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B0BBC433D6; Mon, 15 Aug 2022 19:12:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590730; bh=FaBU6tLMXKLhCG+xIjEuo5LMD+Ntohf7n0ctw1jkAIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g7lwjcPdP1aprBIyciIZ9+F/VMsc3sVl9gb708B1lToC5Rg5z/LDxN8ReyZimBfnu 0cr3wVMmXuLTa0AQvZe0cPKgtexEJOl3F4Fg7HQzSzfdqUr0dYS1GiZvE6QSMAdx2Y Ofdi8Ohoj7Z0dIJvkIdWOKPrQEGbqcfgnku2tTOU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0352/1095] media: imx-jpeg: Correct some definition according specification Date: Mon, 15 Aug 2022 19:55:51 +0200 Message-Id: <20220815180444.317088124@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 5a601f89e846c1b6005ab274d039e5036fc22015 ] the register CAST_NOMFRSIZE_LO should be equal to CAST_STATUS16 the register CAST_NOMFRSIZE_HI should be equal to CAST_STATUS17 the register CAST_OFBSIZE_LO should be equal to CAST_STATUS18 the register CAST_OFBSIZE_HI should be equal to CAST_STATUS19 Fixes: 2db16c6ed72ce ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Enco= der/Decoder") Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h b/drivers/me= dia/platform/nxp/imx-jpeg/mxc-jpeg-hw.h index ae70d3a0dc24..12f132a83a23 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h @@ -53,10 +53,10 @@ #define CAST_REC_REGS_SEL CAST_STATUS4 #define CAST_LUMTH CAST_STATUS5 #define CAST_CHRTH CAST_STATUS6 -#define CAST_NOMFRSIZE_LO CAST_STATUS7 -#define CAST_NOMFRSIZE_HI CAST_STATUS8 -#define CAST_OFBSIZE_LO CAST_STATUS9 -#define CAST_OFBSIZE_HI CAST_STATUS10 +#define CAST_NOMFRSIZE_LO CAST_STATUS16 +#define CAST_NOMFRSIZE_HI CAST_STATUS17 +#define CAST_OFBSIZE_LO CAST_STATUS18 +#define CAST_OFBSIZE_HI CAST_STATUS19 =20 #define MXC_MAX_SLOTS 1 /* TODO use all 4 slots*/ /* JPEG-Decoder Wrapper Slot Registers 0..3 */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08723C00140 for ; Mon, 15 Aug 2022 20:58:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233221AbiHOU6v (ORCPT ); Mon, 15 Aug 2022 16:58:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347112AbiHOU4V (ORCPT ); Mon, 15 Aug 2022 16:56:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90DDC50072; Mon, 15 Aug 2022 12:12:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D73B4B810C6; Mon, 15 Aug 2022 19:12:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A034C433D6; Mon, 15 Aug 2022 19:12:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590733; bh=wvstyrNiHwQRfCv1UAdm9llFykSd9dBXQ/oWG1WnIwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HAB37KnVBzPGdrUuDo0psujfdyD5AT26Jwm5zcFSjvch1DjWfRPieYxNWQ4Vmq+V6 m2BmUyjddzjuFpHbSmI4IKR1ZEUBIB8K+IHJgU6tePBgTn+rg2Pc7Oe1GZ81B8UKnS +rRUNQQaLHX3nHH27uaaDSzgqDBBF8yNu3dC9geg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Tommaso Merciai , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0353/1095] media: imx-jpeg: Leave a blank space before the configuration data Date: Mon, 15 Aug 2022 19:55:52 +0200 Message-Id: <20220815180444.347335006@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 6285cdea19daf764bf00f662a59fc83ef67345cf ] There is a hardware bug that it will load the first 128 bytes of configuration data twice, it will led to some configure error. so shift the configuration data 128 bytes, and make the first 128 bytes all zero, then hardware will load the 128 zero twice, and ignore them as garbage. then the configuration data can be loaded correctly Fixes: 2db16c6ed72ce ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Enco= der/Decoder") Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Reviewed-by: Tommaso Merciai Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.c index d1ec1f4b506b..b53b2317bcee 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -508,6 +508,7 @@ static bool mxc_jpeg_alloc_slot_data(struct mxc_jpeg_de= v *jpeg, GFP_ATOMIC); if (!cfg_stm) goto err; + memset(cfg_stm, 0, MXC_JPEG_MAX_CFG_STREAM); jpeg->slot_data[slot].cfg_stream_vaddr =3D cfg_stm; =20 skip_alloc: @@ -743,7 +744,13 @@ static unsigned int mxc_jpeg_setup_cfg_stream(void *cf= g_stream_vaddr, u32 fourcc, u16 w, u16 h) { - unsigned int offset =3D 0; + /* + * There is a hardware issue that first 128 bytes of configuration data + * can't be loaded correctly. + * To avoid this issue, we need to write the configuration from + * an offset which should be no less than 0x80 (128 bytes). + */ + unsigned int offset =3D 0x80; u8 *cfg =3D (u8 *)cfg_stream_vaddr; struct mxc_jpeg_sof *sof; struct mxc_jpeg_sos *sos; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F25B3C00140 for ; Mon, 15 Aug 2022 20:58:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244076AbiHOU65 (ORCPT ); Mon, 15 Aug 2022 16:58:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347162AbiHOU4Z (ORCPT ); Mon, 15 Aug 2022 16:56:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B4325018A; Mon, 15 Aug 2022 12:12:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D5B91B81117; Mon, 15 Aug 2022 19:12:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BD09C433C1; Mon, 15 Aug 2022 19:12:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590736; bh=hWJfRmigzXjjlg325CHFkYdC+YR8IOWJqgSXsWNhN+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p32zk5WUS7vpL50hCEM8mx7+QeyJfQ2P7ilVDtuGfLJeO023dGbZbpMeqwHC4YLuE sKzwFbjSV37L357dhAHjEIe3pViUTUT3hCr2UzI+lgGgGSZEuqmA+3dZOsq52n5Wqt UxqWx7p5Xbb1QZey2zf+fV/5pkYzuizrK2YT9kbc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0354/1095] media: imx-jpeg: Refactor function mxc_jpeg_parse Date: Mon, 15 Aug 2022 19:55:53 +0200 Message-Id: <20220815180444.382625860@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 8dd504a3a0a5f73b4c137ce3afc35936a4ecd871 ] Refine code to support dynamic resolution change Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.c index b53b2317bcee..d5a4d66b3998 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -1252,8 +1252,7 @@ static void mxc_jpeg_sizeimage(struct mxc_jpeg_q_data= *q) } } =20 -static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, - u8 *src_addr, u32 size, bool *dht_needed) +static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, struct vb2_buffer *vb) { struct device *dev =3D ctx->mxc_jpeg->dev; struct mxc_jpeg_q_data *q_data_out, *q_data_cap; @@ -1263,6 +1262,9 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, struct v4l2_jpeg_header header; struct mxc_jpeg_sof *psof =3D NULL; struct mxc_jpeg_sos *psos =3D NULL; + struct mxc_jpeg_src_buf *jpeg_src_buf =3D vb2_to_mxc_buf(vb); + u8 *src_addr =3D (u8 *)vb2_plane_vaddr(vb, 0); + u32 size =3D vb2_get_plane_payload(vb, 0); int ret; =20 memset(&header, 0, sizeof(header)); @@ -1273,7 +1275,7 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, } =20 /* if DHT marker present, no need to inject default one */ - *dht_needed =3D (header.num_dht =3D=3D 0); + jpeg_src_buf->dht_needed =3D (header.num_dht =3D=3D 0); =20 q_data_out =3D mxc_jpeg_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); @@ -1388,10 +1390,7 @@ static void mxc_jpeg_buf_queue(struct vb2_buffer *vb) =20 jpeg_src_buf =3D vb2_to_mxc_buf(vb); jpeg_src_buf->jpeg_parse_error =3D false; - ret =3D mxc_jpeg_parse(ctx, - (u8 *)vb2_plane_vaddr(vb, 0), - vb2_get_plane_payload(vb, 0), - &jpeg_src_buf->dht_needed); + ret =3D mxc_jpeg_parse(ctx, vb); if (ret) jpeg_src_buf->jpeg_parse_error =3D true; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65A9FC00140 for ; Mon, 15 Aug 2022 20:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232300AbiHOU7A (ORCPT ); Mon, 15 Aug 2022 16:59:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347256AbiHOU4e (ORCPT ); Mon, 15 Aug 2022 16:56:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92E99C04D1; Mon, 15 Aug 2022 12:12:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6A7136009B; Mon, 15 Aug 2022 19:12:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55DAFC433C1; Mon, 15 Aug 2022 19:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590739; bh=q8DmXpApjTRhuYKV877tAEMr7eqPy0HS6qO4TMdtMGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2VPjK3hoSjUWuzD4v0dmQgXdRxIDARzhofF0rirYusyP3unM6jy82YshKlC81ZK5g SN38NsygxyXc5M802qsSlraeEGothj2XVYynuQ4FFTdK4TkWcNcMduLS3X2Zvhqno+ bGL4Ge2lIO7zjSOmw6uMJq2hMhHHTZioA3itHVyE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0355/1095] media: imx-jpeg: Identify and handle precision correctly Date: Mon, 15 Aug 2022 19:55:54 +0200 Message-Id: <20220815180444.421024205@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit bec0a3a67389ede106d0661a007edf832878d8b2 ] The decoder will save the precision that was detected from jpeg header and use it later, when choosing the pixel format and also calculate bytesperline according to precision. The 12bit jpeg is not supported yet, but driver shouldn't led to serious problem if user enqueue a 12 bit jpeg. And the 12bit jpeg is supported by hardware, driver may support it later. [hverkuil: document the new precision field] Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 37 +++++++++++++------ .../media/platform/nxp/imx-jpeg/mxc-jpeg.h | 2 + 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.c index d5a4d66b3998..ece53821859c 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -82,6 +82,7 @@ static const struct mxc_jpeg_fmt mxc_formats[] =3D { .h_align =3D 3, .v_align =3D 3, .flags =3D MXC_JPEG_FMT_TYPE_RAW, + .precision =3D 8, }, { .name =3D "ARGB", /* ARGBARGB packed format */ @@ -93,6 +94,7 @@ static const struct mxc_jpeg_fmt mxc_formats[] =3D { .h_align =3D 3, .v_align =3D 3, .flags =3D MXC_JPEG_FMT_TYPE_RAW, + .precision =3D 8, }, { .name =3D "YUV420", /* 1st plane =3D Y, 2nd plane =3D UV */ @@ -104,6 +106,7 @@ static const struct mxc_jpeg_fmt mxc_formats[] =3D { .h_align =3D 4, .v_align =3D 4, .flags =3D MXC_JPEG_FMT_TYPE_RAW, + .precision =3D 8, }, { .name =3D "YUV422", /* YUYV */ @@ -115,6 +118,7 @@ static const struct mxc_jpeg_fmt mxc_formats[] =3D { .h_align =3D 4, .v_align =3D 3, .flags =3D MXC_JPEG_FMT_TYPE_RAW, + .precision =3D 8, }, { .name =3D "YUV444", /* YUVYUV */ @@ -126,6 +130,7 @@ static const struct mxc_jpeg_fmt mxc_formats[] =3D { .h_align =3D 3, .v_align =3D 3, .flags =3D MXC_JPEG_FMT_TYPE_RAW, + .precision =3D 8, }, { .name =3D "Gray", /* Gray (Y8/Y12) or Single Comp */ @@ -137,6 +142,7 @@ static const struct mxc_jpeg_fmt mxc_formats[] =3D { .h_align =3D 3, .v_align =3D 3, .flags =3D MXC_JPEG_FMT_TYPE_RAW, + .precision =3D 8, }, }; =20 @@ -1182,14 +1188,17 @@ static u32 mxc_jpeg_get_image_format(struct device = *dev, =20 for (i =3D 0; i < MXC_JPEG_NUM_FORMATS; i++) if (mxc_formats[i].subsampling =3D=3D header->frame.subsampling && - mxc_formats[i].nc =3D=3D header->frame.num_components) { + mxc_formats[i].nc =3D=3D header->frame.num_components && + mxc_formats[i].precision =3D=3D header->frame.precision) { fourcc =3D mxc_formats[i].fourcc; break; } if (fourcc =3D=3D 0) { - dev_err(dev, "Could not identify image format nc=3D%d, subsampling=3D%d\= n", + dev_err(dev, + "Could not identify image format nc=3D%d, subsampling=3D%d, precision= =3D%d\n", header->frame.num_components, - header->frame.subsampling); + header->frame.subsampling, + header->frame.precision); return fourcc; } /* @@ -1215,18 +1224,22 @@ static void mxc_jpeg_bytesperline(struct mxc_jpeg_q= _data *q, /* bytesperline unused for compressed formats */ q->bytesperline[0] =3D 0; q->bytesperline[1] =3D 0; - } else if (q->fmt->fourcc =3D=3D V4L2_PIX_FMT_NV12M) { + } else if (q->fmt->subsampling =3D=3D V4L2_JPEG_CHROMA_SUBSAMPLING_420) { /* When the image format is planar the bytesperline value * applies to the first plane and is divided by the same factor * as the width field for the other planes */ - q->bytesperline[0] =3D q->w * (precision / 8) * - (q->fmt->depth / 8); + q->bytesperline[0] =3D q->w * DIV_ROUND_UP(precision, 8); q->bytesperline[1] =3D q->bytesperline[0]; + } else if (q->fmt->subsampling =3D=3D V4L2_JPEG_CHROMA_SUBSAMPLING_422) { + q->bytesperline[0] =3D q->w * DIV_ROUND_UP(precision, 8) * 2; + q->bytesperline[1] =3D 0; + } else if (q->fmt->subsampling =3D=3D V4L2_JPEG_CHROMA_SUBSAMPLING_444) { + q->bytesperline[0] =3D q->w * DIV_ROUND_UP(precision, 8) * q->fmt->nc; + q->bytesperline[1] =3D 0; } else { - /* single plane formats */ - q->bytesperline[0] =3D q->w * (precision / 8) * - (q->fmt->depth / 8); + /* grayscale */ + q->bytesperline[0] =3D q->w * DIV_ROUND_UP(precision, 8); q->bytesperline[1] =3D 0; } } @@ -1360,7 +1373,7 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, s= truct vb2_buffer *vb) (fourcc >> 24) & 0xff); =20 /* setup bytesperline/sizeimage for capture queue */ - mxc_jpeg_bytesperline(q_data_cap, header.frame.precision); + mxc_jpeg_bytesperline(q_data_cap, q_data_cap->fmt->precision); mxc_jpeg_sizeimage(q_data_cap); =20 /* @@ -1516,7 +1529,7 @@ static void mxc_jpeg_set_default_params(struct mxc_jp= eg_ctx *ctx) q[i]->h =3D MXC_JPEG_DEFAULT_HEIGHT; q[i]->w_adjusted =3D MXC_JPEG_DEFAULT_WIDTH; q[i]->h_adjusted =3D MXC_JPEG_DEFAULT_HEIGHT; - mxc_jpeg_bytesperline(q[i], 8); + mxc_jpeg_bytesperline(q[i], q[i]->fmt->precision); mxc_jpeg_sizeimage(q[i]); } } @@ -1658,7 +1671,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f, co= nst struct mxc_jpeg_fmt *fm } =20 /* calculate bytesperline & sizeimage into the tmp_q */ - mxc_jpeg_bytesperline(&tmp_q, 8); + mxc_jpeg_bytesperline(&tmp_q, fmt->precision); mxc_jpeg_sizeimage(&tmp_q); =20 /* adjust user format according to our calculations */ diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.h index f53f004ba851..2b4b30d01e51 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h @@ -49,6 +49,7 @@ enum mxc_jpeg_mode { * @h_align: horizontal alignment order (align to 2^h_align) * @v_align: vertical alignment order (align to 2^v_align) * @flags: flags describing format applicability + * @precision: jpeg sample precision */ struct mxc_jpeg_fmt { const char *name; @@ -60,6 +61,7 @@ struct mxc_jpeg_fmt { int h_align; int v_align; u32 flags; + u8 precision; }; =20 struct mxc_jpeg_desc { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F676C00140 for ; Mon, 15 Aug 2022 20:59:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240130AbiHOU7H (ORCPT ); Mon, 15 Aug 2022 16:59:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232099AbiHOU4j (ORCPT ); Mon, 15 Aug 2022 16:56:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B868D5018C; Mon, 15 Aug 2022 12:12:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CC544B810A3; Mon, 15 Aug 2022 19:12:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41C2EC433C1; Mon, 15 Aug 2022 19:12:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590742; bh=ePW528SVfYKGDNpr7t/sdRXzJL6pdywABBAB/yNipAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k7lVgBxX40CioK9bP/9adZJq8Yca4jRlyrg2rJLX/yCdgO0rgGUr1dsW0uKlpARvV SU3PEwW4DYkNH8WPA8dqOt6Hwzwo/J1Gcr4qyozL73ARoGDsJFPtGjJ/ivjObQCfwP AZPeakRk63+vnny07Tpwc9dWZktWyWbMQ1KJg6CA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0356/1095] media: imx-jpeg: Handle source change in a function Date: Mon, 15 Aug 2022 19:55:55 +0200 Message-Id: <20220815180444.465933786@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 831f87424dd3973612782983ef7352789795b4df ] Refine code to support dynamic resolution change Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 114 ++++++++++-------- 1 file changed, 65 insertions(+), 49 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.c index ece53821859c..07eed00ca5e0 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -315,6 +315,9 @@ struct mxc_jpeg_src_buf { /* mxc-jpeg specific */ bool dht_needed; bool jpeg_parse_error; + const struct mxc_jpeg_fmt *fmt; + int w; + int h; }; =20 static inline struct mxc_jpeg_src_buf *vb2_to_mxc_buf(struct vb2_buffer *v= b) @@ -327,6 +330,9 @@ static unsigned int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Debug level (0-3)"); =20 +static void mxc_jpeg_bytesperline(struct mxc_jpeg_q_data *q, u32 precision= ); +static void mxc_jpeg_sizeimage(struct mxc_jpeg_q_data *q); + static void _bswap16(u16 *a) { *a =3D ((*a & 0x00FF) << 8) | ((*a & 0xFF00) >> 8); @@ -929,6 +935,59 @@ static void mxc_jpeg_config_enc_desc(struct vb2_buffer= *out_buf, mxc_jpeg_set_desc(cfg_desc_handle, reg, slot); } =20 +static bool mxc_jpeg_source_change(struct mxc_jpeg_ctx *ctx, + struct mxc_jpeg_src_buf *jpeg_src_buf) +{ + struct device *dev =3D ctx->mxc_jpeg->dev; + struct mxc_jpeg_q_data *q_data_cap; + bool src_chg =3D false; + + if (!jpeg_src_buf->fmt) + return src_chg; + + q_data_cap =3D mxc_jpeg_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); + if (q_data_cap->w !=3D jpeg_src_buf->w || q_data_cap->h !=3D jpeg_src_buf= ->h) { + dev_dbg(dev, "Detected jpeg res=3D(%dx%d)->(%dx%d), pixfmt=3D%c%c%c%c\n", + q_data_cap->w, q_data_cap->h, + jpeg_src_buf->w, jpeg_src_buf->h, + (jpeg_src_buf->fmt->fourcc & 0xff), + (jpeg_src_buf->fmt->fourcc >> 8) & 0xff, + (jpeg_src_buf->fmt->fourcc >> 16) & 0xff, + (jpeg_src_buf->fmt->fourcc >> 24) & 0xff); + + /* + * set-up the capture queue with the pixelformat and resolution + * detected from the jpeg output stream + */ + q_data_cap->w =3D jpeg_src_buf->w; + q_data_cap->h =3D jpeg_src_buf->h; + q_data_cap->fmt =3D jpeg_src_buf->fmt; + q_data_cap->w_adjusted =3D q_data_cap->w; + q_data_cap->h_adjusted =3D q_data_cap->h; + + /* + * align up the resolution for CAST IP, + * but leave the buffer resolution unchanged + */ + v4l_bound_align_image(&q_data_cap->w_adjusted, + q_data_cap->w_adjusted, /* adjust up */ + MXC_JPEG_MAX_WIDTH, + q_data_cap->fmt->h_align, + &q_data_cap->h_adjusted, + q_data_cap->h_adjusted, /* adjust up */ + MXC_JPEG_MAX_HEIGHT, + q_data_cap->fmt->v_align, + 0); + + /* setup bytesperline/sizeimage for capture queue */ + mxc_jpeg_bytesperline(q_data_cap, jpeg_src_buf->fmt->precision); + mxc_jpeg_sizeimage(q_data_cap); + notify_src_chg(ctx); + src_chg =3D true; + } + return src_chg; +} + static void mxc_jpeg_device_run(void *priv) { struct mxc_jpeg_ctx *ctx =3D priv; @@ -1216,8 +1275,7 @@ static u32 mxc_jpeg_get_image_format(struct device *d= ev, return fourcc; } =20 -static void mxc_jpeg_bytesperline(struct mxc_jpeg_q_data *q, - u32 precision) +static void mxc_jpeg_bytesperline(struct mxc_jpeg_q_data *q, u32 precision) { /* Bytes distance between the leftmost pixels in two adjacent lines */ if (q->fmt->fourcc =3D=3D V4L2_PIX_FMT_JPEG) { @@ -1268,9 +1326,7 @@ static void mxc_jpeg_sizeimage(struct mxc_jpeg_q_data= *q) static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, struct vb2_buffer *vb) { struct device *dev =3D ctx->mxc_jpeg->dev; - struct mxc_jpeg_q_data *q_data_out, *q_data_cap; - enum v4l2_buf_type cap_type =3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; - bool src_chg =3D false; + struct mxc_jpeg_q_data *q_data_out; u32 fourcc; struct v4l2_jpeg_header header; struct mxc_jpeg_sof *psof =3D NULL; @@ -1338,51 +1394,11 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx,= struct vb2_buffer *vb) if (fourcc =3D=3D 0) return -EINVAL; =20 - /* - * set-up the capture queue with the pixelformat and resolution - * detected from the jpeg output stream - */ - q_data_cap =3D mxc_jpeg_get_q_data(ctx, cap_type); - if (q_data_cap->w !=3D header.frame.width || - q_data_cap->h !=3D header.frame.height) - src_chg =3D true; - q_data_cap->w =3D header.frame.width; - q_data_cap->h =3D header.frame.height; - q_data_cap->fmt =3D mxc_jpeg_find_format(ctx, fourcc); - q_data_cap->w_adjusted =3D q_data_cap->w; - q_data_cap->h_adjusted =3D q_data_cap->h; - /* - * align up the resolution for CAST IP, - * but leave the buffer resolution unchanged - */ - v4l_bound_align_image(&q_data_cap->w_adjusted, - q_data_cap->w_adjusted, /* adjust up */ - MXC_JPEG_MAX_WIDTH, - q_data_cap->fmt->h_align, - &q_data_cap->h_adjusted, - q_data_cap->h_adjusted, /* adjust up */ - MXC_JPEG_MAX_HEIGHT, - q_data_cap->fmt->v_align, - 0); - dev_dbg(dev, "Detected jpeg res=3D(%dx%d)->(%dx%d), pixfmt=3D%c%c%c%c\n", - q_data_cap->w, q_data_cap->h, - q_data_cap->w_adjusted, q_data_cap->h_adjusted, - (fourcc & 0xff), - (fourcc >> 8) & 0xff, - (fourcc >> 16) & 0xff, - (fourcc >> 24) & 0xff); - - /* setup bytesperline/sizeimage for capture queue */ - mxc_jpeg_bytesperline(q_data_cap, q_data_cap->fmt->precision); - mxc_jpeg_sizeimage(q_data_cap); + jpeg_src_buf->fmt =3D mxc_jpeg_find_format(ctx, fourcc); + jpeg_src_buf->w =3D header.frame.width; + jpeg_src_buf->h =3D header.frame.height; =20 - /* - * if the CAPTURE format was updated with new values, regardless of - * whether they match the values set by the client or not, signal - * a source change event - */ - if (src_chg) - notify_src_chg(ctx); + mxc_jpeg_source_change(ctx, jpeg_src_buf); =20 return 0; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CF22C00140 for ; Mon, 15 Aug 2022 20:59:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242785AbiHOU7P (ORCPT ); Mon, 15 Aug 2022 16:59:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbiHOU5a (ORCPT ); Mon, 15 Aug 2022 16:57:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD61DC0E5E; Mon, 15 Aug 2022 12:12:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EFD96B81113; Mon, 15 Aug 2022 19:12:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FBC7C433D6; Mon, 15 Aug 2022 19:12:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590745; bh=RDqPj1c2xIHj5AP3Up1tac/9WN9yr7QGN8JP2/eJzOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WI7dRc8tOQV4du1AF69huOdN8Cb26kmfDj50R4itSQS/yGcoefLHRXBF+NuBGNqe2 JDrdfHQ5t3ZlG9xi3lCBHwSPgY54PAPrBTRuxRCEeKklFqL7WqMzf3ABUSERmo+0OD hCS4WSUqzzjHY0stfAYjgXD5B/YKvwnRjHelQCwE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0357/1095] media: imx-jpeg: Support dynamic resolution change Date: Mon, 15 Aug 2022 19:55:56 +0200 Message-Id: <20220815180444.513412725@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit b4e1fb8643daabba850e97df532191acffc23e6a ] To support dynamic resolution change, driver should meet the following conditions: 1. the previous pictures are all decoded before source change event. 2. prevent decoding new resolution pictures with incorrect capture buffer, until user handle source change event and setup capture. 3. report correct fmt and resolution during source change. Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 69 ++++++++++++++----- .../media/platform/nxp/imx-jpeg/mxc-jpeg.h | 2 + 2 files changed, 55 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.c index 07eed00ca5e0..eea03556bec7 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -940,13 +940,14 @@ static bool mxc_jpeg_source_change(struct mxc_jpeg_ct= x *ctx, { struct device *dev =3D ctx->mxc_jpeg->dev; struct mxc_jpeg_q_data *q_data_cap; - bool src_chg =3D false; =20 if (!jpeg_src_buf->fmt) - return src_chg; + return false; =20 q_data_cap =3D mxc_jpeg_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); - if (q_data_cap->w !=3D jpeg_src_buf->w || q_data_cap->h !=3D jpeg_src_buf= ->h) { + if (q_data_cap->fmt !=3D jpeg_src_buf->fmt || + q_data_cap->w !=3D jpeg_src_buf->w || + q_data_cap->h !=3D jpeg_src_buf->h) { dev_dbg(dev, "Detected jpeg res=3D(%dx%d)->(%dx%d), pixfmt=3D%c%c%c%c\n", q_data_cap->w, q_data_cap->h, jpeg_src_buf->w, jpeg_src_buf->h, @@ -983,9 +984,16 @@ static bool mxc_jpeg_source_change(struct mxc_jpeg_ctx= *ctx, mxc_jpeg_bytesperline(q_data_cap, jpeg_src_buf->fmt->precision); mxc_jpeg_sizeimage(q_data_cap); notify_src_chg(ctx); - src_chg =3D true; + ctx->source_change =3D 1; } - return src_chg; + return ctx->source_change ? true : false; +} + +static int mxc_jpeg_job_ready(void *priv) +{ + struct mxc_jpeg_ctx *ctx =3D priv; + + return ctx->source_change ? 0 : 1; } =20 static void mxc_jpeg_device_run(void *priv) @@ -1035,6 +1043,13 @@ static void mxc_jpeg_device_run(void *priv) =20 return; } + if (ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_DECODE) { + if (ctx->source_change || mxc_jpeg_source_change(ctx, jpeg_src_buf)) { + spin_unlock_irqrestore(&ctx->mxc_jpeg->hw_lock, flags); + v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx); + return; + } + } =20 mxc_jpeg_enable(reg); mxc_jpeg_set_l_endian(reg, 1); @@ -1081,6 +1096,7 @@ static void mxc_jpeg_set_last_buffer_dequeued(struct = mxc_jpeg_ctx *ctx) q->last_buffer_dequeued =3D true; wake_up(&q->done_wq); ctx->stopped =3D 0; + ctx->header_parsed =3D false; } =20 static int mxc_jpeg_decoder_cmd(struct file *file, void *priv, @@ -1174,6 +1190,8 @@ static int mxc_jpeg_start_streaming(struct vb2_queue = *q, unsigned int count) struct mxc_jpeg_q_data *q_data =3D mxc_jpeg_get_q_data(ctx, q->type); int ret; =20 + if (ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_DECODE && V4L2_TYPE_IS_CAPTURE(q-= >type)) + ctx->source_change =3D 0; dev_dbg(ctx->mxc_jpeg->dev, "Start streaming ctx=3D%p", ctx); q_data->sequence =3D 0; =20 @@ -1352,16 +1370,15 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx,= struct vb2_buffer *vb) dev_warn(dev, "Invalid user resolution 0x0"); dev_warn(dev, "Keeping resolution from JPEG: %dx%d", header.frame.width, header.frame.height); - q_data_out->w =3D header.frame.width; - q_data_out->h =3D header.frame.height; } else if (header.frame.width !=3D q_data_out->w || header.frame.height !=3D q_data_out->h) { dev_err(dev, "Resolution mismatch: %dx%d (JPEG) versus %dx%d(user)", header.frame.width, header.frame.height, q_data_out->w, q_data_out->h); - return -EINVAL; } + q_data_out->w =3D header.frame.width; + q_data_out->h =3D header.frame.height; if (header.frame.width % 8 !=3D 0 || header.frame.height % 8 !=3D 0) { dev_err(dev, "JPEG width or height not multiple of 8: %dx%d\n", header.frame.width, header.frame.height); @@ -1397,8 +1414,10 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, = struct vb2_buffer *vb) jpeg_src_buf->fmt =3D mxc_jpeg_find_format(ctx, fourcc); jpeg_src_buf->w =3D header.frame.width; jpeg_src_buf->h =3D header.frame.height; + ctx->header_parsed =3D true; =20 - mxc_jpeg_source_change(ctx, jpeg_src_buf); + if (!v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx)) + mxc_jpeg_source_change(ctx, jpeg_src_buf); =20 return 0; } @@ -1475,6 +1494,7 @@ static void mxc_jpeg_buf_finish(struct vb2_buffer *vb) if (list_empty(&q->done_list)) { vbuf->flags |=3D V4L2_BUF_FLAG_LAST; ctx->stopped =3D 0; + ctx->header_parsed =3D false; } } =20 @@ -1620,26 +1640,42 @@ static int mxc_jpeg_enum_fmt_vid_cap(struct file *f= ile, void *priv, struct v4l2_fmtdesc *f) { struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(priv); + struct mxc_jpeg_q_data *q_data =3D mxc_jpeg_get_q_data(ctx, f->type); =20 - if (ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_ENCODE) + if (ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_ENCODE) { return enum_fmt(mxc_formats, MXC_JPEG_NUM_FORMATS, f, MXC_JPEG_FMT_TYPE_ENC); - else + } else if (!ctx->header_parsed) { return enum_fmt(mxc_formats, MXC_JPEG_NUM_FORMATS, f, MXC_JPEG_FMT_TYPE_RAW); + } else { + /* For the decoder CAPTURE queue, only enumerate the raw formats + * supported for the format currently active on OUTPUT + * (more precisely what was propagated on capture queue + * after jpeg parse on the output buffer) + */ + if (f->index) + return -EINVAL; + f->pixelformat =3D q_data->fmt->fourcc; + strscpy(f->description, q_data->fmt->name, sizeof(f->description)); + return 0; + } } =20 static int mxc_jpeg_enum_fmt_vid_out(struct file *file, void *priv, struct v4l2_fmtdesc *f) { struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(priv); + u32 type =3D ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_DECODE ? MXC_JPEG_FMT_T= YPE_ENC : + MXC_JPEG_FMT_TYPE_RAW; + int ret; =20 + ret =3D enum_fmt(mxc_formats, MXC_JPEG_NUM_FORMATS, f, type); + if (ret) + return ret; if (ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_DECODE) - return enum_fmt(mxc_formats, MXC_JPEG_NUM_FORMATS, f, - MXC_JPEG_FMT_TYPE_ENC); - else - return enum_fmt(mxc_formats, MXC_JPEG_NUM_FORMATS, f, - MXC_JPEG_FMT_TYPE_RAW); + f->flags =3D V4L2_FMT_FLAG_DYN_RESOLUTION; + return 0; } =20 static int mxc_jpeg_try_fmt(struct v4l2_format *f, const struct mxc_jpeg_f= mt *fmt, @@ -1997,6 +2033,7 @@ static const struct v4l2_file_operations mxc_jpeg_fop= s =3D { }; =20 static const struct v4l2_m2m_ops mxc_jpeg_m2m_ops =3D { + .job_ready =3D mxc_jpeg_job_ready, .device_run =3D mxc_jpeg_device_run, }; =20 diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.h index 2b4b30d01e51..6913ae087e44 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h @@ -95,6 +95,8 @@ struct mxc_jpeg_ctx { unsigned int stopping; unsigned int stopped; unsigned int slot; + unsigned int source_change; + bool header_parsed; }; =20 struct mxc_jpeg_slot_data { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8019CC25B0E for ; Mon, 15 Aug 2022 20:59:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244013AbiHOU7g (ORCPT ); Mon, 15 Aug 2022 16:59:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244334AbiHOU6g (ORCPT ); Mon, 15 Aug 2022 16:58:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9D08C12D5; Mon, 15 Aug 2022 12:12:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 00A33B810C6; Mon, 15 Aug 2022 19:12:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62830C433D7; Mon, 15 Aug 2022 19:12:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590751; bh=TBR7tEtI0kFfWKhyk7Qo3n1m3u21I+jSMxM4M25irVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hGBdjHhtFFksk4y4+i2hCfMWCgjBBBnnqPknx1Ll4a3OQ1FH4TjPGOVBOilr0trs9 1VNpMVywMU34Y1e6YP+nnHzJBTUShWTbpWU8lheBkfjiYA1XX4kB0Ee+K1W9QXelK4 co+O9MKexCoJsQHOlm5GxAtQB702iiwet+SHqSfA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0358/1095] media: imx-jpeg: Align upwards buffer size Date: Mon, 15 Aug 2022 19:55:57 +0200 Message-Id: <20220815180444.553100126@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 9e7aa76cdb02923ee23a0ddd48f38bdc3512f92b ] The hardware can support any image size WxH, with arbitrary W (image width) and H (image height) dimensions. Align upwards buffer size for both encoder and decoder. and leave the picture resolution unchanged. For decoder, the risk of memory out of bounds can be avoided. For both encoder and decoder, the driver will lift the limitation of resolution alignment. For example, the decoder can support jpeg whose resolution is 227x149 the encoder can support nv12 1080P, won't change it to 1920x1072. Fixes: 2db16c6ed72ce ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Enco= der/Decoder") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 88 ++++++++----------- 1 file changed, 37 insertions(+), 51 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.c index eea03556bec7..04617bf40c51 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -894,8 +894,8 @@ static void mxc_jpeg_config_enc_desc(struct vb2_buffer = *out_buf, jpeg->slot_data[slot].cfg_stream_size =3D mxc_jpeg_setup_cfg_stream(cfg_stream_vaddr, q_data->fmt->fourcc, - q_data->w_adjusted, - q_data->h_adjusted); + q_data->w, + q_data->h); =20 /* chain the config descriptor with the encoding descriptor */ cfg_desc->next_descpt_ptr =3D desc_handle | MXC_NXT_DESCPT_EN; @@ -977,7 +977,7 @@ static bool mxc_jpeg_source_change(struct mxc_jpeg_ctx = *ctx, &q_data_cap->h_adjusted, q_data_cap->h_adjusted, /* adjust up */ MXC_JPEG_MAX_HEIGHT, - q_data_cap->fmt->v_align, + 0, 0); =20 /* setup bytesperline/sizeimage for capture queue */ @@ -1161,16 +1161,28 @@ static int mxc_jpeg_queue_setup(struct vb2_queue *q, { struct mxc_jpeg_ctx *ctx =3D vb2_get_drv_priv(q); struct mxc_jpeg_q_data *q_data =3D NULL; + struct mxc_jpeg_q_data tmp_q; int i; =20 q_data =3D mxc_jpeg_get_q_data(ctx, q->type); if (!q_data) return -EINVAL; =20 + tmp_q.fmt =3D q_data->fmt; + tmp_q.w =3D q_data->w_adjusted; + tmp_q.h =3D q_data->h_adjusted; + for (i =3D 0; i < MXC_JPEG_MAX_PLANES; i++) { + tmp_q.bytesperline[i] =3D q_data->bytesperline[i]; + tmp_q.sizeimage[i] =3D q_data->sizeimage[i]; + } + mxc_jpeg_sizeimage(&tmp_q); + for (i =3D 0; i < MXC_JPEG_MAX_PLANES; i++) + tmp_q.sizeimage[i] =3D max(tmp_q.sizeimage[i], q_data->sizeimage[i]); + /* Handle CREATE_BUFS situation - *nplanes !=3D 0 */ if (*nplanes) { for (i =3D 0; i < *nplanes; i++) { - if (sizes[i] < q_data->sizeimage[i]) + if (sizes[i] < tmp_q.sizeimage[i]) return -EINVAL; } return 0; @@ -1179,7 +1191,7 @@ static int mxc_jpeg_queue_setup(struct vb2_queue *q, /* Handle REQBUFS situation */ *nplanes =3D q_data->fmt->colplanes; for (i =3D 0; i < *nplanes; i++) - sizes[i] =3D q_data->sizeimage[i]; + sizes[i] =3D tmp_q.sizeimage[i]; =20 return 0; } @@ -1379,11 +1391,6 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, = struct vb2_buffer *vb) } q_data_out->w =3D header.frame.width; q_data_out->h =3D header.frame.height; - if (header.frame.width % 8 !=3D 0 || header.frame.height % 8 !=3D 0) { - dev_err(dev, "JPEG width or height not multiple of 8: %dx%d\n", - header.frame.width, header.frame.height); - return -EINVAL; - } if (header.frame.width > MXC_JPEG_MAX_WIDTH || header.frame.height > MXC_JPEG_MAX_HEIGHT) { dev_err(dev, "JPEG width or height should be <=3D 8192: %dx%d\n", @@ -1695,22 +1702,17 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f, = const struct mxc_jpeg_fmt *fm pix_mp->num_planes =3D fmt->colplanes; pix_mp->pixelformat =3D fmt->fourcc; =20 - /* - * use MXC_JPEG_H_ALIGN instead of fmt->v_align, for vertical - * alignment, to loosen up the alignment to multiple of 8, - * otherwise NV12-1080p fails as 1080 is not a multiple of 16 - */ + pix_mp->width =3D w; + pix_mp->height =3D h; v4l_bound_align_image(&w, - MXC_JPEG_MIN_WIDTH, - w, /* adjust downwards*/ + w, /* adjust upwards*/ + MXC_JPEG_MAX_WIDTH, fmt->h_align, &h, - MXC_JPEG_MIN_HEIGHT, - h, /* adjust downwards*/ - MXC_JPEG_H_ALIGN, + h, /* adjust upwards*/ + MXC_JPEG_MAX_HEIGHT, + 0, 0); - pix_mp->width =3D w; /* negotiate the width */ - pix_mp->height =3D h; /* negotiate the height */ =20 /* get user input into the tmp_q */ tmp_q.w =3D w; @@ -1836,35 +1838,19 @@ static int mxc_jpeg_s_fmt(struct mxc_jpeg_ctx *ctx, =20 q_data->w_adjusted =3D q_data->w; q_data->h_adjusted =3D q_data->h; - if (jpeg->mode =3D=3D MXC_JPEG_DECODE) { - /* - * align up the resolution for CAST IP, - * but leave the buffer resolution unchanged - */ - v4l_bound_align_image(&q_data->w_adjusted, - q_data->w_adjusted, /* adjust upwards */ - MXC_JPEG_MAX_WIDTH, - q_data->fmt->h_align, - &q_data->h_adjusted, - q_data->h_adjusted, /* adjust upwards */ - MXC_JPEG_MAX_HEIGHT, - q_data->fmt->v_align, - 0); - } else { - /* - * align down the resolution for CAST IP, - * but leave the buffer resolution unchanged - */ - v4l_bound_align_image(&q_data->w_adjusted, - MXC_JPEG_MIN_WIDTH, - q_data->w_adjusted, /* adjust downwards*/ - q_data->fmt->h_align, - &q_data->h_adjusted, - MXC_JPEG_MIN_HEIGHT, - q_data->h_adjusted, /* adjust downwards*/ - q_data->fmt->v_align, - 0); - } + /* + * align up the resolution for CAST IP, + * but leave the buffer resolution unchanged + */ + v4l_bound_align_image(&q_data->w_adjusted, + q_data->w_adjusted, /* adjust upwards */ + MXC_JPEG_MAX_WIDTH, + q_data->fmt->h_align, + &q_data->h_adjusted, + q_data->h_adjusted, /* adjust upwards */ + MXC_JPEG_MAX_HEIGHT, + q_data->fmt->v_align, + 0); =20 for (i =3D 0; i < pix_mp->num_planes; i++) { q_data->bytesperline[i] =3D pix_mp->plane_fmt[i].bytesperline; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E764CC00140 for ; Mon, 15 Aug 2022 20:59:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244142AbiHOU7t (ORCPT ); Mon, 15 Aug 2022 16:59:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244227AbiHOU7J (ORCPT ); Mon, 15 Aug 2022 16:59:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20A7CC2282; Mon, 15 Aug 2022 12:12:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 49B49B81106; Mon, 15 Aug 2022 19:12:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D45CC433C1; Mon, 15 Aug 2022 19:12:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590755; bh=70UNMZmwj9/cpoYO9G9gm5YNrbNmoVNq33d2vYMZeWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P8hw/74/lPPIdTfs9u0+9+plEfrjfWwohllYDgo2hKWH2Wno1IVO6na0eWrADynF7 qri1LQcDDlnYb5Pyp4LXm0EBKhE2F5exrHYTAPA+tImjxqBqbBYNpRWq9UNgI3TBmZ jAfhmQbMJV3j7pVv1BulTySudpGJ+5sfSz5iNr4Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0359/1095] media: imx-jpeg: Implement drain using v4l2-mem2mem helpers Date: Mon, 15 Aug 2022 19:55:58 +0200 Message-Id: <20220815180444.586169641@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 4911c5acf9351c4caf692895c7cf6a4fa46c26b0 ] v4l2 m2m has supplied some helper function to handle drain, so the driver can use the helper function directly. Fixes: d8ebe298d008c ("media: imx-jpeg: Set V4L2_BUF_FLAG_LAST at eos") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 155 +++++++++--------- .../media/platform/nxp/imx-jpeg/mxc-jpeg.h | 2 - 2 files changed, 73 insertions(+), 84 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.c index 04617bf40c51..8c0bd8b75b00 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -559,6 +559,18 @@ static void mxc_jpeg_free_slot_data(struct mxc_jpeg_de= v *jpeg, jpeg->slot_data[slot].used =3D false; } =20 +static void mxc_jpeg_check_and_set_last_buffer(struct mxc_jpeg_ctx *ctx, + struct vb2_v4l2_buffer *src_buf, + struct vb2_v4l2_buffer *dst_buf) +{ + if (v4l2_m2m_is_last_draining_src_buf(ctx->fh.m2m_ctx, src_buf)) { + dst_buf->flags |=3D V4L2_BUF_FLAG_LAST; + v4l2_m2m_mark_stopped(ctx->fh.m2m_ctx); + notify_eos(ctx); + ctx->header_parsed =3D false; + } +} + static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) { struct mxc_jpeg_dev *jpeg =3D priv; @@ -633,6 +645,7 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) dev_dbg(dev, "Decoder DHT cfg finished. Start decoding...\n"); goto job_unlock; } + if (jpeg->mode =3D=3D MXC_JPEG_ENCODE) { payload =3D readl(reg + MXC_SLOT_OFFSET(slot, SLOT_BUF_PTR)); vb2_set_plane_payload(&dst_buf->vb2_buf, 0, payload); @@ -661,6 +674,7 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) =20 buffers_done: jpeg->slot_data[slot].used =3D false; /* unused, but don't free */ + mxc_jpeg_check_and_set_last_buffer(ctx, src_buf, dst_buf); v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); v4l2_m2m_buf_done(src_buf, buf_state); @@ -1034,6 +1048,7 @@ static void mxc_jpeg_device_run(void *priv) jpeg_src_buf->jpeg_parse_error =3D true; } if (jpeg_src_buf->jpeg_parse_error) { + mxc_jpeg_check_and_set_last_buffer(ctx, src_buf, dst_buf); v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_ERROR); @@ -1084,45 +1099,33 @@ static void mxc_jpeg_device_run(void *priv) spin_unlock_irqrestore(&ctx->mxc_jpeg->hw_lock, flags); } =20 -static void mxc_jpeg_set_last_buffer_dequeued(struct mxc_jpeg_ctx *ctx) -{ - struct vb2_queue *q; - - ctx->stopped =3D 1; - q =3D v4l2_m2m_get_dst_vq(ctx->fh.m2m_ctx); - if (!list_empty(&q->done_list)) - return; - - q->last_buffer_dequeued =3D true; - wake_up(&q->done_wq); - ctx->stopped =3D 0; - ctx->header_parsed =3D false; -} - static int mxc_jpeg_decoder_cmd(struct file *file, void *priv, struct v4l2_decoder_cmd *cmd) { struct v4l2_fh *fh =3D file->private_data; struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(fh); - struct device *dev =3D ctx->mxc_jpeg->dev; int ret; =20 ret =3D v4l2_m2m_ioctl_try_decoder_cmd(file, fh, cmd); if (ret < 0) return ret; =20 - if (cmd->cmd =3D=3D V4L2_DEC_CMD_STOP) { - dev_dbg(dev, "Received V4L2_DEC_CMD_STOP"); - if (v4l2_m2m_num_src_bufs_ready(fh->m2m_ctx) =3D=3D 0) { - /* No more src bufs, notify app EOS */ - notify_eos(ctx); - mxc_jpeg_set_last_buffer_dequeued(ctx); - } else { - /* will send EOS later*/ - ctx->stopping =3D 1; - } + if (!vb2_is_streaming(v4l2_m2m_get_src_vq(fh->m2m_ctx))) + return 0; + + ret =3D v4l2_m2m_ioctl_decoder_cmd(file, priv, cmd); + if (ret < 0) + return ret; + + if (cmd->cmd =3D=3D V4L2_DEC_CMD_STOP && + v4l2_m2m_has_stopped(fh->m2m_ctx)) { + notify_eos(ctx); + ctx->header_parsed =3D false; } =20 + if (cmd->cmd =3D=3D V4L2_DEC_CMD_START && + v4l2_m2m_has_stopped(fh->m2m_ctx)) + vb2_clear_last_buffer_dequeued(&fh->m2m_ctx->cap_q_ctx.q); return 0; } =20 @@ -1131,24 +1134,27 @@ static int mxc_jpeg_encoder_cmd(struct file *file, = void *priv, { struct v4l2_fh *fh =3D file->private_data; struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(fh); - struct device *dev =3D ctx->mxc_jpeg->dev; int ret; =20 ret =3D v4l2_m2m_ioctl_try_encoder_cmd(file, fh, cmd); if (ret < 0) return ret; =20 - if (cmd->cmd =3D=3D V4L2_ENC_CMD_STOP) { - dev_dbg(dev, "Received V4L2_ENC_CMD_STOP"); - if (v4l2_m2m_num_src_bufs_ready(fh->m2m_ctx) =3D=3D 0) { - /* No more src bufs, notify app EOS */ - notify_eos(ctx); - mxc_jpeg_set_last_buffer_dequeued(ctx); - } else { - /* will send EOS later*/ - ctx->stopping =3D 1; - } - } + if (!vb2_is_streaming(v4l2_m2m_get_src_vq(fh->m2m_ctx)) || + !vb2_is_streaming(v4l2_m2m_get_dst_vq(fh->m2m_ctx))) + return 0; + + ret =3D v4l2_m2m_ioctl_encoder_cmd(file, fh, cmd); + if (ret < 0) + return 0; + + if (cmd->cmd =3D=3D V4L2_ENC_CMD_STOP && + v4l2_m2m_has_stopped(fh->m2m_ctx)) + notify_eos(ctx); + + if (cmd->cmd =3D=3D V4L2_ENC_CMD_START && + v4l2_m2m_has_stopped(fh->m2m_ctx)) + vb2_clear_last_buffer_dequeued(&fh->m2m_ctx->cap_q_ctx.q); =20 return 0; } @@ -1202,6 +1208,8 @@ static int mxc_jpeg_start_streaming(struct vb2_queue = *q, unsigned int count) struct mxc_jpeg_q_data *q_data =3D mxc_jpeg_get_q_data(ctx, q->type); int ret; =20 + v4l2_m2m_update_start_streaming_state(ctx->fh.m2m_ctx, q); + if (ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_DECODE && V4L2_TYPE_IS_CAPTURE(q-= >type)) ctx->source_change =3D 0; dev_dbg(ctx->mxc_jpeg->dev, "Start streaming ctx=3D%p", ctx); @@ -1233,11 +1241,15 @@ static void mxc_jpeg_stop_streaming(struct vb2_queu= e *q) break; v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR); } - pm_runtime_put_sync(&ctx->mxc_jpeg->pdev->dev); - if (V4L2_TYPE_IS_OUTPUT(q->type)) { - ctx->stopping =3D 0; - ctx->stopped =3D 0; + + v4l2_m2m_update_stop_streaming_state(ctx->fh.m2m_ctx, q); + if (V4L2_TYPE_IS_OUTPUT(q->type) && + v4l2_m2m_has_stopped(ctx->fh.m2m_ctx)) { + notify_eos(ctx); + ctx->header_parsed =3D false; } + + pm_runtime_put_sync(&ctx->mxc_jpeg->pdev->dev); } =20 static int mxc_jpeg_valid_comp_id(struct device *dev, @@ -1436,6 +1448,20 @@ static void mxc_jpeg_buf_queue(struct vb2_buffer *vb) struct mxc_jpeg_ctx *ctx =3D vb2_get_drv_priv(vb->vb2_queue); struct mxc_jpeg_src_buf *jpeg_src_buf; =20 + if (V4L2_TYPE_IS_CAPTURE(vb->vb2_queue->type) && + vb2_is_streaming(vb->vb2_queue) && + v4l2_m2m_dst_buf_is_last(ctx->fh.m2m_ctx)) { + struct mxc_jpeg_q_data *q_data; + + q_data =3D mxc_jpeg_get_q_data(ctx, vb->vb2_queue->type); + vbuf->field =3D V4L2_FIELD_NONE; + vbuf->sequence =3D q_data->sequence++; + v4l2_m2m_last_buffer_done(ctx->fh.m2m_ctx, vbuf); + notify_eos(ctx); + ctx->header_parsed =3D false; + return; + } + if (vb->vb2_queue->type =3D=3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) goto end; =20 @@ -1485,24 +1511,11 @@ static int mxc_jpeg_buf_prepare(struct vb2_buffer *= vb) } vb2_set_plane_payload(vb, i, sizeimage); } - return 0; -} - -static void mxc_jpeg_buf_finish(struct vb2_buffer *vb) -{ - struct vb2_v4l2_buffer *vbuf =3D to_vb2_v4l2_buffer(vb); - struct mxc_jpeg_ctx *ctx =3D vb2_get_drv_priv(vb->vb2_queue); - struct vb2_queue *q =3D vb->vb2_queue; - - if (V4L2_TYPE_IS_OUTPUT(vb->type)) - return; - if (!ctx->stopped) - return; - if (list_empty(&q->done_list)) { - vbuf->flags |=3D V4L2_BUF_FLAG_LAST; - ctx->stopped =3D 0; - ctx->header_parsed =3D false; + if (V4L2_TYPE_IS_CAPTURE(vb->vb2_queue->type)) { + vb2_set_plane_payload(vb, 0, 0); + vb2_set_plane_payload(vb, 1, 0); } + return 0; } =20 static const struct vb2_ops mxc_jpeg_qops =3D { @@ -1511,7 +1524,6 @@ static const struct vb2_ops mxc_jpeg_qops =3D { .wait_finish =3D vb2_ops_wait_finish, .buf_out_validate =3D mxc_jpeg_buf_out_validate, .buf_prepare =3D mxc_jpeg_buf_prepare, - .buf_finish =3D mxc_jpeg_buf_finish, .start_streaming =3D mxc_jpeg_start_streaming, .stop_streaming =3D mxc_jpeg_stop_streaming, .buf_queue =3D mxc_jpeg_buf_queue, @@ -1932,27 +1944,6 @@ static int mxc_jpeg_subscribe_event(struct v4l2_fh *= fh, } } =20 -static int mxc_jpeg_dqbuf(struct file *file, void *priv, - struct v4l2_buffer *buf) -{ - struct v4l2_fh *fh =3D file->private_data; - struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(priv); - struct device *dev =3D ctx->mxc_jpeg->dev; - int num_src_ready =3D v4l2_m2m_num_src_bufs_ready(fh->m2m_ctx); - int ret; - - dev_dbg(dev, "DQBUF type=3D%d, index=3D%d", buf->type, buf->index); - if (ctx->stopping =3D=3D 1 && num_src_ready =3D=3D 0) { - /* No more src bufs, notify app EOS */ - notify_eos(ctx); - ctx->stopping =3D 0; - mxc_jpeg_set_last_buffer_dequeued(ctx); - } - - ret =3D v4l2_m2m_dqbuf(file, fh->m2m_ctx, buf); - return ret; -} - static const struct v4l2_ioctl_ops mxc_jpeg_ioctl_ops =3D { .vidioc_querycap =3D mxc_jpeg_querycap, .vidioc_enum_fmt_vid_cap =3D mxc_jpeg_enum_fmt_vid_cap, @@ -1976,7 +1967,7 @@ static const struct v4l2_ioctl_ops mxc_jpeg_ioctl_ops= =3D { .vidioc_encoder_cmd =3D mxc_jpeg_encoder_cmd, =20 .vidioc_qbuf =3D v4l2_m2m_ioctl_qbuf, - .vidioc_dqbuf =3D mxc_jpeg_dqbuf, + .vidioc_dqbuf =3D v4l2_m2m_ioctl_dqbuf, =20 .vidioc_create_bufs =3D v4l2_m2m_ioctl_create_bufs, .vidioc_prepare_buf =3D v4l2_m2m_ioctl_prepare_buf, diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.h index 6913ae087e44..542993eb8d5b 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h @@ -92,8 +92,6 @@ struct mxc_jpeg_ctx { struct mxc_jpeg_q_data cap_q; struct v4l2_fh fh; enum mxc_jpeg_enc_state enc_state; - unsigned int stopping; - unsigned int stopped; unsigned int slot; unsigned int source_change; bool header_parsed; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3A0AC00140 for ; Mon, 15 Aug 2022 21:00:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230330AbiHOVAC (ORCPT ); Mon, 15 Aug 2022 17:00:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233257AbiHOU7Q (ORCPT ); Mon, 15 Aug 2022 16:59:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77EFFC229D; Mon, 15 Aug 2022 12:12:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 736AAB810A3; Mon, 15 Aug 2022 19:12:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0448C433C1; Mon, 15 Aug 2022 19:12:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590758; bh=TBZTjxNObxMeSF9MVLIlhAHznmQOteS10aeexvE2FOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YH5cH107sbsHcIrq0xqXtoii3OYlxyRmDfqWdNMwsn6dfYYbvYsJ59+IMsxtAqGV0 yh51MpwlCGlRUJIZZJeJWPSN1pbO4dd97D9u8DdhZdVmfuJ+GRnvVog7f7X09xQyND +7OZFckrhw3WqEgT8qALwrPE6Imjy1Gutl8kILkc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0360/1095] media: rcar-vin: Fix channel routing for Ebisu Date: Mon, 15 Aug 2022 19:55:59 +0200 Message-Id: <20220815180444.624606406@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Niklas S=C3=B6derlund [ Upstream commit 5b9b598453d3ae5fa66d7ab591008373a89b91a0 ] When converting to full Virtual Channel routing an error crept into the routing table for Ebisu (r8a77990). The routing information is used at probe time preventing rcar-vin from probing correctly on this SoC, solve by correcting the routing table. Fixes: 3e52419ec04f9769 ("media: rcar-{csi2,vin}: Move to full Virtual Chan= nel routing per CSI-2 IP") Reported-by: Geert Uytterhoeven Signed-off-by: Niklas S=C3=B6derlund Tested-by: Geert Uytterhoeven Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/renesas/rcar-vin/rcar-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/= media/platform/renesas/rcar-vin/rcar-core.c index 64cb05b3907c..ed3ddf36f906 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c @@ -1264,7 +1264,7 @@ static const struct rvin_info rcar_info_r8a77980 =3D { }; =20 static const struct rvin_group_route rcar_info_r8a77990_routes[] =3D { - { .master =3D 0, .csi =3D RVIN_CSI40, .chsel =3D 0x03 }, + { .master =3D 4, .csi =3D RVIN_CSI40, .chsel =3D 0x03 }, { /* Sentinel */ } }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75132C28B2B for ; Mon, 15 Aug 2022 21:09:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242886AbiHOVJW (ORCPT ); Mon, 15 Aug 2022 17:09:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344841AbiHOVDy (ORCPT ); Mon, 15 Aug 2022 17:03:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AF71D3EE1; Mon, 15 Aug 2022 12:14:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B267F60F68; Mon, 15 Aug 2022 19:14:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1E12C4314B; Mon, 15 Aug 2022 19:14:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590886; bh=BokTBTMkZ4346PaQMeY33bF5LXXEd68/+dwp0v89MXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T21ynF5gE8yks6j6TP1DHXg/TgHh/iL+EE/+Ou2dxhJ2Zi7t55HlHtKQF9kPY56a4 ukhrsO7aA8FGc7rayMzqUGoOh2lLY/dwwrq5ynmhm9UcEXkvzHLz7yEk4L663mYD+r 4zgzC0ivNPsCDXyCvtcv/fZj+SIGFNrvfdz6QMCE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Kalle Valo , Sasha Levin , syzbot+03110230a11411024147@syzkaller.appspotmail.com, syzbot+c6dde1f690b60e0b9fbe@syzkaller.appspotmail.com Subject: [PATCH 5.18 0361/1095] ath9k: fix use-after-free in ath9k_hif_usb_rx_cb Date: Mon, 15 Aug 2022 19:56:00 +0200 Message-Id: <20220815180444.675958576@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Skripkin [ Upstream commit 0ac4827f78c7ffe8eef074bc010e7e34bc22f533 ] Syzbot reported use-after-free Read in ath9k_hif_usb_rx_cb() [0]. The problem was in incorrect htc_handle->drv_priv initialization. Probable call trace which can trigger use-after-free: ath9k_htc_probe_device() /* htc_handle->drv_priv =3D priv; */ ath9k_htc_wait_for_target() <--- Failed ieee80211_free_hw() <--- priv pointer is freed ... ath9k_hif_usb_rx_cb() ath9k_hif_usb_rx_stream() RX_STAT_INC() <--- htc_handle->drv_priv access In order to not add fancy protection for drv_priv we can move htc_handle->drv_priv initialization at the end of the ath9k_htc_probe_device() and add helper macro to make all *_STAT_* macros NULL safe, since syzbot has reported related NULL deref in that macros [1] Link: https://syzkaller.appspot.com/bug?id=3D6ead44e37afb6866ac0c7dd121b4ce= 07cb665f60 [0] Link: https://syzkaller.appspot.com/bug?id=3Db8101ffcec107c0567a0cd8acbbace= c91e9ee8de [1] Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.") Reported-and-tested-by: syzbot+03110230a11411024147@syzkaller.appspotmail.c= om Reported-and-tested-by: syzbot+c6dde1f690b60e0b9fbe@syzkaller.appspotmail.c= om Signed-off-by: Pavel Skripkin Acked-by: Toke H=C3=B8iland-J=C3=B8rgensen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/d57bbedc857950659bfacac0ab48790c1eda00c8.16= 55145743.git.paskripkin@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/ath/ath9k/htc.h | 10 +++++----- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/at= h/ath9k/htc.h index 6b45e63fae4b..e3d546ef71dd 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h @@ -327,11 +327,11 @@ static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(str= uct sk_buff *skb) } =20 #ifdef CONFIG_ATH9K_HTC_DEBUGFS - -#define TX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) -#define TX_STAT_ADD(c, a) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c= +=3D a) -#define RX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c= ++) -#define RX_STAT_ADD(c, a) (hif_dev->htc_handle->drv_priv->debug.skbrx_stat= s.c +=3D a) +#define __STAT_SAFE(expr) (hif_dev->htc_handle->drv_priv ? (expr) : 0) +#define TX_STAT_INC(c) __STAT_SAFE(hif_dev->htc_handle->drv_priv->debug.tx= _stats.c++) +#define TX_STAT_ADD(c, a) __STAT_SAFE(hif_dev->htc_handle->drv_priv->debug= .tx_stats.c +=3D a) +#define RX_STAT_INC(c) __STAT_SAFE(hif_dev->htc_handle->drv_priv->debug.sk= brx_stats.c++) +#define RX_STAT_ADD(c, a) __STAT_SAFE(hif_dev->htc_handle->drv_priv->debug= .skbrx_stats.c +=3D a) #define CAB_STAT_INC priv->debug.tx_stats.cab_queued++ =20 #define TX_QSTAT_INC(q) (priv->debug.tx_stats.queue_stats[q]++) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wi= reless/ath/ath9k/htc_drv_init.c index ff61ae34ecdf..07ac88fb1c57 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -944,7 +944,6 @@ int ath9k_htc_probe_device(struct htc_target *htc_handl= e, struct device *dev, priv->hw =3D hw; priv->htc =3D htc_handle; priv->dev =3D dev; - htc_handle->drv_priv =3D priv; SET_IEEE80211_DEV(hw, priv->dev); =20 ret =3D ath9k_htc_wait_for_target(priv); @@ -965,6 +964,8 @@ int ath9k_htc_probe_device(struct htc_target *htc_handl= e, struct device *dev, if (ret) goto err_init; =20 + htc_handle->drv_priv =3D priv; + return 0; =20 err_init: --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A1DBC25B08 for ; Mon, 15 Aug 2022 21:02:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243584AbiHOVCs (ORCPT ); Mon, 15 Aug 2022 17:02:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344558AbiHOVAp (ORCPT ); Mon, 15 Aug 2022 17:00:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CAA7C651B; Mon, 15 Aug 2022 12:13:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9B3FEB810C6; Mon, 15 Aug 2022 19:13:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE06BC433D6; Mon, 15 Aug 2022 19:13:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590783; bh=C+7qbxZDcsHmioA8hGAKIIf6AxtRN3IaVwqqKwIMSR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X5adwM2qsydbd22Kn57dTxHTolfupn+/9EXhO9dCM5Ked26FeFjgBb40/KZuaocCC wuk6BXLEKCXZ3NcC/SuSLnilJiAkDV9OLqBo5f9ie4oq+kA530gNEKB5Zf0HniVtcN YJ0oudEmiQP3kspaO9POERFOq0oARa+E8u2FJy8Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kodanev , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0362/1095] wifi: iwlegacy: 4965: fix potential off-by-one overflow in il4965_rs_fill_link_cmd() Date: Mon, 15 Aug 2022 19:56:01 +0200 Message-Id: <20220815180444.707677234@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexey Kodanev [ Upstream commit a8eb8e6f7159c7c20c0ddac428bde3d110890aa7 ] As a result of the execution of the inner while loop, the value of 'idx' can be equal to LINK_QUAL_MAX_RETRY_NUM. However, this is not checked after the loop and 'idx' is used to write the LINK_QUAL_MAX_RETRY_NUM size array 'lq_cmd->rs_table[idx]' below in the outer loop. The fix is to check the new value of 'idx' inside the nested loop, and break both loops if index equals the size. Checking it at the start is now pointless, so let's remove it. Detected using the static analysis tool - Svace. Fixes: be663ab67077 ("iwlwifi: split the drivers for agn and legacy devices= 3945/4965") Signed-off-by: Alexey Kodanev Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220608171614.28891-1-aleksei.kodanev@bell= -sw.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/intel/iwlegacy/4965-rs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlegacy/4965-rs.c b/drivers/net/wi= reless/intel/iwlegacy/4965-rs.c index 9a491e5db75b..532e3b91777d 100644 --- a/drivers/net/wireless/intel/iwlegacy/4965-rs.c +++ b/drivers/net/wireless/intel/iwlegacy/4965-rs.c @@ -2403,7 +2403,7 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il= _lq_sta *lq_sta, /* Repeat initial/next rate. * For legacy IL_NUMBER_TRY =3D=3D 1, this loop will not execute. * For HT IL_HT_NUMBER_TRY =3D=3D 3, this executes twice. */ - while (repeat_rate > 0 && idx < LINK_QUAL_MAX_RETRY_NUM) { + while (repeat_rate > 0) { if (is_legacy(tbl_type.lq_type)) { if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) ant_toggle_cnt++; @@ -2422,6 +2422,8 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il= _lq_sta *lq_sta, cpu_to_le32(new_rate); repeat_rate--; idx++; + if (idx >=3D LINK_QUAL_MAX_RETRY_NUM) + goto out; } =20 il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, @@ -2466,6 +2468,7 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il= _lq_sta *lq_sta, repeat_rate--; } =20 +out: lq_cmd->agg_params.agg_frame_cnt_limit =3D LINK_QUAL_AGG_FRAME_LIMIT_DEF; lq_cmd->agg_params.agg_dis_start_th =3D LINK_QUAL_AGG_DISABLE_START_DEF; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46E1FC00140 for ; Mon, 15 Aug 2022 21:04:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344578AbiHOVDx (ORCPT ); Mon, 15 Aug 2022 17:03:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347162AbiHOVBg (ORCPT ); Mon, 15 Aug 2022 17:01:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE4F8C926D; Mon, 15 Aug 2022 12:13:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D2222B8110A; Mon, 15 Aug 2022 19:13:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AE29C433D6; Mon, 15 Aug 2022 19:13:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590817; bh=KcSc+ZYjKicKcnG6acQfvVnfRgrO3EcgcspnfS6w9AQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zMYI97pZoxpElTRQ/Yg76Pu6AraGvkxCa0sItiGZ1NqlO8ndnRmRh1CY9SKMyxru1 KejXdDFcx+JtrOH8ez5UcGQ62KSyhwyPLcYqgkyT5U84JdwocD7WQDOnMTmm5da8ds 89sbcRq5ecyj5cCTjfxy42AUb/ZaR3MFq05zULzk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0363/1095] wifi: rtw89: 8852a: rfk: fix div 0 exception Date: Mon, 15 Aug 2022 19:56:02 +0200 Message-Id: <20220815180444.738712898@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ping-Ke Shih [ Upstream commit 683a4647a7a3044868cfdc14c117525091b9fa0c ] The DPK is a kind of RF calibration whose algorithm is to fine tune parameters and calibrate, and check the result. If the result isn't good enough, it could adjust parameters and try again. This issue is to read and show the result, but it could be a negative calibration result that causes divisor 0 and core dump. So, fix it by phy_div() that does division only if divisor isn't zero; otherwise, zero is adopted. divide error: 0000 [#1] PREEMPT SMP NOPTI CPU: 1 PID: 728 Comm: wpa_supplicant Not tainted 5.10.114-16019-g462a1661= 811a #1 RIP: 0010:rtw8852a_dpk+0x14ae/0x288f [rtw89_core] RSP: 0018:ffffa9bb412a7520 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 00000000000180fc RDI: ffffa141d01023c0 RBP: ffffa9bb412a76a0 R08: 0000000000001319 R09: 00000000ffffff92 R10: ffffffffc0292de3 R11: ffffffffc00d2f51 R12: 0000000000000000 R13: ffffa141d01023c0 R14: ffffffffc0290250 R15: ffffa141d0102638 FS: 00007fa99f5c2740(0000) GS:ffffa142e5e80000(0000) knlGS:0000000000000= 000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000013e8e010 CR3: 0000000110d2c000 CR4: 0000000000750ee0 PKRU: 55555554 Call Trace: rtw89_core_sta_add+0x95/0x9c [rtw89_core ] rtw89_ops_sta_state+0x5d/0x108 [rtw89_core ] drv_sta_state+0x115/0x66f [mac80211 ] sta_info_insert_rcu+0x45c/0x713 [mac80211 ] sta_info_insert+0xf/0x1b [mac80211 ] ieee80211_prep_connection+0x9d6/0xb0c [mac80211 ] ieee80211_mgd_auth+0x2aa/0x352 [mac80211 ] cfg80211_mlme_auth+0x160/0x1f6 [cfg80211 ] nl80211_authenticate+0x2e5/0x306 [cfg80211 ] genl_rcv_msg+0x371/0x3a1 ? nl80211_stop_sched_scan+0xe5/0xe5 [cfg80211 ] ? genl_rcv+0x36/0x36 netlink_rcv_skb+0x8a/0xf9 genl_rcv+0x28/0x36 netlink_unicast+0x27b/0x3a0 netlink_sendmsg+0x2aa/0x469 sock_sendmsg_nosec+0x49/0x4d ____sys_sendmsg+0xe5/0x213 __sys_sendmsg+0xec/0x157 ? syscall_enter_from_user_mode+0xd7/0x116 do_syscall_64+0x43/0x55 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7fa99f6e689b Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver") Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220613065144.15647-1-pkshih@realtek.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c b/drivers/ne= t/wireless/realtek/rtw89/rtw8852a_rfk.c index ad272854c442..8e4869eb3a24 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c @@ -2330,8 +2330,8 @@ static u8 _dpk_pas_read(struct rtw89_dev *rtwdev, boo= l is_check) val2_q =3D abs(sign_extend32(val2_q, 11)); =20 rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DPK] PAS_delta =3D 0x%x\n", - (val1_i * val1_i + val1_q * val1_q) / - (val2_i * val2_i + val2_q * val2_q)); + phy_div(val1_i * val1_i + val1_q * val1_q, + val2_i * val2_i + val2_q * val2_q)); =20 } else { for (i =3D 0; i < 32; i++) { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAF93C28B2B for ; Mon, 15 Aug 2022 21:08:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244256AbiHOVFT (ORCPT ); Mon, 15 Aug 2022 17:05:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347681AbiHOVCQ (ORCPT ); Mon, 15 Aug 2022 17:02:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86745CE496; Mon, 15 Aug 2022 12:14:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B83A060EF0; Mon, 15 Aug 2022 19:14:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFAE9C433C1; Mon, 15 Aug 2022 19:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590852; bh=0GoneA/qGJtls0aUIePvwzp+dy/pKMZAcfjAAZ2A3tM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TiySknY54gVgjRw/9EQ8HRB1yqozhHJNebAoJbXQMtYNpQQTDXZzt1XWMD5NMEAW5 bU8hyWNAX6O+v0DrhuXLOaDRBmqlxkJdgiG6XIkee+SRHibBMqTwlYT+BHBzZm5xUl 38n91VpZVwwN6O8a5GMaUWngEvXjA1nULhq3eE0g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 0364/1095] drm/radeon: fix incorrrect SPDX-License-Identifiers Date: Mon, 15 Aug 2022 19:56:03 +0200 Message-Id: <20220815180444.778790656@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alex Deucher [ Upstream commit 1f43b8903f3aae4a26a603c36f6d5dd25d6edb51 ] radeon is MIT. This were incorrectly changed in commit b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier = to files with no license") and commit d198b34f3855 (".gitignore: add SPDX License Identifier") and: commit ec8f24b7faaf ("treewide: Add SPDX license identifier - Makefile/Kcon= fig") Fixes: d198b34f3855 (".gitignore: add SPDX License Identifier") Fixes: ec8f24b7faaf ("treewide: Add SPDX license identifier - Makefile/Kcon= fig") Fixes: b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier = to files with no license") Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2053 Reviewed-by: Christian K=C3=B6nig Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/radeon/.gitignore | 2 +- drivers/gpu/drm/radeon/Kconfig | 2 +- drivers/gpu/drm/radeon/Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/.gitignore b/drivers/gpu/drm/radeon/.gi= tignore index 9c1a94153983..d8777383a64a 100644 --- a/drivers/gpu/drm/radeon/.gitignore +++ b/drivers/gpu/drm/radeon/.gitignore @@ -1,4 +1,4 @@ -# SPDX-License-Identifier: GPL-2.0-only +# SPDX-License-Identifier: MIT mkregtable *_reg_safe.h =20 diff --git a/drivers/gpu/drm/radeon/Kconfig b/drivers/gpu/drm/radeon/Kconfig index 6f60f4840cc5..52819e7f1fca 100644 --- a/drivers/gpu/drm/radeon/Kconfig +++ b/drivers/gpu/drm/radeon/Kconfig @@ -1,4 +1,4 @@ -# SPDX-License-Identifier: GPL-2.0-only +# SPDX-License-Identifier: MIT config DRM_RADEON_USERPTR bool "Always enable userptr support" depends on DRM_RADEON diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makef= ile index 11c97edde54d..3d502f1bbfcb 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile @@ -1,4 +1,4 @@ -# SPDX-License-Identifier: GPL-2.0 +# SPDX-License-Identifier: MIT # # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B624C2BBC5 for ; Mon, 15 Aug 2022 21:08:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245681AbiHOVFj (ORCPT ); Mon, 15 Aug 2022 17:05:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242801AbiHOVDc (ORCPT ); Mon, 15 Aug 2022 17:03:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C12A9D2EA4; Mon, 15 Aug 2022 12:14:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E81A1B81109; Mon, 15 Aug 2022 19:14:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B33DC433C1; Mon, 15 Aug 2022 19:14:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590867; bh=Axapi9ZUMEYfwtt328vt8/8TF7uU1uOdwcal1zqH1e8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AnJY/e4inu3ooTbQPwuyLgZtqYEAOqNiyVxej2bEVY9pB/DGwNkCbojy3qSirpECg 8uMG33YhIP3dSnsmvqVeJ/aDwzQxgrQvr7oEm17+QS+7CEjut1X1Tkehmie4NX+24x XESva6ZmxktbYsZAaaCO4taLEbDs2L++gfna9bLM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.18 0365/1095] rcutorture: Make kvm.sh allow more memory for --kasan runs Date: Mon, 15 Aug 2022 19:56:04 +0200 Message-Id: <20220815180444.817283309@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul E. McKenney [ Upstream commit 31015625768e6d8bc808a892b221b69afaaa8d07 ] KASAN allots significant memory to track allocation state, and the amount of memory has increased recently, which results in frequent OOMs on a few of the rcutorture scenarios. This commit therefore provides 2G of memory for --kasan runs, up from the 512M default. Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/testing/selftests/rcutorture/bin/kvm.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/= selftests/rcutorture/bin/kvm.sh index 55b2c1533282..b9f4d41da30e 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm.sh @@ -44,6 +44,7 @@ TORTURE_KCONFIG_KASAN_ARG=3D"" TORTURE_KCONFIG_KCSAN_ARG=3D"" TORTURE_KMAKE_ARG=3D"" TORTURE_QEMU_MEM=3D512 +torture_qemu_mem_default=3D1 TORTURE_REMOTE=3D TORTURE_SHUTDOWN_GRACE=3D180 TORTURE_SUITE=3Drcu @@ -180,6 +181,10 @@ do ;; --kasan) TORTURE_KCONFIG_KASAN_ARG=3D"CONFIG_DEBUG_INFO=3Dy CONFIG_KASAN=3Dy"; ex= port TORTURE_KCONFIG_KASAN_ARG + if test -n "$torture_qemu_mem_default" + then + TORTURE_QEMU_MEM=3D2G + fi ;; --kconfig|--kconfigs) checkarg --kconfig "(Kconfig options)" $# "$2" '^CONFIG_[A-Z0-9_]\+=3D\(= [ynm]\|[0-9]\+\)\( CONFIG_[A-Z0-9_]\+=3D\([ynm]\|[0-9]\+\)\)*$' '^error$' @@ -202,6 +207,7 @@ do --memory) checkarg --memory "(memory size)" $# "$2" '^[0-9]\+[MG]\?$' error TORTURE_QEMU_MEM=3D$2 + torture_qemu_mem_default=3D shift ;; --no-initrd) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A91BC2BB9D for ; Mon, 15 Aug 2022 21:08:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343741AbiHOVFr (ORCPT ); Mon, 15 Aug 2022 17:05:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244579AbiHOVDf (ORCPT ); Mon, 15 Aug 2022 17:03:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C656D3446; Mon, 15 Aug 2022 12:14:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0BC59B8110A; Mon, 15 Aug 2022 19:14:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60C99C433C1; Mon, 15 Aug 2022 19:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590870; bh=PbzDN8uCwewUCe9w4bc9uBAOhKpKwxgwoFCKQ9tbr1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uY1ON80ycvGBQAPOqR7Pf5qh/wE8KEklwr+hHvyKp7Kt/oqiZnI9eOROpdyjK+jWw Psi2Jg6kaG4unodD4H7iGablU6l/htBZRoD6uUKoW43s0lnRTcczRPtuU2lX6Wmymt IRWkJlKl1kV8yxoSNZ7tje/AWST+px0KJQahDgAE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.18 0366/1095] torture: Adjust to again produce debugging information Date: Mon, 15 Aug 2022 19:56:05 +0200 Message-Id: <20220815180444.866585300@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul E. McKenney [ Upstream commit 5c92d7501699a5deb72a579f808500db5bb6f92a ] A recent change to the DEBUG_INFO Kconfig option means that simply adding CONFIG_DEBUG_INFO=3Dy to the .config file and running "make oldconfig" no longer works. It is instead necessary to add CONFIG_DEBUG_INFO_NONE=3Dn and (for example) CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy. This combination will then result in CONFIG_DEBUG_INFO being selected. This commit therefore updates the Kconfig options produced in response to the kvm.sh --gdb, --kasan, and --kcsan Kconfig options. Fixes: f9b3cd245784 ("Kconfig.debug: make DEBUG_INFO selectable from a choi= ce") Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/testing/selftests/rcutorture/bin/kvm.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/= selftests/rcutorture/bin/kvm.sh index b9f4d41da30e..f2768994d861 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm.sh @@ -164,7 +164,7 @@ do shift ;; --gdb) - TORTURE_KCONFIG_GDB_ARG=3D"CONFIG_DEBUG_INFO=3Dy"; export TORTURE_KCONFI= G_GDB_ARG + TORTURE_KCONFIG_GDB_ARG=3D"CONFIG_DEBUG_INFO_NONE=3Dn CONFIG_DEBUG_INFO_= DWARF_TOOLCHAIN_DEFAULT=3Dy"; export TORTURE_KCONFIG_GDB_ARG TORTURE_BOOT_GDB_ARG=3D"nokaslr"; export TORTURE_BOOT_GDB_ARG TORTURE_QEMU_GDB_ARG=3D"-s -S"; export TORTURE_QEMU_GDB_ARG ;; @@ -180,7 +180,7 @@ do shift ;; --kasan) - TORTURE_KCONFIG_KASAN_ARG=3D"CONFIG_DEBUG_INFO=3Dy CONFIG_KASAN=3Dy"; ex= port TORTURE_KCONFIG_KASAN_ARG + TORTURE_KCONFIG_KASAN_ARG=3D"CONFIG_DEBUG_INFO_NONE=3Dn CONFIG_DEBUG_INF= O_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_KASAN=3Dy"; export TORTURE_KCONFIG_KAS= AN_ARG if test -n "$torture_qemu_mem_default" then TORTURE_QEMU_MEM=3D2G @@ -192,7 +192,7 @@ do shift ;; --kcsan) - TORTURE_KCONFIG_KCSAN_ARG=3D"CONFIG_DEBUG_INFO=3Dy CONFIG_KCSAN=3Dy CONF= IG_KCSAN_STRICT=3Dy CONFIG_KCSAN_REPORT_ONCE_IN_MS=3D100000 CONFIG_KCSAN_VE= RBOSE=3Dy CONFIG_DEBUG_LOCK_ALLOC=3Dy CONFIG_PROVE_LOCKING=3Dy"; export TOR= TURE_KCONFIG_KCSAN_ARG + TORTURE_KCONFIG_KCSAN_ARG=3D"CONFIG_DEBUG_INFO_NONE=3Dn CONFIG_DEBUG_INF= O_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_KCSAN=3Dy CONFIG_KCSAN_STRICT=3Dy CONF= IG_KCSAN_REPORT_ONCE_IN_MS=3D100000 CONFIG_KCSAN_VERBOSE=3Dy CONFIG_DEBUG_L= OCK_ALLOC=3Dy CONFIG_PROVE_LOCKING=3Dy"; export TORTURE_KCONFIG_KCSAN_ARG ;; --kmake-arg|--kmake-args) checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$' --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F9E8C00140 for ; Mon, 15 Aug 2022 21:08:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240148AbiHOVIq (ORCPT ); Mon, 15 Aug 2022 17:08:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344317AbiHOVDr (ORCPT ); Mon, 15 Aug 2022 17:03:47 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEC7BD346F; Mon, 15 Aug 2022 12:14:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 53203CE12C7; Mon, 15 Aug 2022 19:14:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 532BDC433D6; Mon, 15 Aug 2022 19:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590873; bh=QqpK5lGfpu6Sugnz3kv58SDcN45rswAEAFe5os5dbDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EkhjHWm2NQO+qdKozkXb2aIpz6qohmNKEPXtHkqBTG9ch7Z5XJXXYs1xFOx8sq/Mo vtmMHxL54eJBsNZhQ13f0w3Wqr82qqtX20eWYF5iVQanq8RTfL3+J3JU+0lGqv8iiq 9/ECDK6TXkaaT0ABXH5rmvAGmKNc3tGiU7OWSQa4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frederic Weisbecker , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.18 0367/1095] rcutorture: Fix ksoftirqd boosting timing and iteration Date: Mon, 15 Aug 2022 19:56:06 +0200 Message-Id: <20220815180444.902013702@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Frederic Weisbecker [ Upstream commit 3002153a91a9732a6d1d0bb95138593c7da15743 ] The RCU priority boosting can fail in two situations: 1) If (nr_cpus=3D > maxcpus=3D), which means if the total number of CPUs is higher than those brought online at boot, then torture_onoff() may later bring up CPUs that weren't online on boot. Now since rcutorture initialization only boosts the ksoftirqds of the CPUs that have been set online on boot, the CPUs later set online by torture_onoff won't benefit from the boost, making RCU priority boosting fail. 2) The ksoftirqd kthreads are boosted after the creation of rcu_torture_boost() kthreads, which opens a window large enough for these rcu_torture_boost() kthreads to wait (despite running at FIFO priority) for ksoftirqds that are still running at SCHED_NORMAL priority. The issues can trigger for example with: ./kvm.sh --configs TREE01 --kconfig "CONFIG_RCU_BOOST=3Dy" [ 34.968561] rcu-torture: !!! [ 34.968627] ------------[ cut here ]------------ [ 35.014054] WARNING: CPU: 4 PID: 114 at kernel/rcu/rcutorture.c:1979 rc= u_torture_stats_print+0x5ad/0x610 [ 35.052043] Modules linked in: [ 35.069138] CPU: 4 PID: 114 Comm: rcu_torture_sta Not tainted 5.18.0-rc= 1 #1 [ 35.096424] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS re= l-1.14.0-0-g155821a-rebuilt.opensuse.org 04/01/2014 [ 35.154570] RIP: 0010:rcu_torture_stats_print+0x5ad/0x610 [ 35.198527] Code: 63 1b 02 00 74 02 0f 0b 48 83 3d 35 63 1b 02 00 74 02= 0f 0b 48 83 3d 21 63 1b 02 00 74 02 0f 0b 48 83 3d 0d 63 1b 02 00 74 02 <0= f> 0b 83 eb 01 0f 8e ba fc ff ff 0f 0b e9 b3 fc ff f82 [ 37.251049] RSP: 0000:ffffa92a0050bdf8 EFLAGS: 00010202 [ 37.277320] rcu: De-offloading 8 [ 37.290367] RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000= 000001 [ 37.290387] RDX: 0000000000000000 RSI: 00000000ffffbfff RDI: 00000000ff= ffffff [ 37.290398] RBP: 000000000000007b R08: 0000000000000000 R09: c0000000ff= ffbfff [ 37.290407] R10: 000000000000002a R11: ffffa92a0050bc18 R12: ffffa92a00= 50be20 [ 37.290417] R13: ffffa92a0050be78 R14: 0000000000000000 R15: 0000000000= 01bea0 [ 37.290427] FS: 0000000000000000(0000) GS:ffff96045eb00000(0000) knlGS= :0000000000000000 [ 37.290448] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 37.290460] CR2: 0000000000000000 CR3: 000000001dc0c000 CR4: 0000000000= 0006e0 [ 37.290470] Call Trace: [ 37.295049] [ 37.295065] ? preempt_count_add+0x63/0x90 [ 37.295095] ? _raw_spin_lock_irqsave+0x12/0x40 [ 37.295125] ? rcu_torture_stats_print+0x610/0x610 [ 37.295143] rcu_torture_stats+0x29/0x70 [ 37.295160] kthread+0xe3/0x110 [ 37.295176] ? kthread_complete_and_exit+0x20/0x20 [ 37.295193] ret_from_fork+0x22/0x30 [ 37.295218] Fix this with boosting the ksoftirqds kthreads from the boosting hotplug callback itself and before the boosting kthreads are created. Fixes: ea6d962e80b6 ("rcutorture: Judge RCU priority boosting on grace peri= ods, not callbacks") Signed-off-by: Frederic Weisbecker Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/rcu/rcutorture.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 55d049c39608..7c3a7f8c828b 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -2030,6 +2030,19 @@ static int rcutorture_booster_init(unsigned int cpu) if (boost_tasks[cpu] !=3D NULL) return 0; /* Already created, nothing more to do. */ =20 + // Testing RCU priority boosting requires rcutorture do + // some serious abuse. Counter this by running ksoftirqd + // at higher priority. + if (IS_BUILTIN(CONFIG_RCU_TORTURE_TEST)) { + struct sched_param sp; + struct task_struct *t; + + t =3D per_cpu(ksoftirqd, cpu); + WARN_ON_ONCE(!t); + sp.sched_priority =3D 2; + sched_setscheduler_nocheck(t, SCHED_FIFO, &sp); + } + /* Don't allow time recalculation while creating a new task. */ mutex_lock(&boost_mutex); rcu_torture_disable_rt_throttle(); @@ -3281,21 +3294,6 @@ rcu_torture_init(void) rcutor_hp =3D firsterr; if (torture_init_error(firsterr)) goto unwind; - - // Testing RCU priority boosting requires rcutorture do - // some serious abuse. Counter this by running ksoftirqd - // at higher priority. - if (IS_BUILTIN(CONFIG_RCU_TORTURE_TEST)) { - for_each_online_cpu(cpu) { - struct sched_param sp; - struct task_struct *t; - - t =3D per_cpu(ksoftirqd, cpu); - WARN_ON_ONCE(!t); - sp.sched_priority =3D 2; - sched_setscheduler_nocheck(t, SCHED_FIFO, &sp); - } - } } shutdown_jiffies =3D jiffies + shutdown_secs * HZ; firsterr =3D torture_shutdown_init(shutdown_secs, rcu_torture_cleanup); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 769EAC00140 for ; Mon, 15 Aug 2022 21:08:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231769AbiHOVIk (ORCPT ); Mon, 15 Aug 2022 17:08:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344169AbiHOVDq (ORCPT ); Mon, 15 Aug 2022 17:03:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 124E0D347F; Mon, 15 Aug 2022 12:14:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3428FB810C6; Mon, 15 Aug 2022 19:14:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92B86C433D6; Mon, 15 Aug 2022 19:14:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590877; bh=Ntboj5OdAOnTGn4j2kOWSFp861U/2DFFKLts9urgMTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CW84W8Cmh07yn5kUt6siAXb3lo7L8Wm0A40iXr5NnyKuGeBXQCHHcx31QMzD2mP2l IOyyTYJ1A1ZINNQEsMUuQGEPN9R9eXvrOTJ4hj7VuV2GzdNl6pnL0iOHK9DyikL9Rz FkOCHnQ7S28j9UuDc2t310Jfd35XskneR6+L9mp4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Shen , John Fastabend , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.18 0368/1095] test_bpf: fix incorrect netdev features Date: Mon, 15 Aug 2022 19:56:07 +0200 Message-Id: <20220815180444.933953628@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jian Shen [ Upstream commit 9676feccacdb0571791c88b23e3b7ac4e7c9c457 ] The prototype of .features is netdev_features_t, it should use NETIF_F_LLTX and NETIF_F_HW_VLAN_STAG_TX, not NETIF_F_LLTX_BIT and NETIF_F_HW_VLAN_STAG_TX_BIT. Fixes: cf204a718357 ("bpf, testing: Introduce 'gso_linear_no_head_frag' skb= _segment test") Signed-off-by: Jian Shen Acked-by: John Fastabend Link: https://lore.kernel.org/r/20220622135002.8263-1-shenjian15@huawei.com Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- lib/test_bpf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/test_bpf.c b/lib/test_bpf.c index 0c5cb2d6436a..1a00d0247f70 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c @@ -14456,9 +14456,9 @@ static struct skb_segment_test skb_segment_tests[] = __initconst =3D { .build_skb =3D build_test_skb_linear_no_head_frag, .features =3D NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_GSO | - NETIF_F_LLTX_BIT | NETIF_F_GRO | + NETIF_F_LLTX | NETIF_F_GRO | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | - NETIF_F_HW_VLAN_STAG_TX_BIT + NETIF_F_HW_VLAN_STAG_TX } }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6422C00140 for ; Mon, 15 Aug 2022 21:08:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242757AbiHOVIw (ORCPT ); Mon, 15 Aug 2022 17:08:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344445AbiHOVDt (ORCPT ); Mon, 15 Aug 2022 17:03:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A677DD3EC8; Mon, 15 Aug 2022 12:14:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8371860F68; Mon, 15 Aug 2022 19:14:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7562DC433C1; Mon, 15 Aug 2022 19:14:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590879; bh=zv4DZZibKAMRI0gVGHC/jrX5f2LnrYxkNA82LOX0cq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V1fKiarpTVHVFxy/EDPdR+zoGyTrZe4MaVv0M2q4TcdvuCUATzEBm/MAE+7jzNEUG q1OyXPSzIIJ1+1vifRq8OzBhEAllE41AZJrwXFCF0C8Xlg9zKA48xZT2c6sVPmILtV cdascGXjbVN7PC2FmALSb1yMTluT0HXXxB70cMh8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?J=C3=B6rn-Thorben=20Hinz?= , Andrii Nakryiko , Jakub Sitnicki , Martin KaFai Lau , John Fastabend , Sasha Levin Subject: [PATCH 5.18 0369/1095] selftests/bpf: Fix rare segfault in sock_fields prog test Date: Mon, 15 Aug 2022 19:56:08 +0200 Message-Id: <20220815180444.981359376@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: J=C3=B6rn-Thorben Hinz [ Upstream commit 6dc7a0baf1a70b7d22662d38481824c14ddd80c5 ] test_sock_fields__detach() got called with a null pointer here when one of the CHECKs or ASSERTs up to the test_sock_fields__open_and_load() call resulted in a jump to the "done" label. A skeletons *__detach() is not safe to call with a null pointer, though. This led to a segfault. Go the easy route and only call test_sock_fields__destroy() which is null-pointer safe and includes detaching. Came across this while looking[1] to introduce the usage of bpf_tcp_helpers.h (included in progs/test_sock_fields.c) together with vmlinux.h. [1] https://lore.kernel.org/bpf/629bc069dd807d7ac646f836e9dca28bbc1108e2.ca= mel@mailbox.tu-berlin.de/ Fixes: 8f50f16ff39d ("selftests/bpf: Extend verifier and bpf_sock tests for= dst_port loads") Signed-off-by: J=C3=B6rn-Thorben Hinz Signed-off-by: Andrii Nakryiko Reviewed-by: Jakub Sitnicki Reviewed-by: Martin KaFai Lau Acked-by: John Fastabend Link: https://lore.kernel.org/bpf/20220621070116.307221-1-jthinz@mailbox.tu= -berlin.de Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/testing/selftests/bpf/prog_tests/sock_fields.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests/sock_fields.c b/tools/t= esting/selftests/bpf/prog_tests/sock_fields.c index 9d211b5c22c4..7d23166c77af 100644 --- a/tools/testing/selftests/bpf/prog_tests/sock_fields.c +++ b/tools/testing/selftests/bpf/prog_tests/sock_fields.c @@ -394,7 +394,6 @@ void serial_test_sock_fields(void) test(); =20 done: - test_sock_fields__detach(skel); test_sock_fields__destroy(skel); if (child_cg_fd >=3D 0) close(child_cg_fd); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25A8DC00140 for ; Mon, 15 Aug 2022 21:09:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243761AbiHOVJG (ORCPT ); Mon, 15 Aug 2022 17:09:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344781AbiHOVDy (ORCPT ); Mon, 15 Aug 2022 17:03:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19CF651436; Mon, 15 Aug 2022 12:14:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 64E0EB810A3; Mon, 15 Aug 2022 19:14:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD73CC433B5; Mon, 15 Aug 2022 19:14:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590883; bh=kS8tbc67MJN5uKPeEWqHN9GJd2RwXw/4SoQNaYonMcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RW6UV2ozL6GJOJHUh09kponEPOnrYfK2tU7Jxv5m99q1PZkxERnQKFuptQ+GQ0HN2 zDq0T8u23vjJfNEcVw0Eh5iSMk+t+kwIK6xY7M9kajmCg8Rq1Fup3VaEEHAVf4lGmH cfFihIvpW3MLW9X9uxvn9++vGcjk88qe4A9iPh7A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Lendacky , Herbert Xu , Sasha Levin Subject: [PATCH 5.18 0370/1095] crypto: ccp - During shutdown, check SEV data pointer before using Date: Mon, 15 Aug 2022 19:56:09 +0200 Message-Id: <20220815180445.028779075@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tom Lendacky [ Upstream commit 1b05ece0c931536c0a38a9385e243a7962e933f6 ] On shutdown, each CCP device instance performs shutdown processing. However, __sev_platform_shutdown_locked() uses the controlling psp structure to obtain the pointer to the sev_device structure. However, during driver initialization, it is possible that an error can be received from the firmware that results in the sev_data pointer being cleared from the controlling psp structure. The __sev_platform_shutdown_locked() function does not check for this situation and will segfault. While not common, this scenario should be accounted for. Add a check for a NULL sev_device structure before attempting to use it. Fixes: 5441a07a127f ("crypto: ccp - shutdown SEV firmware on kexec") Signed-off-by: Tom Lendacky Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/crypto/ccp/sev-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c index 812c1356a0f8..95dbab0ffab2 100644 --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -503,7 +503,7 @@ static int __sev_platform_shutdown_locked(int *error) struct sev_device *sev =3D psp_master->sev_data; int ret; =20 - if (sev->state =3D=3D SEV_STATE_UNINIT) + if (!sev || sev->state =3D=3D SEV_STATE_UNINIT) return 0; =20 ret =3D __sev_do_cmd_locked(SEV_CMD_SHUTDOWN, NULL, error); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40A9EC25B0E for ; Mon, 15 Aug 2022 21:02:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232593AbiHOVCy (ORCPT ); Mon, 15 Aug 2022 17:02:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344940AbiHOVAs (ORCPT ); Mon, 15 Aug 2022 17:00:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97E5D5071C; Mon, 15 Aug 2022 12:13:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5413A6009B; Mon, 15 Aug 2022 19:13:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21716C433C1; Mon, 15 Aug 2022 19:13:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590786; bh=yUTNofOgq1olQPMANgZ2ZGeArnRYj09pXtkAyVjYFhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0xG5M90HE9CAjcvSLS7o7OLfz1q3ggl3NbxQpD6PmsZ6L7X3/uAiBiGJh/hb3vYaO qfnYvDJceyZOYpYZ9KtGphaEoO4FQeBOT2rgmRlgvSKr4fgqxICUQshaSmhUM/3f1O 7Pkb5VAeRDFih2ZUJo+FBoNrmmcaPqG2GMBH4WIE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Laurent Pinchart , Sam Ravnborg , Sasha Levin Subject: [PATCH 5.18 0371/1095] drm: bridge: adv7511: Add check for mipi_dsi_driver_register Date: Mon, 15 Aug 2022 19:56:10 +0200 Message-Id: <20220815180445.066576965@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 831463667b5f4f1e5bce9c3b94e9e794d2bc8923 ] As mipi_dsi_driver_register could return error if fails, it should be better to check the return value and return error if fails. Moreover, if i2c_add_driver fails, mipi_dsi_driver_register should be reverted. Fixes: 1e4d58cd7f88 ("drm/bridge: adv7533: Create a MIPI DSI device") Signed-off-by: Jiasheng Jiang Reviewed-by: Laurent Pinchart Signed-off-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20220602103401.2980938-= 1-jiasheng@iscas.ac.cn Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm= /bridge/adv7511/adv7511_drv.c index fba6ad3bb6ad..f4d6359f6219 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1384,10 +1384,21 @@ static struct i2c_driver adv7511_driver =3D { =20 static int __init adv7511_init(void) { - if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) - mipi_dsi_driver_register(&adv7533_dsi_driver); + int ret; + + if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) { + ret =3D mipi_dsi_driver_register(&adv7533_dsi_driver); + if (ret) + return ret; + } =20 - return i2c_add_driver(&adv7511_driver); + ret =3D i2c_add_driver(&adv7511_driver); + if (ret) { + if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) + mipi_dsi_driver_unregister(&adv7533_dsi_driver); + } + + return ret; } module_init(adv7511_init); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2F7EC00140 for ; Mon, 15 Aug 2022 21:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239875AbiHOVDL (ORCPT ); Mon, 15 Aug 2022 17:03:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346807AbiHOVBI (ORCPT ); Mon, 15 Aug 2022 17:01:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2D92C6EA1; Mon, 15 Aug 2022 12:13:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3B52FB81106; Mon, 15 Aug 2022 19:13:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80CD7C433C1; Mon, 15 Aug 2022 19:13:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590790; bh=SYmROEW95gLMnhGnaxwDmkZqi0WBlA/SO1b/5eSAcH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rT6rUikw2OkqkI4pznK0k7Fb10KpQ23Ns1OBDFgX2/vuSSZj/f9VrEjFtwZaWpruN +bje2/DhEdXNvGcTgj0cHp/xXxgl9xv6lm6PAcW9kR6IYqWDb6HLUFhI/fMHtn7PqM YL4qWEo39Rt2+VzpXKbMb7byPhz0BaHW7IL7t2eo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0372/1095] media: imx-jpeg: Disable slot interrupt when frame done Date: Mon, 15 Aug 2022 19:56:11 +0200 Message-Id: <20220815180445.106739773@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 22a2bc88c139dc9757bdb1d0a3665ac27edc79a5 ] The interrupt STMBUF_HALF may be triggered after frame done. It may led to system hang if driver try to access the register after power off. Disable the slot interrupt when frame done. Fixes: 2db16c6ed72ce ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Enco= der/Decoder") Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Tested-by: Mirela Rabulea Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c | 5 +++++ drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h | 1 + drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 10 ++-------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c b/drivers/me= dia/platform/nxp/imx-jpeg/mxc-jpeg-hw.c index 29c604b1b179..718b7b08f93e 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c @@ -79,6 +79,11 @@ void mxc_jpeg_enable_irq(void __iomem *reg, int slot) writel(0xFFFFFFFF, reg + MXC_SLOT_OFFSET(slot, SLOT_IRQ_EN)); } =20 +void mxc_jpeg_disable_irq(void __iomem *reg, int slot) +{ + writel(0x0, reg + MXC_SLOT_OFFSET(slot, SLOT_IRQ_EN)); +} + void mxc_jpeg_sw_reset(void __iomem *reg) { /* diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h b/drivers/me= dia/platform/nxp/imx-jpeg/mxc-jpeg-hw.h index 12f132a83a23..bf4e1973a066 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h @@ -125,6 +125,7 @@ u32 mxc_jpeg_get_offset(void __iomem *reg, int slot); void mxc_jpeg_enable_slot(void __iomem *reg, int slot); void mxc_jpeg_set_l_endian(void __iomem *reg, int le); void mxc_jpeg_enable_irq(void __iomem *reg, int slot); +void mxc_jpeg_disable_irq(void __iomem *reg, int slot); int mxc_jpeg_set_input(void __iomem *reg, u32 in_buf, u32 bufsize); int mxc_jpeg_set_output(void __iomem *reg, u16 out_pitch, u32 out_buf, u16 w, u16 h); diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.c index 8c0bd8b75b00..c287eb789fe6 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -593,15 +593,8 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *pri= v) dev_dbg(dev, "Irq %d on slot %d.\n", irq, slot); =20 ctx =3D v4l2_m2m_get_curr_priv(jpeg->m2m_dev); - if (!ctx) { - dev_err(dev, - "Instance released before the end of transaction.\n"); - /* soft reset only resets internal state, not registers */ - mxc_jpeg_sw_reset(reg); - /* clear all interrupts */ - writel(0xFFFFFFFF, reg + MXC_SLOT_OFFSET(slot, SLOT_STATUS)); + if (WARN_ON(!ctx)) goto job_unlock; - } =20 if (slot !=3D ctx->slot) { /* TODO investigate when adding multi-instance support */ @@ -673,6 +666,7 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) buf_state =3D VB2_BUF_STATE_DONE; =20 buffers_done: + mxc_jpeg_disable_irq(reg, ctx->slot); jpeg->slot_data[slot].used =3D false; /* unused, but don't free */ mxc_jpeg_check_and_set_last_buffer(ctx, src_buf, dst_buf); v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9981FC25B08 for ; Mon, 15 Aug 2022 21:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233169AbiHOVDD (ORCPT ); Mon, 15 Aug 2022 17:03:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346751AbiHOVA7 (ORCPT ); Mon, 15 Aug 2022 17:00:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27CE7C6EB7; Mon, 15 Aug 2022 12:13:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 75F11B810C6; Mon, 15 Aug 2022 19:13:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92981C433C1; Mon, 15 Aug 2022 19:13:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590793; bh=l1JNBUW67c3Haepi31TlKOHIL3hpGY4BFuc6oaKik5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h7Pig7x5uZRF7dFmwGasHxDDRB27Ieqasusrk/zFQtZLvXS5ndOfyjlS/O8a8DNM0 uk54o1HL+PTgpCy33iehEAA7n2MGnyWOsyDbXNNG8znc743+Z+qHZa5KNkXBOfMAsS 7mEsIrmzJSW11b2N9TL5eo84SkDMBwbMqrvUfpqk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0373/1095] media: amphion: output firmware error message Date: Mon, 15 Aug 2022 19:56:12 +0200 Message-Id: <20220815180445.151333958@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 89e3f3fb3d9014efa59ed6bb526d5f1a00168452 ] Firmware may send the error event with some error message, and it help locate the firmware error, so output the error message if it exists Fixes: 61cbf1c1fa6d7 ("media: amphion: implement vpu core communication bas= ed on mailbox") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/amphion/vpu_msgs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/amphion/vpu_msgs.c b/drivers/media/plat= form/amphion/vpu_msgs.c index 58502c51ddb3..077644bc1d7c 100644 --- a/drivers/media/platform/amphion/vpu_msgs.c +++ b/drivers/media/platform/amphion/vpu_msgs.c @@ -150,7 +150,12 @@ static void vpu_session_handle_eos(struct vpu_inst *in= st, struct vpu_rpc_event * =20 static void vpu_session_handle_error(struct vpu_inst *inst, struct vpu_rpc= _event *pkt) { - dev_err(inst->dev, "unsupported stream\n"); + char *str =3D (char *)pkt->data; + + if (strlen(str)) + dev_err(inst->dev, "instance %d firmware error : %s\n", inst->id, str); + else + dev_err(inst->dev, "instance %d is unsupported stream\n", inst->id); call_void_vop(inst, event_notify, VPU_MSG_ID_UNSUPPORTED, NULL); vpu_v4l2_set_error(inst); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6C74C00140 for ; Mon, 15 Aug 2022 21:03:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241550AbiHOVD2 (ORCPT ); Mon, 15 Aug 2022 17:03:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346927AbiHOVBS (ORCPT ); Mon, 15 Aug 2022 17:01:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 970CEC7B9F; Mon, 15 Aug 2022 12:13:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ACEB4B81116; Mon, 15 Aug 2022 19:13:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5874C433C1; Mon, 15 Aug 2022 19:13:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590796; bh=AZdgHdd7Lzfg2eg8h8WDpyyCu/wK8MepgvhUm1bY0G8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hu9oTFbfu7vCy908yzbPPp+IUdoy+c7l5WmjS8hme9q91Uf8ZNkNl8R8LoPLryHiL wk1dYKVNNvza7xYY9sUvaGTp5g9bDTZ/q4l4E4S+4DLcgdu72GiGkWCz5zt8oTQhhS qp0TnISJ5iFLZO6iINjfwgPAQzuiLfCHNvAkf5Lk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Linus Walleij , Sasha Levin Subject: [PATCH 5.18 0374/1095] drm/mcde: Fix refcount leak in mcde_dsi_bind Date: Mon, 15 Aug 2022 19:56:13 +0200 Message-Id: <20220815180445.182185394@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 3a149169e4a2f9127022fec6ef5d71b4e804b3b9 ] Every iteration of for_each_available_child_of_node() decrements the reference counter of the previous node. There is no decrement when break out from the loop and results in refcount leak. Add missing of_node_put() to fix this. Fixes: 5fc537bfd000 ("drm/mcde: Add new driver for ST-Ericsson MCDE") Signed-off-by: Miaoqian Lin Signed-off-by: Linus Walleij Link: https://patchwork.freedesktop.org/patch/msgid/20220525115411.65455-1-= linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/mcde/mcde_dsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_ds= i.c index 5651734ce977..9f9ac8699310 100644 --- a/drivers/gpu/drm/mcde/mcde_dsi.c +++ b/drivers/gpu/drm/mcde/mcde_dsi.c @@ -1111,6 +1111,7 @@ static int mcde_dsi_bind(struct device *dev, struct d= evice *master, bridge =3D of_drm_find_bridge(child); if (!bridge) { dev_err(dev, "failed to find bridge\n"); + of_node_put(child); return -EINVAL; } } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EB91C00140 for ; Mon, 15 Aug 2022 21:03:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240429AbiHOVDQ (ORCPT ); Mon, 15 Aug 2022 17:03:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346905AbiHOVBR (ORCPT ); Mon, 15 Aug 2022 17:01:17 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DFD1C7BAE; Mon, 15 Aug 2022 12:13:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 218E4CE12C8; Mon, 15 Aug 2022 19:13:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20C27C433C1; Mon, 15 Aug 2022 19:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590799; bh=a31WYOj3u0YxhhWWPGE8uaQmFHl6yu7OQLekdTH58ts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ECOBIbqYy0GGof4UTsr4Kx2++7qIXuoVJqDKXtxzg8OFHh9wLVFE6jkF1RbQCJVPW GV1kUEue5u073QxfVOVwd7OYVR/SJO2Mc2JSxz2QHgXDMSTIXDSJQRo27hJLQpDvVH hn4FScFLU0l1fw0d2gUaCpnUsJT3McU2u38g2r5A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niels Dossche , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0375/1095] media: hdpvr: fix error value returns in hdpvr_read Date: Mon, 15 Aug 2022 19:56:14 +0200 Message-Id: <20220815180445.221584739@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Niels Dossche [ Upstream commit 359c27c6ddbde404f44a9c0d3ec88ccd1e2042f2 ] Error return values are supposed to be negative in hdpvr_read. Most error returns are currently handled via an unsigned integer "ret". When setting a negative error value to "ret", the value actually becomes a large positive value, because "ret" is unsigned. Later on, the "ret" value is returned. But as ssize_t is a 64-bit signed number, the error return value stays a large positive integer instead of a negative integer. This can cause an error value to be interpreted as the read size, which can cause a buffer overread for applications relying on the returned size. Fixes: 9aba42efe85b ("V4L/DVB (11096): V4L2 Driver for the Hauppauge HD PVR= usb capture device") Signed-off-by: Niels Dossche Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/usb/hdpvr/hdpvr-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpv= r/hdpvr-video.c index 60e57e0f1927..fd7d2a9d0449 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c @@ -409,7 +409,7 @@ static ssize_t hdpvr_read(struct file *file, char __use= r *buffer, size_t count, struct hdpvr_device *dev =3D video_drvdata(file); struct hdpvr_buffer *buf =3D NULL; struct urb *urb; - unsigned int ret =3D 0; + int ret =3D 0; int rem, cnt; =20 if (*pos) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27979C00140 for ; Mon, 15 Aug 2022 21:03:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242036AbiHOVDV (ORCPT ); Mon, 15 Aug 2022 17:03:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346912AbiHOVBR (ORCPT ); Mon, 15 Aug 2022 17:01:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F292EC7BBE; Mon, 15 Aug 2022 12:13:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2B75A60693; Mon, 15 Aug 2022 19:13:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35A4BC433D6; Mon, 15 Aug 2022 19:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590802; bh=3iDinCEBxPLiLOm5Rep+za2zuEXefAblH7Z3yL6QDHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gjGjeb2a0II/UTCe3AJYxIDKH/+rP8Si0eLEWSH6RAIR958CMP1nGAruIgKuc6x9e fuxAHxP6LpqgwG/nx9vwGzPbRyjvPFY09ubpWSgiPOA4LUb7KEyXwFqfIGCxBg/Dp7 As/6T7d8O4DyG4DsFkEWIYSINg7r18I+AYDYwE3A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0376/1095] media: v4l2-mem2mem: prevent pollerr when last_buffer_dequeued is set Date: Mon, 15 Aug 2022 19:56:15 +0200 Message-Id: <20220815180445.252066139@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit d4de27a9b1eadd33a2e40de87a646d1bf5fef756 ] If the last buffer was dequeued from the capture queue, signal userspace. DQBUF(CAPTURE) will return -EPIPE. But if output queue is empty and capture queue is empty, v4l2_m2m_poll_for_data will return EPOLLERR, This is very easy to happen in drain. When last_buffer_dequeued is set, we shouldn't return EPOLLERR, but return EPOLLIN | EPOLLRDNORM. Fixes: 1698a7f151126 ("media: v4l2-mem2mem: simplify poll logic") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/v4l2-core/v4l2-mem2mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-co= re/v4l2-mem2mem.c index 675e22895ebe..094e1815209b 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -924,7 +924,7 @@ static __poll_t v4l2_m2m_poll_for_data(struct file *fil= e, if ((!src_q->streaming || src_q->error || list_empty(&src_q->queued_list)) && (!dst_q->streaming || dst_q->error || - list_empty(&dst_q->queued_list))) + (list_empty(&dst_q->queued_list) && !dst_q->last_buffer_dequeued))) return EPOLLERR; =20 spin_lock_irqsave(&src_q->done_lock, flags); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 170ECC3F6B0 for ; Mon, 15 Aug 2022 21:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343761AbiHOVDd (ORCPT ); Mon, 15 Aug 2022 17:03:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346970AbiHOVBU (ORCPT ); Mon, 15 Aug 2022 17:01:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BBB4C7F9B; Mon, 15 Aug 2022 12:13:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2836460EEE; Mon, 15 Aug 2022 19:13:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28310C43148; Mon, 15 Aug 2022 19:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590805; bh=2OjajXMonsA43H6MGn0Yk7kn041C0Uia5PRSs490OSo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0tOUhY3Wgo9TxoPVZMCTSoArf6mcOSBsk/YNJDqdHjGl/DarRk9Gzt4tQsK2RzDey yRa6ZvEFv6ofUDMfIOeBySHLCKvV7gINl3lzcIgaWigkeG4p2l6gjC5BFLO0JhHTBA vTQ2cwob0ycz2q5lYy+Bajvg9kdTmA08brQahNJo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0377/1095] media: sta2x11: remove VIRT_TO_BUS dependency Date: Mon, 15 Aug 2022 19:56:16 +0200 Message-Id: <20220815180445.290541533@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann [ Upstream commit a157802359f7451ed8046b2b6dbaca187797e062 ] This driver does not use the virt_to_bus() function, though it depends on x86 specific fixups in the swiotlb code, which was last rewritten in commit e380a0394c36 ("x86/PCI: sta2x11: use default DMA address translation"). It is possible that the driver still fails to build on some architectures that are missing CONFIG_VIRT_TO_BUS, but it is always set on x86 machines with the STA2X11 platform enabled. More likely though is that it was never meant to depend on CONFIG_VIRT_TO_BUS, and the Kconfig dependency was kept from an out-of-tree version when the driver was originally merged. Fixes: efeb98b4e2b2 ("[media] STA2X11 VIP: new V4L2 driver") Signed-off-by: Arnd Bergmann Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/pci/sta2x11/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/sta2x11/Kconfig b/drivers/media/pci/sta2x11/= Kconfig index a96e170ab04e..118b922c08c3 100644 --- a/drivers/media/pci/sta2x11/Kconfig +++ b/drivers/media/pci/sta2x11/Kconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config STA2X11_VIP tristate "STA2X11 VIP Video For Linux" - depends on PCI && VIDEO_DEV && VIRT_TO_BUS && I2C + depends on PCI && VIDEO_DEV && I2C depends on STA2X11 || COMPILE_TEST select GPIOLIB if MEDIA_SUBDRV_AUTOSELECT select VIDEO_ADV7180 if MEDIA_SUBDRV_AUTOSELECT --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48692C25B0E for ; Mon, 15 Aug 2022 21:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344011AbiHOVDi (ORCPT ); Mon, 15 Aug 2022 17:03:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346999AbiHOVBV (ORCPT ); Mon, 15 Aug 2022 17:01:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9382CC7FB0; Mon, 15 Aug 2022 12:13:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D82CAB810A3; Mon, 15 Aug 2022 19:13:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0654EC433C1; Mon, 15 Aug 2022 19:13:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590808; bh=z1yANs3BlEP7elGY8q4zDxeiJDlZsTMIrYLWeQA7WAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vP5awG0Rwu9h44khaCvhA02EPg6gOt2vMvJkaWFisGy0uXqXK/dMLXN/ZQCtoa/QE A45A7w3OAy5sUeQxC5rEh/5uBSIUX28+DN3mdR2zLuWFC1Opz1IHNJiGvcaEJekGql o25vUvBaUErzT8lkHLcTEzmMRJlWCeBrR6hsjdZs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunfei Dong , Chen-Yu Tsai , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0378/1095] media: mediatek: vcodec: Initialize decoder parameters after getting dec_capability Date: Mon, 15 Aug 2022 19:56:17 +0200 Message-Id: <20220815180445.330118996@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yunfei Dong [ Upstream commit faddaa735c208560a3f419038e8d154a01b584e3 ] Need to get dec_capability from scp first, then initialize decoder supported format and other parameters according to dec_capability value. Fixes: fd00d90330d1 ("media: mtk-vcodec: vdec: move stateful ops into their= own file") Signed-off-by: Yunfei Dong Reviewed-by: Chen-Yu Tsai Tested-by: Chen-Yu Tsai Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c | 2 -- drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c b/driv= ers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c index c8ee5e2b4f69..4bb8a2751271 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c @@ -112,8 +112,6 @@ void mtk_vcodec_dec_set_default_params(struct mtk_vcode= c_ctx *ctx) { struct mtk_q_data *q_data; =20 - ctx->dev->vdec_pdata->init_vdec_params(ctx); - ctx->m2m_ctx->q_lock =3D &ctx->dev->dev_mutex; ctx->fh.m2m_ctx =3D ctx->m2m_ctx; ctx->fh.ctrl_handler =3D &ctx->ctrl_hdl; diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/= drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c index fe7b2f1739b1..bd1ee9901da0 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c @@ -211,6 +211,8 @@ static int fops_vcodec_open(struct file *file) =20 dev->dec_capability =3D mtk_vcodec_fw_get_vdec_capa(dev->fw_handler); + ctx->dev->vdec_pdata->init_vdec_params(ctx); + mtk_v4l2_debug(0, "decoder capability %x", dev->dec_capability); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E76FEC25B08 for ; Mon, 15 Aug 2022 21:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243844AbiHOVDp (ORCPT ); Mon, 15 Aug 2022 17:03:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347080AbiHOVB0 (ORCPT ); Mon, 15 Aug 2022 17:01:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2D685073B; Mon, 15 Aug 2022 12:13:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1BED6B81106; Mon, 15 Aug 2022 19:13:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59649C433C1; Mon, 15 Aug 2022 19:13:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590811; bh=ob2e2Kwau3IU/jEWM2h5uCr90WUDCFbA04Mb9fnpwOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JUF5I2QA06r9TLqAJmHa0IgMtrjaWLUBJdmdiVmm1ad0WO1Z6rtx9l8BQhsR3H54V TkdtZy6Zvod0sA0GbXW2npryQGdSMPZijtstEm+f+pM5rJYO2KiDL9T8j1pzlj0fyD GqkW5Z4vjwzLbSbBmfbjnu3Yg31AjiCKuzLrB1/g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Nicolas Dufresne , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0379/1095] media: mediatek: vcodec: Skip SOURCE_CHANGE & EOS events for stateless Date: Mon, 15 Aug 2022 19:56:18 +0200 Message-Id: <20220815180445.369175964@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chen-Yu Tsai [ Upstream commit e13ca460e20ed42fe57a3845b0bb9a82f81f05cd ] The stateless decoder API does not specify the usage of SOURCE_CHANGE and EOF events. These events are used by stateful decoders to signal changes in the bitstream. They do not make sense for stateless decoders. Do not handle subscription for these two types of events for stateless decoder instances. This fixes the last v4l2-compliance error: Control ioctls: fail: v4l2-test-controls.cpp(946): have_source_change || have_eos test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL Fixes: 8cdc3794b2e3 ("media: mtk-vcodec: vdec: support stateless API") Signed-off-by: Chen-Yu Tsai Reviewed-by: Nicolas Dufresne Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c b/driv= ers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c index 4bb8a2751271..54489f64533e 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c @@ -194,6 +194,11 @@ static int vidioc_vdec_querycap(struct file *file, voi= d *priv, static int vidioc_vdec_subscribe_evt(struct v4l2_fh *fh, const struct v4l2_event_subscription *sub) { + struct mtk_vcodec_ctx *ctx =3D fh_to_ctx(fh); + + if (ctx->dev->vdec_pdata->uses_stateless_api) + return v4l2_ctrl_subscribe_event(fh, sub); + switch (sub->type) { case V4L2_EVENT_EOS: return v4l2_event_subscribe(fh, sub, 2, NULL); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28705C282E7 for ; Mon, 15 Aug 2022 21:04:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344319AbiHOVDr (ORCPT ); Mon, 15 Aug 2022 17:03:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347105AbiHOVB2 (ORCPT ); Mon, 15 Aug 2022 17:01:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BAB7C9252; Mon, 15 Aug 2022 12:13:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 310A760F4E; Mon, 15 Aug 2022 19:13:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A2F1C433D6; Mon, 15 Aug 2022 19:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590814; bh=3wWrNwEv20y1udfhNosXeWvs1ZzpNC+If61us6+bLbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ImV6FJHseIkKB/tbAZvlNQ8E7onN2wA7Q0qQzqK88ZsuwnmlWCd7jTeNIvDfYBeJ6 rkNdF2mhvFVFyczq4xgX+tpZ4kuXJi6BLDIZ6pieNdSAFpfMsC6mtqGOGY7s7ljQ1R +LYtJd3vsM9plFsVAHRLY+vNNxBOrpHktHM1r/Jg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Jian Zhang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0380/1095] media: driver/nxp/imx-jpeg: fix a unexpected return value problem Date: Mon, 15 Aug 2022 19:56:19 +0200 Message-Id: <20220815180445.407230791@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jian Zhang [ Upstream commit 5b304046a81eda221b5d06a9c62f7b5e45530fa5 ] In function mxc_jpeg_probe(), when devm_clk_get() fail, the return value will be unexpected, and it should be the devm_clk_get's error code. Fixes: 4c2e5156d9fa6 ("media: imx-jpeg: Add pm-runtime support for imx-jpeg= ") Reported-by: Hulk Robot Signed-off-by: Jian Zhang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.c index c287eb789fe6..55c4b29d3e4e 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -2121,12 +2121,14 @@ static int mxc_jpeg_probe(struct platform_device *p= dev) jpeg->clk_ipg =3D devm_clk_get(dev, "ipg"); if (IS_ERR(jpeg->clk_ipg)) { dev_err(dev, "failed to get clock: ipg\n"); + ret =3D PTR_ERR(jpeg->clk_ipg); goto err_clk; } =20 jpeg->clk_per =3D devm_clk_get(dev, "per"); if (IS_ERR(jpeg->clk_per)) { dev_err(dev, "failed to get clock: per\n"); + ret =3D PTR_ERR(jpeg->clk_per); goto err_clk; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 273BCC00140 for ; Mon, 15 Aug 2022 21:04:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345026AbiHOVD6 (ORCPT ); Mon, 15 Aug 2022 17:03:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347259AbiHOVBk (ORCPT ); Mon, 15 Aug 2022 17:01:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6887EC990F; Mon, 15 Aug 2022 12:13:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A6833B81113; Mon, 15 Aug 2022 19:13:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 024AEC433D6; Mon, 15 Aug 2022 19:13:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590820; bh=zkcR0TpSskPaMHhtJO8TQPX3DUVVd6bVpF2lpjf73/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VyEJImBZ/wEtn3I7u+upwV29PMN7r5gUp/CDvW8h6WXrI62aie4fTlaBdnZi8QPKs 0K42G0A+D3QzL4cOQfoTyTUfhRe1BmFoHWeWe6wd/cZ1HmT6XU1KdNotliwilBoeTy v8n/U8FuFbI6S4bdmYE5zAZFhJEEP/TuiaSSgX5A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0381/1095] media: tw686x: Fix memory leak in tw686x_video_init Date: Mon, 15 Aug 2022 19:56:20 +0200 Message-Id: <20220815180445.446492358@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit e0b212ec9d8177d6f7c404315293f6a085d6ee42 ] video_device_alloc() allocates memory for vdev, when video_register_device() fails, it doesn't release the memory and leads to memory leak, call video_device_release() to fix this. Fixes: 704a84ccdbf1 ("[media] media: Support Intersil/Techwell TW686x-based= video capture cards") Signed-off-by: Miaoqian Lin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/pci/tw686x/tw686x-video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw= 686x/tw686x-video.c index b227e9e78ebd..37a20fe24241 100644 --- a/drivers/media/pci/tw686x/tw686x-video.c +++ b/drivers/media/pci/tw686x/tw686x-video.c @@ -1282,8 +1282,10 @@ int tw686x_video_init(struct tw686x_dev *dev) video_set_drvdata(vdev, vc); =20 err =3D video_register_device(vdev, VFL_TYPE_VIDEO, -1); - if (err < 0) + if (err < 0) { + video_device_release(vdev); goto error; + } vc->num =3D vdev->num; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FC90C282E7 for ; Mon, 15 Aug 2022 21:04:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233257AbiHOVED (ORCPT ); Mon, 15 Aug 2022 17:04:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347331AbiHOVBw (ORCPT ); Mon, 15 Aug 2022 17:01:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BA03C991A; Mon, 15 Aug 2022 12:13:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 96019B81106; Mon, 15 Aug 2022 19:13:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F260BC433D6; Mon, 15 Aug 2022 19:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590823; bh=HoKtzkTygzstL7GC29SCUfat8VCVZu8TXTYJkxcN2bg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cgyNNkAVQBYQFNtqm2LjCzqhfdqFYM7YwH2Mcy9mUnH4G32kMquKddmUxfuJ86D4t n1plHC1aqFci2wvPhEE6LYCZZsepdckyFXRHQwpjUW40xFW95s6WVRFhCN5Gm5Wkca 13RhUPE2w2ipBr1OGd2Kh26qmWWlEoa6eqa4g2UA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunfei Dong , Chen-Yu Tsai , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0382/1095] media: mediatek: vcodec: Fix non subdev architecture open power fail Date: Mon, 15 Aug 2022 19:56:21 +0200 Message-Id: <20220815180445.490635507@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yunfei Dong [ Upstream commit 083f54a7c9c66496b9d9f3c50dfdca24e6aa7012 ] According to subdev_bitmap bit value to open hardware power, need to set subdev_bitmap value for non subdev architecture. Fixes: c05bada35f01 ("media: mtk-vcodec: Add to support multi hardware deco= de") Signed-off-by: Yunfei Dong Reviewed-by: Chen-Yu Tsai Tested-by: Chen-Yu Tsai Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/= drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c index bd1ee9901da0..d5c94845ea42 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c @@ -393,6 +393,8 @@ static int mtk_vcodec_probe(struct platform_device *pde= v) mtk_v4l2_err("Main device of_platform_populate failed."); goto err_reg_cont; } + } else { + set_bit(MTK_VDEC_CORE, dev->subdev_bitmap); } =20 ret =3D video_register_device(vfd_dec, VFL_TYPE_VIDEO, -1); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54400C2BB43 for ; Mon, 15 Aug 2022 21:04:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240683AbiHOVEI (ORCPT ); Mon, 15 Aug 2022 17:04:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347390AbiHOVB4 (ORCPT ); Mon, 15 Aug 2022 17:01:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C0AF51A06; Mon, 15 Aug 2022 12:13:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 24DF760ACE; Mon, 15 Aug 2022 19:13:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13E39C433D7; Mon, 15 Aug 2022 19:13:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590826; bh=gfwa/U5aTt/Oj2XOulh95h2ISx/w91u6PWTvRX/iS1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C0Wb6/AqiUnsh4tGszy9MkrbiQEEcgD/iyjDA0gx66sn1ZUxKPzpLwdD1yL8KkPWe nRfUzWembMQX+jJxarRUvQc1B8Xn9X8Rah7bT2vci3dUuGiVxlyOWjH9pVzsjJQzNf ykYU470HJUlxe2l6zRfjkU3bkCj3AHde0O1mVvfk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Dave Stevenson , Sasha Levin Subject: [PATCH 5.18 0383/1095] drm/vc4: kms: Use maximum FIFO load for the HVS clock rate Date: Mon, 15 Aug 2022 19:56:22 +0200 Message-Id: <20220815180445.529134312@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit 1701a23a4ef0993964ccc2f2d5d13f83a5ff4c70 ] The core clock computation takes into account both the load due to the input (ie, planes) and its output (ie, encoders). However, while the input load needs to consider all the planes, and thus sum all of their associated loads, the output happens mostly in parallel. Therefore, we need to consider only the maximum of all the output loads, and not the sum like we were doing. This resulted in a clock rate way too high which could be discarded for being too high by the clock framework. Since recent changes, the clock framework will even downright reject it, leading to a core clock being too low for its current needs. Fixes: 16e101051f32 ("drm/vc4: Increase the core clock based on HVS load") Signed-off-by: Maxime Ripard Reviewed-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-4-maxime@cerno.tech Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index 992d6a240002..dba23ae2e65e 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -890,7 +890,9 @@ vc4_core_clock_atomic_check(struct drm_atomic_state *st= ate) continue; =20 num_outputs++; - cob_rate +=3D hvs_new_state->fifo_state[i].fifo_load; + cob_rate =3D max_t(unsigned long, + hvs_new_state->fifo_state[i].fifo_load, + cob_rate); } =20 pixel_rate =3D load_state->hvs_load; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 650B8C2BB41 for ; Mon, 15 Aug 2022 21:04:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241188AbiHOVEM (ORCPT ); Mon, 15 Aug 2022 17:04:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347471AbiHOVB7 (ORCPT ); Mon, 15 Aug 2022 17:01:59 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07AC7C993B; Mon, 15 Aug 2022 12:13:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 32EFBCE1262; Mon, 15 Aug 2022 19:13:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2603BC433B5; Mon, 15 Aug 2022 19:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590829; bh=DuodYeglwcyYUVWH7MhHNAR31lBBl3gMZdqVDqjhWOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YKAppNgkVDSngJjhKoAEvS2F10YqXYYe9QDs6nSo32ddHg779QmsNQk4b65GNOqep YlELcdvCyM38sJNCr9ICBMapQtAFRnnkBYNQWi2hgUVQT4X4XFvO5XDNY2lqYfR82C nIRN0KmPAkoZES9poNuYHw8sQGgSAy3CGj6+DTGo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dom Cobley , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0384/1095] drm/vc4: plane: Remove subpixel positioning check Date: Mon, 15 Aug 2022 19:56:23 +0200 Message-Id: <20220815180445.569159390@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dom Cobley [ Upstream commit 517db1ab1566dba3093dbdb8de4263ba4aa66416 ] There is little harm in ignoring fractional coordinates (they just get truncated). Without this: modetest -M vc4 -F tiles,gradient -s 32:1920x1080-60 -P89@74:1920x1080*.1.1= @XR24 is rejected. We have the same issue in Kodi when trying to use zoom options on video. Note: even if all coordinates are fully integer. e.g. src:[0,0,1920,1080] dest:[-10,-10,1940,1100] it will still get rejected as drm_atomic_helper_check_plane_state uses drm_rect_clip_scaled which transforms this to fractional src coords Fixes: 21af94cf1a4c ("drm/vc4: Add support for scaling of display planes.") Signed-off-by: Dom Cobley Link: https://lore.kernel.org/r/20220613144800.326124-5-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_plane.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plan= e.c index 920a9eefe426..c2c33f200416 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -339,7 +339,6 @@ static int vc4_plane_setup_clipping_and_scaling(struct = drm_plane_state *state) struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(state); struct drm_framebuffer *fb =3D state->fb; struct drm_gem_cma_object *bo =3D drm_fb_cma_get_gem_obj(fb, 0); - u32 subpixel_src_mask =3D (1 << 16) - 1; int num_planes =3D fb->format->num_planes; struct drm_crtc_state *crtc_state; u32 h_subsample =3D fb->format->hsub; @@ -361,18 +360,15 @@ static int vc4_plane_setup_clipping_and_scaling(struc= t drm_plane_state *state) for (i =3D 0; i < num_planes; i++) vc4_state->offsets[i] =3D bo->paddr + fb->offsets[i]; =20 - /* We don't support subpixel source positioning for scaling. */ - if ((state->src.x1 & subpixel_src_mask) || - (state->src.x2 & subpixel_src_mask) || - (state->src.y1 & subpixel_src_mask) || - (state->src.y2 & subpixel_src_mask)) { - return -EINVAL; - } - - vc4_state->src_x =3D state->src.x1 >> 16; - vc4_state->src_y =3D state->src.y1 >> 16; - vc4_state->src_w[0] =3D (state->src.x2 - state->src.x1) >> 16; - vc4_state->src_h[0] =3D (state->src.y2 - state->src.y1) >> 16; + /* + * We don't support subpixel source positioning for scaling, + * but fractional coordinates can be generated by clipping + * so just round for now + */ + vc4_state->src_x =3D DIV_ROUND_CLOSEST(state->src.x1, 1 << 16); + vc4_state->src_y =3D DIV_ROUND_CLOSEST(state->src.y1, 1 << 16); + vc4_state->src_w[0] =3D DIV_ROUND_CLOSEST(state->src.x2, 1 << 16) - vc4_s= tate->src_x; + vc4_state->src_h[0] =3D DIV_ROUND_CLOSEST(state->src.y2, 1 << 16) - vc4_s= tate->src_y; =20 vc4_state->crtc_x =3D state->dst.x1; vc4_state->crtc_y =3D state->dst.y1; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE7FDC25B08 for ; Mon, 15 Aug 2022 21:05:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239498AbiHOVEx (ORCPT ); Mon, 15 Aug 2022 17:04:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347491AbiHOVCC (ORCPT ); Mon, 15 Aug 2022 17:02:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDB3FC992A; Mon, 15 Aug 2022 12:13:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2892AB8110A; Mon, 15 Aug 2022 19:13:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 467D1C433C1; Mon, 15 Aug 2022 19:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590832; bh=+sfiCdlkPna/YimG9gnGAbfFXU7/uhfnzudGpJJN/94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p7C1EeBvuxjlUFnEWGO5p5oxDfPQ2zTShfWvxSuJM7HxkkuX2iRCeGsz6B2cRtqml ksVihPlvQU2PRDAo7mXv3lA5xERlYI4T2JWWpmLcWoO/8b/lIsjcDYyCxJ0MViSmNF hbYI6tA85WSIkbcfajUsbEHL73Ckx6beHpnfVdfk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0385/1095] drm/vc4: plane: Fix margin calculations for the right/bottom edges Date: Mon, 15 Aug 2022 19:56:24 +0200 Message-Id: <20220815180445.610685925@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit b7c3d6821627861f4ea3e1f2b595d0ed9e80aac8 ] The current plane margin calculation code clips the right and bottom edges of the range based using the left and top margins. This is obviously wrong, so let's fix it. Fixes: 666e73587f90 ("drm/vc4: Take margin setup into account when updating= planes") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-6-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_plane.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plan= e.c index c2c33f200416..a82a0b1190eb 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -310,16 +310,16 @@ static int vc4_plane_margins_adj(struct drm_plane_sta= te *pstate) adjhdisplay, crtc_state->mode.hdisplay); vc4_pstate->crtc_x +=3D left; - if (vc4_pstate->crtc_x > crtc_state->mode.hdisplay - left) - vc4_pstate->crtc_x =3D crtc_state->mode.hdisplay - left; + if (vc4_pstate->crtc_x > crtc_state->mode.hdisplay - right) + vc4_pstate->crtc_x =3D crtc_state->mode.hdisplay - right; =20 adjvdisplay =3D crtc_state->mode.vdisplay - (top + bottom); vc4_pstate->crtc_y =3D DIV_ROUND_CLOSEST(vc4_pstate->crtc_y * adjvdisplay, crtc_state->mode.vdisplay); vc4_pstate->crtc_y +=3D top; - if (vc4_pstate->crtc_y > crtc_state->mode.vdisplay - top) - vc4_pstate->crtc_y =3D crtc_state->mode.vdisplay - top; + if (vc4_pstate->crtc_y > crtc_state->mode.vdisplay - bottom) + vc4_pstate->crtc_y =3D crtc_state->mode.vdisplay - bottom; =20 vc4_pstate->crtc_w =3D DIV_ROUND_CLOSEST(vc4_pstate->crtc_w * adjhdisplay, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A77DC2BB47 for ; Mon, 15 Aug 2022 21:04:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243161AbiHOVET (ORCPT ); Mon, 15 Aug 2022 17:04:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347496AbiHOVCC (ORCPT ); Mon, 15 Aug 2022 17:02:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AC9EC9932; Mon, 15 Aug 2022 12:13:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AA20560F27; Mon, 15 Aug 2022 19:13:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95B3FC433D6; Mon, 15 Aug 2022 19:13:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590836; bh=glN6sxhxG13vQizBKcYdIeAELf9tcp4qdEOf3tEnxBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JvM48E3rrot5vGG/zBbFY0tiLVdl60UNR9ewMEe1JtSa99khJIqbfmgweIiuQvcVq 6PJr9i0Uu0Ht+3droZMEWwChAF9FptBdCAY/mQzQKoviCYz4Gz2PeDK601Q6RB5YNs BE8Pulp4aQzRK2dOC+MviIjesVzq2zr0qIk5zDwM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0386/1095] drm/vc4: dsi: Release workaround buffer and DMA Date: Mon, 15 Aug 2022 19:56:25 +0200 Message-Id: <20220815180445.652206689@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit 89c4bbe2a01ea401c2b0fabc104720809084b77f ] On Pi0-3 the driver allocates a buffer and requests a DMA channel because the ARM can't write to DSI1's registers directly. However, we never release that buffer or channel. Let's add a device-managed action to release each. Fixes: 4078f5757144 ("drm/vc4: Add DSI driver") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-12-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_dsi.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index 98308a17e4ed..e82ee94cafc7 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -1487,13 +1487,29 @@ vc4_dsi_init_phy_clocks(struct vc4_dsi *dsi) dsi->clk_onecell); } =20 +static void vc4_dsi_dma_mem_release(void *ptr) +{ + struct vc4_dsi *dsi =3D ptr; + struct device *dev =3D &dsi->pdev->dev; + + dma_free_coherent(dev, 4, dsi->reg_dma_mem, dsi->reg_dma_paddr); + dsi->reg_dma_mem =3D NULL; +} + +static void vc4_dsi_dma_chan_release(void *ptr) +{ + struct vc4_dsi *dsi =3D ptr; + + dma_release_channel(dsi->reg_dma_chan); + dsi->reg_dma_chan =3D NULL; +} + static int vc4_dsi_bind(struct device *dev, struct device *master, void *d= ata) { struct platform_device *pdev =3D to_platform_device(dev); struct drm_device *drm =3D dev_get_drvdata(master); struct vc4_dsi *dsi =3D dev_get_drvdata(dev); struct vc4_dsi_encoder *vc4_dsi_encoder; - dma_cap_mask_t dma_mask; int ret; =20 dsi->variant =3D of_device_get_match_data(dev); @@ -1527,6 +1543,8 @@ static int vc4_dsi_bind(struct device *dev, struct de= vice *master, void *data) * so set up a channel for talking to it. */ if (dsi->variant->broken_axi_workaround) { + dma_cap_mask_t dma_mask; + dsi->reg_dma_mem =3D dma_alloc_coherent(dev, 4, &dsi->reg_dma_paddr, GFP_KERNEL); @@ -1535,8 +1553,13 @@ static int vc4_dsi_bind(struct device *dev, struct d= evice *master, void *data) return -ENOMEM; } =20 + ret =3D devm_add_action_or_reset(dev, vc4_dsi_dma_mem_release, dsi); + if (ret) + return ret; + dma_cap_zero(dma_mask); dma_cap_set(DMA_MEMCPY, dma_mask); + dsi->reg_dma_chan =3D dma_request_chan_by_mask(&dma_mask); if (IS_ERR(dsi->reg_dma_chan)) { ret =3D PTR_ERR(dsi->reg_dma_chan); @@ -1546,6 +1569,10 @@ static int vc4_dsi_bind(struct device *dev, struct d= evice *master, void *data) return ret; } =20 + ret =3D devm_add_action_or_reset(dev, vc4_dsi_dma_chan_release, dsi); + if (ret) + return ret; + /* Get the physical address of the device's registers. The * struct resource for the regs gives us the bus address * instead. --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8975CC2BB45 for ; Mon, 15 Aug 2022 21:04:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243435AbiHOVEY (ORCPT ); Mon, 15 Aug 2022 17:04:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347535AbiHOVCF (ORCPT ); Mon, 15 Aug 2022 17:02:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7A08CAC76; Mon, 15 Aug 2022 12:14:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D270E60F86; Mon, 15 Aug 2022 19:13:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D832DC433C1; Mon, 15 Aug 2022 19:13:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590839; bh=zJh7aVjy83OVBviyzmE9wu2gQP51nHf6qxEIm9t2EEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0sBfqoTXUNDbxin2zqgMHhn5ml54baA7ybqOpjIW0G+IgUpudsmO4vz7W217ehlpe QFNKEgMEbi5ri5X8YNM6RQ+1sFclXM89RrQA/TaRuwUi2nfS+vwDvwIvKiZhq5tmKD FvY15+YKEbASH/neLkI/sX3pYiiun8OIbAFM7nyE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0387/1095] drm/vc4: dsi: Correct DSI divider calculations Date: Mon, 15 Aug 2022 19:56:26 +0200 Message-Id: <20220815180445.698269581@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit 3b45eee87da171caa28f61240ddb5c21170cda53 ] The divider calculations tried to find the divider just faster than the clock requested. However if it required a divider of 7 then the for loop aborted without handling the "error" case, and could end up with a clock lower than requested. The integer divider from parent PLL to DSI clock is also capable of going up to /255, not just /7 that the driver was trying. This allows for slower link frequencies on the DSI bus where the resolution permits. Correct the loop so that we always have a clock greater than requested, and covering the whole range of dividers. Fixes: 86c1b9eff3f2 ("drm/vc4: Adjust modes in DSI to work around the integ= er PLL divider.") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-13-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_dsi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index e82ee94cafc7..81a6c4e9576d 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -805,11 +805,9 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_enco= der *encoder, /* Find what divider gets us a faster clock than the requested * pixel clock. */ - for (divider =3D 1; divider < 8; divider++) { - if (parent_rate / divider < pll_clock) { - divider--; + for (divider =3D 1; divider < 255; divider++) { + if (parent_rate / (divider + 1) < pll_clock) break; - } } =20 /* Now that we've picked a PLL divider, calculate back to its --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 330BAC25B0E for ; Mon, 15 Aug 2022 21:08:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243959AbiHOVFE (ORCPT ); Mon, 15 Aug 2022 17:05:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347595AbiHOVCJ (ORCPT ); Mon, 15 Aug 2022 17:02:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80C94CAC71; Mon, 15 Aug 2022 12:14:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A7935B81115; Mon, 15 Aug 2022 19:14:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9D1FC433C1; Mon, 15 Aug 2022 19:14:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590842; bh=p+lLgH6ceTfuqTDR32cF1V9u3wTChHSwPS5LpO3gH1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lloUeSROF68+Ze9dVfBkxv8l+AnQJGdSlHSDQzziQD86uGmOe5KS6LGwXeDpTYVDo qyIjYkgkplsJsC1p4XFvCOGOaXcGYNl1Et7HYorhW6hg5K4s4mp+pZVYVDqJCmZ1UD zeJp7IixfaqbWBzWowNH50pvOyCssEebe9wqf0QQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0388/1095] drm/vc4: dsi: Correct pixel order for DSI0 Date: Mon, 15 Aug 2022 19:56:27 +0200 Message-Id: <20220815180445.739615247@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit edfe84ae0df16be1251b5a8e840d95f1f3827500 ] For slightly unknown reasons, dsi0 takes a different pixel format to dsi1, and that has to be set in the pixel valve. Amend the setup accordingly. Fixes: a86773d120d7 ("drm/vc4: Add support for feeding DSI encoders from th= e pixel valve.") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-14-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_crtc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 477b3c5ad089..0a5f58cdd781 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -317,7 +317,8 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, s= truct drm_encoder *encode u32 pixel_rep =3D (mode->flags & DRM_MODE_FLAG_DBLCLK) ? 2 : 1; bool is_dsi =3D (vc4_encoder->type =3D=3D VC4_ENCODER_TYPE_DSI0 || vc4_encoder->type =3D=3D VC4_ENCODER_TYPE_DSI1); - u32 format =3D is_dsi ? PV_CONTROL_FORMAT_DSIV_24 : PV_CONTROL_FORMAT_24; + bool is_dsi1 =3D vc4_encoder->type =3D=3D VC4_ENCODER_TYPE_DSI1; + u32 format =3D is_dsi1 ? PV_CONTROL_FORMAT_DSIV_24 : PV_CONTROL_FORMAT_24; u8 ppc =3D pv_data->pixels_per_clock; bool debug_dump_regs =3D false; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71BC8C282E7 for ; Mon, 15 Aug 2022 21:08:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242670AbiHOVFI (ORCPT ); Mon, 15 Aug 2022 17:05:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347622AbiHOVCM (ORCPT ); Mon, 15 Aug 2022 17:02:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9A01CB5EC; Mon, 15 Aug 2022 12:14:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 514FC60F27; Mon, 15 Aug 2022 19:14:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35445C433B5; Mon, 15 Aug 2022 19:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590845; bh=KcEV8SKvsjL468XkPQvCHNAT9nTCGEg25sQJaScv6vE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FJMIE1uHqRV733J8vdWkcMPQ9bmi44MUW1pihXuGQhKi0zczI1Xp4PEIt2BfqFO+7 EJHhUWJrDtsX5SVo6ZDJfAH0rgcmvtqLUoFRXuaU85n+9PD6QSAQ7DY3MtFXCzRm9j PjLBTH4d9DPogI/bqynnlaCi2VT0xOGbe6MFhLtU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0389/1095] drm/vc4: dsi: Register dsi0 as the correct vc4 encoder type Date: Mon, 15 Aug 2022 19:56:28 +0200 Message-Id: <20220815180445.778843063@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit 4d9273c978d4c1af15d7874c10c732ec83d444d0 ] vc4_dsi was registering both dsi0 and dsi1 as VC4_ENCODER_TYPE_DSI1 which seemed to work OK for a single DSI display, but fails if there are two DSI displays connected. Update to register the correct type. Fixes: 4078f5757144 ("drm/vc4: Add DSI driver") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-15-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_dsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index 81a6c4e9576d..97a258c934af 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -1518,7 +1518,8 @@ static int vc4_dsi_bind(struct device *dev, struct de= vice *master, void *data) return -ENOMEM; =20 INIT_LIST_HEAD(&dsi->bridge_chain); - vc4_dsi_encoder->base.type =3D VC4_ENCODER_TYPE_DSI1; + vc4_dsi_encoder->base.type =3D dsi->variant->port ? + VC4_ENCODER_TYPE_DSI1 : VC4_ENCODER_TYPE_DSI0; vc4_dsi_encoder->dsi =3D dsi; dsi->encoder =3D &vc4_dsi_encoder->base.base; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96B75C28B2C for ; Mon, 15 Aug 2022 21:08:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243727AbiHOVFO (ORCPT ); Mon, 15 Aug 2022 17:05:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347661AbiHOVCP (ORCPT ); Mon, 15 Aug 2022 17:02:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 965DDCE48A; Mon, 15 Aug 2022 12:14:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3400FB8111E; Mon, 15 Aug 2022 19:14:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DDF0C433C1; Mon, 15 Aug 2022 19:14:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590849; bh=fZqr0HeqVX/CO92GLshtVf3UowJIdnYMudi1aIHwhnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tJkcuaFnLxSTwsznWGfFCAMnR/wkNu/fSJSDr3cjqy7ro1i8n3KrLA4AroD870pdv ZQSMpLtmpYuKDTXFSUccteQYNdRDLG/h+BlE61SG5Qe4uVptxxfeXCLWtGfgi5Zh5F NL/wcVQWQTDtq2fUMe63i9kyrion5eO7b4zTj/ao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0390/1095] drm/vc4: dsi: Fix dsi0 interrupt support Date: Mon, 15 Aug 2022 19:56:29 +0200 Message-Id: <20220815180445.826563250@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit bc5b815e06f90cccdb6461aba1e49fdc2f3c8cd1 ] DSI0 seemingly had very little or no testing as a load of the register mappings were incorrect/missing, so host transfers always timed out due to enabling/checking incorrect bits in the interrupt enable and status registers. Fixes: 4078f5757144 ("drm/vc4: Add DSI driver") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-16-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_dsi.c | 111 ++++++++++++++++++++++++++-------- 1 file changed, 85 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index 97a258c934af..333ea96fcde4 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -181,8 +181,50 @@ =20 #define DSI0_TXPKT_PIX_FIFO 0x20 /* AKA PIX_FIFO */ =20 -#define DSI0_INT_STAT 0x24 -#define DSI0_INT_EN 0x28 +#define DSI0_INT_STAT 0x24 +#define DSI0_INT_EN 0x28 +# define DSI0_INT_FIFO_ERR BIT(25) +# define DSI0_INT_CMDC_DONE_MASK VC4_MASK(24, 23) +# define DSI0_INT_CMDC_DONE_SHIFT 23 +# define DSI0_INT_CMDC_DONE_NO_REPEAT 1 +# define DSI0_INT_CMDC_DONE_REPEAT 3 +# define DSI0_INT_PHY_DIR_RTF BIT(22) +# define DSI0_INT_PHY_D1_ULPS BIT(21) +# define DSI0_INT_PHY_D1_STOP BIT(20) +# define DSI0_INT_PHY_RXLPDT BIT(19) +# define DSI0_INT_PHY_RXTRIG BIT(18) +# define DSI0_INT_PHY_D0_ULPS BIT(17) +# define DSI0_INT_PHY_D0_LPDT BIT(16) +# define DSI0_INT_PHY_D0_FTR BIT(15) +# define DSI0_INT_PHY_D0_STOP BIT(14) +/* Signaled when the clock lane enters the given state. */ +# define DSI0_INT_PHY_CLK_ULPS BIT(13) +# define DSI0_INT_PHY_CLK_HS BIT(12) +# define DSI0_INT_PHY_CLK_FTR BIT(11) +/* Signaled on timeouts */ +# define DSI0_INT_PR_TO BIT(10) +# define DSI0_INT_TA_TO BIT(9) +# define DSI0_INT_LPRX_TO BIT(8) +# define DSI0_INT_HSTX_TO BIT(7) +/* Contention on a line when trying to drive the line low */ +# define DSI0_INT_ERR_CONT_LP1 BIT(6) +# define DSI0_INT_ERR_CONT_LP0 BIT(5) +/* Control error: incorrect line state sequence on data lane 0. */ +# define DSI0_INT_ERR_CONTROL BIT(4) +# define DSI0_INT_ERR_SYNC_ESC BIT(3) +# define DSI0_INT_RX2_PKT BIT(2) +# define DSI0_INT_RX1_PKT BIT(1) +# define DSI0_INT_CMD_PKT BIT(0) + +#define DSI0_INTERRUPTS_ALWAYS_ENABLED (DSI0_INT_ERR_SYNC_ESC | \ + DSI0_INT_ERR_CONTROL | \ + DSI0_INT_ERR_CONT_LP0 | \ + DSI0_INT_ERR_CONT_LP1 | \ + DSI0_INT_HSTX_TO | \ + DSI0_INT_LPRX_TO | \ + DSI0_INT_TA_TO | \ + DSI0_INT_PR_TO) + # define DSI1_INT_PHY_D3_ULPS BIT(30) # define DSI1_INT_PHY_D3_STOP BIT(29) # define DSI1_INT_PHY_D2_ULPS BIT(28) @@ -892,6 +934,9 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *= encoder) =20 DSI_PORT_WRITE(PHY_AFEC0, afec0); =20 + /* AFEC reset hold time */ + mdelay(1); + DSI_PORT_WRITE(PHY_AFEC1, VC4_SET_FIELD(6, DSI0_PHY_AFEC1_IDR_DLANE1) | VC4_SET_FIELD(6, DSI0_PHY_AFEC1_IDR_DLANE0) | @@ -1058,12 +1103,9 @@ static void vc4_dsi_encoder_enable(struct drm_encode= r *encoder) DSI_PORT_WRITE(CTRL, DSI_PORT_READ(CTRL) | DSI1_CTRL_EN); =20 /* Bring AFE out of reset. */ - if (dsi->variant->port =3D=3D 0) { - } else { - DSI_PORT_WRITE(PHY_AFEC0, - DSI_PORT_READ(PHY_AFEC0) & - ~DSI1_PHY_AFEC0_RESET); - } + DSI_PORT_WRITE(PHY_AFEC0, + DSI_PORT_READ(PHY_AFEC0) & + ~DSI_PORT_BIT(PHY_AFEC0_RESET)); =20 vc4_dsi_ulps(dsi, false); =20 @@ -1182,13 +1224,28 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_ds= i_host *host, /* Enable the appropriate interrupt for the transfer completion. */ dsi->xfer_result =3D 0; reinit_completion(&dsi->xfer_completion); - DSI_PORT_WRITE(INT_STAT, DSI1_INT_TXPKT1_DONE | DSI1_INT_PHY_DIR_RTF); - if (msg->rx_len) { - DSI_PORT_WRITE(INT_EN, (DSI1_INTERRUPTS_ALWAYS_ENABLED | - DSI1_INT_PHY_DIR_RTF)); + if (dsi->variant->port =3D=3D 0) { + DSI_PORT_WRITE(INT_STAT, + DSI0_INT_CMDC_DONE_MASK | DSI1_INT_PHY_DIR_RTF); + if (msg->rx_len) { + DSI_PORT_WRITE(INT_EN, (DSI0_INTERRUPTS_ALWAYS_ENABLED | + DSI0_INT_PHY_DIR_RTF)); + } else { + DSI_PORT_WRITE(INT_EN, + (DSI0_INTERRUPTS_ALWAYS_ENABLED | + VC4_SET_FIELD(DSI0_INT_CMDC_DONE_NO_REPEAT, + DSI0_INT_CMDC_DONE))); + } } else { - DSI_PORT_WRITE(INT_EN, (DSI1_INTERRUPTS_ALWAYS_ENABLED | - DSI1_INT_TXPKT1_DONE)); + DSI_PORT_WRITE(INT_STAT, + DSI1_INT_TXPKT1_DONE | DSI1_INT_PHY_DIR_RTF); + if (msg->rx_len) { + DSI_PORT_WRITE(INT_EN, (DSI1_INTERRUPTS_ALWAYS_ENABLED | + DSI1_INT_PHY_DIR_RTF)); + } else { + DSI_PORT_WRITE(INT_EN, (DSI1_INTERRUPTS_ALWAYS_ENABLED | + DSI1_INT_TXPKT1_DONE)); + } } =20 /* Send the packet. */ @@ -1205,7 +1262,7 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_dsi_= host *host, ret =3D dsi->xfer_result; } =20 - DSI_PORT_WRITE(INT_EN, DSI1_INTERRUPTS_ALWAYS_ENABLED); + DSI_PORT_WRITE(INT_EN, DSI_PORT_BIT(INTERRUPTS_ALWAYS_ENABLED)); =20 if (ret) goto reset_fifo_and_return; @@ -1251,7 +1308,7 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_dsi_= host *host, DSI_PORT_BIT(CTRL_RESET_FIFOS)); =20 DSI_PORT_WRITE(TXPKT1C, 0); - DSI_PORT_WRITE(INT_EN, DSI1_INTERRUPTS_ALWAYS_ENABLED); + DSI_PORT_WRITE(INT_EN, DSI_PORT_BIT(INTERRUPTS_ALWAYS_ENABLED)); return ret; } =20 @@ -1388,26 +1445,28 @@ static irqreturn_t vc4_dsi_irq_handler(int irq, voi= d *data) DSI_PORT_WRITE(INT_STAT, stat); =20 dsi_handle_error(dsi, &ret, stat, - DSI1_INT_ERR_SYNC_ESC, "LPDT sync"); + DSI_PORT_BIT(INT_ERR_SYNC_ESC), "LPDT sync"); dsi_handle_error(dsi, &ret, stat, - DSI1_INT_ERR_CONTROL, "data lane 0 sequence"); + DSI_PORT_BIT(INT_ERR_CONTROL), "data lane 0 sequence"); dsi_handle_error(dsi, &ret, stat, - DSI1_INT_ERR_CONT_LP0, "LP0 contention"); + DSI_PORT_BIT(INT_ERR_CONT_LP0), "LP0 contention"); dsi_handle_error(dsi, &ret, stat, - DSI1_INT_ERR_CONT_LP1, "LP1 contention"); + DSI_PORT_BIT(INT_ERR_CONT_LP1), "LP1 contention"); dsi_handle_error(dsi, &ret, stat, - DSI1_INT_HSTX_TO, "HSTX timeout"); + DSI_PORT_BIT(INT_HSTX_TO), "HSTX timeout"); dsi_handle_error(dsi, &ret, stat, - DSI1_INT_LPRX_TO, "LPRX timeout"); + DSI_PORT_BIT(INT_LPRX_TO), "LPRX timeout"); dsi_handle_error(dsi, &ret, stat, - DSI1_INT_TA_TO, "turnaround timeout"); + DSI_PORT_BIT(INT_TA_TO), "turnaround timeout"); dsi_handle_error(dsi, &ret, stat, - DSI1_INT_PR_TO, "peripheral reset timeout"); + DSI_PORT_BIT(INT_PR_TO), "peripheral reset timeout"); =20 - if (stat & (DSI1_INT_TXPKT1_DONE | DSI1_INT_PHY_DIR_RTF)) { + if (stat & ((dsi->variant->port ? DSI1_INT_TXPKT1_DONE : + DSI0_INT_CMDC_DONE_MASK) | + DSI_PORT_BIT(INT_PHY_DIR_RTF))) { complete(&dsi->xfer_completion); ret =3D IRQ_HANDLED; - } else if (stat & DSI1_INT_HSTX_TO) { + } else if (stat & DSI_PORT_BIT(INT_HSTX_TO)) { complete(&dsi->xfer_completion); dsi->xfer_result =3D -ETIMEDOUT; ret =3D IRQ_HANDLED; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAB14C2BB43 for ; Mon, 15 Aug 2022 21:08:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244412AbiHOVFY (ORCPT ); Mon, 15 Aug 2022 17:05:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347727AbiHOVCV (ORCPT ); Mon, 15 Aug 2022 17:02:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 645DBCE4AC; Mon, 15 Aug 2022 12:14:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B376E6009B; Mon, 15 Aug 2022 19:14:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8DDAC433C1; Mon, 15 Aug 2022 19:14:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590855; bh=FXcmKym8+v4WXGSA74E5HXWL4LuU9++qS5FPtliBTcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rmhqdB44j7gys/qwEBwu5GamvybdsgEPu1oSW2TL3HRkWXnYhdn2f0PzetXaL9Oj1 c4dkAptJwT7brP8lIaBZh21teRk76RO3o01+YBDvUo+fuY7FFoDKoupa8YTgAlHneu MM2QfFtTUmNAa84iLbjYN5qprkyucnhm613QQM64= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0391/1095] drm/vc4: dsi: Add correct stop condition to vc4_dsi_encoder_disable iteration Date: Mon, 15 Aug 2022 19:56:30 +0200 Message-Id: <20220815180445.871480142@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit 7bcb9c8d0bc9f3cab8ac2634b056c2e6b63945ca ] vc4_dsi_encoder_disable is partially an open coded version of drm_bridge_chain_disable, but it missed a termination condition in the loop for ->disable which meant that no post_disable calls were made. Add in the termination clause. Fixes: 033bfe7538a1 ("drm/vc4: dsi: Fix bridge chain handling") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-17-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_dsi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index 333ea96fcde4..b7b2c76770dc 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -803,6 +803,9 @@ static void vc4_dsi_encoder_disable(struct drm_encoder = *encoder) list_for_each_entry_reverse(iter, &dsi->bridge_chain, chain_node) { if (iter->funcs->disable) iter->funcs->disable(iter); + + if (iter =3D=3D dsi->bridge) + break; } =20 vc4_dsi_ulps(dsi, true); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB552C2BB41 for ; Mon, 15 Aug 2022 21:08:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244710AbiHOVF2 (ORCPT ); Mon, 15 Aug 2022 17:05:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244497AbiHOVCy (ORCPT ); Mon, 15 Aug 2022 17:02:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8EAFD11E6; Mon, 15 Aug 2022 12:14:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7D25CB810C6; Mon, 15 Aug 2022 19:14:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1A7CC433D7; Mon, 15 Aug 2022 19:14:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590858; bh=++TwpD11aNdUDmi97Map4GQL5JJLoabfwqBMgIhuLCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lhTUJ0QV2P3dwrMrwGazfMUMH+C2guoUtZyJGTjMK0YjJVV4O7uxem2LdRRS9hFrS ItV2WndCXpR6Yx1wC60qNi0JBl8t7lsdj347JUwlqu83zdLKiSAKXyBFHrycF4jel9 jDcZlTQIlJ/LFNfsyEPzjzOitHL0w04g+NZZj7lE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0392/1095] drm/vc4: hdmi: Add all the vc5 HDMI registers into the debugfs dumps Date: Mon, 15 Aug 2022 19:56:31 +0200 Message-Id: <20220815180445.915915848@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit 25eb441d55d479581a65bcc9de88bc1d86bf76c1 ] The vc5 HDMI registers hadn't been added into the debugfs register sets, therefore weren't dumped on request. Add them in. Fixes: 8323989140f3 ("drm/vc4: hdmi: Support the BCM2711 HDMI controllers") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-19-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_hdmi.c | 39 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/vc4/vc4_hdmi.h | 8 +++++++ 2 files changed, 47 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 3ff35e3649aa..2ff53482d5d1 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -122,6 +122,12 @@ static int vc4_hdmi_debugfs_regs(struct seq_file *m, v= oid *unused) =20 drm_print_regset32(&p, &vc4_hdmi->hdmi_regset); drm_print_regset32(&p, &vc4_hdmi->hd_regset); + drm_print_regset32(&p, &vc4_hdmi->cec_regset); + drm_print_regset32(&p, &vc4_hdmi->csc_regset); + drm_print_regset32(&p, &vc4_hdmi->dvp_regset); + drm_print_regset32(&p, &vc4_hdmi->phy_regset); + drm_print_regset32(&p, &vc4_hdmi->ram_regset); + drm_print_regset32(&p, &vc4_hdmi->rm_regset); =20 return 0; } @@ -2374,6 +2380,7 @@ static int vc5_hdmi_init_resources(struct vc4_hdmi *v= c4_hdmi) struct platform_device *pdev =3D vc4_hdmi->pdev; struct device *dev =3D &pdev->dev; struct resource *res; + int ret; =20 res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "hdmi"); if (!res) @@ -2470,6 +2477,38 @@ static int vc5_hdmi_init_resources(struct vc4_hdmi *= vc4_hdmi) return PTR_ERR(vc4_hdmi->reset); } =20 + ret =3D vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->hdmi_regset, VC4_HDMI); + if (ret) + return ret; + + ret =3D vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->hd_regset, VC4_HD); + if (ret) + return ret; + + ret =3D vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->cec_regset, VC5_CEC); + if (ret) + return ret; + + ret =3D vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->csc_regset, VC5_CSC); + if (ret) + return ret; + + ret =3D vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->dvp_regset, VC5_DVP); + if (ret) + return ret; + + ret =3D vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->phy_regset, VC5_PHY); + if (ret) + return ret; + + ret =3D vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->ram_regset, VC5_RAM); + if (ret) + return ret; + + ret =3D vc4_hdmi_build_regset(vc4_hdmi, &vc4_hdmi->rm_regset, VC5_RM); + if (ret) + return ret; + return 0; } =20 diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h index 1076faeab616..2b9f5ca15a40 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h @@ -184,6 +184,14 @@ struct vc4_hdmi { struct debugfs_regset32 hdmi_regset; struct debugfs_regset32 hd_regset; =20 + /* VC5 only */ + struct debugfs_regset32 cec_regset; + struct debugfs_regset32 csc_regset; + struct debugfs_regset32 dvp_regset; + struct debugfs_regset32 phy_regset; + struct debugfs_regset32 ram_regset; + struct debugfs_regset32 rm_regset; + /** * @hw_lock: Spinlock protecting device register access. */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16584C2BB45 for ; Mon, 15 Aug 2022 21:08:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245277AbiHOVFh (ORCPT ); Mon, 15 Aug 2022 17:05:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245501AbiHOVDN (ORCPT ); Mon, 15 Aug 2022 17:03:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7596D51439; Mon, 15 Aug 2022 12:14:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C70F2B81115; Mon, 15 Aug 2022 19:14:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00D18C433D6; Mon, 15 Aug 2022 19:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590861; bh=ezz1QrZMZah4z8XFs+tXhhTISclPhpkXp32xMw1dyyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JygA0IXLX3e8KrO6mAcd4PQ5Uufe9DnlnfNHenBDGkJyQ3iFp0YqRg1LirhlYN+vI WJOKf6RceeEySfhz16in0qH6+XqFdbaRUZ7ww2X0nnB7DYlchzUIdTCwh+2wHCwD20 3meTnIwMlGyxsXiOkz+BnvpI/gxthUVF6xPD8HM8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dom Cobley , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0393/1095] drm/vc4: hdmi: Clear unused infoframe packet RAM registers Date: Mon, 15 Aug 2022 19:56:32 +0200 Message-Id: <20220815180445.956193355@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dom Cobley [ Upstream commit b6079d1578dc4b4b8050d613a5449a63def7d1dd ] Using a hdmi analyser the bytes in packet ram registers beyond the length were visible in the infoframes and it flagged the checksum as invalid. Zeroing unused words of packet RAM avoids this Fixes: 21317b3fba54 ("drm/vc4: Set up the AVI and SPD infoframes.") Signed-off-by: Dom Cobley Link: https://lore.kernel.org/r/20220613144800.326124-20-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_hdmi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 2ff53482d5d1..0fe04b1f9782 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -439,9 +439,11 @@ static void vc4_hdmi_write_infoframe(struct drm_encode= r *encoder, const struct vc4_hdmi_register *ram_packet_start =3D &vc4_hdmi->variant->registers[HDMI_RAM_PACKET_START]; u32 packet_reg =3D ram_packet_start->offset + VC4_HDMI_PACKET_STRIDE * pa= cket_id; + u32 packet_reg_next =3D ram_packet_start->offset + + VC4_HDMI_PACKET_STRIDE * (packet_id + 1); void __iomem *base =3D __vc4_hdmi_get_field_base(vc4_hdmi, ram_packet_start->reg); - uint8_t buffer[VC4_HDMI_PACKET_STRIDE]; + uint8_t buffer[VC4_HDMI_PACKET_STRIDE] =3D {}; unsigned long flags; ssize_t len, i; int ret; @@ -477,6 +479,13 @@ static void vc4_hdmi_write_infoframe(struct drm_encode= r *encoder, packet_reg +=3D 4; } =20 + /* + * clear remainder of packet ram as it's included in the + * infoframe and triggers a checksum error on hdmi analyser + */ + for (; packet_reg < packet_reg_next; packet_reg +=3D 4) + writel(0, base + packet_reg); + HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, HDMI_READ(HDMI_RAM_PACKET_CONFIG) | BIT(packet_id)); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA4AAC2BB47 for ; Mon, 15 Aug 2022 21:08:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244973AbiHOVFc (ORCPT ); Mon, 15 Aug 2022 17:05:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243708AbiHOVDM (ORCPT ); Mon, 15 Aug 2022 17:03:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10AE7D2E87; Mon, 15 Aug 2022 12:14:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3A5DA6009B; Mon, 15 Aug 2022 19:14:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AD8FC433D6; Mon, 15 Aug 2022 19:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590864; bh=iJPDOtGlJElJvvZyDG8X4vC4wyhhFqxMXB3Iss6pbig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qREuBFEXWB5zzv58IORpz5FkIrI1dyA/KdUD57Lp41jXn6dOm+T5AEg91twTLs7/9 eU56aHM00A3lCJLCl3tUJ/vw0AmdCBtHCCjADgXCBpAkWUqxGqNNV1ERCGdSCoiYNR uLUkIVtbTTtib3WczfVW62+ep2ViwmPGLMNBTcaE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dom Cobley , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0394/1095] drm/vc4: hdmi: Avoid full hdmi audio fifo writes Date: Mon, 15 Aug 2022 19:56:33 +0200 Message-Id: <20220815180445.988914873@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dom Cobley [ Upstream commit 1c594eeccf92368177c2e22f1d3ee4933dfb8567 ] We are getting occasional VC4_HD_MAI_CTL_ERRORF in HDMI_MAI_CTL which seem to correspond with audio dropouts. Reduce the threshold where we deassert DREQ to avoid the fifo overfilling Fixes: bb7d78568814 ("drm/vc4: Add HDMI audio support") Signed-off-by: Dom Cobley Link: https://lore.kernel.org/r/20220613144800.326124-21-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_hdmi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 0fe04b1f9782..114b007a1e6e 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -1626,10 +1626,10 @@ static int vc4_hdmi_audio_prepare(struct device *de= v, void *data, =20 /* Set the MAI threshold */ HDMI_WRITE(HDMI_MAI_THR, - VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_PANICHIGH) | - VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_PANICLOW) | - VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_DREQHIGH) | - VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_DREQLOW)); + VC4_SET_FIELD(0x08, VC4_HD_MAI_THR_PANICHIGH) | + VC4_SET_FIELD(0x08, VC4_HD_MAI_THR_PANICLOW) | + VC4_SET_FIELD(0x06, VC4_HD_MAI_THR_DREQHIGH) | + VC4_SET_FIELD(0x08, VC4_HD_MAI_THR_DREQLOW)); =20 HDMI_WRITE(HDMI_MAI_CONFIG, VC4_HDMI_MAI_CONFIG_BIT_REVERSE | --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70635C00140 for ; Mon, 15 Aug 2022 21:13:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239451AbiHOVNE (ORCPT ); Mon, 15 Aug 2022 17:13:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347912AbiHOVHp (ORCPT ); Mon, 15 Aug 2022 17:07:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B766D8B0F; Mon, 15 Aug 2022 12:16:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 08CCEB8107A; Mon, 15 Aug 2022 19:16:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AB53C433C1; Mon, 15 Aug 2022 19:16:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590989; bh=4rRpc6oDYt6umUIsSVxUbsmklZ9vSZ679ntW2hRKkpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G+yj7wgZ3/wdafX0V4MopEDYRTfcMAyYADSg+DdLJhNmYz7WC6ar260UWvc1CEH7x I7wpni2mkg/Mk3gLgdzgesHhoFqmQoRc1Bqrhc7LH95xFeuTVa+i+WNkVOegUvK4XU xLJu0wVvMlh42sAh6itltXdAz6GbmOeeMUjYyg5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0395/1095] drm/vc4: hdmi: Reset HDMI MISC_CONTROL register Date: Mon, 15 Aug 2022 19:56:34 +0200 Message-Id: <20220815180446.026539156@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit 35dc00c12a72700a9c4592afee7d136ecb280cbd ] The HDMI block can repeat pixels for double clocked modes, and the firmware is now configuring the block to do this as the PV is doing it incorrectly when at 2pixels/clock. If the kernel doesn't reset it then we end up with strange modes. Reset MISC_CONTROL. Fixes: 8323989140f3 ("drm/vc4: hdmi: Support the BCM2711 HDMI controllers") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-22-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_hdmi.c | 8 ++++++++ drivers/gpu/drm/vc4/vc4_hdmi_regs.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 114b007a1e6e..452b3214fd09 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -79,6 +79,9 @@ #define VC5_HDMI_VERTB_VSPO_SHIFT 16 #define VC5_HDMI_VERTB_VSPO_MASK VC4_MASK(29, 16) =20 +#define VC5_HDMI_MISC_CONTROL_PIXEL_REP_SHIFT 0 +#define VC5_HDMI_MISC_CONTROL_PIXEL_REP_MASK VC4_MASK(3, 0) + #define VC5_HDMI_SCRAMBLER_CTL_ENABLE BIT(0) =20 #define VC5_HDMI_DEEP_COLOR_CONFIG_1_INIT_PACK_PHASE_SHIFT 8 @@ -988,6 +991,11 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_= hdmi, reg |=3D gcp_en ? VC5_HDMI_GCP_CONFIG_GCP_ENABLE : 0; HDMI_WRITE(HDMI_GCP_CONFIG, reg); =20 + reg =3D HDMI_READ(HDMI_MISC_CONTROL); + reg &=3D ~VC5_HDMI_MISC_CONTROL_PIXEL_REP_MASK; + reg |=3D VC4_SET_FIELD(0, VC5_HDMI_MISC_CONTROL_PIXEL_REP); + HDMI_WRITE(HDMI_MISC_CONTROL, reg); + HDMI_WRITE(HDMI_CLOCK_STOP, 0); =20 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); diff --git a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h b/drivers/gpu/drm/vc4/vc4_= hdmi_regs.h index fc971506bd4f..24056441a4bb 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h @@ -125,6 +125,7 @@ enum vc4_hdmi_field { HDMI_VERTB0, HDMI_VERTB1, HDMI_VID_CTL, + HDMI_MISC_CONTROL, }; =20 struct vc4_hdmi_register { @@ -235,6 +236,7 @@ static const struct vc4_hdmi_register __maybe_unused vc= 5_hdmi_hdmi0_fields[] =3D { VC4_HDMI_REG(HDMI_VERTB0, 0x0f0), VC4_HDMI_REG(HDMI_VERTA1, 0x0f4), VC4_HDMI_REG(HDMI_VERTB1, 0x0f8), + VC4_HDMI_REG(HDMI_MISC_CONTROL, 0x100), VC4_HDMI_REG(HDMI_MAI_CHANNEL_MAP, 0x09c), VC4_HDMI_REG(HDMI_MAI_CONFIG, 0x0a0), VC4_HDMI_REG(HDMI_DEEP_COLOR_CONFIG_1, 0x170), @@ -315,6 +317,7 @@ static const struct vc4_hdmi_register __maybe_unused vc= 5_hdmi_hdmi1_fields[] =3D { VC4_HDMI_REG(HDMI_VERTB0, 0x0f0), VC4_HDMI_REG(HDMI_VERTA1, 0x0f4), VC4_HDMI_REG(HDMI_VERTB1, 0x0f8), + VC4_HDMI_REG(HDMI_MISC_CONTROL, 0x100), VC4_HDMI_REG(HDMI_MAI_CHANNEL_MAP, 0x09c), VC4_HDMI_REG(HDMI_MAI_CONFIG, 0x0a0), VC4_HDMI_REG(HDMI_DEEP_COLOR_CONFIG_1, 0x170), --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80B8FC00140 for ; Mon, 15 Aug 2022 21:09:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243922AbiHOVJ1 (ORCPT ); Mon, 15 Aug 2022 17:09:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241522AbiHOVEQ (ORCPT ); Mon, 15 Aug 2022 17:04:16 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFEC1D5710; Mon, 15 Aug 2022 12:14:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id E4E14CE1262; Mon, 15 Aug 2022 19:14:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D091EC433D6; Mon, 15 Aug 2022 19:14:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590889; bh=qLnXxGHuebqquUUuCDId5Q1nQL5MJHCqyFlJRxfHHtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TSOKaNJqK0o6vUnInbs50pslSLCy8Zjfn4ltMRRp5FSNiLfpYflLGQgDDcF2Dr/F2 qfY7r7oZzWNprygfw6CqHIIqtmc9T5owTTuYgbkrh/shf6B0VX7BsEi9eymq2/HgX6 LJLGTZynz4RrecoDjD2aVAExv5tXv9o1+ioBCeG0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0396/1095] drm/vc4: hdmi: Switch to pm_runtime_status_suspended Date: Mon, 15 Aug 2022 19:56:35 +0200 Message-Id: <20220815180446.070314409@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit fcef97e70094a33ded73b3eb9bef06698c6e9c12 ] If the controller isn't clocked or its domain powered up, the register accesses will either stall the CPU or return garbage, respectively. Thus, we had a warning in our register access function to complain when that kind of risky accesses were performed. In order to check the runtime_pm power state, we were using pm_runtime_active(), but it turns out that it will become active only once the runtime_resume hook has been executed. This prevents us from doing any WARN-free register access in our runtime_resume() implementation, while this is valid. Let's switch to pm_runtime_status_suspended() instead. Fixes: 14e193b95604 ("drm/vc4: hdmi: Warn if we access the controller while= disabled") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-23-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_hdmi_regs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h b/drivers/gpu/drm/vc4/vc4_= hdmi_regs.h index 24056441a4bb..72b769412482 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h @@ -417,7 +417,7 @@ static inline u32 vc4_hdmi_read(struct vc4_hdmi *hdmi, const struct vc4_hdmi_variant *variant =3D hdmi->variant; void __iomem *base; =20 - WARN_ON(!pm_runtime_active(&hdmi->pdev->dev)); + WARN_ON(pm_runtime_status_suspended(&hdmi->pdev->dev)); =20 if (reg >=3D variant->num_registers) { dev_warn(&hdmi->pdev->dev, @@ -447,7 +447,7 @@ static inline void vc4_hdmi_write(struct vc4_hdmi *hdmi, =20 lockdep_assert_held(&hdmi->hw_lock); =20 - WARN_ON(!pm_runtime_active(&hdmi->pdev->dev)); + WARN_ON(pm_runtime_status_suspended(&hdmi->pdev->dev)); =20 if (reg >=3D variant->num_registers) { dev_warn(&hdmi->pdev->dev, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28E21C25B08 for ; Mon, 15 Aug 2022 21:12:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244441AbiHOVKx (ORCPT ); Mon, 15 Aug 2022 17:10:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346820AbiHOVGX (ORCPT ); Mon, 15 Aug 2022 17:06:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2FFE2AEC; Mon, 15 Aug 2022 12:15:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 47075B8107A; Mon, 15 Aug 2022 19:15:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A772C433D6; Mon, 15 Aug 2022 19:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590924; bh=9Cmphg+rx262SI8Ahg+JADKSt7EMD8oH9zs/LQ7ULPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ci0NVS3ZIqeLCXsuWGKNYIQmJCTSnYkXa6HuzdTBol1G2MnKYIeawzotyAqC+peo9 0Hqb7Y64ZVtgAN40XQxeOqxR9hCcO/s9ejFyRzE77oKSnGUA22GV448UpGcfaVkmUV eMsVsxPZTdvxcAGOXwPqSwOXmcolOHYZwV44vB3Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0397/1095] drm/vc4: hdmi: Move HDMI reset to pm_resume Date: Mon, 15 Aug 2022 19:56:36 +0200 Message-Id: <20220815180446.110033761@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit 467e30171b5b483922b1c24c573fa50787207cb6 ] The BCM2835-37 found in the RaspberryPi 0 to 3 have a power domain attached to the HDMI block, handled in Linux through runtime_pm. That power domain is shared with the VEC block, so even if we put our runtime_pm reference in the HDMI driver it would keep being on. If the VEC is disabled though, the power domain would be disabled and we would lose any initialization done in our bind implementation. That initialization involves calling the reset function and initializing the CEC registers. Let's move the initialization to our runtime_resume implementation so that we initialize everything properly if we ever need to. Fixes: c86b41214362 ("drm/vc4: hdmi: Move the HSM clock enable to runtime_p= m") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-24-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_hdmi.c | 41 ++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 452b3214fd09..55a965120a77 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -2214,8 +2214,6 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdm= i) struct cec_connector_info conn_info; struct platform_device *pdev =3D vc4_hdmi->pdev; struct device *dev =3D &pdev->dev; - unsigned long flags; - u32 value; int ret; =20 if (!of_find_property(dev->of_node, "interrupts", NULL)) { @@ -2234,15 +2232,6 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hd= mi) cec_fill_conn_info_from_drm(&conn_info, &vc4_hdmi->connector); cec_s_conn_info(vc4_hdmi->cec_adap, &conn_info); =20 - spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); - value =3D HDMI_READ(HDMI_CEC_CNTRL_1); - /* Set the logical address to Unregistered */ - value |=3D VC4_HDMI_CEC_ADDR_MASK; - HDMI_WRITE(HDMI_CEC_CNTRL_1, value); - spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); - - vc4_hdmi_cec_update_clk_div(vc4_hdmi); - if (vc4_hdmi->variant->external_irq_controller) { ret =3D request_threaded_irq(platform_get_irq_byname(pdev, "cec-rx"), vc4_cec_irq_handler_rx_bare, @@ -2258,10 +2247,6 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hd= mi) if (ret) goto err_remove_cec_rx_handler; } else { - spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); - HDMI_WRITE(HDMI_CEC_CPU_MASK_SET, 0xffffffff); - spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); - ret =3D request_threaded_irq(platform_get_irq(pdev, 0), vc4_cec_irq_handler, vc4_cec_irq_handler_thread, 0, @@ -2312,7 +2297,6 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdm= i) } =20 static void vc4_hdmi_cec_exit(struct vc4_hdmi *vc4_hdmi) {}; - #endif =20 static int vc4_hdmi_build_regset(struct vc4_hdmi *vc4_hdmi, @@ -2541,12 +2525,34 @@ static int __maybe_unused vc4_hdmi_runtime_suspend(= struct device *dev) static int vc4_hdmi_runtime_resume(struct device *dev) { struct vc4_hdmi *vc4_hdmi =3D dev_get_drvdata(dev); + unsigned long __maybe_unused flags; + u32 __maybe_unused value; int ret; =20 ret =3D clk_prepare_enable(vc4_hdmi->hsm_clock); if (ret) return ret; =20 + if (vc4_hdmi->variant->reset) + vc4_hdmi->variant->reset(vc4_hdmi); + +#ifdef CONFIG_DRM_VC4_HDMI_CEC + spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); + value =3D HDMI_READ(HDMI_CEC_CNTRL_1); + /* Set the logical address to Unregistered */ + value |=3D VC4_HDMI_CEC_ADDR_MASK; + HDMI_WRITE(HDMI_CEC_CNTRL_1, value); + spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); + + vc4_hdmi_cec_update_clk_div(vc4_hdmi); + + if (!vc4_hdmi->variant->external_irq_controller) { + spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); + HDMI_WRITE(HDMI_CEC_CPU_MASK_SET, 0xffffffff); + spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); + } +#endif + return 0; } =20 @@ -2649,9 +2655,6 @@ static int vc4_hdmi_bind(struct device *dev, struct d= evice *master, void *data) pm_runtime_set_active(dev); pm_runtime_enable(dev); =20 - if (vc4_hdmi->variant->reset) - vc4_hdmi->variant->reset(vc4_hdmi); - if ((of_device_is_compatible(dev->of_node, "brcm,bcm2711-hdmi0") || of_device_is_compatible(dev->of_node, "brcm,bcm2711-hdmi1")) && HDMI_READ(HDMI_VID_CTL) & VC4_HD_VID_CTL_ENABLE) { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90157C25B08 for ; Mon, 15 Aug 2022 21:12:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343506AbiHOVL1 (ORCPT ); Mon, 15 Aug 2022 17:11:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347591AbiHOVHJ (ORCPT ); Mon, 15 Aug 2022 17:07:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01FFEBB003; Mon, 15 Aug 2022 12:15:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 87CCD60FB5; Mon, 15 Aug 2022 19:15:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 912D9C433C1; Mon, 15 Aug 2022 19:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590956; bh=DznJc7TWENctD5//IBiKoAflqIB7T8sPH+IxLgYWjFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tave9I4R8XKAFoBgYJx2gpt6McCdL7fu9pLaDzBd6AlnwKal6r2l9B9QJYLeJ+jaT 4tLX7LYjJIvMvT9sHwnFvGXR6mdA1OnZStDJu7CCqiavykGxpTpuknCkRJX7zCpiSd 6HKMHx7Pq2HwfaXqAIdgdk22IO00xnh48oAKy/Io= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mateusz Kwiatkowski , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0398/1095] drm/vc4: hdmi: Fix timings for interlaced modes Date: Mon, 15 Aug 2022 19:56:37 +0200 Message-Id: <20220815180446.152833393@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mateusz Kwiatkowski [ Upstream commit 0ee5a40152b15f200ed3a0d51e8aa782ea979c6a ] Increase the number of post-sync blanking lines on odd fields instead of decreasing it on even fields. This makes the total number of lines properly match the modelines. Additionally fix the value of PV_VCONTROL_ODD_DELAY, which did not take pixels_per_clock into account, causing some displays to invert the fields when driven by bcm2711. Fixes: 682e62c45406 ("drm/vc4: Fix support for interlaced modes on HDMI.") Signed-off-by: Mateusz Kwiatkowski Link: https://lore.kernel.org/r/20220613144800.326124-31-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_crtc.c | 7 ++++--- drivers/gpu/drm/vc4/vc4_hdmi.c | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 0a5f58cdd781..2810b0d9e78c 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -344,7 +344,8 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, s= truct drm_encoder *encode PV_HORZB_HACTIVE)); =20 CRTC_WRITE(PV_VERTA, - VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, + VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end + + interlace, PV_VERTA_VBP) | VC4_SET_FIELD(mode->crtc_vsync_end - mode->crtc_vsync_start, PV_VERTA_VSYNC)); @@ -356,7 +357,7 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, s= truct drm_encoder *encode if (interlace) { CRTC_WRITE(PV_VERTA_EVEN, VC4_SET_FIELD(mode->crtc_vtotal - - mode->crtc_vsync_end - 1, + mode->crtc_vsync_end, PV_VERTA_VBP) | VC4_SET_FIELD(mode->crtc_vsync_end - mode->crtc_vsync_start, @@ -376,7 +377,7 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, s= truct drm_encoder *encode PV_VCONTROL_CONTINUOUS | (is_dsi ? PV_VCONTROL_DSI : 0) | PV_VCONTROL_INTERLACE | - VC4_SET_FIELD(mode->htotal * pixel_rep / 2, + VC4_SET_FIELD(mode->htotal * pixel_rep / (2 * ppc), PV_VCONTROL_ODD_DELAY)); CRTC_WRITE(PV_VSYNCD_EVEN, 0); } else { diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 55a965120a77..da3622f34dba 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -870,12 +870,12 @@ static void vc4_hdmi_set_timings(struct vc4_hdmi *vc4= _hdmi, VC4_HDMI_VERTA_VFP) | VC4_SET_FIELD(mode->crtc_vdisplay, VC4_HDMI_VERTA_VAL)); u32 vertb =3D (VC4_SET_FIELD(0, VC4_HDMI_VERTB_VSPO) | - VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, + VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end + + interlaced, VC4_HDMI_VERTB_VBP)); u32 vertb_even =3D (VC4_SET_FIELD(0, VC4_HDMI_VERTB_VSPO) | VC4_SET_FIELD(mode->crtc_vtotal - - mode->crtc_vsync_end - - interlaced, + mode->crtc_vsync_end, VC4_HDMI_VERTB_VBP)); unsigned long flags; =20 @@ -921,12 +921,12 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4= _hdmi, VC5_HDMI_VERTA_VFP) | VC4_SET_FIELD(mode->crtc_vdisplay, VC5_HDMI_VERTA_VAL)); u32 vertb =3D (VC4_SET_FIELD(0, VC5_HDMI_VERTB_VSPO) | - VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, + VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end + + interlaced, VC4_HDMI_VERTB_VBP)); u32 vertb_even =3D (VC4_SET_FIELD(0, VC5_HDMI_VERTB_VSPO) | VC4_SET_FIELD(mode->crtc_vtotal - - mode->crtc_vsync_end - - interlaced, + mode->crtc_vsync_end, VC4_HDMI_VERTB_VBP)); unsigned long flags; unsigned char gcp; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E049C2BB43 for ; Mon, 15 Aug 2022 21:12:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232624AbiHOVMP (ORCPT ); Mon, 15 Aug 2022 17:12:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347838AbiHOVHj (ORCPT ); Mon, 15 Aug 2022 17:07:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12B96D7CD6; Mon, 15 Aug 2022 12:16:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 267C660EF0; Mon, 15 Aug 2022 19:16:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EC2AC433D6; Mon, 15 Aug 2022 19:16:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590971; bh=jFpYE0q8Cil9nULPreWovUqFj5Fwa7A8dX1EsVOA+Wg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=efatLqxEMYzEsn2KCk9sM5K6JwWPvYEpFkcq3b9F3K1UdVk2ztSGt+xaGZQzKBYzh uTbpk9DJSa9HoFNhvsQCgqWYG/81/kLhcVuDXXdVyuwJGHdxCApC5r/OXZ6ajFjpnj oM/Us02Vn3LhtMGHUvDIsCZgJHdAPkQDzVY5yzsc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0399/1095] drm/vc4: hdmi: Correct HDMI timing registers for interlaced modes Date: Mon, 15 Aug 2022 19:56:38 +0200 Message-Id: <20220815180446.198793246@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit fb10dc451c0f15e3c19798a2f41d357f3f7576f5 ] For interlaced modes the timings were not being correctly programmed into the HDMI block, so correct them. Fixes: 8323989140f3 ("drm/vc4: hdmi: Support the BCM2711 HDMI controllers") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-33-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_hdmi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index da3622f34dba..f7781d171687 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -920,13 +920,13 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4= _hdmi, VC4_SET_FIELD(mode->crtc_vsync_start - mode->crtc_vdisplay, VC5_HDMI_VERTA_VFP) | VC4_SET_FIELD(mode->crtc_vdisplay, VC5_HDMI_VERTA_VAL)); - u32 vertb =3D (VC4_SET_FIELD(0, VC5_HDMI_VERTB_VSPO) | - VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end + - interlaced, + u32 vertb =3D (VC4_SET_FIELD(mode->htotal >> (2 - pixel_rep), + VC5_HDMI_VERTB_VSPO) | + VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, VC4_HDMI_VERTB_VBP)); u32 vertb_even =3D (VC4_SET_FIELD(0, VC5_HDMI_VERTB_VSPO) | VC4_SET_FIELD(mode->crtc_vtotal - - mode->crtc_vsync_end, + mode->crtc_vsync_end - interlaced, VC4_HDMI_VERTB_VBP)); unsigned long flags; unsigned char gcp; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3091C00140 for ; Mon, 15 Aug 2022 21:12:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233376AbiHOVMS (ORCPT ); Mon, 15 Aug 2022 17:12:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347860AbiHOVHl (ORCPT ); Mon, 15 Aug 2022 17:07:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49C62D86C2; Mon, 15 Aug 2022 12:16:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2DFFD6009B; Mon, 15 Aug 2022 19:16:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 351B5C433C1; Mon, 15 Aug 2022 19:16:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590974; bh=P0ta2E98eViqb8E8o8a6Gqzg4ZfJXdlI8NtXdE30U5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JsKG+VYue/nxXPcnqh62ioxLtNzF0rTjIIo96BqKaqYzzKBH6aVDdEf/YQGi2kcwR nDsojK0j9GvYQRuJ/HV6H5sSUn8w0XQiNp3p0oWyYuwTK1NA3ywUlwDPwp8k6VpvZk rYACe5TLi32/X71ZBES1SV+rBsN/slIucQExSt5o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0400/1095] drm/vc4: hdmi: Move pixel doubling from Pixelvalve to HDMI block Date: Mon, 15 Aug 2022 19:56:39 +0200 Message-Id: <20220815180446.242731488@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit 3650062e4281ab28a6f8c9d59606d0a6266be736 ] With the change to 2 pixels/clock, the pixel doubling in the PV results in doubling each pair of pixels, ie ABABCDCD instead of AABBCCDD. Move the pixel doubling to the HDMI block, however this means that DBLCLK modes now fall foul of requiring even values for all the horizontal timing parameters. As both 480i and 576i fail this, attempt to fix up DBLCLK modes that have odd timings values. Fixes: 8323989140f3 ("drm/vc4: hdmi: Support the BCM2711 HDMI controllers") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-34-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_crtc.c | 4 +++- drivers/gpu/drm/vc4/vc4_hdmi.c | 34 ++++++++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 2810b0d9e78c..18e2a246f7c1 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -314,7 +314,9 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, s= truct drm_encoder *encode struct drm_crtc_state *crtc_state =3D crtc->state; struct drm_display_mode *mode =3D &crtc_state->adjusted_mode; bool interlace =3D mode->flags & DRM_MODE_FLAG_INTERLACE; - u32 pixel_rep =3D (mode->flags & DRM_MODE_FLAG_DBLCLK) ? 2 : 1; + bool is_hdmi =3D vc4_encoder->type =3D=3D VC4_ENCODER_TYPE_HDMI0 || + vc4_encoder->type =3D=3D VC4_ENCODER_TYPE_HDMI1; + u32 pixel_rep =3D ((mode->flags & DRM_MODE_FLAG_DBLCLK) && !is_hdmi) ? 2 = : 1; bool is_dsi =3D (vc4_encoder->type =3D=3D VC4_ENCODER_TYPE_DSI0 || vc4_encoder->type =3D=3D VC4_ENCODER_TYPE_DSI1); bool is_dsi1 =3D vc4_encoder->type =3D=3D VC4_ENCODER_TYPE_DSI1; diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index f7781d171687..8b1e52145082 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -79,6 +79,8 @@ #define VC5_HDMI_VERTB_VSPO_SHIFT 16 #define VC5_HDMI_VERTB_VSPO_MASK VC4_MASK(29, 16) =20 +#define VC4_HDMI_MISC_CONTROL_PIXEL_REP_SHIFT 0 +#define VC4_HDMI_MISC_CONTROL_PIXEL_REP_MASK VC4_MASK(3, 0) #define VC5_HDMI_MISC_CONTROL_PIXEL_REP_SHIFT 0 #define VC5_HDMI_MISC_CONTROL_PIXEL_REP_MASK VC4_MASK(3, 0) =20 @@ -878,6 +880,7 @@ static void vc4_hdmi_set_timings(struct vc4_hdmi *vc4_h= dmi, mode->crtc_vsync_end, VC4_HDMI_VERTB_VBP)); unsigned long flags; + u32 reg; =20 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); =20 @@ -904,6 +907,11 @@ static void vc4_hdmi_set_timings(struct vc4_hdmi *vc4_= hdmi, HDMI_WRITE(HDMI_VERTB0, vertb_even); HDMI_WRITE(HDMI_VERTB1, vertb); =20 + reg =3D HDMI_READ(HDMI_MISC_CONTROL); + reg &=3D ~VC4_HDMI_MISC_CONTROL_PIXEL_REP_MASK; + reg |=3D VC4_SET_FIELD(pixel_rep - 1, VC4_HDMI_MISC_CONTROL_PIXEL_REP); + HDMI_WRITE(HDMI_MISC_CONTROL, reg); + spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); } =20 @@ -993,7 +1001,7 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_= hdmi, =20 reg =3D HDMI_READ(HDMI_MISC_CONTROL); reg &=3D ~VC5_HDMI_MISC_CONTROL_PIXEL_REP_MASK; - reg |=3D VC4_SET_FIELD(0, VC5_HDMI_MISC_CONTROL_PIXEL_REP); + reg |=3D VC4_SET_FIELD(pixel_rep - 1, VC5_HDMI_MISC_CONTROL_PIXEL_REP); HDMI_WRITE(HDMI_MISC_CONTROL, reg); =20 HDMI_WRITE(HDMI_CLOCK_STOP, 0); @@ -1276,11 +1284,25 @@ static int vc4_hdmi_encoder_atomic_check(struct drm= _encoder *encoder, unsigned long long pixel_rate =3D mode->clock * 1000; unsigned long long tmds_rate; =20 - if (vc4_hdmi->variant->unsupported_odd_h_timings && - !(mode->flags & DRM_MODE_FLAG_DBLCLK) && - ((mode->hdisplay % 2) || (mode->hsync_start % 2) || - (mode->hsync_end % 2) || (mode->htotal % 2))) - return -EINVAL; + if (vc4_hdmi->variant->unsupported_odd_h_timings) { + if (mode->flags & DRM_MODE_FLAG_DBLCLK) { + /* Only try to fixup DBLCLK modes to get 480i and 576i + * working. + * A generic solution for all modes with odd horizontal + * timing values seems impossible based on trying to + * solve it for 1366x768 monitors. + */ + if ((mode->hsync_start - mode->hdisplay) & 1) + mode->hsync_start--; + if ((mode->hsync_end - mode->hsync_start) & 1) + mode->hsync_end--; + } + + /* Now check whether we still have odd values remaining */ + if ((mode->hdisplay % 2) || (mode->hsync_start % 2) || + (mode->hsync_end % 2) || (mode->htotal % 2)) + return -EINVAL; + } =20 /* * The 1440p@60 pixel rate is in the same range than the first --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40FDEC00140 for ; Mon, 15 Aug 2022 21:12:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233538AbiHOVM3 (ORCPT ); Mon, 15 Aug 2022 17:12:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347877AbiHOVHm (ORCPT ); Mon, 15 Aug 2022 17:07:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16EE052DC5; Mon, 15 Aug 2022 12:16:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BD0F7B810A3; Mon, 15 Aug 2022 19:16:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06969C433C1; Mon, 15 Aug 2022 19:16:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590977; bh=FSlNSLhvpoyiw9eFcM5g7ayib14ZGARLfiKQGyQtPDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=or5MVeNaDHLyvahTYk8jm3RKn0dOmZQelv7FqKEFWutWN8u9f6dWlu8MqM54L0NWZ 33gSvLUil5nQnQLiaFJwzaM1FyQkRfxjVHqoHKq79T4QMYe/MmwDraOnk0MtcqFuby RpjxVS5skLWAjh1PcySzkhB7VQFVDIv+O3bHe2Uk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Chinner , "Darrick J. Wong" , "Matthew Wilcox (Oracle)" , Sasha Levin Subject: [PATCH 5.18 0401/1095] mm: Account dirty folios properly during splits Date: Mon, 15 Aug 2022 19:56:40 +0200 Message-Id: <20220815180446.282386990@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Matthew Wilcox (Oracle) [ Upstream commit fb5c2029f8221e904e604938171c4a8ef169aadb ] If the last folio in a file is split as a result of truncation, we simply clear the dirty bits for the pages we're discarding. That causes NR_FILE_DIRTY (among other counters) to be thrown off and eventually Linux will hang in balance_dirty_pages_ratelimited() Reported-by: Dave Chinner Tested-by: Dave Chinner Tested-by: Darrick J. Wong Fixes: d68eccad3706 ("mm/filemap: Allow large folios to be added to the pag= e cache") Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- mm/huge_memory.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index b7d0697b1f26..e0c1cf3168d7 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -2389,11 +2390,15 @@ static void __split_huge_page(struct page *page, st= ruct list_head *list, __split_huge_page_tail(head, i, lruvec, list); /* Some pages can be beyond EOF: drop them from page cache */ if (head[i].index >=3D end) { - ClearPageDirty(head + i); - __delete_from_page_cache(head + i, NULL); + struct folio *tail =3D page_folio(head + i); + if (shmem_mapping(head->mapping)) shmem_uncharge(head->mapping->host, 1); - put_page(head + i); + else if (folio_test_clear_dirty(tail)) + folio_account_cleaned(tail, + inode_to_wb(folio->mapping->host)); + __filemap_remove_folio(tail, NULL); + folio_put(tail); } else if (!PageAnon(page)) { __xa_store(&head->mapping->i_pages, head[i].index, head + i, 0); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3066FC25B0E for ; Mon, 15 Aug 2022 21:13:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239886AbiHOVNH (ORCPT ); Mon, 15 Aug 2022 17:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347896AbiHOVHn (ORCPT ); Mon, 15 Aug 2022 17:07:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A1A35247C; Mon, 15 Aug 2022 12:16:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 01950B8107A; Mon, 15 Aug 2022 19:16:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D93BC433D6; Mon, 15 Aug 2022 19:16:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590980; bh=LirXWrjAmt9goQwEFSLoY6YoxSifPxKeann4ZciL/hg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jDUy/XulmV7Rs2QYyQgAtGFp0x6rb0iLrwYf1w+veivGJD2V7JbNBfWP7h5f2El+x ric1ruIkhRl7BBFx8V/tfd8XU3LySm0i59syzwnWdt9v6fCUkS8yDkNvDQzwAw+++K nhrnodNZhU4nyYU1EEuUV9Ipv2FK3LaSK4s3slWs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qian Cai , Herbert Xu , Sasha Levin Subject: [PATCH 5.18 0402/1095] crypto: arm64/gcm - Select AEAD for GHASH_ARM64_CE Date: Mon, 15 Aug 2022 19:56:41 +0200 Message-Id: <20220815180446.326140313@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qian Cai [ Upstream commit fac76f2260893dde5aa05bb693b4c13e8ed0454b ] Otherwise, we could fail to compile. ld: arch/arm64/crypto/ghash-ce-glue.o: in function 'ghash_ce_mod_exit': ghash-ce-glue.c:(.exit.text+0x24): undefined reference to 'crypto_unregiste= r_aead' ld: arch/arm64/crypto/ghash-ce-glue.o: in function 'ghash_ce_mod_init': ghash-ce-glue.c:(.init.text+0x34): undefined reference to 'crypto_register_= aead' Fixes: 537c1445ab0b ("crypto: arm64/gcm - implement native driver using v8 = Crypto Extensions") Signed-off-by: Qian Cai Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/crypto/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/crypto/Kconfig b/arch/arm64/crypto/Kconfig index 2a965aa0188d..bdca34283c06 100644 --- a/arch/arm64/crypto/Kconfig +++ b/arch/arm64/crypto/Kconfig @@ -59,6 +59,7 @@ config CRYPTO_GHASH_ARM64_CE select CRYPTO_HASH select CRYPTO_GF128MUL select CRYPTO_LIB_AES + select CRYPTO_AEAD =20 config CRYPTO_CRCT10DIF_ARM64_CE tristate "CRCT10DIF digest algorithm using PMULL instructions" --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 783B4C28B2C for ; Mon, 15 Aug 2022 21:18:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345308AbiHOVRo (ORCPT ); Mon, 15 Aug 2022 17:17:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347909AbiHOVHp (ORCPT ); Mon, 15 Aug 2022 17:07:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCB68D86F6; Mon, 15 Aug 2022 12:16:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5B1AD60F6A; Mon, 15 Aug 2022 19:16:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42AC7C433D6; Mon, 15 Aug 2022 19:16:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590983; bh=YcUUB4RedbZ+lubJgf+hTcDCMOcGMS1Aj3kO+WeMkUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ECNwkVlLNSeaUN9Dn052eEZip/jfKAW8H1tiFyQIS6SmbUvJXr6qUtGO8BA4LxuFE ze1DFU7iSdnDwD536INzdax4iaqCqcGRbZpK1Ivo33bCBghHwkIfJiYV3epOO37g+9 5BGEbkN98v775LizQeTFLWdafVgtHX+14ZkpNBgs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maciej Fijalkowski , Daniel Borkmann , Magnus Karlsson , Sasha Levin Subject: [PATCH 5.18 0403/1095] selftests/xsk: Destroy BPF resources only when ctx refcount drops to 0 Date: Mon, 15 Aug 2022 19:56:42 +0200 Message-Id: <20220815180446.369943806@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maciej Fijalkowski [ Upstream commit 39e940d4abfabb08b6937a315546b24d10be67e3 ] Currently, xsk_socket__delete frees BPF resources regardless of ctx refcount. Xdpxceiver has a test to verify whether underlying BPF resources would not be wiped out after closing XSK socket that was bound to interface with other active sockets. From library's xsk part perspective it also means that the internal xsk context is shared and its refcount is bumped accordingly. After a switch to loading XDP prog based on previously opened XSK socket, mentioned xdpxceiver test fails with: not ok 16 [xdpxceiver.c:swap_xsk_resources:1334]: ERROR: 9/"Bad file desc= riptor which means that in swap_xsk_resources(), xsk_socket__delete() released xskmap which in turn caused a failure of xsk_socket__update_xskmap(). To fix this, when deleting socket, decrement ctx refcount before releasing BPF resources and do so only when refcount dropped to 0 which means there are no more active sockets for this ctx so BPF resources can be freed safely. Fixes: 2f6324a3937f ("libbpf: Support shared umems between queues and devic= es") Signed-off-by: Maciej Fijalkowski Signed-off-by: Daniel Borkmann Acked-by: Magnus Karlsson Link: https://lore.kernel.org/bpf/20220629143458.934337-5-maciej.fijalkowsk= i@intel.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/lib/bpf/xsk.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c index af136f73b09d..67dc010e9fe3 100644 --- a/tools/lib/bpf/xsk.c +++ b/tools/lib/bpf/xsk.c @@ -1147,8 +1147,6 @@ int xsk_socket__create_shared(struct xsk_socket **xsk= _ptr, goto out_mmap_tx; } =20 - ctx->prog_fd =3D -1; - if (!(xsk->config.libbpf_flags & XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD)) { err =3D __xsk_setup_xdp_prog(xsk, NULL); if (err) @@ -1229,7 +1227,10 @@ void xsk_socket__delete(struct xsk_socket *xsk) =20 ctx =3D xsk->ctx; umem =3D ctx->umem; - if (ctx->prog_fd !=3D -1) { + + xsk_put_ctx(ctx, true); + + if (!ctx->refcount) { xsk_delete_bpf_maps(xsk); close(ctx->prog_fd); if (ctx->has_bpf_link) @@ -1248,8 +1249,6 @@ void xsk_socket__delete(struct xsk_socket *xsk) } } =20 - xsk_put_ctx(ctx, true); - umem->refcount--; /* Do not close an fd that also has an associated umem connected * to it. --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A15C0C00140 for ; Mon, 15 Aug 2022 21:12:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232452AbiHOVMi (ORCPT ); Mon, 15 Aug 2022 17:12:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347911AbiHOVHp (ORCPT ); Mon, 15 Aug 2022 17:07:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48CC452DFF; Mon, 15 Aug 2022 12:16:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F36D7B8107A; Mon, 15 Aug 2022 19:16:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52DC6C433C1; Mon, 15 Aug 2022 19:16:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590986; bh=4w1Henxr21HxdIOW24rJo+vlghp87PGzvVsvvHwWgHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1A22LiW/6Ek29wZoGlLR1C0iaevQ7G4GBQobEhjnr+7wtqemaD8WUVCVr3wgTDXbY Z4b1XjfHyPqCteNHmZ/sW+JllxBI6jBrLbxiUh7lwFGKj4BnS7Rp3yh2Utgyv7mslw yssq77dSiHxiIgfDZSLuHXYQ22yLCA0K6oge7vA4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0404/1095] net: mscc: ocelot: delete ocelot_port :: xmit_template Date: Mon, 15 Aug 2022 19:56:43 +0200 Message-Id: <20220815180446.421996832@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 15f6d01e4829cd2a2dc4f02a00c51d7cec1c736d ] This is no longer used since commit 7c4bb540e917 ("net: dsa: tag_ocelot: create separate tagger for Seville"). Signed-off-by: Vladimir Oltean Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/soc/mscc/ocelot.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 9b4e6c78d0f4..b191f0a7fe26 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -663,7 +663,6 @@ struct ocelot_port { =20 phy_interface_t phy_mode; =20 - u8 *xmit_template; bool is_dsa_8021q_cpu; bool learn_ena; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 917E6C25B08 for ; Mon, 15 Aug 2022 21:09:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244165AbiHOVJd (ORCPT ); Mon, 15 Aug 2022 17:09:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243106AbiHOVFI (ORCPT ); Mon, 15 Aug 2022 17:05:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A60151A0E; Mon, 15 Aug 2022 12:14:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AF685B810C6; Mon, 15 Aug 2022 19:14:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F28F3C433D6; Mon, 15 Aug 2022 19:14:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590892; bh=BAEcyU3+ShsFXc6JgX0vieoDWdx4El55H+ZjK+qyTOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=re7yNE4C08PXBfdXIWgdFu42FiukIZwkCP7Qv89qsmenzteUFtxAe9PPl98NWTNyo MvWOEn9MVtWDr8FHRsriSf6Eu7Dc3aMjoxGPYaBSx+fgLC2v2IjPE0psqRmRPsv7vP cJVBLb3L+MxZOcTp1OhuaJK5GQqG//r6TixLq62o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0405/1095] net: mscc: ocelot: minimize holes in struct ocelot_port Date: Mon, 15 Aug 2022 19:56:44 +0200 Message-Id: <20220815180446.469088623@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 6d0be600477089026c76fe529bd96fad4cf69c3b ] Reorder members of struct ocelot_port to eliminate holes and reduce structure size. Pahole says: Before: struct ocelot_port { struct ocelot * ocelot; /* 0 8 */ struct regmap * target; /* 8 8 */ bool vlan_aware; /* 16 1 */ /* XXX 7 bytes hole, try to pack */ const struct ocelot_bridge_vlan * pvid_vlan; /* 24 8 */ unsigned int ptp_skbs_in_flight; /* 32 4 */ u8 ptp_cmd; /* 36 1 */ /* XXX 3 bytes hole, try to pack */ struct sk_buff_head tx_skbs; /* 40 96 */ /* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */ u8 ts_id; /* 136 1 */ /* XXX 3 bytes hole, try to pack */ phy_interface_t phy_mode; /* 140 4 */ bool is_dsa_8021q_cpu; /* 144 1 */ bool learn_ena; /* 145 1 */ /* XXX 6 bytes hole, try to pack */ struct net_device * bond; /* 152 8 */ bool lag_tx_active; /* 160 1 */ /* XXX 1 byte hole, try to pack */ u16 mrp_ring_id; /* 162 2 */ /* XXX 4 bytes hole, try to pack */ struct net_device * bridge; /* 168 8 */ int bridge_num; /* 176 4 */ u8 stp_state; /* 180 1 */ /* XXX 3 bytes hole, try to pack */ int speed; /* 184 4 */ /* size: 192, cachelines: 3, members: 18 */ /* sum members: 161, holes: 7, sum holes: 27 */ /* padding: 4 */ }; After: struct ocelot_port { struct ocelot * ocelot; /* 0 8 */ struct regmap * target; /* 8 8 */ struct net_device * bond; /* 16 8 */ struct net_device * bridge; /* 24 8 */ const struct ocelot_bridge_vlan * pvid_vlan; /* 32 8 */ phy_interface_t phy_mode; /* 40 4 */ unsigned int ptp_skbs_in_flight; /* 44 4 */ struct sk_buff_head tx_skbs; /* 48 96 */ /* --- cacheline 2 boundary (128 bytes) was 16 bytes ago --- */ u16 mrp_ring_id; /* 144 2 */ u8 ptp_cmd; /* 146 1 */ u8 ts_id; /* 147 1 */ u8 stp_state; /* 148 1 */ bool vlan_aware; /* 149 1 */ bool is_dsa_8021q_cpu; /* 150 1 */ bool learn_ena; /* 151 1 */ bool lag_tx_active; /* 152 1 */ /* XXX 3 bytes hole, try to pack */ int bridge_num; /* 156 4 */ int speed; /* 160 4 */ /* size: 168, cachelines: 3, members: 18 */ /* sum members: 161, holes: 1, sum holes: 3 */ /* padding: 4 */ /* last cacheline: 40 bytes */ }; Signed-off-by: Vladimir Oltean Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/soc/mscc/ocelot.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index b191f0a7fe26..bae2ddb06731 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -652,28 +652,30 @@ struct ocelot_port { =20 struct regmap *target; =20 - bool vlan_aware; + struct net_device *bond; + struct net_device *bridge; + /* VLAN that untagged frames are classified to, on ingress */ const struct ocelot_bridge_vlan *pvid_vlan; =20 + phy_interface_t phy_mode; + unsigned int ptp_skbs_in_flight; - u8 ptp_cmd; struct sk_buff_head tx_skbs; - u8 ts_id; =20 - phy_interface_t phy_mode; + u16 mrp_ring_id; =20 + u8 ptp_cmd; + u8 ts_id; + + u8 stp_state; + bool vlan_aware; bool is_dsa_8021q_cpu; bool learn_ena; =20 - struct net_device *bond; bool lag_tx_active; =20 - u16 mrp_ring_id; - - struct net_device *bridge; int bridge_num; - u8 stp_state; =20 int speed; }; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 461A0C00140 for ; Mon, 15 Aug 2022 21:09:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243612AbiHOVJs (ORCPT ); Mon, 15 Aug 2022 17:09:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244998AbiHOVFc (ORCPT ); Mon, 15 Aug 2022 17:05:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAFC4D5983; Mon, 15 Aug 2022 12:14:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B005EB81115; Mon, 15 Aug 2022 19:14:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1047BC433D6; Mon, 15 Aug 2022 19:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590895; bh=+bRa1Wac3tRBRCGhwGcVo8I1ZbysVjIHLl5NfJO/eqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ipdy+mzhtEfl/4/VHGa4NAUCAqWCQJA/41kPxviAnY2c//U+HbgRwiDirpMEID3m4 fo4KWNEZBCdxYGWtcGNO3oc0TxZIdVwYBGe9HFs4iq0fudbwtCJq9DWj4yn4Nk17h0 Oiedz5ayjlL6XjlBGQG4GVU/5bqqtqAhOlZkqGr0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaoliang Yang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 0406/1095] net: dsa: felix: update base time of time-aware shaper when adjusting PTP time Date: Mon, 15 Aug 2022 19:56:45 +0200 Message-Id: <20220815180446.506318599@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiaoliang Yang [ Upstream commit 8670dc33f48bab4d7bb4b8d0232f17f4dae419ec ] When adjusting the PTP clock, the base time of the TAS configuration will become unreliable. We need reset the TAS configuration by using a new base time. For example, if the driver gets a base time 0 of Qbv configuration from user, and current time is 20000. The driver will set the TAS base time to be 20000. After the PTP clock adjustment, the current time becomes 10000. If the TAS base time is still 20000, it will be a future time, and TAS entry list will stop running. Another example, if the current time becomes to be 10000000 after PTP clock adjust, a large time offset can cause the hardware to hang. This patch introduces a tas_clock_adjust() function to reset the TAS module by using a new base time after the PTP clock adjustment. This can avoid issues above. Due to PTP clock adjustment can occur at any time, it may conflict with the TAS configuration. We introduce a new TAS lock to serialize the access to the TAS registers. Signed-off-by: Xiaoliang Yang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/dsa/ocelot/felix_vsc9959.c | 83 ++++++++++++++++++++++++-- drivers/net/ethernet/mscc/ocelot.c | 1 + drivers/net/ethernet/mscc/ocelot_ptp.c | 8 +++ include/soc/mscc/ocelot.h | 7 +++ 4 files changed, 93 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelo= t/felix_vsc9959.c index 4a071f96ea28..f21d9ff40af3 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1193,10 +1193,13 @@ static void vsc9959_tas_gcl_set(struct ocelot *ocel= ot, const u32 gcl_ix, static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, struct tc_taprio_qopt_offload *taprio) { + struct ocelot_port *ocelot_port =3D ocelot->ports[port]; struct timespec64 base_ts; int ret, i; u32 val; =20 + mutex_lock(&ocelot->tas_lock); + if (!taprio->enable) { ocelot_rmw_rix(ocelot, QSYS_TAG_CONFIG_INIT_GATE_STATE(0xFF), @@ -1204,15 +1207,20 @@ static int vsc9959_qos_port_tas_set(struct ocelot *= ocelot, int port, QSYS_TAG_CONFIG_INIT_GATE_STATE_M, QSYS_TAG_CONFIG, port); =20 + mutex_unlock(&ocelot->tas_lock); return 0; } =20 if (taprio->cycle_time > NSEC_PER_SEC || - taprio->cycle_time_extension >=3D NSEC_PER_SEC) - return -EINVAL; + taprio->cycle_time_extension >=3D NSEC_PER_SEC) { + ret =3D -EINVAL; + goto err; + } =20 - if (taprio->num_entries > VSC9959_TAS_GCL_ENTRY_MAX) - return -ERANGE; + if (taprio->num_entries > VSC9959_TAS_GCL_ENTRY_MAX) { + ret =3D -ERANGE; + goto err; + } =20 /* Enable guard band. The switch will schedule frames without taking * their length into account. Thus we'll always need to enable the @@ -1233,8 +1241,10 @@ static int vsc9959_qos_port_tas_set(struct ocelot *o= celot, int port, * config is pending, need reset the TAS module */ val =3D ocelot_read(ocelot, QSYS_PARAM_STATUS_REG_8); - if (val & QSYS_PARAM_STATUS_REG_8_CONFIG_PENDING) - return -EBUSY; + if (val & QSYS_PARAM_STATUS_REG_8_CONFIG_PENDING) { + ret =3D -EBUSY; + goto err; + } =20 ocelot_rmw_rix(ocelot, QSYS_TAG_CONFIG_ENABLE | @@ -1245,6 +1255,8 @@ static int vsc9959_qos_port_tas_set(struct ocelot *oc= elot, int port, QSYS_TAG_CONFIG_SCH_TRAFFIC_QUEUES_M, QSYS_TAG_CONFIG, port); =20 + ocelot_port->base_time =3D taprio->base_time; + vsc9959_new_base_time(ocelot, taprio->base_time, taprio->cycle_time, &base_ts); ocelot_write(ocelot, base_ts.tv_nsec, QSYS_PARAM_CFG_REG_1); @@ -1268,9 +1280,67 @@ static int vsc9959_qos_port_tas_set(struct ocelot *o= celot, int port, !(val & QSYS_TAS_PARAM_CFG_CTRL_CONFIG_CHANGE), 10, 100000); =20 +err: + mutex_unlock(&ocelot->tas_lock); + return ret; } =20 +static void vsc9959_tas_clock_adjust(struct ocelot *ocelot) +{ + struct ocelot_port *ocelot_port; + struct timespec64 base_ts; + u64 cycletime; + int port; + u32 val; + + mutex_lock(&ocelot->tas_lock); + + for (port =3D 0; port < ocelot->num_phys_ports; port++) { + val =3D ocelot_read_rix(ocelot, QSYS_TAG_CONFIG, port); + if (!(val & QSYS_TAG_CONFIG_ENABLE)) + continue; + + ocelot_rmw(ocelot, + QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM(port), + QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM_M, + QSYS_TAS_PARAM_CFG_CTRL); + + ocelot_rmw_rix(ocelot, + QSYS_TAG_CONFIG_INIT_GATE_STATE(0xFF), + QSYS_TAG_CONFIG_ENABLE | + QSYS_TAG_CONFIG_INIT_GATE_STATE_M, + QSYS_TAG_CONFIG, port); + + cycletime =3D ocelot_read(ocelot, QSYS_PARAM_CFG_REG_4); + ocelot_port =3D ocelot->ports[port]; + + vsc9959_new_base_time(ocelot, ocelot_port->base_time, + cycletime, &base_ts); + + ocelot_write(ocelot, base_ts.tv_nsec, QSYS_PARAM_CFG_REG_1); + ocelot_write(ocelot, lower_32_bits(base_ts.tv_sec), + QSYS_PARAM_CFG_REG_2); + val =3D upper_32_bits(base_ts.tv_sec); + ocelot_rmw(ocelot, + QSYS_PARAM_CFG_REG_3_BASE_TIME_SEC_MSB(val), + QSYS_PARAM_CFG_REG_3_BASE_TIME_SEC_MSB_M, + QSYS_PARAM_CFG_REG_3); + + ocelot_rmw(ocelot, QSYS_TAS_PARAM_CFG_CTRL_CONFIG_CHANGE, + QSYS_TAS_PARAM_CFG_CTRL_CONFIG_CHANGE, + QSYS_TAS_PARAM_CFG_CTRL); + + ocelot_rmw_rix(ocelot, + QSYS_TAG_CONFIG_INIT_GATE_STATE(0xFF) | + QSYS_TAG_CONFIG_ENABLE, + QSYS_TAG_CONFIG_ENABLE | + QSYS_TAG_CONFIG_INIT_GATE_STATE_M, + QSYS_TAG_CONFIG, port); + } + mutex_unlock(&ocelot->tas_lock); +} + static int vsc9959_qos_port_cbs_set(struct dsa_switch *ds, int port, struct tc_cbs_qopt_offload *cbs_qopt) { @@ -2210,6 +2280,7 @@ static const struct ocelot_ops vsc9959_ops =3D { .psfp_filter_del =3D vsc9959_psfp_filter_del, .psfp_stats_get =3D vsc9959_psfp_stats_get, .cut_through_fwd =3D vsc9959_cut_through_fwd, + .tas_clock_adjust =3D vsc9959_tas_clock_adjust, }; =20 static const struct felix_info felix_info_vsc9959 =3D { diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc= /ocelot.c index 20ceac81a2c2..497077726916 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -3245,6 +3245,7 @@ int ocelot_init(struct ocelot *ocelot) mutex_init(&ocelot->ptp_lock); mutex_init(&ocelot->mact_lock); mutex_init(&ocelot->fwd_domain_lock); + mutex_init(&ocelot->tas_lock); spin_lock_init(&ocelot->ptp_clock_lock); spin_lock_init(&ocelot->ts_id_lock); snprintf(queue_name, sizeof(queue_name), "%s-stats", diff --git a/drivers/net/ethernet/mscc/ocelot_ptp.c b/drivers/net/ethernet/= mscc/ocelot_ptp.c index 87ad2137ba06..09c703efe946 100644 --- a/drivers/net/ethernet/mscc/ocelot_ptp.c +++ b/drivers/net/ethernet/mscc/ocelot_ptp.c @@ -72,6 +72,10 @@ int ocelot_ptp_settime64(struct ptp_clock_info *ptp, ocelot_write_rix(ocelot, val, PTP_PIN_CFG, TOD_ACC_PIN); =20 spin_unlock_irqrestore(&ocelot->ptp_clock_lock, flags); + + if (ocelot->ops->tas_clock_adjust) + ocelot->ops->tas_clock_adjust(ocelot); + return 0; } EXPORT_SYMBOL(ocelot_ptp_settime64); @@ -105,6 +109,9 @@ int ocelot_ptp_adjtime(struct ptp_clock_info *ptp, s64 = delta) ocelot_write_rix(ocelot, val, PTP_PIN_CFG, TOD_ACC_PIN); =20 spin_unlock_irqrestore(&ocelot->ptp_clock_lock, flags); + + if (ocelot->ops->tas_clock_adjust) + ocelot->ops->tas_clock_adjust(ocelot); } else { /* Fall back using ocelot_ptp_settime64 which is not exact. */ struct timespec64 ts; @@ -117,6 +124,7 @@ int ocelot_ptp_adjtime(struct ptp_clock_info *ptp, s64 = delta) =20 ocelot_ptp_settime64(ptp, &ts); } + return 0; } EXPORT_SYMBOL(ocelot_ptp_adjtime); diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index bae2ddb06731..b944fc670c72 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -568,6 +568,7 @@ struct ocelot_ops { int (*psfp_stats_get)(struct ocelot *ocelot, struct flow_cls_offload *f, struct flow_stats *stats); void (*cut_through_fwd)(struct ocelot *ocelot); + void (*tas_clock_adjust)(struct ocelot *ocelot); }; =20 struct ocelot_vcap_policer { @@ -678,6 +679,9 @@ struct ocelot_port { int bridge_num; =20 int speed; + + /* Store the AdminBaseTime of EST fetched from userspace. */ + s64 base_time; }; =20 struct ocelot { @@ -744,6 +748,9 @@ struct ocelot { /* Lock for serializing forwarding domain changes */ struct mutex fwd_domain_lock; =20 + /* Lock for serializing Time-Aware Shaper changes */ + struct mutex tas_lock; + struct workqueue_struct *owq; =20 u8 ptp:1; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35AEEC00140 for ; Mon, 15 Aug 2022 21:09:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232063AbiHOVJj (ORCPT ); Mon, 15 Aug 2022 17:09:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244915AbiHOVFb (ORCPT ); Mon, 15 Aug 2022 17:05:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF9C9D5985; Mon, 15 Aug 2022 12:14:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0E32C60EF0; Mon, 15 Aug 2022 19:14:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 107E2C433D6; Mon, 15 Aug 2022 19:14:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590898; bh=A8eKkdgs0YzVymdzU8dECFJ/F2mnGOelqyLESFLxkg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZlobHPjJbJyUj7aggrQ4WqEt+h7413xB5O+NFXeev0KXOw3ID5qPSDuTns9vbn3rK IU9juZtqhjZ0zTXbW9jseeoQ512DjPENpCF5vYn60F669X4neXEjQm1SCVtGue/TxV 3qbhsojs1KhaNSQaQ9TM50H7JgvSyBA9/+1ymsi4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0407/1095] net: dsa: felix: keep reference on entire tc-taprio config Date: Mon, 15 Aug 2022 19:56:46 +0200 Message-Id: <20220815180446.545983881@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 1c9017e44af2eee94b1001af18c401ae440ad77c ] In a future change we will need to remember the entire tc-taprio config on all ports rather than just the base time, so use the taprio_offload_get() helper function to replace ocelot_port->base_time with ocelot_port->taprio. Signed-off-by: Vladimir Oltean Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/dsa/ocelot/felix_vsc9959.c | 23 +++++++++++++---------- include/soc/mscc/ocelot.h | 5 ++--- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelo= t/felix_vsc9959.c index f21d9ff40af3..3d86f061802d 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1207,6 +1207,9 @@ static int vsc9959_qos_port_tas_set(struct ocelot *oc= elot, int port, QSYS_TAG_CONFIG_INIT_GATE_STATE_M, QSYS_TAG_CONFIG, port); =20 + taprio_offload_free(ocelot_port->taprio); + ocelot_port->taprio =3D NULL; + mutex_unlock(&ocelot->tas_lock); return 0; } @@ -1255,8 +1258,6 @@ static int vsc9959_qos_port_tas_set(struct ocelot *oc= elot, int port, QSYS_TAG_CONFIG_SCH_TRAFFIC_QUEUES_M, QSYS_TAG_CONFIG, port); =20 - ocelot_port->base_time =3D taprio->base_time; - vsc9959_new_base_time(ocelot, taprio->base_time, taprio->cycle_time, &base_ts); ocelot_write(ocelot, base_ts.tv_nsec, QSYS_PARAM_CFG_REG_1); @@ -1279,6 +1280,10 @@ static int vsc9959_qos_port_tas_set(struct ocelot *o= celot, int port, ret =3D readx_poll_timeout(vsc9959_tas_read_cfg_status, ocelot, val, !(val & QSYS_TAS_PARAM_CFG_CTRL_CONFIG_CHANGE), 10, 100000); + if (ret) + goto err; + + ocelot_port->taprio =3D taprio_offload_get(taprio); =20 err: mutex_unlock(&ocelot->tas_lock); @@ -1288,17 +1293,18 @@ static int vsc9959_qos_port_tas_set(struct ocelot *= ocelot, int port, =20 static void vsc9959_tas_clock_adjust(struct ocelot *ocelot) { + struct tc_taprio_qopt_offload *taprio; struct ocelot_port *ocelot_port; struct timespec64 base_ts; - u64 cycletime; int port; u32 val; =20 mutex_lock(&ocelot->tas_lock); =20 for (port =3D 0; port < ocelot->num_phys_ports; port++) { - val =3D ocelot_read_rix(ocelot, QSYS_TAG_CONFIG, port); - if (!(val & QSYS_TAG_CONFIG_ENABLE)) + ocelot_port =3D ocelot->ports[port]; + taprio =3D ocelot_port->taprio; + if (!taprio) continue; =20 ocelot_rmw(ocelot, @@ -1312,11 +1318,8 @@ static void vsc9959_tas_clock_adjust(struct ocelot *= ocelot) QSYS_TAG_CONFIG_INIT_GATE_STATE_M, QSYS_TAG_CONFIG, port); =20 - cycletime =3D ocelot_read(ocelot, QSYS_PARAM_CFG_REG_4); - ocelot_port =3D ocelot->ports[port]; - - vsc9959_new_base_time(ocelot, ocelot_port->base_time, - cycletime, &base_ts); + vsc9959_new_base_time(ocelot, taprio->base_time, + taprio->cycle_time, &base_ts); =20 ocelot_write(ocelot, base_ts.tv_nsec, QSYS_PARAM_CFG_REG_1); ocelot_write(ocelot, lower_32_bits(base_ts.tv_sec), diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index b944fc670c72..c90a9a2f77a9 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -659,6 +659,8 @@ struct ocelot_port { /* VLAN that untagged frames are classified to, on ingress */ const struct ocelot_bridge_vlan *pvid_vlan; =20 + struct tc_taprio_qopt_offload *taprio; + phy_interface_t phy_mode; =20 unsigned int ptp_skbs_in_flight; @@ -679,9 +681,6 @@ struct ocelot_port { int bridge_num; =20 int speed; - - /* Store the AdminBaseTime of EST fetched from userspace. */ - s64 base_time; }; =20 struct ocelot { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C363CC00140 for ; Mon, 15 Aug 2022 21:10:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231543AbiHOVKD (ORCPT ); Mon, 15 Aug 2022 17:10:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245426AbiHOVFi (ORCPT ); Mon, 15 Aug 2022 17:05:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4084BD5998; Mon, 15 Aug 2022 12:15:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7035060FAD; Mon, 15 Aug 2022 19:15:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23BDAC433C1; Mon, 15 Aug 2022 19:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590901; bh=hlTMO6StVjgA7lCnI1PFiwsjzZjPcRcDbDThBJl/KSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HHaQnZdnG3hl6mlGykXuBpvHNfcFPB/FEpR7FDLoaLYuJYgeqr9RLeZ9sYsueTDc+ 31JALdhNpi0WtEEPzlgTh1BMT6U2maJRqihU3T8up0NkdnSxHDca5fbZkLrskRK81S vil15TuFLqZXN8npCvt7eR72RpNe4YJcUIxoaaNc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richie Pearn , Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0408/1095] net: dsa: felix: drop oversized frames with tc-taprio instead of hanging the port Date: Mon, 15 Aug 2022 19:56:47 +0200 Message-Id: <20220815180446.586534815@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 55a515b1f5a97df5704a1788fe97a4a740be2b9e ] Currently, sending a packet into a time gate too small for it (or always closed) causes the queue system to hold the frame forever. Even worse, this frame isn't subject to aging either, because for that to happen, it needs to be scheduled for transmission in the first place. But the frame will consume buffer memory and frame references while it is forever held in the queue system. Before commit a4ae997adcbd ("net: mscc: ocelot: initialize watermarks to sane defaults"), this behavior was somewhat subtle, as the switch had a more intricately tuned default watermark configuration out of reset, which did not allow any single port and tc to consume the entire switch buffer space. Nonetheless, the held frames are still there, and they reduce the total backplane capacity of the switch. However, after the aforementioned commit, the behavior can be very clearly seen, since we deliberately allow each {port, tc} to consume the entire shared buffer of the switch minus the reservations (and we disable all reservations by default). That is to say, we allow a permanently closed tc-taprio gate to hang the entire switch. A careful inspection of the documentation shows that the QSYS:Q_MAX_SDU per-port-tc registers serve 2 purposes: one is for guard band calculation (when zero, this falls back to QSYS:PORT_MAX_SDU), and the other is to enable oversized frame dropping (when non-zero). Currently the QSYS:Q_MAX_SDU registers are all zero, so oversized frame dropping is disabled. The goal of the change is to enable it seamlessly. For that, we need to hook into the MTU change, tc-taprio change, and port link speed change procedures, since we depend on these variables. Frames are not dropped on egress due to a queue system oversize condition, instead that egress port is simply excluded from the mask of valid destination ports for the packet. If there are no destination ports at all, the ingress counter that increments is the generic "drop_tail" in ethtool -S. The issue exists in various forms since the tc-taprio offload was introduce= d. Fixes: de143c0e274b ("net: dsa: felix: Configure Time-Aware Scheduler via t= aprio offload") Reported-by: Richie Pearn Signed-off-by: Vladimir Oltean Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/dsa/ocelot/felix.c | 9 ++ drivers/net/dsa/ocelot/felix.h | 1 + drivers/net/dsa/ocelot/felix_vsc9959.c | 201 +++++++++++++++++++++++++ 3 files changed, 211 insertions(+) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index faccfb3f0158..d95c2c0a64bd 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1613,9 +1613,18 @@ static void felix_txtstamp(struct dsa_switch *ds, in= t port, static int felix_change_mtu(struct dsa_switch *ds, int port, int new_mtu) { struct ocelot *ocelot =3D ds->priv; + struct ocelot_port *ocelot_port =3D ocelot->ports[port]; + struct felix *felix =3D ocelot_to_felix(ocelot); =20 ocelot_port_set_maxlen(ocelot, port, new_mtu); =20 + mutex_lock(&ocelot->tas_lock); + + if (ocelot_port->taprio && felix->info->tas_guard_bands_update) + felix->info->tas_guard_bands_update(ocelot, port); + + mutex_unlock(&ocelot->tas_lock); + return 0; } =20 diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h index f083b06fdfe9..b0e4635a8cc2 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -53,6 +53,7 @@ struct felix_info { struct phylink_link_state *state); int (*port_setup_tc)(struct dsa_switch *ds, int port, enum tc_setup_type type, void *type_data); + void (*tas_guard_bands_update)(struct ocelot *ocelot, int port); void (*port_sched_speed_set)(struct ocelot *ocelot, int port, u32 speed); struct regmap *(*init_regmap)(struct ocelot *ocelot, diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelo= t/felix_vsc9959.c index 3d86f061802d..6bb5c5ef339b 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1124,9 +1124,199 @@ static void vsc9959_mdio_bus_free(struct ocelot *oc= elot) mdiobus_free(felix->imdio); } =20 +/* Extract shortest continuous gate open intervals in ns for each traffic = class + * of a cyclic tc-taprio schedule. If a gate is always open, the duration = is + * considered U64_MAX. If the gate is always closed, it is considered 0. + */ +static void vsc9959_tas_min_gate_lengths(struct tc_taprio_qopt_offload *ta= prio, + u64 min_gate_len[OCELOT_NUM_TC]) +{ + struct tc_taprio_sched_entry *entry; + u64 gate_len[OCELOT_NUM_TC]; + int tc, i, n; + + /* Initialize arrays */ + for (tc =3D 0; tc < OCELOT_NUM_TC; tc++) { + min_gate_len[tc] =3D U64_MAX; + gate_len[tc] =3D 0; + } + + /* If we don't have taprio, consider all gates as permanently open */ + if (!taprio) + return; + + n =3D taprio->num_entries; + + /* Walk through the gate list twice to determine the length + * of consecutively open gates for a traffic class, including + * open gates that wrap around. We are just interested in the + * minimum window size, and this doesn't change what the + * minimum is (if the gate never closes, min_gate_len will + * remain U64_MAX). + */ + for (i =3D 0; i < 2 * n; i++) { + entry =3D &taprio->entries[i % n]; + + for (tc =3D 0; tc < OCELOT_NUM_TC; tc++) { + if (entry->gate_mask & BIT(tc)) { + gate_len[tc] +=3D entry->interval; + } else { + /* Gate closes now, record a potential new + * minimum and reinitialize length + */ + if (min_gate_len[tc] > gate_len[tc]) + min_gate_len[tc] =3D gate_len[tc]; + gate_len[tc] =3D 0; + } + } + } +} + +/* Update QSYS_PORT_MAX_SDU to make sure the static guard bands added by t= he + * switch (see the ALWAYS_GUARD_BAND_SCH_Q comment) are correct at all MTU + * values (the default value is 1518). Also, for traffic class windows sma= ller + * than one MTU sized frame, update QSYS_QMAXSDU_CFG to enable oversized f= rame + * dropping, such that these won't hang the port, as they will never be se= nt. + */ +static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port) +{ + struct ocelot_port *ocelot_port =3D ocelot->ports[port]; + u64 min_gate_len[OCELOT_NUM_TC]; + int speed, picos_per_byte; + u64 needed_bit_time_ps; + u32 val, maxlen; + u8 tas_speed; + int tc; + + lockdep_assert_held(&ocelot->tas_lock); + + val =3D ocelot_read_rix(ocelot, QSYS_TAG_CONFIG, port); + tas_speed =3D QSYS_TAG_CONFIG_LINK_SPEED_X(val); + + switch (tas_speed) { + case OCELOT_SPEED_10: + speed =3D SPEED_10; + break; + case OCELOT_SPEED_100: + speed =3D SPEED_100; + break; + case OCELOT_SPEED_1000: + speed =3D SPEED_1000; + break; + case OCELOT_SPEED_2500: + speed =3D SPEED_2500; + break; + default: + return; + } + + picos_per_byte =3D (USEC_PER_SEC * 8) / speed; + + val =3D ocelot_port_readl(ocelot_port, DEV_MAC_MAXLEN_CFG); + /* MAXLEN_CFG accounts automatically for VLAN. We need to include it + * manually in the bit time calculation, plus the preamble and SFD. + */ + maxlen =3D val + 2 * VLAN_HLEN; + /* Consider the standard Ethernet overhead of 8 octets preamble+SFD, + * 4 octets FCS, 12 octets IFG. + */ + needed_bit_time_ps =3D (maxlen + 24) * picos_per_byte; + + dev_dbg(ocelot->dev, + "port %d: max frame size %d needs %llu ps at speed %d\n", + port, maxlen, needed_bit_time_ps, speed); + + vsc9959_tas_min_gate_lengths(ocelot_port->taprio, min_gate_len); + + for (tc =3D 0; tc < OCELOT_NUM_TC; tc++) { + u32 max_sdu; + + if (min_gate_len[tc] =3D=3D U64_MAX /* Gate always open */ || + min_gate_len[tc] * 1000 > needed_bit_time_ps) { + /* Setting QMAXSDU_CFG to 0 disables oversized frame + * dropping. + */ + max_sdu =3D 0; + dev_dbg(ocelot->dev, + "port %d tc %d min gate len %llu" + ", sending all frames\n", + port, tc, min_gate_len[tc]); + } else { + /* If traffic class doesn't support a full MTU sized + * frame, make sure to enable oversize frame dropping + * for frames larger than the smallest that would fit. + */ + max_sdu =3D div_u64(min_gate_len[tc] * 1000, + picos_per_byte); + /* A TC gate may be completely closed, which is a + * special case where all packets are oversized. + * Any limit smaller than 64 octets accomplishes this + */ + if (!max_sdu) + max_sdu =3D 1; + /* Take L1 overhead into account, but just don't allow + * max_sdu to go negative or to 0. Here we use 20 + * because QSYS_MAXSDU_CFG_* already counts the 4 FCS + * octets as part of packet size. + */ + if (max_sdu > 20) + max_sdu -=3D 20; + dev_info(ocelot->dev, + "port %d tc %d min gate length %llu" + " ns not enough for max frame size %d at %d" + " Mbps, dropping frames over %d" + " octets including FCS\n", + port, tc, min_gate_len[tc], maxlen, speed, + max_sdu); + } + + /* ocelot_write_rix is a macro that concatenates + * QSYS_MAXSDU_CFG_* with _RSZ, so we need to spell out + * the writes to each traffic class + */ + switch (tc) { + case 0: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_0, + port); + break; + case 1: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_1, + port); + break; + case 2: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_2, + port); + break; + case 3: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_3, + port); + break; + case 4: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_4, + port); + break; + case 5: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_5, + port); + break; + case 6: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_6, + port); + break; + case 7: + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_7, + port); + break; + } + } + + ocelot_write_rix(ocelot, maxlen, QSYS_PORT_MAX_SDU, port); +} + static void vsc9959_sched_speed_set(struct ocelot *ocelot, int port, u32 speed) { + struct ocelot_port *ocelot_port =3D ocelot->ports[port]; u8 tas_speed; =20 switch (speed) { @@ -1151,6 +1341,13 @@ static void vsc9959_sched_speed_set(struct ocelot *o= celot, int port, QSYS_TAG_CONFIG_LINK_SPEED(tas_speed), QSYS_TAG_CONFIG_LINK_SPEED_M, QSYS_TAG_CONFIG, port); + + mutex_lock(&ocelot->tas_lock); + + if (ocelot_port->taprio) + vsc9959_tas_guard_bands_update(ocelot, port); + + mutex_unlock(&ocelot->tas_lock); } =20 static void vsc9959_new_base_time(struct ocelot *ocelot, ktime_t base_time, @@ -1210,6 +1407,8 @@ static int vsc9959_qos_port_tas_set(struct ocelot *oc= elot, int port, taprio_offload_free(ocelot_port->taprio); ocelot_port->taprio =3D NULL; =20 + vsc9959_tas_guard_bands_update(ocelot, port); + mutex_unlock(&ocelot->tas_lock); return 0; } @@ -1284,6 +1483,7 @@ static int vsc9959_qos_port_tas_set(struct ocelot *oc= elot, int port, goto err; =20 ocelot_port->taprio =3D taprio_offload_get(taprio); + vsc9959_tas_guard_bands_update(ocelot, port); =20 err: mutex_unlock(&ocelot->tas_lock); @@ -2311,6 +2511,7 @@ static const struct felix_info felix_info_vsc9959 =3D= { .port_modes =3D vsc9959_port_modes, .port_setup_tc =3D vsc9959_port_setup_tc, .port_sched_speed_set =3D vsc9959_sched_speed_set, + .tas_guard_bands_update =3D vsc9959_tas_guard_bands_update, .init_regmap =3D ocelot_regmap_init, }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC6C4C00140 for ; Mon, 15 Aug 2022 21:10:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230189AbiHOVKS (ORCPT ); Mon, 15 Aug 2022 17:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343703AbiHOVFp (ORCPT ); Mon, 15 Aug 2022 17:05:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9369D59AD; Mon, 15 Aug 2022 12:15:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5491BB810C6; Mon, 15 Aug 2022 19:15:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7685DC433D7; Mon, 15 Aug 2022 19:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590904; bh=FxBN7LaxHEX1si3N7YKQqHSv/xxhqf4UY3m1TLZKvMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DdyxxYlt0XdlbaAPAvF8A7fqIbmhgt09X3dj4G6WGoFjA+lVSzD6oBvdEJyvoGq38 lLtDtgzFRPvA+6OgFAbI+LPpZb89zb8rfIGkf+mUb+1qIDSxgN6sS69XdffW5lGp9x gngSFcWsPWI34weyxZQyHSP+u4/ic1e7Ub2Uz/Zs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Sean Paul , Douglas Anderson , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.18 0409/1095] drm/rockchip: vop: Dont crash for invalid duplicate_state() Date: Mon, 15 Aug 2022 19:56:48 +0200 Message-Id: <20220815180446.629620476@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris [ Upstream commit 1449110b0dade8b638d2c17ab7c5b0ff696bfccb ] It's possible for users to try to duplicate the CRTC state even when the state doesn't exist. drm_atomic_helper_crtc_duplicate_state() (and other users of __drm_atomic_helper_crtc_duplicate_state()) already guard this with a WARN_ON() instead of crashing, so let's do that here too. Fixes: 4e257d9eee23 ("drm/rockchip: get rid of rockchip_drm_crtc_mode_confi= g") Signed-off-by: Brian Norris Reviewed-by: Sean Paul Reviewed-by: Douglas Anderson Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20220617172623.1.I62db2= 28170b1559ada60b8d3e1637e1688424926@changeid Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/= rockchip/rockchip_drm_vop.c index d53037531f40..26e24f62f75f 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1552,6 +1552,9 @@ static struct drm_crtc_state *vop_crtc_duplicate_stat= e(struct drm_crtc *crtc) { struct rockchip_crtc_state *rockchip_state; =20 + if (WARN_ON(!crtc->state)) + return NULL; + rockchip_state =3D kzalloc(sizeof(*rockchip_state), GFP_KERNEL); if (!rockchip_state) return NULL; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EE5EC25B08 for ; Mon, 15 Aug 2022 21:10:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241363AbiHOVK1 (ORCPT ); Mon, 15 Aug 2022 17:10:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343939AbiHOVFt (ORCPT ); Mon, 15 Aug 2022 17:05:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EF98D5DC1; Mon, 15 Aug 2022 12:15:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B10ED60F68; Mon, 15 Aug 2022 19:15:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07032C433D7; Mon, 15 Aug 2022 19:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590909; bh=RobEPk0ktDvBzpclkbB/iJ3rx8WyTbt0060Tx09Tb4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1SJb5p3dePnUNfEQq/DUsXZxjpwGKAzZI0XeqZRyAsDPDy9RpS+kUQKY8ii1vnfq4 nTYQK6Lyh/4NmEEqwl7FtV3vpm8W0CNrz5dbTdubJoTMosncj3zvzcszWvM4MJdcYa Lf+AsOkrilaVfSgUDfa4Tw7y4LlvZrjvsZoizL1Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.18 0410/1095] drm/rockchip: Fix an error handling path rockchip_dp_probe() Date: Mon, 15 Aug 2022 19:56:49 +0200 Message-Id: <20220815180446.673524098@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 5074376822fe99fa4ce344b851c5016d00c0444f ] Should component_add() fail, we should call analogix_dp_remove() in the error handling path, as already done in the remove function. Fixes: 152cce0006ab ("drm/bridge: analogix_dp: Split bind() into probe() an= d real bind()") Signed-off-by: Christophe JAILLET Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/b719d9061bb97eb85145fbd= 3c5e63f4549f2e13e.1655572071.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/= drm/rockchip/analogix_dp-rockchip.c index c82901d9a9cc..8a9bb618f872 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -398,7 +398,15 @@ static int rockchip_dp_probe(struct platform_device *p= dev) if (IS_ERR(dp->adp)) return PTR_ERR(dp->adp); =20 - return component_add(dev, &rockchip_dp_component_ops); + ret =3D component_add(dev, &rockchip_dp_component_ops); + if (ret) + goto err_dp_remove; + + return 0; + +err_dp_remove: + analogix_dp_remove(dp->adp); + return ret; } =20 static int rockchip_dp_remove(struct platform_device *pdev) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16BBFC00140 for ; Mon, 15 Aug 2022 21:11:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233346AbiHOVKe (ORCPT ); Mon, 15 Aug 2022 17:10:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344994AbiHOVGC (ORCPT ); Mon, 15 Aug 2022 17:06:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D3C9D5DEA; Mon, 15 Aug 2022 12:15:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A14E86009B; Mon, 15 Aug 2022 19:15:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8DEFC433B5; Mon, 15 Aug 2022 19:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590912; bh=NDaqN0HN4Lw9xKA+GYcUn8lKUCBj57SDn6sS5RzJY98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=be7B401GkXp190PFOa1w+1ldwmm0+7s8UmSIRRWIKrgiu8+RtddBTHLhBE55XDQJQ EFcrI3/G9x4IH2Npwwo+fXDhJ4Gk7MR6t83Kuu1Pcm4zKXM0X1cDMLy1v1Db39O38d 4Ewck4pQiyaJWzw3+H8M6cFQYTp2SDQ3YsENb0FA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bo-Chen Chen , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.18 0411/1095] drm/mediatek: dpi: Remove output format of YUV Date: Mon, 15 Aug 2022 19:56:50 +0200 Message-Id: <20220815180446.707640223@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bo-Chen Chen [ Upstream commit c9ed0713b3c35fc45677707ba47f432cad95da56 ] DPI is not support output format as YUV, but there is the setting of configuring output YUV. Therefore, remove them in this patch. Fixes: 9e629c17aa8d ("drm/mediatek: Add DPI sub driver") Signed-off-by: Bo-Chen Chen Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20220701035= 845.16458-5-rex-bc.chen@mediatek.com/ Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/mediatek/mtk_dpi.c | 31 ++++++------------------------ 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/= mtk_dpi.c index e61cd67b978f..675e2e4072df 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c @@ -54,13 +54,7 @@ enum mtk_dpi_out_channel_swap { }; =20 enum mtk_dpi_out_color_format { - MTK_DPI_COLOR_FORMAT_RGB, - MTK_DPI_COLOR_FORMAT_RGB_FULL, - MTK_DPI_COLOR_FORMAT_YCBCR_444, - MTK_DPI_COLOR_FORMAT_YCBCR_422, - MTK_DPI_COLOR_FORMAT_XV_YCC, - MTK_DPI_COLOR_FORMAT_YCBCR_444_FULL, - MTK_DPI_COLOR_FORMAT_YCBCR_422_FULL + MTK_DPI_COLOR_FORMAT_RGB }; =20 struct mtk_dpi { @@ -364,24 +358,11 @@ static void mtk_dpi_config_disable_edge(struct mtk_dp= i *dpi) static void mtk_dpi_config_color_format(struct mtk_dpi *dpi, enum mtk_dpi_out_color_format format) { - if ((format =3D=3D MTK_DPI_COLOR_FORMAT_YCBCR_444) || - (format =3D=3D MTK_DPI_COLOR_FORMAT_YCBCR_444_FULL)) { - mtk_dpi_config_yuv422_enable(dpi, false); - mtk_dpi_config_csc_enable(dpi, true); - mtk_dpi_config_swap_input(dpi, false); - mtk_dpi_config_channel_swap(dpi, MTK_DPI_OUT_CHANNEL_SWAP_BGR); - } else if ((format =3D=3D MTK_DPI_COLOR_FORMAT_YCBCR_422) || - (format =3D=3D MTK_DPI_COLOR_FORMAT_YCBCR_422_FULL)) { - mtk_dpi_config_yuv422_enable(dpi, true); - mtk_dpi_config_csc_enable(dpi, true); - mtk_dpi_config_swap_input(dpi, true); - mtk_dpi_config_channel_swap(dpi, MTK_DPI_OUT_CHANNEL_SWAP_RGB); - } else { - mtk_dpi_config_yuv422_enable(dpi, false); - mtk_dpi_config_csc_enable(dpi, false); - mtk_dpi_config_swap_input(dpi, false); - mtk_dpi_config_channel_swap(dpi, MTK_DPI_OUT_CHANNEL_SWAP_RGB); - } + /* only support RGB888 */ + mtk_dpi_config_yuv422_enable(dpi, false); + mtk_dpi_config_csc_enable(dpi, false); + mtk_dpi_config_swap_input(dpi, false); + mtk_dpi_config_channel_swap(dpi, MTK_DPI_OUT_CHANNEL_SWAP_RGB); } =20 static void mtk_dpi_dual_edge(struct mtk_dpi *dpi) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A91DC25B0E for ; Mon, 15 Aug 2022 21:12:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243773AbiHOVKk (ORCPT ); Mon, 15 Aug 2022 17:10:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346042AbiHOVGO (ORCPT ); Mon, 15 Aug 2022 17:06:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 204122A739; Mon, 15 Aug 2022 12:15:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5C2CBB81113; Mon, 15 Aug 2022 19:15:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91619C433C1; Mon, 15 Aug 2022 19:15:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590915; bh=ZCTlZ6oiSDxVQ1XvejSCzZ84C+U5CBdJqQG1WcctKyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jBqQ367e6eXPtbCuAj9O8XrXmpMKWi+BHibTnRiwWfETpZomcKyB3D1w5+Cli5VVn ylpTviK0jiUTZw4F8uv9kPKrvdg5EiIJo8azEgStjzmCVO+j3LqN7jy1Zl93L6gLFR 8NJMdIZOXxDNpbIVsouRxGn2ZwlpASrOhZgW8Yuk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Ranquet , Bo-Chen Chen , AngeloGioacchino Del Regno , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.18 0412/1095] drm/mediatek: dpi: Only enable dpi after the bridge is enabled Date: Mon, 15 Aug 2022 19:56:51 +0200 Message-Id: <20220815180446.738887855@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guillaume Ranquet [ Upstream commit aed61ef6beb911cc043af0f2f291167663995065 ] Enabling the dpi too early causes glitches on screen. Move the call to mtk_dpi_enable() at the end of the bridge_enable callback to ensure everything is setup properly before enabling dpi. Fixes: 9e629c17aa8d ("drm/mediatek: Add DPI sub driver") Signed-off-by: Guillaume Ranquet Signed-off-by: Bo-Chen Chen Tested-by: AngeloGioacchino Del Regno Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20220701035= 845.16458-16-rex-bc.chen@mediatek.com/ Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/mediatek/mtk_dpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/= mtk_dpi.c index 675e2e4072df..41c783349321 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c @@ -417,7 +417,6 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi) if (dpi->pinctrl && dpi->pins_dpi) pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi); =20 - mtk_dpi_enable(dpi); return 0; =20 err_pixel: @@ -639,6 +638,7 @@ static void mtk_dpi_bridge_enable(struct drm_bridge *br= idge) =20 mtk_dpi_power_on(dpi); mtk_dpi_set_display_mode(dpi, &dpi->mode); + mtk_dpi_enable(dpi); } =20 static enum drm_mode_status --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ED63C00140 for ; Mon, 15 Aug 2022 21:12:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244246AbiHOVKs (ORCPT ); Mon, 15 Aug 2022 17:10:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346834AbiHOVGZ (ORCPT ); Mon, 15 Aug 2022 17:06:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95C49AB4CB; Mon, 15 Aug 2022 12:15:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 889B960F6A; Mon, 15 Aug 2022 19:15:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91B1AC433C1; Mon, 15 Aug 2022 19:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590917; bh=spwZJtPCOaCQx479iBlNNrKXgaCqoQhwNGPt9q4iVOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ymy+YnhsPWnESgcgmylVDEquDXDlsaaxopbajyAoU2sQioJzxsDsum74RG8ayMCQq dzrqKPTc0N7lWZ+mLloQyna5pLZ2cn70zLr/CNQ/JkCGAGWDsVq3DndqagvkbV77yZ 1oj31ufQ35aG6nQS+zOzogGyEvEH+qawZz4QgBlg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Stephen Boyd , Sasha Levin Subject: [PATCH 5.18 0413/1095] drm/msm/hdmi: fill the pwr_regs bulk regulators Date: Mon, 15 Aug 2022 19:56:52 +0200 Message-Id: <20220815180446.779411530@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Baryshkov [ Upstream commit a18a44e9262d5c7f7fbccbc9458df64d69185d41 ] Conversion to use bulk regulator API omitted filling the pwr_regs with proper regulator IDs. This was left unnoticed, since none of my testing platforms has used the pwr_regs. Fix this by propagating regulator ids properly. Fixes: 31b3b1f5e352 ("drm/msm/hdmi: use bulk regulator API") Signed-off-by: Dmitry Baryshkov Reviewed-by: Stephen Boyd Patchwork: https://patchwork.freedesktop.org/patch/488847/ Link: https://lore.kernel.org/r/20220609113148.3149194-1-dmitry.baryshkov@l= inaro.org Signed-off-by: Dmitry Baryshkov Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/msm/hdmi/hdmi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdm= i.c index f6229262dcb0..4ce0b4c41e49 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -180,6 +180,9 @@ static struct hdmi *msm_hdmi_init(struct platform_devic= e *pdev) goto fail; } =20 + for (i =3D 0; i < config->pwr_reg_cnt; i++) + hdmi->pwr_regs[i].supply =3D config->pwr_reg_names[i]; + ret =3D devm_regulator_bulk_get(&pdev->dev, config->pwr_reg_cnt, hdmi->pw= r_regs); if (ret) { DRM_DEV_ERROR(&pdev->dev, "failed to get pwr regulator: %d\n", ret); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3912EC25B0E for ; Mon, 15 Aug 2022 21:12:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244714AbiHOVLH (ORCPT ); Mon, 15 Aug 2022 17:11:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346816AbiHOVGX (ORCPT ); Mon, 15 Aug 2022 17:06:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA6FCEBC; Mon, 15 Aug 2022 12:15:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 244E3B81117; Mon, 15 Aug 2022 19:15:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AF42C433B5; Mon, 15 Aug 2022 19:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590920; bh=LZk7gSWpaSoUsHd/k9TE2xG/PGVAIeKrKwCihr/MDmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YeIDs53IdbKSgIin9lET7/04KynHYe12j5W4D0vSFJmLu11uYlXZVRxqBqiIOzNHi PN3nZue8av674riY8iUyifflFogCKMvaD7bqTb2tpJvqhwwqS+P7+uT+sj2Kx4rloE 9JFT0AQkfu0iy1tH237KxoGSbFKaF6/3crUbsr3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Andrzej Hajda , Robert Foss , Sasha Levin Subject: [PATCH 5.18 0414/1095] drm: bridge: sii8620: fix possible off-by-one Date: Mon, 15 Aug 2022 19:56:53 +0200 Message-Id: <20220815180446.823025815@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hangyu Hua [ Upstream commit 21779cc21c732c5eff8ea1624be6590450baa30f ] The next call to sii8620_burst_get_tx_buf will result in off-by-one When ctx->burst.tx_count + size =3D=3D ARRAY_SIZE(ctx->burst.tx_buf). The s= ame thing happens in sii8620_burst_get_rx_buf. This patch also change tx_count and tx_buf to rx_count and rx_buf in sii8620_burst_get_rx_buf. It is unreasonable to check tx_buf's size and use rx_buf. Fixes: e19e9c692f81 ("drm/bridge/sii8620: add support for burst eMSC transm= issions") Signed-off-by: Hangyu Hua Reviewed-by: Andrzej Hajda Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220518065856.18936-1-= hbh25y@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/sil-sii8620.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/= sil-sii8620.c index ec7745c31da0..ab0bce4a988c 100644 --- a/drivers/gpu/drm/bridge/sil-sii8620.c +++ b/drivers/gpu/drm/bridge/sil-sii8620.c @@ -605,7 +605,7 @@ static void *sii8620_burst_get_tx_buf(struct sii8620 *c= tx, int len) u8 *buf =3D &ctx->burst.tx_buf[ctx->burst.tx_count]; int size =3D len + 2; =20 - if (ctx->burst.tx_count + size > ARRAY_SIZE(ctx->burst.tx_buf)) { + if (ctx->burst.tx_count + size >=3D ARRAY_SIZE(ctx->burst.tx_buf)) { dev_err(ctx->dev, "TX-BLK buffer exhausted\n"); ctx->error =3D -EINVAL; return NULL; @@ -622,7 +622,7 @@ static u8 *sii8620_burst_get_rx_buf(struct sii8620 *ctx= , int len) u8 *buf =3D &ctx->burst.rx_buf[ctx->burst.rx_count]; int size =3D len + 1; =20 - if (ctx->burst.tx_count + size > ARRAY_SIZE(ctx->burst.tx_buf)) { + if (ctx->burst.rx_count + size >=3D ARRAY_SIZE(ctx->burst.rx_buf)) { dev_err(ctx->dev, "RX-BLK buffer exhausted\n"); ctx->error =3D -EINVAL; return NULL; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48F41C00140 for ; Mon, 15 Aug 2022 21:12:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244850AbiHOVLM (ORCPT ); Mon, 15 Aug 2022 17:11:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346905AbiHOVG2 (ORCPT ); Mon, 15 Aug 2022 17:06:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F28C388C; Mon, 15 Aug 2022 12:15:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9744E60F68; Mon, 15 Aug 2022 19:15:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96F77C433D7; Mon, 15 Aug 2022 19:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590927; bh=HdZN3NTvMMQl8HTqsLSlcwZKLq5OqohzlyHzJ25xYXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZafUegXbXcBEt9lXLZXl1D5MLNYD38NpFiYL8QZduzYMQIHWXVPfwmu2A2DYfgsLE HpsJfxrfzYyONj7NmPohNoXRcvMdO6+jkP6STxB8XNwdKQ5osSECN3ak9hzmYjk8KB Lu4zYjRh2bE/ibHc9TDQgvCWAiQuqt/cvHj3kTqk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Foster , Vladimir Oltean , Vinicius Costa Gomes , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0415/1095] net: sched: provide shim definitions for taprio_offload_{get,free} Date: Mon, 15 Aug 2022 19:56:54 +0200 Message-Id: <20220815180446.866780758@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit d7be266adbfd3aca6965ea6a0c36b2c3d8fc9fc8 ] All callers of taprio_offload_get() and taprio_offload_free() prior to the blamed commit are conditionally compiled based on CONFIG_NET_SCH_TAPRIO. felix_vsc9959.c is different; it provides vsc9959_qos_port_tas_set() even when taprio is compiled out. Provide shim definitions for the functions exported by taprio so that felix_vsc9959.c is able to compile. vsc9959_qos_port_tas_set() in that case is dead code anyway, and ocelot_port->taprio remains NULL, which is fine for the rest of the logic. Fixes: 1c9017e44af2 ("net: dsa: felix: keep reference on entire tc-taprio c= onfig") Reported-by: Colin Foster Signed-off-by: Vladimir Oltean Tested-by: Colin Foster Acked-by: Vinicius Costa Gomes Link: https://lore.kernel.org/r/20220704190241.1288847-1-vladimir.oltean@nx= p.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/net/pkt_sched.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 44a35531952e..3372a1f67cf4 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -173,11 +173,28 @@ struct tc_taprio_qopt_offload { struct tc_taprio_sched_entry entries[]; }; =20 +#if IS_ENABLED(CONFIG_NET_SCH_TAPRIO) + /* Reference counting */ struct tc_taprio_qopt_offload *taprio_offload_get(struct tc_taprio_qopt_of= fload *offload); void taprio_offload_free(struct tc_taprio_qopt_offload *offload); =20 +#else + +/* Reference counting */ +static inline struct tc_taprio_qopt_offload * +taprio_offload_get(struct tc_taprio_qopt_offload *offload) +{ + return NULL; +} + +static inline void taprio_offload_free(struct tc_taprio_qopt_offload *offl= oad) +{ +} + +#endif + /* Ensure skb_mstamp_ns, which might have been populated with the txtime, = is * not mistaken for a software timestamp, because this will otherwise prev= ent * the dispatch of hardware timestamps to the socket. --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAA2DC28B2B for ; Mon, 15 Aug 2022 21:12:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245057AbiHOVLQ (ORCPT ); Mon, 15 Aug 2022 17:11:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347080AbiHOVGm (ORCPT ); Mon, 15 Aug 2022 17:06:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5FC063C9; Mon, 15 Aug 2022 12:15:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5CCAD60FAD; Mon, 15 Aug 2022 19:15:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64604C433D7; Mon, 15 Aug 2022 19:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590929; bh=nCWO8YIu1PEBiyHOTBnU4ZCYz8V+EBt7GoQJfXewjfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GW5mQoB6La+JbS3RDSb92X4gcetEorChrPHRUZMHiMcRgMTPZTEFXaKq8DJNcnqzm uJx0fVbgLTPq/FVYbajHUuQpVIhRsifPdUjVRkN+FQBoNZYM0bjHoORgYfI2BsSyyp Ty3xYMfTnBlTU4jk3/BgSkRvFGPG9IGg82kln34Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0416/1095] net: dsa: felix: build as module when tc-taprio is module Date: Mon, 15 Aug 2022 19:56:55 +0200 Message-Id: <20220815180446.915381685@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 10ed11ab6399813eb652137db9c378433c28a95c ] felix_vsc9959.c calls taprio_offload_get() and taprio_offload_free(), symbols exported by net/sched/sch_taprio.c. As such, we must disallow building the Felix driver as built-in when the symbol exported by tc-taprio isn't present in the kernel image. Fixes: 1c9017e44af2 ("net: dsa: felix: keep reference on entire tc-taprio c= onfig") Signed-off-by: Vladimir Oltean Link: https://lore.kernel.org/r/20220704190241.1288847-2-vladimir.oltean@nx= p.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/dsa/ocelot/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/dsa/ocelot/Kconfig b/drivers/net/dsa/ocelot/Kconfig index 220b0b027b55..08db9cf76818 100644 --- a/drivers/net/dsa/ocelot/Kconfig +++ b/drivers/net/dsa/ocelot/Kconfig @@ -6,6 +6,7 @@ config NET_DSA_MSCC_FELIX depends on NET_VENDOR_FREESCALE depends on HAS_IOMEM depends on PTP_1588_CLOCK_OPTIONAL + depends on NET_SCH_TAPRIO || NET_SCH_TAPRIO=3Dn select MSCC_OCELOT_SWITCH_LIB select NET_DSA_TAG_OCELOT_8021Q select NET_DSA_TAG_OCELOT --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F1E4C3F6B0 for ; Mon, 15 Aug 2022 21:12:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245317AbiHOVLT (ORCPT ); Mon, 15 Aug 2022 17:11:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347476AbiHOVG7 (ORCPT ); Mon, 15 Aug 2022 17:06:59 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E900918382; Mon, 15 Aug 2022 12:15:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 8AAD2CE1087; Mon, 15 Aug 2022 19:15:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EF4FC433D7; Mon, 15 Aug 2022 19:15:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590932; bh=VAXuy6qTweqSeZ0LUKOMiZxh54lrf8iikegCxcOJiFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M28j4xp9SPc96pMY7IJJDsA55IuUv0bZDTn1gF0GR3FbigyDcHU+4NdlFx7ENfRH2 Vrp+8yYphaAowB34OdaN5nJ8+XHMvr3pufQHYNt0dzrgnCIFbBA1xlI5nVyestEPGh RjcjunVoE9WE+5HptYT7nDIOA70HF4Rl4OqEEmVM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0417/1095] hinic: Use the bitmap API when applicable Date: Mon, 15 Aug 2022 19:56:56 +0200 Message-Id: <20220815180446.954268316@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 7c2c57263af41cfd8b5022274e6801542831bb69 ] 'vlan_bitmap' is a bitmap and is used as such. So allocate it with devm_bitmap_zalloc() and its explicit bit size (i.e. VLAN_N_VID). This avoids the need of the VLAN_BITMAP_SIZE macro which: - needlessly has a 'nic_dev' parameter - should be "long" (and not byte) aligned, so that the bitmap semantic is respected This is in fact not an issue because VLAN_N_VID is 4096 at the time being, but devm_bitmap_zalloc() is less verbose and easier to understand. Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/6ff7b7d21414240794a77dc2456914412718a145.16= 56260842.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/huawei/hinic/hinic_main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/e= thernet/huawei/hinic/hinic_main.c index 05329292d940..56a89793f47d 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -62,8 +62,6 @@ MODULE_PARM_DESC(rx_weight, "Number Rx packets for NAPI b= udget (default=3D64)"); =20 #define HINIC_LRO_RX_TIMER_DEFAULT 16 =20 -#define VLAN_BITMAP_SIZE(nic_dev) (ALIGN(VLAN_N_VID, 8) / 8) - #define work_to_rx_mode_work(work) \ container_of(work, struct hinic_rx_mode_work, work) =20 @@ -1242,9 +1240,8 @@ static int nic_dev_init(struct pci_dev *pdev) u64_stats_init(&tx_stats->syncp); u64_stats_init(&rx_stats->syncp); =20 - nic_dev->vlan_bitmap =3D devm_kzalloc(&pdev->dev, - VLAN_BITMAP_SIZE(nic_dev), - GFP_KERNEL); + nic_dev->vlan_bitmap =3D devm_bitmap_zalloc(&pdev->dev, VLAN_N_VID, + GFP_KERNEL); if (!nic_dev->vlan_bitmap) { err =3D -ENOMEM; goto err_vlan_bitmap; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EED46C2BB41 for ; Mon, 15 Aug 2022 21:12:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344360AbiHOVLj (ORCPT ); Mon, 15 Aug 2022 17:11:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347758AbiHOVH2 (ORCPT ); Mon, 15 Aug 2022 17:07:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34C001A3A9; Mon, 15 Aug 2022 12:15:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4F01BB810A3; Mon, 15 Aug 2022 19:15:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65465C433D6; Mon, 15 Aug 2022 19:15:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590936; bh=BRREgrfvO9W2sHR0exN5v9EzUf1Wi7h066+OAMDloMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qTCa7R7aCzL+tUDvWXB+/nKRidRq24oK8KDK97KxLkXUGtS10EQRoZn+/ctGEmvVc ddw2PDWrx2ODJebHsWI7fSesbHoTNiS0VfEil6/pTFEzwHVY1rQa/4QI+KvsCjpRRz RhOmT5f5XSZwyjmb0j9oFP1dfYeLJcKQQzyNAFuk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qiao Ma , kernel test robot , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 0418/1095] net: hinic: fix bug that ethtool get wrong stats Date: Mon, 15 Aug 2022 19:56:57 +0200 Message-Id: <20220815180447.001728933@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qiao Ma [ Upstream commit 67dffd3db98570af8ff54c934f7d14664c0d182a ] Function hinic_get_stats64() will do two operations: 1. reads stats from every hinic_rxq/txq and accumulates them 2. calls hinic_rxq/txq_clean_stats() to clean every rxq/txq's stats For hinic_get_stats64(), it could get right data, because it sums all data to nic_dev->rx_stats/tx_stats. But it is wrong for get_drv_queue_stats(), this function will read hinic_rxq's stats, which have been cleared to zero by hinic_get_stats64(). I have observed hinic's cleanup operation by using such command: > watch -n 1 "cat ethtool -S eth4 | tail -40" Result before: ... rxq7_pkts: 1 rxq7_bytes: 90 rxq7_errors: 0 rxq7_csum_errors: 0 rxq7_other_errors: 0 ... rxq9_pkts: 11 rxq9_bytes: 726 rxq9_errors: 0 rxq9_csum_errors: 0 rxq9_other_errors: 0 ... rxq11_pkts: 0 rxq11_bytes: 0 rxq11_errors: 0 rxq11_csum_errors: 0 rxq11_other_errors: 0 Result after a few seconds: ... rxq7_pkts: 0 rxq7_bytes: 0 rxq7_errors: 0 rxq7_csum_errors: 0 rxq7_other_errors: 0 ... rxq9_pkts: 2 rxq9_bytes: 132 rxq9_errors: 0 rxq9_csum_errors: 0 rxq9_other_errors: 0 ... rxq11_pkts: 1 rxq11_bytes: 170 rxq11_errors: 0 rxq11_csum_errors: 0 rxq11_other_errors: 0 To solve this problem, we just keep every queue's total stats in their own queue (aka hinic_{rxq|txq}), and simply sum all per-queue stats every time calling hinic_get_stats64(). With that solution, there is no need to clean per-queue stats now, and there is no need to maintain global hinic_dev.{tx|rx}_stats, too. Fixes: edd384f682cc ("net-next/hinic: Add ethtool and stats") Signed-off-by: Qiao Ma Reported-by: kernel test robot Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/huawei/hinic/hinic_dev.h | 3 - .../net/ethernet/huawei/hinic/hinic_main.c | 57 ++++++------------- drivers/net/ethernet/huawei/hinic/hinic_rx.c | 2 - drivers/net/ethernet/huawei/hinic/hinic_tx.c | 2 - 4 files changed, 16 insertions(+), 48 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_dev.h b/drivers/net/et= hernet/huawei/hinic/hinic_dev.h index fb3e89141a0d..a4fbf44f944c 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_dev.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_dev.h @@ -95,9 +95,6 @@ struct hinic_dev { u16 sq_depth; u16 rq_depth; =20 - struct hinic_txq_stats tx_stats; - struct hinic_rxq_stats rx_stats; - u8 rss_tmpl_idx; u8 rss_hash_engine; u16 num_rss; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/e= thernet/huawei/hinic/hinic_main.c index 56a89793f47d..89dc52510fdc 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -80,56 +80,44 @@ static int set_features(struct hinic_dev *nic_dev, netdev_features_t pre_features, netdev_features_t features, bool force_change); =20 -static void update_rx_stats(struct hinic_dev *nic_dev, struct hinic_rxq *r= xq) +static void gather_rx_stats(struct hinic_rxq_stats *nic_rx_stats, struct h= inic_rxq *rxq) { - struct hinic_rxq_stats *nic_rx_stats =3D &nic_dev->rx_stats; struct hinic_rxq_stats rx_stats; =20 - u64_stats_init(&rx_stats.syncp); - hinic_rxq_get_stats(rxq, &rx_stats); =20 - u64_stats_update_begin(&nic_rx_stats->syncp); nic_rx_stats->bytes +=3D rx_stats.bytes; nic_rx_stats->pkts +=3D rx_stats.pkts; nic_rx_stats->errors +=3D rx_stats.errors; nic_rx_stats->csum_errors +=3D rx_stats.csum_errors; nic_rx_stats->other_errors +=3D rx_stats.other_errors; - u64_stats_update_end(&nic_rx_stats->syncp); - - hinic_rxq_clean_stats(rxq); } =20 -static void update_tx_stats(struct hinic_dev *nic_dev, struct hinic_txq *t= xq) +static void gather_tx_stats(struct hinic_txq_stats *nic_tx_stats, struct h= inic_txq *txq) { - struct hinic_txq_stats *nic_tx_stats =3D &nic_dev->tx_stats; struct hinic_txq_stats tx_stats; =20 - u64_stats_init(&tx_stats.syncp); - hinic_txq_get_stats(txq, &tx_stats); =20 - u64_stats_update_begin(&nic_tx_stats->syncp); nic_tx_stats->bytes +=3D tx_stats.bytes; nic_tx_stats->pkts +=3D tx_stats.pkts; nic_tx_stats->tx_busy +=3D tx_stats.tx_busy; nic_tx_stats->tx_wake +=3D tx_stats.tx_wake; nic_tx_stats->tx_dropped +=3D tx_stats.tx_dropped; nic_tx_stats->big_frags_pkts +=3D tx_stats.big_frags_pkts; - u64_stats_update_end(&nic_tx_stats->syncp); - - hinic_txq_clean_stats(txq); } =20 -static void update_nic_stats(struct hinic_dev *nic_dev) +static void gather_nic_stats(struct hinic_dev *nic_dev, + struct hinic_rxq_stats *nic_rx_stats, + struct hinic_txq_stats *nic_tx_stats) { int i, num_qps =3D hinic_hwdev_num_qps(nic_dev->hwdev); =20 for (i =3D 0; i < num_qps; i++) - update_rx_stats(nic_dev, &nic_dev->rxqs[i]); + gather_rx_stats(nic_rx_stats, &nic_dev->rxqs[i]); =20 for (i =3D 0; i < num_qps; i++) - update_tx_stats(nic_dev, &nic_dev->txqs[i]); + gather_tx_stats(nic_tx_stats, &nic_dev->txqs[i]); } =20 /** @@ -558,8 +546,6 @@ int hinic_close(struct net_device *netdev) netif_carrier_off(netdev); netif_tx_disable(netdev); =20 - update_nic_stats(nic_dev); - up(&nic_dev->mgmt_lock); =20 if (!HINIC_IS_VF(nic_dev->hwdev->hwif)) @@ -853,26 +839,23 @@ static void hinic_get_stats64(struct net_device *netd= ev, struct rtnl_link_stats64 *stats) { struct hinic_dev *nic_dev =3D netdev_priv(netdev); - struct hinic_rxq_stats *nic_rx_stats; - struct hinic_txq_stats *nic_tx_stats; - - nic_rx_stats =3D &nic_dev->rx_stats; - nic_tx_stats =3D &nic_dev->tx_stats; + struct hinic_rxq_stats nic_rx_stats =3D {}; + struct hinic_txq_stats nic_tx_stats =3D {}; =20 down(&nic_dev->mgmt_lock); =20 if (nic_dev->flags & HINIC_INTF_UP) - update_nic_stats(nic_dev); + gather_nic_stats(nic_dev, &nic_rx_stats, &nic_tx_stats); =20 up(&nic_dev->mgmt_lock); =20 - stats->rx_bytes =3D nic_rx_stats->bytes; - stats->rx_packets =3D nic_rx_stats->pkts; - stats->rx_errors =3D nic_rx_stats->errors; + stats->rx_bytes =3D nic_rx_stats.bytes; + stats->rx_packets =3D nic_rx_stats.pkts; + stats->rx_errors =3D nic_rx_stats.errors; =20 - stats->tx_bytes =3D nic_tx_stats->bytes; - stats->tx_packets =3D nic_tx_stats->pkts; - stats->tx_errors =3D nic_tx_stats->tx_dropped; + stats->tx_bytes =3D nic_tx_stats.bytes; + stats->tx_packets =3D nic_tx_stats.pkts; + stats->tx_errors =3D nic_tx_stats.tx_dropped; } =20 static int hinic_set_features(struct net_device *netdev, @@ -1171,8 +1154,6 @@ static void hinic_free_intr_coalesce(struct hinic_dev= *nic_dev) static int nic_dev_init(struct pci_dev *pdev) { struct hinic_rx_mode_work *rx_mode_work; - struct hinic_txq_stats *tx_stats; - struct hinic_rxq_stats *rx_stats; struct hinic_dev *nic_dev; struct net_device *netdev; struct hinic_hwdev *hwdev; @@ -1234,12 +1215,6 @@ static int nic_dev_init(struct pci_dev *pdev) =20 sema_init(&nic_dev->mgmt_lock, 1); =20 - tx_stats =3D &nic_dev->tx_stats; - rx_stats =3D &nic_dev->rx_stats; - - u64_stats_init(&tx_stats->syncp); - u64_stats_init(&rx_stats->syncp); - nic_dev->vlan_bitmap =3D devm_bitmap_zalloc(&pdev->dev, VLAN_N_VID, GFP_KERNEL); if (!nic_dev->vlan_bitmap) { diff --git a/drivers/net/ethernet/huawei/hinic/hinic_rx.c b/drivers/net/eth= ernet/huawei/hinic/hinic_rx.c index b33ed4d92b71..b6bce622a6a8 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_rx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_rx.c @@ -73,7 +73,6 @@ void hinic_rxq_get_stats(struct hinic_rxq *rxq, struct hi= nic_rxq_stats *stats) struct hinic_rxq_stats *rxq_stats =3D &rxq->rxq_stats; unsigned int start; =20 - u64_stats_update_begin(&stats->syncp); do { start =3D u64_stats_fetch_begin(&rxq_stats->syncp); stats->pkts =3D rxq_stats->pkts; @@ -83,7 +82,6 @@ void hinic_rxq_get_stats(struct hinic_rxq *rxq, struct hi= nic_rxq_stats *stats) stats->csum_errors =3D rxq_stats->csum_errors; stats->other_errors =3D rxq_stats->other_errors; } while (u64_stats_fetch_retry(&rxq_stats->syncp, start)); - u64_stats_update_end(&stats->syncp); } =20 /** diff --git a/drivers/net/ethernet/huawei/hinic/hinic_tx.c b/drivers/net/eth= ernet/huawei/hinic/hinic_tx.c index 8d59babbf476..082eb2a5088d 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_tx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_tx.c @@ -98,7 +98,6 @@ void hinic_txq_get_stats(struct hinic_txq *txq, struct hi= nic_txq_stats *stats) struct hinic_txq_stats *txq_stats =3D &txq->txq_stats; unsigned int start; =20 - u64_stats_update_begin(&stats->syncp); do { start =3D u64_stats_fetch_begin(&txq_stats->syncp); stats->pkts =3D txq_stats->pkts; @@ -108,7 +107,6 @@ void hinic_txq_get_stats(struct hinic_txq *txq, struct = hinic_txq_stats *stats) stats->tx_dropped =3D txq_stats->tx_dropped; stats->big_frags_pkts =3D txq_stats->big_frags_pkts; } while (u64_stats_fetch_retry(&txq_stats->syncp, start)); - u64_stats_update_end(&stats->syncp); } =20 /** --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74B73C28B2B for ; Mon, 15 Aug 2022 21:12:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245488AbiHOVLW (ORCPT ); Mon, 15 Aug 2022 17:11:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347575AbiHOVHF (ORCPT ); Mon, 15 Aug 2022 17:07:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5229B1BEB9; Mon, 15 Aug 2022 12:15:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 92AAE60F6C; Mon, 15 Aug 2022 19:15:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9938FC433C1; Mon, 15 Aug 2022 19:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590939; bh=5D8R5ND/ejMtZ3MKYGCmT1b4bpEsntPeqRPpwjWiHjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i7+Bs5w11QvtL6pJjPgGFKa9wYyLB50X3n9TGUTTq1D8iR46OtsqajGjRRdMlCMpr vMduVIuYdRNZHXIJvX9TsvXpGKtsz43d/HrWUruvt4iWCnyyQuFyG3pno8D/Db7hRe mRQyTNZP5rJkgegarFUf6c6W0vI4zQMbMZZgJPL8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qiao Ma , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 0419/1095] net: hinic: avoid kernel hung in hinic_get_stats64() Date: Mon, 15 Aug 2022 19:56:58 +0200 Message-Id: <20220815180447.040497555@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qiao Ma [ Upstream commit 98f9fcdee35add80505b6c73f72de5f750d5c03c ] When using hinic device as a bond slave device, and reading device stats of master bond device, the kernel may hung. The kernel panic calltrace as follows: Kernel panic - not syncing: softlockup: hung tasks Call trace: native_queued_spin_lock_slowpath+0x1ec/0x31c dev_get_stats+0x60/0xcc dev_seq_printf_stats+0x40/0x120 dev_seq_show+0x1c/0x40 seq_read_iter+0x3c8/0x4dc seq_read+0xe0/0x130 proc_reg_read+0xa8/0xe0 vfs_read+0xb0/0x1d4 ksys_read+0x70/0xfc __arm64_sys_read+0x20/0x30 el0_svc_common+0x88/0x234 do_el0_svc+0x2c/0x90 el0_svc+0x1c/0x30 el0_sync_handler+0xa8/0xb0 el0_sync+0x148/0x180 And the calltrace of task that actually caused kernel hungs as follows: __switch_to+124 __schedule+548 schedule+72 schedule_timeout+348 __down_common+188 __down+24 down+104 hinic_get_stats64+44 [hinic] dev_get_stats+92 bond_get_stats+172 [bonding] dev_get_stats+92 dev_seq_printf_stats+60 dev_seq_show+24 seq_read_iter+964 seq_read+220 proc_reg_read+164 vfs_read+172 ksys_read+108 __arm64_sys_read+28 el0_svc_common+132 do_el0_svc+40 el0_svc+24 el0_sync_handler+164 el0_sync+324 When getting device stats from bond, kernel will call bond_get_stats(). It first holds the spinlock bond->stats_lock, and then call hinic_get_stats64() to collect hinic device's stats. However, hinic_get_stats64() calls `down(&nic_dev->mgmt_lock)` to protect its critical section, which may schedule current task out. And if system is under high pressure, the task cannot be woken up immediately, which eventually triggers kernel hung panic. Since previous patch has replaced hinic_dev.tx_stats/rx_stats with local variable in hinic_get_stats64(), there is nothing need to be protected by lock, so just removing down()/up() is ok. Fixes: edd384f682cc ("net-next/hinic: Add ethtool and stats") Signed-off-by: Qiao Ma Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/huawei/hinic/hinic_main.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/e= thernet/huawei/hinic/hinic_main.c index 89dc52510fdc..c23ee2ddbce3 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -842,13 +842,9 @@ static void hinic_get_stats64(struct net_device *netde= v, struct hinic_rxq_stats nic_rx_stats =3D {}; struct hinic_txq_stats nic_tx_stats =3D {}; =20 - down(&nic_dev->mgmt_lock); - if (nic_dev->flags & HINIC_INTF_UP) gather_nic_stats(nic_dev, &nic_rx_stats, &nic_tx_stats); =20 - up(&nic_dev->mgmt_lock); - stats->rx_bytes =3D nic_rx_stats.bytes; stats->rx_packets =3D nic_rx_stats.pkts; stats->rx_errors =3D nic_rx_stats.errors; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAD65C282E7 for ; Mon, 15 Aug 2022 21:12:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343789AbiHOVLa (ORCPT ); Mon, 15 Aug 2022 17:11:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347668AbiHOVHO (ORCPT ); Mon, 15 Aug 2022 17:07:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8573E26AF6; Mon, 15 Aug 2022 12:15:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2E22AB8107A; Mon, 15 Aug 2022 19:15:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7892AC433C1; Mon, 15 Aug 2022 19:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590942; bh=F48SpVhjoLYkjKlpfxwPhkaM0vRy1y7C3KBzHeSr3Cc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iccco44Tcv2ubfedsyZsPT+LVqrYOVkiXK1EeCJPsIBH5RvlpbNX2AwHxykl7kpzJ xuiw9pce7dKSusejmeiXJzNw/a9/aFu1xkIFnd8MeLjHVtSjIwPZsQ6ze867BEYg60 1OFqJ9eDuTe9J9hEtwifHLsEnO3QqHJvFHswTnLI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hsin-Yi Wang , Xin Ji , Robert Foss , Sasha Levin Subject: [PATCH 5.18 0420/1095] drm/bridge: anx7625: Fix NULL pointer crash when using edp-panel Date: Mon, 15 Aug 2022 19:56:59 +0200 Message-Id: <20220815180447.079124897@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hsin-Yi Wang [ Upstream commit dfb02eb6bdf84697dbadd69a7df12db612ce4ed0 ] Move devm_of_dp_aux_populate_ep_devices() after pm runtime and i2c setup to avoid NULL pointer crash. edp-panel probe (generic_edp_panel_probe) calls pm_runtime_get_sync() to read EDID. At this time, bridge should have pm runtime enabled and i2c clients ready. Fixes: adca62ec370c ("drm/bridge: anx7625: Support reading edid through aux= channel") Signed-off-by: Hsin-Yi Wang Reviewed-by: Xin Ji Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220706125254.2474095-= 4-hsinyi@chromium.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/analogix/anx7625.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/br= idge/analogix/anx7625.c index 060849f8ad8b..c527a3a02eac 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -2651,14 +2651,6 @@ static int anx7625_i2c_probe(struct i2c_client *clie= nt, platform->aux.dev =3D dev; platform->aux.transfer =3D anx7625_aux_transfer; drm_dp_aux_init(&platform->aux); - devm_of_dp_aux_populate_ep_devices(&platform->aux); - - ret =3D anx7625_parse_dt(dev, pdata); - if (ret) { - if (ret !=3D -EPROBE_DEFER) - DRM_DEV_ERROR(dev, "fail to parse DT : %d\n", ret); - goto free_wq; - } =20 if (anx7625_register_i2c_dummy_clients(platform, client) !=3D 0) { ret =3D -ENOMEM; @@ -2674,6 +2666,15 @@ static int anx7625_i2c_probe(struct i2c_client *clie= nt, if (ret) goto free_wq; =20 + devm_of_dp_aux_populate_ep_devices(&platform->aux); + + ret =3D anx7625_parse_dt(dev, pdata); + if (ret) { + if (ret !=3D -EPROBE_DEFER) + DRM_DEV_ERROR(dev, "fail to parse DT : %d\n", ret); + goto free_wq; + } + if (!platform->pdata.low_power_mode) { anx7625_disable_pd_protocol(platform); pm_runtime_get_sync(dev); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68657C25B0E for ; Mon, 15 Aug 2022 21:18:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345207AbiHOVRm (ORCPT ); Mon, 15 Aug 2022 17:17:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347726AbiHOVHS (ORCPT ); Mon, 15 Aug 2022 17:07:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22DD737F88; Mon, 15 Aug 2022 12:15:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2DA85B81106; Mon, 15 Aug 2022 19:15:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B73DC433D6; Mon, 15 Aug 2022 19:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590944; bh=z+5x1ygZ0wmS3S4zFmjdaGOeyp2L82efvKH3V/p6uRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yJRxCO4y6yllgDM8q8ilHmbc2VyfFFUsIenbVlHBBJropzMwB8fBbPhd2xbGpAUTy 9h0JJYc5LFJctkfbWGht/kschzf/gPStd79zAgktswLoC4+Z1Vm79vmJtR7HRgr4B5 0ivyoQ+aPsSdoS41ca41EMkpqz9UCM8ubaNZ0aUI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , Rob Clark , Rob Clark , Sasha Levin Subject: [PATCH 5.18 0421/1095] drm/msm: Avoid unclocked GMU register access in 6xx gpu_busy Date: Mon, 15 Aug 2022 19:57:00 +0200 Message-Id: <20220815180447.129052352@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Douglas Anderson [ Upstream commit 6694482a70e9536efbf2ac233cbf0c302d6e2dae ] >From testing on sc7180-trogdor devices, reading the GMU registers needs the GMU clocks to be enabled. Those clocks get turned on in a6xx_gmu_resume(). Confusingly enough, that function is called as a result of the runtime_pm of the GPU "struct device", not the GMU "struct device". Unfortunately the current a6xx_gpu_busy() grabs a reference to the GMU's "struct device". The fact that we were grabbing the wrong reference was easily seen to cause crashes that happen if we change the GPU's pm_runtime usage to not use autosuspend. It's also believed to cause some long tail GPU crashes even with autosuspend. We could look at changing it so that we do pm_runtime_get_if_in_use() on the GPU's "struct device", but then we run into a different problem. pm_runtime_get_if_in_use() will return 0 for the GPU's "struct device" the whole time when we're in the "autosuspend delay". That is, when we drop the last reference to the GPU but we're waiting a period before actually suspending then we'll think the GPU is off. One reason that's bad is that if the GPU didn't actually turn off then the cycle counter doesn't lose state and that throws off all of our calculations. Let's change the code to keep track of the suspend state of devfreq. msm_devfreq_suspend() is always called before we actually suspend the GPU and msm_devfreq_resume() after we resume it. This means we can use the suspended state to know if we're powered or not. NOTE: one might wonder when exactly our status function is called when devfreq is supposed to be disabled. The stack crawl I captured was: msm_devfreq_get_dev_status devfreq_simple_ondemand_func devfreq_update_target qos_notifier_call qos_max_notifier_call blocking_notifier_call_chain pm_qos_update_target freq_qos_apply apply_constraint __dev_pm_qos_update_request dev_pm_qos_update_request msm_devfreq_idle_work Fixes: eadf79286a4b ("drm/msm: Check for powered down HW in the devfreq cal= lbacks") Signed-off-by: Douglas Anderson Reviewed-by: Rob Clark Patchwork: https://patchwork.freedesktop.org/patch/489124/ Link: https://lore.kernel.org/r/20220610124639.v4.1.Ie846c5352bc307ee4248d7= cab998ab3016b85d06@changeid Signed-off-by: Rob Clark Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 8 ------ drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 13 ++++----- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 12 +++------ drivers/gpu/drm/msm/adreno/a6xx_gpu.h | 3 ++- drivers/gpu/drm/msm/msm_gpu.h | 11 +++++++- drivers/gpu/drm/msm/msm_gpu_devfreq.c | 39 +++++++++++++++++++++------ 6 files changed, 53 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/ad= reno/a5xx_gpu.c index 217615e0e850..213f75fc98e8 100644 --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c @@ -1666,18 +1666,10 @@ static u64 a5xx_gpu_busy(struct msm_gpu *gpu, unsig= ned long *out_sample_rate) { u64 busy_cycles; =20 - /* Only read the gpu busy if the hardware is already active */ - if (pm_runtime_get_if_in_use(&gpu->pdev->dev) =3D=3D 0) { - *out_sample_rate =3D 1; - return 0; - } - busy_cycles =3D gpu_read64(gpu, REG_A5XX_RBBM_PERFCTR_RBBM_0_LO, REG_A5XX_RBBM_PERFCTR_RBBM_0_HI); *out_sample_rate =3D clk_get_rate(gpu->core_clk); =20 - pm_runtime_put(&gpu->pdev->dev); - return busy_cycles; } =20 diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/ad= reno/a6xx_gmu.c index 3e325e2a2b1b..1863908694dc 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -102,7 +102,8 @@ bool a6xx_gmu_gx_is_on(struct a6xx_gmu *gmu) A6XX_GMU_SPTPRAC_PWR_CLK_STATUS_GX_HM_CLK_OFF)); } =20 -void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp) +void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp, + bool suspended) { struct adreno_gpu *adreno_gpu =3D to_adreno_gpu(gpu); struct a6xx_gpu *a6xx_gpu =3D to_a6xx_gpu(adreno_gpu); @@ -127,15 +128,16 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct de= v_pm_opp *opp) =20 /* * This can get called from devfreq while the hardware is idle. Don't - * bring up the power if it isn't already active + * bring up the power if it isn't already active. All we're doing here + * is updating the frequency so that when we come back online we're at + * the right rate. */ - if (pm_runtime_get_if_in_use(gmu->dev) =3D=3D 0) + if (suspended) return; =20 if (!gmu->legacy) { a6xx_hfi_set_freq(gmu, perf_index); dev_pm_opp_set_opp(&gpu->pdev->dev, opp); - pm_runtime_put(gmu->dev); return; } =20 @@ -159,7 +161,6 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct dev_= pm_opp *opp) dev_err(gmu->dev, "GMU set GPU frequency error: %d\n", ret); =20 dev_pm_opp_set_opp(&gpu->pdev->dev, opp); - pm_runtime_put(gmu->dev); } =20 unsigned long a6xx_gmu_get_freq(struct msm_gpu *gpu) @@ -895,7 +896,7 @@ static void a6xx_gmu_set_initial_freq(struct msm_gpu *g= pu, struct a6xx_gmu *gmu) return; =20 gmu->freq =3D 0; /* so a6xx_gmu_set_freq() doesn't exit early */ - a6xx_gmu_set_freq(gpu, gpu_opp); + a6xx_gmu_set_freq(gpu, gpu_opp, false); dev_pm_opp_put(gpu_opp); } =20 diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/ad= reno/a6xx_gpu.c index 40fb92becc78..a8a0d798d17f 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -1658,27 +1658,21 @@ static u64 a6xx_gpu_busy(struct msm_gpu *gpu, unsig= ned long *out_sample_rate) /* 19.2MHz */ *out_sample_rate =3D 19200000; =20 - /* Only read the gpu busy if the hardware is already active */ - if (pm_runtime_get_if_in_use(a6xx_gpu->gmu.dev) =3D=3D 0) - return 0; - busy_cycles =3D gmu_read64(&a6xx_gpu->gmu, REG_A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_L, REG_A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_H); =20 - - pm_runtime_put(a6xx_gpu->gmu.dev); - return busy_cycles; } =20 -static void a6xx_gpu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp) +static void a6xx_gpu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp, + bool suspended) { struct adreno_gpu *adreno_gpu =3D to_adreno_gpu(gpu); struct a6xx_gpu *a6xx_gpu =3D to_a6xx_gpu(adreno_gpu); =20 mutex_lock(&a6xx_gpu->gmu.lock); - a6xx_gmu_set_freq(gpu, opp); + a6xx_gmu_set_freq(gpu, opp, suspended); mutex_unlock(&a6xx_gpu->gmu.lock); } =20 diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h b/drivers/gpu/drm/msm/ad= reno/a6xx_gpu.h index 86e0a7c3fe6d..ab853f61db63 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h @@ -77,7 +77,8 @@ void a6xx_gmu_clear_oob(struct a6xx_gmu *gmu, enum a6xx_g= mu_oob_state state); int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node); void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu); =20 -void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp); +void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp, + bool suspended); unsigned long a6xx_gmu_get_freq(struct msm_gpu *gpu); =20 void a6xx_show(struct msm_gpu *gpu, struct msm_gpu_state *state, diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h index 143c56f5185b..a4d3abc4f3e1 100644 --- a/drivers/gpu/drm/msm/msm_gpu.h +++ b/drivers/gpu/drm/msm/msm_gpu.h @@ -63,11 +63,14 @@ struct msm_gpu_funcs { /* for generation specific debugfs: */ void (*debugfs_init)(struct msm_gpu *gpu, struct drm_minor *minor); #endif + /* note: gpu_busy() can assume that we have been pm_resumed */ u64 (*gpu_busy)(struct msm_gpu *gpu, unsigned long *out_sample_rate); struct msm_gpu_state *(*gpu_state_get)(struct msm_gpu *gpu); int (*gpu_state_put)(struct msm_gpu_state *state); unsigned long (*gpu_get_freq)(struct msm_gpu *gpu); - void (*gpu_set_freq)(struct msm_gpu *gpu, struct dev_pm_opp *opp); + /* note: gpu_set_freq() can assume that we have been pm_resumed */ + void (*gpu_set_freq)(struct msm_gpu *gpu, struct dev_pm_opp *opp, + bool suspended); struct msm_gem_address_space *(*create_address_space) (struct msm_gpu *gpu, struct platform_device *pdev); struct msm_gem_address_space *(*create_private_address_space) @@ -91,6 +94,9 @@ struct msm_gpu_devfreq { /** devfreq: devfreq instance */ struct devfreq *devfreq; =20 + /** lock: lock for "suspended", "busy_cycles", and "time" */ + struct mutex lock; + /** * idle_constraint: * @@ -134,6 +140,9 @@ struct msm_gpu_devfreq { * elapsed */ struct msm_hrtimer_work boost_work; + + /** suspended: tracks if we're suspended */ + bool suspended; }; =20 struct msm_gpu { diff --git a/drivers/gpu/drm/msm/msm_gpu_devfreq.c b/drivers/gpu/drm/msm/ms= m_gpu_devfreq.c index c7dbaa4b1926..01248d340124 100644 --- a/drivers/gpu/drm/msm/msm_gpu_devfreq.c +++ b/drivers/gpu/drm/msm/msm_gpu_devfreq.c @@ -20,6 +20,7 @@ static int msm_devfreq_target(struct device *dev, unsigne= d long *freq, u32 flags) { struct msm_gpu *gpu =3D dev_to_gpu(dev); + struct msm_gpu_devfreq *df =3D &gpu->devfreq; struct dev_pm_opp *opp; =20 /* @@ -32,10 +33,13 @@ static int msm_devfreq_target(struct device *dev, unsig= ned long *freq, =20 trace_msm_gpu_freq_change(dev_pm_opp_get_freq(opp)); =20 - if (gpu->funcs->gpu_set_freq) - gpu->funcs->gpu_set_freq(gpu, opp); - else + if (gpu->funcs->gpu_set_freq) { + mutex_lock(&df->lock); + gpu->funcs->gpu_set_freq(gpu, opp, df->suspended); + mutex_unlock(&df->lock); + } else { clk_set_rate(gpu->core_clk, *freq); + } =20 dev_pm_opp_put(opp); =20 @@ -58,15 +62,24 @@ static void get_raw_dev_status(struct msm_gpu *gpu, unsigned long sample_rate; ktime_t time; =20 + mutex_lock(&df->lock); + status->current_frequency =3D get_freq(gpu); - busy_cycles =3D gpu->funcs->gpu_busy(gpu, &sample_rate); time =3D ktime_get(); - - busy_time =3D busy_cycles - df->busy_cycles; status->total_time =3D ktime_us_delta(time, df->time); + df->time =3D time; =20 + if (df->suspended) { + mutex_unlock(&df->lock); + status->busy_time =3D 0; + return; + } + + busy_cycles =3D gpu->funcs->gpu_busy(gpu, &sample_rate); + busy_time =3D busy_cycles - df->busy_cycles; df->busy_cycles =3D busy_cycles; - df->time =3D time; + + mutex_unlock(&df->lock); =20 busy_time *=3D USEC_PER_SEC; do_div(busy_time, sample_rate); @@ -175,6 +188,8 @@ void msm_devfreq_init(struct msm_gpu *gpu) if (!gpu->funcs->gpu_busy) return; =20 + mutex_init(&df->lock); + dev_pm_qos_add_request(&gpu->pdev->dev, &df->idle_freq, DEV_PM_QOS_MAX_FREQUENCY, PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE); @@ -244,12 +259,16 @@ void msm_devfreq_cleanup(struct msm_gpu *gpu) void msm_devfreq_resume(struct msm_gpu *gpu) { struct msm_gpu_devfreq *df =3D &gpu->devfreq; + unsigned long sample_rate; =20 if (!has_devfreq(gpu)) return; =20 - df->busy_cycles =3D 0; + mutex_lock(&df->lock); + df->busy_cycles =3D gpu->funcs->gpu_busy(gpu, &sample_rate); df->time =3D ktime_get(); + df->suspended =3D false; + mutex_unlock(&df->lock); =20 devfreq_resume_device(df->devfreq); } @@ -261,6 +280,10 @@ void msm_devfreq_suspend(struct msm_gpu *gpu) if (!has_devfreq(gpu)) return; =20 + mutex_lock(&df->lock); + df->suspended =3D true; + mutex_unlock(&df->lock); + devfreq_suspend_device(df->devfreq); =20 cancel_idle_work(df); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE760C25B0E for ; Mon, 15 Aug 2022 21:12:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344146AbiHOVLg (ORCPT ); Mon, 15 Aug 2022 17:11:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347695AbiHOVHP (ORCPT ); Mon, 15 Aug 2022 17:07:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 834EDB3B39; Mon, 15 Aug 2022 12:15:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1448AB8110A; Mon, 15 Aug 2022 19:15:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66A73C433D6; Mon, 15 Aug 2022 19:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590947; bh=A7ewpQEt3rqc/dX6YH/ywzUaXlCgXOfEWwGpF3U/FuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v7z4eZioZgtzuXW8emcKlLeMR6hjl8mxWUUphBuFk2ZHw4nInWtUdoKILlh8lu2mi EElvqwrhj2jAbyG/hvMCiw6Pspw8tfX9YtII1BgWUP01x8JL+q/Wl3FaKKz0msl6lP fQQvR2yaIjW59nlLgZ/vKbCyUC4Plmnl/6mv+grw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yixun Lan , Daniel Borkmann , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Amjad OULED-AMEUR , Sasha Levin Subject: [PATCH 5.18 0422/1095] libbpf, riscv: Use a0 for RC register Date: Mon, 15 Aug 2022 19:57:01 +0200 Message-Id: <20220815180447.173186472@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yixun Lan [ Upstream commit 935dc35c75318fa213d26808ad8bb130fb0b486e ] According to the RISC-V calling convention register usage here [0], a0 is used as return value register, so rename it to make it consistent with the spec. [0] section 18.2, table 18.2 https://riscv.org/wp-content/uploads/2015/01/riscv-calling.pdf Fixes: 589fed479ba1 ("riscv, libbpf: Add RISC-V (RV64) support to bpf_traci= ng.h") Signed-off-by: Yixun Lan Signed-off-by: Daniel Borkmann Acked-by: Bj=C3=B6rn T=C3=B6pel Acked-by: Amjad OULED-AMEUR Link: https://lore.kernel.org/bpf/20220706140204.47926-1-dlan@gentoo.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/lib/bpf/bpf_tracing.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h index e3a8c947e89f..479f514f7411 100644 --- a/tools/lib/bpf/bpf_tracing.h +++ b/tools/lib/bpf/bpf_tracing.h @@ -227,7 +227,7 @@ struct pt_regs___arm64 { #define __PT_PARM5_REG a4 #define __PT_RET_REG ra #define __PT_FP_REG s0 -#define __PT_RC_REG a5 +#define __PT_RC_REG a0 #define __PT_SP_REG sp #define __PT_IP_REG pc /* riscv does not select ARCH_HAS_SYSCALL_WRAPPER. */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC1ECC28B2C for ; Mon, 15 Aug 2022 21:12:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343948AbiHOVLe (ORCPT ); Mon, 15 Aug 2022 17:11:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347699AbiHOVHQ (ORCPT ); Mon, 15 Aug 2022 17:07:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01F5EB9FBE; Mon, 15 Aug 2022 12:15:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 70D3960F6A; Mon, 15 Aug 2022 19:15:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A6A2C433D6; Mon, 15 Aug 2022 19:15:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590950; bh=qthlUxLyneTrQoXxQBbYo31Gy/R5BpXEYmeBs7zGNCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JJNG8BkWjCKwAeqtRiUj0UNGYKTIC3xia4bYcdWj2Ln/C7b8DslNr2jDyvfcu8Oh3 x93sCwwzd22iNxQIefioP5l8FD3CLs587XIN9vN4WdN67vvrpmiz/rZPgoypuxJ0En jhsyP7XxgFeHre3jCqEaxKuNOnaSedW3trmwAM0E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Abhinav Kumar , Sasha Levin Subject: [PATCH 5.18 0423/1095] drm/msm/mdp5: Fix global state lock backoff Date: Mon, 15 Aug 2022 19:57:02 +0200 Message-Id: <20220815180447.224365926@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rob Clark [ Upstream commit 92ef86ab513593c6329d04146e61f9a670e72fc5 ] We need to grab the lock after the early return for !hwpipe case. Otherwise, we could have hit contention yet still returned 0. Fixes an issue that the new CONFIG_DRM_DEBUG_MODESET_LOCK stuff flagged in CI: WARNING: CPU: 0 PID: 282 at drivers/gpu/drm/drm_modeset_lock.c:296 drm_m= odeset_lock+0xf8/0x154 Modules linked in: CPU: 0 PID: 282 Comm: kms_cursor_lega Tainted: G W 5.19.0= -rc2-15930-g875cc8bc536a #1 Hardware name: Qualcomm Technologies, Inc. DB820c (DT) pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) pc : drm_modeset_lock+0xf8/0x154 lr : drm_atomic_get_private_obj_state+0x84/0x170 sp : ffff80000cfab6a0 x29: ffff80000cfab6a0 x28: 0000000000000000 x27: ffff000083bc4d00 x26: 0000000000000038 x25: 0000000000000000 x24: ffff80000957ca58 x23: 0000000000000000 x22: ffff000081ace080 x21: 0000000000000001 x20: ffff000081acec18 x19: ffff80000cfabb80 x18: 0000000000000038 x17: 0000000000000000 x16: 0000000000000000 x15: fffffffffffea0d0 x14: 0000000000000000 x13: 284e4f5f4e524157 x12: 5f534b434f4c5f47 x11: ffff80000a386aa8 x10: 0000000000000029 x9 : ffff80000cfab610 x8 : 0000000000000029 x7 : 0000000000000014 x6 : 0000000000000000 x5 : 0000000000000001 x4 : ffff8000081ad904 x3 : 0000000000000029 x2 : ffff0000801db4c0 x1 : ffff80000cfabb80 x0 : ffff000081aceb58 Call trace: drm_modeset_lock+0xf8/0x154 drm_atomic_get_private_obj_state+0x84/0x170 mdp5_get_global_state+0x54/0x6c mdp5_pipe_release+0x2c/0xd4 mdp5_plane_atomic_check+0x2ec/0x414 drm_atomic_helper_check_planes+0xd8/0x210 drm_atomic_helper_check+0x54/0xb0 ... ---[ end trace 0000000000000000 ]--- drm_modeset_lock attempting to lock a contended lock without backoff: drm_modeset_lock+0x148/0x154 mdp5_get_global_state+0x30/0x6c mdp5_pipe_release+0x2c/0xd4 mdp5_plane_atomic_check+0x290/0x414 drm_atomic_helper_check_planes+0xd8/0x210 drm_atomic_helper_check+0x54/0xb0 drm_atomic_check_only+0x4b0/0x8f4 drm_atomic_commit+0x68/0xe0 Fixes: d59be579fa93 ("drm/msm/mdp5: Return error code in mdp5_pipe_release = when deadlock is detected") Signed-off-by: Rob Clark Reviewed-by: Abhinav Kumar Patchwork: https://patchwork.freedesktop.org/patch/492701/ Link: https://lore.kernel.org/r/20220707162040.1594855-1-robdclark@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c b/drivers/gpu/drm/ms= m/disp/mdp5/mdp5_pipe.c index a4f5cb90f3e8..e4b8a789835a 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c @@ -123,12 +123,13 @@ int mdp5_pipe_release(struct drm_atomic_state *s, str= uct mdp5_hw_pipe *hwpipe) { struct msm_drm_private *priv =3D s->dev->dev_private; struct mdp5_kms *mdp5_kms =3D to_mdp5_kms(to_mdp_kms(priv->kms)); - struct mdp5_global_state *state =3D mdp5_get_global_state(s); + struct mdp5_global_state *state; struct mdp5_hw_pipe_state *new_state; =20 if (!hwpipe) return 0; =20 + state =3D mdp5_get_global_state(s); if (IS_ERR(state)) return PTR_ERR(state); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B40CC2BB43 for ; Mon, 15 Aug 2022 21:12:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344720AbiHOVLs (ORCPT ); Mon, 15 Aug 2022 17:11:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347788AbiHOVHe (ORCPT ); Mon, 15 Aug 2022 17:07:34 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D29CD5DFC; Mon, 15 Aug 2022 12:15:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C0D11CE12C5; Mon, 15 Aug 2022 19:15:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5DF5C433D7; Mon, 15 Aug 2022 19:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590954; bh=Q8Hc5xyH/xwarte89q54kVHnwt5Jx0tft9JuJvXgEEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WCZVbsqQ8W09FXShZlp49xw3HVlN0MpQ29i01U5FX5aHbBcXru/yOjfaD6i8Nk7eU fXErA1dqVe+NNIp5EVjEEw7aL5dM+XPWll/PpXd52IkfDv9lsYu5kw6fXtfRaxEtKT +JWaM/DzINMZv2MuSBTMZAqj1KyOyeHNa7y9pLnU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Jonathan Gray , =?UTF-8?q?Mateusz=20Jo=C5=84czyk?= , Sasha Levin Subject: [PATCH 5.18 0424/1095] drm/radeon: avoid bogus "vram limit (0) must be a power of 2" warning Date: Mon, 15 Aug 2022 19:57:03 +0200 Message-Id: <20220815180447.272844505@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mateusz Jo=C5=84czyk [ Upstream commit 9da2902609f7519c48eda84f953f72fee53f2b71 ] I was getting the following message on boot on Linux 5.19-rc5: radeon 0000:01:05.0: vram limit (0) must be a power of 2 (I didn't use any radeon.vramlimit commandline parameter). This is caused by commit 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than loca= l version") which removed radeon_check_pot_argument() and converted its users to is_power_of_2(). The two functions differ in its handling of 0, which is the default value of radeon_vram_limit: radeon_check_pot_argument() "incorrectly" considered it a power of 2, while is_power_of_2() does not. An appropriate conditional silences the warning message. It is not necessary to add a similar test to other callers of is_power_of_2() in radeon_device.c. The matching commit in amdgpu: commit 761175078466 ("drm/amdgpu: use kernel is_power_of_2 rather than loca= l version") is unaffected by this bug. Tested on Radeon HD 3200. Not ccing stable, this is not serious enough. Fixes: 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than loca= l version") Cc: Alex Deucher Cc: Christian K=C3=B6nig Cc: "Pan, Xinhui" Cc: David Airlie Cc: Daniel Vetter Cc: Jonathan Gray Signed-off-by: Mateusz Jo=C5=84czyk Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/radeon/radeon_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeo= n/radeon_device.c index 15692cb241fc..429644d5ddc6 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -1113,7 +1113,7 @@ static int radeon_gart_size_auto(enum radeon_family f= amily) static void radeon_check_arguments(struct radeon_device *rdev) { /* vramlimit must be a power of two */ - if (!is_power_of_2(radeon_vram_limit)) { + if (radeon_vram_limit !=3D 0 && !is_power_of_2(radeon_vram_limit)) { dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n", radeon_vram_limit); radeon_vram_limit =3D 0; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59F4BC3F6B0 for ; Mon, 15 Aug 2022 21:18:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344976AbiHOVRi (ORCPT ); Mon, 15 Aug 2022 17:17:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347730AbiHOVHS (ORCPT ); Mon, 15 Aug 2022 17:07:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44D15D7CC0; Mon, 15 Aug 2022 12:16:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8F32660F68; Mon, 15 Aug 2022 19:16:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65520C433C1; Mon, 15 Aug 2022 19:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590960; bh=TV1A34qSeVnvK3T5CmuOfDs7H8Ocm+rnoh5pu/mpe1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pYtuTMA7VkvQm4h0sDbfo1MVvaDsRJZwDZQmi9oMM8DRgq8JFqEAjrBiN3KOdIvrf DOFeF/IXYTiev9KJVd5Wd1FUk2SPzzrZInh7IbzsBCX5JQX6fKvcQ+YI6Nd42xbtlS zP3M/uPflskz8sP9GS6Ipikxd/GdvG+A4rHJpArc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengchao Shao , Herbert Xu , Sasha Levin Subject: [PATCH 5.18 0425/1095] crypto: hisilicon/sec - dont sleep when in softirq Date: Mon, 15 Aug 2022 19:57:04 +0200 Message-Id: <20220815180447.314041633@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhengchao Shao [ Upstream commit 02884a4f12de11f54d4ca67a07dd1f111d96fdbd ] When kunpeng920 encryption driver is used to deencrypt and decrypt packets during the softirq, it is not allowed to use mutex lock. The kernel will report the following error: BUG: scheduling while atomic: swapper/57/0/0x00000300 Call trace: dump_backtrace+0x0/0x1e4 show_stack+0x20/0x2c dump_stack+0xd8/0x140 __schedule_bug+0x68/0x80 __schedule+0x728/0x840 schedule+0x50/0xe0 schedule_preempt_disabled+0x18/0x24 __mutex_lock.constprop.0+0x594/0x5dc __mutex_lock_slowpath+0x1c/0x30 mutex_lock+0x50/0x60 sec_request_init+0x8c/0x1a0 [hisi_sec2] sec_process+0x28/0x1ac [hisi_sec2] sec_skcipher_crypto+0xf4/0x1d4 [hisi_sec2] sec_skcipher_encrypt+0x1c/0x30 [hisi_sec2] crypto_skcipher_encrypt+0x2c/0x40 crypto_authenc_encrypt+0xc8/0xfc [authenc] crypto_aead_encrypt+0x2c/0x40 echainiv_encrypt+0x144/0x1a0 [echainiv] crypto_aead_encrypt+0x2c/0x40 esp_output_tail+0x348/0x5c0 [esp4] esp_output+0x120/0x19c [esp4] xfrm_output_one+0x25c/0x4d4 xfrm_output_resume+0x6c/0x1fc xfrm_output+0xac/0x3c0 xfrm4_output+0x64/0x130 ip_build_and_send_pkt+0x158/0x20c tcp_v4_send_synack+0xdc/0x1f0 tcp_conn_request+0x7d0/0x994 tcp_v4_conn_request+0x58/0x6c tcp_v6_conn_request+0xf0/0x100 tcp_rcv_state_process+0x1cc/0xd60 tcp_v4_do_rcv+0x10c/0x250 tcp_v4_rcv+0xfc4/0x10a4 ip_protocol_deliver_rcu+0xf4/0x200 ip_local_deliver_finish+0x58/0x70 ip_local_deliver+0x68/0x120 ip_sublist_rcv_finish+0x70/0x94 ip_list_rcv_finish.constprop.0+0x17c/0x1d0 ip_sublist_rcv+0x40/0xb0 ip_list_rcv+0x140/0x1dc __netif_receive_skb_list_core+0x154/0x28c __netif_receive_skb_list+0x120/0x1a0 netif_receive_skb_list_internal+0xe4/0x1f0 napi_complete_done+0x70/0x1f0 gro_cell_poll+0x9c/0xb0 napi_poll+0xcc/0x264 net_rx_action+0xd4/0x21c __do_softirq+0x130/0x358 irq_exit+0x11c/0x13c __handle_domain_irq+0x88/0xf0 gic_handle_irq+0x78/0x2c0 el1_irq+0xb8/0x140 arch_cpu_idle+0x18/0x40 default_idle_call+0x5c/0x1c0 cpuidle_idle_call+0x174/0x1b0 do_idle+0xc8/0x160 cpu_startup_entry+0x30/0x11c secondary_start_kernel+0x158/0x1e4 softirq: huh, entered softirq 3 NET_RX 0000000093774ee4 with preempt_count 00000100, exited with fffffe00? Fixes: 416d82204df4 ("crypto: hisilicon - add HiSilicon SEC V2 driver") Signed-off-by: Zhengchao Shao Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/crypto/hisilicon/sec2/sec.h | 2 +- drivers/crypto/hisilicon/sec2/sec_crypto.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/crypto/hisilicon/sec2/sec.h b/drivers/crypto/hisilicon= /sec2/sec.h index c2e9b01187a7..a44c8dba3cda 100644 --- a/drivers/crypto/hisilicon/sec2/sec.h +++ b/drivers/crypto/hisilicon/sec2/sec.h @@ -119,7 +119,7 @@ struct sec_qp_ctx { struct idr req_idr; struct sec_alg_res res[QM_Q_DEPTH]; struct sec_ctx *ctx; - struct mutex req_lock; + spinlock_t req_lock; struct list_head backlog; struct hisi_acc_sgl_pool *c_in_pool; struct hisi_acc_sgl_pool *c_out_pool; diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hi= silicon/sec2/sec_crypto.c index a91635c348b5..f193d6b6fa16 100644 --- a/drivers/crypto/hisilicon/sec2/sec_crypto.c +++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c @@ -127,11 +127,11 @@ static int sec_alloc_req_id(struct sec_req *req, stru= ct sec_qp_ctx *qp_ctx) { int req_id; =20 - mutex_lock(&qp_ctx->req_lock); + spin_lock_bh(&qp_ctx->req_lock); =20 req_id =3D idr_alloc_cyclic(&qp_ctx->req_idr, NULL, 0, QM_Q_DEPTH, GFP_ATOMIC); - mutex_unlock(&qp_ctx->req_lock); + spin_unlock_bh(&qp_ctx->req_lock); if (unlikely(req_id < 0)) { dev_err(req->ctx->dev, "alloc req id fail!\n"); return req_id; @@ -156,9 +156,9 @@ static void sec_free_req_id(struct sec_req *req) qp_ctx->req_list[req_id] =3D NULL; req->qp_ctx =3D NULL; =20 - mutex_lock(&qp_ctx->req_lock); + spin_lock_bh(&qp_ctx->req_lock); idr_remove(&qp_ctx->req_idr, req_id); - mutex_unlock(&qp_ctx->req_lock); + spin_unlock_bh(&qp_ctx->req_lock); } =20 static u8 pre_parse_finished_bd(struct bd_status *status, void *resp) @@ -273,7 +273,7 @@ static int sec_bd_send(struct sec_ctx *ctx, struct sec_= req *req) !(req->flag & CRYPTO_TFM_REQ_MAY_BACKLOG)) return -EBUSY; =20 - mutex_lock(&qp_ctx->req_lock); + spin_lock_bh(&qp_ctx->req_lock); ret =3D hisi_qp_send(qp_ctx->qp, &req->sec_sqe); =20 if (ctx->fake_req_limit <=3D @@ -281,10 +281,10 @@ static int sec_bd_send(struct sec_ctx *ctx, struct se= c_req *req) list_add_tail(&req->backlog_head, &qp_ctx->backlog); atomic64_inc(&ctx->sec->debug.dfx.send_cnt); atomic64_inc(&ctx->sec->debug.dfx.send_busy_cnt); - mutex_unlock(&qp_ctx->req_lock); + spin_unlock_bh(&qp_ctx->req_lock); return -EBUSY; } - mutex_unlock(&qp_ctx->req_lock); + spin_unlock_bh(&qp_ctx->req_lock); =20 if (unlikely(ret =3D=3D -EBUSY)) return -ENOBUFS; @@ -487,7 +487,7 @@ static int sec_create_qp_ctx(struct hisi_qm *qm, struct= sec_ctx *ctx, =20 qp->req_cb =3D sec_req_cb; =20 - mutex_init(&qp_ctx->req_lock); + spin_lock_init(&qp_ctx->req_lock); idr_init(&qp_ctx->req_idr); INIT_LIST_HEAD(&qp_ctx->backlog); =20 @@ -1382,7 +1382,7 @@ static struct sec_req *sec_back_req_clear(struct sec_= ctx *ctx, { struct sec_req *backlog_req =3D NULL; =20 - mutex_lock(&qp_ctx->req_lock); + spin_lock_bh(&qp_ctx->req_lock); if (ctx->fake_req_limit >=3D atomic_read(&qp_ctx->qp->qp_status.used) && !list_empty(&qp_ctx->backlog)) { @@ -1390,7 +1390,7 @@ static struct sec_req *sec_back_req_clear(struct sec_= ctx *ctx, typeof(*backlog_req), backlog_head); list_del(&backlog_req->backlog_head); } - mutex_unlock(&qp_ctx->req_lock); + spin_unlock_bh(&qp_ctx->req_lock); =20 return backlog_req; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09E2BC2BB45 for ; Mon, 15 Aug 2022 21:12:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344529AbiHOVLn (ORCPT ); Mon, 15 Aug 2022 17:11:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347775AbiHOVHd (ORCPT ); Mon, 15 Aug 2022 17:07:33 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E2B2D7CC5; Mon, 15 Aug 2022 12:16:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 6189BCE1087; Mon, 15 Aug 2022 19:16:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F872C433D6; Mon, 15 Aug 2022 19:16:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590962; bh=UDGcVwRi7O++OPdySi9hrL7ej4PyhcDWLK6vrD9AdiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHhiBrLRc2TI11CAY/7SSrB4m8picCbIOAyWrNvrUhUz3YTTfAN2IW78C3qppFeF8 UWQMbrMSMr+pET/wBTGSFM0PncJIfONeqhl9yYy10hpAe5QZyD6/xJJW3qzfO8UNtH GRkFg81TW6XrYaEjGLTLnGchy6oUwcrq7xCd7GtA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengchao Shao , Herbert Xu , Sasha Levin Subject: [PATCH 5.18 0426/1095] crypto: hisilicon - Kunpeng916 crypto driver dont sleep when in softirq Date: Mon, 15 Aug 2022 19:57:05 +0200 Message-Id: <20220815180447.347753642@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhengchao Shao [ Upstream commit 68740ab505431f268dc1ee26a54b871e75f0ddaa ] When kunpeng916 encryption driver is used to deencrypt and decrypt packets during the softirq, it is not allowed to use mutex lock. Fixes: 915e4e8413da ("crypto: hisilicon - SEC security accelerator driver") Signed-off-by: Zhengchao Shao Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/crypto/hisilicon/sec/sec_algs.c | 14 +++++++------- drivers/crypto/hisilicon/sec/sec_drv.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/hisilicon/sec/sec_algs.c b/drivers/crypto/hisil= icon/sec/sec_algs.c index 0a3c8f019b02..490e1542305e 100644 --- a/drivers/crypto/hisilicon/sec/sec_algs.c +++ b/drivers/crypto/hisilicon/sec/sec_algs.c @@ -449,7 +449,7 @@ static void sec_skcipher_alg_callback(struct sec_bd_inf= o *sec_resp, */ } =20 - mutex_lock(&ctx->queue->queuelock); + spin_lock_bh(&ctx->queue->queuelock); /* Put the IV in place for chained cases */ switch (ctx->cipher_alg) { case SEC_C_AES_CBC_128: @@ -509,7 +509,7 @@ static void sec_skcipher_alg_callback(struct sec_bd_inf= o *sec_resp, list_del(&backlog_req->backlog_head); } } - mutex_unlock(&ctx->queue->queuelock); + spin_unlock_bh(&ctx->queue->queuelock); =20 mutex_lock(&sec_req->lock); list_del(&sec_req_el->head); @@ -798,7 +798,7 @@ static int sec_alg_skcipher_crypto(struct skcipher_requ= est *skreq, */ =20 /* Grab a big lock for a long time to avoid concurrency issues */ - mutex_lock(&queue->queuelock); + spin_lock_bh(&queue->queuelock); =20 /* * Can go on to queue if we have space in either: @@ -814,15 +814,15 @@ static int sec_alg_skcipher_crypto(struct skcipher_re= quest *skreq, ret =3D -EBUSY; if ((skreq->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)) { list_add_tail(&sec_req->backlog_head, &ctx->backlog); - mutex_unlock(&queue->queuelock); + spin_unlock_bh(&queue->queuelock); goto out; } =20 - mutex_unlock(&queue->queuelock); + spin_unlock_bh(&queue->queuelock); goto err_free_elements; } ret =3D sec_send_request(sec_req, queue); - mutex_unlock(&queue->queuelock); + spin_unlock_bh(&queue->queuelock); if (ret) goto err_free_elements; =20 @@ -881,7 +881,7 @@ static int sec_alg_skcipher_init(struct crypto_skcipher= *tfm) if (IS_ERR(ctx->queue)) return PTR_ERR(ctx->queue); =20 - mutex_init(&ctx->queue->queuelock); + spin_lock_init(&ctx->queue->queuelock); ctx->queue->havesoftqueue =3D false; =20 return 0; diff --git a/drivers/crypto/hisilicon/sec/sec_drv.h b/drivers/crypto/hisili= con/sec/sec_drv.h index 179a8250d691..e2a50bf2234b 100644 --- a/drivers/crypto/hisilicon/sec/sec_drv.h +++ b/drivers/crypto/hisilicon/sec/sec_drv.h @@ -347,7 +347,7 @@ struct sec_queue { DECLARE_BITMAP(unprocessed, SEC_QUEUE_LEN); DECLARE_KFIFO_PTR(softqueue, typeof(struct sec_request_el *)); bool havesoftqueue; - struct mutex queuelock; + spinlock_t queuelock; void *shadow[SEC_QUEUE_LEN]; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32C42C2BB47 for ; Mon, 15 Aug 2022 21:12:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344818AbiHOVLv (ORCPT ); Mon, 15 Aug 2022 17:11:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347790AbiHOVHf (ORCPT ); Mon, 15 Aug 2022 17:07:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9BAD8D3D5; Mon, 15 Aug 2022 12:16:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1469AB81115; Mon, 15 Aug 2022 19:16:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F952C433C1; Mon, 15 Aug 2022 19:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590965; bh=9O9iAJb5khkUCY/Vmag+s/+bSwnnOfdvyRWWB2nxb6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o893bpvoZyG1R/xtSyghHuaT1ktE6H85QR2NbIsM0EMuUQd57DkConZCoSRXbpqyh ZUoKHmR5PArJ+9557FELLErsGqsTivaXLuKAnZRtwyyeuaixERF2I+qwO83l33MTNi fycYH57JtFqyACB9QUC50FDqu7JOoYNSufX3V07s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Houlong Wei , Irui Wang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0427/1095] media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment Date: Mon, 15 Aug 2022 19:57:06 +0200 Message-Id: <20220815180447.387030698@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: AngeloGioacchino Del Regno [ Upstream commit ab14c99c035da7156a3b66fa171171295bc4b89a ] The mdp_ipi_comm structure defines a command that is either PROCESS (start processing) or DEINIT (destroy instance); we are using this one to send PROCESS or DEINIT commands from Linux to an MDP instance through a VPU write but, while the first wants us to stay 4-bytes aligned, the VPU instead requires an 8-bytes data alignment. Keeping in mind that these commands are executed immediately after sending them (hence not chained with others before the VPU/MDP "actually" start executing), it is fine to simply add a padding of 4 bytes to this structure: this keeps the same performance as before, as we're still stack-allocating it, while avoiding hackery inside of mtk-vpu to ensure alignment bringing a definitely bigger performance impact. Fixes: c8eb2d7e8202 ("[media] media: Add Mediatek MDP Driver") Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Houlong Wei Reviewed-by: Irui Wang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/mediatek/mdp/mtk_mdp_ipi.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/mediatek/mdp/mtk_mdp_ipi.h b/drivers/me= dia/platform/mediatek/mdp/mtk_mdp_ipi.h index 2cb8cecb3077..b810c96695c8 100644 --- a/drivers/media/platform/mediatek/mdp/mtk_mdp_ipi.h +++ b/drivers/media/platform/mediatek/mdp/mtk_mdp_ipi.h @@ -40,12 +40,14 @@ struct mdp_ipi_init { * @ipi_id : IPI_MDP * @ap_inst : AP mtk_mdp_vpu address * @vpu_inst_addr : VPU MDP instance address + * @padding : Alignment padding */ struct mdp_ipi_comm { uint32_t msg_id; uint32_t ipi_id; uint64_t ap_inst; uint32_t vpu_inst_addr; + uint32_t padding; }; =20 /** --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F13DC32757 for ; Mon, 15 Aug 2022 21:12:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230481AbiHOVMC (ORCPT ); Mon, 15 Aug 2022 17:12:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347798AbiHOVHf (ORCPT ); Mon, 15 Aug 2022 17:07:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F275451A35; Mon, 15 Aug 2022 12:16:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 25D7060FB9; Mon, 15 Aug 2022 19:16:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35483C433C1; Mon, 15 Aug 2022 19:16:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590968; bh=+52ntI2e1KU5OBA4ew9V71YL6B2bJ+BVsws6QREl/Bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aa09H9oh7fehYSGwjtD8ucyMNdxYUNL3pSBicdOIxyWI2xwcE8bbR7HfugaKEAAHI RH2/YvcDiPXt0HQJ29Ny0aG/U38CRQu+lB/kSZ6XU7z7x21IxguPgJd51Oe3JvADGl tQrPBcHwx5Kw1Eet0lnZaSRFPzhmyBOK5YzKd8eg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0428/1095] media: amphion: release core lock before reset vpu core Date: Mon, 15 Aug 2022 19:57:07 +0200 Message-Id: <20220815180447.417794125@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit a621cc4bed97e49f5a8019f5215dec7e208a7c4d ] In reset vpu core, driver will wait for a response event, but if there are still some events unhandled, they will be handled first, driver may acquire core lock for that. So if we do reset in core lock, it may led to reset timeout. Fixes: 9f599f351e86a ("media: amphion: add vpu core driver") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/amphion/vpu_core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/plat= form/amphion/vpu_core.c index 68ad183925fd..51a764713159 100644 --- a/drivers/media/platform/amphion/vpu_core.c +++ b/drivers/media/platform/amphion/vpu_core.c @@ -455,8 +455,13 @@ int vpu_inst_unregister(struct vpu_inst *inst) } vpu_core_check_hang(core); if (core->state =3D=3D VPU_CORE_HANG && !core->instance_mask) { + int err; + dev_info(core->dev, "reset hang core\n"); - if (!vpu_core_sw_reset(core)) { + mutex_unlock(&core->lock); + err =3D vpu_core_sw_reset(core); + mutex_lock(&core->lock); + if (!err) { core->state =3D VPU_CORE_ACTIVE; core->hang_mask =3D 0; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57EE4C25B08 for ; Mon, 15 Aug 2022 21:18:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343898AbiHOVRP (ORCPT ); Mon, 15 Aug 2022 17:17:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348066AbiHOVIC (ORCPT ); Mon, 15 Aug 2022 17:08:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 872373C8FA; Mon, 15 Aug 2022 12:18:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1B440B81115; Mon, 15 Aug 2022 19:18:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FBDDC433C1; Mon, 15 Aug 2022 19:18:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591092; bh=ndmVlTPDED50pu5GSZoOJaw1o/lfGAtkCF85mjTLRXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fgxp0xoVpRqu5nqthZtfBgbSbKdouo+hmWD4ZkIrv5pbWXSm4Y3prZQCp4SAeRvD6 7zClizCss36ebCcm0E0A2ZoviGTaYvpm8/Zu/Bobx3P6Bnjn0ACJ6GPAAaWwdfSr/k 4dVlo5qGXSWVl7H7vNyL7zqYUBobfRvHK+pf9qbo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Sasha Levin Subject: [PATCH 5.18 0429/1095] drm/msm/dpu: Fix for non-visible planes Date: Mon, 15 Aug 2022 19:57:08 +0200 Message-Id: <20220815180447.456371119@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rob Clark [ Upstream commit cb77085b1f0a86ef9dfba86b5f3ed6c3340c2ea3 ] Fixes `kms_cursor_crc --run-subtest cursor-offscreen`.. when the cursor moves offscreen the plane becomes non-visible, so we need to skip over it in crtc atomic test and mixer setup. Signed-off-by: Rob Clark Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") Reviewed-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar Patchwork: https://patchwork.freedesktop.org/patch/492819/ Link: https://lore.kernel.org/r/20220707212003.1710163-1-robdclark@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm= /disp/dpu1/dpu_crtc.c index 16ba9f9b9a78..32715399a7c1 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -361,6 +361,9 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc= *crtc, if (!state) continue; =20 + if (!state->visible) + continue; + pstate =3D to_dpu_plane_state(state); fb =3D state->fb; =20 @@ -1125,6 +1128,9 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crt= c, if (cnt >=3D DPU_STAGE_MAX * 4) continue; =20 + if (!pstate->visible) + continue; + pstates[cnt].dpu_pstate =3D dpu_pstate; pstates[cnt].drm_pstate =3D pstate; pstates[cnt].stage =3D pstate->normalized_zpos; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5EF4C00140 for ; Mon, 15 Aug 2022 21:12:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231583AbiHOVMx (ORCPT ); Mon, 15 Aug 2022 17:12:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347913AbiHOVHp (ORCPT ); Mon, 15 Aug 2022 17:07:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E8683C8CB; Mon, 15 Aug 2022 12:16:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2CC36B8107A; Mon, 15 Aug 2022 19:16:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ADA2C433D6; Mon, 15 Aug 2022 19:16:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590992; bh=G6869hI4IspcflH37LO4N3qRMAFa9aQF+7X6uqFqdmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eqmNSOG1IDQsuq8VErMfKgPK7VT/p+GZGJ1R3tzbTcePqc3AkHA8mvH70I7+lWu1m Yx9pE1DolyQG5o6mrfTITaKQKhD9Lx83ovH/3zG7C5z+DIC7HV2FVfJKxGe6R+DPII p0KNBwfBQdfm0IC6okXhxK9R4Oy0E1OnOa5yiOiM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Yunfei Dong , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0430/1095] media: mediatek: vcodec: Initialize decoder parameters for each instance Date: Mon, 15 Aug 2022 19:57:09 +0200 Message-Id: <20220815180447.494572285@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chen-Yu Tsai [ Upstream commit fe3d651627d61210c6905339e5281d3b9db75033 ] The decoder parameters are stored in each instance's context data. This needs to be initialized per-instance, but a previous fix incorrectly changed it to only be initialized for the first opened instance. This resulted in subsequent instances not correctly signaling the requirement for the Requests API. Fix this by calling the initializing function outside of the v4l2_fh_is_singular() conditional block. Fixes: faddaa735c20 ("media: mediatek: vcodec: Initialize decoder parameter= s after getting dec_capability") Signed-off-by: Chen-Yu Tsai Reviewed-by: Yunfei Dong Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/= drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c index d5c94845ea42..ff8f2a4829a3 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c @@ -211,11 +211,12 @@ static int fops_vcodec_open(struct file *file) =20 dev->dec_capability =3D mtk_vcodec_fw_get_vdec_capa(dev->fw_handler); - ctx->dev->vdec_pdata->init_vdec_params(ctx); =20 mtk_v4l2_debug(0, "decoder capability %x", dev->dec_capability); } =20 + ctx->dev->vdec_pdata->init_vdec_params(ctx); + list_add(&ctx->list, &dev->ctx_list); =20 mutex_unlock(&dev->dev_mutex); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C680C00140 for ; Mon, 15 Aug 2022 21:14:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240255AbiHOVOy (ORCPT ); Mon, 15 Aug 2022 17:14:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347966AbiHOVHt (ORCPT ); Mon, 15 Aug 2022 17:07:49 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C44A2D1ED; Mon, 15 Aug 2022 12:17:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 12BAACE1087; Mon, 15 Aug 2022 19:17:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1816CC433D6; Mon, 15 Aug 2022 19:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591027; bh=FARaVPvRMXStF/MY3YQIh2YsGGkPGTewGxsp8JT6BLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oKSuebbdCDpG/L6A32kPWEL+0quW9rmFS0v414egat5bd8krIV/FYdaLsWzgl0tZ6 OjDlgT0hdp5iYZJ/b7bStKKuIa1afylE1bERK2bO1TMDse5krgIqfn+boqDwinyNhH x35tipVvVLL1xqNHSj/gH4yOzNte8E2drJ3VL9f8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0431/1095] media: amphion: defer setting last_buffer_dequeued until resolution changes are processed Date: Mon, 15 Aug 2022 19:57:10 +0200 Message-Id: <20220815180447.528837559@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit afba6e20801ad9a2f863c52c21e609e021269d83 ] Don't set last_buffer_dequeued during dynamic resolution change, otherwise it may be cleared in handling resolution change, as streamoff may be called in dynamic resolution change. Normally, this does not happen. But we encounter a special testcase, User issue V4L2_DEC_CMD_STOP after enqueue one buffer that only contains codec config header, but not any frame data. So VPU report the parsed resolution, then report the eos event. So driver should notify user to handle resolution change first, after it's handled, set the last_buffer_dequeued. then the user can exit decoding normally. Otherwise the user may be stalled. Fixes: 6de8d628df6ef ("media: amphion: add v4l2 m2m vpu decoder stateful dr= iver") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/amphion/vdec.c | 36 ++++++++++++++--------- drivers/media/platform/amphion/vpu_v4l2.c | 2 +- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform= /amphion/vdec.c index c0dfede11ab7..a91f88fdb5ef 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -174,16 +174,6 @@ static int vdec_ctrl_init(struct vpu_inst *inst) return 0; } =20 -static void vdec_set_last_buffer_dequeued(struct vpu_inst *inst) -{ - struct vdec_t *vdec =3D inst->priv; - - if (vdec->eos_received) { - if (!vpu_set_last_buffer_dequeued(inst)) - vdec->eos_received--; - } -} - static void vdec_handle_resolution_change(struct vpu_inst *inst) { struct vdec_t *vdec =3D inst->priv; @@ -230,6 +220,21 @@ static int vdec_update_state(struct vpu_inst *inst, en= um vpu_codec_state state, return 0; } =20 +static void vdec_set_last_buffer_dequeued(struct vpu_inst *inst) +{ + struct vdec_t *vdec =3D inst->priv; + + if (inst->state =3D=3D VPU_CODEC_STATE_DYAMIC_RESOLUTION_CHANGE) + return; + + if (vdec->eos_received) { + if (!vpu_set_last_buffer_dequeued(inst)) { + vdec->eos_received--; + vdec_update_state(inst, VPU_CODEC_STATE_DRAIN, 0); + } + } +} + static int vdec_querycap(struct file *file, void *fh, struct v4l2_capabili= ty *cap) { strscpy(cap->driver, "amphion-vpu", sizeof(cap->driver)); @@ -489,6 +494,8 @@ static int vdec_drain(struct vpu_inst *inst) =20 static int vdec_cmd_start(struct vpu_inst *inst) { + struct vdec_t *vdec =3D inst->priv; + switch (inst->state) { case VPU_CODEC_STATE_STARTED: case VPU_CODEC_STATE_DRAIN: @@ -499,6 +506,8 @@ static int vdec_cmd_start(struct vpu_inst *inst) break; } vpu_process_capture_buffer(inst); + if (vdec->eos_received) + vdec_set_last_buffer_dequeued(inst); return 0; } =20 @@ -1188,7 +1197,6 @@ static void vdec_event_eos(struct vpu_inst *inst) vdec->eos_received++; vdec->fixed_fmt =3D false; inst->min_buffer_cap =3D VDEC_MIN_BUFFER_CAP; - vdec_update_state(inst, VPU_CODEC_STATE_DRAIN, 0); vdec_set_last_buffer_dequeued(inst); vpu_inst_unlock(inst); } @@ -1470,10 +1478,10 @@ static int vdec_stop_session(struct vpu_inst *inst,= u32 type) vdec_update_state(inst, VPU_CODEC_STATE_SEEK, 0); vdec->drain =3D 0; } else { - if (inst->state !=3D VPU_CODEC_STATE_DYAMIC_RESOLUTION_CHANGE) + if (inst->state !=3D VPU_CODEC_STATE_DYAMIC_RESOLUTION_CHANGE) { vdec_abort(inst); - - vdec->eos_received =3D 0; + vdec->eos_received =3D 0; + } vdec_clear_slots(inst); } =20 diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/plat= form/amphion/vpu_v4l2.c index 4183a3994d30..5584b3848107 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -440,8 +440,8 @@ static int vpu_vb2_start_streaming(struct vb2_queue *q,= unsigned int count) fmt->sizeimage[1], fmt->bytesperline[1], fmt->sizeimage[2], fmt->bytesperline[2], q->num_buffers); - ret =3D call_vop(inst, start, q->type); vb2_clear_last_buffer_dequeued(q); + ret =3D call_vop(inst, start, q->type); if (ret) vpu_vb2_buffers_return(inst, q->type, VB2_BUF_STATE_QUEUED); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E625C28B2B for ; Mon, 15 Aug 2022 21:18:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244385AbiHOVQ0 (ORCPT ); Mon, 15 Aug 2022 17:16:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348016AbiHOVH4 (ORCPT ); Mon, 15 Aug 2022 17:07:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D123E3C8C6; Mon, 15 Aug 2022 12:17:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7EB0CB810A3; Mon, 15 Aug 2022 19:17:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6816C433C1; Mon, 15 Aug 2022 19:17:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591062; bh=Mx87WYwyT1wEKTM8f5AUem/0iBZPW2/lVxXm8BygN5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oVZyy4w/4vVj+o2W3LJN+uXJ7dWogqNsQH7C/zpAhVjyUdZYrotlGH1AA7ZF/HOpw U3vo6dZmINL2o5n4XmRX1JllEQANCMSoAEPBGVirBLZ1IFF8SnYafZnzlxRaS09vOT VLLLTGRpjsA5oTrWu9bfVwpDzaUTfUfBqAEONA0s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Piotr Oniszczuk , Ezequiel Garcia , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0432/1095] media: hantro: Add support for Hantro G1 on RK356x Date: Mon, 15 Aug 2022 19:57:11 +0200 Message-Id: <20220815180447.563742677@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Piotr Oniszczuk [ Upstream commit 5f6bfab6da6531238e899fdf29efd6d0185adc3e ] RK356x has Hantro G1 video decoder capable to decode MPEG2/H.264/VP8 video formats. This patch adds support for RK356x family in existing Hantro video decoder kernel driver. Tested on [1] with FFmpeg v4l2_request code taken from [2] with MPEG2, H.642 and VP8 samples with results [3]. [1] https://github.com/warpme/minimyth2 [2] https://github.com/LibreELEC/LibreELEC.tv/blob/master/packages/multimed= ia/ffmpeg/patches/v4l2-request/ffmpeg-001-v4l2-request.patch [3] https://github.com/warpme/minimyth2/blob/master/video-test-summary.txt Signed-off-by: Piotr Oniszczuk Reviewed-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 + drivers/staging/media/hantro/rockchip_vpu_hw.c | 14 ++++++++++++++ 3 files changed, 16 insertions(+) diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/me= dia/hantro/hantro_drv.c index bd7d11032c94..ac232b5f7825 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -638,6 +638,7 @@ static const struct of_device_id of_hantro_match[] =3D { { .compatible =3D "rockchip,rk3288-vpu", .data =3D &rk3288_vpu_variant, }, { .compatible =3D "rockchip,rk3328-vpu", .data =3D &rk3328_vpu_variant, }, { .compatible =3D "rockchip,rk3399-vpu", .data =3D &rk3399_vpu_variant, }, + { .compatible =3D "rockchip,rk3568-vpu", .data =3D &rk3568_vpu_variant, }, #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible =3D "nxp,imx8mm-vpu-g1", .data =3D &imx8mm_vpu_g1_variant, = }, diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/med= ia/hantro/hantro_hw.h index ed018e293ba0..c5dc77125fb7 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -300,6 +300,7 @@ extern const struct hantro_variant rk3066_vpu_variant; extern const struct hantro_variant rk3288_vpu_variant; extern const struct hantro_variant rk3328_vpu_variant; extern const struct hantro_variant rk3399_vpu_variant; +extern const struct hantro_variant rk3568_vpu_variant; extern const struct hantro_variant sama5d4_vdec_variant; extern const struct hantro_variant sunxi_vpu_variant; =20 diff --git a/drivers/staging/media/hantro/rockchip_vpu_hw.c b/drivers/stagi= ng/media/hantro/rockchip_vpu_hw.c index 163cf92eafca..fc96501f3bc8 100644 --- a/drivers/staging/media/hantro/rockchip_vpu_hw.c +++ b/drivers/staging/media/hantro/rockchip_vpu_hw.c @@ -545,6 +545,20 @@ const struct hantro_variant rk3399_vpu_variant =3D { .num_clocks =3D ARRAY_SIZE(rockchip_vpu_clk_names) }; =20 +const struct hantro_variant rk3568_vpu_variant =3D { + .dec_offset =3D 0x400, + .dec_fmts =3D rk3399_vpu_dec_fmts, + .num_dec_fmts =3D ARRAY_SIZE(rk3399_vpu_dec_fmts), + .codec =3D HANTRO_MPEG2_DECODER | + HANTRO_VP8_DECODER | HANTRO_H264_DECODER, + .codec_ops =3D rk3399_vpu_codec_ops, + .irqs =3D rockchip_vdpu2_irqs, + .num_irqs =3D ARRAY_SIZE(rockchip_vdpu2_irqs), + .init =3D rockchip_vpu_hw_init, + .clk_names =3D rockchip_vpu_clk_names, + .num_clocks =3D ARRAY_SIZE(rockchip_vpu_clk_names) +}; + const struct hantro_variant px30_vpu_variant =3D { .enc_offset =3D 0x0, .enc_fmts =3D rockchip_vpu_enc_fmts, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C965AC2BB47 for ; Mon, 15 Aug 2022 21:18:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245064AbiHOVQs (ORCPT ); Mon, 15 Aug 2022 17:16:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348039AbiHOVIA (ORCPT ); Mon, 15 Aug 2022 17:08:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1E1E2E691; Mon, 15 Aug 2022 12:17:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AD945B8107A; Mon, 15 Aug 2022 19:17:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3656C433C1; Mon, 15 Aug 2022 19:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591074; bh=Wyzz/kX11fAf7yn4QudM02EmmHD4vOUHB5xDkUDigwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P3WrSgvsx/pjV5teS6Gb4XU8eBvozrYaTTfOC6nHj3uWyLy+Qx8+f8w/Tx3MzuQZ9 YmdWv18MYFSt5rpnXVqHSE6OTN/OPs5jFGqFW5H4VlGSIJ0lKaYA2dBiy8D+2UyJdg /Ffw9VZnuWjYwiGS+SQI9ZAIj9ByQTKiE1ZLJNu0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Fricke , Nicolas Dufresne , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0433/1095] media: staging: media: hantro: Fix typos Date: Mon, 15 Aug 2022 19:57:12 +0200 Message-Id: <20220815180447.594816922@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sebastian Fricke [ Upstream commit d8f6f1c56d5469e22eeb7cc1f3580b29e2f0fef5 ] Fix typos in comments within the Hantro driver. Signed-off-by: Sebastian Fricke Reviewed-by: Nicolas Dufresne Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/staging/media/hantro/hantro_g2_hevc_dec.c | 2 +- drivers/staging/media/hantro/hantro_hevc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c b/drivers/st= aging/media/hantro/hantro_g2_hevc_dec.c index 5f3178bac9c8..a4642ed1f463 100644 --- a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c +++ b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c @@ -401,7 +401,7 @@ static int set_ref(struct hantro_ctx *ctx) =20 set_ref_pic_list(ctx); =20 - /* We will only keep the references picture that are still used */ + /* We will only keep the reference pictures that are still used */ ctx->hevc_dec.ref_bufs_used =3D 0; =20 /* Set up addresses of DPB buffers */ diff --git a/drivers/staging/media/hantro/hantro_hevc.c b/drivers/staging/m= edia/hantro/hantro_hevc.c index b49a41d7ae91..9c351f7fe6bd 100644 --- a/drivers/staging/media/hantro/hantro_hevc.c +++ b/drivers/staging/media/hantro/hantro_hevc.c @@ -59,7 +59,7 @@ dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, struct hantro_hevc_dec_hw_ctx *hevc_dec =3D &ctx->hevc_dec; int i; =20 - /* Find the reference buffer in already know ones */ + /* Find the reference buffer in already known ones */ for (i =3D 0; i < NUM_REF_PICTURES; i++) { if (hevc_dec->ref_bufs_poc[i] =3D=3D poc) { hevc_dec->ref_bufs_used |=3D 1 << i; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70A16C2BB45 for ; Mon, 15 Aug 2022 21:18:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244859AbiHOVQm (ORCPT ); Mon, 15 Aug 2022 17:16:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348038AbiHOVIA (ORCPT ); Mon, 15 Aug 2022 17:08:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B3EE3C8D7; Mon, 15 Aug 2022 12:18:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BC732B81106; Mon, 15 Aug 2022 19:17:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12156C433C1; Mon, 15 Aug 2022 19:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591077; bh=lbTs/5k4Wl+Wd+pYJniOD4sGSRSPcOtCJRp3bCpZ5HQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=arYoZvUYIf8O3wuGUl5+0ZT7tm0p0IvyyTo0NJHaiiaJ96nOMvSSrMoqCMOYOwTrQ EpZYBgxYKmkaFMKz8U/j3UFHP5pglNi2LkDLJSvXm+lwDp2MkKoSP9RfcfDB861deD MGP8CKqVdhBRb+TocG2FYw+WAhdqzw8Hla1xB/Vw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Gaignard , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0434/1095] media: hantro: HEVC: Fix output frame chroma offset Date: Mon, 15 Aug 2022 19:57:13 +0200 Message-Id: <20220815180447.634825691@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Benjamin Gaignard [ Upstream commit 579846ec52593e6ca123c30379103377cd25728a ] Hantro decoder doesn't take care of the requested and aligned size of the capture buffer. Stop using the bitstream width/height and use capture frame size stored in the context to get the correct values. hantro_hevc_chroma_offset() and hantro_hevc_motion_vectors_offset() are only used in hantro_g2_hevc_dec.c so take the opportunity to move them here. fluster HEVC score goes up from 77 to 85 successful tests (over 147) with this patch. Signed-off-by: Benjamin Gaignard Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../staging/media/hantro/hantro_g2_hevc_dec.c | 19 ++++++++++++++++--- drivers/staging/media/hantro/hantro_hevc.c | 17 ----------------- drivers/staging/media/hantro/hantro_hw.h | 2 -- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c b/drivers/st= aging/media/hantro/hantro_g2_hevc_dec.c index a4642ed1f463..7c046d456038 100644 --- a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c +++ b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c @@ -8,6 +8,20 @@ #include "hantro_hw.h" #include "hantro_g2_regs.h" =20 +#define G2_ALIGN 16 + +static size_t hantro_hevc_chroma_offset(struct hantro_ctx *ctx) +{ + return ctx->dst_fmt.width * ctx->dst_fmt.height; +} + +static size_t hantro_hevc_motion_vectors_offset(struct hantro_ctx *ctx) +{ + size_t cr_offset =3D hantro_hevc_chroma_offset(ctx); + + return ALIGN((cr_offset * 3) / 2, G2_ALIGN); +} + static void prepare_tile_info_buffer(struct hantro_ctx *ctx) { struct hantro_dev *vpu =3D ctx->dev; @@ -330,7 +344,6 @@ static void set_ref_pic_list(struct hantro_ctx *ctx) static int set_ref(struct hantro_ctx *ctx) { const struct hantro_hevc_dec_ctrls *ctrls =3D &ctx->hevc_dec.ctrls; - const struct v4l2_ctrl_hevc_sps *sps =3D ctrls->sps; const struct v4l2_ctrl_hevc_pps *pps =3D ctrls->pps; const struct v4l2_ctrl_hevc_decode_params *decode_params =3D ctrls->decod= e_params; const struct v4l2_hevc_dpb_entry *dpb =3D decode_params->dpb; @@ -338,8 +351,8 @@ static int set_ref(struct hantro_ctx *ctx) struct hantro_dev *vpu =3D ctx->dev; struct vb2_v4l2_buffer *vb2_dst; struct hantro_decoded_buffer *dst; - size_t cr_offset =3D hantro_hevc_chroma_offset(sps); - size_t mv_offset =3D hantro_hevc_motion_vectors_offset(sps); + size_t cr_offset =3D hantro_hevc_chroma_offset(ctx); + size_t mv_offset =3D hantro_hevc_motion_vectors_offset(ctx); u32 max_ref_frames; u16 dpb_longterm_e; static const struct hantro_reg cur_poc[] =3D { diff --git a/drivers/staging/media/hantro/hantro_hevc.c b/drivers/staging/m= edia/hantro/hantro_hevc.c index 9c351f7fe6bd..b3a057beaf19 100644 --- a/drivers/staging/media/hantro/hantro_hevc.c +++ b/drivers/staging/media/hantro/hantro_hevc.c @@ -27,23 +27,6 @@ =20 #define UNUSED_REF -1 =20 -#define G2_ALIGN 16 - -size_t hantro_hevc_chroma_offset(const struct v4l2_ctrl_hevc_sps *sps) -{ - int bytes_per_pixel =3D sps->bit_depth_luma_minus8 =3D=3D 0 ? 1 : 2; - - return sps->pic_width_in_luma_samples * - sps->pic_height_in_luma_samples * bytes_per_pixel; -} - -size_t hantro_hevc_motion_vectors_offset(const struct v4l2_ctrl_hevc_sps *= sps) -{ - size_t cr_offset =3D hantro_hevc_chroma_offset(sps); - - return ALIGN((cr_offset * 3) / 2, G2_ALIGN); -} - static void hantro_hevc_ref_init(struct hantro_ctx *ctx) { struct hantro_hevc_dec_hw_ctx *hevc_dec =3D &ctx->hevc_dec; diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/med= ia/hantro/hantro_hw.h index c5dc77125fb7..df142f31e31b 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -341,8 +341,6 @@ int hantro_hevc_dec_prepare_run(struct hantro_ctx *ctx); dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, int poc); int hantro_hevc_add_ref_buf(struct hantro_ctx *ctx, int poc, dma_addr_t ad= dr); void hantro_hevc_ref_remove_unused(struct hantro_ctx *ctx); -size_t hantro_hevc_chroma_offset(const struct v4l2_ctrl_hevc_sps *sps); -size_t hantro_hevc_motion_vectors_offset(const struct v4l2_ctrl_hevc_sps *= sps); =20 static inline unsigned short hantro_vp9_num_sbs(unsigned short dimension) { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BAE0C00140 for ; Mon, 15 Aug 2022 21:18:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244678AbiHOVQj (ORCPT ); Mon, 15 Aug 2022 17:16:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348042AbiHOVIA (ORCPT ); Mon, 15 Aug 2022 17:08:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 165D43C8D8; Mon, 15 Aug 2022 12:18:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BD9A9B810C6; Mon, 15 Aug 2022 19:18:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21D4FC433C1; Mon, 15 Aug 2022 19:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591080; bh=mhEgBORyV3PVFKJt5jhDc4jGPUxc6GqM6YMT/Qmh7G4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cwr1SnVsUckarkzKQAFCfHNbSMDzqrnyN34f9Y4MUpFv6JUcGxGY3ubG//gjpwgZ1 SFwqx/8gokSjXHatTaFuBSuyvMkXgWhxdVeW9MnIIfkHRKwuyUkacbwbMvnjskHOCT T8yfa4DrV2KOiDwaAsiZuwBQDXhK5VT6oOey9YAY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Gaignard , Ezequiel Garcia , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0435/1095] media: hantro: HEVC: Fix reference frames management Date: Mon, 15 Aug 2022 19:57:14 +0200 Message-Id: <20220815180447.674145076@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Benjamin Gaignard [ Upstream commit 387d1176956883635c63a7d1c91b1f45e19c1777 ] PoC shall be int the range of -2^31 to 2^31 -1 (HEVC spec section 8.3.1 Decoding process for picture order count). The current way to know if an entry in reference picture array is free is to test if PoC =3D UNUSED_REF. Since UNUSED_REF is defined as '-1' that could lead to decode issue if one PoC also equal '-1'. PoC with value =3D '-1' exists in conformance test SLIST_B_Sony_9. Change the way unused entries are managed in reference pictures array to avoid using PoC to detect then. This patch doesn't change fluster HEVC score. Signed-off-by: Benjamin Gaignard Reviewed-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../staging/media/hantro/hantro_g2_hevc_dec.c | 4 +-- drivers/staging/media/hantro/hantro_hevc.c | 27 +++---------------- drivers/staging/media/hantro/hantro_hw.h | 2 +- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c b/drivers/st= aging/media/hantro/hantro_g2_hevc_dec.c index 7c046d456038..5df6f08e26f5 100644 --- a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c +++ b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c @@ -415,7 +415,7 @@ static int set_ref(struct hantro_ctx *ctx) set_ref_pic_list(ctx); =20 /* We will only keep the reference pictures that are still used */ - ctx->hevc_dec.ref_bufs_used =3D 0; + hantro_hevc_ref_init(ctx); =20 /* Set up addresses of DPB buffers */ dpb_longterm_e =3D 0; @@ -456,8 +456,6 @@ static int set_ref(struct hantro_ctx *ctx) hantro_write_addr(vpu, G2_OUT_CHROMA_ADDR, chroma_addr); hantro_write_addr(vpu, G2_OUT_MV_ADDR, mv_addr); =20 - hantro_hevc_ref_remove_unused(ctx); - for (; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) { hantro_write_addr(vpu, G2_REF_LUMA_ADDR(i), 0); hantro_write_addr(vpu, G2_REF_CHROMA_ADDR(i), 0); diff --git a/drivers/staging/media/hantro/hantro_hevc.c b/drivers/staging/m= edia/hantro/hantro_hevc.c index b3a057beaf19..f86c98e19177 100644 --- a/drivers/staging/media/hantro/hantro_hevc.c +++ b/drivers/staging/media/hantro/hantro_hevc.c @@ -25,15 +25,11 @@ #define MAX_TILE_COLS 20 #define MAX_TILE_ROWS 22 =20 -#define UNUSED_REF -1 - -static void hantro_hevc_ref_init(struct hantro_ctx *ctx) +void hantro_hevc_ref_init(struct hantro_ctx *ctx) { struct hantro_hevc_dec_hw_ctx *hevc_dec =3D &ctx->hevc_dec; - int i; =20 - for (i =3D 0; i < NUM_REF_PICTURES; i++) - hevc_dec->ref_bufs_poc[i] =3D UNUSED_REF; + hevc_dec->ref_bufs_used =3D 0; } =20 dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, @@ -60,7 +56,7 @@ int hantro_hevc_add_ref_buf(struct hantro_ctx *ctx, int p= oc, dma_addr_t addr) =20 /* Add a new reference buffer */ for (i =3D 0; i < NUM_REF_PICTURES; i++) { - if (hevc_dec->ref_bufs_poc[i] =3D=3D UNUSED_REF) { + if (!(hevc_dec->ref_bufs_used & 1 << i)) { hevc_dec->ref_bufs_used |=3D 1 << i; hevc_dec->ref_bufs_poc[i] =3D poc; hevc_dec->ref_bufs[i].dma =3D addr; @@ -71,23 +67,6 @@ int hantro_hevc_add_ref_buf(struct hantro_ctx *ctx, int = poc, dma_addr_t addr) return -EINVAL; } =20 -void hantro_hevc_ref_remove_unused(struct hantro_ctx *ctx) -{ - struct hantro_hevc_dec_hw_ctx *hevc_dec =3D &ctx->hevc_dec; - int i; - - /* Just tag buffer as unused, do not free them */ - for (i =3D 0; i < NUM_REF_PICTURES; i++) { - if (hevc_dec->ref_bufs_poc[i] =3D=3D UNUSED_REF) - continue; - - if (hevc_dec->ref_bufs_used & (1 << i)) - continue; - - hevc_dec->ref_bufs_poc[i] =3D UNUSED_REF; - } -} - static int tile_buffer_reallocate(struct hantro_ctx *ctx) { struct hantro_dev *vpu =3D ctx->dev; diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/med= ia/hantro/hantro_hw.h index df142f31e31b..699c1efc0215 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -338,9 +338,9 @@ int hantro_hevc_dec_init(struct hantro_ctx *ctx); void hantro_hevc_dec_exit(struct hantro_ctx *ctx); int hantro_g2_hevc_dec_run(struct hantro_ctx *ctx); int hantro_hevc_dec_prepare_run(struct hantro_ctx *ctx); +void hantro_hevc_ref_init(struct hantro_ctx *ctx); dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, int poc); int hantro_hevc_add_ref_buf(struct hantro_ctx *ctx, int poc, dma_addr_t ad= dr); -void hantro_hevc_ref_remove_unused(struct hantro_ctx *ctx); =20 static inline unsigned short hantro_vp9_num_sbs(unsigned short dimension) { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99155C2BB9D for ; Mon, 15 Aug 2022 21:18:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245467AbiHOVQz (ORCPT ); Mon, 15 Aug 2022 17:16:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348040AbiHOVIA (ORCPT ); Mon, 15 Aug 2022 17:08:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7505C3C8D9; Mon, 15 Aug 2022 12:18:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 02B88B81106; Mon, 15 Aug 2022 19:18:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33CCEC433D6; Mon, 15 Aug 2022 19:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591083; bh=LhSAAOCHNX5vYNuydplNUPL5Mc5kRKP0UjU4TxxLSDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JkxDhbL+JkPAL9AYhXVUE6WipPSnEsv+pAEKQlnymz6GT+GGerrpzwvkmjN00cVtz 9zZB/CnHRTEb56ZN95FePpcegImi18eaEXvfJtWTicvzUrq9XwyVaHo/+Ybh8OMof+ TQpATrqSLl+QadYVASsn2YPYz3+Mw4hJDIagKDJw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Gaignard , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0436/1095] media: hantro: Be more accurate on pixel formats step_width constraints Date: Mon, 15 Aug 2022 19:57:15 +0200 Message-Id: <20220815180447.703513918@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Benjamin Gaignard [ Upstream commit 135ad96cb4d6bd6dace030846fe5c7ea890411ab ] On Hantro G2 decoder on IMX8MQ strides requirements aren't the same for NV12_4L4 and NV12 pixel formats. The first one use a 4 bytes padding while the last one needs 16 bytes. To be sure to provide the correct stride in all cases we need: - to relax the constraints on codec formats so set step_width to 4 - use capture queue format and not the output queue format when applying the pixel format constraints. - put the correct step_width constraints on each pixel format. Move HEVC SPS validation in hantro_hevc.c to be able to perform it when setting sps control and when starting to decode the bitstream. Add a new test in HEVC SPS validation function to check if resolution is still matching the hardware constraints. With this SAODBLK_A_MainConcept_4 and SAODBLK_B_MainConcept_4 conformance tests files are correctly decoded with both NV12 and NV12_4L4 pixel formats. These two files have a resolution of 1016x760. Add defines for the various used resolutions. For other variants than Hantro G2 on IMX8M keep the same step_width to avoid regressions. Fluster HEVC test score is now 128/147 vs 126/147 with the both pixel formats as decoder output. Fluster VP9 test score stay at 147/303. [hverkuil: fix trivial checkpatch warnings] Signed-off-by: Benjamin Gaignard Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/staging/media/hantro/hantro_drv.c | 12 +- drivers/staging/media/hantro/hantro_hevc.c | 30 +++++ drivers/staging/media/hantro/hantro_hw.h | 14 +++ drivers/staging/media/hantro/hantro_v4l2.c | 2 +- drivers/staging/media/hantro/imx8m_vpu_hw.c | 80 ++++++++++---- .../staging/media/hantro/rockchip_vpu_hw.c | 104 ++++++++++++------ .../staging/media/hantro/sama5d4_vdec_hw.c | 40 +++++-- drivers/staging/media/hantro/sunxi_vpu_hw.c | 24 +++- 8 files changed, 223 insertions(+), 83 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/me= dia/hantro/hantro_drv.c index ac232b5f7825..01d33dcb0467 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -253,6 +253,11 @@ queue_init(void *priv, struct vb2_queue *src_vq, struc= t vb2_queue *dst_vq) =20 static int hantro_try_ctrl(struct v4l2_ctrl *ctrl) { + struct hantro_ctx *ctx; + + ctx =3D container_of(ctrl->handler, + struct hantro_ctx, ctrl_handler); + if (ctrl->id =3D=3D V4L2_CID_STATELESS_H264_SPS) { const struct v4l2_ctrl_h264_sps *sps =3D ctrl->p_new.p_h264_sps; =20 @@ -268,12 +273,7 @@ static int hantro_try_ctrl(struct v4l2_ctrl *ctrl) } else if (ctrl->id =3D=3D V4L2_CID_MPEG_VIDEO_HEVC_SPS) { const struct v4l2_ctrl_hevc_sps *sps =3D ctrl->p_new.p_hevc_sps; =20 - if (sps->bit_depth_luma_minus8 !=3D sps->bit_depth_chroma_minus8) - /* Luma and chroma bit depth mismatch */ - return -EINVAL; - if (sps->bit_depth_luma_minus8 !=3D 0) - /* Only 8-bit is supported */ - return -EINVAL; + return hantro_hevc_validate_sps(ctx, sps); } else if (ctrl->id =3D=3D V4L2_CID_STATELESS_VP9_FRAME) { const struct v4l2_ctrl_vp9_frame *dec_params =3D ctrl->p_new.p_vp9_frame; =20 diff --git a/drivers/staging/media/hantro/hantro_hevc.c b/drivers/staging/m= edia/hantro/hantro_hevc.c index f86c98e19177..bd924896e409 100644 --- a/drivers/staging/media/hantro/hantro_hevc.c +++ b/drivers/staging/media/hantro/hantro_hevc.c @@ -154,6 +154,32 @@ static int tile_buffer_reallocate(struct hantro_ctx *c= tx) return -ENOMEM; } =20 +int hantro_hevc_validate_sps(struct hantro_ctx *ctx, const struct v4l2_ctr= l_hevc_sps *sps) +{ + if (sps->bit_depth_luma_minus8 !=3D sps->bit_depth_chroma_minus8) + /* Luma and chroma bit depth mismatch */ + return -EINVAL; + if (sps->bit_depth_luma_minus8 !=3D 0) + /* Only 8-bit is supported */ + return -EINVAL; + + /* + * for tile pixel format check if the width and height match + * hardware constraints + */ + if (ctx->vpu_dst_fmt->fourcc =3D=3D V4L2_PIX_FMT_NV12_4L4) { + if (ctx->dst_fmt.width !=3D + ALIGN(sps->pic_width_in_luma_samples, ctx->vpu_dst_fmt->frmsize.step= _width)) + return -EINVAL; + + if (ctx->dst_fmt.height !=3D + ALIGN(sps->pic_height_in_luma_samples, ctx->vpu_dst_fmt->frmsize.ste= p_height)) + return -EINVAL; + } + + return 0; +} + int hantro_hevc_dec_prepare_run(struct hantro_ctx *ctx) { struct hantro_hevc_dec_hw_ctx *hevc_ctx =3D &ctx->hevc_dec; @@ -177,6 +203,10 @@ int hantro_hevc_dec_prepare_run(struct hantro_ctx *ctx) if (WARN_ON(!ctrls->sps)) return -EINVAL; =20 + ret =3D hantro_hevc_validate_sps(ctx, ctrls->sps); + if (ret) + return ret; + ctrls->pps =3D hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_HEVC_PPS); if (WARN_ON(!ctrls->pps)) diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/med= ia/hantro/hantro_hw.h index 699c1efc0215..b480cf329b13 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -18,9 +18,21 @@ #define DEC_8190_ALIGN_MASK 0x07U =20 #define MB_DIM 16 +#define TILE_MB_DIM 4 #define MB_WIDTH(w) DIV_ROUND_UP(w, MB_DIM) #define MB_HEIGHT(h) DIV_ROUND_UP(h, MB_DIM) =20 +#define FMT_MIN_WIDTH 48 +#define FMT_MIN_HEIGHT 48 +#define FMT_HD_WIDTH 1280 +#define FMT_HD_HEIGHT 720 +#define FMT_FHD_WIDTH 1920 +#define FMT_FHD_HEIGHT 1088 +#define FMT_UHD_WIDTH 3840 +#define FMT_UHD_HEIGHT 2160 +#define FMT_4K_WIDTH 4096 +#define FMT_4K_HEIGHT 2304 + #define NUM_REF_PICTURES (V4L2_HEVC_DPB_ENTRIES_NUM_MAX + 1) =20 struct hantro_dev; @@ -341,6 +353,8 @@ int hantro_hevc_dec_prepare_run(struct hantro_ctx *ctx); void hantro_hevc_ref_init(struct hantro_ctx *ctx); dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, int poc); int hantro_hevc_add_ref_buf(struct hantro_ctx *ctx, int poc, dma_addr_t ad= dr); +int hantro_hevc_validate_sps(struct hantro_ctx *ctx, const struct v4l2_ctr= l_hevc_sps *sps); + =20 static inline unsigned short hantro_vp9_num_sbs(unsigned short dimension) { diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/m= edia/hantro/hantro_v4l2.c index 71a6279750bf..93d0dcf69f4a 100644 --- a/drivers/staging/media/hantro/hantro_v4l2.c +++ b/drivers/staging/media/hantro/hantro_v4l2.c @@ -260,7 +260,7 @@ static int hantro_try_fmt(const struct hantro_ctx *ctx, } else if (ctx->is_encoder) { vpu_fmt =3D ctx->vpu_dst_fmt; } else { - vpu_fmt =3D ctx->vpu_src_fmt; + vpu_fmt =3D fmt; /* * Width/height on the CAPTURE end of a decoder are ignored and * replaced by the OUTPUT ones. diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/= media/hantro/imx8m_vpu_hw.c index 9802508bade2..77f574fdfa77 100644 --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c @@ -83,6 +83,14 @@ static const struct hantro_fmt imx8m_vpu_postproc_fmts[]= =3D { .fourcc =3D V4L2_PIX_FMT_YUYV, .codec_mode =3D HANTRO_MODE_NONE, .postprocessed =3D true, + .frmsize =3D { + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_UHD_WIDTH, + .step_width =3D MB_DIM, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_UHD_HEIGHT, + .step_height =3D MB_DIM, + }, }, }; =20 @@ -90,17 +98,25 @@ static const struct hantro_fmt imx8m_vpu_dec_fmts[] =3D= { { .fourcc =3D V4L2_PIX_FMT_NV12, .codec_mode =3D HANTRO_MODE_NONE, + .frmsize =3D { + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_UHD_WIDTH, + .step_width =3D MB_DIM, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_UHD_HEIGHT, + .step_height =3D MB_DIM, + }, }, { .fourcc =3D V4L2_PIX_FMT_MPEG2_SLICE, .codec_mode =3D HANTRO_MODE_MPEG2_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 1920, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_FHD_WIDTH, .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 1088, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_FHD_HEIGHT, .step_height =3D MB_DIM, }, }, @@ -109,11 +125,11 @@ static const struct hantro_fmt imx8m_vpu_dec_fmts[] = =3D { .codec_mode =3D HANTRO_MODE_VP8_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 3840, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_UHD_WIDTH, .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 2160, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_UHD_HEIGHT, .step_height =3D MB_DIM, }, }, @@ -122,11 +138,11 @@ static const struct hantro_fmt imx8m_vpu_dec_fmts[] = =3D { .codec_mode =3D HANTRO_MODE_H264_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 3840, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_UHD_WIDTH, .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 2160, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_UHD_HEIGHT, .step_height =3D MB_DIM, }, }, @@ -137,6 +153,14 @@ static const struct hantro_fmt imx8m_vpu_g2_postproc_f= mts[] =3D { .fourcc =3D V4L2_PIX_FMT_NV12, .codec_mode =3D HANTRO_MODE_NONE, .postprocessed =3D true, + .frmsize =3D { + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_UHD_WIDTH, + .step_width =3D MB_DIM, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_UHD_HEIGHT, + .step_height =3D MB_DIM, + }, }, }; =20 @@ -144,18 +168,26 @@ static const struct hantro_fmt imx8m_vpu_g2_dec_fmts[= ] =3D { { .fourcc =3D V4L2_PIX_FMT_NV12_4L4, .codec_mode =3D HANTRO_MODE_NONE, + .frmsize =3D { + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_UHD_WIDTH, + .step_width =3D TILE_MB_DIM, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_UHD_HEIGHT, + .step_height =3D TILE_MB_DIM, + }, }, { .fourcc =3D V4L2_PIX_FMT_HEVC_SLICE, .codec_mode =3D HANTRO_MODE_HEVC_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 3840, - .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 2160, - .step_height =3D MB_DIM, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_UHD_WIDTH, + .step_width =3D TILE_MB_DIM, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_UHD_HEIGHT, + .step_height =3D TILE_MB_DIM, }, }, { @@ -163,12 +195,12 @@ static const struct hantro_fmt imx8m_vpu_g2_dec_fmts[= ] =3D { .codec_mode =3D HANTRO_MODE_VP9_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 3840, - .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 2160, - .step_height =3D MB_DIM, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_UHD_WIDTH, + .step_width =3D TILE_MB_DIM, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_UHD_HEIGHT, + .step_height =3D TILE_MB_DIM, }, }, }; diff --git a/drivers/staging/media/hantro/rockchip_vpu_hw.c b/drivers/stagi= ng/media/hantro/rockchip_vpu_hw.c index fc96501f3bc8..098486b9ec27 100644 --- a/drivers/staging/media/hantro/rockchip_vpu_hw.c +++ b/drivers/staging/media/hantro/rockchip_vpu_hw.c @@ -63,6 +63,14 @@ static const struct hantro_fmt rockchip_vpu1_postproc_fm= ts[] =3D { .fourcc =3D V4L2_PIX_FMT_YUYV, .codec_mode =3D HANTRO_MODE_NONE, .postprocessed =3D true, + .frmsize =3D { + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_FHD_WIDTH, + .step_width =3D MB_DIM, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_FHD_HEIGHT, + .step_height =3D MB_DIM, + }, }, }; =20 @@ -70,17 +78,25 @@ static const struct hantro_fmt rk3066_vpu_dec_fmts[] = =3D { { .fourcc =3D V4L2_PIX_FMT_NV12, .codec_mode =3D HANTRO_MODE_NONE, + .frmsize =3D { + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_FHD_WIDTH, + .step_width =3D MB_DIM, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_FHD_HEIGHT, + .step_height =3D MB_DIM, + }, }, { .fourcc =3D V4L2_PIX_FMT_H264_SLICE, .codec_mode =3D HANTRO_MODE_H264_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 1920, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_FHD_WIDTH, .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 1088, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_FHD_HEIGHT, .step_height =3D MB_DIM, }, }, @@ -89,11 +105,11 @@ static const struct hantro_fmt rk3066_vpu_dec_fmts[] = =3D { .codec_mode =3D HANTRO_MODE_MPEG2_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 1920, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_FHD_WIDTH, .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 1088, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_FHD_HEIGHT, .step_height =3D MB_DIM, }, }, @@ -102,11 +118,11 @@ static const struct hantro_fmt rk3066_vpu_dec_fmts[] = =3D { .codec_mode =3D HANTRO_MODE_VP8_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 1920, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_FHD_WIDTH, .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 1088, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_FHD_HEIGHT, .step_height =3D MB_DIM, }, }, @@ -116,17 +132,25 @@ static const struct hantro_fmt rk3288_vpu_dec_fmts[] = =3D { { .fourcc =3D V4L2_PIX_FMT_NV12, .codec_mode =3D HANTRO_MODE_NONE, + .frmsize =3D { + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_4K_WIDTH, + .step_width =3D MB_DIM, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_4K_HEIGHT, + .step_height =3D MB_DIM, + }, }, { .fourcc =3D V4L2_PIX_FMT_H264_SLICE, .codec_mode =3D HANTRO_MODE_H264_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 4096, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_4K_WIDTH, .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 2304, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_4K_HEIGHT, .step_height =3D MB_DIM, }, }, @@ -135,11 +159,11 @@ static const struct hantro_fmt rk3288_vpu_dec_fmts[] = =3D { .codec_mode =3D HANTRO_MODE_MPEG2_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 1920, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_FHD_WIDTH, .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 1088, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_FHD_HEIGHT, .step_height =3D MB_DIM, }, }, @@ -148,11 +172,11 @@ static const struct hantro_fmt rk3288_vpu_dec_fmts[] = =3D { .codec_mode =3D HANTRO_MODE_VP8_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 3840, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_UHD_WIDTH, .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 2160, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_UHD_HEIGHT, .step_height =3D MB_DIM, }, }, @@ -162,17 +186,25 @@ static const struct hantro_fmt rk3399_vpu_dec_fmts[] = =3D { { .fourcc =3D V4L2_PIX_FMT_NV12, .codec_mode =3D HANTRO_MODE_NONE, + .frmsize =3D { + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_FHD_WIDTH, + .step_width =3D MB_DIM, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_FHD_HEIGHT, + .step_height =3D MB_DIM, + }, }, { .fourcc =3D V4L2_PIX_FMT_H264_SLICE, .codec_mode =3D HANTRO_MODE_H264_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 1920, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_FHD_WIDTH, .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 1088, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_FHD_HEIGHT, .step_height =3D MB_DIM, }, }, @@ -181,11 +213,11 @@ static const struct hantro_fmt rk3399_vpu_dec_fmts[] = =3D { .codec_mode =3D HANTRO_MODE_MPEG2_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 1920, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_FHD_WIDTH, .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 1088, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_FHD_HEIGHT, .step_height =3D MB_DIM, }, }, @@ -194,11 +226,11 @@ static const struct hantro_fmt rk3399_vpu_dec_fmts[] = =3D { .codec_mode =3D HANTRO_MODE_VP8_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 3840, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_UHD_WIDTH, .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 2160, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_UHD_HEIGHT, .step_height =3D MB_DIM, }, }, diff --git a/drivers/staging/media/hantro/sama5d4_vdec_hw.c b/drivers/stagi= ng/media/hantro/sama5d4_vdec_hw.c index b2fc1c5613e1..b205e2db5b04 100644 --- a/drivers/staging/media/hantro/sama5d4_vdec_hw.c +++ b/drivers/staging/media/hantro/sama5d4_vdec_hw.c @@ -16,6 +16,14 @@ static const struct hantro_fmt sama5d4_vdec_postproc_fmt= s[] =3D { .fourcc =3D V4L2_PIX_FMT_YUYV, .codec_mode =3D HANTRO_MODE_NONE, .postprocessed =3D true, + .frmsize =3D { + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_HD_WIDTH, + .step_width =3D MB_DIM, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_HD_HEIGHT, + .step_height =3D MB_DIM, + }, }, }; =20 @@ -23,17 +31,25 @@ static const struct hantro_fmt sama5d4_vdec_fmts[] =3D { { .fourcc =3D V4L2_PIX_FMT_NV12, .codec_mode =3D HANTRO_MODE_NONE, + .frmsize =3D { + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_HD_WIDTH, + .step_width =3D MB_DIM, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_HD_HEIGHT, + .step_height =3D MB_DIM, + }, }, { .fourcc =3D V4L2_PIX_FMT_MPEG2_SLICE, .codec_mode =3D HANTRO_MODE_MPEG2_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 1280, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_HD_WIDTH, .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 720, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_HD_HEIGHT, .step_height =3D MB_DIM, }, }, @@ -42,11 +58,11 @@ static const struct hantro_fmt sama5d4_vdec_fmts[] =3D { .codec_mode =3D HANTRO_MODE_VP8_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 1280, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_HD_WIDTH, .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 720, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_HD_HEIGHT, .step_height =3D MB_DIM, }, }, @@ -55,11 +71,11 @@ static const struct hantro_fmt sama5d4_vdec_fmts[] =3D { .codec_mode =3D HANTRO_MODE_H264_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 1280, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_HD_WIDTH, .step_width =3D MB_DIM, - .min_height =3D 48, - .max_height =3D 720, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_HD_HEIGHT, .step_height =3D MB_DIM, }, }, diff --git a/drivers/staging/media/hantro/sunxi_vpu_hw.c b/drivers/staging/= media/hantro/sunxi_vpu_hw.c index c0edd5856a0c..fbeac81e59e1 100644 --- a/drivers/staging/media/hantro/sunxi_vpu_hw.c +++ b/drivers/staging/media/hantro/sunxi_vpu_hw.c @@ -14,6 +14,14 @@ static const struct hantro_fmt sunxi_vpu_postproc_fmts[]= =3D { .fourcc =3D V4L2_PIX_FMT_NV12, .codec_mode =3D HANTRO_MODE_NONE, .postprocessed =3D true, + .frmsize =3D { + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_UHD_WIDTH, + .step_width =3D 32, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_UHD_HEIGHT, + .step_height =3D 32, + }, }, }; =20 @@ -21,17 +29,25 @@ static const struct hantro_fmt sunxi_vpu_dec_fmts[] =3D= { { .fourcc =3D V4L2_PIX_FMT_NV12_4L4, .codec_mode =3D HANTRO_MODE_NONE, + .frmsize =3D { + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_UHD_WIDTH, + .step_width =3D 32, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_UHD_HEIGHT, + .step_height =3D 32, + }, }, { .fourcc =3D V4L2_PIX_FMT_VP9_FRAME, .codec_mode =3D HANTRO_MODE_VP9_DEC, .max_depth =3D 2, .frmsize =3D { - .min_width =3D 48, - .max_width =3D 3840, + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_UHD_WIDTH, .step_width =3D 32, - .min_height =3D 48, - .max_height =3D 2160, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_UHD_HEIGHT, .step_height =3D 32, }, }, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24395C2BBC5 for ; Mon, 15 Aug 2022 21:18:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245206AbiHOVQv (ORCPT ); Mon, 15 Aug 2022 17:16:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348044AbiHOVIA (ORCPT ); Mon, 15 Aug 2022 17:08:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8C403C8DA; Mon, 15 Aug 2022 12:18:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5860E60EF0; Mon, 15 Aug 2022 19:18:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4500EC433D6; Mon, 15 Aug 2022 19:18:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591086; bh=++0gQvoVEsES9czLKXdr0jf/8o4LNf21BoHpAo3XYVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kwhRjt9OFz/VE8wTuDz6w2tSUcwZIUkRSZ4midVI2BFIgs1BwyrG2TJpYT/q67aj7 nSMc/SNL6ZjSbmY6Ns9qIEroFf9eIHJD6zlaCbBjnxNtVuOfe65TAVj/DW4/NQGgvC XQH7aJQ+1pPU++Ex6l7TJfTUe5+WQthJOxKwola8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ezequiel Garcia , Nicolas Dufresne , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0437/1095] media: hantro: Fix RK3399 H.264 format advertising Date: Mon, 15 Aug 2022 19:57:16 +0200 Message-Id: <20220815180447.734658112@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ezequiel Garcia [ Upstream commit 177d841fa19542eb35aa5ec9579c4abb989c9255 ] Commit 1f82f2df523cb ("media: hantro: Enable H.264 on Rockchip VDPU2") enabled H.264 on some SoCs with VDPU2 cores. This had the side-effect of exposing H.264 coded format as supported on RK3399. Fix this and clarify how the codec is explicitly disabled on RK3399 on this driver. Fixes: 1f82f2df523cb ("media: hantro: Enable H.264 on Rockchip VDPU2") Signed-off-by: Ezequiel Garcia Tested-by: Nicolas Dufresne Reviewed-by: Nicolas Dufresne Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../staging/media/hantro/rockchip_vpu_hw.c | 60 ++++++++++++++++--- 1 file changed, 53 insertions(+), 7 deletions(-) diff --git a/drivers/staging/media/hantro/rockchip_vpu_hw.c b/drivers/stagi= ng/media/hantro/rockchip_vpu_hw.c index 098486b9ec27..26e16b5a6a70 100644 --- a/drivers/staging/media/hantro/rockchip_vpu_hw.c +++ b/drivers/staging/media/hantro/rockchip_vpu_hw.c @@ -182,7 +182,7 @@ static const struct hantro_fmt rk3288_vpu_dec_fmts[] = =3D { }, }; =20 -static const struct hantro_fmt rk3399_vpu_dec_fmts[] =3D { +static const struct hantro_fmt rockchip_vdpu2_dec_fmts[] =3D { { .fourcc =3D V4L2_PIX_FMT_NV12, .codec_mode =3D HANTRO_MODE_NONE, @@ -236,6 +236,47 @@ static const struct hantro_fmt rk3399_vpu_dec_fmts[] = =3D { }, }; =20 +static const struct hantro_fmt rk3399_vpu_dec_fmts[] =3D { + { + .fourcc =3D V4L2_PIX_FMT_NV12, + .codec_mode =3D HANTRO_MODE_NONE, + .frmsize =3D { + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_FHD_WIDTH, + .step_width =3D MB_DIM, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_FHD_HEIGHT, + .step_height =3D MB_DIM, + }, + }, + { + .fourcc =3D V4L2_PIX_FMT_MPEG2_SLICE, + .codec_mode =3D HANTRO_MODE_MPEG2_DEC, + .max_depth =3D 2, + .frmsize =3D { + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_FHD_WIDTH, + .step_width =3D MB_DIM, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_FHD_HEIGHT, + .step_height =3D MB_DIM, + }, + }, + { + .fourcc =3D V4L2_PIX_FMT_VP8_FRAME, + .codec_mode =3D HANTRO_MODE_VP8_DEC, + .max_depth =3D 2, + .frmsize =3D { + .min_width =3D FMT_MIN_WIDTH, + .max_width =3D FMT_UHD_WIDTH, + .step_width =3D MB_DIM, + .min_height =3D FMT_MIN_HEIGHT, + .max_height =3D FMT_UHD_HEIGHT, + .step_height =3D MB_DIM, + }, + }, +}; + static irqreturn_t rockchip_vpu1_vepu_irq(int irq, void *dev_id) { struct hantro_dev *vpu =3D dev_id; @@ -548,8 +589,8 @@ const struct hantro_variant rk3288_vpu_variant =3D { =20 const struct hantro_variant rk3328_vpu_variant =3D { .dec_offset =3D 0x400, - .dec_fmts =3D rk3399_vpu_dec_fmts, - .num_dec_fmts =3D ARRAY_SIZE(rk3399_vpu_dec_fmts), + .dec_fmts =3D rockchip_vdpu2_dec_fmts, + .num_dec_fmts =3D ARRAY_SIZE(rockchip_vdpu2_dec_fmts), .codec =3D HANTRO_MPEG2_DECODER | HANTRO_VP8_DECODER | HANTRO_H264_DECODER, .codec_ops =3D rk3399_vpu_codec_ops, @@ -560,6 +601,11 @@ const struct hantro_variant rk3328_vpu_variant =3D { .num_clocks =3D ARRAY_SIZE(rockchip_vpu_clk_names), }; =20 +/* + * H.264 decoding explicitly disabled in RK3399. + * This ensures userspace applications use the Rockchip VDEC core, + * which has better performance. + */ const struct hantro_variant rk3399_vpu_variant =3D { .enc_offset =3D 0x0, .enc_fmts =3D rockchip_vpu_enc_fmts, @@ -579,8 +625,8 @@ const struct hantro_variant rk3399_vpu_variant =3D { =20 const struct hantro_variant rk3568_vpu_variant =3D { .dec_offset =3D 0x400, - .dec_fmts =3D rk3399_vpu_dec_fmts, - .num_dec_fmts =3D ARRAY_SIZE(rk3399_vpu_dec_fmts), + .dec_fmts =3D rockchip_vdpu2_dec_fmts, + .num_dec_fmts =3D ARRAY_SIZE(rockchip_vdpu2_dec_fmts), .codec =3D HANTRO_MPEG2_DECODER | HANTRO_VP8_DECODER | HANTRO_H264_DECODER, .codec_ops =3D rk3399_vpu_codec_ops, @@ -596,8 +642,8 @@ const struct hantro_variant px30_vpu_variant =3D { .enc_fmts =3D rockchip_vpu_enc_fmts, .num_enc_fmts =3D ARRAY_SIZE(rockchip_vpu_enc_fmts), .dec_offset =3D 0x400, - .dec_fmts =3D rk3399_vpu_dec_fmts, - .num_dec_fmts =3D ARRAY_SIZE(rk3399_vpu_dec_fmts), + .dec_fmts =3D rockchip_vdpu2_dec_fmts, + .num_dec_fmts =3D ARRAY_SIZE(rockchip_vdpu2_dec_fmts), .codec =3D HANTRO_JPEG_ENCODER | HANTRO_MPEG2_DECODER | HANTRO_VP8_DECODER | HANTRO_H264_DECODER, .codec_ops =3D rk3399_vpu_codec_ops, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F28DC25B0E for ; Mon, 15 Aug 2022 21:18:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343552AbiHOVRE (ORCPT ); Mon, 15 Aug 2022 17:17:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348056AbiHOVIC (ORCPT ); Mon, 15 Aug 2022 17:08:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E4FF2B1A4; Mon, 15 Aug 2022 12:18:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3BB0660F6A; Mon, 15 Aug 2022 19:18:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35716C433C1; Mon, 15 Aug 2022 19:18:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591089; bh=lrqtO/qAylreAQQN93DQ6b/hetCpqzJ51B53ZBouAzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p4nmJ4+5s3Q7P6eMvZvhnHATbTQDh/lPRdI+ulnaNQRKrmeg7TE5RSRUwYbXE54wc S+7HhnWd2aQLSZviQP3wVNeQWlRmqpa17vjQrxUGhr+P5UHIkkiaGRE60atxX0bXEQ +jhzWYmiwUYOctr4Ja/EWN5aKfWrOpA9fkBM0r58= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0438/1095] media: amphion: decoder copy timestamp from output to capture Date: Mon, 15 Aug 2022 19:57:17 +0200 Message-Id: <20220815180447.766847875@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit a4dca209f23470f20b61b40cca417a5bf6ea8533 ] copy the timestamp using the helper function V4L2_BUF_FLAG_TIMESTAMP_COPY To implement this, driver will keep the output buffer until it's decoded, in previous, driver will return the output buffer immediately after copying data to stream buffer. After that, there is no need to make a workaround for poll function. driver can use v4l2_m2m_fop_poll directly. Also, driver don't need to keep a input threshold as the buffer count is up to only 32. Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/amphion/vdec.c | 76 ++++++++------------- drivers/media/platform/amphion/vpu_malone.c | 2 +- drivers/media/platform/amphion/vpu_v4l2.c | 56 +++++++++++++++ drivers/media/platform/amphion/vpu_v4l2.h | 3 + 4 files changed, 87 insertions(+), 50 deletions(-) diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform= /amphion/vdec.c index a91f88fdb5ef..052a60189c13 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -26,8 +26,8 @@ #include "vpu_cmds.h" #include "vpu_rpc.h" =20 -#define VDEC_FRAME_DEPTH 256 #define VDEC_MIN_BUFFER_CAP 8 +#define VDEC_MIN_BUFFER_OUT 8 =20 struct vdec_fs_info { char name[8]; @@ -63,8 +63,6 @@ struct vdec_t { bool is_source_changed; u32 source_change; u32 drain; - u32 ts_pre_count; - u32 frame_depth; }; =20 static const struct vpu_format vdec_formats[] =3D { @@ -475,7 +473,7 @@ static int vdec_drain(struct vpu_inst *inst) if (!vdec->drain) return 0; =20 - if (v4l2_m2m_num_src_bufs_ready(inst->fh.m2m_ctx)) + if (!vpu_is_source_empty(inst)) return 0; =20 if (!vdec->params.frame_count) { @@ -598,11 +596,8 @@ static bool vdec_check_ready(struct vpu_inst *inst, un= signed int type) { struct vdec_t *vdec =3D inst->priv; =20 - if (V4L2_TYPE_IS_OUTPUT(type)) { - if (vdec->ts_pre_count >=3D vdec->frame_depth) - return false; + if (V4L2_TYPE_IS_OUTPUT(type)) return true; - } =20 if (vdec->req_frame_count) return true; @@ -610,12 +605,21 @@ static bool vdec_check_ready(struct vpu_inst *inst, u= nsigned int type) return false; } =20 +static struct vb2_v4l2_buffer *vdec_get_src_buffer(struct vpu_inst *inst, = u32 count) +{ + if (count > 1) + vpu_skip_frame(inst, count - 1); + + return vpu_next_src_buf(inst); +} + static int vdec_frame_decoded(struct vpu_inst *inst, void *arg) { struct vdec_t *vdec =3D inst->priv; struct vpu_dec_pic_info *info =3D arg; struct vpu_vb2_buffer *vpu_buf; struct vb2_v4l2_buffer *vbuf; + struct vb2_v4l2_buffer *src_buf; int ret =3D 0; =20 if (!info || info->id >=3D ARRAY_SIZE(vdec->slots)) @@ -629,14 +633,21 @@ static int vdec_frame_decoded(struct vpu_inst *inst, = void *arg) goto exit; } vbuf =3D &vpu_buf->m2m_buf.vb; + src_buf =3D vdec_get_src_buffer(inst, info->consumed_count); + if (src_buf) { + v4l2_m2m_buf_copy_metadata(src_buf, vbuf, true); + if (info->consumed_count) { + v4l2_m2m_src_buf_remove(inst->fh.m2m_ctx); + vpu_set_buffer_state(src_buf, VPU_BUF_STATE_IDLE); + v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE); + } else { + vpu_set_buffer_state(src_buf, VPU_BUF_STATE_DECODED); + } + } if (vpu_get_buffer_state(vbuf) =3D=3D VPU_BUF_STATE_DECODED) dev_info(inst->dev, "[%d] buf[%d] has been decoded\n", inst->id, info->i= d); vpu_set_buffer_state(vbuf, VPU_BUF_STATE_DECODED); vdec->decoded_frame_count++; - if (vdec->ts_pre_count >=3D info->consumed_count) - vdec->ts_pre_count -=3D info->consumed_count; - else - vdec->ts_pre_count =3D 0; exit: vpu_inst_unlock(inst); =20 @@ -692,10 +703,9 @@ static void vdec_buf_done(struct vpu_inst *inst, struc= t vpu_frame_info *frame) vpu_set_buffer_state(vbuf, VPU_BUF_STATE_READY); vb2_set_plane_payload(&vbuf->vb2_buf, 0, inst->cap_format.sizeimage[0]); vb2_set_plane_payload(&vbuf->vb2_buf, 1, inst->cap_format.sizeimage[1]); - vbuf->vb2_buf.timestamp =3D frame->timestamp; vbuf->field =3D inst->cap_format.field; vbuf->sequence =3D sequence; - dev_dbg(inst->dev, "[%d][OUTPUT TS]%32lld\n", inst->id, frame->timestamp); + dev_dbg(inst->dev, "[%d][OUTPUT TS]%32lld\n", inst->id, vbuf->vb2_buf.tim= estamp); =20 v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_DONE); vpu_inst_lock(inst); @@ -717,7 +727,6 @@ static void vdec_stop_done(struct vpu_inst *inst) vdec->fixed_fmt =3D false; vdec->params.end_flag =3D 0; vdec->drain =3D 0; - vdec->ts_pre_count =3D 0; vdec->params.frame_count =3D 0; vdec->decoded_frame_count =3D 0; vdec->display_frame_count =3D 0; @@ -1252,18 +1261,14 @@ static int vdec_process_output(struct vpu_inst *ins= t, struct vb2_buffer *vb) if (free_space < vb2_get_plane_payload(vb, 0) + 0x40000) return -ENOMEM; =20 + vpu_set_buffer_state(vbuf, VPU_BUF_STATE_INUSE); ret =3D vpu_iface_input_frame(inst, vb); if (ret < 0) return -ENOMEM; =20 dev_dbg(inst->dev, "[%d][INPUT TS]%32lld\n", inst->id, vb->timestamp); - vdec->ts_pre_count++; vdec->params.frame_count++; =20 - v4l2_m2m_src_buf_remove_by_buf(inst->fh.m2m_ctx, vbuf); - vpu_set_buffer_state(vbuf, VPU_BUF_STATE_IDLE); - v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_DONE); - if (vdec->drain) vdec_drain(inst); =20 @@ -1326,7 +1331,6 @@ static void vdec_abort(struct vpu_inst *inst) vdec->sequence); vdec->params.end_flag =3D 0; vdec->drain =3D 0; - vdec->ts_pre_count =3D 0; vdec->params.frame_count =3D 0; vdec->decoded_frame_count =3D 0; vdec->display_frame_count =3D 0; @@ -1533,10 +1537,6 @@ static int vdec_get_debug_info(struct vpu_inst *inst= , char *str, u32 size, u32 i vdec->drain, vdec->eos_received, vdec->source_change); break; case 8: - num =3D scnprintf(str, size, "ts_pre_count =3D %d, frame_depth =3D %d\n", - vdec->ts_pre_count, vdec->frame_depth); - break; - case 9: num =3D scnprintf(str, size, "fps =3D %d/%d\n", vdec->codec_info.frame_rate.numerator, vdec->codec_info.frame_rate.denominator); @@ -1570,12 +1570,8 @@ static struct vpu_inst_ops vdec_inst_ops =3D { static void vdec_init(struct file *file) { struct vpu_inst *inst =3D to_inst(file); - struct vdec_t *vdec; struct v4l2_format f; =20 - vdec =3D inst->priv; - vdec->frame_depth =3D VDEC_FRAME_DEPTH; - memset(&f, 0, sizeof(f)); f.type =3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; f.fmt.pix_mp.pixelformat =3D V4L2_PIX_FMT_H264; @@ -1620,36 +1616,18 @@ static int vdec_open(struct file *file) =20 vdec->fixed_fmt =3D false; inst->min_buffer_cap =3D VDEC_MIN_BUFFER_CAP; + inst->min_buffer_out =3D VDEC_MIN_BUFFER_OUT; vdec_init(file); =20 return 0; } =20 -static __poll_t vdec_poll(struct file *file, poll_table *wait) -{ - struct vpu_inst *inst =3D to_inst(file); - struct vb2_queue *src_q, *dst_q; - __poll_t ret; - - ret =3D v4l2_m2m_fop_poll(file, wait); - src_q =3D v4l2_m2m_get_src_vq(inst->fh.m2m_ctx); - dst_q =3D v4l2_m2m_get_dst_vq(inst->fh.m2m_ctx); - if (vb2_is_streaming(src_q) && !vb2_is_streaming(dst_q)) - ret &=3D (~EPOLLERR); - if (!src_q->error && !dst_q->error && - (vb2_is_streaming(src_q) && list_empty(&src_q->queued_list)) && - (vb2_is_streaming(dst_q) && list_empty(&dst_q->queued_list))) - ret &=3D (~EPOLLERR); - - return ret; -} - static const struct v4l2_file_operations vdec_fops =3D { .owner =3D THIS_MODULE, .open =3D vdec_open, .release =3D vpu_v4l2_close, .unlocked_ioctl =3D video_ioctl2, - .poll =3D vdec_poll, + .poll =3D v4l2_m2m_fop_poll, .mmap =3D v4l2_m2m_fop_mmap, }; =20 diff --git a/drivers/media/platform/amphion/vpu_malone.c b/drivers/media/pl= atform/amphion/vpu_malone.c index d91be0ece961..5ca8afb60afc 100644 --- a/drivers/media/platform/amphion/vpu_malone.c +++ b/drivers/media/platform/amphion/vpu_malone.c @@ -1558,7 +1558,7 @@ int vpu_malone_input_frame(struct vpu_shared_addr *sh= ared, * merge the data to next frame */ vbuf =3D to_vb2_v4l2_buffer(vb); - if (vpu_vb_is_codecconfig(vbuf) && (s64)vb->timestamp < 0) { + if (vpu_vb_is_codecconfig(vbuf)) { inst->extra_size +=3D size; return 0; } diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/plat= form/amphion/vpu_v4l2.c index 5584b3848107..0f3726c80967 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -127,6 +127,19 @@ int vpu_set_last_buffer_dequeued(struct vpu_inst *inst) return 0; } =20 +bool vpu_is_source_empty(struct vpu_inst *inst) +{ + struct v4l2_m2m_buffer *buf =3D NULL; + + if (!inst->fh.m2m_ctx) + return true; + v4l2_m2m_for_each_src_buf(inst->fh.m2m_ctx, buf) { + if (vpu_get_buffer_state(&buf->vb) =3D=3D VPU_BUF_STATE_IDLE) + return false; + } + return true; +} + const struct vpu_format *vpu_try_fmt_common(struct vpu_inst *inst, struct = v4l2_format *f) { struct v4l2_pix_format_mplane *pixmp =3D &f->fmt.pix_mp; @@ -234,6 +247,49 @@ int vpu_process_capture_buffer(struct vpu_inst *inst) return call_vop(inst, process_capture, &vbuf->vb2_buf); } =20 +struct vb2_v4l2_buffer *vpu_next_src_buf(struct vpu_inst *inst) +{ + struct vb2_v4l2_buffer *src_buf =3D v4l2_m2m_next_src_buf(inst->fh.m2m_ct= x); + + if (!src_buf || vpu_get_buffer_state(src_buf) =3D=3D VPU_BUF_STATE_IDLE) + return NULL; + + while (vpu_vb_is_codecconfig(src_buf)) { + v4l2_m2m_src_buf_remove(inst->fh.m2m_ctx); + vpu_set_buffer_state(src_buf, VPU_BUF_STATE_IDLE); + v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE); + + src_buf =3D v4l2_m2m_next_src_buf(inst->fh.m2m_ctx); + if (!src_buf || vpu_get_buffer_state(src_buf) =3D=3D VPU_BUF_STATE_IDLE) + return NULL; + } + + return src_buf; +} + +void vpu_skip_frame(struct vpu_inst *inst, int count) +{ + struct vb2_v4l2_buffer *src_buf; + enum vb2_buffer_state state; + int i =3D 0; + + if (count <=3D 0) + return; + + while (i < count) { + src_buf =3D v4l2_m2m_src_buf_remove(inst->fh.m2m_ctx); + if (!src_buf || vpu_get_buffer_state(src_buf) =3D=3D VPU_BUF_STATE_IDLE) + return; + if (vpu_get_buffer_state(src_buf) =3D=3D VPU_BUF_STATE_DECODED) + state =3D VB2_BUF_STATE_DONE; + else + state =3D VB2_BUF_STATE_ERROR; + i++; + vpu_set_buffer_state(src_buf, VPU_BUF_STATE_IDLE); + v4l2_m2m_buf_done(src_buf, state); + } +} + struct vb2_v4l2_buffer *vpu_find_buf_by_sequence(struct vpu_inst *inst, u3= 2 type, u32 sequence) { struct v4l2_m2m_buffer *buf =3D NULL; diff --git a/drivers/media/platform/amphion/vpu_v4l2.h b/drivers/media/plat= form/amphion/vpu_v4l2.h index 90fa7ea67495..795ca33a6a50 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.h +++ b/drivers/media/platform/amphion/vpu_v4l2.h @@ -19,6 +19,8 @@ int vpu_v4l2_close(struct file *file); const struct vpu_format *vpu_try_fmt_common(struct vpu_inst *inst, struct = v4l2_format *f); int vpu_process_output_buffer(struct vpu_inst *inst); int vpu_process_capture_buffer(struct vpu_inst *inst); +struct vb2_v4l2_buffer *vpu_next_src_buf(struct vpu_inst *inst); +void vpu_skip_frame(struct vpu_inst *inst, int count); struct vb2_v4l2_buffer *vpu_find_buf_by_sequence(struct vpu_inst *inst, u3= 2 type, u32 sequence); struct vb2_v4l2_buffer *vpu_find_buf_by_idx(struct vpu_inst *inst, u32 typ= e, u32 idx); void vpu_v4l2_set_error(struct vpu_inst *inst); @@ -27,6 +29,7 @@ int vpu_notify_source_change(struct vpu_inst *inst); int vpu_set_last_buffer_dequeued(struct vpu_inst *inst); void vpu_vb2_buffers_return(struct vpu_inst *inst, unsigned int type, enum= vb2_buffer_state state); int vpu_get_num_buffers(struct vpu_inst *inst, u32 type); +bool vpu_is_source_empty(struct vpu_inst *inst); =20 dma_addr_t vpu_get_vb_phy_addr(struct vb2_buffer *vb, u32 plane_no); unsigned int vpu_get_vb_length(struct vb2_buffer *vb, u32 plane_no); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E435C2BB41 for ; Mon, 15 Aug 2022 21:18:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345530AbiHOVRr (ORCPT ); Mon, 15 Aug 2022 17:17:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347917AbiHOVHp (ORCPT ); Mon, 15 Aug 2022 17:07:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E003E52E4A; Mon, 15 Aug 2022 12:16:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7E09D60EF0; Mon, 15 Aug 2022 19:16:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 835D3C433D6; Mon, 15 Aug 2022 19:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590995; bh=wZ6id2vo0jW3PMWz/YuKBr5MtvwyfWz2sT5AKcRRCd4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F5PmjCsQzI/Ar192Vq64An/zaEm0lD3Z0HHhp90FxpnfsWVnp7PoZUoDe286X3jkh Jgkb8lF3vaTeb/vVhzy8R9RZr2GRH1IwUxvcQAQbUwAxPp9hiLJWHdpNzZxXhLsRR4 Fbjx2auCM5kQzP2DVmbG+mjak1djWnnVSliTYGv0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0439/1095] media: amphion: sync buffer status with firmware during abort Date: Mon, 15 Aug 2022 19:57:18 +0200 Message-Id: <20220815180447.816781289@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit d8f1eb105eab7aab36323c6b488dda479d5bd2da ] 1. prevent to allocate buffer to firmware during abort 2. release buffer when clear the slots Fixes: 6de8d628df6ef ("media: amphion: add v4l2 m2m vpu decoder stateful dr= iver") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/amphion/vdec.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform= /amphion/vdec.c index 052a60189c13..dd7ea23902c0 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -63,6 +63,7 @@ struct vdec_t { bool is_source_changed; u32 source_change; u32 drain; + bool aborting; }; =20 static const struct vpu_format vdec_formats[] =3D { @@ -942,6 +943,9 @@ static int vdec_response_frame(struct vpu_inst *inst, s= truct vb2_v4l2_buffer *vb if (inst->state !=3D VPU_CODEC_STATE_ACTIVE) return -EINVAL; =20 + if (vdec->aborting) + return -EINVAL; + if (!vdec->req_frame_count) return -EINVAL; =20 @@ -1051,6 +1055,8 @@ static void vdec_clear_slots(struct vpu_inst *inst) vpu_buf =3D vdec->slots[i]; vbuf =3D &vpu_buf->m2m_buf.vb; =20 + vpu_trace(inst->dev, "clear slot %d\n", i); + vdec_response_fs_release(inst, i, vpu_buf->tag); vdec_recycle_buffer(inst, vbuf); vdec->slots[i]->state =3D VPU_BUF_STATE_IDLE; vdec->slots[i] =3D NULL; @@ -1312,6 +1318,8 @@ static void vdec_abort(struct vpu_inst *inst) int ret; =20 vpu_trace(inst->dev, "[%d] state =3D %d\n", inst->id, inst->state); + + vdec->aborting =3D true; vpu_iface_add_scode(inst, SCODE_PADDING_ABORT); vdec->params.end_flag =3D 1; vpu_iface_set_decode_params(inst, &vdec->params, 1); @@ -1335,6 +1343,7 @@ static void vdec_abort(struct vpu_inst *inst) vdec->decoded_frame_count =3D 0; vdec->display_frame_count =3D 0; vdec->sequence =3D 0; + vdec->aborting =3D false; } =20 static void vdec_stop(struct vpu_inst *inst, bool free) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6895DC00140 for ; Mon, 15 Aug 2022 21:13:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232324AbiHOVNP (ORCPT ); Mon, 15 Aug 2022 17:13:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347921AbiHOVHq (ORCPT ); Mon, 15 Aug 2022 17:07:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 991D452DEB; Mon, 15 Aug 2022 12:16:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 527E8B8107A; Mon, 15 Aug 2022 19:16:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99FE8C433D6; Mon, 15 Aug 2022 19:16:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590999; bh=I4ETvaEm4sUKUXphFN714e6JCy6rpYt8iACWLUxC0qc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iFaloL8DuvdgEx9iEm25KZ1N7ekLMmdhUC62riCoPFtjRmZUfp+UkTmOURY0ZDD2h 2awwPDn4qsBi4Rkpq4cMLQaL2UP0wkeRRKqjfq+04JPsAmJvJmHySdPt6Ys+/Hs7tM renudEWXQF2TtxWU28J9zw/R3f6YOrHJzzEi9Xi4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0440/1095] media: amphion: only insert the first sequence startcode for vc1l format Date: Mon, 15 Aug 2022 19:57:19 +0200 Message-Id: <20220815180447.856313194@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit e670f5d672ef3d00b0b8c69eff09a019e6dd4ef9 ] For format V4L2_PIX_FMT_VC1_ANNEX_L, the amphion vpu requires driver to help insert some custom startcode before sequence and frame. but only the first sequence startcode is needed, the extra startcode will cause decoding error. So after seek, we don't need to insert the sequence startcode. In other words, for V4L2_PIX_FMT_VC1_ANNEX_L, the vpu doesn't support dynamic resolution change. Fixes: 145e936380edb ("media: amphion: implement malone decoder rpc interfa= ce") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/media/platform/amphion/vdec.c | 2 +- drivers/media/platform/amphion/vpu.h | 1 + drivers/media/platform/amphion/vpu_malone.c | 2 ++ drivers/media/platform/amphion/vpu_rpc.h | 7 ++++++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform= /amphion/vdec.c index dd7ea23902c0..36450a2e85c9 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -105,7 +105,6 @@ static const struct vpu_format vdec_formats[] =3D { .pixfmt =3D V4L2_PIX_FMT_VC1_ANNEX_L, .num_planes =3D 1, .type =3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - .flags =3D V4L2_FMT_FLAG_DYN_RESOLUTION }, { .pixfmt =3D V4L2_PIX_FMT_MPEG2, @@ -735,6 +734,7 @@ static void vdec_stop_done(struct vpu_inst *inst) vdec->eos_received =3D 0; vdec->is_source_changed =3D false; vdec->source_change =3D 0; + inst->total_input_count =3D 0; vpu_inst_unlock(inst); } =20 diff --git a/drivers/media/platform/amphion/vpu.h b/drivers/media/platform/= amphion/vpu.h index e56b96a7e5d3..f914de6ed81e 100644 --- a/drivers/media/platform/amphion/vpu.h +++ b/drivers/media/platform/amphion/vpu.h @@ -258,6 +258,7 @@ struct vpu_inst { struct vpu_format cap_format; u32 min_buffer_cap; u32 min_buffer_out; + u32 total_input_count; =20 struct v4l2_rect crop; u32 colorspace; diff --git a/drivers/media/platform/amphion/vpu_malone.c b/drivers/media/pl= atform/amphion/vpu_malone.c index 5ca8afb60afc..7f591805c48c 100644 --- a/drivers/media/platform/amphion/vpu_malone.c +++ b/drivers/media/platform/amphion/vpu_malone.c @@ -1296,6 +1296,8 @@ static int vpu_malone_insert_scode_vc1_l_seq(struct m= alone_scode_t *scode) int size =3D 0; u8 rcv_seqhdr[MALONE_VC1_RCV_SEQ_HEADER_LEN]; =20 + if (scode->inst->total_input_count) + return 0; scode->need_data =3D 0; =20 ret =3D vpu_malone_insert_scode_seq(scode, MALONE_CODEC_ID_VC1_SIMPLE, si= zeof(rcv_seqhdr)); diff --git a/drivers/media/platform/amphion/vpu_rpc.h b/drivers/media/platf= orm/amphion/vpu_rpc.h index 25119e5e807e..7eb6f01e6ab5 100644 --- a/drivers/media/platform/amphion/vpu_rpc.h +++ b/drivers/media/platform/amphion/vpu_rpc.h @@ -312,11 +312,16 @@ static inline int vpu_iface_input_frame(struct vpu_in= st *inst, struct vb2_buffer *vb) { struct vpu_iface_ops *ops =3D vpu_core_get_iface(inst->core); + int ret; =20 if (!ops || !ops->input_frame) return -EINVAL; =20 - return ops->input_frame(inst->core->iface, inst, vb); + ret =3D ops->input_frame(inst->core->iface, inst, vb); + if (ret < 0) + return ret; + inst->total_input_count++; + return ret; } =20 static inline int vpu_iface_config_memory_resource(struct vpu_inst *inst, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68FC7C00140 for ; Mon, 15 Aug 2022 21:13:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233837AbiHOVNV (ORCPT ); Mon, 15 Aug 2022 17:13:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347926AbiHOVHq (ORCPT ); Mon, 15 Aug 2022 17:07:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 405663C8C0; Mon, 15 Aug 2022 12:16:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D369B60F68; Mon, 15 Aug 2022 19:16:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4F13C433C1; Mon, 15 Aug 2022 19:16:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591002; bh=b7hS5d454oaulv4KcfZU56i0AKfffymxFdCbBxiLZoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QPvTjG42Ksy1wyr1HvbLuQ64IpIFN7qTuPMN2FUr4kJ2s8g7lfRUqmGpXsb4TnJCe qQCYwTtXvBZekClXowBmJcF+0rcKb4CtmZi279YCzYe9NRaC70G/QDntF77RIY2LsP loUu8iopxNm5JSHM8UGgLBmrpXT/b40pmDninzFM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gergo Koteles , Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.18 0441/1095] mt76: mt76x02u: fix possible memory leak in __mt76x02u_mcu_send_msg Date: Mon, 15 Aug 2022 19:57:20 +0200 Message-Id: <20220815180447.895110264@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lorenzo Bianconi [ Upstream commit cffd93411575afd987788e2ec3cb8eaff70f0215 ] Free the skb if mt76u_bulk_msg fails in __mt76x02u_mcu_send_msg routine. Fixes: 4c89ff2c74e39 ("mt76: split __mt76u_mcu_send_msg and mt76u_mcu_send_= msg routines") Co-developed-by: Gergo Koteles Signed-off-by: Gergo Koteles Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c b/drivers= /net/wireless/mediatek/mt76/mt76x02_usb_mcu.c index 2953df7d8388..c6c16fe8ee85 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c @@ -108,7 +108,7 @@ __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk= _buff *skb, ret =3D mt76u_bulk_msg(dev, skb->data, skb->len, NULL, 500, MT_EP_OUT_INBAND_CMD); if (ret) - return ret; + goto out; =20 if (wait_resp) ret =3D mt76x02u_mcu_wait_resp(dev, seq); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94D81C25B08 for ; Mon, 15 Aug 2022 21:13:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240760AbiHOVNb (ORCPT ); Mon, 15 Aug 2022 17:13:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347928AbiHOVHq (ORCPT ); Mon, 15 Aug 2022 17:07:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 868322B185; Mon, 15 Aug 2022 12:16:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 25FE360EF0; Mon, 15 Aug 2022 19:16:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CD65C433D6; Mon, 15 Aug 2022 19:16:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591005; bh=fQvQWAEajSJ2fek1XKvOZ9Xp2q9da3v0Jkxxl0TpCXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HDePn8L7hGWqNFR45EmmLcDFKQl4TR74nnn/nWqzKW3cccco0Stwrg4SjHIIHd38e avy49tC11yW+l1dtQNCY47YJKbK8erIjqyV/8Ty9ljvwDUQ8/e0uxha9b/C2qP8twX 6EjILPXHLKGM4ZsnQYmV8tuRVI1NIYTBKvOybFvk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Deren Wu , Felix Fietkau , Sasha Levin Subject: [PATCH 5.18 0442/1095] mt76: mt7921s: fix firmware download random fail Date: Mon, 15 Aug 2022 19:57:21 +0200 Message-Id: <20220815180447.939220294@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: YN Chen [ Upstream commit a55a0c701c129f8e448f0ec1eb811dba728ace64 ] To avoid racing problems in chip, mt7921s should reacquire drv-own after firmware semaphore is released. Fixes: 78b217580c509 ("mt76: mt7921s: fix bus hang with wrong privilege") Signed-off-by: YN Chen Signed-off-by: Deren Wu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/= wireless/mediatek/mt76/mt7921/mcu.c index da2be050ed7c..2a609b25561c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -538,13 +538,6 @@ static int mt7921_load_patch(struct mt7921_dev *dev) if (ret) dev_err(dev->mt76.dev, "Failed to start patch\n"); =20 - if (mt76_is_sdio(&dev->mt76)) { - /* activate again */ - ret =3D __mt7921_mcu_fw_pmctrl(dev); - if (!ret) - ret =3D __mt7921_mcu_drv_pmctrl(dev); - } - out: sem =3D mt76_connac_mcu_patch_sem_ctrl(&dev->mt76, false); switch (sem) { @@ -555,6 +548,14 @@ static int mt7921_load_patch(struct mt7921_dev *dev) dev_err(dev->mt76.dev, "Failed to release patch semaphore\n"); break; } + + if (!ret && mt76_is_sdio(&dev->mt76)) { + /* activate again */ + ret =3D __mt7921_mcu_fw_pmctrl(dev); + if (!ret) + ret =3D __mt7921_mcu_drv_pmctrl(dev); + } + release_firmware(fw); =20 return ret; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92861C25B0E for ; Mon, 15 Aug 2022 21:14:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242148AbiHOVN5 (ORCPT ); Mon, 15 Aug 2022 17:13:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347934AbiHOVHr (ORCPT ); Mon, 15 Aug 2022 17:07:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E13E2DAA0; Mon, 15 Aug 2022 12:16:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0A8AA60F6A; Mon, 15 Aug 2022 19:16:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11867C433C1; Mon, 15 Aug 2022 19:16:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591008; bh=jYvjc2jx/tJWDFcenTX34W9Cgm5iRIk5XYyMQirFE00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hCRPLe+IQ7z6aN6wgC4IaaJkadm6EB5o7BsseTY6bw82tfg99pnhoMj/sbGHbknzi wMEu36pBoikg9yNuEOv+OkIteUuVgChM2yMn58FThxq8kVIMYFF2uouXuiT7dEujT8 QevN7CZpyoPHkd6aTd6NRfYBLNbO1nLxv9zpjv8w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.18 0443/1095] mt76: mt7615: do not update pm stats in case of error Date: Mon, 15 Aug 2022 19:57:22 +0200 Message-Id: <20220815180447.978286034@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lorenzo Bianconi [ Upstream commit 79717c4eeeae9dec894794fbe8af72f08f03ebdd ] Do not update pm stats if mt7615_mcu_fw_pmctrl returns an error. Fixes: abe912ae3cd42 ("mt76: mt7663: add awake and doze time accounting") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/= wireless/mediatek/mt76/mt7615/mcu.c index 97e2a85cb728..6f3efec58afe 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -350,10 +350,11 @@ static int mt7615_mcu_fw_pmctrl(struct mt7615_dev *de= v) } =20 mt7622_trigger_hif_int(dev, false); - - pm->stats.last_doze_event =3D jiffies; - pm->stats.awake_time +=3D pm->stats.last_doze_event - - pm->stats.last_wake_event; + if (!err) { + pm->stats.last_doze_event =3D jiffies; + pm->stats.awake_time +=3D pm->stats.last_doze_event - + pm->stats.last_wake_event; + } out: mutex_unlock(&pm->mutex); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F95FC00140 for ; Mon, 15 Aug 2022 21:13:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241516AbiHOVNs (ORCPT ); Mon, 15 Aug 2022 17:13:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347940AbiHOVHr (ORCPT ); Mon, 15 Aug 2022 17:07:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 095B22D1F0; Mon, 15 Aug 2022 12:16:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B934FB81106; Mon, 15 Aug 2022 19:16:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05348C433C1; Mon, 15 Aug 2022 19:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591011; bh=tM4SDSdgsL1BoKw3VU2X2UxP5u4uYpyQPMV0hmBuJvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FReGgXUZu2H0cRIMvzX6om+oIyiRk5/oWZC3m78BQK4UalR4ck87r4tx3Khi7lDKN SbXkDRejjqXWS4nsUPMGW/U0ekb44CrU7IEkNxnVOOjOD5E216Sd39J7L4dGuV7Avy cs/tLcx0IgnOq4XUIujcDzkJHqNI+pHYlxf2GBiw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.18 0444/1095] mt76: mt7921: do not update pm states in case of error Date: Mon, 15 Aug 2022 19:57:23 +0200 Message-Id: <20220815180448.008789243@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lorenzo Bianconi [ Upstream commit f4a92547fb9818ff272e1e2f0c79cd6b0bc99ce8 ] Do not update pm stats if mt7921e_mcu_fw_pmctrl routine returns an error. Fixes: 36873246f78a2 ("mt76: mt7921: add awake and doze time accounting") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c b/drivers/= net/wireless/mediatek/mt76/mt7921/pci_mcu.c index 36669e5aeef3..a1ab5f878f81 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c @@ -102,7 +102,7 @@ int mt7921e_mcu_fw_pmctrl(struct mt7921_dev *dev) { struct mt76_phy *mphy =3D &dev->mt76.phy; struct mt76_connac_pm *pm =3D &dev->pm; - int i, err =3D 0; + int i; =20 for (i =3D 0; i < MT7921_DRV_OWN_RETRY_COUNT; i++) { mt76_wr(dev, MT_CONN_ON_LPCTL, PCIE_LPCR_HOST_SET_OWN); @@ -114,12 +114,12 @@ int mt7921e_mcu_fw_pmctrl(struct mt7921_dev *dev) if (i =3D=3D MT7921_DRV_OWN_RETRY_COUNT) { dev_err(dev->mt76.dev, "firmware own failed\n"); clear_bit(MT76_STATE_PM, &mphy->state); - err =3D -EIO; + return -EIO; } =20 pm->stats.last_doze_event =3D jiffies; pm->stats.awake_time +=3D pm->stats.last_doze_event - pm->stats.last_wake_event; =20 - return err; + return 0; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BC8CC00140 for ; Mon, 15 Aug 2022 21:14:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229689AbiHOVON (ORCPT ); Mon, 15 Aug 2022 17:14:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347942AbiHOVHr (ORCPT ); Mon, 15 Aug 2022 17:07:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C43D72D1D5; Mon, 15 Aug 2022 12:16:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7C88AB8107A; Mon, 15 Aug 2022 19:16:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B640DC433C1; Mon, 15 Aug 2022 19:16:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591015; bh=UiwS0woC9t2O9OGl5uIZCvA0IgPGyEzpElFJIVaIBUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l0srZjpWYH5kRaz6uqSkQtBaMV+JYVVxm2Bs1/Xevx/W4EBKvw67JqCJCKi90LUMa /xN0K3GjaRoQ80sa53t7WE4PKPr9s0NbZL4o/e0LWzwqRInd2NvvspmXqhY2Nk3XWl ivJ7bCgiMCqXsCQum7ucUySztjRbHwVLLkc9baL8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Lorenzo Bianconi , Deren Wu , Felix Fietkau , Sasha Levin Subject: [PATCH 5.18 0445/1095] mt76: mt7921s: fix possible sdio deadlock in command fail Date: Mon, 15 Aug 2022 19:57:24 +0200 Message-Id: <20220815180448.051714585@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Deren Wu [ Upstream commit 364718c94ac2ea4e51958ac0aa15c9092c785a3a ] Move sdio_release_host() to final resource handing Fixes: b12deb5e86fa ("mt76: mt7921s: fix mt7921s_mcu_[fw|drv]_pmctrl") Reported-by: YN Chen Co-developed-by: Lorenzo Bianconi Signed-off-by: Lorenzo Bianconi Signed-off-by: Deren Wu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c b/drivers= /net/wireless/mediatek/mt76/mt7921/sdio_mcu.c index 54a5c712a3c3..c572a3107b8b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c @@ -136,8 +136,8 @@ int mt7921s_mcu_fw_pmctrl(struct mt7921_dev *dev) struct sdio_func *func =3D dev->mt76.sdio.func; struct mt76_phy *mphy =3D &dev->mt76.phy; struct mt76_connac_pm *pm =3D &dev->pm; - int err =3D 0; u32 status; + int err; =20 sdio_claim_host(func); =20 @@ -148,7 +148,7 @@ int mt7921s_mcu_fw_pmctrl(struct mt7921_dev *dev) 2000, 1000000); if (err < 0) { dev_err(dev->mt76.dev, "mailbox ACK not cleared\n"); - goto err; + goto out; } } =20 @@ -156,18 +156,18 @@ int mt7921s_mcu_fw_pmctrl(struct mt7921_dev *dev) =20 err =3D readx_poll_timeout(mt76s_read_pcr, &dev->mt76, status, !(status & WHLPCR_IS_DRIVER_OWN), 2000, 1000000); +out: sdio_release_host(func); =20 -err: if (err < 0) { dev_err(dev->mt76.dev, "firmware own failed\n"); clear_bit(MT76_STATE_PM, &mphy->state); - err =3D -EIO; + return -EIO; } =20 pm->stats.last_doze_event =3D jiffies; pm->stats.awake_time +=3D pm->stats.last_doze_event - pm->stats.last_wake_event; =20 - return err; + return 0; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8598C00140 for ; Mon, 15 Aug 2022 21:14:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232112AbiHOVOH (ORCPT ); Mon, 15 Aug 2022 17:14:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347947AbiHOVHs (ORCPT ); Mon, 15 Aug 2022 17:07:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 405723B948; Mon, 15 Aug 2022 12:16:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D19E66009B; Mon, 15 Aug 2022 19:16:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0C9AC433D6; Mon, 15 Aug 2022 19:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591018; bh=ATE1cTmhzo7APlhk3egsok+n2wPA9FCysFJZ3kyQ6Hg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BgOd6ZBNG932AH47dswoXI7DhqyUJZlOeryx0ysKmtbn7VHEjZ66FGXeo/mostavi zTo01FWfy9ie5Z3L18Z934M5XF5PENXscvQqK4kd6Annt7dc9gqgun1VbRUHL+RgY+ /96e3tFZxkNY7jRurB1akpuGdPrwOFnDL6JsN9U4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Yen Hsieh , Sean Wang , Deren Wu , Felix Fietkau , Sasha Levin Subject: [PATCH 5.18 0446/1095] mt76: mt7921: fix aggregation subframes setting to HE max Date: Mon, 15 Aug 2022 19:57:25 +0200 Message-Id: <20220815180448.089520156@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Deren Wu [ Upstream commit d5a50e6bd1972c481f82befa846dce0b9866f025 ] mt7921/mt7922 support HE max aggregation subframes 256 for both tx/rx. Get better throughput then before. Fixes: 94bb18b03d43 ("mt76: mt7921: fix max aggregation subframes setting") Tested-by: Ming Yen Hsieh Reviewed-by: Sean Wang Signed-off-by: Deren Wu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net= /wireless/mediatek/mt76/mt7921/init.c index 91fc41922d95..2fb2a6295c06 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -49,8 +49,8 @@ mt7921_init_wiphy(struct ieee80211_hw *hw) struct wiphy *wiphy =3D hw->wiphy; =20 hw->queues =3D 4; - hw->max_rx_aggregation_subframes =3D 64; - hw->max_tx_aggregation_subframes =3D 128; + hw->max_rx_aggregation_subframes =3D IEEE80211_MAX_AMPDU_BUF_HE; + hw->max_tx_aggregation_subframes =3D IEEE80211_MAX_AMPDU_BUF_HE; hw->netdev_features =3D NETIF_F_RXCSUM; =20 hw->radiotap_timestamp.units_pos =3D --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B77EDC00140 for ; Mon, 15 Aug 2022 21:14:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241963AbiHOVOm (ORCPT ); Mon, 15 Aug 2022 17:14:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347956AbiHOVHt (ORCPT ); Mon, 15 Aug 2022 17:07:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D681F52DCC; Mon, 15 Aug 2022 12:17:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 83D65B810C6; Mon, 15 Aug 2022 19:17:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0C43C433C1; Mon, 15 Aug 2022 19:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591021; bh=ZUY3aye9XfntD/W1LptzNAeuGwjfjNeNEbwzMypK0Mc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wUUFeIiuOYFmH46F8h2OuKFsF0+J6Y522Uv5GyRXgyUD18/Uk07lx8DvnpJ43qFpp tdcjyas4TjBY0YERYxXR1wJ13Q0Itqw+Uk4nEcc/lxeZARWC12gBaW351+xZGLfFoR Emp8j6k0TbAErqBh1asNZqJd8TSV130XTk+Q4kWI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Yen Hsieh , Deren Wu , Felix Fietkau , Sasha Levin Subject: [PATCH 5.18 0447/1095] mt76: mt7921: enlarge maximum VHT MPDU length to 11454 Date: Mon, 15 Aug 2022 19:57:26 +0200 Message-Id: <20220815180448.121058796@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Deren Wu [ Upstream commit 31f3248a75932b111bc90c66b1f6c7d89eedca8e ] Enlarge maximum MPDU length to 11454 that both mt7921/mt7922 can support. After this fixing, we can get better performance. Fixes: 5c14a5f944b9 ("mt76: mt7921: introduce mt7921e support") Tested-by: Ming Yen Hsieh Signed-off-by: Deren Wu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net= /wireless/mediatek/mt76/mt7921/init.c index 2fb2a6295c06..37453e1c136f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -291,7 +291,7 @@ int mt7921_register_device(struct mt7921_dev *dev) IEEE80211_HT_CAP_LDPC_CODING | IEEE80211_HT_CAP_MAX_AMSDU; dev->mphy.sband_5g.sband.vht_cap.cap |=3D - IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 | + IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 | IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE | --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10408C00140 for ; Mon, 15 Aug 2022 21:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232778AbiHOVO0 (ORCPT ); Mon, 15 Aug 2022 17:14:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347963AbiHOVHt (ORCPT ); Mon, 15 Aug 2022 17:07:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60D2D52DF5; Mon, 15 Aug 2022 12:17:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F04996009B; Mon, 15 Aug 2022 19:17:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 057BEC433D6; Mon, 15 Aug 2022 19:17:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591024; bh=4cp7xliMzBn+/YidW4XUZ9qJ3YykQDoffQ5NM1pymH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SBS1lX+if8MzYvkmtWkL7VpvTIEWZ1UKkfOYYQDuRhot1XYCHU2VMac1nMt+8/L57 K9ivliSlYjJ8bDy3hJnvKGoGzoLx0s1DhVauuwvvBmTrH8mNkZho8qT+SkD/Ov/ECD Aixwoi26OHzb9z1Xf216swcR01YtP320JlROGgD4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , Sasha Levin Subject: [PATCH 5.18 0448/1095] mt76: mt7615: fix throughput regression on DFS channels Date: Mon, 15 Aug 2022 19:57:27 +0200 Message-Id: <20220815180448.160646959@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Felix Fietkau [ Upstream commit aac86cebb4a09e3fa2c07589f79f7d0e07e8c9a4 ] For some reason, mt7615 reacts badly to repeatedly enabling/disabling the r= adar detector without also switching the channel. This results in very bad throughput on DFS channels, because hw->conf.radar_enabled can get toggled a few times after CAC ends. Fix this by always leaving the DFS detector enabled on DFS channels and ins= tead suppress unwanted detection events. Fixes: 2c86f6752046 ("mt76: mt7615: fix/rewrite the dfs state handling logi= c") Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../net/wireless/mediatek/mt76/mt7615/mac.c | 7 ++++--- .../net/wireless/mediatek/mt76/mt7615/main.c | 21 ------------------- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 3 +++ .../wireless/mediatek/mt76/mt7615/mt7615.h | 1 - 4 files changed, 7 insertions(+), 25 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/= wireless/mediatek/mt76/mt7615/mac.c index bd687f7de628..9e832b27170f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -2282,6 +2282,7 @@ mt7615_dfs_init_radar_specs(struct mt7615_phy *phy) =20 int mt7615_dfs_init_radar_detector(struct mt7615_phy *phy) { + struct cfg80211_chan_def *chandef =3D &phy->mt76->chandef; struct mt7615_dev *dev =3D phy->dev; bool ext_phy =3D phy !=3D &dev->phy; enum mt76_dfs_state dfs_state, prev_state; @@ -2292,13 +2293,13 @@ int mt7615_dfs_init_radar_detector(struct mt7615_ph= y *phy) =20 prev_state =3D phy->mt76->dfs_state; dfs_state =3D mt76_phy_dfs_state(phy->mt76); + if ((chandef->chan->flags & IEEE80211_CHAN_RADAR) && + dfs_state < MT_DFS_STATE_CAC) + dfs_state =3D MT_DFS_STATE_ACTIVE; =20 if (prev_state =3D=3D dfs_state) return 0; =20 - if (prev_state =3D=3D MT_DFS_STATE_UNKNOWN) - mt7615_dfs_stop_radar_detector(phy); - if (dfs_state =3D=3D MT_DFS_STATE_DISABLED) goto stop; =20 diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net= /wireless/mediatek/mt76/mt7615/main.c index 6b8e3e7ae4a2..36990637a8a2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c @@ -282,26 +282,6 @@ static void mt7615_remove_interface(struct ieee80211_h= w *hw, mt76_packet_id_flush(&dev->mt76, &mvif->sta.wcid); } =20 -static void mt7615_init_dfs_state(struct mt7615_phy *phy) -{ - struct mt76_phy *mphy =3D phy->mt76; - struct ieee80211_hw *hw =3D mphy->hw; - struct cfg80211_chan_def *chandef =3D &hw->conf.chandef; - - if (hw->conf.flags & IEEE80211_CONF_OFFCHANNEL) - return; - - if (!(chandef->chan->flags & IEEE80211_CHAN_RADAR) && - !(mphy->chandef.chan->flags & IEEE80211_CHAN_RADAR)) - return; - - if (mphy->chandef.chan->center_freq =3D=3D chandef->chan->center_freq && - mphy->chandef.width =3D=3D chandef->width) - return; - - phy->dfs_state =3D -1; -} - int mt7615_set_channel(struct mt7615_phy *phy) { struct mt7615_dev *dev =3D phy->dev; @@ -314,7 +294,6 @@ int mt7615_set_channel(struct mt7615_phy *phy) =20 set_bit(MT76_RESET, &phy->mt76->state); =20 - mt7615_init_dfs_state(phy); mt76_set_channel(phy->mt76); =20 if (is_mt7615(&dev->mt76) && dev->flash_eeprom) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/= wireless/mediatek/mt76/mt7615/mcu.c index 6f3efec58afe..7127d6007ae0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -403,6 +403,9 @@ mt7615_mcu_rx_radar_detected(struct mt7615_dev *dev, st= ruct sk_buff *skb) if (r->band_idx && dev->mt76.phy2) mphy =3D dev->mt76.phy2; =20 + if (mt76_phy_dfs_state(mphy) < MT_DFS_STATE_CAC) + return; + ieee80211_radar_detected(mphy->hw); dev->hw_pattern++; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/n= et/wireless/mediatek/mt76/mt7615/mt7615.h index 2e91f6a27d0f..082c73b571ae 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h @@ -177,7 +177,6 @@ struct mt7615_phy { =20 u8 chfreq; u8 rdd_state; - int dfs_state; =20 u32 rx_ampdu_ts; u32 ampdu_ref; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D61DAC00140 for ; Mon, 15 Aug 2022 21:15:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243155AbiHOVPB (ORCPT ); Mon, 15 Aug 2022 17:15:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347972AbiHOVHv (ORCPT ); Mon, 15 Aug 2022 17:07:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 127A62DA9D; Mon, 15 Aug 2022 12:17:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C0710B81106; Mon, 15 Aug 2022 19:17:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10009C433D6; Mon, 15 Aug 2022 19:17:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591030; bh=fYbP1YflV4hH15QKYSOkjKnLIBRWSIwhXtLP5OnT6Kc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Shu9OyJ5f2NgUyT963J5HT8SJ3W5LPB4+cKPrVT7vp0FyNoOv0Uh0MNvbZNKfdAZr s8/P9b1q63oNQIMKGAuHkhWQuCG+wtQytPlWUVUF7OP4dd8TNuvU9XsXmUTf6AhxVO qbk3r2DPEaHwFWStGHsQg49jC0DpjQLaNwdXiCvw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Felix Fietkau , Sasha Levin Subject: [PATCH 5.18 0449/1095] mediatek: mt76: mac80211: Fix missing of_node_put() in mt76_led_init() Date: Mon, 15 Aug 2022 19:57:28 +0200 Message-Id: <20220815180448.203829608@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 0a14c1d0113f121151edf34333cdf212dd209190 ] We should use of_node_put() for the reference 'np' returned by of_get_child_by_name() which will increase the refcount. Fixes: 17f1de56df05 ("mt76: add common code shared between multiple chipset= s") Signed-off-by: Liang He Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/mediatek/mt76/mac80211.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wi= reless/mediatek/mt76/mac80211.c index 8a2fedbb1451..2cd7b3f1db64 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -210,6 +210,7 @@ static int mt76_led_init(struct mt76_dev *dev) if (!of_property_read_u32(np, "led-sources", &led_pin)) dev->led_pin =3D led_pin; dev->led_al =3D of_property_read_bool(np, "led-active-low"); + of_node_put(np); } =20 return led_classdev_register(dev->dev, &dev->led_cdev); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A881CC00140 for ; Mon, 15 Aug 2022 21:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243273AbiHOVPP (ORCPT ); Mon, 15 Aug 2022 17:15:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347974AbiHOVHv (ORCPT ); Mon, 15 Aug 2022 17:07:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96A0F2DAA9; Mon, 15 Aug 2022 12:17:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 33F6E60F6C; Mon, 15 Aug 2022 19:17:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30F2AC433D6; Mon, 15 Aug 2022 19:17:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591033; bh=5w7u11WAsIHQgPorsHch8FybS1tdF79re+HYY2FLuss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KAye4u1nadB3tBHmTabhQF1HPhawPJtLmtWtkUuW+1Jv7b1VZeyPrv/+jdaXNjwmJ KDnSee6cda7U1Y6sXD3sWhfzvMz2J1W1J0snVPt63A9ddu10a7UF2yfvwCj3OY7eB7 k/tSWQjcCm8AIH/zhF8tmQvIagQyI3cP6LP55ww4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Felix Fietkau , Sasha Levin Subject: [PATCH 5.18 0450/1095] mediatek: mt76: eeprom: fix missing of_node_put() in mt76_find_power_limits_node() Date: Mon, 15 Aug 2022 19:57:29 +0200 Message-Id: <20220815180448.242700239@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 3bd53ea02d77917c2314ec7be9e2d05be22f87d3 ] We should use of_node_put() for the reference 'np' returned by of_get_child_by_name() which will increase the refcount. Fixes: 22b980badc0f ("mt76: add functions for parsing rate power limits fro= m DT") Signed-off-by: Liang He Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/mediatek/mt76/eeprom.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wire= less/mediatek/mt76/eeprom.c index a499861918fa..9bc8758573fc 100644 --- a/drivers/net/wireless/mediatek/mt76/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/eeprom.c @@ -162,10 +162,13 @@ mt76_find_power_limits_node(struct mt76_dev *dev) } =20 if (mt76_string_prop_find(country, dev->alpha2) || - mt76_string_prop_find(regd, region_name)) + mt76_string_prop_find(regd, region_name)) { + of_node_put(np); return cur; + } } =20 + of_node_put(np); return fallback; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7735C00140 for ; Mon, 15 Aug 2022 21:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239081AbiHOVPU (ORCPT ); Mon, 15 Aug 2022 17:15:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347982AbiHOVHw (ORCPT ); Mon, 15 Aug 2022 17:07:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60D642E686; Mon, 15 Aug 2022 12:17:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1B3A2B8107A; Mon, 15 Aug 2022 19:17:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6608DC433C1; Mon, 15 Aug 2022 19:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591036; bh=9gl4kRdQ+WLKKQ5khPH9o29OL7Te4TCVWT384FGVGKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CN/XWQ+SZwtm8+YvOY3yGycumBkpfQgANOH7UjMW5YtEyNtXclLbQbbyjWARF6nUn FwUAghLPcdw4ZZiam37Ze/K1zIu4EedGi3PPZuABP1z/gzNSq2asZdxeg5QK2kF0ZL Rc1qND5OwxVhNpqUzl+oac/bObRwh9rBlLo59KqM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Jian , Daniel Borkmann , John Fastabend , Sasha Levin Subject: [PATCH 5.18 0451/1095] skmsg: Fix invalid last sg check in sk_msg_recvmsg() Date: Mon, 15 Aug 2022 19:57:30 +0200 Message-Id: <20220815180448.289597023@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liu Jian [ Upstream commit 9974d37ea75f01b47d16072b5dad305bd8d23fcc ] In sk_psock_skb_ingress_enqueue function, if the linear area + nr_frags + frag_list of the SKB has NR_MSG_FRAG_IDS blocks in total, skb_to_sgvec will return NR_MSG_FRAG_IDS, then msg->sg.end will be set to NR_MSG_FRAG_IDS, and in addition, (NR_MSG_FRAG_IDS - 1) is set to the last SG of msg. Recv the msg in sk_msg_recvmsg, when i is (NR_MSG_FRAG_IDS - 1), the sk_msg_iter_var_next(i) will change i to 0 (not NR_MSG_FRAG_IDS), the judgment condition "msg_rx->sg.start=3D=3Dmsg_rx->sg.end" and "i !=3D msg_rx->sg.end" can not work. As a result, the processed msg cannot be deleted from ingress_msg list. But the length of all the sge of the msg has changed to 0. Then the next recvmsg syscall will process the msg repeatedly, because the length of sge is 0, the -EFAULT error is always returned. Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface") Signed-off-by: Liu Jian Signed-off-by: Daniel Borkmann Acked-by: John Fastabend Link: https://lore.kernel.org/bpf/20220628123616.186950-1-liujian56@huawei.= com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/core/skmsg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index ede0af308f40..f50f8d95b628 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c @@ -462,7 +462,7 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *ps= ock, struct msghdr *msg, =20 if (copied =3D=3D len) break; - } while (i !=3D msg_rx->sg.end); + } while (!sg_is_last(sge)); =20 if (unlikely(peek)) { msg_rx =3D sk_psock_next_msg(psock, msg_rx); @@ -472,7 +472,7 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *ps= ock, struct msghdr *msg, } =20 msg_rx->sg.start =3D i; - if (!sge->length && msg_rx->sg.start =3D=3D msg_rx->sg.end) { + if (!sge->length && sg_is_last(sge)) { msg_rx =3D sk_psock_dequeue_msg(psock); kfree_sk_msg(msg_rx); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06FB1C00140 for ; Mon, 15 Aug 2022 21:18:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243456AbiHOVPk (ORCPT ); Mon, 15 Aug 2022 17:15:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347989AbiHOVHx (ORCPT ); Mon, 15 Aug 2022 17:07:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 896FB3B971; Mon, 15 Aug 2022 12:17:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 44643B810A3; Mon, 15 Aug 2022 19:17:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 773D6C433C1; Mon, 15 Aug 2022 19:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591039; bh=h/PfWu7Xr8kqLVrdH1TS0WY7MGdiEQCDXRo1umr4zv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PvakoKGeBlUfL3ScuF4KI/POHi5Ha1cPWejspiaocPWdJdz0DD+gTQqIfqLoRAmrh Fh7d4Ut/bKddzUmCm8gcL2nL/o36a9j3JyrycEYWnPUkHaKR1B0H1mw4klj07IYg7q XRs23bxpY4nzwqH2cNKIQBd3SzFHZ1dGfsakBT+0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Jian Zhang , Inki Dae , Sasha Levin Subject: [PATCH 5.18 0452/1095] drm/exynos/exynos7_drm_decon: free resources when clk_set_parent() failed. Date: Mon, 15 Aug 2022 19:57:31 +0200 Message-Id: <20220815180448.329093478@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jian Zhang [ Upstream commit 48b927770f8ad3f8cf4a024a552abf272af9f592 ] In exynos7_decon_resume, When it fails, we must use clk_disable_unprepare() to free resource that have been used. Fixes: 6f83d20838c09 ("drm/exynos: use DRM_DEV_ERROR to print out error message") Reported-by: Hulk Robot Signed-off-by: Jian Zhang Signed-off-by: Inki Dae Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/e= xynos/exynos7_drm_decon.c index c04264f70ad1..3c31405600f0 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -800,31 +800,40 @@ static int exynos7_decon_resume(struct device *dev) if (ret < 0) { DRM_DEV_ERROR(dev, "Failed to prepare_enable the pclk [%d]\n", ret); - return ret; + goto err_pclk_enable; } =20 ret =3D clk_prepare_enable(ctx->aclk); if (ret < 0) { DRM_DEV_ERROR(dev, "Failed to prepare_enable the aclk [%d]\n", ret); - return ret; + goto err_aclk_enable; } =20 ret =3D clk_prepare_enable(ctx->eclk); if (ret < 0) { DRM_DEV_ERROR(dev, "Failed to prepare_enable the eclk [%d]\n", ret); - return ret; + goto err_eclk_enable; } =20 ret =3D clk_prepare_enable(ctx->vclk); if (ret < 0) { DRM_DEV_ERROR(dev, "Failed to prepare_enable the vclk [%d]\n", ret); - return ret; + goto err_vclk_enable; } =20 return 0; + +err_vclk_enable: + clk_disable_unprepare(ctx->eclk); +err_eclk_enable: + clk_disable_unprepare(ctx->aclk); +err_aclk_enable: + clk_disable_unprepare(ctx->pclk); +err_pclk_enable: + return ret; } #endif =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95BC1C25B08 for ; Mon, 15 Aug 2022 21:15:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233797AbiHOVPg (ORCPT ); Mon, 15 Aug 2022 17:15:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347993AbiHOVHx (ORCPT ); Mon, 15 Aug 2022 17:07:53 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 493C52AE3E; Mon, 15 Aug 2022 12:17:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id B0ACDCE12C7; Mon, 15 Aug 2022 19:17:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 894DCC433C1; Mon, 15 Aug 2022 19:17:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591043; bh=eZUb+aQMNbV6lZHdXecjaoF0a6s0C00ln2UItW2hTY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RiCP3ANDcwOSUs6JxbuEuN1unIXAu/bdpIYyrFxo+RtHeoWAzHRvW06+VA52TBtVX fOUHOc49l8gUOC4x5JAwnBHJlzrwuuOw3Tpz8W13+9yjtbmnOhO+lAb9VeuT+VuBwU 1FmySetzoaBrfTg16vwlxgzQS+HczXIeOpZ/KsvA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Milan Landaverde , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.18 0453/1095] bpftool: Add missing link types Date: Mon, 15 Aug 2022 19:57:32 +0200 Message-Id: <20220815180448.362288232@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Milan Landaverde [ Upstream commit fff3dfab17866f6ac5c5666839f6132b6c52f306 ] Will display the link type names in bpftool link show output Signed-off-by: Milan Landaverde Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20220331154555.422506-3-milan@mdaverde.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/bpf/bpftool/link.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/bpf/bpftool/link.c b/tools/bpf/bpftool/link.c index 97dec81950e5..8fb0116f9136 100644 --- a/tools/bpf/bpftool/link.c +++ b/tools/bpf/bpftool/link.c @@ -20,6 +20,9 @@ static const char * const link_type_name[] =3D { [BPF_LINK_TYPE_CGROUP] =3D "cgroup", [BPF_LINK_TYPE_ITER] =3D "iter", [BPF_LINK_TYPE_NETNS] =3D "netns", + [BPF_LINK_TYPE_XDP] =3D "xdp", + [BPF_LINK_TYPE_PERF_EVENT] =3D "perf_event", + [BPF_LINK_TYPE_KPROBE_MULTI] =3D "kprobe_multi", }; =20 static struct hashmap *link_table; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C438C2BB41 for ; Mon, 15 Aug 2022 21:18:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244565AbiHOVQe (ORCPT ); Mon, 15 Aug 2022 17:16:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347995AbiHOVHy (ORCPT ); Mon, 15 Aug 2022 17:07:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 727572DA93; Mon, 15 Aug 2022 12:17:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0210160EF0; Mon, 15 Aug 2022 19:17:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2C2DC433C1; Mon, 15 Aug 2022 19:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591046; bh=IG97x3kT7IDBVNhEo+u6d/Usu23pv+nco+K29YmFSjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LY/uIzg3gYeRFHMvjv1Os7Bu7BgKOlevCTNl1gCKXnfWGIKm/O56qq35oijbU65h3 C4aHjtxIM3nKuyBZ/ki76Y3oHjSASff3NcuXbjyefRuO6lFY/Hn/eRZS1d2dqkTG6a NU7rdmHEoZMkZe7a/IuFTEuz1naB+/dLh6fgWn7g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kui-Feng Lee , Alexei Starovoitov , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.18 0454/1095] bpf, x86: Generate trampolines from bpf_tramp_links Date: Mon, 15 Aug 2022 19:57:33 +0200 Message-Id: <20220815180448.404598919@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kui-Feng Lee [ Upstream commit f7e0beaf39d3868dc700d4954b26cf8443c5d423 ] Replace struct bpf_tramp_progs with struct bpf_tramp_links to collect struct bpf_tramp_link(s) for a trampoline. struct bpf_tramp_link extends bpf_link to act as a linked list node. arch_prepare_bpf_trampoline() accepts a struct bpf_tramp_links to collects all bpf_tramp_link(s) that a trampoline should call. Change BPF trampoline and bpf_struct_ops to pass bpf_tramp_links instead of bpf_tramp_progs. Signed-off-by: Kui-Feng Lee Signed-off-by: Alexei Starovoitov Signed-off-by: Andrii Nakryiko Acked-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20220510205923.3206889-2-kuifeng@fb.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/net/bpf_jit_comp.c | 36 +++++++++-------- include/linux/bpf.h | 36 +++++++++++------ include/linux/bpf_types.h | 1 + include/uapi/linux/bpf.h | 1 + kernel/bpf/bpf_struct_ops.c | 71 +++++++++++++++++++++++---------- kernel/bpf/syscall.c | 23 ++++------- kernel/bpf/trampoline.c | 73 +++++++++++++++++++--------------- net/bpf/bpf_dummy_struct_ops.c | 24 ++++++++--- tools/bpf/bpftool/link.c | 1 + tools/include/uapi/linux/bpf.h | 1 + 10 files changed, 164 insertions(+), 103 deletions(-) diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index 2dab2816b3f7..9ec96d5a8239 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c @@ -1777,10 +1777,12 @@ static void restore_regs(const struct btf_func_mode= l *m, u8 **prog, int nr_args, } =20 static int invoke_bpf_prog(const struct btf_func_model *m, u8 **pprog, - struct bpf_prog *p, int stack_size, bool save_ret) + struct bpf_tramp_link *l, int stack_size, + bool save_ret) { u8 *prog =3D *pprog; u8 *jmp_insn; + struct bpf_prog *p =3D l->link.prog; =20 /* arg1: mov rdi, progs[i] */ emit_mov_imm64(&prog, BPF_REG_1, (long) p >> 32, (u32) (long) p); @@ -1865,14 +1867,14 @@ static int emit_cond_near_jump(u8 **pprog, void *fu= nc, void *ip, u8 jmp_cond) } =20 static int invoke_bpf(const struct btf_func_model *m, u8 **pprog, - struct bpf_tramp_progs *tp, int stack_size, + struct bpf_tramp_links *tl, int stack_size, bool save_ret) { int i; u8 *prog =3D *pprog; =20 - for (i =3D 0; i < tp->nr_progs; i++) { - if (invoke_bpf_prog(m, &prog, tp->progs[i], stack_size, + for (i =3D 0; i < tl->nr_links; i++) { + if (invoke_bpf_prog(m, &prog, tl->links[i], stack_size, save_ret)) return -EINVAL; } @@ -1881,7 +1883,7 @@ static int invoke_bpf(const struct btf_func_model *m,= u8 **pprog, } =20 static int invoke_bpf_mod_ret(const struct btf_func_model *m, u8 **pprog, - struct bpf_tramp_progs *tp, int stack_size, + struct bpf_tramp_links *tl, int stack_size, u8 **branches) { u8 *prog =3D *pprog; @@ -1892,8 +1894,8 @@ static int invoke_bpf_mod_ret(const struct btf_func_m= odel *m, u8 **pprog, */ emit_mov_imm32(&prog, false, BPF_REG_0, 0); emit_stx(&prog, BPF_DW, BPF_REG_FP, BPF_REG_0, -8); - for (i =3D 0; i < tp->nr_progs; i++) { - if (invoke_bpf_prog(m, &prog, tp->progs[i], stack_size, true)) + for (i =3D 0; i < tl->nr_links; i++) { + if (invoke_bpf_prog(m, &prog, tl->links[i], stack_size, true)) return -EINVAL; =20 /* mod_ret prog stored return value into [rbp - 8]. Emit: @@ -1995,14 +1997,14 @@ static bool is_valid_bpf_tramp_flags(unsigned int f= lags) */ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, v= oid *image_end, const struct btf_func_model *m, u32 flags, - struct bpf_tramp_progs *tprogs, + struct bpf_tramp_links *tlinks, void *orig_call) { int ret, i, nr_args =3D m->nr_args; int regs_off, ip_off, args_off, stack_size =3D nr_args * 8; - struct bpf_tramp_progs *fentry =3D &tprogs[BPF_TRAMP_FENTRY]; - struct bpf_tramp_progs *fexit =3D &tprogs[BPF_TRAMP_FEXIT]; - struct bpf_tramp_progs *fmod_ret =3D &tprogs[BPF_TRAMP_MODIFY_RETURN]; + struct bpf_tramp_links *fentry =3D &tlinks[BPF_TRAMP_FENTRY]; + struct bpf_tramp_links *fexit =3D &tlinks[BPF_TRAMP_FEXIT]; + struct bpf_tramp_links *fmod_ret =3D &tlinks[BPF_TRAMP_MODIFY_RETURN]; u8 **branches =3D NULL; u8 *prog; bool save_ret; @@ -2093,13 +2095,13 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_im= age *im, void *image, void *i } } =20 - if (fentry->nr_progs) + if (fentry->nr_links) if (invoke_bpf(m, &prog, fentry, regs_off, flags & BPF_TRAMP_F_RET_FENTRY_RET)) return -EINVAL; =20 - if (fmod_ret->nr_progs) { - branches =3D kcalloc(fmod_ret->nr_progs, sizeof(u8 *), + if (fmod_ret->nr_links) { + branches =3D kcalloc(fmod_ret->nr_links, sizeof(u8 *), GFP_KERNEL); if (!branches) return -ENOMEM; @@ -2126,7 +2128,7 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_imag= e *im, void *image, void *i prog +=3D X86_PATCH_SIZE; } =20 - if (fmod_ret->nr_progs) { + if (fmod_ret->nr_links) { /* From Intel 64 and IA-32 Architectures Optimization * Reference Manual, 3.4.1.4 Code Alignment, Assembly/Compiler * Coding Rule 11: All branch targets should be 16-byte @@ -2136,12 +2138,12 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_im= age *im, void *image, void *i /* Update the branches saved in invoke_bpf_mod_ret with the * aligned address of do_fexit. */ - for (i =3D 0; i < fmod_ret->nr_progs; i++) + for (i =3D 0; i < fmod_ret->nr_links; i++) emit_cond_near_jump(&branches[i], prog, branches[i], X86_JNE); } =20 - if (fexit->nr_progs) + if (fexit->nr_links) if (invoke_bpf(m, &prog, fexit, regs_off, false)) { ret =3D -EINVAL; goto cleanup; diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 83bd5598ec4d..b5d19a6f7d24 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -674,11 +674,11 @@ struct btf_func_model { /* Each call __bpf_prog_enter + call bpf_func + call __bpf_prog_exit is ~50 * bytes on x86. */ -#define BPF_MAX_TRAMP_PROGS 38 +#define BPF_MAX_TRAMP_LINKS 38 =20 -struct bpf_tramp_progs { - struct bpf_prog *progs[BPF_MAX_TRAMP_PROGS]; - int nr_progs; +struct bpf_tramp_links { + struct bpf_tramp_link *links[BPF_MAX_TRAMP_LINKS]; + int nr_links; }; =20 /* Different use cases for BPF trampoline: @@ -704,7 +704,7 @@ struct bpf_tramp_progs { struct bpf_tramp_image; int arch_prepare_bpf_trampoline(struct bpf_tramp_image *tr, void *image, v= oid *image_end, const struct btf_func_model *m, u32 flags, - struct bpf_tramp_progs *tprogs, + struct bpf_tramp_links *tlinks, void *orig_call); /* these two functions are called from generated trampoline */ u64 notrace __bpf_prog_enter(struct bpf_prog *prog); @@ -803,9 +803,10 @@ static __always_inline __nocfi unsigned int bpf_dispat= cher_nop_func( { return bpf_func(ctx, insnsi); } + #ifdef CONFIG_BPF_JIT -int bpf_trampoline_link_prog(struct bpf_prog *prog, struct bpf_trampoline = *tr); -int bpf_trampoline_unlink_prog(struct bpf_prog *prog, struct bpf_trampolin= e *tr); +int bpf_trampoline_link_prog(struct bpf_tramp_link *link, struct bpf_tramp= oline *tr); +int bpf_trampoline_unlink_prog(struct bpf_tramp_link *link, struct bpf_tra= mpoline *tr); struct bpf_trampoline *bpf_trampoline_get(u64 key, struct bpf_attach_target_info *tgt_info); void bpf_trampoline_put(struct bpf_trampoline *tr); @@ -856,12 +857,12 @@ int bpf_jit_charge_modmem(u32 size); void bpf_jit_uncharge_modmem(u32 size); bool bpf_prog_has_trampoline(const struct bpf_prog *prog); #else -static inline int bpf_trampoline_link_prog(struct bpf_prog *prog, +static inline int bpf_trampoline_link_prog(struct bpf_tramp_link *link, struct bpf_trampoline *tr) { return -ENOTSUPP; } -static inline int bpf_trampoline_unlink_prog(struct bpf_prog *prog, +static inline int bpf_trampoline_unlink_prog(struct bpf_tramp_link *link, struct bpf_trampoline *tr) { return -ENOTSUPP; @@ -960,7 +961,6 @@ struct bpf_prog_aux { bool tail_call_reachable; bool xdp_has_frags; bool use_bpf_prog_pack; - struct hlist_node tramp_hlist; /* BTF_KIND_FUNC_PROTO for valid attach_btf_id */ const struct btf_type *attach_func_proto; /* function name for valid attach_btf_id */ @@ -1047,6 +1047,18 @@ struct bpf_link_ops { struct bpf_link_info *info); }; =20 +struct bpf_tramp_link { + struct bpf_link link; + struct hlist_node tramp_hlist; +}; + +struct bpf_tracing_link { + struct bpf_tramp_link link; + enum bpf_attach_type attach_type; + struct bpf_trampoline *trampoline; + struct bpf_prog *tgt_prog; +}; + struct bpf_link_primer { struct bpf_link *link; struct file *file; @@ -1084,8 +1096,8 @@ bool bpf_struct_ops_get(const void *kdata); void bpf_struct_ops_put(const void *kdata); int bpf_struct_ops_map_sys_lookup_elem(struct bpf_map *map, void *key, void *value); -int bpf_struct_ops_prepare_trampoline(struct bpf_tramp_progs *tprogs, - struct bpf_prog *prog, +int bpf_struct_ops_prepare_trampoline(struct bpf_tramp_links *tlinks, + struct bpf_tramp_link *link, const struct btf_func_model *model, void *image, void *image_end); static inline bool bpf_try_module_get(const void *data, struct module *own= er) diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h index 3e24ad0c4b3c..2b9112b80171 100644 --- a/include/linux/bpf_types.h +++ b/include/linux/bpf_types.h @@ -141,3 +141,4 @@ BPF_LINK_TYPE(BPF_LINK_TYPE_XDP, xdp) BPF_LINK_TYPE(BPF_LINK_TYPE_PERF_EVENT, perf) #endif BPF_LINK_TYPE(BPF_LINK_TYPE_KPROBE_MULTI, kprobe_multi) +BPF_LINK_TYPE(BPF_LINK_TYPE_STRUCT_OPS, struct_ops) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index d14b10b85e51..a4f557338af7 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -1013,6 +1013,7 @@ enum bpf_link_type { BPF_LINK_TYPE_XDP =3D 6, BPF_LINK_TYPE_PERF_EVENT =3D 7, BPF_LINK_TYPE_KPROBE_MULTI =3D 8, + BPF_LINK_TYPE_STRUCT_OPS =3D 9, =20 MAX_BPF_LINK_TYPE, }; diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c index 21069dbe9138..310b0591d91f 100644 --- a/kernel/bpf/bpf_struct_ops.c +++ b/kernel/bpf/bpf_struct_ops.c @@ -32,15 +32,15 @@ struct bpf_struct_ops_map { const struct bpf_struct_ops *st_ops; /* protect map_update */ struct mutex lock; - /* progs has all the bpf_prog that is populated + /* link has all the bpf_links that is populated * to the func ptr of the kernel's struct * (in kvalue.data). */ - struct bpf_prog **progs; + struct bpf_link **links; /* image is a page that has all the trampolines * that stores the func args before calling the bpf_prog. * A PAGE_SIZE "image" is enough to store all trampoline for - * "progs[]". + * "links[]". */ void *image; /* uvalue->data stores the kernel struct @@ -282,9 +282,9 @@ static void bpf_struct_ops_map_put_progs(struct bpf_str= uct_ops_map *st_map) u32 i; =20 for (i =3D 0; i < btf_type_vlen(t); i++) { - if (st_map->progs[i]) { - bpf_prog_put(st_map->progs[i]); - st_map->progs[i] =3D NULL; + if (st_map->links[i]) { + bpf_link_put(st_map->links[i]); + st_map->links[i] =3D NULL; } } } @@ -315,18 +315,34 @@ static int check_zero_holes(const struct btf_type *t,= void *data) return 0; } =20 -int bpf_struct_ops_prepare_trampoline(struct bpf_tramp_progs *tprogs, - struct bpf_prog *prog, +static void bpf_struct_ops_link_release(struct bpf_link *link) +{ +} + +static void bpf_struct_ops_link_dealloc(struct bpf_link *link) +{ + struct bpf_tramp_link *tlink =3D container_of(link, struct bpf_tramp_link= , link); + + kfree(tlink); +} + +const struct bpf_link_ops bpf_struct_ops_link_lops =3D { + .release =3D bpf_struct_ops_link_release, + .dealloc =3D bpf_struct_ops_link_dealloc, +}; + +int bpf_struct_ops_prepare_trampoline(struct bpf_tramp_links *tlinks, + struct bpf_tramp_link *link, const struct btf_func_model *model, void *image, void *image_end) { u32 flags; =20 - tprogs[BPF_TRAMP_FENTRY].progs[0] =3D prog; - tprogs[BPF_TRAMP_FENTRY].nr_progs =3D 1; + tlinks[BPF_TRAMP_FENTRY].links[0] =3D link; + tlinks[BPF_TRAMP_FENTRY].nr_links =3D 1; flags =3D model->ret_size > 0 ? BPF_TRAMP_F_RET_FENTRY_RET : 0; return arch_prepare_bpf_trampoline(NULL, image, image_end, - model, flags, tprogs, NULL); + model, flags, tlinks, NULL); } =20 static int bpf_struct_ops_map_update_elem(struct bpf_map *map, void *key, @@ -337,7 +353,7 @@ static int bpf_struct_ops_map_update_elem(struct bpf_ma= p *map, void *key, struct bpf_struct_ops_value *uvalue, *kvalue; const struct btf_member *member; const struct btf_type *t =3D st_ops->type; - struct bpf_tramp_progs *tprogs =3D NULL; + struct bpf_tramp_links *tlinks =3D NULL; void *udata, *kdata; int prog_fd, err =3D 0; void *image, *image_end; @@ -361,8 +377,8 @@ static int bpf_struct_ops_map_update_elem(struct bpf_ma= p *map, void *key, if (uvalue->state || refcount_read(&uvalue->refcnt)) return -EINVAL; =20 - tprogs =3D kcalloc(BPF_TRAMP_MAX, sizeof(*tprogs), GFP_KERNEL); - if (!tprogs) + tlinks =3D kcalloc(BPF_TRAMP_MAX, sizeof(*tlinks), GFP_KERNEL); + if (!tlinks) return -ENOMEM; =20 uvalue =3D (struct bpf_struct_ops_value *)st_map->uvalue; @@ -385,6 +401,7 @@ static int bpf_struct_ops_map_update_elem(struct bpf_ma= p *map, void *key, for_each_member(i, t, member) { const struct btf_type *mtype, *ptype; struct bpf_prog *prog; + struct bpf_tramp_link *link; u32 moff; =20 moff =3D __btf_member_bit_offset(t, member) / 8; @@ -438,16 +455,26 @@ static int bpf_struct_ops_map_update_elem(struct bpf_= map *map, void *key, err =3D PTR_ERR(prog); goto reset_unlock; } - st_map->progs[i] =3D prog; =20 if (prog->type !=3D BPF_PROG_TYPE_STRUCT_OPS || prog->aux->attach_btf_id !=3D st_ops->type_id || prog->expected_attach_type !=3D i) { + bpf_prog_put(prog); err =3D -EINVAL; goto reset_unlock; } =20 - err =3D bpf_struct_ops_prepare_trampoline(tprogs, prog, + link =3D kzalloc(sizeof(*link), GFP_USER); + if (!link) { + bpf_prog_put(prog); + err =3D -ENOMEM; + goto reset_unlock; + } + bpf_link_init(&link->link, BPF_LINK_TYPE_STRUCT_OPS, + &bpf_struct_ops_link_lops, prog); + st_map->links[i] =3D &link->link; + + err =3D bpf_struct_ops_prepare_trampoline(tlinks, link, &st_ops->func_models[i], image, image_end); if (err < 0) @@ -490,7 +517,7 @@ static int bpf_struct_ops_map_update_elem(struct bpf_ma= p *map, void *key, memset(uvalue, 0, map->value_size); memset(kvalue, 0, map->value_size); unlock: - kfree(tprogs); + kfree(tlinks); mutex_unlock(&st_map->lock); return err; } @@ -545,9 +572,9 @@ static void bpf_struct_ops_map_free(struct bpf_map *map) { struct bpf_struct_ops_map *st_map =3D (struct bpf_struct_ops_map *)map; =20 - if (st_map->progs) + if (st_map->links) bpf_struct_ops_map_put_progs(st_map); - bpf_map_area_free(st_map->progs); + bpf_map_area_free(st_map->links); bpf_jit_free_exec(st_map->image); bpf_map_area_free(st_map->uvalue); bpf_map_area_free(st_map); @@ -596,11 +623,11 @@ static struct bpf_map *bpf_struct_ops_map_alloc(union= bpf_attr *attr) map =3D &st_map->map; =20 st_map->uvalue =3D bpf_map_area_alloc(vt->size, NUMA_NO_NODE); - st_map->progs =3D - bpf_map_area_alloc(btf_type_vlen(t) * sizeof(struct bpf_prog *), + st_map->links =3D + bpf_map_area_alloc(btf_type_vlen(t) * sizeof(struct bpf_links *), NUMA_NO_NODE); st_map->image =3D bpf_jit_alloc_exec(PAGE_SIZE); - if (!st_map->uvalue || !st_map->progs || !st_map->image) { + if (!st_map->uvalue || !st_map->links || !st_map->image) { bpf_struct_ops_map_free(map); return ERR_PTR(-ENOMEM); } diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index cdaa1152436a..3078c0c9317f 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -2640,19 +2640,12 @@ struct bpf_link *bpf_link_get_from_fd(u32 ufd) } EXPORT_SYMBOL(bpf_link_get_from_fd); =20 -struct bpf_tracing_link { - struct bpf_link link; - enum bpf_attach_type attach_type; - struct bpf_trampoline *trampoline; - struct bpf_prog *tgt_prog; -}; - static void bpf_tracing_link_release(struct bpf_link *link) { struct bpf_tracing_link *tr_link =3D - container_of(link, struct bpf_tracing_link, link); + container_of(link, struct bpf_tracing_link, link.link); =20 - WARN_ON_ONCE(bpf_trampoline_unlink_prog(link->prog, + WARN_ON_ONCE(bpf_trampoline_unlink_prog(&tr_link->link, tr_link->trampoline)); =20 bpf_trampoline_put(tr_link->trampoline); @@ -2665,7 +2658,7 @@ static void bpf_tracing_link_release(struct bpf_link = *link) static void bpf_tracing_link_dealloc(struct bpf_link *link) { struct bpf_tracing_link *tr_link =3D - container_of(link, struct bpf_tracing_link, link); + container_of(link, struct bpf_tracing_link, link.link); =20 kfree(tr_link); } @@ -2674,7 +2667,7 @@ static void bpf_tracing_link_show_fdinfo(const struct= bpf_link *link, struct seq_file *seq) { struct bpf_tracing_link *tr_link =3D - container_of(link, struct bpf_tracing_link, link); + container_of(link, struct bpf_tracing_link, link.link); =20 seq_printf(seq, "attach_type:\t%d\n", @@ -2685,7 +2678,7 @@ static int bpf_tracing_link_fill_link_info(const stru= ct bpf_link *link, struct bpf_link_info *info) { struct bpf_tracing_link *tr_link =3D - container_of(link, struct bpf_tracing_link, link); + container_of(link, struct bpf_tracing_link, link.link); =20 info->tracing.attach_type =3D tr_link->attach_type; bpf_trampoline_unpack_key(tr_link->trampoline->key, @@ -2766,7 +2759,7 @@ static int bpf_tracing_prog_attach(struct bpf_prog *p= rog, err =3D -ENOMEM; goto out_put_prog; } - bpf_link_init(&link->link, BPF_LINK_TYPE_TRACING, + bpf_link_init(&link->link.link, BPF_LINK_TYPE_TRACING, &bpf_tracing_link_lops, prog); link->attach_type =3D prog->expected_attach_type; =20 @@ -2836,11 +2829,11 @@ static int bpf_tracing_prog_attach(struct bpf_prog = *prog, tgt_prog =3D prog->aux->dst_prog; } =20 - err =3D bpf_link_prime(&link->link, &link_primer); + err =3D bpf_link_prime(&link->link.link, &link_primer); if (err) goto out_unlock; =20 - err =3D bpf_trampoline_link_prog(prog, tr); + err =3D bpf_trampoline_link_prog(&link->link, tr); if (err) { bpf_link_cleanup(&link_primer); link =3D NULL; diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c index 5d8bfb5ef239..e3bcad5a7c68 100644 --- a/kernel/bpf/trampoline.c +++ b/kernel/bpf/trampoline.c @@ -168,30 +168,30 @@ static int register_fentry(struct bpf_trampoline *tr,= void *new_addr) return ret; } =20 -static struct bpf_tramp_progs * +static struct bpf_tramp_links * bpf_trampoline_get_progs(const struct bpf_trampoline *tr, int *total, bool= *ip_arg) { - const struct bpf_prog_aux *aux; - struct bpf_tramp_progs *tprogs; - struct bpf_prog **progs; + struct bpf_tramp_link *link; + struct bpf_tramp_links *tlinks; + struct bpf_tramp_link **links; int kind; =20 *total =3D 0; - tprogs =3D kcalloc(BPF_TRAMP_MAX, sizeof(*tprogs), GFP_KERNEL); - if (!tprogs) + tlinks =3D kcalloc(BPF_TRAMP_MAX, sizeof(*tlinks), GFP_KERNEL); + if (!tlinks) return ERR_PTR(-ENOMEM); =20 for (kind =3D 0; kind < BPF_TRAMP_MAX; kind++) { - tprogs[kind].nr_progs =3D tr->progs_cnt[kind]; + tlinks[kind].nr_links =3D tr->progs_cnt[kind]; *total +=3D tr->progs_cnt[kind]; - progs =3D tprogs[kind].progs; + links =3D tlinks[kind].links; =20 - hlist_for_each_entry(aux, &tr->progs_hlist[kind], tramp_hlist) { - *ip_arg |=3D aux->prog->call_get_func_ip; - *progs++ =3D aux->prog; + hlist_for_each_entry(link, &tr->progs_hlist[kind], tramp_hlist) { + *ip_arg |=3D link->link.prog->call_get_func_ip; + *links++ =3D link; } } - return tprogs; + return tlinks; } =20 static void __bpf_tramp_image_put_deferred(struct work_struct *work) @@ -330,14 +330,14 @@ static struct bpf_tramp_image *bpf_tramp_image_alloc(= u64 key, u32 idx) static int bpf_trampoline_update(struct bpf_trampoline *tr) { struct bpf_tramp_image *im; - struct bpf_tramp_progs *tprogs; + struct bpf_tramp_links *tlinks; u32 flags =3D BPF_TRAMP_F_RESTORE_REGS; bool ip_arg =3D false; int err, total; =20 - tprogs =3D bpf_trampoline_get_progs(tr, &total, &ip_arg); - if (IS_ERR(tprogs)) - return PTR_ERR(tprogs); + tlinks =3D bpf_trampoline_get_progs(tr, &total, &ip_arg); + if (IS_ERR(tlinks)) + return PTR_ERR(tlinks); =20 if (total =3D=3D 0) { err =3D unregister_fentry(tr, tr->cur_image->image); @@ -353,15 +353,15 @@ static int bpf_trampoline_update(struct bpf_trampolin= e *tr) goto out; } =20 - if (tprogs[BPF_TRAMP_FEXIT].nr_progs || - tprogs[BPF_TRAMP_MODIFY_RETURN].nr_progs) + if (tlinks[BPF_TRAMP_FEXIT].nr_links || + tlinks[BPF_TRAMP_MODIFY_RETURN].nr_links) flags =3D BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_SKIP_FRAME; =20 if (ip_arg) flags |=3D BPF_TRAMP_F_IP_ARG; =20 err =3D arch_prepare_bpf_trampoline(im, im->image, im->image + PAGE_SIZE, - &tr->func.model, flags, tprogs, + &tr->func.model, flags, tlinks, tr->func.addr); if (err < 0) goto out; @@ -381,7 +381,7 @@ static int bpf_trampoline_update(struct bpf_trampoline = *tr) tr->cur_image =3D im; tr->selector++; out: - kfree(tprogs); + kfree(tlinks); return err; } =20 @@ -407,13 +407,14 @@ static enum bpf_tramp_prog_type bpf_attach_type_to_tr= amp(struct bpf_prog *prog) } } =20 -int bpf_trampoline_link_prog(struct bpf_prog *prog, struct bpf_trampoline = *tr) +int bpf_trampoline_link_prog(struct bpf_tramp_link *link, struct bpf_tramp= oline *tr) { enum bpf_tramp_prog_type kind; + struct bpf_tramp_link *link_exiting; int err =3D 0; int cnt =3D 0, i; =20 - kind =3D bpf_attach_type_to_tramp(prog); + kind =3D bpf_attach_type_to_tramp(link->link.prog); mutex_lock(&tr->mutex); if (tr->extension_prog) { /* cannot attach fentry/fexit if extension prog is attached. @@ -432,25 +433,33 @@ int bpf_trampoline_link_prog(struct bpf_prog *prog, s= truct bpf_trampoline *tr) err =3D -EBUSY; goto out; } - tr->extension_prog =3D prog; + tr->extension_prog =3D link->link.prog; err =3D bpf_arch_text_poke(tr->func.addr, BPF_MOD_JUMP, NULL, - prog->bpf_func); + link->link.prog->bpf_func); goto out; } - if (cnt >=3D BPF_MAX_TRAMP_PROGS) { + if (cnt >=3D BPF_MAX_TRAMP_LINKS) { err =3D -E2BIG; goto out; } - if (!hlist_unhashed(&prog->aux->tramp_hlist)) { + if (!hlist_unhashed(&link->tramp_hlist)) { /* prog already linked */ err =3D -EBUSY; goto out; } - hlist_add_head(&prog->aux->tramp_hlist, &tr->progs_hlist[kind]); + hlist_for_each_entry(link_exiting, &tr->progs_hlist[kind], tramp_hlist) { + if (link_exiting->link.prog !=3D link->link.prog) + continue; + /* prog already linked */ + err =3D -EBUSY; + goto out; + } + + hlist_add_head(&link->tramp_hlist, &tr->progs_hlist[kind]); tr->progs_cnt[kind]++; err =3D bpf_trampoline_update(tr); if (err) { - hlist_del_init(&prog->aux->tramp_hlist); + hlist_del_init(&link->tramp_hlist); tr->progs_cnt[kind]--; } out: @@ -459,12 +468,12 @@ int bpf_trampoline_link_prog(struct bpf_prog *prog, s= truct bpf_trampoline *tr) } =20 /* bpf_trampoline_unlink_prog() should never fail. */ -int bpf_trampoline_unlink_prog(struct bpf_prog *prog, struct bpf_trampolin= e *tr) +int bpf_trampoline_unlink_prog(struct bpf_tramp_link *link, struct bpf_tra= mpoline *tr) { enum bpf_tramp_prog_type kind; int err; =20 - kind =3D bpf_attach_type_to_tramp(prog); + kind =3D bpf_attach_type_to_tramp(link->link.prog); mutex_lock(&tr->mutex); if (kind =3D=3D BPF_TRAMP_REPLACE) { WARN_ON_ONCE(!tr->extension_prog); @@ -473,7 +482,7 @@ int bpf_trampoline_unlink_prog(struct bpf_prog *prog, s= truct bpf_trampoline *tr) tr->extension_prog =3D NULL; goto out; } - hlist_del_init(&prog->aux->tramp_hlist); + hlist_del_init(&link->tramp_hlist); tr->progs_cnt[kind]--; err =3D bpf_trampoline_update(tr); out: @@ -641,7 +650,7 @@ void notrace __bpf_tramp_exit(struct bpf_tramp_image *t= r) int __weak arch_prepare_bpf_trampoline(struct bpf_tramp_image *tr, void *image, void = *image_end, const struct btf_func_model *m, u32 flags, - struct bpf_tramp_progs *tprogs, + struct bpf_tramp_links *tlinks, void *orig_call) { return -ENOTSUPP; diff --git a/net/bpf/bpf_dummy_struct_ops.c b/net/bpf/bpf_dummy_struct_ops.c index d0e54e30658a..e78dadfc5829 100644 --- a/net/bpf/bpf_dummy_struct_ops.c +++ b/net/bpf/bpf_dummy_struct_ops.c @@ -72,13 +72,16 @@ static int dummy_ops_call_op(void *image, struct bpf_du= mmy_ops_test_args *args) args->args[3], args->args[4]); } =20 +extern const struct bpf_link_ops bpf_struct_ops_link_lops; + int bpf_struct_ops_test_run(struct bpf_prog *prog, const union bpf_attr *k= attr, union bpf_attr __user *uattr) { const struct bpf_struct_ops *st_ops =3D &bpf_bpf_dummy_ops; const struct btf_type *func_proto; struct bpf_dummy_ops_test_args *args; - struct bpf_tramp_progs *tprogs; + struct bpf_tramp_links *tlinks; + struct bpf_tramp_link *link =3D NULL; void *image =3D NULL; unsigned int op_idx; int prog_ret; @@ -92,8 +95,8 @@ int bpf_struct_ops_test_run(struct bpf_prog *prog, const = union bpf_attr *kattr, if (IS_ERR(args)) return PTR_ERR(args); =20 - tprogs =3D kcalloc(BPF_TRAMP_MAX, sizeof(*tprogs), GFP_KERNEL); - if (!tprogs) { + tlinks =3D kcalloc(BPF_TRAMP_MAX, sizeof(*tlinks), GFP_KERNEL); + if (!tlinks) { err =3D -ENOMEM; goto out; } @@ -105,8 +108,17 @@ int bpf_struct_ops_test_run(struct bpf_prog *prog, con= st union bpf_attr *kattr, } set_vm_flush_reset_perms(image); =20 + link =3D kzalloc(sizeof(*link), GFP_USER); + if (!link) { + err =3D -ENOMEM; + goto out; + } + /* prog doesn't take the ownership of the reference from caller */ + bpf_prog_inc(prog); + bpf_link_init(&link->link, BPF_LINK_TYPE_STRUCT_OPS, &bpf_struct_ops_link= _lops, prog); + op_idx =3D prog->expected_attach_type; - err =3D bpf_struct_ops_prepare_trampoline(tprogs, prog, + err =3D bpf_struct_ops_prepare_trampoline(tlinks, link, &st_ops->func_models[op_idx], image, image + PAGE_SIZE); if (err < 0) @@ -124,7 +136,9 @@ int bpf_struct_ops_test_run(struct bpf_prog *prog, cons= t union bpf_attr *kattr, out: kfree(args); bpf_jit_free_exec(image); - kfree(tprogs); + if (link) + bpf_link_put(&link->link); + kfree(tlinks); return err; } =20 diff --git a/tools/bpf/bpftool/link.c b/tools/bpf/bpftool/link.c index 8fb0116f9136..6353a789322b 100644 --- a/tools/bpf/bpftool/link.c +++ b/tools/bpf/bpftool/link.c @@ -23,6 +23,7 @@ static const char * const link_type_name[] =3D { [BPF_LINK_TYPE_XDP] =3D "xdp", [BPF_LINK_TYPE_PERF_EVENT] =3D "perf_event", [BPF_LINK_TYPE_KPROBE_MULTI] =3D "kprobe_multi", + [BPF_LINK_TYPE_STRUCT_OPS] =3D "struct_ops", }; =20 static struct hashmap *link_table; diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index d14b10b85e51..a4f557338af7 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -1013,6 +1013,7 @@ enum bpf_link_type { BPF_LINK_TYPE_XDP =3D 6, BPF_LINK_TYPE_PERF_EVENT =3D 7, BPF_LINK_TYPE_KPROBE_MULTI =3D 8, + BPF_LINK_TYPE_STRUCT_OPS =3D 9, =20 MAX_BPF_LINK_TYPE, }; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6945EC00140 for ; Mon, 15 Aug 2022 21:15:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233387AbiHOVP1 (ORCPT ); Mon, 15 Aug 2022 17:15:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347994AbiHOVHy (ORCPT ); Mon, 15 Aug 2022 17:07:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45BA62E681; Mon, 15 Aug 2022 12:17:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D6D916009B; Mon, 15 Aug 2022 19:17:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFF7CC433D6; Mon, 15 Aug 2022 19:17:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591049; bh=fNf3lYZ3JXkcpaPS13aW1IHh+HAR/gsUqnLFHXNzqIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dsYmP9qZ30Y+vXmrFaa0rijYfoDFkIwMrykdWafwixhu77pjjMh6zOCcYtswR7vX7 zmoxpW1FlWCrX6qKw5/bBQzgIu+Tr493ZiHtoQ88CIfHm4THAt4ycd6MlV1CTbAv9c wNrX1qNMUsDizOYiL8ti3vzB5lkyg8N3Kb90Z8Kk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tony Ambardar , Jakub Sitnicki , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.18 0455/1095] bpf, x64: Add predicate for bpf2bpf with tailcalls support in JIT Date: Mon, 15 Aug 2022 19:57:34 +0200 Message-Id: <20220815180448.447796708@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tony Ambardar [ Upstream commit 95acd8817e66d031d2e6ee7def3f1e1874819317 ] The BPF core/verifier is hard-coded to permit mixing bpf2bpf and tail calls for only x86-64. Change the logic to instead rely on a new weak function 'bool bpf_jit_supports_subprog_tailcalls(void)', which a capable JIT backend can override. Update the x86-64 eBPF JIT to reflect this. Signed-off-by: Tony Ambardar [jakub: drop MIPS bits and tweak patch subject] Signed-off-by: Jakub Sitnicki Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20220617105735.733938-2-jakub@cloudflare.= com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/net/bpf_jit_comp.c | 6 ++++++ include/linux/filter.h | 1 + kernel/bpf/core.c | 6 ++++++ kernel/bpf/verifier.c | 3 ++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index 9ec96d5a8239..124456bb23b9 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c @@ -2477,3 +2477,9 @@ void *bpf_arch_text_copy(void *dst, void *src, size_t= len) return ERR_PTR(-EINVAL); return dst; } + +/* Indicate the JIT backend supports mixing bpf2bpf and tailcalls. */ +bool bpf_jit_supports_subprog_tailcalls(void) +{ + return true; +} diff --git a/include/linux/filter.h b/include/linux/filter.h index ed0c0ff42ad5..d9a0db845b50 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -948,6 +948,7 @@ u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64= r5); struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog); void bpf_jit_compile(struct bpf_prog *prog); bool bpf_jit_needs_zext(void); +bool bpf_jit_supports_subprog_tailcalls(void); bool bpf_jit_supports_kfunc_call(void); bool bpf_helper_changes_pkt_data(void *func); =20 diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 3adff3831c04..7a1ce697689b 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -2712,6 +2712,12 @@ bool __weak bpf_jit_needs_zext(void) return false; } =20 +/* Return TRUE if the JIT backend supports mixing bpf2bpf and tailcalls. */ +bool __weak bpf_jit_supports_subprog_tailcalls(void) +{ + return false; +} + bool __weak bpf_jit_supports_kfunc_call(void) { return false; diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index d04147a5efa5..a6d3a8972355 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -5696,7 +5696,8 @@ static bool may_update_sockmap(struct bpf_verifier_en= v *env, int func_id) =20 static bool allow_tail_call_in_subprogs(struct bpf_verifier_env *env) { - return env->prog->jit_requested && IS_ENABLED(CONFIG_X86_64); + return env->prog->jit_requested && + bpf_jit_supports_subprog_tailcalls(); } =20 static int check_map_func_compatibility(struct bpf_verifier_env *env, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA50FC25B08 for ; Mon, 15 Aug 2022 21:18:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243707AbiHOVP4 (ORCPT ); Mon, 15 Aug 2022 17:15:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348002AbiHOVHy (ORCPT ); Mon, 15 Aug 2022 17:07:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 585453C15C; Mon, 15 Aug 2022 12:17:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 033CDB8107A; Mon, 15 Aug 2022 19:17:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0809C433D6; Mon, 15 Aug 2022 19:17:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591052; bh=AQDYzwGiehn4kY3j/Lg/+TToLWwVHNYXnACyJZVJfNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pLK/p0iozPXxAbCEKzBWjrrrAkXt4YkA9Pex9dPQfVQAtr6HVwh77dJxEr5t/g+Aq iZB5zsizFi58Z8+roQ1tistjPToipUSKGkYP96lebgR/GPiOU+XETcpIqw2Cevw8OO rZf8ELPmA7sYrOoXH+z5H52eA605hS/v2TmOZ1Wo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+2f649ec6d2eea1495a8f@syzkaller.appspotmail.com, syzbot+87f65c75f4a72db05445@syzkaller.appspotmail.com, Song Liu , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.18 0456/1095] bpf, x86: fix freeing of not-finalized bpf_prog_pack Date: Mon, 15 Aug 2022 19:57:35 +0200 Message-Id: <20220815180448.478426047@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Song Liu [ Upstream commit 1d5f82d9dd477d5c66e0214a68c3e4f308eadd6d ] syzbot reported a few issues with bpf_prog_pack [1], [2]. This only happens with multiple subprogs. In jit_subprogs(), we first call bpf_int_jit_compil= e() on each sub program. And then, we call it on each sub program again. jit_da= ta is not freed in the first call of bpf_int_jit_compile(). Similarly we don't call bpf_jit_binary_pack_finalize() in the first call of bpf_int_jit_compil= e(). If bpf_int_jit_compile() failed for one sub program, we will call bpf_jit_binary_pack_finalize() for this sub program. However, we don't have= a chance to call it for other sub programs. Then we will hit "goto out_free" = in jit_subprogs(), and call bpf_jit_free on some subprograms that haven't got bpf_jit_binary_pack_finalize() yet. At this point, bpf_jit_binary_pack_free() is called and the whole 2MB page = is freed erroneously. Fix this with a custom bpf_jit_free() for x86_64, which calls bpf_jit_binary_pack_finalize() if necessary. Also, with custom bpf_jit_free(), bpf_prog_aux->use_bpf_prog_pack is not needed any more, remove it. Fixes: 1022a5498f6f ("bpf, x86_64: Use bpf_jit_binary_pack_alloc") [1] https://syzkaller.appspot.com/bug?extid=3D2f649ec6d2eea1495a8f [2] https://syzkaller.appspot.com/bug?extid=3D87f65c75f4a72db05445 Reported-by: syzbot+2f649ec6d2eea1495a8f@syzkaller.appspotmail.com Reported-by: syzbot+87f65c75f4a72db05445@syzkaller.appspotmail.com Signed-off-by: Song Liu Link: https://lore.kernel.org/r/20220706002612.4013790-1-song@kernel.org Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/net/bpf_jit_comp.c | 25 +++++++++++++++++++++++++ include/linux/bpf.h | 1 - include/linux/filter.h | 8 ++++++++ kernel/bpf/core.c | 29 ++++++++++++----------------- 4 files changed, 45 insertions(+), 18 deletions(-) diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index 124456bb23b9..400117f630b8 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c @@ -2483,3 +2483,28 @@ bool bpf_jit_supports_subprog_tailcalls(void) { return true; } + +void bpf_jit_free(struct bpf_prog *prog) +{ + if (prog->jited) { + struct x64_jit_data *jit_data =3D prog->aux->jit_data; + struct bpf_binary_header *hdr; + + /* + * If we fail the final pass of JIT (from jit_subprogs), + * the program may not be finalized yet. Call finalize here + * before freeing it. + */ + if (jit_data) { + bpf_jit_binary_pack_finalize(prog, jit_data->header, + jit_data->rw_header); + kvfree(jit_data->addrs); + kfree(jit_data); + } + hdr =3D bpf_jit_binary_pack_hdr(prog); + bpf_jit_binary_pack_free(hdr, NULL); + WARN_ON_ONCE(!bpf_prog_kallsyms_verify_off(prog)); + } + + bpf_prog_unlock_free(prog); +} diff --git a/include/linux/bpf.h b/include/linux/bpf.h index b5d19a6f7d24..492e114b4e32 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -960,7 +960,6 @@ struct bpf_prog_aux { bool sleepable; bool tail_call_reachable; bool xdp_has_frags; - bool use_bpf_prog_pack; /* BTF_KIND_FUNC_PROTO for valid attach_btf_id */ const struct btf_type *attach_func_proto; /* function name for valid attach_btf_id */ diff --git a/include/linux/filter.h b/include/linux/filter.h index d9a0db845b50..8fd2e2f58eeb 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -1061,6 +1061,14 @@ u64 bpf_jit_alloc_exec_limit(void); void *bpf_jit_alloc_exec(unsigned long size); void bpf_jit_free_exec(void *addr); void bpf_jit_free(struct bpf_prog *fp); +struct bpf_binary_header * +bpf_jit_binary_pack_hdr(const struct bpf_prog *fp); + +static inline bool bpf_prog_kallsyms_verify_off(const struct bpf_prog *fp) +{ + return list_empty(&fp->aux->ksym.lnode) || + fp->aux->ksym.lnode.prev =3D=3D LIST_POISON2; +} =20 struct bpf_binary_header * bpf_jit_binary_pack_alloc(unsigned int proglen, u8 **ro_image, diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 7a1ce697689b..483bee45ead5 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -649,12 +649,6 @@ static bool bpf_prog_kallsyms_candidate(const struct b= pf_prog *fp) return fp->jited && !bpf_prog_was_classic(fp); } =20 -static bool bpf_prog_kallsyms_verify_off(const struct bpf_prog *fp) -{ - return list_empty(&fp->aux->ksym.lnode) || - fp->aux->ksym.lnode.prev =3D=3D LIST_POISON2; -} - void bpf_prog_kallsyms_add(struct bpf_prog *fp) { if (!bpf_prog_kallsyms_candidate(fp) || @@ -1149,7 +1143,6 @@ int bpf_jit_binary_pack_finalize(struct bpf_prog *pro= g, bpf_prog_pack_free(ro_header); return PTR_ERR(ptr); } - prog->aux->use_bpf_prog_pack =3D true; return 0; } =20 @@ -1173,17 +1166,23 @@ void bpf_jit_binary_pack_free(struct bpf_binary_hea= der *ro_header, bpf_jit_uncharge_modmem(size); } =20 +struct bpf_binary_header * +bpf_jit_binary_pack_hdr(const struct bpf_prog *fp) +{ + unsigned long real_start =3D (unsigned long)fp->bpf_func; + unsigned long addr; + + addr =3D real_start & BPF_PROG_CHUNK_MASK; + return (void *)addr; +} + static inline struct bpf_binary_header * bpf_jit_binary_hdr(const struct bpf_prog *fp) { unsigned long real_start =3D (unsigned long)fp->bpf_func; unsigned long addr; =20 - if (fp->aux->use_bpf_prog_pack) - addr =3D real_start & BPF_PROG_CHUNK_MASK; - else - addr =3D real_start & PAGE_MASK; - + addr =3D real_start & PAGE_MASK; return (void *)addr; } =20 @@ -1196,11 +1195,7 @@ void __weak bpf_jit_free(struct bpf_prog *fp) if (fp->jited) { struct bpf_binary_header *hdr =3D bpf_jit_binary_hdr(fp); =20 - if (fp->aux->use_bpf_prog_pack) - bpf_jit_binary_pack_free(hdr, NULL /* rw_buffer */); - else - bpf_jit_binary_free(hdr); - + bpf_jit_binary_free(hdr); WARN_ON_ONCE(!bpf_prog_kallsyms_verify_off(fp)); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C99ECC3F6B0 for ; Mon, 15 Aug 2022 21:18:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243870AbiHOVQH (ORCPT ); Mon, 15 Aug 2022 17:16:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348003AbiHOVHz (ORCPT ); Mon, 15 Aug 2022 17:07:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B378A3C167; Mon, 15 Aug 2022 12:17:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4FD4260F68; Mon, 15 Aug 2022 19:17:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3ECCCC433C1; Mon, 15 Aug 2022 19:17:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591055; bh=Oc76SXNrcZOr5dQFk+mWwofFizMrLxKgl+KdoZ72n10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E4SlKUwMm5cWZaT5S4L+Trugsk3h3KfzffIwiHcbronnvgejMuYfDCvPck2+VlVnW mV71yCb+VtN2ZAfDUpBu85Ed81Au4kpE8t+ajjFTxVxWILvZhMoQhCh64sRuAvfnEJ hcH10ZLgcxUssf1yv3X6clXgvpY8/gyj8O8Gs1Tw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yonglong Li , Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0457/1095] tcp: make retransmitted SKB fit into the send window Date: Mon, 15 Aug 2022 19:57:36 +0200 Message-Id: <20220815180448.512718191@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yonglong Li [ Upstream commit 536a6c8e05f95e3d1118c40ae8b3022ee2d05d52 ] current code of __tcp_retransmit_skb only check TCP_SKB_CB(skb)->seq in send window, and TCP_SKB_CB(skb)->seq_end maybe out of send window. If receiver has shrunk his window, and skb is out of new window, it should retransmit a smaller portion of the payload. test packetdrill script: 0 socket(..., SOCK_STREAM, IPPROTO_TCP) =3D 3 +0 fcntl(3, F_GETFL) =3D 0x2 (flags O_RDWR) +0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) =3D 0 +0 connect(3, ..., ...) =3D -1 EINPROGRESS (Operation now in progress) +0 > S 0:0(0) win 65535 +.05 < S. 0:0(0) ack 1 win 6000 +0 > . 1:1(0) ack 1 +0 write(3, ..., 10000) =3D 10000 +0 > . 1:2001(2000) ack 1 win 65535 +0 > . 2001:4001(2000) ack 1 win 65535 +0 > . 4001:6001(2000) ack 1 win 65535 +.05 < . 1:1(0) ack 4001 win 1001 and tcpdump show: 192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 1:2001, ack 1, win 65535= , length 2000 192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 2001:4001, ack 1, win 65= 535, length 2000 192.168.226.67.55 > 192.0.2.1.8080: Flags [P.], seq 4001:5001, ack 1, win 6= 5535, length 1000 192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 5001:6001, ack 1, win 65= 535, length 1000 192.0.2.1.8080 > 192.168.226.67.55: Flags [.], ack 4001, win 1001, length 0 192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 5001:6001, ack 1, win 65= 535, length 1000 192.168.226.67.55 > 192.0.2.1.8080: Flags [P.], seq 4001:5001, ack 1, win 6= 5535, length 1000 when cient retract window to 1001, send window is [4001,5002], but TLP send 5001-6001 packet which is out of send window. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Yonglong Li Signed-off-by: Eric Dumazet Link: https://lore.kernel.org/r/1657532838-20200-1-git-send-email-liyonglon= g@chinatelecom.cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/ipv4/tcp_output.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index a7f0a1f0c2a3..e90b99fa79bf 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -3140,7 +3140,7 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_b= uff *skb, int segs) struct tcp_sock *tp =3D tcp_sk(sk); unsigned int cur_mss; int diff, len, err; - + int avail_wnd; =20 /* Inconclusive MTU probe */ if (icsk->icsk_mtup.probe_size) @@ -3162,17 +3162,25 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk= _buff *skb, int segs) return -EHOSTUNREACH; /* Routing failure or similar. */ =20 cur_mss =3D tcp_current_mss(sk); + avail_wnd =3D tcp_wnd_end(tp) - TCP_SKB_CB(skb)->seq; =20 /* If receiver has shrunk his window, and skb is out of * new window, do not retransmit it. The exception is the * case, when window is shrunk to zero. In this case - * our retransmit serves as a zero window probe. + * our retransmit of one segment serves as a zero window probe. */ - if (!before(TCP_SKB_CB(skb)->seq, tcp_wnd_end(tp)) && - TCP_SKB_CB(skb)->seq !=3D tp->snd_una) - return -EAGAIN; + if (avail_wnd <=3D 0) { + if (TCP_SKB_CB(skb)->seq !=3D tp->snd_una) + return -EAGAIN; + avail_wnd =3D cur_mss; + } =20 len =3D cur_mss * segs; + if (len > avail_wnd) { + len =3D rounddown(avail_wnd, cur_mss); + if (!len) + len =3D avail_wnd; + } if (skb->len > len) { if (tcp_fragment(sk, TCP_FRAG_IN_RTX_QUEUE, skb, len, cur_mss, GFP_ATOMIC)) @@ -3186,8 +3194,9 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_b= uff *skb, int segs) diff -=3D tcp_skb_pcount(skb); if (diff) tcp_adjust_pcount(sk, skb, diff); - if (skb->len < cur_mss) - tcp_retrans_try_collapse(sk, skb, cur_mss); + avail_wnd =3D min_t(int, avail_wnd, cur_mss); + if (skb->len < avail_wnd) + tcp_retrans_try_collapse(sk, skb, avail_wnd); } =20 /* RFC3168, section 6.1.1.1. ECN fallback */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AACD9C25B0E for ; Mon, 15 Aug 2022 21:18:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243548AbiHOVPt (ORCPT ); Mon, 15 Aug 2022 17:15:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348007AbiHOVH4 (ORCPT ); Mon, 15 Aug 2022 17:07:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CA1E3C16E; Mon, 15 Aug 2022 12:17:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5AAD4B81109; Mon, 15 Aug 2022 19:17:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82C07C433C1; Mon, 15 Aug 2022 19:17:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591059; bh=6yHQWsJK6FndKB55IeRJzI/BbMbACLOwRSgfytfxKLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=btmFoF4S939Epcl1AymoW1AawIwtiP/7ttaJlF8zTQuOFLDhkvFbpPoDCL0BgZr73 TGs4Rk4MhXYWFSK4Dmrpo/P4ZeDD1weVN8W4VUcfboLbrhzk3ZfOY60P1kqRzsMT7x lRs/M434NjTevVQIQfuwNARjVAC6pRpqJUTTxbl8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anquan Wu , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.18 0458/1095] libbpf: Fix the name of a reused map Date: Mon, 15 Aug 2022 19:57:37 +0200 Message-Id: <20220815180448.543475078@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anquan Wu [ Upstream commit bf3f00378524adae16628cbadbd11ba7211863bb ] BPF map name is limited to BPF_OBJ_NAME_LEN. A map name is defined as being longer than BPF_OBJ_NAME_LEN, it will be truncated to BPF_OBJ_NAME_LEN when a userspace program calls libbpf to create the map. A pinned map also generates a path in the /sys. If the previous program wanted to reuse the map=EF=BC=8C it can not get bpf_map by name, because the name of the map is only partially the same as the name which get from pinned path. The syscall information below show that map name "process_pinned_map" is truncated to "process_pinned_". bpf(BPF_OBJ_GET, {pathname=3D"/sys/fs/bpf/process_pinned_map", bpf_fd=3D0, file_flags=3D0}, 144) =3D -1 ENOENT (No such file or direct= ory) bpf(BPF_MAP_CREATE, {map_type=3DBPF_MAP_TYPE_HASH, key_size=3D4, value_size=3D4,max_entries=3D1024, map_flags=3D0, inner_map_fd=3D0, map_name=3D"process_pinned_",map_ifindex=3D0, btf_fd=3D3, btf_key_type_= id=3D6, btf_value_type_id=3D10,btf_vmlinux_value_type_id=3D0}, 72) =3D 4 This patch check that if the name of pinned map are the same as the actual name for the first (BPF_OBJ_NAME_LEN - 1), bpf map still uses the name which is included in bpf object. Fixes: 26736eb9a483 ("tools: libbpf: allow map reuse") Signed-off-by: Anquan Wu Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/OSZP286MB1725CEA1C95C5CB8E7CCC53FB8869@OS= ZP286MB1725.JPNP286.PROD.OUTLOOK.COM Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/lib/bpf/libbpf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 881ea905ca81..2323d3e38a8e 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -4271,7 +4271,7 @@ static int bpf_get_map_info_from_fdinfo(int fd, struc= t bpf_map_info *info) int bpf_map__reuse_fd(struct bpf_map *map, int fd) { struct bpf_map_info info =3D {}; - __u32 len =3D sizeof(info); + __u32 len =3D sizeof(info), name_len; int new_fd, err; char *new_name; =20 @@ -4281,7 +4281,12 @@ int bpf_map__reuse_fd(struct bpf_map *map, int fd) if (err) return libbpf_err(err); =20 - new_name =3D strdup(info.name); + name_len =3D strlen(info.name); + if (name_len =3D=3D BPF_OBJ_NAME_LEN - 1 && strncmp(map->name, info.name,= name_len) =3D=3D 0) + new_name =3D strdup(map->name); + else + new_name =3D strdup(info.name); + if (!new_name) return libbpf_err(-errno); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D99FC2BB43 for ; Mon, 15 Aug 2022 21:18:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244498AbiHOVQ3 (ORCPT ); Mon, 15 Aug 2022 17:16:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348014AbiHOVH4 (ORCPT ); Mon, 15 Aug 2022 17:07:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4CAC2DABE; Mon, 15 Aug 2022 12:17:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A48C7B8107A; Mon, 15 Aug 2022 19:17:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA626C433D6; Mon, 15 Aug 2022 19:17:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591065; bh=4Ad6WHw+VEo7Yt24zjkg9al8JR/d0E217Ezuc9hpe3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Amv5AsxWYHSfZ87qjf5Zz6+mUd+BWMF4HikuKyt9IgpFGS3/Mo6h7v9nFFYJgeKJ6 pl7H+WdFpChSQqNL9BDdtcVkH7O81Du93YEWCrQbgHfMSSc8fZlGO28XjhQVhxlspH 6J+294X4cDmLRtf/2wZTYBE2LQbvNl3MLKrXqnDc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , kernel test robot , Dan Carpenter , Daniel Latypov , Brendan Higgins , David Gow , Shuah Khan , Sasha Levin Subject: [PATCH 5.18 0459/1095] kunit: executor: Fix a memory leak on failure in kunit_filter_tests Date: Mon, 15 Aug 2022 19:57:38 +0200 Message-Id: <20220815180448.591050196@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Gow [ Upstream commit 94681e289bf5d10c9db9db143d1a22d8717205c5 ] It's possible that memory allocation for 'filtered' will fail, but for the copy of the suite to succeed. In this case, the copy could be leaked. Properly free 'copy' in the error case for the allocation of 'filtered' failing. Note that there may also have been a similar issue in kunit_filter_subsuites, before it was removed in "kunit: flatten kunit_suite*** to kunit_suite** in .kunit_test_suites". This was reported by clang-analyzer via the kernel test robot, here: https://lore.kernel.org/all/c8073b8e-7b9e-0830-4177-87c12f16349c@intel.com/ And by smatch via Dan Carpenter and the kernel test robot: https://lore.kernel.org/all/202207101328.ASjx88yj-lkp@intel.com/ Fixes: a02353f49162 ("kunit: bail out of test filtering logic quicker if OO= M") Reported-by: kernel test robot Reported-by: kernel test robot Reported-by: Dan Carpenter Reviewed-by: Daniel Latypov Reviewed-by: Brendan Higgins Signed-off-by: David Gow Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- lib/kunit/executor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c index 96f96e42ce06..16fb88c0aca3 100644 --- a/lib/kunit/executor.c +++ b/lib/kunit/executor.c @@ -76,8 +76,10 @@ kunit_filter_tests(struct kunit_suite *const suite, cons= t char *test_glob) memcpy(copy, suite, sizeof(*copy)); =20 filtered =3D kcalloc(n + 1, sizeof(*filtered), GFP_KERNEL); - if (!filtered) + if (!filtered) { + kfree(copy); return ERR_PTR(-ENOMEM); + } =20 n =3D 0; kunit_suite_for_each_test_case(suite, test_case) { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 099E1C28B2C for ; Mon, 15 Aug 2022 21:18:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244178AbiHOVQT (ORCPT ); Mon, 15 Aug 2022 17:16:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348017AbiHOVH4 (ORCPT ); Mon, 15 Aug 2022 17:07:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 444042E68D; Mon, 15 Aug 2022 12:17:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D6E6A60EF0; Mon, 15 Aug 2022 19:17:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4146C433C1; Mon, 15 Aug 2022 19:17:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591068; bh=791j+2hWy8TOd/D1gDSC01GR07M5nk56qoSUdhg5FAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JXVzWNL9Z1DSyVDeQQTbVrCCsjYzHu1TeBW69fZhrDoePkwbnlWNjEyl3TuuDZrvI SBgWzB+bcPyrEXh8Ypkhr6Bdk9ezud6uJAD5kp21v5AUXQt+vOyZhERH7bhtxU0rmn D9ph9cyAqBcpiErmA72GVGJOpCXK2UfN6z14MH/4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfram Sang , John Stultz , Shuah Khan , Sasha Levin Subject: [PATCH 5.18 0460/1095] selftests: timers: valid-adjtimex: build fix for newer toolchains Date: Mon, 15 Aug 2022 19:57:39 +0200 Message-Id: <20220815180448.625934164@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wolfram Sang [ Upstream commit 9a162977d20436be5678a8e21a8e58eb4616d86a ] Toolchains with an include file 'sys/timex.h' based on 3.18 will have a 'clock_adjtime' definition added, so it can't be static in the code: valid-adjtimex.c:43:12: error: static declaration of =E2=80=98clock_adjtime= =E2=80=99 follows non-static declaration Fixes: e03a58c320e1 ("kselftests: timers: Add adjtimex SETOFFSET validity t= ests") Signed-off-by: Wolfram Sang Acked-by: John Stultz Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/testing/selftests/timers/valid-adjtimex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/timers/valid-adjtimex.c b/tools/testin= g/selftests/timers/valid-adjtimex.c index 5397de708d3c..48b9a803235a 100644 --- a/tools/testing/selftests/timers/valid-adjtimex.c +++ b/tools/testing/selftests/timers/valid-adjtimex.c @@ -40,7 +40,7 @@ #define ADJ_SETOFFSET 0x0100 =20 #include -static int clock_adjtime(clockid_t id, struct timex *tx) +int clock_adjtime(clockid_t id, struct timex *tx) { return syscall(__NR_clock_adjtime, id, tx); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCBDAC282E7 for ; Mon, 15 Aug 2022 21:18:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244030AbiHOVQL (ORCPT ); Mon, 15 Aug 2022 17:16:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348022AbiHOVH4 (ORCPT ); Mon, 15 Aug 2022 17:07:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71722371A1; Mon, 15 Aug 2022 12:17:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 02B8E60EF0; Mon, 15 Aug 2022 19:17:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1C31C433D6; Mon, 15 Aug 2022 19:17:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591071; bh=wuOSQasS4O7g9t9kdiLWCgRp6fK3GbiBlpL7zqz9SuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cmSdyviezgaVPQu/OAadFy3pCkrSouCdpIHRAmdF2taW/uPtisTpfj4K2Ji1yw0jE TyuvgsDmmR7ksstz1+6XpqsqeTKVSYXnwnFbBsQSj4zQh3qrN0Hj5L426Rm9kES/hm 7wfE/+xVCwxOcBl24oJhMHKOEJ+MxJlWCoXiE6U0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfram Sang , John Stultz , Shuah Khan , Sasha Levin Subject: [PATCH 5.18 0461/1095] selftests: timers: clocksource-switch: fix passing errors from child Date: Mon, 15 Aug 2022 19:57:40 +0200 Message-Id: <20220815180448.675806950@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wolfram Sang [ Upstream commit 4d8f52ac5fa9eede7b7aa2f2d67c841d9eeb655f ] The return value from system() is a waitpid-style integer. Do not return it directly because with the implicit masking in exit() it will always return 0. Access it with appropriate macros to really pass on errors. Fixes: 7290ce1423c3 ("selftests/timers: Add clocksource-switch test from ti= metest suite") Signed-off-by: Wolfram Sang Acked-by: John Stultz Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/testing/selftests/timers/clocksource-switch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/timers/clocksource-switch.c b/tools/te= sting/selftests/timers/clocksource-switch.c index ef8eb3604595..b57f0a9be490 100644 --- a/tools/testing/selftests/timers/clocksource-switch.c +++ b/tools/testing/selftests/timers/clocksource-switch.c @@ -110,10 +110,10 @@ int run_tests(int secs) =20 sprintf(buf, "./inconsistency-check -t %i", secs); ret =3D system(buf); - if (ret) - return ret; + if (WIFEXITED(ret) && WEXITSTATUS(ret)) + return WEXITSTATUS(ret); ret =3D system("./nanosleep"); - return ret; + return WIFEXITED(ret) ? WEXITSTATUS(ret) : 0; } =20 =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B36EBC32765 for ; Mon, 15 Aug 2022 21:22:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344441AbiHOVVe (ORCPT ); Mon, 15 Aug 2022 17:21:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243392AbiHOVP0 (ORCPT ); Mon, 15 Aug 2022 17:15:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BB2CDD751; Mon, 15 Aug 2022 12:20:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D7A8461029; Mon, 15 Aug 2022 19:20:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2FAFC4314B; Mon, 15 Aug 2022 19:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591202; bh=o4hOL74n7dGYA/eSRE1bc2Cbf2Nn5U/BWYjK5vaLMuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CaIHGDwl5B9n4iXGf2KZz3+wNBx0/SqIvSBQwOuMfhUuToqsTZ+VuqSFdseDLfaqv aohbOmS2IlosvOmkTwEyCUJMfdGQl/QXsyFQppKgLaqd5wSFPyn8+gXH1VILBpIi2+ 2wWLMPOuN75nLcuCuEn1gk834F4+I0fUYpEgeA68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tejun Heo , Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Yonghong Song , Sasha Levin Subject: [PATCH 5.18 0462/1095] bpf: Fix subprog names in stack traces. Date: Mon, 15 Aug 2022 19:57:41 +0200 Message-Id: <20220815180448.720612194@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexei Starovoitov [ Upstream commit 9c7c48d6a1e2eb5192ad5294c1c4dbd42a88e88b ] The commit 7337224fc150 ("bpf: Improve the info.func_info and info.func_inf= o_rec_size behavior") accidently made bpf_prog_ksym_set_name() conservative for bpf subprograms. Fixed it so instead of "bpf_prog_tag_F" the stack traces print "bpf_prog_ta= g_full_subprog_name". Fixes: 7337224fc150 ("bpf: Improve the info.func_info and info.func_info_re= c_size behavior") Reported-by: Tejun Heo Signed-off-by: Alexei Starovoitov Signed-off-by: Andrii Nakryiko Acked-by: Martin KaFai Lau Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20220714211637.17150-1-alexei.starovoitov= @gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/bpf/verifier.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index a6d3a8972355..f29aa357826c 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -13016,6 +13016,7 @@ static int jit_subprogs(struct bpf_verifier_env *en= v) /* Below members will be freed only at prog->aux */ func[i]->aux->btf =3D prog->aux->btf; func[i]->aux->func_info =3D prog->aux->func_info; + func[i]->aux->func_info_cnt =3D prog->aux->func_info_cnt; func[i]->aux->poke_tab =3D prog->aux->poke_tab; func[i]->aux->size_poke_tab =3D prog->aux->size_poke_tab; =20 @@ -13028,9 +13029,6 @@ static int jit_subprogs(struct bpf_verifier_env *en= v) poke->aux =3D func[i]->aux; } =20 - /* Use bpf_prog_F_tag to indicate functions in stack traces. - * Long term would need debug info to populate names - */ func[i]->aux->name[0] =3D 'F'; func[i]->aux->stack_depth =3D env->subprog_info[i].stack_depth; func[i]->jit_requested =3D 1; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 954EEC28B2B for ; Mon, 15 Aug 2022 21:18:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343713AbiHOVRI (ORCPT ); Mon, 15 Aug 2022 17:17:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348071AbiHOVIC (ORCPT ); Mon, 15 Aug 2022 17:08:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 952943CBCA; Mon, 15 Aug 2022 12:18:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BEA0F60BB7; Mon, 15 Aug 2022 19:18:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADF1CC433C1; Mon, 15 Aug 2022 19:18:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591096; bh=X9e1ULn5u8dN/vWtVUa60/Uy8EpTPSSad7gGvaqhSkQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AoHYzkvdxJlvQRGFVqCssMgKZr034tROrt/TQ6MswZ4IcEq2jfVaql5jYBDXcfrBe W88XgJ/jVkUCMlyxHKXN5cYZ0FvnCMZWAxQ8PhLPaoeJ6zOLz5c9ZnNGf/YOCkaSSR j6r2eC16lvM6iClGjCIPsDOF27ZJJA7rGr+wjAFQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jens Axboe , "Jason A. Donenfeld" , Al Viro , Sasha Levin Subject: [PATCH 5.18 0463/1095] fs: check FMODE_LSEEK to control internal pipe splicing Date: Mon, 15 Aug 2022 19:57:42 +0200 Message-Id: <20220815180448.752479071@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld [ Upstream commit 97ef77c52b789ec1411d360ed99dca1efe4b2c81 ] The original direct splicing mechanism from Jens required the input to be a regular file because it was avoiding the special socket case. It also recognized blkdevs as being close enough to a regular file. But it forgot about chardevs, which behave the same way and work fine here. This is an okayish heuristic, but it doesn't totally work. For example, a few chardevs should be spliceable here. And a few regular files shouldn't. This patch fixes this by instead checking whether FMODE_LSEEK is set, which represents decently enough what we need rewinding for when splicing to internal pipes. Fixes: b92ce5589374 ("[PATCH] splice: add direct fd <-> fd splicing support= ") Cc: Jens Axboe Signed-off-by: Jason A. Donenfeld Signed-off-by: Al Viro Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/splice.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index 047b79db8eb5..93a2c9bf6249 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -814,17 +814,15 @@ ssize_t splice_direct_to_actor(struct file *in, struc= t splice_desc *sd, { struct pipe_inode_info *pipe; long ret, bytes; - umode_t i_mode; size_t len; int i, flags, more; =20 /* - * We require the input being a regular file, as we don't want to - * randomly drop data for eg socket -> socket splicing. Use the - * piped splicing for that! + * We require the input to be seekable, as we don't want to randomly + * drop data for eg socket -> socket splicing. Use the piped splicing + * for that! */ - i_mode =3D file_inode(in)->i_mode; - if (unlikely(!S_ISREG(i_mode) && !S_ISBLK(i_mode))) + if (unlikely(!(in->f_mode & FMODE_LSEEK))) return -EINVAL; =20 /* --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C397C2BBC5 for ; Mon, 15 Aug 2022 21:18:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347273AbiHOVSV (ORCPT ); Mon, 15 Aug 2022 17:18:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243713AbiHOVJB (ORCPT ); Mon, 15 Aug 2022 17:09:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65D3054C9F; Mon, 15 Aug 2022 12:18:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6328460FB8; Mon, 15 Aug 2022 19:18:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D638C433C1; Mon, 15 Aug 2022 19:18:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591130; bh=Ggx5eMXhfYasjXBC9zesMgQQm7DndAkFwc/nvYHdF3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eq1Gw+aFoQ+C4P3N9SGis5Tk/SY4bS7TCV2QgPyOvNk0FMOsLj9NpJWZ/yO0hBOG6 3HSXz1TxoifXA/DMv+oGJqJgFOa54qg910ZMheQUeg2i1/vQJ4H/Nf/R5ie2g32U7y 7DNfQmPrVB1qE+XYxaDAeV7IiODpL8vPRzN19U9Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0464/1095] media: cedrus: h265: Fix flag name Date: Mon, 15 Aug 2022 19:57:43 +0200 Message-Id: <20220815180448.790853756@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jernej Skrabec [ Upstream commit 104a70e1d0bcef28db13c4192b8729086089651c ] Bit 21 in register 0x24 (slice header info 1) actually represents negated version of low delay flag. This can be seen in vendor Cedar library source code. While this flag is not part of the standard, it can be found in reference HEVC implementation. Fix macro name and change it to flag. Fixes: 86caab29da78 ("media: cedrus: Add HEVC/H.265 decoding support") Signed-off-by: Jernej Skrabec Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 4 +++- drivers/staging/media/sunxi/cedrus/cedrus_regs.h | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/sta= ging/media/sunxi/cedrus/cedrus_h265.c index 44f385be9f6c..2febdf7a97fe 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c @@ -559,7 +559,6 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, =20 reg =3D VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_TC_OFFSET_DIV2(slice_params= ->slice_tc_offset_div2) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_BETA_OFFSET_DIV2(slice_params= ->slice_beta_offset_div2) | - VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_POC_BIGEST_IN_RPS_ST(decode_p= arams->num_poc_st_curr_after =3D=3D 0) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CR_QP_OFFSET(slice_params->sl= ice_cr_qp_offset) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CB_QP_OFFSET(slice_params->sl= ice_cb_qp_offset) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_QP_DELTA(slice_params->slice_= qp_delta); @@ -572,6 +571,9 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED, slice_params->flags); =20 + if (decode_params->num_poc_st_curr_after =3D=3D 0) + reg |=3D VE_DEC_H265_DEC_SLICE_HDR_INFO1_FLAG_SLICE_NOT_LOW_DELAY; + cedrus_write(dev, VE_DEC_H265_DEC_SLICE_HDR_INFO1, reg); =20 chroma_log2_weight_denom =3D pred_weight_table->luma_log2_weight_denom + diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h b/drivers/sta= ging/media/sunxi/cedrus/cedrus_regs.h index bdb062ad8682..d81f7513ade0 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h +++ b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h @@ -377,13 +377,12 @@ =20 #define VE_DEC_H265_DEC_SLICE_HDR_INFO1_FLAG_SLICE_DEBLOCKING_FILTER_DISAB= LED BIT(23) #define VE_DEC_H265_DEC_SLICE_HDR_INFO1_FLAG_SLICE_LOOP_FILTER_ACROSS_SLIC= ES_ENABLED BIT(22) +#define VE_DEC_H265_DEC_SLICE_HDR_INFO1_FLAG_SLICE_NOT_LOW_DELAY BIT(21) =20 #define VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_TC_OFFSET_DIV2(v) \ SHIFT_AND_MASK_BITS(v, 31, 28) #define VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_BETA_OFFSET_DIV2(v) \ SHIFT_AND_MASK_BITS(v, 27, 24) -#define VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_POC_BIGEST_IN_RPS_ST(v) \ - ((v) ? BIT(21) : 0) #define VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CR_QP_OFFSET(v) \ SHIFT_AND_MASK_BITS(v, 20, 16) #define VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CB_QP_OFFSET(v) \ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 282D3C00140 for ; Mon, 15 Aug 2022 21:20:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244248AbiHOVUK (ORCPT ); Mon, 15 Aug 2022 17:20:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344646AbiHOVLp (ORCPT ); Mon, 15 Aug 2022 17:11:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01A4CD9E86; Mon, 15 Aug 2022 12:19:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4BC0BB81122; Mon, 15 Aug 2022 19:19:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3A66C433D7; Mon, 15 Aug 2022 19:19:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591165; bh=WU8kE6p9yJ72bRifA3r1RnbfoV1epnk0R1xMzc53M1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jDj7dwOz08Z12sSHmwbuQ+BREqNVNyiqdnGtFbYu+CliW0ly8a/IgIHyP1/VjwLDx 7Qhmqs+iveLGWY4rekrqanhsm/rmhwLIFBj97ClhAVTjdHCav9cbxG5zGHa7ZaTLQE +bFSZ1V3iY1NYZ1LXuhXSN0UCh8EZAkD9vPh3RMs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Gaignard , Ezequiel Garcia , Nicolas Dufresne , Jernej Skrabec , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0465/1095] media: uapi: HEVC: Change pic_order_cnt definition in v4l2_hevc_dpb_entry Date: Mon, 15 Aug 2022 19:57:44 +0200 Message-Id: <20220815180448.839228146@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Benjamin Gaignard [ Upstream commit c4a179c7167ee16aad1267f9c99bc1ecff475585 ] The HEVC specification describes the following: "PicOrderCntVal is derived as follows: PicOrderCntVal =3D PicOrderCntMsb + slice_pic_order_cnt_lsb The value of PicOrderCntVal shall be in the range of =E2=88=922^31 to 2^31 =E2=88=92 1, inclusive." To match with these definitions change __u16 pic_order_cnt[2] into __s32 pic_order_cnt_val. Change v4l2_ctrl_hevc_slice_params->slice_pic_order_cnt to __s32 too. Signed-off-by: Benjamin Gaignard Reviewed-by: Ezequiel Garcia Acked-by: Nicolas Dufresne Tested-by: Jernej Skrabec Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 2 +- drivers/staging/media/hantro/hantro_g2_hevc_dec.c | 7 +++---- drivers/staging/media/hantro/hantro_hevc.c | 2 +- drivers/staging/media/hantro/hantro_hw.h | 4 ++-- drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 4 ++-- include/media/hevc-ctrls.h | 4 ++-- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Do= cumentation/userspace-api/media/v4l/ext-ctrls-codec.rst index 4cd7c541fc30..bcdc14144105 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -2975,7 +2975,7 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - * - __u8 - ``colour_plane_id`` - - * - __u16 + * - __s32 - ``slice_pic_order_cnt`` - * - __u8 diff --git a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c b/drivers/st= aging/media/hantro/hantro_g2_hevc_dec.c index 5df6f08e26f5..d28653d04d20 100644 --- a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c +++ b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c @@ -390,11 +390,10 @@ static int set_ref(struct hantro_ctx *ctx) !!(pps->flags & V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED)); =20 /* - * Write POC count diff from current pic. For frame decoding only compute - * pic_order_cnt[0] and ignore pic_order_cnt[1] used in field-coding. + * Write POC count diff from current pic. */ for (i =3D 0; i < decode_params->num_active_dpb_entries && i < ARRAY_SIZE= (cur_poc); i++) { - char poc_diff =3D decode_params->pic_order_cnt_val - dpb[i].pic_order_cn= t[0]; + char poc_diff =3D decode_params->pic_order_cnt_val - dpb[i].pic_order_cn= t_val; =20 hantro_reg_write(vpu, &cur_poc[i], poc_diff); } @@ -421,7 +420,7 @@ static int set_ref(struct hantro_ctx *ctx) dpb_longterm_e =3D 0; for (i =3D 0; i < decode_params->num_active_dpb_entries && i < (V4L2_HEVC_DPB_ENTRIES_NUM_MAX - 1); i++) { - luma_addr =3D hantro_hevc_get_ref_buf(ctx, dpb[i].pic_order_cnt[0]); + luma_addr =3D hantro_hevc_get_ref_buf(ctx, dpb[i].pic_order_cnt_val); if (!luma_addr) return -ENOMEM; =20 diff --git a/drivers/staging/media/hantro/hantro_hevc.c b/drivers/staging/m= edia/hantro/hantro_hevc.c index bd924896e409..4f7e2acb46ec 100644 --- a/drivers/staging/media/hantro/hantro_hevc.c +++ b/drivers/staging/media/hantro/hantro_hevc.c @@ -33,7 +33,7 @@ void hantro_hevc_ref_init(struct hantro_ctx *ctx) } =20 dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, - int poc) + s32 poc) { struct hantro_hevc_dec_hw_ctx *hevc_dec =3D &ctx->hevc_dec; int i; diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/med= ia/hantro/hantro_hw.h index b480cf329b13..457eb8bb6dc2 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -143,7 +143,7 @@ struct hantro_hevc_dec_hw_ctx { struct hantro_aux_buf tile_bsd; struct hantro_aux_buf ref_bufs[NUM_REF_PICTURES]; struct hantro_aux_buf scaling_lists; - int ref_bufs_poc[NUM_REF_PICTURES]; + s32 ref_bufs_poc[NUM_REF_PICTURES]; u32 ref_bufs_used; struct hantro_hevc_dec_ctrls ctrls; unsigned int num_tile_cols_allocated; @@ -351,7 +351,7 @@ void hantro_hevc_dec_exit(struct hantro_ctx *ctx); int hantro_g2_hevc_dec_run(struct hantro_ctx *ctx); int hantro_hevc_dec_prepare_run(struct hantro_ctx *ctx); void hantro_hevc_ref_init(struct hantro_ctx *ctx); -dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, int poc); +dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, s32 poc); int hantro_hevc_add_ref_buf(struct hantro_ctx *ctx, int poc, dma_addr_t ad= dr); int hantro_hevc_validate_sps(struct hantro_ctx *ctx, const struct v4l2_ctr= l_hevc_sps *sps); =20 diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/sta= ging/media/sunxi/cedrus/cedrus_h265.c index 2febdf7a97fe..c26e515d64c9 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c @@ -143,8 +143,8 @@ static void cedrus_h265_frame_info_write_dpb(struct ced= rus_ctx *ctx, for (i =3D 0; i < num_active_dpb_entries; i++) { int buffer_index =3D vb2_find_timestamp(vq, dpb[i].timestamp, 0); u32 pic_order_cnt[2] =3D { - dpb[i].pic_order_cnt[0], - dpb[i].pic_order_cnt[1] + dpb[i].pic_order_cnt_val, + dpb[i].pic_order_cnt_val }; =20 cedrus_h265_frame_info_write_single(ctx, i, dpb[i].field_pic, diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h index 01ccda48d8c5..88e804578cb1 100644 --- a/include/media/hevc-ctrls.h +++ b/include/media/hevc-ctrls.h @@ -135,7 +135,7 @@ struct v4l2_hevc_dpb_entry { __u64 timestamp; __u8 flags; __u8 field_pic; - __u16 pic_order_cnt[2]; + __s32 pic_order_cnt_val; __u8 padding[2]; }; =20 @@ -178,7 +178,7 @@ struct v4l2_ctrl_hevc_slice_params { /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ __u8 slice_type; __u8 colour_plane_id; - __u16 slice_pic_order_cnt; + __s32 slice_pic_order_cnt; __u8 num_ref_idx_l0_active_minus1; __u8 num_ref_idx_l1_active_minus1; __u8 collocated_ref_idx; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2690CC25B0E for ; Mon, 15 Aug 2022 21:27:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347228AbiHOVZe (ORCPT ); Mon, 15 Aug 2022 17:25:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241696AbiHOVNs (ORCPT ); Mon, 15 Aug 2022 17:13:48 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36AF15722E; Mon, 15 Aug 2022 12:19:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 22873CE1087; Mon, 15 Aug 2022 19:19:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CF6CC433C1; Mon, 15 Aug 2022 19:19:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591183; bh=TMDXt7jtDWdicJEzEyNkxrX+6SxG2YI30o1x7P3pwRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sxmx7lL7I8vAFJ4dKQpqzq1bmOIQUSyho5MWMXU2CHkbWHUICTPBMA6nzAX6RSVT6 YG7eWiJY+hEMEWUHUmeBm2gBWrbHgou8aDbONGMNIjFGM3talGuu36l+c1yqRdRI1Y FJi1h/vPACKBuRHi01gAN5P9AaL22edTn9opLdk0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0466/1095] media: cedrus: h265: Fix logic for not low delay flag Date: Mon, 15 Aug 2022 19:57:45 +0200 Message-Id: <20220815180448.886955062@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jernej Skrabec [ Upstream commit f1a413902aa71044b6ec41265e5e28ebaf29a9ce ] Now that we know real purpose of "not low delay" flag, logic for applying this flag should be fixed too. According to vendor and reference implementation, low delay is signaled when POC of current frame is lower than POC of at least one reference of a slice. Implement mentioned logic and invert it to conform to flag meaning. Also don't apply flag for I frames. They don't have any reference. This fixes decoding of 3 reference bitstreams. Fixes: 86caab29da78 ("media: cedrus: Add HEVC/H.265 decoding support") Signed-off-by: Jernej Skrabec Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../staging/media/sunxi/cedrus/cedrus_h265.c | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/sta= ging/media/sunxi/cedrus/cedrus_h265.c index c26e515d64c9..2f6404fccd5a 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c @@ -301,6 +301,31 @@ static void cedrus_h265_write_scaling_list(struct cedr= us_ctx *ctx, } } =20 +static int cedrus_h265_is_low_delay(struct cedrus_run *run) +{ + const struct v4l2_ctrl_hevc_slice_params *slice_params; + const struct v4l2_hevc_dpb_entry *dpb; + s32 poc; + int i; + + slice_params =3D run->h265.slice_params; + poc =3D run->h265.decode_params->pic_order_cnt_val; + dpb =3D run->h265.decode_params->dpb; + + for (i =3D 0; i < slice_params->num_ref_idx_l0_active_minus1 + 1; i++) + if (dpb[slice_params->ref_idx_l0[i]].pic_order_cnt_val > poc) + return 1; + + if (slice_params->slice_type !=3D V4L2_HEVC_SLICE_TYPE_B) + return 0; + + for (i =3D 0; i < slice_params->num_ref_idx_l1_active_minus1 + 1; i++) + if (dpb[slice_params->ref_idx_l1[i]].pic_order_cnt_val > poc) + return 1; + + return 0; +} + static void cedrus_h265_setup(struct cedrus_ctx *ctx, struct cedrus_run *run) { @@ -571,7 +596,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED, slice_params->flags); =20 - if (decode_params->num_poc_st_curr_after =3D=3D 0) + if (slice_params->slice_type !=3D V4L2_HEVC_SLICE_TYPE_I && !cedrus_h265_= is_low_delay(run)) reg |=3D VE_DEC_H265_DEC_SLICE_HDR_INFO1_FLAG_SLICE_NOT_LOW_DELAY; =20 cedrus_write(dev, VE_DEC_H265_DEC_SLICE_HDR_INFO1, reg); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38A23C25B08 for ; Mon, 15 Aug 2022 21:27:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347491AbiHOVZl (ORCPT ); Mon, 15 Aug 2022 17:25:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241608AbiHOVNs (ORCPT ); Mon, 15 Aug 2022 17:13:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB262DABB5; Mon, 15 Aug 2022 12:19:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 49EF460A52; Mon, 15 Aug 2022 19:19:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37903C433D6; Mon, 15 Aug 2022 19:19:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591186; bh=qXskdu1j9rHf85RE4xREBJawMz2p1A/Hq3++wgRptaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cpiikw84cllnhkM4OGWv5CIppUOh0eunSQjR4WRk1GbvvHVffEEMb1MeTHkSDBOm1 wgenBsf5/HEV0z9QGknKhFz89bBlYAF/1ypwAAp8ddP7a1DAtPwWxTIGdL+7iNAIQJ yhTq0uv6bF4AXqj8eSBCyLCRUIkx5hmTaJekq9EU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0467/1095] wifi: wil6210: debugfs: fix info leak in wil_write_file_wmi() Date: Mon, 15 Aug 2022 19:57:46 +0200 Message-Id: <20220815180448.927414587@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 7a4836560a6198d245d5732e26f94898b12eb760 ] The simple_write_to_buffer() function will succeed if even a single byte is initialized. However, we need to initialize the whole buffer to prevent information leaks. Just use memdup_user(). Fixes: ff974e408334 ("wil6210: debugfs interface to send raw WMI command") Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/Ysg14NdKAZF/hcNG@kili Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/ath/wil6210/debugfs.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wirel= ess/ath/wil6210/debugfs.c index 4c944e595978..c6f8254cb21d 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -1012,18 +1012,12 @@ static ssize_t wil_write_file_wmi(struct file *file= , const char __user *buf, u16 cmdid; int rc, rc1; =20 - if (cmdlen < 0) + if (cmdlen < 0 || *ppos !=3D 0) return -EINVAL; =20 - wmi =3D kmalloc(len, GFP_KERNEL); - if (!wmi) - return -ENOMEM; - - rc =3D simple_write_to_buffer(wmi, len, ppos, buf, len); - if (rc < 0) { - kfree(wmi); - return rc; - } + wmi =3D memdup_user(buf, len); + if (IS_ERR(wmi)) + return PTR_ERR(wmi); =20 cmd =3D (cmdlen > 0) ? &wmi[1] : NULL; cmdid =3D le16_to_cpu(wmi->command_id); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFF4FC32763 for ; Mon, 15 Aug 2022 21:22:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343757AbiHOVVF (ORCPT ); Mon, 15 Aug 2022 17:21:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241870AbiHOVNw (ORCPT ); Mon, 15 Aug 2022 17:13:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A69E5723A; Mon, 15 Aug 2022 12:19:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6DB686009B; Mon, 15 Aug 2022 19:19:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70380C433D6; Mon, 15 Aug 2022 19:19:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591189; bh=0UKjixtL0eNbQD7Gi+0rqyBPU1iqbuobQHBHws/8h70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rsh5hG/Wc5bYF/vXt48K7Ix8RYmQ8vD/gbfa3YRXkR8cvms5rBYnBVMXQgoWzYI8D /+nNbiX7YElthvfUmglURxhGM19M9HbgTlLGZbXogCAgU1fbDTYeIXXhk8NcFMMrLE cTWwkIPIx5Vwc9DMmJ+sjrs1PGBUqUSexzXrBdcY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Christian Lamparter , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0468/1095] wifi: p54: Fix an error handling path in p54spi_probe() Date: Mon, 15 Aug 2022 19:57:47 +0200 Message-Id: <20220815180448.961526283@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 83781f0162d080fec7dcb911afd1bc2f5ad04471 ] If an error occurs after a successful call to p54spi_request_firmware(), it must be undone by a corresponding release_firmware() as already done in the error handling path of p54spi_request_firmware() and in the .remove() function. Add the missing call in the error handling path and remove it from p54spi_request_firmware() now that it is the responsibility of the caller to release the firmware Fixes: cd8d3d321285 ("p54spi: p54spi driver") Signed-off-by: Christophe JAILLET Acked-by: Christian Lamparter Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/297d2547ff2ee627731662abceeab9dbdaf23231.16= 55068321.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/intersil/p54/p54spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intersil/p54/p54spi.c b/drivers/net/wirel= ess/intersil/p54/p54spi.c index f99b7ba69fc3..19152fd449ba 100644 --- a/drivers/net/wireless/intersil/p54/p54spi.c +++ b/drivers/net/wireless/intersil/p54/p54spi.c @@ -164,7 +164,7 @@ static int p54spi_request_firmware(struct ieee80211_hw = *dev) =20 ret =3D p54_parse_firmware(dev, priv->firmware); if (ret) { - release_firmware(priv->firmware); + /* the firmware is released by the caller */ return ret; } =20 @@ -659,6 +659,7 @@ static int p54spi_probe(struct spi_device *spi) return 0; =20 err_free_common: + release_firmware(priv->firmware); free_irq(gpio_to_irq(p54spi_gpio_irq), spi); err_free_gpio_irq: gpio_free(p54spi_gpio_irq); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0828C32762 for ; Mon, 15 Aug 2022 21:22:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343932AbiHOVVL (ORCPT ); Mon, 15 Aug 2022 17:21:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233870AbiHOVOL (ORCPT ); Mon, 15 Aug 2022 17:14:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D01A5DB7C7; Mon, 15 Aug 2022 12:19:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A2EFC6009B; Mon, 15 Aug 2022 19:19:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CA31C433D7; Mon, 15 Aug 2022 19:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591193; bh=fQ8GGMOh4zLwx6CDpw5/MD/NznF498JGC0ZDntJHGnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vBqGCKnvInDMjojKuHtAVBv9VxVb6KKu7/uWLm/NQ/efX5dAtYOfzlpED1SDktDLy c7JtWxYGM0+JXRo30/PYFG0ITA7xH0EOEycaE9Bk/EuRBVCvFxbN6c2UKeC3UzZRX+ uckTtHulZ8CkJ4hW7lA7uPR27A5ZqcsA5VJjyWCY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rustam Subkhankulov , Christian Lamparter , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0469/1095] wifi: p54: add missing parentheses in p54_flush() Date: Mon, 15 Aug 2022 19:57:48 +0200 Message-Id: <20220815180449.000893569@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rustam Subkhankulov [ Upstream commit bcfd9d7f6840b06d5988c7141127795cf405805e ] The assignment of the value to the variable total in the loop condition must be enclosed in additional parentheses, since otherwise, in accordance with the precedence of the operators, the conjunction will be performed first, and only then the assignment. Due to this error, a warning later in the function after the loop may not occur in the situation when it should. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Rustam Subkhankulov Fixes: 0d4171e2153b ("p54: implement flush callback") Acked-by: Christian Lamparter Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220714134831.106004-1-subkhankulov@ispras= .ru Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/intersil/p54/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intersil/p54/main.c b/drivers/net/wireles= s/intersil/p54/main.c index a3ca6620dc0c..8fa3ec71603e 100644 --- a/drivers/net/wireless/intersil/p54/main.c +++ b/drivers/net/wireless/intersil/p54/main.c @@ -682,7 +682,7 @@ static void p54_flush(struct ieee80211_hw *dev, struct = ieee80211_vif *vif, * queues have already been stopped and no new frames can sneak * up from behind. */ - while ((total =3D p54_flush_count(priv) && i--)) { + while ((total =3D p54_flush_count(priv)) && i--) { /* waste time */ msleep(20); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90472C32764 for ; Mon, 15 Aug 2022 21:22:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344104AbiHOVVR (ORCPT ); Mon, 15 Aug 2022 17:21:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242705AbiHOVOW (ORCPT ); Mon, 15 Aug 2022 17:14:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BFD7DB7EE; Mon, 15 Aug 2022 12:19:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B1F3C60FFD; Mon, 15 Aug 2022 19:19:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3A93C433D6; Mon, 15 Aug 2022 19:19:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591196; bh=ZU9bzVza16EHJwtJkckwm5xW/Zg3CxMpPeOoH57DRPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vbmbNTjYQZDLR5GTbqyzigF0afJNCzfQiLGv9ts1iRp5IQC9WrFPyBDgmxtQJSIi3 pgkZic0G/9j265abj3bH0gHd0YRiduMvvthmhdw9nfh5VpIdG2zqtDM1l/0aV++yk5 MpTnFls5N8cL4ogJAOSsRzxXXAQEIllcvcW5/Za0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kent Russell , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 0470/1095] drm/amdgpu: use the same HDP flush registers for all nbio 7.4.x Date: Mon, 15 Aug 2022 19:57:49 +0200 Message-Id: <20220815180449.033501019@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alex Deucher [ Upstream commit 912db6a58738e8be502838eb6a88f207ba356cd7 ] Align aldebaran with all other asics. One HDP bit per SDMA instance, aligned with firmware. This is effectively a revert of commit a0f9f8546668 ("drm/amdgpu/nbio7.4: don't use GPU_HDP_FLUSH bit 12"). On further discussions with the relevant hardware teams, re-align the bits for SDMA. Fixes: a0f9f8546668 ("drm/amdgpu/nbio7.4: don't use GPU_HDP_FLUSH bit 12") Reviewed-by: Kent Russell Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 5 +---- drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 21 ------------------- drivers/gpu/drm/amd/amdgpu/nbio_v7_4.h | 1 - 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/dr= m/amd/amdgpu/amdgpu_discovery.c index e4fcbb385a62..918bb7fef6ba 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c @@ -1891,12 +1891,9 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_dev= ice *adev) break; case IP_VERSION(7, 4, 0): case IP_VERSION(7, 4, 1): - adev->nbio.funcs =3D &nbio_v7_4_funcs; - adev->nbio.hdp_flush_reg =3D &nbio_v7_4_hdp_flush_reg; - break; case IP_VERSION(7, 4, 4): adev->nbio.funcs =3D &nbio_v7_4_funcs; - adev->nbio.hdp_flush_reg =3D &nbio_v7_4_hdp_flush_reg_ald; + adev->nbio.hdp_flush_reg =3D &nbio_v7_4_hdp_flush_reg; break; case IP_VERSION(7, 2, 0): case IP_VERSION(7, 2, 1): diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c b/drivers/gpu/drm/amd/a= mdgpu/nbio_v7_4.c index c2357e83a8c4..09c0def356a1 100644 --- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c @@ -339,27 +339,6 @@ const struct nbio_hdp_flush_reg nbio_v7_4_hdp_flush_re= g =3D { .ref_and_mask_sdma1 =3D GPU_HDP_FLUSH_DONE__SDMA1_MASK, }; =20 -const struct nbio_hdp_flush_reg nbio_v7_4_hdp_flush_reg_ald =3D { - .ref_and_mask_cp0 =3D GPU_HDP_FLUSH_DONE__CP0_MASK, - .ref_and_mask_cp1 =3D GPU_HDP_FLUSH_DONE__CP1_MASK, - .ref_and_mask_cp2 =3D GPU_HDP_FLUSH_DONE__CP2_MASK, - .ref_and_mask_cp3 =3D GPU_HDP_FLUSH_DONE__CP3_MASK, - .ref_and_mask_cp4 =3D GPU_HDP_FLUSH_DONE__CP4_MASK, - .ref_and_mask_cp5 =3D GPU_HDP_FLUSH_DONE__CP5_MASK, - .ref_and_mask_cp6 =3D GPU_HDP_FLUSH_DONE__CP6_MASK, - .ref_and_mask_cp7 =3D GPU_HDP_FLUSH_DONE__CP7_MASK, - .ref_and_mask_cp8 =3D GPU_HDP_FLUSH_DONE__CP8_MASK, - .ref_and_mask_cp9 =3D GPU_HDP_FLUSH_DONE__CP9_MASK, - .ref_and_mask_sdma0 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG1_MASK, - .ref_and_mask_sdma1 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG2_MASK, - .ref_and_mask_sdma2 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG3_MASK, - .ref_and_mask_sdma3 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG4_MASK, - .ref_and_mask_sdma4 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG5_MASK, - .ref_and_mask_sdma5 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG6_MASK, - .ref_and_mask_sdma6 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG7_MASK, - .ref_and_mask_sdma7 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG8_MASK, -}; - static void nbio_v7_4_init_registers(struct amdgpu_device *adev) { uint32_t baco_cntl; diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.h b/drivers/gpu/drm/amd/a= mdgpu/nbio_v7_4.h index 7490022d79d4..f27c41728822 100644 --- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.h +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.h @@ -27,7 +27,6 @@ #include "soc15_common.h" =20 extern const struct nbio_hdp_flush_reg nbio_v7_4_hdp_flush_reg; -extern const struct nbio_hdp_flush_reg nbio_v7_4_hdp_flush_reg_ald; extern const struct amdgpu_nbio_funcs nbio_v7_4_funcs; extern struct amdgpu_nbio_ras nbio_v7_4_ras; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A02CEC32766 for ; Mon, 15 Aug 2022 21:22:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344272AbiHOVV2 (ORCPT ); Mon, 15 Aug 2022 17:21:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243360AbiHOVP0 (ORCPT ); Mon, 15 Aug 2022 17:15:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F082BDD74D; Mon, 15 Aug 2022 12:20:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6AD0CB80FD3; Mon, 15 Aug 2022 19:20:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB864C433D6; Mon, 15 Aug 2022 19:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591199; bh=leaJCV8zypGw3gSJdo5jPsu49r3nMcYAxTlGjvMqcjs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZMZF6MesoOlL3jPXqDqwtM5F6gBNF3fME0L4Deu4DI2v4KTZrwn9N2o60w9xq8EG5 QPfAVzRlkaH3gwuFLVW/bBpQYFWCCqJDEr9sinDJ0WIUA5/sntBFmx9WlWDiUhqaKY P2VV5si2JN+pmNJnEFZgN74qtItianoHbfAqymHY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kent Russell , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 0471/1095] drm/amdgpu: use the same HDP flush registers for all nbio 2.3.x Date: Mon, 15 Aug 2022 19:57:50 +0200 Message-Id: <20220815180449.065185548@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alex Deucher [ Upstream commit 98a90f1f0fdd112b85b16ef6ceee69f319ab9311 ] Align RDNA2.x with other asics. One HDP bit per SDMA instance, aligned with firmware. This is effectively a revert of commit 369b7d04baf3 ("drm/amdgpu/nbio2.3: don't use GPU_HDP_FLUSH bit 12"). On further discussions with the relevant hardware teams, re-align the bits for SDMA. Fixes: 369b7d04baf3 ("drm/amdgpu/nbio2.3: don't use GPU_HDP_FLUSH bit 12") Reviewed-by: Kent Russell Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 5 +---- drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c | 21 ------------------- drivers/gpu/drm/amd/amdgpu/nbio_v2_3.h | 1 - 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/dr= m/amd/amdgpu/amdgpu_discovery.c index 918bb7fef6ba..d68db66d969b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c @@ -1907,15 +1907,12 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_de= vice *adev) case IP_VERSION(2, 3, 0): case IP_VERSION(2, 3, 1): case IP_VERSION(2, 3, 2): - adev->nbio.funcs =3D &nbio_v2_3_funcs; - adev->nbio.hdp_flush_reg =3D &nbio_v2_3_hdp_flush_reg; - break; case IP_VERSION(3, 3, 0): case IP_VERSION(3, 3, 1): case IP_VERSION(3, 3, 2): case IP_VERSION(3, 3, 3): adev->nbio.funcs =3D &nbio_v2_3_funcs; - adev->nbio.hdp_flush_reg =3D &nbio_v2_3_hdp_flush_reg_sc; + adev->nbio.hdp_flush_reg =3D &nbio_v2_3_hdp_flush_reg; break; default: break; diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c b/drivers/gpu/drm/amd/a= mdgpu/nbio_v2_3.c index ee7cab37dfd5..dae78a1e88e6 100644 --- a/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c @@ -328,27 +328,6 @@ const struct nbio_hdp_flush_reg nbio_v2_3_hdp_flush_re= g =3D { .ref_and_mask_sdma1 =3D BIF_BX_PF_GPU_HDP_FLUSH_DONE__SDMA1_MASK, }; =20 -const struct nbio_hdp_flush_reg nbio_v2_3_hdp_flush_reg_sc =3D { - .ref_and_mask_cp0 =3D BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP0_MASK, - .ref_and_mask_cp1 =3D BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP1_MASK, - .ref_and_mask_cp2 =3D BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP2_MASK, - .ref_and_mask_cp3 =3D BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP3_MASK, - .ref_and_mask_cp4 =3D BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP4_MASK, - .ref_and_mask_cp5 =3D BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP5_MASK, - .ref_and_mask_cp6 =3D BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP6_MASK, - .ref_and_mask_cp7 =3D BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP7_MASK, - .ref_and_mask_cp8 =3D BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP8_MASK, - .ref_and_mask_cp9 =3D BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP9_MASK, - .ref_and_mask_sdma0 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG1_MASK, - .ref_and_mask_sdma1 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG2_MASK, - .ref_and_mask_sdma2 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG3_MASK, - .ref_and_mask_sdma3 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG4_MASK, - .ref_and_mask_sdma4 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG5_MASK, - .ref_and_mask_sdma5 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG6_MASK, - .ref_and_mask_sdma6 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG7_MASK, - .ref_and_mask_sdma7 =3D GPU_HDP_FLUSH_DONE__RSVD_ENG8_MASK, -}; - static void nbio_v2_3_init_registers(struct amdgpu_device *adev) { uint32_t def, data; diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.h b/drivers/gpu/drm/amd/a= mdgpu/nbio_v2_3.h index 6074dd3a1ed8..a43b60acf7f6 100644 --- a/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.h +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.h @@ -27,7 +27,6 @@ #include "soc15_common.h" =20 extern const struct nbio_hdp_flush_reg nbio_v2_3_hdp_flush_reg; -extern const struct nbio_hdp_flush_reg nbio_v2_3_hdp_flush_reg_sc; extern const struct amdgpu_nbio_funcs nbio_v2_3_funcs; =20 #endif --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2D96C282E7 for ; Mon, 15 Aug 2022 21:18:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344276AbiHOVR0 (ORCPT ); Mon, 15 Aug 2022 17:17:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348086AbiHOVIF (ORCPT ); Mon, 15 Aug 2022 17:08:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BEAD3C8FF; Mon, 15 Aug 2022 12:18:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E92F060F6A; Mon, 15 Aug 2022 19:18:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCFEDC433C1; Mon, 15 Aug 2022 19:18:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591099; bh=kecoAhspe8ZOIjQtbaMol+JU8+XTX0SpoPNFUJlo3Vg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TS/XgkOgx0UGs5BmjV6xIJDki6KSnOXsqTQSJ/YvQlHOTIqmPf9OGwWbTux28nYFo XyCGrEQRgKa4j07iO3fLlu70eeY2i81wRitcFoUDybgbpgeSXkRKp9FH/qoymcEa4A pmqJFscHVGmVFFaFqm2Wz1Ita/lHeM5QAyXFezu4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20K=C3=B6nig?= , Shashank Sharma , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 0472/1095] drm/amdgpu: cleanup ctx implementation Date: Mon, 15 Aug 2022 19:57:51 +0200 Message-Id: <20220815180449.100544012@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christian K=C3=B6nig [ Upstream commit 69493c034d2455204dfcd370de8c4dc204374a94 ] Let each context have a pointer to the ctx manager and properly initialize the adev pointer inside the context manager. Reduce the BUG_ON() in amdgpu_ctx_add_fence() into a WARN_ON() and directly return the sequence number instead of writing into a parmeter. Signed-off-by: Christian K=C3=B6nig Reviewed-by: Shashank Sharma Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 46 ++++++++++++------------- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h | 11 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/a= mdgpu/amdgpu_cs.c index 2019622191b5..ee0cbc6ccbfb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -1260,7 +1260,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *= p, =20 p->fence =3D dma_fence_get(&job->base.s_fence->finished); =20 - amdgpu_ctx_add_fence(p->ctx, entity, p->fence, &seq); + seq =3D amdgpu_ctx_add_fence(p->ctx, entity, p->fence); amdgpu_cs_post_dependencies(p); =20 if ((job->preamble_status & AMDGPU_PREAMBLE_IB_PRESENT) && diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_ctx.c index c317078d1afd..a61e4c83a545 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -135,9 +135,9 @@ static enum amdgpu_ring_priority_level amdgpu_ctx_sched= _prio_to_ring_prio(int32_ =20 static unsigned int amdgpu_ctx_get_hw_prio(struct amdgpu_ctx *ctx, u32 hw_= ip) { - struct amdgpu_device *adev =3D ctx->adev; - int32_t ctx_prio; + struct amdgpu_device *adev =3D ctx->mgr->adev; unsigned int hw_prio; + int32_t ctx_prio; =20 ctx_prio =3D (ctx->override_priority =3D=3D AMDGPU_CTX_PRIORITY_UNSET) ? ctx->init_priority : ctx->override_priority; @@ -166,7 +166,7 @@ static unsigned int amdgpu_ctx_get_hw_prio(struct amdgp= u_ctx *ctx, u32 hw_ip) static int amdgpu_ctx_init_entity(struct amdgpu_ctx *ctx, u32 hw_ip, const u32 ring) { - struct amdgpu_device *adev =3D ctx->adev; + struct amdgpu_device *adev =3D ctx->mgr->adev; struct amdgpu_ctx_entity *entity; struct drm_gpu_scheduler **scheds =3D NULL, *sched =3D NULL; unsigned num_scheds =3D 0; @@ -220,10 +220,8 @@ static int amdgpu_ctx_init_entity(struct amdgpu_ctx *c= tx, u32 hw_ip, return r; } =20 -static int amdgpu_ctx_init(struct amdgpu_device *adev, - int32_t priority, - struct drm_file *filp, - struct amdgpu_ctx *ctx) +static int amdgpu_ctx_init(struct amdgpu_ctx_mgr *mgr, int32_t priority, + struct drm_file *filp, struct amdgpu_ctx *ctx) { int r; =20 @@ -233,15 +231,14 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, =20 memset(ctx, 0, sizeof(*ctx)); =20 - ctx->adev =3D adev; - kref_init(&ctx->refcount); + ctx->mgr =3D mgr; spin_lock_init(&ctx->ring_lock); mutex_init(&ctx->lock); =20 - ctx->reset_counter =3D atomic_read(&adev->gpu_reset_counter); + ctx->reset_counter =3D atomic_read(&mgr->adev->gpu_reset_counter); ctx->reset_counter_query =3D ctx->reset_counter; - ctx->vram_lost_counter =3D atomic_read(&adev->vram_lost_counter); + ctx->vram_lost_counter =3D atomic_read(&mgr->adev->vram_lost_counter); ctx->init_priority =3D priority; ctx->override_priority =3D AMDGPU_CTX_PRIORITY_UNSET; ctx->stable_pstate =3D AMDGPU_CTX_STABLE_PSTATE_NONE; @@ -266,7 +263,7 @@ static void amdgpu_ctx_fini_entity(struct amdgpu_ctx_en= tity *entity) static int amdgpu_ctx_get_stable_pstate(struct amdgpu_ctx *ctx, u32 *stable_pstate) { - struct amdgpu_device *adev =3D ctx->adev; + struct amdgpu_device *adev =3D ctx->mgr->adev; enum amd_dpm_forced_level current_level; =20 current_level =3D amdgpu_dpm_get_performance_level(adev); @@ -294,7 +291,7 @@ static int amdgpu_ctx_get_stable_pstate(struct amdgpu_c= tx *ctx, static int amdgpu_ctx_set_stable_pstate(struct amdgpu_ctx *ctx, u32 stable_pstate) { - struct amdgpu_device *adev =3D ctx->adev; + struct amdgpu_device *adev =3D ctx->mgr->adev; enum amd_dpm_forced_level level; u32 current_stable_pstate; int r; @@ -345,7 +342,8 @@ static int amdgpu_ctx_set_stable_pstate(struct amdgpu_c= tx *ctx, static void amdgpu_ctx_fini(struct kref *ref) { struct amdgpu_ctx *ctx =3D container_of(ref, struct amdgpu_ctx, refcount); - struct amdgpu_device *adev =3D ctx->adev; + struct amdgpu_ctx_mgr *mgr =3D ctx->mgr; + struct amdgpu_device *adev =3D mgr->adev; unsigned i, j, idx; =20 if (!adev) @@ -421,7 +419,7 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev, } =20 *id =3D (uint32_t)r; - r =3D amdgpu_ctx_init(adev, priority, filp, ctx); + r =3D amdgpu_ctx_init(mgr, priority, filp, ctx); if (r) { idr_remove(&mgr->ctx_handles, *id); *id =3D 0; @@ -671,9 +669,9 @@ int amdgpu_ctx_put(struct amdgpu_ctx *ctx) return 0; } =20 -void amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, - struct drm_sched_entity *entity, - struct dma_fence *fence, uint64_t *handle) +uint64_t amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, + struct drm_sched_entity *entity, + struct dma_fence *fence) { struct amdgpu_ctx_entity *centity =3D to_amdgpu_ctx_entity(entity); uint64_t seq =3D centity->sequence; @@ -682,8 +680,7 @@ void amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, =20 idx =3D seq & (amdgpu_sched_jobs - 1); other =3D centity->fences[idx]; - if (other) - BUG_ON(!dma_fence_is_signaled(other)); + WARN_ON(other && !dma_fence_is_signaled(other)); =20 dma_fence_get(fence); =20 @@ -693,8 +690,7 @@ void amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, spin_unlock(&ctx->ring_lock); =20 dma_fence_put(other); - if (handle) - *handle =3D seq; + return seq; } =20 struct dma_fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx, @@ -731,7 +727,7 @@ static void amdgpu_ctx_set_entity_priority(struct amdgp= u_ctx *ctx, int hw_ip, int32_t priority) { - struct amdgpu_device *adev =3D ctx->adev; + struct amdgpu_device *adev =3D ctx->mgr->adev; unsigned int hw_prio; struct drm_gpu_scheduler **scheds =3D NULL; unsigned num_scheds; @@ -796,8 +792,10 @@ int amdgpu_ctx_wait_prev_fence(struct amdgpu_ctx *ctx, return r; } =20 -void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr) +void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr, + struct amdgpu_device *adev) { + mgr->adev =3D adev; mutex_init(&mgr->lock); idr_init(&mgr->ctx_handles); } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h b/drivers/gpu/drm/amd/= amdgpu/amdgpu_ctx.h index 142f2f87d44c..681050bc828c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h @@ -40,7 +40,7 @@ struct amdgpu_ctx_entity { =20 struct amdgpu_ctx { struct kref refcount; - struct amdgpu_device *adev; + struct amdgpu_ctx_mgr *mgr; unsigned reset_counter; unsigned reset_counter_query; uint32_t vram_lost_counter; @@ -70,9 +70,9 @@ int amdgpu_ctx_put(struct amdgpu_ctx *ctx); =20 int amdgpu_ctx_get_entity(struct amdgpu_ctx *ctx, u32 hw_ip, u32 instance, u32 ring, struct drm_sched_entity **entity); -void amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, - struct drm_sched_entity *entity, - struct dma_fence *fence, uint64_t *seq); +uint64_t amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, + struct drm_sched_entity *entity, + struct dma_fence *fence); struct dma_fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx, struct drm_sched_entity *entity, uint64_t seq); @@ -85,7 +85,8 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data, int amdgpu_ctx_wait_prev_fence(struct amdgpu_ctx *ctx, struct drm_sched_entity *entity); =20 -void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr); +void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr, + struct amdgpu_device *adev); void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr); long amdgpu_ctx_mgr_entity_flush(struct amdgpu_ctx_mgr *mgr, long timeout); void amdgpu_ctx_mgr_fini(struct amdgpu_ctx_mgr *mgr); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_kms.c index 49c55d82cba8..20a432a774c1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -1142,7 +1142,7 @@ int amdgpu_driver_open_kms(struct drm_device *dev, st= ruct drm_file *file_priv) mutex_init(&fpriv->bo_list_lock); idr_init(&fpriv->bo_list_handles); =20 - amdgpu_ctx_mgr_init(&fpriv->ctx_mgr); + amdgpu_ctx_mgr_init(&fpriv->ctx_mgr, adev); =20 file_priv->driver_priv =3D fpriv; goto out_suspend; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3DBCC28B2B for ; Mon, 15 Aug 2022 21:18:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344632AbiHOVRd (ORCPT ); Mon, 15 Aug 2022 17:17:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348097AbiHOVIH (ORCPT ); Mon, 15 Aug 2022 17:08:07 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76C0E52E58; Mon, 15 Aug 2022 12:18:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id E2784CE12C5; Mon, 15 Aug 2022 19:18:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E54F3C433D6; Mon, 15 Aug 2022 19:18:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591102; bh=5kYBB6X/8iRDlgaDFIsv3QBoZ6DilMJxaXnfoQdzZXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pF63v/cTNnt0I+aZmVmDUqOQcOkFLjIzFF0XDirpC++A3vQloCrHmBEhmk83q97rO FKmbrKcIgtplR8ghwEkI5m7ankaC4qOJ2zgGPaPIbzoKr22Sg3+S4+XhtYbkI+MTvJ tQG/SYhqbfYUtDN+GJXn6YFlwCsbdE8C/mJ22dUk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 0473/1095] drm/amdgpu: restore original stable pstate on ctx fini Date: Mon, 15 Aug 2022 19:57:52 +0200 Message-Id: <20220815180449.144415984@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alex Deucher [ Upstream commit 958afce98c2c86732483458c03540d3c6ef45254 ] Save the original stable pstate on ctx init and restore it on ctx fini so that we restore a manually selected stable pstate on ctx exit. v2: fix init order (Alex) v3: don't add new variable to ctx struct (Evan) Fixes: c65b364c52ba ("drm/amdgpu/ctx: only reset stable pstate if the user = changed it (v2)") Reviewed-by: Evan Quan Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 60 ++++++++++++++----------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_ctx.c index a61e4c83a545..95ed528e6ec5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -220,32 +220,6 @@ static int amdgpu_ctx_init_entity(struct amdgpu_ctx *c= tx, u32 hw_ip, return r; } =20 -static int amdgpu_ctx_init(struct amdgpu_ctx_mgr *mgr, int32_t priority, - struct drm_file *filp, struct amdgpu_ctx *ctx) -{ - int r; - - r =3D amdgpu_ctx_priority_permit(filp, priority); - if (r) - return r; - - memset(ctx, 0, sizeof(*ctx)); - - kref_init(&ctx->refcount); - ctx->mgr =3D mgr; - spin_lock_init(&ctx->ring_lock); - mutex_init(&ctx->lock); - - ctx->reset_counter =3D atomic_read(&mgr->adev->gpu_reset_counter); - ctx->reset_counter_query =3D ctx->reset_counter; - ctx->vram_lost_counter =3D atomic_read(&mgr->adev->vram_lost_counter); - ctx->init_priority =3D priority; - ctx->override_priority =3D AMDGPU_CTX_PRIORITY_UNSET; - ctx->stable_pstate =3D AMDGPU_CTX_STABLE_PSTATE_NONE; - - return 0; -} - static void amdgpu_ctx_fini_entity(struct amdgpu_ctx_entity *entity) { =20 @@ -288,6 +262,38 @@ static int amdgpu_ctx_get_stable_pstate(struct amdgpu_= ctx *ctx, return 0; } =20 +static int amdgpu_ctx_init(struct amdgpu_ctx_mgr *mgr, int32_t priority, + struct drm_file *filp, struct amdgpu_ctx *ctx) +{ + u32 current_stable_pstate; + int r; + + r =3D amdgpu_ctx_priority_permit(filp, priority); + if (r) + return r; + + memset(ctx, 0, sizeof(*ctx)); + + kref_init(&ctx->refcount); + ctx->mgr =3D mgr; + spin_lock_init(&ctx->ring_lock); + mutex_init(&ctx->lock); + + ctx->reset_counter =3D atomic_read(&mgr->adev->gpu_reset_counter); + ctx->reset_counter_query =3D ctx->reset_counter; + ctx->vram_lost_counter =3D atomic_read(&mgr->adev->vram_lost_counter); + ctx->init_priority =3D priority; + ctx->override_priority =3D AMDGPU_CTX_PRIORITY_UNSET; + + r =3D amdgpu_ctx_get_stable_pstate(ctx, ¤t_stable_pstate); + if (r) + return r; + + ctx->stable_pstate =3D current_stable_pstate; + + return 0; +} + static int amdgpu_ctx_set_stable_pstate(struct amdgpu_ctx *ctx, u32 stable_pstate) { @@ -357,7 +363,7 @@ static void amdgpu_ctx_fini(struct kref *ref) } =20 if (drm_dev_enter(&adev->ddev, &idx)) { - amdgpu_ctx_set_stable_pstate(ctx, AMDGPU_CTX_STABLE_PSTATE_NONE); + amdgpu_ctx_set_stable_pstate(ctx, ctx->stable_pstate); drm_dev_exit(idx); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06F35C25B08 for ; Mon, 15 Aug 2022 21:18:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344435AbiHOVR3 (ORCPT ); Mon, 15 Aug 2022 17:17:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348114AbiHOVIJ (ORCPT ); Mon, 15 Aug 2022 17:08:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8B9052E61; Mon, 15 Aug 2022 12:18:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 152EA60F6A; Mon, 15 Aug 2022 19:18:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02AEAC433C1; Mon, 15 Aug 2022 19:18:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591105; bh=RQC04sJGMjT6XKh3t5k+vlRJIMq7XS4wkzF/QxCzlZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tevvKICWnMaeU/LeLgfJs3eg+X41mgYO1q0uElQF10i0hRwD6IaLX6otkrKrr01rQ 5c30psAhyNQYyxhevlw01JdKu4LbYxOUMTlA1RlahEwRJoz+qF3FVU7T0PuMM0ikF2 P2sa7F02s7OAYHHoYDgnlg2KAtvrILqQjLy2S4zw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kumar Kartikeya Dwivedi , Alexei Starovoitov , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.18 0474/1095] bpf: Make btf_find_field more generic Date: Mon, 15 Aug 2022 19:57:53 +0200 Message-Id: <20220815180449.194539098@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kumar Kartikeya Dwivedi [ Upstream commit 42ba1308074d9046386d58b56e793604be48ce22 ] Next commit introduces field type 'kptr' whose kind will not be struct, but pointer, and it will not be limited to one offset, but multiple ones. Make existing btf_find_struct_field and btf_find_datasec_var functions amenable to use for finding kptrs in map value, by moving spin_lock and timer specific checks into their own function. The alignment, and name are checked before the function is called, so it is the last point where we can skip field or return an error before the next loop iteration happens. Size of the field and type is meant to be checked inside the function. Signed-off-by: Kumar Kartikeya Dwivedi Signed-off-by: Alexei Starovoitov Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20220415160354.1050687-2-memxor@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/bpf/btf.c | 120 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 89 insertions(+), 31 deletions(-) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index feef799884d1..1fd8400bda06 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -3163,24 +3163,44 @@ static void btf_struct_log(struct btf_verifier_env = *env, btf_verifier_log(env, "size=3D%u vlen=3D%u", t->size, btf_type_vlen(t)); } =20 +enum btf_field_type { + BTF_FIELD_SPIN_LOCK, + BTF_FIELD_TIMER, +}; + +struct btf_field_info { + u32 off; +}; + +static int btf_find_struct(const struct btf *btf, const struct btf_type *t, + u32 off, int sz, struct btf_field_info *info) +{ + if (!__btf_type_is_struct(t)) + return 0; + if (t->size !=3D sz) + return 0; + if (info->off !=3D -ENOENT) + /* only one such field is allowed */ + return -E2BIG; + info->off =3D off; + return 0; +} + static int btf_find_struct_field(const struct btf *btf, const struct btf_t= ype *t, - const char *name, int sz, int align) + const char *name, int sz, int align, + enum btf_field_type field_type, + struct btf_field_info *info) { const struct btf_member *member; - u32 i, off =3D -ENOENT; + u32 i, off; =20 for_each_member(i, t, member) { const struct btf_type *member_type =3D btf_type_by_id(btf, member->type); - if (!__btf_type_is_struct(member_type)) - continue; - if (member_type->size !=3D sz) - continue; + if (strcmp(__btf_name_by_offset(btf, member_type->name_off), name)) continue; - if (off !=3D -ENOENT) - /* only one such field is allowed */ - return -E2BIG; + off =3D __btf_member_bit_offset(t, member); if (off % 8) /* valid C code cannot generate such BTF */ @@ -3188,46 +3208,76 @@ static int btf_find_struct_field(const struct btf *= btf, const struct btf_type *t off /=3D 8; if (off % align) return -EINVAL; + + switch (field_type) { + case BTF_FIELD_SPIN_LOCK: + case BTF_FIELD_TIMER: + return btf_find_struct(btf, member_type, off, sz, info); + default: + return -EFAULT; + } } - return off; + return 0; } =20 static int btf_find_datasec_var(const struct btf *btf, const struct btf_ty= pe *t, - const char *name, int sz, int align) + const char *name, int sz, int align, + enum btf_field_type field_type, + struct btf_field_info *info) { const struct btf_var_secinfo *vsi; - u32 i, off =3D -ENOENT; + u32 i, off; =20 for_each_vsi(i, t, vsi) { const struct btf_type *var =3D btf_type_by_id(btf, vsi->type); const struct btf_type *var_type =3D btf_type_by_id(btf, var->type); =20 - if (!__btf_type_is_struct(var_type)) - continue; - if (var_type->size !=3D sz) + off =3D vsi->offset; + + if (strcmp(__btf_name_by_offset(btf, var_type->name_off), name)) continue; if (vsi->size !=3D sz) continue; - if (strcmp(__btf_name_by_offset(btf, var_type->name_off), name)) - continue; - if (off !=3D -ENOENT) - /* only one such field is allowed */ - return -E2BIG; - off =3D vsi->offset; if (off % align) return -EINVAL; + + switch (field_type) { + case BTF_FIELD_SPIN_LOCK: + case BTF_FIELD_TIMER: + return btf_find_struct(btf, var_type, off, sz, info); + default: + return -EFAULT; + } } - return off; + return 0; } =20 static int btf_find_field(const struct btf *btf, const struct btf_type *t, - const char *name, int sz, int align) + enum btf_field_type field_type, + struct btf_field_info *info) { + const char *name; + int sz, align; + + switch (field_type) { + case BTF_FIELD_SPIN_LOCK: + name =3D "bpf_spin_lock"; + sz =3D sizeof(struct bpf_spin_lock); + align =3D __alignof__(struct bpf_spin_lock); + break; + case BTF_FIELD_TIMER: + name =3D "bpf_timer"; + sz =3D sizeof(struct bpf_timer); + align =3D __alignof__(struct bpf_timer); + break; + default: + return -EFAULT; + } =20 if (__btf_type_is_struct(t)) - return btf_find_struct_field(btf, t, name, sz, align); + return btf_find_struct_field(btf, t, name, sz, align, field_type, info); else if (btf_type_is_datasec(t)) - return btf_find_datasec_var(btf, t, name, sz, align); + return btf_find_datasec_var(btf, t, name, sz, align, field_type, info); return -EINVAL; } =20 @@ -3237,16 +3287,24 @@ static int btf_find_field(const struct btf *btf, co= nst struct btf_type *t, */ int btf_find_spin_lock(const struct btf *btf, const struct btf_type *t) { - return btf_find_field(btf, t, "bpf_spin_lock", - sizeof(struct bpf_spin_lock), - __alignof__(struct bpf_spin_lock)); + struct btf_field_info info =3D { .off =3D -ENOENT }; + int ret; + + ret =3D btf_find_field(btf, t, BTF_FIELD_SPIN_LOCK, &info); + if (ret < 0) + return ret; + return info.off; } =20 int btf_find_timer(const struct btf *btf, const struct btf_type *t) { - return btf_find_field(btf, t, "bpf_timer", - sizeof(struct bpf_timer), - __alignof__(struct bpf_timer)); + struct btf_field_info info =3D { .off =3D -ENOENT }; + int ret; + + ret =3D btf_find_field(btf, t, BTF_FIELD_TIMER, &info); + if (ret < 0) + return ret; + return info.off; } =20 static void __btf_struct_show(const struct btf *btf, const struct btf_type= *t, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BD6FC28B2B for ; Mon, 15 Aug 2022 21:18:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344820AbiHOVRg (ORCPT ); Mon, 15 Aug 2022 17:17:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348143AbiHOVIN (ORCPT ); Mon, 15 Aug 2022 17:08:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1543152FC2; Mon, 15 Aug 2022 12:18:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AC47EB81106; Mon, 15 Aug 2022 19:18:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16EE4C433D6; Mon, 15 Aug 2022 19:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591108; bh=J5MIm3UtF/W+1yWUXo2HL/p6MBZovK8cm6sauq+Outg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yl+neMqc7i8YAUwRKy3OT7j0P1sVVkJZ9r8qST/BPcdYuQKMLGlfv98Ozr3eYCE1d EaNkz4yIvo5ztpTjB2hTm6VCz+LuoLniknpOo89phieMUB9xz3N7oyIOt6Vs2RV/AT UStfruWhsr9o6Bd9jvKQk0iQHDoHVW5jZcEp0ajY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kumar Kartikeya Dwivedi , Alexei Starovoitov , Daniel Borkmann , Joanne Koong , Sasha Levin Subject: [PATCH 5.18 0475/1095] bpf: Move check_ptr_off_reg before check_map_access Date: Mon, 15 Aug 2022 19:57:54 +0200 Message-Id: <20220815180449.237811027@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kumar Kartikeya Dwivedi [ Upstream commit e9147b4422e1f35b9c229c980c596ccf03d61562 ] Some functions in next patch want to use this function, and those functions will be called by check_map_access, hence move it before check_map_access. Signed-off-by: Kumar Kartikeya Dwivedi Signed-off-by: Alexei Starovoitov Signed-off-by: Daniel Borkmann Acked-by: Joanne Koong Link: https://lore.kernel.org/bpf/20220415160354.1050687-3-memxor@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/bpf/verifier.c | 76 +++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index f29aa357826c..afa05e6cd78f 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -3468,6 +3468,44 @@ static int check_mem_region_access(struct bpf_verifi= er_env *env, u32 regno, return 0; } =20 +static int __check_ptr_off_reg(struct bpf_verifier_env *env, + const struct bpf_reg_state *reg, int regno, + bool fixed_off_ok) +{ + /* Access to this pointer-typed register or passing it to a helper + * is only allowed in its original, unmodified form. + */ + + if (reg->off < 0) { + verbose(env, "negative offset %s ptr R%d off=3D%d disallowed\n", + reg_type_str(env, reg->type), regno, reg->off); + return -EACCES; + } + + if (!fixed_off_ok && reg->off) { + verbose(env, "dereference of modified %s ptr R%d off=3D%d disallowed\n", + reg_type_str(env, reg->type), regno, reg->off); + return -EACCES; + } + + if (!tnum_is_const(reg->var_off) || reg->var_off.value) { + char tn_buf[48]; + + tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off); + verbose(env, "variable %s access var_off=3D%s disallowed\n", + reg_type_str(env, reg->type), tn_buf); + return -EACCES; + } + + return 0; +} + +int check_ptr_off_reg(struct bpf_verifier_env *env, + const struct bpf_reg_state *reg, int regno) +{ + return __check_ptr_off_reg(env, reg, regno, false); +} + /* check read/write into a map element with possible variable offset */ static int check_map_access(struct bpf_verifier_env *env, u32 regno, int off, int size, bool zero_size_allowed) @@ -3979,44 +4017,6 @@ static int get_callee_stack_depth(struct bpf_verifie= r_env *env, } #endif =20 -static int __check_ptr_off_reg(struct bpf_verifier_env *env, - const struct bpf_reg_state *reg, int regno, - bool fixed_off_ok) -{ - /* Access to this pointer-typed register or passing it to a helper - * is only allowed in its original, unmodified form. - */ - - if (reg->off < 0) { - verbose(env, "negative offset %s ptr R%d off=3D%d disallowed\n", - reg_type_str(env, reg->type), regno, reg->off); - return -EACCES; - } - - if (!fixed_off_ok && reg->off) { - verbose(env, "dereference of modified %s ptr R%d off=3D%d disallowed\n", - reg_type_str(env, reg->type), regno, reg->off); - return -EACCES; - } - - if (!tnum_is_const(reg->var_off) || reg->var_off.value) { - char tn_buf[48]; - - tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off); - verbose(env, "variable %s access var_off=3D%s disallowed\n", - reg_type_str(env, reg->type), tn_buf); - return -EACCES; - } - - return 0; -} - -int check_ptr_off_reg(struct bpf_verifier_env *env, - const struct bpf_reg_state *reg, int regno) -{ - return __check_ptr_off_reg(env, reg, regno, false); -} - static int __check_buffer_access(struct bpf_verifier_env *env, const char *buf_info, const struct bpf_reg_state *reg, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D267C2BB43 for ; Mon, 15 Aug 2022 21:18:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345791AbiHOVRv (ORCPT ); Mon, 15 Aug 2022 17:17:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348191AbiHOVIR (ORCPT ); Mon, 15 Aug 2022 17:08:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F407552FDB; Mon, 15 Aug 2022 12:18:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 063BBB81113; Mon, 15 Aug 2022 19:18:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19F89C433D7; Mon, 15 Aug 2022 19:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591111; bh=KqLgRJqVi462HBfNickbVT8GZk5LabqnYUttxHP06+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RrT1TqBxPSpwv3d489/X98TOSrWKtCveFFshK+1C0Bnuk3+ne+6dljzy717Ud2vDn 9yG9QJ+CEKhUZF2XKvBYUxW0aOA9OXm1F/xSRrzk9AdyLyrPa7mv2wRG8kZtWlqoWj DnHUbQmtXvQAw3S656Nbrm2Gf2fHSxo6+Uh3zdfU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kumar Kartikeya Dwivedi , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.18 0476/1095] bpf: Allow storing unreferenced kptr in map Date: Mon, 15 Aug 2022 19:57:55 +0200 Message-Id: <20220815180449.276304260@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kumar Kartikeya Dwivedi [ Upstream commit 61df10c7799e27807ad5e459eec9d77cddf8bf45 ] This commit introduces a new pointer type 'kptr' which can be embedded in a map value to hold a PTR_TO_BTF_ID stored by a BPF program during its invocation. When storing such a kptr, BPF program's PTR_TO_BTF_ID register must have the same type as in the map value's BTF, and loading a kptr marks the destination register as PTR_TO_BTF_ID with the correct kernel BTF and BTF ID. Such kptr are unreferenced, i.e. by the time another invocation of the BPF program loads this pointer, the object which the pointer points to may not longer exist. Since PTR_TO_BTF_ID loads (using BPF_LDX) are patched to PROBE_MEM loads by the verifier, it would safe to allow user to still access such invalid pointer, but passing such pointers into BPF helpers and kfuncs should not be permitted. A future patch in this series will close this gap. The flexibility offered by allowing programs to dereference such invalid pointers while being safe at runtime frees the verifier from doing complex lifetime tracking. As long as the user may ensure that the object remains valid, it can ensure data read by it from the kernel object is valid. The user indicates that a certain pointer must be treated as kptr capable of accepting stores of PTR_TO_BTF_ID of a certain type, by using a BTF type tag 'kptr' on the pointed to type of the pointer. Then, this information is recorded in the object BTF which will be passed into the kernel by way of map's BTF information. The name and kind from the map value BTF is used to look up the in-kernel type, and the actual BTF and BTF ID is recorded in the map struct in a new kptr_off_tab member. For now, only storing pointers to structs is permitted. An example of this specification is shown below: #define __kptr __attribute__((btf_type_tag("kptr"))) struct map_value { ... struct task_struct __kptr *task; ... }; Then, in a BPF program, user may store PTR_TO_BTF_ID with the type task_struct into the map, and then load it later. Note that the destination register is marked PTR_TO_BTF_ID_OR_NULL, as the verifier cannot know whether the value is NULL or not statically, it must treat all potential loads at that map value offset as loading a possibly NULL pointer. Only BPF_LDX, BPF_STX, and BPF_ST (with insn->imm =3D 0 to denote NULL) are allowed instructions that can access such a pointer. On BPF_LDX, the destination register is updated to be a PTR_TO_BTF_ID, and on BPF_STX, it is checked whether the source register type is a PTR_TO_BTF_ID with same BTF type as specified in the map BTF. The access size must always be BPF_DW. For the map in map support, the kptr_off_tab for outer map is copied from the inner map's kptr_off_tab. It was chosen to do a deep copy instead of introducing a refcount to kptr_off_tab, because the copy only needs to be done when paramterizing using inner_map_fd in the map in map case, hence would be unnecessary for all other users. It is not permitted to use MAP_FREEZE command and mmap for BPF map having kptrs, similar to the bpf_timer case. A kptr also requires that BPF program has both read and write access to the map (hence both BPF_F_RDONLY_PROG and BPF_F_WRONLY_PROG are disallowed). Note that check_map_access must be called from both check_helper_mem_access and for the BPF instructions, hence the kptr check must distinguish between ACCESS_DIRECT and ACCESS_HELPER, and reject ACCESS_HELPER cases. We rename stack_access_src to bpf_access_src and reuse it for this purpose. Signed-off-by: Kumar Kartikeya Dwivedi Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20220424214901.2743946-2-memxor@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/bpf.h | 31 +++++++- include/linux/btf.h | 2 + kernel/bpf/btf.c | 167 +++++++++++++++++++++++++++++++++++----- kernel/bpf/map_in_map.c | 5 +- kernel/bpf/syscall.c | 103 ++++++++++++++++++++++++- kernel/bpf/verifier.c | 161 +++++++++++++++++++++++++++++++++++--- 6 files changed, 433 insertions(+), 36 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 492e114b4e32..00d55c10d876 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -155,6 +155,24 @@ struct bpf_map_ops { const struct bpf_iter_seq_info *iter_seq_info; }; =20 +enum { + /* Support at most 8 pointers in a BPF map value */ + BPF_MAP_VALUE_OFF_MAX =3D 8, +}; + +struct bpf_map_value_off_desc { + u32 offset; + struct { + struct btf *btf; + u32 btf_id; + } kptr; +}; + +struct bpf_map_value_off { + u32 nr_off; + struct bpf_map_value_off_desc off[]; +}; + struct bpf_map { /* The first two cachelines with read-mostly members of which some * are also accessed in fast-path (e.g. ops, max_entries). @@ -171,6 +189,7 @@ struct bpf_map { u64 map_extra; /* any per-map-type extra fields */ u32 map_flags; int spin_lock_off; /* >=3D0 valid offset, <0 error */ + struct bpf_map_value_off *kptr_off_tab; int timer_off; /* >=3D0 valid offset, <0 error */ u32 id; int numa_node; @@ -184,7 +203,7 @@ struct bpf_map { char name[BPF_OBJ_NAME_LEN]; bool bypass_spec_v1; bool frozen; /* write-once; write-protected by freeze_mutex */ - /* 14 bytes hole */ + /* 6 bytes hole */ =20 /* The 3rd and 4th cacheline with misc members to avoid false sharing * particularly with refcounting. @@ -217,6 +236,11 @@ static inline bool map_value_has_timer(const struct bp= f_map *map) return map->timer_off >=3D 0; } =20 +static inline bool map_value_has_kptrs(const struct bpf_map *map) +{ + return !IS_ERR_OR_NULL(map->kptr_off_tab); +} + static inline void check_and_init_map_value(struct bpf_map *map, void *dst) { if (unlikely(map_value_has_spin_lock(map))) @@ -1407,6 +1431,11 @@ void bpf_prog_put(struct bpf_prog *prog); void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock); void bpf_map_free_id(struct bpf_map *map, bool do_idr_lock); =20 +struct bpf_map_value_off_desc *bpf_map_kptr_off_contains(struct bpf_map *m= ap, u32 offset); +void bpf_map_free_kptr_off_tab(struct bpf_map *map); +struct bpf_map_value_off *bpf_map_copy_kptr_off_tab(const struct bpf_map *= map); +bool bpf_map_equal_kptr_off_tab(const struct bpf_map *map_a, const struct = bpf_map *map_b); + struct bpf_map *bpf_map_get(u32 ufd); struct bpf_map *bpf_map_get_with_uref(u32 ufd); struct bpf_map *__bpf_map_get(struct fd f); diff --git a/include/linux/btf.h b/include/linux/btf.h index 36bc09b8e890..19c297f9a52f 100644 --- a/include/linux/btf.h +++ b/include/linux/btf.h @@ -123,6 +123,8 @@ bool btf_member_is_reg_int(const struct btf *btf, const= struct btf_type *s, u32 expected_offset, u32 expected_size); int btf_find_spin_lock(const struct btf *btf, const struct btf_type *t); int btf_find_timer(const struct btf *btf, const struct btf_type *t); +struct bpf_map_value_off *btf_parse_kptrs(const struct btf *btf, + const struct btf_type *t); bool btf_type_is_void(const struct btf_type *t); s32 btf_find_by_name_kind(const struct btf *btf, const char *name, u8 kind= ); const struct btf_type *btf_type_skip_modifiers(const struct btf *btf, diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 1fd8400bda06..cbb48eb8c009 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -3166,9 +3166,16 @@ static void btf_struct_log(struct btf_verifier_env *= env, enum btf_field_type { BTF_FIELD_SPIN_LOCK, BTF_FIELD_TIMER, + BTF_FIELD_KPTR, +}; + +enum { + BTF_FIELD_IGNORE =3D 0, + BTF_FIELD_FOUND =3D 1, }; =20 struct btf_field_info { + u32 type_id; u32 off; }; =20 @@ -3176,29 +3183,57 @@ static int btf_find_struct(const struct btf *btf, c= onst struct btf_type *t, u32 off, int sz, struct btf_field_info *info) { if (!__btf_type_is_struct(t)) - return 0; + return BTF_FIELD_IGNORE; if (t->size !=3D sz) - return 0; - if (info->off !=3D -ENOENT) - /* only one such field is allowed */ - return -E2BIG; + return BTF_FIELD_IGNORE; info->off =3D off; - return 0; + return BTF_FIELD_FOUND; +} + +static int btf_find_kptr(const struct btf *btf, const struct btf_type *t, + u32 off, int sz, struct btf_field_info *info) +{ + u32 res_id; + + /* For PTR, sz is always =3D=3D 8 */ + if (!btf_type_is_ptr(t)) + return BTF_FIELD_IGNORE; + t =3D btf_type_by_id(btf, t->type); + + if (!btf_type_is_type_tag(t)) + return BTF_FIELD_IGNORE; + /* Reject extra tags */ + if (btf_type_is_type_tag(btf_type_by_id(btf, t->type))) + return -EINVAL; + if (strcmp("kptr", __btf_name_by_offset(btf, t->name_off))) + return -EINVAL; + + /* Get the base type */ + t =3D btf_type_skip_modifiers(btf, t->type, &res_id); + /* Only pointer to struct is allowed */ + if (!__btf_type_is_struct(t)) + return -EINVAL; + + info->type_id =3D res_id; + info->off =3D off; + return BTF_FIELD_FOUND; } =20 static int btf_find_struct_field(const struct btf *btf, const struct btf_t= ype *t, const char *name, int sz, int align, enum btf_field_type field_type, - struct btf_field_info *info) + struct btf_field_info *info, int info_cnt) { const struct btf_member *member; + struct btf_field_info tmp; + int ret, idx =3D 0; u32 i, off; =20 for_each_member(i, t, member) { const struct btf_type *member_type =3D btf_type_by_id(btf, member->type); =20 - if (strcmp(__btf_name_by_offset(btf, member_type->name_off), name)) + if (name && strcmp(__btf_name_by_offset(btf, member_type->name_off), nam= e)) continue; =20 off =3D __btf_member_bit_offset(t, member); @@ -3212,20 +3247,38 @@ static int btf_find_struct_field(const struct btf *= btf, const struct btf_type *t switch (field_type) { case BTF_FIELD_SPIN_LOCK: case BTF_FIELD_TIMER: - return btf_find_struct(btf, member_type, off, sz, info); + ret =3D btf_find_struct(btf, member_type, off, sz, + idx < info_cnt ? &info[idx] : &tmp); + if (ret < 0) + return ret; + break; + case BTF_FIELD_KPTR: + ret =3D btf_find_kptr(btf, member_type, off, sz, + idx < info_cnt ? &info[idx] : &tmp); + if (ret < 0) + return ret; + break; default: return -EFAULT; } + + if (ret =3D=3D BTF_FIELD_IGNORE) + continue; + if (idx >=3D info_cnt) + return -E2BIG; + ++idx; } - return 0; + return idx; } =20 static int btf_find_datasec_var(const struct btf *btf, const struct btf_ty= pe *t, const char *name, int sz, int align, enum btf_field_type field_type, - struct btf_field_info *info) + struct btf_field_info *info, int info_cnt) { const struct btf_var_secinfo *vsi; + struct btf_field_info tmp; + int ret, idx =3D 0; u32 i, off; =20 for_each_vsi(i, t, vsi) { @@ -3234,7 +3287,7 @@ static int btf_find_datasec_var(const struct btf *btf= , const struct btf_type *t, =20 off =3D vsi->offset; =20 - if (strcmp(__btf_name_by_offset(btf, var_type->name_off), name)) + if (name && strcmp(__btf_name_by_offset(btf, var_type->name_off), name)) continue; if (vsi->size !=3D sz) continue; @@ -3244,17 +3297,33 @@ static int btf_find_datasec_var(const struct btf *b= tf, const struct btf_type *t, switch (field_type) { case BTF_FIELD_SPIN_LOCK: case BTF_FIELD_TIMER: - return btf_find_struct(btf, var_type, off, sz, info); + ret =3D btf_find_struct(btf, var_type, off, sz, + idx < info_cnt ? &info[idx] : &tmp); + if (ret < 0) + return ret; + break; + case BTF_FIELD_KPTR: + ret =3D btf_find_kptr(btf, var_type, off, sz, + idx < info_cnt ? &info[idx] : &tmp); + if (ret < 0) + return ret; + break; default: return -EFAULT; } + + if (ret =3D=3D BTF_FIELD_IGNORE) + continue; + if (idx >=3D info_cnt) + return -E2BIG; + ++idx; } - return 0; + return idx; } =20 static int btf_find_field(const struct btf *btf, const struct btf_type *t, enum btf_field_type field_type, - struct btf_field_info *info) + struct btf_field_info *info, int info_cnt) { const char *name; int sz, align; @@ -3270,14 +3339,19 @@ static int btf_find_field(const struct btf *btf, co= nst struct btf_type *t, sz =3D sizeof(struct bpf_timer); align =3D __alignof__(struct bpf_timer); break; + case BTF_FIELD_KPTR: + name =3D NULL; + sz =3D sizeof(u64); + align =3D 8; + break; default: return -EFAULT; } =20 if (__btf_type_is_struct(t)) - return btf_find_struct_field(btf, t, name, sz, align, field_type, info); + return btf_find_struct_field(btf, t, name, sz, align, field_type, info, = info_cnt); else if (btf_type_is_datasec(t)) - return btf_find_datasec_var(btf, t, name, sz, align, field_type, info); + return btf_find_datasec_var(btf, t, name, sz, align, field_type, info, i= nfo_cnt); return -EINVAL; } =20 @@ -3287,26 +3361,77 @@ static int btf_find_field(const struct btf *btf, co= nst struct btf_type *t, */ int btf_find_spin_lock(const struct btf *btf, const struct btf_type *t) { - struct btf_field_info info =3D { .off =3D -ENOENT }; + struct btf_field_info info; int ret; =20 - ret =3D btf_find_field(btf, t, BTF_FIELD_SPIN_LOCK, &info); + ret =3D btf_find_field(btf, t, BTF_FIELD_SPIN_LOCK, &info, 1); if (ret < 0) return ret; + if (!ret) + return -ENOENT; return info.off; } =20 int btf_find_timer(const struct btf *btf, const struct btf_type *t) { - struct btf_field_info info =3D { .off =3D -ENOENT }; + struct btf_field_info info; int ret; =20 - ret =3D btf_find_field(btf, t, BTF_FIELD_TIMER, &info); + ret =3D btf_find_field(btf, t, BTF_FIELD_TIMER, &info, 1); if (ret < 0) return ret; + if (!ret) + return -ENOENT; return info.off; } =20 +struct bpf_map_value_off *btf_parse_kptrs(const struct btf *btf, + const struct btf_type *t) +{ + struct btf_field_info info_arr[BPF_MAP_VALUE_OFF_MAX]; + struct bpf_map_value_off *tab; + struct btf *kernel_btf =3D NULL; + int ret, i, nr_off; + + ret =3D btf_find_field(btf, t, BTF_FIELD_KPTR, info_arr, ARRAY_SIZE(info_= arr)); + if (ret < 0) + return ERR_PTR(ret); + if (!ret) + return NULL; + + nr_off =3D ret; + tab =3D kzalloc(offsetof(struct bpf_map_value_off, off[nr_off]), GFP_KERN= EL | __GFP_NOWARN); + if (!tab) + return ERR_PTR(-ENOMEM); + + for (i =3D 0; i < nr_off; i++) { + const struct btf_type *t; + s32 id; + + /* Find type in map BTF, and use it to look up the matching type + * in vmlinux or module BTFs, by name and kind. + */ + t =3D btf_type_by_id(btf, info_arr[i].type_id); + id =3D bpf_find_btf_id(__btf_name_by_offset(btf, t->name_off), BTF_INFO_= KIND(t->info), + &kernel_btf); + if (id < 0) { + ret =3D id; + goto end; + } + + tab->off[i].offset =3D info_arr[i].off; + tab->off[i].kptr.btf_id =3D id; + tab->off[i].kptr.btf =3D kernel_btf; + } + tab->nr_off =3D nr_off; + return tab; +end: + while (i--) + btf_put(tab->off[i].kptr.btf); + kfree(tab); + return ERR_PTR(ret); +} + static void __btf_struct_show(const struct btf *btf, const struct btf_type= *t, u32 type_id, void *data, u8 bits_offset, struct btf_show *show) diff --git a/kernel/bpf/map_in_map.c b/kernel/bpf/map_in_map.c index 5cd8f5277279..135205d0d560 100644 --- a/kernel/bpf/map_in_map.c +++ b/kernel/bpf/map_in_map.c @@ -52,6 +52,7 @@ struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd) inner_map_meta->max_entries =3D inner_map->max_entries; inner_map_meta->spin_lock_off =3D inner_map->spin_lock_off; inner_map_meta->timer_off =3D inner_map->timer_off; + inner_map_meta->kptr_off_tab =3D bpf_map_copy_kptr_off_tab(inner_map); if (inner_map->btf) { btf_get(inner_map->btf); inner_map_meta->btf =3D inner_map->btf; @@ -71,6 +72,7 @@ struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd) =20 void bpf_map_meta_free(struct bpf_map *map_meta) { + bpf_map_free_kptr_off_tab(map_meta); btf_put(map_meta->btf); kfree(map_meta); } @@ -83,7 +85,8 @@ bool bpf_map_meta_equal(const struct bpf_map *meta0, meta0->key_size =3D=3D meta1->key_size && meta0->value_size =3D=3D meta1->value_size && meta0->timer_off =3D=3D meta1->timer_off && - meta0->map_flags =3D=3D meta1->map_flags; + meta0->map_flags =3D=3D meta1->map_flags && + bpf_map_equal_kptr_off_tab(meta0, meta1); } =20 void *bpf_map_fd_get_ptr(struct bpf_map *map, diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 3078c0c9317f..dc49bd880ac0 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -473,12 +474,84 @@ static void bpf_map_release_memcg(struct bpf_map *map) } #endif =20 +static int bpf_map_kptr_off_cmp(const void *a, const void *b) +{ + const struct bpf_map_value_off_desc *off_desc1 =3D a, *off_desc2 =3D b; + + if (off_desc1->offset < off_desc2->offset) + return -1; + else if (off_desc1->offset > off_desc2->offset) + return 1; + return 0; +} + +struct bpf_map_value_off_desc *bpf_map_kptr_off_contains(struct bpf_map *m= ap, u32 offset) +{ + /* Since members are iterated in btf_find_field in increasing order, + * offsets appended to kptr_off_tab are in increasing order, so we can + * do bsearch to find exact match. + */ + struct bpf_map_value_off *tab; + + if (!map_value_has_kptrs(map)) + return NULL; + tab =3D map->kptr_off_tab; + return bsearch(&offset, tab->off, tab->nr_off, sizeof(tab->off[0]), bpf_m= ap_kptr_off_cmp); +} + +void bpf_map_free_kptr_off_tab(struct bpf_map *map) +{ + struct bpf_map_value_off *tab =3D map->kptr_off_tab; + int i; + + if (!map_value_has_kptrs(map)) + return; + for (i =3D 0; i < tab->nr_off; i++) + btf_put(tab->off[i].kptr.btf); + kfree(tab); + map->kptr_off_tab =3D NULL; +} + +struct bpf_map_value_off *bpf_map_copy_kptr_off_tab(const struct bpf_map *= map) +{ + struct bpf_map_value_off *tab =3D map->kptr_off_tab, *new_tab; + int size, i; + + if (!map_value_has_kptrs(map)) + return ERR_PTR(-ENOENT); + size =3D offsetof(struct bpf_map_value_off, off[tab->nr_off]); + new_tab =3D kmemdup(tab, size, GFP_KERNEL | __GFP_NOWARN); + if (!new_tab) + return ERR_PTR(-ENOMEM); + /* Do a deep copy of the kptr_off_tab */ + for (i =3D 0; i < tab->nr_off; i++) + btf_get(tab->off[i].kptr.btf); + return new_tab; +} + +bool bpf_map_equal_kptr_off_tab(const struct bpf_map *map_a, const struct = bpf_map *map_b) +{ + struct bpf_map_value_off *tab_a =3D map_a->kptr_off_tab, *tab_b =3D map_b= ->kptr_off_tab; + bool a_has_kptr =3D map_value_has_kptrs(map_a), b_has_kptr =3D map_value_= has_kptrs(map_b); + int size; + + if (!a_has_kptr && !b_has_kptr) + return true; + if (a_has_kptr !=3D b_has_kptr) + return false; + if (tab_a->nr_off !=3D tab_b->nr_off) + return false; + size =3D offsetof(struct bpf_map_value_off, off[tab_a->nr_off]); + return !memcmp(tab_a, tab_b, size); +} + /* called from workqueue */ static void bpf_map_free_deferred(struct work_struct *work) { struct bpf_map *map =3D container_of(work, struct bpf_map, work); =20 security_bpf_map_free(map); + bpf_map_free_kptr_off_tab(map); bpf_map_release_memcg(map); /* implementation dependent freeing */ map->ops->map_free(map); @@ -640,7 +713,7 @@ static int bpf_map_mmap(struct file *filp, struct vm_ar= ea_struct *vma) int err; =20 if (!map->ops->map_mmap || map_value_has_spin_lock(map) || - map_value_has_timer(map)) + map_value_has_timer(map) || map_value_has_kptrs(map)) return -ENOTSUPP; =20 if (!(vma->vm_flags & VM_SHARED)) @@ -820,9 +893,33 @@ static int map_check_btf(struct bpf_map *map, const st= ruct btf *btf, return -EOPNOTSUPP; } =20 - if (map->ops->map_check_btf) + map->kptr_off_tab =3D btf_parse_kptrs(btf, value_type); + if (map_value_has_kptrs(map)) { + if (!bpf_capable()) { + ret =3D -EPERM; + goto free_map_tab; + } + if (map->map_flags & (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG)) { + ret =3D -EACCES; + goto free_map_tab; + } + if (map->map_type !=3D BPF_MAP_TYPE_HASH && + map->map_type !=3D BPF_MAP_TYPE_LRU_HASH && + map->map_type !=3D BPF_MAP_TYPE_ARRAY) { + ret =3D -EOPNOTSUPP; + goto free_map_tab; + } + } + + if (map->ops->map_check_btf) { ret =3D map->ops->map_check_btf(map, btf, key_type, value_type); + if (ret < 0) + goto free_map_tab; + } =20 + return ret; +free_map_tab: + bpf_map_free_kptr_off_tab(map); return ret; } =20 @@ -1639,7 +1736,7 @@ static int map_freeze(const union bpf_attr *attr) return PTR_ERR(map); =20 if (map->map_type =3D=3D BPF_MAP_TYPE_STRUCT_OPS || - map_value_has_timer(map)) { + map_value_has_timer(map) || map_value_has_kptrs(map)) { fdput(f); return -ENOTSUPP; } diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index afa05e6cd78f..b8d1060153c8 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -3210,7 +3210,7 @@ static int check_stack_read_fixed_off(struct bpf_veri= fier_env *env, return 0; } =20 -enum stack_access_src { +enum bpf_access_src { ACCESS_DIRECT =3D 1, /* the access is performed by an instruction */ ACCESS_HELPER =3D 2, /* the access is performed by a helper */ }; @@ -3218,7 +3218,7 @@ enum stack_access_src { static int check_stack_range_initialized(struct bpf_verifier_env *env, int regno, int off, int access_size, bool zero_size_allowed, - enum stack_access_src type, + enum bpf_access_src type, struct bpf_call_arg_meta *meta); =20 static struct bpf_reg_state *reg_state(struct bpf_verifier_env *env, int r= egno) @@ -3506,9 +3506,109 @@ int check_ptr_off_reg(struct bpf_verifier_env *env, return __check_ptr_off_reg(env, reg, regno, false); } =20 +static int map_kptr_match_type(struct bpf_verifier_env *env, + struct bpf_map_value_off_desc *off_desc, + struct bpf_reg_state *reg, u32 regno) +{ + const char *targ_name =3D kernel_type_name(off_desc->kptr.btf, off_desc->= kptr.btf_id); + const char *reg_name =3D ""; + + if (base_type(reg->type) !=3D PTR_TO_BTF_ID || type_flag(reg->type) !=3D = PTR_MAYBE_NULL) + goto bad_type; + + if (!btf_is_kernel(reg->btf)) { + verbose(env, "R%d must point to kernel BTF\n", regno); + return -EINVAL; + } + /* We need to verify reg->type and reg->btf, before accessing reg->btf */ + reg_name =3D kernel_type_name(reg->btf, reg->btf_id); + + if (__check_ptr_off_reg(env, reg, regno, true)) + return -EACCES; + + /* A full type match is needed, as BTF can be vmlinux or module BTF, and + * we also need to take into account the reg->off. + * + * We want to support cases like: + * + * struct foo { + * struct bar br; + * struct baz bz; + * }; + * + * struct foo *v; + * v =3D func(); // PTR_TO_BTF_ID + * val->foo =3D v; // reg->off is zero, btf and btf_id match type + * val->bar =3D &v->br; // reg->off is still zero, but we need to retry w= ith + * // first member type of struct after comparison fai= ls + * val->baz =3D &v->bz; // reg->off is non-zero, so struct needs to be wa= lked + * // to match type + * + * In the kptr_ref case, check_func_arg_reg_off already ensures reg->off + * is zero. + */ + if (!btf_struct_ids_match(&env->log, reg->btf, reg->btf_id, reg->off, + off_desc->kptr.btf, off_desc->kptr.btf_id)) + goto bad_type; + return 0; +bad_type: + verbose(env, "invalid kptr access, R%d type=3D%s%s ", regno, + reg_type_str(env, reg->type), reg_name); + verbose(env, "expected=3D%s%s\n", reg_type_str(env, PTR_TO_BTF_ID), targ_= name); + return -EINVAL; +} + +static int check_map_kptr_access(struct bpf_verifier_env *env, u32 regno, + int value_regno, int insn_idx, + struct bpf_map_value_off_desc *off_desc) +{ + struct bpf_insn *insn =3D &env->prog->insnsi[insn_idx]; + int class =3D BPF_CLASS(insn->code); + struct bpf_reg_state *val_reg; + + /* Things we already checked for in check_map_access and caller: + * - Reject cases where variable offset may touch kptr + * - size of access (must be BPF_DW) + * - tnum_is_const(reg->var_off) + * - off_desc->offset =3D=3D off + reg->var_off.value + */ + /* Only BPF_[LDX,STX,ST] | BPF_MEM | BPF_DW is supported */ + if (BPF_MODE(insn->code) !=3D BPF_MEM) { + verbose(env, "kptr in map can only be accessed using BPF_MEM instruction= mode\n"); + return -EACCES; + } + + if (class =3D=3D BPF_LDX) { + val_reg =3D reg_state(env, value_regno); + /* We can simply mark the value_regno receiving the pointer + * value from map as PTR_TO_BTF_ID, with the correct type. + */ + mark_btf_ld_reg(env, cur_regs(env), value_regno, PTR_TO_BTF_ID, off_desc= ->kptr.btf, + off_desc->kptr.btf_id, PTR_MAYBE_NULL); + /* For mark_ptr_or_null_reg */ + val_reg->id =3D ++env->id_gen; + } else if (class =3D=3D BPF_STX) { + val_reg =3D reg_state(env, value_regno); + if (!register_is_null(val_reg) && + map_kptr_match_type(env, off_desc, val_reg, value_regno)) + return -EACCES; + } else if (class =3D=3D BPF_ST) { + if (insn->imm) { + verbose(env, "BPF_ST imm must be 0 when storing to kptr at off=3D%u\n", + off_desc->offset); + return -EACCES; + } + } else { + verbose(env, "kptr in map can only be accessed using BPF_LDX/BPF_STX/BPF= _ST\n"); + return -EACCES; + } + return 0; +} + /* check read/write into a map element with possible variable offset */ static int check_map_access(struct bpf_verifier_env *env, u32 regno, - int off, int size, bool zero_size_allowed) + int off, int size, bool zero_size_allowed, + enum bpf_access_src src) { struct bpf_verifier_state *vstate =3D env->cur_state; struct bpf_func_state *state =3D vstate->frame[vstate->curframe]; @@ -3544,6 +3644,36 @@ static int check_map_access(struct bpf_verifier_env = *env, u32 regno, return -EACCES; } } + if (map_value_has_kptrs(map)) { + struct bpf_map_value_off *tab =3D map->kptr_off_tab; + int i; + + for (i =3D 0; i < tab->nr_off; i++) { + u32 p =3D tab->off[i].offset; + + if (reg->smin_value + off < p + sizeof(u64) && + p < reg->umax_value + off + size) { + if (src !=3D ACCESS_DIRECT) { + verbose(env, "kptr cannot be accessed indirectly by helper\n"); + return -EACCES; + } + if (!tnum_is_const(reg->var_off)) { + verbose(env, "kptr access cannot have variable offset\n"); + return -EACCES; + } + if (p !=3D off + reg->var_off.value) { + verbose(env, "kptr access misaligned expected=3D%u off=3D%llu\n", + p, off + reg->var_off.value); + return -EACCES; + } + if (size !=3D bpf_size_to_bytes(BPF_DW)) { + verbose(env, "kptr access size must be BPF_DW\n"); + return -EACCES; + } + break; + } + } + } return err; } =20 @@ -4315,7 +4445,7 @@ static int check_stack_slot_within_bounds(int off, static int check_stack_access_within_bounds( struct bpf_verifier_env *env, int regno, int off, int access_size, - enum stack_access_src src, enum bpf_access_type type) + enum bpf_access_src src, enum bpf_access_type type) { struct bpf_reg_state *regs =3D cur_regs(env); struct bpf_reg_state *reg =3D regs + regno; @@ -4411,6 +4541,8 @@ static int check_mem_access(struct bpf_verifier_env *= env, int insn_idx, u32 regn if (value_regno >=3D 0) mark_reg_unknown(env, regs, value_regno); } else if (reg->type =3D=3D PTR_TO_MAP_VALUE) { + struct bpf_map_value_off_desc *kptr_off_desc =3D NULL; + if (t =3D=3D BPF_WRITE && value_regno >=3D 0 && is_pointer_value(env, value_regno)) { verbose(env, "R%d leaks addr into map\n", value_regno); @@ -4419,8 +4551,16 @@ static int check_mem_access(struct bpf_verifier_env = *env, int insn_idx, u32 regn err =3D check_map_access_type(env, regno, off, size, t); if (err) return err; - err =3D check_map_access(env, regno, off, size, false); - if (!err && t =3D=3D BPF_READ && value_regno >=3D 0) { + err =3D check_map_access(env, regno, off, size, false, ACCESS_DIRECT); + if (err) + return err; + if (tnum_is_const(reg->var_off)) + kptr_off_desc =3D bpf_map_kptr_off_contains(reg->map_ptr, + off + reg->var_off.value); + if (kptr_off_desc) { + err =3D check_map_kptr_access(env, regno, value_regno, insn_idx, + kptr_off_desc); + } else if (t =3D=3D BPF_READ && value_regno >=3D 0) { struct bpf_map *map =3D reg->map_ptr; =20 /* if map is read-only, track its contents as scalars */ @@ -4723,7 +4863,7 @@ static int check_atomic(struct bpf_verifier_env *env,= int insn_idx, struct bpf_i static int check_stack_range_initialized( struct bpf_verifier_env *env, int regno, int off, int access_size, bool zero_size_allowed, - enum stack_access_src type, struct bpf_call_arg_meta *meta) + enum bpf_access_src type, struct bpf_call_arg_meta *meta) { struct bpf_reg_state *reg =3D reg_state(env, regno); struct bpf_func_state *state =3D func(env, reg); @@ -4873,7 +5013,7 @@ static int check_helper_mem_access(struct bpf_verifie= r_env *env, int regno, BPF_READ)) return -EACCES; return check_map_access(env, regno, reg->off, access_size, - zero_size_allowed); + zero_size_allowed, ACCESS_HELPER); case PTR_TO_MEM: if (type_is_rdonly_mem(reg->type)) { if (meta && meta->raw_mode) { @@ -5641,7 +5781,8 @@ static int check_func_arg(struct bpf_verifier_env *en= v, u32 arg, } =20 err =3D check_map_access(env, regno, reg->off, - map->value_size - reg->off, false); + map->value_size - reg->off, false, + ACCESS_HELPER); if (err) return err; =20 @@ -7460,7 +7601,7 @@ static int sanitize_check_bounds(struct bpf_verifier_= env *env, return -EACCES; break; case PTR_TO_MAP_VALUE: - if (check_map_access(env, dst, dst_reg->off, 1, false)) { + if (check_map_access(env, dst, dst_reg->off, 1, false, ACCESS_HELPER)) { verbose(env, "R%d pointer arithmetic of map value goes out of range, " "prohibited for !root\n", dst); return -EACCES; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 954D2C00140 for ; Mon, 15 Aug 2022 21:18:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346027AbiHOVSB (ORCPT ); Mon, 15 Aug 2022 17:18:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348214AbiHOVIT (ORCPT ); Mon, 15 Aug 2022 17:08:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3BDB52FD0; Mon, 15 Aug 2022 12:18:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 20C67B8110A; Mon, 15 Aug 2022 19:18:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50021C433D6; Mon, 15 Aug 2022 19:18:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591114; bh=AiL8C4bcc+DV1FzeQRqw5uNlFaO1A51bBlHx9EuX62o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ygE+KI2PtKf5a6j1bOhVgQVql+ktUTox0/XTN/ISKNKwPBHUgY4XlKOESkjL8hpOG yOGnPZHtYZiYxl8BvoCtchVhzS3/2Ym1VkaK0RW5d1Mfp3/GVegFFUtEQ6A6Ttej8u WGxf2NpQpoDN24iAI7MCAeZU8EuTxWM+PvKmeHtk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kumar Kartikeya Dwivedi , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.18 0477/1095] bpf: Tag argument to be released in bpf_func_proto Date: Mon, 15 Aug 2022 19:57:56 +0200 Message-Id: <20220815180449.318005835@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kumar Kartikeya Dwivedi [ Upstream commit 8f14852e89113d738c99c375b4c8b8b7e1073df1 ] Add a new type flag for bpf_arg_type that when set tells verifier that for a release function, that argument's register will be the one for which meta.ref_obj_id will be set, and which will then be released using release_reference. To capture the regno, introduce a new field release_regno in bpf_call_arg_meta. This would be required in the next patch, where we may either pass NULL or a refcounted pointer as an argument to the release function bpf_kptr_xchg. Just releasing only when meta.ref_obj_id is set is not enough, as there is a case where the type of argument needed matches, but the ref_obj_id is set to 0. Hence, we must enforce that whenever meta.ref_obj_id is zero, the register that is to be released can only be NULL for a release function. Since we now indicate whether an argument is to be released in bpf_func_proto itself, is_release_function helper has lost its utitlity, hence refactor code to work without it, and just rely on meta.release_regno to know when to release state for a ref_obj_id. Still, the restriction of one release argument and only one ref_obj_id passed to BPF helper or kfunc remains. This may be lifted in the future. Signed-off-by: Kumar Kartikeya Dwivedi Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20220424214901.2743946-3-memxor@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/bpf.h | 5 +- include/linux/bpf_verifier.h | 3 +- kernel/bpf/btf.c | 11 ++- kernel/bpf/ringbuf.c | 4 +- kernel/bpf/verifier.c | 76 +++++++++++-------- net/core/filter.c | 2 +- .../selftests/bpf/verifier/ref_tracking.c | 2 +- tools/testing/selftests/bpf/verifier/sock.c | 6 +- 8 files changed, 60 insertions(+), 49 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 00d55c10d876..2feae4a24d99 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -366,7 +366,10 @@ enum bpf_type_flag { */ MEM_PERCPU =3D BIT(4 + BPF_BASE_TYPE_BITS), =20 - __BPF_TYPE_LAST_FLAG =3D MEM_PERCPU, + /* Indicates that the argument will be released. */ + OBJ_RELEASE =3D BIT(5 + BPF_BASE_TYPE_BITS), + + __BPF_TYPE_LAST_FLAG =3D OBJ_RELEASE, }; =20 /* Max number of base types. */ diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index 3a9d2d7cc6b7..1f1e7f2ea967 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h @@ -523,8 +523,7 @@ int check_ptr_off_reg(struct bpf_verifier_env *env, const struct bpf_reg_state *reg, int regno); int check_func_arg_reg_off(struct bpf_verifier_env *env, const struct bpf_reg_state *reg, int regno, - enum bpf_arg_type arg_type, - bool is_release_func); + enum bpf_arg_type arg_type); int check_kfunc_mem_size_reg(struct bpf_verifier_env *env, struct bpf_reg_= state *reg, u32 regno); int check_mem_reg(struct bpf_verifier_env *env, struct bpf_reg_state *reg, diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index cbb48eb8c009..752de8112206 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -5994,6 +5994,7 @@ static int btf_check_func_arg_match(struct bpf_verifi= er_env *env, * verifier sees. */ for (i =3D 0; i < nargs; i++) { + enum bpf_arg_type arg_type =3D ARG_DONTCARE; u32 regno =3D i + 1; struct bpf_reg_state *reg =3D ®s[regno]; =20 @@ -6014,7 +6015,9 @@ static int btf_check_func_arg_match(struct bpf_verifi= er_env *env, ref_t =3D btf_type_skip_modifiers(btf, t->type, &ref_id); ref_tname =3D btf_name_by_offset(btf, ref_t->name_off); =20 - ret =3D check_func_arg_reg_off(env, reg, regno, ARG_DONTCARE, rel); + if (rel && reg->ref_obj_id) + arg_type |=3D OBJ_RELEASE; + ret =3D check_func_arg_reg_off(env, reg, regno, arg_type); if (ret < 0) return ret; =20 @@ -6045,11 +6048,7 @@ static int btf_check_func_arg_match(struct bpf_verif= ier_env *env, if (reg->type =3D=3D PTR_TO_BTF_ID) { reg_btf =3D reg->btf; reg_ref_id =3D reg->btf_id; - /* Ensure only one argument is referenced - * PTR_TO_BTF_ID, check_func_arg_reg_off relies - * on only one referenced register being allowed - * for kfuncs. - */ + /* Ensure only one argument is referenced PTR_TO_BTF_ID */ if (reg->ref_obj_id) { if (ref_obj_id) { bpf_log(log, "verifier internal error: more than one arg with ref_ob= j_id R%d %u %u\n", diff --git a/kernel/bpf/ringbuf.c b/kernel/bpf/ringbuf.c index 710ba9de12ce..5173fd37590f 100644 --- a/kernel/bpf/ringbuf.c +++ b/kernel/bpf/ringbuf.c @@ -404,7 +404,7 @@ BPF_CALL_2(bpf_ringbuf_submit, void *, sample, u64, fla= gs) const struct bpf_func_proto bpf_ringbuf_submit_proto =3D { .func =3D bpf_ringbuf_submit, .ret_type =3D RET_VOID, - .arg1_type =3D ARG_PTR_TO_ALLOC_MEM, + .arg1_type =3D ARG_PTR_TO_ALLOC_MEM | OBJ_RELEASE, .arg2_type =3D ARG_ANYTHING, }; =20 @@ -417,7 +417,7 @@ BPF_CALL_2(bpf_ringbuf_discard, void *, sample, u64, fl= ags) const struct bpf_func_proto bpf_ringbuf_discard_proto =3D { .func =3D bpf_ringbuf_discard, .ret_type =3D RET_VOID, - .arg1_type =3D ARG_PTR_TO_ALLOC_MEM, + .arg1_type =3D ARG_PTR_TO_ALLOC_MEM | OBJ_RELEASE, .arg2_type =3D ARG_ANYTHING, }; =20 diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index b8d1060153c8..4f19a86c2682 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -245,6 +245,7 @@ struct bpf_call_arg_meta { struct bpf_map *map_ptr; bool raw_mode; bool pkt_access; + u8 release_regno; int regno; int access_size; int mem_size; @@ -471,17 +472,6 @@ static bool type_may_be_null(u32 type) return type & PTR_MAYBE_NULL; } =20 -/* Determine whether the function releases some resources allocated by ano= ther - * function call. The first reference type argument will be assumed to be - * released by release_reference(). - */ -static bool is_release_function(enum bpf_func_id func_id) -{ - return func_id =3D=3D BPF_FUNC_sk_release || - func_id =3D=3D BPF_FUNC_ringbuf_submit || - func_id =3D=3D BPF_FUNC_ringbuf_discard; -} - static bool may_be_acquire_function(enum bpf_func_id func_id) { return func_id =3D=3D BPF_FUNC_sk_lookup_tcp || @@ -5325,6 +5315,11 @@ static bool arg_type_is_int_ptr(enum bpf_arg_type ty= pe) type =3D=3D ARG_PTR_TO_LONG; } =20 +static bool arg_type_is_release(enum bpf_arg_type type) +{ + return type & OBJ_RELEASE; +} + static int int_ptr_type_to_size(enum bpf_arg_type type) { if (type =3D=3D ARG_PTR_TO_INT) @@ -5535,11 +5530,10 @@ static int check_reg_type(struct bpf_verifier_env *= env, u32 regno, =20 int check_func_arg_reg_off(struct bpf_verifier_env *env, const struct bpf_reg_state *reg, int regno, - enum bpf_arg_type arg_type, - bool is_release_func) + enum bpf_arg_type arg_type) { - bool fixed_off_ok =3D false, release_reg; enum bpf_reg_type type =3D reg->type; + bool fixed_off_ok =3D false; =20 switch ((u32)type) { case SCALAR_VALUE: @@ -5557,7 +5551,7 @@ int check_func_arg_reg_off(struct bpf_verifier_env *e= nv, /* Some of the argument types nevertheless require a * zero register offset. */ - if (arg_type !=3D ARG_PTR_TO_ALLOC_MEM) + if (base_type(arg_type) !=3D ARG_PTR_TO_ALLOC_MEM) return 0; break; /* All the rest must be rejected, except PTR_TO_BTF_ID which allows @@ -5565,19 +5559,17 @@ int check_func_arg_reg_off(struct bpf_verifier_env = *env, */ case PTR_TO_BTF_ID: /* When referenced PTR_TO_BTF_ID is passed to release function, - * it's fixed offset must be 0. We rely on the property that - * only one referenced register can be passed to BPF helpers and - * kfuncs. In the other cases, fixed offset can be non-zero. + * it's fixed offset must be 0. In the other cases, fixed offset + * can be non-zero. */ - release_reg =3D is_release_func && reg->ref_obj_id; - if (release_reg && reg->off) { + if (arg_type_is_release(arg_type) && reg->off) { verbose(env, "R%d must have zero offset when passed to release func\n", regno); return -EINVAL; } - /* For release_reg =3D=3D true, fixed_off_ok must be false, but we - * already checked and rejected reg->off !=3D 0 above, so set to - * true to allow fixed offset for all other cases. + /* For arg is release pointer, fixed_off_ok must be false, but + * we already checked and rejected reg->off !=3D 0 above, so set + * to true to allow fixed offset for all other cases. */ fixed_off_ok =3D true; break; @@ -5636,14 +5628,24 @@ static int check_func_arg(struct bpf_verifier_env *= env, u32 arg, if (err) return err; =20 - err =3D check_func_arg_reg_off(env, reg, regno, arg_type, is_release_func= tion(meta->func_id)); + err =3D check_func_arg_reg_off(env, reg, regno, arg_type); if (err) return err; =20 skip_type_check: - /* check_func_arg_reg_off relies on only one referenced register being - * allowed for BPF helpers. - */ + if (arg_type_is_release(arg_type)) { + if (!reg->ref_obj_id && !register_is_null(reg)) { + verbose(env, "R%d must be referenced when passed to release function\n", + regno); + return -EINVAL; + } + if (meta->release_regno) { + verbose(env, "verifier internal error: more than one release argument\n= "); + return -EFAULT; + } + meta->release_regno =3D regno; + } + if (reg->ref_obj_id) { if (meta->ref_obj_id) { verbose(env, "verifier internal error: more than one arg with ref_obj_i= d R%d %u %u\n", @@ -6151,7 +6153,8 @@ static bool check_btf_id_ok(const struct bpf_func_pro= to *fn) return true; } =20 -static int check_func_proto(const struct bpf_func_proto *fn, int func_id) +static int check_func_proto(const struct bpf_func_proto *fn, int func_id, + struct bpf_call_arg_meta *meta) { return check_raw_mode_ok(fn) && check_arg_pair_ok(fn) && @@ -6833,7 +6836,7 @@ static int check_helper_call(struct bpf_verifier_env = *env, struct bpf_insn *insn memset(&meta, 0, sizeof(meta)); meta.pkt_access =3D fn->pkt_access; =20 - err =3D check_func_proto(fn, func_id); + err =3D check_func_proto(fn, func_id, &meta); if (err) { verbose(env, "kernel subsystem misconfigured func %s#%d\n", func_id_name(func_id), func_id); @@ -6866,8 +6869,17 @@ static int check_helper_call(struct bpf_verifier_env= *env, struct bpf_insn *insn return err; } =20 - if (is_release_function(func_id)) { - err =3D release_reference(env, meta.ref_obj_id); + regs =3D cur_regs(env); + + if (meta.release_regno) { + err =3D -EINVAL; + if (meta.ref_obj_id) + err =3D release_reference(env, meta.ref_obj_id); + /* meta.ref_obj_id can only be 0 if register that is meant to be + * released is NULL, which must be > R0. + */ + else if (register_is_null(®s[meta.release_regno])) + err =3D 0; if (err) { verbose(env, "func %s#%d reference has not been acquired before\n", func_id_name(func_id), func_id); @@ -6875,8 +6887,6 @@ static int check_helper_call(struct bpf_verifier_env = *env, struct bpf_insn *insn } } =20 - regs =3D cur_regs(env); - switch (func_id) { case BPF_FUNC_tail_call: err =3D check_reference_leak(env); diff --git a/net/core/filter.c b/net/core/filter.c index d0b0c163d3f3..5db4fae23925 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -6642,7 +6642,7 @@ static const struct bpf_func_proto bpf_sk_release_pro= to =3D { .func =3D bpf_sk_release, .gpl_only =3D false, .ret_type =3D RET_INTEGER, - .arg1_type =3D ARG_PTR_TO_BTF_ID_SOCK_COMMON, + .arg1_type =3D ARG_PTR_TO_BTF_ID_SOCK_COMMON | OBJ_RELEASE, }; =20 BPF_CALL_5(bpf_xdp_sk_lookup_udp, struct xdp_buff *, ctx, diff --git a/tools/testing/selftests/bpf/verifier/ref_tracking.c b/tools/te= sting/selftests/bpf/verifier/ref_tracking.c index fbd682520e47..57a83d763ec1 100644 --- a/tools/testing/selftests/bpf/verifier/ref_tracking.c +++ b/tools/testing/selftests/bpf/verifier/ref_tracking.c @@ -796,7 +796,7 @@ }, .prog_type =3D BPF_PROG_TYPE_SCHED_CLS, .result =3D REJECT, - .errstr =3D "reference has not been acquired before", + .errstr =3D "R1 must be referenced when passed to release function", }, { /* !bpf_sk_fullsock(sk) is checked but !bpf_tcp_sock(sk) is not checked */ diff --git a/tools/testing/selftests/bpf/verifier/sock.c b/tools/testing/se= lftests/bpf/verifier/sock.c index 86b24cad27a7..d11d0b28be41 100644 --- a/tools/testing/selftests/bpf/verifier/sock.c +++ b/tools/testing/selftests/bpf/verifier/sock.c @@ -417,7 +417,7 @@ }, .prog_type =3D BPF_PROG_TYPE_SCHED_CLS, .result =3D REJECT, - .errstr =3D "reference has not been acquired before", + .errstr =3D "R1 must be referenced when passed to release function", }, { "bpf_sk_release(bpf_sk_fullsock(skb->sk))", @@ -436,7 +436,7 @@ }, .prog_type =3D BPF_PROG_TYPE_SCHED_CLS, .result =3D REJECT, - .errstr =3D "reference has not been acquired before", + .errstr =3D "R1 must be referenced when passed to release function", }, { "bpf_sk_release(bpf_tcp_sock(skb->sk))", @@ -455,7 +455,7 @@ }, .prog_type =3D BPF_PROG_TYPE_SCHED_CLS, .result =3D REJECT, - .errstr =3D "reference has not been acquired before", + .errstr =3D "R1 must be referenced when passed to release function", }, { "sk_storage_get(map, skb->sk, NULL, 0): value =3D=3D NULL", --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B072FC282E7 for ; Mon, 15 Aug 2022 21:18:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346444AbiHOVSF (ORCPT ); Mon, 15 Aug 2022 17:18:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348240AbiHOVIX (ORCPT ); Mon, 15 Aug 2022 17:08:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97CE453D11; Mon, 15 Aug 2022 12:18:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A354B60FC4; Mon, 15 Aug 2022 19:18:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9783AC433D6; Mon, 15 Aug 2022 19:18:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591118; bh=63nKvukSJ5KMQCSCJzjVeq6AEWGIFlAgJoHRSgTer+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0EeJKXL5PsnEpiHaEbobHEt1f26AfQ7qaXydp7qEY/XeI5s0D0mXMTSD/1JvPza5B lVLl4bbrBxzA+rL7lsgCf5gZvCelARm54cZmlVJAqJ5RhSARjcUQWLdpegFDCSwX5T ozyGPPr3k+8HyuqAw8d9I+aXvTUEiI+KmSqQdu58= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kumar Kartikeya Dwivedi , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.18 0478/1095] bpf: Allow storing referenced kptr in map Date: Mon, 15 Aug 2022 19:57:57 +0200 Message-Id: <20220815180449.366002618@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kumar Kartikeya Dwivedi [ Upstream commit c0a5a21c25f37c9fd7b36072f9968cdff1e4aa13 ] Extending the code in previous commits, introduce referenced kptr support, which needs to be tagged using 'kptr_ref' tag instead. Unlike unreferenced kptr, referenced kptr have a lot more restrictions. In addition to the type matching, only a newly introduced bpf_kptr_xchg helper is allowed to modify the map value at that offset. This transfers the referenced pointer being stored into the map, releasing the references state for the program, and returning the old value and creating new reference state for the returned pointer. Similar to unreferenced pointer case, return value for this case will also be PTR_TO_BTF_ID_OR_NULL. The reference for the returned pointer must either be eventually released by calling the corresponding release function, otherwise it must be transferred into another map. It is also allowed to call bpf_kptr_xchg with a NULL pointer, to clear the value, and obtain the old value if any. BPF_LDX, BPF_STX, and BPF_ST cannot access referenced kptr. A future commit will permit using BPF_LDX for such pointers, but attempt at making it safe, since the lifetime of object won't be guaranteed. There are valid reasons to enforce the restriction of permitting only bpf_kptr_xchg to operate on referenced kptr. The pointer value must be consistent in face of concurrent modification, and any prior values contained in the map must also be released before a new one is moved into the map. To ensure proper transfer of this ownership, bpf_kptr_xchg returns the old value, which the verifier would require the user to either free or move into another map, and releases the reference held for the pointer being moved in. In the future, direct BPF_XCHG instruction may also be permitted to work like bpf_kptr_xchg helper. Note that process_kptr_func doesn't have to call check_helper_mem_access, since we already disallow rdonly/wronly flags for map, which is what check_map_access_type checks, and we already ensure the PTR_TO_MAP_VALUE refers to kptr by obtaining its off_desc, so check_map_access is also not required. Signed-off-by: Kumar Kartikeya Dwivedi Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20220424214901.2743946-4-memxor@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/bpf.h | 8 +++ include/uapi/linux/bpf.h | 12 +++++ kernel/bpf/btf.c | 10 +++- kernel/bpf/helpers.c | 24 +++++++++ kernel/bpf/verifier.c | 98 +++++++++++++++++++++++++++++----- tools/include/uapi/linux/bpf.h | 12 +++++ 6 files changed, 151 insertions(+), 13 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 2feae4a24d99..2f6e7fc474ea 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -160,8 +160,14 @@ enum { BPF_MAP_VALUE_OFF_MAX =3D 8, }; =20 +enum bpf_kptr_type { + BPF_KPTR_UNREF, + BPF_KPTR_REF, +}; + struct bpf_map_value_off_desc { u32 offset; + enum bpf_kptr_type type; struct { struct btf *btf; u32 btf_id; @@ -418,6 +424,7 @@ enum bpf_arg_type { ARG_PTR_TO_STACK, /* pointer to stack */ ARG_PTR_TO_CONST_STR, /* pointer to a null terminated read-only string */ ARG_PTR_TO_TIMER, /* pointer to bpf_timer */ + ARG_PTR_TO_KPTR, /* pointer to referenced kptr */ __BPF_ARG_TYPE_MAX, =20 /* Extended arg_types. */ @@ -427,6 +434,7 @@ enum bpf_arg_type { ARG_PTR_TO_SOCKET_OR_NULL =3D PTR_MAYBE_NULL | ARG_PTR_TO_SOCKET, ARG_PTR_TO_ALLOC_MEM_OR_NULL =3D PTR_MAYBE_NULL | ARG_PTR_TO_ALLOC_MEM, ARG_PTR_TO_STACK_OR_NULL =3D PTR_MAYBE_NULL | ARG_PTR_TO_STACK, + ARG_PTR_TO_BTF_ID_OR_NULL =3D PTR_MAYBE_NULL | ARG_PTR_TO_BTF_ID, =20 /* This must be the last entry. Its purpose is to ensure the enum is * wide enough to hold the higher bits reserved for bpf_type_flag. diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index a4f557338af7..ff9af73859ca 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -5144,6 +5144,17 @@ union bpf_attr { * The **hash_algo** is returned on success, * **-EOPNOTSUP** if the hash calculation failed or **-EINVAL** if * invalid arguments are passed. + * + * void *bpf_kptr_xchg(void *map_value, void *ptr) + * Description + * Exchange kptr at pointer *map_value* with *ptr*, and return the + * old value. *ptr* can be NULL, otherwise it must be a referenced + * pointer which will be released when this helper is called. + * Return + * The old value of kptr (which can be NULL). The returned pointer + * if not NULL, is a reference which must be released using its + * corresponding release function, or moved into a BPF map before + * program exit. */ #define __BPF_FUNC_MAPPER(FN) \ FN(unspec), \ @@ -5340,6 +5351,7 @@ union bpf_attr { FN(copy_from_user_task), \ FN(skb_set_tstamp), \ FN(ima_file_hash), \ + FN(kptr_xchg), \ /* */ =20 /* integer value in 'imm' field of BPF_CALL instruction selects which help= er diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 752de8112206..58fd6896c403 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -3177,6 +3177,7 @@ enum { struct btf_field_info { u32 type_id; u32 off; + enum bpf_kptr_type type; }; =20 static int btf_find_struct(const struct btf *btf, const struct btf_type *t, @@ -3193,6 +3194,7 @@ static int btf_find_struct(const struct btf *btf, con= st struct btf_type *t, static int btf_find_kptr(const struct btf *btf, const struct btf_type *t, u32 off, int sz, struct btf_field_info *info) { + enum bpf_kptr_type type; u32 res_id; =20 /* For PTR, sz is always =3D=3D 8 */ @@ -3205,7 +3207,11 @@ static int btf_find_kptr(const struct btf *btf, cons= t struct btf_type *t, /* Reject extra tags */ if (btf_type_is_type_tag(btf_type_by_id(btf, t->type))) return -EINVAL; - if (strcmp("kptr", __btf_name_by_offset(btf, t->name_off))) + if (!strcmp("kptr", __btf_name_by_offset(btf, t->name_off))) + type =3D BPF_KPTR_UNREF; + else if (!strcmp("kptr_ref", __btf_name_by_offset(btf, t->name_off))) + type =3D BPF_KPTR_REF; + else return -EINVAL; =20 /* Get the base type */ @@ -3216,6 +3222,7 @@ static int btf_find_kptr(const struct btf *btf, const= struct btf_type *t, =20 info->type_id =3D res_id; info->off =3D off; + info->type =3D type; return BTF_FIELD_FOUND; } =20 @@ -3420,6 +3427,7 @@ struct bpf_map_value_off *btf_parse_kptrs(const struc= t btf *btf, } =20 tab->off[i].offset =3D info_arr[i].off; + tab->off[i].type =3D info_arr[i].type; tab->off[i].kptr.btf_id =3D id; tab->off[i].kptr.btf =3D kernel_btf; } diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 315053ef6a75..3e709fed5306 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -1374,6 +1374,28 @@ void bpf_timer_cancel_and_free(void *val) kfree(t); } =20 +BPF_CALL_2(bpf_kptr_xchg, void *, map_value, void *, ptr) +{ + unsigned long *kptr =3D map_value; + + return xchg(kptr, (unsigned long)ptr); +} + +/* Unlike other PTR_TO_BTF_ID helpers the btf_id in bpf_kptr_xchg() + * helper is determined dynamically by the verifier. + */ +#define BPF_PTR_POISON ((void *)((0xeB9FUL << 2) + POISON_POINTER_DELTA)) + +const struct bpf_func_proto bpf_kptr_xchg_proto =3D { + .func =3D bpf_kptr_xchg, + .gpl_only =3D false, + .ret_type =3D RET_PTR_TO_BTF_ID_OR_NULL, + .ret_btf_id =3D BPF_PTR_POISON, + .arg1_type =3D ARG_PTR_TO_KPTR, + .arg2_type =3D ARG_PTR_TO_BTF_ID_OR_NULL | OBJ_RELEASE, + .arg2_btf_id =3D BPF_PTR_POISON, +}; + const struct bpf_func_proto bpf_get_current_task_proto __weak; const struct bpf_func_proto bpf_get_current_task_btf_proto __weak; const struct bpf_func_proto bpf_probe_read_user_proto __weak; @@ -1452,6 +1474,8 @@ bpf_base_func_proto(enum bpf_func_id func_id) return &bpf_timer_start_proto; case BPF_FUNC_timer_cancel: return &bpf_timer_cancel_proto; + case BPF_FUNC_kptr_xchg: + return &bpf_kptr_xchg_proto; default: break; } diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 4f19a86c2682..93c98f95901e 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -258,6 +258,7 @@ struct bpf_call_arg_meta { struct btf *ret_btf; u32 ret_btf_id; u32 subprogno; + struct bpf_map_value_off_desc *kptr_off_desc; }; =20 struct btf *btf_vmlinux; @@ -489,7 +490,8 @@ static bool is_acquire_function(enum bpf_func_id func_i= d, if (func_id =3D=3D BPF_FUNC_sk_lookup_tcp || func_id =3D=3D BPF_FUNC_sk_lookup_udp || func_id =3D=3D BPF_FUNC_skc_lookup_tcp || - func_id =3D=3D BPF_FUNC_ringbuf_reserve) + func_id =3D=3D BPF_FUNC_ringbuf_reserve || + func_id =3D=3D BPF_FUNC_kptr_xchg) return true; =20 if (func_id =3D=3D BPF_FUNC_map_lookup_elem && @@ -3513,6 +3515,12 @@ static int map_kptr_match_type(struct bpf_verifier_e= nv *env, /* We need to verify reg->type and reg->btf, before accessing reg->btf */ reg_name =3D kernel_type_name(reg->btf, reg->btf_id); =20 + /* For ref_ptr case, release function check should ensure we get one + * referenced PTR_TO_BTF_ID, and that its fixed offset is 0. For the + * normal store of unreferenced kptr, we must ensure var_off is zero. + * Since ref_ptr cannot be accessed directly by BPF insns, checks for + * reg->off and reg->ref_obj_id are not needed here. + */ if (__check_ptr_off_reg(env, reg, regno, true)) return -EACCES; =20 @@ -3568,6 +3576,12 @@ static int check_map_kptr_access(struct bpf_verifier= _env *env, u32 regno, return -EACCES; } =20 + /* We cannot directly access kptr_ref */ + if (off_desc->type =3D=3D BPF_KPTR_REF) { + verbose(env, "accessing referenced kptr disallowed\n"); + return -EACCES; + } + if (class =3D=3D BPF_LDX) { val_reg =3D reg_state(env, value_regno); /* We can simply mark the value_regno receiving the pointer @@ -5292,6 +5306,53 @@ static int process_timer_func(struct bpf_verifier_en= v *env, int regno, return 0; } =20 +static int process_kptr_func(struct bpf_verifier_env *env, int regno, + struct bpf_call_arg_meta *meta) +{ + struct bpf_reg_state *regs =3D cur_regs(env), *reg =3D ®s[regno]; + struct bpf_map_value_off_desc *off_desc; + struct bpf_map *map_ptr =3D reg->map_ptr; + u32 kptr_off; + int ret; + + if (!tnum_is_const(reg->var_off)) { + verbose(env, + "R%d doesn't have constant offset. kptr has to be at the constant offse= t\n", + regno); + return -EINVAL; + } + if (!map_ptr->btf) { + verbose(env, "map '%s' has to have BTF in order to use bpf_kptr_xchg\n", + map_ptr->name); + return -EINVAL; + } + if (!map_value_has_kptrs(map_ptr)) { + ret =3D PTR_ERR(map_ptr->kptr_off_tab); + if (ret =3D=3D -E2BIG) + verbose(env, "map '%s' has more than %d kptr\n", map_ptr->name, + BPF_MAP_VALUE_OFF_MAX); + else if (ret =3D=3D -EEXIST) + verbose(env, "map '%s' has repeating kptr BTF tags\n", map_ptr->name); + else + verbose(env, "map '%s' has no valid kptr\n", map_ptr->name); + return -EINVAL; + } + + meta->map_ptr =3D map_ptr; + kptr_off =3D reg->off + reg->var_off.value; + off_desc =3D bpf_map_kptr_off_contains(map_ptr, kptr_off); + if (!off_desc) { + verbose(env, "off=3D%d doesn't point to kptr\n", kptr_off); + return -EACCES; + } + if (off_desc->type !=3D BPF_KPTR_REF) { + verbose(env, "off=3D%d kptr isn't referenced kptr\n", kptr_off); + return -EACCES; + } + meta->kptr_off_desc =3D off_desc; + return 0; +} + static bool arg_type_is_mem_ptr(enum bpf_arg_type type) { return base_type(type) =3D=3D ARG_PTR_TO_MEM || @@ -5432,6 +5493,7 @@ static const struct bpf_reg_types func_ptr_types =3D = { .types =3D { PTR_TO_FUNC } }; static const struct bpf_reg_types stack_ptr_types =3D { .types =3D { PTR_T= O_STACK } }; static const struct bpf_reg_types const_str_ptr_types =3D { .types =3D { P= TR_TO_MAP_VALUE } }; static const struct bpf_reg_types timer_types =3D { .types =3D { PTR_TO_MA= P_VALUE } }; +static const struct bpf_reg_types kptr_types =3D { .types =3D { PTR_TO_MAP= _VALUE } }; =20 static const struct bpf_reg_types *compatible_reg_types[__BPF_ARG_TYPE_MAX= ] =3D { [ARG_PTR_TO_MAP_KEY] =3D &map_key_value_types, @@ -5459,11 +5521,13 @@ static const struct bpf_reg_types *compatible_reg_t= ypes[__BPF_ARG_TYPE_MAX] =3D { [ARG_PTR_TO_STACK] =3D &stack_ptr_types, [ARG_PTR_TO_CONST_STR] =3D &const_str_ptr_types, [ARG_PTR_TO_TIMER] =3D &timer_types, + [ARG_PTR_TO_KPTR] =3D &kptr_types, }; =20 static int check_reg_type(struct bpf_verifier_env *env, u32 regno, enum bpf_arg_type arg_type, - const u32 *arg_btf_id) + const u32 *arg_btf_id, + struct bpf_call_arg_meta *meta) { struct bpf_reg_state *regs =3D cur_regs(env), *reg =3D ®s[regno]; enum bpf_reg_type expected, type =3D reg->type; @@ -5516,8 +5580,11 @@ static int check_reg_type(struct bpf_verifier_env *e= nv, u32 regno, arg_btf_id =3D compatible->btf_id; } =20 - if (!btf_struct_ids_match(&env->log, reg->btf, reg->btf_id, reg->off, - btf_vmlinux, *arg_btf_id)) { + if (meta->func_id =3D=3D BPF_FUNC_kptr_xchg) { + if (map_kptr_match_type(env, meta->kptr_off_desc, reg, regno)) + return -EACCES; + } else if (!btf_struct_ids_match(&env->log, reg->btf, reg->btf_id, reg->= off, + btf_vmlinux, *arg_btf_id)) { verbose(env, "R%d is of type %s but %s is expected\n", regno, kernel_type_name(reg->btf, reg->btf_id), kernel_type_name(btf_vmlinux, *arg_btf_id)); @@ -5624,7 +5691,7 @@ static int check_func_arg(struct bpf_verifier_env *en= v, u32 arg, */ goto skip_type_check; =20 - err =3D check_reg_type(env, regno, arg_type, fn->arg_btf_id[arg]); + err =3D check_reg_type(env, regno, arg_type, fn->arg_btf_id[arg], meta); if (err) return err; =20 @@ -5800,6 +5867,9 @@ static int check_func_arg(struct bpf_verifier_env *en= v, u32 arg, verbose(env, "string is not zero-terminated\n"); return -EINVAL; } + } else if (arg_type =3D=3D ARG_PTR_TO_KPTR) { + if (process_kptr_func(env, regno, meta)) + return -EACCES; } =20 return err; @@ -6143,10 +6213,10 @@ static bool check_btf_id_ok(const struct bpf_func_p= roto *fn) int i; =20 for (i =3D 0; i < ARRAY_SIZE(fn->arg_type); i++) { - if (fn->arg_type[i] =3D=3D ARG_PTR_TO_BTF_ID && !fn->arg_btf_id[i]) + if (base_type(fn->arg_type[i]) =3D=3D ARG_PTR_TO_BTF_ID && !fn->arg_btf_= id[i]) return false; =20 - if (fn->arg_type[i] !=3D ARG_PTR_TO_BTF_ID && fn->arg_btf_id[i]) + if (base_type(fn->arg_type[i]) !=3D ARG_PTR_TO_BTF_ID && fn->arg_btf_id[= i]) return false; } =20 @@ -7010,21 +7080,25 @@ static int check_helper_call(struct bpf_verifier_en= v *env, struct bpf_insn *insn regs[BPF_REG_0].btf_id =3D meta.ret_btf_id; } } else if (base_type(ret_type) =3D=3D RET_PTR_TO_BTF_ID) { + struct btf *ret_btf; int ret_btf_id; =20 mark_reg_known_zero(env, regs, BPF_REG_0); regs[BPF_REG_0].type =3D PTR_TO_BTF_ID | ret_flag; - ret_btf_id =3D *fn->ret_btf_id; + if (func_id =3D=3D BPF_FUNC_kptr_xchg) { + ret_btf =3D meta.kptr_off_desc->kptr.btf; + ret_btf_id =3D meta.kptr_off_desc->kptr.btf_id; + } else { + ret_btf =3D btf_vmlinux; + ret_btf_id =3D *fn->ret_btf_id; + } if (ret_btf_id =3D=3D 0) { verbose(env, "invalid return type %u of func %s#%d\n", base_type(ret_type), func_id_name(func_id), func_id); return -EINVAL; } - /* current BPF helper definitions are only coming from - * built-in code with type IDs from vmlinux BTF - */ - regs[BPF_REG_0].btf =3D btf_vmlinux; + regs[BPF_REG_0].btf =3D ret_btf; regs[BPF_REG_0].btf_id =3D ret_btf_id; } else { verbose(env, "unknown return type %u of func %s#%d\n", diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index a4f557338af7..ff9af73859ca 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -5144,6 +5144,17 @@ union bpf_attr { * The **hash_algo** is returned on success, * **-EOPNOTSUP** if the hash calculation failed or **-EINVAL** if * invalid arguments are passed. + * + * void *bpf_kptr_xchg(void *map_value, void *ptr) + * Description + * Exchange kptr at pointer *map_value* with *ptr*, and return the + * old value. *ptr* can be NULL, otherwise it must be a referenced + * pointer which will be released when this helper is called. + * Return + * The old value of kptr (which can be NULL). The returned pointer + * if not NULL, is a reference which must be released using its + * corresponding release function, or moved into a BPF map before + * program exit. */ #define __BPF_FUNC_MAPPER(FN) \ FN(unspec), \ @@ -5340,6 +5351,7 @@ union bpf_attr { FN(copy_from_user_task), \ FN(skb_set_tstamp), \ FN(ima_file_hash), \ + FN(kptr_xchg), \ /* */ =20 /* integer value in 'imm' field of BPF_CALL instruction selects which help= er --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2159FC2BB47 for ; Mon, 15 Aug 2022 21:18:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346783AbiHOVSH (ORCPT ); Mon, 15 Aug 2022 17:18:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240133AbiHOVIp (ORCPT ); Mon, 15 Aug 2022 17:08:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0121454645; Mon, 15 Aug 2022 12:18:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A233E60FB9; Mon, 15 Aug 2022 19:18:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99859C433D6; Mon, 15 Aug 2022 19:18:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591121; bh=xYO+TDFOfQODSrEx0HoMIGJBE32gT1/jzGDxoOV/ltY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tql5egFyVxl8bBl6zYmmQ5j9cOPj+nTsPoAnRGkLExsYJJs3z3Gh7Qun0fjFOLBT6 6egqfZ4xJYzEh1amBi3nAT8dmGcrXEuSy1vE89LjssJqD4wxa9RekdLPNkjFQvr7sG fq6ROglsOmYmwOx0iqvk8BNVHaFb2vPGuf8fdwmE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kumar Kartikeya Dwivedi , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.18 0479/1095] bpf: Adapt copy_map_value for multiple offset case Date: Mon, 15 Aug 2022 19:57:58 +0200 Message-Id: <20220815180449.404334664@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kumar Kartikeya Dwivedi [ Upstream commit 4d7d7f69f4b104b2ddeec6a1e7fcfd2d044ed8c4 ] Since now there might be at most 10 offsets that need handling in copy_map_value, the manual shuffling and special case is no longer going to work. Hence, let's generalise the copy_map_value function by using a sorted array of offsets to skip regions that must be avoided while copying into and out of a map value. When the map is created, we populate the offset array in struct map, Then, copy_map_value uses this sorted offset array is used to memcpy while skipping timer, spin lock, and kptr. The array is allocated as in most cases none of these special fields would be present in map value, hence we can save on space for the common case by not embedding the entire object inside bpf_map struct. Signed-off-by: Kumar Kartikeya Dwivedi Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20220424214901.2743946-6-memxor@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/bpf.h | 56 +++++++++++++++------------- kernel/bpf/syscall.c | 88 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 117 insertions(+), 27 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 2f6e7fc474ea..a3fe7f53e567 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -158,6 +158,9 @@ struct bpf_map_ops { enum { /* Support at most 8 pointers in a BPF map value */ BPF_MAP_VALUE_OFF_MAX =3D 8, + BPF_MAP_OFF_ARR_MAX =3D BPF_MAP_VALUE_OFF_MAX + + 1 + /* for bpf_spin_lock */ + 1, /* for bpf_timer */ }; =20 enum bpf_kptr_type { @@ -179,6 +182,12 @@ struct bpf_map_value_off { struct bpf_map_value_off_desc off[]; }; =20 +struct bpf_map_off_arr { + u32 cnt; + u32 field_off[BPF_MAP_OFF_ARR_MAX]; + u8 field_sz[BPF_MAP_OFF_ARR_MAX]; +}; + struct bpf_map { /* The first two cachelines with read-mostly members of which some * are also accessed in fast-path (e.g. ops, max_entries). @@ -207,10 +216,7 @@ struct bpf_map { struct mem_cgroup *memcg; #endif char name[BPF_OBJ_NAME_LEN]; - bool bypass_spec_v1; - bool frozen; /* write-once; write-protected by freeze_mutex */ - /* 6 bytes hole */ - + struct bpf_map_off_arr *off_arr; /* The 3rd and 4th cacheline with misc members to avoid false sharing * particularly with refcounting. */ @@ -230,6 +236,8 @@ struct bpf_map { bool jited; bool xdp_has_frags; } owner; + bool bypass_spec_v1; + bool frozen; /* write-once; write-protected by freeze_mutex */ }; =20 static inline bool map_value_has_spin_lock(const struct bpf_map *map) @@ -253,37 +261,33 @@ static inline void check_and_init_map_value(struct bp= f_map *map, void *dst) memset(dst + map->spin_lock_off, 0, sizeof(struct bpf_spin_lock)); if (unlikely(map_value_has_timer(map))) memset(dst + map->timer_off, 0, sizeof(struct bpf_timer)); + if (unlikely(map_value_has_kptrs(map))) { + struct bpf_map_value_off *tab =3D map->kptr_off_tab; + int i; + + for (i =3D 0; i < tab->nr_off; i++) + *(u64 *)(dst + tab->off[i].offset) =3D 0; + } } =20 /* copy everything but bpf_spin_lock and bpf_timer. There could be one of = each. */ static inline void copy_map_value(struct bpf_map *map, void *dst, void *sr= c) { - u32 s_off =3D 0, s_sz =3D 0, t_off =3D 0, t_sz =3D 0; + u32 curr_off =3D 0; + int i; =20 - if (unlikely(map_value_has_spin_lock(map))) { - s_off =3D map->spin_lock_off; - s_sz =3D sizeof(struct bpf_spin_lock); - } - if (unlikely(map_value_has_timer(map))) { - t_off =3D map->timer_off; - t_sz =3D sizeof(struct bpf_timer); + if (likely(!map->off_arr)) { + memcpy(dst, src, map->value_size); + return; } =20 - if (unlikely(s_sz || t_sz)) { - if (s_off < t_off || !s_sz) { - swap(s_off, t_off); - swap(s_sz, t_sz); - } - memcpy(dst, src, t_off); - memcpy(dst + t_off + t_sz, - src + t_off + t_sz, - s_off - t_off - t_sz); - memcpy(dst + s_off + s_sz, - src + s_off + s_sz, - map->value_size - s_off - s_sz); - } else { - memcpy(dst, src, map->value_size); + for (i =3D 0; i < map->off_arr->cnt; i++) { + u32 next_off =3D map->off_arr->field_off[i]; + + memcpy(dst + curr_off, src + curr_off, next_off - curr_off); + curr_off +=3D map->off_arr->field_sz[i]; } + memcpy(dst + curr_off, src + curr_off, map->value_size - curr_off); } void copy_map_value_locked(struct bpf_map *map, void *dst, void *src, bool lock_src); diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index dc49bd880ac0..811bc71b0906 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -551,6 +552,7 @@ static void bpf_map_free_deferred(struct work_struct *w= ork) struct bpf_map *map =3D container_of(work, struct bpf_map, work); =20 security_bpf_map_free(map); + kfree(map->off_arr); bpf_map_free_kptr_off_tab(map); bpf_map_release_memcg(map); /* implementation dependent freeing */ @@ -840,6 +842,84 @@ int map_check_no_btf(const struct bpf_map *map, return -ENOTSUPP; } =20 +static int map_off_arr_cmp(const void *_a, const void *_b, const void *pri= v) +{ + const u32 a =3D *(const u32 *)_a; + const u32 b =3D *(const u32 *)_b; + + if (a < b) + return -1; + else if (a > b) + return 1; + return 0; +} + +static void map_off_arr_swap(void *_a, void *_b, int size, const void *pri= v) +{ + struct bpf_map *map =3D (struct bpf_map *)priv; + u32 *off_base =3D map->off_arr->field_off; + u32 *a =3D _a, *b =3D _b; + u8 *sz_a, *sz_b; + + sz_a =3D map->off_arr->field_sz + (a - off_base); + sz_b =3D map->off_arr->field_sz + (b - off_base); + + swap(*a, *b); + swap(*sz_a, *sz_b); +} + +static int bpf_map_alloc_off_arr(struct bpf_map *map) +{ + bool has_spin_lock =3D map_value_has_spin_lock(map); + bool has_timer =3D map_value_has_timer(map); + bool has_kptrs =3D map_value_has_kptrs(map); + struct bpf_map_off_arr *off_arr; + u32 i; + + if (!has_spin_lock && !has_timer && !has_kptrs) { + map->off_arr =3D NULL; + return 0; + } + + off_arr =3D kmalloc(sizeof(*map->off_arr), GFP_KERNEL | __GFP_NOWARN); + if (!off_arr) + return -ENOMEM; + map->off_arr =3D off_arr; + + off_arr->cnt =3D 0; + if (has_spin_lock) { + i =3D off_arr->cnt; + + off_arr->field_off[i] =3D map->spin_lock_off; + off_arr->field_sz[i] =3D sizeof(struct bpf_spin_lock); + off_arr->cnt++; + } + if (has_timer) { + i =3D off_arr->cnt; + + off_arr->field_off[i] =3D map->timer_off; + off_arr->field_sz[i] =3D sizeof(struct bpf_timer); + off_arr->cnt++; + } + if (has_kptrs) { + struct bpf_map_value_off *tab =3D map->kptr_off_tab; + u32 *off =3D &off_arr->field_off[off_arr->cnt]; + u8 *sz =3D &off_arr->field_sz[off_arr->cnt]; + + for (i =3D 0; i < tab->nr_off; i++) { + *off++ =3D tab->off[i].offset; + *sz++ =3D sizeof(u64); + } + off_arr->cnt +=3D tab->nr_off; + } + + if (off_arr->cnt =3D=3D 1) + return 0; + sort_r(off_arr->field_off, off_arr->cnt, sizeof(off_arr->field_off[0]), + map_off_arr_cmp, map_off_arr_swap, map); + return 0; +} + static int map_check_btf(struct bpf_map *map, const struct btf *btf, u32 btf_key_id, u32 btf_value_id) { @@ -1009,10 +1089,14 @@ static int map_create(union bpf_attr *attr) attr->btf_vmlinux_value_type_id; } =20 - err =3D security_bpf_map_alloc(map); + err =3D bpf_map_alloc_off_arr(map); if (err) goto free_map; =20 + err =3D security_bpf_map_alloc(map); + if (err) + goto free_map_off_arr; + err =3D bpf_map_alloc_id(map); if (err) goto free_map_sec; @@ -1035,6 +1119,8 @@ static int map_create(union bpf_attr *attr) =20 free_map_sec: security_bpf_map_free(map); +free_map_off_arr: + kfree(map->off_arr); free_map: btf_put(map->btf); map->ops->map_free(map); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 393F2C2BB45 for ; Mon, 15 Aug 2022 21:18:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346907AbiHOVSL (ORCPT ); Mon, 15 Aug 2022 17:18:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242255AbiHOVIw (ORCPT ); Mon, 15 Aug 2022 17:08:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4483754673; Mon, 15 Aug 2022 12:18:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 71516B81106; Mon, 15 Aug 2022 19:18:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1A86C433D6; Mon, 15 Aug 2022 19:18:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591124; bh=vlb04FSZDe5zBy0a8n/JpcWfjR8IY7CPYEu8zaATBEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V1JU3xHBJM1y697mC/+O9SWZ1uHvydUb3LVcDEIVNgxQl4kzC7asB+GMabYPb2N7i xkFz98TLy3gRw2Omhvc0CfjBcmgyumrl/RMG9iR+cIJi4KFq/kszNpA1Mjyjd0GFD+ v+58plinjM6URLf3oG/urjC/oVjJchLJYQzX9Aic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kumar Kartikeya Dwivedi , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.18 0480/1095] bpf: Populate pairs of btf_id and destructor kfunc in btf Date: Mon, 15 Aug 2022 19:57:59 +0200 Message-Id: <20220815180449.436699917@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kumar Kartikeya Dwivedi [ Upstream commit 5ce937d613a423ca3102f53d9f3daf4210c1b6e2 ] To support storing referenced PTR_TO_BTF_ID in maps, we require associating a specific BTF ID with a 'destructor' kfunc. This is because we need to release a live referenced pointer at a certain offset in map value from the map destruction path, otherwise we end up leaking resources. Hence, introduce support for passing an array of btf_id, kfunc_btf_id pairs that denote a BTF ID and its associated release function. Then, add an accessor 'btf_find_dtor_kfunc' which can be used to look up the destructor kfunc of a certain BTF ID. If found, we can use it to free the object from the map free path. The registration of these pairs also serve as a whitelist of structures which are allowed as referenced PTR_TO_BTF_ID in a BPF map, because without finding the destructor kfunc, we will bail and return an error. Signed-off-by: Kumar Kartikeya Dwivedi Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20220424214901.2743946-7-memxor@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/btf.h | 17 +++++++ kernel/bpf/btf.c | 108 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) diff --git a/include/linux/btf.h b/include/linux/btf.h index 19c297f9a52f..fea424681d66 100644 --- a/include/linux/btf.h +++ b/include/linux/btf.h @@ -40,6 +40,11 @@ struct btf_kfunc_id_set { }; }; =20 +struct btf_id_dtor_kfunc { + u32 btf_id; + u32 kfunc_btf_id; +}; + extern const struct file_operations btf_fops; =20 void btf_get(struct btf *btf); @@ -346,6 +351,9 @@ bool btf_kfunc_id_set_contains(const struct btf *btf, enum btf_kfunc_type type, u32 kfunc_btf_id); int register_btf_kfunc_id_set(enum bpf_prog_type prog_type, const struct btf_kfunc_id_set *s); +s32 btf_find_dtor_kfunc(struct btf *btf, u32 btf_id); +int register_btf_id_dtor_kfuncs(const struct btf_id_dtor_kfunc *dtors, u32= add_cnt, + struct module *owner); #else static inline const struct btf_type *btf_type_by_id(const struct btf *btf, u32 type_id) @@ -369,6 +377,15 @@ static inline int register_btf_kfunc_id_set(enum bpf_p= rog_type prog_type, { return 0; } +static inline s32 btf_find_dtor_kfunc(struct btf *btf, u32 btf_id) +{ + return -ENOENT; +} +static inline int register_btf_id_dtor_kfuncs(const struct btf_id_dtor_kfu= nc *dtors, + u32 add_cnt, struct module *owner) +{ + return 0; +} #endif =20 #endif diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 58fd6896c403..57e3d9443ff3 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -207,12 +207,18 @@ enum btf_kfunc_hook { =20 enum { BTF_KFUNC_SET_MAX_CNT =3D 32, + BTF_DTOR_KFUNC_MAX_CNT =3D 256, }; =20 struct btf_kfunc_set_tab { struct btf_id_set *sets[BTF_KFUNC_HOOK_MAX][BTF_KFUNC_TYPE_MAX]; }; =20 +struct btf_id_dtor_kfunc_tab { + u32 cnt; + struct btf_id_dtor_kfunc dtors[]; +}; + struct btf { void *data; struct btf_type **types; @@ -228,6 +234,7 @@ struct btf { u32 id; struct rcu_head rcu; struct btf_kfunc_set_tab *kfunc_set_tab; + struct btf_id_dtor_kfunc_tab *dtor_kfunc_tab; =20 /* split BTF support */ struct btf *base_btf; @@ -1616,8 +1623,19 @@ static void btf_free_kfunc_set_tab(struct btf *btf) btf->kfunc_set_tab =3D NULL; } =20 +static void btf_free_dtor_kfunc_tab(struct btf *btf) +{ + struct btf_id_dtor_kfunc_tab *tab =3D btf->dtor_kfunc_tab; + + if (!tab) + return; + kfree(tab); + btf->dtor_kfunc_tab =3D NULL; +} + static void btf_free(struct btf *btf) { + btf_free_dtor_kfunc_tab(btf); btf_free_kfunc_set_tab(btf); kvfree(btf->types); kvfree(btf->resolved_sizes); @@ -7022,6 +7040,96 @@ int register_btf_kfunc_id_set(enum bpf_prog_type pro= g_type, } EXPORT_SYMBOL_GPL(register_btf_kfunc_id_set); =20 +s32 btf_find_dtor_kfunc(struct btf *btf, u32 btf_id) +{ + struct btf_id_dtor_kfunc_tab *tab =3D btf->dtor_kfunc_tab; + struct btf_id_dtor_kfunc *dtor; + + if (!tab) + return -ENOENT; + /* Even though the size of tab->dtors[0] is > sizeof(u32), we only need + * to compare the first u32 with btf_id, so we can reuse btf_id_cmp_func. + */ + BUILD_BUG_ON(offsetof(struct btf_id_dtor_kfunc, btf_id) !=3D 0); + dtor =3D bsearch(&btf_id, tab->dtors, tab->cnt, sizeof(tab->dtors[0]), bt= f_id_cmp_func); + if (!dtor) + return -ENOENT; + return dtor->kfunc_btf_id; +} + +/* This function must be invoked only from initcalls/module init functions= */ +int register_btf_id_dtor_kfuncs(const struct btf_id_dtor_kfunc *dtors, u32= add_cnt, + struct module *owner) +{ + struct btf_id_dtor_kfunc_tab *tab; + struct btf *btf; + u32 tab_cnt; + int ret; + + btf =3D btf_get_module_btf(owner); + if (!btf) { + if (!owner && IS_ENABLED(CONFIG_DEBUG_INFO_BTF)) { + pr_err("missing vmlinux BTF, cannot register dtor kfuncs\n"); + return -ENOENT; + } + if (owner && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES)) { + pr_err("missing module BTF, cannot register dtor kfuncs\n"); + return -ENOENT; + } + return 0; + } + if (IS_ERR(btf)) + return PTR_ERR(btf); + + if (add_cnt >=3D BTF_DTOR_KFUNC_MAX_CNT) { + pr_err("cannot register more than %d kfunc destructors\n", BTF_DTOR_KFUN= C_MAX_CNT); + ret =3D -E2BIG; + goto end; + } + + tab =3D btf->dtor_kfunc_tab; + /* Only one call allowed for modules */ + if (WARN_ON_ONCE(tab && btf_is_module(btf))) { + ret =3D -EINVAL; + goto end; + } + + tab_cnt =3D tab ? tab->cnt : 0; + if (tab_cnt > U32_MAX - add_cnt) { + ret =3D -EOVERFLOW; + goto end; + } + if (tab_cnt + add_cnt >=3D BTF_DTOR_KFUNC_MAX_CNT) { + pr_err("cannot register more than %d kfunc destructors\n", BTF_DTOR_KFUN= C_MAX_CNT); + ret =3D -E2BIG; + goto end; + } + + tab =3D krealloc(btf->dtor_kfunc_tab, + offsetof(struct btf_id_dtor_kfunc_tab, dtors[tab_cnt + add_cnt]), + GFP_KERNEL | __GFP_NOWARN); + if (!tab) { + ret =3D -ENOMEM; + goto end; + } + + if (!btf->dtor_kfunc_tab) + tab->cnt =3D 0; + btf->dtor_kfunc_tab =3D tab; + + memcpy(tab->dtors + tab->cnt, dtors, add_cnt * sizeof(tab->dtors[0])); + tab->cnt +=3D add_cnt; + + sort(tab->dtors, tab->cnt, sizeof(tab->dtors[0]), btf_id_cmp_func, NULL); + + return 0; +end: + btf_free_dtor_kfunc_tab(btf); + btf_put(btf); + return ret; +} +EXPORT_SYMBOL_GPL(register_btf_id_dtor_kfuncs); + #define MAX_TYPES_ARE_COMPAT_DEPTH 2 =20 static --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7F9DC25B08 for ; Mon, 15 Aug 2022 21:18:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347105AbiHOVSQ (ORCPT ); Mon, 15 Aug 2022 17:18:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243598AbiHOVI7 (ORCPT ); Mon, 15 Aug 2022 17:08:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEFC254C92; Mon, 15 Aug 2022 12:18:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CF2DCB8110A; Mon, 15 Aug 2022 19:18:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5329C433C1; Mon, 15 Aug 2022 19:18:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591127; bh=6WDEfNG2SlEg4VX9iIS7KvXAg5MLkFrCyOsMhlwg7a0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D4Vr8mBe2rbHb4yX9P10ULlctGrT5zwLMEURt8rTpZEoSlkpxcKewS6hwX7+Tz6fo l1rkv9kG/mJQXr8SaiY2hFvSntRMjb5YC9IH06pwkM8ovPVyLGBdYgYqCyYEt1phGq tIdmYxFdpEYZlCAbaZc/at6PSnlghUf/2/5qmuZQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kumar Kartikeya Dwivedi , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.18 0481/1095] bpf: Wire up freeing of referenced kptr Date: Mon, 15 Aug 2022 19:58:00 +0200 Message-Id: <20220815180449.476382408@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kumar Kartikeya Dwivedi [ Upstream commit 14a324f6a67ef6a53e04362a70160a47eb8afffa ] A destructor kfunc can be defined as void func(type *), where type may be void or any other pointer type as per convenience. In this patch, we ensure that the type is sane and capture the function pointer into off_desc of ptr_off_tab for the specific pointer offset, with the invariant that the dtor pointer is always set when 'kptr_ref' tag is applied to the pointer's pointee type, which is indicated by the flag BPF_MAP_VALUE_OFF_F_REF. Note that only BTF IDs whose destructor kfunc is registered, thus become the allowed BTF IDs for embedding as referenced kptr. Hence it serves the purpose of finding dtor kfunc BTF ID, as well acting as a check against the whitelist of allowed BTF IDs for this purpose. Finally, wire up the actual freeing of the referenced pointer if any at all available offsets, so that no references are leaked after the BPF map goes away and the BPF program previously moved the ownership a referenced pointer into it. The behavior is similar to BPF timers, where bpf_map_{update,delete}_elem will free any existing referenced kptr. The same case is with LRU map's bpf_lru_push_free/htab_lru_push_free functions, which are extended to reset unreferenced and free referenced kptr. Note that unlike BPF timers, kptr is not reset or freed when map uref drops to zero. Signed-off-by: Kumar Kartikeya Dwivedi Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20220424214901.2743946-8-memxor@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/bpf.h | 4 ++ include/linux/btf.h | 2 + kernel/bpf/arraymap.c | 18 ++++++-- kernel/bpf/btf.c | 98 ++++++++++++++++++++++++++++++++++++++++++- kernel/bpf/hashtab.c | 64 +++++++++++++++++++++------- kernel/bpf/syscall.c | 49 ++++++++++++++++++++-- 6 files changed, 210 insertions(+), 25 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index a3fe7f53e567..f3c38574c265 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -23,6 +23,7 @@ #include #include #include +#include =20 struct bpf_verifier_env; struct bpf_verifier_log; @@ -173,6 +174,8 @@ struct bpf_map_value_off_desc { enum bpf_kptr_type type; struct { struct btf *btf; + struct module *module; + btf_dtor_kfunc_t dtor; u32 btf_id; } kptr; }; @@ -1450,6 +1453,7 @@ struct bpf_map_value_off_desc *bpf_map_kptr_off_conta= ins(struct bpf_map *map, u3 void bpf_map_free_kptr_off_tab(struct bpf_map *map); struct bpf_map_value_off *bpf_map_copy_kptr_off_tab(const struct bpf_map *= map); bool bpf_map_equal_kptr_off_tab(const struct bpf_map *map_a, const struct = bpf_map *map_b); +void bpf_map_free_kptrs(struct bpf_map *map, void *map_value); =20 struct bpf_map *bpf_map_get(u32 ufd); struct bpf_map *bpf_map_get_with_uref(u32 ufd); diff --git a/include/linux/btf.h b/include/linux/btf.h index fea424681d66..f70625dd5bb4 100644 --- a/include/linux/btf.h +++ b/include/linux/btf.h @@ -45,6 +45,8 @@ struct btf_id_dtor_kfunc { u32 kfunc_btf_id; }; =20 +typedef void (*btf_dtor_kfunc_t)(void *); + extern const struct file_operations btf_fops; =20 void btf_get(struct btf *btf); diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c index 7f145aefbff8..c3de63ce574e 100644 --- a/kernel/bpf/arraymap.c +++ b/kernel/bpf/arraymap.c @@ -287,10 +287,12 @@ static int array_map_get_next_key(struct bpf_map *map= , void *key, void *next_key return 0; } =20 -static void check_and_free_timer_in_array(struct bpf_array *arr, void *val) +static void check_and_free_fields(struct bpf_array *arr, void *val) { - if (unlikely(map_value_has_timer(&arr->map))) + if (map_value_has_timer(&arr->map)) bpf_timer_cancel_and_free(val + arr->map.timer_off); + if (map_value_has_kptrs(&arr->map)) + bpf_map_free_kptrs(&arr->map, val); } =20 /* Called from syscall or from eBPF program */ @@ -327,7 +329,7 @@ static int array_map_update_elem(struct bpf_map *map, v= oid *key, void *value, copy_map_value_locked(map, val, value, false); else copy_map_value(map, val, value); - check_and_free_timer_in_array(array, val); + check_and_free_fields(array, val); } return 0; } @@ -386,7 +388,8 @@ static void array_map_free_timers(struct bpf_map *map) struct bpf_array *array =3D container_of(map, struct bpf_array, map); int i; =20 - if (likely(!map_value_has_timer(map))) + /* We don't reset or free kptr on uref dropping to zero. */ + if (!map_value_has_timer(map)) return; =20 for (i =3D 0; i < array->map.max_entries; i++) @@ -398,6 +401,13 @@ static void array_map_free_timers(struct bpf_map *map) static void array_map_free(struct bpf_map *map) { struct bpf_array *array =3D container_of(map, struct bpf_array, map); + int i; + + if (map_value_has_kptrs(map)) { + for (i =3D 0; i < array->map.max_entries; i++) + bpf_map_free_kptrs(map, array->value + array->elem_size * i); + bpf_map_free_kptr_off_tab(map); + } =20 if (array->map.map_type =3D=3D BPF_MAP_TYPE_PERCPU_ARRAY) bpf_array_free_percpu(array); diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 57e3d9443ff3..7a593ecfbeec 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -3416,6 +3416,7 @@ struct bpf_map_value_off *btf_parse_kptrs(const struc= t btf *btf, struct btf_field_info info_arr[BPF_MAP_VALUE_OFF_MAX]; struct bpf_map_value_off *tab; struct btf *kernel_btf =3D NULL; + struct module *mod =3D NULL; int ret, i, nr_off; =20 ret =3D btf_find_field(btf, t, BTF_FIELD_KPTR, info_arr, ARRAY_SIZE(info_= arr)); @@ -3444,16 +3445,69 @@ struct bpf_map_value_off *btf_parse_kptrs(const str= uct btf *btf, goto end; } =20 + /* Find and stash the function pointer for the destruction function that + * needs to be eventually invoked from the map free path. + */ + if (info_arr[i].type =3D=3D BPF_KPTR_REF) { + const struct btf_type *dtor_func; + const char *dtor_func_name; + unsigned long addr; + s32 dtor_btf_id; + + /* This call also serves as a whitelist of allowed objects that + * can be used as a referenced pointer and be stored in a map at + * the same time. + */ + dtor_btf_id =3D btf_find_dtor_kfunc(kernel_btf, id); + if (dtor_btf_id < 0) { + ret =3D dtor_btf_id; + goto end_btf; + } + + dtor_func =3D btf_type_by_id(kernel_btf, dtor_btf_id); + if (!dtor_func) { + ret =3D -ENOENT; + goto end_btf; + } + + if (btf_is_module(kernel_btf)) { + mod =3D btf_try_get_module(kernel_btf); + if (!mod) { + ret =3D -ENXIO; + goto end_btf; + } + } + + /* We already verified dtor_func to be btf_type_is_func + * in register_btf_id_dtor_kfuncs. + */ + dtor_func_name =3D __btf_name_by_offset(kernel_btf, dtor_func->name_off= ); + addr =3D kallsyms_lookup_name(dtor_func_name); + if (!addr) { + ret =3D -EINVAL; + goto end_mod; + } + tab->off[i].kptr.dtor =3D (void *)addr; + } + tab->off[i].offset =3D info_arr[i].off; tab->off[i].type =3D info_arr[i].type; tab->off[i].kptr.btf_id =3D id; tab->off[i].kptr.btf =3D kernel_btf; + tab->off[i].kptr.module =3D mod; } tab->nr_off =3D nr_off; return tab; +end_mod: + module_put(mod); +end_btf: + btf_put(kernel_btf); end: - while (i--) + while (i--) { btf_put(tab->off[i].kptr.btf); + if (tab->off[i].kptr.module) + module_put(tab->off[i].kptr.module); + } kfree(tab); return ERR_PTR(ret); } @@ -7057,6 +7111,43 @@ s32 btf_find_dtor_kfunc(struct btf *btf, u32 btf_id) return dtor->kfunc_btf_id; } =20 +static int btf_check_dtor_kfuncs(struct btf *btf, const struct btf_id_dtor= _kfunc *dtors, u32 cnt) +{ + const struct btf_type *dtor_func, *dtor_func_proto, *t; + const struct btf_param *args; + s32 dtor_btf_id; + u32 nr_args, i; + + for (i =3D 0; i < cnt; i++) { + dtor_btf_id =3D dtors[i].kfunc_btf_id; + + dtor_func =3D btf_type_by_id(btf, dtor_btf_id); + if (!dtor_func || !btf_type_is_func(dtor_func)) + return -EINVAL; + + dtor_func_proto =3D btf_type_by_id(btf, dtor_func->type); + if (!dtor_func_proto || !btf_type_is_func_proto(dtor_func_proto)) + return -EINVAL; + + /* Make sure the prototype of the destructor kfunc is 'void func(type *)= ' */ + t =3D btf_type_by_id(btf, dtor_func_proto->type); + if (!t || !btf_type_is_void(t)) + return -EINVAL; + + nr_args =3D btf_type_vlen(dtor_func_proto); + if (nr_args !=3D 1) + return -EINVAL; + args =3D btf_params(dtor_func_proto); + t =3D btf_type_by_id(btf, args[0].type); + /* Allow any pointer type, as width on targets Linux supports + * will be same for all pointer types (i.e. sizeof(void *)) + */ + if (!t || !btf_type_is_ptr(t)) + return -EINVAL; + } + return 0; +} + /* This function must be invoked only from initcalls/module init functions= */ int register_btf_id_dtor_kfuncs(const struct btf_id_dtor_kfunc *dtors, u32= add_cnt, struct module *owner) @@ -7087,6 +7178,11 @@ int register_btf_id_dtor_kfuncs(const struct btf_id_= dtor_kfunc *dtors, u32 add_c goto end; } =20 + /* Ensure that the prototype of dtor kfuncs being registered is sane */ + ret =3D btf_check_dtor_kfuncs(btf, dtors, add_cnt); + if (ret < 0) + goto end; + tab =3D btf->dtor_kfunc_tab; /* Only one call allowed for modules */ if (WARN_ON_ONCE(tab && btf_is_module(btf))) { diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index 65877967f414..ea99c91f72b6 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -238,7 +238,7 @@ static void htab_free_prealloced_timers(struct bpf_htab= *htab) u32 num_entries =3D htab->map.max_entries; int i; =20 - if (likely(!map_value_has_timer(&htab->map))) + if (!map_value_has_timer(&htab->map)) return; if (htab_has_extra_elems(htab)) num_entries +=3D num_possible_cpus(); @@ -254,6 +254,25 @@ static void htab_free_prealloced_timers(struct bpf_hta= b *htab) } } =20 +static void htab_free_prealloced_kptrs(struct bpf_htab *htab) +{ + u32 num_entries =3D htab->map.max_entries; + int i; + + if (!map_value_has_kptrs(&htab->map)) + return; + if (htab_has_extra_elems(htab)) + num_entries +=3D num_possible_cpus(); + + for (i =3D 0; i < num_entries; i++) { + struct htab_elem *elem; + + elem =3D get_htab_elem(htab, i); + bpf_map_free_kptrs(&htab->map, elem->key + round_up(htab->map.key_size, = 8)); + cond_resched(); + } +} + static void htab_free_elems(struct bpf_htab *htab) { int i; @@ -725,12 +744,15 @@ static int htab_lru_map_gen_lookup(struct bpf_map *ma= p, return insn - insn_buf; } =20 -static void check_and_free_timer(struct bpf_htab *htab, struct htab_elem *= elem) +static void check_and_free_fields(struct bpf_htab *htab, + struct htab_elem *elem) { - if (unlikely(map_value_has_timer(&htab->map))) - bpf_timer_cancel_and_free(elem->key + - round_up(htab->map.key_size, 8) + - htab->map.timer_off); + void *map_value =3D elem->key + round_up(htab->map.key_size, 8); + + if (map_value_has_timer(&htab->map)) + bpf_timer_cancel_and_free(map_value + htab->map.timer_off); + if (map_value_has_kptrs(&htab->map)) + bpf_map_free_kptrs(&htab->map, map_value); } =20 /* It is called from the bpf_lru_list when the LRU needs to delete @@ -757,7 +779,7 @@ static bool htab_lru_map_delete_node(void *arg, struct = bpf_lru_node *node) hlist_nulls_for_each_entry_rcu(l, n, head, hash_node) if (l =3D=3D tgt_l) { hlist_nulls_del_rcu(&l->hash_node); - check_and_free_timer(htab, l); + check_and_free_fields(htab, l); break; } =20 @@ -829,7 +851,7 @@ static void htab_elem_free(struct bpf_htab *htab, struc= t htab_elem *l) { if (htab->map.map_type =3D=3D BPF_MAP_TYPE_PERCPU_HASH) free_percpu(htab_elem_get_ptr(l, htab->map.key_size)); - check_and_free_timer(htab, l); + check_and_free_fields(htab, l); kfree(l); } =20 @@ -857,7 +879,7 @@ static void free_htab_elem(struct bpf_htab *htab, struc= t htab_elem *l) htab_put_fd_value(htab, l); =20 if (htab_is_prealloc(htab)) { - check_and_free_timer(htab, l); + check_and_free_fields(htab, l); __pcpu_freelist_push(&htab->freelist, &l->fnode); } else { atomic_dec(&htab->count); @@ -1104,7 +1126,7 @@ static int htab_map_update_elem(struct bpf_map *map, = void *key, void *value, if (!htab_is_prealloc(htab)) free_htab_elem(htab, l_old); else - check_and_free_timer(htab, l_old); + check_and_free_fields(htab, l_old); } ret =3D 0; err: @@ -1114,7 +1136,7 @@ static int htab_map_update_elem(struct bpf_map *map, = void *key, void *value, =20 static void htab_lru_push_free(struct bpf_htab *htab, struct htab_elem *el= em) { - check_and_free_timer(htab, elem); + check_and_free_fields(htab, elem); bpf_lru_push_free(&htab->lru, &elem->lru_node); } =20 @@ -1419,8 +1441,14 @@ static void htab_free_malloced_timers(struct bpf_hta= b *htab) struct hlist_nulls_node *n; struct htab_elem *l; =20 - hlist_nulls_for_each_entry(l, n, head, hash_node) - check_and_free_timer(htab, l); + hlist_nulls_for_each_entry(l, n, head, hash_node) { + /* We don't reset or free kptr on uref dropping to zero, + * hence just free timer. + */ + bpf_timer_cancel_and_free(l->key + + round_up(htab->map.key_size, 8) + + htab->map.timer_off); + } cond_resched_rcu(); } rcu_read_unlock(); @@ -1430,7 +1458,8 @@ static void htab_map_free_timers(struct bpf_map *map) { struct bpf_htab *htab =3D container_of(map, struct bpf_htab, map); =20 - if (likely(!map_value_has_timer(&htab->map))) + /* We don't reset or free kptr on uref dropping to zero. */ + if (!map_value_has_timer(&htab->map)) return; if (!htab_is_prealloc(htab)) htab_free_malloced_timers(htab); @@ -1453,11 +1482,14 @@ static void htab_map_free(struct bpf_map *map) * not have executed. Wait for them. */ rcu_barrier(); - if (!htab_is_prealloc(htab)) + if (!htab_is_prealloc(htab)) { delete_all_elements(htab); - else + } else { + htab_free_prealloced_kptrs(htab); prealloc_destroy(htab); + } =20 + bpf_map_free_kptr_off_tab(map); free_percpu(htab->extra_elems); bpf_map_area_free(htab->buckets); for (i =3D 0; i < HASHTAB_MAP_LOCK_COUNT; i++) diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 811bc71b0906..f4d1f974a8cd 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -507,8 +507,11 @@ void bpf_map_free_kptr_off_tab(struct bpf_map *map) =20 if (!map_value_has_kptrs(map)) return; - for (i =3D 0; i < tab->nr_off; i++) + for (i =3D 0; i < tab->nr_off; i++) { + if (tab->off[i].kptr.module) + module_put(tab->off[i].kptr.module); btf_put(tab->off[i].kptr.btf); + } kfree(tab); map->kptr_off_tab =3D NULL; } @@ -525,8 +528,18 @@ struct bpf_map_value_off *bpf_map_copy_kptr_off_tab(co= nst struct bpf_map *map) if (!new_tab) return ERR_PTR(-ENOMEM); /* Do a deep copy of the kptr_off_tab */ - for (i =3D 0; i < tab->nr_off; i++) + for (i =3D 0; i < tab->nr_off; i++) { btf_get(tab->off[i].kptr.btf); + if (tab->off[i].kptr.module && !try_module_get(tab->off[i].kptr.module))= { + while (i--) { + if (tab->off[i].kptr.module) + module_put(tab->off[i].kptr.module); + btf_put(tab->off[i].kptr.btf); + } + kfree(new_tab); + return ERR_PTR(-ENXIO); + } + } return new_tab; } =20 @@ -546,6 +559,33 @@ bool bpf_map_equal_kptr_off_tab(const struct bpf_map *= map_a, const struct bpf_ma return !memcmp(tab_a, tab_b, size); } =20 +/* Caller must ensure map_value_has_kptrs is true. Note that this function= can + * be called on a map value while the map_value is visible to BPF programs= , as + * it ensures the correct synchronization, and we already enforce the same= using + * the bpf_kptr_xchg helper on the BPF program side for referenced kptrs. + */ +void bpf_map_free_kptrs(struct bpf_map *map, void *map_value) +{ + struct bpf_map_value_off *tab =3D map->kptr_off_tab; + unsigned long *btf_id_ptr; + int i; + + for (i =3D 0; i < tab->nr_off; i++) { + struct bpf_map_value_off_desc *off_desc =3D &tab->off[i]; + unsigned long old_ptr; + + btf_id_ptr =3D map_value + off_desc->offset; + if (off_desc->type =3D=3D BPF_KPTR_UNREF) { + u64 *p =3D (u64 *)btf_id_ptr; + + WRITE_ONCE(p, 0); + continue; + } + old_ptr =3D xchg(btf_id_ptr, 0); + off_desc->kptr.dtor((void *)old_ptr); + } +} + /* called from workqueue */ static void bpf_map_free_deferred(struct work_struct *work) { @@ -553,9 +593,10 @@ static void bpf_map_free_deferred(struct work_struct *= work) =20 security_bpf_map_free(map); kfree(map->off_arr); - bpf_map_free_kptr_off_tab(map); bpf_map_release_memcg(map); - /* implementation dependent freeing */ + /* implementation dependent freeing, map_free callback also does + * bpf_map_free_kptr_off_tab, if needed. + */ map->ops->map_free(map); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86BADC32762 for ; Mon, 15 Aug 2022 21:18:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347535AbiHOVS1 (ORCPT ); Mon, 15 Aug 2022 17:18:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243926AbiHOVJ1 (ORCPT ); Mon, 15 Aug 2022 17:09:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D3D254CB5; Mon, 15 Aug 2022 12:18:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 88FBD60A52; Mon, 15 Aug 2022 19:18:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B6D9C433D6; Mon, 15 Aug 2022 19:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591134; bh=YtyBoUIxn3QX5ba5O8rN16+/jqTBV3/xRXxJO7Nnqhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SAULSfqrSXkx8TWS2BnJLHfBftZ6iy2URkyrPr3VE3R3bh1H8iFoQC1nYZtCd4Ugj ZwQLCpIJVkmIM8XvQCrTOgn6YPxqFowCpyHpRtl7bdfZQV4wUQh5+Foe+0qeWhkrzf 2M4Fy1SLMrSRL82gNhj+h8caP5IP0W5yHe/NIFNk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.18 0482/1095] bpf: fix potential 32-bit overflow when accessing ARRAY map element Date: Mon, 15 Aug 2022 19:58:01 +0200 Message-Id: <20220815180449.508630492@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrii Nakryiko [ Upstream commit 87ac0d600943994444e24382a87aa19acc4cd3d4 ] If BPF array map is bigger than 4GB, element pointer calculation can overflow because both index and elem_size are u32. Fix this everywhere by forcing 64-bit multiplication. Extract this formula into separate small helper and use it consistently in various places. Speculative-preventing formula utilizing index_mask trick is left as is, but explicit u64 casts are added in both places. Fixes: c85d69135a91 ("bpf: move memory size checks to bpf_map_charge_init()= ") Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/r/20220715053146.1291891-2-andrii@kernel.org Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/bpf/arraymap.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c index c3de63ce574e..d015fce67865 100644 --- a/kernel/bpf/arraymap.c +++ b/kernel/bpf/arraymap.c @@ -155,6 +155,11 @@ static struct bpf_map *array_map_alloc(union bpf_attr = *attr) return &array->map; } =20 +static void *array_map_elem_ptr(struct bpf_array* array, u32 index) +{ + return array->value + (u64)array->elem_size * index; +} + /* Called from syscall or from eBPF program */ static void *array_map_lookup_elem(struct bpf_map *map, void *key) { @@ -164,7 +169,7 @@ static void *array_map_lookup_elem(struct bpf_map *map,= void *key) if (unlikely(index >=3D array->map.max_entries)) return NULL; =20 - return array->value + array->elem_size * (index & array->index_mask); + return array->value + (u64)array->elem_size * (index & array->index_mask); } =20 static int array_map_direct_value_addr(const struct bpf_map *map, u64 *imm, @@ -324,7 +329,7 @@ static int array_map_update_elem(struct bpf_map *map, v= oid *key, void *value, value, map->value_size); } else { val =3D array->value + - array->elem_size * (index & array->index_mask); + (u64)array->elem_size * (index & array->index_mask); if (map_flags & BPF_F_LOCK) copy_map_value_locked(map, val, value, false); else @@ -393,8 +398,7 @@ static void array_map_free_timers(struct bpf_map *map) return; =20 for (i =3D 0; i < array->map.max_entries; i++) - bpf_timer_cancel_and_free(array->value + array->elem_size * i + - map->timer_off); + bpf_timer_cancel_and_free(array_map_elem_ptr(array, i) + map->timer_off); } =20 /* Called when map->refcnt goes to zero, either from workqueue or from sys= call */ @@ -405,7 +409,7 @@ static void array_map_free(struct bpf_map *map) =20 if (map_value_has_kptrs(map)) { for (i =3D 0; i < array->map.max_entries; i++) - bpf_map_free_kptrs(map, array->value + array->elem_size * i); + bpf_map_free_kptrs(map, array_map_elem_ptr(array, i)); bpf_map_free_kptr_off_tab(map); } =20 @@ -541,7 +545,7 @@ static void *bpf_array_map_seq_start(struct seq_file *s= eq, loff_t *pos) index =3D info->index & array->index_mask; if (info->percpu_value_buf) return array->pptrs[index]; - return array->value + array->elem_size * index; + return array_map_elem_ptr(array, index); } =20 static void *bpf_array_map_seq_next(struct seq_file *seq, void *v, loff_t = *pos) @@ -560,7 +564,7 @@ static void *bpf_array_map_seq_next(struct seq_file *se= q, void *v, loff_t *pos) index =3D info->index & array->index_mask; if (info->percpu_value_buf) return array->pptrs[index]; - return array->value + array->elem_size * index; + return array_map_elem_ptr(array, index); } =20 static int __bpf_array_map_seq_show(struct seq_file *seq, void *v) @@ -675,7 +679,7 @@ static int bpf_for_each_array_elem(struct bpf_map *map,= bpf_callback_t callback_ if (is_percpu) val =3D this_cpu_ptr(array->pptrs[i]); else - val =3D array->value + array->elem_size * i; + val =3D array_map_elem_ptr(array, i); num_elems++; key =3D i; ret =3D callback_fn((u64)(long)map, (u64)(long)&key, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CCBBC32757 for ; Mon, 15 Aug 2022 21:18:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347642AbiHOVSi (ORCPT ); Mon, 15 Aug 2022 17:18:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243585AbiHOVKF (ORCPT ); Mon, 15 Aug 2022 17:10:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C27315509F; Mon, 15 Aug 2022 12:18:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 126E1B81120; Mon, 15 Aug 2022 19:18:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 625B7C433C1; Mon, 15 Aug 2022 19:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591136; bh=zo472JXDZC4ztxKvqyyytsSeGVG+XJDGa+4eATKg5Ug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rclxg+/wJferl0senWSDyT4tmR0r4yXs8eVFPi44i7UZ/7hh43HRcMioXKGOTPTEl WSIfyHnMeh0wEuB7FfM+Ad8qRkVnN1FlYvsRIBdH/euniQvmkrySOCnlplefux8PNL f9sA52ltqI2Wky60QXfNdVsH7XD6VkNqg5F0jx+c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Martin KaFai Lau , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.18 0483/1095] selftests/bpf: fix a test for snprintf() overflow Date: Mon, 15 Aug 2022 19:58:02 +0200 Message-Id: <20220815180449.544839968@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit c5d22f4cfe8dfb93f1db0a1e7e2e7ebc41395d98 ] The snprintf() function returns the number of bytes which *would* have been copied if there were space. In other words, it can be > sizeof(pin_path). Fixes: c0fa1b6c3efc ("bpf: btf: Add BTF tests") Signed-off-by: Dan Carpenter Acked-by: Martin KaFai Lau Link: https://lore.kernel.org/r/YtZ+aD/tZMkgOUw+@kili Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/testing/selftests/bpf/prog_tests/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests/btf.c b/tools/testing/s= elftests/bpf/prog_tests/btf.c index ec823561b912..a294176f8a9d 100644 --- a/tools/testing/selftests/bpf/prog_tests/btf.c +++ b/tools/testing/selftests/bpf/prog_tests/btf.c @@ -5226,7 +5226,7 @@ static void do_test_pprint(int test_num) ret =3D snprintf(pin_path, sizeof(pin_path), "%s/%s", "/sys/fs/bpf", test->map_name); =20 - if (CHECK(ret =3D=3D sizeof(pin_path), "pin_path %s/%s is too long", + if (CHECK(ret >=3D sizeof(pin_path), "pin_path %s/%s is too long", "/sys/fs/bpf", test->map_name)) { err =3D -1; goto done; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83135C00140 for ; Mon, 15 Aug 2022 21:19:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347714AbiHOVSn (ORCPT ); Mon, 15 Aug 2022 17:18:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244573AbiHOVK4 (ORCPT ); Mon, 15 Aug 2022 17:10:56 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A575C558C9; Mon, 15 Aug 2022 12:19:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 957AACE12C4; Mon, 15 Aug 2022 19:19:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A3A9C433C1; Mon, 15 Aug 2022 19:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591139; bh=JYVX+japmWo6QkvwKxE7PofA1DxPVMaWjvU8+Bwxme0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UJSuEFBTdB5P5usijTlDveuaO+xuFxqfYKp7MpPwT3u9ZUxi2OmKApn5WOwgF66Fr RtvE47vLF+Ojr5i/lqq6TrJjQB2sWyPJJT0rG9HXdBEiIL3lbR2Rh4tLllkDeijGKP c7Qr/YRs/O5khJ1vtYri6NmnN9gW6lhAs3d/7Qqk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Martin KaFai Lau , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.18 0484/1095] libbpf: fix an snprintf() overflow check Date: Mon, 15 Aug 2022 19:58:03 +0200 Message-Id: <20220815180449.583538580@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit b77ffb30cfc5f58e957571d8541c6a7e3da19221 ] The snprintf() function returns the number of bytes it *would* have copied if there were enough space. So it can return > the sizeof(gen->attach_target). Fixes: 67234743736a ("libbpf: Generate loader program out of BPF ELF file.") Signed-off-by: Dan Carpenter Acked-by: Martin KaFai Lau Link: https://lore.kernel.org/r/YtZ+oAySqIhFl6/J@kili Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/lib/bpf/gen_loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/gen_loader.c b/tools/lib/bpf/gen_loader.c index 927745b08014..23f5c46708f8 100644 --- a/tools/lib/bpf/gen_loader.c +++ b/tools/lib/bpf/gen_loader.c @@ -533,7 +533,7 @@ void bpf_gen__record_attach_target(struct bpf_gen *gen,= const char *attach_name, gen->attach_kind =3D kind; ret =3D snprintf(gen->attach_target, sizeof(gen->attach_target), "%s%s", prefix, attach_name); - if (ret =3D=3D sizeof(gen->attach_target)) + if (ret >=3D sizeof(gen->attach_target)) gen->error =3D -ENOSPC; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5C3EC25B08 for ; Mon, 15 Aug 2022 21:19:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231631AbiHOVSu (ORCPT ); Mon, 15 Aug 2022 17:18:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244621AbiHOVLB (ORCPT ); Mon, 15 Aug 2022 17:11:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09C9C558DD; Mon, 15 Aug 2022 12:19:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 55D61B810C6; Mon, 15 Aug 2022 19:19:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 947B3C433C1; Mon, 15 Aug 2022 19:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591143; bh=3M1eR0MH/er0VTOTeQQq/ugsH+gor7sowFVWjoopc6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XciqChUwIuviBjYSTH6BFK1nmjvRTv2Zcd52aDIpQwjuHjiqoN67uUMa3ukk0pdHQ EgJkR6/dpx9/NnSYJjhn/HxKsMIx23Q3VIVop5qFyqbmsn1vaxG53/h/AEszpa5zOY dq36hMLNKQI5i3p1k7TFCGt03QO+ouFTLu2PiY9s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.18 0485/1095] can: pch_can: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:58:04 +0200 Message-Id: <20220815180449.618564688@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Mailhol [ Upstream commit 3a5c7e4611ddcf0ef37a3a17296b964d986161a6 ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: 0c78ab76a05c ("pch_can: Add setting TEC/REC statistics processing") Link: https://lore.kernel.org/all/20220719143550.3681-2-mailhol.vincent@wan= adoo.fr Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/can/pch_can.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c index 888bef03de09..076b1339f806 100644 --- a/drivers/net/can/pch_can.c +++ b/drivers/net/can/pch_can.c @@ -496,6 +496,9 @@ static void pch_can_error(struct net_device *ndev, u32 = status) cf->can_id |=3D CAN_ERR_BUSOFF; priv->can.can_stats.bus_off++; can_bus_off(ndev); + } else { + cf->data[6] =3D errc & PCH_TEC; + cf->data[7] =3D (errc & PCH_REC) >> 8; } =20 errc =3D ioread32(&priv->regs->errc); @@ -556,9 +559,6 @@ static void pch_can_error(struct net_device *ndev, u32 = status) break; } =20 - cf->data[6] =3D errc & PCH_TEC; - cf->data[7] =3D (errc & PCH_REC) >> 8; - priv->can.state =3D state; netif_receive_skb(skb); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0372DC3F6B0 for ; Mon, 15 Aug 2022 21:19:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243293AbiHOVTi (ORCPT ); Mon, 15 Aug 2022 17:19:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245264AbiHOVLS (ORCPT ); Mon, 15 Aug 2022 17:11:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE7FD564C7; Mon, 15 Aug 2022 12:19:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 61D1FB81128; Mon, 15 Aug 2022 19:19:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E0BDC433D6; Mon, 15 Aug 2022 19:19:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591146; bh=Mc5px7yuSl0vtm8jgs5tSOtHfACObvjp6R7zxjWog5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X4ewcEFrzXkGhAO6jobjsMCO07ILyEFlzSMqiDXQhY2mfLuhmEYksyeZJ7ysHjMmC uaWmso5TrKv9QLWGrv0oXspqTZQ+R6U6t1BC/V/ozt46Qb2ikjvFrKNN20IrOSceUc mt6BckBZ3q3vp+1ckC+u5PCqH5omt7NPoZgg7cQc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.18 0486/1095] can: rcar_can: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:58:05 +0200 Message-Id: <20220815180449.659850915@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Mailhol [ Upstream commit a37b7245e831a641df360ca41db6a71c023d3746 ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: fd1159318e55 ("can: add Renesas R-Car CAN driver") Link: https://lore.kernel.org/all/20220719143550.3681-3-mailhol.vincent@wan= adoo.fr Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/can/rcar/rcar_can.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/can/rcar/rcar_can.c b/drivers/net/can/rcar/rcar_ca= n.c index 33e37395379d..4ca5b09f1e5d 100644 --- a/drivers/net/can/rcar/rcar_can.c +++ b/drivers/net/can/rcar/rcar_can.c @@ -233,11 +233,8 @@ static void rcar_can_error(struct net_device *ndev) if (eifr & (RCAR_CAN_EIFR_EWIF | RCAR_CAN_EIFR_EPIF)) { txerr =3D readb(&priv->regs->tecr); rxerr =3D readb(&priv->regs->recr); - if (skb) { + if (skb) cf->can_id |=3D CAN_ERR_CRTL; - cf->data[6] =3D txerr; - cf->data[7] =3D rxerr; - } } if (eifr & RCAR_CAN_EIFR_BEIF) { int rx_errors =3D 0, tx_errors =3D 0; @@ -337,6 +334,9 @@ static void rcar_can_error(struct net_device *ndev) can_bus_off(ndev); if (skb) cf->can_id |=3D CAN_ERR_BUSOFF; + } else if (skb) { + cf->data[6] =3D txerr; + cf->data[7] =3D rxerr; } if (eifr & RCAR_CAN_EIFR_ORIF) { netdev_dbg(priv->ndev, "Receive overrun error interrupt\n"); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EC36C282E7 for ; Mon, 15 Aug 2022 21:19:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241318AbiHOVTJ (ORCPT ); Mon, 15 Aug 2022 17:19:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245439AbiHOVLV (ORCPT ); Mon, 15 Aug 2022 17:11:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0CFC2E68E; Mon, 15 Aug 2022 12:19:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B03D76009B; Mon, 15 Aug 2022 19:19:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7021C433D6; Mon, 15 Aug 2022 19:19:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591149; bh=bie2YhzVa1X6tTTKAxzCNdn7whSyCkG11tybkM125Sc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D91yuvuPVRhJs2PQhJAurPR8ThWnmzWul5K72y4AvjtPD6y2vFuGLVZS6h2T9vDLS fLst2tc2+V9UxC+7+bjp1a7RgXcCavwP6jHz0xhhNn2GLJd1ZkzmpuBwg3tI7npUUr xXZX+dGJ/A5e05UpHbcwvGZERbJC8Rh8if6zB7xc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.18 0487/1095] can: sja1000: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:58:06 +0200 Message-Id: <20220815180449.692349927@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Mailhol [ Upstream commit 164d7cb2d5a30f1b3a5ab4fab1a27731fb1494a8 ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: 215db1856e83 ("can: sja1000: Consolidate and unify state change hand= ling") Link: https://lore.kernel.org/all/20220719143550.3681-4-mailhol.vincent@wan= adoo.fr Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/can/sja1000/sja1000.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sj= a1000.c index 966316479485..366a369080ef 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c @@ -405,9 +405,6 @@ static int sja1000_err(struct net_device *dev, uint8_t = isrc, uint8_t status) txerr =3D priv->read_reg(priv, SJA1000_TXERR); rxerr =3D priv->read_reg(priv, SJA1000_RXERR); =20 - cf->data[6] =3D txerr; - cf->data[7] =3D rxerr; - if (isrc & IRQ_DOI) { /* data overrun interrupt */ netdev_dbg(dev, "data overrun interrupt\n"); @@ -429,6 +426,10 @@ static int sja1000_err(struct net_device *dev, uint8_t= isrc, uint8_t status) else state =3D CAN_STATE_ERROR_ACTIVE; } + if (state !=3D CAN_STATE_BUS_OFF) { + cf->data[6] =3D txerr; + cf->data[7] =3D rxerr; + } if (isrc & IRQ_BEI) { /* bus error interrupt */ priv->can.can_stats.bus_error++; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2FE1C25B0E for ; Mon, 15 Aug 2022 21:19:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242225AbiHOVTX (ORCPT ); Mon, 15 Aug 2022 17:19:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343500AbiHOVL1 (ORCPT ); Mon, 15 Aug 2022 17:11:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E79A56B92; Mon, 15 Aug 2022 12:19:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 92255B810A3; Mon, 15 Aug 2022 19:19:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E233BC433C1; Mon, 15 Aug 2022 19:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591152; bh=eOIpwwLug7xaU7xZcpgJ3YxRa4IP5m/bwHHhlYRXlxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g1Occ6u9r28Q7+SkVsjo1PzH6xBKSMxK1YVcEgo25NHUX+uoIkmytXdzF7H8KSfn4 J1Hp6486wFJe6lVpaE9lwEEFKzKQdDUQZOJd+3GxJYYG2hWUHSTGAG5GlwrmztRYkZ L4g08QW6fq5A6mm7lnaX0tffNwQNLUWPWHA0+gQI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.18 0488/1095] can: hi311x: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:58:07 +0200 Message-Id: <20220815180449.733238387@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Mailhol [ Upstream commit a22bd630cfff496b270211745536e50e98eb3a45 ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: 57e83fb9b746 ("can: hi311x: Add Holt HI-311x CAN driver") Link: https://lore.kernel.org/all/20220719143550.3681-6-mailhol.vincent@wan= adoo.fr Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/can/spi/hi311x.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c index a5b2952b8d0f..7dc88a9eca0f 100644 --- a/drivers/net/can/spi/hi311x.c +++ b/drivers/net/can/spi/hi311x.c @@ -672,8 +672,6 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id) =20 txerr =3D hi3110_read(spi, HI3110_READ_TEC); rxerr =3D hi3110_read(spi, HI3110_READ_REC); - cf->data[6] =3D txerr; - cf->data[7] =3D rxerr; tx_state =3D txerr >=3D rxerr ? new_state : 0; rx_state =3D txerr <=3D rxerr ? new_state : 0; can_change_state(net, cf, tx_state, rx_state); @@ -686,6 +684,9 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id) hi3110_hw_sleep(spi); break; } + } else { + cf->data[6] =3D txerr; + cf->data[7] =3D rxerr; } } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E98F7C00140 for ; Mon, 15 Aug 2022 21:19:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241636AbiHOVTb (ORCPT ); Mon, 15 Aug 2022 17:19:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343972AbiHOVLe (ORCPT ); Mon, 15 Aug 2022 17:11:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF142564CB; Mon, 15 Aug 2022 12:19:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0C8A2B81123; Mon, 15 Aug 2022 19:19:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFAA7C433C1; Mon, 15 Aug 2022 19:19:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591155; bh=mOJiTfYXXghttqqDx/jhCa0gwW/IhXfWePwJX7Lm2Ik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ryusZDU+c6p2Qksc5GqJSBJyNva3+podBcUZi15esiWD3uKNTOdN8LfxlirrDzN55 hbJUt/+mDp5NwVBe/G8gPMxfhpKMpdUJdLnk+5kEjMwxRyG83Yz5Pc5ljpezETqJYk iNtOq+o627YSVELPY+xQyROtsYsPEwAK1gs2aiWw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.18 0489/1095] can: sun4i_can: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:58:08 +0200 Message-Id: <20220815180449.768645301@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Mailhol [ Upstream commit 0ac15a8f661b941519379831d09bfb12271b23ee ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: 0738eff14d81 ("can: Allwinner A10/A20 CAN Controller support - Kerne= l module") Link: https://lore.kernel.org/all/20220719143550.3681-7-mailhol.vincent@wan= adoo.fr CC: Chen-Yu Tsai Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/can/sun4i_can.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c index 25d6d81ab4f4..f3ad585e766f 100644 --- a/drivers/net/can/sun4i_can.c +++ b/drivers/net/can/sun4i_can.c @@ -538,11 +538,6 @@ static int sun4i_can_err(struct net_device *dev, u8 is= rc, u8 status) rxerr =3D (errc >> 16) & 0xFF; txerr =3D errc & 0xFF; =20 - if (skb) { - cf->data[6] =3D txerr; - cf->data[7] =3D rxerr; - } - if (isrc & SUN4I_INT_DATA_OR) { /* data overrun interrupt */ netdev_dbg(dev, "data overrun interrupt\n"); @@ -573,6 +568,10 @@ static int sun4i_can_err(struct net_device *dev, u8 is= rc, u8 status) else state =3D CAN_STATE_ERROR_ACTIVE; } + if (skb && state !=3D CAN_STATE_BUS_OFF) { + cf->data[6] =3D txerr; + cf->data[7] =3D rxerr; + } if (isrc & SUN4I_INT_BUS_ERR) { /* bus error interrupt */ netdev_dbg(dev, "bus error interrupt\n"); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45312C00140 for ; Mon, 15 Aug 2022 21:20:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243633AbiHOVTv (ORCPT ); Mon, 15 Aug 2022 17:19:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344327AbiHOVLi (ORCPT ); Mon, 15 Aug 2022 17:11:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4644CD8B21; Mon, 15 Aug 2022 12:19:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4BCC5B810C6; Mon, 15 Aug 2022 19:19:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D529C433C1; Mon, 15 Aug 2022 19:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591159; bh=KjpTREGfDX1i7sYjb8h6LrLMdereyImHgHdSfSNAH0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TV/4Go1+ZXalXbN2cmdAqM5W1Pyfub1JKgaK5dGhfMAWN77C2GcZb0Y40UJaGOA1J ER/DDAMK7kT4OoDGFUDyRALl0j13y/kL97jFTHc/3gK4VaXmFGi6GKggN/gGO+VYIk hH4vj101M4NmPGHlIGLqLENiIBb65+C/spjGJaHg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson , Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.18 0490/1095] can: kvaser_usb_hydra: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:58:09 +0200 Message-Id: <20220815180449.809307035@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Mailhol [ Upstream commit 936e90595376e64b6247c72d3ea8b8b164b7ac96 ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: aec5fb2268b7 ("can: kvaser_usb: Add support for Kvaser USB hydra fam= ily") Link: https://lore.kernel.org/all/20220719143550.3681-8-mailhol.vincent@wan= adoo.fr CC: Jimmy Assarsson Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c b/drivers/ne= t/can/usb/kvaser_usb/kvaser_usb_hydra.c index 5d70844ac030..404093468b2f 100644 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c @@ -917,8 +917,10 @@ static void kvaser_usb_hydra_update_state(struct kvase= r_usb_net_priv *priv, new_state < CAN_STATE_BUS_OFF) priv->can.can_stats.restarts++; =20 - cf->data[6] =3D bec->txerr; - cf->data[7] =3D bec->rxerr; + if (new_state !=3D CAN_STATE_BUS_OFF) { + cf->data[6] =3D bec->txerr; + cf->data[7] =3D bec->rxerr; + } =20 netif_rx(skb); } @@ -1069,8 +1071,10 @@ kvaser_usb_hydra_error_frame(struct kvaser_usb_net_p= riv *priv, shhwtstamps->hwtstamp =3D hwtstamp; =20 cf->can_id |=3D CAN_ERR_BUSERROR; - cf->data[6] =3D bec.txerr; - cf->data[7] =3D bec.rxerr; + if (new_state !=3D CAN_STATE_BUS_OFF) { + cf->data[6] =3D bec.txerr; + cf->data[7] =3D bec.rxerr; + } =20 netif_rx(skb); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D94AC00140 for ; Mon, 15 Aug 2022 21:20:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244018AbiHOVUB (ORCPT ); Mon, 15 Aug 2022 17:20:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344397AbiHOVLl (ORCPT ); Mon, 15 Aug 2022 17:11:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AAF474E34; Mon, 15 Aug 2022 12:19:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AADE460FAD; Mon, 15 Aug 2022 19:19:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAD8EC433C1; Mon, 15 Aug 2022 19:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591162; bh=Ck2+hCrQVgLQVzZ0ToyRALvKkwnPpjmXE+ci7kc4odo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GJemErACgLDcql30+PF9nW2irI92KfQrJFgNmJ7P2WfRJWjTAdagzdw7XDfGdsuGz v//D4QRc2dNAKfGXRL1aAOB8Hy+CqBbBPHbai+BnuN1vz2sHPJIE6ubW79zAJlZjIF 0bfru6idZl4tKZMYZEw/K0WVsGA3OW0yeyvnMz24= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson , Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.18 0491/1095] can: kvaser_usb_leaf: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:58:10 +0200 Message-Id: <20220815180449.844409080@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Mailhol [ Upstream commit a57732084e06791d37ea1ea447cca46220737abd ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: 7259124eac7d1 ("can: kvaser_usb: Split driver into kvaser_usb_core.c= and kvaser_usb_leaf.c") Link: https://lore.kernel.org/all/20220719143550.3681-9-mailhol.vincent@wan= adoo.fr CC: Jimmy Assarsson Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c b/drivers/net= /can/usb/kvaser_usb/kvaser_usb_leaf.c index cc809ecd1e62..f551fde16a70 100644 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -853,8 +853,10 @@ static void kvaser_usb_leaf_rx_error(const struct kvas= er_usb *dev, break; } =20 - cf->data[6] =3D es->txerr; - cf->data[7] =3D es->rxerr; + if (new_state !=3D CAN_STATE_BUS_OFF) { + cf->data[6] =3D es->txerr; + cf->data[7] =3D es->rxerr; + } =20 netif_rx(skb); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60F31C00140 for ; Mon, 15 Aug 2022 21:20:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244834AbiHOVUU (ORCPT ); Mon, 15 Aug 2022 17:20:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344754AbiHOVLs (ORCPT ); Mon, 15 Aug 2022 17:11:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53BF9D9E8C; Mon, 15 Aug 2022 12:19:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AF31660FAD; Mon, 15 Aug 2022 19:19:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AABC1C433D6; Mon, 15 Aug 2022 19:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591168; bh=+LY3GhzYm1T5o5hEdNkydbAr4fEcREFXwhcZw2B5lhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ION5jsm4cNlRcOkqj8OXcyF8nVIjktfwnO3zoaHl0mSYrC3t6LgFmWuv9FcgDo3pK d9Z/DiRZgJRid8LAFxWAjgCF4L/vFMlEFU7VN6mNp0YcQLhis8iY419e09cEKE6JIn CaK7GCgnPJ5wHiwRAOnJT3jAFA+865zhjIQy+CYA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.18 0492/1095] can: usb_8dev: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:58:11 +0200 Message-Id: <20220815180449.888894818@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Mailhol [ Upstream commit aebe8a2433cd090ccdc222861f44bddb75eb01de ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: 0024d8ad1639 ("can: usb_8dev: Add support for USB2CAN interface from= 8 devices") Link: https://lore.kernel.org/all/20220719143550.3681-10-mailhol.vincent@wa= nadoo.fr Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/can/usb/usb_8dev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c index b638604bf1ee..ea63dc687fdb 100644 --- a/drivers/net/can/usb/usb_8dev.c +++ b/drivers/net/can/usb/usb_8dev.c @@ -439,9 +439,10 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *= priv, =20 if (rx_errors) stats->rx_errors++; - - cf->data[6] =3D txerr; - cf->data[7] =3D rxerr; + if (priv->can.state !=3D CAN_STATE_BUS_OFF) { + cf->data[6] =3D txerr; + cf->data[7] =3D rxerr; + } =20 priv->bec.txerr =3D txerr; priv->bec.rxerr =3D rxerr; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDD37C28B2C for ; Mon, 15 Aug 2022 21:22:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245321AbiHOVUl (ORCPT ); Mon, 15 Aug 2022 17:20:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238649AbiHOVM2 (ORCPT ); Mon, 15 Aug 2022 17:12:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE786D9EA7; Mon, 15 Aug 2022 12:19:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BC89260FF6; Mon, 15 Aug 2022 19:19:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AE23C433D6; Mon, 15 Aug 2022 19:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591171; bh=jGYDKm0Tw+bfYKYZH5hqWm2mnwiYORDMGSxt/7Z6A0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qUhPRHp6tfi0WGpfO5cQLjy0UPPpO8MmiTsTBpDucBrVIiqqXnihyvzoRqh+hlZK3 uOX/fQUu9HCHltMciUtkhgGvYqvIL9izPQRg7UIL26dfbHZMvctoXz0lEedhPXcdbH MHHXDbmlw0A8/r7gvT8/2IaKr3dapn3pUx1tKVw0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.18 0493/1095] can: error: specify the values of data[5..7] of CAN error frames Date: Mon, 15 Aug 2022 19:58:12 +0200 Message-Id: <20220815180449.929847988@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Mailhol [ Upstream commit e70a3263a7eed768d5f947b8f2aff8d2a79c9d97 ] Currently, data[5..7] of struct can_frame, when used as a CAN error frame, are defined as being "controller specific". Device specific behaviours are problematic because it prevents someone from writing code which is portable between devices. As a matter of fact, data[5] is never used, data[6] is always used to report TX error counter and data[7] is always used to report RX error counter. can-utils also relies on this. This patch updates the comment in the uapi header to specify that data[5] is reserved (and thus should not be used) and that data[6..7] are used for error counters. Fixes: 0d66548a10cb ("[CAN]: Add PF_CAN core module") Link: https://lore.kernel.org/all/20220719143550.3681-11-mailhol.vincent@wa= nadoo.fr Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/uapi/linux/can/error.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/can/error.h b/include/uapi/linux/can/error.h index 34633283de64..a1000cb63063 100644 --- a/include/uapi/linux/can/error.h +++ b/include/uapi/linux/can/error.h @@ -120,6 +120,9 @@ #define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */ #define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */ =20 -/* controller specific additional information / data[5..7] */ +/* data[5] is reserved (do not use) */ + +/* TX error counter / data[6] */ +/* RX error counter / data[7] */ =20 #endif /* _UAPI_CAN_ERROR_H */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CED1BC2BB43 for ; Mon, 15 Aug 2022 21:22:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245510AbiHOVUo (ORCPT ); Mon, 15 Aug 2022 17:20:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231310AbiHOVMv (ORCPT ); Mon, 15 Aug 2022 17:12:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 271FAD9EB9; Mon, 15 Aug 2022 12:19:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 740E7B810C6; Mon, 15 Aug 2022 19:19:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B401EC43146; Mon, 15 Aug 2022 19:19:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591174; bh=/Ep41pE7oDOpaDpBHOmpca5SEeozGMujjWwqQHauVtA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gWAZWS+KGfGXBUSWVIyRjwwILtZrAmQBOcRJnCLIWNT8DTML6CqXurAsmzKoLV5Oa amPFsUpKLDyYon3+Hxy+733LVcS7U+w1wqz+V5/YtmHmRR1WPDLvQhW+eSIe48yd3H ervFcywt7sM0KZgnU+Q89AG2EchlS0Zb/tpjrbaw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.18 0494/1095] can: pch_can: pch_can_error(): initialize errc before using it Date: Mon, 15 Aug 2022 19:58:13 +0200 Message-Id: <20220815180449.970063047@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Mailhol [ Upstream commit 9950f11211331180269867aef848c7cf56861742 ] After commit 3a5c7e4611dd, the variable errc is accessed before being initialized, c.f. below W=3D2 warning: | In function 'pch_can_error', | inlined from 'pch_can_poll' at drivers/net/can/pch_can.c:739:4: | drivers/net/can/pch_can.c:501:29: warning: 'errc' may be used uninitializ= ed [-Wmaybe-uninitialized] | 501 | cf->data[6] =3D errc & PCH_TEC; | | ^ | drivers/net/can/pch_can.c: In function 'pch_can_poll': | drivers/net/can/pch_can.c:484:13: note: 'errc' was declared here | 484 | u32 errc, lec; | | ^~~~ Moving errc initialization up solves this issue. Fixes: 3a5c7e4611dd ("can: pch_can: do not report txerr and rxerr during bu= s-off") Reported-by: Nathan Chancellor Signed-off-by: Vincent Mailhol Reviewed-by: Nathan Chancellor Link: https://lore.kernel.org/all/20220721160032.9348-1-mailhol.vincent@wan= adoo.fr Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/can/pch_can.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c index 076b1339f806..17f8d67ddb18 100644 --- a/drivers/net/can/pch_can.c +++ b/drivers/net/can/pch_can.c @@ -489,6 +489,7 @@ static void pch_can_error(struct net_device *ndev, u32 = status) if (!skb) return; =20 + errc =3D ioread32(&priv->regs->errc); if (status & PCH_BUS_OFF) { pch_can_set_tx_all(priv, 0); pch_can_set_rx_all(priv, 0); @@ -501,7 +502,6 @@ static void pch_can_error(struct net_device *ndev, u32 = status) cf->data[7] =3D (errc & PCH_REC) >> 8; } =20 - errc =3D ioread32(&priv->regs->errc); /* Warning interrupt. */ if (status & PCH_EWARN) { state =3D CAN_STATE_ERROR_WARNING; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF03DC32757 for ; Mon, 15 Aug 2022 21:22:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245714AbiHOVUy (ORCPT ); Mon, 15 Aug 2022 17:20:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231867AbiHOVMy (ORCPT ); Mon, 15 Aug 2022 17:12:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97E02D9E88; Mon, 15 Aug 2022 12:19:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F3F5860FAD; Mon, 15 Aug 2022 19:19:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE307C433C1; Mon, 15 Aug 2022 19:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591177; bh=8TplkGd97N18pN9xdr3NQUO0P7WdvSM5cJZ6n9xVWmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dco02L137gEjscKqSamDkC9myKKXkcfGKh2vsojkonO+5/VvbOa4Em3Z+OwMliZq0 q7ieW99x9K/lG8qV94xsNT2Jsyq/CCEe2VDiBiBI9KhWcIW3r/IU4kT39hK7VfXxkG b7xbn9iW3fyOTUVfgHhwCh6vOlYkFFCzolTYajJY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.18 0495/1095] Bluetooth: hci_intel: Add check for platform_driver_register Date: Mon, 15 Aug 2022 19:58:14 +0200 Message-Id: <20220815180450.002752306@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit ab2d2a982ff721f4b029282d9a40602ea46a745e ] As platform_driver_register() could fail, it should be better to deal with the return value in order to maintain the code consisitency. Fixes: 1ab1f239bf17 ("Bluetooth: hci_intel: Add support for platform driver= ") Signed-off-by: Jiasheng Jiang Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/bluetooth/hci_intel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c index 7249b91d9b91..78afb9a348e7 100644 --- a/drivers/bluetooth/hci_intel.c +++ b/drivers/bluetooth/hci_intel.c @@ -1217,7 +1217,11 @@ static struct platform_driver intel_driver =3D { =20 int __init intel_init(void) { - platform_driver_register(&intel_driver); + int err; + + err =3D platform_driver_register(&intel_driver); + if (err) + return err; =20 return hci_uart_register_proto(&intel_proto); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF392C2BBC5 for ; Mon, 15 Aug 2022 21:22:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343574AbiHOVVB (ORCPT ); Mon, 15 Aug 2022 17:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241239AbiHOVNp (ORCPT ); Mon, 15 Aug 2022 17:13:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C91BDAB9C; Mon, 15 Aug 2022 12:19:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C59EEB81122; Mon, 15 Aug 2022 19:19:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFE9EC433D6; Mon, 15 Aug 2022 19:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591180; bh=VwI+tU7kIt7/Mj5JWlsCMmZ+77AuLLrmY9LqbYMIQB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t4/R5rKmrNL7iO4eA8RmNOc9bj1OUTJkE6xF/W06H72wblglkMxV6uW/Nms+Zc4W8 R4COBc10ftiqBiW+ACJHNAbGfH4u+F66QyHA8ZjZ7AlRlrO3KINhB+EtUeD9W3TQ+o k/lGzZPJFId/XcuixG0HyzxeVYRaY3B9X56G/m5o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+63bed493aebbf6872647@syzkaller.appspotmail.com, Schspa Shi , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.18 0496/1095] Bluetooth: When HCI work queue is drained, only queue chained work Date: Mon, 15 Aug 2022 19:58:15 +0200 Message-Id: <20220815180450.051320724@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Schspa Shi [ Upstream commit 877afadad2dce8aae1f2aad8ce47e072d4f6165e ] The HCI command, event, and data packet processing workqueue is drained to avoid deadlock in commit 76727c02c1e1 ("Bluetooth: Call drain_workqueue() before resetting state"). There is another delayed work, which will queue command to this drained workqueue. Which results in the following error report: Bluetooth: hci2: command 0x040f tx timeout WARNING: CPU: 1 PID: 18374 at kernel/workqueue.c:1438 __queue_work+0xdad/0x= 1140 Workqueue: events hci_cmd_timeout RIP: 0010:__queue_work+0xdad/0x1140 RSP: 0000:ffffc90002cffc60 EFLAGS: 00010093 RAX: 0000000000000000 RBX: ffff8880b9d3ec00 RCX: 0000000000000000 RDX: ffff888024ba0000 RSI: ffffffff814e048d RDI: ffff8880b9d3ec08 RBP: 0000000000000008 R08: 0000000000000000 R09: 00000000b9d39700 R10: ffffffff814f73c6 R11: 0000000000000000 R12: ffff88807cce4c60 R13: 0000000000000000 R14: ffff8880796d8800 R15: ffff8880796d8800 FS: 0000000000000000(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000c0174b4000 CR3: 000000007cae9000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: ? queue_work_on+0xcb/0x110 ? lockdep_hardirqs_off+0x90/0xd0 queue_work_on+0xee/0x110 process_one_work+0x996/0x1610 ? pwq_dec_nr_in_flight+0x2a0/0x2a0 ? rwlock_bug.part.0+0x90/0x90 ? _raw_spin_lock_irq+0x41/0x50 worker_thread+0x665/0x1080 ? process_one_work+0x1610/0x1610 kthread+0x2e9/0x3a0 ? kthread_complete_and_exit+0x40/0x40 ret_from_fork+0x1f/0x30 To fix this, we can add a new HCI_DRAIN_WQ flag, and don't queue the timeout workqueue while command workqueue is draining. Fixes: 76727c02c1e1 ("Bluetooth: Call drain_workqueue() before resetting st= ate") Reported-by: syzbot+63bed493aebbf6872647@syzkaller.appspotmail.com Signed-off-by: Schspa Shi Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/net/bluetooth/hci.h | 1 + net/bluetooth/hci_core.c | 10 +++++++++- net/bluetooth/hci_event.c | 5 +++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 62a9bb022aed..5f2342205ae1 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -361,6 +361,7 @@ enum { HCI_QUALITY_REPORT, HCI_OFFLOAD_CODECS_ENABLED, HCI_LE_SIMULTANEOUS_ROLES, + HCI_CMD_DRAIN_WORKQUEUE, =20 __HCI_NUM_FLAGS, }; diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 19df3905c5f8..2b8b51b89452 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -593,6 +593,11 @@ static int hci_dev_do_reset(struct hci_dev *hdev) skb_queue_purge(&hdev->rx_q); skb_queue_purge(&hdev->cmd_q); =20 + /* Cancel these to avoid queueing non-chained pending work */ + hci_dev_set_flag(hdev, HCI_CMD_DRAIN_WORKQUEUE); + cancel_delayed_work(&hdev->cmd_timer); + cancel_delayed_work(&hdev->ncmd_timer); + /* Avoid potential lockdep warnings from the *_flush() calls by * ensuring the workqueue is empty up front. */ @@ -606,6 +611,8 @@ static int hci_dev_do_reset(struct hci_dev *hdev) if (hdev->flush) hdev->flush(hdev); =20 + hci_dev_clear_flag(hdev, HCI_CMD_DRAIN_WORKQUEUE); + atomic_set(&hdev->cmd_cnt, 1); hdev->acl_cnt =3D 0; hdev->sco_cnt =3D 0; hdev->le_cnt =3D 0; =20 @@ -3863,7 +3870,8 @@ static void hci_cmd_work(struct work_struct *work) if (res < 0) __hci_cmd_sync_cancel(hdev, -res); =20 - if (test_bit(HCI_RESET, &hdev->flags)) + if (test_bit(HCI_RESET, &hdev->flags) || + hci_dev_test_flag(hdev, HCI_CMD_DRAIN_WORKQUEUE)) cancel_delayed_work(&hdev->cmd_timer); else schedule_delayed_work(&hdev->cmd_timer, diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index af17dfb20e01..7cb956d3abb2 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -3768,8 +3768,9 @@ static inline void handle_cmd_cnt_and_timer(struct hc= i_dev *hdev, u8 ncmd) cancel_delayed_work(&hdev->ncmd_timer); atomic_set(&hdev->cmd_cnt, 1); } else { - schedule_delayed_work(&hdev->ncmd_timer, - HCI_NCMD_TIMEOUT); + if (!hci_dev_test_flag(hdev, HCI_CMD_DRAIN_WORKQUEUE)) + schedule_delayed_work(&hdev->ncmd_timer, + HCI_NCMD_TIMEOUT); } } } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F0C2C25B0E for ; Mon, 15 Aug 2022 21:28:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243630AbiHOV2D (ORCPT ); Mon, 15 Aug 2022 17:28:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347668AbiHOVSj (ORCPT ); Mon, 15 Aug 2022 17:18:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F06CE3C19; Mon, 15 Aug 2022 12:22:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C3716B80FD3; Mon, 15 Aug 2022 19:21:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03F00C43142; Mon, 15 Aug 2022 19:21:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591318; bh=C003x6BECaOjQ4JdOh/MX9egyER9MLtoCYxgZdpOtUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kW6xDWjH8ocsd0HViLXlLKWWFHbTCWwHYy0o5Npwis3+6528wYHr+Yejr6iTlTwVy 4nFYkMMfRKuuTyCX+2e3cDViuPioZ81pVhK9DeoZJtO+9PGEdsafld9yx8/R4/ql3m ZwJYUj6p0WJo+uzSNFaYoS2mEimox8TTguEefA94= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengping Jiang , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 5.18 0497/1095] Bluetooth: mgmt: Fix refresh cached connection info Date: Mon, 15 Aug 2022 19:58:16 +0200 Message-Id: <20220815180450.092211146@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhengping Jiang [ Upstream commit d7b2fdfb53ea09382941c0a4950dc9b00d51d1c7 ] Set the connection data before calling get_conn_info_sync, so it can be verified the connection is still connected, before refreshing cached values. Fixes: 47db6b42991e6 ("Bluetooth: hci_sync: Convert MGMT_OP_GET_CONN_INFO") Signed-off-by: Zhengping Jiang Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/bluetooth/mgmt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index ae758ab1b558..12c1ecdba3f3 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -6821,11 +6821,14 @@ static int get_conn_info(struct sock *sk, struct hc= i_dev *hdev, void *data, =20 cmd =3D mgmt_pending_new(sk, MGMT_OP_GET_CONN_INFO, hdev, data, len); - if (!cmd) + if (!cmd) { err =3D -ENOMEM; - else + } else { + hci_conn_hold(conn); + cmd->user_data =3D hci_conn_get(conn); err =3D hci_cmd_sync_queue(hdev, get_conn_info_sync, cmd, get_conn_info_complete); + } =20 if (err < 0) { mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_CONN_INFO, @@ -6837,9 +6840,6 @@ static int get_conn_info(struct sock *sk, struct hci_= dev *hdev, void *data, goto unlock; } =20 - hci_conn_hold(conn); - cmd->user_data =3D hci_conn_get(conn); - conn->conn_info_timestamp =3D jiffies; } else { /* Cache is valid, just reply with values cached in hci_conn */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6ECBC32768 for ; Mon, 15 Aug 2022 21:22:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344617AbiHOVVi (ORCPT ); Mon, 15 Aug 2022 17:21:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243822AbiHOVQB (ORCPT ); Mon, 15 Aug 2022 17:16:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 148B6DD773; Mon, 15 Aug 2022 12:20:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6949AB81109; Mon, 15 Aug 2022 19:20:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA570C433C1; Mon, 15 Aug 2022 19:20:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591205; bh=YSQI2zPVfo1ine7m5O/rAnLOw30xNef/7p43YRVoBwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Su6yXtTL1WAJHe/eX8QUQYJMBR2XPFDC7vOcq1W9XDLQwhoPtoUtFltvhemNdrV+W a48xTtOZBhxgY7Ao7xgbh+k3Ag2ok3ooeu/wAQw2tmhN9Vg3IaOzVUDbUNv4Ieh8XW McnjChL+zeQQbCnMNxF9TBsl4FYIUbu4vEDjNeIY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengping Jiang , Abhishek Pandit-Subedi , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 5.18 0498/1095] Bluetooth: hci_sync: Fix resuming scan after suspend resume Date: Mon, 15 Aug 2022 19:58:17 +0200 Message-Id: <20220815180450.130852699@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhengping Jiang [ Upstream commit 68253f3cd715e819bc4bff2b0e6b21234e259d56 ] After resuming, remove setting scanning_paused to false, because it is checked and set to false in hci_resume_scan_sync. Also move setting the value to false before updating passive scan, because the value is used when resuming passive scan. Fixes: 3b42055388c30 (Bluetooth: hci_sync: Fix attempting to suspend with unfiltered passive scan) Signed-off-by: Zhengping Jiang Reviewed-by: Abhishek Pandit-Subedi Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/bluetooth/hci_sync.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index 9e2a42299fc0..99ef15167a81 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -5008,13 +5008,13 @@ static int hci_resume_scan_sync(struct hci_dev *hde= v) if (!hdev->scanning_paused) return 0; =20 + hdev->scanning_paused =3D false; + hci_update_scan_sync(hdev); =20 /* Reset passive scanning to normal */ hci_update_passive_scan_sync(hdev); =20 - hdev->scanning_paused =3D false; - return 0; } =20 @@ -5033,7 +5033,6 @@ int hci_resume_sync(struct hci_dev *hdev) return 0; =20 hdev->suspended =3D false; - hdev->scanning_paused =3D false; =20 /* Restore event mask */ hci_set_event_mask_sync(hdev); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 509E1C00140 for ; Mon, 15 Aug 2022 21:22:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244188AbiHOVWx (ORCPT ); Mon, 15 Aug 2022 17:22:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344479AbiHOVRa (ORCPT ); Mon, 15 Aug 2022 17:17:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A5585725B; Mon, 15 Aug 2022 12:20:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BC1436009B; Mon, 15 Aug 2022 19:20:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8DD6C433C1; Mon, 15 Aug 2022 19:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591241; bh=W8tKKp3uQ7QzLlBkW/w8MCeuiMzfHsJzpzwh8y5v5xk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vfb3fZPYhRHw0YFxIHp6gjnEjTPZabG2TcaKZqwKzt7I8NGkAEW5LaoUbQ4ii5BvO JPsGlD9r82B9HpItyvbMdNjfoQVF1JwRBXSDO+cem2/M9IlnAqtHqrw19LHw9i7bt8 xWImAGlb2Mtqpnkmv/JxJVY76zHZ+ZzIORfdJXhY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Zhengping Jiang , Sasha Levin Subject: [PATCH 5.18 0499/1095] Bluetooth: hci_sync: Fix not updating privacy_mode Date: Mon, 15 Aug 2022 19:58:18 +0200 Message-Id: <20220815180450.170806979@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luiz Augusto von Dentz [ Upstream commit 0900b1c62f43e495d04ca4bebdf80b34f3c12432 ] When programming a new entry into the resolving list it shall default to network mode since the params may contain the mode programmed when the device was last added to the resolving list. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D209745 Fixes: 853b70b506a20 ("Bluetooth: hci_sync: Set Privacy Mode when updating = the resolving list") Signed-off-by: Luiz Augusto von Dentz Tested-by: Zhengping Jiang Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/bluetooth/hci_sync.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index 99ef15167a81..6f901398132e 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -1612,6 +1612,9 @@ static int hci_le_add_resolve_list_sync(struct hci_de= v *hdev, bacpy(&cp.bdaddr, ¶ms->addr); memcpy(cp.peer_irk, irk->val, 16); =20 + /* Default privacy mode is always Network */ + params->privacy_mode =3D HCI_NETWORK_PRIVACY; + done: if (hci_dev_test_flag(hdev, HCI_PRIVACY)) memcpy(cp.local_irk, hdev->irk, 16); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C648BC00140 for ; Mon, 15 Aug 2022 21:24:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346306AbiHOVY1 (ORCPT ); Mon, 15 Aug 2022 17:24:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345934AbiHOVSA (ORCPT ); Mon, 15 Aug 2022 17:18:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AEEA59273; Mon, 15 Aug 2022 12:21:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 27DDA60EF0; Mon, 15 Aug 2022 19:21:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16797C433D6; Mon, 15 Aug 2022 19:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591274; bh=rrQeGSVgnu2T3cpBdnktpWmYUw4Kt7wbOPiN/PrBLLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i8WcICYCRchjkgS7aY0V+hvl4ikBnqakFd3aYQjtHnHYp1NLjxLeh03j5CSDJ2W/8 Y1zJ2VpshAKyV9NpAv69JCxxzIMW61WoixRHSkfz5CfgWeipvqC+/YI/3WHIAA0YZ9 E+LWXYNYZsPiYKoPp8BUVKNtXgB8KVlGorvssK3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ying Hsu , Alain Michaud , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 5.18 0500/1095] Bluetooth: Add default wakeup callback for HCI UART driver Date: Mon, 15 Aug 2022 19:58:19 +0200 Message-Id: <20220815180450.218033541@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ying Hsu [ Upstream commit bee5395ced44c5a312348557eb2dfb0c2a7bfaa2 ] Bluetooth HCI devices indicate if they are able to wakeup in the wakeup callback since 'commit 4539ca67fe8e ("Bluetooth: Rename driver .prevent_wake to .wakeup")'. This patch adds a default wakeup callback for Bluetooth HCI UAR devices. It assumes Bluetooth HCI UART devices are wakeable for backward compatibility. For those who need a customized behavior, one can override it before calling hci_uart_register_device(). Fixes: 4539ca67fe8e ("Bluetooth: Rename driver .prevent_wake to .wakeup") Signed-off-by: Ying Hsu Reviewed-by: Alain Michaud Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/bluetooth/hci_serdev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c index 4cda890ce647..c0e5f42ec6b7 100644 --- a/drivers/bluetooth/hci_serdev.c +++ b/drivers/bluetooth/hci_serdev.c @@ -231,6 +231,15 @@ static int hci_uart_setup(struct hci_dev *hdev) return 0; } =20 +/* Check if the device is wakeable */ +static bool hci_uart_wakeup(struct hci_dev *hdev) +{ + /* HCI UART devices are assumed to be wakeable by default. + * Implement wakeup callback to override this behavior. + */ + return true; +} + /** hci_uart_write_wakeup - transmit buffer wakeup * @serdev: serial device * @@ -342,6 +351,8 @@ int hci_uart_register_device(struct hci_uart *hu, hdev->flush =3D hci_uart_flush; hdev->send =3D hci_uart_send_frame; hdev->setup =3D hci_uart_setup; + if (!hdev->wakeup) + hdev->wakeup =3D hci_uart_wakeup; SET_HCIDEV_DEV(hdev, &hu->serdev->dev); =20 if (test_bit(HCI_UART_NO_SUSPEND_NOTIFIER, &hu->flags)) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EED83C2BB41 for ; Mon, 15 Aug 2022 21:27:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347875AbiHOV00 (ORCPT ); Mon, 15 Aug 2022 17:26:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346874AbiHOVSJ (ORCPT ); Mon, 15 Aug 2022 17:18:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE461C46; Mon, 15 Aug 2022 12:21:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8A6D460FBE; Mon, 15 Aug 2022 19:21:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75BF6C433C1; Mon, 15 Aug 2022 19:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591300; bh=vYKQ+tCX8WDdMfseVHQsF3kvwn3B0p/f7dOk+AcTaPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z1YVlv7Gp59X6QB4u2cjhfrs439rrA6+nr0q9JWWCMN8FDr4N3pv/RvQsuNqIZI+C 4brGAWkmW3wSX1VgweeYqGkkyar/6+5basnJsVnUr9Vmt9i8f3HUxL/7zHIrhbVKG3 9oYwzIgC3K4O6SnfVQwyhtrkjlI/cqXZqOokowbM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lars-Peter Clausen , Shubhrajyoti Datta , Wolfram Sang , Sasha Levin Subject: [PATCH 5.18 0501/1095] i2c: cadence: Support PEC for SMBus block read Date: Mon, 15 Aug 2022 19:58:20 +0200 Message-Id: <20220815180450.252300865@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lars-Peter Clausen [ Upstream commit 9fdf6d97f03035ad5298e2d1635036c74c2090ed ] SMBus packet error checking (PEC) is implemented by appending one additional byte of checksum data at the end of the message. This provides additional protection and allows to detect data corruption on the I2C bus. SMBus block reads support variable length reads. The first byte in the read message is the number of available data bytes. The combination of PEC and block read is currently not supported by the Cadence I2C driver. * When PEC is enabled the maximum transfer length for block reads increases from 33 to 34 bytes. * The I2C core smbus emulation layer relies on the driver updating the `i2c_msg` `len` field with the number of received bytes. The updated length is used when checking the PEC. Add support to the Cadence I2C driver for handling SMBus block reads with PEC. To determine the maximum transfer length uses the initial `len` value of the `i2c_msg`. When PEC is enabled this will be 2, when it is disabled it will be 1. Once a read transfer is done also increment the `len` field by the amount of received data bytes. This change has been tested with a UCM90320 PMBus power monitor, which requires block reads to access certain data fields, but also has PEC enabled by default. Fixes: df8eb5691c48 ("i2c: Add driver for Cadence I2C controller") Signed-off-by: Lars-Peter Clausen Tested-by: Shubhrajyoti Datta Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/i2c/busses/i2c-cadence.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cade= nce.c index 630cfa4ddd46..33f5588a50c0 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -573,8 +573,13 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id) ctrl_reg =3D cdns_i2c_readreg(CDNS_I2C_CR_OFFSET); ctrl_reg |=3D CDNS_I2C_CR_RW | CDNS_I2C_CR_CLR_FIFO; =20 + /* + * Receive up to I2C_SMBUS_BLOCK_MAX data bytes, plus one message length + * byte, plus one checksum byte if PEC is enabled. p_msg->len will be 2 if + * PEC is enabled, otherwise 1. + */ if (id->p_msg->flags & I2C_M_RECV_LEN) - id->recv_count =3D I2C_SMBUS_BLOCK_MAX + 1; + id->recv_count =3D I2C_SMBUS_BLOCK_MAX + id->p_msg->len; =20 id->curr_recv_count =3D id->recv_count; =20 @@ -789,6 +794,9 @@ static int cdns_i2c_process_msg(struct cdns_i2c *id, st= ruct i2c_msg *msg, if (id->err_status & CDNS_I2C_IXR_ARB_LOST) return -EAGAIN; =20 + if (msg->flags & I2C_M_RECV_LEN) + msg->len +=3D min_t(unsigned int, msg->buf[0], I2C_SMBUS_BLOCK_MAX); + return 0; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B537CC00140 for ; Mon, 15 Aug 2022 21:25:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347055AbiHOVZO (ORCPT ); Mon, 15 Aug 2022 17:25:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346951AbiHOVSL (ORCPT ); Mon, 15 Aug 2022 17:18:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F2E421A9; Mon, 15 Aug 2022 12:21:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 549ABB810C6; Mon, 15 Aug 2022 19:21:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A21F0C433D7; Mon, 15 Aug 2022 19:21:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591303; bh=bf6HyBj5q29ViznfrW5X8XfxvHhrJS90o5YD8uYC+p4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qw5wXIuhI6r9kuQTkUwTom0VfFqLuUOzDNl8kCuLoXliw7k93QN9tUbDNcmTaY+FB 1puCrkM/29Qd1bP+9epvqojZGVV2ScKh2HwsQHGzVDPNnX6LSyBM2IBZ6XF7OWaYsZ nuPcdIhEGuwgFPEZy/pVpeEP8Fm6/1RXPPvZH/M4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bjorn Andersson , Andrew Halaney , Vinod Koul , Johan Hovold , Wolfram Sang , Sasha Levin Subject: [PATCH 5.18 0502/1095] i2c: qcom-geni: Use the correct return value Date: Mon, 15 Aug 2022 19:58:21 +0200 Message-Id: <20220815180450.290148955@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bjorn Andersson [ Upstream commit b3f0ceb7c2037c6e3affd7d9c84ac5f97af7a5b5 ] The introduction of GPI support moved things around and instead of returning the result from geni_i2c_xfer() the number of messages in the request was returned, ignoring the actual result. Fix this. Fixes: d8703554f4de ("i2c: qcom-geni: Add support for GPI DMA") Signed-off-by: Bjorn Andersson Reviewed-by: Andrew Halaney Reviewed-by: Vinod Koul Reviewed-by: Johan Hovold Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/i2c/busses/i2c-qcom-geni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qc= om-geni.c index 5b920f0fc7dd..a4eef8de054c 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -688,7 +688,7 @@ static int geni_i2c_xfer(struct i2c_adapter *adap, pm_runtime_put_autosuspend(gi2c->se.dev); gi2c->cur =3D NULL; gi2c->err =3D 0; - return num; + return ret; } =20 static u32 geni_i2c_func(struct i2c_adapter *adap) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88D18C00140 for ; Mon, 15 Aug 2022 21:25:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347061AbiHOVZS (ORCPT ); Mon, 15 Aug 2022 17:25:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347024AbiHOVSO (ORCPT ); Mon, 15 Aug 2022 17:18:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E33ACC5; Mon, 15 Aug 2022 12:21:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AC6CE60EF0; Mon, 15 Aug 2022 19:21:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3DA5C4315D; Mon, 15 Aug 2022 19:21:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591306; bh=7HKHyqcvmrU1BBYjyvlutRcXUP3YLfWBNtPAvCpOBb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q1nrQguorhrAiTSNB9HbQiOhsSkEnp6oCT1xBHEA8k1SIU1EkS0MNZUKiKh0MjgiS 81KrJfcDZgXsUA/ZSFJ/wq/VLycAxQ/570OhjVA97s4henDem277jG7K+IeB1Rwe9H TsecEe5PPtPqnw4646Gogcb90sh1mV9U0q53pHPI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joanne Koong , Daniel Borkmann , Martin KaFai Lau , Lorenzo Bianconi , Sasha Levin Subject: [PATCH 5.18 0503/1095] bpf: Fix bpf_xdp_pointer return pointer Date: Mon, 15 Aug 2022 19:58:22 +0200 Message-Id: <20220815180450.337220358@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Joanne Koong [ Upstream commit bbd52178e249fe893ef4a9b87cde5b6c473b0a7c ] For the case where offset + len =3D=3D size, bpf_xdp_pointer should return a valid pointer to the addr because that access is permitted. We should only return NULL in the case where offset + len exceeds size. Fixes: 3f364222d032 ("net: xdp: introduce bpf_xdp_pointer utility routine") Signed-off-by: Joanne Koong Signed-off-by: Daniel Borkmann Acked-by: Martin KaFai Lau Acked-by: Lorenzo Bianconi Link: https://lore.kernel.org/bpf/20220722220105.2065466-1-joannelkoong@gma= il.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/filter.c b/net/core/filter.c index 5db4fae23925..a98f34cb5aee 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -3917,7 +3917,7 @@ static void *bpf_xdp_pointer(struct xdp_buff *xdp, u3= 2 offset, u32 len) offset -=3D frag_size; } out: - return offset + len < size ? addr + offset : NULL; + return offset + len <=3D size ? addr + offset : NULL; } =20 BPF_CALL_4(bpf_xdp_load_bytes, struct xdp_buff *, xdp, u32, offset, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CFB9C2BB45 for ; Mon, 15 Aug 2022 21:27:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347907AbiHOV03 (ORCPT ); Mon, 15 Aug 2022 17:26:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347040AbiHOVSO (ORCPT ); Mon, 15 Aug 2022 17:18:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B73265AD; Mon, 15 Aug 2022 12:21:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ED1FC60FBE; Mon, 15 Aug 2022 19:21:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC474C4314C; Mon, 15 Aug 2022 19:21:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591309; bh=GOWshVnBwy6EwloCgplMH55chcLT2EZdBYc4L1saBCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XfTeq2jJFPTFIUAMLVS/ctPna2m2hbMhDIKB4Uk3iUvFRQpeV6gWlUZKJAJvIIhqP AG64X8uD0dSIN5SlWzBfDdqaRfOu6yt71IQB8eKZM+67DrhgFomGw7StSkG7WypGqe SF5PY5o4GD40czq4dY9hz2HabZlRH29XZBaak85g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Peter Rosin , Wolfram Sang , Sasha Levin Subject: [PATCH 5.18 0504/1095] i2c: mux-gpmux: Add of_node_put() when breaking out of loop Date: Mon, 15 Aug 2022 19:58:23 +0200 Message-Id: <20220815180450.377517216@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 6435319c34704994e19b0767f6a4e6f37439867b ] In i2c_mux_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which will automatically increase and decrease the refcount. Fixes: ac8498f0ce53 ("i2c: i2c-mux-gpmux: new driver") Signed-off-by: Liang He Acked-by: Peter Rosin Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/i2c/muxes/i2c-mux-gpmux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-= gpmux.c index d3acd8d66c32..33024acaac02 100644 --- a/drivers/i2c/muxes/i2c-mux-gpmux.c +++ b/drivers/i2c/muxes/i2c-mux-gpmux.c @@ -134,6 +134,7 @@ static int i2c_mux_probe(struct platform_device *pdev) return 0; =20 err_children: + of_node_put(child); i2c_mux_del_adapters(muxc); err_parent: i2c_put_adapter(parent); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B06B0C00140 for ; Mon, 15 Aug 2022 21:25:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344612AbiHOVZ2 (ORCPT ); Mon, 15 Aug 2022 17:25:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347162AbiHOVSR (ORCPT ); Mon, 15 Aug 2022 17:18:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1234986C10; Mon, 15 Aug 2022 12:21:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A8D16B81120; Mon, 15 Aug 2022 19:21:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0C27C433D7; Mon, 15 Aug 2022 19:21:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591312; bh=AZWjm2x8zpKJXfI6zI6/Cj794cVBbJ4zC6s5gwi7uz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z7jAWnd0Az+mL66si0lL0tIMvLRWYLlTf6HzVovjhd/RnzK8IriaBI9+0CJ0dVl/M 06JRrNkMA8Gwa1i0fe0+iU2IByxeg87Yozsuow1sjNIM5PTv8lDnv6qUfs1Xc2YWs7 lJuRvCSj5a/IG3PGQGv/UhU3EUZVuUPpNqeeT1Aw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , kernel test robot , Ammar Faizi , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0505/1095] wifi: wil6210: debugfs: fix uninitialized variable use in `wil_write_file_wmi()` Date: Mon, 15 Aug 2022 19:58:24 +0200 Message-Id: <20220815180450.412888119@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ammar Faizi [ Upstream commit d578e0af3a003736f6c440188b156483d451b329 ] Commit 7a4836560a61 changes simple_write_to_buffer() with memdup_user() but it forgets to change the value to be returned that came from simple_write_to_buffer() call. It results in the following warning: warning: variable 'rc' is uninitialized when used here [-Wuninitialized] return rc; ^~ Remove rc variable and just return the passed in length if the memdup_user() succeeds. Cc: Dan Carpenter Reported-by: kernel test robot Fixes: 7a4836560a6198d245d5732e26f94898b12eb760 ("wifi: wil6210: debugfs: f= ix info leak in wil_write_file_wmi()") Fixes: ff974e4083341383d3dd4079e52ed30f57f376f0 ("wil6210: debugfs interfac= e to send raw WMI command") Signed-off-by: Ammar Faizi Reviewed-by: Dan Carpenter Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220724202452.61846-1-ammar.faizi@intel.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/ath/wil6210/debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wirel= ess/ath/wil6210/debugfs.c index c6f8254cb21d..ac7787e1a7f6 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -1010,7 +1010,7 @@ static ssize_t wil_write_file_wmi(struct file *file, = const char __user *buf, void *cmd; int cmdlen =3D len - sizeof(struct wmi_cmd_hdr); u16 cmdid; - int rc, rc1; + int rc1; =20 if (cmdlen < 0 || *ppos !=3D 0) return -EINVAL; @@ -1027,7 +1027,7 @@ static ssize_t wil_write_file_wmi(struct file *file, = const char __user *buf, =20 wil_info(wil, "0x%04x[%d] -> %d\n", cmdid, cmdlen, rc1); =20 - return rc; + return len; } =20 static const struct file_operations fops_wmi =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C6B0C2BB43 for ; Mon, 15 Aug 2022 21:27:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347926AbiHOV0e (ORCPT ); Mon, 15 Aug 2022 17:26:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347279AbiHOVSV (ORCPT ); Mon, 15 Aug 2022 17:18:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02EB7E395C; Mon, 15 Aug 2022 12:21:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 045FF61028; Mon, 15 Aug 2022 19:21:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D2EBC433D6; Mon, 15 Aug 2022 19:21:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591315; bh=waPGeb73Tsj2NRxcAjuBsLWHF18iKihkY/VAnSl59Po=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CLwAzDxz9fXzKKnLbg7mxxtykhgorKy3wG6btzRNVAyftfALR+RB906fSBwI56mtG zrhOd3rI6AVKpnxpRRgMD5BDON3V3ukDz+XpKNcv/LJSga1dqt4mSuO4IwhvEtyHb7 aOgnHR7WJEKKT1PgMKYQQm8/+fF+9edxqyzSjK3Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takayuki Nagata , Petr Stourac , Jose Ignacio Tornos Martinez , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0506/1095] wifi: iwlwifi: mvm: fix double list_add at iwl_mvm_mac_wake_tx_queue Date: Mon, 15 Aug 2022 19:58:25 +0200 Message-Id: <20220815180450.461538557@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jose Ignacio Tornos Martinez [ Upstream commit 14a3aacf517a9de725dd3219dbbcf741e31763c4 ] After successfull station association, if station queues are disabled for some reason, the related lists are not emptied. So if some new element is added to the list in iwl_mvm_mac_wake_tx_queue, it can match with the old one and produce a BUG like this: [ 46.535263] list_add corruption. prev->next should be next (ffff94c1c318= a360), but was 0000000000000000. (prev=3Dffff94c1d02d3388). [ 46.535283] ------------[ cut here ]------------ [ 46.535284] kernel BUG at lib/list_debug.c:26! [ 46.535290] invalid opcode: 0000 [#1] PREEMPT SMP PTI [ 46.585304] CPU: 0 PID: 623 Comm: wpa_supplicant Not tainted 5.19.0-rc3+= #1 [ 46.592380] Hardware name: Dell Inc. Inspiron 660s/0478VN , BIOS A= 07 08/24/2012 [ 46.600336] RIP: 0010:__list_add_valid.cold+0x3d/0x3f [ 46.605475] Code: f2 4c 89 c1 48 89 fe 48 c7 c7 c8 40 67 93 e8 20 cc fd = ff 0f 0b 48 89 d1 4c 89 c6 4c 89 ca 48 c7 c7 70 40 67 93 e8 09 cc fd ff <0f= > 0b 48 89 fe 48 c7 c7 00 41 67 93 e8 f8 cb fd ff 0f 0b 48 89 d1 [ 46.624469] RSP: 0018:ffffb20800ab76d8 EFLAGS: 00010286 [ 46.629854] RAX: 0000000000000075 RBX: ffff94c1c318a0e0 RCX: 00000000000= 00000 [ 46.637105] RDX: 0000000000000201 RSI: ffffffff9365e100 RDI: 00000000fff= fffff [ 46.644356] RBP: ffff94c1c5f43370 R08: 0000000000000075 R09: 30643163343= 96666 [ 46.651607] R10: 3364323064316334 R11: 39666666663d7665 R12: ffff94c1c5f= 43388 [ 46.658857] R13: ffff94c1d02d3388 R14: ffff94c1c318a360 R15: ffff94c1cf2= 289c0 [ 46.666108] FS: 00007f65634ff7c0(0000) GS:ffff94c1da200000(0000) knlGS:= 0000000000000000 [ 46.674331] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 46.680170] CR2: 00007f7dfe984460 CR3: 000000010e894003 CR4: 00000000000= 606f0 [ 46.687422] Call Trace: [ 46.689906] [ 46.691950] iwl_mvm_mac_wake_tx_queue+0xec/0x15c [iwlmvm] [ 46.697601] ieee80211_queue_skb+0x4b3/0x720 [mac80211] [ 46.702973] ? sta_info_get+0x46/0x60 [mac80211] [ 46.707703] ieee80211_tx+0xad/0x110 [mac80211] [ 46.712355] __ieee80211_tx_skb_tid_band+0x71/0x90 [mac80211] ... In order to avoid this problem, we must also remove the related lists when station queues are disabled. Fixes: cfbc6c4c5b91c ("iwlwifi: mvm: support mac80211 TXQs model") Reported-by: Takayuki Nagata Reported-by: Petr Stourac Tested-by: Petr Stourac Signed-off-by: Jose Ignacio Tornos Martinez Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220719153542.81466-1-jtornosm@redhat.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wir= eless/intel/iwlwifi/mvm/sta.c index c7f9d3870f21..8a38d1bfe9b3 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c @@ -1862,6 +1862,7 @@ static void iwl_mvm_disable_sta_queues(struct iwl_mvm= *mvm, iwl_mvm_txq_from_mac80211(sta->txq[i]); =20 mvmtxq->txq_id =3D IWL_MVM_INVALID_QUEUE; + list_del_init(&mvmtxq->list); } } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E531BC3276B for ; Mon, 15 Aug 2022 21:22:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344974AbiHOVVt (ORCPT ); Mon, 15 Aug 2022 17:21:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244827AbiHOVQl (ORCPT ); Mon, 15 Aug 2022 17:16:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85DB8DEA49; Mon, 15 Aug 2022 12:20:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8E1F46009B; Mon, 15 Aug 2022 19:20:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99808C433D7; Mon, 15 Aug 2022 19:20:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591208; bh=GuioARgipAjckdAdajthvc005UG73r+y/SYqcn3+24w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=063c/KeTiRqIUf8a46zzf9I8U6XesB6/F/HomPsMACkqrd2KvRdrRHUxzsnfsXEoT /R+1Xj71bUpIMMWoRrcvOY8FZ8yFvszAZxnSnA5BJuINoS83VjVvnsCcV+YY155iTr TjPLQ0pW6GT8V1jNkY40hux5qHQaVOmg3IHG1Kas= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0507/1095] wifi: libertas: Fix possible refcount leak in if_usb_probe() Date: Mon, 15 Aug 2022 19:58:26 +0200 Message-Id: <20220815180450.503605787@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hangyu Hua [ Upstream commit 6fd57e1d120bf13d4dc6c200a7cf914e6347a316 ] usb_get_dev will be called before lbs_get_firmware_async which means that usb_put_dev need to be called when lbs_get_firmware_async fails. Fixes: ce84bb69f50e ("libertas USB: convert to asynchronous firmware loadin= g") Signed-off-by: Hangyu Hua Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220620092350.39960-1-hbh25y@gmail.com Link: https://lore.kernel.org/r/20220622113402.16969-1-colin.i.king@gmail.c= om Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/marvell/libertas/if_usb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/marvell/libertas/if_usb.c b/drivers/net/w= ireless/marvell/libertas/if_usb.c index 5d6dc1dd050d..32fdc4150b60 100644 --- a/drivers/net/wireless/marvell/libertas/if_usb.c +++ b/drivers/net/wireless/marvell/libertas/if_usb.c @@ -287,6 +287,7 @@ static int if_usb_probe(struct usb_interface *intf, return 0; =20 err_get_fw: + usb_put_dev(udev); lbs_remove_card(priv); err_add_card: if_usb_reset_device(cardp); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6264C32767 for ; Mon, 15 Aug 2022 21:22:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344817AbiHOVVn (ORCPT ); Mon, 15 Aug 2022 17:21:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244742AbiHOVQk (ORCPT ); Mon, 15 Aug 2022 17:16:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18D20DEA6C; Mon, 15 Aug 2022 12:20:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5A1A46101F; Mon, 15 Aug 2022 19:20:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B26FC433C1; Mon, 15 Aug 2022 19:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591210; bh=fI3ggYNDRY5ZStkHfiu7AToAPUQW7fzehU9W+hqrCew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uRLwgXS7paPxOUS8HdmMaLqzq7ROuHPedVTsq/EwqoPu1vWEwIPV9iFOd00o9XlJg TuWZ48335hnfTzSN3vb+H6tkvEODwaDPGoeYx6Q4wLAbS04BR1Dj948ax07REYjMxL r+XFGzd8ClI2FlR0gelxG5mi+rZslWgtMXCFQuoE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Ezequiel Garcia , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0508/1095] media: cedrus: hevc: Add check for invalid timestamp Date: Mon, 15 Aug 2022 19:58:27 +0200 Message-Id: <20220815180450.547425221@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jernej Skrabec [ Upstream commit 143201a6435bf65f0115435e9dc6d95c66b908e9 ] Not all DPB entries will be used most of the time. Unused entries will thus have invalid timestamps. They will produce negative buffer index which is not specifically handled. This works just by chance in current code. It will even produce bogus pointer, but since it's not used, it won't do any harm. Let's fix that brittle design by skipping writing DPB entry altogether if timestamp is invalid. Fixes: 86caab29da78 ("media: cedrus: Add HEVC/H.265 decoding support") Signed-off-by: Jernej Skrabec Reviewed-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/sta= ging/media/sunxi/cedrus/cedrus_h265.c index 2f6404fccd5a..04419381ea56 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c @@ -147,6 +147,9 @@ static void cedrus_h265_frame_info_write_dpb(struct ced= rus_ctx *ctx, dpb[i].pic_order_cnt_val }; =20 + if (buffer_index < 0) + continue; + cedrus_h265_frame_info_write_single(ctx, i, dpb[i].field_pic, pic_order_cnt, buffer_index); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94101C25B08 for ; Mon, 15 Aug 2022 21:22:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231310AbiHOVWG (ORCPT ); Mon, 15 Aug 2022 17:22:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245476AbiHOVQ4 (ORCPT ); Mon, 15 Aug 2022 17:16:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65C87E34; Mon, 15 Aug 2022 12:20:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EB7CEB81123; Mon, 15 Aug 2022 19:20:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB1A0C433C1; Mon, 15 Aug 2022 19:20:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591214; bh=L06Sv7lqBwFtevSXYTNx3gL3bYegFT+MrKgvTofIZK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FiOW54q63AC8MfHEFg6XOjLsHOXZ1gfiZNwgDCpMqiwTfmH0f8ngCBVp2SEs8aLuA LR0lcg7RS7FuFV8fHaHpcxS/WsmlJEzDcftwOblBUbmGxYmzmtgT+3PacICo4OVK9b yvsEH7nVdIGB2Y3Bw9HNZu0rP+4hpX0LQiPuEZ6w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ezequiel Garcia , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 0509/1095] hantro: Remove incorrect HEVC SPS validation Date: Mon, 15 Aug 2022 19:58:28 +0200 Message-Id: <20220815180450.591537881@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ezequiel Garcia [ Upstream commit df9ec2fc8e70e01532fd9161cd98711969561ff6 ] Currently, the driver tries to validat the HEVC SPS against the CAPTURE queue format (i.e. the decoded format). This is not correct, because typically the SPS control is set before the CAPTURE queue is negotiated. Fixes: 135ad96cb4d6b ("media: hantro: Be more accurate on pixel formats ste= p_width constraints") Signed-off-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/staging/media/hantro/hantro_drv.c | 12 ++++++------ drivers/staging/media/hantro/hantro_hevc.c | 9 +-------- drivers/staging/media/hantro/hantro_hw.h | 1 - 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/me= dia/hantro/hantro_drv.c index 01d33dcb0467..ac232b5f7825 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -253,11 +253,6 @@ queue_init(void *priv, struct vb2_queue *src_vq, struc= t vb2_queue *dst_vq) =20 static int hantro_try_ctrl(struct v4l2_ctrl *ctrl) { - struct hantro_ctx *ctx; - - ctx =3D container_of(ctrl->handler, - struct hantro_ctx, ctrl_handler); - if (ctrl->id =3D=3D V4L2_CID_STATELESS_H264_SPS) { const struct v4l2_ctrl_h264_sps *sps =3D ctrl->p_new.p_h264_sps; =20 @@ -273,7 +268,12 @@ static int hantro_try_ctrl(struct v4l2_ctrl *ctrl) } else if (ctrl->id =3D=3D V4L2_CID_MPEG_VIDEO_HEVC_SPS) { const struct v4l2_ctrl_hevc_sps *sps =3D ctrl->p_new.p_hevc_sps; =20 - return hantro_hevc_validate_sps(ctx, sps); + if (sps->bit_depth_luma_minus8 !=3D sps->bit_depth_chroma_minus8) + /* Luma and chroma bit depth mismatch */ + return -EINVAL; + if (sps->bit_depth_luma_minus8 !=3D 0) + /* Only 8-bit is supported */ + return -EINVAL; } else if (ctrl->id =3D=3D V4L2_CID_STATELESS_VP9_FRAME) { const struct v4l2_ctrl_vp9_frame *dec_params =3D ctrl->p_new.p_vp9_frame; =20 diff --git a/drivers/staging/media/hantro/hantro_hevc.c b/drivers/staging/m= edia/hantro/hantro_hevc.c index 4f7e2acb46ec..df1f81952bba 100644 --- a/drivers/staging/media/hantro/hantro_hevc.c +++ b/drivers/staging/media/hantro/hantro_hevc.c @@ -154,15 +154,8 @@ static int tile_buffer_reallocate(struct hantro_ctx *c= tx) return -ENOMEM; } =20 -int hantro_hevc_validate_sps(struct hantro_ctx *ctx, const struct v4l2_ctr= l_hevc_sps *sps) +static int hantro_hevc_validate_sps(struct hantro_ctx *ctx, const struct v= 4l2_ctrl_hevc_sps *sps) { - if (sps->bit_depth_luma_minus8 !=3D sps->bit_depth_chroma_minus8) - /* Luma and chroma bit depth mismatch */ - return -EINVAL; - if (sps->bit_depth_luma_minus8 !=3D 0) - /* Only 8-bit is supported */ - return -EINVAL; - /* * for tile pixel format check if the width and height match * hardware constraints diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/med= ia/hantro/hantro_hw.h index 457eb8bb6dc2..68c313864b06 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -353,7 +353,6 @@ int hantro_hevc_dec_prepare_run(struct hantro_ctx *ctx); void hantro_hevc_ref_init(struct hantro_ctx *ctx); dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, s32 poc); int hantro_hevc_add_ref_buf(struct hantro_ctx *ctx, int poc, dma_addr_t ad= dr); -int hantro_hevc_validate_sps(struct hantro_ctx *ctx, const struct v4l2_ctr= l_hevc_sps *sps); =20 =20 static inline unsigned short hantro_vp9_num_sbs(unsigned short dimension) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1103BC00140 for ; Mon, 15 Aug 2022 21:22:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241767AbiHOVWP (ORCPT ); Mon, 15 Aug 2022 17:22:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245528AbiHOVQ6 (ORCPT ); Mon, 15 Aug 2022 17:16:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70730F3B; Mon, 15 Aug 2022 12:20:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3B1DA60BB7; Mon, 15 Aug 2022 19:20:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 357A9C433D6; Mon, 15 Aug 2022 19:20:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591217; bh=koEmmcXb9FfrHcn5esncw0TNEGulqIwaVYmOpG1i0Uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BV9ZSZ6y7NkALF1uzg/u42WFx8pQ7wA1eUDbv7TtgPqodvWFIsRy7at3fue8sXniy SldHjSjhOvUZIMcXw18Xy3HNnE4eAeGr1jBNfIbwt+Z/fHuM+99JGmyUUgukIlNBj3 0ZN6WNQGd8DT/FP8LCKWSK6vhv3yswdvh/KySCZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 0510/1095] drm/amd/display: fix signedness bug in execute_synaptics_rc_command() Date: Mon, 15 Aug 2022 19:58:29 +0200 Message-Id: <20220815180450.629402741@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 06ac561fb0edf868f7b292fb4a3c8ffbbb1e14bb ] The "ret" variable needs to be signed for the error handling to work. Fixes: 2ca97adccdc9 ("drm/amd/display: Add Synaptics Fifo Reset Workaround") Signed-off-by: Dan Carpenter Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/dr= ivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c index f5f39984702f..a3282ddbff86 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c @@ -571,7 +571,7 @@ static bool execute_synaptics_rc_command(struct drm_dp_= aux *aux, unsigned char rc_cmd =3D 0; unsigned char rc_result =3D 0xFF; unsigned char i =3D 0; - uint8_t ret =3D 0; + int ret; =20 if (is_write_cmd) { // write rc data --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C97CC00140 for ; Mon, 15 Aug 2022 21:22:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243330AbiHOVWX (ORCPT ); Mon, 15 Aug 2022 17:22:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343543AbiHOVRE (ORCPT ); Mon, 15 Aug 2022 17:17:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C7E15FC1; Mon, 15 Aug 2022 12:20:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B995CB81120; Mon, 15 Aug 2022 19:20:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FCC6C433C1; Mon, 15 Aug 2022 19:20:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591220; bh=BzYeuORAkJHPCD80V8MI5zoA/RwoFsTPI8noqeq6Vdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A6UBcsalR7sXbHuVTMQCuL/tSUehK3+dek0xbJsGSkMnqw+c6BbPDLCTN/J62GmOg 3EN47fXYSZjMUw3RkzjuIgOYRoPodna5ZWYPDJ6DmlST3lC2cSYzWVLy6MAZ6dNwtQ htDTi2yrBVh25XathOwNWTe8d/qSX296WUHkidf8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gal Pressman , Tariq Toukan , Maxim Mikityanskiy , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 0511/1095] net/mlx5e: Remove WARN_ON when trying to offload an unsupported TLS cipher/version Date: Mon, 15 Aug 2022 19:58:30 +0200 Message-Id: <20220815180450.662178110@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gal Pressman [ Upstream commit 115d9f95ea7ab780ef315dc356bebba2e07cb731 ] The driver reports whether TX/RX TLS device offloads are supported, but not which ciphers/versions, these should be handled by returning -EOPNOTSUPP when .tls_dev_add() is called. Remove the WARN_ON kernel trace when the driver gets a request to offload a cipher/version that is not supported as it is expected. Fixes: d2ead1f360e8 ("net/mlx5e: Add kTLS TX HW offload support") Signed-off-by: Gal Pressman Reviewed-by: Tariq Toukan Reviewed-by: Maxim Mikityanskiy Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c b/driv= ers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c index d93aadbf10da..90ea78239d40 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c @@ -16,7 +16,7 @@ static int mlx5e_ktls_add(struct net_device *netdev, stru= ct sock *sk, struct mlx5_core_dev *mdev =3D priv->mdev; int err; =20 - if (WARN_ON(!mlx5e_ktls_type_check(mdev, crypto_info))) + if (!mlx5e_ktls_type_check(mdev, crypto_info)) return -EOPNOTSUPP; =20 if (direction =3D=3D TLS_OFFLOAD_CTX_DIR_TX) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B58E0C00140 for ; Mon, 15 Aug 2022 21:23:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343500AbiHOVX3 (ORCPT ); Mon, 15 Aug 2022 17:23:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343599AbiHOVRF (ORCPT ); Mon, 15 Aug 2022 17:17:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2145D6270; Mon, 15 Aug 2022 12:20:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0AA0C6009B; Mon, 15 Aug 2022 19:20:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F55EC433C1; Mon, 15 Aug 2022 19:20:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591223; bh=WJJZjSRsNAmFjH1N2BZiZSDeHE3N2TcBII3rUzJ6/LA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PxmB5ywAhRSZtWSDU5rkBrZvNi15AY4HzGI9GPXr6OnlKcItFLa9eAoPSK42JSqQn F5E4HcYw4O8U2L2U3/lt12/HOIB6p41Ihw2sxqNE400yNh0bv/ZFlr00MV+tHTRLnT +6w5M/OXcNwkA/gTMMWtPyDGAO9TfWQGytQSMjXI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maor Dickman , Roi Dayan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 0512/1095] net/mlx5e: TC, Fix post_act to not match on in_port metadata Date: Mon, 15 Aug 2022 19:58:31 +0200 Message-Id: <20220815180450.703036192@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maor Dickman [ Upstream commit 903f2194f74bbd289f3170114035d472a36a8ab4 ] The cited commit changed CT to use multi table actions post act infrastruct= ure instead of using it own post act infrastructure, this broke decap during VF tunnel = offload (Stack devices) with CT due to wrong match on in_port metadata in the post = act table. This changed only broke VF tunnel offload because it modify the packet in_p= ort metadata to be VF metadata and it isn't propagate the post act creation. Fixed by modify post act rules to match only on fte_id and not match on in_= port metadata which isn't needed. Fixes: a81283263bb0 ("net/mlx5e: Use multi table support for CT and sample = actions") Signed-off-by: Maor Dickman Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c b/dri= vers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c index dea137dd744b..2b64dd557b5d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c @@ -128,6 +128,7 @@ mlx5e_tc_post_act_add(struct mlx5e_post_act *post_act, = struct mlx5_flow_attr *at post_attr->inner_match_level =3D MLX5_MATCH_NONE; post_attr->outer_match_level =3D MLX5_MATCH_NONE; post_attr->action &=3D ~MLX5_FLOW_CONTEXT_ACTION_DECAP; + post_attr->flags |=3D MLX5_ATTR_FLAG_NO_IN_PORT; =20 handle->ns_type =3D post_act->ns_type; /* Splits were handled before post action */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6669AC3F6B0 for ; Mon, 15 Aug 2022 21:22:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243573AbiHOVWc (ORCPT ); Mon, 15 Aug 2022 17:22:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343832AbiHOVRL (ORCPT ); Mon, 15 Aug 2022 17:17:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 165982872C; Mon, 15 Aug 2022 12:20:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E5F5260BB7; Mon, 15 Aug 2022 19:20:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCF15C433C1; Mon, 15 Aug 2022 19:20:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591228; bh=qKnz3Qd/vicMq8SoVA929etJpzVjlrcNsCj63xN+ZYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=orXBox5KfL4HRuVK0dlXrq8qWZPQZiC1pwqIyjsZSIPi7GBWusYMCpciaGfgtVppF ftl92yHMgsdHD2AWosdtIwN3t744ClNdt+vJ718C4bOsGgnJmOMf9fTY6OdHj0otd7 2dCVkvzTD5HQkw95Hvv7YDWBFQoEioy8EkhhvR9U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 0513/1095] net/mlx5e: Fix the value of MLX5E_MAX_RQ_NUM_MTTS Date: Mon, 15 Aug 2022 19:58:32 +0200 Message-Id: <20220815180450.754935009@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxim Mikityanskiy [ Upstream commit 562696c3c62c7c23dd896e9447252ce9268cb812 ] MLX5E_MAX_RQ_NUM_MTTS should be the maximum value, so that MLX5_MTT_OCTW(MLX5E_MAX_RQ_NUM_MTTS) fits into u16. The current value of 1 << 17 results in MLX5_MTT_OCTW(1 << 17) =3D 1 << 16, which doesn't fit into u16. This commit replaces it with the maximum value that still fits u16. Fixes: 73281b78a37a ("net/mlx5e: Derive Striding RQ size from MTU") Signed-off-by: Maxim Mikityanskiy Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/eth= ernet/mellanox/mlx5/core/en.h index d0d14325a0d9..d73571e542bd 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -109,7 +109,7 @@ struct page_pool; #define MLX5E_REQUIRED_WQE_MTTS (MLX5_ALIGN_MTTS(MLX5_MPWRQ_PAGES_PER_WQE= + 1)) #define MLX5E_REQUIRED_MTTS(wqes) (wqes * MLX5E_REQUIRED_WQE_MTTS) #define MLX5E_MAX_RQ_NUM_MTTS \ - ((1 << 16) * 2) /* So that MLX5_MTT_OCTW(num_mtts) fits into u16 */ + (ALIGN_DOWN(U16_MAX, 4) * 2) /* So that MLX5_MTT_OCTW(num_mtts) fits into= u16 */ #define MLX5E_ORDER2_MAX_PACKET_MTU (order_base_2(10 * 1024)) #define MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE_MPW \ (ilog2(MLX5E_MAX_RQ_NUM_MTTS / MLX5E_REQUIRED_WQE_MTTS)) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 494EDC3F6B0 for ; Mon, 15 Aug 2022 21:27:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347643AbiHOV0C (ORCPT ); Mon, 15 Aug 2022 17:26:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343941AbiHOVRR (ORCPT ); Mon, 15 Aug 2022 17:17:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23B1529829; Mon, 15 Aug 2022 12:20:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A3550B810A3; Mon, 15 Aug 2022 19:20:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFAD8C433C1; Mon, 15 Aug 2022 19:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591231; bh=77p0F+fhXx8FwC7ansFUH3g5OXXvP6hKPXv1B2Jh3cc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sQMS38i4JHbgM7Qhdn68Z63JifgT9mUqkSmb930Ur4aWVzTtCnk4usiX76eUXAptt IUuMbpZsu9TemAaC1+MaeCIHRMaBqIlmN/bOsOtTpdZtnB066jxDuwbNFr2S9ZbkbR WUosSeb1VwkCKiu1PgKkWdwvFFlsu5BESIhQ3YxU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 0514/1095] net/mlx5e: xsk: Account for XSK RQ UMRs when calculating ICOSQ size Date: Mon, 15 Aug 2022 19:58:33 +0200 Message-Id: <20220815180450.804339679@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxim Mikityanskiy [ Upstream commit 52586d2f56b3e4f528ca7268d65074e92c936681 ] ICOSQ is used to post UMR WQEs for both regular RQ and XSK RQ. However, space in ICOSQ is reserved only for the regular RQ, which may cause ICOSQ overflows when using XSK (the most risk is on activating channels). This commit fixes the issue by reserving space for XSK UMR WQEs as well. As XSK may be enabled without restarting the channel and recreating the ICOSQ, this space is reserved unconditionally. Fixes: db05815b36cb ("net/mlx5e: Add XSK zero-copy support") Signed-off-by: Maxim Mikityanskiy Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/mellanox/mlx5/core/en/params.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c b/drivers/= net/ethernet/mellanox/mlx5/core/en/params.c index 08fd1370a8b0..75da12e1b0c7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/params.c @@ -797,8 +797,20 @@ static u8 mlx5e_build_icosq_log_wq_sz(struct mlx5_core= _dev *mdev, return MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE; =20 wqebbs =3D MLX5E_UMR_WQEBBS * BIT(mlx5e_get_rq_log_wq_sz(rqp->rqc)); + + /* If XDP program is attached, XSK may be turned on at any time without + * restarting the channel. ICOSQ must be big enough to fit UMR WQEs of + * both regular RQ and XSK RQ. + * Although mlx5e_mpwqe_get_log_rq_size accepts mlx5e_xsk_param, it + * doesn't affect its return value, as long as params->xdp_prog !=3D NULL, + * so we can just multiply by 2. + */ + if (params->xdp_prog) + wqebbs *=3D 2; + if (params->packet_merge.type =3D=3D MLX5E_PACKET_MERGE_SHAMPO) wqebbs +=3D mlx5e_shampo_icosq_sz(mdev, params, rqp); + return max_t(u8, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE, order_base_2(wqebbs)); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22E9EC00140 for ; Mon, 15 Aug 2022 21:22:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243810AbiHOVWo (ORCPT ); Mon, 15 Aug 2022 17:22:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344090AbiHOVRV (ORCPT ); Mon, 15 Aug 2022 17:17:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B74072FFFA; Mon, 15 Aug 2022 12:20:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DC75260FDA; Mon, 15 Aug 2022 19:20:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7CD3C433C1; Mon, 15 Aug 2022 19:20:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591234; bh=LtJsvBhIVK5UrqoDpW6GPrgRhJqhQsRYBRbVyyiJycA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cMklkd2kBnSAIbFLBcrQLVg9Jt/21F5ZFyl2XojaG0Eh6m8d+ZqBRERUoqveUIp28 VBbonc8WUdApAF01yB4XMgrkC+2kZNwM8G9apB1xz5zte3edLNVUlRjYuO7X9gjY5z B1IzBDIXXNdKvlcGdCq4XoO2TfkT54WrFvqAcO3o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 0515/1095] net/mlx5e: Fix calculations related to max MPWQE size Date: Mon, 15 Aug 2022 19:58:34 +0200 Message-Id: <20220815180450.847079084@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxim Mikityanskiy [ Upstream commit 677e78c8d44f326a73a77d71acf3a49ea562c1d9 ] Before commit 76c31e5f7585 ("net/mlx5e: Use FW limitation for max MPW WQEBBs"), the maximum size of MPWQE in WQEBBs was hardcoded as a driver constant. That commit started using the firmware capability that can further limit the size, however, it unintentionally changed a few things: 1. The calculation of MLX5E_MAX_KLM_PER_WQE used the size in DS, which was replaced by the size in WQEBBs, making the resulting value 4 times smaller. 2. MLX5E_TX_MPW_MAX_WQEBBS used to be aligned to the cache line size (either 64 or 128 bytes, i.e. 1 or 2 WQEBBs), but it's no longer the case if the firmware capability is smaller than the driver maximum. Fix both issues by using the correct units for MLX5E_MAX_KLM_PER_WQE and by aligning mlx5e_get_sw_max_sq_mpw_wqebbs after taking the minimum. Besides fixing the arithmetics in calculation of MLX5E_MAX_KLM_PER_WQE, also use appropriate constants: `size of BSF * num of DS per WQEBB * number of WQEBBs` (the calculation before the blamed commit) doesn't make much sense to calculate the WQE size in bytes, so just use `size of WQEBB * number of WQEBBs`. While at it, replace the types that hold the number of WQEBBs by u8. These values don't exceed 16, and it allows to fill holes in two structs. Fixes: 76c31e5f7585 ("net/mlx5e: Use FW limitation for max MPW WQEBBs") Signed-off-by: Maxim Mikityanskiy Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/eth= ernet/mellanox/mlx5/core/en.h index d73571e542bd..3ddf76aea3f1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -174,8 +174,8 @@ struct page_pool; ALIGN_DOWN(MLX5E_KLM_MAX_ENTRIES_PER_WQE(wqe_size), MLX5_UMR_KLM_ALIGNMEN= T) =20 #define MLX5E_MAX_KLM_PER_WQE(mdev) \ - MLX5E_KLM_ENTRIES_PER_WQE(mlx5e_get_sw_max_sq_mpw_wqebbs(mlx5e_get_max_sq= _wqebbs(mdev)) \ - << MLX5_MKEY_BSF_OCTO_SIZE) + MLX5E_KLM_ENTRIES_PER_WQE(MLX5_SEND_WQE_BB * \ + mlx5e_get_sw_max_sq_mpw_wqebbs(mlx5e_get_max_sq_wqebbs(mdev))) =20 #define MLX5E_MSG_LEVEL NETIF_MSG_LINK =20 @@ -233,7 +233,7 @@ static inline u16 mlx5e_get_max_sq_wqebbs(struct mlx5_c= ore_dev *mdev) MLX5_CAP_GEN(mdev, max_wqe_sz_sq) / MLX5_SEND_WQE_BB); } =20 -static inline u16 mlx5e_get_sw_max_sq_mpw_wqebbs(u16 max_sq_wqebbs) +static inline u8 mlx5e_get_sw_max_sq_mpw_wqebbs(u8 max_sq_wqebbs) { /* The return value will be multiplied by MLX5_SEND_WQEBB_NUM_DS. * Since max_sq_wqebbs may be up to MLX5_SEND_WQE_MAX_WQEBBS =3D=3D 16, @@ -242,11 +242,12 @@ static inline u16 mlx5e_get_sw_max_sq_mpw_wqebbs(u16 = max_sq_wqebbs) * than MLX5_SEND_WQE_MAX_WQEBBS to let a full-session WQE be * cache-aligned. */ -#if L1_CACHE_BYTES < 128 - return min_t(u16, max_sq_wqebbs, MLX5_SEND_WQE_MAX_WQEBBS - 1); -#else - return min_t(u16, max_sq_wqebbs, MLX5_SEND_WQE_MAX_WQEBBS - 2); + u8 wqebbs =3D min_t(u8, max_sq_wqebbs, MLX5_SEND_WQE_MAX_WQEBBS - 1); + +#if L1_CACHE_BYTES >=3D 128 + wqebbs =3D ALIGN_DOWN(wqebbs, 2); #endif + return wqebbs; } =20 struct mlx5e_tx_wqe { @@ -456,7 +457,7 @@ struct mlx5e_txqsq { struct netdev_queue *txq; u32 sqn; u16 stop_room; - u16 max_sq_mpw_wqebbs; + u8 max_sq_mpw_wqebbs; u8 min_inline_mode; struct device *pdev; __be32 mkey_be; @@ -571,7 +572,7 @@ struct mlx5e_xdpsq { struct device *pdev; __be32 mkey_be; u16 stop_room; - u16 max_sq_mpw_wqebbs; + u8 max_sq_mpw_wqebbs; u8 min_inline_mode; unsigned long state; unsigned int hw_mtu; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9399FC00140 for ; Mon, 15 Aug 2022 21:23:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244613AbiHOVXA (ORCPT ); Mon, 15 Aug 2022 17:23:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344456AbiHOVR3 (ORCPT ); Mon, 15 Aug 2022 17:17:29 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5C745724D; Mon, 15 Aug 2022 12:20:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id CEBA5CE12C8; Mon, 15 Aug 2022 19:20:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7892DC433C1; Mon, 15 Aug 2022 19:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591238; bh=2AIfHgwfeBKdGos6JvHSPfX/PD5vFVUIM0rHUicTW30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bnKuzD7F04uozYGDNJCVKa5cqu09nGg1XSyI+/+Kyy0HFZPaJzZVWdTlxNQk43krF TbntEMD+iLD7n4TmhUyQpSMAU7DegdQvLsFkVJQ5ULUhlnY047hjTuuK9xoD1l4aSW gnzzmOnI2PHjVxKwaRk8GSWw0oySSrDyCk97zv/o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vlad Buslov , Roi Dayan , Paul Blakey , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 0516/1095] net/mlx5e: Modify slow path rules to go to slow fdb Date: Mon, 15 Aug 2022 19:58:35 +0200 Message-Id: <20220815180450.888719957@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vlad Buslov [ Upstream commit c0063a43700fa8c98cac2637aa1afcf40bb9e403 ] While extending available range of supported chains/prios referenced commit also modified slow path rules to go to FT chain instead of actual slow FDB. However neither of existing users of the MLX5_ATTR_FLAG_SLOW_PATH flag (tunnel encap entries with invalid encap and flows with trap action) need to match on FT chain. After bridge offload was implemented packets of such flows can also be matched by bridge priority tables which is undesirable. Restore slow path flows implementation to redirect packets to slow_fdb. Fixes: 278d51f24330 ("net/mlx5: E-Switch, Increase number of chains and pri= orities") Signed-off-by: Vlad Buslov Reviewed-by: Roi Dayan Reviewed-by: Paul Blakey Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../mellanox/mlx5/core/eswitch_offloads.c | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/d= rivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 796d97bcf1aa..c6546613f7d8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -230,10 +230,8 @@ esw_setup_ft_dest(struct mlx5_flow_destination *dest, } =20 static void -esw_setup_slow_path_dest(struct mlx5_flow_destination *dest, - struct mlx5_flow_act *flow_act, - struct mlx5_fs_chains *chains, - int i) +esw_setup_accept_dest(struct mlx5_flow_destination *dest, struct mlx5_flow= _act *flow_act, + struct mlx5_fs_chains *chains, int i) { if (mlx5_chains_ignore_flow_level_supported(chains)) flow_act->flags |=3D FLOW_ACT_IGNORE_FLOW_LEVEL; @@ -241,6 +239,16 @@ esw_setup_slow_path_dest(struct mlx5_flow_destination = *dest, dest[i].ft =3D mlx5_chains_get_tc_end_ft(chains); } =20 +static void +esw_setup_slow_path_dest(struct mlx5_flow_destination *dest, struct mlx5_f= low_act *flow_act, + struct mlx5_eswitch *esw, int i) +{ + if (MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, ignore_flow_level)) + flow_act->flags |=3D FLOW_ACT_IGNORE_FLOW_LEVEL; + dest[i].type =3D MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; + dest[i].ft =3D esw->fdb_table.offloads.slow_fdb; +} + static int esw_setup_chain_dest(struct mlx5_flow_destination *dest, struct mlx5_flow_act *flow_act, @@ -473,8 +481,11 @@ esw_setup_dests(struct mlx5_flow_destination *dest, } else if (attr->dest_ft) { esw_setup_ft_dest(dest, flow_act, esw, attr, spec, *i); (*i)++; - } else if (mlx5e_tc_attr_flags_skip(attr->flags)) { - esw_setup_slow_path_dest(dest, flow_act, chains, *i); + } else if (attr->flags & MLX5_ATTR_FLAG_SLOW_PATH) { + esw_setup_slow_path_dest(dest, flow_act, esw, *i); + (*i)++; + } else if (attr->flags & MLX5_ATTR_FLAG_ACCEPT) { + esw_setup_accept_dest(dest, flow_act, chains, *i); (*i)++; } else if (attr->dest_chain) { err =3D esw_setup_chain_dest(dest, flow_act, chains, attr->dest_chain, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9461CC00140 for ; Mon, 15 Aug 2022 21:23:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244784AbiHOVXN (ORCPT ); Mon, 15 Aug 2022 17:23:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344664AbiHOVRd (ORCPT ); Mon, 15 Aug 2022 17:17:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B213A5727F; Mon, 15 Aug 2022 12:20:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 640E1B81109; Mon, 15 Aug 2022 19:20:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A80ADC433D6; Mon, 15 Aug 2022 19:20:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591244; bh=0EQ4/Dg94d0UaYsLFhWmQFoiKgcKY4dRJ6yUJLSE2SQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YPkJokaWBW3En9N4IAOyrSUFnXKUA8FBBcCF0Uemh/WjUkxxDOw1Net34IzJIkjrt bc6CDKTVB8WSXdIAj0Svd05NSyuJW0Els0UAwmG2jmdy6JZ2EP7JJKqMAgPpEgxu5h Dvxmm5GhkdGyjxBAi8yWssEPgcRwhQx2f3nc60Dg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maher Sanalla , Maor Gottlieb , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 0517/1095] net/mlx5: Adjust log_max_qp to be 18 at most Date: Mon, 15 Aug 2022 19:58:36 +0200 Message-Id: <20220815180450.928809527@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maher Sanalla [ Upstream commit a6e9085d791f8306084fd5bc44dd3fdd4e1ac27b ] The cited commit limited log_max_qp to be 17 due to FW capabilities. Recently, it turned out that there are old FW versions that supported more than 17, so the cited commit caused a degradation. Thus, set the maximum log_max_qp back to 18 as it was before the cited commit. Fixes: 7f839965b2d7 ("net/mlx5: Update log_max_qp value to be 17 at most") Signed-off-by: Maher Sanalla Reviewed-by: Maor Gottlieb Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/e= thernet/mellanox/mlx5/core/main.c index 8b5263699994..ffb0bb4ecdef 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -526,7 +526,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, vo= id *set_ctx) =20 /* Check log_max_qp from HCA caps to set in current profile */ if (prof->log_max_qp =3D=3D LOG_MAX_SUPPORTED_QPS) { - prof->log_max_qp =3D min_t(u8, 17, MLX5_CAP_GEN_MAX(dev, log_max_qp)); + prof->log_max_qp =3D min_t(u8, 18, MLX5_CAP_GEN_MAX(dev, log_max_qp)); } else if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < prof->log_max_qp) { mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing= it to HCA capability limit (%d)\n", prof->log_max_qp, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73068C00140 for ; Mon, 15 Aug 2022 21:23:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245038AbiHOVXV (ORCPT ); Mon, 15 Aug 2022 17:23:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344789AbiHOVRf (ORCPT ); Mon, 15 Aug 2022 17:17:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A453E3D59F; Mon, 15 Aug 2022 12:20:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 581EDB810A3; Mon, 15 Aug 2022 19:20:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D12BC433C1; Mon, 15 Aug 2022 19:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591247; bh=w9DKv41Q3nZHDkkXaYYUdVGq5szEXNwsqk7DaJ1L83s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LxCRr7bom+9Ab6s4l7Qq9eb16MqKDGynjYAbRi8vWD4rp7q1fYKU/bL7WfA5eAVTm BlhmiXRv6/UBG4ohOb91cdoxc6nAQ0xVBZq7vmeTvuEPWof8T6LF8RP9iNbSrBNeZ2 /Mhhw+hb8Y2k48aYWbRCSd5N56OJayIGi8+z9EW0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yevgeny Kliteynik , Muhammad Sammar , Alex Vesker , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 0518/1095] net/mlx5: DR, Fix SMFS steering info dump format Date: Mon, 15 Aug 2022 19:58:37 +0200 Message-Id: <20220815180450.969666189@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yevgeny Kliteynik [ Upstream commit 62d2664351ef37da34f6f3a3fd8ab34257d6fe30 ] Fix several issues in SMFS steering info dump: - Fix outdated macro value for matcher mask in the SMFS debug dump format. The existing value denotes the old format of the matcher mask, as it was used during the early stages of development, and it results in wrong parsing by the steering dump parser - wrong fields are shown in the parsed output. - Add the missing destination table to the dumped action. The missing dest table handle breaks the ability to associate between the "go to table" action and the actual table in the steering info. Fixes: 9222f0b27da2 ("net/mlx5: DR, Add support for dumping steering info") Signed-off-by: Yevgeny Kliteynik Signed-off-by: Muhammad Sammar Reviewed-by: Alex Vesker Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../ethernet/mellanox/mlx5/core/steering/dr_dbg.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_dbg.c b/dr= ivers/net/ethernet/mellanox/mlx5/core/steering/dr_dbg.c index d5998ef59be4..7adcf0eec13b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_dbg.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_dbg.c @@ -21,10 +21,11 @@ enum dr_dump_rec_type { DR_DUMP_REC_TYPE_TABLE_TX =3D 3102, =20 DR_DUMP_REC_TYPE_MATCHER =3D 3200, - DR_DUMP_REC_TYPE_MATCHER_MASK =3D 3201, + DR_DUMP_REC_TYPE_MATCHER_MASK_DEPRECATED =3D 3201, DR_DUMP_REC_TYPE_MATCHER_RX =3D 3202, DR_DUMP_REC_TYPE_MATCHER_TX =3D 3203, DR_DUMP_REC_TYPE_MATCHER_BUILDER =3D 3204, + DR_DUMP_REC_TYPE_MATCHER_MASK =3D 3205, =20 DR_DUMP_REC_TYPE_RULE =3D 3300, DR_DUMP_REC_TYPE_RULE_RX_ENTRY_V0 =3D 3301, @@ -114,13 +115,15 @@ dr_dump_rule_action_mem(struct seq_file *file, const = u64 rule_id, break; case DR_ACTION_TYP_FT: if (action->dest_tbl->is_fw_tbl) - seq_printf(file, "%d,0x%llx,0x%llx,0x%x\n", + seq_printf(file, "%d,0x%llx,0x%llx,0x%x,0x%x\n", DR_DUMP_REC_TYPE_ACTION_FT, action_id, - rule_id, action->dest_tbl->fw_tbl.id); + rule_id, action->dest_tbl->fw_tbl.id, + -1); else - seq_printf(file, "%d,0x%llx,0x%llx,0x%x\n", + seq_printf(file, "%d,0x%llx,0x%llx,0x%x,0x%llx\n", DR_DUMP_REC_TYPE_ACTION_FT, action_id, - rule_id, action->dest_tbl->tbl->table_id); + rule_id, action->dest_tbl->tbl->table_id, + DR_DBG_PTR_TO_ID(action->dest_tbl->tbl)); =20 break; case DR_ACTION_TYP_CTR: --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85044C00140 for ; Mon, 15 Aug 2022 21:23:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343832AbiHOVXf (ORCPT ); Mon, 15 Aug 2022 17:23:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344874AbiHOVRh (ORCPT ); Mon, 15 Aug 2022 17:17:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8A9FE0FD9; Mon, 15 Aug 2022 12:20:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4FA9BB80FD3; Mon, 15 Aug 2022 19:20:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 993C4C433D6; Mon, 15 Aug 2022 19:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591250; bh=TQxWdx3oGUdaA/R2Vh3d0qVpSXxzDrvfsM9VzIlgOAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kNRtr97poKl908dk+Zu6F6hPdzIr6mC8Ksto7TnYqLCEOmzellDHyRua3QHtiU+6T hJl163PVLwR6945rAs7GaKW+Q7owWDzlCtdt1SFpMzc3KmK1yScTFH+cVdwxeGvWcW w8PPlKSVYDEOkCcSjqCwRD+R5nQ7Ls/+8YintxYg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shay Drory , Moshe Shemesh , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 0519/1095] net/mlx5: Fix driver use of uninitialized timeout Date: Mon, 15 Aug 2022 19:58:38 +0200 Message-Id: <20220815180451.008226773@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shay Drory [ Upstream commit 42b4f7f66a43cdb9216e76e595c8a9af154806da ] Currently, driver is setting default values to all timeouts during function setup. The offending commit is using a timeout before function setup, meaning: the timeout is 0 (or garbage), since no value have been set. This may result in failure to probe the driver: mlx5_function_setup:1034:(pid 69850): Firmware over 4294967296 MS in pre-in= itializing state, aborting probe_one:1591:(pid 69850): mlx5_init_one failed with error code -16 Hence, set default values to timeouts during tout_init() Fixes: 37ca95e62ee2 ("net/mlx5: Increase FW pre-init timeout for health rec= overy") Signed-off-by: Shay Drory Reviewed-by: Moshe Shemesh Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/mellanox/mlx5/core/lib/tout.c | 11 ++++------- drivers/net/ethernet/mellanox/mlx5/core/lib/tout.h | 1 - drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 -- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/tout.c b/drivers/n= et/ethernet/mellanox/mlx5/core/lib/tout.c index d758848d34d0..696e45e2bd06 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/tout.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/tout.c @@ -32,20 +32,17 @@ static void tout_set(struct mlx5_core_dev *dev, u64 val= , enum mlx5_timeouts_type dev->timeouts->to[type] =3D val; } =20 -void mlx5_tout_set_def_val(struct mlx5_core_dev *dev) +int mlx5_tout_init(struct mlx5_core_dev *dev) { int i; =20 - for (i =3D 0; i < MAX_TIMEOUT_TYPES; i++) - tout_set(dev, tout_def_sw_val[i], i); -} - -int mlx5_tout_init(struct mlx5_core_dev *dev) -{ dev->timeouts =3D kmalloc(sizeof(*dev->timeouts), GFP_KERNEL); if (!dev->timeouts) return -ENOMEM; =20 + for (i =3D 0; i < MAX_TIMEOUT_TYPES; i++) + tout_set(dev, tout_def_sw_val[i], i); + return 0; } =20 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/tout.h b/drivers/n= et/ethernet/mellanox/mlx5/core/lib/tout.h index 257c03eeab36..bc9e9aeda847 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/tout.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/tout.h @@ -35,7 +35,6 @@ int mlx5_tout_init(struct mlx5_core_dev *dev); void mlx5_tout_cleanup(struct mlx5_core_dev *dev); void mlx5_tout_query_iseg(struct mlx5_core_dev *dev); int mlx5_tout_query_dtor(struct mlx5_core_dev *dev); -void mlx5_tout_set_def_val(struct mlx5_core_dev *dev); u64 _mlx5_tout_ms(struct mlx5_core_dev *dev, enum mlx5_timeouts_types type= ); =20 #define mlx5_tout_ms(dev, type) _mlx5_tout_ms(dev, MLX5_TO_##type##_MS) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/e= thernet/mellanox/mlx5/core/main.c index ffb0bb4ecdef..75d216246955 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -1025,8 +1025,6 @@ static int mlx5_function_setup(struct mlx5_core_dev *= dev, u64 timeout) if (mlx5_core_is_pf(dev)) pcie_print_link_status(dev->pdev); =20 - mlx5_tout_set_def_val(dev); - /* wait for firmware to accept initialization segments configurations */ err =3D wait_fw_init(dev, timeout, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FEE0C00140 for ; Mon, 15 Aug 2022 21:23:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345479AbiHOVXr (ORCPT ); Mon, 15 Aug 2022 17:23:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344947AbiHOVRi (ORCPT ); Mon, 15 Aug 2022 17:17:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34EF6E0FF9; Mon, 15 Aug 2022 12:20:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B6A5660EF0; Mon, 15 Aug 2022 19:20:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1813C433C1; Mon, 15 Aug 2022 19:20:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591253; bh=alkqNoVEuZH4FmZPEVVM7SNB9OYHmAev1RY7fyrIPCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i0ZAprHThy1q+7vdJq9901xVGodcvCvwhbYzRUUyZ3o6jQ6nYN0rgMjWwA3KSEvf6 Ab/Jaz/g9GfO2+CRCA9pjptNrgN/iwVgDRagbxEK7mk78xTbbMYSnrpVDi1tJscE76 /8sYSeTndOIR7lrmqG5TBLuBsIetVkIR6sWxNQ8g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bernard F6BVP , Eric Dumazet , Duoming Zhou , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0520/1095] ax25: fix incorrect dev_tracker usage Date: Mon, 15 Aug 2022 19:58:39 +0200 Message-Id: <20220815180451.058379786@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet [ Upstream commit d7c4c9e075f8cc6d88d277bc24e5d99297f03c06 ] While investigating a separate rose issue [1], and enabling CONFIG_NET_DEV_REFCNT_TRACKER=3Dy, Bernard reported an orthogonal ax25 issu= e [2] An ax25_dev can be used by one (or many) struct ax25_cb. We thus need different dev_tracker, one per struct ax25_cb. After this patch is applied, we are able to focus on rose. [1] https://lore.kernel.org/netdev/fb7544a1-f42e-9254-18cc-c9b071f4ca70@fre= e.fr/ [2] [ 205.798723] reference already released. [ 205.798732] allocated in: [ 205.798734] ax25_bind+0x1a2/0x230 [ax25] [ 205.798747] __sys_bind+0xea/0x110 [ 205.798753] __x64_sys_bind+0x18/0x20 [ 205.798758] do_syscall_64+0x5c/0x80 [ 205.798763] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 205.798768] freed in: [ 205.798770] ax25_release+0x115/0x370 [ax25] [ 205.798778] __sock_release+0x42/0xb0 [ 205.798782] sock_close+0x15/0x20 [ 205.798785] __fput+0x9f/0x260 [ 205.798789] ____fput+0xe/0x10 [ 205.798792] task_work_run+0x64/0xa0 [ 205.798798] exit_to_user_mode_prepare+0x18b/0x190 [ 205.798804] syscall_exit_to_user_mode+0x26/0x40 [ 205.798808] do_syscall_64+0x69/0x80 [ 205.798812] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 205.798827] ------------[ cut here ]------------ [ 205.798829] WARNING: CPU: 2 PID: 2605 at lib/ref_tracker.c:136 ref_track= er_free.cold+0x60/0x81 [ 205.798837] Modules linked in: rose netrom mkiss ax25 rfcomm cmac algif_= hash algif_skcipher af_alg bnep snd_hda_codec_hdmi nls_iso8859_1 i915 rtw88= _8821ce rtw88_8821c x86_pkg_temp_thermal rtw88_pci intel_powerclamp rtw88_c= ore snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio coretemp snd_= hda_intel kvm_intel snd_intel_dspcfg mac80211 snd_hda_codec kvm i2c_algo_bi= t drm_buddy drm_dp_helper btusb drm_kms_helper snd_hwdep btrtl snd_hda_core= btbcm joydev crct10dif_pclmul btintel crc32_pclmul ghash_clmulni_intel mei= _hdcp btmtk intel_rapl_msr aesni_intel bluetooth input_leds snd_pcm crypto_= simd syscopyarea processor_thermal_device_pci_legacy sysfillrect cryptd int= el_soc_dts_iosf snd_seq sysimgblt ecdh_generic fb_sys_fops rapl libarc4 pro= cessor_thermal_device intel_cstate processor_thermal_rfim cec snd_timer ecc= snd_seq_device cfg80211 processor_thermal_mbox mei_me processor_thermal_ra= pl mei rc_core at24 snd intel_pch_thermal intel_rapl_common ttm soundcore i= nt340x_thermal_zone video [ 205.798948] mac_hid acpi_pad sch_fq_codel ipmi_devintf ipmi_msghandler = drm msr parport_pc ppdev lp parport ramoops pstore_blk reed_solomon pstore_= zone efi_pstore ip_tables x_tables autofs4 hid_generic usbhid hid i2c_i801 = i2c_smbus r8169 xhci_pci ahci libahci realtek lpc_ich xhci_pci_renesas [las= t unloaded: ax25] [ 205.798992] CPU: 2 PID: 2605 Comm: ax25ipd Not tainted 5.18.11-F6BVP #3 [ 205.798996] Hardware name: To be filled by O.E.M. To be filled by O.E.M.= /CK3, BIOS 5.011 09/16/2020 [ 205.798999] RIP: 0010:ref_tracker_free.cold+0x60/0x81 [ 205.799005] Code: e8 d2 01 9b ff 83 7b 18 00 74 14 48 c7 c7 2f d7 ff 98 = e8 10 6e fc ff 8b 7b 18 e8 b8 01 9b ff 4c 89 ee 4c 89 e7 e8 5d fd 07 00 <0f= > 0b b8 ea ff ff ff e9 30 05 9b ff 41 0f b6 f7 48 c7 c7 a0 fa 4e [ 205.799008] RSP: 0018:ffffaf5281073958 EFLAGS: 00010286 [ 205.799011] RAX: 0000000080000000 RBX: ffff9a0bd687ebe0 RCX: 00000000000= 00000 [ 205.799014] RDX: 0000000000000001 RSI: 0000000000000282 RDI: 00000000fff= fffff [ 205.799016] RBP: ffffaf5281073a10 R08: 0000000000000003 R09: fffffffffff= d5618 [ 205.799019] R10: 0000000000ffff10 R11: 000000000000000f R12: ffff9a0bc53= 384d0 [ 205.799022] R13: 0000000000000282 R14: 00000000ae000001 R15: 00000000000= 00001 [ 205.799024] FS: 0000000000000000(0000) GS:ffff9a0d0f300000(0000) knlGS:= 0000000000000000 [ 205.799028] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 205.799031] CR2: 00007ff6b8311554 CR3: 000000001ac10004 CR4: 00000000001= 706e0 [ 205.799033] Call Trace: [ 205.799035] [ 205.799038] ? ax25_dev_device_down+0xd9/0x1b0 [ax25] [ 205.799047] ? ax25_device_event+0x9f/0x270 [ax25] [ 205.799055] ? raw_notifier_call_chain+0x49/0x60 [ 205.799060] ? call_netdevice_notifiers_info+0x52/0xa0 [ 205.799065] ? dev_close_many+0xc8/0x120 [ 205.799070] ? unregister_netdevice_many+0x13d/0x890 [ 205.799073] ? unregister_netdevice_queue+0x90/0xe0 [ 205.799076] ? unregister_netdev+0x1d/0x30 [ 205.799080] ? mkiss_close+0x7c/0xc0 [mkiss] [ 205.799084] ? tty_ldisc_close+0x2e/0x40 [ 205.799089] ? tty_ldisc_hangup+0x137/0x210 [ 205.799092] ? __tty_hangup.part.0+0x208/0x350 [ 205.799098] ? tty_vhangup+0x15/0x20 [ 205.799103] ? pty_close+0x127/0x160 [ 205.799108] ? tty_release+0x139/0x5e0 [ 205.799112] ? __fput+0x9f/0x260 [ 205.799118] ax25_dev_device_down+0xd9/0x1b0 [ax25] [ 205.799126] ax25_device_event+0x9f/0x270 [ax25] [ 205.799135] raw_notifier_call_chain+0x49/0x60 [ 205.799140] call_netdevice_notifiers_info+0x52/0xa0 [ 205.799146] dev_close_many+0xc8/0x120 [ 205.799152] unregister_netdevice_many+0x13d/0x890 [ 205.799157] unregister_netdevice_queue+0x90/0xe0 [ 205.799161] unregister_netdev+0x1d/0x30 [ 205.799165] mkiss_close+0x7c/0xc0 [mkiss] [ 205.799170] tty_ldisc_close+0x2e/0x40 [ 205.799173] tty_ldisc_hangup+0x137/0x210 [ 205.799178] __tty_hangup.part.0+0x208/0x350 [ 205.799184] tty_vhangup+0x15/0x20 [ 205.799188] pty_close+0x127/0x160 [ 205.799193] tty_release+0x139/0x5e0 [ 205.799199] __fput+0x9f/0x260 [ 205.799203] ____fput+0xe/0x10 [ 205.799208] task_work_run+0x64/0xa0 [ 205.799213] do_exit+0x33b/0xab0 [ 205.799217] ? __handle_mm_fault+0xc4f/0x15f0 [ 205.799224] do_group_exit+0x35/0xa0 [ 205.799228] __x64_sys_exit_group+0x18/0x20 [ 205.799232] do_syscall_64+0x5c/0x80 [ 205.799238] ? handle_mm_fault+0xba/0x290 [ 205.799242] ? debug_smp_processor_id+0x17/0x20 [ 205.799246] ? fpregs_assert_state_consistent+0x26/0x50 [ 205.799251] ? exit_to_user_mode_prepare+0x49/0x190 [ 205.799256] ? irqentry_exit_to_user_mode+0x9/0x20 [ 205.799260] ? irqentry_exit+0x33/0x40 [ 205.799263] ? exc_page_fault+0x87/0x170 [ 205.799268] ? asm_exc_page_fault+0x8/0x30 [ 205.799273] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 205.799277] RIP: 0033:0x7ff6b80eaca1 [ 205.799281] Code: Unable to access opcode bytes at RIP 0x7ff6b80eac77. [ 205.799283] RSP: 002b:00007fff6dfd4738 EFLAGS: 00000246 ORIG_RAX: 000000= 00000000e7 [ 205.799287] RAX: ffffffffffffffda RBX: 00007ff6b8215a00 RCX: 00007ff6b80= eaca1 [ 205.799290] RDX: 000000000000003c RSI: 00000000000000e7 RDI: 00000000000= 00001 [ 205.799293] RBP: 0000000000000001 R08: ffffffffffffff80 R09: 00000000000= 00028 [ 205.799295] R10: 0000000000000000 R11: 0000000000000246 R12: 00007ff6b82= 15a00 [ 205.799298] R13: 0000000000000000 R14: 00007ff6b821aee8 R15: 00007ff6b82= 1af00 [ 205.799304] Fixes: feef318c855a ("ax25: fix UAF bugs of net_device caused by rebinding = operation") Reported-by: Bernard F6BVP Signed-off-by: Eric Dumazet Cc: Duoming Zhou Link: https://lore.kernel.org/r/20220728051821.3160118-1-eric.dumazet@gmail= .com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/net/ax25.h | 1 + net/ax25/af_ax25.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/net/ax25.h b/include/net/ax25.h index a427a05672e2..f8cf3629a419 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h @@ -236,6 +236,7 @@ typedef struct ax25_cb { ax25_address source_addr, dest_addr; ax25_digi *digipeat; ax25_dev *ax25_dev; + netdevice_tracker dev_tracker; unsigned char iamdigi; unsigned char state, modulus, pidincl; unsigned short vs, vr, va; diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 4c7030ed8d33..5b5363c99ed5 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1065,7 +1065,7 @@ static int ax25_release(struct socket *sock) del_timer_sync(&ax25->t3timer); del_timer_sync(&ax25->idletimer); } - dev_put_track(ax25_dev->dev, &ax25_dev->dev_tracker); + dev_put_track(ax25_dev->dev, &ax25->dev_tracker); ax25_dev_put(ax25_dev); } =20 @@ -1146,7 +1146,7 @@ static int ax25_bind(struct socket *sock, struct sock= addr *uaddr, int addr_len) =20 if (ax25_dev) { ax25_fillin_cb(ax25, ax25_dev); - dev_hold_track(ax25_dev->dev, &ax25_dev->dev_tracker, GFP_ATOMIC); + dev_hold_track(ax25_dev->dev, &ax25->dev_tracker, GFP_ATOMIC); } =20 done: --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 942F3C00140 for ; Mon, 15 Aug 2022 21:24:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346002AbiHOVYP (ORCPT ); Mon, 15 Aug 2022 17:24:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345202AbiHOVRl (ORCPT ); Mon, 15 Aug 2022 17:17:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EE1258B62; Mon, 15 Aug 2022 12:20:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 67CE2B810A3; Mon, 15 Aug 2022 19:20:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FD6FC433D6; Mon, 15 Aug 2022 19:20:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591256; bh=bjh2T3gtOlTJmqSHRYkYkNlxRdKEcz/kD+u8jQqUFdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xs+fFEqH7mx+DZDfSvRq1J65QBWXElV5AJhgLL/XLgqcQqt1e+p1Zq6ElTf23H2UO 6IxrpJpdJICpx6t+jJ3d8IaQaG/LGY2wpCKk+UHwTANDDy320x8XkfsXKQqvGw+bdl lQkjl9DyZ7P4DvICSt96UId/yS72DTG+AmL7NPeY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengchao Shao , Herbert Xu , Sasha Levin Subject: [PATCH 5.18 0521/1095] crypto: hisilicon/hpre - dont use GFP_KERNEL to alloc mem during softirq Date: Mon, 15 Aug 2022 19:58:40 +0200 Message-Id: <20220815180451.107903705@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhengchao Shao [ Upstream commit 98dfa9343f37bdd4112966292751e3a93aaf2e56 ] The hpre encryption driver may be used to encrypt and decrypt packets during the rx softirq, it is not allowed to use GFP_KERNEL. Fixes: c8b4b477079d ("crypto: hisilicon - add HiSilicon HPRE accelerator") Signed-off-by: Zhengchao Shao Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_crypto.c b/drivers/crypto/h= isilicon/hpre/hpre_crypto.c index 97d54c1465c2..3ba6f15deafc 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_crypto.c +++ b/drivers/crypto/hisilicon/hpre/hpre_crypto.c @@ -252,7 +252,7 @@ static int hpre_prepare_dma_buf(struct hpre_asym_reques= t *hpre_req, if (unlikely(shift < 0)) return -EINVAL; =20 - ptr =3D dma_alloc_coherent(dev, ctx->key_sz, tmp, GFP_KERNEL); + ptr =3D dma_alloc_coherent(dev, ctx->key_sz, tmp, GFP_ATOMIC); if (unlikely(!ptr)) return -ENOMEM; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CAE2C00140 for ; Mon, 15 Aug 2022 21:24:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345079AbiHOVYH (ORCPT ); Mon, 15 Aug 2022 17:24:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345261AbiHOVRn (ORCPT ); Mon, 15 Aug 2022 17:17:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58AE258B67; Mon, 15 Aug 2022 12:21:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 928466100A; Mon, 15 Aug 2022 19:20:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EAE7C433C1; Mon, 15 Aug 2022 19:20:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591259; bh=E9Bqs6DXdhLdrqZtlcaeECpgCsSG1vqbp0DxY58K9A8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NGy3T/e0eSTu29QzuCs156o/8pxVdEnUeHVGo9NQNqS/om7NjaSC+HDvnjvzJPZz7 8Sv5yuNne73ShxXyRQcHUuIA2J2tol4NOCAf7fnqvNwbrat9hFhSxkmeVQbVKsZd36 snY3zoGjwwXt1DqDz1V8RiulxYbPhkQWNltV86gw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Herbert Xu , Sasha Levin Subject: [PATCH 5.18 0522/1095] crypto: inside-secure - Add missing MODULE_DEVICE_TABLE for of Date: Mon, 15 Aug 2022 19:58:41 +0200 Message-Id: <20220815180451.152236045@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Roh=C3=A1r [ Upstream commit fa4d57b85786ec0e16565c75a51c208834b0c24d ] Without MODULE_DEVICE_TABLE, crypto_safexcel.ko module is not automatically loaded on platforms where inside-secure crypto HW is specified in device tree (e.g. Armada 3720). So add missing MODULE_DEVICE_TABLE for of. Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto en= gine driver") Signed-off-by: Pali Roh=C3=A1r Acked-by: Marek Beh=C3=BAn Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/crypto/inside-secure/safexcel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/insid= e-secure/safexcel.c index 9ff885d50edf..389a7b51f1f3 100644 --- a/drivers/crypto/inside-secure/safexcel.c +++ b/drivers/crypto/inside-secure/safexcel.c @@ -1831,6 +1831,8 @@ static const struct of_device_id safexcel_of_match_ta= ble[] =3D { {}, }; =20 +MODULE_DEVICE_TABLE(of, safexcel_of_match_table); + static struct platform_driver crypto_safexcel =3D { .probe =3D safexcel_probe, .remove =3D safexcel_remove, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D935C282E7 for ; Mon, 15 Aug 2022 21:27:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347723AbiHOV0K (ORCPT ); Mon, 15 Aug 2022 17:26:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345376AbiHOVRq (ORCPT ); Mon, 15 Aug 2022 17:17:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59C0D58B77; Mon, 15 Aug 2022 12:21:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E9E7360FDA; Mon, 15 Aug 2022 19:21:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B70E3C433D6; Mon, 15 Aug 2022 19:21:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591262; bh=V8KFlUt8vc+S/5k6oJNap1osqTZ/7ZMM2KhwKESJ2xM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vMO48c0ZtCNxfe60URy3MdIBmgqIDagb1cmvFvxJYg9pTMJIQgYPtV2AAD7n7nGIu cDl/zoQvX9TMjf4bBAaWuLd7z77DyBqIGmeZr2Am32Zn1+imzX6rsWOM5XiKB8G0iL zLBKImH7xPbe2bdYRl0i/rAexLABipug7t5BAbBs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Ye , Herbert Xu , Sasha Levin Subject: [PATCH 5.18 0523/1095] crypto: hisilicon/sec - fix auth key size error Date: Mon, 15 Aug 2022 19:58:42 +0200 Message-Id: <20220815180451.193254865@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kai Ye [ Upstream commit 45f5d0176d8426cc1ab0bab84fbd8ef5c57526c6 ] The authentication algorithm supports a maximum of 128-byte keys. The allocated key memory is insufficient. Fixes: 2f072d75d1ab ("crypto: hisilicon - Add aead support on SEC2") Signed-off-by: Kai Ye Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/crypto/hisilicon/sec2/sec_crypto.c | 6 +++--- drivers/crypto/hisilicon/sec2/sec_crypto.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hi= silicon/sec2/sec_crypto.c index f193d6b6fa16..dbaa6c918cfd 100644 --- a/drivers/crypto/hisilicon/sec2/sec_crypto.c +++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c @@ -620,7 +620,7 @@ static int sec_auth_init(struct sec_ctx *ctx) { struct sec_auth_ctx *a_ctx =3D &ctx->a_ctx; =20 - a_ctx->a_key =3D dma_alloc_coherent(ctx->dev, SEC_MAX_KEY_SIZE, + a_ctx->a_key =3D dma_alloc_coherent(ctx->dev, SEC_MAX_AKEY_SIZE, &a_ctx->a_key_dma, GFP_KERNEL); if (!a_ctx->a_key) return -ENOMEM; @@ -632,8 +632,8 @@ static void sec_auth_uninit(struct sec_ctx *ctx) { struct sec_auth_ctx *a_ctx =3D &ctx->a_ctx; =20 - memzero_explicit(a_ctx->a_key, SEC_MAX_KEY_SIZE); - dma_free_coherent(ctx->dev, SEC_MAX_KEY_SIZE, + memzero_explicit(a_ctx->a_key, SEC_MAX_AKEY_SIZE); + dma_free_coherent(ctx->dev, SEC_MAX_AKEY_SIZE, a_ctx->a_key, a_ctx->a_key_dma); } =20 diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.h b/drivers/crypto/hi= silicon/sec2/sec_crypto.h index 5e039b50e9d4..d033f63b583f 100644 --- a/drivers/crypto/hisilicon/sec2/sec_crypto.h +++ b/drivers/crypto/hisilicon/sec2/sec_crypto.h @@ -7,6 +7,7 @@ #define SEC_AIV_SIZE 12 #define SEC_IV_SIZE 24 #define SEC_MAX_KEY_SIZE 64 +#define SEC_MAX_AKEY_SIZE 128 #define SEC_COMM_SCENE 0 #define SEC_MIN_BLOCK_SZ 1 =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89063C28B2C for ; Mon, 15 Aug 2022 21:27:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347778AbiHOV0O (ORCPT ); Mon, 15 Aug 2022 17:26:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345631AbiHOVRs (ORCPT ); Mon, 15 Aug 2022 17:17:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3323F59245; Mon, 15 Aug 2022 12:21:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 668CFB810A3; Mon, 15 Aug 2022 19:21:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C61DFC433D6; Mon, 15 Aug 2022 19:21:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591265; bh=hCfd31VGfArmS1A3Vodmt42e7+p9e4TCKuJdxM20xpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENS4BFTl74jSpUtxcG3COeEgJwJmB63HhWgZQxZeHnJmLl55Jj0gdjG6e7vkFqBRP /Q0YrRxF2YVFxZ2UvO+WUimJQHfFbcKZGM9gE0SdBYxR/JgEMjtBkULhFEo/7YmXKC IphnWf03mjw7UUxQznLK8Qvedj5oFUwWEgoWv1KM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 0524/1095] inet: add READ_ONCE(sk->sk_bound_dev_if) in INET_MATCH() Date: Mon, 15 Aug 2022 19:58:43 +0200 Message-Id: <20220815180451.232724740@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet [ Upstream commit 4915d50e300e96929d2462041d6f6c6f061167fd ] INET_MATCH() runs without holding a lock on the socket. We probably need to annotate most reads. This patch makes INET_MATCH() an inline function to ease our changes. v2: We remove the 32bit version of it, as modern compilers should generate the same code really, no need to try to be smarter. Also make 'struct net *net' the first argument. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/net/inet_hashtables.h | 35 ++++++++++++++++------------------- include/net/sock.h | 3 --- net/ipv4/inet_hashtables.c | 15 +++++---------- net/ipv4/udp.c | 3 +-- 4 files changed, 22 insertions(+), 34 deletions(-) diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 749bb1e46087..825ad1d06d05 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h @@ -295,7 +295,6 @@ static inline struct sock *inet_lookup_listener(struct = net *net, ((__force __portpair)(((__u32)(__dport) << 16) | (__force __u32)(__be16)(= __sport))) #endif =20 -#if (BITS_PER_LONG =3D=3D 64) #ifdef __BIG_ENDIAN #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ const __addrpair __name =3D (__force __addrpair) ( \ @@ -307,24 +306,22 @@ static inline struct sock *inet_lookup_listener(struc= t net *net, (((__force __u64)(__be32)(__daddr)) << 32) | \ ((__force __u64)(__be32)(__saddr))) #endif /* __BIG_ENDIAN */ -#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif= , __sdif) \ - (((__sk)->sk_portpair =3D=3D (__ports)) && \ - ((__sk)->sk_addrpair =3D=3D (__cookie)) && \ - (((__sk)->sk_bound_dev_if =3D=3D (__dif)) || \ - ((__sk)->sk_bound_dev_if =3D=3D (__sdif))) && \ - net_eq(sock_net(__sk), (__net))) -#else /* 32-bit arch */ -#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ - const int __name __deprecated __attribute__((unused)) - -#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif= , __sdif) \ - (((__sk)->sk_portpair =3D=3D (__ports)) && \ - ((__sk)->sk_daddr =3D=3D (__saddr)) && \ - ((__sk)->sk_rcv_saddr =3D=3D (__daddr)) && \ - (((__sk)->sk_bound_dev_if =3D=3D (__dif)) || \ - ((__sk)->sk_bound_dev_if =3D=3D (__sdif))) && \ - net_eq(sock_net(__sk), (__net))) -#endif /* 64-bit arch */ + +static inline bool INET_MATCH(struct net *net, const struct sock *sk, + const __addrpair cookie, const __portpair ports, + int dif, int sdif) +{ + int bound_dev_if; + + if (!net_eq(sock_net(sk), net) || + sk->sk_portpair !=3D ports || + sk->sk_addrpair !=3D cookie) + return false; + + /* Paired with WRITE_ONCE() from sock_bindtoindex_locked() */ + bound_dev_if =3D READ_ONCE(sk->sk_bound_dev_if); + return bound_dev_if =3D=3D dif || bound_dev_if =3D=3D sdif; +} =20 /* Sockets in TCP_CLOSE state are _always_ taken out of the hash, so we ne= ed * not check it for lookups anymore, thanks Alexey. -DaveM diff --git a/include/net/sock.h b/include/net/sock.h index aab25d1806a9..810cb96b7f39 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -161,9 +161,6 @@ typedef __u64 __bitwise __addrpair; * for struct sock and struct inet_timewait_sock. */ struct sock_common { - /* skc_daddr and skc_rcv_saddr must be grouped on a 8 bytes aligned - * address on 64bit arches : cf INET_MATCH() - */ union { __addrpair skc_addrpair; struct { diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 55654e335d43..8dbe0782eafe 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -410,13 +410,11 @@ struct sock *__inet_lookup_established(struct net *ne= t, sk_nulls_for_each_rcu(sk, node, &head->chain) { if (sk->sk_hash !=3D hash) continue; - if (likely(INET_MATCH(sk, net, acookie, - saddr, daddr, ports, dif, sdif))) { + if (likely(INET_MATCH(net, sk, acookie, ports, dif, sdif))) { if (unlikely(!refcount_inc_not_zero(&sk->sk_refcnt))) goto out; - if (unlikely(!INET_MATCH(sk, net, acookie, - saddr, daddr, ports, - dif, sdif))) { + if (unlikely(!INET_MATCH(net, sk, acookie, + ports, dif, sdif))) { sock_gen_put(sk); goto begin; } @@ -465,8 +463,7 @@ static int __inet_check_established(struct inet_timewai= t_death_row *death_row, if (sk2->sk_hash !=3D hash) continue; =20 - if (likely(INET_MATCH(sk2, net, acookie, - saddr, daddr, ports, dif, sdif))) { + if (likely(INET_MATCH(net, sk2, acookie, ports, dif, sdif))) { if (sk2->sk_state =3D=3D TCP_TIME_WAIT) { tw =3D inet_twsk(sk2); if (twsk_unique(sk, sk2, twp)) @@ -532,9 +529,7 @@ static bool inet_ehash_lookup_by_sk(struct sock *sk, if (esk->sk_hash !=3D sk->sk_hash) continue; if (sk->sk_family =3D=3D AF_INET) { - if (unlikely(INET_MATCH(esk, net, acookie, - sk->sk_daddr, - sk->sk_rcv_saddr, + if (unlikely(INET_MATCH(net, esk, acookie, ports, dif, sdif))) { return true; } diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 6b4d8361560f..201e2533acb2 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2564,8 +2564,7 @@ static struct sock *__udp4_lib_demux_lookup(struct ne= t *net, struct sock *sk; =20 udp_portaddr_for_each_entry_rcu(sk, &hslot2->head) { - if (INET_MATCH(sk, net, acookie, rmt_addr, - loc_addr, ports, dif, sdif)) + if (INET_MATCH(net, sk, acookie, ports, dif, sdif)) return sk; /* Only check first socket in chain */ break; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B561C2BB9D for ; Mon, 15 Aug 2022 21:27:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347958AbiHOV0j (ORCPT ); Mon, 15 Aug 2022 17:26:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345741AbiHOVRt (ORCPT ); Mon, 15 Aug 2022 17:17:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7249E192B; Mon, 15 Aug 2022 12:21:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 88002B81120; Mon, 15 Aug 2022 19:21:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEABDC433D6; Mon, 15 Aug 2022 19:21:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591268; bh=UHis/WH57DlnsBA2REYNiER691/UQwxEL9zORic0t1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j/zXGW1C1bQz1YgdLHLQ/mIuoSLs0ufsp0HRSmS/t08tlWLv3FfCY575cr7DBdQDM uMW7CAXH+X1Au6gcn6AZeE2OxZFYLgWiK7S1qkhz4A9T+RhGf8KKhD8IMBNVn/RG0N KoOJ1TUWdJ0erOdmGkXGlaMAREMRJpiz9SJDcYec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 0525/1095] ipv6: add READ_ONCE(sk->sk_bound_dev_if) in INET6_MATCH() Date: Mon, 15 Aug 2022 19:58:44 +0200 Message-Id: <20220815180451.273158866@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet [ Upstream commit 5d368f03280d3678433a7f119efe15dfbbb87bc8 ] INET6_MATCH() runs without holding a lock on the socket. We probably need to annotate most reads. This patch makes INET6_MATCH() an inline function to ease our changes. v2: inline function only defined if IS_ENABLED(CONFIG_IPV6) Change the name to inet6_match(), this is no longer a macro. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/net/inet6_hashtables.h | 28 +++++++++++++++++++--------- net/ipv4/inet_hashtables.c | 2 +- net/ipv6/inet6_hashtables.c | 6 +++--- net/ipv6/udp.c | 2 +- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index 81b965953036..f259e1ae14ba 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h @@ -103,15 +103,25 @@ struct sock *inet6_lookup(struct net *net, struct ine= t_hashinfo *hashinfo, const int dif); =20 int inet6_hash(struct sock *sk); -#endif /* IS_ENABLED(CONFIG_IPV6) */ =20 -#define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif, __sdif)= \ - (((__sk)->sk_portpair =3D=3D (__ports)) && \ - ((__sk)->sk_family =3D=3D AF_INET6) && \ - ipv6_addr_equal(&(__sk)->sk_v6_daddr, (__saddr)) && \ - ipv6_addr_equal(&(__sk)->sk_v6_rcv_saddr, (__daddr)) && \ - (((__sk)->sk_bound_dev_if =3D=3D (__dif)) || \ - ((__sk)->sk_bound_dev_if =3D=3D (__sdif))) && \ - net_eq(sock_net(__sk), (__net))) +static inline bool inet6_match(struct net *net, const struct sock *sk, + const struct in6_addr *saddr, + const struct in6_addr *daddr, + const __portpair ports, + const int dif, const int sdif) +{ + int bound_dev_if; + + if (!net_eq(sock_net(sk), net) || + sk->sk_family !=3D AF_INET6 || + sk->sk_portpair !=3D ports || + !ipv6_addr_equal(&sk->sk_v6_daddr, saddr) || + !ipv6_addr_equal(&sk->sk_v6_rcv_saddr, daddr)) + return false; + + bound_dev_if =3D READ_ONCE(sk->sk_bound_dev_if); + return bound_dev_if =3D=3D dif || bound_dev_if =3D=3D sdif; +} +#endif /* IS_ENABLED(CONFIG_IPV6) */ =20 #endif /* _INET6_HASHTABLES_H */ diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 8dbe0782eafe..d631198e0938 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -536,7 +536,7 @@ static bool inet_ehash_lookup_by_sk(struct sock *sk, } #if IS_ENABLED(CONFIG_IPV6) else if (sk->sk_family =3D=3D AF_INET6) { - if (unlikely(INET6_MATCH(esk, net, + if (unlikely(inet6_match(net, esk, &sk->sk_v6_daddr, &sk->sk_v6_rcv_saddr, ports, dif, sdif))) { diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index 32ccac10bd62..bb4939e36840 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c @@ -71,12 +71,12 @@ struct sock *__inet6_lookup_established(struct net *net, sk_nulls_for_each_rcu(sk, node, &head->chain) { if (sk->sk_hash !=3D hash) continue; - if (!INET6_MATCH(sk, net, saddr, daddr, ports, dif, sdif)) + if (!inet6_match(net, sk, saddr, daddr, ports, dif, sdif)) continue; if (unlikely(!refcount_inc_not_zero(&sk->sk_refcnt))) goto out; =20 - if (unlikely(!INET6_MATCH(sk, net, saddr, daddr, ports, dif, sdif))) { + if (unlikely(!inet6_match(net, sk, saddr, daddr, ports, dif, sdif))) { sock_gen_put(sk); goto begin; } @@ -269,7 +269,7 @@ static int __inet6_check_established(struct inet_timewa= it_death_row *death_row, if (sk2->sk_hash !=3D hash) continue; =20 - if (likely(INET6_MATCH(sk2, net, saddr, daddr, ports, + if (likely(inet6_match(net, sk2, saddr, daddr, ports, dif, sdif))) { if (sk2->sk_state =3D=3D TCP_TIME_WAIT) { tw =3D inet_twsk(sk2); diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index aea28bf701be..544842fc831e 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -1044,7 +1044,7 @@ static struct sock *__udp6_lib_demux_lookup(struct ne= t *net, =20 udp_portaddr_for_each_entry_rcu(sk, &hslot2->head) { if (sk->sk_state =3D=3D TCP_ESTABLISHED && - INET6_MATCH(sk, net, rmt_addr, loc_addr, ports, dif, sdif)) + inet6_match(net, sk, rmt_addr, loc_addr, ports, dif, sdif)) return sk; /* Only check first socket in chain */ break; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C11C7C00140 for ; Mon, 15 Aug 2022 21:24:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346189AbiHOVYV (ORCPT ); Mon, 15 Aug 2022 17:24:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345754AbiHOVRu (ORCPT ); Mon, 15 Aug 2022 17:17:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E519E3942; Mon, 15 Aug 2022 12:21:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D63AC60EF0; Mon, 15 Aug 2022 19:21:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1EF8C433D6; Mon, 15 Aug 2022 19:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591271; bh=iZFd9z97YtMV3WCy5/Eyrxb+ZVXfH1kFgooGwXNH438=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zgPJdUJZwPTmiFMevXBjvzIOE9S2+9aSLWt79IsQhVwZC0qyiGyv6BnTioOlaVakI n14Hy9S+WxvXSCNMYaukVfxhxK1nR4MoHeGsy0rurIRs4bBkqWhOo49QU1Fvjt1knx S/ha57msdc48FMKJtCfocdPJEp8SN1mPiQtXxuWs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Manning , David Ahern , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 0526/1095] net: allow unbound socket for packets in VRF when tcp_l3mdev_accept set Date: Mon, 15 Aug 2022 19:58:45 +0200 Message-Id: <20220815180451.317397256@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mike Manning [ Upstream commit 944fd1aeacb627fa617f85f8e5a34f7ae8ea4d8e ] The commit 3c82a21f4320 ("net: allow binding socket in a VRF when there's an unbound socket") changed the inet socket lookup to avoid packets in a VRF from matching an unbound socket. This is to ensure the necessary isolation between the default and other VRFs for routing and forwarding. VRF-unaware processes running in the default VRF cannot access another VRF and have to be run with 'ip vrf exec '. This is to be expected with tcp_l3mdev_accept disabled, but could be reallowed when this sysctl option is enabled. So instead of directly checking dif and sdif in inet[6]_match, here call inet_sk_bound_dev_eq(). This allows a match on unbound socket for non-zero sdif i.e. for packets in a VRF, if tcp_l3mdev_accept is enabled. Fixes: 3c82a21f4320 ("net: allow binding socket in a VRF when there's an un= bound socket") Signed-off-by: Mike Manning Link: https://lore.kernel.org/netdev/a54c149aed38fded2d3b5fdb1a6c89e36a083b= 74.camel@lasnet.de/ Reviewed-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/net/inet6_hashtables.h | 7 +++---- include/net/inet_hashtables.h | 19 +++---------------- include/net/inet_sock.h | 11 +++++++++++ 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index f259e1ae14ba..56f1286583d3 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h @@ -110,8 +110,6 @@ static inline bool inet6_match(struct net *net, const s= truct sock *sk, const __portpair ports, const int dif, const int sdif) { - int bound_dev_if; - if (!net_eq(sock_net(sk), net) || sk->sk_family !=3D AF_INET6 || sk->sk_portpair !=3D ports || @@ -119,8 +117,9 @@ static inline bool inet6_match(struct net *net, const s= truct sock *sk, !ipv6_addr_equal(&sk->sk_v6_rcv_saddr, daddr)) return false; =20 - bound_dev_if =3D READ_ONCE(sk->sk_bound_dev_if); - return bound_dev_if =3D=3D dif || bound_dev_if =3D=3D sdif; + /* READ_ONCE() paired with WRITE_ONCE() in sock_bindtoindex_locked() */ + return inet_sk_bound_dev_eq(net, READ_ONCE(sk->sk_bound_dev_if), dif, + sdif); } #endif /* IS_ENABLED(CONFIG_IPV6) */ =20 diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 825ad1d06d05..53c22b64e972 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h @@ -203,17 +203,6 @@ static inline void inet_ehash_locks_free(struct inet_h= ashinfo *hashinfo) hashinfo->ehash_locks =3D NULL; } =20 -static inline bool inet_sk_bound_dev_eq(struct net *net, int bound_dev_if, - int dif, int sdif) -{ -#if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV) - return inet_bound_dev_eq(!!READ_ONCE(net->ipv4.sysctl_tcp_l3mdev_accept), - bound_dev_if, dif, sdif); -#else - return inet_bound_dev_eq(true, bound_dev_if, dif, sdif); -#endif -} - struct inet_bind_bucket * inet_bind_bucket_create(struct kmem_cache *cachep, struct net *net, struct inet_bind_hashbucket *head, @@ -311,16 +300,14 @@ static inline bool INET_MATCH(struct net *net, const = struct sock *sk, const __addrpair cookie, const __portpair ports, int dif, int sdif) { - int bound_dev_if; - if (!net_eq(sock_net(sk), net) || sk->sk_portpair !=3D ports || sk->sk_addrpair !=3D cookie) return false; =20 - /* Paired with WRITE_ONCE() from sock_bindtoindex_locked() */ - bound_dev_if =3D READ_ONCE(sk->sk_bound_dev_if); - return bound_dev_if =3D=3D dif || bound_dev_if =3D=3D sdif; + /* READ_ONCE() paired with WRITE_ONCE() in sock_bindtoindex_locked() */ + return inet_sk_bound_dev_eq(net, READ_ONCE(sk->sk_bound_dev_if), dif, + sdif); } =20 /* Sockets in TCP_CLOSE state are _always_ taken out of the hash, so we ne= ed diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 6395f6b9a5d2..bf5654ce711e 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h @@ -149,6 +149,17 @@ static inline bool inet_bound_dev_eq(bool l3mdev_accep= t, int bound_dev_if, return bound_dev_if =3D=3D dif || bound_dev_if =3D=3D sdif; } =20 +static inline bool inet_sk_bound_dev_eq(struct net *net, int bound_dev_if, + int dif, int sdif) +{ +#if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV) + return inet_bound_dev_eq(!!READ_ONCE(net->ipv4.sysctl_tcp_l3mdev_accept), + bound_dev_if, dif, sdif); +#else + return inet_bound_dev_eq(true, bound_dev_if, dif, sdif); +#endif +} + struct inet_cork { unsigned int flags; __be32 addr; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB732C00140 for ; Mon, 15 Aug 2022 21:24:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346446AbiHOVYa (ORCPT ); Mon, 15 Aug 2022 17:24:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346297AbiHOVSD (ORCPT ); Mon, 15 Aug 2022 17:18:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EDAE5A147; Mon, 15 Aug 2022 12:21:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0FC10B810C6; Mon, 15 Aug 2022 19:21:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4926AC433D6; Mon, 15 Aug 2022 19:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591277; bh=2rlkvR+VSCNZxJ9MpCjFN9T0LkYJDu75Wd2nel5TUv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oW+RQWsuB0XOvYx9LhU4t0EYhtaMghyJKnhLHZyCk4wr8Yj/nvkoBpFrtnMyVbWTx S11V4B0Davo6lovVCOLlUbac+362atI+FZ2+Hkl195PPmAHy/ECVF5ybnF+NBuHUDT 1lLRRXsPXvAcVeTgSijjUEnOY+fdhpW5jyG4YAus= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ido Schimmel , Amit Cohen , David Ahern , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 0527/1095] netdevsim: fib: Fix reference count leak on route deletion failure Date: Mon, 15 Aug 2022 19:58:46 +0200 Message-Id: <20220815180451.357535785@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ido Schimmel [ Upstream commit 180a6a3ee60a7cb69ed1232388460644f6a21f00 ] As part of FIB offload simulation, netdevsim stores IPv4 and IPv6 routes and holds a reference on FIB info structures that in turn hold a reference on the associated nexthop device(s). In the unlikely case where we are unable to allocate memory to process a route deletion request, netdevsim will not release the reference from the associated FIB info structure, thereby preventing the associated nexthop device(s) from ever being removed [1]. Fix this by scheduling a work item that will flush netdevsim's FIB table upon route deletion failure. This will cause netdevsim to release its reference from all the FIB info structures in its table. Reported by Lucas Leong of Trend Micro Zero Day Initiative. Fixes: 0ae3eb7b4611 ("netdevsim: fib: Perform the route programming in a no= n-atomic context") Signed-off-by: Ido Schimmel Reviewed-by: Amit Cohen Reviewed-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/netdevsim/fib.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/net/netdevsim/fib.c b/drivers/net/netdevsim/fib.c index 378ee779061c..14787d17f703 100644 --- a/drivers/net/netdevsim/fib.c +++ b/drivers/net/netdevsim/fib.c @@ -53,6 +53,7 @@ struct nsim_fib_data { struct rhashtable nexthop_ht; struct devlink *devlink; struct work_struct fib_event_work; + struct work_struct fib_flush_work; struct list_head fib_event_queue; spinlock_t fib_event_queue_lock; /* Protects fib event queue list */ struct mutex nh_lock; /* Protects NH HT */ @@ -977,7 +978,7 @@ static int nsim_fib_event_schedule_work(struct nsim_fib= _data *data, =20 fib_event =3D kzalloc(sizeof(*fib_event), GFP_ATOMIC); if (!fib_event) - return NOTIFY_BAD; + goto err_fib_event_alloc; =20 fib_event->data =3D data; fib_event->event =3D event; @@ -1005,6 +1006,9 @@ static int nsim_fib_event_schedule_work(struct nsim_f= ib_data *data, =20 err_fib_prepare_event: kfree(fib_event); +err_fib_event_alloc: + if (event =3D=3D FIB_EVENT_ENTRY_DEL) + schedule_work(&data->fib_flush_work); return NOTIFY_BAD; } =20 @@ -1482,6 +1486,24 @@ static void nsim_fib_event_work(struct work_struct *= work) mutex_unlock(&data->fib_lock); } =20 +static void nsim_fib_flush_work(struct work_struct *work) +{ + struct nsim_fib_data *data =3D container_of(work, struct nsim_fib_data, + fib_flush_work); + struct nsim_fib_rt *fib_rt, *fib_rt_tmp; + + /* Process pending work. */ + flush_work(&data->fib_event_work); + + mutex_lock(&data->fib_lock); + list_for_each_entry_safe(fib_rt, fib_rt_tmp, &data->fib_rt_list, list) { + rhashtable_remove_fast(&data->fib_rt_ht, &fib_rt->ht_node, + nsim_fib_rt_ht_params); + nsim_fib_rt_free(fib_rt, data); + } + mutex_unlock(&data->fib_lock); +} + static int nsim_fib_debugfs_init(struct nsim_fib_data *data, struct nsim_dev *nsim_de= v) { @@ -1540,6 +1562,7 @@ struct nsim_fib_data *nsim_fib_create(struct devlink = *devlink, goto err_rhashtable_nexthop_destroy; =20 INIT_WORK(&data->fib_event_work, nsim_fib_event_work); + INIT_WORK(&data->fib_flush_work, nsim_fib_flush_work); INIT_LIST_HEAD(&data->fib_event_queue); spin_lock_init(&data->fib_event_queue_lock); =20 @@ -1586,6 +1609,7 @@ struct nsim_fib_data *nsim_fib_create(struct devlink = *devlink, err_nexthop_nb_unregister: unregister_nexthop_notifier(devlink_net(devlink), &data->nexthop_nb); err_rhashtable_fib_destroy: + cancel_work_sync(&data->fib_flush_work); flush_work(&data->fib_event_work); rhashtable_free_and_destroy(&data->fib_rt_ht, nsim_fib_rt_free, data); @@ -1615,6 +1639,7 @@ void nsim_fib_destroy(struct devlink *devlink, struct= nsim_fib_data *data) NSIM_RESOURCE_IPV4_FIB); unregister_fib_notifier(devlink_net(devlink), &data->fib_nb); unregister_nexthop_notifier(devlink_net(devlink), &data->nexthop_nb); + cancel_work_sync(&data->fib_flush_work); flush_work(&data->fib_event_work); rhashtable_free_and_destroy(&data->fib_rt_ht, nsim_fib_rt_free, data); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11D0FC00140 for ; Mon, 15 Aug 2022 21:24:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346826AbiHOVYp (ORCPT ); Mon, 15 Aug 2022 17:24:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346418AbiHOVSE (ORCPT ); Mon, 15 Aug 2022 17:18:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E7172E9D9; Mon, 15 Aug 2022 12:21:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F6D1B81120; Mon, 15 Aug 2022 19:21:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69D20C433C1; Mon, 15 Aug 2022 19:21:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591280; bh=yvkrzACW/qrxgj1lX7sug5NglxA19jWHmopMFD2FfTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UQanQNQcWxSOWebk+7djiyA4tLMIX79x0PUb1N/W0huSnFseTo29b/EBnzyjRTZwl Us+IPsXLL5gJ47Xzp7s2IFovuP94JgKDx4SOg7BPwClm7Eokyh3fGixtfd5nb5BF1L NjX7xjEI6cl1Q7qABkIp8wtwPSwtY17XVcdwHD3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , William Dean , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0528/1095] wifi: rtw88: check the return value of alloc_workqueue() Date: Mon, 15 Aug 2022 19:58:47 +0200 Message-Id: <20220815180451.387059444@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Dean [ Upstream commit 42bbf810e155efc6129a3a648ae5300f00b79d7b ] The function alloc_workqueue() in rtw_core_init() can fail, but there is no check of its return value. To fix this bug, its return value should be checked with new error handling code. Fixes: fe101716c7c9d ("rtw88: replace tx tasklet with work queue") Reported-by: Hacash Robot Signed-off-by: William Dean Reviewed-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220723063756.2956189-1-williamsukatube@16= 3.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/realtek/rtw88/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wirele= ss/realtek/rtw88/main.c index 8b9899e41b0b..ded952913ae6 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1974,6 +1974,10 @@ int rtw_core_init(struct rtw_dev *rtwdev) timer_setup(&rtwdev->tx_report.purge_timer, rtw_tx_report_purge_timer, 0); rtwdev->tx_wq =3D alloc_workqueue("rtw_tx_wq", WQ_UNBOUND | WQ_HIGHPRI, 0= ); + if (!rtwdev->tx_wq) { + rtw_warn(rtwdev, "alloc_workqueue rtw_tx_wq failed\n"); + return -ENOMEM; + } =20 INIT_DELAYED_WORK(&rtwdev->watch_dog_work, rtw_watch_dog_work); INIT_DELAYED_WORK(&coex->bt_relink_work, rtw_coex_bt_relink_work); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FEC5C25B08 for ; Mon, 15 Aug 2022 21:24:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346713AbiHOVYi (ORCPT ); Mon, 15 Aug 2022 17:24:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346565AbiHOVSF (ORCPT ); Mon, 15 Aug 2022 17:18:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEB132DAB2; Mon, 15 Aug 2022 12:21:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 66567B81109; Mon, 15 Aug 2022 19:21:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95C78C433C1; Mon, 15 Aug 2022 19:21:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591284; bh=f4SZ4mcsekZdIZR9EDgaIVdoZev4KSJk5zIiug8otjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uc7nG+Gtkk/3TDMIZih5I3rft/lm9bBFX30oKCgN1blo2j/sUSWnYhccggy/blKGK 5Y/a5qqYv5EqqegYDLg4Hpb3DdYhBFizpcEK0hBW4eIl0kzr++JNdBqCFXsU+65t7W VHuX7vyc0w6j5IjUEdTLX1c094D8mS4LcBymsLKg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Przemyslaw Patynowski , Jun Zhang , Bharathi Sreenivas , Tony Nguyen , Sasha Levin Subject: [PATCH 5.18 0529/1095] iavf: Fix max_rate limiting Date: Mon, 15 Aug 2022 19:58:48 +0200 Message-Id: <20220815180451.428677159@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Przemyslaw Patynowski [ Upstream commit ec60d54cb9a3d43a02c5612a03093c18233e6601 ] Fix max_rate option in TC, check for proper quanta boundaries. Check for minimum value provided and if it fits expected 50Mbps quanta. Without this patch, iavf could send settings for max_rate limiting that would be accepted from by PF even the max_rate option is less than expected 50Mbps quanta. It results in no rate limiting on traffic as rate limiting will be floored to 0. Example: tc qdisc add dev $vf root mqprio num_tc 3 map 0 2 1 queues \ 2@0 2@2 2@4 hw 1 mode channel shaper bw_rlimit \ max_rate 50Mbps 500Mbps 500Mbps Should limit TC0 to circa 50 Mbps tc qdisc add dev $vf root mqprio num_tc 3 map 0 2 1 queues \ 2@0 2@2 2@4 hw 1 mode channel shaper bw_rlimit \ max_rate 0Mbps 100Kbit 500Mbps Should return error Fixes: d5b33d024496 ("i40evf: add ndo_setup_tc callback to i40evf") Signed-off-by: Przemyslaw Patynowski Signed-off-by: Jun Zhang Tested-by: Bharathi Sreenivas Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/intel/iavf/iavf.h | 1 + drivers/net/ethernet/intel/iavf/iavf_main.c | 25 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/= intel/iavf/iavf.h index 0ea0361cd86b..c241fbc30f93 100644 --- a/drivers/net/ethernet/intel/iavf/iavf.h +++ b/drivers/net/ethernet/intel/iavf/iavf.h @@ -92,6 +92,7 @@ struct iavf_vsi { #define IAVF_HKEY_ARRAY_SIZE ((IAVF_VFQF_HKEY_MAX_INDEX + 1) * 4) #define IAVF_HLUT_ARRAY_SIZE ((IAVF_VFQF_HLUT_MAX_INDEX + 1) * 4) #define IAVF_MBPS_DIVISOR 125000 /* divisor to convert to Mbps */ +#define IAVF_MBPS_QUANTA 50 =20 #define IAVF_VIRTCHNL_VF_RESOURCE_SIZE (sizeof(struct virtchnl_vf_resource= ) + \ (IAVF_MAX_VF_VSI * \ diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethe= rnet/intel/iavf/iavf_main.c index 2e2c153ce46a..51ae10eb348c 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -3322,6 +3322,7 @@ static int iavf_validate_ch_config(struct iavf_adapte= r *adapter, struct tc_mqprio_qopt_offload *mqprio_qopt) { u64 total_max_rate =3D 0; + u32 tx_rate_rem =3D 0; int i, num_qps =3D 0; u64 tx_rate =3D 0; int ret =3D 0; @@ -3336,12 +3337,32 @@ static int iavf_validate_ch_config(struct iavf_adap= ter *adapter, return -EINVAL; if (mqprio_qopt->min_rate[i]) { dev_err(&adapter->pdev->dev, - "Invalid min tx rate (greater than 0) specified\n"); + "Invalid min tx rate (greater than 0) specified for TC%d\n", + i); return -EINVAL; } - /*convert to Mbps */ + + /* convert to Mbps */ tx_rate =3D div_u64(mqprio_qopt->max_rate[i], IAVF_MBPS_DIVISOR); + + if (mqprio_qopt->max_rate[i] && + tx_rate < IAVF_MBPS_QUANTA) { + dev_err(&adapter->pdev->dev, + "Invalid max tx rate for TC%d, minimum %dMbps\n", + i, IAVF_MBPS_QUANTA); + return -EINVAL; + } + + (void)div_u64_rem(tx_rate, IAVF_MBPS_QUANTA, &tx_rate_rem); + + if (tx_rate_rem !=3D 0) { + dev_err(&adapter->pdev->dev, + "Invalid max tx rate for TC%d, not divisible by %d\n", + i, IAVF_MBPS_QUANTA); + return -EINVAL; + } + total_max_rate +=3D tx_rate; num_qps +=3D mqprio_qopt->qopt.count[i]; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDFABC25B0E for ; Mon, 15 Aug 2022 21:24:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346858AbiHOVYs (ORCPT ); Mon, 15 Aug 2022 17:24:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346566AbiHOVSG (ORCPT ); Mon, 15 Aug 2022 17:18:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0F77100; Mon, 15 Aug 2022 12:21:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9A67AB81109; Mon, 15 Aug 2022 19:21:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D837DC433C1; Mon, 15 Aug 2022 19:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591287; bh=CjcsINQYa6VArzm2wXQ8YIirX6aD5SJf3S+UBgXgnuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WzGPHx89VEUsOfuedTqiC/tmB07O8DIfxV/9pIHZQ9KsIMJdodTD1WBZG8Q939VAb Bz985+H8+7YYoCQKqt/fq9Py1SbkDDa/gBMsv5//oe64O2h8w9gDU3CMVPtbtQn3Yb rNl26ETYqpQtfYTP1xBHz8znvgaPP6Ry0ri6s3DU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Przemyslaw Patynowski , Grzegorz Szczurek , Kiran Patil , Jedrzej Jagielski , Bharathi Sreenivas , Tony Nguyen , Sasha Levin Subject: [PATCH 5.18 0530/1095] iavf: Fix tc qdisc show listing too many queues Date: Mon, 15 Aug 2022 19:58:49 +0200 Message-Id: <20220815180451.468305203@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Przemyslaw Patynowski [ Upstream commit 93cb804edab1b9a5bb7bb7b6824012dbb20abf22 ] Fix tc qdisc show dev root displaying too many fq_codel qdiscs. tc_modify_qdisc, which is caller of ndo_setup_tc, expects driver to call netif_set_real_num_tx_queues, which prepares qdiscs. Without this patch, fq_codel qdiscs would not be adjusted to number of queues on VF. e.g.: tc qdisc show dev qdisc mq 0: root qdisc fq_codel 0: parent :4 limit 10240p flows 1024 quantum 1514 target 5ms= interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent :3 limit 10240p flows 1024 quantum 1514 target 5ms= interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent :2 limit 10240p flows 1024 quantum 1514 target 5ms= interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent :1 limit 10240p flows 1024 quantum 1514 target 5ms= interval 100ms memory_limit 32Mb ecn drop_batch 64 tc qdisc add dev root mqprio num_tc 2 map 1 0 0 0 0 0 0 0 queues 1@0= 1@1 hw 1 mode channel shaper bw_rlimit max_rate 5000Mbit 150Mbit tc qdisc show dev qdisc mqprio 8003: root tc 2 map 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 queues:(0:0) (1:1) mode:channel shaper:bw_rlimit max_rate:5Gbit 150Mbit qdisc fq_codel 0: parent 8003:4 limit 10240p flows 1024 quantum 1514 target= 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent 8003:3 limit 10240p flows 1024 quantum 1514 target= 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent 8003:2 limit 10240p flows 1024 quantum 1514 target= 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent 8003:1 limit 10240p flows 1024 quantum 1514 target= 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 While after fix: tc qdisc add dev root mqprio num_tc 2 map 1 0 0 0 0 0 0 0 queues 1@0= 1@1 hw 1 mode channel shaper bw_rlimit max_rate 5000Mbit 150Mbit tc qdisc show dev #should show 2, shows 4 qdisc mqprio 8004: root tc 2 map 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 queues:(0:0) (1:1) mode:channel shaper:bw_rlimit max_rate:5Gbit 150Mbit qdisc fq_codel 0: parent 8004:2 limit 10240p flows 1024 quantum 1514 target= 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent 8004:1 limit 10240p flows 1024 quantum 1514 target= 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 Fixes: d5b33d024496 ("i40evf: add ndo_setup_tc callback to i40evf") Signed-off-by: Przemyslaw Patynowski Co-developed-by: Grzegorz Szczurek Signed-off-by: Grzegorz Szczurek Co-developed-by: Kiran Patil Signed-off-by: Kiran Patil Signed-off-by: Jedrzej Jagielski Tested-by: Bharathi Sreenivas Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/intel/iavf/iavf.h | 5 +++++ drivers/net/ethernet/intel/iavf/iavf_main.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/= intel/iavf/iavf.h index c241fbc30f93..a988c08e906f 100644 --- a/drivers/net/ethernet/intel/iavf/iavf.h +++ b/drivers/net/ethernet/intel/iavf/iavf.h @@ -431,6 +431,11 @@ struct iavf_adapter { /* lock to protect access to the cloud filter list */ spinlock_t cloud_filter_list_lock; u16 num_cloud_filters; + /* snapshot of "num_active_queues" before setup_tc for qdisc add + * is invoked. This information is useful during qdisc del flow, + * to restore correct number of queues + */ + int orig_num_active_queues; =20 #define IAVF_MAX_FDIR_FILTERS 128 /* max allowed Flow Director filters */ u16 fdir_active_fltr; diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethe= rnet/intel/iavf/iavf_main.c index 51ae10eb348c..3dbfaead2ac7 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -3429,6 +3429,7 @@ static int __iavf_setup_tc(struct net_device *netdev,= void *type_data) netif_tx_disable(netdev); iavf_del_all_cloud_filters(adapter); adapter->aq_required =3D IAVF_FLAG_AQ_DISABLE_CHANNELS; + total_qps =3D adapter->orig_num_active_queues; goto exit; } else { return -EINVAL; @@ -3472,7 +3473,21 @@ static int __iavf_setup_tc(struct net_device *netdev= , void *type_data) adapter->ch_config.ch_info[i].offset =3D 0; } } + + /* Take snapshot of original config such as "num_active_queues" + * It is used later when delete ADQ flow is exercised, so that + * once delete ADQ flow completes, VF shall go back to its + * original queue configuration + */ + + adapter->orig_num_active_queues =3D adapter->num_active_queues; + + /* Store queue info based on TC so that VF gets configured + * with correct number of queues when VF completes ADQ config + * flow + */ adapter->ch_config.total_qps =3D total_qps; + netif_tx_stop_all_queues(netdev); netif_tx_disable(netdev); adapter->aq_required |=3D IAVF_FLAG_AQ_ENABLE_CHANNELS; @@ -3489,6 +3504,12 @@ static int __iavf_setup_tc(struct net_device *netdev= , void *type_data) } } exit: + if (test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) + return 0; + + netif_set_real_num_rx_queues(netdev, total_qps); + netif_set_real_num_tx_queues(netdev, total_qps); + return ret; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFE9DC00140 for ; Mon, 15 Aug 2022 21:25:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245377AbiHOVZD (ORCPT ); Mon, 15 Aug 2022 17:25:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346767AbiHOVSH (ORCPT ); Mon, 15 Aug 2022 17:18:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B433B08; Mon, 15 Aug 2022 12:21:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D0212B81122; Mon, 15 Aug 2022 19:21:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F92AC433C1; Mon, 15 Aug 2022 19:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591290; bh=rCJ5IZlcujA+VBDei++2b8s3UWpJOoJg5ymsyUzwOQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lj9IAUuiF8b7ZNrtkR1zNpnqMQaT3jTayBSGj94R5ywyeP5SfisxJRNhtSR8/mNEO Wo6CurpfxXND2UgDMk54VAEO/Et4Ow7/SEbDN5lrSy7aq4ZWxpsOlUOyeNlib74Z9u AR2cYPB7EEhbSgVnxMFa/19dw/lHkaoQA5tAcCPA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+ad24705d3fd6463b18c6@syzkaller.appspotmail.com, Jakub Kicinski , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.18 0531/1095] netdevsim: Avoid allocation warnings triggered from user space Date: Mon, 15 Aug 2022 19:58:50 +0200 Message-Id: <20220815180451.508527940@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jakub Kicinski [ Upstream commit d0b80a9edb1a029ff913e81b47540e57ad034329 ] We need to suppress warnings from sily map sizes. Also switch from GFP_USER to GFP_KERNEL_ACCOUNT, I'm pretty sure I misunderstood the flags when writing this code. Fixes: 395cacb5f1a0 ("netdevsim: bpf: support fake map offload") Reported-by: syzbot+ad24705d3fd6463b18c6@syzkaller.appspotmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20220726213605.154204-1-kuba@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/netdevsim/bpf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/netdevsim/bpf.c b/drivers/net/netdevsim/bpf.c index a43820212932..50854265864d 100644 --- a/drivers/net/netdevsim/bpf.c +++ b/drivers/net/netdevsim/bpf.c @@ -351,10 +351,12 @@ nsim_map_alloc_elem(struct bpf_offloaded_map *offmap,= unsigned int idx) { struct nsim_bpf_bound_map *nmap =3D offmap->dev_priv; =20 - nmap->entry[idx].key =3D kmalloc(offmap->map.key_size, GFP_USER); + nmap->entry[idx].key =3D kmalloc(offmap->map.key_size, + GFP_KERNEL_ACCOUNT | __GFP_NOWARN); if (!nmap->entry[idx].key) return -ENOMEM; - nmap->entry[idx].value =3D kmalloc(offmap->map.value_size, GFP_USER); + nmap->entry[idx].value =3D kmalloc(offmap->map.value_size, + GFP_KERNEL_ACCOUNT | __GFP_NOWARN); if (!nmap->entry[idx].value) { kfree(nmap->entry[idx].key); nmap->entry[idx].key =3D NULL; @@ -496,7 +498,7 @@ nsim_bpf_map_alloc(struct netdevsim *ns, struct bpf_off= loaded_map *offmap) if (offmap->map.map_flags) return -EINVAL; =20 - nmap =3D kzalloc(sizeof(*nmap), GFP_USER); + nmap =3D kzalloc(sizeof(*nmap), GFP_KERNEL_ACCOUNT); if (!nmap) return -ENOMEM; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B57AC00140 for ; Mon, 15 Aug 2022 21:24:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245036AbiHOVY4 (ORCPT ); Mon, 15 Aug 2022 17:24:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346798AbiHOVSH (ORCPT ); Mon, 15 Aug 2022 17:18:07 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D046CB51; Mon, 15 Aug 2022 12:21:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 4AADDCE12C8; Mon, 15 Aug 2022 19:21:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31A4CC433C1; Mon, 15 Aug 2022 19:21:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591293; bh=iHhW4qyLdoFyQYBl6J+HvzCnbf6OZqPZB8iVowfHA8Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UJiNHNG5q/8gTJ3G2XgHyPQQ0qR4YBEVrlTw37GBHT1VRyVoZ96HsdarOeNTAp7et vRGO2hxzBSP5Xj7NBZKb9rIs3M+lrw3v9duJREr19UB+Bqm/BCGAzDBVFzZZoVyThW kA99V0rLwxAn1vVENJTd9bV6ory0ZBs42LCS2Cek= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bernard Pidoux , Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0532/1095] net: rose: fix netdev reference changes Date: Mon, 15 Aug 2022 19:58:51 +0200 Message-Id: <20220815180451.559061671@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet [ Upstream commit 931027820e4dafabc78aff82af59f8c1c4bd3128 ] Bernard reported that trying to unload rose module would lead to infamous messages: unregistered_netdevice: waiting for rose0 to become free. Usage count =3D xx This patch solves the issue, by making sure each socket referring to a netdevice holds a reference count on it, and properly releases it in rose_release(). rose_dev_first() is also fixed to take a device reference before leaving the rcu_read_locked section. Following patch will add ref_tracker annotations to ease future bug hunting. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Bernard Pidoux Signed-off-by: Eric Dumazet Tested-by: Bernard Pidoux Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/rose/af_rose.c | 11 +++++++++-- net/rose/rose_route.c | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index bf2d986a6bc3..a8e3ec800a9c 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c @@ -192,6 +192,7 @@ static void rose_kill_by_device(struct net_device *dev) rose_disconnect(s, ENETUNREACH, ROSE_OUT_OF_ORDER, 0); if (rose->neighbour) rose->neighbour->use--; + dev_put(rose->device); rose->device =3D NULL; } } @@ -592,6 +593,8 @@ static struct sock *rose_make_new(struct sock *osk) rose->idle =3D orose->idle; rose->defer =3D orose->defer; rose->device =3D orose->device; + if (rose->device) + dev_hold(rose->device); rose->qbitincl =3D orose->qbitincl; =20 return sk; @@ -645,6 +648,7 @@ static int rose_release(struct socket *sock) break; } =20 + dev_put(rose->device); sock->sk =3D NULL; release_sock(sk); sock_put(sk); @@ -721,7 +725,6 @@ static int rose_connect(struct socket *sock, struct soc= kaddr *uaddr, int addr_le struct rose_sock *rose =3D rose_sk(sk); struct sockaddr_rose *addr =3D (struct sockaddr_rose *)uaddr; unsigned char cause, diagnostic; - struct net_device *dev; ax25_uid_assoc *user; int n, err =3D 0; =20 @@ -778,9 +781,12 @@ static int rose_connect(struct socket *sock, struct so= ckaddr *uaddr, int addr_le } =20 if (sock_flag(sk, SOCK_ZAPPED)) { /* Must bind first - autobinding in thi= s may or may not work */ + struct net_device *dev; + sock_reset_flag(sk, SOCK_ZAPPED); =20 - if ((dev =3D rose_dev_first()) =3D=3D NULL) { + dev =3D rose_dev_first(); + if (!dev) { err =3D -ENETUNREACH; goto out_release; } @@ -788,6 +794,7 @@ static int rose_connect(struct socket *sock, struct soc= kaddr *uaddr, int addr_le user =3D ax25_findbyuid(current_euid()); if (!user) { err =3D -EINVAL; + dev_put(dev); goto out_release; } =20 diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c index 5e93510fa3d2..09ad2d9e63c9 100644 --- a/net/rose/rose_route.c +++ b/net/rose/rose_route.c @@ -615,6 +615,8 @@ struct net_device *rose_dev_first(void) if (first =3D=3D NULL || strncmp(dev->name, first->name, 3) < 0) first =3D dev; } + if (first) + dev_hold(first); rcu_read_unlock(); =20 return first; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FFA8C28B2B for ; Mon, 15 Aug 2022 21:27:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347829AbiHOV0U (ORCPT ); Mon, 15 Aug 2022 17:26:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346863AbiHOVSJ (ORCPT ); Mon, 15 Aug 2022 17:18:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D843BE5; Mon, 15 Aug 2022 12:21:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EFFA3B81109; Mon, 15 Aug 2022 19:21:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BF24C433D6; Mon, 15 Aug 2022 19:21:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591296; bh=UtehnCRzzqBGAbgtNav8NMIRUa9kB+iUG7AiDwD9Uks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PNmdZNE5e+Gjku84IU2lUuV7owsYtL0KDDuYAAbEV7Ks1Ryy5L/bnFExE5ysFJkUC Slf9SxnMem6vHZEpssA9Eno4SsSmTbW1dS7eS/loKRXuZN7zFa0FBxygFRyFUTLlQh XUEEbccdTQN+Q0AarfVt4un/WMV5Sm3AZOB6WbT8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Shen , Guangbin Huang , Tony Nguyen , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0533/1095] net: ice: fix error NETIF_F_HW_VLAN_CTAG_FILTER check in ice_vsi_sync_fltr() Date: Mon, 15 Aug 2022 19:58:52 +0200 Message-Id: <20220815180451.598611436@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jian Shen [ Upstream commit 7dc839fe47611e6995f370cae37b9797cf7d2672 ] vsi->current_netdev_flags is used store the current net device flags, not the active netdevice features. So it should use vsi->netdev->featurs, rather than vsi->current_netdev_flags to check NETIF_F_HW_VLAN_CTAG_FILTER. Fixes: 1babaf77f49d ("ice: Advertise 802.1ad VLAN filtering and offloads fo= r PF netdev") Signed-off-by: Jian Shen Signed-off-by: Guangbin Huang Acked-by: Tony Nguyen Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/intel/ice/ice_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethern= et/intel/ice/ice_main.c index 522462f41067..f48938af960c 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -419,7 +419,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi) IFF_PROMISC; goto out_promisc; } - if (vsi->current_netdev_flags & + if (vsi->netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER) vlan_ops->ena_rx_filtering(vsi); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DFC3C00140 for ; Mon, 15 Aug 2022 21:33:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348547AbiHOVdi (ORCPT ); Mon, 15 Aug 2022 17:33:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348603AbiHOVbk (ORCPT ); Mon, 15 Aug 2022 17:31:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EC7EEF9F3; Mon, 15 Aug 2022 12:24:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E18B16100A; Mon, 15 Aug 2022 19:24:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 727C5C433C1; Mon, 15 Aug 2022 19:24:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591449; bh=E7a/8oKrx2+k0GllHy1FIIfAK9lmfDORKu43LLWGCG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jKzxuJZmkD3BF+TnldaT478IpeYyGM0Vz75AdVdpA2VzyhhjlI6oyszWRBFBN4cj4 7TiaGbg2Chx3ipPOOicZuWgDFxP0ifCgI8T7wjhbX+5DwiW+JRD1Mu6YKoZ1vXczcU oym1h2nlGMqdkxDOfZJtgq/TKCQwZe8pxXjx46FU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Shen , Guangbin Huang , Shannon Nelson , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0534/1095] net: ionic: fix error check for vlan flags in ionic_set_nic_features() Date: Mon, 15 Aug 2022 19:58:53 +0200 Message-Id: <20220815180451.637770373@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jian Shen [ Upstream commit a86e86db5e6d72c82724a63ca1c5293409a21518 ] The prototype of input features of ionic_set_nic_features() is netdev_features_t, but the vlan_flags is using the private definition of ionic drivers. It should use the variable ctx.cmd.lif_setattr.features, rather than features to check the vlan flags. So fixes it. Fixes: beead698b173 ("ionic: Add the basic NDO callbacks for netdev support= ") Signed-off-by: Jian Shen Signed-off-by: Guangbin Huang Acked-by: Shannon Nelson Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/= ethernet/pensando/ionic/ionic_lif.c index f3568901eb91..1443f788ee37 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1437,7 +1437,7 @@ static int ionic_set_nic_features(struct ionic_lif *l= if, if ((old_hw_features ^ lif->hw_features) & IONIC_ETH_HW_RX_HASH) ionic_lif_rss_config(lif, lif->rss_types, NULL, NULL); =20 - if ((vlan_flags & features) && + if ((vlan_flags & le64_to_cpu(ctx.cmd.lif_setattr.features)) && !(vlan_flags & le64_to_cpu(ctx.comp.lif_setattr.features))) dev_info_once(lif->ionic->dev, "NIC is not supporting vlan offload, like= ly in SmartNIC mode\n"); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5742C282E7 for ; Mon, 15 Aug 2022 21:28:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344456AbiHOV2R (ORCPT ); Mon, 15 Aug 2022 17:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347730AbiHOVSr (ORCPT ); Mon, 15 Aug 2022 17:18:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A015DD119; Mon, 15 Aug 2022 12:22:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BBBEAB81122; Mon, 15 Aug 2022 19:22:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E20FC433C1; Mon, 15 Aug 2022 19:22:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591321; bh=GKndzDF+4wiFc5ZLcT52WO+3p+pdQ9M/nfja5EkNrUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L3L5EKhCyj6IVmRgMZDIvxR+LxungNCIjTlA0fni3GhWhuniJ3o2xlHZfiiI8TOQP 5NFiwH/ZAULnAoBMHUaLuabFnfzFEL0DRZ/bVTsWLjaPwgMePPxEWFNR/qx0QFbCgE zKuHHZIpFn949FHp7fUAuwk1SImeUB8O+pedBMUk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0535/1095] dccp: put dccp_qpolicy_full() and dccp_qpolicy_push() in the same lock Date: Mon, 15 Aug 2022 19:58:54 +0200 Message-Id: <20220815180451.677301287@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hangyu Hua [ Upstream commit a41b17ff9dacd22f5f118ee53d82da0f3e52d5e3 ] In the case of sk->dccps_qpolicy =3D=3D DCCPQ_POLICY_PRIO, dccp_qpolicy_full will drop a skb when qpolicy is full. And the lock in dccp_sendmsg is released before sock_alloc_send_skb and then relocked after sock_alloc_send_skb. The following conditions may lead dccp_qpolicy_push to add skb to an already full sk_write_queue: thread1--->lock thread1--->dccp_qpolicy_full: queue is full. drop a skb thread1--->unlock thread2--->lock thread2--->dccp_qpolicy_full: queue is not full. no need to drop. thread2--->unlock thread1--->lock thread1--->dccp_qpolicy_push: add a skb. queue is full. thread1--->unlock thread2--->lock thread2--->dccp_qpolicy_push: add a skb! thread2--->unlock Fix this by moving dccp_qpolicy_full. Fixes: b1308dc015eb ("[DCCP]: Set TX Queue Length Bounds via Sysctl") Signed-off-by: Hangyu Hua Link: https://lore.kernel.org/r/20220729110027.40569-1-hbh25y@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/dccp/proto.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/dccp/proto.c b/net/dccp/proto.c index a976b4d29892..0ee62506105a 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c @@ -736,11 +736,6 @@ int dccp_sendmsg(struct sock *sk, struct msghdr *msg, = size_t len) =20 lock_sock(sk); =20 - if (dccp_qpolicy_full(sk)) { - rc =3D -EAGAIN; - goto out_release; - } - timeo =3D sock_sndtimeo(sk, noblock); =20 /* @@ -759,6 +754,11 @@ int dccp_sendmsg(struct sock *sk, struct msghdr *msg, = size_t len) if (skb =3D=3D NULL) goto out_release; =20 + if (dccp_qpolicy_full(sk)) { + rc =3D -EAGAIN; + goto out_discard; + } + if (sk->sk_state =3D=3D DCCP_CLOSED) { rc =3D -ENOTCONN; goto out_discard; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AFB5C00140 for ; Mon, 15 Aug 2022 21:29:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348080AbiHOV3j (ORCPT ); Mon, 15 Aug 2022 17:29:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243668AbiHOVYf (ORCPT ); Mon, 15 Aug 2022 17:24:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9363E8313; Mon, 15 Aug 2022 12:22:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BBC0C60EF0; Mon, 15 Aug 2022 19:22:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAE72C433C1; Mon, 15 Aug 2022 19:22:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591356; bh=6WkHnJVm5rzOj2ShWWfniZvz3jfM09Vn7mLBc0nYWV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ds4NgbvUdNSy0K+wecRqtRxYjonQDFoh9yP+r6k/8yv5MoaRXxl98GvA9neKkXBxz j5mzGB7ZNPmHW9c0lylsA+6Sq0/TkbcDk9Idv2UjYxgc2gfi/3C6JlyoXVjxW/ZT5x zjBIO3osDm7RkVM66L0/UORS38efCckYsgcwpW1k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Hayes Wang , Jakub Kicinski , =?UTF-8?q?Maciej=20=C5=BBenczykowski?= , Paolo Abeni , Sasha Levin Subject: [PATCH 5.18 0536/1095] net: usb: make USB_RTL8153_ECM non user configurable Date: Mon, 15 Aug 2022 19:58:55 +0200 Message-Id: <20220815180451.723458190@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maciej =C5=BBenczykowski [ Upstream commit f56530dcdb0684406661ac9f1accf48319d07600 ] This refixes: commit 7da17624e7948d5d9660b910f8079d26d26ce453 nt: usb: USB_RTL8153_ECM should not default to y In general, device drivers should not be enabled by default. which basically broke the commit it claimed to fix, ie: commit 657bc1d10bfc23ac06d5d687ce45826c760744f9 r8153_ecm: avoid to be prior to r8152 driver Avoid r8153_ecm is compiled as built-in, if r8152 driver is compiled as modules. Otherwise, the r8153_ecm would be used, even though the device is supported by r8152 driver. this commit amounted to: drivers/net/usb/Kconfig: +config USB_RTL8153_ECM + tristate "RTL8153 ECM support" + depends on USB_NET_CDCETHER && (USB_RTL8152 || USB_RTL8152=3Dn) + default y + help + This option supports ECM mode for RTL8153 ethernet adapter, when + CONFIG_USB_RTL8152 is not set, or the RTL8153 device is not + supported by r8152 driver. drivers/net/usb/Makefile: -obj-$(CONFIG_USB_NET_CDCETHER) +=3D cdc_ether.o r8153_ecm.o +obj-$(CONFIG_USB_NET_CDCETHER) +=3D cdc_ether.o +obj-$(CONFIG_USB_RTL8153_ECM) +=3D r8153_ecm.o And as can be seen it pulls a piece of the cdc_ether driver out into a separate config option to be able to make this piece modular in case cdc_ether is builtin, while r8152 is modular. While in general, device drivers should indeed not be enabled by default: this isn't a device driver per say, but rather this is support code for the CDCETHER (ECM) driver, and should thus be enabled if it is enabled. See also email thread at: https://www.spinics.net/lists/netdev/msg767649.html In: https://www.spinics.net/lists/netdev/msg768284.html Jakub wrote: And when we say "removed" we can just hide it from what's prompted to the user (whatever such internal options are called)? I believe this way we don't bring back Marek's complaint. Side note: these incorrect defaults will result in Android 13 on 5.15 GKI kernels lacking USB_RTL8153_ECM support while having USB_NET_CDCETHER (luckily we also have USB_RTL8150 and USB_RTL8152, so it's probably only an issue for very new RTL815x hardware with no native 5.15 driver). Fixes: 7da17624e7948d5d ("nt: usb: USB_RTL8153_ECM should not default to y") Cc: Geert Uytterhoeven Cc: Greg Kroah-Hartman Cc: Hayes Wang Cc: Jakub Kicinski Signed-off-by: Maciej =C5=BBenczykowski Link: https://lore.kernel.org/r/20220730230113.4138858-1-zenczykowski@gmail= .com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/usb/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index e62fc4f2aee0..76659c1c525a 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig @@ -637,8 +637,9 @@ config USB_NET_AQC111 * Aquantia AQtion USB to 5GbE =20 config USB_RTL8153_ECM - tristate "RTL8153 ECM support" + tristate depends on USB_NET_CDCETHER && (USB_RTL8152 || USB_RTL8152=3Dn) + default y help This option supports ECM mode for RTL8153 ethernet adapter, when CONFIG_USB_RTL8152 is not set, or the RTL8153 device is not --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F59DC3F6B0 for ; Mon, 15 Aug 2022 21:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348305AbiHOVaq (ORCPT ); Mon, 15 Aug 2022 17:30:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348361AbiHOV13 (ORCPT ); Mon, 15 Aug 2022 17:27:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72657EA32E; Mon, 15 Aug 2022 12:23:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 765A66100A; Mon, 15 Aug 2022 19:23:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D0A1C433C1; Mon, 15 Aug 2022 19:23:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591389; bh=lKxoAvXVsGRe9PiFvoNGpQWBXTPaZ/60XQ9q76tymYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WCOE5TzEgCnKXBNRICTwovUEELaRppJmD2ojniejxFXzbIiQBiSsaHcSxfDOHRUdj sCthMOCeeBni6R30Qy24y4P49m3Xo1gRKnfII17cMXRHiGiJK7civJq9bJjTPcUe/r f5cM1vysvJL/AA5J9doy//pu3W4lTArNBuQKHRfk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan , Saeed Mahameed , Maciej Fijalkowski , Paolo Abeni , Sasha Levin Subject: [PATCH 5.18 0537/1095] net/mlx5e: xsk: Discard unaligned XSK frames on striding RQ Date: Mon, 15 Aug 2022 19:58:56 +0200 Message-Id: <20220815180451.761190961@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxim Mikityanskiy [ Upstream commit 8eaa1d110800fac050bab44001732747a1c39894 ] Striding RQ uses MTT page mapping, where each page corresponds to an XSK frame. MTT pages have alignment requirements, and XSK frames don't have any alignment guarantees in the unaligned mode. Frames with improper alignment must be discarded, otherwise the packet data will be written at a wrong address. Fixes: 282c0c798f8e ("net/mlx5e: Allow XSK frames smaller than a page") Signed-off-by: Maxim Mikityanskiy Reviewed-by: Tariq Toukan Reviewed-by: Saeed Mahameed Reviewed-by: Maciej Fijalkowski Link: https://lore.kernel.org/r/20220729121356.3990867-1-maximmi@nvidia.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../net/ethernet/mellanox/mlx5/core/en/xsk/rx.h | 14 ++++++++++++++ include/net/xdp_sock_drv.h | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.h b/drivers/= net/ethernet/mellanox/mlx5/core/en/xsk/rx.h index 7f88ccf67fdd..8b56cb8b4743 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.h @@ -7,6 +7,8 @@ #include "en.h" #include =20 +#define MLX5E_MTT_PTAG_MASK 0xfffffffffffffff8ULL + /* RX data path */ =20 struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, @@ -22,6 +24,7 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5= e_rq *rq, static inline int mlx5e_xsk_page_alloc_pool(struct mlx5e_rq *rq, struct mlx5e_dma_info *dma_info) { +retry: dma_info->xsk =3D xsk_buff_alloc(rq->xsk_pool); if (!dma_info->xsk) return -ENOMEM; @@ -33,6 +36,17 @@ static inline int mlx5e_xsk_page_alloc_pool(struct mlx5e= _rq *rq, */ dma_info->addr =3D xsk_buff_xdp_get_frame_dma(dma_info->xsk); =20 + /* MTT page mapping has alignment requirements. If they are not + * satisfied, leak the descriptor so that it won't come again, and try + * to allocate a new one. + */ + if (rq->wq_type =3D=3D MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ) { + if (unlikely(dma_info->addr & ~MLX5E_MTT_PTAG_MASK)) { + xsk_buff_discard(dma_info->xsk); + goto retry; + } + } + return 0; } =20 diff --git a/include/net/xdp_sock_drv.h b/include/net/xdp_sock_drv.h index 4aa031849668..0774ce97c2f1 100644 --- a/include/net/xdp_sock_drv.h +++ b/include/net/xdp_sock_drv.h @@ -95,6 +95,13 @@ static inline void xsk_buff_free(struct xdp_buff *xdp) xp_free(xskb); } =20 +static inline void xsk_buff_discard(struct xdp_buff *xdp) +{ + struct xdp_buff_xsk *xskb =3D container_of(xdp, struct xdp_buff_xsk, xdp); + + xp_release(xskb); +} + static inline void xsk_buff_set_size(struct xdp_buff *xdp, u32 size) { xdp->data =3D xdp->data_hard_start + XDP_PACKET_HEADROOM; @@ -238,6 +245,10 @@ static inline void xsk_buff_free(struct xdp_buff *xdp) { } =20 +static inline void xsk_buff_discard(struct xdp_buff *xdp) +{ +} + static inline void xsk_buff_set_size(struct xdp_buff *xdp, u32 size) { } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6BF8C25B0E for ; Mon, 15 Aug 2022 21:32:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245274AbiHOVcp (ORCPT ); Mon, 15 Aug 2022 17:32:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348525AbiHOV1u (ORCPT ); Mon, 15 Aug 2022 17:27:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1538E3D5BF; Mon, 15 Aug 2022 12:23:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B16A9B80FD3; Mon, 15 Aug 2022 19:23:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C6CEC433C1; Mon, 15 Aug 2022 19:23:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591423; bh=hG2YwfD3GERqvp7dAQn4lJn8v53PgZPVyBYg36/I2NI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHrXOg9rOoL9HMEW6K0r0gnlMcnAsxcnzBItIUti2xcyb8gyWtsBKjo/nqcyxzGl1 EykCYWEiHRg35JhBNgka9MPbPa7fSsgOYHejJs7uG5NjSnZwbgzXdmErLxBnBzYuRN 2qixfa8BnKnnNtUSmfZeeE+scnmib6aVLpkF9r3I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , "Jason A. Donenfeld" , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0538/1095] wireguard: ratelimiter: use hrtimer in selftest Date: Mon, 15 Aug 2022 19:58:57 +0200 Message-Id: <20220815180451.808558091@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld [ Upstream commit 151c8e499f4705010780189377f85b57400ccbf5 ] Using msleep() is problematic because it's compared against ratelimiter.c's ktime_get_coarse_boottime_ns(), which means on systems with slow jiffies (such as UML's forced HZ=3D100), the result is inaccurate. So switch to using schedule_hrtimeout(). However, hrtimer gives us access only to the traditional posix timers, and none of the _COARSE variants. So now, rather than being too imprecise like jiffies, it's too precise. One solution would be to give it a large "range" value, but this will still fire early on a loaded system. A better solution is to align the timeout to the actual coarse timer, and then round up to the nearest tick, plus change. So add the timeout to the current coarse time, and then schedule_hrtimer() until the absolute computed time. This should hopefully reduce flakes in CI as well. Note that we keep the retry loop in case the entire function is running behind, because the test could still be scheduled out, by either the kernel or by the hypervisor's kernel, in which case restarting the test and hoping to not be scheduled out still helps. Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") Suggested-by: Thomas Gleixner Signed-off-by: Jason A. Donenfeld Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireguard/selftest/ratelimiter.c | 25 +++++++++++--------- kernel/time/hrtimer.c | 1 + 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireguard/selftest/ratelimiter.c b/drivers/net/wir= eguard/selftest/ratelimiter.c index 007cd4457c5f..ba87d294604f 100644 --- a/drivers/net/wireguard/selftest/ratelimiter.c +++ b/drivers/net/wireguard/selftest/ratelimiter.c @@ -6,28 +6,29 @@ #ifdef DEBUG =20 #include +#include =20 static const struct { bool result; - unsigned int msec_to_sleep_before; + u64 nsec_to_sleep_before; } expected_results[] __initconst =3D { [0 ... PACKETS_BURSTABLE - 1] =3D { true, 0 }, [PACKETS_BURSTABLE] =3D { false, 0 }, - [PACKETS_BURSTABLE + 1] =3D { true, MSEC_PER_SEC / PACKETS_PER_SECOND }, + [PACKETS_BURSTABLE + 1] =3D { true, NSEC_PER_SEC / PACKETS_PER_SECOND }, [PACKETS_BURSTABLE + 2] =3D { false, 0 }, - [PACKETS_BURSTABLE + 3] =3D { true, (MSEC_PER_SEC / PACKETS_PER_SECOND) *= 2 }, + [PACKETS_BURSTABLE + 3] =3D { true, (NSEC_PER_SEC / PACKETS_PER_SECOND) *= 2 }, [PACKETS_BURSTABLE + 4] =3D { true, 0 }, [PACKETS_BURSTABLE + 5] =3D { false, 0 } }; =20 static __init unsigned int maximum_jiffies_at_index(int index) { - unsigned int total_msecs =3D 2 * MSEC_PER_SEC / PACKETS_PER_SECOND / 3; + u64 total_nsecs =3D 2 * NSEC_PER_SEC / PACKETS_PER_SECOND / 3; int i; =20 for (i =3D 0; i <=3D index; ++i) - total_msecs +=3D expected_results[i].msec_to_sleep_before; - return msecs_to_jiffies(total_msecs); + total_nsecs +=3D expected_results[i].nsec_to_sleep_before; + return nsecs_to_jiffies(total_nsecs); } =20 static __init int timings_test(struct sk_buff *skb4, struct iphdr *hdr4, @@ -42,8 +43,12 @@ static __init int timings_test(struct sk_buff *skb4, str= uct iphdr *hdr4, loop_start_time =3D jiffies; =20 for (i =3D 0; i < ARRAY_SIZE(expected_results); ++i) { - if (expected_results[i].msec_to_sleep_before) - msleep(expected_results[i].msec_to_sleep_before); + if (expected_results[i].nsec_to_sleep_before) { + ktime_t timeout =3D ktime_add(ktime_add_ns(ktime_get_coarse_boottime(),= TICK_NSEC * 4 / 3), + ns_to_ktime(expected_results[i].nsec_to_sleep_before)); + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_hrtimeout_range_clock(&timeout, 0, HRTIMER_MODE_ABS, CLOCK_BOO= TTIME); + } =20 if (time_is_before_jiffies(loop_start_time + maximum_jiffies_at_index(i))) @@ -127,7 +132,7 @@ bool __init wg_ratelimiter_selftest(void) if (IS_ENABLED(CONFIG_KASAN) || IS_ENABLED(CONFIG_UBSAN)) return true; =20 - BUILD_BUG_ON(MSEC_PER_SEC % PACKETS_PER_SECOND !=3D 0); + BUILD_BUG_ON(NSEC_PER_SEC % PACKETS_PER_SECOND !=3D 0); =20 if (wg_ratelimiter_init()) goto out; @@ -176,7 +181,6 @@ bool __init wg_ratelimiter_selftest(void) test +=3D test_count; goto err; } - msleep(500); continue; } else if (ret < 0) { test +=3D test_count; @@ -195,7 +199,6 @@ bool __init wg_ratelimiter_selftest(void) test +=3D test_count; goto err; } - msleep(50); continue; } test +=3D test_count; diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 0ea8702eb516..23af5eca11b1 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -2311,6 +2311,7 @@ schedule_hrtimeout_range_clock(ktime_t *expires, u64 = delta, =20 return !t.task ? 0 : -EINTR; } +EXPORT_SYMBOL_GPL(schedule_hrtimeout_range_clock); =20 /** * schedule_hrtimeout_range - sleep until timeout --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1226FC00140 for ; Mon, 15 Aug 2022 21:33:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348356AbiHOVdC (ORCPT ); Mon, 15 Aug 2022 17:33:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347203AbiHOV27 (ORCPT ); Mon, 15 Aug 2022 17:28:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62DF1EE4A5; Mon, 15 Aug 2022 12:23:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3C578B80FD3; Mon, 15 Aug 2022 19:23:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B6F7C433C1; Mon, 15 Aug 2022 19:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591433; bh=u0HsNN8rMYruFAvZHEvP0r2fe53rUhzO3lCv1NuR+A8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A1CWwJ0qGH3RFEiOyJyikecZyGVGeSDyYzwdsq0pqUaX/0CtlbJzaICvXrBlFqldm Qbzpsx5ajM1RY+EfFdMBfThkXtfCu5hjxhPSjDEpvSwmV4N9rll5LV+lEAA+j4S1dD xsPWSwIOR2+nvXx68UedPqp8qTRcaRdYDC4dUAKI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds , "Jason A. Donenfeld" , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0539/1095] wireguard: allowedips: dont corrupt stack when detecting overflow Date: Mon, 15 Aug 2022 19:58:58 +0200 Message-Id: <20220815180451.840742115@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld [ Upstream commit c31b14d86dfe7174361e8c6e5df6c2c3a4d5918c ] In case push_rcu() and related functions are buggy, there's a WARN_ON(len >=3D 128), which the selftest tries to hit by being tricky. In case it is hit, we shouldn't corrupt the kernel's stack, though; otherwise it may be hard to even receive the report that it's buggy. So conditionalize the stack write based on that WARN_ON()'s return value. Note that this never *actually* happens anyway. The WARN_ON() in the first place is bounded by IS_ENABLED(DEBUG), and isn't expected to ever actually hit. This is just a debugging sanity check. Additionally, hoist the constant 128 into a named enum, MAX_ALLOWEDIPS_BITS, so that it's clear why this value is chosen. Suggested-by: Linus Torvalds Link: https://lore.kernel.org/all/CAHk-=3DwjJZGA6w_DxA+k7Ejbqsq+uGK=3D=3Dko= Pai3sqdsfJqemvag@mail.gmail.com/ Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") Signed-off-by: Jason A. Donenfeld Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireguard/allowedips.c | 9 ++++++--- drivers/net/wireguard/selftest/allowedips.c | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireguard/allowedips.c b/drivers/net/wireguard/all= owedips.c index 9a4c8ff32d9d..5bf7822c53f1 100644 --- a/drivers/net/wireguard/allowedips.c +++ b/drivers/net/wireguard/allowedips.c @@ -6,6 +6,8 @@ #include "allowedips.h" #include "peer.h" =20 +enum { MAX_ALLOWEDIPS_BITS =3D 128 }; + static struct kmem_cache *node_cache; =20 static void swap_endian(u8 *dst, const u8 *src, u8 bits) @@ -40,7 +42,8 @@ static void push_rcu(struct allowedips_node **stack, struct allowedips_node __rcu *p, unsigned int *len) { if (rcu_access_pointer(p)) { - WARN_ON(IS_ENABLED(DEBUG) && *len >=3D 128); + if (WARN_ON(IS_ENABLED(DEBUG) && *len >=3D MAX_ALLOWEDIPS_BITS)) + return; stack[(*len)++] =3D rcu_dereference_raw(p); } } @@ -52,7 +55,7 @@ static void node_free_rcu(struct rcu_head *rcu) =20 static void root_free_rcu(struct rcu_head *rcu) { - struct allowedips_node *node, *stack[128] =3D { + struct allowedips_node *node, *stack[MAX_ALLOWEDIPS_BITS] =3D { container_of(rcu, struct allowedips_node, rcu) }; unsigned int len =3D 1; =20 @@ -65,7 +68,7 @@ static void root_free_rcu(struct rcu_head *rcu) =20 static void root_remove_peer_lists(struct allowedips_node *root) { - struct allowedips_node *node, *stack[128] =3D { root }; + struct allowedips_node *node, *stack[MAX_ALLOWEDIPS_BITS] =3D { root }; unsigned int len =3D 1; =20 while (len > 0 && (node =3D stack[--len])) { diff --git a/drivers/net/wireguard/selftest/allowedips.c b/drivers/net/wire= guard/selftest/allowedips.c index e173204ae7d7..41db10f9be49 100644 --- a/drivers/net/wireguard/selftest/allowedips.c +++ b/drivers/net/wireguard/selftest/allowedips.c @@ -593,10 +593,10 @@ bool __init wg_allowedips_selftest(void) wg_allowedips_remove_by_peer(&t, a, &mutex); test_negative(4, a, 192, 168, 0, 1); =20 - /* These will hit the WARN_ON(len >=3D 128) in free_node if something - * goes wrong. + /* These will hit the WARN_ON(len >=3D MAX_ALLOWEDIPS_BITS) in free_node + * if something goes wrong. */ - for (i =3D 0; i < 128; ++i) { + for (i =3D 0; i < MAX_ALLOWEDIPS_BITS; ++i) { part =3D cpu_to_be64(~(1LLU << (i % 64))); memset(&ip, 0xff, 16); memcpy((u8 *)&ip + (i < 64) * 8, &part, 8); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03871C00140 for ; Mon, 15 Aug 2022 21:33:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348398AbiHOVdL (ORCPT ); Mon, 15 Aug 2022 17:33:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347612AbiHOV3M (ORCPT ); Mon, 15 Aug 2022 17:29:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A1F3EE4B1; Mon, 15 Aug 2022 12:23:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8F58760693; Mon, 15 Aug 2022 19:23:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A98FC433D6; Mon, 15 Aug 2022 19:23:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591436; bh=4eqoZxTaNTamgQoJfwYtkg7G/7ZFJzTqF8mExp98g1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aWZkQhs+XVtDoZ6G9kGJ9OZ7bfVe+ZLyZlioXQfDeXU1JdRGaoJel19Z+v3U3XWoR fWr5hZVa9CEnZvXh/jAxpCvlQltx6fk1LdSWQadCG+dH62nlHV4gVSMzwdzSHzOL71 daJB5exnRoc7UIzUzPlIDtlgwIx+g4eibgyGOZik= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Chang , Mario Limonciello , Basavaraj Natikar , Jiri Kosina , Sasha Levin Subject: [PATCH 5.18 0540/1095] HID: amd_sfh: Dont show client init failed as error when discovery fails Date: Mon, 15 Aug 2022 19:58:59 +0200 Message-Id: <20220815180451.887668980@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mario Limonciello [ Upstream commit e51d8d3ea3d773334d2c047c8d1623dba66f592a ] When sensor discovery fails, this means that the system doesn't have any sensors connected and a user should only be notified at most one time. A message is already displayed at WARN level of "failed to discover, sensors not enabled". It's pointless to show that the client init failed at ERR level for the same condition. Check the return code and don't display this message in those conditions. Fixes: b5d7f43e97da ("HID: amd_sfh: Add support for sensor discovery") Reported-by: David Chang Signed-off-by: Mario Limonciello Acked-by: Basavaraj Natikar Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-h= id/amd_sfh_pcie.c index e18a4efd8839..390298a6fc85 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c @@ -327,7 +327,8 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, cons= t struct pci_device_id *i rc =3D amd_sfh_hid_client_init(privdata); if (rc) { amd_sfh_clear_intr(privdata); - dev_err(&pdev->dev, "amd_sfh_hid_client_init failed\n"); + if (rc !=3D -EOPNOTSUPP) + dev_err(&pdev->dev, "amd_sfh_hid_client_init failed\n"); return rc; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05820C00140 for ; Mon, 15 Aug 2022 21:33:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348461AbiHOVdX (ORCPT ); Mon, 15 Aug 2022 17:33:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348341AbiHOVax (ORCPT ); Mon, 15 Aug 2022 17:30:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78511EEF1A; Mon, 15 Aug 2022 12:24:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AD1C761029; Mon, 15 Aug 2022 19:23:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D98DC433D6; Mon, 15 Aug 2022 19:23:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591439; bh=hVpoeMwUvpglwrk2FaC7xACVbQKklXD3rXGWF/M7v7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KEK+z9H4WBMpqsH4TjMsiJS6BuPTujO5OH50NJbwSXGbwBtOXj0omrzymoQE/CsCv nsOBu6Q9gssY0YkZLFOXOHIHCmDm/PpK3Dyjx9m3cGuVEpP/AH2bgAW1q6iWBkaJP+ 90KWYHH+9MzMVgUdtpc/PsRS9JI9WvPVvXzonJSs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ralph Siemsen , Phil Edworthy , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.18 0541/1095] clk: renesas: r9a06g032: Fix UART clkgrp bitsel Date: Mon, 15 Aug 2022 19:59:00 +0200 Message-Id: <20220815180451.920275250@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ralph Siemsen [ Upstream commit 2dee50ab9e72a3cae75b65e5934c8dd3e9bf01bc ] There are two UART clock groups, each having a mux to select its upstream clock source. The register/bit definitions for accessing these two muxes appear to have been reversed since introduction. Correct them so as to match the hardware manual. Fixes: 4c3d88526eba ("clk: renesas: Renesas R9A06G032 clock driver") Signed-off-by: Ralph Siemsen Reviewed-by: Phil Edworthy Link: https://lore.kernel.org/r/20220518182527.1693156-1-ralph.siemsen@lina= ro.org Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/renesas/r9a06g032-clocks.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r= 9a06g032-clocks.c index c99942f0e4d4..abc0891fd96d 100644 --- a/drivers/clk/renesas/r9a06g032-clocks.c +++ b/drivers/clk/renesas/r9a06g032-clocks.c @@ -286,8 +286,8 @@ static const struct r9a06g032_clkdesc r9a06g032_clocks[= ] =3D { .name =3D "uart_group_012", .type =3D K_BITSEL, .source =3D 1 + R9A06G032_DIV_UART, - /* R9A06G032_SYSCTRL_REG_PWRCTRL_PG1_PR2 */ - .dual.sel =3D ((0xec / 4) << 5) | 24, + /* R9A06G032_SYSCTRL_REG_PWRCTRL_PG0_0 */ + .dual.sel =3D ((0x34 / 4) << 5) | 30, .dual.group =3D 0, }, { @@ -295,8 +295,8 @@ static const struct r9a06g032_clkdesc r9a06g032_clocks[= ] =3D { .name =3D "uart_group_34567", .type =3D K_BITSEL, .source =3D 1 + R9A06G032_DIV_P2_PG, - /* R9A06G032_SYSCTRL_REG_PWRCTRL_PG0_0 */ - .dual.sel =3D ((0x34 / 4) << 5) | 30, + /* R9A06G032_SYSCTRL_REG_PWRCTRL_PG1_PR2 */ + .dual.sel =3D ((0xec / 4) << 5) | 24, .dual.group =3D 1, }, D_UGATE(CLK_UART0, "clk_uart0", UART_GROUP_012, 0, 0, 0x1b2, 0x1b3, 0x1b4= , 0x1b5), --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE531C00140 for ; Mon, 15 Aug 2022 21:33:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348439AbiHOVdO (ORCPT ); Mon, 15 Aug 2022 17:33:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348208AbiHOVaN (ORCPT ); Mon, 15 Aug 2022 17:30:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A9B1EF9C7; Mon, 15 Aug 2022 12:24:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F3CE2B810C6; Mon, 15 Aug 2022 19:24:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0C30C433C1; Mon, 15 Aug 2022 19:24:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591442; bh=dUu8ueBkoD9WU0J+cgsPNoGbfDPcl41stYx5RPPV8tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bfvbuk/OhCHLRuVwV07yzWtLeCHfJZS3TfIgbdKhh3SgZCPN96f/rxcBqo+Uv0s3S s7k0PPcNJxmnjAXeq8FobRCqPrqOLk9FTPVmTKqvVDzExZOuvTNyimA9wKk0OwULft vrxZUbnOxSS63OYLiAGEL7hlBYr7SXTgWV4u6urU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Linus Walleij , Miquel Raynal , Sasha Levin Subject: [PATCH 5.18 0542/1095] mtd: maps: Fix refcount leak in of_flash_probe_versatile Date: Mon, 15 Aug 2022 19:59:01 +0200 Message-Id: <20220815180451.967171685@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 33ec82a6d2b119938f26e5c8040ed5d92378eb54 ] of_find_matching_node_and_match() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: b0afd44bc192 ("mtd: physmap_of: add a hook for Versatile write prote= ction") Signed-off-by: Miaoqian Lin Reviewed-by: Linus Walleij Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220523140205.48625-1-linmq006@gma= il.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mtd/maps/physmap-versatile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/maps/physmap-versatile.c b/drivers/mtd/maps/physma= p-versatile.c index ad7cd9cfaee0..297a50957356 100644 --- a/drivers/mtd/maps/physmap-versatile.c +++ b/drivers/mtd/maps/physmap-versatile.c @@ -207,6 +207,7 @@ int of_flash_probe_versatile(struct platform_device *pd= ev, =20 versatile_flashprot =3D (enum versatile_flashprot)devid->data; rmap =3D syscon_node_to_regmap(sysnp); + of_node_put(sysnp); if (IS_ERR(rmap)) return PTR_ERR(rmap); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E695CC00140 for ; Mon, 15 Aug 2022 21:33:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348480AbiHOVd2 (ORCPT ); Mon, 15 Aug 2022 17:33:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348506AbiHOVb1 (ORCPT ); Mon, 15 Aug 2022 17:31:27 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DD82EF9DD; Mon, 15 Aug 2022 12:24:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 81E3FCE12C8; Mon, 15 Aug 2022 19:24:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CEDAC433D6; Mon, 15 Aug 2022 19:24:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591445; bh=Y2YVxMxFUYn+u8NnVUBKFgPVl4Mn/bDpZE1Y3UP0Zr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lFmQYvQ2/0KZDe3ipzLp7ilm6R68WObnrpeYYh1GPtGamiUtL/UCcT3ZroelDCjHw /WyMvdRVcru9qJCjHwfFLtcrTiag1NZ2URSoJMt+S3WyXYB+lqUrYpAw6D6XF6+pVt +oxkcwhcs6QqhCRCiY6j6puDNFKZqPfYTtoxrj4I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Linus Walleij , Miquel Raynal , Sasha Levin Subject: [PATCH 5.18 0543/1095] mtd: maps: Fix refcount leak in ap_flash_init Date: Mon, 15 Aug 2022 19:59:02 +0200 Message-Id: <20220815180452.002892916@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 77087a04c8fd554134bddcb8a9ff87b21f357926 ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: b0afd44bc192 ("mtd: physmap_of: add a hook for Versatile write prote= ction") Signed-off-by: Miaoqian Lin Reviewed-by: Linus Walleij Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220523143255.4376-1-linmq006@gmai= l.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mtd/maps/physmap-versatile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/maps/physmap-versatile.c b/drivers/mtd/maps/physma= p-versatile.c index 297a50957356..a1b8b7b25f88 100644 --- a/drivers/mtd/maps/physmap-versatile.c +++ b/drivers/mtd/maps/physmap-versatile.c @@ -93,6 +93,7 @@ static int ap_flash_init(struct platform_device *pdev) return -ENODEV; } ebi_base =3D of_iomap(ebi, 0); + of_node_put(ebi); if (!ebi_base) return -ENODEV; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCBB3C00140 for ; Mon, 15 Aug 2022 21:28:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345304AbiHOV2Y (ORCPT ); Mon, 15 Aug 2022 17:28:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243679AbiHOVTw (ORCPT ); Mon, 15 Aug 2022 17:19:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1996DE3C3F; Mon, 15 Aug 2022 12:22:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E8A79B81062; Mon, 15 Aug 2022 19:22:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35B05C433D6; Mon, 15 Aug 2022 19:22:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591324; bh=JDV9LBwF5joWK8HGi4wBwjEykNxNVY96ePmNBMJjcug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wg+yhhq2w4AKqu+K+Kh242wNg6Hc9jhmoTY0azcSb3kTGh9qE+SvEudj2PJ/gE4Ks aiYelVkGMeI3QRzv4LZlMcA16ZuFa/SrHdcCrLf4ILXkdfDOSjlwiHbLQ8Mx2/DKs9 JsePeO4C8aMxPZQHfekuFConOHQg3B2K0w4KuwsM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Liang Yang , Miquel Raynal , Sasha Levin Subject: [PATCH 5.18 0544/1095] mtd: rawnand: meson: Fix a potential double free issue Date: Mon, 15 Aug 2022 19:59:03 +0200 Message-Id: <20220815180452.050529873@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit ec0da06337751b18f6dee06b6526e0f0d6e80369 ] When meson_nfc_nand_chip_cleanup() is called, it will call: meson_nfc_free_buffer(&meson_chip->nand); nand_cleanup(&meson_chip->nand); nand_cleanup() in turn will call nand_detach() which calls the .detach_chip() which is here meson_nand_detach_chip(). meson_nand_detach_chip() already calls meson_nfc_free_buffer(), so we could double free some memory. Fix it by removing the unneeded explicit call to meson_nfc_free_buffer(). Fixes: 8fae856c5350 ("mtd: rawnand: meson: add support for Amlogic NAND fla= sh controller") Signed-off-by: Christophe JAILLET Acked-by: Liang Yang Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/ec15c358b8063f7c50ff4cd628cf0d2e14e= 43f49.1653064877.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mtd/nand/raw/meson_nand.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson= _nand.c index ac3be92872d0..032180183339 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -1307,7 +1307,6 @@ static int meson_nfc_nand_chip_cleanup(struct meson_n= fc *nfc) if (ret) return ret; =20 - meson_nfc_free_buffer(&meson_chip->nand); nand_cleanup(&meson_chip->nand); list_del(&meson_chip->node); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE9B7C282E7 for ; Mon, 15 Aug 2022 21:28:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346905AbiHOV2s (ORCPT ); Mon, 15 Aug 2022 17:28:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244917AbiHOVU3 (ORCPT ); Mon, 15 Aug 2022 17:20:29 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DBE0E42E5; Mon, 15 Aug 2022 12:22:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 616DCCE12C4; Mon, 15 Aug 2022 19:22:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AF1CC433D6; Mon, 15 Aug 2022 19:22:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591327; bh=HrKKffI5O2JNEYG9R4zavF2S4ypNCV02Z8F8Qh6fPuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D07ijHMnnmnej9RY2GaXxhqqLZS6ArYTy7t6/ocX74I7+RnwUb6vw313b1oI/8DMd 8WJX9J9MFqQKl1oiMTwykk7jBmL0oG9OfvBZ3V9KCHmEzin0GyCk36xrZDl6ZsI4KY 5iMOhe9iT0/gjPUmxDPGzxpXUDc+1B95pWpeS6Dc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biju Das , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.18 0545/1095] clk: renesas: rzg2l: Fix reset status function Date: Mon, 15 Aug 2022 19:59:04 +0200 Message-Id: <20220815180452.097609847@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Biju Das [ Upstream commit 02c96ed9e4cd1f47bfcd10296fec6b0b69d6b3c6 ] As per RZ/G2L HW(Rev.1.10) manual, reset monitor register value 0 means reset signal is not applied (deassert state) and 1 means reset signal is applied (assert state). reset_control_status() expects a positive value if the reset line is asserted. But rzg2l_cpg_status function returns zero for asserted state. This patch fixes the issue by adding double inverted logic, so that reset_control_status returns a positive value if the reset line is asserted. Fixes: ef3c613ccd68 ("clk: renesas: Add CPG core wrapper for RZ/G2L SoC") Signed-off-by: Biju Das Link: https://lore.kernel.org/r/20220531071657.104121-1-biju.das.jz@bp.rene= sas.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/renesas/rzg2l-cpg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cp= g.c index 486d0656c58a..1068058a3865 100644 --- a/drivers/clk/renesas/rzg2l-cpg.c +++ b/drivers/clk/renesas/rzg2l-cpg.c @@ -744,7 +744,7 @@ static int rzg2l_cpg_status(struct reset_controller_dev= *rcdev, unsigned int reg =3D info->resets[id].off; u32 bitmask =3D BIT(info->resets[id].bit); =20 - return !(readl(priv->base + CLK_MRST_R(reg)) & bitmask); + return !!(readl(priv->base + CLK_MRST_R(reg)) & bitmask); } =20 static const struct reset_control_ops rzg2l_cpg_reset_ops =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8BBAC3F6B0 for ; Mon, 15 Aug 2022 21:28:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346429AbiHOV2e (ORCPT ); Mon, 15 Aug 2022 17:28:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244967AbiHOVUa (ORCPT ); Mon, 15 Aug 2022 17:20:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DD6EE42E7; Mon, 15 Aug 2022 12:22:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 632CA60EF0; Mon, 15 Aug 2022 19:22:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18E4CC433D6; Mon, 15 Aug 2022 19:22:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591330; bh=COkNRrEX6w4UbdnjU7Ri0CSOfhCU3mGHHhJ6+4yGcDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Il49eU3aS3PL4347rvBqoAxpWTpg5pBbupvVA+Jgw5eMBRktSiUkVVDnc6zl1eiDT hV530UGeH/bUHRuVa9oZwvLv93kP4kWa0cIlaPSMMRzcP3S+HDui0wm1oXUOUBGu7i tqg6MhjmI/e+au+yveuXs9Md2HG8ZaTTq7Qzs2CU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frank Rowand , Prakhar Srivastava , Lakshmi Ramasubramanian , Thiago Jung Bauermann , Rob Herring , Ritesh Harjani , Robin Murphy , Vaibhav Jain , Sasha Levin Subject: [PATCH 5.18 0546/1095] of: check previous kernels ima-kexec-buffer against memory bounds Date: Mon, 15 Aug 2022 19:59:05 +0200 Message-Id: <20220815180452.139243461@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vaibhav Jain [ Upstream commit cbf9c4b9617b6767886a913705ca14b7600c77db ] Presently ima_get_kexec_buffer() doesn't check if the previous kernel's ima-kexec-buffer lies outside the addressable memory range. This can result in a kernel panic if the new kernel is booted with 'mem=3DX' arg and the ima-kexec-buffer was allocated beyond that range by the previous kernel. The panic is usually of the form below: $ sudo kexec --initrd initrd vmlinux --append=3D'mem=3D16G' BUG: Unable to handle kernel data access on read at 0xc000c01fff7f0000 Faulting instruction address: 0xc000000000837974 Oops: Kernel access of bad area, sig: 11 [#1] NIP [c000000000837974] ima_restore_measurement_list+0x94/0x6c0 LR [c00000000083b55c] ima_load_kexec_buffer+0xac/0x160 Call Trace: [c00000000371fa80] [c00000000083b55c] ima_load_kexec_buffer+0xac/0x160 [c00000000371fb00] [c0000000020512c4] ima_init+0x80/0x108 [c00000000371fb70] [c0000000020514dc] init_ima+0x4c/0x120 [c00000000371fbf0] [c000000000012240] do_one_initcall+0x60/0x2c0 [c00000000371fcc0] [c000000002004ad0] kernel_init_freeable+0x344/0x3ec [c00000000371fda0] [c0000000000128a4] kernel_init+0x34/0x1b0 [c00000000371fe10] [c00000000000ce64] ret_from_kernel_thread+0x5c/0x64 Instruction dump: f92100b8 f92100c0 90e10090 910100a0 4182050c 282a0017 3bc00000 40810330 7c0802a6 fb610198 7c9b2378 f80101d0 2c090001 40820614 e9240010 ---[ end trace 0000000000000000 ]--- Fix this issue by checking returned PFN range of previous kernel's ima-kexec-buffer with page_is_ram() to ensure correct memory bounds. Fixes: 467d27824920 ("powerpc: ima: get the kexec buffer passed by the prev= ious kernel") Cc: Frank Rowand Cc: Prakhar Srivastava Cc: Lakshmi Ramasubramanian Cc: Thiago Jung Bauermann Cc: Rob Herring Cc: Ritesh Harjani Cc: Robin Murphy Signed-off-by: Vaibhav Jain Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20220531041446.3334259-1-vaibhav@linux.ibm.= com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/of/kexec.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c index 8d374cc552be..91b04b04eec4 100644 --- a/drivers/of/kexec.c +++ b/drivers/of/kexec.c @@ -126,6 +126,7 @@ int ima_get_kexec_buffer(void **addr, size_t *size) { int ret, len; unsigned long tmp_addr; + unsigned long start_pfn, end_pfn; size_t tmp_size; const void *prop; =20 @@ -140,6 +141,22 @@ int ima_get_kexec_buffer(void **addr, size_t *size) if (ret) return ret; =20 + /* Do some sanity on the returned size for the ima-kexec buffer */ + if (!tmp_size) + return -ENOENT; + + /* + * Calculate the PFNs for the buffer and ensure + * they are with in addressable memory. + */ + start_pfn =3D PHYS_PFN(tmp_addr); + end_pfn =3D PHYS_PFN(tmp_addr + tmp_size - 1); + if (!page_is_ram(start_pfn) || !page_is_ram(end_pfn)) { + pr_warn("IMA buffer at 0x%lx, size =3D 0x%zx beyond memory\n", + tmp_addr, tmp_size); + return -EINVAL; + } + *addr =3D __va(tmp_addr); *size =3D tmp_size; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2347C25B08 for ; Mon, 15 Aug 2022 21:28:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346995AbiHOV25 (ORCPT ); Mon, 15 Aug 2022 17:28:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245098AbiHOVUe (ORCPT ); Mon, 15 Aug 2022 17:20:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA513E588B; Mon, 15 Aug 2022 12:22:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BCA0D60BB7; Mon, 15 Aug 2022 19:22:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75C49C433C1; Mon, 15 Aug 2022 19:22:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591334; bh=X8rFAxY+1PXy9Zrxo9sXm4SKMV2fUnYTBhpKiaevkaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d1aUcKivYOmCF/VS8Mbd+TMmRcIxv9owOUVr74mA3zDDGgzfjb5+p6f0naDLP3zeq QbloJrmnlPlOlJ14WtP/9qmegVvBAAgU96e0lWcLVmT12HGIuNjz5EjElVDOZNb2lo O6WG9x3jJB12vxjYsR955NKcZgbiPNm39bc5ohO8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0547/1095] scsi: qla2xxx: edif: Reduce Initiator-Initiator thrashing Date: Mon, 15 Aug 2022 19:59:06 +0200 Message-Id: <20220815180452.181731637@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 9c40c36e75ffd49952cd4ead0672defc4b4dbdf7 ] This patch uses GFFID switch command to scan whether remote device is Target or Initiator mode. Based on that info, driver will not pass up Initiator info to authentication application. This helps reduce unnecessary stress for authentication application to deal with unused connections. Link: https://lore.kernel.org/r/20220607044627.19563-2-njavali@marvell.com Fixes: 7ebb336e45ef ("scsi: qla2xxx: edif: Add start + stop bsgs") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_def.h | 2 + drivers/scsi/qla2xxx/qla_edif.c | 32 ++++++++- drivers/scsi/qla2xxx/qla_gbl.h | 3 +- drivers/scsi/qla2xxx/qla_gs.c | 118 +++++++++++++++++++++++--------- drivers/scsi/qla2xxx/qla_iocb.c | 2 +- 5 files changed, 120 insertions(+), 37 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index f25a131fb07e..5f22276927dd 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3204,6 +3204,8 @@ struct ct_sns_rsp { #define GFF_NVME_OFFSET 23 /* type =3D 28h */ struct { uint8_t fc4_features[128]; +#define FC4_FF_TARGET BIT_0 +#define FC4_FF_INITIATOR BIT_1 } gff_id; struct { uint8_t reserved; diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index 0628633c7c7e..30ca56f8e4c8 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -517,16 +517,28 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_j= ob *bsg_job) if (atomic_read(&vha->loop_state) =3D=3D LOOP_DOWN) break; =20 - fcport->edif.app_started =3D 1; fcport->login_retry =3D vha->hw->login_retry_count; =20 - /* no activity */ fcport->edif.app_stop =3D 0; + fcport->edif.app_sess_online =3D 0; + fcport->edif.app_started =3D 1; + + if (fcport->scan_state !=3D QLA_FCPORT_FOUND) + continue; + + if (fcport->port_type =3D=3D FCT_UNKNOWN && + !fcport->fc4_features) + rval =3D qla24xx_async_gffid(vha, fcport, true); + + if (!rval && !(fcport->fc4_features & FC4_FF_TARGET || + fcport->port_type & (FCT_TARGET|FCT_NVME_TARGET))) + continue; + + rval =3D 0; =20 ql_dbg(ql_dbg_edif, vha, 0x911e, "%s wwpn %8phC calling qla_edif_reset_auth_wait\n", __func__, fcport->port_name); - fcport->edif.app_sess_online =3D 0; qlt_schedule_sess_for_deletion(fcport); qla_edif_sa_ctl_init(vha, fcport); } @@ -884,6 +896,20 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bs= g_job *bsg_job) app_reply->ports[pcnt].rekey_count =3D fcport->edif.rekey_cnt; =20 + if (fcport->scan_state !=3D QLA_FCPORT_FOUND) + continue; + + if (fcport->port_type =3D=3D FCT_UNKNOWN && !fcport->fc4_features) + rval =3D qla24xx_async_gffid(vha, fcport, true); + + if (!rval && + !(fcport->fc4_features & FC4_FF_TARGET || + fcport->port_type & + (FCT_TARGET | FCT_NVME_TARGET))) + continue; + + rval =3D 0; + app_reply->ports[pcnt].remote_type =3D VND_CMD_RTYPE_UNKNOWN; if (fcport->port_type & (FCT_NVME_TARGET | FCT_TARGET)) diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index dac27b5ff0ac..84b44454c231 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -335,6 +335,7 @@ extern int qla24xx_configure_prot_mode(srb_t *, uint16_= t *); extern int qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e); void qla2x00_sp_release(struct kref *kref); +void qla2x00_els_dcmd2_iocb_timeout(void *data); =20 /* * Global Function Prototypes in qla_mbx.c source file. @@ -727,7 +728,7 @@ int qla24xx_async_gpsc(scsi_qla_host_t *, fc_port_t *); void qla24xx_handle_gpsc_event(scsi_qla_host_t *, struct event_arg *); int qla2x00_mgmt_svr_login(scsi_qla_host_t *); void qla24xx_handle_gffid_event(scsi_qla_host_t *vha, struct event_arg *ea= ); -int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport); +int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport, bool); int qla24xx_async_gpnft(scsi_qla_host_t *, u8, srb_t *); void qla24xx_async_gpnft_done(scsi_qla_host_t *, srb_t *); void qla24xx_async_gnnft_done(scsi_qla_host_t *, srb_t *); diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index f8005ce65082..574251b2e0ef 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3277,19 +3277,12 @@ int qla24xx_async_gpnid(scsi_qla_host_t *vha, port_= id_t *id) return rval; } =20 -void qla24xx_handle_gffid_event(scsi_qla_host_t *vha, struct event_arg *ea) -{ - fc_port_t *fcport =3D ea->fcport; - - qla24xx_post_gnl_work(vha, fcport); -} =20 void qla24xx_async_gffid_sp_done(srb_t *sp, int res) { struct scsi_qla_host *vha =3D sp->vha; fc_port_t *fcport =3D sp->fcport; struct ct_sns_rsp *ct_rsp; - struct event_arg ea; uint8_t fc4_scsi_feat; uint8_t fc4_nvme_feat; =20 @@ -3297,10 +3290,10 @@ void qla24xx_async_gffid_sp_done(srb_t *sp, int res) "Async done-%s res %x ID %x. %8phC\n", sp->name, res, fcport->d_id.b24, fcport->port_name); =20 - fcport->flags &=3D ~FCF_ASYNC_SENT; - ct_rsp =3D &fcport->ct_desc.ct_sns->p.rsp; + ct_rsp =3D sp->u.iocb_cmd.u.ctarg.rsp; fc4_scsi_feat =3D ct_rsp->rsp.gff_id.fc4_features[GFF_FCP_SCSI_OFFSET]; fc4_nvme_feat =3D ct_rsp->rsp.gff_id.fc4_features[GFF_NVME_OFFSET]; + sp->rc =3D res; =20 /* * FC-GS-7, 5.2.3.12 FC-4 Features - format @@ -3321,24 +3314,42 @@ void qla24xx_async_gffid_sp_done(srb_t *sp, int res) } } =20 - memset(&ea, 0, sizeof(ea)); - ea.sp =3D sp; - ea.fcport =3D sp->fcport; - ea.rc =3D res; + if (sp->flags & SRB_WAKEUP_ON_COMP) { + complete(sp->comp); + } else { + if (sp->u.iocb_cmd.u.ctarg.req) { + dma_free_coherent(&vha->hw->pdev->dev, + sp->u.iocb_cmd.u.ctarg.req_allocated_size, + sp->u.iocb_cmd.u.ctarg.req, + sp->u.iocb_cmd.u.ctarg.req_dma); + sp->u.iocb_cmd.u.ctarg.req =3D NULL; + } =20 - qla24xx_handle_gffid_event(vha, &ea); - /* ref: INIT */ - kref_put(&sp->cmd_kref, qla2x00_sp_release); + if (sp->u.iocb_cmd.u.ctarg.rsp) { + dma_free_coherent(&vha->hw->pdev->dev, + sp->u.iocb_cmd.u.ctarg.rsp_allocated_size, + sp->u.iocb_cmd.u.ctarg.rsp, + sp->u.iocb_cmd.u.ctarg.rsp_dma); + sp->u.iocb_cmd.u.ctarg.rsp =3D NULL; + } + + /* ref: INIT */ + kref_put(&sp->cmd_kref, qla2x00_sp_release); + /* we should not be here */ + dump_stack(); + } } =20 /* Get FC4 Feature with Nport ID. */ -int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport) +int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport, bool wait) { int rval =3D QLA_FUNCTION_FAILED; struct ct_sns_req *ct_req; srb_t *sp; + DECLARE_COMPLETION_ONSTACK(comp); =20 - if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) + /* this routine does not have handling for no wait */ + if (!vha->flags.online || !wait) return rval; =20 /* ref: INIT */ @@ -3346,43 +3357,86 @@ int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_po= rt_t *fcport) if (!sp) return rval; =20 - fcport->flags |=3D FCF_ASYNC_SENT; sp->type =3D SRB_CT_PTHRU_CMD; sp->name =3D "gffid"; sp->gen1 =3D fcport->rscn_gen; sp->gen2 =3D fcport->login_gen; qla2x00_init_async_sp(sp, qla2x00_get_async_timeout(vha) + 2, qla24xx_async_gffid_sp_done); + sp->comp =3D ∁ + sp->u.iocb_cmd.timeout =3D qla2x00_els_dcmd2_iocb_timeout; + + if (wait) + sp->flags =3D SRB_WAKEUP_ON_COMP; + + sp->u.iocb_cmd.u.ctarg.req_allocated_size =3D sizeof(struct ct_sns_pkt); + sp->u.iocb_cmd.u.ctarg.req =3D dma_alloc_coherent(&vha->hw->pdev->dev, + sp->u.iocb_cmd.u.ctarg.req_allocated_size, + &sp->u.iocb_cmd.u.ctarg.req_dma, + GFP_KERNEL); + if (!sp->u.iocb_cmd.u.ctarg.req) { + ql_log(ql_log_warn, vha, 0xd041, + "%s: Failed to allocate ct_sns request.\n", + __func__); + goto done_free_sp; + } + + sp->u.iocb_cmd.u.ctarg.rsp_allocated_size =3D sizeof(struct ct_sns_pkt); + sp->u.iocb_cmd.u.ctarg.rsp =3D dma_alloc_coherent(&vha->hw->pdev->dev, + sp->u.iocb_cmd.u.ctarg.rsp_allocated_size, + &sp->u.iocb_cmd.u.ctarg.rsp_dma, + GFP_KERNEL); + if (!sp->u.iocb_cmd.u.ctarg.req) { + ql_log(ql_log_warn, vha, 0xd041, + "%s: Failed to allocate ct_sns request.\n", + __func__); + goto done_free_sp; + } =20 /* CT_IU preamble */ - ct_req =3D qla2x00_prep_ct_req(fcport->ct_desc.ct_sns, GFF_ID_CMD, - GFF_ID_RSP_SIZE); + ct_req =3D qla2x00_prep_ct_req(sp->u.iocb_cmd.u.ctarg.req, GFF_ID_CMD, GF= F_ID_RSP_SIZE); =20 ct_req->req.gff_id.port_id[0] =3D fcport->d_id.b.domain; ct_req->req.gff_id.port_id[1] =3D fcport->d_id.b.area; ct_req->req.gff_id.port_id[2] =3D fcport->d_id.b.al_pa; =20 - sp->u.iocb_cmd.u.ctarg.req =3D fcport->ct_desc.ct_sns; - sp->u.iocb_cmd.u.ctarg.req_dma =3D fcport->ct_desc.ct_sns_dma; - sp->u.iocb_cmd.u.ctarg.rsp =3D fcport->ct_desc.ct_sns; - sp->u.iocb_cmd.u.ctarg.rsp_dma =3D fcport->ct_desc.ct_sns_dma; sp->u.iocb_cmd.u.ctarg.req_size =3D GFF_ID_REQ_SIZE; sp->u.iocb_cmd.u.ctarg.rsp_size =3D GFF_ID_RSP_SIZE; sp->u.iocb_cmd.u.ctarg.nport_handle =3D NPH_SNS; =20 - ql_dbg(ql_dbg_disc, vha, 0x2132, - "Async-%s hdl=3D%x %8phC.\n", sp->name, - sp->handle, fcport->port_name); - rval =3D qla2x00_start_sp(sp); - if (rval !=3D QLA_SUCCESS) + + if (rval !=3D QLA_SUCCESS) { + rval =3D QLA_FUNCTION_FAILED; goto done_free_sp; + } else { + ql_dbg(ql_dbg_disc, vha, 0x3074, + "Async-%s hdl=3D%x portid %06x\n", + sp->name, sp->handle, fcport->d_id.b24); + } + + wait_for_completion(sp->comp); + rval =3D sp->rc; =20 - return rval; done_free_sp: + if (sp->u.iocb_cmd.u.ctarg.req) { + dma_free_coherent(&vha->hw->pdev->dev, + sp->u.iocb_cmd.u.ctarg.req_allocated_size, + sp->u.iocb_cmd.u.ctarg.req, + sp->u.iocb_cmd.u.ctarg.req_dma); + sp->u.iocb_cmd.u.ctarg.req =3D NULL; + } + + if (sp->u.iocb_cmd.u.ctarg.rsp) { + dma_free_coherent(&vha->hw->pdev->dev, + sp->u.iocb_cmd.u.ctarg.rsp_allocated_size, + sp->u.iocb_cmd.u.ctarg.rsp, + sp->u.iocb_cmd.u.ctarg.rsp_dma); + sp->u.iocb_cmd.u.ctarg.rsp =3D NULL; + } + /* ref: INIT */ kref_put(&sp->cmd_kref, qla2x00_sp_release); - fcport->flags &=3D ~FCF_ASYNC_SENT; return rval; } =20 diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_ioc= b.c index e0fe9ddb4bd2..46c879923da1 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2819,7 +2819,7 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24x= x *els_iocb) sp->vha->qla_stats.control_requests++; } =20 -static void +void qla2x00_els_dcmd2_iocb_timeout(void *data) { srb_t *sp =3D data; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 949A9C00140 for ; Mon, 15 Aug 2022 21:29:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347482AbiHOV3I (ORCPT ); Mon, 15 Aug 2022 17:29:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344515AbiHOVXm (ORCPT ); Mon, 15 Aug 2022 17:23:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53724E68C3; Mon, 15 Aug 2022 12:22:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A75CAB81109; Mon, 15 Aug 2022 19:22:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD345C433C1; Mon, 15 Aug 2022 19:22:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591337; bh=BKIxRizxJYC3fDwWJHTwZ9YRG2rgV2o83TGACtjwAlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=how/FFPkvFvRSeLjc97CwdY57FSYVsIEBFhGXrDvQTRQUqLqp/NHMCLqhBUxz9ntS ZHF4LiP2vkVcdeugEqu20o+YPs+AemyFIl816qu32ycvC5rhOEqBpDs2p3flM8d0b8 x7MSEscMM6GHOsHgMO3NqIaDTBqxvJrd/hijyOGU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0548/1095] scsi: qla2xxx: edif: bsg refactor Date: Mon, 15 Aug 2022 19:59:07 +0200 Message-Id: <20220815180452.215450188@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 7a7b0b4865d3490f62d6ef1a3aa39fa2b47859a4 ] - Add version field to edif bsg for future enhancement. - Add version edif bsg version check - Remove unused interfaces and fields. Link: https://lore.kernel.org/r/20220607044627.19563-3-njavali@marvell.com Fixes: dd30706e73b7 ("scsi: qla2xxx: edif: Add key update") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 32 +++++++--- drivers/scsi/qla2xxx/qla_edif_bsg.h | 90 ++++++++++++++++++----------- 2 files changed, 79 insertions(+), 43 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index 30ca56f8e4c8..0978551f85f5 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -280,14 +280,19 @@ qla_edif_app_check(scsi_qla_host_t *vha, struct app_i= d appid) { /* check that the app is allow/known to the driver */ =20 - if (appid.app_vid =3D=3D EDIF_APP_ID) { - ql_dbg(ql_dbg_edif + ql_dbg_verbose, vha, 0x911d, "%s app id ok\n", __fu= nc__); - return true; + if (appid.app_vid !=3D EDIF_APP_ID) { + ql_dbg(ql_dbg_edif, vha, 0x911d, "%s app id not ok (%x)", + __func__, appid.app_vid); + return false; + } + + if (appid.version !=3D EDIF_VERSION1) { + ql_dbg(ql_dbg_edif, vha, 0x911d, "%s app version is not ok (%x)", + __func__, appid.version); + return false; } - ql_dbg(ql_dbg_edif, vha, 0x911d, "%s app id not ok (%x)", - __func__, appid.app_vid); =20 - return false; + return true; } =20 static void @@ -555,6 +560,7 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job= *bsg_job) appreply.host_support_edif =3D vha->hw->flags.edif_enabled; appreply.edif_enode_active =3D vha->pur_cinfo.enode_flags; appreply.edif_edb_active =3D vha->e_dbell.db_flags; + appreply.version =3D EDIF_VERSION1; =20 bsg_job->reply_len =3D sizeof(struct fc_bsg_reply); =20 @@ -685,6 +691,7 @@ qla_edif_app_authok(scsi_qla_host_t *vha, struct bsg_jo= b *bsg_job) portid.b.area =3D appplogiok.u.d_id.b.area; portid.b.al_pa =3D appplogiok.u.d_id.b.al_pa; =20 + appplogireply.version =3D EDIF_VERSION1; switch (appplogiok.type) { case PL_TYPE_WWPN: fcport =3D qla2x00_find_fcport_by_wwpn(vha, @@ -877,6 +884,8 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bsg= _job *bsg_job) } else { struct fc_port *fcport =3D NULL, *tf; =20 + app_reply->version =3D EDIF_VERSION1; + list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) { if (!(fcport->flags & FCF_FCSP_DEVICE)) continue; @@ -893,9 +902,6 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bsg= _job *bsg_job) if (tdid.b24 !=3D 0 && tdid.b24 !=3D fcport->d_id.b24) continue; =20 - app_reply->ports[pcnt].rekey_count =3D - fcport->edif.rekey_cnt; - if (fcport->scan_state !=3D QLA_FCPORT_FOUND) continue; =20 @@ -910,6 +916,7 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bsg= _job *bsg_job) =20 rval =3D 0; =20 + app_reply->ports[pcnt].version =3D EDIF_VERSION1; app_reply->ports[pcnt].remote_type =3D VND_CMD_RTYPE_UNKNOWN; if (fcport->port_type & (FCT_NVME_TARGET | FCT_TARGET)) @@ -1006,6 +1013,8 @@ qla_edif_app_getstats(scsi_qla_host_t *vha, struct bs= g_job *bsg_job) } else { struct fc_port *fcport =3D NULL, *tf; =20 + app_reply->version =3D EDIF_VERSION1; + list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) { if (fcport->edif.enable) { if (pcnt > app_req.num_ports) @@ -2037,6 +2046,7 @@ qla_edb_eventcreate(scsi_qla_host_t *vha, uint32_t db= type, edbnode->u.sa_aen.port_id =3D fcport->d_id; edbnode->u.sa_aen.status =3D data; edbnode->u.sa_aen.key_type =3D data2; + edbnode->u.sa_aen.version =3D EDIF_VERSION1; break; default: ql_dbg(ql_dbg_edif, vha, 0x09102, @@ -3380,6 +3390,10 @@ int qla_edif_process_els(scsi_qla_host_t *vha, struc= t bsg_job *bsg_job) port_id_t d_id; struct qla_bsg_auth_els_request *p =3D (struct qla_bsg_auth_els_request *)bsg_job->request; + struct qla_bsg_auth_els_reply *rpl =3D + (struct qla_bsg_auth_els_reply *)bsg_job->reply; + + rpl->version =3D EDIF_VERSION1; =20 d_id.b.al_pa =3D bsg_request->rqst_data.h_els.port_id[2]; d_id.b.area =3D bsg_request->rqst_data.h_els.port_id[1]; diff --git a/drivers/scsi/qla2xxx/qla_edif_bsg.h b/drivers/scsi/qla2xxx/qla= _edif_bsg.h index 5a26c77157da..301523e4f483 100644 --- a/drivers/scsi/qla2xxx/qla_edif_bsg.h +++ b/drivers/scsi/qla2xxx/qla_edif_bsg.h @@ -7,13 +7,15 @@ #ifndef __QLA_EDIF_BSG_H #define __QLA_EDIF_BSG_H =20 +#define EDIF_VERSION1 1 + /* BSG Vendor specific commands */ #define ELS_MAX_PAYLOAD 2112 #ifndef WWN_SIZE #define WWN_SIZE 8 #endif -#define VND_CMD_APP_RESERVED_SIZE 32 - +#define VND_CMD_APP_RESERVED_SIZE 28 +#define VND_CMD_PAD_SIZE 3 enum auth_els_sub_cmd { SEND_ELS =3D 0, SEND_ELS_REPLY, @@ -28,7 +30,9 @@ struct extra_auth_els { #define BSG_CTL_FLAG_LS_ACC 1 #define BSG_CTL_FLAG_LS_RJT 2 #define BSG_CTL_FLAG_TRM 3 - uint8_t extra_rsvd[3]; + uint8_t version; + uint8_t pad[2]; + uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; } __packed; =20 struct qla_bsg_auth_els_request { @@ -39,51 +43,46 @@ struct qla_bsg_auth_els_request { struct qla_bsg_auth_els_reply { struct fc_bsg_reply r; uint32_t rx_xchg_address; + uint8_t version; + uint8_t pad[VND_CMD_PAD_SIZE]; + uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; }; =20 struct app_id { int app_vid; - uint8_t app_key[32]; + uint8_t version; + uint8_t pad[VND_CMD_PAD_SIZE]; + uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; } __packed; =20 struct app_start_reply { uint32_t host_support_edif; uint32_t edif_enode_active; uint32_t edif_edb_active; - uint32_t reserved[VND_CMD_APP_RESERVED_SIZE]; + uint8_t version; + uint8_t pad[VND_CMD_PAD_SIZE]; + uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; } __packed; =20 struct app_start { struct app_id app_info; - uint32_t prli_to; - uint32_t key_shred; uint8_t app_start_flags; - uint8_t reserved[VND_CMD_APP_RESERVED_SIZE - 1]; + uint8_t version; + uint8_t pad[2]; + uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; } __packed; =20 struct app_stop { struct app_id app_info; - char buf[16]; + uint8_t version; + uint8_t pad[VND_CMD_PAD_SIZE]; + uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; } __packed; =20 struct app_plogi_reply { uint32_t prli_status; - uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; -} __packed; - -#define RECFG_TIME 1 -#define RECFG_BYTES 2 - -struct app_rekey_cfg { - struct app_id app_info; - uint8_t rekey_mode; - port_id_t d_id; - uint8_t force; - union { - int64_t bytes; - int64_t time; - } rky_units; - + uint8_t version; + uint8_t pad[VND_CMD_PAD_SIZE]; uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; } __packed; =20 @@ -91,7 +90,9 @@ struct app_pinfo_req { struct app_id app_info; uint8_t num_ports; port_id_t remote_pid; - uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; + uint8_t version; + uint8_t pad[VND_CMD_PAD_SIZE]; + uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; } __packed; =20 struct app_pinfo { @@ -103,11 +104,8 @@ struct app_pinfo { #define VND_CMD_RTYPE_INITIATOR 2 uint8_t remote_state; uint8_t auth_state; - uint8_t rekey_mode; - int64_t rekey_count; - int64_t rekey_config_value; - int64_t rekey_consumed_value; - + uint8_t version; + uint8_t pad[VND_CMD_PAD_SIZE]; uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; } __packed; =20 @@ -120,6 +118,8 @@ struct app_pinfo { =20 struct app_pinfo_reply { uint8_t port_count; + uint8_t version; + uint8_t pad[VND_CMD_PAD_SIZE]; uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; struct app_pinfo ports[]; } __packed; @@ -127,6 +127,8 @@ struct app_pinfo_reply { struct app_sinfo_req { struct app_id app_info; uint8_t num_ports; + uint8_t version; + uint8_t pad[VND_CMD_PAD_SIZE]; uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; } __packed; =20 @@ -140,6 +142,9 @@ struct app_sinfo { =20 struct app_stats_reply { uint8_t elem_count; + uint8_t version; + uint8_t pad[VND_CMD_PAD_SIZE]; + uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; struct app_sinfo elem[]; } __packed; =20 @@ -163,9 +168,11 @@ struct qla_sa_update_frame { uint8_t node_name[WWN_SIZE]; uint8_t port_name[WWN_SIZE]; port_id_t port_id; + uint8_t version; + uint8_t pad[VND_CMD_PAD_SIZE]; + uint8_t reserved2[VND_CMD_APP_RESERVED_SIZE]; } __packed; =20 -// used for edif mgmt bsg interface #define QL_VND_SC_UNDEF 0 #define QL_VND_SC_SA_UPDATE 1 #define QL_VND_SC_APP_START 2 @@ -175,6 +182,8 @@ struct qla_sa_update_frame { #define QL_VND_SC_REKEY_CONFIG 6 #define QL_VND_SC_GET_FCINFO 7 #define QL_VND_SC_GET_STATS 8 +#define QL_VND_SC_AEN_COMPLETE 9 + =20 /* Application interface data structure for rtn data */ #define EXT_DEF_EVENT_DATA_SIZE 64 @@ -191,7 +200,9 @@ struct edif_sa_update_aen { port_id_t port_id; uint32_t key_type; /* Tx (1) or RX (2) */ uint32_t status; /* 0 succes, 1 failed, 2 timeout , 3 error */ - uint8_t reserved[16]; + uint8_t version; + uint8_t pad[VND_CMD_PAD_SIZE]; + uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; } __packed; =20 #define QL_VND_SA_STAT_SUCCESS 0 @@ -212,7 +223,18 @@ struct auth_complete_cmd { uint8_t wwpn[WWN_SIZE]; port_id_t d_id; } u; - uint32_t reserved[VND_CMD_APP_RESERVED_SIZE]; + uint8_t version; + uint8_t pad[VND_CMD_PAD_SIZE]; + uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; +} __packed; + +struct aen_complete_cmd { + struct app_id app_info; + port_id_t port_id; + uint32_t event_code; + uint8_t version; + uint8_t pad[VND_CMD_PAD_SIZE]; + uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; } __packed; =20 #define RX_DELAY_DELETE_TIMEOUT 20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32C24C25B08 for ; Mon, 15 Aug 2022 21:29:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347396AbiHOV3D (ORCPT ); Mon, 15 Aug 2022 17:29:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243729AbiHOVWh (ORCPT ); Mon, 15 Aug 2022 17:22:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0292AE68D4; Mon, 15 Aug 2022 12:22:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 188B760BB7; Mon, 15 Aug 2022 19:22:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0789FC433D6; Mon, 15 Aug 2022 19:22:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591340; bh=0SYm1VVHnhtjkTsyruKuYLbCCiFCcr39+3jSY7b7QZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=De0rs9zQ0SuETDgbIkSkjRKWZ/nG+NeTKwkBBrvPMd5R/mQvK5UCxOj/xp5d/EqSy 1zgjPN7ky9QMG3kOy2/Omo+RGjKkB/2hOMIHm+MQn00I+iAqun3jcmMKCJ637oXtQK cPqmQy3y7JpiXrPQUqLVRYpuqh3fPlgnU9TdTcXY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0549/1095] scsi: qla2xxx: edif: Wait for app to ack on sess down Date: Mon, 15 Aug 2022 19:59:08 +0200 Message-Id: <20220815180452.266487763@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit df648afa39da9c4d3af99c6c03dc3e9c7dfa99b0 ] On session deletion, wait for app to acknowledge before moving on. This allows both app and driver to stay in sync. In addition, this gives a chance for authentication app to do any type of cleanup before moving on. Link: https://lore.kernel.org/r/20220607044627.19563-4-njavali@marvell.com Fixes: dd30706e73b7 ("scsi: qla2xxx: edif: Add key update") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_def.h | 2 +- drivers/scsi/qla2xxx/qla_edif.c | 66 +++++++++++++++++++++++++------ drivers/scsi/qla2xxx/qla_init.c | 4 -- drivers/scsi/qla2xxx/qla_target.c | 35 ++++++++-------- 4 files changed, 74 insertions(+), 33 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 5f22276927dd..c2b92a6fef90 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2626,7 +2626,6 @@ typedef struct fc_port { struct { uint32_t enable:1; /* device is edif enabled/req'd */ uint32_t app_stop:2; - uint32_t app_started:1; uint32_t aes_gmac:1; uint32_t app_sess_online:1; uint32_t tx_sa_set:1; @@ -2637,6 +2636,7 @@ typedef struct fc_port { uint32_t rx_rekey_cnt; uint64_t tx_bytes; uint64_t rx_bytes; + uint8_t sess_down_acked; uint8_t auth_state; uint16_t authok:1; uint16_t rekey_cnt; diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index 0978551f85f5..034c43a8bb9b 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -257,14 +257,8 @@ qla2x00_find_fcport_by_pid(scsi_qla_host_t *vha, port_= id_t *id) =20 f =3D NULL; list_for_each_entry_safe(f, tf, &vha->vp_fcports, list) { - if ((f->flags & FCF_FCSP_DEVICE)) { - ql_dbg(ql_dbg_edif + ql_dbg_verbose, vha, 0x2058, - "Found secure fcport - nn %8phN pn %8phN portid=3D0x%x, 0x%x.\n", - f->node_name, f->port_name, - f->d_id.b24, id->b24); - if (f->d_id.b24 =3D=3D id->b24) - return f; - } + if (f->d_id.b24 =3D=3D id->b24) + return f; } return NULL; } @@ -526,7 +520,6 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job= *bsg_job) =20 fcport->edif.app_stop =3D 0; fcport->edif.app_sess_online =3D 0; - fcport->edif.app_started =3D 1; =20 if (fcport->scan_state !=3D QLA_FCPORT_FOUND) continue; @@ -628,9 +621,6 @@ qla_edif_app_stop(scsi_qla_host_t *vha, struct bsg_job = *bsg_job) =20 fcport->send_els_logo =3D 1; qlt_schedule_sess_for_deletion(fcport); - - /* qla_edif_flush_sa_ctl_lists(fcport); */ - fcport->edif.app_started =3D 0; } } =20 @@ -1048,6 +1038,40 @@ qla_edif_app_getstats(scsi_qla_host_t *vha, struct b= sg_job *bsg_job) return rval; } =20 +static int32_t +qla_edif_ack(scsi_qla_host_t *vha, struct bsg_job *bsg_job) +{ + struct fc_port *fcport; + struct aen_complete_cmd ack; + struct fc_bsg_reply *bsg_reply =3D bsg_job->reply; + + sg_copy_to_buffer(bsg_job->request_payload.sg_list, + bsg_job->request_payload.sg_cnt, &ack, sizeof(ack)); + + ql_dbg(ql_dbg_edif, vha, 0x70cf, + "%s: %06x event_code %x\n", + __func__, ack.port_id.b24, ack.event_code); + + fcport =3D qla2x00_find_fcport_by_pid(vha, &ack.port_id); + SET_DID_STATUS(bsg_reply->result, DID_OK); + + if (!fcport) { + ql_dbg(ql_dbg_edif, vha, 0x70cf, + "%s: unable to find fcport %06x \n", + __func__, ack.port_id.b24); + return 0; + } + + switch (ack.event_code) { + case VND_CMD_AUTH_STATE_SESSION_SHUTDOWN: + fcport->edif.sess_down_acked =3D 1; + break; + default: + break; + } + return 0; +} + int32_t qla_edif_app_mgmt(struct bsg_job *bsg_job) { @@ -1110,6 +1134,9 @@ qla_edif_app_mgmt(struct bsg_job *bsg_job) case QL_VND_SC_GET_STATS: rval =3D qla_edif_app_getstats(vha, bsg_job); break; + case QL_VND_SC_AEN_COMPLETE: + rval =3D qla_edif_ack(vha, bsg_job); + break; default: ql_dbg(ql_dbg_edif, vha, 0x911d, "%s unknown cmd=3D%x\n", __func__, @@ -3513,14 +3540,29 @@ int qla_edif_process_els(scsi_qla_host_t *vha, stru= ct bsg_job *bsg_job) =20 void qla_edif_sess_down(struct scsi_qla_host *vha, struct fc_port *sess) { + u16 cnt =3D 0; + if (sess->edif.app_sess_online && DBELL_ACTIVE(vha)) { ql_dbg(ql_dbg_disc, vha, 0xf09c, "%s: sess %8phN send port_offline event\n", __func__, sess->port_name); sess->edif.app_sess_online =3D 0; + sess->edif.sess_down_acked =3D 0; qla_edb_eventcreate(vha, VND_CMD_AUTH_STATE_SESSION_SHUTDOWN, sess->d_id.b24, 0, sess); qla2x00_post_aen_work(vha, FCH_EVT_PORT_OFFLINE, sess->d_id.b24); + + while (!READ_ONCE(sess->edif.sess_down_acked) && + !test_bit(VPORT_DELETE, &vha->dpc_flags)) { + msleep(100); + cnt++; + if (cnt > 100) + break; + } + sess->edif.sess_down_acked =3D 0; + ql_dbg(ql_dbg_disc, vha, 0xf09c, + "%s: sess %8phN port_offline event completed\n", + __func__, sess->port_name); } } =20 diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_ini= t.c index 4c0f76021c47..5f077f9217e5 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -1480,7 +1480,6 @@ static int qla_chk_secure_login(scsi_qla_host_t *vha,= fc_port_t *fcport, ql_dbg(ql_dbg_disc, vha, 0x20ef, "%s %d %8phC EDIF: post DB_AUTH: AUTH needed\n", __func__, __LINE__, fcport->port_name); - fcport->edif.app_started =3D 1; fcport->edif.app_sess_online =3D 1; =20 qla_edb_eventcreate(vha, VND_CMD_AUTH_STATE_NEEDED, @@ -5275,9 +5274,6 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flag= s) INIT_LIST_HEAD(&fcport->edif.tx_sa_list); INIT_LIST_HEAD(&fcport->edif.rx_sa_list); =20 - if (vha->e_dbell.db_flags =3D=3D EDB_ACTIVE) - fcport->edif.app_started =3D 1; - spin_lock_init(&fcport->edif.indx_list_lock); INIT_LIST_HEAD(&fcport->edif.edif_indx_list); =20 diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_t= arget.c index 6dfcfd8e7337..34b85c80233f 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -988,22 +988,6 @@ void qlt_free_session_done(struct work_struct *work) sess->send_els_logo); =20 if (!IS_SW_RESV_ADDR(sess->d_id)) { - if (ha->flags.edif_enabled && - (!own || own->iocb.u.isp24.status_subcode =3D=3D ELS_PLOGI)) { - sess->edif.authok =3D 0; - if (!ha->flags.host_shutting_down) { - ql_dbg(ql_dbg_edif, vha, 0x911e, - "%s wwpn %8phC calling qla2x00_release_all_sadb\n", - __func__, sess->port_name); - qla2x00_release_all_sadb(vha, sess); - } else { - ql_dbg(ql_dbg_edif, vha, 0x911e, - "%s bypassing release_all_sadb\n", - __func__); - } - qla_edif_clear_appdata(vha, sess); - qla_edif_sess_down(vha, sess); - } qla2x00_mark_device_lost(vha, sess, 0); =20 if (sess->send_els_logo) { @@ -1049,6 +1033,25 @@ void qlt_free_session_done(struct work_struct *work) sess->nvme_flag |=3D NVME_FLAG_DELETING; qla_nvme_unregister_remote_port(sess); } + + if (ha->flags.edif_enabled && + (!own || (own && + own->iocb.u.isp24.status_subcode =3D=3D ELS_PLOGI))) { + sess->edif.authok =3D 0; + if (!ha->flags.host_shutting_down) { + ql_dbg(ql_dbg_edif, vha, 0x911e, + "%s wwpn %8phC calling qla2x00_release_all_sadb\n", + __func__, sess->port_name); + qla2x00_release_all_sadb(vha, sess); + } else { + ql_dbg(ql_dbg_edif, vha, 0x911e, + "%s bypassing release_all_sadb\n", + __func__); + } + + qla_edif_clear_appdata(vha, sess); + qla_edif_sess_down(vha, sess); + } } =20 /* --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0257C00140 for ; Mon, 15 Aug 2022 21:29:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347974AbiHOV3X (ORCPT ); Mon, 15 Aug 2022 17:29:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345213AbiHOVXp (ORCPT ); Mon, 15 Aug 2022 17:23:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22CFBE68FC; Mon, 15 Aug 2022 12:22:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EB951B81062; Mon, 15 Aug 2022 19:22:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 325F3C433D6; Mon, 15 Aug 2022 19:22:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591343; bh=MqocL5w8cz/Erg9VNDx9VYFSea4EQuI4Jiy03JZYY9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PEOMIr8DqrWnU6x5bY/n7jrsMY7iK9UeosSbnMNvB95xAO/QN7VP0bEyswixORZu3 2I0z1FnFcW9f4ADu18/9+BiWQ7Kex4Yiip4HGgYMhAENeAE0mtMM7+HYyvVGWrSndE 7POPycvJ7zq4BTzOGKdhDFzuMr6w4RDyxP784wkQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0550/1095] scsi: qla2xxx: edif: Add bsg interface to read doorbell events Date: Mon, 15 Aug 2022 19:59:09 +0200 Message-Id: <20220815180452.307276336@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 5ecd241bd7b1088a189581c0b560a13fe93621f6 ] Add bsg interface for app to read doorbell events. This interface lets driver know how much app can read based on return buffer size. When the next event(s) occur, driver will return the bsg_job with the event(s) in the return buffer. If there is no event to read, driver will hold on to the bsg_job up to few seconds as a way to control the polling interval. Link: https://lore.kernel.org/r/20220607044627.19563-5-njavali@marvell.com Fixes: dd30706e73b7 ("scsi: qla2xxx: edif: Add key update") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_dbg.h | 2 +- drivers/scsi/qla2xxx/qla_edif.c | 249 ++++++++++++++++++++-------- drivers/scsi/qla2xxx/qla_edif.h | 3 +- drivers/scsi/qla2xxx/qla_edif_bsg.h | 14 ++ 4 files changed, 195 insertions(+), 73 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h index f1f6c740bdcd..feeb1666227f 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.h +++ b/drivers/scsi/qla2xxx/qla_dbg.h @@ -383,5 +383,5 @@ ql_mask_match(uint level) if (ql2xextended_error_logging =3D=3D 1) ql2xextended_error_logging =3D QL_DBG_DEFAULT1_MASK; =20 - return (level & ql2xextended_error_logging) =3D=3D level; + return level && ((level & ql2xextended_error_logging) =3D=3D level); } diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index 034c43a8bb9b..d9e3f145b162 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -52,6 +52,31 @@ const char *sc_to_str(uint16_t cmd) return "unknown"; } =20 +static struct edb_node *qla_edb_getnext(scsi_qla_host_t *vha) +{ + unsigned long flags; + struct edb_node *edbnode =3D NULL; + + spin_lock_irqsave(&vha->e_dbell.db_lock, flags); + + /* db nodes are fifo - no qualifications done */ + if (!list_empty(&vha->e_dbell.head)) { + edbnode =3D list_first_entry(&vha->e_dbell.head, + struct edb_node, list); + list_del_init(&edbnode->list); + } + + spin_unlock_irqrestore(&vha->e_dbell.db_lock, flags); + + return edbnode; +} + +static void qla_edb_node_free(scsi_qla_host_t *vha, struct edb_node *node) +{ + list_del_init(&node->list); + kfree(node); +} + static struct edif_list_entry *qla_edif_list_find_sa_index(fc_port_t *fcpo= rt, uint16_t handle) { @@ -1072,6 +1097,130 @@ qla_edif_ack(scsi_qla_host_t *vha, struct bsg_job *= bsg_job) return 0; } =20 +static int qla_edif_consume_dbell(scsi_qla_host_t *vha, struct bsg_job *bs= g_job) +{ + struct fc_bsg_reply *bsg_reply =3D bsg_job->reply; + u32 sg_skip, reply_payload_len; + bool keep; + struct edb_node *dbnode =3D NULL; + struct edif_app_dbell ap; + int dat_size =3D 0; + + sg_skip =3D 0; + reply_payload_len =3D bsg_job->reply_payload.payload_len; + + while ((reply_payload_len - sg_skip) >=3D sizeof(struct edb_node)) { + dbnode =3D qla_edb_getnext(vha); + if (dbnode) { + keep =3D true; + dat_size =3D 0; + ap.event_code =3D dbnode->ntype; + switch (dbnode->ntype) { + case VND_CMD_AUTH_STATE_SESSION_SHUTDOWN: + case VND_CMD_AUTH_STATE_NEEDED: + ap.port_id =3D dbnode->u.plogi_did; + dat_size +=3D sizeof(ap.port_id); + break; + case VND_CMD_AUTH_STATE_ELS_RCVD: + ap.port_id =3D dbnode->u.els_sid; + dat_size +=3D sizeof(ap.port_id); + break; + case VND_CMD_AUTH_STATE_SAUPDATE_COMPL: + ap.port_id =3D dbnode->u.sa_aen.port_id; + memcpy(&ap.event_data, &dbnode->u, + sizeof(struct edif_sa_update_aen)); + dat_size +=3D sizeof(struct edif_sa_update_aen); + break; + default: + keep =3D false; + ql_log(ql_log_warn, vha, 0x09102, + "%s unknown DB type=3D%d %p\n", + __func__, dbnode->ntype, dbnode); + break; + } + ap.event_data_size =3D dat_size; + /* 8 =3D sizeof(ap.event_code + ap.event_data_size) */ + dat_size +=3D 8; + if (keep) + sg_skip +=3D sg_copy_buffer(bsg_job->reply_payload.sg_list, + bsg_job->reply_payload.sg_cnt, + &ap, dat_size, sg_skip, false); + + ql_dbg(ql_dbg_edif, vha, 0x09102, + "%s Doorbell consumed : type=3D%d %p\n", + __func__, dbnode->ntype, dbnode); + + kfree(dbnode); + } else { + break; + } + } + + SET_DID_STATUS(bsg_reply->result, DID_OK); + bsg_reply->reply_payload_rcv_len =3D sg_skip; + bsg_job->reply_len =3D sizeof(struct fc_bsg_reply); + + return 0; +} + +static void __qla_edif_dbell_bsg_done(scsi_qla_host_t *vha, struct bsg_job= *bsg_job, + u32 delay) +{ + struct fc_bsg_reply *bsg_reply =3D bsg_job->reply; + + /* small sleep for doorbell events to accumulate */ + if (delay) + msleep(delay); + + qla_edif_consume_dbell(vha, bsg_job); + + bsg_job_done(bsg_job, bsg_reply->result, bsg_reply->reply_payload_rcv_len= ); +} + +static void qla_edif_dbell_bsg_done(scsi_qla_host_t *vha) +{ + unsigned long flags; + struct bsg_job *prev_bsg_job =3D NULL; + + spin_lock_irqsave(&vha->e_dbell.db_lock, flags); + if (vha->e_dbell.dbell_bsg_job) { + prev_bsg_job =3D vha->e_dbell.dbell_bsg_job; + vha->e_dbell.dbell_bsg_job =3D NULL; + } + spin_unlock_irqrestore(&vha->e_dbell.db_lock, flags); + + if (prev_bsg_job) + __qla_edif_dbell_bsg_done(vha, prev_bsg_job, 0); +} + +static int +qla_edif_dbell_bsg(scsi_qla_host_t *vha, struct bsg_job *bsg_job) +{ + unsigned long flags; + bool return_bsg =3D false; + + /* flush previous dbell bsg */ + qla_edif_dbell_bsg_done(vha); + + spin_lock_irqsave(&vha->e_dbell.db_lock, flags); + if (list_empty(&vha->e_dbell.head) && DBELL_ACTIVE(vha)) { + /* + * when the next db event happens, bsg_job will return. + * Otherwise, timer will return it. + */ + vha->e_dbell.dbell_bsg_job =3D bsg_job; + vha->e_dbell.bsg_expire =3D jiffies + 10 * HZ; + } else { + return_bsg =3D true; + } + spin_unlock_irqrestore(&vha->e_dbell.db_lock, flags); + + if (return_bsg) + __qla_edif_dbell_bsg_done(vha, bsg_job, 1); + + return 0; +} + int32_t qla_edif_app_mgmt(struct bsg_job *bsg_job) { @@ -1083,8 +1232,13 @@ qla_edif_app_mgmt(struct bsg_job *bsg_job) bool done =3D true; int32_t rval =3D 0; uint32_t vnd_sc =3D bsg_request->rqst_data.h_vendor.vendor_cmd[1]; + u32 level =3D ql_dbg_edif; =20 - ql_dbg(ql_dbg_edif, vha, 0x911d, "%s vnd subcmd=3D%x\n", + /* doorbell is high traffic */ + if (vnd_sc =3D=3D QL_VND_SC_READ_DBELL) + level =3D 0; + + ql_dbg(level, vha, 0x911d, "%s vnd subcmd=3D%x\n", __func__, vnd_sc); =20 sg_copy_to_buffer(bsg_job->request_payload.sg_list, @@ -1093,7 +1247,7 @@ qla_edif_app_mgmt(struct bsg_job *bsg_job) =20 if (!vha->hw->flags.edif_enabled || test_bit(VPORT_DELETE, &vha->dpc_flags)) { - ql_dbg(ql_dbg_edif, vha, 0x911d, + ql_dbg(level, vha, 0x911d, "%s edif not enabled or vp delete. bsg ptr done %p. dpc_flags %lx\n", __func__, bsg_job, vha->dpc_flags); =20 @@ -1102,7 +1256,7 @@ qla_edif_app_mgmt(struct bsg_job *bsg_job) } =20 if (!qla_edif_app_check(vha, appcheck)) { - ql_dbg(ql_dbg_edif, vha, 0x911d, + ql_dbg(level, vha, 0x911d, "%s app checked failed.\n", __func__); =20 @@ -1137,6 +1291,10 @@ qla_edif_app_mgmt(struct bsg_job *bsg_job) case QL_VND_SC_AEN_COMPLETE: rval =3D qla_edif_ack(vha, bsg_job); break; + case QL_VND_SC_READ_DBELL: + rval =3D qla_edif_dbell_bsg(vha, bsg_job); + done =3D false; + break; default: ql_dbg(ql_dbg_edif, vha, 0x911d, "%s unknown cmd=3D%x\n", __func__, @@ -1148,7 +1306,7 @@ qla_edif_app_mgmt(struct bsg_job *bsg_job) =20 done: if (done) { - ql_dbg(ql_dbg_user, vha, 0x7009, + ql_dbg(level, vha, 0x7009, "%s: %d bsg ptr done %p\n", __func__, __LINE__, bsg_job); bsg_job_done(bsg_job, bsg_reply->result, bsg_reply->reply_payload_rcv_len); @@ -1860,30 +2018,6 @@ qla_edb_init(scsi_qla_host_t *vha) /* initialize lock which protects doorbell & init list */ spin_lock_init(&vha->e_dbell.db_lock); INIT_LIST_HEAD(&vha->e_dbell.head); - - /* create and initialize doorbell */ - init_completion(&vha->e_dbell.dbell); -} - -static void -qla_edb_node_free(scsi_qla_host_t *vha, struct edb_node *node) -{ - /* - * releases the space held by this edb node entry - * this function does _not_ free the edb node itself - * NB: the edb node entry passed should not be on any list - * - * currently for doorbell there's no additional cleanup - * needed, but here as a placeholder for furture use. - */ - - if (!node) { - ql_dbg(ql_dbg_edif, vha, 0x09122, - "%s error - no valid node passed\n", __func__); - return; - } - - node->ntype =3D N_UNDEF; } =20 static void qla_edb_clear(scsi_qla_host_t *vha, port_id_t portid) @@ -1930,11 +2064,8 @@ static void qla_edb_clear(scsi_qla_host_t *vha, port= _id_t portid) } spin_unlock_irqrestore(&vha->e_dbell.db_lock, flags); =20 - list_for_each_entry_safe(e, tmp, &edb_list, list) { + list_for_each_entry_safe(e, tmp, &edb_list, list) qla_edb_node_free(vha, e); - list_del_init(&e->list); - kfree(e); - } } =20 /* function called when app is stopping */ @@ -1962,14 +2093,10 @@ qla_edb_stop(scsi_qla_host_t *vha) "%s freeing edb_node type=3D%x\n", __func__, node->ntype); qla_edb_node_free(vha, node); - list_del(&node->list); - - kfree(node); } spin_unlock_irqrestore(&vha->e_dbell.db_lock, flags); =20 - /* wake up doorbell waiters - they'll be dismissed with error code */ - complete_all(&vha->e_dbell.dbell); + qla_edif_dbell_bsg_done(vha); } =20 static struct edb_node * @@ -2007,9 +2134,6 @@ qla_edb_node_add(scsi_qla_host_t *vha, struct edb_nod= e *ptr) list_add_tail(&ptr->list, &vha->e_dbell.head); spin_unlock_irqrestore(&vha->e_dbell.db_lock, flags); =20 - /* ring doorbell for waiters */ - complete(&vha->e_dbell.dbell); - return true; } =20 @@ -2078,43 +2202,24 @@ qla_edb_eventcreate(scsi_qla_host_t *vha, uint32_t = dbtype, default: ql_dbg(ql_dbg_edif, vha, 0x09102, "%s unknown type: %x\n", __func__, dbtype); - qla_edb_node_free(vha, edbnode); kfree(edbnode); edbnode =3D NULL; break; } =20 - if (edbnode && (!qla_edb_node_add(vha, edbnode))) { + if (edbnode) { + if (!qla_edb_node_add(vha, edbnode)) { + ql_dbg(ql_dbg_edif, vha, 0x09102, + "%s unable to add dbnode\n", __func__); + kfree(edbnode); + return; + } ql_dbg(ql_dbg_edif, vha, 0x09102, - "%s unable to add dbnode\n", __func__); - qla_edb_node_free(vha, edbnode); - kfree(edbnode); - return; - } - if (edbnode && fcport) - fcport->edif.auth_state =3D dbtype; - ql_dbg(ql_dbg_edif, vha, 0x09102, - "%s Doorbell produced : type=3D%d %p\n", __func__, dbtype, edbnode); -} - -static struct edb_node * -qla_edb_getnext(scsi_qla_host_t *vha) -{ - unsigned long flags; - struct edb_node *edbnode =3D NULL; - - spin_lock_irqsave(&vha->e_dbell.db_lock, flags); - - /* db nodes are fifo - no qualifications done */ - if (!list_empty(&vha->e_dbell.head)) { - edbnode =3D list_first_entry(&vha->e_dbell.head, - struct edb_node, list); - list_del(&edbnode->list); + "%s Doorbell produced : type=3D%d %p\n", __func__, dbtype, edbnode); + qla_edif_dbell_bsg_done(vha); + if (fcport) + fcport->edif.auth_state =3D dbtype; } - - spin_unlock_irqrestore(&vha->e_dbell.db_lock, flags); - - return edbnode; } =20 void @@ -2142,6 +2247,9 @@ qla_edif_timer(scsi_qla_host_t *vha) ha->edif_post_stop_cnt_down =3D 60; } } + + if (vha->e_dbell.dbell_bsg_job && time_after_eq(jiffies, vha->e_dbell.bsg= _expire)) + qla_edif_dbell_bsg_done(vha); } =20 /* @@ -2209,7 +2317,6 @@ edif_doorbell_show(struct device *dev, struct device_= attribute *attr, "%s Doorbell consumed : type=3D%d %p\n", __func__, dbnode->ntype, dbnode); /* we're done with the db node, so free it up */ - qla_edb_node_free(vha, dbnode); kfree(dbnode); } else { break; diff --git a/drivers/scsi/qla2xxx/qla_edif.h b/drivers/scsi/qla2xxx/qla_edi= f.h index a965ca8e47ce..3561e22b8f0f 100644 --- a/drivers/scsi/qla2xxx/qla_edif.h +++ b/drivers/scsi/qla2xxx/qla_edif.h @@ -51,7 +51,8 @@ struct edif_dbell { enum db_flags_t db_flags; spinlock_t db_lock; struct list_head head; - struct completion dbell; + struct bsg_job *dbell_bsg_job; + unsigned long bsg_expire; }; =20 #define SA_UPDATE_IOCB_TYPE 0x71 /* Security Association Upd= ate IOCB entry */ diff --git a/drivers/scsi/qla2xxx/qla_edif_bsg.h b/drivers/scsi/qla2xxx/qla= _edif_bsg.h index 301523e4f483..110843b13767 100644 --- a/drivers/scsi/qla2xxx/qla_edif_bsg.h +++ b/drivers/scsi/qla2xxx/qla_edif_bsg.h @@ -183,6 +183,20 @@ struct qla_sa_update_frame { #define QL_VND_SC_GET_FCINFO 7 #define QL_VND_SC_GET_STATS 8 #define QL_VND_SC_AEN_COMPLETE 9 +#define QL_VND_SC_READ_DBELL 10 + +/* + * bsg caller to provide empty buffer for doorbell events. + * + * sg_io_v4.din_xferp =3D empty buffer for door bell events + * sg_io_v4.dout_xferp =3D struct edif_read_dbell *buf + */ +struct edif_read_dbell { + struct app_id app_info; + uint8_t version; + uint8_t pad[VND_CMD_PAD_SIZE]; + uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; +}; =20 =20 /* Application interface data structure for rtn data */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B5FDC00140 for ; Mon, 15 Aug 2022 21:29:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347817AbiHOV3N (ORCPT ); Mon, 15 Aug 2022 17:29:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345214AbiHOVXp (ORCPT ); Mon, 15 Aug 2022 17:23:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AD59E7244; Mon, 15 Aug 2022 12:22:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6DDB061029; Mon, 15 Aug 2022 19:22:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DAE1C433C1; Mon, 15 Aug 2022 19:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591346; bh=M/ohy5nRZZWVPrSGlZ5Tz1xX6F3zlQOz05L6jXLL4YU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WRxdqRwRZuYTP+DfOynBEeWoJO8cH3Uc/kJxuKKcDn1BdtQfJw0qXiff89OhzU/ji uBoKMrdIKfl7Ia6S70bBh7EuC+BWYOned97B6qZcbN+lrXwlSQZ4bS6SHPN05AQcK4 zehys4GCuM6stl9XIrMzDT69+vorqa7NtOrDqTsA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0551/1095] scsi: qla2xxx: edif: Fix potential stuck session in sa update Date: Mon, 15 Aug 2022 19:59:10 +0200 Message-Id: <20220815180452.349253008@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit e0fb8ce2bb9e52c846e54ad2c58b5b7beb13eb09 ] When a thread is in the process of reestablish a session, a flag is set to prevent multiple threads/triggers from doing the same task. This flag was left on, and any attempt to relogin was locked out. Clear this flag if the attempt has failed. Link: https://lore.kernel.org/r/20220607044627.19563-6-njavali@marvell.com Fixes: dd30706e73b7 ("scsi: qla2xxx: edif: Add key update") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index d9e3f145b162..166647d4ab27 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -2332,6 +2332,7 @@ edif_doorbell_show(struct device *dev, struct device_= attribute *attr, =20 static void qla_noop_sp_done(srb_t *sp, int res) { + sp->fcport->flags &=3D ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); /* ref: INIT */ kref_put(&sp->cmd_kref, qla2x00_sp_release); } @@ -2356,7 +2357,8 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, s= truct qla_work_evt *e) if (!sa_ctl) { ql_dbg(ql_dbg_edif, vha, 0x70e6, "sa_ctl allocation failed\n"); - return -ENOMEM; + rval =3D -ENOMEM; + goto done; } =20 fcport =3D sa_ctl->fcport; @@ -2366,7 +2368,8 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, s= truct qla_work_evt *e) if (!sp) { ql_dbg(ql_dbg_edif, vha, 0x70e6, "SRB allocation failed\n"); - return -ENOMEM; + rval =3D -ENOMEM; + goto done; } =20 fcport->flags |=3D FCF_ASYNC_SENT; @@ -2395,9 +2398,17 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, = struct qla_work_evt *e) =20 rval =3D qla2x00_start_sp(sp); =20 - if (rval !=3D QLA_SUCCESS) + if (rval !=3D QLA_SUCCESS) { rval =3D QLA_FUNCTION_FAILED; + goto done_free_sp; + } =20 + return rval; +done_free_sp: + kref_put(&sp->cmd_kref, qla2x00_sp_release); + fcport->flags &=3D ~FCF_ASYNC_SENT; +done: + fcport->flags &=3D ~FCF_ASYNC_ACTIVE; return rval; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCAA5C00140 for ; Mon, 15 Aug 2022 21:29:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348039AbiHOV3b (ORCPT ); Mon, 15 Aug 2022 17:29:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346382AbiHOVY2 (ORCPT ); Mon, 15 Aug 2022 17:24:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42AA6E725E; Mon, 15 Aug 2022 12:22:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6463561024; Mon, 15 Aug 2022 19:22:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CCFAC433D7; Mon, 15 Aug 2022 19:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591349; bh=YTl8WtGTSEAv6fEihigIAxYf6dV25myHpJqpS3uakVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bju5ECkm5mDxyPZ2e+m5KAU0dvVE2YJWe2+7RT3vnvJtjBQbsA2O2E8bA9AXILwva T+z2GKesYekXRuU6+BSknG0bCdMD+lmPk1x7m3RCfLYfKHJxtWFggrc0YzkMY3cv1g hnnkgJrqJ5VJlujzFuMsixx8OSWS7ltWXKalzQ+A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0552/1095] scsi: qla2xxx: edif: Synchronize NPIV deletion with authentication application Date: Mon, 15 Aug 2022 19:59:11 +0200 Message-Id: <20220815180452.395892404@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit cf79716e6636400ae38c37bc8a652b1e522abbba ] Notify authentication application of a NPIV deletion event is about to occur. This allows app to perform cleanup. Link: https://lore.kernel.org/r/20220607044627.19563-7-njavali@marvell.com Fixes: 9efea843a906 ("scsi: qla2xxx: edif: Add detection of secure device") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif_bsg.h | 2 ++ drivers/scsi/qla2xxx/qla_mid.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_edif_bsg.h b/drivers/scsi/qla2xxx/qla= _edif_bsg.h index 110843b13767..0931f4e4e127 100644 --- a/drivers/scsi/qla2xxx/qla_edif_bsg.h +++ b/drivers/scsi/qla2xxx/qla_edif_bsg.h @@ -253,4 +253,6 @@ struct aen_complete_cmd { =20 #define RX_DELAY_DELETE_TIMEOUT 20 =20 +#define FCH_EVT_VENDOR_UNIQUE_VPORT_DOWN 1 + #endif /* QLA_EDIF_BSG_H */ diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index e6b5c4ccce97..eb43a5f1b399 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c @@ -166,9 +166,13 @@ qla24xx_disable_vp(scsi_qla_host_t *vha) int ret =3D QLA_SUCCESS; fc_port_t *fcport; =20 - if (vha->hw->flags.edif_enabled) + if (vha->hw->flags.edif_enabled) { + if (DBELL_ACTIVE(vha)) + qla2x00_post_aen_work(vha, FCH_EVT_VENDOR_UNIQUE, + FCH_EVT_VENDOR_UNIQUE_VPORT_DOWN); /* delete sessions and flush sa_indexes */ qla2x00_wait_for_sess_deletion(vha); + } =20 if (vha->hw->flags.fw_started) ret =3D qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47F35C00140 for ; Mon, 15 Aug 2022 21:29:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348097AbiHOV3p (ORCPT ); Mon, 15 Aug 2022 17:29:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347122AbiHOVZZ (ORCPT ); Mon, 15 Aug 2022 17:25:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 453AAE8306; Mon, 15 Aug 2022 12:22:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 33569B81122; Mon, 15 Aug 2022 19:22:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77522C433D6; Mon, 15 Aug 2022 19:22:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591352; bh=RhgteyQS3kvuldvAL+apW68+vLiEfEaTsyeIwJ3D7A8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WfXM19tu/9VXd6gveeuSybEKEa9EiF2q730wpQf2iNehykIqI4B2cMNGgVhdJNYDL 2tmHdozJb4gykwGZiVxjMaTItYWgoeZiBNI5TYtyF1t91IRLUrx+oOFHTBC7X+BD0d wqppzFmZVlUMea6GW++/ogXT6m3hj7krmebZMvHQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0553/1095] scsi: qla2xxx: edif: Add retry for ELS passthrough Date: Mon, 15 Aug 2022 19:59:12 +0200 Message-Id: <20220815180452.437587008@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 0b3f3143d473b489a7aa0779c43bcdb344bd3014 ] Relating to EDIF, when sending IKE message, updating key or deleting key, driver can encounter IOCB queue full. Add additional retries to reduce higher level recovery. Link: https://lore.kernel.org/r/20220607044627.19563-8-njavali@marvell.com Fixes: dd30706e73b7 ("scsi: qla2xxx: edif: Add key update") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 52 +++++++++++++++++++++++---------- drivers/scsi/qla2xxx/qla_os.c | 2 +- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index 166647d4ab27..ce893ddb13df 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -1468,6 +1468,8 @@ qla24xx_check_sadb_avail_slot(struct bsg_job *bsg_job= , fc_port_t *fcport, =20 #define QLA_SA_UPDATE_FLAGS_RX_KEY 0x0 #define QLA_SA_UPDATE_FLAGS_TX_KEY 0x2 +#define EDIF_MSLEEP_INTERVAL 100 +#define EDIF_RETRY_COUNT 50 =20 int qla24xx_sadb_update(struct bsg_job *bsg_job) @@ -1480,7 +1482,7 @@ qla24xx_sadb_update(struct bsg_job *bsg_job) struct edif_list_entry *edif_entry =3D NULL; int found =3D 0; int rval =3D 0; - int result =3D 0; + int result =3D 0, cnt; struct qla_sa_update_frame sa_frame; struct srb_iocb *iocb_cmd; port_id_t portid; @@ -1721,11 +1723,23 @@ qla24xx_sadb_update(struct bsg_job *bsg_job) sp->done =3D qla2x00_bsg_job_done; iocb_cmd =3D &sp->u.iocb_cmd; iocb_cmd->u.sa_update.sa_frame =3D sa_frame; - + cnt =3D 0; +retry: rval =3D qla2x00_start_sp(sp); - if (rval !=3D QLA_SUCCESS) { + switch (rval) { + case QLA_SUCCESS: + break; + case EAGAIN: + msleep(EDIF_MSLEEP_INTERVAL); + cnt++; + if (cnt < EDIF_RETRY_COUNT) + goto retry; + + fallthrough; + default: ql_log(ql_dbg_edif, vha, 0x70e3, - "qla2x00_start_sp failed=3D%d.\n", rval); + "%s qla2x00_start_sp failed=3D%d.\n", + __func__, rval); =20 qla2x00_rel_sp(sp); rval =3D -EIO; @@ -2399,7 +2413,6 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, s= truct qla_work_evt *e) rval =3D qla2x00_start_sp(sp); =20 if (rval !=3D QLA_SUCCESS) { - rval =3D QLA_FUNCTION_FAILED; goto done_free_sp; } =20 @@ -3531,7 +3544,7 @@ int qla_edif_process_els(scsi_qla_host_t *vha, struct= bsg_job *bsg_job) fc_port_t *fcport =3D NULL; struct qla_hw_data *ha =3D vha->hw; srb_t *sp; - int rval =3D (DID_ERROR << 16); + int rval =3D (DID_ERROR << 16), cnt; port_id_t d_id; struct qla_bsg_auth_els_request *p =3D (struct qla_bsg_auth_els_request *)bsg_job->request; @@ -3626,17 +3639,26 @@ int qla_edif_process_els(scsi_qla_host_t *vha, stru= ct bsg_job *bsg_job) sp->free =3D qla2x00_bsg_sp_free; sp->done =3D qla2x00_bsg_job_done; =20 + cnt =3D 0; +retry: rval =3D qla2x00_start_sp(sp); - - ql_dbg(ql_dbg_edif, vha, 0x700a, - "%s %s %8phN xchg %x ctlflag %x hdl %x reqlen %xh bsg ptr %p\n", - __func__, sc_to_str(p->e.sub_cmd), fcport->port_name, - p->e.extra_rx_xchg_address, p->e.extra_control_flags, - sp->handle, sp->remap.req.len, bsg_job); - - if (rval !=3D QLA_SUCCESS) { + switch (rval) { + case QLA_SUCCESS: + ql_dbg(ql_dbg_edif, vha, 0x700a, + "%s %s %8phN xchg %x ctlflag %x hdl %x reqlen %xh bsg ptr %p\n", + __func__, sc_to_str(p->e.sub_cmd), fcport->port_name, + p->e.extra_rx_xchg_address, p->e.extra_control_flags, + sp->handle, sp->remap.req.len, bsg_job); + break; + case EAGAIN: + msleep(EDIF_MSLEEP_INTERVAL); + cnt++; + if (cnt < EDIF_RETRY_COUNT) + goto retry; + fallthrough; + default: ql_log(ql_log_warn, vha, 0x700e, - "qla2x00_start_sp failed =3D %d\n", rval); + "%s qla2x00_start_sp failed =3D %d\n", __func__, rval); SET_DID_STATUS(bsg_reply->result, DID_IMM_RETRY); rval =3D -EIO; goto done_free_remap_rsp; diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 762229d495a8..3c68dad00d04 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -5473,7 +5473,7 @@ qla2x00_do_work(struct scsi_qla_host *vha) e->u.fcport.fcport, false); break; case QLA_EVT_SA_REPLACE: - qla24xx_issue_sa_replace_iocb(vha, e); + rc =3D qla24xx_issue_sa_replace_iocb(vha, e); break; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1852DC00140 for ; Mon, 15 Aug 2022 21:30:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348172AbiHOV35 (ORCPT ); Mon, 15 Aug 2022 17:29:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347665AbiHOV0G (ORCPT ); Mon, 15 Aug 2022 17:26:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9277CE8320; Mon, 15 Aug 2022 12:22:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B6AF960FDA; Mon, 15 Aug 2022 19:22:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE19DC433D6; Mon, 15 Aug 2022 19:22:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591359; bh=EpI4s0rZZlvhdv4EB9lnUgtUdH7otxTdlujJi/PPPfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jNIRlgljrtXuk2X9mxXe8jlm18rzuT1SEjhhoncdeeDUSXBIf3QI2GYfNsKBkXcGC X/SbgogDcE3aoouFbF4Ec+qIzSGi2HCF73I1/QGfemaZ3rq2MdiapZ6pSEKtIsXZWw eoWHcGm6pOtuydO9GaTwywymgb0ODnyiAV55zTnw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0554/1095] scsi: qla2xxx: edif: Fix n2n discovery issue with secure target Date: Mon, 15 Aug 2022 19:59:13 +0200 Message-Id: <20220815180452.472169540@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 789d54a4178634850e441f60c0326124138e7269 ] User failed to see disk via n2n topology. Driver used up all login retries before authentication application started. When authentication application started, driver did not have enough login retries to connect securely. On app_start, driver will reset the login retry attempt count. Link: https://lore.kernel.org/r/20220607044627.19563-10-njavali@marvell.com Fixes: 4de067e5df12 ("scsi: qla2xxx: edif: Add N2N support for EDIF") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index ce893ddb13df..c17e177864d3 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -515,6 +515,9 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job= *bsg_job) } =20 if (N2N_TOPO(vha->hw)) { + list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) + fcport->n2n_link_reset_cnt =3D 0; + if (vha->hw->flags.n2n_fw_acc_sec) set_bit(N2N_LINK_RESET, &vha->dpc_flags); else --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 791E0C00140 for ; Mon, 15 Aug 2022 21:29:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348125AbiHOV3s (ORCPT ); Mon, 15 Aug 2022 17:29:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347622AbiHOVZ7 (ORCPT ); Mon, 15 Aug 2022 17:25:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 129C838BA; Mon, 15 Aug 2022 12:22:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DE5F661024; Mon, 15 Aug 2022 19:22:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD513C433D6; Mon, 15 Aug 2022 19:22:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591362; bh=fFljOQNloyO/qfGLcVLELB2aDek7yeS4/gMF84dZj8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y+YU1hHJr2+hTTfbZJy0xFKRhHki9kg4LsppTeD61rw3DidbWiHReGyLL4Q5Qv9rw sHJEImnu1QqXCYwXq/1EzxLa5qoIp3GLZ5J89dMQZoQfVfGjmGzCCUBQkU7xyZ8sH0 ponI18w1jL1tfOR/5oXevKXR4Rx/n/WnYFPRrPkw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0555/1095] scsi: qla2xxx: edif: Fix n2n login retry for secure device Date: Mon, 15 Aug 2022 19:59:14 +0200 Message-Id: <20220815180452.517904866@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit aec55325ddec975216119da000092cb8664a3399 ] After initiator has burned up all login retries, target authentication application begins to run. This triggers a link bounce on target side. Initiator will attempt another login. Due to N2N, the PRLI [nvme | fcp] can fail because of the mode mismatch with target. This patch add a few more login retries to revive the connection. Link: https://lore.kernel.org/r/20220607044627.19563-11-njavali@marvell.com Fixes: 4de067e5df12 ("scsi: qla2xxx: edif: Add N2N support for EDIF") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_ini= t.c index 5f077f9217e5..177ce45b76a6 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -2123,6 +2123,13 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host = *vha, struct event_arg *ea) } =20 if (N2N_TOPO(vha->hw)) { + if (ea->fcport->n2n_link_reset_cnt =3D=3D + vha->hw->login_retry_count && + ea->fcport->flags & FCF_FCSP_DEVICE) { + /* remote authentication app just started */ + ea->fcport->n2n_link_reset_cnt =3D 0; + } + if (ea->fcport->n2n_link_reset_cnt < vha->hw->login_retry_count) { ea->fcport->n2n_link_reset_cnt++; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E120C00140 for ; Mon, 15 Aug 2022 21:30:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243428AbiHOVaI (ORCPT ); Mon, 15 Aug 2022 17:30:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348017AbiHOV0v (ORCPT ); Mon, 15 Aug 2022 17:26:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70F36E97C2; Mon, 15 Aug 2022 12:22:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B50DBB810C6; Mon, 15 Aug 2022 19:22:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF8D3C433C1; Mon, 15 Aug 2022 19:22:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591365; bh=egGKbDqvXc1EvJ4PBDPmmMxMGc9KA8xbMp/xsy6gDFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vjBhLi35tXOzsTa5VyyzO5PHuosMAyVWonOZOXdwW9xNVk0bfYECKI9w3o5hJgCTO W2ni+w45d+kneiVOv+nqQZGw1xZwnenVDtbtF9xpVbZynWQFGGjjOI0KTuJsKKOZzB XvlY1kPL7PauZwYb5AoVt1hty/dyqmakcx5UKM3A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Levitsky , Sean Christopherson , "Maciej S. Szmigiero" , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 0556/1095] KVM: SVM: Unwind "speculative" RIP advancement if INTn injection "fails" Date: Mon, 15 Aug 2022 19:59:15 +0200 Message-Id: <20220815180452.559585831@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit cd9e6da8048c5b40315ee2d929b6230ce1252c3c ] Unwind the RIP advancement done by svm_queue_exception() when injecting an INT3 ultimately "fails" due to the CPU encountering a VM-Exit while vectoring the injected event, even if the exception reported by the CPU isn't the same event that was injected. If vectoring INT3 encounters an exception, e.g. #NP, and vectoring the #NP encounters an intercepted exception, e.g. #PF when KVM is using shadow paging, then the #NP will be reported as the event that was in-progress. Note, this is still imperfect, as it will get a false positive if the INT3 is cleanly injected, no VM-Exit occurs before the IRET from the INT3 handler in the guest, the instruction following the INT3 generates an exception (directly or indirectly), _and_ vectoring that exception encounters an exception that is intercepted by KVM. The false positives could theoretically be solved by further analyzing the vectoring event, e.g. by comparing the error code against the expected error code were an exception to occur when vectoring the original injected exception, but SVM without NRIPS is a complete disaster, trying to make it 100% correct is a waste of time. Reviewed-by: Maxim Levitsky Fixes: 66b7138f9136 ("KVM: SVM: Emulate nRIP feature when reinjecting INT3") Signed-off-by: Sean Christopherson Signed-off-by: Maciej S. Szmigiero Message-Id: <450133cf0a026cb9825a2ff55d02cb136a1cb111.1651440202.git.maciej= .szmigiero@oracle.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/svm/svm.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 2851d1e58cb8..e4c736d74fcb 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -3613,6 +3613,18 @@ static void svm_complete_interrupts(struct kvm_vcpu = *vcpu) vector =3D exitintinfo & SVM_EXITINTINFO_VEC_MASK; type =3D exitintinfo & SVM_EXITINTINFO_TYPE_MASK; =20 + /* + * If NextRIP isn't enabled, KVM must manually advance RIP prior to + * injecting the soft exception/interrupt. That advancement needs to + * be unwound if vectoring didn't complete. Note, the _new_ event may + * not be the injected event, e.g. if KVM injected an INTn, the INTn + * hit a #NP in the guest, and the #NP encountered a #PF, the #NP will + * be the reported vectored event, but RIP still needs to be unwound. + */ + if (int3_injected && type =3D=3D SVM_EXITINTINFO_TYPE_EXEPT && + kvm_is_linear_rip(vcpu, svm->int3_rip)) + kvm_rip_write(vcpu, kvm_rip_read(vcpu) - int3_injected); + switch (type) { case SVM_EXITINTINFO_TYPE_NMI: vcpu->arch.nmi_injected =3D true; @@ -3626,16 +3638,11 @@ static void svm_complete_interrupts(struct kvm_vcpu= *vcpu) =20 /* * In case of software exceptions, do not reinject the vector, - * but re-execute the instruction instead. Rewind RIP first - * if we emulated INT3 before. + * but re-execute the instruction instead. */ - if (kvm_exception_is_soft(vector)) { - if (vector =3D=3D BP_VECTOR && int3_injected && - kvm_is_linear_rip(vcpu, svm->int3_rip)) - kvm_rip_write(vcpu, - kvm_rip_read(vcpu) - int3_injected); + if (kvm_exception_is_soft(vector)) break; - } + if (exitintinfo & SVM_EXITINTINFO_VALID_ERR) { u32 err =3D svm->vmcb->control.exit_int_info_err; kvm_requeue_exception_e(vcpu, vector, err); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE148C25B08 for ; Mon, 15 Aug 2022 21:32:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243678AbiHOVcJ (ORCPT ); Mon, 15 Aug 2022 17:32:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348044AbiHOV0w (ORCPT ); Mon, 15 Aug 2022 17:26:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2502315734; Mon, 15 Aug 2022 12:22:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 26AA361029; Mon, 15 Aug 2022 19:22:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28BD0C433D6; Mon, 15 Aug 2022 19:22:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591368; bh=ONiKSiNfoJ7cyniodmbLoVS9aaexIl6o8kiTkIsPUC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xuFEkvfD0OTB5CfVKmMZMyXVAbwbHhrdrq3Id4wIgfDnawiHFOUuKvePSd/KG0nly vmxfGkpvco73GCJDV2hcfENOb+WZOfsIKJO5ev/OacVjJQC/W0mN7vRlBOAi4oqCeG qhokFOXrCO1MeNvWo6bplkO3zpXok4rl04VdnZRs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Levitsky , Sean Christopherson , "Maciej S. Szmigiero" , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 0557/1095] KVM: SVM: Stuff next_rip on emulated INT3 injection if NRIPS is supported Date: Mon, 15 Aug 2022 19:59:16 +0200 Message-Id: <20220815180452.600078706@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit 3741aec4c38fa4123ab08ae552f05366d4fd05d8 ] If NRIPS is supported in hardware but disabled in KVM, set next_rip to the next RIP when advancing RIP as part of emulating INT3 injection. There is no flag to tell the CPU that KVM isn't using next_rip, and so leaving next_rip is left as is will result in the CPU pushing garbage onto the stack when vectoring the injected event. Reviewed-by: Maxim Levitsky Fixes: 66b7138f9136 ("KVM: SVM: Emulate nRIP feature when reinjecting INT3") Signed-off-by: Sean Christopherson Signed-off-by: Maciej S. Szmigiero Message-Id: Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/svm/svm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index e4c736d74fcb..e5a154f0d2ab 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -390,6 +390,10 @@ static void svm_queue_exception(struct kvm_vcpu *vcpu) */ (void)svm_skip_emulated_instruction(vcpu); rip =3D kvm_rip_read(vcpu); + + if (boot_cpu_has(X86_FEATURE_NRIPS)) + svm->vmcb->control.next_rip =3D rip; + svm->int3_rip =3D rip + svm->vmcb->save.cs.base; svm->int3_injected =3D rip - old_rip; } @@ -3616,7 +3620,7 @@ static void svm_complete_interrupts(struct kvm_vcpu *= vcpu) /* * If NextRIP isn't enabled, KVM must manually advance RIP prior to * injecting the soft exception/interrupt. That advancement needs to - * be unwound if vectoring didn't complete. Note, the _new_ event may + * be unwound if vectoring didn't complete. Note, the new event may * not be the injected event, e.g. if KVM injected an INTn, the INTn * hit a #NP in the guest, and the #NP encountered a #PF, the #NP will * be the reported vectored event, but RIP still needs to be unwound. --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0384C00140 for ; Mon, 15 Aug 2022 21:30:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345462AbiHOVaO (ORCPT ); Mon, 15 Aug 2022 17:30:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348075AbiHOV0y (ORCPT ); Mon, 15 Aug 2022 17:26:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C62F6E97D6; Mon, 15 Aug 2022 12:22:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 582FD60EF0; Mon, 15 Aug 2022 19:22:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 413EDC433D7; Mon, 15 Aug 2022 19:22:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591371; bh=vMvWEIEo1oW/bGTWgeRjKxE+hvtQgXM/3X8UYsmh7Pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XAgeCeBfc0rTFFYrh5ZG0GtzzYtyU3eQio6a4/SAzHZCBJhFwAnRfr3E6Bao58MKE B/cUWaIFXizkwebHCKbecZVJdzYoSnZfu8i7QxXu5cTICLQ8KZdrxDyhqeR6fGYqIP UOGbUZ/cWICvFvb6J1ikdcdWNpmqCXyB7z4sgc4g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Matlack , Ben Gardon , Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 0558/1095] KVM: x86/mmu: Drop RWX=0 SPTEs during ept_sync_page() Date: Mon, 15 Aug 2022 19:59:17 +0200 Message-Id: <20220815180452.641750171@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit 9fb3565743d58352f00964bf47213b88aff4bb82 ] All of sync_page()'s existing checks filter out only !PRESENT gPTE, because without execute-only, all upper levels are guaranteed to be at least READABLE. However, if EPT with execute-only support is in use by L1, KVM can create an SPTE that is shadow-present but guest-inaccessible (RWX=3D0) if the upper level combined permissions are R (or RW) and the leaf EPTE is changed from R (or RW) to X. Because the EPTE is considered present when viewed in isolation, and no reserved bits are set, FNAME(prefetch_invalid_gpte) will consider the GPTE valid, and cause a not-present SPTE to be created. The SPTE is "correct": the guest translation is inaccessible because the combined protections of all levels yield RWX=3D0, and KVM will just redirect any vmexits to the guest. If EPT A/D bits are disabled, KVM can mistake the SPTE for an access-tracked SPTE, but again such confusion isn't fatal, as the "saved" protections are also RWX=3D0. However, creating a useless SPTE in general means that KVM messed up something, even if this particular goof didn't manifest as a functional bug. So, drop SPTEs whose new protections will yield a RWX=3D0 SPTE, and add a WARN in make_spte() to detect creation of SPTEs that will result in RWX=3D0 protections. Fixes: d95c55687e11 ("kvm: mmu: track read permission explicitly for shadow= EPT page tables") Cc: David Matlack Cc: Ben Gardon Signed-off-by: Sean Christopherson Message-Id: <20220513195000.99371-2-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/mmu/paging_tmpl.h | 9 ++++++++- arch/x86/kvm/mmu/spte.c | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu/paging_tmpl.h b/arch/x86/kvm/mmu/paging_tmpl.h index beb3ce8d94eb..43f6a882615f 100644 --- a/arch/x86/kvm/mmu/paging_tmpl.h +++ b/arch/x86/kvm/mmu/paging_tmpl.h @@ -1044,7 +1044,14 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, s= truct kvm_mmu_page *sp) if (sync_mmio_spte(vcpu, &sp->spt[i], gfn, pte_access)) continue; =20 - if (gfn !=3D sp->gfns[i]) { + /* + * Drop the SPTE if the new protections would result in a RWX=3D0 + * SPTE or if the gfn is changing. The RWX=3D0 case only affects + * EPT with execute-only support, i.e. EPT without an effective + * "present" bit, as all other paging modes will create a + * read-only SPTE if pte_access is zero. + */ + if ((!pte_access && !shadow_present_mask) || gfn !=3D sp->gfns[i]) { drop_spte(vcpu->kvm, &sp->spt[i]); flush =3D true; continue; diff --git a/arch/x86/kvm/mmu/spte.c b/arch/x86/kvm/mmu/spte.c index e5c0b6db6f2c..8223a80802e7 100644 --- a/arch/x86/kvm/mmu/spte.c +++ b/arch/x86/kvm/mmu/spte.c @@ -128,6 +128,8 @@ bool make_spte(struct kvm_vcpu *vcpu, struct kvm_mmu_pa= ge *sp, u64 spte =3D SPTE_MMU_PRESENT_MASK; bool wrprot =3D false; =20 + WARN_ON_ONCE(!pte_access && !shadow_present_mask); + if (sp->role.ad_disabled) spte |=3D SPTE_TDP_AD_DISABLED_MASK; else if (kvm_mmu_page_ad_need_write_protect(sp)) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AE0FC00140 for ; Mon, 15 Aug 2022 21:30:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243557AbiHOVaR (ORCPT ); Mon, 15 Aug 2022 17:30:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348152AbiHOV07 (ORCPT ); Mon, 15 Aug 2022 17:26:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C4CEE97F1; Mon, 15 Aug 2022 12:22:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 607F560FDA; Mon, 15 Aug 2022 19:22:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63953C433D6; Mon, 15 Aug 2022 19:22:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591374; bh=Y2JRNAOW2EOmlGoFTTcKC2KjNshzPUJ73cPXUm8YcIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wMYc9Ams5BffVckF0HS7IQUMeuD4+mnHpWPhcVBv2ByGFea5pe9VnXDwRBWRn2jrg 5Ar5CsrcLbnppV9zACFZ/58AQseRAj71p4xN6I8LuXr4+QnO2Eu82TFnSDIZyp7F5r uSg+fDxJ3wrxN7K9JAUHvlziv5H6VITX3RXzPXHI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chanho Park , Krzysztof Kozlowski , Vinod Koul , Sasha Levin Subject: [PATCH 5.18 0559/1095] phy: samsung: exynosautov9-ufs: correct TSRV register configurations Date: Mon, 15 Aug 2022 19:59:18 +0200 Message-Id: <20220815180452.689981782@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chanho Park [ Upstream commit f7fdc4db071f7ee7d408ea3f083222a060c76623 ] For exynos auto v9's UFS MPHY, We should use 0x50 offset of TSRV register configurations. So, it must be s/PHY_TRSV_REG_CFG/PHY_TRSV_REG_CFG_AUTOV9/g Fixes: d64519249e1d ("phy: samsung-ufs: support exynosauto ufs phy driver") Signed-off-by: Chanho Park Acked-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220603050536.61957-1-chanho61.park@samsun= g.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/phy/samsung/phy-exynosautov9-ufs.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/phy/samsung/phy-exynosautov9-ufs.c b/drivers/phy/samsu= ng/phy-exynosautov9-ufs.c index 36398a15c2db..d043dfdb598a 100644 --- a/drivers/phy/samsung/phy-exynosautov9-ufs.c +++ b/drivers/phy/samsung/phy-exynosautov9-ufs.c @@ -31,22 +31,22 @@ static const struct samsung_ufs_phy_cfg exynosautov9_pr= e_init_cfg[] =3D { PHY_COMN_REG_CFG(0x023, 0xc0, PWR_MODE_ANY), PHY_COMN_REG_CFG(0x023, 0x00, PWR_MODE_ANY), =20 - PHY_TRSV_REG_CFG(0x042, 0x5d, PWR_MODE_ANY), - PHY_TRSV_REG_CFG(0x043, 0x80, PWR_MODE_ANY), + PHY_TRSV_REG_CFG_AUTOV9(0x042, 0x5d, PWR_MODE_ANY), + PHY_TRSV_REG_CFG_AUTOV9(0x043, 0x80, PWR_MODE_ANY), =20 END_UFS_PHY_CFG, }; =20 /* Calibration for HS mode series A/B */ static const struct samsung_ufs_phy_cfg exynosautov9_pre_pwr_hs_cfg[] =3D { - PHY_TRSV_REG_CFG(0x032, 0xbc, PWR_MODE_HS_ANY), - PHY_TRSV_REG_CFG(0x03c, 0x7f, PWR_MODE_HS_ANY), - PHY_TRSV_REG_CFG(0x048, 0xc0, PWR_MODE_HS_ANY), + PHY_TRSV_REG_CFG_AUTOV9(0x032, 0xbc, PWR_MODE_HS_ANY), + PHY_TRSV_REG_CFG_AUTOV9(0x03c, 0x7f, PWR_MODE_HS_ANY), + PHY_TRSV_REG_CFG_AUTOV9(0x048, 0xc0, PWR_MODE_HS_ANY), =20 - PHY_TRSV_REG_CFG(0x04a, 0x00, PWR_MODE_HS_G3_SER_B), - PHY_TRSV_REG_CFG(0x04b, 0x10, PWR_MODE_HS_G1_SER_B | - PWR_MODE_HS_G3_SER_B), - PHY_TRSV_REG_CFG(0x04d, 0x63, PWR_MODE_HS_G3_SER_B), + PHY_TRSV_REG_CFG_AUTOV9(0x04a, 0x00, PWR_MODE_HS_G3_SER_B), + PHY_TRSV_REG_CFG_AUTOV9(0x04b, 0x10, PWR_MODE_HS_G1_SER_B | + PWR_MODE_HS_G3_SER_B), + PHY_TRSV_REG_CFG_AUTOV9(0x04d, 0x63, PWR_MODE_HS_G3_SER_B), =20 END_UFS_PHY_CFG, }; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BBEFC00140 for ; Mon, 15 Aug 2022 21:30:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348234AbiHOVa3 (ORCPT ); Mon, 15 Aug 2022 17:30:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348224AbiHOV1E (ORCPT ); Mon, 15 Aug 2022 17:27:04 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BAF9E97D0; Mon, 15 Aug 2022 12:23:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 5E47BCE12C4; Mon, 15 Aug 2022 19:22:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F708C433D7; Mon, 15 Aug 2022 19:22:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591377; bh=Pb+Su699391mtr7066eQ49nAxJ3tqsKaKrMulCNhQ/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JELQf5TGpBbND2dUNmYbsDsJU+kmcWoMEF/yN5sWefxRCawBCBabnd4kNJysEbBB4 axo+sxKhXPfpEqbZ3fzOm+p3G1rbTuubsR4AmszO9NpKjTviAqKVdSy2FpaX5vrw+L H91NxnpsVEjnaIqaKSTJWW+TRQJ50RYIxb756O7o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Bjorn Helgaas , Rob Herring , Sasha Levin Subject: [PATCH 5.18 0560/1095] PCI: microchip: Fix refcount leak in mc_pcie_init_irq_domains() Date: Mon, 15 Aug 2022 19:59:19 +0200 Message-Id: <20220815180452.738930098@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit f030304fdeb87ec8f1b518c73703214aec6cc24a ] of_get_next_child() returns a node pointer with refcount incremented, so we should use of_node_put() on it when we don't need it anymore. mc_pcie_init_irq_domains() only calls of_node_put() in the normal path, missing it in some error paths. Add missing of_node_put() to avoid refcount leak. Fixes: 6f15a9c9f941 ("PCI: microchip: Add Microchip PolarFire PCIe controll= er driver") Link: https://lore.kernel.org/r/20220605055123.59127-1-linmq006@gmail.com Signed-off-by: Miaoqian Lin Signed-off-by: Bjorn Helgaas Reviewed-by: Rob Herring Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pci/controller/pcie-microchip-host.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/controller/pcie-microchip-host.c b/drivers/pci/con= troller/pcie-microchip-host.c index 2c52a8cef726..932b1c182149 100644 --- a/drivers/pci/controller/pcie-microchip-host.c +++ b/drivers/pci/controller/pcie-microchip-host.c @@ -904,6 +904,7 @@ static int mc_pcie_init_irq_domains(struct mc_pcie *por= t) &event_domain_ops, port); if (!port->event_domain) { dev_err(dev, "failed to get event domain\n"); + of_node_put(pcie_intc_node); return -ENOMEM; } =20 @@ -913,6 +914,7 @@ static int mc_pcie_init_irq_domains(struct mc_pcie *por= t) &intx_domain_ops, port); if (!port->intx_domain) { dev_err(dev, "failed to get an INTx IRQ domain\n"); + of_node_put(pcie_intc_node); return -ENOMEM; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F040EC00140 for ; Mon, 15 Aug 2022 21:30:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345140AbiHOVaY (ORCPT ); Mon, 15 Aug 2022 17:30:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348227AbiHOV1E (ORCPT ); Mon, 15 Aug 2022 17:27:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A074E9A9F; Mon, 15 Aug 2022 12:23:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 29D13B81062; Mon, 15 Aug 2022 19:23:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CCECC433B5; Mon, 15 Aug 2022 19:23:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591380; bh=m5pg8KO/7b40AWDkw1tfUtzdu1cCdSm98iHUIZ9koyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WP+XBHPkrcsQG0HL0xgoUO79XFg3KBE2G9E4ahB1jn83myXElKy0UCGgiJwQ4gZta spch18dcUP+AS7R4fPPjH3O7ttpurMp2o3DBNrSaAmLQXBbAzKyMKsswGBTxjxF9Ud QA6QQq76xkVATZ5lku89LDlIZV6uaGbi07Hftx4E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Bjorn Helgaas , Vidya Sagar , Sasha Levin Subject: [PATCH 5.18 0561/1095] PCI: tegra194: Fix PM error handling in tegra_pcie_config_ep() Date: Mon, 15 Aug 2022 19:59:20 +0200 Message-Id: <20220815180452.779643101@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit e8fbd344a5ea62663554b8546b6bf9f88b93785a ] pm_runtime_enable() will increase power disable depth. If dw_pcie_ep_init() fails, we should use pm_runtime_disable() to balance it with pm_runtime_enable(). Add missing pm_runtime_disable() for tegra_pcie_config_ep(). Fixes: c57247f940e8 ("PCI: tegra: Add support for PCIe endpoint mode in Teg= ra194") Link: https://lore.kernel.org/r/20220602031910.55859-1-linmq006@gmail.com Signed-off-by: Miaoqian Lin Signed-off-by: Bjorn Helgaas Reviewed-by: Vidya Sagar Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-tegra194.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/contr= oller/dwc/pcie-tegra194.c index b1b5f836a806..0888c3726414 100644 --- a/drivers/pci/controller/dwc/pcie-tegra194.c +++ b/drivers/pci/controller/dwc/pcie-tegra194.c @@ -1951,6 +1951,7 @@ static int tegra_pcie_config_ep(struct tegra194_pcie = *pcie, if (ret) { dev_err(dev, "Failed to initialize DWC Endpoint subsystem: %d\n", ret); + pm_runtime_disable(dev); return ret; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FC38C00140 for ; Mon, 15 Aug 2022 21:32:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348250AbiHOVad (ORCPT ); Mon, 15 Aug 2022 17:30:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348246AbiHOV1F (ORCPT ); Mon, 15 Aug 2022 17:27:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3177BE9AB1; Mon, 15 Aug 2022 12:23:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8132B60BB7; Mon, 15 Aug 2022 19:23:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85430C433D7; Mon, 15 Aug 2022 19:23:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591383; bh=aZcGBsdZmldfbvVLdPKlPrR+pTlUOeweKXXlUsFE84I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JRSem1gtv+6H32Nq2jUiJNdglRzplsJkUWjDmJVNbCdp1c6oZrXfiUn8JDhcx+lDg 8uicvZGEURyp0wdDUgZqIGDFbbFj7988a0v1zOaWr/FU3Fnh+cWP5KSdnPJGVfcRt0 7K6SRpAhxVB8XXgC54YMeKUBWOy9VhV3twHHw+kA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harshit Mogalapalli , Jiri Kosina , Sasha Levin Subject: [PATCH 5.18 0562/1095] HID: cp2112: prevent a buffer overflow in cp2112_xfer() Date: Mon, 15 Aug 2022 19:59:21 +0200 Message-Id: <20220815180452.823221007@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Harshit Mogalapalli [ Upstream commit 381583845d19cb4bd21c8193449385f3fefa9caf ] Smatch warnings: drivers/hid/hid-cp2112.c:793 cp2112_xfer() error: __memcpy() 'data->block[1]' too small (33 vs 255) drivers/hid/hid-cp2112.c:793 cp2112_xfer() error: __memcpy() 'buf' too small (64 vs 255) The 'read_length' variable is provided by 'data->block[0]' which comes from user and it(read_length) can take a value between 0-255. Add an upper bound to 'read_length' variable to prevent a buffer overflow in memcpy(). Fixes: 542134c0375b ("HID: cp2112: Fix I2C_BLOCK_DATA transactions") Signed-off-by: Harshit Mogalapalli Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hid/hid-cp2112.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index ece147d1a278..1e16b0fa310d 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -790,6 +790,11 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 a= ddr, data->word =3D le16_to_cpup((__le16 *)buf); break; case I2C_SMBUS_I2C_BLOCK_DATA: + if (read_length > I2C_SMBUS_BLOCK_MAX) { + ret =3D -EINVAL; + goto power_normal; + } + memcpy(data->block + 1, buf, read_length); break; case I2C_SMBUS_BLOCK_DATA: --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1083DC25B0E for ; Mon, 15 Aug 2022 21:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348272AbiHOVak (ORCPT ); Mon, 15 Aug 2022 17:30:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348329AbiHOV1Y (ORCPT ); Mon, 15 Aug 2022 17:27:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A354EA324; Mon, 15 Aug 2022 12:23:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3187DB81062; Mon, 15 Aug 2022 19:23:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 824B1C433D6; Mon, 15 Aug 2022 19:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591387; bh=zUlcBjt3sYFgyUmwRf5ZWSN61dwFobVQH7Z7LAAaPPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ajCrbkyCkebLitKvF2uIQwhymYfOHHnSgWP9prmWan0oesT3sZMgWTCqbECl3EK1R 6PfiPMO+YBMyh2C1XZknbfVO0cNJ9CPS+GUrvzzK9gr7AP6n53iYEsexiLJJwF2ZdA +pfV9AIH9LJe8rl6xKXWr0QBd0K1thDj4iPHStf8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Duoming Zhou , Miquel Raynal , Sasha Levin Subject: [PATCH 5.18 0563/1095] mtd: sm_ftl: Fix deadlock caused by cancel_work_sync in sm_release Date: Mon, 15 Aug 2022 19:59:22 +0200 Message-Id: <20220815180452.858633452@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Duoming Zhou [ Upstream commit a61528d997619a518ee8c51cf0ef0513021afaff ] There is a deadlock between sm_release and sm_cache_flush_work which is a work item. The cancel_work_sync in sm_release will not return until sm_cache_flush_work is finished. If we hold mutex_lock and use cancel_work_sync to wait the work item to finish, the work item also requires mutex_lock. As a result, the sm_release will be blocked forever. The race condition is shown below: (Thread 1) | (Thread 2) sm_release | mutex_lock(&ftl->mutex) | sm_cache_flush_work | mutex_lock(&ftl->mutex) cancel_work_sync | ... This patch moves del_timer_sync and cancel_work_sync out of mutex_lock in order to mitigate deadlock. Fixes: 7d17c02a01a1 ("mtd: Add new SmartMedia/xD FTL") Signed-off-by: Duoming Zhou Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220524044841.10517-1-duoming@zju.= edu.cn Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mtd/sm_ftl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c index 0cff2cda1b5a..7f955fade838 100644 --- a/drivers/mtd/sm_ftl.c +++ b/drivers/mtd/sm_ftl.c @@ -1111,9 +1111,9 @@ static void sm_release(struct mtd_blktrans_dev *dev) { struct sm_ftl *ftl =3D dev->priv; =20 - mutex_lock(&ftl->mutex); del_timer_sync(&ftl->timer); cancel_work_sync(&ftl->flush_work); + mutex_lock(&ftl->mutex); sm_cache_flush(ftl); mutex_unlock(&ftl->mutex); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3421BC25B08 for ; Mon, 15 Aug 2022 21:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348333AbiHOVat (ORCPT ); Mon, 15 Aug 2022 17:30:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348376AbiHOV1b (ORCPT ); Mon, 15 Aug 2022 17:27:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79C56EA33C; Mon, 15 Aug 2022 12:23:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 97A2B60EF0; Mon, 15 Aug 2022 19:23:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89924C433D6; Mon, 15 Aug 2022 19:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591393; bh=NsVV9z4D0is7Au0wRGSembh84gMxq1mQKQCq5GKTZn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vLkqxHySpZXhSF7J/uSz1o+XMEhuHpZyiEoZKreeq6H4a8jQhhDSCyiCf9+pC3Ibx pNMdZOOAaI+SS2bs26xB7lD3bKOhVuwkKuWTDc05MJjkooO8hoydPk83HDrOatV8Wk 7l75DUL+l7GtaWN0a7CQOnBEaBWFn0to2DTrMBMA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Linus Walleij , Miquel Raynal , Sasha Levin Subject: [PATCH 5.18 0564/1095] mtd: partitions: Fix refcount leak in parse_redboot_of Date: Mon, 15 Aug 2022 19:59:23 +0200 Message-Id: <20220815180452.900950659@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 9f7e62815cf3cbbcb1b8cb21649fb4dfdb3aa016 ] of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 237960880960 ("mtd: partitions: redboot: seek fis-index-block in the= right node") Signed-off-by: Miaoqian Lin Reviewed-by: Linus Walleij Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220526110652.64849-1-linmq006@gma= il.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mtd/parsers/redboot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/parsers/redboot.c b/drivers/mtd/parsers/redboot.c index feb44a573d44..a16b42a88581 100644 --- a/drivers/mtd/parsers/redboot.c +++ b/drivers/mtd/parsers/redboot.c @@ -58,6 +58,7 @@ static void parse_redboot_of(struct mtd_info *master) return; =20 ret =3D of_property_read_u32(npart, "fis-index-block", &dirblock); + of_node_put(npart); if (ret) return; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53C14C282E7 for ; Mon, 15 Aug 2022 21:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348355AbiHOVa6 (ORCPT ); Mon, 15 Aug 2022 17:30:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348398AbiHOV1f (ORCPT ); Mon, 15 Aug 2022 17:27:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84F5FEA88C; Mon, 15 Aug 2022 12:23:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B3BDB61024; Mon, 15 Aug 2022 19:23:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4B3EC433D6; Mon, 15 Aug 2022 19:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591396; bh=9u+RPsdKAXeHUNT7S87LWCUibPX9fT0Xx0jOa0D91Us=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xIhGaBIDFH+ZC1M/H8B4/FFDdwzrU2MgKJ6brG7PWgY6VsRN5qa5eMNrqELRDaHsH sJ3ANpsUeCCWW5gPfJwfwPPLc6cx1WNBrM8cAAsvjEUvyTV3gni2rKfLyV87x8zkWf O3fWsYPNpvP/4AZbMJ2cD5TtA2K0MYLEyjfQ1vqI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Miquel Raynal , Sasha Levin Subject: [PATCH 5.18 0565/1095] mtd: parsers: ofpart: Fix refcount leak in bcm4908_partitions_fw_offset Date: Mon, 15 Aug 2022 19:59:24 +0200 Message-Id: <20220815180452.949493279@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit e607879b0da18c451de5e91daf239cc2f2f8ff2d ] of_find_node_by_path() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: bb17230c61a6 ("mtd: parsers: ofpart: support BCM4908 fixed partition= s") Signed-off-by: Miaoqian Lin Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220605070726.5979-1-linmq006@gmai= l.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mtd/parsers/ofpart_bcm4908.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/parsers/ofpart_bcm4908.c b/drivers/mtd/parsers/ofp= art_bcm4908.c index 0eddef4c198e..bb072a0940e4 100644 --- a/drivers/mtd/parsers/ofpart_bcm4908.c +++ b/drivers/mtd/parsers/ofpart_bcm4908.c @@ -35,12 +35,15 @@ static long long bcm4908_partitions_fw_offset(void) err =3D kstrtoul(s + len + 1, 0, &offset); if (err) { pr_err("failed to parse %s\n", s + len + 1); + of_node_put(root); return err; } =20 + of_node_put(root); return offset << 10; } =20 + of_node_put(root); return -ENOENT; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 785C3C28B2B for ; Mon, 15 Aug 2022 21:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348412AbiHOVbI (ORCPT ); Mon, 15 Aug 2022 17:31:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348435AbiHOV1j (ORCPT ); Mon, 15 Aug 2022 17:27:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D5E5EA8A9; Mon, 15 Aug 2022 12:23:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 648FEB80FD3; Mon, 15 Aug 2022 19:23:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6A5DC433C1; Mon, 15 Aug 2022 19:23:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591399; bh=CXgv/mwnDeY7ZKskEA+lAuZOc1xXfXxQx4KsFMlI+pU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AB8m6qY01CfEzQMHJyY9zMvkc4vIMEiH86Nze/ACgOWgk/ZEdYpz57+uY92FXI8w2 vewymdgCYGxDWjuIYFTPTHteNFtwVVp86gDeYoLklraIw3kB23oZ1M6RpFvZzPD8Z7 vp66Z7fzer45rjZ3etFHVJJuSthDivumOobkXrSo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Miquel Raynal , Sasha Levin Subject: [PATCH 5.18 0566/1095] mtd: st_spi_fsm: Add a clk_disable_unprepare() in .probe()s error path Date: Mon, 15 Aug 2022 19:59:25 +0200 Message-Id: <20220815180452.988843466@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 28607b426c3d050714f250d0faeb99d2e9106e90 ] For all but one error path clk_disable_unprepare() is already there. Add it to the one location where it's missing. Fixes: 481815a6193b ("mtd: st_spi_fsm: Handle clk_prepare_enable/clk_disabl= e_unprepare.") Fixes: 69d5af8d016c ("mtd: st_spi_fsm: Obtain and use EMI clock") Signed-off-by: Uwe Kleine-K=C3=B6nig Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220607152458.232847-2-u.kleine-ko= enig@pengutronix.de Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mtd/devices/st_spi_fsm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_= fsm.c index 983999c020d6..48bda2dd1bb5 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -2115,10 +2115,12 @@ static int stfsm_probe(struct platform_device *pdev) (long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20), fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10)); =20 - return mtd_device_register(&fsm->mtd, NULL, 0); - + ret =3D mtd_device_register(&fsm->mtd, NULL, 0); + if (ret) { err_clk_unprepare: - clk_disable_unprepare(fsm->clk); + clk_disable_unprepare(fsm->clk); + } + return ret; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A4A6C28B2C for ; Mon, 15 Aug 2022 21:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348385AbiHOVbE (ORCPT ); Mon, 15 Aug 2022 17:31:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348439AbiHOV1k (ORCPT ); Mon, 15 Aug 2022 17:27:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38709EA8AA; Mon, 15 Aug 2022 12:23:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C0FC060FBE; Mon, 15 Aug 2022 19:23:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B90B1C433C1; Mon, 15 Aug 2022 19:23:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591402; bh=UA4CGN5pQUGKiJSR+n6oMVNpzJodTwCIgeiovrvABLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=InHLUGGuCBic7HKAYQkqdiaYcotMgw9+Be8unnPR5XWdq6pgpl6bmGLq6wAuYX7fx jPgTKQh2mjcs4jIB0Rfc05ijRM8ywC6+iLpsEqJtgQkKcBdF6eDsMd7WgB3fPvIiJY NA/yz+ynCRX8wGEnkQcNSQs23ZWvV2YJVtkP/CMo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Bjorn Helgaas , Miles Chen , Jianjun Wang , Sasha Levin Subject: [PATCH 5.18 0567/1095] PCI: mediatek-gen3: Fix refcount leak in mtk_pcie_init_irq_domains() Date: Mon, 15 Aug 2022 19:59:26 +0200 Message-Id: <20220815180453.036262195@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit bf038503d5fe90189743124233fe7aeb0984e961 ] of_get_child_by_name() returns a node pointer with refcount incremented, so we should use of_node_put() on it when we don't need it anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 814cceebba9b ("PCI: mediatek-gen3: Add INTx support") Link: https://lore.kernel.org/r/20220601041259.56185-1-linmq006@gmail.com Signed-off-by: Miaoqian Lin Signed-off-by: Bjorn Helgaas Reviewed-by: Miles Chen Acked-by: Jianjun Wang Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pci/controller/pcie-mediatek-gen3.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/cont= roller/pcie-mediatek-gen3.c index 5d9fd36b02d1..a02c466a597c 100644 --- a/drivers/pci/controller/pcie-mediatek-gen3.c +++ b/drivers/pci/controller/pcie-mediatek-gen3.c @@ -600,7 +600,8 @@ static int mtk_pcie_init_irq_domains(struct mtk_gen3_pc= ie *pcie) &intx_domain_ops, pcie); if (!pcie->intx_domain) { dev_err(dev, "failed to create INTx IRQ domain\n"); - return -ENODEV; + ret =3D -ENODEV; + goto out_put_node; } =20 /* Setup MSI */ @@ -623,13 +624,15 @@ static int mtk_pcie_init_irq_domains(struct mtk_gen3_= pcie *pcie) goto err_msi_domain; } =20 + of_node_put(intc_node); return 0; =20 err_msi_domain: irq_domain_remove(pcie->msi_bottom_domain); err_msi_bottom_domain: irq_domain_remove(pcie->intx_domain); - +out_put_node: + of_node_put(intc_node); return ret; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EDECC25B08 for ; Mon, 15 Aug 2022 21:32:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347092AbiHOVcO (ORCPT ); Mon, 15 Aug 2022 17:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348462AbiHOV1n (ORCPT ); Mon, 15 Aug 2022 17:27:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16831EA8B9; Mon, 15 Aug 2022 12:23:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 82868B81128; Mon, 15 Aug 2022 19:23:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0284C433C1; Mon, 15 Aug 2022 19:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591405; bh=k7nHqZv4WUM/Gzvi9+9Lkzl3Yklu7UNR2pB54Dnes3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q8l2wOn4yIIzEAY8UtN2PqQbC7OetImMlwMkdAj73A7F6ntk8ta5E3yh+vuROUxY9 ID4jaT5UrqfPwN/a1M0/sBnTh834A6KkwB4ypSab5EbKbDvhHF5atdDLWBa2OwXOiZ s4a6M70h00fU00k7NG2o2o+y6lU1ZYpG40BMuOwU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , Xu Yilun , Marco Pagani , Sasha Levin Subject: [PATCH 5.18 0568/1095] fpga: altera-pr-ip: fix unsigned comparison with less than zero Date: Mon, 15 Aug 2022 19:59:27 +0200 Message-Id: <20220815180453.069129334@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marco Pagani [ Upstream commit 2df84a757d87fd62869fc401119d429735377ec5 ] Fix the "comparison with less than zero" warning reported by cppcheck for the unsigned (size_t) parameter count of the alt_pr_fpga_write() function. Fixes: d201cc17a8a3 ("fpga pr ip: Core driver support for Altera Partial Re= configuration IP") Reviewed-by: Tom Rix Acked-by: Xu Yilun Signed-off-by: Marco Pagani Link: https://lore.kernel.org/r/20220609140520.42662-1-marpagan@redhat.com Signed-off-by: Xu Yilun Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/fpga/altera-pr-ip-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/fpga/altera-pr-ip-core.c b/drivers/fpga/altera-pr-ip-c= ore.c index be0667968d33..df8671af4a92 100644 --- a/drivers/fpga/altera-pr-ip-core.c +++ b/drivers/fpga/altera-pr-ip-core.c @@ -108,7 +108,7 @@ static int alt_pr_fpga_write(struct fpga_manager *mgr, = const char *buf, u32 *buffer_32 =3D (u32 *)buf; size_t i =3D 0; =20 - if (count <=3D 0) + if (!count) return -EINVAL; =20 /* Write out the complete 32-bit chunks */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96051C00140 for ; Mon, 15 Aug 2022 21:32:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347570AbiHOVcU (ORCPT ); Mon, 15 Aug 2022 17:32:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348463AbiHOV1n (ORCPT ); Mon, 15 Aug 2022 17:27:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45AF2EC4C0; Mon, 15 Aug 2022 12:23:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C710A60EF0; Mon, 15 Aug 2022 19:23:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFD87C433C1; Mon, 15 Aug 2022 19:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591408; bh=0e2tt6DrrV1ZWC1oY7l9p4t3b8AMy0FXCj2qQ2cAlz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ii5G+EpaBg00VE53QV1OwmgC3qGddOo+wQQOofz11SOn6Gf1DPeSdlhipYMG+kg/V NNVCZsdwrtd/ajte/wSF2T687j/TtAcC0iNnaANZHMnIChETpzQJSOiVU8GUFHsPEY TNI+WYTLL+n21i5vqDvrlRxuvBXQCHt2Pf8coyV8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Miaoqian Lin , Sasha Levin Subject: [PATCH 5.18 0569/1095] usb: host: Fix refcount leak in ehci_hcd_ppc_of_probe Date: Mon, 15 Aug 2022 19:59:28 +0200 Message-Id: <20220815180453.109474821@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit b5c5b13cb45e2c88181308186b0001992cb41954 ] of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes: 796bcae7361c ("USB: powerpc: Workaround for the PPC440EPX USBH_23 er= rata [take 3]") Acked-by: Alan Stern Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220602110849.58549-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/host/ehci-ppc-of.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c index 6bbaee74f7e7..28a19693c19f 100644 --- a/drivers/usb/host/ehci-ppc-of.c +++ b/drivers/usb/host/ehci-ppc-of.c @@ -148,6 +148,7 @@ static int ehci_hcd_ppc_of_probe(struct platform_device= *op) } else { ehci->has_amcc_usb23 =3D 1; } + of_node_put(np); } =20 if (of_get_property(dn, "big-endian", NULL)) { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25308C00140 for ; Mon, 15 Aug 2022 21:32:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347239AbiHOVcR (ORCPT ); Mon, 15 Aug 2022 17:32:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348474AbiHOV1o (ORCPT ); Mon, 15 Aug 2022 17:27:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CD46EC4C7; Mon, 15 Aug 2022 12:23:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B87E86101B; Mon, 15 Aug 2022 19:23:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1909C433D7; Mon, 15 Aug 2022 19:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591411; bh=bzFVUVkb0hL4tUDIprYYW0i2vps8384MfZ5C8L4/c+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aOekDM7aOAVlILWPkysSQvJt6dvv063N+1FnbxqSolX80fzx5RSQhE6/VtwWEeiRk bDSmn2UPfjQUgRqh8W1bkAx3Tf3lnyrFMhCswS7vXF6tw5KE+bNqcTXDjo5/6xvrgF pO2G+VLPGO30tooUz8m8NZOSzwlJZwV+EFF/S9L0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Miaoqian Lin , Sasha Levin Subject: [PATCH 5.18 0570/1095] usb: ohci-nxp: Fix refcount leak in ohci_hcd_nxp_probe Date: Mon, 15 Aug 2022 19:59:29 +0200 Message-Id: <20220815180453.148853677@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 302970b4cad3ebfda2c05ce06c322ccdc447d17e ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 73108aa90cbf ("USB: ohci-nxp: Use isp1301 driver") Acked-by: Alan Stern Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220603141231.979-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/host/ohci-nxp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c index 85878e8ad331..106a6bcefb08 100644 --- a/drivers/usb/host/ohci-nxp.c +++ b/drivers/usb/host/ohci-nxp.c @@ -164,6 +164,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *p= dev) } =20 isp1301_i2c_client =3D isp1301_get_client(isp1301_node); + of_node_put(isp1301_node); if (!isp1301_i2c_client) return -EPROBE_DEFER; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04E51C00140 for ; Mon, 15 Aug 2022 21:32:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347849AbiHOVc2 (ORCPT ); Mon, 15 Aug 2022 17:32:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348485AbiHOV1p (ORCPT ); Mon, 15 Aug 2022 17:27:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01A97EC4C4; Mon, 15 Aug 2022 12:23:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 89A2CB81062; Mon, 15 Aug 2022 19:23:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3957C433D7; Mon, 15 Aug 2022 19:23:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591414; bh=KrALzRffdPJpjtELaG5nbdJTzrNEz8nRkpzXogTmmmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q0j2qFL9WYEfRo/iuotjzKPbl9VeQiKHGjODvER6dmveHTJfM126mPna3LZB44/FN ByeXFLEmcIKZhAmnNh8v2CGf3N7VTVmVG856plhBCPvJt3polrdV9tSxuKVCrfp6FM 2afI47ubFmEWQWFCiihRh1KvqNW41nGRvjKM4Cic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tang Bin , Sasha Levin Subject: [PATCH 5.18 0571/1095] usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init() Date: Mon, 15 Aug 2022 19:59:30 +0200 Message-Id: <20220815180453.188394102@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tang Bin [ Upstream commit f08aa7c80dac27ee00fa6827f447597d2fba5465 ] dev_pm_domain_attach_by_name() may return NULL in some cases, so IS_ERR() doesn't meet the requirements. Thus fix it. Fixes: 49db427232fe ("usb: gadget: Add UDC driver for tegra XUSB device mod= e controller") Signed-off-by: Tang Bin Link: https://lore.kernel.org/r/20220525135332.23144-1-tangbin@cmss.chinamo= bile.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/gadget/udc/tegra-xudc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/t= egra-xudc.c index d9c406bdb680..c25765628625 100644 --- a/drivers/usb/gadget/udc/tegra-xudc.c +++ b/drivers/usb/gadget/udc/tegra-xudc.c @@ -3691,15 +3691,15 @@ static int tegra_xudc_powerdomain_init(struct tegra= _xudc *xudc) int err; =20 xudc->genpd_dev_device =3D dev_pm_domain_attach_by_name(dev, "dev"); - if (IS_ERR(xudc->genpd_dev_device)) { - err =3D PTR_ERR(xudc->genpd_dev_device); + if (IS_ERR_OR_NULL(xudc->genpd_dev_device)) { + err =3D PTR_ERR(xudc->genpd_dev_device) ? : -ENODATA; dev_err(dev, "failed to get device power domain: %d\n", err); return err; } =20 xudc->genpd_dev_ss =3D dev_pm_domain_attach_by_name(dev, "ss"); - if (IS_ERR(xudc->genpd_dev_ss)) { - err =3D PTR_ERR(xudc->genpd_dev_ss); + if (IS_ERR_OR_NULL(xudc->genpd_dev_ss)) { + err =3D PTR_ERR(xudc->genpd_dev_ss) ? : -ENODATA; dev_err(dev, "failed to get SuperSpeed power domain: %d\n", err); return err; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4523AC00140 for ; Mon, 15 Aug 2022 21:32:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348062AbiHOVce (ORCPT ); Mon, 15 Aug 2022 17:32:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348500AbiHOV1r (ORCPT ); Mon, 15 Aug 2022 17:27:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56EB932EFD; Mon, 15 Aug 2022 12:23:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C9CEBB80FD3; Mon, 15 Aug 2022 19:23:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A66CC433D6; Mon, 15 Aug 2022 19:23:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591417; bh=2iiww0YZVx3IsAfXGgFTGknilWMD0Hkj0gj15HbjlMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NHwasjgURY70yICkhNdDzhc3Www5Cj78gjnPagV9DotDsROf9kOiZLmjQdZHOeVvs wwNBb8EfVFUBpZiFwOFcHOEwnUFJZNXWlwtb82/ipFQxLdhp+c2dGGDCOTYj9DneJ6 P7jMVqtY7/D5Rmlz5/CE3ZQo30RpI2PY+R1iWRCY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tang Bin , Sasha Levin Subject: [PATCH 5.18 0572/1095] usb: xhci: tegra: Fix error check Date: Mon, 15 Aug 2022 19:59:31 +0200 Message-Id: <20220815180453.227559450@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tang Bin [ Upstream commit 18fc7c435be3f17ea26a21b2e2312fcb9088e01f ] In the function tegra_xusb_powerdomain_init(), dev_pm_domain_attach_by_name() may return NULL in some cases, so IS_ERR() doesn't meet the requirements. Thus fix it. Fixes: 6494a9ad86de ("usb: xhci: tegra: Add genpd support") Signed-off-by: Tang Bin Link: https://lore.kernel.org/r/20220524121404.18376-1-tangbin@cmss.chinamo= bile.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/host/xhci-tegra.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c index 996958a6565c..bdb776553826 100644 --- a/drivers/usb/host/xhci-tegra.c +++ b/drivers/usb/host/xhci-tegra.c @@ -1010,15 +1010,15 @@ static int tegra_xusb_powerdomain_init(struct devic= e *dev, int err; =20 tegra->genpd_dev_host =3D dev_pm_domain_attach_by_name(dev, "xusb_host"); - if (IS_ERR(tegra->genpd_dev_host)) { - err =3D PTR_ERR(tegra->genpd_dev_host); + if (IS_ERR_OR_NULL(tegra->genpd_dev_host)) { + err =3D PTR_ERR(tegra->genpd_dev_host) ? : -ENODATA; dev_err(dev, "failed to get host pm-domain: %d\n", err); return err; } =20 tegra->genpd_dev_ss =3D dev_pm_domain_attach_by_name(dev, "xusb_ss"); - if (IS_ERR(tegra->genpd_dev_ss)) { - err =3D PTR_ERR(tegra->genpd_dev_ss); + if (IS_ERR_OR_NULL(tegra->genpd_dev_ss)) { + err =3D PTR_ERR(tegra->genpd_dev_ss) ? : -ENODATA; dev_err(dev, "failed to get superspeed pm-domain: %d\n", err); return err; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9077C00140 for ; Mon, 15 Aug 2022 21:32:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348145AbiHOVch (ORCPT ); Mon, 15 Aug 2022 17:32:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348503AbiHOV1r (ORCPT ); Mon, 15 Aug 2022 17:27:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B59FEEC4E2; Mon, 15 Aug 2022 12:23:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 120F460EF0; Mon, 15 Aug 2022 19:23:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CF02C433C1; Mon, 15 Aug 2022 19:23:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591420; bh=nm4OJZwJEZv1pIUYaeMBoUGeJreDgEESneK9E8E3b3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qUnkrXSq9E0Hw5bgyEj23LQ+iRQyJeDrEyzZ5CZ9s8TrPNn6bM6LT7K797U0WuHJ9 4kwRNfa0G8Gzq7tv+aQHlRb59wuSSFMIVJJM/j7bRpu9mDLMdZipq6BJPcFKK16zXC +E0fKSbcMznCXjsoam+fHUrhrxU/I0ooyBX5XB4M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manoj Basapathi , Subash Abhinov Kasiviswanathan , Pablo Neira Ayuso , netfilter-devel@vger.kernel.org, Thomas Gleixner , Sasha Levin Subject: [PATCH 5.18 0573/1095] netfilter: xtables: Bring SPDX identifier back Date: Mon, 15 Aug 2022 19:59:32 +0200 Message-Id: <20220815180453.266523720@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner [ Upstream commit 20646f5b1e798bcc20044ae90ac3702f177bf254 ] Commit e2be04c7f995 ("License cleanup: add SPDX license identifier to uapi header files with a license") added the correct SPDX identifier to include/uapi/linux/netfilter/xt_IDLETIMER.h. A subsequent commit removed it for no reason and reintroduced the UAPI license incorrectness as the file is now missing the UAPI exception again. Add it back and remove the GPLv2 boilerplate while at it. Fixes: 68983a354a65 ("netfilter: xtables: Add snapshot of hardidletimer tar= get") Cc: Manoj Basapathi Cc: Subash Abhinov Kasiviswanathan Cc: Pablo Neira Ayuso Cc: netfilter-devel@vger.kernel.org Signed-off-by: Thomas Gleixner Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/uapi/linux/netfilter/xt_IDLETIMER.h | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/include/uapi/linux/netfilter/xt_IDLETIMER.h b/include/uapi/lin= ux/netfilter/xt_IDLETIMER.h index 49ddcdc61c09..7bfb31a66fc9 100644 --- a/include/uapi/linux/netfilter/xt_IDLETIMER.h +++ b/include/uapi/linux/netfilter/xt_IDLETIMER.h @@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ /* - * linux/include/linux/netfilter/xt_IDLETIMER.h - * * Header file for Xtables timer target module. * * Copyright (C) 2004, 2010 Nokia Corporation @@ -10,20 +9,6 @@ * by Luciano Coelho * * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA */ =20 #ifndef _XT_IDLETIMER_H --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F955C00140 for ; Mon, 15 Aug 2022 21:32:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348206AbiHOVcw (ORCPT ); Mon, 15 Aug 2022 17:32:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348540AbiHOV1w (ORCPT ); Mon, 15 Aug 2022 17:27:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F01AEC4FD; Mon, 15 Aug 2022 12:23:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E5D41B810C6; Mon, 15 Aug 2022 19:23:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3405AC433D6; Mon, 15 Aug 2022 19:23:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591426; bh=h8Q516GPAhcvv277OwVBGuM0KfIRuOS34O8QA4RBpXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hK8MHP89RbMbWBGdfCFRNiwk3WYuYNArG6vO+nHWqR5s/uA7cuHCxUghIs/YgJJXB oZv/WygMUIC/AQovMtljLi0h+6C8emIock+FBSbZFPmzVMurW7cWHuiiZEd5ntwI37 EQKW088/ml43OgKn6UE0TnIi8zY7RS5u8BlVMpsU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0574/1095] scsi: qla2xxx: edif: Send LOGO for unexpected IKE message Date: Mon, 15 Aug 2022 19:59:33 +0200 Message-Id: <20220815180453.309795070@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 2b659ed67a12f39f56d8dcad9b5d5a74d67c01b3 ] If the session is down and the local port continues to receive AUTH ELS messages, the driver needs to send back LOGO so that the remote device knows to tear down its session. Terminate and clean up the AUTH ELS exchange followed by a passthrough LOGO. Link: https://lore.kernel.org/r/20220608115849.16693-3-njavali@marvell.com Fixes: 225479296c4f ("scsi: qla2xxx: edif: Reject AUTH ELS on session down") Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 19 +++++++++++++++++-- drivers/scsi/qla2xxx/qla_fw.h | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index c17e177864d3..0ead3d95f594 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -2644,8 +2644,7 @@ void qla24xx_auth_els(scsi_qla_host_t *vha, void **pk= t, struct rsp_que **rsp) =20 fcport =3D qla2x00_find_fcport_by_pid(host, &purex->pur_info.pur_sid); =20 - if (DBELL_INACTIVE(vha) || - (fcport && EDIF_SESSION_DOWN(fcport))) { + if (DBELL_INACTIVE(vha)) { ql_dbg(ql_dbg_edif, host, 0x0910c, "%s e_dbell.db_flags =3D%x %06x\n", __func__, host->e_dbell.db_flags, fcport ? fcport->d_id.b24 : 0); @@ -2655,6 +2654,22 @@ void qla24xx_auth_els(scsi_qla_host_t *vha, void **p= kt, struct rsp_que **rsp) return; } =20 + if (fcport && EDIF_SESSION_DOWN(fcport)) { + ql_dbg(ql_dbg_edif, host, 0x13b6, + "%s terminate exchange. Send logo to 0x%x\n", + __func__, a.did.b24); + + a.tx_byte_count =3D a.tx_len =3D 0; + a.tx_addr =3D 0; + a.control_flags =3D EPD_RX_XCHG; /* EPD_RX_XCHG =3D terminate cmd */ + qla_els_reject_iocb(host, (*rsp)->qpair, &a); + qla_enode_free(host, ptr); + /* send logo to let remote port knows to tear down session */ + fcport->send_els_logo =3D 1; + qlt_schedule_sess_for_deletion(fcport); + return; + } + /* add the local enode to the list */ qla_enode_add(host, ptr); =20 diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h index 0bb1d562f0bf..361015b5763e 100644 --- a/drivers/scsi/qla2xxx/qla_fw.h +++ b/drivers/scsi/qla2xxx/qla_fw.h @@ -807,7 +807,7 @@ struct els_entry_24xx { #define EPD_ELS_COMMAND (0 << 13) #define EPD_ELS_ACC (1 << 13) #define EPD_ELS_RJT (2 << 13) -#define EPD_RX_XCHG (3 << 13) +#define EPD_RX_XCHG (3 << 13) /* terminate exchange */ #define ECF_CLR_PASSTHRU_PEND BIT_12 #define ECF_INCL_FRAME_HDR BIT_11 #define ECF_SEC_LOGIN BIT_3 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30D30C00140 for ; Mon, 15 Aug 2022 21:32:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348316AbiHOVcy (ORCPT ); Mon, 15 Aug 2022 17:32:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348548AbiHOV1w (ORCPT ); Mon, 15 Aug 2022 17:27:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54AB6ED00C; Mon, 15 Aug 2022 12:23:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 681B960693; Mon, 15 Aug 2022 19:23:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 508BAC433D6; Mon, 15 Aug 2022 19:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591429; bh=BXbrf2VsO7sCBorUn5KdpawL5FlbDVwfKdOkkWueWDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QsW2e1laMga6zo0+sLtQpmgwQTUHEbxN47QZf5/02/6iQJndfTx8Gur9nT5krmXCB 5BaT7OxjoFm+jC/Je0ZKlTemmagT2uyh7Bi/x7O7Bcwvy8qWmSH9GBbgcbMtP8NVks Ss3iqzqobe2cS+IhoNTOuqxOoJqk1rYIqjqWUQec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0575/1095] scsi: qla2xxx: edif: Reduce disruption due to multiple app start Date: Mon, 15 Aug 2022 19:59:34 +0200 Message-Id: <20220815180453.352026999@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 0dbfce5255fe8d069a1a3b712a25b263264cfa58 ] Multiple app start can trigger a session bounce. Make driver skip over session teardown if app start is seen more than once. Link: https://lore.kernel.org/r/20220608115849.16693-4-njavali@marvell.com Fixes: 7ebb336e45ef ("scsi: qla2xxx: edif: Add start + stop bsgs") Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index 0ead3d95f594..208a16cb54f0 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -510,8 +510,7 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job= *bsg_job) /* mark doorbell as active since an app is now present */ vha->e_dbell.db_flags |=3D EDB_ACTIVE; } else { - ql_dbg(ql_dbg_edif, vha, 0x911e, "%s doorbell already active\n", - __func__); + goto out; } =20 if (N2N_TOPO(vha->hw)) { @@ -578,6 +577,7 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job= *bsg_job) __func__); } =20 +out: appreply.host_support_edif =3D vha->hw->flags.edif_enabled; appreply.edif_enode_active =3D vha->pur_cinfo.enode_flags; appreply.edif_edb_active =3D vha->e_dbell.db_flags; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46518C00140 for ; Mon, 15 Aug 2022 21:39:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349179AbiHOVjq (ORCPT ); Mon, 15 Aug 2022 17:39:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349069AbiHOVgf (ORCPT ); Mon, 15 Aug 2022 17:36:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77882106; Mon, 15 Aug 2022 12:26:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 17339610A1; Mon, 15 Aug 2022 19:26:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03484C433D6; Mon, 15 Aug 2022 19:26:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591578; bh=90CmysPOl4jxfz6UiU92ZjhnuJQTM2s168P8efW9v3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O5+WZVxpu0cQEikcLu4c5RLS9jTrDgcxbgpi6o+1YASJmfwVwChjh72qNUthcu1OE b8+r8XF6BEAX/pWjoV1IbLq7P61QgVUTJ31QPCTVh/gKhLPBteJv8266/jYchFZSyw xfgMIfa2fK7GxycPhfj2Y3SbokCdaO0T6nOu3V1k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0576/1095] scsi: qla2xxx: edif: Fix no login after app start Date: Mon, 15 Aug 2022 19:59:35 +0200 Message-Id: <20220815180453.398646937@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 24c796098f5395477f7f7ebf8e24f3f08a139f71 ] The scenario is this: User loaded driver but has not started authentication app. All sessions to secure device will exhaust all login attempts, fail, and in stay in deleted state. Then some time later the app is started. The driver will replenish the login retry count, trigger delete to prepare for secure login. After deletion, relogin is triggered. For the session that is already deleted, the delete trigger is a no-op. If none of the sessions trigger a relogin, no progress is made. Add a relogin trigger. Link: https://lore.kernel.org/r/20220608115849.16693-5-njavali@marvell.com Fixes: 7ebb336e45ef ("scsi: qla2xxx: edif: Add start + stop bsgs") Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index 208a16cb54f0..9020cc3c61df 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -567,6 +567,7 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job= *bsg_job) qlt_schedule_sess_for_deletion(fcport); qla_edif_sa_ctl_init(vha, fcport); } + set_bit(RELOGIN_NEEDED, &vha->dpc_flags); } =20 if (vha->pur_cinfo.enode_flags !=3D ENODE_ACTIVE) { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7C43C00140 for ; Mon, 15 Aug 2022 21:33:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348529AbiHOVdd (ORCPT ); Mon, 15 Aug 2022 17:33:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348569AbiHOVbg (ORCPT ); Mon, 15 Aug 2022 17:31:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E954DF0745; Mon, 15 Aug 2022 12:24:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E8AC3610A2; Mon, 15 Aug 2022 19:24:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D027BC433D7; Mon, 15 Aug 2022 19:24:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591452; bh=i8hmpQ53bR+sr3him2AXH2AmyhXku3SVxEQnzBlMJxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=foa4AwPr9KderzW8y2tdRNnWslYsCfUBWEavbUKkaBbE+WCawk5wqEpoSA+lTrGmJ Cdy6bJAvDz+PEmWkDmKbKFUnm5YbjE+rd+KqUvnmzWXfh8BXTwISrh9Cx3/blJFVOb WR3DHE8MH1pCl0FpjFTf5CX2mkFjqRitZrAJoZ10= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0577/1095] scsi: qla2xxx: edif: Tear down session if keys have been removed Date: Mon, 15 Aug 2022 19:59:36 +0200 Message-Id: <20220815180453.443224603@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit d7e2e4a68fc047a025afcd200e6b7e1fbc8b1999 ] If all keys for a session have been deleted, trigger a session teardown. Link: https://lore.kernel.org/r/20220608115849.16693-6-njavali@marvell.com Fixes: dd30706e73b7 ("scsi: qla2xxx: edif: Add key update") Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_def.h | 5 +++++ drivers/scsi/qla2xxx/qla_isr.c | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index c2b92a6fef90..4062d46f33a6 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2158,6 +2158,11 @@ typedef struct { #define CS_IOCB_ERROR 0x31 /* Generic error for IOCB request failure */ #define CS_REJECT_RECEIVED 0x4E /* Reject received */ +#define CS_EDIF_AUTH_ERROR 0x63 /* decrypt error */ +#define CS_EDIF_PAD_LEN_ERROR 0x65 /* pad > frame size, not 4byte align */ +#define CS_EDIF_INV_REQ 0x66 /* invalid request */ +#define CS_EDIF_SPI_ERROR 0x67 /* rx frame unable to locate sa */ +#define CS_EDIF_HDR_ERROR 0x69 /* data frame !=3D expected len */ #define CS_BAD_PAYLOAD 0x80 /* Driver defined */ #define CS_UNKNOWN 0x81 /* Driver defined */ #define CS_RETRY 0x82 /* Driver defined */ diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 5deea6bff09f..ad55eace66aa 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -3424,6 +3424,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp= _que *rsp, void *pkt) case CS_PORT_UNAVAILABLE: case CS_TIMEOUT: case CS_RESET: + case CS_EDIF_INV_REQ: =20 /* * We are going to have the fc class block the rport --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CEE3C282E7 for ; Mon, 15 Aug 2022 21:36:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348361AbiHOVgm (ORCPT ); Mon, 15 Aug 2022 17:36:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241500AbiHOVeI (ORCPT ); Mon, 15 Aug 2022 17:34:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2C1375CED; Mon, 15 Aug 2022 12:24:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2EB4EB81126; Mon, 15 Aug 2022 19:24:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74175C433C1; Mon, 15 Aug 2022 19:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591486; bh=mRN+4lFH/UimAOYwqFZmkEk6HCUaxjjt8ALsrbdobtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yz62bFEzOO50zdGRk7T686/nWQkR5iSODIfZaJ0aLluXq9LDgeGOBWvxLb/YlRX/H p2fD9qFfH1/p6FHaj39gbGLx9Bt3DBt5utXa2ETRw8uNE2Mhg78WbrfYDljc+UE0e/ PZZoV9G2XsE0W2foqj6W7HadOkqyq5NZoNomaEIY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0578/1095] scsi: qla2xxx: edif: Fix session thrash Date: Mon, 15 Aug 2022 19:59:37 +0200 Message-Id: <20220815180453.491081599@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit a8fdfb0b39c2b31722c70bdf2272b949d5af4b7b ] Current code prematurely sends out PRLI before authentication application has given the OK to do so. This causes PRLI failure and session teardown. Prevents PRLI from going out before authentication app gives the OK. Link: https://lore.kernel.org/r/20220608115849.16693-7-njavali@marvell.com Fixes: 91f6f5fbe87b ("scsi: qla2xxx: edif: Reduce connection thrash") Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 2 +- drivers/scsi/qla2xxx/qla_edif.h | 4 ++++ drivers/scsi/qla2xxx/qla_init.c | 10 +++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index 9020cc3c61df..3f886b86d74a 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -3589,7 +3589,7 @@ int qla_edif_process_els(scsi_qla_host_t *vha, struct= bsg_job *bsg_job) if (qla_bsg_check(vha, bsg_job, fcport)) return 0; =20 - if (fcport->loop_id =3D=3D FC_NO_LOOP_ID) { + if (EDIF_SESS_DELETE(fcport)) { ql_dbg(ql_dbg_edif, vha, 0x910d, "%s ELS code %x, no loop id.\n", __func__, bsg_request->rqst_data.r_els.els_code); diff --git a/drivers/scsi/qla2xxx/qla_edif.h b/drivers/scsi/qla2xxx/qla_edi= f.h index 3561e22b8f0f..7cdb89ccdc6e 100644 --- a/drivers/scsi/qla2xxx/qla_edif.h +++ b/drivers/scsi/qla2xxx/qla_edif.h @@ -141,4 +141,8 @@ struct enode { (DBELL_ACTIVE(_fcport->vha) && \ (_fcport->disc_state =3D=3D DSC_LOGIN_AUTH_PEND)) =20 +#define EDIF_SESS_DELETE(_s) \ + (qla_ini_mode_enabled(_s->vha) && (_s->disc_state =3D=3D DSC_DELETE_PEND = || \ + _s->disc_state =3D=3D DSC_DELETED)) + #endif /* __QLA_EDIF_H */ diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_ini= t.c index 177ce45b76a6..7bd10b4ed9ed 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -1762,8 +1762,16 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host= *vha, fc_port_t *fcport) break; =20 case DSC_LOGIN_PEND: - if (fcport->fw_login_state =3D=3D DSC_LS_PLOGI_COMP) + if (vha->hw->flags.edif_enabled) + break; + + if (fcport->fw_login_state =3D=3D DSC_LS_PLOGI_COMP) { + ql_dbg(ql_dbg_disc, vha, 0x2118, + "%s %d %8phC post %s PRLI\n", + __func__, __LINE__, fcport->port_name, + NVME_TARGET(vha->hw, fcport) ? "NVME" : "FC"); qla24xx_post_prli_work(vha, fcport); + } break; =20 case DSC_UPD_FCPORT: --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCC3BC3F6B0 for ; Mon, 15 Aug 2022 21:37:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348830AbiHOVho (ORCPT ); Mon, 15 Aug 2022 17:37:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348889AbiHOVgC (ORCPT ); Mon, 15 Aug 2022 17:36:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71EAAE0F3; Mon, 15 Aug 2022 12:25:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A2ECCB810C6; Mon, 15 Aug 2022 19:25:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E1D1C433D6; Mon, 15 Aug 2022 19:25:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591520; bh=hTRS1tqejUoIqcG1ti54Lman6PjQTp4st0trKhr/PfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L1kQjW6Oi/3zaPzFBQs1OUiia+mY3ZEsyFIrWOEKDw7HB2oyggFG/ba27s1edUcqT AdWuG0Duo0N0chpxhg9Sc/pnirTPcKIrlumA00ildbB+lvKKxJIzrsd40fMxeDkv50 kI4BUC8iZQe4EjicfjUwHLECUVC39gvOudFrx8RE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0579/1095] scsi: qla2xxx: edif: Fix no logout on delete for N2N Date: Mon, 15 Aug 2022 19:59:38 +0200 Message-Id: <20220815180453.530247827@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit ec538eb838f334453b10e7e9b260f0c358018a37 ] The driver failed to send implicit logout on session delete. For edif, this failed to flush any lingering SA index in FW. Set a flag to turn on implicit logout early in the session recovery to make sure the logout will go out in case of error. Link: https://lore.kernel.org/r/20220608115849.16693-8-njavali@marvell.com Fixes: 4de067e5df12 ("scsi: qla2xxx: edif: Add N2N support for EDIF") Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_iocb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_ioc= b.c index 46c879923da1..42ce4e1fe744 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2882,6 +2882,9 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int = res) sp->name, res, sp->handle, fcport->d_id.b24, fcport->port_name); =20 fcport->flags &=3D ~(FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE); + /* For edif, set logout on delete to ensure any residual key from FW is f= lushed.*/ + fcport->logout_on_delete =3D 1; + fcport->chip_reset =3D vha->hw->base_qpair->chip_reset; =20 if (sp->flags & SRB_WAKEUP_ON_COMP) complete(&lio->u.els_plogi.comp); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FAEDC00140 for ; Mon, 15 Aug 2022 21:39:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349108AbiHOVjE (ORCPT ); Mon, 15 Aug 2022 17:39:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349034AbiHOVga (ORCPT ); Mon, 15 Aug 2022 17:36:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B7A56DADE; Mon, 15 Aug 2022 12:25:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8EAF86102C; Mon, 15 Aug 2022 19:25:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98E89C433C1; Mon, 15 Aug 2022 19:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591554; bh=49UswcMoTrYQFdQpZMQkdx9wWcv/19lShqGHkiFImoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bd/e7wOKJHNpjgDui+P8qasJDplJOOVFaA5WlxPyIMtbCtHaqBjIFXJmU2hIiDNE1 zpY4TaR/CS26ydpo5Q+JtloXu0EBqLam/uLvLTYSl5pYQbVRySVAis7jEvwH4aoxn7 VleGe6KFl2xq9wPfLGEJQAzM4KwA1ZYhR1j6IaGQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0580/1095] scsi: qla2xxx: edif: Reduce N2N thrashing at app_start time Date: Mon, 15 Aug 2022 19:59:39 +0200 Message-Id: <20220815180453.570200078@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 37be3f9d6993a721bc019f03c97ea0fe66319997 ] For N2N + remote WWPN is bigger than local adapter, remote adapter will login to local adapter while authentication application is not running. When authentication application starts, the current session in FW needs to to be invalidated. Make sure the old session is torn down before triggering a relogin. Link: https://lore.kernel.org/r/20220608115849.16693-9-njavali@marvell.com Fixes: 4de067e5df12 ("scsi: qla2xxx: edif: Add N2N support for EDIF") Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 47 ++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index 3f886b86d74a..dbe8ef887a9d 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -517,11 +517,28 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_j= ob *bsg_job) list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) fcport->n2n_link_reset_cnt =3D 0; =20 - if (vha->hw->flags.n2n_fw_acc_sec) - set_bit(N2N_LINK_RESET, &vha->dpc_flags); - else + if (vha->hw->flags.n2n_fw_acc_sec) { + list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) + qla_edif_sa_ctl_init(vha, fcport); + + /* + * While authentication app was not running, remote device + * could still try to login with this local port. Let's + * clear the state and try again. + */ + qla2x00_wait_for_sess_deletion(vha); + + /* bounce the link to get the other guy to relogin */ + if (!vha->hw->flags.n2n_bigger) { + set_bit(N2N_LINK_RESET, &vha->dpc_flags); + qla2xxx_wake_dpc(vha); + } + } else { + qla2x00_wait_for_hba_online(vha); set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); - qla2xxx_wake_dpc(vha); + qla2xxx_wake_dpc(vha); + qla2x00_wait_for_hba_online(vha); + } } else { list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) { ql_dbg(ql_dbg_edif, vha, 0x2058, @@ -921,17 +938,21 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct b= sg_job *bsg_job) if (tdid.b24 !=3D 0 && tdid.b24 !=3D fcport->d_id.b24) continue; =20 - if (fcport->scan_state !=3D QLA_FCPORT_FOUND) - continue; + if (!N2N_TOPO(vha->hw)) { + if (fcport->scan_state !=3D QLA_FCPORT_FOUND) + continue; =20 - if (fcport->port_type =3D=3D FCT_UNKNOWN && !fcport->fc4_features) - rval =3D qla24xx_async_gffid(vha, fcport, true); + if (fcport->port_type =3D=3D FCT_UNKNOWN && + !fcport->fc4_features) + rval =3D qla24xx_async_gffid(vha, fcport, + true); =20 - if (!rval && - !(fcport->fc4_features & FC4_FF_TARGET || - fcport->port_type & - (FCT_TARGET | FCT_NVME_TARGET))) - continue; + if (!rval && + !(fcport->fc4_features & FC4_FF_TARGET || + fcport->port_type & + (FCT_TARGET | FCT_NVME_TARGET))) + continue; + } =20 rval =3D 0; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4278FC3F6B0 for ; Mon, 15 Aug 2022 21:39:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348894AbiHOVjV (ORCPT ); Mon, 15 Aug 2022 17:39:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349042AbiHOVgb (ORCPT ); Mon, 15 Aug 2022 17:36:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA83C6DAE5; Mon, 15 Aug 2022 12:26:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2C26860EF0; Mon, 15 Aug 2022 19:26:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA4B9C433C1; Mon, 15 Aug 2022 19:26:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591563; bh=dz7vQ4RXKIwyT5wUIh04z6+gRNzyrIgUgYrhIoQKgSM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dgmBKoVA7MOOpzNlh++pa5SgvinpPFTZ7FPZVamdVPk0/SkoX7H6olpiuW7nh4wHI 40mGQ2ULrGbjQl1S0dRJoWwDeiU3eySYAcPABgkXI9VmVNof/9gwKlsw/ExNN9lZ5Z WWi1pcFJxHFM1RCrHDGQqnqeaap6ZbRkUpSFtCvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jagath Jog J , Andy Shevchenko , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.18 0581/1095] iio: accel: bma400: Fix the scale min and max macro values Date: Mon, 15 Aug 2022 19:59:40 +0200 Message-Id: <20220815180453.613172440@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jagath Jog J [ Upstream commit 747c7cf1592e226d40543231b26502b332d0ea2f ] Changing the scale macro values to match the bma400 sensitivity for 1 LSB of all the available ranges. Fixes: 465c811f1f20 ("iio: accel: Add driver for the BMA400") Signed-off-by: Jagath Jog J Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220505133021.22362-2-jagathjog1996@gmail.= com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/accel/bma400.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/iio/accel/bma400.h b/drivers/iio/accel/bma400.h index c4c8d74155c2..80330c7ce17f 100644 --- a/drivers/iio/accel/bma400.h +++ b/drivers/iio/accel/bma400.h @@ -83,8 +83,27 @@ #define BMA400_ACC_ODR_MIN_WHOLE_HZ 25 #define BMA400_ACC_ODR_MIN_HZ 12 =20 -#define BMA400_SCALE_MIN 38357 -#define BMA400_SCALE_MAX 306864 +/* + * BMA400_SCALE_MIN macro value represents m/s^2 for 1 LSB before + * converting to micro values for +-2g range. + * + * For +-2g - 1 LSB =3D 0.976562 milli g =3D 0.009576 m/s^2 + * For +-4g - 1 LSB =3D 1.953125 milli g =3D 0.019153 m/s^2 + * For +-16g - 1 LSB =3D 7.8125 milli g =3D 0.076614 m/s^2 + * + * The raw value which is used to select the different ranges is determined + * by the first bit set position from the scale value, so BMA400_SCALE_MIN + * should be odd. + * + * Scale values for +-2g, +-4g, +-8g and +-16g are populated into bma400_s= cales + * array by left shifting BMA400_SCALE_MIN. + * e.g.: + * To select +-2g =3D 9577 << 0 =3D raw value to write is 0. + * To select +-8g =3D 9577 << 2 =3D raw value to write is 2. + * To select +-16g =3D 9577 << 3 =3D raw value to write is 3. + */ +#define BMA400_SCALE_MIN 9577 +#define BMA400_SCALE_MAX 76617 =20 #define BMA400_NUM_REGULATORS 2 #define BMA400_VDD_REGULATOR 0 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D93AC25B08 for ; Mon, 15 Aug 2022 21:39:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349153AbiHOVj2 (ORCPT ); Mon, 15 Aug 2022 17:39:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349046AbiHOVgc (ORCPT ); Mon, 15 Aug 2022 17:36:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B58F66DAE9; Mon, 15 Aug 2022 12:26:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 345B2610A1; Mon, 15 Aug 2022 19:26:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 396C1C433C1; Mon, 15 Aug 2022 19:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591566; bh=QR1XBvrH8wI3gk0GPZBv4A5itdT7WIsgvNLuw9VtplE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VpGxYeSqtBGvhmWC8b4q5konXV5wcFWa8dvPzzfzVkzFmAn61aFrWGMrE8zCmlvOG 6FJtAGjWVVIhlv4ZyKgE+R51Qo+JFwMiSqyVXxNdiOM9tTU44lpnVSGtnSBVi4RYWt 5myIzttw0SB1ven8vn/2GzlfNjLvNfP5S4FZgH74= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rajat Jain , Matthias Kaehlcke , Hsin-Yi Wang , Tzung-Bi Shih , Guenter Roeck , Evan Green , Stephen Boyd , Sasha Levin Subject: [PATCH 5.18 0582/1095] platform/chrome: cros_ec: Always expose last resume result Date: Mon, 15 Aug 2022 19:59:41 +0200 Message-Id: <20220815180453.664185027@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephen Boyd [ Upstream commit 74bb746407bf0d7c7d126c7731dbcd66d467619b ] The last resume result exposing logic in cros_ec_sleep_event() incorrectly requires S0ix support, which doesn't work on ARM based systems where S0ix doesn't exist. That's because cros_ec_sleep_event() only reports the last resume result when the EC indicates the last sleep event was an S0ix resume. On ARM systems, the last sleep event is always S3 resume, but the EC can still detect sleep hang events in case some other part of the AP is blocking sleep. Always expose the last resume result if the EC supports it so that this works on all devices regardless of S0ix support. This fixes sleep hang detection on ARM based chromebooks like Trogdor. Cc: Rajat Jain Cc: Matthias Kaehlcke Cc: Hsin-Yi Wang Cc: Tzung-Bi Shih Reviewed-by: Guenter Roeck Reviewed-by: Evan Green Fixes: 7235560ac77a ("platform/chrome: Add support for v1 of host sleep eve= nt") Signed-off-by: Stephen Boyd Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220614075726.2729987-1-swboyd@chromium.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/platform/chrome/cros_ec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cr= os_ec.c index a5cc8f24299e..4168d7f5f273 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -135,16 +135,16 @@ static int cros_ec_sleep_event(struct cros_ec_device = *ec_dev, u8 sleep_event) buf.msg.command =3D EC_CMD_HOST_SLEEP_EVENT; =20 ret =3D cros_ec_cmd_xfer_status(ec_dev, &buf.msg); - - /* For now, report failure to transition to S0ix with a warning. */ + /* Report failure to transition to system wide suspend with a warning. */ if (ret >=3D 0 && ec_dev->host_sleep_v1 && - (sleep_event =3D=3D HOST_SLEEP_EVENT_S0IX_RESUME)) { + (sleep_event =3D=3D HOST_SLEEP_EVENT_S0IX_RESUME || + sleep_event =3D=3D HOST_SLEEP_EVENT_S3_RESUME)) { ec_dev->last_resume_result =3D buf.u.resp1.resume_response.sleep_transitions; =20 WARN_ONCE(buf.u.resp1.resume_response.sleep_transitions & EC_HOST_RESUME_SLEEP_TIMEOUT, - "EC detected sleep transition timeout. Total slp_s0 transitions: %d", + "EC detected sleep transition timeout. Total sleep transitions: %d", buf.u.resp1.resume_response.sleep_transitions & EC_HOST_RESUME_SLEEP_TRANSITIONS_MASK); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A436CC25B0E for ; Mon, 15 Aug 2022 21:39:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349159AbiHOVjb (ORCPT ); Mon, 15 Aug 2022 17:39:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349053AbiHOVgd (ORCPT ); Mon, 15 Aug 2022 17:36:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AF683DF3C; Mon, 15 Aug 2022 12:26:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 14C636101B; Mon, 15 Aug 2022 19:26:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C958C433C1; Mon, 15 Aug 2022 19:26:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591569; bh=Bc1TolM682MDUtF/9AwyY7cOvy03uM8FRp6Z0YxCu+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bGycBrHSz0dhz81UJCrajp9ZdDZlI3kktqt/QcFWaBw6yY4A36rREFAzVPbFMXa5H RGNZk1+s/Lvm/xOvpXuzedL8XS6CKyIB8DtVlaTuqQDHUbHQUPei/2dht0YyY3h1nk B48gahnkcy/5ADmbSS+nrt0KFcel9G9/qRo78s/E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gwendal Grignou , Stephen Boyd , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.18 0583/1095] iio: sx9324: Fix register field spelling Date: Mon, 15 Aug 2022 19:59:42 +0200 Message-Id: <20220815180453.708059871@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gwendal Grignou [ Upstream commit 0b24034c7ffa20bcfb4fdfece1df770ec5b0a634 ] Field for PROX_CTRL4 should contain PROX_CTRL4. Fixes: 4c18a890dff8d ("iio:proximity:sx9324: Add SX9324 support") Signed-off-by: Gwendal Grignou Reviewed-by: Stephen Boyd Link: https://lore.kernel.org/r/20220429220144.1476049-3-gwendal@chromium.o= rg Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/proximity/sx9324.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c index 63fbcaa4cac8..a30ac8007a3d 100644 --- a/drivers/iio/proximity/sx9324.c +++ b/drivers/iio/proximity/sx9324.c @@ -93,7 +93,7 @@ #define SX9324_REG_PROX_CTRL4_AVGNEGFILT_MASK GENMASK(5, 3) #define SX9324_REG_PROX_CTRL4_AVGNEG_FILT_2 0x08 #define SX9324_REG_PROX_CTRL4_AVGPOSFILT_MASK GENMASK(2, 0) -#define SX9324_REG_PROX_CTRL3_AVGPOS_FILT_256 0x04 +#define SX9324_REG_PROX_CTRL4_AVGPOS_FILT_256 0x04 #define SX9324_REG_PROX_CTRL5 0x35 #define SX9324_REG_PROX_CTRL5_HYST_MASK GENMASK(5, 4) #define SX9324_REG_PROX_CTRL5_CLOSE_DEBOUNCE_MASK GENMASK(3, 2) @@ -810,7 +810,7 @@ static const struct sx_common_reg_default sx9324_defaul= t_regs[] =3D { { SX9324_REG_PROX_CTRL3, SX9324_REG_PROX_CTRL3_AVGDEB_2SAMPLES | SX9324_REG_PROX_CTRL3_AVGPOS_THRESH_16K }, { SX9324_REG_PROX_CTRL4, SX9324_REG_PROX_CTRL4_AVGNEG_FILT_2 | - SX9324_REG_PROX_CTRL3_AVGPOS_FILT_256 }, + SX9324_REG_PROX_CTRL4_AVGPOS_FILT_256 }, { SX9324_REG_PROX_CTRL5, 0x00 }, { SX9324_REG_PROX_CTRL6, SX9324_REG_PROX_CTRL6_PROXTHRESH_32 }, { SX9324_REG_PROX_CTRL7, SX9324_REG_PROX_CTRL6_PROXTHRESH_32 }, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ABEBC25B0E for ; Mon, 15 Aug 2022 21:39:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349029AbiHOVjh (ORCPT ); Mon, 15 Aug 2022 17:39:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349062AbiHOVge (ORCPT ); Mon, 15 Aug 2022 17:36:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 379912A95E; Mon, 15 Aug 2022 12:26:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B68C4B810C6; Mon, 15 Aug 2022 19:26:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13328C433C1; Mon, 15 Aug 2022 19:26:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591572; bh=gy1qGSqXwJLomVUXNFZL7GA9Gval7RWJfTJsR6onuzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pWizerqcp5k26Bbco9wwQWyogMM9I8edCG+dh+vJKiJtCxpNmwoQXcuz8845yNsus gQNcuFe2sdYgZQoXfmzIewg/hHIwn+zHV5RnPdgop/34DNIq6Rj7tCHsiJpSHTeGct QWRwmDpvaC9TGTE9WdjKvCOGfCW2qgZOO9Vzbcak= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jagath Jog J , Andy Shevchenko , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.18 0584/1095] iio: accel: bma400: Reordering of header files Date: Mon, 15 Aug 2022 19:59:43 +0200 Message-Id: <20220815180453.754003004@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jagath Jog J [ Upstream commit 1bd2dc6ea863690aee5c45ebf09c9194c7a42c0d ] Reordering of header files and removing the iio/sysfs.h since custom attributes are not being used in the driver. Signed-off-by: Jagath Jog J Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220505133021.22362-3-jagathjog1996@gmail.= com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/accel/bma400_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/accel/bma400_core.c b/drivers/iio/accel/bma400_cor= e.c index 043002fe6f63..25ad1f7339bc 100644 --- a/drivers/iio/accel/bma400_core.c +++ b/drivers/iio/accel/bma400_core.c @@ -13,14 +13,14 @@ =20 #include #include -#include -#include #include #include #include #include #include =20 +#include + #include "bma400.h" =20 /* --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 835FBC00140 for ; Mon, 15 Aug 2022 21:39:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244430AbiHOVjn (ORCPT ); Mon, 15 Aug 2022 17:39:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349068AbiHOVgf (ORCPT ); Mon, 15 Aug 2022 17:36:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1CC1B7; Mon, 15 Aug 2022 12:26:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ADE0BB810C6; Mon, 15 Aug 2022 19:26:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11CE8C433D6; Mon, 15 Aug 2022 19:26:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591575; bh=2YYp1pyJZPc3drJBP+v525omMRdvo3xH8Vra2/XQD5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pN3GqIvxjeqN4/jpC76H/K3n/mWGBc+d21npGOUO9QeUjZRAFxvzDyTmYnX/RKC85 NkVs07G9sLUb8euwz3QakTqF9WWLVSosX3bRkQduitf9iZiXaigwwaOWO3nNaSs5aC /IZMm5hFwXF6Oa0e+C2DGeRS6IFDpPG1l0cE0X1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jagath Jog J , Andy Shevchenko , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.18 0585/1095] iio: accel: bma400: conversion to device-managed function Date: Mon, 15 Aug 2022 19:59:44 +0200 Message-Id: <20220815180453.792763307@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jagath Jog J [ Upstream commit 12c99f859fd3da5fc8f8491826e7023001f54821 ] This is a conversion to device-managed by using devm_iio_device_register() inside probe function. Previously the bma400 was not put into power down mode in some error paths in probe where it now is, but that should cause no harm. The dev_set_drvdata() call, bma400_remove() function and hooks in the I2C and SPI driver struct is removed as devm_iio_device_register() function is used to automatically unregister on driver detach. Signed-off-by: Jagath Jog J Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220505133021.22362-4-jagathjog1996@gmail.= com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/accel/bma400.h | 2 - drivers/iio/accel/bma400_core.c | 77 ++++++++++++++++----------------- drivers/iio/accel/bma400_i2c.c | 8 ---- drivers/iio/accel/bma400_spi.c | 6 --- 4 files changed, 38 insertions(+), 55 deletions(-) diff --git a/drivers/iio/accel/bma400.h b/drivers/iio/accel/bma400.h index 80330c7ce17f..1c8c47a9a317 100644 --- a/drivers/iio/accel/bma400.h +++ b/drivers/iio/accel/bma400.h @@ -113,6 +113,4 @@ extern const struct regmap_config bma400_regmap_config; =20 int bma400_probe(struct device *dev, struct regmap *regmap, const char *na= me); =20 -void bma400_remove(struct device *dev); - #endif diff --git a/drivers/iio/accel/bma400_core.c b/drivers/iio/accel/bma400_cor= e.c index 25ad1f7339bc..07674d89d978 100644 --- a/drivers/iio/accel/bma400_core.c +++ b/drivers/iio/accel/bma400_core.c @@ -560,6 +560,26 @@ static void bma400_init_tables(void) } } =20 +static void bma400_regulators_disable(void *data_ptr) +{ + struct bma400_data *data =3D data_ptr; + + regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators); +} + +static void bma400_power_disable(void *data_ptr) +{ + struct bma400_data *data =3D data_ptr; + int ret; + + mutex_lock(&data->mutex); + ret =3D bma400_set_power_mode(data, POWER_MODE_SLEEP); + mutex_unlock(&data->mutex); + if (ret) + dev_warn(data->dev, "Failed to put device into sleep mode (%pe)\n", + ERR_PTR(ret)); +} + static int bma400_init(struct bma400_data *data) { unsigned int val; @@ -569,13 +589,12 @@ static int bma400_init(struct bma400_data *data) ret =3D regmap_read(data->regmap, BMA400_CHIP_ID_REG, &val); if (ret) { dev_err(data->dev, "Failed to read chip id register\n"); - goto out; + return ret; } =20 if (val !=3D BMA400_ID_REG_VAL) { dev_err(data->dev, "Chip ID mismatch\n"); - ret =3D -ENODEV; - goto out; + return -ENODEV; } =20 data->regulators[BMA400_VDD_REGULATOR].supply =3D "vdd"; @@ -589,27 +608,31 @@ static int bma400_init(struct bma400_data *data) "Failed to get regulators: %d\n", ret); =20 - goto out; + return ret; } ret =3D regulator_bulk_enable(ARRAY_SIZE(data->regulators), data->regulators); if (ret) { dev_err(data->dev, "Failed to enable regulators: %d\n", ret); - goto out; + return ret; } =20 + ret =3D devm_add_action_or_reset(data->dev, bma400_regulators_disable, da= ta); + if (ret) + return ret; + ret =3D bma400_get_power_mode(data); if (ret) { dev_err(data->dev, "Failed to get the initial power-mode\n"); - goto err_reg_disable; + return ret; } =20 if (data->power_mode !=3D POWER_MODE_NORMAL) { ret =3D bma400_set_power_mode(data, POWER_MODE_NORMAL); if (ret) { dev_err(data->dev, "Failed to wake up the device\n"); - goto err_reg_disable; + return ret; } /* * TODO: The datasheet waits 1500us here in the example, but @@ -618,19 +641,23 @@ static int bma400_init(struct bma400_data *data) usleep_range(1500, 2000); } =20 + ret =3D devm_add_action_or_reset(data->dev, bma400_power_disable, data); + if (ret) + return ret; + bma400_init_tables(); =20 ret =3D bma400_get_accel_output_data_rate(data); if (ret) - goto err_reg_disable; + return ret; =20 ret =3D bma400_get_accel_oversampling_ratio(data); if (ret) - goto err_reg_disable; + return ret; =20 ret =3D bma400_get_accel_scale(data); if (ret) - goto err_reg_disable; + return ret; =20 /* * Once the interrupt engine is supported we might use the @@ -639,12 +666,6 @@ static int bma400_init(struct bma400_data *data) * channel. */ return regmap_write(data->regmap, BMA400_ACC_CONFIG2_REG, 0x00); - -err_reg_disable: - regulator_bulk_disable(ARRAY_SIZE(data->regulators), - data->regulators); -out: - return ret; } =20 static int bma400_read_raw(struct iio_dev *indio_dev, @@ -822,32 +843,10 @@ int bma400_probe(struct device *dev, struct regmap *r= egmap, const char *name) indio_dev->num_channels =3D ARRAY_SIZE(bma400_channels); indio_dev->modes =3D INDIO_DIRECT_MODE; =20 - dev_set_drvdata(dev, indio_dev); - - return iio_device_register(indio_dev); + return devm_iio_device_register(dev, indio_dev); } EXPORT_SYMBOL_NS(bma400_probe, IIO_BMA400); =20 -void bma400_remove(struct device *dev) -{ - struct iio_dev *indio_dev =3D dev_get_drvdata(dev); - struct bma400_data *data =3D iio_priv(indio_dev); - int ret; - - mutex_lock(&data->mutex); - ret =3D bma400_set_power_mode(data, POWER_MODE_SLEEP); - mutex_unlock(&data->mutex); - - if (ret) - dev_warn(dev, "Failed to put device into sleep mode (%pe)\n", ERR_PTR(re= t)); - - regulator_bulk_disable(ARRAY_SIZE(data->regulators), - data->regulators); - - iio_device_unregister(indio_dev); -} -EXPORT_SYMBOL_NS(bma400_remove, IIO_BMA400); - MODULE_AUTHOR("Dan Robertson "); MODULE_DESCRIPTION("Bosch BMA400 triaxial acceleration sensor core"); MODULE_LICENSE("GPL"); diff --git a/drivers/iio/accel/bma400_i2c.c b/drivers/iio/accel/bma400_i2c.c index da104ffd3fe0..4f6e01a3b3a1 100644 --- a/drivers/iio/accel/bma400_i2c.c +++ b/drivers/iio/accel/bma400_i2c.c @@ -27,13 +27,6 @@ static int bma400_i2c_probe(struct i2c_client *client, return bma400_probe(&client->dev, regmap, id->name); } =20 -static int bma400_i2c_remove(struct i2c_client *client) -{ - bma400_remove(&client->dev); - - return 0; -} - static const struct i2c_device_id bma400_i2c_ids[] =3D { { "bma400", 0 }, { } @@ -52,7 +45,6 @@ static struct i2c_driver bma400_i2c_driver =3D { .of_match_table =3D bma400_of_i2c_match, }, .probe =3D bma400_i2c_probe, - .remove =3D bma400_i2c_remove, .id_table =3D bma400_i2c_ids, }; =20 diff --git a/drivers/iio/accel/bma400_spi.c b/drivers/iio/accel/bma400_spi.c index 51f23bdc0ea5..28e240400a3f 100644 --- a/drivers/iio/accel/bma400_spi.c +++ b/drivers/iio/accel/bma400_spi.c @@ -87,11 +87,6 @@ static int bma400_spi_probe(struct spi_device *spi) return bma400_probe(&spi->dev, regmap, id->name); } =20 -static void bma400_spi_remove(struct spi_device *spi) -{ - bma400_remove(&spi->dev); -} - static const struct spi_device_id bma400_spi_ids[] =3D { { "bma400", 0 }, { } @@ -110,7 +105,6 @@ static struct spi_driver bma400_spi_driver =3D { .of_match_table =3D bma400_of_spi_match, }, .probe =3D bma400_spi_probe, - .remove =3D bma400_spi_remove, .id_table =3D bma400_spi_ids, }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3D6BC00140 for ; Mon, 15 Aug 2022 21:33:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348560AbiHOVdk (ORCPT ); Mon, 15 Aug 2022 17:33:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348621AbiHOVbm (ORCPT ); Mon, 15 Aug 2022 17:31:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92FCBF076B; Mon, 15 Aug 2022 12:24:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B5046B81062; Mon, 15 Aug 2022 19:24:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07601C433D6; Mon, 15 Aug 2022 19:24:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591455; bh=CnsTbjLDuDtH0/cJrjat7Y4T94D3EJ6Ue+A+1sVKQvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CY8DGInxQZ1N1pobkfVqJFQdZWaIJ79O5g3qzWcoQIfS64Yueco6YOeAchnRePPHZ O10HIkNlxv+6FWIhRgh8J130UB01yBWci6SaobzFufmGHPYV/Naw1v7v40tqlilpbZ abY9yF127uQRyDZXNZuR+QOjzT5t/VCWYzILp6C0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0586/1095] iio: core: Fix IIO_ALIGN and rename as it was not sufficiently large Date: Mon, 15 Aug 2022 19:59:45 +0200 Message-Id: <20220815180453.832686798@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 12c4efe3509b8018e76ea3ebda8227cb53bf5887 ] Discussion of the series: https://lore.kernel.org/all/20220405135758.774016-1-catalin.marinas@arm.com/ mm, arm64: Reduce ARCH_KMALLOC_MINALIGN brought to my attention that our current IIO usage of L1CACHE_ALIGN is insufficient as their are Arm platforms out their with non coherent DMA and larger cache lines at at higher levels of their cache hierarchy. Rename the define to make it's purpose more explicit. It will be used much more widely going forwards (to replace incorrect ____cacheline_aligned markings. Note this patch will greatly reduce the padding on some architectures that have smaller requirements for DMA safe buffers. The history of changing values of ARCH_KMALLOC_MINALIGN via ARCH_DMA_MINALIGN on arm64 is rather complex. I'm not tagging this as fixing a particular patch from that route as it's not clear what to tag. Most recently a change to bring them back inline was reverted because of some Qualcomm Kryo cores with an L2 cache with 128-byte lines sitting above the point of coherency. c1132702c71f Revert "arm64: cache: Lower ARCH_DMA_MINALIGN to 64 (L1_CACHE_= BYTES)" That reverts: 65688d2a05de arm64: cache: Lower ARCH_DMA_MINALIGN to 64 (L1_CACHE_BYTES) w= hich refers to the change originally being motivated by Thunder x1 performance rather than correctness. Fixes: 6f7c8ee585e9d ("staging:iio: Add ability to allocate private data sp= ace to iio_allocate_device") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-2-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/adi-axi-adc.c | 7 ++++--- drivers/iio/industrialio-core.c | 4 ++-- include/linux/iio/iio.h | 10 ++++++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c index a9e655e69eaa..8ffabdaf841e 100644 --- a/drivers/iio/adc/adi-axi-adc.c +++ b/drivers/iio/adc/adi-axi-adc.c @@ -84,7 +84,8 @@ void *adi_axi_adc_conv_priv(struct adi_axi_adc_conv *conv) { struct adi_axi_adc_client *cl =3D conv_to_client(conv); =20 - return (char *)cl + ALIGN(sizeof(struct adi_axi_adc_client), IIO_ALIGN); + return (char *)cl + ALIGN(sizeof(struct adi_axi_adc_client), + IIO_DMA_MINALIGN); } EXPORT_SYMBOL_GPL(adi_axi_adc_conv_priv); =20 @@ -169,9 +170,9 @@ static struct adi_axi_adc_conv *adi_axi_adc_conv_regist= er(struct device *dev, struct adi_axi_adc_client *cl; size_t alloc_size; =20 - alloc_size =3D ALIGN(sizeof(struct adi_axi_adc_client), IIO_ALIGN); + alloc_size =3D ALIGN(sizeof(struct adi_axi_adc_client), IIO_DMA_MINALIGN); if (sizeof_priv) - alloc_size +=3D ALIGN(sizeof_priv, IIO_ALIGN); + alloc_size +=3D ALIGN(sizeof_priv, IIO_DMA_MINALIGN); =20 cl =3D kzalloc(alloc_size, GFP_KERNEL); if (!cl) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-cor= e.c index b2d2b42614d3..e5aed96de8f3 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -1655,7 +1655,7 @@ struct iio_dev *iio_device_alloc(struct device *paren= t, int sizeof_priv) =20 alloc_size =3D sizeof(struct iio_dev_opaque); if (sizeof_priv) { - alloc_size =3D ALIGN(alloc_size, IIO_ALIGN); + alloc_size =3D ALIGN(alloc_size, IIO_DMA_MINALIGN); alloc_size +=3D sizeof_priv; } =20 @@ -1665,7 +1665,7 @@ struct iio_dev *iio_device_alloc(struct device *paren= t, int sizeof_priv) =20 indio_dev =3D &iio_dev_opaque->indio_dev; indio_dev->priv =3D (char *)iio_dev_opaque + - ALIGN(sizeof(struct iio_dev_opaque), IIO_ALIGN); + ALIGN(sizeof(struct iio_dev_opaque), IIO_DMA_MINALIGN); =20 indio_dev->dev.parent =3D parent; indio_dev->dev.type =3D &iio_device_type; diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index faf00f2c0be6..c4ce02293f1f 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -9,6 +9,7 @@ =20 #include #include +#include #include #include /* IIO TODO LIST */ @@ -657,8 +658,13 @@ static inline void *iio_device_get_drvdata(const struc= t iio_dev *indio_dev) return dev_get_drvdata(&indio_dev->dev); } =20 -/* Can we make this smaller? */ -#define IIO_ALIGN L1_CACHE_BYTES +/* + * Used to ensure the iio_priv() structure is aligned to allow that struct= ure + * to in turn include IIO_DMA_MINALIGN'd elements such as buffers which + * must not share cachelines with the rest of the structure, thus making + * them safe for use with non-coherent DMA. + */ +#define IIO_DMA_MINALIGN ARCH_KMALLOC_MINALIGN struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv); =20 /* The information at the returned address is guaranteed to be cacheline a= ligned */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7BD9C25B08 for ; Mon, 15 Aug 2022 21:33:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348592AbiHOVds (ORCPT ); Mon, 15 Aug 2022 17:33:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348696AbiHOVbv (ORCPT ); Mon, 15 Aug 2022 17:31:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DAB2F14C6; Mon, 15 Aug 2022 12:24:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D9575B810C6; Mon, 15 Aug 2022 19:24:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3299FC433D6; Mon, 15 Aug 2022 19:24:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591458; bh=pDQAiluEMFznMnl6qm26vpua8zn+CoKeaErTyh8RvIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=19KiLrB3UyvWaw6xqpvFlRAXtUpucPB5EtGDiTw02ybpgqrK5k8oz6gax8DYleDBY qBeS+6yiwoU2BePYHpCnJfX4ooW0g4NIuJwQK54HcRnBnluMu87eRRf7iqX4ESWiJF KMqqsN1A7msu5e71cKu81vBQfQNf7SP6KqKiNJrA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0587/1095] iio: accel: adxl313: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 19:59:46 +0200 Message-Id: <20220815180453.867035052@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit f68a0445ee86e48dafbfdea50163ad6fc6dba268 ] ____cacheline_aligned is insufficient guarantee for non-coherent DMA. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 636d44633039 ("iio: accel: Add driver support for ADXL313") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-3-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/accel/adxl313_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/accel/adxl313_core.c b/drivers/iio/accel/adxl313_c= ore.c index 9e4193e64765..afeef779e1d0 100644 --- a/drivers/iio/accel/adxl313_core.c +++ b/drivers/iio/accel/adxl313_core.c @@ -46,7 +46,7 @@ EXPORT_SYMBOL_NS_GPL(adxl313_writable_regs_table, IIO_ADX= L313); struct adxl313_data { struct regmap *regmap; struct mutex lock; /* lock to protect transf_buf */ - __le16 transf_buf ____cacheline_aligned; + __le16 transf_buf __aligned(IIO_DMA_MINALIGN); }; =20 static const int adxl313_odr_freqs[][2] =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DFCFC00140 for ; Mon, 15 Aug 2022 21:33:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239330AbiHOVd4 (ORCPT ); Mon, 15 Aug 2022 17:33:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348703AbiHOVbw (ORCPT ); Mon, 15 Aug 2022 17:31:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7C12F14DE; Mon, 15 Aug 2022 12:24:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EC6DFB81125; Mon, 15 Aug 2022 19:24:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D8CFC433D7; Mon, 15 Aug 2022 19:24:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591461; bh=48Kw4A0AdOgJlUaYNtEqPs6oaVrKW8gwiJZQTkihobw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D+5doL7PKhUxIOMCHuaWB4FWyvWvcoTiYeQeOXoQp4TcznqLkiYs7GVgH76RiqDPU fFb6qpOe3XQ3RY0EujA1rAuGR4qhCplHUy5fEja37MFax9ot155J9D8NSSaADu8BpO Xp9FS/HjN0tyrGMTqJ+2toQMsYAi3EB0WKtQbT7k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Puranjay Mohan , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0588/1095] iio: accel: adxl355: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 19:59:47 +0200 Message-Id: <20220815180453.900569043@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 46403dcf3a7cbd24b86f809fd79962f4d6b137c5 ] ____cacheline_aligned is insufficient guarantee for non-coherent DMA. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 327a0eaf19d53 ("iio: accel: adxl355: Add triggered buffer support") Signed-off-by: Jonathan Cameron Cc: Puranjay Mohan Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-4-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/accel/adxl355_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/accel/adxl355_core.c b/drivers/iio/accel/adxl355_c= ore.c index e9c10c8c32f0..2dfe780d6144 100644 --- a/drivers/iio/accel/adxl355_core.c +++ b/drivers/iio/accel/adxl355_core.c @@ -177,7 +177,7 @@ struct adxl355_data { u8 buf[14]; s64 ts; } buffer; - } ____cacheline_aligned; + } __aligned(IIO_DMA_MINALIGN); }; =20 static int adxl355_set_op_mode(struct adxl355_data *data, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B3A8C00140 for ; Mon, 15 Aug 2022 21:33:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348572AbiHOVdp (ORCPT ); Mon, 15 Aug 2022 17:33:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348691AbiHOVbu (ORCPT ); Mon, 15 Aug 2022 17:31:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2B6EF14F4; Mon, 15 Aug 2022 12:24:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 377A0B81126; Mon, 15 Aug 2022 19:24:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E217C433C1; Mon, 15 Aug 2022 19:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591464; bh=s4e9UgebQLPV4QdXY6YUNgIrkfi/fdUQw7qqKd56Jo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mU9nlAK2T7NySVWOotPt8W+x0C7aOCvW29A2rltNXECviKmNOCHS+oYrP4EHySyFA aue8gGOe8RaCoyhJLNbzLfBTQWunIcm+hE1deOWBS7c9kNhOpvfR18678vVSfbIr7N Fpz/Gw/L20c5EruuyTUWgMhzd9aEdAZ+iPmFWDAk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Cosmin Tanislav , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0589/1095] iio: accel: adxl367: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 19:59:48 +0200 Message-Id: <20220815180453.932463861@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit e1f956a804df9074fb5de557563d153ae25252e7 ] ____cacheline_aligned is insufficient guarantee for non-coherent DMA. Switch to the updated IIO_DMA_MINALIGN definition. Update comment to reflect that DMA safety may require separate cachelines. Fixes: cbab791c5e2a5 ("iio: accel: add ADXL367 driver") Signed-off-by: Jonathan Cameron Cc: Cosmin Tanislav Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-5-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/accel/adxl367.c | 2 +- drivers/iio/accel/adxl367_spi.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/iio/accel/adxl367.c b/drivers/iio/accel/adxl367.c index 62960134ea19..d680bec05efc 100644 --- a/drivers/iio/accel/adxl367.c +++ b/drivers/iio/accel/adxl367.c @@ -179,7 +179,7 @@ struct adxl367_state { unsigned int fifo_set_size; unsigned int fifo_watermark; =20 - __be16 fifo_buf[ADXL367_FIFO_SIZE] ____cacheline_aligned; + __be16 fifo_buf[ADXL367_FIFO_SIZE] __aligned(IIO_DMA_MINALIGN); __be16 sample_buf; u8 act_threshold_buf[2]; u8 inact_time_buf[2]; diff --git a/drivers/iio/accel/adxl367_spi.c b/drivers/iio/accel/adxl367_sp= i.c index 26dfc821ebbe..118c894015a5 100644 --- a/drivers/iio/accel/adxl367_spi.c +++ b/drivers/iio/accel/adxl367_spi.c @@ -9,6 +9,8 @@ #include #include =20 +#include + #include "adxl367.h" =20 #define ADXL367_SPI_WRITE_COMMAND 0x0A @@ -28,10 +30,10 @@ struct adxl367_spi_state { struct spi_transfer fifo_xfer[2]; =20 /* - * DMA (thus cache coherency maintenance) requires the - * transfer buffers to live in their own cache lines. + * DMA (thus cache coherency maintenance) may require the + * transfer buffers live in their own cache lines. */ - u8 reg_write_tx_buf[1] ____cacheline_aligned; + u8 reg_write_tx_buf[1] __aligned(IIO_DMA_MINALIGN); u8 reg_read_tx_buf[2]; u8 fifo_tx_buf[1]; }; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 257E7C00140 for ; Mon, 15 Aug 2022 21:34:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348607AbiHOVd7 (ORCPT ); Mon, 15 Aug 2022 17:33:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348733AbiHOVb6 (ORCPT ); Mon, 15 Aug 2022 17:31:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A1D8F23CF; Mon, 15 Aug 2022 12:24:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 87526B81109; Mon, 15 Aug 2022 19:24:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 981CAC433C1; Mon, 15 Aug 2022 19:24:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591468; bh=1ZM8t4XUhuzWdK3a2YEu+0EkEQ6u6byYIrpokLIX+HA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GjPIm+8/+Qr28jKoKcqGgfEEMZ40szX7fXQGrTS936JiHQsulDcO3UIXuNmeaVF3c KPyewpMcTR4VonTMusO2l2pvaOVNzo0IUFkz82kUi5vcwVw5/CTEkPNVjrWo5NDvzh Zy9aLGGVRbfvSzkgsumQW0wm/sh9QwV/LtvkEBWs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0590/1095] iio: accel: bma220: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 19:59:49 +0200 Message-Id: <20220815180453.967994704@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 38e71240e2ff97184cdcdaf877cf62d3f16678e2 ] ____cacheline_aligned is insufficient guarantee for non-coherent DMA. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: bf2a5600a3ebc ("iio: accel: Add support for Bosch BMA220") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-6-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/accel/bma220_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/accel/bma220_spi.c b/drivers/iio/accel/bma220_spi.c index 74024d7ce5ac..b6d9ab8e2054 100644 --- a/drivers/iio/accel/bma220_spi.c +++ b/drivers/iio/accel/bma220_spi.c @@ -67,7 +67,7 @@ struct bma220_data { /* Ensure timestamp is naturally aligned. */ s64 timestamp __aligned(8); } scan; - u8 tx_buf[2] ____cacheline_aligned; + u8 tx_buf[2] __aligned(IIO_DMA_MINALIGN); }; =20 static const struct iio_chan_spec bma220_channels[] =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 545A2C00140 for ; Mon, 15 Aug 2022 21:34:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233446AbiHOVeI (ORCPT ); Mon, 15 Aug 2022 17:34:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348748AbiHOVb7 (ORCPT ); Mon, 15 Aug 2022 17:31:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 454F4F23DF; Mon, 15 Aug 2022 12:24:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BC0F0B81128; Mon, 15 Aug 2022 19:24:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07BA4C433C1; Mon, 15 Aug 2022 19:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591471; bh=hVFKu6wSS3SbD3vsdkiHszDP6Ydrmgza0pKYi4La5fE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NQkN+2d4+2PeMWFPJs2JD2mpeR8JIe3obUA5h6cdv/p1N7oRCLJPScwp1eq5vC8jF V0IF/rIKEH80ZDeOlA81UZSAf1Pz1iCSKwRm2UZXaZFFt4qWeEGTpoqK7UPo7OK415 Fm42Y7bngqwrTSTKsePlrCMB0aGDzUK6Z3z4NeRA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0591/1095] iio: accel: sca3000: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 19:59:50 +0200 Message-Id: <20220815180454.005212790@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit a263456f0e27ec2f00d25119757f4d4bd656b2e9 ] ____cacheline_aligned is insufficient guarantee for non-coherent DMA. Switch to the updated IIO_DMA_MINALIGN definition. The second alignment marking is left in place to avoid doing more than the simple fix in this patch. Fixes: ced5c03d360ae ("staging:iio:accel:sca3000 merge files into one.") Fixes: 152a6a884ae13 ("staging:iio:accel:sca3000 move to hybrid hard / soft= buffer design.") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-8-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/accel/sca3000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c index 83c81072511e..2eecd2ab72dd 100644 --- a/drivers/iio/accel/sca3000.c +++ b/drivers/iio/accel/sca3000.c @@ -167,8 +167,8 @@ struct sca3000_state { int mo_det_use_count; struct mutex lock; /* Can these share a cacheline ? */ - u8 rx[384] ____cacheline_aligned; - u8 tx[6] ____cacheline_aligned; + u8 rx[384] __aligned(IIO_DMA_MINALIGN); + u8 tx[6] __aligned(IIO_DMA_MINALIGN); }; =20 /** --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FAC3C00140 for ; Mon, 15 Aug 2022 21:34:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348675AbiHOVer (ORCPT ); Mon, 15 Aug 2022 17:34:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348548AbiHOVdi (ORCPT ); Mon, 15 Aug 2022 17:33:38 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E7DF5FF51; Mon, 15 Aug 2022 12:24:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 3ECDDCE12C8; Mon, 15 Aug 2022 19:24:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12538C433D7; Mon, 15 Aug 2022 19:24:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591474; bh=BPYGU0prx8vy2rm3ykiDuUfKlScpRpunExDGsvyfH6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fNlCtzLXZdlZFKSzgbEZH14pwIkfAmyV+g2gEu+MUGLBO8oQ3Hjo4tvKm8i2yntQX kEPLzNuTnhX2rnqeUfsq6gAvWAZb2WbPGqSE6hRYHqFaZWv69zcyqjPvtS6sWY6Mx7 fC4jhsAMz8oAUFhoxZt4cxjh9iN3ZLA1CW5vBAMw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Tomas Melin , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0592/1095] iio: accel: sca3300: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 19:59:51 +0200 Message-Id: <20220815180454.043035081@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit b1d3a806630dbbf3b4d75a2e850adccf4f4439e7 ] ____cacheline_aligned is insufficient guarantee for non-coherent DMA. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 9cc9806e22178 ("iio: accel: Add driver for Murata SCA3300 accelerome= ter") Signed-off-by: Jonathan Cameron Reviewed-by: Tomas Melin Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-9-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/accel/sca3300.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/accel/sca3300.c b/drivers/iio/accel/sca3300.c index f7ef8ecfd34a..39e0c24364ae 100644 --- a/drivers/iio/accel/sca3300.c +++ b/drivers/iio/accel/sca3300.c @@ -115,7 +115,7 @@ struct sca3300_data { s16 channels[4]; s64 ts __aligned(sizeof(s64)); } scan; - u8 txbuf[4] ____cacheline_aligned; + u8 txbuf[4] __aligned(IIO_DMA_MINALIGN); u8 rxbuf[4]; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 524ECC00140 for ; Mon, 15 Aug 2022 21:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348468AbiHOVe0 (ORCPT ); Mon, 15 Aug 2022 17:34:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348496AbiHOVdb (ORCPT ); Mon, 15 Aug 2022 17:33:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 416C55FF54; Mon, 15 Aug 2022 12:24:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5378B6101B; Mon, 15 Aug 2022 19:24:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B008C433C1; Mon, 15 Aug 2022 19:24:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591477; bh=d55AagMU7taW5lTQYGHTQe24t8k3WYBIidccWjs+KKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WY1k9xtIXh3eyLp4vL7F7D6vEBHpbgYbGXg66Bh3sFI88o7CMmk4ZAdKwTy1nTvqV CLFRuFpH8hHd9b6rtM0u9JsA4m4toru2H7DAh2beWXELNBnaDLKc1/R4MM7p3eHaIw aJZNdU6ipHz4COqtPlOE3rCfLY4r4IkvMPhywX/o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0593/1095] iio: adc: ad7266: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 19:59:52 +0200 Message-Id: <20220815180454.082516568@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit b990cdfe7536a8da7e134d516350402981300016 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to reflect that DMA safety 'may' require separate cachelines. Fixes: 54e018da3141 ("iio:ad7266: Mark transfer buffer as __be16") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-10-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ad7266.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c index c17d9b5fbaf6..53c83e04dde5 100644 --- a/drivers/iio/adc/ad7266.c +++ b/drivers/iio/adc/ad7266.c @@ -37,7 +37,7 @@ struct ad7266_state { struct gpio_desc *gpios[3]; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. * The buffer needs to be large enough to hold two samples (4 bytes) and * the naturally aligned timestamp (8 bytes). @@ -45,7 +45,7 @@ struct ad7266_state { struct { __be16 sample[2]; s64 timestamp; - } data ____cacheline_aligned; + } data __aligned(IIO_DMA_MINALIGN); }; =20 static int ad7266_wakeup(struct ad7266_state *st) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0FDAC25B0E for ; Mon, 15 Aug 2022 21:34:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348678AbiHOVe6 (ORCPT ); Mon, 15 Aug 2022 17:34:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348591AbiHOVds (ORCPT ); Mon, 15 Aug 2022 17:33:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73BC85FF78; Mon, 15 Aug 2022 12:24:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 683B56101F; Mon, 15 Aug 2022 19:24:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50CC3C433D6; Mon, 15 Aug 2022 19:24:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591480; bh=Rc89W/iujlQ4wimzvMqL0A9iZ4hEsIzX4Ta5xrszvkY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dXJDZrdgtkcnRoZzJk6ChSw4JQ67+kOjDuUNTgjioHbSUkqFDKTtsS5Yl8En2Xy6s MTyJ1+FflflAyolTYxbNQTVPr3NEQBSw+eXrN+1oVXKIPxLyfyl0swYeQyHPB9TBYO BlWb/X6raJ3y24/ixvccC76epeA2+q8mBvcwqKDo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0594/1095] iio: adc: ad7280a: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 19:59:53 +0200 Message-Id: <20220815180454.131911748@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 4e2008429588b857bbc13d048b67b931a8d84816 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 003f1d48de52 ("staging:iio:adc:ad7280a: Split buff[2] into tx and rx= parts") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-11-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ad7280a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ad7280a.c b/drivers/iio/adc/ad7280a.c index ec9acbf12b9a..047a9d0dbcf7 100644 --- a/drivers/iio/adc/ad7280a.c +++ b/drivers/iio/adc/ad7280a.c @@ -183,7 +183,7 @@ struct ad7280_state { unsigned char cb_mask[AD7280A_MAX_CHAIN]; struct mutex lock; /* protect sensor state */ =20 - __be32 tx ____cacheline_aligned; + __be32 tx __aligned(IIO_DMA_MINALIGN); __be32 rx; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92AB6C00140 for ; Mon, 15 Aug 2022 21:36:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243348AbiHOVgj (ORCPT ); Mon, 15 Aug 2022 17:36:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348651AbiHOVeE (ORCPT ); Mon, 15 Aug 2022 17:34:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D408275CD1; Mon, 15 Aug 2022 12:24:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 17AF4B810C6; Mon, 15 Aug 2022 19:24:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73435C433D7; Mon, 15 Aug 2022 19:24:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591483; bh=ENrKwTqUaG6wm01FcYnw3KyNtxaADTZHndpvPJ+CDHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ukJg/WNt1dPev6qQGEhRDogdiK7Aq2NN5kSTuhgLy3Nf3CDSM7RqIb5FB3t1rhkFF 7DAg24KKkS2Z8ewcaN+PjR4JacjOxyZDpSFYxPa+87VbFEcudncn/GRCB77GiXMdKP 7cAN4PDg3NnUZQ7e0Go92JqjID5gyCunfQFhiMVI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Marcelo Schmitt , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0595/1095] iio: adc: ad7292: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 19:59:54 +0200 Message-Id: <20220815180454.164862407@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 98295a206d04633bae31f279de11ff7d04724bce ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 506d2e317a0a ("iio: adc: Add driver support for AD7292") Signed-off-by: Jonathan Cameron Acked-by: Marcelo Schmitt Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-12-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ad7292.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ad7292.c b/drivers/iio/adc/ad7292.c index 3271a31afde1..92c68d467c50 100644 --- a/drivers/iio/adc/ad7292.c +++ b/drivers/iio/adc/ad7292.c @@ -80,7 +80,7 @@ struct ad7292_state { struct regulator *reg; unsigned short vref_mv; =20 - __be16 d16 ____cacheline_aligned; + __be16 d16 __aligned(IIO_DMA_MINALIGN); u8 d8[2]; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C86AC25B0E for ; Mon, 15 Aug 2022 21:36:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348548AbiHOVgr (ORCPT ); Mon, 15 Aug 2022 17:36:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348521AbiHOVei (ORCPT ); Mon, 15 Aug 2022 17:34:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A76375CF2; Mon, 15 Aug 2022 12:24:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 930746101B; Mon, 15 Aug 2022 19:24:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CACDC433D6; Mon, 15 Aug 2022 19:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591490; bh=d4ycwxc2rDoKWptparan665MelJUrI1M2sFJzZh0K1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gYC5rQ7H6Mki658nDVs14eUbo8CXWlvBFDIPoxC7DKTo1ki+SpvJgRZly2cHs6ILW WQPLBnWQn4rQt+3/F836aWPMNbf8gf68nzpPuMk+Uh5al4obEJCLQv9lAx/BFDfg8w 8DDY4uGVpr//6BLwG3xj1nmF4ByPcZpvB/RRlt3I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0596/1095] iio: adc: ad7298: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 19:59:55 +0200 Message-Id: <20220815180454.212816941@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 585c9772f883da3ac425e2e8277b2aaceb201f38 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: be7fd3b86ad2 ("iio:adc:ad7298 make the tx and rx buffers __be16") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-13-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ad7298.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ad7298.c b/drivers/iio/adc/ad7298.c index 3f4e73f7d35a..c0430f71f592 100644 --- a/drivers/iio/adc/ad7298.c +++ b/drivers/iio/adc/ad7298.c @@ -49,7 +49,7 @@ struct ad7298_state { * DMA (thus cache coherency maintenance) requires the * transfer buffers to live in their own cache lines. */ - __be16 rx_buf[12] ____cacheline_aligned; + __be16 rx_buf[12] __aligned(IIO_DMA_MINALIGN); __be16 tx_buf[2]; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1445BC00140 for ; Mon, 15 Aug 2022 21:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348631AbiHOVgv (ORCPT ); Mon, 15 Aug 2022 17:36:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243568AbiHOVfI (ORCPT ); Mon, 15 Aug 2022 17:35:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B884EA6C4E; Mon, 15 Aug 2022 12:24:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8FB0060EF0; Mon, 15 Aug 2022 19:24:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96352C433D6; Mon, 15 Aug 2022 19:24:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591493; bh=sDltwdfM+bb1xgm1e4fTojwxAiLFI29C+V8cwlFn1WA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NOeS+StV8Y+mfZuZ6SVS15FXm5S80etZkWlRFYZ1+2zWcem0LJVRW+a4bteP/WAJ3 qL3seBkbGtGXbrmoZIzjmWIlKaCI8ZzSDa6X+FMIcIwf66QfH+YluPtGHMmwYip6LB nruZ4N+sQ5Fu+acAiRdZnG3iX9BauGY5oiUy0WlE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0597/1095] iio: adc: ad7476: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 19:59:56 +0200 Message-Id: <20220815180454.253495266@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 58b74555afc8affe4ae4f57d396349158433fc80 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to reflect that DMA safety 'may' require separate cachelines. Fixes tag is unlikely to be the actual introdution of the problem but is far enough back to cover any likely backporting. Fixes: 7a28fe3c93d6 ("staging:iio:ad7476: Squash driver into a single file.= ") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-14-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ad7476.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index a1e8b32671cf..94776f696290 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -44,13 +44,12 @@ struct ad7476_state { struct spi_transfer xfer; struct spi_message msg; /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. * Make the buffer large enough for one 16 bit sample and one 64 bit * aligned 64 bit timestamp. */ - unsigned char data[ALIGN(2, sizeof(s64)) + sizeof(s64)] - ____cacheline_aligned; + unsigned char data[ALIGN(2, sizeof(s64)) + sizeof(s64)] __aligned(IIO_DMA= _MINALIGN); }; =20 enum ad7476_supported_device_ids { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75679C25B08 for ; Mon, 15 Aug 2022 21:37:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348696AbiHOVhC (ORCPT ); Mon, 15 Aug 2022 17:37:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233940AbiHOVfb (ORCPT ); Mon, 15 Aug 2022 17:35:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EB2A5FF5C; Mon, 15 Aug 2022 12:24:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B7959610A3; Mon, 15 Aug 2022 19:24:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFF97C433D6; Mon, 15 Aug 2022 19:24:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591496; bh=t39TPq0Qi6nLwofCxmJh29LPIR/lAo6j3QHCbsl6r3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PW5aBbZ5rURUhFjOAKBA0D7v3rGeDndoVfzTU7WCKNNYGhM0WST0GCoftOFBnbbmD I8QB6jM/fYaRL4nH9O6IARPtnIe5erdGLJ3oxUNu/LtNa13wQWR3AVxCo4zxLha5y9 +UmNQYtolZIIvQq1Al61eYRzCgPMni6mdyU/BND0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0598/1095] iio: adc: ad7606: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 19:59:57 +0200 Message-Id: <20220815180454.284961537@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 6268c6eebb13f228d418f9adaca848b3ed5b3cf9 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_ALIGN definition. Update the comment to reflect the fact DMA safety 'may' require separate cachelines. Fixes: 7989b4bb23fe ("iio: adc: ad7616: Add support for AD7616 ADC") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-15-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ad7606.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ad7606.h b/drivers/iio/adc/ad7606.h index 4f82d7c9acfd..2dc4f599f9df 100644 --- a/drivers/iio/adc/ad7606.h +++ b/drivers/iio/adc/ad7606.h @@ -116,11 +116,11 @@ struct ad7606_state { struct completion completion; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. * 16 * 16-bit samples + 64-bit timestamp */ - unsigned short data[20] ____cacheline_aligned; + unsigned short data[20] __aligned(IIO_DMA_MINALIGN); __be16 d16[2]; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB72FC00140 for ; Mon, 15 Aug 2022 21:37:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348710AbiHOVhG (ORCPT ); Mon, 15 Aug 2022 17:37:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348725AbiHOVfn (ORCPT ); Mon, 15 Aug 2022 17:35:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3322FA6C79; Mon, 15 Aug 2022 12:25:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 66D93B810C6; Mon, 15 Aug 2022 19:25:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF5AFC433C1; Mon, 15 Aug 2022 19:24:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591499; bh=Y2GwHYK57VPhob4MMTy54v3pRXav3yAzyrwJQXChdOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cfmO18ltOjGXlUwG6W/l+AdwcCTFaAKmZqehKbPk2gd0LbXk+eQmyYhUP4s1rHltF fm4qoO0c+tBILe60Vfb4xPafJkj68Pm/63bRxvK55/zO/37EzE3Fhz0hjZhx+qCOto RbSY3WvRwMLZP43eliA+4mPNFxGkjWFyk9B9Sv3s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Lars-Peter Clausen , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0599/1095] iio: adc: ad7766: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 19:59:58 +0200 Message-Id: <20220815180454.332627555@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 009ae227a1dace2d4d27c804e5bd65907e1d0557 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to reflect the fact DMA safety 'may' require separate cachelines. Fixes: aa16c6bd0e09 ("iio:adc: Add support for AD7766/AD7767") Signed-off-by: Jonathan Cameron Cc: Lars-Peter Clausen Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-16-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ad7766.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/ad7766.c b/drivers/iio/adc/ad7766.c index 51ee9482e0df..3079a0872947 100644 --- a/drivers/iio/adc/ad7766.c +++ b/drivers/iio/adc/ad7766.c @@ -45,13 +45,12 @@ struct ad7766 { struct spi_message msg; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. * Make the buffer large enough for one 24 bit sample and one 64 bit * aligned 64 bit timestamp. */ - unsigned char data[ALIGN(3, sizeof(s64)) + sizeof(s64)] - ____cacheline_aligned; + unsigned char data[ALIGN(3, sizeof(s64)) + sizeof(s64)] __aligned(IIO_DMA= _MINALIGN); }; =20 /* --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F825C3F6B0 for ; Mon, 15 Aug 2022 21:37:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348722AbiHOVhI (ORCPT ); Mon, 15 Aug 2022 17:37:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348774AbiHOVfs (ORCPT ); Mon, 15 Aug 2022 17:35:48 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14A16FFF53; Mon, 15 Aug 2022 12:25:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 17E4CCE12C4; Mon, 15 Aug 2022 19:25:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD92EC433C1; Mon, 15 Aug 2022 19:25:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591502; bh=0tf/0b2AdKUQKK7C+WXjRWbwcUQVHS+l9wXcB+tIzXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bijS7b/eaUsRsStq7gX3UlUPDVX2Egn1u6kZySNFeo4rvMSkAHbN66Ea9P6+eScLX 2m8/W3h/WJNy0ECTIBSyHvx0ho5GQZ45IkLDPCQOLnnnduaq1NSpBcl1vShiuEAKQ5 +IPe0yBdUfDv73FSBmMYpRwz6EEL+Y7RwgnA4Ow0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0600/1095] iio: adc: ad7768-1: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 19:59:59 +0200 Message-Id: <20220815180454.364390403@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 211f810f8fae05c1f78e531b2b113ea1ab3d1ce7 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to reflect that separate cachelines 'may' be required. Fixes: a5f8c7da3dbe ("iio: adc: Add AD7768-1 ADC basic support") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-17-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ad7768-1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c index aa42ba759fa1..60f394da4640 100644 --- a/drivers/iio/adc/ad7768-1.c +++ b/drivers/iio/adc/ad7768-1.c @@ -163,7 +163,7 @@ struct ad7768_state { struct gpio_desc *gpio_sync_in; const char *labels[ARRAY_SIZE(ad7768_channels)]; /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ union { @@ -173,7 +173,7 @@ struct ad7768_state { } scan; __be32 d32; u8 d8[2]; - } data ____cacheline_aligned; + } data __aligned(IIO_DMA_MINALIGN); }; =20 static int ad7768_spi_reg_read(struct ad7768_state *st, unsigned int addr, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40314C25B0E for ; Mon, 15 Aug 2022 21:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348746AbiHOVhT (ORCPT ); Mon, 15 Aug 2022 17:37:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348792AbiHOVft (ORCPT ); Mon, 15 Aug 2022 17:35:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EECA7FFF62; Mon, 15 Aug 2022 12:25:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D822CB810C6; Mon, 15 Aug 2022 19:25:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C36AC433C1; Mon, 15 Aug 2022 19:25:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591505; bh=AjPHz77vqqBU48LoSmJeUUwmzkiS0wYCFE5oYXiVF7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0USe6qc7CT0xDXuUpjHx57RE1tOwssPNZpukYlXBLP3gu27GGDFc7qQ/402bjfTF6 9TaPmQkef1AyRiLH3DWZWD/cyVQZAlL2tHkaKoR3MLS+0uoVixvsLJFuGdnXocKgXk GRyypUXT2pAjj2ZllMov4FJh2u39z/NeJh3uym/E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Lars-Peter Clausen , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0601/1095] iio: adc: ad7887: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:00 +0200 Message-Id: <20220815180454.394611037@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit b330ea6bc52468e183ced79189ff064f36c64aa7 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes tag is clearly not where this was introduced but it is very unlikely anyone will back port it past that point. Fixes: 65dd3d3d7a9b ("staging:iio:ad7887: Squash everything into one file") Signed-off-by: Jonathan Cameron Cc: Lars-Peter Clausen Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-18-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ad7887.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c index f64999714a4d..965bdc8aa696 100644 --- a/drivers/iio/adc/ad7887.c +++ b/drivers/iio/adc/ad7887.c @@ -66,13 +66,12 @@ struct ad7887_state { unsigned char tx_cmd_buf[4]; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. * Buffer needs to be large enough to hold two 16 bit samples and a * 64 bit aligned 64 bit timestamp. */ - unsigned char data[ALIGN(4, sizeof(s64)) + sizeof(s64)] - ____cacheline_aligned; + unsigned char data[ALIGN(4, sizeof(s64)) + sizeof(s64)] __aligned(IIO_DMA= _MINALIGN); }; =20 enum ad7887_supported_device_ids { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74C62C00140 for ; Mon, 15 Aug 2022 21:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348764AbiHOVhX (ORCPT ); Mon, 15 Aug 2022 17:37:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348807AbiHOVfv (ORCPT ); Mon, 15 Aug 2022 17:35:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60807FFF47; Mon, 15 Aug 2022 12:25:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 446EB60FDA; Mon, 15 Aug 2022 19:25:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B476C433C1; Mon, 15 Aug 2022 19:25:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591508; bh=MSNzXfALZ1pphQIwP5x3WoJA46cNHX8cL9fbPNhrhJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m+GlVLeFbJhqJb2ofJQRVhSejDVIJMrlaBGTFJ0Kfi1gvudXxv2KpOhb+yTWIgWv0 Wo5xVuyU4fUJ73qTKELaJ8sXnz5XypkfJmXEFU0dF2yAe4migTHLw1W6YBoqe5go+z Iw8XYCMvijSWSk2cAXc+EX1Mvni9srPGZLET+6Ak= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0602/1095] iio: adc: ad7923: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:01 +0200 Message-Id: <20220815180454.442193006@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 908af45d7057345bc910940a9340f7a1d8935875 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Note that some other fixes have applied to this line of code that may complicate automated backporting. Signed-off-by: Jonathan Cameron Fixes: 0eac259db28f ("IIO ADC support for AD7923") Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-19-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ad7923.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ad7923.c b/drivers/iio/adc/ad7923.c index 069b561ee768..edad1f30121d 100644 --- a/drivers/iio/adc/ad7923.c +++ b/drivers/iio/adc/ad7923.c @@ -57,12 +57,12 @@ struct ad7923_state { unsigned int settings; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. * Ensure rx_buf can be directly used in iio_push_to_buffers_with_timetamp * Length =3D 8 channels + 4 extra for 8 byte timestamp */ - __be16 rx_buf[12] ____cacheline_aligned; + __be16 rx_buf[12] __aligned(IIO_DMA_MINALIGN); __be16 tx_buf[4]; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 884D0C00140 for ; Mon, 15 Aug 2022 21:37:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348781AbiHOVh1 (ORCPT ); Mon, 15 Aug 2022 17:37:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348829AbiHOVfy (ORCPT ); Mon, 15 Aug 2022 17:35:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E344294; Mon, 15 Aug 2022 12:25:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CDD7AB81062; Mon, 15 Aug 2022 19:25:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 169F2C433C1; Mon, 15 Aug 2022 19:25:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591511; bh=XciHyWnDBuPvGWWBjFygaD/yU+5gy1/2Vrxjlwf9EMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gqbQHg6MoWgh1KX8iTcgcUIPrSnicBDzfS/thS5u6U2s1RUf1YQCtbSwfvpbvAwOc m767vi0onkhRmDJ6ShvjC4xwYnORuAJAOXh9h9LnTNeLEvoNdJ3OJJdQboqBasuDOD f3VUR50l13+4nDwihSFYR7E5jvvd7WyweQdLwD90= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Charles-Antoine Couret , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0603/1095] iio: adc: ad7949: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:02 +0200 Message-Id: <20220815180454.487326058@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 9c6c7eff7d4a53efd4d0818f8664259a1862665a ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Note the fixes tag predates some changes to this line of code so automated application of this fix may fail. Fixes: 7f40e0614317 ("iio:adc:ad7949: Add AD7949 ADC driver family") Signed-off-by: Jonathan Cameron Cc: Charles-Antoine Couret Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-20-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ad7949.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ad7949.c b/drivers/iio/adc/ad7949.c index 44bb5fde83de..ed4c1656ca75 100644 --- a/drivers/iio/adc/ad7949.c +++ b/drivers/iio/adc/ad7949.c @@ -86,7 +86,7 @@ struct ad7949_adc_chip { u8 resolution; u16 cfg; unsigned int current_channel; - u16 buffer ____cacheline_aligned; + u16 buffer __aligned(IIO_DMA_MINALIGN); __be16 buf8b; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8465C00140 for ; Mon, 15 Aug 2022 21:37:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348796AbiHOVhf (ORCPT ); Mon, 15 Aug 2022 17:37:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348843AbiHOVfz (ORCPT ); Mon, 15 Aug 2022 17:35:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5505ECDE; Mon, 15 Aug 2022 12:25:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8F08EB80FD3; Mon, 15 Aug 2022 19:25:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0392FC433D6; Mon, 15 Aug 2022 19:25:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591514; bh=LqalBsGRa1zu1E5rLHt1XDvDX+e1QcLKHZ/M7/gLjvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uUC1e8Uoen+rd4+RdGkumaOmjP+4dxFr97zC5ld+22o7WFqCjEwloSd7Kfuqn7rN7 ieWd5ch9adJwNJDN7pm13XPy1pSABYc51ofK8+WpmbE7Lyh59Tx4359I0XuXBfMbs1 pkv7XX9Nqbn48XR86xpAXxVPZmHPmJ18taee7kIQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0604/1095] iio: adc: hi8435: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:03 +0200 Message-Id: <20220815180454.524576584@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 48e4ae96b0b10f93de23b86fd34e573c44e95ab3 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 72aa29ce0a59 ("iio: adc: hi8435: Holt HI-8435 threshold detector") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-21-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/hi8435.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/hi8435.c b/drivers/iio/adc/hi8435.c index 8eb0140df133..771fa12bdc02 100644 --- a/drivers/iio/adc/hi8435.c +++ b/drivers/iio/adc/hi8435.c @@ -49,7 +49,7 @@ struct hi8435_priv { =20 unsigned threshold_lo[2]; /* GND-Open and Supply-Open thresholds */ unsigned threshold_hi[2]; /* GND-Open and Supply-Open thresholds */ - u8 reg_buffer[3] ____cacheline_aligned; + u8 reg_buffer[3] __aligned(IIO_DMA_MINALIGN); }; =20 static int hi8435_readb(struct hi8435_priv *priv, u8 reg, u8 *val) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDC73C25B0E for ; Mon, 15 Aug 2022 21:37:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347655AbiHOVhj (ORCPT ); Mon, 15 Aug 2022 17:37:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348854AbiHOVf5 (ORCPT ); Mon, 15 Aug 2022 17:35:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8152F6D; Mon, 15 Aug 2022 12:25:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F3C5860FDA; Mon, 15 Aug 2022 19:25:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBB85C433C1; Mon, 15 Aug 2022 19:25:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591517; bh=2oBrmztX5ILvCe0bc7Fv7LeINu6uTnScN9hYYDlqA7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OUczLce0h4M6Mmhptn9Qk+2WISlNLI5BIWk6nsgKhk9BsDeizTLo1lyMqosbYef1j LoTX3ojYXSNj0pYSRw7n39R4+fmaqow5XGwyLlSf2SIdUT0HsCscZbEpWRSlm6YuzE dWWOLkxmuAqAS9M4tE7W1lT5kwbDfTKvn5uemaP0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0605/1095] iio: adc: ltc2496: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:04 +0200 Message-Id: <20220815180454.558946978@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 1673b7ca2dc1fb3b8d7c94a112496c02d34ae449 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: e4c5c4dfaa88 ("iio: adc: new driver to support Linear technology's l= tc2496") Signed-off-by: Jonathan Cameron Cc: Uwe Kleine-K=C3=B6nig Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-22-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ltc2496.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ltc2496.c b/drivers/iio/adc/ltc2496.c index 5a55f79f2574..dfb3bb5997e5 100644 --- a/drivers/iio/adc/ltc2496.c +++ b/drivers/iio/adc/ltc2496.c @@ -24,10 +24,10 @@ struct ltc2496_driverdata { struct spi_device *spi; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ - unsigned char rxbuf[3] ____cacheline_aligned; + unsigned char rxbuf[3] __aligned(IIO_DMA_MINALIGN); unsigned char txbuf[3]; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EF8EC25B08 for ; Mon, 15 Aug 2022 21:37:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348898AbiHOVhw (ORCPT ); Mon, 15 Aug 2022 17:37:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348907AbiHOVgE (ORCPT ); Mon, 15 Aug 2022 17:36:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3B131A06A; Mon, 15 Aug 2022 12:25:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 271AEB81123; Mon, 15 Aug 2022 19:25:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BC28C433C1; Mon, 15 Aug 2022 19:25:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591523; bh=VIEVbCtvRfjrQKPCYjdDan+CnTB02T8MRrjk4iIJJi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MX9x+6T+8WH6ToREawWdADJU3HDUrne1ckhVm09O3z8zDpKt7nswkMyObMSQnBBwI wSTtT2d8IU+jc30ILiRFAiLGzr5fMY5d0GJlsMf2muYFfoypNwj49l0dajzAC/txl8 bO7W/U0md5f3tCRDEapNp64prP3aohsnz3ktNbKE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Michael Hennerich , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0606/1095] iio: adc: ltc2497: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:05 +0200 Message-Id: <20220815180454.601018830@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 6ebf401d555ee1e75e779b865d38e171db0aa1f2 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: bc82222fcca1 ("iio:adc: Driver for Linear Technology LTC2497 ADC") Signed-off-by: Jonathan Cameron Cc: Michael Hennerich Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-23-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ltc2497.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ltc2497.c b/drivers/iio/adc/ltc2497.c index 1adddf5a88a9..f7c786f37ceb 100644 --- a/drivers/iio/adc/ltc2497.c +++ b/drivers/iio/adc/ltc2497.c @@ -20,10 +20,10 @@ struct ltc2497_driverdata { struct ltc2497core_driverdata common_ddata; struct i2c_client *client; /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ - __be32 buf ____cacheline_aligned; + __be32 buf __aligned(IIO_DMA_MINALIGN); }; =20 static int ltc2497_result_and_measure(struct ltc2497core_driverdata *ddata, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15FF2C00140 for ; Mon, 15 Aug 2022 21:37:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348868AbiHOVhs (ORCPT ); Mon, 15 Aug 2022 17:37:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348909AbiHOVgE (ORCPT ); Mon, 15 Aug 2022 17:36:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED2B92AE07; Mon, 15 Aug 2022 12:25:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8AB6460693; Mon, 15 Aug 2022 19:25:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D2F6C433D6; Mon, 15 Aug 2022 19:25:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591526; bh=b6g+upfMBir4x9nL9lFu0jJvrq9WrlcAMfMMZBcT7hY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XVJiPiFh6mJV4WQeO0FCTlnSI6dTx0TM8SL0wNbe1GN6MMkuw6Ua7tWZGsZJ+xA3w IXfVhsFyY5Of1aBIrww/mv9HsyoQmRwOObCXm1/hJ9RlBU8V8fobV0rQO6i//2WrYt U3fw5/U49XRC83b8a8a8i4A4pbsqdnf4V+Otc9sE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0607/1095] iio: adc: max1027: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:06 +0200 Message-Id: <20220815180454.636359074@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit e754fb7e7a05e3838c9aa044b4114869dd0d1e17 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: fc167f624833 ("iio: add support of the max1027") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-24-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/max1027.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c index 4daf1d576c4e..b725d012625c 100644 --- a/drivers/iio/adc/max1027.c +++ b/drivers/iio/adc/max1027.c @@ -272,7 +272,7 @@ struct max1027_state { struct mutex lock; struct completion complete; =20 - u8 reg ____cacheline_aligned; + u8 reg __aligned(IIO_DMA_MINALIGN); }; =20 static int max1027_wait_eoc(struct iio_dev *indio_dev) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91EECC25B0E for ; Mon, 15 Aug 2022 21:37:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232453AbiHOVh6 (ORCPT ); Mon, 15 Aug 2022 17:37:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348936AbiHOVgI (ORCPT ); Mon, 15 Aug 2022 17:36:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88F484E84B; Mon, 15 Aug 2022 12:25:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 25884B810C6; Mon, 15 Aug 2022 19:25:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7661FC433D6; Mon, 15 Aug 2022 19:25:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591529; bh=/abWgxfwLHAtA6csyAuy8ia+oSqJcSA0RuGdE9gcwn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sO1Ai902yBTZEpuSm9Wty7DB7Se4it9ORhR86+SRiXyh9a5d3BRrMcu4UJxK7HRP6 5f5ny3F6rrrnZkpdt93i6cSimoZ4+0bF3KYiwfC/Qv/p5kY+dKacUxxKHxZmGFnbkR 0TiVNKPI4aVbC++cTiroRRWZFjIwB1wHPW+h3GBo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Jacopo Mondi , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0608/1095] iio: adc: max11100: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:07 +0200 Message-Id: <20220815180454.676084487@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 51f30d63145cc84cb8a8e0ec96f9a8b73e6b5448 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: a8e7e88df9ec ("iio: adc: Add Maxim MAX11100 driver") Signed-off-by: Jonathan Cameron Acked-by: Jacopo Mondi Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-25-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/max11100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/max11100.c b/drivers/iio/adc/max11100.c index eb1ce6a0315c..49e38dca8fe2 100644 --- a/drivers/iio/adc/max11100.c +++ b/drivers/iio/adc/max11100.c @@ -33,10 +33,10 @@ struct max11100_state { struct spi_device *spi; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ - u8 buffer[3] ____cacheline_aligned; + u8 buffer[3] __aligned(IIO_DMA_MINALIGN); }; =20 static const struct iio_chan_spec max11100_channels[] =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9860EC00140 for ; Mon, 15 Aug 2022 21:38:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348925AbiHOViB (ORCPT ); Mon, 15 Aug 2022 17:38:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348952AbiHOVgK (ORCPT ); Mon, 15 Aug 2022 17:36:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C058552FCB; Mon, 15 Aug 2022 12:25:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 78AE06100A; Mon, 15 Aug 2022 19:25:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B977C433D7; Mon, 15 Aug 2022 19:25:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591532; bh=DnZBMLmbY0UB+P699kmZk580RYZWU16RG1msKGGlh8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qk7mnq8KgzkVK0vICcmVEq0bnbP4eRMIlDo0atzHP8wwrYIWM67Qz/0YmutD5LtlU vKgcYdr2o+/4DwMmV67OyxHVlbawKZkB3xC4QXNZ8CjJwuMADepf6huPfhrINg1sU1 +dKDuKNcvRAGN6nmUXWSoJz9zuz3maXzZOTPWgRI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Akinobu Mita , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0609/1095] iio: adc: max1118: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:08 +0200 Message-Id: <20220815180454.708500910@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit f746ab0bac5b335b09143dcd01db6f9f26d0c9ec ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: a9e9c7153e96 ("iio: adc: add max1117/max1118/max1119 ADC driver") Signed-off-by: Jonathan Cameron Cc: Akinobu Mita Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-26-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/max1118.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/max1118.c b/drivers/iio/adc/max1118.c index a41bc570be21..75ab57d9aef7 100644 --- a/drivers/iio/adc/max1118.c +++ b/drivers/iio/adc/max1118.c @@ -42,7 +42,7 @@ struct max1118 { s64 ts __aligned(8); } scan; =20 - u8 data ____cacheline_aligned; + u8 data __aligned(IIO_DMA_MINALIGN); }; =20 #define MAX1118_CHANNEL(ch) \ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34B33C25B08 for ; Mon, 15 Aug 2022 21:38:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239817AbiHOViW (ORCPT ); Mon, 15 Aug 2022 17:38:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348981AbiHOVgR (ORCPT ); Mon, 15 Aug 2022 17:36:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06DB6DD758; Mon, 15 Aug 2022 12:25:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A200BB81125; Mon, 15 Aug 2022 19:25:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07409C433C1; Mon, 15 Aug 2022 19:25:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591536; bh=fkS7l4Mv2LRZIz6RMO+Qh8fV/b9u3krpLRZn04lzIRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gZ6nuqlwws6y/45uLVJkEfVcQ1smW6bnrqUSbQlJlt2KV0Fb4TX2U4M3f3mbAdqUd V4gybGg8hPHU/45jtsxqBHeogoP/iMXTO9O8zt+TK5Oulg14sYLn1By1oXinKhNfXM MGFjC6wT3yUuEpO/ZA9assezAH+5Ps2pTdMpZTYA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Alexandru Lazar , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0610/1095] iio: adc: max1241: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:09 +0200 Message-Id: <20220815180454.743090611@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 9d7019e43ee67a48cef63f8f23f002233064d390 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 8a80a71d9020 ("iio: adc: Add MAX1241 driver") Signed-off-by: Jonathan Cameron Acked-by: Alexandru Lazar Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-27-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/max1241.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/max1241.c b/drivers/iio/adc/max1241.c index a5afd84af58b..a815ad1f6913 100644 --- a/drivers/iio/adc/max1241.c +++ b/drivers/iio/adc/max1241.c @@ -26,7 +26,7 @@ struct max1241 { struct regulator *vref; struct gpio_desc *shutdown; =20 - __be16 data ____cacheline_aligned; + __be16 data __aligned(IIO_DMA_MINALIGN); }; =20 static const struct iio_chan_spec max1241_channels[] =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D4BDC25B08 for ; Mon, 15 Aug 2022 21:38:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349010AbiHOVi2 (ORCPT ); Mon, 15 Aug 2022 17:38:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348987AbiHOVgU (ORCPT ); Mon, 15 Aug 2022 17:36:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F88F2E9E4; Mon, 15 Aug 2022 12:25:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EBDF360693; Mon, 15 Aug 2022 19:25:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF794C433C1; Mon, 15 Aug 2022 19:25:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591539; bh=x7EQv7AD4LMoZ4EMaiSnO2H0ly6bAUK3LBIgSix3a/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dQrDO66k0wgGsE1bJq3/T+dNViLDbokG1s4Q8/KIWlObhJcrqou4RtrsnfXJzSmJM pPVtPHStU4A23DQg/R31WTqjedkPhxXWyKMPh3flZ6yPmV7p1Y9RpHkH2YoX8H8wOe 7AFuwD4YM715CVHT/dUnSsqsOSy+H8Z0lrKl4Q7g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Michael Welling , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0611/1095] iio: adc: mcp320x: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:10 +0200 Message-Id: <20220815180454.777785472@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit e770f78036ce4327caf285873f4b20564a8b4f0f ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Worth noting the fixes tag refers to the same issue being observed on a platform that probably had only 64 byte cachelines. Fixes: 0e81bc99a082 ("iio: mcp320x: Fix occasional incorrect readings") Signed-off-by: Jonathan Cameron Cc: Michael Welling Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-28-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/mcp320x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c index b4c69acb33e3..f3b81798b3c9 100644 --- a/drivers/iio/adc/mcp320x.c +++ b/drivers/iio/adc/mcp320x.c @@ -92,7 +92,7 @@ struct mcp320x { struct mutex lock; const struct mcp320x_chip_info *chip_info; =20 - u8 tx_buf ____cacheline_aligned; + u8 tx_buf __aligned(IIO_DMA_MINALIGN); u8 rx_buf[4]; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0591C25B08 for ; Mon, 15 Aug 2022 21:38:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349055AbiHOVii (ORCPT ); Mon, 15 Aug 2022 17:38:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349001AbiHOVg0 (ORCPT ); Mon, 15 Aug 2022 17:36:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84B982E9FA; Mon, 15 Aug 2022 12:25:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1CB3A61089; Mon, 15 Aug 2022 19:25:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11D84C433D6; Mon, 15 Aug 2022 19:25:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591542; bh=Cie5ZzNsVo95h6m7oSLL4Rw3+kDPsVt9/3cxcdnlirs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gQT2Yc7qCXJ2QFkXBNyEeg2mDXVryUspcIgEcrG9SBQmbSPMvrXNQ3h/Tf5FVHkTX ZIAG5ZbF1t1qSRRw5LBOG0+Xvwpda+AJo+F6QxX0LXa0KQIwHJAQnUUPZunr/tR+0H 0AkvzcurEEEah7B0ToNZxuYD9A0xDMVZNhO7Jark= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Akinobu Mita , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0612/1095] iio: adc: ti-adc0832: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:11 +0200 Message-Id: <20220815180454.823435439@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 1e6bb81c23a84a078736a0f2a52bd765863e94ed ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: efc945fb729c ("iio: adc: add support for ADC0831/ADC0832/ADC0834/ADC= 0838 chips") Signed-off-by: Jonathan Cameron Cc: Akinobu Mita Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-29-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ti-adc0832.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ti-adc0832.c b/drivers/iio/adc/ti-adc0832.c index fb5e72600b96..b11ce555ba3b 100644 --- a/drivers/iio/adc/ti-adc0832.c +++ b/drivers/iio/adc/ti-adc0832.c @@ -36,7 +36,7 @@ struct adc0832 { */ u8 data[24] __aligned(8); =20 - u8 tx_buf[2] ____cacheline_aligned; + u8 tx_buf[2] __aligned(IIO_DMA_MINALIGN); u8 rx_buf[2]; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96AC2C25B0E for ; Mon, 15 Aug 2022 21:38:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348798AbiHOVip (ORCPT ); Mon, 15 Aug 2022 17:38:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349013AbiHOVg2 (ORCPT ); Mon, 15 Aug 2022 17:36:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02051AF0E4; Mon, 15 Aug 2022 12:25:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A0118B81123; Mon, 15 Aug 2022 19:25:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01F8CC433D6; Mon, 15 Aug 2022 19:25:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591545; bh=LKS5fls3b0rL9L9SXSmCMaU/hrG7AW6TsELGrKgnn0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ujuPzGws9vu8CinPTN70X42t8PlMCO1o9+Z+EZ3L4aO38n95xZSpaoOYYXdtBezVx J9cBjTYBheU5bGal4qcD+TE3JfaB1E9FfYXEpX7nldYz740Mj760z5iWAmOgz1iX+K HOa3vgKf29hO1umM2CwhnSl8sAIAPiWaH6XexMyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , =?UTF-8?q?M=C3=A5rten=20Lindahl?= , Sasha Levin Subject: [PATCH 5.18 0613/1095] iio: adc: ti-adc084s021: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:12 +0200 Message-Id: <20220815180454.864609448@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit bb102fd600d1d6c0020a4514197c0604c4a218d9 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: 3691e5a69449 ("iio: adc: add driver for the ti-adc084s021 chip") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Acked-by: M=C3=A5rten Lindahl Link: https://lore.kernel.org/r/20220508175712.647246-30-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ti-adc084s021.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ti-adc084s021.c b/drivers/iio/adc/ti-adc084s02= 1.c index c9b5d9aec3dc..1f6e53832e06 100644 --- a/drivers/iio/adc/ti-adc084s021.c +++ b/drivers/iio/adc/ti-adc084s021.c @@ -32,10 +32,10 @@ struct adc084s021 { s64 ts __aligned(8); } scan; /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache line. */ - u16 tx_buf[4] ____cacheline_aligned; + u16 tx_buf[4] __aligned(IIO_DMA_MINALIGN); __be16 rx_buf[5]; /* First 16-bits are trash */ }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE208C28B2C for ; Mon, 15 Aug 2022 21:38:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348829AbiHOViw (ORCPT ); Mon, 15 Aug 2022 17:38:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349015AbiHOVg2 (ORCPT ); Mon, 15 Aug 2022 17:36:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 659EA101593; Mon, 15 Aug 2022 12:25:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 00C046100A; Mon, 15 Aug 2022 19:25:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6227C433D7; Mon, 15 Aug 2022 19:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591548; bh=gjLriqIdzmeysA+p9MegAImHwIi1C5sySXkdAMnieJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XECm0eZ7n2LfsR7fHSElPwr3Z6ZuPMUr3cu0FdLNWzjU43uzXTFeqGeDfdwgj82a8 2Ldyo77ropvQ9UE9MFsYu+tIZW0ICDpQtLANQ1dDTxyj3S3XWThxCicPGpTtPvmpvs /f+Tj629spyFGAgsYXk9HnsH7X63sQRuggzVUy54= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0614/1095] iio: adc: ti-adc108s102: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:13 +0200 Message-Id: <20220815180454.909094176@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 6909fe17888b66ea53ebb15640f82b97daa587a0 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Dual fixes tags as two cases that were introduced in different patches. One of those patches is a fix however and likely to have been backported to stable kernels. Note the second alignment marking is likely to be unnecessary, but is left for now to keep this fix simple. Fixes: 3691e5a69449 ("iio: adc: add driver for the ti-adc084s021 chip") Fixes: cbe5c6977604 ("iio: adc: ti-adc108s102: Fix alignment of buffer push= ed to iio buffers.") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-31-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ti-adc108s102.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ti-adc108s102.c b/drivers/iio/adc/ti-adc108s10= 2.c index c8e48881c37f..c82a161630e1 100644 --- a/drivers/iio/adc/ti-adc108s102.c +++ b/drivers/iio/adc/ti-adc108s102.c @@ -77,8 +77,8 @@ struct adc108s102_state { * tx_buf: 8 channel read commands, plus 1 dummy command * rx_buf: 1 dummy response, 8 channel responses */ - __be16 rx_buf[9] ____cacheline_aligned; - __be16 tx_buf[9] ____cacheline_aligned; + __be16 rx_buf[9] __aligned(IIO_DMA_MINALIGN); + __be16 tx_buf[9] __aligned(IIO_DMA_MINALIGN); }; =20 #define ADC108S102_V_CHAN(index) \ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28DF2C00140 for ; Mon, 15 Aug 2022 21:39:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349103AbiHOVjA (ORCPT ); Mon, 15 Aug 2022 17:39:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349023AbiHOVg3 (ORCPT ); Mon, 15 Aug 2022 17:36:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20E7F1015A8; Mon, 15 Aug 2022 12:25:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B2F3E60FDA; Mon, 15 Aug 2022 19:25:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B446BC433D6; Mon, 15 Aug 2022 19:25:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591551; bh=5lzskJ0NY1Iz1wrIBAvJmV+7D2DRoPG61KDnsiVFxoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UvlfmQySZJLfGU0ZKlSAb73PIuSbRHnU4XSWDAjokVPY/p7Jlm5osRGLQ/r3bSqny d73Et3prPZbGUjlhvfWzckgJ51fNdb4gBl0zB5Q/MJ8Q9c0o0rQNhAtU8zAChTlNSw rjv5/vACWb+LYfANBqOl2BH+O3z6Spl5JICDdxYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Akinobu Mita , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0615/1095] iio: adc: ti-adc12138: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:14 +0200 Message-Id: <20220815180454.943364212@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 76890c3bce6003caf53b283c49a210280cb8ea33 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 50a6edb1b6e0 ("iio: adc: add ADC12130/ADC12132/ADC12138 ADC driver") Signed-off-by: Jonathan Cameron Cc: Akinobu Mita Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-32-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ti-adc12138.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ti-adc12138.c b/drivers/iio/adc/ti-adc12138.c index 59d75d09604f..c0a72d72f3a9 100644 --- a/drivers/iio/adc/ti-adc12138.c +++ b/drivers/iio/adc/ti-adc12138.c @@ -55,7 +55,7 @@ struct adc12138 { */ __be16 data[20] __aligned(8); =20 - u8 tx_buf[2] ____cacheline_aligned; + u8 tx_buf[2] __aligned(IIO_DMA_MINALIGN); u8 rx_buf[2]; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52EC6C25B08 for ; Mon, 15 Aug 2022 21:39:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349115AbiHOVjJ (ORCPT ); Mon, 15 Aug 2022 17:39:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349035AbiHOVga (ORCPT ); Mon, 15 Aug 2022 17:36:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C726C2ED50; Mon, 15 Aug 2022 12:25:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6535160EF0; Mon, 15 Aug 2022 19:25:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71085C433C1; Mon, 15 Aug 2022 19:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591556; bh=DodGUGhhzSe5+/SXIMWvmy4wXtJmh4+oOf6w+xHaOjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TCNDj7GrIDwvuAIe4oiOYj8NnDVXSrwFc9V9/BmMf+W3q3e160DJBkenrNsX+8m66 V5llyUP46jpFg+sMcDyAgAQ0eigbLTLOxMsQApdaueCgdanqEoJgAOZVcpvHQZlvPI MP8jctYSZoeYFpFkTumL5PzydfWGQCytDuKKPna4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0616/1095] iio: adc: ti-adc128s052: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:15 +0200 Message-Id: <20220815180454.987375655@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 23c81e7a7e5204a08b553d07362d3082926663b8 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 913b86468674 ("iio: adc: Add TI ADC128S052") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-33-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ti-adc128s052.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s05= 2.c index 8e7adec87755..622fd384983c 100644 --- a/drivers/iio/adc/ti-adc128s052.c +++ b/drivers/iio/adc/ti-adc128s052.c @@ -29,7 +29,7 @@ struct adc128 { struct regulator *reg; struct mutex lock; =20 - u8 buffer[2] ____cacheline_aligned; + u8 buffer[2] __aligned(IIO_DMA_MINALIGN); }; =20 static int adc128_adc_conversion(struct adc128 *adc, u8 channel) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F20CC00140 for ; Mon, 15 Aug 2022 21:39:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349125AbiHOVjP (ORCPT ); Mon, 15 Aug 2022 17:39:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349037AbiHOVgb (ORCPT ); Mon, 15 Aug 2022 17:36:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9463F3DF0B; Mon, 15 Aug 2022 12:26:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 42D3FB81062; Mon, 15 Aug 2022 19:26:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F3C7C433C1; Mon, 15 Aug 2022 19:25:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591560; bh=nXLCx3HLzLLuXAw+x75a8CCR+YLWXfcXcmLGSMI+CgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I1Qz/hCb9+T6eCc7yCLBufnGDY90feavnX7SzboFug9vY2ePdAu4QpRkm4wRtbZ/Q diZ6/vFNk/l5MZxAhcly4lIbuzvnBMHyc7Z7k9HCwhZs1UeiVl/oogAxpp5fzXI1Ky GF8EUYdenhR3RV8nUO5WSJEZ4MU9WJ9a0yvCC6b0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Matt Ranostay , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0617/1095] iio: adc: ti-adc161s626: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:16 +0200 Message-Id: <20220815180455.017739046@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 3a828f204a110dc9f253c4cf3c1103d00a0681da ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 4d671b71beef ("iio: adc: ti-adc161s626: add support for TI 1-channel= differential ADCs") Signed-off-by: Jonathan Cameron Cc: Matt Ranostay Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-34-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ti-adc161s626.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ti-adc161s626.c b/drivers/iio/adc/ti-adc161s62= 6.c index 75ca7f1c8726..b789891dcf49 100644 --- a/drivers/iio/adc/ti-adc161s626.c +++ b/drivers/iio/adc/ti-adc161s626.c @@ -71,7 +71,7 @@ struct ti_adc_data { u8 read_size; u8 shift; =20 - u8 buffer[16] ____cacheline_aligned; + u8 buffer[16] __aligned(IIO_DMA_MINALIGN); }; =20 static int ti_adc_read_measurement(struct ti_adc_data *data, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D699C25B0E for ; Mon, 15 Aug 2022 21:43:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349311AbiHOVnJ (ORCPT ); Mon, 15 Aug 2022 17:43:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349087AbiHOVit (ORCPT ); Mon, 15 Aug 2022 17:38:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 780312F013; Mon, 15 Aug 2022 12:28:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3C352B8107A; Mon, 15 Aug 2022 19:28:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E876C433D7; Mon, 15 Aug 2022 19:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591698; bh=32JWxgsHlTzu0E40Cgme+bJNd6tCN/0r15ri5IIlPQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iuJ/C840GiPhxtS0xOZSzFBtFB5/5eUoeQzzijYylUgvf/qI9he95luEqEkQrjsCO uwS1g7w7elG3gkoQVmtJAUBzYNe7b87kM5fXvh4elVPC0DIUrU6sqObsAqVFOeNivk 61y1yNGBmTbSW0cVaQOvtRiW4xj+bKkUlq4XAgrE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0618/1095] iio: adc: ti-ads124s08: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:17 +0200 Message-Id: <20220815180455.052791484@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 7df19bd26cc0b85ff997cc9e2aaea712836b5460 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: e717f8c6dfec ("iio: adc: Add the TI ads124s08 ADC code") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-35-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ti-ads124s08.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ti-ads124s08.c b/drivers/iio/adc/ti-ads124s08.c index 767b3b634809..64833156c199 100644 --- a/drivers/iio/adc/ti-ads124s08.c +++ b/drivers/iio/adc/ti-ads124s08.c @@ -106,7 +106,7 @@ struct ads124s_private { * timestamp is maintained. */ u32 buffer[ADS124S08_MAX_CHANNELS + sizeof(s64)/sizeof(u32)] __aligned(8); - u8 data[5] ____cacheline_aligned; + u8 data[5] __aligned(IIO_DMA_MINALIGN); }; =20 #define ADS124S08_CHAN(index) \ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B6CFC25B08 for ; Mon, 15 Aug 2022 21:40:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349194AbiHOVj5 (ORCPT ); Mon, 15 Aug 2022 17:39:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349073AbiHOVgg (ORCPT ); Mon, 15 Aug 2022 17:36:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11ED420F; Mon, 15 Aug 2022 12:26:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C8CA3B80FD3; Mon, 15 Aug 2022 19:26:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 154C6C433C1; Mon, 15 Aug 2022 19:26:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591581; bh=o+aJkkxQg1xdwE3GE8FcNT0QI3kL4+w+o02wQgstK8o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MMwUKPPjoROqNOzJrbLzSRY5u8u4/yhAmkMEld8Jc2VDyYlSncElMj0h30UpjdI9Q QG/3ZTdSE+xVO9NSLqIVlVQzK/da9745gRI1UNTXgPeI7WYPMtyPmbWXXJA6ErkgVE 5Jkycg3tCf+mg+Oo8l/dZBsies0bcbUufovRvrgY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Tomislav Denis , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0619/1095] iio: adc: ti-ads131e08: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:18 +0200 Message-Id: <20220815180455.091558736@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 55afdd050c063ae4b8dbd566107a030c00d005fd ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: d935eddd2799 ("iio: adc: Add driver for Texas Instruments ADS131E0x = ADC family") Signed-off-by: Jonathan Cameron Cc: Tomislav Denis Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-36-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ti-ads131e08.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ti-ads131e08.c b/drivers/iio/adc/ti-ads131e08.c index 80a09817c119..32237cacc9a3 100644 --- a/drivers/iio/adc/ti-ads131e08.c +++ b/drivers/iio/adc/ti-ads131e08.c @@ -105,7 +105,7 @@ struct ads131e08_state { s64 ts __aligned(8); } tmp_buf; =20 - u8 tx_buf[3] ____cacheline_aligned; + u8 tx_buf[3] __aligned(IIO_DMA_MINALIGN); /* * Add extra one padding byte to be able to access the last channel * value using u32 pointer --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F83FC282E7 for ; Mon, 15 Aug 2022 21:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349355AbiHOVlC (ORCPT ); Mon, 15 Aug 2022 17:41:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348693AbiHOVhC (ORCPT ); Mon, 15 Aug 2022 17:37:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E9F3302; Mon, 15 Aug 2022 12:26:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 21E1EB810C6; Mon, 15 Aug 2022 19:26:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60079C433C1; Mon, 15 Aug 2022 19:26:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591615; bh=Wqu/9eB3IBw4Rlu01YrHumyUkZpx4nb+nPdYyBgmIMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NxXoQ0w8ht2xcj1wHScdJoaEzxAmsM6BYR57mOSRUIvmIfcwoSG7LIOjmU6XpH3dY mAoXl5QaiNoXq43FL634/cnD5nVqbe9EuIC72lCWMNKejNm/e0EysrvVvhC8/3mi4v Gwau9BqhcPiMcYenjA6A8QGest3tW2aeox78O0Uk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0620/1095] iio: adc: ti-ads7950: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:19 +0200 Message-Id: <20220815180455.122978329@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit dd54ba8b2469f6ae665c529623a9454ce5293ca8 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: 902c4b2446d4 ("iio: adc: New driver for TI ADS7950 chips") Signed-off-by: Jonathan Cameron Acked-by: David Lechner Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-37-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ti-ads7950.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c index e3658b969c5b..2cc9a9bd9db6 100644 --- a/drivers/iio/adc/ti-ads7950.c +++ b/drivers/iio/adc/ti-ads7950.c @@ -102,11 +102,11 @@ struct ti_ads7950_state { unsigned int gpio_cmd_settings_bitmask; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ u16 rx_buf[TI_ADS7950_MAX_CHAN + 2 + TI_ADS7950_TIMESTAMP_SIZE] - ____cacheline_aligned; + __aligned(IIO_DMA_MINALIGN); u16 tx_buf[TI_ADS7950_MAX_CHAN + 2]; u16 single_tx; u16 single_rx; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 824D0C32762 for ; Mon, 15 Aug 2022 21:42:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349733AbiHOVls (ORCPT ); Mon, 15 Aug 2022 17:41:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348845AbiHOVhp (ORCPT ); Mon, 15 Aug 2022 17:37:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16B8DDEAB; Mon, 15 Aug 2022 12:27:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AA138610A1; Mon, 15 Aug 2022 19:27:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 969E1C433D6; Mon, 15 Aug 2022 19:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591651; bh=sbKiUkLWI4e9wRtVslmNKBxQISuUd3FwZfgPSd6f2fE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dGuhKSbsXS/AGKCzk1bDZkWcLeymfE1EbOFcg82Lg75GARs2REkJephyDRAMSUaHu sqo1tFW+3kbUt5BXdWVqURfvHWgqCzM1euGt2I38xCM2XaroB96PItGIB4QvcKFwzK Z98f8MJYZ/Vw/TdxKnph2utGRdWKVCm+0aqZ5F4Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0621/1095] iio: adc: ti-ads8344: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:20 +0200 Message-Id: <20220815180455.168008422@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 8966b11e5a14aaabc747ee97a7942fd50a681402 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 8dd2d7c0fed7 ("iio: adc: Add driver for the TI ADS8344 A/DC chips") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-38-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ti-ads8344.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ti-ads8344.c b/drivers/iio/adc/ti-ads8344.c index c96d2a9ba924..bbd85cb47f81 100644 --- a/drivers/iio/adc/ti-ads8344.c +++ b/drivers/iio/adc/ti-ads8344.c @@ -28,7 +28,7 @@ struct ads8344 { */ struct mutex lock; =20 - u8 tx_buf ____cacheline_aligned; + u8 tx_buf __aligned(IIO_DMA_MINALIGN); u8 rx_buf[3]; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1748EC00140 for ; Mon, 15 Aug 2022 21:42:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349184AbiHOVmd (ORCPT ); Mon, 15 Aug 2022 17:42:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348991AbiHOVi1 (ORCPT ); Mon, 15 Aug 2022 17:38:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAADB29CA7; Mon, 15 Aug 2022 12:28:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 55EFF610A1; Mon, 15 Aug 2022 19:28:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45FDBC433D6; Mon, 15 Aug 2022 19:27:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591679; bh=mHv6ngVvU2rDaW48u+G7k6U7y4oj2bzPh78/WkNmH8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=htfEwjSUALQ2ib6cuSCKxfwNsVxM526HLU5/RzcmEaI6NjZ+EXB6nQzWS9ltFehAY Bzn3mB+XhKz/xKS9CTzcKan2dpKIPGRrKueb3+3k6nM/xbWuNdKtqax5L/lcx0jeTz YM9bWBmdek1Zl9/yGC5l0+i7Hwjhlr7GlKxT5QGY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0622/1095] iio: adc: ti-ads8688: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:21 +0200 Message-Id: <20220815180455.199419913@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit a2105d87eb8eb03591515df10102e04a1c9e0e46 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 3e87e7838328 ("iio: adc: Add TI ADS8688") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-39-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ti-ads8688.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c index 22c2583eedd0..7ee14c6d9f46 100644 --- a/drivers/iio/adc/ti-ads8688.c +++ b/drivers/iio/adc/ti-ads8688.c @@ -71,7 +71,7 @@ struct ads8688_state { union { __be32 d32; u8 d8[4]; - } data[2] ____cacheline_aligned; + } data[2] __aligned(IIO_DMA_MINALIGN); }; =20 enum ads8688_id { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA07EC00140 for ; Mon, 15 Aug 2022 21:42:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349228AbiHOVms (ORCPT ); Mon, 15 Aug 2022 17:42:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348996AbiHOVi1 (ORCPT ); Mon, 15 Aug 2022 17:38:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 481B22A43F; Mon, 15 Aug 2022 12:28:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F0BEDB81109; Mon, 15 Aug 2022 19:28:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 516E6C433C1; Mon, 15 Aug 2022 19:28:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591682; bh=5YLn6KVnTu45C/6F30pnuNxkCjssGKF9M3riSTvOykY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TYz/gDZXEFXwJ/SsGg2Tru/3wMShOoy8zY4S7o23Q4g2nXxXiiPXm4zVObh8Lhbx8 VlGkRqXXLptncIhdeqc8YlGDwFJti5XXcpECzKYMLlt8PIU0bMgK8RK4/bZLb7iOdR fTdsIEEdI6QlICPT7oqgpZVEvlQZAC9JxJx0vPbs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0623/1095] iio: adc: ti-tlc4541: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:22 +0200 Message-Id: <20220815180455.236407383@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 62fa19bf484bfeb52c56b7c6d6a6b1222c597f9c ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: ac2bec9d587c ("iio: adc: tlc4541: add support for TI tlc4541 adc") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-40-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/ti-tlc4541.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ti-tlc4541.c b/drivers/iio/adc/ti-tlc4541.c index 2406eda9dfc6..30f629a553a1 100644 --- a/drivers/iio/adc/ti-tlc4541.c +++ b/drivers/iio/adc/ti-tlc4541.c @@ -37,12 +37,12 @@ struct tlc4541_state { struct spi_message scan_single_msg; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. * 2 bytes data + 6 bytes padding + 8 bytes timestamp when * call iio_push_to_buffers_with_timestamp. */ - __be16 rx_buf[8] ____cacheline_aligned; + __be16 rx_buf[8] __aligned(IIO_DMA_MINALIGN); }; =20 struct tlc4541_chip_info { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3202C25B08 for ; Mon, 15 Aug 2022 21:42:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349213AbiHOVmh (ORCPT ); Mon, 15 Aug 2022 17:42:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231453AbiHOVi1 (ORCPT ); Mon, 15 Aug 2022 17:38:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 790482A96C; Mon, 15 Aug 2022 12:28:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 39452B81109; Mon, 15 Aug 2022 19:28:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81F16C433C1; Mon, 15 Aug 2022 19:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591686; bh=SKMP35W+5RYcCpTlONFWVCGGNxzI2fUXOAlmrPnng1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QV+n6GkbEdQNVlormvZWID8VzhMZOzCUE8ZXFuB5JjkTqn5XrzRldstvOnUZ0QHk3 PSrbX7N6Nu+dMK3pgVTG5xp9ShtuSS/VgOzuSCaw1Lv14Ae+flRrAeJy42jIOEXPUc GAIh4tImnRKpGYIvvZgCqPhQL7ENZzyJTtJKEPD4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Cosmin Tanislav , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0624/1095] iio: addac: ad74413r: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:23 +0200 Message-Id: <20220815180455.270466619@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 00eb2b8a077062557772234019ecd6045b8b6298 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: fea251b6a5db ("iio: addac: add AD74413R driver") Signed-off-by: Jonathan Cameron Cc: Cosmin Tanislav Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-41-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/addac/ad74413r.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c index acd230a6af35..6a66d7a65db7 100644 --- a/drivers/iio/addac/ad74413r.c +++ b/drivers/iio/addac/ad74413r.c @@ -77,13 +77,13 @@ struct ad74413r_state { struct spi_transfer adc_samples_xfer[AD74413R_CHANNEL_MAX + 1]; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ struct { u8 rx_buf[AD74413R_FRAME_SIZE * AD74413R_CHANNEL_MAX]; s64 timestamp; - } adc_samples_buf ____cacheline_aligned; + } adc_samples_buf __aligned(IIO_DMA_MINALIGN); =20 u8 adc_samples_tx_buf[AD74413R_FRAME_SIZE * AD74413R_CHANNEL_MAX]; u8 reg_tx_buf[AD74413R_FRAME_SIZE]; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86D26C25B08 for ; Mon, 15 Aug 2022 21:42:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349244AbiHOVm4 (ORCPT ); Mon, 15 Aug 2022 17:42:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349003AbiHOVi2 (ORCPT ); Mon, 15 Aug 2022 17:38:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AE4C2AC69; Mon, 15 Aug 2022 12:28:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 38525B81109; Mon, 15 Aug 2022 19:28:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 947F4C433C1; Mon, 15 Aug 2022 19:28:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591689; bh=b2Wl1cgr0hCIZksa0yi8sM5DSO722BIyjIUYCwkDi+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F1/W9OOSQ35Q4saq7SN8hr4CxR8NgLX9IntB9SeKik8KiNq5MU6JFXscWs0+rLCms wRPuhX0TMTXUK14Xr+qHQgzrN4F6LAaBilbwXL/tOQbuuLuwawWnyV9NykXQyzz0uC kMBi6sjzzSskJq3A1npYQrJ6RX2cvBqF0e+2XNjo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0625/1095] iio: amplifiers: ad8366: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:24 +0200 Message-Id: <20220815180455.306530468@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 026bffa458d029a5f15ac3f82a9bb0f64aca403d ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: e71d42e03c60 ("iio: amplifiers: New driver for AD8366 Dual-Digital V= ariable Gain Amplifier") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-42-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/amplifiers/ad8366.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad836= 6.c index 1134ae12e531..f2c2ea79a07f 100644 --- a/drivers/iio/amplifiers/ad8366.c +++ b/drivers/iio/amplifiers/ad8366.c @@ -45,10 +45,10 @@ struct ad8366_state { enum ad8366_type type; struct ad8366_info *info; /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ - unsigned char data[2] ____cacheline_aligned; + unsigned char data[2] __aligned(IIO_DMA_MINALIGN); }; =20 static struct ad8366_info ad8366_infos[] =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF015C00140 for ; Mon, 15 Aug 2022 21:43:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349255AbiHOVnA (ORCPT ); Mon, 15 Aug 2022 17:43:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349039AbiHOVib (ORCPT ); Mon, 15 Aug 2022 17:38:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B12072DABF; Mon, 15 Aug 2022 12:28:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 40E74B81062; Mon, 15 Aug 2022 19:28:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8939EC433C1; Mon, 15 Aug 2022 19:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591691; bh=yEOsJkf0JUzDzGdTK4Ndj7FqnAcfm+AIdD0yILuhxek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cTH+jBm02Q8WdLNeWmun/BZe9gvVujX9uh7/eDnKwsibv4umteRuW4sFgVyiRqBNK AvtnWBD2VMkgeF/9tQuY84Sm/6KOjeoRCgUgQHZOjROn9uvFzzwyB2gYNiN0UgFFI1 oYxo8jV8I1gEawEEoPN8lv2bohrR62XWcRhzMqG0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0626/1095] iio: common: ssp: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:25 +0200 Message-Id: <20220815180455.342707295@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 314d2b1978bb3d20b1ec239f4e28c394da493f36 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 50dd64d57eee ("iio: common: ssp_sensors: Add sensorhub driver") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-43-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/common/ssp_sensors/ssp.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iio/common/ssp_sensors/ssp.h b/drivers/iio/common/ssp_= sensors/ssp.h index abb832795619..f649cdecc277 100644 --- a/drivers/iio/common/ssp_sensors/ssp.h +++ b/drivers/iio/common/ssp_sensors/ssp.h @@ -221,8 +221,7 @@ struct ssp_data { struct iio_dev *sensor_devs[SSP_SENSOR_MAX]; atomic_t enable_refcount; =20 - __le16 header_buffer[SSP_HEADER_BUFFER_SIZE / sizeof(__le16)] - ____cacheline_aligned; + __le16 header_buffer[SSP_HEADER_BUFFER_SIZE / sizeof(__le16)] __aligned(I= IO_DMA_MINALIGN); }; =20 void ssp_clean_pending_list(struct ssp_data *data); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C4DFC25B0E for ; Mon, 15 Aug 2022 21:43:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349275AbiHOVnF (ORCPT ); Mon, 15 Aug 2022 17:43:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349072AbiHOVik (ORCPT ); Mon, 15 Aug 2022 17:38:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 932C72DAAD; Mon, 15 Aug 2022 12:28:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3DD94B8107A; Mon, 15 Aug 2022 19:28:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78C6CC433D7; Mon, 15 Aug 2022 19:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591694; bh=Io0DB5x+gnquA+xXfXJz5X6mRYlmgxS+14UpLcqOgTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SB5qSChdUq0mdquNrt4Q3LcGvYY/OLgxYG4oxmjCW4ThaDiID8y8RwDlp2SVvHbjk 5AC6TwhcXtOr+eGl3hqhQ+3V+kAkp3ABLDhUt2UP5EZ05dwkJqYYsZ4xIiAuE9peFw yJlZimzLpV3RbxAlTZAsnTul11zu60qquqZSlHQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Lars-Peter Clausen , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0627/1095] iio: dac: ad5064: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:26 +0200 Message-Id: <20220815180455.388878497@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 8779b88c214fa0f8fdfb9c54a124f468884d356a ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: 6a17a0768f77 ("iio:dac:ad5064: Add support for the ad5629r and ad566= 9r") Signed-off-by: Jonathan Cameron Cc: Lars-Peter Clausen Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-44-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad5064.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c index 27ee2c63c5d4..e3b1add34f46 100644 --- a/drivers/iio/dac/ad5064.c +++ b/drivers/iio/dac/ad5064.c @@ -115,13 +115,13 @@ struct ad5064_state { struct mutex lock; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ union { u8 i2c[3]; __be32 spi; - } data ____cacheline_aligned; + } data __aligned(IIO_DMA_MINALIGN); }; =20 enum ad5064_type { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 917CDC25B0E for ; Mon, 15 Aug 2022 21:39:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349071AbiHOVjy (ORCPT ); Mon, 15 Aug 2022 17:39:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349074AbiHOVgg (ORCPT ); Mon, 15 Aug 2022 17:36:36 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E58EDF4C; Mon, 15 Aug 2022 12:26:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 4010ECE12C8; Mon, 15 Aug 2022 19:26:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17390C433C1; Mon, 15 Aug 2022 19:26:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591584; bh=HLQ2nldeCGQ4S65ve1hTIYx9ITuoCpzbvZnJt2vv1aU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JibUvFGpV86Va/4TAcldEJkk4V5qw5h9oDi/lOEqsbtoIMEzQlRcPZFHureuYRRL9 jDDrUtAYmbO4XemvVj7FVp9JY1E4TCVwg+ZpHVHQ91xH9no0vuxI3boAUpn1eANnjQ up/xDJOT6VTS63YZJNSlMuNN5J8RzmXIpuZb3pu0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Lars-Peter Clausen , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0628/1095] iio: dac: ad5360: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:27 +0200 Message-Id: <20220815180455.419064911@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 94ec314e1bd686b669c24385ce2dbc967eb74147 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: a3e2940c24d3 ("staging:iio:dac: Add AD5360 driver") Signed-off-by: Jonathan Cameron Cc: Lars-Peter Clausen Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-45-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad5360.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/dac/ad5360.c b/drivers/iio/dac/ad5360.c index ecbc6a51d60f..1bde696a572c 100644 --- a/drivers/iio/dac/ad5360.c +++ b/drivers/iio/dac/ad5360.c @@ -79,13 +79,13 @@ struct ad5360_state { struct mutex lock; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ union { __be32 d32; u8 d8[4]; - } data[2] ____cacheline_aligned; + } data[2] __aligned(IIO_DMA_MINALIGN); }; =20 enum ad5360_type { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91D82C00140 for ; Mon, 15 Aug 2022 21:40:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229752AbiHOVkN (ORCPT ); Mon, 15 Aug 2022 17:40:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349077AbiHOVgg (ORCPT ); Mon, 15 Aug 2022 17:36:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05004C16; Mon, 15 Aug 2022 12:26:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 96061610A1; Mon, 15 Aug 2022 19:26:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83627C433D6; Mon, 15 Aug 2022 19:26:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591588; bh=QBs0OPYI9aWofdr2sU6p/jBAbryfkGs77ZODg51bgv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pEy9es+yXzls3c2H9bEP43XcTsryqm5InDJeb7nqMt6/RC6eQwDl+bciXXAsZInLw 72gMaEWI0+wjHDyWFxDDkDF+04ecJFNKJdY2nlY2VQ2arbFKjm+iALjIQDarETcGdw 3S7JEY0zjF7Y2mH0cDwtbNqAPPMqYGkzqUNRyIRY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Lars-Peter Clausen , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0629/1095] iio: dac: ad5421: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:28 +0200 Message-Id: <20220815180455.463747917@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit d2b240d3d31c66df4d2da54c75ff8e27a0e006c3 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: 5691b23489db ("staging:iio:dac: Add AD5421 driver") Signed-off-by: Jonathan Cameron Cc: Lars-Peter Clausen Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-46-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad5421.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/dac/ad5421.c b/drivers/iio/dac/ad5421.c index eedf661d32b2..7644acfd879e 100644 --- a/drivers/iio/dac/ad5421.c +++ b/drivers/iio/dac/ad5421.c @@ -72,13 +72,13 @@ struct ad5421_state { struct mutex lock; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ union { __be32 d32; u8 d8[4]; - } data[2] ____cacheline_aligned; + } data[2] __aligned(IIO_DMA_MINALIGN); }; =20 static const struct iio_event_spec ad5421_current_event[] =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D9BEC00140 for ; Mon, 15 Aug 2022 21:40:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349096AbiHOVkJ (ORCPT ); Mon, 15 Aug 2022 17:40:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349080AbiHOVgh (ORCPT ); Mon, 15 Aug 2022 17:36:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E447055B5; Mon, 15 Aug 2022 12:26:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 81E796102C; Mon, 15 Aug 2022 19:26:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AE70C433D6; Mon, 15 Aug 2022 19:26:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591590; bh=/CWyogt2Y8mS43e49FKvb48Fe5tDzFS/MYJg2ijo9dU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NXDIpibN24ohhedu18imLrFEvNlRSEyhbAETn+N6gxaWnaEsm71F8yQryq0eeAb/Z fQC5nObm0YukU/wdWh1kSwPXBNMXnYgTB0WyWe5yVp84My3HCOI9lbVmB2oStf9Ao6 yHUywzvNsgAi5L6n5Dl2tejZ6Jt7txTu88QImbkc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Lars-Peter Clausen , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0630/1095] iio: dac: ad5449: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:29 +0200 Message-Id: <20220815180455.502157083@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 678d536bb454e3bbedcaa68208550ac9dc1cc066 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: 8341dc04dfb3 ("iio:dac: Add support for the ad5449") Signed-off-by: Jonathan Cameron Cc: Lars-Peter Clausen Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-47-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad5449.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/dac/ad5449.c b/drivers/iio/dac/ad5449.c index bad9bdaafa94..4572d6f49275 100644 --- a/drivers/iio/dac/ad5449.c +++ b/drivers/iio/dac/ad5449.c @@ -68,10 +68,10 @@ struct ad5449 { uint16_t dac_cache[AD5449_MAX_CHANNELS]; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ - __be16 data[2] ____cacheline_aligned; + __be16 data[2] __aligned(IIO_DMA_MINALIGN); }; =20 enum ad5449_type { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 525BBC00140 for ; Mon, 15 Aug 2022 21:40:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343753AbiHOVkS (ORCPT ); Mon, 15 Aug 2022 17:40:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348591AbiHOVgr (ORCPT ); Mon, 15 Aug 2022 17:36:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E8EB27B0C; Mon, 15 Aug 2022 12:26:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A00956102C; Mon, 15 Aug 2022 19:26:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94014C433D6; Mon, 15 Aug 2022 19:26:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591594; bh=ubhr0oCw+NmXN4y20R4+URbD/0qmCOyALhGD+sLVmtA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fWg5g4J0Fn1ytFj7cCRCDRttyQBBm0GSfjGDcjhJ7UqQHjhshQt/zGmWvdNGhx+fI WD/qr1hsxWPpf4X+jgwk5bpu0iovv0VmyXFptUrO4c98GT7HibE5wSj526X0phrUjb Ie7EPe1uYhIf0VZ+cGA8FKGJHCxDO+Zx0PXCzqbU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Lars-Peter Clausen , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0631/1095] iio: dac: ad5504: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:30 +0200 Message-Id: <20220815180455.541825828@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 00b9737caa5aaed5cf45a7c7498edf5957efa3b2 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 0dbe59c7a788 ("iio:ad5504: Do not store transfer buffers on the stac= k") Signed-off-by: Jonathan Cameron Cc: Lars-Peter Clausen Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-48-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad5504.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c index 8507573aa13e..e472c9564edf 100644 --- a/drivers/iio/dac/ad5504.c +++ b/drivers/iio/dac/ad5504.c @@ -54,7 +54,7 @@ struct ad5504_state { unsigned pwr_down_mask; unsigned pwr_down_mode; =20 - __be16 data[2] ____cacheline_aligned; + __be16 data[2] __aligned(IIO_DMA_MINALIGN); }; =20 /* --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F22FC00140 for ; Mon, 15 Aug 2022 21:40:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349116AbiHOVk2 (ORCPT ); Mon, 15 Aug 2022 17:40:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348642AbiHOVg5 (ORCPT ); Mon, 15 Aug 2022 17:36:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CC0AAD; Mon, 15 Aug 2022 12:26:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CC3C4610A3; Mon, 15 Aug 2022 19:26:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDA80C433C1; Mon, 15 Aug 2022 19:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591597; bh=K1mckkucQ53SKXsVQAHvieVbLZoUpM1bXDgk3yp9K1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dTrL2BBN3uJOj5JieFAzFoIAn6byj9kAOQVubirjAJmnZk5YQdeRDqfXB0CqVE6OY 7h/2JyIZuGGmXho8W/1nuw/0yWQx/KWODCRQwK1QkG38mYh5hbJrnaFg86N+Z5spDE bVKkCSTjxzV00ZxTEJrXLb5T8VFncUphfjO5yJ2Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Paul Cercueil , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0632/1095] iio: dac: ad5592r: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:31 +0200 Message-Id: <20220815180455.589344187@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 4a4a79c06caeec47003bcbee1cf3094479f26e24 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 56ca9db862bf ("iio: dac: Add support for the AD5592R/AD5593R ADCs/DA= Cs") Signed-off-by: Jonathan Cameron Cc: Paul Cercueil Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-49-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad5592r-base.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iio/dac/ad5592r-base.h b/drivers/iio/dac/ad5592r-base.h index 2a22ef691996..cc7be426cbc8 100644 --- a/drivers/iio/dac/ad5592r-base.h +++ b/drivers/iio/dac/ad5592r-base.h @@ -14,6 +14,8 @@ #include #include =20 +#include + struct device; struct ad5592r_state; =20 @@ -65,7 +67,7 @@ struct ad5592r_state { u8 gpio_in; u8 gpio_val; =20 - __be16 spi_msg ____cacheline_aligned; + __be16 spi_msg __aligned(IIO_DMA_MINALIGN); __be16 spi_msg_nop; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D05D6C00140 for ; Mon, 15 Aug 2022 21:42:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349234AbiHOVkk (ORCPT ); Mon, 15 Aug 2022 17:40:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348643AbiHOVg6 (ORCPT ); Mon, 15 Aug 2022 17:36:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11483C1; Mon, 15 Aug 2022 12:26:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B1DEEB810C6; Mon, 15 Aug 2022 19:26:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0730BC433C1; Mon, 15 Aug 2022 19:26:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591600; bh=FzjM4HdHxjLmZ684q6puJoDo94H7dfh4vykYfgUVssE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nzEYZRCWVSrEETSXUoMaBRtXtnwI/w7n5CXpilMPNjDj7WjT9duBsAvaPqcyOUL0A SZdinsnd7Iwn5ib95NbIxLZETpnpUf0bF9qnQ3qBlgsV6L5Xkz3nhOC7qibbUsQYFm LLhWP0apvNs/duThld/0kPdC0BvJRMhLGa67nLKU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0633/1095] iio: dac: ad5686: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:32 +0200 Message-Id: <20220815180455.625424604@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 444e38927d9af093de7cdc6afbb7afdc3485da2d ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: 0357e488b825 ("iio:dac:ad5686: Refactor the driver") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-50-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad5686.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h index cd5fff9e9d53..b7ade3a6b9b6 100644 --- a/drivers/iio/dac/ad5686.h +++ b/drivers/iio/dac/ad5686.h @@ -13,6 +13,8 @@ #include #include =20 +#include + #define AD5310_CMD(x) ((x) << 12) =20 #define AD5683_DATA(x) ((x) << 4) @@ -137,7 +139,7 @@ struct ad5686_state { struct mutex lock; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ =20 @@ -145,7 +147,7 @@ struct ad5686_state { __be32 d32; __be16 d16; u8 d8[4]; - } data[3] ____cacheline_aligned; + } data[3] __aligned(IIO_DMA_MINALIGN); }; =20 =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C558BC00140 for ; Mon, 15 Aug 2022 21:40:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349131AbiHOVkc (ORCPT ); Mon, 15 Aug 2022 17:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239483AbiHOVhA (ORCPT ); Mon, 15 Aug 2022 17:37:00 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB48EBC; Mon, 15 Aug 2022 12:26:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 2E1B4CE12C4; Mon, 15 Aug 2022 19:26:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BEBFC433C1; Mon, 15 Aug 2022 19:26:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591603; bh=MYq0vri+hL6QZjF+gfUQ6522RBfujaX6ufFN70VX1Qs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fTyF1Ho3Mec4OLEU09mT7EuA2tST94H+v03cI691NFlv6nDI3ob19Jjh90JS44YBd G2tyCIItArGCO0CKozp+pWlNe+UVsLKBEvwMMikNUWn8Ppj/4t33tRRhacgN36P4Bj T1eAfpIaAmax0VXPKG6cRlwjC2N74Ar4N9iGwow8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0634/1095] iio: dac: ad5755: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:33 +0200 Message-Id: <20220815180455.655796517@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit d0c167ceff2d833ee493dd58164dc87bd36e48aa ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: c499d029d805 ("iio:dac: Add ad5755 driver") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-51-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad5755.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c index 7a62e6e1d5f1..bbb345323b69 100644 --- a/drivers/iio/dac/ad5755.c +++ b/drivers/iio/dac/ad5755.c @@ -189,14 +189,14 @@ struct ad5755_state { struct mutex lock; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ =20 union { __be32 d32; u8 d8[4]; - } data[2] ____cacheline_aligned; + } data[2] __aligned(IIO_DMA_MINALIGN); }; =20 enum ad5755_type { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2902C25B0E for ; Mon, 15 Aug 2022 21:42:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349264AbiHOVkr (ORCPT ); Mon, 15 Aug 2022 17:40:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348653AbiHOVhB (ORCPT ); Mon, 15 Aug 2022 17:37:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27D97245; Mon, 15 Aug 2022 12:26:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DCC5EB810C6; Mon, 15 Aug 2022 19:26:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11F78C433C1; Mon, 15 Aug 2022 19:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591606; bh=a7T7QAPToG/q/uwHwCI/IaHbQDRIPKfATRnRq28sMIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gHgzvdHvYZVcfLEJYQ9K8d6aUrVCquDvzM8ig96IetGvCqFSPLPtreLWZ0TCAnnUP vrn+mtJqNqYrZNCU2qwm2rwKL86M6oiA2MzheEsTaQQbdGqbWUwMCGC7Xnp1b4Nmxl mD0y0jCNb0QfxegSd72gobdgD2uoJdtj7d35kJR0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0635/1095] iio: dac: ad5761: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:34 +0200 Message-Id: <20220815180455.688230229@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 7d12a61187aed57863c41032acbc1fae516d6e49 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: 131497acd88a ("iio: add ad5761 DAC driver") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-52-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad5761.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/dac/ad5761.c b/drivers/iio/dac/ad5761.c index 4cb8471db81e..6aa1a068adb0 100644 --- a/drivers/iio/dac/ad5761.c +++ b/drivers/iio/dac/ad5761.c @@ -70,13 +70,13 @@ struct ad5761_state { enum ad5761_voltage_range range; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ union { __be32 d32; u8 d8[4]; - } data[3] ____cacheline_aligned; + } data[3] __aligned(IIO_DMA_MINALIGN); }; =20 static const struct ad5761_range_params ad5761_range_params[] =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D738C25B08 for ; Mon, 15 Aug 2022 21:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349330AbiHOVk5 (ORCPT ); Mon, 15 Aug 2022 17:40:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348660AbiHOVhB (ORCPT ); Mon, 15 Aug 2022 17:37:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0664227A; Mon, 15 Aug 2022 12:26:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B7683B81109; Mon, 15 Aug 2022 19:26:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F043C433C1; Mon, 15 Aug 2022 19:26:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591609; bh=gVIVNV2xHbIDh/TWiE3uTRTO6JJqsDPQmQjuj5fS39E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=si5wb0iLBMc7ur3+hWLMBCo1I9u28Fq04H+KRBYv9KNREisiJDR+6OwszGhyJvgm6 39cZgPRmDrkvH0byZtN2fPt4G/dPIBme4RQVtW4n2+2re+Lsz7+LSPagLCgG0qzvYL KqwtRZhLCABYQs2ew+zyfEH+bqG2CLVGLcM8n5Bw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0636/1095] iio: dac: ad5764: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:35 +0200 Message-Id: <20220815180455.730784445@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit b378722a3e9bb51318c0de7eeb4d71f2fcd6987f ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: 68b14d7ea956 ("staging:iio:dac: Add AD5764 driver") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-53-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad5764.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/dac/ad5764.c b/drivers/iio/dac/ad5764.c index d235a8047ba0..26c049d5b73a 100644 --- a/drivers/iio/dac/ad5764.c +++ b/drivers/iio/dac/ad5764.c @@ -56,13 +56,13 @@ struct ad5764_state { struct mutex lock; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ union { __be32 d32; u8 d8[4]; - } data[2] ____cacheline_aligned; + } data[2] __aligned(IIO_DMA_MINALIGN); }; =20 enum ad5764_type { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1135C3F6B0 for ; Mon, 15 Aug 2022 21:42:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349300AbiHOVkx (ORCPT ); Mon, 15 Aug 2022 17:40:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348667AbiHOVhB (ORCPT ); Mon, 15 Aug 2022 17:37:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6CF32E4; Mon, 15 Aug 2022 12:26:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4C7F8610A3; Mon, 15 Aug 2022 19:26:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32FC7C433C1; Mon, 15 Aug 2022 19:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591612; bh=ZxyM/5s66vFtuDDP4J/0MFczF9QSWxEyXjL60nT96AE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q4J8NacJkVa2rfvCuXuFmNLXAm0VNy9z5I0OlBp6RKOyUHb+yzf/RI8KRUtgokO9Q 3KNK/A68Lh3Ie/qbIiJwCsQZURtSNNj4RTdZVFrsARYYu7rAQYFCBd2+HfBViPxgPx wCHmICwuVhi6zPTqKKGQpKknE1rkXuMtst9DR/+M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0637/1095] iio: dac: ad5766: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:36 +0200 Message-Id: <20220815180455.770895356@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit c32be7f035ae430ba9c142b03ceb9f935b09ed6b ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: fd9373e41b9b ("iio: dac: ad5766: add driver support for AD5766") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-54-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad5766.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/dac/ad5766.c b/drivers/iio/dac/ad5766.c index 43189af2fb1f..899894523752 100644 --- a/drivers/iio/dac/ad5766.c +++ b/drivers/iio/dac/ad5766.c @@ -123,7 +123,7 @@ struct ad5766_state { u32 d32; u16 w16[2]; u8 b8[4]; - } data[3] ____cacheline_aligned; + } data[3] __aligned(IIO_DMA_MINALIGN); }; =20 struct ad5766_span_tbl { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2D4FC25B0E for ; Mon, 15 Aug 2022 21:42:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349387AbiHOVlF (ORCPT ); Mon, 15 Aug 2022 17:41:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348737AbiHOVhQ (ORCPT ); Mon, 15 Aug 2022 17:37:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02206398; Mon, 15 Aug 2022 12:27:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 939FA610A4; Mon, 15 Aug 2022 19:26:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DE2BC433D6; Mon, 15 Aug 2022 19:26:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591619; bh=hV6Frwkr598I9q+vasMT+TjrxpsQwchMtgkxbByYxAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y/1umAvLlmcKlIJnK5CBSA0xJcFjFbtn70qOKaJ62bfSSR/A67MJ1foaZeG5g8gpw 5AxQ9UMqTtg8P5U+8XzigSyh37Wbb/WvR5sE4QpWr+PrPKMOxsjhzEpMOq0G1CwQq6 5Jq+trWjMAndnuVwzFczZszTxulXHVLsDeD7glwA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Alexandru Tachici , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0638/1095] iio: dac: ad5770r: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:37 +0200 Message-Id: <20220815180455.804433327@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 27f2261d16d01858b8e5baca5a1a515b040429c4 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: cbbb819837f6 ("iio: dac: ad5770r: Add AD5770R support") Signed-off-by: Jonathan Cameron Cc: Alexandru Tachici Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-55-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad5770r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/dac/ad5770r.c b/drivers/iio/dac/ad5770r.c index 7e2fd32e993a..f66d67402e43 100644 --- a/drivers/iio/dac/ad5770r.c +++ b/drivers/iio/dac/ad5770r.c @@ -140,7 +140,7 @@ struct ad5770r_state { bool ch_pwr_down[AD5770R_MAX_CHANNELS]; bool internal_ref; bool external_res; - u8 transf_buf[2] ____cacheline_aligned; + u8 transf_buf[2] __aligned(IIO_DMA_MINALIGN); }; =20 static const struct regmap_config ad5770r_spi_regmap_config =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55736C28B2C for ; Mon, 15 Aug 2022 21:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349414AbiHOVlG (ORCPT ); Mon, 15 Aug 2022 17:41:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348744AbiHOVhS (ORCPT ); Mon, 15 Aug 2022 17:37:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C1D6D58; Mon, 15 Aug 2022 12:27:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DCD356102C; Mon, 15 Aug 2022 19:27:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF070C433D6; Mon, 15 Aug 2022 19:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591622; bh=XaJ+R22eoV2RTw46FJeM8UhmYTLW/EGQcBQ5EsH8yz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UrQG9Vb2XENmHOQ3eEXg97rmeZXJJAI8U8D4uOsmenccYQqhmgZ0ideEgTj8lJ3LP zeKZNTfiFLWgX39n4dP7wd1Cj4uTrgZnBHclSneCBoj62onW+ugJclDv9YWE8KjcmW G6uldyIiAiknPFjui0tkFeZGJbWvm7cWvz8Gf69U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0639/1095] iio: dac: ad5791: Fix alignment for DMA saftey Date: Mon, 15 Aug 2022 20:00:38 +0200 Message-Id: <20220815180455.835723881@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit b2d5e9de77c8774a5a6cff59d928f2fa38cbc642 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 791bb52a0cd2 ("iio:ad5791: Do not store transfer buffers on the stac= k") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-56-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad5791.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/dac/ad5791.c b/drivers/iio/dac/ad5791.c index 2b14914b4050..ee7e89774d9d 100644 --- a/drivers/iio/dac/ad5791.c +++ b/drivers/iio/dac/ad5791.c @@ -95,7 +95,7 @@ struct ad5791_state { union { __be32 d32; u8 d8[4]; - } data[3] ____cacheline_aligned; + } data[3] __aligned(IIO_DMA_MINALIGN); }; =20 enum ad5791_supported_device_ids { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 739DCC28B2B for ; Mon, 15 Aug 2022 21:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349441AbiHOVlJ (ORCPT ); Mon, 15 Aug 2022 17:41:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348795AbiHOVhf (ORCPT ); Mon, 15 Aug 2022 17:37:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B4531098; Mon, 15 Aug 2022 12:27:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C9BE1B810C6; Mon, 15 Aug 2022 19:27:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0494BC433D6; Mon, 15 Aug 2022 19:27:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591625; bh=LGftA0U8NBZTIfcn4KRWoipw2faNgjkzfJIOn+gHiqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EO2TX0GqSC6QJuc9JFYIFITY3LIjJD1/G3oCQljKHXVlci++HXNsZhkMVaDntFOEf BwNZfVWyPK35rQ7PYKqF3vPztWM5z+yc9u3HSDn2Z1SFmisE/NMDIVYpL8zPOIMJWp 5dvLBkQh4HqyhOd+AP2TpAL5mmljMq2sX2DnJil0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Antoniu Miclaus , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0640/1095] iio: dac: ad7293: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:39 +0200 Message-Id: <20220815180455.873915128@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 8482468b30bdb16d4a764f995d7a63d94fa0cf40 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 0bb12606c05f ("iio:dac:ad7293: add support for AD7293") Signed-off-by: Jonathan Cameron Cc: Antoniu Miclaus Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-57-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad7293.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/dac/ad7293.c b/drivers/iio/dac/ad7293.c index 59a38ca4c3c7..06f05750d921 100644 --- a/drivers/iio/dac/ad7293.c +++ b/drivers/iio/dac/ad7293.c @@ -144,7 +144,7 @@ struct ad7293_state { struct regulator *reg_avdd; struct regulator *reg_vdrive; u8 page_select; - u8 data[3] ____cacheline_aligned; + u8 data[3] __aligned(IIO_DMA_MINALIGN); }; =20 static int ad7293_page_select(struct ad7293_state *st, unsigned int reg) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9256CC2BB43 for ; Mon, 15 Aug 2022 21:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349467AbiHOVlN (ORCPT ); Mon, 15 Aug 2022 17:41:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348802AbiHOVhf (ORCPT ); Mon, 15 Aug 2022 17:37:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69AC510AA; Mon, 15 Aug 2022 12:27:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 06665610A4; Mon, 15 Aug 2022 19:27:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0407EC433C1; Mon, 15 Aug 2022 19:27:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591628; bh=F1SgTCp/dDpk7c09QkTIr99nEeGl0qlY6WtZRHGFq90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q9DMmt65T48mK8Je9pxaRmfKmfnRi+7I7ur1Jifuhio19XbKm4PwFS/VqOfkf03mB 7dwpxZR0Q3OP9iyy0RZ4AdysdHihdOk+5DqxFkjYzZ0NJJc3dl1CwsQC0vRHCEUc+y aQmjqhJs0KDiOgU0t2zzkuHurm0heYZ5iPHPYNi0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0641/1095] iio: dac: ad7303: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:40 +0200 Message-Id: <20220815180455.908832388@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 69e51448ddfb9062efdf83e2d3179498e0aeb293 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: f83478240e74 ("iio:dac: Add support for the AD7303") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-58-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad7303.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/dac/ad7303.c b/drivers/iio/dac/ad7303.c index 91eaaf793b3e..558af7926a89 100644 --- a/drivers/iio/dac/ad7303.c +++ b/drivers/iio/dac/ad7303.c @@ -44,10 +44,10 @@ struct ad7303_state { =20 struct mutex lock; /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ - __be16 data ____cacheline_aligned; + __be16 data __aligned(IIO_DMA_MINALIGN); }; =20 static int ad7303_write(struct ad7303_state *st, unsigned int chan, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFCF8C2BB47 for ; Mon, 15 Aug 2022 21:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349524AbiHOVlW (ORCPT ); Mon, 15 Aug 2022 17:41:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348806AbiHOVhf (ORCPT ); Mon, 15 Aug 2022 17:37:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AEB925FE; Mon, 15 Aug 2022 12:27:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CB5D760EF0; Mon, 15 Aug 2022 19:27:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98D3BC433C1; Mon, 15 Aug 2022 19:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591632; bh=gBGcrnAMclXRoqc3CuPodqBwsRNPRWq2FLZYJfZT2Ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ngDD8ye1wOel+cP/UVQO8OItSUQRA4MrAUyHEOCWpdEz+YcbPBGzHglPl2Un5tqWb L3Cs+w/U6XvF8B1naWT8RiYwutkxXpkjrqA2WaXBylKI98DeXsVCYVMoVgDQknGZQk 1eN8SrR+ebPyIQ7UHNCOFxqprynNMrgVtKh/WMDM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0642/1095] iio: dac: ad8801: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:41 +0200 Message-Id: <20220815180455.953092388@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 1c20292c6b60cfc60a5e652174b8063e5cc03fec ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 7f270bc9a2d9 ("iio: dac: AD8801: add Analog Devices AD8801/AD8803 su= pport") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-59-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ad8801.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/dac/ad8801.c b/drivers/iio/dac/ad8801.c index 6be35c92d435..919e8c880697 100644 --- a/drivers/iio/dac/ad8801.c +++ b/drivers/iio/dac/ad8801.c @@ -26,7 +26,7 @@ struct ad8801_state { struct regulator *vrefh_reg; struct regulator *vrefl_reg; =20 - __be16 data ____cacheline_aligned; + __be16 data __aligned(IIO_DMA_MINALIGN); }; =20 static int ad8801_spi_write(struct ad8801_state *state, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1842C2BB41 for ; Mon, 15 Aug 2022 21:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349492AbiHOVlS (ORCPT ); Mon, 15 Aug 2022 17:41:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348808AbiHOVhg (ORCPT ); Mon, 15 Aug 2022 17:37:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F9552601; Mon, 15 Aug 2022 12:27:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B9D21B80FD3; Mon, 15 Aug 2022 19:27:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DBC8C433C1; Mon, 15 Aug 2022 19:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591635; bh=+MXzQxdX7/fGpLsiHW7FfFtJhrKVjphDAx5tGVZnnpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vuA8WIaan/3Gkhgee0GakbINa4+yvQUqPGTjfDZyfCjNLI5yfdvSVXGJBlDuXeF1b 82pKXTmtG3JE7aZQst54Pncz293V87OD9DkxwKQEX4UMt9oYMs2bpqYH85FAw79sB+ TMZfdycG5sxZXfcL58aSYmkZbjBh9YwfgAF1X+h0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0643/1095] iio: dac: ltc2688: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:42 +0200 Message-Id: <20220815180455.996050240@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 2030708377a219b548a9a36da57d3852382baf1d ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Update the comment to include 'may'. Fixes: 832cb9eeb931 ("iio: dac: add support for ltc2688") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-60-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ltc2688.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/dac/ltc2688.c b/drivers/iio/dac/ltc2688.c index 2f9c384885f4..04ec38b1cad1 100644 --- a/drivers/iio/dac/ltc2688.c +++ b/drivers/iio/dac/ltc2688.c @@ -91,10 +91,10 @@ struct ltc2688_state { struct mutex lock; int vref; /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ - u8 tx_data[6] ____cacheline_aligned; + u8 tx_data[6] __aligned(IIO_DMA_MINALIGN); u8 rx_data[3]; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0B9FC00140 for ; Mon, 15 Aug 2022 21:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349566AbiHOVl1 (ORCPT ); Mon, 15 Aug 2022 17:41:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348817AbiHOVhh (ORCPT ); Mon, 15 Aug 2022 17:37:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7777B2634; Mon, 15 Aug 2022 12:27:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 110B160EF0; Mon, 15 Aug 2022 19:27:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EA96C433D6; Mon, 15 Aug 2022 19:27:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591638; bh=dNFBnbzURibeCT2P3eZZy7892rCSoDAp9zS8hNV0w5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YZeug/TeByO1VSP7D9FdJ8Thld7QtTpcfb/T6jC1wZsWtHkggBasrgWQRS/qF+yIg 7NIKPiZJu1nRd266bKenOOnLZcyFe3NMrOitOfGQ56ccxqyFPLb1iTRIzcTadUeoG+ ta2L/zu0LhWcir2Zrvdndf+deO8WAZZWz3dYukAQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Michael Welling , Sasha Levin Subject: [PATCH 5.18 0644/1095] iio: dac: mcp4922: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:43 +0200 Message-Id: <20220815180456.044796888@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit e66bf04797f1f95a2402414c00e64d00f63d31ec ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 1b791fadf3a1 ("iio: dac: mcp4902/mcp4912/mcp4922 dac driver") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Acked-by: Michael Welling Link: https://lore.kernel.org/r/20220508175712.647246-61-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/mcp4922.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/dac/mcp4922.c b/drivers/iio/dac/mcp4922.c index cb9e60e71b91..6c0e31032c57 100644 --- a/drivers/iio/dac/mcp4922.c +++ b/drivers/iio/dac/mcp4922.c @@ -29,7 +29,7 @@ struct mcp4922_state { unsigned int value[MCP4922_NUM_CHANNELS]; unsigned int vref_mv; struct regulator *vref_reg; - u8 mosi[2] ____cacheline_aligned; + u8 mosi[2] __aligned(IIO_DMA_MINALIGN); }; =20 #define MCP4922_CHAN(chan, bits) { \ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4F64C32763 for ; Mon, 15 Aug 2022 21:42:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349601AbiHOVla (ORCPT ); Mon, 15 Aug 2022 17:41:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348825AbiHOVhl (ORCPT ); Mon, 15 Aug 2022 17:37:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F5825FAF; Mon, 15 Aug 2022 12:27:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F186EB81109; Mon, 15 Aug 2022 19:27:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 497DCC433D6; Mon, 15 Aug 2022 19:27:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591641; bh=ryrRA7jYT//H0xbqp5+yaatD738JmA/+IKo8VTpNAEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r4EL3t8YIW+klh9PiNu7IxpBub7/dg3dqkvhzdyZkalKKnsehWnoj1Acz+DLvKCku n8+DN8h1R01ycK2whGDvCJ/CPq+oO21vOlgCx8m/o/nN9bKZTQb9oC93KQ0SK5MhJR Jkbd48EYPh6fPYEzqToc2RWkuIhgHh17lRPkXIB0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0645/1095] iio: dac: ti-dac082s085: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:44 +0200 Message-Id: <20220815180456.076773995@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 03a0cc77f164e4e59b970d50c6e9a6caf06dae80 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 61011264c1af ("iio: dac: Add Texas Instruments 8/10/12-bit 2/4-chann= el DAC driver") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-62-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ti-dac082s085.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/dac/ti-dac082s085.c b/drivers/iio/dac/ti-dac082s08= 5.c index 4e1156e6deb2..f52ad8fa7747 100644 --- a/drivers/iio/dac/ti-dac082s085.c +++ b/drivers/iio/dac/ti-dac082s085.c @@ -55,7 +55,7 @@ struct ti_dac_chip { bool powerdown; u8 powerdown_mode; u8 resolution; - u8 buf[2] ____cacheline_aligned; + u8 buf[2] __aligned(IIO_DMA_MINALIGN); }; =20 #define WRITE_NOT_UPDATE(chan) (0x00 | (chan) << 6) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21686C2BB45 for ; Mon, 15 Aug 2022 21:42:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349633AbiHOVlh (ORCPT ); Mon, 15 Aug 2022 17:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244325AbiHOVhn (ORCPT ); Mon, 15 Aug 2022 17:37:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9B9A625D; Mon, 15 Aug 2022 12:27:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 54ED56102C; Mon, 15 Aug 2022 19:27:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 415B8C433D6; Mon, 15 Aug 2022 19:27:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591644; bh=qC+fTR72lKNazJDRxV9oVf7A+NTEtgKs6MUoauoVF+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JbahZjsL/YSn9Jiyu9ZnmMeC1OejoZLunMebMxszgRmtJ0loWsAswBlS3BlOMIj2E oY/JD21p8HhOLf4MSitLBDmvM9od7n7Y0lohmrDCbgAu7mczIiZbseOgXghLDa19Ek iGn+f3bO7J2MbwpqN0sr4MAngKm0+LOUYY2nsHU8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Sean Nyekjaer , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0646/1095] iio: dac: ti-dac5571: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:45 +0200 Message-Id: <20220815180456.117078873@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 58e22371539e01c742be5c30295f591a6a17e348 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: df38a4a72a3b ("iio: dac: add TI DAC5571 family support") Signed-off-by: Jonathan Cameron Cc: Sean Nyekjaer Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-63-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ti-dac5571.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/dac/ti-dac5571.c b/drivers/iio/dac/ti-dac5571.c index 0b775f943db3..ba68ea1e3455 100644 --- a/drivers/iio/dac/ti-dac5571.c +++ b/drivers/iio/dac/ti-dac5571.c @@ -52,7 +52,7 @@ struct dac5571_data { struct dac5571_spec const *spec; int (*dac5571_cmd)(struct dac5571_data *data, int channel, u16 val); int (*dac5571_pwrdwn)(struct dac5571_data *data, int channel, u8 pwrdwn); - u8 buf[3] ____cacheline_aligned; + u8 buf[3] __aligned(IIO_DMA_MINALIGN); }; =20 #define DAC5571_POWERDOWN(mode) ((mode) + 1) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41E5FC2BB9D for ; Mon, 15 Aug 2022 21:42:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349666AbiHOVlk (ORCPT ); Mon, 15 Aug 2022 17:41:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348832AbiHOVho (ORCPT ); Mon, 15 Aug 2022 17:37:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03922764B; Mon, 15 Aug 2022 12:27:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 97A7560EF0; Mon, 15 Aug 2022 19:27:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86967C433D6; Mon, 15 Aug 2022 19:27:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591648; bh=p602ogtdB0tsIU314uDoYRHO1tao2jzK++pqzAL2gtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bQbxzwexEAQIeXQProorV61ubUcd7oXbwc3bSaMEvQl3ZLus8/KuiA4/m1ydlc6h1 Drx+e0wY5m7u+cmQ838mpPQqbzPwF4YpMktpchqSY/LUqCPITN0KLiy/OMAo7May0c 0hELwNb+zBt5GH0rIpXLjDZuGFs4JKQvgxqmwBik= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Charles-Antoine Couret , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0647/1095] iio: dac: ti-dac7311: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:46 +0200 Message-Id: <20220815180456.156169522@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 3637c49ed54632d7c221af718d2d7b1d381d4b6e ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 7a02ef7907d8 ("iio:dac:ti-dac7311 Add driver for Texas Instrument DA= C7311") Signed-off-by: Jonathan Cameron Cc: Charles-Antoine Couret Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-64-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ti-dac7311.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/dac/ti-dac7311.c b/drivers/iio/dac/ti-dac7311.c index e10d17e60ed3..dd0a7b77838d 100644 --- a/drivers/iio/dac/ti-dac7311.c +++ b/drivers/iio/dac/ti-dac7311.c @@ -52,7 +52,7 @@ struct ti_dac_chip { bool powerdown; u8 powerdown_mode; u8 resolution; - u8 buf[2] ____cacheline_aligned; + u8 buf[2] __aligned(IIO_DMA_MINALIGN); }; =20 static u8 ti_dac_get_power(struct ti_dac_chip *ti_dac, bool powerdown) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61A48C2BBC5 for ; Mon, 15 Aug 2022 21:42:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349698AbiHOVlo (ORCPT ); Mon, 15 Aug 2022 17:41:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348843AbiHOVhp (ORCPT ); Mon, 15 Aug 2022 17:37:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30719DF45; Mon, 15 Aug 2022 12:27:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C06DB6102C; Mon, 15 Aug 2022 19:27:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC845C433C1; Mon, 15 Aug 2022 19:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591654; bh=E+QZQsBXl0dqxOYJkYZFIb9f68aE3v6YlJF+X8cSSBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yzGl0O2ClLvz6xPFrvSvfazqVdNUic/NoJtTM6GdSKGgaWDRLNYwCo9wovyihQsHd gh8nlFn6Mm5o1FbTzm3k44IZw5bbmoE6Z0mDNuzM5aDbBxkdL2lMxh1PbF7JHsbveJ /wrss0uvUi2YVUblD0UDdoVdj2/n3DubuqMHfeO0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Ricardo Ribalda , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0648/1095] iio: dac: ti-dac7612: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:47 +0200 Message-Id: <20220815180456.204927850@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit b9ac08b3282a95fcefb057c2886028a6807725d8 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Updated help text to 'may' require buffers to be in their own cacheline. Fixes: 977724d20584 ("iio:dac:ti-dac7612: Add driver for Texas Instruments = DAC7612") Signed-off-by: Jonathan Cameron Cc: Ricardo Ribalda Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-65-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/dac/ti-dac7612.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/dac/ti-dac7612.c b/drivers/iio/dac/ti-dac7612.c index 4c0f4b5e9ff4..8195815de26f 100644 --- a/drivers/iio/dac/ti-dac7612.c +++ b/drivers/iio/dac/ti-dac7612.c @@ -31,10 +31,10 @@ struct dac7612 { struct mutex lock; =20 /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ - uint8_t data[2] ____cacheline_aligned; + uint8_t data[2] __aligned(IIO_DMA_MINALIGN); }; =20 static int dac7612_cmd_single(struct dac7612 *priv, int channel, u16 val) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF53AC32764 for ; Mon, 15 Aug 2022 21:42:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349776AbiHOVl7 (ORCPT ); Mon, 15 Aug 2022 17:41:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348865AbiHOVhr (ORCPT ); Mon, 15 Aug 2022 17:37:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A76E611A09; Mon, 15 Aug 2022 12:27:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3F4826102C; Mon, 15 Aug 2022 19:27:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29464C433C1; Mon, 15 Aug 2022 19:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591657; bh=DosOz4ZtUjf4WnMkmhiZb3LJmvrLoyJntFkoAu9J33g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F/pMcPE2fGqGaZwEsWONEamv6aW7LKxhu8u+UMlGjf2ab35oklLoteGBXptG7wHTS umGtj/UWJ0fLC39qEMg8u3EtvZCQJezXIk7H5NpUMfVlT8aWXfWwVoLlsO63uZO1iT rFOlADfNEfD+rVk9ecgaGC8J4GX2tpe54fBrskkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0649/1095] iio: frequency: ad9523: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:48 +0200 Message-Id: <20220815180456.246035592@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 8ff2eb625c353b1491d9f89f1dfd52e7aef5734c ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Updated help text to 'may' require buffers to be in their own cacheline. Fixes: cd1678f96329 ("iio: frequency: New driver for AD9523 SPI Low Jitter = Clock Generator") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-66-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/frequency/ad9523.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c index a0f92c336fc4..31c97f9f2c1b 100644 --- a/drivers/iio/frequency/ad9523.c +++ b/drivers/iio/frequency/ad9523.c @@ -287,13 +287,13 @@ struct ad9523_state { struct mutex lock; =20 /* - * DMA (thus cache coherency maintenance) requires the - * transfer buffers to live in their own cache lines. + * DMA (thus cache coherency maintenance) may require that + * transfer buffers live in their own cache lines. */ union { __be32 d32; u8 d8[4]; - } data[2] ____cacheline_aligned; + } data[2] __aligned(IIO_DMA_MINALIGN); }; =20 static int ad9523_read(struct iio_dev *indio_dev, unsigned int addr) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1511C32757 for ; Mon, 15 Aug 2022 21:42:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349754AbiHOVlx (ORCPT ); Mon, 15 Aug 2022 17:41:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348870AbiHOVhs (ORCPT ); Mon, 15 Aug 2022 17:37:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2C9811A31; Mon, 15 Aug 2022 12:27:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 832326102C; Mon, 15 Aug 2022 19:27:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D32DC433C1; Mon, 15 Aug 2022 19:27:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591660; bh=8LUaCd4bTBKPuxdWhBKc9IuyNYhTts+CufpvhOlETNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hsBLz2iENtBa/ssq7Xis8VXTnWap/MaivUDCgoYI+nxbQh/DHzzZ4QA1RFbHpuSao g2bJBrW7C4QAuDNuQykPbGkL1oyJGUvOI1wz5ob/SQqqtL5bh2rap5vWhej9aY2VES WwpORWLSWy3FCCh2P/8pJtjvGEFO5eDuIy2kD5HM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0650/1095] iio: frequency: adf4350: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:49 +0200 Message-Id: <20220815180456.280292936@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 389b8972eb2a614cb3189e5fa55b1b7f66142c71 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Updated help text to 'may' require buffers to be in their own cacheline. Fixes: e31166f0fd48 ("iio: frequency: New driver for Analog Devices ADF4350= /ADF4351 Wideband Synthesizers") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-67-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/frequency/adf4350.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf435= 0.c index be1218d86291..85e289700c3c 100644 --- a/drivers/iio/frequency/adf4350.c +++ b/drivers/iio/frequency/adf4350.c @@ -56,10 +56,10 @@ struct adf4350_state { */ struct mutex lock; /* - * DMA (thus cache coherency maintenance) requires the - * transfer buffers to live in their own cache lines. + * DMA (thus cache coherency maintenance) may require that + * transfer buffers live in their own cache lines. */ - __be32 val ____cacheline_aligned; + __be32 val __aligned(IIO_DMA_MINALIGN); }; =20 static struct adf4350_platform_data default_pdata =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19C03C32765 for ; Mon, 15 Aug 2022 21:42:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244325AbiHOVmG (ORCPT ); Mon, 15 Aug 2022 17:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348893AbiHOVhv (ORCPT ); Mon, 15 Aug 2022 17:37:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87BF513DCA; Mon, 15 Aug 2022 12:27:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 35F71B8107A; Mon, 15 Aug 2022 19:27:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84511C433C1; Mon, 15 Aug 2022 19:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591664; bh=iTmeA8s+xFoCTgBSS0GCvKoR1P2ycaxa6jZr3GJywEY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I2pxk7wDWPNWzyAhpRrKp7QNReSExOP+iA4XTKJiipiqWVXQiqqMtn0A9gQcgW7/e Zv7Mit0kBYfUUhm0brapx8qVZX2JJlu8CcrfXmWAGjdNloUd5mn0w0D6QXppxPpKw0 CGOtx4+bmOAU27XSGQFieH31C5iRHMqm+Kn6jQtI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0651/1095] iio: frequency: adf4371: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:50 +0200 Message-Id: <20220815180456.327396329@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 0bb5675befe666eeed71ad808426cf2ec1c9a714 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 7f699bd14913 ("iio: frequency: adf4371: Add support for ADF4371 PLL") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-68-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/frequency/adf4371.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/frequency/adf4371.c b/drivers/iio/frequency/adf437= 1.c index ecd5e18995ad..135c8cedc33d 100644 --- a/drivers/iio/frequency/adf4371.c +++ b/drivers/iio/frequency/adf4371.c @@ -175,7 +175,7 @@ struct adf4371_state { unsigned int mod2; unsigned int rf_div_sel; unsigned int ref_div_factor; - u8 buf[10] ____cacheline_aligned; + u8 buf[10] __aligned(IIO_DMA_MINALIGN); }; =20 static unsigned long long adf4371_pll_fract_n_get_rate(struct adf4371_stat= e *st, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71C4AC282E7 for ; Mon, 15 Aug 2022 21:42:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348841AbiHOVmO (ORCPT ); Mon, 15 Aug 2022 17:42:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348903AbiHOVhz (ORCPT ); Mon, 15 Aug 2022 17:37:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 478FC13F9C; Mon, 15 Aug 2022 12:27:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A093260FB9; Mon, 15 Aug 2022 19:27:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9004FC433C1; Mon, 15 Aug 2022 19:27:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591667; bh=UJIY00J93F1Q/dE4S4wXG9IfUZT8NkvrOkTOVnXQXpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oV23iv3QOtehLCav0BCdTBqlzTIia6M8To0VQJ1+n0dycyi8VwMUDMlsUUD+C7X6h 4dXmNjG27Fo+inc25kFPZ1hhCRCw4SMIQLbMx1B9PzWauLbMy20iOp5iA9fVG9nAh4 /Lv+kPmaViRsyYiBA5ifwO85aWwUDKYpZq64+1WE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Antoniu Miclaus , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0652/1095] iio: frequency: admv1013: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:51 +0200 Message-Id: <20220815180456.372357413@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit b3f3f8d264b9be0cb3e50e89e3f8789a948a43bb ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: da35a7b526d9 ("iio: frequency: admv1013: add support for ADMV1013") Signed-off-by: Jonathan Cameron Cc: Antoniu Miclaus Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-69-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/frequency/admv1013.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/frequency/admv1013.c b/drivers/iio/frequency/admv1= 013.c index b0e1f6571afb..ed8167271358 100644 --- a/drivers/iio/frequency/admv1013.c +++ b/drivers/iio/frequency/admv1013.c @@ -100,7 +100,7 @@ struct admv1013_state { unsigned int input_mode; unsigned int quad_se_mode; bool det_en; - u8 data[3] ____cacheline_aligned; + u8 data[3] __aligned(IIO_DMA_MINALIGN); }; =20 static int __admv1013_spi_read(struct admv1013_state *st, unsigned int reg, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 982DAC282E7 for ; Mon, 15 Aug 2022 21:42:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348998AbiHOVmR (ORCPT ); Mon, 15 Aug 2022 17:42:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348929AbiHOViD (ORCPT ); Mon, 15 Aug 2022 17:38:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE6FF15FE4; Mon, 15 Aug 2022 12:27:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 776B5B8107A; Mon, 15 Aug 2022 19:27:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA410C433C1; Mon, 15 Aug 2022 19:27:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591670; bh=WF/nE0dsIWLxyJyAdB9X1MScvpCJjcRub//XDzLP26w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nUDVHMCzRFJx9C1xmD+o3zuSqLQIOZ17fblZ34vHaACtlIsn719ixqhEFgdry5XCB yR91bLbyCAN7zXIkMPEz0JUBg7Un9w4GX+M1ltY+QBqDG+VNh0ONyT88L1WMiYkI9h VYLvH+sotjm8KiJnPzp8S6A8bFlfl50+85cQMxkU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Antoniu Miclaus , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0653/1095] iio: frequency: admv1014: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:52 +0200 Message-Id: <20220815180456.419902503@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit a3e38a557a54df0edea791d7eb623515bb86e39a ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: f4eb9ac7842f ("iio: frequency: admv1014: add support for ADMV1014") Signed-off-by: Jonathan Cameron Cc: Antoniu Miclaus Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-70-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/frequency/admv1014.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/frequency/admv1014.c b/drivers/iio/frequency/admv1= 014.c index a7994f8e6b9b..d1ccaa7ed5fe 100644 --- a/drivers/iio/frequency/admv1014.c +++ b/drivers/iio/frequency/admv1014.c @@ -127,7 +127,7 @@ struct admv1014_state { unsigned int quad_se_mode; unsigned int p1db_comp; bool det_en; - u8 data[3] ____cacheline_aligned; + u8 data[3] __aligned(IIO_DMA_MINALIGN); }; =20 static const int mixer_vgate_table[] =3D {106, 107, 108, 110, 111, 112, 11= 3, 114, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97378C25B0E for ; Mon, 15 Aug 2022 21:42:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349137AbiHOVmW (ORCPT ); Mon, 15 Aug 2022 17:42:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348944AbiHOViI (ORCPT ); Mon, 15 Aug 2022 17:38:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9313117074; Mon, 15 Aug 2022 12:27:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 066BF60FB1; Mon, 15 Aug 2022 19:27:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4AA0C433C1; Mon, 15 Aug 2022 19:27:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591673; bh=5tBwxDuYUVfFzXaQbnSevdNB+ybQqK3ps3Ci0oXnLr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DloydXCPiXbD+UuStdhSEABjy9xV0pjnZubmEM30DsbZ6iIXS85lllj4rU+Kkhr1i 80B8cvoUDsk3cLXrxyokypGYKifY+HnUlsInMI1rye4/nwNjh/w1lfzKJm3XwnrUUr DxY1UULJmtkEYQu3lAcQB5fVa8ueJ/EcOSaD9mZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0654/1095] iio: frequency: admv4420: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:53 +0200 Message-Id: <20220815180456.459835605@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit f890aaac771bd015c348eddb967b4027e88344c0 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: b59c04155901 ("iio: frequency: admv4420.c: Add support for ADMV4420") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-71-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/frequency/admv4420.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/frequency/admv4420.c b/drivers/iio/frequency/admv4= 420.c index 51134aee8510..863ba8e98c95 100644 --- a/drivers/iio/frequency/admv4420.c +++ b/drivers/iio/frequency/admv4420.c @@ -113,7 +113,7 @@ struct admv4420_state { struct admv4420_n_counter n_counter; enum admv4420_mux_sel mux_sel; struct mutex lock; - u8 transf_buf[4] ____cacheline_aligned; + u8 transf_buf[4] __aligned(IIO_DMA_MINALIGN); }; =20 static const struct regmap_config admv4420_regmap_config =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1444C25B08 for ; Mon, 15 Aug 2022 21:42:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349166AbiHOVm2 (ORCPT ); Mon, 15 Aug 2022 17:42:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348971AbiHOViU (ORCPT ); Mon, 15 Aug 2022 17:38:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62FD0193F9; Mon, 15 Aug 2022 12:27:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E4AEBB81062; Mon, 15 Aug 2022 19:27:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34853C433D6; Mon, 15 Aug 2022 19:27:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591676; bh=PatvG9eaTtQbGqYAXTyhKleN5tMw5LZqmxtcyReqGO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MwCZYdEGfMIwqQnmUBvn4tHFJCqNOfqmbdFYslFiN8wybwS7Vk0bB7QI88Rc9h0z7 WRX9dRnlie6RC55dxgBL5P046W4Ux+zmdEDIoIadBTNsSMPvzRBRyzw0cY77RcBZ5f 813GCUL5aNjWEbq3MSErBu50T9z1Rmfmz3x5sJpk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Antoniu Miclaus , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0655/1095] iio: frequency: adrf6780: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:54 +0200 Message-Id: <20220815180456.500462919@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 9a5b11884cb72780cb824cac8aab47094654a84f ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 63aaf6d06d87 ("iio: frequency: adrf6780: add support for ADRF6780") Signed-off-by: Jonathan Cameron Cc: Antoniu Miclaus Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-72-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/frequency/adrf6780.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/frequency/adrf6780.c b/drivers/iio/frequency/adrf6= 780.c index 8255ffd174f6..21878bad0909 100644 --- a/drivers/iio/frequency/adrf6780.c +++ b/drivers/iio/frequency/adrf6780.c @@ -86,7 +86,7 @@ struct adrf6780_state { bool uc_bias_en; bool lo_sideband; bool vdet_out_en; - u8 data[3] ____cacheline_aligned; + u8 data[3] __aligned(IIO_DMA_MINALIGN); }; =20 static int __adrf6780_spi_read(struct adrf6780_state *st, unsigned int reg, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F7AEC25B0E for ; Mon, 15 Aug 2022 21:51:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350180AbiHOVup (ORCPT ); Mon, 15 Aug 2022 17:50:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350220AbiHOVr2 (ORCPT ); Mon, 15 Aug 2022 17:47:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46B1065251; Mon, 15 Aug 2022 12:31:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A9B3560FB9; Mon, 15 Aug 2022 19:31:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F73BC433D6; Mon, 15 Aug 2022 19:31:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591877; bh=z1xUNYx42fke/EV5QP7IxecBd8URVJ29kBbGoG4kACI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=We7Alsmr3ojowbIhKABYTYg7jeaAQJUhyK2Fba8QJPT8laLnyDktGTlu3vsMEsTnC kE1IkETD060mFbcNdryTCVUFUt4659le9QyP61HHO/Xl6uU9T/YLPVvXLnexHNzME6 MU0OjyglycoKC+JckMPTOFiSSfFTW5n9Ru+b/8Qc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0656/1095] iio: gyro: adis16080: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:55 +0200 Message-Id: <20220815180456.539742838@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit ae6eeb534924ecc2afd5a394964fd6de0ca54d39 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes tag is inaccurate but unlikely anyone will backport this beyond that point so I haven't chased the history futher than 2013. Fixes: 3c80372dae17 ("staging:iio:adis16080: be16 cleanups") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-73-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/gyro/adis16080.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/gyro/adis16080.c b/drivers/iio/gyro/adis16080.c index acef59d822b1..14b3abf6dce9 100644 --- a/drivers/iio/gyro/adis16080.c +++ b/drivers/iio/gyro/adis16080.c @@ -45,7 +45,7 @@ struct adis16080_state { const struct adis16080_chip_info *info; struct mutex lock; =20 - __be16 buf ____cacheline_aligned; + __be16 buf __aligned(IIO_DMA_MINALIGN); }; =20 static int adis16080_read_sample(struct iio_dev *indio_dev, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ECF2C00140 for ; Mon, 15 Aug 2022 21:43:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349354AbiHOVnQ (ORCPT ); Mon, 15 Aug 2022 17:43:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349097AbiHOViw (ORCPT ); Mon, 15 Aug 2022 17:38:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AEC82ED55; Mon, 15 Aug 2022 12:28:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A12BD60FB1; Mon, 15 Aug 2022 19:28:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91219C433C1; Mon, 15 Aug 2022 19:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591701; bh=3SHcPNsSd7kyJBhhcXsA1nXQfXffY39m27eP4DbjyVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IKHAReK2RYNrl8HA+DpG5pv5om7kH/9af/oF+gBsTfFIagQ4vUWUi4raMKaiYMV/+ NLKJgdGzMqmh7bW5bXjm28UebQiAOdHtxNWZNUs3OTDVQ2Pkv8zvbmgEFF494W9mBU Vq5jlwXLPPma0ROyxwUhN3JkGhZJP7VLm3tJXIak= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0657/1095] iio: gyro: adis16130: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:56 +0200 Message-Id: <20220815180456.575004793@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit ff3211b2ba9afac80ceb795d148831dd879b30b7 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 8e67875141b2 ("staging:iio:gyro: adis16130 cleanup, move to abi and = bug fixes.") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-74-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/gyro/adis16130.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/gyro/adis16130.c b/drivers/iio/gyro/adis16130.c index b9c952e65b55..33cde9e6fca5 100644 --- a/drivers/iio/gyro/adis16130.c +++ b/drivers/iio/gyro/adis16130.c @@ -41,7 +41,7 @@ struct adis16130_state { struct spi_device *us; struct mutex buf_lock; - u8 buf[4] ____cacheline_aligned; + u8 buf[4] __aligned(IIO_DMA_MINALIGN); }; =20 static int adis16130_spi_read(struct iio_dev *indio_dev, u8 reg_addr, u32 = *val) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF089C00140 for ; Mon, 15 Aug 2022 21:44:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349530AbiHOVok (ORCPT ); Mon, 15 Aug 2022 17:44:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349312AbiHOVkz (ORCPT ); Mon, 15 Aug 2022 17:40:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 480A75A3F9; Mon, 15 Aug 2022 12:28:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C1A9761089; Mon, 15 Aug 2022 19:28:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3453C433D6; Mon, 15 Aug 2022 19:28:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591737; bh=Crn7UfGD8TI4bN32FbgUjAZlJe0HbeYgeSEAu/snc6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MunsartTcujR8ctq+/7Z41qMfWAs7qhoKtdCkY/k8SJnbRFtmvnSkOYlH6M9YKwPe P8vP6Pa9vpPUBgUTfpzpyogFeb59w1bL7+UcmrwA+FzH828d5HeyTQPp3BGXM6wCC+ KHDG2qtsiULWo3WNtbMtOGtlb7oq7UgD5QEr2Sck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0658/1095] iio: gyro: adxrs450: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:57 +0200 Message-Id: <20220815180456.624957730@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 966d2f4ee7f6e189df47abf67223266ad31e201f ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes tag is inaccurate but unlikely anyone will be interested in backporting beyond that point. Fixes: 53ac8500ba9b ("staging:iio:adxrs450: Move header file contents to ma= in file") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-75-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/gyro/adxrs450.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/gyro/adxrs450.c b/drivers/iio/gyro/adxrs450.c index 04f350025215..f84438e0c42c 100644 --- a/drivers/iio/gyro/adxrs450.c +++ b/drivers/iio/gyro/adxrs450.c @@ -73,7 +73,7 @@ enum { struct adxrs450_state { struct spi_device *us; struct mutex buf_lock; - __be32 tx ____cacheline_aligned; + __be32 tx __aligned(IIO_DMA_MINALIGN); __be32 rx; =20 }; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C192C25B0E for ; Mon, 15 Aug 2022 21:47:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350333AbiHOVrp (ORCPT ); Mon, 15 Aug 2022 17:47:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349789AbiHOVmF (ORCPT ); Mon, 15 Aug 2022 17:42:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6821B6DAFA; Mon, 15 Aug 2022 12:29:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D191FB8107A; Mon, 15 Aug 2022 19:29:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32829C433D7; Mon, 15 Aug 2022 19:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591771; bh=EzOr3ecHRSRRF9rDsjBNuE8SLcI+04DTjOy9tRGAHBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ex9fHHHJE1SmsPhDjENlC/nLaEpebcONzQbLm1mU9TlK79txKJqsZxjnBlAzu7oOX 4o2ohWded0FNqLZlM82XsLpbAKODtEMDIyDksyPIttc7/YRmmVpMCxBX4GKutbre1g 9GqCnIGMPuxeS6tg046sNfA21n38m4KttR6wKN9s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Rui Miguel Silva , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0659/1095] iio: gyro: fxas210002c: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:58 +0200 Message-Id: <20220815180456.669805424@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 3aafe923987cb4a15e16f03c6185ed4b6a78ca00 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Updated the comment to 'may' require. Fixes: a0701b6263ae ("iio: gyro: add core driver for fxas21002c") Signed-off-by: Jonathan Cameron Reviewed-by: Rui Miguel Silva Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-76-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/gyro/fxas21002c_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/gyro/fxas21002c_core.c b/drivers/iio/gyro/fxas2100= 2c_core.c index 410e5e9f2672..7a459a823f6e 100644 --- a/drivers/iio/gyro/fxas21002c_core.c +++ b/drivers/iio/gyro/fxas21002c_core.c @@ -150,10 +150,10 @@ struct fxas21002c_data { struct regulator *vddio; =20 /* - * DMA (thus cache coherency maintenance) requires the - * transfer buffers to live in their own cache lines. + * DMA (thus cache coherency maintenance) may require the + * transfer buffers live in their own cache lines. */ - s16 buffer[8] ____cacheline_aligned; + s16 buffer[8] __aligned(IIO_DMA_MINALIGN); }; =20 enum fxas21002c_channel_index { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC017C28B2B for ; Mon, 15 Aug 2022 21:48:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349874AbiHOVsz (ORCPT ); Mon, 15 Aug 2022 17:48:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349376AbiHOVpZ (ORCPT ); Mon, 15 Aug 2022 17:45:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33864C9EAA; Mon, 15 Aug 2022 12:30:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 94D49B81062; Mon, 15 Aug 2022 19:30:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABA6FC433D6; Mon, 15 Aug 2022 19:30:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591806; bh=rqdC4nZwbSnbxPw0o+7GJSE6FDRyxJqDCjoWH0/UZjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G8zxx/mDsjwsvbPa+jaRyGihBRpyFOmBT+VK71qE6f38zE/t75TJ1wHz+TRvIAoQ0 bu6nMCj1mSLAKwHQ1Tzyi23fHaYbvItWti/QasNaFcNXb7Pw59C7+lAChXIBP8J0qd XvfpaKv/TzrtwLLxNwnxM72HDvu5UX+KAuN1wfQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Robert Jones , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0660/1095] iio: imu: fxos8700: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:00:59 +0200 Message-Id: <20220815180456.707717476@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit c9a8417a13ed9c81383662fca8a4b89f84d31e78 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 84e5ddd5c46e ("iio: imu: Add support for the FXOS8700 IMU") Signed-off-by: Jonathan Cameron Cc: Robert Jones Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-77-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/imu/fxos8700_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/imu/fxos8700_core.c b/drivers/iio/imu/fxos8700_cor= e.c index ab288186f36e..423cfe526f2a 100644 --- a/drivers/iio/imu/fxos8700_core.c +++ b/drivers/iio/imu/fxos8700_core.c @@ -167,7 +167,7 @@ struct fxos8700_data { struct regmap *regmap; struct iio_trigger *trig; - __be16 buf[FXOS8700_DATA_BUF_SIZE] ____cacheline_aligned; + __be16 buf[FXOS8700_DATA_BUF_SIZE] __aligned(IIO_DMA_MINALIGN); }; =20 /* Regmap info */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4249FC00140 for ; Mon, 15 Aug 2022 21:49:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350031AbiHOVtq (ORCPT ); Mon, 15 Aug 2022 17:49:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350004AbiHOVrB (ORCPT ); Mon, 15 Aug 2022 17:47:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 185B733A06; Mon, 15 Aug 2022 12:30:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 67CE26111E; Mon, 15 Aug 2022 19:30:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AE1CC433D6; Mon, 15 Aug 2022 19:30:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591843; bh=dYtzRbPPdLqJorc5v/DVHVdbr2kS8jGXbCpIM27gDQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u6HCXMi0R/rWMBcw/IjmfFOLMgu2OmWA54qlHIWRL0PayaCbOv9uGDO+67S4RCTj+ SxVebInbpyQqcMlMXNOXRtZrrJYcMonNL+wOefTXE2ePZVizCa+t+bfvcmvb30Lbom TDTYrH5HbrzoUHDCxGl8H3kmjfEwCNnV/+XLNYPs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Jean-Baptiste Maneyrol , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0661/1095] iio: imu: inv_icm42600: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:01:00 +0200 Message-Id: <20220815180456.748935915@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 848847702bd10bf0bf547e38adc44c14e9742784 ] Partial fix for this driver as a second instance was introduced in a later patch. ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: a095fadb443b ("iio: imu: inv_icm42600: add gyroscope IIO device") Signed-off-by: Jonathan Cameron Acked-by: Jean-Baptiste Maneyrol Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-78-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/imu/inv_icm42600/inv_icm42600.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600.h b/drivers/iio/imu/= inv_icm42600/inv_icm42600.h index 995a9dc06521..3d91469beccb 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600.h +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600.h @@ -141,7 +141,7 @@ struct inv_icm42600_state { struct inv_icm42600_suspended suspended; struct iio_dev *indio_gyro; struct iio_dev *indio_accel; - uint8_t buffer[2] ____cacheline_aligned; + uint8_t buffer[2] __aligned(IIO_DMA_MINALIGN); struct inv_icm42600_fifo fifo; struct { int64_t gyro; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B51BC00140 for ; Mon, 15 Aug 2022 21:50:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349570AbiHOVu3 (ORCPT ); Mon, 15 Aug 2022 17:50:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350148AbiHOVrS (ORCPT ); Mon, 15 Aug 2022 17:47:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0205C7D1F4; Mon, 15 Aug 2022 12:31:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5F8FFB81126; Mon, 15 Aug 2022 19:31:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3161BC433C1; Mon, 15 Aug 2022 19:31:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591865; bh=kiF11z6MXxdcmqUH02ZK+3YK79JUgbzvn7owzU+ly+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vJpE4ANYVqxEdvOhwMLbpWE1ezXmypNEPmGCu3bO3TmZL7E6vMAAJCtqH0P8VWbjU Y7q7bzHgxgA0kwLtMRQtCGIxrp+AJuWW1RvvwLBfpKYe376vLIhypw7GJ4aETcF5PU 3MrReH85eKPhnqnqMS5R1as3SALdzI0dxzp0q008= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Jean-Baptiste Maneyrol , Jean-Baptiste Maneyrol , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0662/1095] iio: imu: inv_icm42600: Fix alignment for DMA safety in buffer code. Date: Mon, 15 Aug 2022 20:01:01 +0200 Message-Id: <20220815180456.784614907@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit b0aa05065a0c1d1bffa10923dbc36f7193babbb7 ] Second fix for this driver due to different introducing patches. ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 7f85e42a6c54 ("iio: imu: inv_icm42600: add buffer support in iio dev= ices") Signed-off-by: Jonathan Cameron Cc: Jean-Baptiste Maneyrol Acked-by: Jean-Baptiste Maneyrol Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-79-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.h b/drivers/i= io/imu/inv_icm42600/inv_icm42600_buffer.h index de2a3949dcc7..8b85ee333bf8 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.h +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.h @@ -39,7 +39,7 @@ struct inv_icm42600_fifo { size_t accel; size_t total; } nb; - uint8_t data[2080] ____cacheline_aligned; + uint8_t data[2080] __aligned(IIO_DMA_MINALIGN); }; =20 /* FIFO data packet */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87385C25B08 for ; Mon, 15 Aug 2022 21:50:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350111AbiHOVuZ (ORCPT ); Mon, 15 Aug 2022 17:50:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350161AbiHOVrT (ORCPT ); Mon, 15 Aug 2022 17:47:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A6AF103C54; Mon, 15 Aug 2022 12:31:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 90D1F60FB9; Mon, 15 Aug 2022 19:31:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94510C433D6; Mon, 15 Aug 2022 19:31:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591868; bh=FS07t58lqjdERCAoZlhJ5qAq56XF3WKvzZZl34Am4A0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gmc+L8GQl/EGdt8PUxPY6jCjmTSFwEPf9rIfOyl5tEZ6eZRvZDwLHUFdLhvv+VX6y s+jtMX4JPEiONOfE4pntZIvSe4ijB+FSh3MPAxmGecdgGwvRWAfKQIWCchhcKaW6bv Cr9IPttkbu9cSt9c8RcGhODnGtlbpFBu2TkT/R4g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Jean-Baptiste Maneyrol , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0663/1095] iio: imu: mpu6050: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:01:02 +0200 Message-Id: <20220815180456.824283011@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 54e03562bb960e78af050d2e550c28d77642ee44 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 6b0cc5dce072 ("iio:imu:inv_mpu6050 Fix dma and ts alignment and data= leak issues.") Signed-off-by: Jonathan Cameron Acked-by: Jean-Baptiste Maneyrol Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-80-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h b/drivers/iio/imu/in= v_mpu6050/inv_mpu_iio.h index c6aa36ee966a..32b58b797d57 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h @@ -203,7 +203,7 @@ struct inv_mpu6050_state { s32 magn_raw_to_gauss[3]; struct iio_mount_matrix magn_orient; unsigned int suspended_sensors; - u8 data[INV_MPU6050_OUTPUT_DATA_SIZE] ____cacheline_aligned; + u8 data[INV_MPU6050_OUTPUT_DATA_SIZE] __aligned(IIO_DMA_MINALIGN); }; =20 /*register and associated bit definition*/ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6D05C25B08 for ; Mon, 15 Aug 2022 21:51:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350136AbiHOVuh (ORCPT ); Mon, 15 Aug 2022 17:50:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350184AbiHOVrV (ORCPT ); Mon, 15 Aug 2022 17:47:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B53425F9AA; Mon, 15 Aug 2022 12:31:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 69094B81062; Mon, 15 Aug 2022 19:31:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A50D8C433D6; Mon, 15 Aug 2022 19:31:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591871; bh=5CiSJRDycVN1/+uf8e3hF3S3PgT4ShsvHAWoBCYNW5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lkJZrY+p5erzJW6ZIRw7p4Yx3vND2O+ZQf5jHntibB5QnWYs9+qFdzG8536KyBS7C 451j8htkSzayjrcPnz7CPnaFAki7D0LXxkZtCeTMmlvpgrspWmwCpKmefX8eiZXY06 ufhgGqwB2Dq8TQjQtpiHSe0wsK4yO0egQXO7WOmw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Mugilraj Dhavachelvan , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0664/1095] iio: potentiometer: ad5110: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:01:03 +0200 Message-Id: <20220815180456.859968072@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit b5841c38cb2f7e54b0787b3e0326a6b21b89ea3e ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: d03a74bfacce ("iio: potentiometer: Add driver support for AD5110") Signed-off-by: Jonathan Cameron Cc: Mugilraj Dhavachelvan Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-81-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/potentiometer/ad5110.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/potentiometer/ad5110.c b/drivers/iio/potentiometer= /ad5110.c index d4eeedae56e5..8fbcce482989 100644 --- a/drivers/iio/potentiometer/ad5110.c +++ b/drivers/iio/potentiometer/ad5110.c @@ -63,10 +63,10 @@ struct ad5110_data { struct mutex lock; const struct ad5110_cfg *cfg; /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. */ - u8 buf[2] ____cacheline_aligned; + u8 buf[2] __aligned(IIO_DMA_MINALIGN); }; =20 static const struct iio_chan_spec ad5110_channels[] =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3095AC00140 for ; Mon, 15 Aug 2022 21:51:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350155AbiHOVun (ORCPT ); Mon, 15 Aug 2022 17:50:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350212AbiHOVr2 (ORCPT ); Mon, 15 Aug 2022 17:47:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C6336524A; Mon, 15 Aug 2022 12:31:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6928BB810C6; Mon, 15 Aug 2022 19:31:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E89EC433D6; Mon, 15 Aug 2022 19:31:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591874; bh=an4bUhqZY3EouznEf8JWpPb3qALmzTCafVC8Jys3Shk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tA3JDqiG2U0crjp0ddWGGsULGjdw+s+D+tsmAwq5jvtOnS+Cy/W5iCjia7+G7MhZr spu8g7GS257+oqVoUdtXhTx/sVL9lqZ6ySAaW9hBj1vogaUvrln1BDMXrwtg0wMBIb UeP10lFyiXlUdappCojc8JxSKjyyDJRn3Spk6qGc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Phil Reid , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0665/1095] iio: potentiometer: ad5272: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:01:04 +0200 Message-Id: <20220815180456.906096386@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit da803652534271dbb4af0802bd678c759e27e6de ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 79e8a32d2aa9 ("iio: ad5272: Add support for Analog Devices digital p= otentiometers") Signed-off-by: Jonathan Cameron Reviewed-by: Phil Reid Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-82-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/potentiometer/ad5272.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/potentiometer/ad5272.c b/drivers/iio/potentiometer= /ad5272.c index d8cbd170262f..ed5fc0b50fe9 100644 --- a/drivers/iio/potentiometer/ad5272.c +++ b/drivers/iio/potentiometer/ad5272.c @@ -50,7 +50,7 @@ struct ad5272_data { struct i2c_client *client; struct mutex lock; const struct ad5272_cfg *cfg; - u8 buf[2] ____cacheline_aligned; + u8 buf[2] __aligned(IIO_DMA_MINALIGN); }; =20 static const struct iio_chan_spec ad5272_channel =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0614CC25B0E for ; Mon, 15 Aug 2022 21:43:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349367AbiHOVnW (ORCPT ); Mon, 15 Aug 2022 17:43:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349149AbiHOVjX (ORCPT ); Mon, 15 Aug 2022 17:39:23 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6FB22B266; Mon, 15 Aug 2022 12:28:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id A686ECE10E7; Mon, 15 Aug 2022 19:28:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0B98C433D6; Mon, 15 Aug 2022 19:28:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591704; bh=9zNDmu/zOk4ltrP6s2+OhrMweR1ou95kUO+IEG4hVQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pi1MysNp9jmmL8E1DsWXl7e+vzERmoH18U+Msw2+YNTXXjv5SeCM2BklTd0+FcQlv 5V3JL7eOO5dwBD9WMEDcV4gRoKPomb5Yd4cYfNtARO41eG/If4JVxG6+TuT545f6MK osg3GsvBvbZkg5iz6SndAwCIhHYP24kKv5TQLsAY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0666/1095] iio: potentiometer: max5481: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:01:05 +0200 Message-Id: <20220815180456.946628371@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit ec1ac1c0e7a14657d729159ccfbea72f434bdaf1 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: df1fd2de118e ("iio: max5481: Add support for Maxim digital potentiom= eters") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-83-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/potentiometer/max5481.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/potentiometer/max5481.c b/drivers/iio/potentiomete= r/max5481.c index 098d144a8fdd..b40e5ac218d7 100644 --- a/drivers/iio/potentiometer/max5481.c +++ b/drivers/iio/potentiometer/max5481.c @@ -44,7 +44,7 @@ static const struct max5481_cfg max5481_cfg[] =3D { struct max5481_data { struct spi_device *spi; const struct max5481_cfg *cfg; - u8 msg[3] ____cacheline_aligned; + u8 msg[3] __aligned(IIO_DMA_MINALIGN); }; =20 #define MAX5481_CHANNEL { \ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2BA2C00140 for ; Mon, 15 Aug 2022 21:43:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349386AbiHOVn2 (ORCPT ); Mon, 15 Aug 2022 17:43:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349165AbiHOVjd (ORCPT ); Mon, 15 Aug 2022 17:39:33 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFBA03ED4F; Mon, 15 Aug 2022 12:28:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id D507DCE12C9; Mon, 15 Aug 2022 19:28:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B451CC433C1; Mon, 15 Aug 2022 19:28:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591707; bh=Qb7NOxQ2HvEjpwNTGYPuGuO+GJE36F0ManhVFQhhL4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M0rsA0hUHqp8ERZB+ix7bnS7Oi3LCEJOeqpP7AJuveNadjuwm0tF4L2/nl73rCKcJ j+h+7HN1/JqXsv6nqfruWvuAq2eSQdfIHd5qmDfpveTOqgMouIGXfDA4fBfxtQOPQA 0v208Btvnc6gyYjA5UFi87YKHnkv+4YND/vzwZsM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0667/1095] iio: potentiometer: mcp41010: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:01:06 +0200 Message-Id: <20220815180456.985640411@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit c5f78f4d2168ba21324095b0d46d4353c2eace4d ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 092cb71a604e ("iio: potentiometer: Add driver for Microchip MCP41xxx= /42xxx") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-84-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/potentiometer/mcp41010.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/potentiometer/mcp41010.c b/drivers/iio/potentiomet= er/mcp41010.c index 30a4594d4e11..2b73c7540209 100644 --- a/drivers/iio/potentiometer/mcp41010.c +++ b/drivers/iio/potentiometer/mcp41010.c @@ -60,7 +60,7 @@ struct mcp41010_data { const struct mcp41010_cfg *cfg; struct mutex lock; /* Protect write sequences */ unsigned int value[MCP41010_MAX_WIPERS]; /* Cache wiper values */ - u8 buf[2] ____cacheline_aligned; + u8 buf[2] __aligned(IIO_DMA_MINALIGN); }; =20 #define MCP41010_CHANNEL(ch) { \ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12B5EC00140 for ; Mon, 15 Aug 2022 21:43:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349397AbiHOVne (ORCPT ); Mon, 15 Aug 2022 17:43:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346299AbiHOVjh (ORCPT ); Mon, 15 Aug 2022 17:39:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB0E33ED6B; Mon, 15 Aug 2022 12:28:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 95821B81109; Mon, 15 Aug 2022 19:28:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE338C433C1; Mon, 15 Aug 2022 19:28:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591710; bh=XVTACl5lEivz5w/igqkLXPqt+lJ92BfMNTk1diWpk6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mQpSKHu3eGGxvN+ect4O5qQe6ya9rnmqhV0jRt3lgg3TLv4hDY8A7mwxqnJjafArQ hUTwpxKpA/rXZgM1cKS1EZmF1iJigKSW2GgLNTdX9TypHz2+rw/7EZuUVOuE/OmBp0 MdEQifDKZ71ovaq+s0NBtJQhE63qvcfBU91I9TTY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0668/1095] iio: potentiometer: mcp4131: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:01:07 +0200 Message-Id: <20220815180457.020765118@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 4842e5de6f39ebf2c0f6da9e6a0cb751c7108507 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 22d199a53910 ("iio: potentiometer: add driver for Microchip MCP413X/= 414X/415X/416X/423X/424X/425X/426X") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-85-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/potentiometer/mcp4131.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/potentiometer/mcp4131.c b/drivers/iio/potentiomete= r/mcp4131.c index 7c8c18ab8764..7890c0993ec4 100644 --- a/drivers/iio/potentiometer/mcp4131.c +++ b/drivers/iio/potentiometer/mcp4131.c @@ -129,7 +129,7 @@ struct mcp4131_data { struct spi_device *spi; const struct mcp4131_cfg *cfg; struct mutex lock; - u8 buf[2] ____cacheline_aligned; + u8 buf[2] __aligned(IIO_DMA_MINALIGN); }; =20 #define MCP4131_CHANNEL(ch) { \ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C941C25B08 for ; Mon, 15 Aug 2022 21:43:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349427AbiHOVnk (ORCPT ); Mon, 15 Aug 2022 17:43:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349063AbiHOVjj (ORCPT ); Mon, 15 Aug 2022 17:39:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A4943F307; Mon, 15 Aug 2022 12:28:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 236D860FB1; Mon, 15 Aug 2022 19:28:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14A2FC433C1; Mon, 15 Aug 2022 19:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591713; bh=GTIZkC3zKQWu+Bct/VE1yaL9YF7rpRhed2b2ZCRgiOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0r6wRS4VDERRMwM2s73IpBxn7W/K1SeD6tZDuZuiB5Wax2ZZGHVnLs8SW5RXJdF0W NrQLUv9wgMIR8WJHKfHPoFHtfTgbFf3zQ5x4E1GYb8TiYlhYjMcCYi9MbndD9S19dM DNd1kyUSNbq0DMeIWch+tUSQgCM0KuYIxSoEuLnY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Matt Ranostay , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0669/1095] iio: proximity: as3935: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:01:08 +0200 Message-Id: <20220815180457.064911180@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 2386c0f8c5b740873a4b9126c3706601b127fe22 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: 24ddb0e4bba4 ("iio: Add AS3935 lightning sensor support") Signed-off-by: Jonathan Cameron Cc: Matt Ranostay Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-87-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/proximity/as3935.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c index 67891ce2bd09..ebc95cf8f5f4 100644 --- a/drivers/iio/proximity/as3935.c +++ b/drivers/iio/proximity/as3935.c @@ -65,7 +65,7 @@ struct as3935_state { u8 chan; s64 timestamp __aligned(8); } scan; - u8 buf[2] ____cacheline_aligned; + u8 buf[2] __aligned(IIO_DMA_MINALIGN); }; =20 static const struct iio_chan_spec as3935_channels[] =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6261EC00140 for ; Mon, 15 Aug 2022 21:43:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243492AbiHOVnr (ORCPT ); Mon, 15 Aug 2022 17:43:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349215AbiHOVkT (ORCPT ); Mon, 15 Aug 2022 17:40:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB7123F324; Mon, 15 Aug 2022 12:28:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2C3F3B81120; Mon, 15 Aug 2022 19:28:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5702BC433C1; Mon, 15 Aug 2022 19:28:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591716; bh=Fz0Od070cEnkqYN5WQgTtuDbh/fruRSQCiM/ni+h/wg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NTPQsqKvIRotwFHPNEX9jVyYrBetNWJdxoVZEX72+OQ7zxpNj0X2OLAJ8V5brjjPQ 6djsQANPyIJx6OiZUVh/pnN7aQjwfab/6V5diFmTgRChFXU7thT3hQIPK12K9+tzaS BDt3z7W2k8ZRLFlX10XalLBwvY1jZt2e7LNIhkrA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0670/1095] iio: resolver: ad2s1200: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:01:09 +0200 Message-Id: <20220815180457.107638556@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 37882314d3bdc2ae775ebb9fa8ed7a94cd1aad61 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes tag is probably not where the issue was first introduced, but is likely to be as far as anyone considers backporting this fix. Fixes: 0bd3d338f61b ("staging: iio: ad2s1200: Improve readability with be16= _to_cpup") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-89-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/resolver/ad2s1200.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/resolver/ad2s1200.c b/drivers/iio/resolver/ad2s120= 0.c index 9746bd935628..9d95241bdf8f 100644 --- a/drivers/iio/resolver/ad2s1200.c +++ b/drivers/iio/resolver/ad2s1200.c @@ -41,7 +41,7 @@ struct ad2s1200_state { struct spi_device *sdev; struct gpio_desc *sample; struct gpio_desc *rdvel; - __be16 rx ____cacheline_aligned; + __be16 rx __aligned(IIO_DMA_MINALIGN); }; =20 static int ad2s1200_read_raw(struct iio_dev *indio_dev, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3248C00140 for ; Mon, 15 Aug 2022 21:43:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349454AbiHOVnt (ORCPT ); Mon, 15 Aug 2022 17:43:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349223AbiHOVka (ORCPT ); Mon, 15 Aug 2022 17:40:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 886873F33B; Mon, 15 Aug 2022 12:28:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ABF98610A1; Mon, 15 Aug 2022 19:28:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B5ACC433D6; Mon, 15 Aug 2022 19:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591720; bh=ASbyxEyP1dD5hh8u1Hr7eG+52grw381N4ggEoI0bqnY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G0xNhWYX/wiWiTWmnsmATCDNsf+tkdGDUFvzC8zE2kEybbf6eeRwFU4o+IUGR8oZ/ R4hwXQoQVCIOyx8NbEf7bRNSbgO3gmtzJey8iayWrzaCO/3mPMTsK+Lo4Au48CS5u2 ZHW1jwDsQL4D8eAXb/lEf3Nphh/xiVZOtI8cqxhg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0671/1095] iio: resolver: ad2s90: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:01:10 +0200 Message-Id: <20220815180457.145009781@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit faa05ecb1349070d874810e161b653c2220e0006 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes tag is probably not where the issue was first introduced, but is likely to be far beyond the point where anyone considers backporting this fix. Fixes: 58f08b0af857 ("staging:iio:resolver:ad2s90 general cleanup") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-90-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/resolver/ad2s90.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/resolver/ad2s90.c b/drivers/iio/resolver/ad2s90.c index d6a91f137e13..be6836e55376 100644 --- a/drivers/iio/resolver/ad2s90.c +++ b/drivers/iio/resolver/ad2s90.c @@ -24,7 +24,7 @@ struct ad2s90_state { struct mutex lock; /* lock to protect rx buffer */ struct spi_device *sdev; - u8 rx[2] ____cacheline_aligned; + u8 rx[2] __aligned(IIO_DMA_MINALIGN); }; =20 static int ad2s90_read_raw(struct iio_dev *indio_dev, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 808FFC00140 for ; Mon, 15 Aug 2022 21:44:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349487AbiHOVoL (ORCPT ); Mon, 15 Aug 2022 17:44:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349233AbiHOVkj (ORCPT ); Mon, 15 Aug 2022 17:40:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A12A3FA13; Mon, 15 Aug 2022 12:28:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EA943610AA; Mon, 15 Aug 2022 19:28:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0017C433D6; Mon, 15 Aug 2022 19:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591723; bh=hT5vbUheX3mLxmG3WZVUo2aViOACob6rZyBDGwrkk3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zZhlpJAFArSL3VBJ5Ah0mVxhihsIbR4FLqBn7V2ayU+uQXv+WWlo7+GONBAoxUua8 PcXo8GCu8v9Rv8ATWBr4tjDZx8mfPV9+geIJaRN4ZQfmkarRtmMEeTBE6EsNhnjFXv iifeajFzdcARMh2NVF2YuQKTvliZqZ/Nsof1B8PQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0672/1095] iio: temp: ltc2983: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:01:11 +0200 Message-Id: <20220815180457.178230027@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 732f2cb2fbb51bd5bc03a114bd102ab3b2f537fe ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition. Fixes: f110f3188e56 ("iio: temperature: Add support for LTC2983") Signed-off-by: Jonathan Cameron Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-91-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/temperature/ltc2983.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/lt= c2983.c index 301c3f13fb26..1b8252d86889 100644 --- a/drivers/iio/temperature/ltc2983.c +++ b/drivers/iio/temperature/ltc2983.c @@ -200,11 +200,11 @@ struct ltc2983_data { u8 num_channels; u8 iio_channels; /* - * DMA (thus cache coherency maintenance) requires the + * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. * Holds the converted temperature */ - __be32 temp ____cacheline_aligned; + __be32 temp __aligned(IIO_DMA_MINALIGN); }; =20 struct ltc2983_sensor { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50556C00140 for ; Mon, 15 Aug 2022 21:44:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233015AbiHOVo1 (ORCPT ); Mon, 15 Aug 2022 17:44:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349299AbiHOVkx (ORCPT ); Mon, 15 Aug 2022 17:40:53 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A87D5A3E2; Mon, 15 Aug 2022 12:28:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id DA674CE12C8; Mon, 15 Aug 2022 19:28:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 914FBC433D7; Mon, 15 Aug 2022 19:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591731; bh=T3JxhTHSCW/nvTO9zRsUjYtOC1qS6d5weGtlvLzl4/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EZwbebuK7VrFmsfmMVtkbnj5xTxnniTrK6fk8Xsr7rKZlDN+Rf7Ofw6OKRZg/OG91 nvkzDW43BBZRdRMjHL37L19OaXD0Z8u997RKNa1yQAh20We9e5xxWxChj4+346GICw N5zTGzvAMJzfT3rvP/Fp6qqMYI3UQKK1ZG8k8pQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Navin Sankar Velliangiri , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0673/1095] iio: temp: max31865: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:01:12 +0200 Message-Id: <20220815180457.216403426@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit ecdef5b8317cdf18acb46223e087f04a226fa619 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition Fixes: e112dc4e18ea ("iio: temperature: Add MAX31865 RTD Support") Signed-off-by: Jonathan Cameron Cc: Navin Sankar Velliangiri Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-92-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/temperature/max31865.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/temperature/max31865.c b/drivers/iio/temperature/m= ax31865.c index 86c3f3509a26..f0079e51d8d2 100644 --- a/drivers/iio/temperature/max31865.c +++ b/drivers/iio/temperature/max31865.c @@ -53,7 +53,7 @@ struct max31865_data { struct mutex lock; bool filter_50hz; bool three_wire; - u8 buf[2] ____cacheline_aligned; + u8 buf[2] __aligned(IIO_DMA_MINALIGN); }; =20 static int max31865_read(struct max31865_data *data, u8 reg, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 341B6C00140 for ; Mon, 15 Aug 2022 21:45:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349550AbiHOVoy (ORCPT ); Mon, 15 Aug 2022 17:44:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349365AbiHOVlD (ORCPT ); Mon, 15 Aug 2022 17:41:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D89245A8A2; Mon, 15 Aug 2022 12:29:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8555CB81109; Mon, 15 Aug 2022 19:29:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE76AC433D7; Mon, 15 Aug 2022 19:28:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591740; bh=YXN664tHlqpao73ub4aCiZFPrlz/XdG5wd1w5nCQIKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PLCzTh7veo/Yjnv1roYZj6lGgiyQauLj+XV+qe9kf4ShH2xtsonLc21wS9dS7itMb bJAnRyi18rqDOP5H13zowBp6+LVAfXIOqEZYDDQDeJamYmaBFfGT2A5nyy0j1rvxCU ZV21D2VRaHARZTs8FEhOxoBDGiyyiqqOTLc7sb5g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Matt Ranostay , =?UTF-8?q?Nuno=20S=C3=A1?= , Sasha Levin Subject: [PATCH 5.18 0674/1095] iio: temp: maxim_thermocouple: Fix alignment for DMA safety Date: Mon, 15 Aug 2022 20:01:13 +0200 Message-Id: <20220815180457.255675593@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron [ Upstream commit 10897f34309b3c7bc14698407436c82d11c07f47 ] ____cacheline_aligned is an insufficient guarantee for non-coherent DMA on platforms with 128 byte cachelines above L1. Switch to the updated IIO_DMA_MINALIGN definition Fixes: 1f25ca11d84a ("iio: temperature: add support for Maxim thermocouple = chips") Signed-off-by: Jonathan Cameron Cc: Matt Ranostay Acked-by: Nuno S=C3=A1 Link: https://lore.kernel.org/r/20220508175712.647246-93-jic23@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/temperature/maxim_thermocouple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/temperature/maxim_thermocouple.c b/drivers/iio/tem= perature/maxim_thermocouple.c index 98c41cddc6f0..c28a7a6dea5f 100644 --- a/drivers/iio/temperature/maxim_thermocouple.c +++ b/drivers/iio/temperature/maxim_thermocouple.c @@ -122,7 +122,7 @@ struct maxim_thermocouple_data { struct spi_device *spi; const struct maxim_thermocouple_chip *chip; =20 - u8 buffer[16] ____cacheline_aligned; + u8 buffer[16] __aligned(IIO_DMA_MINALIGN); char tc_type; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A724C00140 for ; Mon, 15 Aug 2022 21:45:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239980AbiHOVpL (ORCPT ); Mon, 15 Aug 2022 17:45:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349519AbiHOVlU (ORCPT ); Mon, 15 Aug 2022 17:41:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3E6A5B07B; Mon, 15 Aug 2022 12:29:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C9B8DB81122; Mon, 15 Aug 2022 19:29:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25C49C433C1; Mon, 15 Aug 2022 19:29:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591746; bh=DzPOh5HBa5hS4q8TybX16QGzzaKpFJOkCzER+G1iOI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LSIgtur3FehTsbP/x4L9cU7FG95UTI0dB2bDOgmPaJ6pAav4tYPriSTdIVxWbmwr6 90QEgqg2yShWDN9qgjJcsvDypg746mvjZMXkCd3CHyWFJbt3kKvo4G7GQpwXz8jmn6 0UvgqlxqCvNdmTuPmskd/vV1z89XTpRb5oc27QLU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rex-BC Chen , Chen-Yu Tsai , AngeloGioacchino Del Regno , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Stephen Boyd , Sasha Levin Subject: [PATCH 5.18 0675/1095] clk: mediatek: reset: Fix written reset bit offset Date: Mon, 15 Aug 2022 20:01:14 +0200 Message-Id: <20220815180457.294286178@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rex-BC Chen [ Upstream commit edabcf71d100fd433a0fc2d0c97057c446c33b2a ] Original assert/deassert bit is BIT(0), but it's more resonable to modify them to BIT(id % 32) which is based on id. This patch will not influence any previous driver because the reset is only used for thermal. The id (MT8183_INFRACFG_AO_THERM_SW_RST) is 0. Fixes: 64ebb57a3df6 ("clk: reset: Modify reset-controller driver") Signed-off-by: Rex-BC Chen Reviewed-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: N=C3=ADcolas F. R. A. Prado Tested-by: N=C3=ADcolas F. R. A. Prado Link: https://lore.kernel.org/r/20220523093346.28493-3-rex-bc.chen@mediatek= .com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/mediatek/reset.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clk/mediatek/reset.c b/drivers/clk/mediatek/reset.c index bcec4b89f449..834d26e9bdfd 100644 --- a/drivers/clk/mediatek/reset.c +++ b/drivers/clk/mediatek/reset.c @@ -25,7 +25,7 @@ static int mtk_reset_assert_set_clr(struct reset_controll= er_dev *rcdev, struct mtk_reset *data =3D container_of(rcdev, struct mtk_reset, rcdev); unsigned int reg =3D data->regofs + ((id / 32) << 4); =20 - return regmap_write(data->regmap, reg, 1); + return regmap_write(data->regmap, reg, BIT(id % 32)); } =20 static int mtk_reset_deassert_set_clr(struct reset_controller_dev *rcdev, @@ -34,7 +34,7 @@ static int mtk_reset_deassert_set_clr(struct reset_contro= ller_dev *rcdev, struct mtk_reset *data =3D container_of(rcdev, struct mtk_reset, rcdev); unsigned int reg =3D data->regofs + ((id / 32) << 4) + 0x4; =20 - return regmap_write(data->regmap, reg, 1); + return regmap_write(data->regmap, reg, BIT(id % 32)); } =20 static int mtk_reset_assert(struct reset_controller_dev *rcdev, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E149C00140 for ; Mon, 15 Aug 2022 21:45:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349584AbiHOVpW (ORCPT ); Mon, 15 Aug 2022 17:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349559AbiHOVl0 (ORCPT ); Mon, 15 Aug 2022 17:41:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67CAC5B7B1; Mon, 15 Aug 2022 12:29:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 71C6761120; Mon, 15 Aug 2022 19:29:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61F59C433C1; Mon, 15 Aug 2022 19:29:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591752; bh=1zVo5EEaQatHXI3wYiQzTgBe1L4ws1B/mp02biI9KXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I2byXRrT1hJJyNn8R+BE3wQWvI731WlrVgdittIgIlzBS2cRX8ME3fqreVLslX1mB mVoNZy7lIU6/+vTNyuZhZjZxDbg6su3VHlr2HVt0rtt8YEpjB3K+VhWNN4wghTf7Pn cIDeNRHOQ0J9MyEouTR1zI3FOPsLlSbDuDU9JYco= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haibo Chen , Jacky Bai , Peng Fan , Abel Vesa , Sasha Levin Subject: [PATCH 5.18 0676/1095] clk: imx93: use adc_root as the parent clock of adc1 Date: Mon, 15 Aug 2022 20:01:15 +0200 Message-Id: <20220815180457.344062796@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Haibo Chen [ Upstream commit 18d6d8fe4f24938985844d52c481b86fcce9d102 ] When debug, find after system boot up, all adc register operation will trigger system hang, this is because the internal adc ipg clock is gate off. In dts, only reference the IMX93_CLK_ADC1_GATE, which is adc1, no one touch the adc_root, so adc_root will be gate off automatically after system boot up. Fixes: 24defbe194b6 ("clk: imx: add i.MX93 clk") Signed-off-by: Haibo Chen Signed-off-by: Jacky Bai Signed-off-by: Peng Fan Reviewed-by: Peng Fan Reviewed-by: Abel Vesa Link: https://lore.kernel.org/r/20220609132902.3504651-2-peng.fan@oss.nxp.c= om Signed-off-by: Abel Vesa Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/imx/clk-imx93.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-imx93.c b/drivers/clk/imx/clk-imx93.c index edcc87661d1f..172cd56c9610 100644 --- a/drivers/clk/imx/clk-imx93.c +++ b/drivers/clk/imx/clk-imx93.c @@ -150,7 +150,7 @@ static const struct imx93_clk_ccgr { { IMX93_CLK_A55_GATE, "a55", "a55_root", 0x8000, }, /* M33 critical clk for system run */ { IMX93_CLK_CM33_GATE, "cm33", "m33_root", 0x8040, CLK_IS_CRITICAL }, - { IMX93_CLK_ADC1_GATE, "adc1", "osc_24m", 0x82c0, }, + { IMX93_CLK_ADC1_GATE, "adc1", "adc_root", 0x82c0, }, { IMX93_CLK_WDOG1_GATE, "wdog1", "osc_24m", 0x8300, }, { IMX93_CLK_WDOG2_GATE, "wdog2", "osc_24m", 0x8340, }, { IMX93_CLK_WDOG3_GATE, "wdog3", "osc_24m", 0x8380, }, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C858EC00140 for ; Mon, 15 Aug 2022 21:45:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349595AbiHOVpc (ORCPT ); Mon, 15 Aug 2022 17:45:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349628AbiHOVle (ORCPT ); Mon, 15 Aug 2022 17:41:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD5D95C364; Mon, 15 Aug 2022 12:29:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C0A7E6102C; Mon, 15 Aug 2022 19:29:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA05FC433C1; Mon, 15 Aug 2022 19:29:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591759; bh=S/IeTTpq9OkUlxtTdQuqOhWlh09dKfkjc/hnIhRR/+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IpkRZukCgiZjmRSYgy2EApCLxedWdtyKX836L7h9nrHawv1okm1W4tDAaC/18Enh8 V+S8piW9RXKFH35mVrpW3WvNVSaqv3STo29X02kqpH8Biq9N0FpEmHcGxP51rZoa+r ZRWKeEy525w+jWf2B0tLuIiut0UJFUMIGmzIKYDo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Fan , Abel Vesa , Sasha Levin Subject: [PATCH 5.18 0677/1095] clk: imx93: correct nic_media parent Date: Mon, 15 Aug 2022 20:01:16 +0200 Message-Id: <20220815180457.380104104@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peng Fan [ Upstream commit 1e3c837a663e9a12c4afabb3279d18cb5110a8f4 ] NIC_MEDIA sources from media_axi_root, not media_apb_root. Fixes: 24defbe194b6 ("clk: imx: add i.MX93 clk") Signed-off-by: Peng Fan Reviewed-by: Abel Vesa Link: https://lore.kernel.org/r/20220609132902.3504651-3-peng.fan@oss.nxp.c= om Signed-off-by: Abel Vesa Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/imx/clk-imx93.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-imx93.c b/drivers/clk/imx/clk-imx93.c index 172cd56c9610..26885bd3971c 100644 --- a/drivers/clk/imx/clk-imx93.c +++ b/drivers/clk/imx/clk-imx93.c @@ -219,7 +219,7 @@ static const struct imx93_clk_ccgr { { IMX93_CLK_LCDIF_GATE, "lcdif", "media_apb_root", 0x9640, }, { IMX93_CLK_PXP_GATE, "pxp", "media_apb_root", 0x9680, }, { IMX93_CLK_ISI_GATE, "isi", "media_apb_root", 0x96c0, }, - { IMX93_CLK_NIC_MEDIA_GATE, "nic_media", "media_apb_root", 0x9700, }, + { IMX93_CLK_NIC_MEDIA_GATE, "nic_media", "media_axi_root", 0x9700, }, { IMX93_CLK_USB_CONTROLLER_GATE, "usb_controller", "hsio_root", 0x9a00, = }, { IMX93_CLK_USB_TEST_60M_GATE, "usb_test_60m", "hsio_usb_test_60m_root", = 0x9a40, }, { IMX93_CLK_HSIO_TROUT_24M_GATE, "hsio_trout_24m", "osc_24m", 0x9a80, }, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A15CEC00140 for ; Mon, 15 Aug 2022 21:47:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349643AbiHOVpq (ORCPT ); Mon, 15 Aug 2022 17:45:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349702AbiHOVlp (ORCPT ); Mon, 15 Aug 2022 17:41:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4D085C9E8; Mon, 15 Aug 2022 12:29:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BD27EB810C6; Mon, 15 Aug 2022 19:29:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18090C43147; Mon, 15 Aug 2022 19:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591765; bh=7rSatraBdchFZq9eWy7keGz7HdtwWZBRr7vyDaCiar4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sI1m33gwo8o0Mw0YvhKPNMWRUFvOF//N4LxZO6rTi569mlp/fN/L8BW7/3SzUIBCe nt7e2X0DV2McyHBFP8TxffApaT3ahkOWbsBVEXh6G/arTX4kZK77l0aeIlZeQQhYYO p4c2OMCW6WUBp0X4EhPuTJjaNr4CZSLFDyb1Z6vk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Fan , Jacky Bai , Abel Vesa , Sasha Levin Subject: [PATCH 5.18 0678/1095] clk: imx: clk-fracn-gppll: fix mfd value Date: Mon, 15 Aug 2022 20:01:17 +0200 Message-Id: <20220815180457.419164984@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peng Fan [ Upstream commit 044034efbeea05f65c09d2ba15ceeab53b60e947 ] According to spec: A value of 0 is disallowed and should not be programmed in this register Fix to 1. Fixes: 1b26cb8a77a4 ("clk: imx: support fracn gppll") Signed-off-by: Peng Fan Reviewed-by: Jacky Bai Reviewed-by: Abel Vesa Link: https://lore.kernel.org/r/20220609132902.3504651-5-peng.fan@oss.nxp.c= om Signed-off-by: Abel Vesa Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/imx/clk-fracn-gppll.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/clk/imx/clk-fracn-gppll.c b/drivers/clk/imx/clk-fracn-= gppll.c index 71c102d950ab..36a53c60e71f 100644 --- a/drivers/clk/imx/clk-fracn-gppll.c +++ b/drivers/clk/imx/clk-fracn-gppll.c @@ -64,10 +64,10 @@ struct clk_fracn_gppll { * Fout =3D Fvco / (rdiv * odiv) */ static const struct imx_fracn_gppll_rate_table fracn_tbl[] =3D { - PLL_FRACN_GP(650000000U, 81, 0, 0, 0, 3), - PLL_FRACN_GP(594000000U, 198, 0, 0, 0, 8), - PLL_FRACN_GP(560000000U, 70, 0, 0, 0, 3), - PLL_FRACN_GP(400000000U, 50, 0, 0, 0, 3), + PLL_FRACN_GP(650000000U, 81, 0, 1, 0, 3), + PLL_FRACN_GP(594000000U, 198, 0, 1, 0, 8), + PLL_FRACN_GP(560000000U, 70, 0, 1, 0, 3), + PLL_FRACN_GP(400000000U, 50, 0, 1, 0, 3), PLL_FRACN_GP(393216000U, 81, 92, 100, 0, 5) }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22349C282E7 for ; Mon, 15 Aug 2022 21:47:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242462AbiHOVry (ORCPT ); Mon, 15 Aug 2022 17:47:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349079AbiHOVmU (ORCPT ); Mon, 15 Aug 2022 17:42:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 573E1C5788; Mon, 15 Aug 2022 12:29:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DC241B8112C; Mon, 15 Aug 2022 19:29:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF0B5C433C1; Mon, 15 Aug 2022 19:29:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591774; bh=REkwR5J41q/Hrazw8AkkdOJJpFzFGfPiF5Ij9pcyQ+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rEpJYOZMLOuT+J+7KSuW9VDkVX2q+TcXIIRePOMbEt3lQb69gvvjwh1NXkhI+z7Yq byUCjOvdsgdx1cWFs03l9brvqJ32bpbMMbrOkw+7id9PQ74QyMHH3NdbrAMzGi9Axs s41sW49BZf5o0E/sxmV5JBuqWlqeZaJGvttpVa3Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Abel Vesa , Michael Turquette , Stephen Boyd , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Peng Fan , Liu Ying , Abel Vesa , Sasha Levin Subject: [PATCH 5.18 0679/1095] clk: imx: clk-fracn-gppll: Return rate in rate table properly in ->recalc_rate() Date: Mon, 15 Aug 2022 20:01:18 +0200 Message-Id: <20220815180457.458166104@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liu Ying [ Upstream commit 5ebaf9f7da5bb2dc56d394eabfcbe46dc6b1ea8d ] The PLL parameters in rate table should be directly compared with those read from PLL registers instead of the cooked ones. Fixes: 1b26cb8a77a4 ("clk: imx: support fracn gppll") Cc: Abel Vesa Cc: Michael Turquette Cc: Stephen Boyd Cc: Shawn Guo Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: NXP Linux Team Cc: Peng Fan Signed-off-by: Liu Ying Reviewed-by: Peng Fan Reviewed-by: Abel Vesa Link: https://lore.kernel.org/r/20220609132902.3504651-6-peng.fan@oss.nxp.c= om Signed-off-by: Abel Vesa Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/imx/clk-fracn-gppll.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/clk/imx/clk-fracn-gppll.c b/drivers/clk/imx/clk-fracn-= gppll.c index 36a53c60e71f..cb06b0045e9e 100644 --- a/drivers/clk/imx/clk-fracn-gppll.c +++ b/drivers/clk/imx/clk-fracn-gppll.c @@ -131,18 +131,7 @@ static unsigned long clk_fracn_gppll_recalc_rate(struc= t clk_hw *hw, unsigned lon mfi =3D FIELD_GET(PLL_MFI_MASK, pll_div); =20 rdiv =3D FIELD_GET(PLL_RDIV_MASK, pll_div); - rdiv =3D rdiv + 1; odiv =3D FIELD_GET(PLL_ODIV_MASK, pll_div); - switch (odiv) { - case 0: - odiv =3D 2; - break; - case 1: - odiv =3D 3; - break; - default: - break; - } =20 /* * Sometimes, the recalculated rate has deviation due to @@ -160,6 +149,19 @@ static unsigned long clk_fracn_gppll_recalc_rate(struc= t clk_hw *hw, unsigned lon if (rate) return (unsigned long)rate; =20 + rdiv =3D rdiv + 1; + + switch (odiv) { + case 0: + odiv =3D 2; + break; + case 1: + odiv =3D 3; + break; + default: + break; + } + /* Fvco =3D Fref * (MFI + MFN / MFD) */ fvco =3D fvco * mfi * mfd + fvco * mfn; do_div(fvco, mfd * rdiv * odiv); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DC16C25B08 for ; Mon, 15 Aug 2022 21:48:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349483AbiHOVsD (ORCPT ); Mon, 15 Aug 2022 17:48:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349333AbiHOVnO (ORCPT ); Mon, 15 Aug 2022 17:43:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1EE6C57BE; Mon, 15 Aug 2022 12:29:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0F6C1B810C6; Mon, 15 Aug 2022 19:29:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5750FC433C1; Mon, 15 Aug 2022 19:29:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591780; bh=jOFUmOin2soedTIGfZkBJaD3YTlBujDsu4f/pQUr+Tk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eiHFntFVpbyz75+bJnwn85mFWMkPYz57/oAuh83gIMV5kfaq2Uh30W2+9BcWlQwAm D4i9D6/2B9byTbUDUStGo9BjfGaYapdedPzHIo1r/3wzpIH7XgJdywVDL8/Vyd1zDZ k8eVhF+XIom6eAqDfj/XWYlwv7CVev8qvyVcakYY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Fan , Jacky Bai , Abel Vesa , Sasha Levin Subject: [PATCH 5.18 0680/1095] clk: imx: clk-fracn-gppll: correct rdiv Date: Mon, 15 Aug 2022 20:01:19 +0200 Message-Id: <20220815180457.505796844@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peng Fan [ Upstream commit f300cb7fccf69ba1835b983c76d70deb818ad194 ] According to Reference Manual: 000b - Divide by 1 001b - Divide by 1 010b - Divide by 2 011b - Divide by 3 100b - Divide by 4 101b - Divide by 5 110b - Divide by 6 111b - Divide by 7 So only need increase rdiv by 1 when the register value is 0. Fixes: 1b26cb8a77a4 ("clk: imx: support fracn gppll") Signed-off-by: Peng Fan Reviewed-by: Jacky Bai Reviewed-by: Abel Vesa Link: https://lore.kernel.org/r/20220609132902.3504651-7-peng.fan@oss.nxp.c= om Signed-off-by: Abel Vesa Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/imx/clk-fracn-gppll.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-fracn-gppll.c b/drivers/clk/imx/clk-fracn-= gppll.c index cb06b0045e9e..025b73229cdd 100644 --- a/drivers/clk/imx/clk-fracn-gppll.c +++ b/drivers/clk/imx/clk-fracn-gppll.c @@ -149,7 +149,8 @@ static unsigned long clk_fracn_gppll_recalc_rate(struct= clk_hw *hw, unsigned lon if (rate) return (unsigned long)rate; =20 - rdiv =3D rdiv + 1; + if (!rdiv) + rdiv =3D rdiv + 1; =20 switch (odiv) { case 0: --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6C14C282E7 for ; Mon, 15 Aug 2022 21:51:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244768AbiHOVvx (ORCPT ); Mon, 15 Aug 2022 17:51:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349486AbiHOVoL (ORCPT ); Mon, 15 Aug 2022 17:44:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED3B110228B; Mon, 15 Aug 2022 12:29:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 486B8B81062; Mon, 15 Aug 2022 19:29:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A0C6C433C1; Mon, 15 Aug 2022 19:29:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591787; bh=tSG5BZiS7wjhmXMXzV5/Gy6ukN5wWDyGwnZ1mUmPQps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TF5nKCizpYV1zk7jbvSLc46wrisoQGxdCeHMlHHLl+5j4nklmKNinWyMGqJ+GzdcM nUO5P9k6JDM1fnw8vT3mbfADwrjbTVaqnDq4o229B0MI/clSAwd+Os34Nbf3XqKBoC BTI053I2sPvA+s8yL5Jm5gMxQwW0rltnvCH4krtY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dongliang Mu , Bob Pearson , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.18 0681/1095] RDMA/rxe: fix xa_alloc_cycle() error return value check again Date: Mon, 15 Aug 2022 20:01:20 +0200 Message-Id: <20220815180457.546859444@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dongliang Mu [ Upstream commit 1a685940e6200e9def6e34bbaa19dd31dc5aeaf8 ] Currently rxe_alloc checks ret to indicate error, but 1 is also a valid return and just indicates that the allocation succeeded with a wrap. Fix this by modifying the check to be < 0. Link: https://lore.kernel.org/r/20220609070656.1446121-1-dzm91@hust.edu.cn Fixes: 3225717f6dfa ("RDMA/rxe: Replace red-black trees by xarrays") Signed-off-by: Dongliang Mu Reviewed-by: Bob Pearson Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/sw/rxe/rxe_pool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/r= xe/rxe_pool.c index 87066d04ed18..69db28944567 100644 --- a/drivers/infiniband/sw/rxe/rxe_pool.c +++ b/drivers/infiniband/sw/rxe/rxe_pool.c @@ -140,7 +140,7 @@ void *rxe_alloc(struct rxe_pool *pool) =20 err =3D xa_alloc_cyclic(&pool->xa, &elem->index, elem, pool->limit, &pool->next, GFP_KERNEL); - if (err) + if (err < 0) goto err_free; =20 return obj; @@ -168,7 +168,7 @@ int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe= _pool_elem *elem) =20 err =3D xa_alloc_cyclic(&pool->xa, &elem->index, elem, pool->limit, &pool->next, GFP_KERNEL); - if (err) + if (err < 0) goto err_cnt; =20 return 0; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54254C00140 for ; Mon, 15 Aug 2022 21:48:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349624AbiHOVsU (ORCPT ); Mon, 15 Aug 2022 17:48:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346706AbiHOVo1 (ORCPT ); Mon, 15 Aug 2022 17:44:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38A871022B1; Mon, 15 Aug 2022 12:29:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C693B60EF0; Mon, 15 Aug 2022 19:29:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B97A6C433D6; Mon, 15 Aug 2022 19:29:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591793; bh=bZ788B6z466vmlS6LVITTCvYlqYe/U/IhX4N2/r73Is=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JArRvkp0Iarwi1tZkms2ephH3WB5Jef8NshxDiVpWhnoj+Nc3G/mUT3QNJECvpXbp LNJHeEHbyRhPThDrWrylc9gBPuwUn8T/sDbQ8wsYIlBYfBGGI4w0FPsWswS67u/kN5 9W3VIXGh7OflOr/duyCRAMSEjIrBI8vUTbS4iMHI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , Jerome Glisse , Alistair Popple , Jason Gunthorpe , Ralph Campbell , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 0682/1095] lib/test_hmm: avoid accessing uninitialized pages Date: Mon, 15 Aug 2022 20:01:21 +0200 Message-Id: <20220815180457.586158042@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaohe Lin [ Upstream commit ed913b055a74b723976f8e885a3395162a0371e6 ] If make_device_exclusive_range() fails or returns pages marked for exclusive access less than required, remaining fields of pages will left uninitialized. So dmirror_atomic_map() will access those yet uninitialized fields of pages. To fix it, do dmirror_atomic_map() iff all pages are marked for exclusive access (we will break if mapped is less than required anyway) so we won't access those uninitialized fields of pages. Link: https://lkml.kernel.org/r/20220609130835.35110-1-linmiaohe@huawei.com Fixes: b659baea7546 ("mm: selftests for exclusive device memory") Signed-off-by: Miaohe Lin Cc: Jerome Glisse Cc: Alistair Popple Cc: Jason Gunthorpe Cc: Ralph Campbell Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- lib/test_hmm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/test_hmm.c b/lib/test_hmm.c index cfe632047839..f2c3015c5c82 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -732,7 +732,7 @@ static int dmirror_exclusive(struct dmirror *dmirror, =20 mmap_read_lock(mm); for (addr =3D start; addr < end; addr =3D next) { - unsigned long mapped; + unsigned long mapped =3D 0; int i; =20 if (end < addr + (ARRAY_SIZE(pages) << PAGE_SHIFT)) @@ -741,7 +741,13 @@ static int dmirror_exclusive(struct dmirror *dmirror, next =3D addr + (ARRAY_SIZE(pages) << PAGE_SHIFT); =20 ret =3D make_device_exclusive_range(mm, addr, next, pages, NULL); - mapped =3D dmirror_atomic_map(addr, next, pages, dmirror); + /* + * Do dmirror_atomic_map() iff all pages are marked for + * exclusive access to avoid accessing uninitialized + * fields of pages. + */ + if (ret =3D=3D (next - addr) >> PAGE_SHIFT) + mapped =3D dmirror_atomic_map(addr, next, pages, dmirror); for (i =3D 0; i < ret; i++) { if (pages[i]) { unlock_page(pages[i]); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C01E6C25B0E for ; Mon, 15 Aug 2022 21:48:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349826AbiHOVsq (ORCPT ); Mon, 15 Aug 2022 17:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349290AbiHOVpJ (ORCPT ); Mon, 15 Aug 2022 17:45:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FCE8C9E91; Mon, 15 Aug 2022 12:30:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D7ED1B81062; Mon, 15 Aug 2022 19:30:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17FC2C433C1; Mon, 15 Aug 2022 19:29:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591799; bh=kQSvD+paUr+cZU1TDKWmkofASbgYNIP6QBT9xrztMWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QmunClIVxO2c+TZJ7bv9Aim/mwwqUoXZEMD9wIFki4qqoLXxiXHqb6y/2nSRX4VK8 0IUxH/peA1Ye93K5s02AUXiw1UbTjWL6EaA7yWOEbuj+lMuCq1AfPLxUlG23Vbdx+r GdTHDj0tkfzll2evXvGQfH8k1zwUpavf30V4KLrg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , Dan Williams , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 0683/1095] mm/memremap: fix memunmap_pages() race with get_dev_pagemap() Date: Mon, 15 Aug 2022 20:01:22 +0200 Message-Id: <20220815180457.629161015@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaohe Lin [ Upstream commit 1e57ffb6e3fd9583268c6462c4e3853575b21701 ] Think about the below scene: CPU1 CPU2 memunmap_pages percpu_ref_exit __percpu_ref_exit free_percpu(percpu_count); /* percpu_count is freed here! */ get_dev_pagemap xa_load(&pgmap_array, PHYS_PFN(phys)) /* pgmap still in the pgmap_array */ percpu_ref_tryget_live(&pgmap->ref) if __ref_is_percpu /* __PERCPU_REF_ATOMIC_DEAD not set yet */ this_cpu_inc(*percpu_count) /* access freed percpu_count here! */ ref->percpu_count_ptr =3D __PERCPU_REF_ATOMIC_DEAD; /* too late... */ pageunmap_range To fix the issue, do percpu_ref_exit() after pgmap_array is emptied. So we won't do percpu_ref_tryget_live() against a being freed percpu_ref. Link: https://lkml.kernel.org/r/20220609121305.2508-1-linmiaohe@huawei.com Fixes: b7b3c01b1915 ("mm/memremap_pages: support multiple ranges per invoca= tion") Signed-off-by: Miaohe Lin Cc: Dan Williams Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- mm/memremap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memremap.c b/mm/memremap.c index e11653fd348c..2c1130486d28 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -141,10 +141,10 @@ void memunmap_pages(struct dev_pagemap *pgmap) for (i =3D 0; i < pgmap->nr_range; i++) percpu_ref_put_many(&pgmap->ref, pfn_len(pgmap, i)); wait_for_completion(&pgmap->done); - percpu_ref_exit(&pgmap->ref); =20 for (i =3D 0; i < pgmap->nr_range; i++) pageunmap_range(pgmap, i); + percpu_ref_exit(&pgmap->ref); =20 WARN_ONCE(pgmap->altmap.alloc, "failed to free all reserved pages\n"); devmap_managed_enable_put(pgmap); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A25FDC25B08 for ; Mon, 15 Aug 2022 21:48:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349898AbiHOVs5 (ORCPT ); Mon, 15 Aug 2022 17:48:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349746AbiHOVq0 (ORCPT ); Mon, 15 Aug 2022 17:46:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C76F9C9EBF; Mon, 15 Aug 2022 12:30:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6ABA5B810C6; Mon, 15 Aug 2022 19:30:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B736CC433D6; Mon, 15 Aug 2022 19:30:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591810; bh=1aEBkEVldE0y9BjO7ITmcEY/CmdEXYwxIU4S5/DA+5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zbI4BhQNmNNLKOO7VUqdFLfqdIGd2IvSAu+sNi8CpFlKOdjrgcFfJQv1LSD7DeNsG MPDKCs3KuPj5mYg7UI6X87lcs7CV9jUhHx2QGq5tWSpBTe7huVDU562DyffVCBefWp OBIW0F2tNU8HwDH9TC3vkCswavTlNsO1hnoXrQgA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 0684/1095] KVM: Dont set Accessed/Dirty bits for ZERO_PAGE Date: Mon, 15 Aug 2022 20:01:23 +0200 Message-Id: <20220815180457.671221396@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit a1040b0d42acf69bb4f6dbdc54c2dcd78eea1de5 ] Don't set Accessed/Dirty bits for a struct page with PG_reserved set, i.e. don't set A/D bits for the ZERO_PAGE. The ZERO_PAGE (or pages depending on the architecture) should obviously never be written, and similarly there's no point in marking it accessed as the page will never be swapped out or reclaimed. The comment in page-flags.h is quite clear that PG_reserved pages should be managed only by their owner, and strictly following that mandate also simplifies KVM's logic. Fixes: 7df003c85218 ("KVM: fix overflow of zero page refcount with ksm runn= ing") Signed-off-by: Sean Christopherson Message-Id: <20220429010416.2788472-4-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- virt/kvm/kvm_main.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 6c8295e76548..843396ed4ad3 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2852,16 +2852,28 @@ void kvm_release_pfn_dirty(kvm_pfn_t pfn) } EXPORT_SYMBOL_GPL(kvm_release_pfn_dirty); =20 +static bool kvm_is_ad_tracked_pfn(kvm_pfn_t pfn) +{ + if (!pfn_valid(pfn)) + return false; + + /* + * Per page-flags.h, pages tagged PG_reserved "should in general not be + * touched (e.g. set dirty) except by its owner". + */ + return !PageReserved(pfn_to_page(pfn)); +} + void kvm_set_pfn_dirty(kvm_pfn_t pfn) { - if (!kvm_is_reserved_pfn(pfn) && !kvm_is_zone_device_pfn(pfn)) + if (kvm_is_ad_tracked_pfn(pfn)) SetPageDirty(pfn_to_page(pfn)); } EXPORT_SYMBOL_GPL(kvm_set_pfn_dirty); =20 void kvm_set_pfn_accessed(kvm_pfn_t pfn) { - if (!kvm_is_reserved_pfn(pfn) && !kvm_is_zone_device_pfn(pfn)) + if (kvm_is_ad_tracked_pfn(pfn)) mark_page_accessed(pfn_to_page(pfn)); } EXPORT_SYMBOL_GPL(kvm_set_pfn_accessed); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3AE2C25B0E for ; Mon, 15 Aug 2022 21:49:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349908AbiHOVtF (ORCPT ); Mon, 15 Aug 2022 17:49:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349828AbiHOVqj (ORCPT ); Mon, 15 Aug 2022 17:46:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C95E7E68; Mon, 15 Aug 2022 12:30:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1878D610A3; Mon, 15 Aug 2022 19:30:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12BCEC433D6; Mon, 15 Aug 2022 19:30:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591817; bh=dI8AaoBjOiapI8HBOxTQnpOMEoE2WYNYVO0XPkuWt0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jbgote6xcoLWQMCuaC9Gz4lh0cR0lEJy67E569nX/PuWSNfM26FaD1HGyDmhVanNg 20cjaxe0zpHSt4NzpP6Ps90n4LXJ+dVlORZYPBtwsgEjwGDfJoquwL8aTqGgD1UiYL qRQhUMA/XPmEnVwvBq2k6PuTHSWWzuDTEW2ALyVs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Duoming Zhou , Sasha Levin Subject: [PATCH 5.18 0685/1095] mwifiex: fix sleep in atomic context bugs caused by dev_coredumpv Date: Mon, 15 Aug 2022 20:01:24 +0200 Message-Id: <20220815180457.711234778@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Duoming Zhou [ Upstream commit a52ed4866d2b90dd5e4ae9dabd453f3ed8fa3cbc ] There are sleep in atomic context bugs when uploading device dump data in mwifiex. The root cause is that dev_coredumpv could not be used in atomic contexts, because it calls dev_set_name which include operations that may sleep. The call tree shows execution paths that could lead to bugs: (Interrupt context) fw_dump_timer_fn mwifiex_upload_device_dump dev_coredumpv(..., GFP_KERNEL) dev_coredumpm() kzalloc(sizeof(*devcd), gfp); //may sleep dev_set_name kobject_set_name_vargs kvasprintf_const(GFP_KERNEL, ...); //may sleep kstrdup(s, GFP_KERNEL); //may sleep The corresponding fail log is shown below: [ 135.275938] usb 1-1: =3D=3D mwifiex dump information to /sys/class/devco= redump start [ 135.281029] BUG: sleeping function called from invalid context at includ= e/linux/sched/mm.h:265 ... [ 135.293613] Call Trace: [ 135.293613] [ 135.293613] dump_stack_lvl+0x57/0x7d [ 135.293613] __might_resched.cold+0x138/0x173 [ 135.293613] ? dev_coredumpm+0xca/0x2e0 [ 135.293613] kmem_cache_alloc_trace+0x189/0x1f0 [ 135.293613] ? devcd_match_failing+0x30/0x30 [ 135.293613] dev_coredumpm+0xca/0x2e0 [ 135.293613] ? devcd_freev+0x10/0x10 [ 135.293613] dev_coredumpv+0x1c/0x20 [ 135.293613] ? devcd_match_failing+0x30/0x30 [ 135.293613] mwifiex_upload_device_dump+0x65/0xb0 [ 135.293613] ? mwifiex_dnld_fw+0x1b0/0x1b0 [ 135.293613] call_timer_fn+0x122/0x3d0 [ 135.293613] ? msleep_interruptible+0xb0/0xb0 [ 135.293613] ? lock_downgrade+0x3c0/0x3c0 [ 135.293613] ? __next_timer_interrupt+0x13c/0x160 [ 135.293613] ? lockdep_hardirqs_on_prepare+0xe/0x220 [ 135.293613] ? mwifiex_dnld_fw+0x1b0/0x1b0 [ 135.293613] __run_timers.part.0+0x3f8/0x540 [ 135.293613] ? call_timer_fn+0x3d0/0x3d0 [ 135.293613] ? arch_restore_msi_irqs+0x10/0x10 [ 135.293613] ? lapic_next_event+0x31/0x40 [ 135.293613] run_timer_softirq+0x4f/0xb0 [ 135.293613] __do_softirq+0x1c2/0x651 ... [ 135.293613] RIP: 0010:default_idle+0xb/0x10 [ 135.293613] RSP: 0018:ffff888006317e68 EFLAGS: 00000246 [ 135.293613] RAX: ffffffff82ad8d10 RBX: ffff888006301cc0 RCX: ffffffff82a= c90e1 [ 135.293613] RDX: ffffed100d9ff1b4 RSI: ffffffff831ad140 RDI: ffffffff82a= d8f20 [ 135.293613] RBP: 0000000000000003 R08: 0000000000000000 R09: ffff88806cf= f8d9b [ 135.293613] R10: ffffed100d9ff1b3 R11: 0000000000000001 R12: ffffffff845= 93410 [ 135.293613] R13: 0000000000000000 R14: 0000000000000000 R15: 1ffff11000c= 62fd2 ... [ 135.389205] usb 1-1: =3D=3D mwifiex dump information to /sys/class/devco= redump end This patch uses delayed work to replace timer and moves the operations that may sleep into a delayed work in order to mitigate bugs, it was tested on Marvell 88W8801 chip whose port is usb and the firmware is usb8801_uapsta.bin. The following is the result after using delayed work to replace timer. [ 134.936453] usb 1-1: =3D=3D mwifiex dump information to /sys/class/devco= redump start [ 135.043344] usb 1-1: =3D=3D mwifiex dump information to /sys/class/devco= redump end As we can see, there is no bug now. Fixes: f5ecd02a8b20 ("mwifiex: device dump support for usb interface") Reviewed-by: Brian Norris Signed-off-by: Duoming Zhou Link: https://lore.kernel.org/r/b63b77fc84ed3e8a6bef02378e17c7c71a0bc3be.16= 54569290.git.duoming@zju.edu.cn Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/marvell/mwifiex/init.c | 9 +++++---- drivers/net/wireless/marvell/mwifiex/main.h | 3 ++- drivers/net/wireless/marvell/mwifiex/sta_event.c | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wire= less/marvell/mwifiex/init.c index 88c72d1827a0..fca3ab948f6c 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -63,9 +63,10 @@ static void wakeup_timer_fn(struct timer_list *t) adapter->if_ops.card_reset(adapter); } =20 -static void fw_dump_timer_fn(struct timer_list *t) +static void fw_dump_work(struct work_struct *work) { - struct mwifiex_adapter *adapter =3D from_timer(adapter, t, devdump_timer); + struct mwifiex_adapter *adapter =3D + container_of(work, struct mwifiex_adapter, devdump_work.work); =20 mwifiex_upload_device_dump(adapter); } @@ -321,7 +322,7 @@ static void mwifiex_init_adapter(struct mwifiex_adapter= *adapter) adapter->active_scan_triggered =3D false; timer_setup(&adapter->wakeup_timer, wakeup_timer_fn, 0); adapter->devdump_len =3D 0; - timer_setup(&adapter->devdump_timer, fw_dump_timer_fn, 0); + INIT_DELAYED_WORK(&adapter->devdump_work, fw_dump_work); } =20 /* @@ -400,7 +401,7 @@ static void mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter) { del_timer(&adapter->wakeup_timer); - del_timer_sync(&adapter->devdump_timer); + cancel_delayed_work_sync(&adapter->devdump_work); mwifiex_cancel_all_pending_cmd(adapter); wake_up_interruptible(&adapter->cmd_wait_q.wait); wake_up_interruptible(&adapter->hs_activate_wait_q); diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wire= less/marvell/mwifiex/main.h index 332dd1c8db35..5d8646f16162 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -49,6 +49,7 @@ #include #include #include +#include =20 #include "decl.h" #include "ioctl.h" @@ -1055,7 +1056,7 @@ struct mwifiex_adapter { /* Device dump data/length */ void *devdump_data; int devdump_len; - struct timer_list devdump_timer; + struct delayed_work devdump_work; =20 bool ignore_btcoex_events; }; diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net= /wireless/marvell/mwifiex/sta_event.c index 7d42c5d2dbf6..4d93386494c5 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c @@ -623,8 +623,8 @@ mwifiex_fw_dump_info_event(struct mwifiex_private *priv, * transmission event get lost, in this cornel case, * user would still get partial of the dump. */ - mod_timer(&adapter->devdump_timer, - jiffies + msecs_to_jiffies(MWIFIEX_TIMER_10S)); + schedule_delayed_work(&adapter->devdump_work, + msecs_to_jiffies(MWIFIEX_TIMER_10S)); } =20 /* Overflow check */ @@ -643,7 +643,7 @@ mwifiex_fw_dump_info_event(struct mwifiex_private *priv, return; =20 upload_dump: - del_timer_sync(&adapter->devdump_timer); + cancel_delayed_work_sync(&adapter->devdump_work); mwifiex_upload_device_dump(adapter); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31903C00140 for ; Mon, 15 Aug 2022 21:49:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349937AbiHOVtS (ORCPT ); Mon, 15 Aug 2022 17:49:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349877AbiHOVqt (ORCPT ); Mon, 15 Aug 2022 17:46:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDB18B1D2; Mon, 15 Aug 2022 12:30:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E11F060FBE; Mon, 15 Aug 2022 19:30:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2DDCC433D6; Mon, 15 Aug 2022 19:30:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591823; bh=uqZcaJCwpR4tvAkaLzZ8vTWBYN/99OrptHDtyN8vDYQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mAH17giFwrHl9mF9TXIasTOfCcZKljMZb+qnPEd9x4PRrYEdYiom4PYDa/08Z2WRy kG6EMo3IUFoEzdqZo2LUbXDgK4RyPzCRySI5K5+y6wnAfwlbbDA613odnzIQr5lPpm feAgckCHWphwqzJB2VfVP6wn2NS16kmrIx4bOPO4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nilesh Javali , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0686/1095] scsi: iscsi: Allow iscsi_if_stop_conn() to be called from kernel Date: Mon, 15 Aug 2022 20:01:25 +0200 Message-Id: <20220815180457.749693212@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mike Christie [ Upstream commit 3328333b47f4163504267440ec0a36087a407a5f ] iscsi_if_stop_conn() is only called from the userspace interface but in a subsequent commit we will want to call it from the kernel interface to allow drivers like qedi to remove sessions from inside the kernel during shutdown. This removes the iscsi_uevent code from iscsi_if_stop_conn() so we can call it in a new helper. Link: https://lore.kernel.org/r/20220616222738.5722-3-michael.christie@orac= le.com Tested-by: Nilesh Javali Reviewed-by: Nilesh Javali Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/scsi_transport_iscsi.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transp= ort_iscsi.c index 5d21f07456c6..a410d0b8a445 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2264,16 +2264,8 @@ static void iscsi_if_disconnect_bound_ep(struct iscs= i_cls_conn *conn, } } =20 -static int iscsi_if_stop_conn(struct iscsi_transport *transport, - struct iscsi_uevent *ev) +static int iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag) { - int flag =3D ev->u.stop_conn.flag; - struct iscsi_cls_conn *conn; - - conn =3D iscsi_conn_lookup(ev->u.stop_conn.sid, ev->u.stop_conn.cid); - if (!conn) - return -EINVAL; - ISCSI_DBG_TRANS_CONN(conn, "iscsi if conn stop.\n"); /* * If this is a termination we have to call stop_conn with that flag @@ -3720,7 +3712,12 @@ static int iscsi_if_transport_conn(struct iscsi_tran= sport *transport, case ISCSI_UEVENT_DESTROY_CONN: return iscsi_if_destroy_conn(transport, ev); case ISCSI_UEVENT_STOP_CONN: - return iscsi_if_stop_conn(transport, ev); + conn =3D iscsi_conn_lookup(ev->u.stop_conn.sid, + ev->u.stop_conn.cid); + if (!conn) + return -EINVAL; + + return iscsi_if_stop_conn(conn, ev->u.stop_conn.flag); } =20 /* --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45659C00140 for ; Mon, 15 Aug 2022 21:49:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349985AbiHOVt3 (ORCPT ); Mon, 15 Aug 2022 17:49:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349939AbiHOVqz (ORCPT ); Mon, 15 Aug 2022 17:46:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DCDC1707B; Mon, 15 Aug 2022 12:30:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A270FB810C6; Mon, 15 Aug 2022 19:30:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04B4BC433C1; Mon, 15 Aug 2022 19:30:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591830; bh=SHvDN0xdtf/T4fnzzE6qjyxX6hjji2NDLwj2gXivZOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UcsreZF6ODK1H+1L7r5rRc3/nKblFjHiVittOfleeC02mlw8sW20Jz+OvIOL6qify rZgkC8IPvHOCNzybHRFp8DAHegs5uPiOkdbMRqLQ63NeSBC7HCDB6arYpF3dY/PsKn RztelUHV/i2W9uBlPB73P/sbBWU45MNZGja1cxCw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nilesh Javali , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0687/1095] scsi: iscsi: Add helper to remove a session from the kernel Date: Mon, 15 Aug 2022 20:01:26 +0200 Message-Id: <20220815180457.799825797@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mike Christie [ Upstream commit bb42856bfd54fda1cbc7c470fcf5db1596938f4f ] During qedi shutdown we need to stop the iSCSI layer from sending new nops as pings and from responding to target ones and make sure there is no running connection cleanups. Commit d1f2ce77638d ("scsi: qedi: Fix host removal with running sessions") converted the driver to use the libicsi helper to drive session removal, so the above issues could be handled. The problem is that during system shutdown iscsid will not be running so when we try to remove the root session we will hang waiting for userspace to reply. Add a helper that will drive the destruction of sessions like these during system shutdown. Link: https://lore.kernel.org/r/20220616222738.5722-5-michael.christie@orac= le.com Tested-by: Nilesh Javali Reviewed-by: Nilesh Javali Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/scsi_transport_iscsi.c | 49 +++++++++++++++++++++++++++++ include/scsi/scsi_transport_iscsi.h | 1 + 2 files changed, 50 insertions(+) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transp= ort_iscsi.c index a410d0b8a445..2a38cd2d24ef 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2341,6 +2341,55 @@ static void iscsi_cleanup_conn_work_fn(struct work_s= truct *work) ISCSI_DBG_TRANS_CONN(conn, "cleanup done.\n"); } =20 +static int iscsi_iter_force_destroy_conn_fn(struct device *dev, void *data) +{ + struct iscsi_transport *transport; + struct iscsi_cls_conn *conn; + + if (!iscsi_is_conn_dev(dev)) + return 0; + + conn =3D iscsi_dev_to_conn(dev); + transport =3D conn->transport; + + if (READ_ONCE(conn->state) !=3D ISCSI_CONN_DOWN) + iscsi_if_stop_conn(conn, STOP_CONN_TERM); + + transport->destroy_conn(conn); + return 0; +} + +/** + * iscsi_force_destroy_session - destroy a session from the kernel + * @session: session to destroy + * + * Force the destruction of a session from the kernel. This should only be + * used when userspace is no longer running during system shutdown. + */ +void iscsi_force_destroy_session(struct iscsi_cls_session *session) +{ + struct iscsi_transport *transport =3D session->transport; + unsigned long flags; + + WARN_ON_ONCE(system_state =3D=3D SYSTEM_RUNNING); + + spin_lock_irqsave(&sesslock, flags); + if (list_empty(&session->sess_list)) { + spin_unlock_irqrestore(&sesslock, flags); + /* + * Conn/ep is already freed. Session is being torn down via + * async path. For shutdown we don't care about it so return. + */ + return; + } + spin_unlock_irqrestore(&sesslock, flags); + + device_for_each_child(&session->dev, NULL, + iscsi_iter_force_destroy_conn_fn); + transport->destroy_session(session); +} +EXPORT_SYMBOL_GPL(iscsi_force_destroy_session); + void iscsi_free_session(struct iscsi_cls_session *session) { ISCSI_DBG_TRANS_SESSION(session, "Freeing session\n"); diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transp= ort_iscsi.h index 9acb8422f680..d6eab7cb221a 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h @@ -442,6 +442,7 @@ extern struct iscsi_cls_session *iscsi_create_session(s= truct Scsi_Host *shost, struct iscsi_transport *t, int dd_size, unsigned int target_id); +extern void iscsi_force_destroy_session(struct iscsi_cls_session *session); extern void iscsi_remove_session(struct iscsi_cls_session *session); extern void iscsi_free_session(struct iscsi_cls_session *session); extern struct iscsi_cls_conn *iscsi_alloc_conn(struct iscsi_cls_session *s= ess, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED26BC00140 for ; Mon, 15 Aug 2022 21:49:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350010AbiHOVtj (ORCPT ); Mon, 15 Aug 2022 17:49:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349971AbiHOVq6 (ORCPT ); Mon, 15 Aug 2022 17:46:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F32C33349; Mon, 15 Aug 2022 12:30:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D8014B8107A; Mon, 15 Aug 2022 19:30:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16558C433C1; Mon, 15 Aug 2022 19:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591836; bh=6ef/Zsm6xEKJGQpRu6eAMimCjHH1f+bfuuoRh5fCEkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2Bgyo0A3mwaQObQNkr3Z8zt5PECx6qdgCa5BcSffa8kyeoec5P+oTaQpxXJtJ1kh6 kVHRE1n6/9h9teY19UywsoTXYJJdyBbcXHZgh7RgjkTqJmk8LlKQsopIpYoETUv+Na Sr5AahWqiKHo5Kc8szwEpQEQ1AJKbq6wffrz5cYo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nilesh Javali , Lee Duncan , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0688/1095] scsi: iscsi: Fix session removal on shutdown Date: Mon, 15 Aug 2022 20:01:27 +0200 Message-Id: <20220815180457.839616001@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mike Christie [ Upstream commit 31500e902759322ba3c64b60dabae2704e738df8 ] When the system is shutting down, iscsid is not running so we will not get a response to the ISCSI_ERR_INVALID_HOST error event. The system shutdown will then hang waiting on userspace to remove the session. This has libiscsi force the destruction of the session from the kernel when iscsi_host_remove() is called from a driver's shutdown callout. This fixes a regression added in qedi boot with commit d1f2ce77638d ("scsi: qedi: Fix host removal with running sessions") which made qedi use the common session removal function that waits on userspace instead of rolling its own kernel based removal. Link: https://lore.kernel.org/r/20220616222738.5722-7-michael.christie@orac= le.com Fixes: d1f2ce77638d ("scsi: qedi: Fix host removal with running sessions") Tested-by: Nilesh Javali Reviewed-by: Lee Duncan Reviewed-by: Nilesh Javali Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/ulp/iser/iscsi_iser.c | 4 ++-- drivers/scsi/be2iscsi/be_main.c | 2 +- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- drivers/scsi/cxgbi/libcxgbi.c | 2 +- drivers/scsi/iscsi_tcp.c | 4 ++-- drivers/scsi/libiscsi.c | 9 +++++++-- drivers/scsi/qedi/qedi_main.c | 9 ++++++--- include/scsi/libiscsi.h | 2 +- 8 files changed, 21 insertions(+), 13 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/= ulp/iser/iscsi_iser.c index f8d0bab4424c..e36036b8f386 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -568,7 +568,7 @@ static void iscsi_iser_session_destroy(struct iscsi_cls= _session *cls_session) struct Scsi_Host *shost =3D iscsi_session_to_shost(cls_session); =20 iscsi_session_teardown(cls_session); - iscsi_host_remove(shost); + iscsi_host_remove(shost, false); iscsi_host_free(shost); } =20 @@ -685,7 +685,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep, return cls_session; =20 remove_host: - iscsi_host_remove(shost); + iscsi_host_remove(shost, false); free_host: iscsi_host_free(shost); return NULL; diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_mai= n.c index 3bb0adefbe06..02026476c39c 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -5745,7 +5745,7 @@ static void beiscsi_remove(struct pci_dev *pcidev) cancel_work_sync(&phba->sess_work); =20 beiscsi_iface_destroy_default(phba); - iscsi_host_remove(phba->shost); + iscsi_host_remove(phba->shost, false); beiscsi_disable_port(phba, 1); =20 /* after cancelling boot_work */ diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_is= csi.c index 15fbd09baa94..a3c800e04a2e 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -909,7 +909,7 @@ void bnx2i_free_hba(struct bnx2i_hba *hba) { struct Scsi_Host *shost =3D hba->shost; =20 - iscsi_host_remove(shost); + iscsi_host_remove(shost, false); INIT_LIST_HEAD(&hba->ep_ofld_list); INIT_LIST_HEAD(&hba->ep_active_list); INIT_LIST_HEAD(&hba->ep_destroy_list); diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 4365d52c6430..32abdf0fa9aa 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -328,7 +328,7 @@ void cxgbi_hbas_remove(struct cxgbi_device *cdev) chba =3D cdev->hbas[i]; if (chba) { cdev->hbas[i] =3D NULL; - iscsi_host_remove(chba->shost); + iscsi_host_remove(chba->shost, false); pci_dev_put(cdev->pdev); iscsi_host_free(chba->shost); } diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 9fee70d6434a..52c6f70d60ec 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -898,7 +898,7 @@ iscsi_sw_tcp_session_create(struct iscsi_endpoint *ep, = uint16_t cmds_max, remove_session: iscsi_session_teardown(cls_session); remove_host: - iscsi_host_remove(shost); + iscsi_host_remove(shost, false); free_host: iscsi_host_free(shost); return NULL; @@ -915,7 +915,7 @@ static void iscsi_sw_tcp_session_destroy(struct iscsi_c= ls_session *cls_session) iscsi_tcp_r2tpool_free(cls_session->dd_data); iscsi_session_teardown(cls_session); =20 - iscsi_host_remove(shost); + iscsi_host_remove(shost, false); iscsi_host_free(shost); } =20 diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 797abf4f5399..3ddb701cd29c 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -2828,11 +2828,12 @@ static void iscsi_notify_host_removed(struct iscsi_= cls_session *cls_session) /** * iscsi_host_remove - remove host and sessions * @shost: scsi host + * @is_shutdown: true if called from a driver shutdown callout * * If there are any sessions left, this will initiate the removal and wait * for the completion. */ -void iscsi_host_remove(struct Scsi_Host *shost) +void iscsi_host_remove(struct Scsi_Host *shost, bool is_shutdown) { struct iscsi_host *ihost =3D shost_priv(shost); unsigned long flags; @@ -2841,7 +2842,11 @@ void iscsi_host_remove(struct Scsi_Host *shost) ihost->state =3D ISCSI_HOST_REMOVED; spin_unlock_irqrestore(&ihost->lock, flags); =20 - iscsi_host_for_each_session(shost, iscsi_notify_host_removed); + if (!is_shutdown) + iscsi_host_for_each_session(shost, iscsi_notify_host_removed); + else + iscsi_host_for_each_session(shost, iscsi_force_destroy_session); + wait_event_interruptible(ihost->session_removal_wq, ihost->num_sessions =3D=3D 0); if (signal_pending(current)) diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index 83ffba7f51da..780d975c85b5 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -2414,9 +2414,12 @@ static void __qedi_remove(struct pci_dev *pdev, int = mode) int rval; u16 retry =3D 10; =20 - if (mode =3D=3D QEDI_MODE_NORMAL || mode =3D=3D QEDI_MODE_SHUTDOWN) { - iscsi_host_remove(qedi->shost); + if (mode =3D=3D QEDI_MODE_NORMAL) + iscsi_host_remove(qedi->shost, false); + else if (mode =3D=3D QEDI_MODE_SHUTDOWN) + iscsi_host_remove(qedi->shost, true); =20 + if (mode =3D=3D QEDI_MODE_NORMAL || mode =3D=3D QEDI_MODE_SHUTDOWN) { if (qedi->tmf_thread) { destroy_workqueue(qedi->tmf_thread); qedi->tmf_thread =3D NULL; @@ -2791,7 +2794,7 @@ static int __qedi_probe(struct pci_dev *pdev, int mod= e) #ifdef CONFIG_DEBUG_FS qedi_dbg_host_exit(&qedi->dbg_ctx); #endif - iscsi_host_remove(qedi->shost); + iscsi_host_remove(qedi->shost, false); stop_iscsi_func: qedi_ops->stop(qedi->cdev); stop_slowpath: diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index c0703cd20a99..9758a4a9923f 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -411,7 +411,7 @@ extern int iscsi_host_add(struct Scsi_Host *shost, stru= ct device *pdev); extern struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht, int dd_data_size, bool xmit_can_sleep); -extern void iscsi_host_remove(struct Scsi_Host *shost); +extern void iscsi_host_remove(struct Scsi_Host *shost, bool is_shutdown); extern void iscsi_host_free(struct Scsi_Host *shost); extern int iscsi_target_alloc(struct scsi_target *starget); extern int iscsi_host_get_max_scsi_cmds(struct Scsi_Host *shost, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBC3EC00140 for ; Mon, 15 Aug 2022 21:49:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349072AbiHOVtt (ORCPT ); Mon, 15 Aug 2022 17:49:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350017AbiHOVrD (ORCPT ); Mon, 15 Aug 2022 17:47:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAC2852DDC; Mon, 15 Aug 2022 12:30:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 588FA610E7; Mon, 15 Aug 2022 19:30:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62ABFC433C1; Mon, 15 Aug 2022 19:30:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591846; bh=OWPSdIFm61z5E2K4vT0EJcS4iLQ5Z8SLJgsG9Gpzgiw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wIML5KEVcxxOGfn/nDlckkj/ivxNiyCJVGD7L+fPuWQVyp0DBkEnfpTlnst+otL7P t0GVRlVEkhCr14fda2fdwrzuSqmyo+aaK5E5//o+fN2g7coIfFU09sxvEAQ8xILPNm cdQh852cLN86VE8usyRAve3oE9IF1GhN8pY5EOnc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Serge Semin , Frank Li , Bjorn Helgaas , Vinod Koul , Sasha Levin Subject: [PATCH 5.18 0689/1095] dmaengine: dw-edma: Fix eDMA Rd/Wr-channels and DMA-direction semantics Date: Mon, 15 Aug 2022 20:01:28 +0200 Message-Id: <20220815180457.894073085@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit c1e33979171da63cf47e56243ccb8ba82363c7d3 ] In accordance with [1, 2] the DW eDMA controller has been created to be part of the DW PCIe Root Port and DW PCIe End-point controllers and to offload the transferring of large blocks of data between application and remote PCIe domains leaving the system CPU free for other tasks. In the first case (eDMA being part of DW PCIe Root Port) the eDMA controller is always accessible via the CPU DBI interface and never over the PCIe wire. The latter case is more complex. Depending on the DW PCIe End-Point IP-core synthesize parameters it's possible to have the eDMA registers accessible not only from the application CPU side, but also via mapping the eDMA CSRs over a dedicated endpoint BAR. So based on the specifics denoted above the eDMA driver is supposed to support two types of the DMA controller setups: 1) eDMA embedded into the DW PCIe Root Port/End-point and accessible over the local CPU from the application side. 2) eDMA embedded into the DW PCIe End-point and accessible via the PCIe wire with MWr/MRd TLPs generated by the CPU PCIe host controller. Since the CPU memory resides different sides in these cases the semantics of the MEM_TO_DEV and DEV_TO_MEM operations is flipped with respect to the Tx and Rx DMA channels. So MEM_TO_DEV/DEV_TO_MEM corresponds to the Tx/Rx channels in setup 1) and to the Rx/Tx channels in case of setup 2). The DW eDMA driver has supported the case 2) since e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver") in the framework of the drivers/dma/dw-edma/dw-edma-pcie.c driver. The case 1) support was added later by bd96f1b2f43a ("dmaengine: dw-edma: support local dma device transfer semantics"). Afterwards the driver was supposed to cover the both possible eDMA setups, but the latter commit turned out to be not fully correct. The problem was that the commit together with the new functionality support also changed the channel direction semantics so the eDMA Read-channel (corresponding to the DMA_DEV_TO_MEM direction for case 1) now uses the sgl/cyclic base addresses as the Source addresses of the DMA transfers and dma_slave_config.dst_addr as the Destination address of the DMA transfers. Similarly the eDMA Write-channel (corresponding to the DMA_MEM_TO_DEV direction for case 1) now uses dma_slave_config.src_addr as a source address of the DMA transfers and sgl/cyclic base address as the Destination address of the DMA transfers. This contradicts the logic of the DMA-interface, which implies that DEV side is supposed to belong to the PCIe device memory and MEM - to the CPU/Application memory. Indeed it seems irrational to have the SG-list defined in the PCIe bus space, while expecting a contiguous buffer allocated in the CPU memory. Moreover the passed SG-list and cyclic DMA buffers are supposed to be mapped in a way so to be seen by the DW eDMA Application (CPU) interface. So in order to have the correct DW eDMA interface we need to invert the eDMA Rd/Wr-channels and DMA-slave directions semantics by selecting the src/dst addresses based on the DMA transfer direction instead of using the channel direction capability. [1] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port, v.5.40a, March 2019, p.1092 [2] DesignWare Cores PCI Express Controller Databook - DWC PCIe Endpoint, v.5.40a, March 2019, p.1189 Co-developed-by: Manivannan Sadhasivam Fixes: bd96f1b2f43a ("dmaengine: dw-edma: support local dma device transfer= semantics") Link: https://lore.kernel.org/r/20220524152159.2370739-7-Frank.Li@nxp.com Tested-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Frank Li Signed-off-by: Bjorn Helgaas Acked-By: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/dma/dw-edma/dw-edma-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-ed= ma-core.c index 468d1097a1ec..f23569e4b0bd 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -423,7 +423,7 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) chunk->ll_region.sz +=3D burst->sz; desc->alloc_sz +=3D burst->sz; =20 - if (chan->dir =3D=3D EDMA_DIR_WRITE) { + if (dir =3D=3D DMA_DEV_TO_MEM) { burst->sar =3D src_addr; if (xfer->type =3D=3D EDMA_XFER_CYCLIC) { burst->dar =3D xfer->xfer.cyclic.paddr; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C925C00140 for ; Mon, 15 Aug 2022 21:50:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350064AbiHOVuD (ORCPT ); Mon, 15 Aug 2022 17:50:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350074AbiHOVrI (ORCPT ); Mon, 15 Aug 2022 17:47:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E08EF5E33B; Mon, 15 Aug 2022 12:30:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C8442B81126; Mon, 15 Aug 2022 19:30:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21F9DC433D6; Mon, 15 Aug 2022 19:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591852; bh=0n30SQV2oTUexFgmstOps5qTzO9d1a9NzMVVVLjrvdQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=szpve99RwVC20m01gVfm66m+gXoRhQub4LZmNmd9KGTLLivUOkvvSWj/ViJwcn55r mKodYzOyjV2+YMA/YNpCkf5HGbJcpoA13CQt/YUkGwj0jepRNKLcAk7HaS4CQptKfo VELCHyJBIxhz9FuvqIPzgtjWD7aPIolHVE0CTDzw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Matlack , Peter Xu , Ben Gardon , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 0690/1095] KVM: x86: Fix errant brace in KVM capability handling Date: Mon, 15 Aug 2022 20:01:29 +0200 Message-Id: <20220815180457.924813944@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ben Gardon [ Upstream commit 1c4dc57328bf218e999951824dce75c6125c4f3c ] The braces around the KVM_CAP_XSAVE2 block also surround the KVM_CAP_PMU_CAPABILITY block, likely the result of a merge issue. Simply move the curly brace back to where it belongs. Fixes: ba7bb663f5547 ("KVM: x86: Provide per VM capability for disabling PM= U virtualization") Reviewed-by: David Matlack Reviewed-by: Peter Xu Signed-off-by: Ben Gardon Message-Id: <20220613212523.3436117-8-bgardon@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index cc2c89c08d85..767a61e29f51 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4377,10 +4377,10 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, l= ong ext) if (r < sizeof(struct kvm_xsave)) r =3D sizeof(struct kvm_xsave); break; + } case KVM_CAP_PMU_CAPABILITY: r =3D enable_pmu ? KVM_CAP_PMU_VALID_MASK : 0; break; - } case KVM_CAP_DISABLE_QUIRKS2: r =3D KVM_X86_VALID_QUIRKS; break; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CF9FC00140 for ; Mon, 15 Aug 2022 21:50:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349723AbiHOVuT (ORCPT ); Mon, 15 Aug 2022 17:50:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350120AbiHOVrN (ORCPT ); Mon, 15 Aug 2022 17:47:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48AC75F12E; Mon, 15 Aug 2022 12:31:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 21371B8107A; Mon, 15 Aug 2022 19:31:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79C21C433D6; Mon, 15 Aug 2022 19:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591858; bh=7Lvbr3yWglt5qIfD10p3dizhg1TsWM9D8DoP5cAkLTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d773Nw+REw55AD6h01+PJzjIqop8COkygmOGdmPAdRqZ4VD+5GHNFNtl9IdZFAuCq 77mKePj4Y+7aHergu2r2NmAV+LafBPEO2GutlrtovWqUYgy2iOoTIyLJhm5DZ2e5qP 1R4OPD0cRHn2casgBNR5Uk0ialDgfk7jFJ95eJZU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Wolfram Sang , Lad Prabhakar , Sergey Shtylyov , Miquel Raynal , Sasha Levin Subject: [PATCH 5.18 0691/1095] mtd: hyperbus: rpc-if: Fix RPM imbalance in probe error path Date: Mon, 15 Aug 2022 20:01:30 +0200 Message-Id: <20220815180457.960816982@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Geert Uytterhoeven [ Upstream commit c223a38d62e57aa60a890ea7247e3c58a54478e6 ] If rpcif_hw_init() fails, Runtime PM is left enabled. Fixes: b04cc0d912eb80d3 ("memory: renesas-rpc-if: Add support for RZ/G2L") Signed-off-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Reviewed-by: Lad Prabhakar Reviewed-by: Sergey Shtylyov Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/f3070e1af480cb252ae183d479a593dbbf9= 47685.1655457790.git.geert+renesas@glider.be Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mtd/hyperbus/rpc-if.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/hyperbus/rpc-if.c b/drivers/mtd/hyperbus/rpc-if.c index 6e08ec1d4f09..b70d259e48a7 100644 --- a/drivers/mtd/hyperbus/rpc-if.c +++ b/drivers/mtd/hyperbus/rpc-if.c @@ -134,7 +134,7 @@ static int rpcif_hb_probe(struct platform_device *pdev) =20 error =3D rpcif_hw_init(&hyperbus->rpc, true); if (error) - return error; + goto out_disable_rpm; =20 hyperbus->hbdev.map.size =3D hyperbus->rpc.size; hyperbus->hbdev.map.virt =3D hyperbus->rpc.dirmap; @@ -145,8 +145,12 @@ static int rpcif_hb_probe(struct platform_device *pdev) hyperbus->hbdev.np =3D of_get_next_child(pdev->dev.parent->of_node, NULL); error =3D hyperbus_register_device(&hyperbus->hbdev); if (error) - rpcif_disable_rpm(&hyperbus->rpc); + goto out_disable_rpm; + + return 0; =20 +out_disable_rpm: + rpcif_disable_rpm(&hyperbus->rpc); return error; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC759C00140 for ; Mon, 15 Aug 2022 22:00:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346078AbiHOWA0 (ORCPT ); Mon, 15 Aug 2022 18:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347213AbiHOV73 (ORCPT ); Mon, 15 Aug 2022 17:59:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A5910DCE9; Mon, 15 Aug 2022 12:35:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 29B1561184; Mon, 15 Aug 2022 19:34:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C7FCC433C1; Mon, 15 Aug 2022 19:34:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592081; bh=bOmIgRM4vNz3Df9Jf/OuuxejBYT6qZkU/b0bYL8I7/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tmJ/Hn0Y7VPD1ZxOrbMhfJDQjYmWXa5IoMSUPbZmoOi/ZmjSVRVzyNhvQ+J3dwQAj 5oOXTHPMoZVADEZLI4KIlo9f5QnR7Cxo/Dkie/Ir4JBdhZ8Z5Vgq3My7CWsUVbv/Tm Kfjh70JGEUCbYmCKvU1OU/cU5c8P3NJ4uyIpyJ3E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Miquel Raynal , Sasha Levin Subject: [PATCH 5.18 0692/1095] mtd: dataflash: Add SPI ID table Date: Mon, 15 Aug 2022 20:01:31 +0200 Message-Id: <20220815180458.001073972@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Brown [ Upstream commit ac4f83482afbfd927d0fe118151b747cf175e724 ] Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding an id_table listing the SPI IDs for everything. Fixes: 96c8395e2166 ("spi: Revert modalias changes") Signed-off-by: Mark Brown Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220620152313.708768-1-broonie@ker= nel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mtd/devices/mtd_dataflash.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_= dataflash.c index 134e27328597..25bad4318305 100644 --- a/drivers/mtd/devices/mtd_dataflash.c +++ b/drivers/mtd/devices/mtd_dataflash.c @@ -112,6 +112,13 @@ static const struct of_device_id dataflash_dt_ids[] = =3D { MODULE_DEVICE_TABLE(of, dataflash_dt_ids); #endif =20 +static const struct spi_device_id dataflash_spi_ids[] =3D { + { .name =3D "at45", }, + { .name =3D "dataflash", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(spi, dataflash_spi_ids); + /* .......................................................................= .. */ =20 /* @@ -936,6 +943,7 @@ static struct spi_driver dataflash_driver =3D { =20 .probe =3D dataflash_probe, .remove =3D dataflash_remove, + .id_table =3D dataflash_spi_ids, =20 /* FIXME: investigate suspend and resume... */ }; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE34BC28B2C for ; Mon, 15 Aug 2022 21:52:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349899AbiHOVwC (ORCPT ); Mon, 15 Aug 2022 17:52:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350233AbiHOVra (ORCPT ); Mon, 15 Aug 2022 17:47:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D75B20BFA; Mon, 15 Aug 2022 12:31:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A1931610A3; Mon, 15 Aug 2022 19:31:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7250C433D6; Mon, 15 Aug 2022 19:31:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591880; bh=UOH6REFJS8cP2N9uoUPHkUleTOhh+U4QEU+B7D5bc6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HFFIlybauDg/ardgHNbMvLYzlOFR0uhbgsdKJVUeYpuvwSMhv3dqbKoEFLX3gAbB1 DWKbVzpaVATnklPa289Dl/+9sbA6JktZao2EUBU58DGl+a6jcYoYbd9huOTZyCHxzc XniqxbFm3R5AW+avxZybqyQ8TaHxTuyqdTRq/vUA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Zapolskiy , Bryan ODonoghue , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0693/1095] clk: qcom: camcc-sm8250: Fix halt on boot by reducing drivers init level Date: Mon, 15 Aug 2022 20:01:32 +0200 Message-Id: <20220815180458.050992029@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Zapolskiy [ Upstream commit c4f40351901a10cd662ac2c081396d8fb04f584d ] Access to I/O of SM8250 camera clock controller IP depends on enabled GCC_CAMERA_AHB_CLK clock supplied by global clock controller, the latter one is inited on subsys level, so, to satisfy the dependency, it would make sense to deprive the init level of camcc-sm8250 driver. If both drivers are compiled as built-in, there is a change that a board won't boot up due to a race, which happens on the same init level. Fixes: 5d66ca79b58c ("clk: qcom: Add camera clock controller driver for SM8= 250") Signed-off-by: Vladimir Zapolskiy Reviewed-by: Bryan O'Donoghue Tested-by: Bryan O'Donoghue Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220518103554.949511-1-vladimir.zapolskiy@= linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/camcc-sm8250.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/clk/qcom/camcc-sm8250.c b/drivers/clk/qcom/camcc-sm825= 0.c index 439eaafdcc86..ae4e9774f36e 100644 --- a/drivers/clk/qcom/camcc-sm8250.c +++ b/drivers/clk/qcom/camcc-sm8250.c @@ -2440,17 +2440,7 @@ static struct platform_driver cam_cc_sm8250_driver = =3D { }, }; =20 -static int __init cam_cc_sm8250_init(void) -{ - return platform_driver_register(&cam_cc_sm8250_driver); -} -subsys_initcall(cam_cc_sm8250_init); - -static void __exit cam_cc_sm8250_exit(void) -{ - platform_driver_unregister(&cam_cc_sm8250_driver); -} -module_exit(cam_cc_sm8250_exit); +module_platform_driver(cam_cc_sm8250_driver); =20 MODULE_DESCRIPTION("QTI CAMCC SM8250 Driver"); MODULE_LICENSE("GPL v2"); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AA55C00140 for ; Mon, 15 Aug 2022 21:52:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350364AbiHOVwy (ORCPT ); Mon, 15 Aug 2022 17:52:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350320AbiHOVrj (ORCPT ); Mon, 15 Aug 2022 17:47:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C571A60535; Mon, 15 Aug 2022 12:31:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 42D96B81128; Mon, 15 Aug 2022 19:31:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74D9FC4315A; Mon, 15 Aug 2022 19:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591913; bh=ISFO6hjI4XqtpbbowUxey809oGw5ggq0GNaeJcnkqKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JpennA+rVC23dmt3KSf0eBxhsieabMVmp+ZbjZ4OjF4MNxU6DFvwmxmXhXHcT5iT+ 3TeZ1ToJu6+JtNamSsr/j6syAukVT0/O9B5kspD/0A/jdutxHn78yelf+n1d9ZI+AQ 8CXwOD9bTyosbxfj5Bwm5qEF8VMDRXmidBYXiubM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Sasha Levin Subject: [PATCH 5.18 0694/1095] misc: rtsx: Fix an error handling path in rtsx_pci_probe() Date: Mon, 15 Aug 2022 20:01:33 +0200 Message-Id: <20220815180458.085909188@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 44fd1917314e9d4f53dd95dd65df1c152f503d3a ] If an error occurs after a successful idr_alloc() call, the corresponding resource must be released with idr_remove() as already done in the .remove function. Update the error handling path to add the missing idr_remove() call. Fixes: ada8a8a13b13 ("mfd: Add realtek pcie card reader driver") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/e8dc41716cbf52fb37a12e70d8972848e69df6d6.16= 55271216.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/misc/cardreader/rtsx_pcr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/r= tsx_pcr.c index 2a2619e3c72c..f001d99bf366 100644 --- a/drivers/misc/cardreader/rtsx_pcr.c +++ b/drivers/misc/cardreader/rtsx_pcr.c @@ -1507,7 +1507,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, pcr->remap_addr =3D ioremap(base, len); if (!pcr->remap_addr) { ret =3D -ENOMEM; - goto free_handle; + goto free_idr; } =20 pcr->rtsx_resv_buf =3D dma_alloc_coherent(&(pcidev->dev), @@ -1570,6 +1570,10 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, pcr->rtsx_resv_buf, pcr->rtsx_resv_buf_addr); unmap: iounmap(pcr->remap_addr); +free_idr: + spin_lock(&rtsx_pci_lock); + idr_remove(&rtsx_pci_idr, pcr->id); + spin_unlock(&rtsx_pci_lock); free_handle: kfree(handle); free_pcr: --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5256C00140 for ; Mon, 15 Aug 2022 21:54:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347044AbiHOVya (ORCPT ); Mon, 15 Aug 2022 17:54:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350368AbiHOVvF (ORCPT ); Mon, 15 Aug 2022 17:51:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A39BF104B27; Mon, 15 Aug 2022 12:32:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ED6286101B; Mon, 15 Aug 2022 19:32:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4F06C433C1; Mon, 15 Aug 2022 19:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591948; bh=payAf0HvEewLL/gsAXZ7WoDbcj/dgmnR+M9F73oqHIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UfLZ3wTtFLXGGQZVcM++zojLPJ/0g/+NoczxkNPhvrsFWqLcfrkDHv0f4n+0GiTro ge+5KhSK2l7SsztYF2BY53dTl/LzGcNrQ2DgktYp3brpYKFJqTFTDhn8WowS5W5EkY t3u3RcIFy7SUKTIPqp7RexVXX0o25isQcAOxA5w4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Wensheng , Sasha Levin Subject: [PATCH 5.18 0695/1095] driver core: fix potential deadlock in __driver_attach Date: Mon, 15 Aug 2022 20:01:34 +0200 Message-Id: <20220815180458.124830979@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhang Wensheng [ Upstream commit 70fe758352cafdee72a7b13bf9db065f9613ced8 ] In __driver_attach function, There are also AA deadlock problem, like the commit b232b02bf3c2 ("driver core: fix deadlock in __device_attach"). stack like commit b232b02bf3c2 ("driver core: fix deadlock in __device_attach"). list below: In __driver_attach function, The lock holding logic is as follows: ... __driver_attach if (driver_allows_async_probing(drv)) device_lock(dev) // get lock dev async_schedule_dev(__driver_attach_async_helper, dev); // func async_schedule_node async_schedule_node_domain(func) entry =3D kzalloc(sizeof(struct async_entry), GFP_ATOMIC); /* when fail or work limit, sync to execute func, but __driver_attach_async_helper will get lock dev as will, which will lead to A-A deadlock. */ if (!entry || atomic_read(&entry_count) > MAX_WORK) { func; else queue_work_node(node, system_unbound_wq, &entry->work) device_unlock(dev) As above show, when it is allowed to do async probes, because of out of memory or work limit, async work is not be allowed, to do sync execute instead. it will lead to A-A deadlock because of __driver_attach_async_helper getting lock dev. Reproduce: and it can be reproduce by make the condition (if (!entry || atomic_read(&entry_count) > MAX_WORK)) untenable, like below: [ 370.785650] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 370.787154] task:swapper/0 state:D stack: 0 pid: 1 ppid: 0 flags:0x00004000 [ 370.788865] Call Trace: [ 370.789374] [ 370.789841] __schedule+0x482/0x1050 [ 370.790613] schedule+0x92/0x1a0 [ 370.791290] schedule_preempt_disabled+0x2c/0x50 [ 370.792256] __mutex_lock.isra.0+0x757/0xec0 [ 370.793158] __mutex_lock_slowpath+0x1f/0x30 [ 370.794079] mutex_lock+0x50/0x60 [ 370.794795] __device_driver_lock+0x2f/0x70 [ 370.795677] ? driver_probe_device+0xd0/0xd0 [ 370.796576] __driver_attach_async_helper+0x1d/0xd0 [ 370.797318] ? driver_probe_device+0xd0/0xd0 [ 370.797957] async_schedule_node_domain+0xa5/0xc0 [ 370.798652] async_schedule_node+0x19/0x30 [ 370.799243] __driver_attach+0x246/0x290 [ 370.799828] ? driver_allows_async_probing+0xa0/0xa0 [ 370.800548] bus_for_each_dev+0x9d/0x130 [ 370.801132] driver_attach+0x22/0x30 [ 370.801666] bus_add_driver+0x290/0x340 [ 370.802246] driver_register+0x88/0x140 [ 370.802817] ? virtio_scsi_init+0x116/0x116 [ 370.803425] scsi_register_driver+0x1a/0x30 [ 370.804057] init_sd+0x184/0x226 [ 370.804533] do_one_initcall+0x71/0x3a0 [ 370.805107] kernel_init_freeable+0x39a/0x43a [ 370.805759] ? rest_init+0x150/0x150 [ 370.806283] kernel_init+0x26/0x230 [ 370.806799] ret_from_fork+0x1f/0x30 To fix the deadlock, move the async_schedule_dev outside device_lock, as we can see, in async_schedule_node_domain, the parameter of queue_work_node is system_unbound_wq, so it can accept concurrent operations. which will also not change the code logic, and will not lead to deadlock. Fixes: ef0ff68351be ("driver core: Probe devices asynchronously instead of = the driver") Signed-off-by: Zhang Wensheng Link: https://lore.kernel.org/r/20220622074327.497102-1-zhangwensheng5@huaw= ei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/base/dd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index d6980f33afc4..822dfa6561c2 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -1091,6 +1091,7 @@ static void __driver_attach_async_helper(void *_dev, = async_cookie_t cookie) static int __driver_attach(struct device *dev, void *data) { struct device_driver *drv =3D data; + bool async =3D false; int ret; =20 /* @@ -1129,9 +1130,11 @@ static int __driver_attach(struct device *dev, void = *data) if (!dev->driver) { get_device(dev); dev->p->async_driver =3D drv; - async_schedule_dev(__driver_attach_async_helper, dev); + async =3D true; } device_unlock(dev); + if (async) + async_schedule_dev(__driver_attach_async_helper, dev); return 0; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F244CC00140 for ; Mon, 15 Aug 2022 21:54:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348456AbiHOVyo (ORCPT ); Mon, 15 Aug 2022 17:54:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350551AbiHOVvg (ORCPT ); Mon, 15 Aug 2022 17:51:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9582E106FBB; Mon, 15 Aug 2022 12:33:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E8A2AB80EA7; Mon, 15 Aug 2022 19:33:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B144C433D6; Mon, 15 Aug 2022 19:33:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591982; bh=8yMkKzhaIIy3DNw9qsKXKinY89NRF/Ka1TXvMtoYgLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wtb5w3lczj0nviXn8a5nG2Nkp8JKgSj0TQYHHy2Url6UCH7xwtkf/yRHccyCiaa+l HL5eEjdS5JbYkbo9lFXbQj1n2CzrXb6qu7ktKR9oWIqI3S0jTrusqgJjeicz1F2jTf axuRwGpefMsPrSepl2SRhuwWOjNRVSGauxLqUtho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ansuel Smith , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0696/1095] clk: qcom: clk-krait: unlock spin after mux completion Date: Mon, 15 Aug 2022 20:01:35 +0200 Message-Id: <20220815180458.175221153@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ansuel Smith [ Upstream commit df83d2c9e72910416f650ade1e07cc314ff02731 ] Unlock spinlock after the mux switch is completed to prevent any corner case of mux request while the switch still needs to be done. Fixes: 4d7dc77babfe ("clk: qcom: Add support for Krait clocks") Signed-off-by: Ansuel Smith Reviewed-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220430054458.31321-3-ansuelsmth@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/clk-krait.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/clk-krait.c b/drivers/clk/qcom/clk-krait.c index 59f1af415b58..90046428693c 100644 --- a/drivers/clk/qcom/clk-krait.c +++ b/drivers/clk/qcom/clk-krait.c @@ -32,11 +32,16 @@ static void __krait_mux_set_sel(struct krait_mux_clk *m= ux, int sel) regval |=3D (sel & mux->mask) << (mux->shift + LPL_SHIFT); } krait_set_l2_indirect_reg(mux->offset, regval); - spin_unlock_irqrestore(&krait_clock_reg_lock, flags); =20 /* Wait for switch to complete. */ mb(); udelay(1); + + /* + * Unlock now to make sure the mux register is not + * modified while switching to the new parent. + */ + spin_unlock_irqrestore(&krait_clock_reg_lock, flags); } =20 static int krait_mux_set_parent(struct clk_hw *hw, u8 index) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AEADC25B08 for ; Mon, 15 Aug 2022 22:00:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245305AbiHOWAD (ORCPT ); Mon, 15 Aug 2022 18:00:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244496AbiHOV7S (ORCPT ); Mon, 15 Aug 2022 17:59:18 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83A6F10E949; Mon, 15 Aug 2022 12:35:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 6EFB8CE12E0; Mon, 15 Aug 2022 19:34:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4428DC433D7; Mon, 15 Aug 2022 19:34:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592071; bh=2wEmTjhGcMoUyc8RMh2YSMUxxlVkaz9yxKNpzM825EQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gyQKfJvsf780D38RU/nEGg67JKrC4cP3dhVedXYpW4JQ2V7Nnh1G07JAd6+mLSjOJ YLE0HkWshrDttOa6apW1cdtKj6BAswEm13PCpv7pOOzoi4lb2Rxim58twjLVRfKx8G Ky7biVM90Y1HayZqL/MTMn8zRLBQVUVv5i0AV/5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suzuki Poulose , Mike Leach , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.18 0697/1095] coresight: configfs: Fix unload of configurations on module exit Date: Mon, 15 Aug 2022 20:01:36 +0200 Message-Id: <20220815180458.210907254@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mike Leach [ Upstream commit 199380decc5f9188a9e65676031950f1734aaffe ] Any loaded configurations must be correctly unloaded on coresight module exit, or issues can arise with nested locking in the configfs directory code if built with CONFIG_LOCKDEP. Prior to this patch, the preloaded configuration configfs directory entries were being unloaded by the recursive code in configfs_unregister_subsystem(). However, when built with CONFIG_LOCKDEP, this caused a nested lock warning, which was not mitigated by the LOCKDEP dependent code in fs/configfs/dir.c designed to prevent this, due to the different directory levels for the root of the directory being removed. As the preloaded (and all other) configurations are registered after configfs_register_subsystem(), we now explicitly unload them before the call to configfs_unregister_subsystem(). The new routine cscfg_unload_cfgs_on_exit() iterates through the load owner list to unload any remaining configurations that were not unloaded by the user before the module exits. This covers both the CSCFG_OWNER_PRELOAD and CSCFG_OWNER_MODULE owner types, and will be extended to cover future load owner types for CoreSight configurations. Fixes: eb2ec49606c2 ("coresight: syscfg: Update load API for config loadabl= e modules") Reported-by: Suzuki Poulose Signed-off-by: Mike Leach Reviewed-and-tested-by: Suzuki K Poulose Link: https://lore.kernel.org/r/20220628173004.30002-2-mike.leach@linaro.org Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../hwtracing/coresight/coresight-syscfg.c | 104 ++++++++++++++++-- 1 file changed, 93 insertions(+), 11 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-syscfg.c b/drivers/hwtra= cing/coresight/coresight-syscfg.c index 11850fd8c3b5..17e728ab5c99 100644 --- a/drivers/hwtracing/coresight/coresight-syscfg.c +++ b/drivers/hwtracing/coresight/coresight-syscfg.c @@ -414,6 +414,27 @@ static void cscfg_remove_owned_csdev_features(struct c= oresight_device *csdev, vo } } =20 +/* + * Unregister all configuration and features from configfs owned by load_o= wner. + * Although this is called without the list mutex being held, it is in the + * context of an unload operation which are strictly serialised, + * so the lists cannot change during this call. + */ +static void cscfg_fs_unregister_cfgs_feats(void *load_owner) +{ + struct cscfg_config_desc *config_desc; + struct cscfg_feature_desc *feat_desc; + + list_for_each_entry(config_desc, &cscfg_mgr->config_desc_list, item) { + if (config_desc->load_owner =3D=3D load_owner) + cscfg_configfs_del_config(config_desc); + } + list_for_each_entry(feat_desc, &cscfg_mgr->feat_desc_list, item) { + if (feat_desc->load_owner =3D=3D load_owner) + cscfg_configfs_del_feature(feat_desc); + } +} + /* * removal is relatively easy - just remove from all lists, anything that * matches the owner. Memory for the descriptors will be managed by the ow= ner, @@ -1022,8 +1043,10 @@ struct device *cscfg_device(void) /* Must have a release function or the kernel will complain on module unlo= ad */ static void cscfg_dev_release(struct device *dev) { + mutex_lock(&cscfg_mutex); kfree(cscfg_mgr); cscfg_mgr =3D NULL; + mutex_unlock(&cscfg_mutex); } =20 /* a device is needed to "own" some kernel elements such as sysfs entries.= */ @@ -1042,6 +1065,13 @@ static int cscfg_create_device(void) if (!cscfg_mgr) goto create_dev_exit_unlock; =20 + /* initialise the cscfg_mgr structure */ + INIT_LIST_HEAD(&cscfg_mgr->csdev_desc_list); + INIT_LIST_HEAD(&cscfg_mgr->feat_desc_list); + INIT_LIST_HEAD(&cscfg_mgr->config_desc_list); + INIT_LIST_HEAD(&cscfg_mgr->load_order_list); + atomic_set(&cscfg_mgr->sys_active_cnt, 0); + /* setup the device */ dev =3D cscfg_device(); dev->release =3D cscfg_dev_release; @@ -1056,17 +1086,73 @@ static int cscfg_create_device(void) return err; } =20 -static void cscfg_clear_device(void) +/* + * Loading and unloading is generally on user discretion. + * If exiting due to coresight module unload, we need to unload any config= urations that remain, + * before we unregister the configfs intrastructure. + * + * Do this by walking the load_owner list and taking appropriate action, d= epending on the load + * owner type. + */ +static void cscfg_unload_cfgs_on_exit(void) { - struct cscfg_config_desc *cfg_desc; + struct cscfg_load_owner_info *owner_info =3D NULL; =20 + /* + * grab the mutex - even though we are exiting, some configfs files + * may still be live till we dump them, so ensure list data is + * protected from a race condition. + */ mutex_lock(&cscfg_mutex); - list_for_each_entry(cfg_desc, &cscfg_mgr->config_desc_list, item) { - etm_perf_del_symlink_cscfg(cfg_desc); + while (!list_empty(&cscfg_mgr->load_order_list)) { + + /* remove in reverse order of loading */ + owner_info =3D list_last_entry(&cscfg_mgr->load_order_list, + struct cscfg_load_owner_info, item); + + /* action according to type */ + switch (owner_info->type) { + case CSCFG_OWNER_PRELOAD: + /* + * preloaded descriptors are statically allocated in + * this module - just need to unload dynamic items from + * csdev lists, and remove from configfs directories. + */ + pr_info("cscfg: unloading preloaded configurations\n"); + break; + + case CSCFG_OWNER_MODULE: + /* + * this is an error - the loadable module must have been unloaded prior + * to the coresight module unload. Therefore that module has not + * correctly unloaded configs in its own exit code. + * Nothing to do other than emit an error string as the static descript= or + * references we need to unload will have disappeared with the module. + */ + pr_err("cscfg: ERROR: prior module failed to unload configuration\n"); + goto list_remove; + } + + /* remove from configfs - outside the scope of the list mutex */ + mutex_unlock(&cscfg_mutex); + cscfg_fs_unregister_cfgs_feats(owner_info); + mutex_lock(&cscfg_mutex); + + /* Next unload from csdev lists. */ + cscfg_unload_owned_cfgs_feats(owner_info); + +list_remove: + /* remove from load order list */ + list_del(&owner_info->item); } + mutex_unlock(&cscfg_mutex); +} + +static void cscfg_clear_device(void) +{ + cscfg_unload_cfgs_on_exit(); cscfg_configfs_release(cscfg_mgr); device_unregister(cscfg_device()); - mutex_unlock(&cscfg_mutex); } =20 /* Initialise system config management API device */ @@ -1074,20 +1160,16 @@ int __init cscfg_init(void) { int err =3D 0; =20 + /* create the device and init cscfg_mgr */ err =3D cscfg_create_device(); if (err) return err; =20 + /* initialise configfs subsystem */ err =3D cscfg_configfs_init(cscfg_mgr); if (err) goto exit_err; =20 - INIT_LIST_HEAD(&cscfg_mgr->csdev_desc_list); - INIT_LIST_HEAD(&cscfg_mgr->feat_desc_list); - INIT_LIST_HEAD(&cscfg_mgr->config_desc_list); - INIT_LIST_HEAD(&cscfg_mgr->load_order_list); - atomic_set(&cscfg_mgr->sys_active_cnt, 0); - /* preload built-in configurations */ err =3D cscfg_preload(THIS_MODULE); if (err) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1ED8AC25B08 for ; Mon, 15 Aug 2022 22:00:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344338AbiHOWAf (ORCPT ); Mon, 15 Aug 2022 18:00:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346207AbiHOV73 (ORCPT ); Mon, 15 Aug 2022 17:59:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A22A10E964; Mon, 15 Aug 2022 12:35:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 046E26113B; Mon, 15 Aug 2022 19:34:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B196BC433D7; Mon, 15 Aug 2022 19:34:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592078; bh=6JLjxT/Lu+DUMinJzcdWuuAg5ranlTsisFvAYUj8FuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o8JMP+51NbKHBkImYJm1POkFYw5wHtMR8OEQHAKlQmeNHNX/Yz3bvw1VFgJC91b0q wB4+Q0RmlVTKCmEOIzF9goIuAtojK/IoeIFsgZ8eIZfMVKzXpf7FTSSVTC6VKlsJ6+ q1OAB76pwTPpcGz0yeCTAkGY9gqkljgslQbf9Rm0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suzuki Poulose , Mike Leach , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.18 0698/1095] coresight: syscfg: Update load and unload operations Date: Mon, 15 Aug 2022 20:01:37 +0200 Message-Id: <20220815180458.262372366@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mike Leach [ Upstream commit 8add26f7ef33bba7984cb6ff7911c6aa970fe55a ] The configfs system is a source of access to the config information in the configuration and feature lists. This can result in additional LOCKDEP issues as a result of the mutex ordering between the config list mutex (cscfg_mutex) and the configfs system mutexes. As such we need to adjust how load/unload operations work to ensure correct operation. 1) Previously the cscfg_mutex was held throughout the load/unload operation. This is now only held during configuration list manipulations, resulting in a multi-stage load/unload process. 2) All operations that manipulate the configfs representation of the configurations and features are now separated out and run without the cscfg_mutex being held. This avoids circular lock_dep issue with the built-in configfs mutexes and semaphores 3) As the load and unload is now multi-stage, some parts under the cscfg_mutex and others not: i) A flag indicating a load / unload operation in progress is used to serialise load / unload operations. ii) activating any configuration not possible when unload is in progress. iii) Configurations have an "available" flag set only after the last load stage for the configuration is complete. Activation of the configuration not possible till flag is set. 4) Following load/unload rules remain: i) Unload prevented while any configuration is active remains. ii) Unload in strict reverse order of load. iii) Existing configurations can be activated while a new load operation is underway. (by definition there can be no dependencies between an existing configuration and a new loading one due to ii) above.) Fixes: eb2ec49606c2 ("coresight: syscfg: Update load API for config loadabl= e modules") Reported-by: Suzuki Poulose Signed-off-by: Mike Leach Reviewed-and-tested-by: Suzuki K Poulose Link: https://lore.kernel.org/r/20220628173004.30002-3-mike.leach@linaro.org Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../hwtracing/coresight/coresight-config.h | 2 + .../hwtracing/coresight/coresight-syscfg.c | 191 ++++++++++++++---- .../hwtracing/coresight/coresight-syscfg.h | 13 ++ 3 files changed, 165 insertions(+), 41 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-config.h b/drivers/hwtra= cing/coresight/coresight-config.h index 2e1670523461..6ba013975741 100644 --- a/drivers/hwtracing/coresight/coresight-config.h +++ b/drivers/hwtracing/coresight/coresight-config.h @@ -134,6 +134,7 @@ struct cscfg_feature_desc { * @active_cnt: ref count for activate on this configuration. * @load_owner: handle to load owner for dynamic load and unload of confi= gs. * @fs_group: reference to configfs group for dynamic unload. + * @available: config can be activated - multi-stage load sets true on co= mpletion. */ struct cscfg_config_desc { const char *name; @@ -148,6 +149,7 @@ struct cscfg_config_desc { atomic_t active_cnt; void *load_owner; struct config_group *fs_group; + bool available; }; =20 /** diff --git a/drivers/hwtracing/coresight/coresight-syscfg.c b/drivers/hwtra= cing/coresight/coresight-syscfg.c index 17e728ab5c99..11138a9762b0 100644 --- a/drivers/hwtracing/coresight/coresight-syscfg.c +++ b/drivers/hwtracing/coresight/coresight-syscfg.c @@ -447,6 +447,8 @@ static void cscfg_unload_owned_cfgs_feats(void *load_ow= ner) struct cscfg_feature_desc *feat_desc, *feat_tmp; struct cscfg_registered_csdev *csdev_item; =20 + lockdep_assert_held(&cscfg_mutex); + /* remove from each csdev instance feature and config lists */ list_for_each_entry(csdev_item, &cscfg_mgr->csdev_desc_list, item) { /* @@ -460,7 +462,6 @@ static void cscfg_unload_owned_cfgs_feats(void *load_ow= ner) /* remove from the config descriptor lists */ list_for_each_entry_safe(config_desc, cfg_tmp, &cscfg_mgr->config_desc_li= st, item) { if (config_desc->load_owner =3D=3D load_owner) { - cscfg_configfs_del_config(config_desc); etm_perf_del_symlink_cscfg(config_desc); list_del(&config_desc->item); } @@ -469,12 +470,90 @@ static void cscfg_unload_owned_cfgs_feats(void *load_= owner) /* remove from the feature descriptor lists */ list_for_each_entry_safe(feat_desc, feat_tmp, &cscfg_mgr->feat_desc_list,= item) { if (feat_desc->load_owner =3D=3D load_owner) { - cscfg_configfs_del_feature(feat_desc); list_del(&feat_desc->item); } } } =20 +/* + * load the features and configs to the lists - called with list mutex held + */ +static int cscfg_load_owned_cfgs_feats(struct cscfg_config_desc **config_d= escs, + struct cscfg_feature_desc **feat_descs, + struct cscfg_load_owner_info *owner_info) +{ + int i, err; + + lockdep_assert_held(&cscfg_mutex); + + /* load features first */ + if (feat_descs) { + for (i =3D 0; feat_descs[i]; i++) { + err =3D cscfg_load_feat(feat_descs[i]); + if (err) { + pr_err("coresight-syscfg: Failed to load feature %s\n", + feat_descs[i]->name); + return err; + } + feat_descs[i]->load_owner =3D owner_info; + } + } + + /* next any configurations to check feature dependencies */ + if (config_descs) { + for (i =3D 0; config_descs[i]; i++) { + err =3D cscfg_load_config(config_descs[i]); + if (err) { + pr_err("coresight-syscfg: Failed to load configuration %s\n", + config_descs[i]->name); + return err; + } + config_descs[i]->load_owner =3D owner_info; + config_descs[i]->available =3D false; + } + } + return 0; +} + +/* set configurations as available to activate at the end of the load proc= ess */ +static void cscfg_set_configs_available(struct cscfg_config_desc **config_= descs) +{ + int i; + + lockdep_assert_held(&cscfg_mutex); + + if (config_descs) { + for (i =3D 0; config_descs[i]; i++) + config_descs[i]->available =3D true; + } +} + +/* + * Create and register each of the configurations and features with config= fs. + * Called without mutex being held. + */ +static int cscfg_fs_register_cfgs_feats(struct cscfg_config_desc **config_= descs, + struct cscfg_feature_desc **feat_descs) +{ + int i, err; + + if (feat_descs) { + for (i =3D 0; feat_descs[i]; i++) { + err =3D cscfg_configfs_add_feature(feat_descs[i]); + if (err) + return err; + } + } + if (config_descs) { + for (i =3D 0; config_descs[i]; i++) { + err =3D cscfg_configfs_add_config(config_descs[i]); + if (err) + return err; + } + } + return 0; +} + /** * cscfg_load_config_sets - API function to load feature and config sets. * @@ -497,57 +576,63 @@ int cscfg_load_config_sets(struct cscfg_config_desc *= *config_descs, struct cscfg_feature_desc **feat_descs, struct cscfg_load_owner_info *owner_info) { - int err =3D 0, i =3D 0; + int err =3D 0; =20 mutex_lock(&cscfg_mutex); - - /* load features first */ - if (feat_descs) { - while (feat_descs[i]) { - err =3D cscfg_load_feat(feat_descs[i]); - if (!err) - err =3D cscfg_configfs_add_feature(feat_descs[i]); - if (err) { - pr_err("coresight-syscfg: Failed to load feature %s\n", - feat_descs[i]->name); - cscfg_unload_owned_cfgs_feats(owner_info); - goto exit_unlock; - } - feat_descs[i]->load_owner =3D owner_info; - i++; - } + if (cscfg_mgr->load_state !=3D CSCFG_NONE) { + mutex_unlock(&cscfg_mutex); + return -EBUSY; } + cscfg_mgr->load_state =3D CSCFG_LOAD; =20 - /* next any configurations to check feature dependencies */ - i =3D 0; - if (config_descs) { - while (config_descs[i]) { - err =3D cscfg_load_config(config_descs[i]); - if (!err) - err =3D cscfg_configfs_add_config(config_descs[i]); - if (err) { - pr_err("coresight-syscfg: Failed to load configuration %s\n", - config_descs[i]->name); - cscfg_unload_owned_cfgs_feats(owner_info); - goto exit_unlock; - } - config_descs[i]->load_owner =3D owner_info; - i++; - } - } + /* first load and add to the lists */ + err =3D cscfg_load_owned_cfgs_feats(config_descs, feat_descs, owner_info); + if (err) + goto err_clean_load; =20 /* add the load owner to the load order list */ list_add_tail(&owner_info->item, &cscfg_mgr->load_order_list); if (!list_is_singular(&cscfg_mgr->load_order_list)) { /* lock previous item in load order list */ err =3D cscfg_owner_get(list_prev_entry(owner_info, item)); - if (err) { - cscfg_unload_owned_cfgs_feats(owner_info); - list_del(&owner_info->item); - } + if (err) + goto err_clean_owner_list; } =20 + /* + * make visible to configfs - configfs manipulation must occur outside + * the list mutex lock to avoid circular lockdep issues with configfs + * built in mutexes and semaphores. This is safe as it is not possible + * to start a new load/unload operation till the current one is done. + */ + mutex_unlock(&cscfg_mutex); + + /* create the configfs elements */ + err =3D cscfg_fs_register_cfgs_feats(config_descs, feat_descs); + mutex_lock(&cscfg_mutex); + + if (err) + goto err_clean_cfs; + + /* mark any new configs as available for activation */ + cscfg_set_configs_available(config_descs); + goto exit_unlock; + +err_clean_cfs: + /* cleanup after error registering with configfs */ + cscfg_fs_unregister_cfgs_feats(owner_info); + + if (!list_is_singular(&cscfg_mgr->load_order_list)) + cscfg_owner_put(list_prev_entry(owner_info, item)); + +err_clean_owner_list: + list_del(&owner_info->item); + +err_clean_load: + cscfg_unload_owned_cfgs_feats(owner_info); + exit_unlock: + cscfg_mgr->load_state =3D CSCFG_NONE; mutex_unlock(&cscfg_mutex); return err; } @@ -564,6 +649,9 @@ EXPORT_SYMBOL_GPL(cscfg_load_config_sets); * 1) no configurations are active. * 2) the set being unloaded was the last to be loaded to maintain depende= ncies. * + * Once the unload operation commences, we disallow any configuration being + * made active until it is complete. + * * @owner_info: Information on owner for set being unloaded. */ int cscfg_unload_config_sets(struct cscfg_load_owner_info *owner_info) @@ -572,6 +660,13 @@ int cscfg_unload_config_sets(struct cscfg_load_owner_i= nfo *owner_info) struct cscfg_load_owner_info *load_list_item =3D NULL; =20 mutex_lock(&cscfg_mutex); + if (cscfg_mgr->load_state !=3D CSCFG_NONE) { + mutex_unlock(&cscfg_mutex); + return -EBUSY; + } + + /* unload op in progress also prevents activation of any config */ + cscfg_mgr->load_state =3D CSCFG_UNLOAD; =20 /* cannot unload if anything is active */ if (atomic_read(&cscfg_mgr->sys_active_cnt)) { @@ -592,7 +687,12 @@ int cscfg_unload_config_sets(struct cscfg_load_owner_i= nfo *owner_info) goto exit_unlock; } =20 - /* unload all belonging to load_owner */ + /* remove from configfs - again outside the scope of the list mutex */ + mutex_unlock(&cscfg_mutex); + cscfg_fs_unregister_cfgs_feats(owner_info); + mutex_lock(&cscfg_mutex); + + /* unload everything from lists belonging to load_owner */ cscfg_unload_owned_cfgs_feats(owner_info); =20 /* remove from load order list */ @@ -603,6 +703,7 @@ int cscfg_unload_config_sets(struct cscfg_load_owner_in= fo *owner_info) list_del(&owner_info->item); =20 exit_unlock: + cscfg_mgr->load_state =3D CSCFG_NONE; mutex_unlock(&cscfg_mutex); return err; } @@ -780,8 +881,15 @@ static int _cscfg_activate_config(unsigned long cfg_ha= sh) struct cscfg_config_desc *config_desc; int err =3D -EINVAL; =20 + if (cscfg_mgr->load_state =3D=3D CSCFG_UNLOAD) + return -EBUSY; + list_for_each_entry(config_desc, &cscfg_mgr->config_desc_list, item) { if ((unsigned long)config_desc->event_ea->var =3D=3D cfg_hash) { + /* if we happen upon a partly loaded config, can't use it */ + if (config_desc->available =3D=3D false) + return -EBUSY; + /* must ensure that config cannot be unloaded in use */ err =3D cscfg_owner_get(config_desc->load_owner); if (err) @@ -1071,6 +1179,7 @@ static int cscfg_create_device(void) INIT_LIST_HEAD(&cscfg_mgr->config_desc_list); INIT_LIST_HEAD(&cscfg_mgr->load_order_list); atomic_set(&cscfg_mgr->sys_active_cnt, 0); + cscfg_mgr->load_state =3D CSCFG_NONE; =20 /* setup the device */ dev =3D cscfg_device(); diff --git a/drivers/hwtracing/coresight/coresight-syscfg.h b/drivers/hwtra= cing/coresight/coresight-syscfg.h index 9106ffab4833..66e2db890d82 100644 --- a/drivers/hwtracing/coresight/coresight-syscfg.h +++ b/drivers/hwtracing/coresight/coresight-syscfg.h @@ -12,6 +12,17 @@ =20 #include "coresight-config.h" =20 +/* + * Load operation types. + * When loading or unloading, another load operation cannot be run. + * When unloading configurations cannot be activated. + */ +enum cscfg_load_ops { + CSCFG_NONE, + CSCFG_LOAD, + CSCFG_UNLOAD +}; + /** * System configuration manager device. * @@ -30,6 +41,7 @@ * @cfgfs_subsys: configfs subsystem used to manage configurations. * @sysfs_active_config:Active config hash used if CoreSight controlled fr= om sysfs. * @sysfs_active_preset:Active preset index used if CoreSight controlled f= rom sysfs. + * @load_state: A multi-stage load/unload operation is in progress. */ struct cscfg_manager { struct device dev; @@ -41,6 +53,7 @@ struct cscfg_manager { struct configfs_subsystem cfgfs_subsys; u32 sysfs_active_config; int sysfs_active_preset; + enum cscfg_load_ops load_state; }; =20 /* get reference to dev in cscfg_manager */ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD2EFC25B0E for ; Mon, 15 Aug 2022 21:52:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350103AbiHOVwM (ORCPT ); Mon, 15 Aug 2022 17:52:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350257AbiHOVrc (ORCPT ); Mon, 15 Aug 2022 17:47:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFB875FAD0; Mon, 15 Aug 2022 12:31:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6DB68B81125; Mon, 15 Aug 2022 19:31:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98BC0C433C1; Mon, 15 Aug 2022 19:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591886; bh=8xVoADYwIv4LNKJ9F7p8sP2HeEkSfNtj+oTvGTxCvuo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kv6aiWSxGJ9RKEg0+EpWhF7HNZNZXcTNkQYH9pdX8scKioL3qCXyLhWmCeaFEPi/4 vN78iUEE6uI32yrralX6PNAUrR21jaX+F5BYo+0QbdofvnbK9Yi+X1cGIItx48cq1m 300yNkG/c53ouISPSnaHCGWxZjq8QX45haY1NaN8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Neal Liu , Sasha Levin Subject: [PATCH 5.18 0699/1095] usb: gadget: f_mass_storage: Make CD-ROM emulation works with Windows OS Date: Mon, 15 Aug 2022 20:01:38 +0200 Message-Id: <20220815180458.306057483@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Neal Liu [ Upstream commit 3b91edd624ab1ab694deef513a45eb9e9d49d75f ] Add read TOC with format 1 to support CD-ROM emulation with Windows OS. This patch is tested on Windows OS Server 2019. Fixes: 89ada0fe669a ("usb: gadget: f_mass_storage: Make CD-ROM emulation wo= rk with Mac OS-X") Reviewed-by: Alan Stern Signed-off-by: Neal Liu Link: https://lore.kernel.org/r/20220628021436.3252262-1-neal_liu@aspeedtec= h.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/gadget/function/f_mass_storage.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gad= get/function/f_mass_storage.c index 3a77bca0ebe1..e884f295504f 100644 --- a/drivers/usb/gadget/function/f_mass_storage.c +++ b/drivers/usb/gadget/function/f_mass_storage.c @@ -1192,13 +1192,14 @@ static int do_read_toc(struct fsg_common *common, s= truct fsg_buffhd *bh) u8 format; int i, len; =20 + format =3D common->cmnd[2] & 0xf; + if ((common->cmnd[1] & ~0x02) !=3D 0 || /* Mask away MSF */ - start_track > 1) { + (start_track > 1 && format !=3D 0x1)) { curlun->sense_data =3D SS_INVALID_FIELD_IN_CDB; return -EINVAL; } =20 - format =3D common->cmnd[2] & 0xf; /* * Check if CDB is old style SFF-8020i * i.e. format is in 2 MSBs of byte 9 @@ -1208,8 +1209,8 @@ static int do_read_toc(struct fsg_common *common, str= uct fsg_buffhd *bh) format =3D (common->cmnd[9] >> 6) & 0x3; =20 switch (format) { - case 0: - /* Formatted TOC */ + case 0: /* Formatted TOC */ + case 1: /* Multi-session info */ len =3D 4 + 2*8; /* 4 byte header + 2 descriptors */ memset(buf, 0, len); buf[1] =3D len - 2; /* TOC Length excludes length field */ @@ -1250,7 +1251,7 @@ static int do_read_toc(struct fsg_common *common, str= uct fsg_buffhd *bh) return len; =20 default: - /* Multi-session, PMA, ATIP, CD-TEXT not supported/required */ + /* PMA, ATIP, CD-TEXT not supported/required */ curlun->sense_data =3D SS_INVALID_FIELD_IN_CDB; return -EINVAL; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DEBCC00140 for ; Mon, 15 Aug 2022 21:52:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350220AbiHOVwV (ORCPT ); Mon, 15 Aug 2022 17:52:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350272AbiHOVre (ORCPT ); Mon, 15 Aug 2022 17:47:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F9885FAE3; Mon, 15 Aug 2022 12:31:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BC8ED6101B; Mon, 15 Aug 2022 19:31:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3221C433C1; Mon, 15 Aug 2022 19:31:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591892; bh=wtp6p6RMN1MZpTJuYtBu272z3ieJ8QwXzu/VzXe3Qcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IM3brOL24ONhaiR1/31iflriA5AT0dLukJz6RH2kYpG65OH07Jne2ajgHHNUC2IHP qTY/NWe7lMsqwVlANQrU6CxtVK0I9wvepk08kR/GV8wRpnprvXbFM3CIBUviSb+GDV 564DXJW1994zwOPU8vq1jHGmOggNG4YIQWQaNJ0M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Bryan ODonoghue , Krzysztof Kozlowski , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0700/1095] clk: qcom: gcc-msm8939: Add missing SYSTEM_MM_NOC_BFDCD_CLK_SRC Date: Mon, 15 Aug 2022 20:01:39 +0200 Message-Id: <20220815180458.339813454@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bryan O'Donoghue [ Upstream commit 07e7fcf1714c5f9930ad27613fea940aedba68da ] When adding in the indexes for this clock-controller we missed SYSTEM_MM_NOC_BFDCD_CLK_SRC. Add it in now. Fixes: 4c71d6abc4fc ("clk: qcom: Add DT bindings for MSM8939 GCC") Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: devicetree@vger.kernel.org Signed-off-by: Bryan O'Donoghue Acked-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220504163835.40130-2-bryan.odonoghue@lina= ro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/dt-bindings/clock/qcom,gcc-msm8939.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/dt-bindings/clock/qcom,gcc-msm8939.h b/include/dt-bind= ings/clock/qcom,gcc-msm8939.h index 0634467c4ce5..2d545ed0d35a 100644 --- a/include/dt-bindings/clock/qcom,gcc-msm8939.h +++ b/include/dt-bindings/clock/qcom,gcc-msm8939.h @@ -192,6 +192,7 @@ #define GCC_VENUS0_CORE0_VCODEC0_CLK 183 #define GCC_VENUS0_CORE1_VCODEC0_CLK 184 #define GCC_OXILI_TIMER_CLK 185 +#define SYSTEM_MM_NOC_BFDCD_CLK_SRC 186 =20 /* Indexes for GDSCs */ #define BIMC_GDSC 0 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53FCAC00140 for ; Mon, 15 Aug 2022 21:52:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350262AbiHOVwg (ORCPT ); Mon, 15 Aug 2022 17:52:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350282AbiHOVrf (ORCPT ); Mon, 15 Aug 2022 17:47:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 113415FAEB; Mon, 15 Aug 2022 12:31:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1611E60FB9; Mon, 15 Aug 2022 19:31:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03DC7C433D6; Mon, 15 Aug 2022 19:31:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591898; bh=LReIQ89/CnA3hqpuGEtuig0bfblqLBYyZyH7Eeo99iI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U0K+bhox8r/9qZ4OKXwa/vG/TLf7x80iXQ76MljmTq76FnSeduhKtiTMvzPbITQqw lVYKy/nUqGfwFTYbsI7DfQjpomUiMPKI9J8niGvU+0JIrIOeg7TWqtstdvIWJX3dB/ ZhDvz0JMJPf2LFe551Eypz4Zl6ytgJO/0Taik2dg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0701/1095] clk: qcom: gcc-msm8939: Fix bimc_ddr_clk_src rcgr base address Date: Mon, 15 Aug 2022 20:01:40 +0200 Message-Id: <20220815180458.372804561@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bryan O'Donoghue [ Upstream commit 63d42708320d6d2ca9ed505123d50ff4a542c36f ] Reviewing qcom docs for the 8939 we can see the command rcgr is pointing to the wrong address. bimc_ddr_clk_src_rcgr is @ 0x01832024 not 0x01832004. Fixes: 1664014e4679 ("clk: qcom: gcc-msm8939: Add MSM8939 Generic Clock Con= troller") Signed-off-by: Bryan O'Donoghue Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220504163835.40130-3-bryan.odonoghue@lina= ro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-msm8939.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/qcom/gcc-msm8939.c b/drivers/clk/qcom/gcc-msm8939.c index 39ebb443ae3d..31568658d23d 100644 --- a/drivers/clk/qcom/gcc-msm8939.c +++ b/drivers/clk/qcom/gcc-msm8939.c @@ -632,7 +632,7 @@ static struct clk_rcg2 system_noc_bfdcd_clk_src =3D { }; =20 static struct clk_rcg2 bimc_ddr_clk_src =3D { - .cmd_rcgr =3D 0x32004, + .cmd_rcgr =3D 0x32024, .hid_width =3D 5, .parent_map =3D gcc_xo_gpll0_bimc_map, .clkr.hw.init =3D &(struct clk_init_data){ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8545CC00140 for ; Mon, 15 Aug 2022 21:52:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350302AbiHOVwo (ORCPT ); Mon, 15 Aug 2022 17:52:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350292AbiHOVrh (ORCPT ); Mon, 15 Aug 2022 17:47:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1541F5FAEF; Mon, 15 Aug 2022 12:31:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C33BAB81062; Mon, 15 Aug 2022 19:31:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FA91C433D6; Mon, 15 Aug 2022 19:31:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591904; bh=/EF4z/uxQCTHAXnRvEbMiDLRJBQ1km36r9FTaXO2r6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RXdftRpWbl17hiPcXdmt4fYEW5d9yykT1ix5sVgCrchwKrEd3lsTTtSioPb3i75GQ F5c9F1WeoKR2sCc0jOaLC6aTktSSLaQ6siM5AhhwCEee8LCj0mQkvFtYj+/+aEcOt1 7KqxS1KyYy4CsqK1qjBhDFiRrj+CKSWWc4GT2ZgQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0702/1095] clk: qcom: gcc-msm8939: Add missing system_mm_noc_bfdcd_clk_src Date: Mon, 15 Aug 2022 20:01:41 +0200 Message-Id: <20220815180458.406405612@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bryan O'Donoghue [ Upstream commit dd363e2f7196278e7a30f509a0e8a841cb763b14 ] The msm8939 has an additional higher operating point for the multi-media peripherals. The higher throughput MM componets operate off of the system-mm noc not the system noc. system_mm_noc_bfdcd_clk_src is the source clock for the higher frequency capable system noc mm. Maximum frequency for the MM SNOC is 400 MHz. Fixes: 1664014e4679 ("clk: qcom: gcc-msm8939: Add MSM8939 Generic Clock Con= troller") Signed-off-by: Bryan O'Donoghue Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220504163835.40130-4-bryan.odonoghue@lina= ro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-msm8939.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/clk/qcom/gcc-msm8939.c b/drivers/clk/qcom/gcc-msm8939.c index 31568658d23d..12bab9067ea8 100644 --- a/drivers/clk/qcom/gcc-msm8939.c +++ b/drivers/clk/qcom/gcc-msm8939.c @@ -644,6 +644,18 @@ static struct clk_rcg2 bimc_ddr_clk_src =3D { }, }; =20 +static struct clk_rcg2 system_mm_noc_bfdcd_clk_src =3D { + .cmd_rcgr =3D 0x2600c, + .hid_width =3D 5, + .parent_map =3D gcc_xo_gpll0_gpll6a_map, + .clkr.hw.init =3D &(struct clk_init_data){ + .name =3D "system_mm_noc_bfdcd_clk_src", + .parent_data =3D gcc_xo_gpll0_gpll6a_parent_data, + .num_parents =3D 3, + .ops =3D &clk_rcg2_ops, + }, +}; + static const struct freq_tbl ftbl_gcc_camss_ahb_clk[] =3D { F(40000000, P_GPLL0, 10, 1, 2), F(80000000, P_GPLL0, 10, 0, 0), @@ -3623,6 +3635,7 @@ static struct clk_regmap *gcc_msm8939_clocks[] =3D { [GPLL2_VOTE] =3D &gpll2_vote, [PCNOC_BFDCD_CLK_SRC] =3D &pcnoc_bfdcd_clk_src.clkr, [SYSTEM_NOC_BFDCD_CLK_SRC] =3D &system_noc_bfdcd_clk_src.clkr, + [SYSTEM_MM_NOC_BFDCD_CLK_SRC] =3D &system_mm_noc_bfdcd_clk_src.clkr, [CAMSS_AHB_CLK_SRC] =3D &camss_ahb_clk_src.clkr, [APSS_AHB_CLK_SRC] =3D &apss_ahb_clk_src.clkr, [CSI0_CLK_SRC] =3D &csi0_clk_src.clkr, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51066C00140 for ; Mon, 15 Aug 2022 21:52:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350343AbiHOVwv (ORCPT ); Mon, 15 Aug 2022 17:52:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350306AbiHOVri (ORCPT ); Mon, 15 Aug 2022 17:47:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 979D76050F; Mon, 15 Aug 2022 12:31:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0978EB8107A; Mon, 15 Aug 2022 19:31:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A6C9C433C1; Mon, 15 Aug 2022 19:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591910; bh=z2ppMhTPiC/F2H1GoH0DGMhpTjqq0uo0VJ7PpbIH8zo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W9oe+aTf7yjoposCPbzNekzFYYb1goza5bmqWIUrVZXWRr4bzyQV8nXJ6aUIajrwg J0UauQW8RzO1HM5+GFdl3ICAtV7yH1TaDbe6LB032WoP/dAcTHua3TWMU6pokmXPle KZ83C4+wvsJPTPTPFtW5ewIOOEN/yKwWnwPjM1x0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0703/1095] clk: qcom: gcc-msm8939: Point MM peripherals to system_mm_noc clock Date: Mon, 15 Aug 2022 20:01:42 +0200 Message-Id: <20220815180458.445954519@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bryan O'Donoghue [ Upstream commit 05eed0990927aa9634682fec58660e30f7b7ae30 ] Qcom docs indciate the following peripherals operating from System NOC MM not from System NOC clocks. - MDP - VFE - JPEGe - Venus Switch over the relevant parent pointers. Fixes: 1664014e4679 ("clk: qcom: gcc-msm8939: Add MSM8939 Generic Clock Con= troller") Signed-off-by: Bryan O'Donoghue Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220504163835.40130-5-bryan.odonoghue@lina= ro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-msm8939.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/clk/qcom/gcc-msm8939.c b/drivers/clk/qcom/gcc-msm8939.c index 12bab9067ea8..c7377ec0f423 100644 --- a/drivers/clk/qcom/gcc-msm8939.c +++ b/drivers/clk/qcom/gcc-msm8939.c @@ -2453,7 +2453,7 @@ static struct clk_branch gcc_camss_jpeg_axi_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_camss_jpeg_axi_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, @@ -2657,7 +2657,7 @@ static struct clk_branch gcc_camss_vfe_axi_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_camss_vfe_axi_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, @@ -2813,7 +2813,7 @@ static struct clk_branch gcc_mdss_axi_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_mdss_axi_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, @@ -3205,7 +3205,7 @@ static struct clk_branch gcc_mdp_tbu_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_mdp_tbu_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, @@ -3223,7 +3223,7 @@ static struct clk_branch gcc_venus_tbu_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_venus_tbu_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, @@ -3241,7 +3241,7 @@ static struct clk_branch gcc_vfe_tbu_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_vfe_tbu_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, @@ -3259,7 +3259,7 @@ static struct clk_branch gcc_jpeg_tbu_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_jpeg_tbu_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, @@ -3496,7 +3496,7 @@ static struct clk_branch gcc_venus0_axi_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_venus0_axi_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7847AC25B0E for ; Mon, 15 Aug 2022 21:53:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350408AbiHOVxF (ORCPT ); Mon, 15 Aug 2022 17:53:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349789AbiHOVsY (ORCPT ); Mon, 15 Aug 2022 17:48:24 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A452B2AE14; Mon, 15 Aug 2022 12:32:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id E9735CE12C4; Mon, 15 Aug 2022 19:32:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2C2DC433C1; Mon, 15 Aug 2022 19:31:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591920; bh=rlc+TygH3/TDpI6G8/9xUMPvuJv/ForyaE2lXM7vA8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1wawT3C1aSwX6ayJs/hfOobHUdS6EMEUnRXd7ilLG8QzEwAuIWplEQrpuPNpQcXG9 G2se+gsKZ7xF7yXYauLKd6MZ6hMK8786a/8iDuPIQ89ReUOkdae9Ds4iBNsaxxXXWv fNRYFb7Lse+8SCgtLrIgW5aZVUULxfnk8AZDJOUg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Mathias Nyman , Sasha Levin Subject: [PATCH 5.18 0704/1095] usb: host: xhci: use snprintf() in xhci_decode_trb() Date: Mon, 15 Aug 2022 20:01:43 +0200 Message-Id: <20220815180458.494210801@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergey Shtylyov [ Upstream commit 1ce69c35b86038dd11d3a6115a04501c5b89a940 ] Commit cbf286e8ef83 ("xhci: fix unsafe memory usage in xhci tracing") apparently missed one sprintf() call in xhci_decode_trb() -- replace it with the snprintf() call as well... Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. Fixes: cbf286e8ef83 ("xhci: fix unsafe memory usage in xhci tracing") Signed-off-by: Sergey Shtylyov Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20220630124645.1805902-2-mathias.nyman@linu= x.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/host/xhci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 1f3f311d9951..1d60e62752f3 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -2393,7 +2393,7 @@ static inline const char *xhci_decode_trb(char *str, = size_t size, field3 & TRB_CYCLE ? 'C' : 'c'); break; case TRB_STOP_RING: - sprintf(str, + snprintf(str, size, "%s: slot %d sp %d ep %d flags %c", xhci_trb_type_string(type), TRB_TO_SLOT_ID(field3), --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31C71C00140 for ; Mon, 15 Aug 2022 21:53:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349810AbiHOVxN (ORCPT ); Mon, 15 Aug 2022 17:53:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349876AbiHOVsz (ORCPT ); Mon, 15 Aug 2022 17:48:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 119FF606B8; Mon, 15 Aug 2022 12:32:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2640461133; Mon, 15 Aug 2022 19:32:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11D65C433C1; Mon, 15 Aug 2022 19:32:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591926; bh=cRcGwfrIuzA+tBZlDTT6JWtbArYGci7x41RI+xWkygM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f3+KWOYgzLfiZ2g/LTKQPdRQkL3Y5OJI5A5HJnSLYpwgVc8R+dtwBBUzKkglzJm88 efI7MXD9O2isrfneKHtJh+RlqyfXx/gJnpfmDsnl7zqpA5xy7zmGVtQT/QRGGXxy25 x4Qy+c6d07530W1zioSRaTsNIosCnsikon3/i+dc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jenny Hack , Bob Pearson , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.18 0705/1095] RDMA/rxe: Fix deadlock in rxe_do_local_ops() Date: Mon, 15 Aug 2022 20:01:44 +0200 Message-Id: <20220815180458.543648823@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bob Pearson [ Upstream commit 7cb33d1bc1ac8e51fd88928f96674d392f8e07c4 ] When a local operation (invalidate mr, reg mr, bind mw) is finished there will be no ack packet coming from a responder to cause the wqe to be completed. This may happen anyway if a subsequent wqe performs IO. Currently if the wqe is signalled the completer tasklet is scheduled immediately but not otherwise. This leads to a deadlock if the next wqe has the fence bit set in send flags and the operation is not signalled. This patch removes the condition that the wqe must be signalled in order to schedule the completer tasklet which is the simplest fix for this deadlock and is fairly low cost. This is the analog for local operations of always setting the ackreq bit in all last or only request packets even if the operation is not signalled. Link: https://lore.kernel.org/r/20220523223251.15350-1-rpearsonhpe@gmail.com Reported-by: Jenny Hack Fixes: c1a411268a4b ("RDMA/rxe: Move local ops to subroutine") Signed-off-by: Bob Pearson Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/sw/rxe/rxe_req.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rx= e/rxe_req.c index 8a1cff80a68e..d574c47099b8 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -586,9 +586,11 @@ static int rxe_do_local_ops(struct rxe_qp *qp, struct = rxe_send_wqe *wqe) wqe->status =3D IB_WC_SUCCESS; qp->req.wqe_index =3D queue_next_index(qp->sq.queue, qp->req.wqe_index); =20 - if ((wqe->wr.send_flags & IB_SEND_SIGNALED) || - qp->sq_sig_type =3D=3D IB_SIGNAL_ALL_WR) - rxe_run_task(&qp->comp.task, 1); + /* There is no ack coming for local work requests + * which can lead to a deadlock. So go ahead and complete + * it now. + */ + rxe_run_task(&qp->comp.task, 1); =20 return 0; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F077CC00140 for ; Mon, 15 Aug 2022 21:54:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347231AbiHOVy2 (ORCPT ); Mon, 15 Aug 2022 17:54:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350093AbiHOVuL (ORCPT ); Mon, 15 Aug 2022 17:50:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16155BD154; Mon, 15 Aug 2022 12:32:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 37E96B80FD3; Mon, 15 Aug 2022 19:32:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 677C1C433C1; Mon, 15 Aug 2022 19:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591932; bh=EIFqnLnUM23Nz1J6+mXn0fbS1tnry5gPG/oOFxiGxUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rS3cUN29VnD9w2I/vSymQavVLN192Y0PKWX5ur5JLgHBZ0WH0W1JVx05K/H41cQM+ KkpOEX+Xre4zmz/mepUeCmY1te7zfFNeH7U1i0sT0CK2KFePZfyO8mpmSNanhFw1nm HyxNaMfSOhN89AXkiVvJn/8JEhX8JRIbnZTNaSYk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0706/1095] clk: qcom: ipq8074: fix NSS core PLL-s Date: Mon, 15 Aug 2022 20:01:45 +0200 Message-Id: <20220815180458.594771040@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robert Marko [ Upstream commit ca41ec1b30434636c56c5600b24a8d964d359d9c ] Like in IPQ6018 the NSS related Alpha PLL-s require initial configuration to work. So, obtain the regmap that is required for the Alpha PLL configuration and thus utilize the qcom_cc_really_probe() as we already have the regmap. Then utilize the Alpha PLL configs from the downstream QCA 5.4 based kernel to configure them. This fixes the UBI32 and NSS crypto PLL-s failing to get enabled by the kernel. Fixes: b8e7e519625f ("clk: qcom: ipq8074: add remaining PLL=E2=80=99s") Signed-off-by: Robert Marko Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220515210048.483898-1-robimarko@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-ipq8074.c | 39 +++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/gcc-ipq8074.c b/drivers/clk/qcom/gcc-ipq8074.c index 541016db3c4b..1a5141da7e23 100644 --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c @@ -4371,6 +4371,33 @@ static struct clk_branch gcc_pcie0_axi_s_bridge_clk = =3D { }, }; =20 +static const struct alpha_pll_config ubi32_pll_config =3D { + .l =3D 0x4e, + .config_ctl_val =3D 0x200d4aa8, + .config_ctl_hi_val =3D 0x3c2, + .main_output_mask =3D BIT(0), + .aux_output_mask =3D BIT(1), + .pre_div_val =3D 0x0, + .pre_div_mask =3D BIT(12), + .post_div_val =3D 0x0, + .post_div_mask =3D GENMASK(9, 8), +}; + +static const struct alpha_pll_config nss_crypto_pll_config =3D { + .l =3D 0x3e, + .alpha =3D 0x0, + .alpha_hi =3D 0x80, + .config_ctl_val =3D 0x4001055b, + .main_output_mask =3D BIT(0), + .pre_div_val =3D 0x0, + .pre_div_mask =3D GENMASK(14, 12), + .post_div_val =3D 0x1 << 8, + .post_div_mask =3D GENMASK(11, 8), + .vco_mask =3D GENMASK(21, 20), + .vco_val =3D 0x0, + .alpha_en_mask =3D BIT(24), +}; + static struct clk_hw *gcc_ipq8074_hws[] =3D { &gpll0_out_main_div2.hw, &gpll6_out_main_div2.hw, @@ -4772,7 +4799,17 @@ static const struct qcom_cc_desc gcc_ipq8074_desc = =3D { =20 static int gcc_ipq8074_probe(struct platform_device *pdev) { - return qcom_cc_probe(pdev, &gcc_ipq8074_desc); + struct regmap *regmap; + + regmap =3D qcom_cc_map(pdev, &gcc_ipq8074_desc); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + + clk_alpha_pll_configure(&ubi32_pll_main, regmap, &ubi32_pll_config); + clk_alpha_pll_configure(&nss_crypto_pll_main, regmap, + &nss_crypto_pll_config); + + return qcom_cc_really_probe(pdev, &gcc_ipq8074_desc, regmap); } =20 static struct platform_driver gcc_ipq8074_driver =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42173C25B08 for ; Mon, 15 Aug 2022 21:53:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348595AbiHOVx3 (ORCPT ); Mon, 15 Aug 2022 17:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350218AbiHOVuw (ORCPT ); Mon, 15 Aug 2022 17:50:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF530DEB57; Mon, 15 Aug 2022 12:32:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 76B89B81126; Mon, 15 Aug 2022 19:32:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC52AC433C1; Mon, 15 Aug 2022 19:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591939; bh=Sl8pAt6Q0dhidSZAmwSvNFkkV5IgZon/SaDP+uWCIr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JF4CRkpFMQRi/6zirq/w9cGhy/l40AIDNwNerQsxoCInHzvBVfgOnJTvSJZcLTSRZ 5EUzPaZA6D0GuXhGhgU5L1eNBHMQ0PajVIcu94ALiqMD+XRujtJMpY38nLGDbMJE0n TKjUAa56W9uxo3EaH0SqlLGYe80WlErgFaC7fwDM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0707/1095] clk: qcom: ipq8074: SW workaround for UBI32 PLL lock Date: Mon, 15 Aug 2022 20:01:46 +0200 Message-Id: <20220815180458.639328837@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robert Marko [ Upstream commit 3401ea2856ef84f39b75f0dc5ebcaeda81cb90ec ] UBI32 Huayra PLL fails to lock in 5 us in some SoC silicon and thus it will cause the wait_for_pll() to timeout and thus return the error indicating that the PLL failed to lock. This is bug in Huayra PLL HW for which SW workaround is to set bit 26 of TEST_CTL register. This is ported from the QCA 5.4 based downstream kernel. Fixes: b8e7e519625f ("clk: qcom: ipq8074: add remaining PLL=E2=80=99s") Signed-off-by: Robert Marko Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220515210048.483898-2-robimarko@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-ipq8074.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clk/qcom/gcc-ipq8074.c b/drivers/clk/qcom/gcc-ipq8074.c index 1a5141da7e23..b4291ba53c78 100644 --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c @@ -4805,6 +4805,9 @@ static int gcc_ipq8074_probe(struct platform_device *= pdev) if (IS_ERR(regmap)) return PTR_ERR(regmap); =20 + /* SW Workaround for UBI32 Huayra PLL */ + regmap_update_bits(regmap, 0x2501c, BIT(26), BIT(26)); + clk_alpha_pll_configure(&ubi32_pll_main, regmap, &ubi32_pll_config); clk_alpha_pll_configure(&nss_crypto_pll_main, regmap, &nss_crypto_pll_config); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9D74C00140 for ; Mon, 15 Aug 2022 21:53:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347485AbiHOVxn (ORCPT ); Mon, 15 Aug 2022 17:53:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350348AbiHOVvC (ORCPT ); Mon, 15 Aug 2022 17:51:02 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65959104B24; Mon, 15 Aug 2022 12:32:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 463EECE12DB; Mon, 15 Aug 2022 19:32:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7D3EC433C1; Mon, 15 Aug 2022 19:32:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591945; bh=exXlSyE6+QPcILp+nxmGivamKTdZ39q0PQQr8Zupu9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cFZWbY3+/XlNxBUkgyiEpFi3kJuYnh59rhShxtM6vOgqmOL4U8YnAHcFvQ+DbDRe7 vPCZ4UbIyPC33UOs73GFWvZcgBOytnB/1HoWa8MObWS38KXolRrCBNj/c8QeLx1yKi kc4DuXasggjHduFAX5VPxb5I+KrIRgTs+YiAMVww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0708/1095] clk: qcom: ipq8074: fix NSS port frequency tables Date: Mon, 15 Aug 2022 20:01:47 +0200 Message-Id: <20220815180458.671139666@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Marko [ Upstream commit 0e9e61a2815b5cd34f1b495b2d72e8127ce9b794 ] NSS port 5 and 6 frequency tables are currently broken and are causing a wide ranges of issue like 1G not working at all on port 6 or port 5 being clocked with 312 instead of 125 MHz as UNIPHY1 gets selected. So, update the frequency tables with the ones from the downstream QCA 5.4 based kernel which has already fixed this. Fixes: 7117a51ed303 ("clk: qcom: ipq8074: add NSS ethernet port clocks") Signed-off-by: Robert Marko Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220515210048.483898-3-robimarko@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-ipq8074.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/clk/qcom/gcc-ipq8074.c b/drivers/clk/qcom/gcc-ipq8074.c index b4291ba53c78..f1017f2e61bd 100644 --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c @@ -1788,8 +1788,10 @@ static struct clk_regmap_div nss_port4_tx_div_clk_sr= c =3D { static const struct freq_tbl ftbl_nss_port5_rx_clk_src[] =3D { F(19200000, P_XO, 1, 0, 0), F(25000000, P_UNIPHY1_RX, 12.5, 0, 0), + F(25000000, P_UNIPHY0_RX, 5, 0, 0), F(78125000, P_UNIPHY1_RX, 4, 0, 0), F(125000000, P_UNIPHY1_RX, 2.5, 0, 0), + F(125000000, P_UNIPHY0_RX, 1, 0, 0), F(156250000, P_UNIPHY1_RX, 2, 0, 0), F(312500000, P_UNIPHY1_RX, 1, 0, 0), { } @@ -1828,8 +1830,10 @@ static struct clk_regmap_div nss_port5_rx_div_clk_sr= c =3D { static const struct freq_tbl ftbl_nss_port5_tx_clk_src[] =3D { F(19200000, P_XO, 1, 0, 0), F(25000000, P_UNIPHY1_TX, 12.5, 0, 0), + F(25000000, P_UNIPHY0_TX, 5, 0, 0), F(78125000, P_UNIPHY1_TX, 4, 0, 0), F(125000000, P_UNIPHY1_TX, 2.5, 0, 0), + F(125000000, P_UNIPHY0_TX, 1, 0, 0), F(156250000, P_UNIPHY1_TX, 2, 0, 0), F(312500000, P_UNIPHY1_TX, 1, 0, 0), { } @@ -1867,8 +1871,10 @@ static struct clk_regmap_div nss_port5_tx_div_clk_sr= c =3D { =20 static const struct freq_tbl ftbl_nss_port6_rx_clk_src[] =3D { F(19200000, P_XO, 1, 0, 0), + F(25000000, P_UNIPHY2_RX, 5, 0, 0), F(25000000, P_UNIPHY2_RX, 12.5, 0, 0), F(78125000, P_UNIPHY2_RX, 4, 0, 0), + F(125000000, P_UNIPHY2_RX, 1, 0, 0), F(125000000, P_UNIPHY2_RX, 2.5, 0, 0), F(156250000, P_UNIPHY2_RX, 2, 0, 0), F(312500000, P_UNIPHY2_RX, 1, 0, 0), @@ -1907,8 +1913,10 @@ static struct clk_regmap_div nss_port6_rx_div_clk_sr= c =3D { =20 static const struct freq_tbl ftbl_nss_port6_tx_clk_src[] =3D { F(19200000, P_XO, 1, 0, 0), + F(25000000, P_UNIPHY2_TX, 5, 0, 0), F(25000000, P_UNIPHY2_TX, 12.5, 0, 0), F(78125000, P_UNIPHY2_TX, 4, 0, 0), + F(125000000, P_UNIPHY2_TX, 1, 0, 0), F(125000000, P_UNIPHY2_TX, 2.5, 0, 0), F(156250000, P_UNIPHY2_TX, 2, 0, 0), F(312500000, P_UNIPHY2_TX, 1, 0, 0), --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B49EBC00140 for ; Mon, 15 Aug 2022 21:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244336AbiHOVxz (ORCPT ); Mon, 15 Aug 2022 17:53:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350450AbiHOVvU (ORCPT ); Mon, 15 Aug 2022 17:51:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC45610522A; Mon, 15 Aug 2022 12:32:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B8C81B80EA7; Mon, 15 Aug 2022 19:32:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1779AC433C1; Mon, 15 Aug 2022 19:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591954; bh=SBzQteFzmwAx5cbaMvhguyziPkBKT50j+fZw3n8Q/0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1p8XrVJ3C9p26T8cP1t2/QFdT7o2NcUT9a7xrLA0qt7leGjEzoBwD/C74g10hXPQD ZsF78jSo/FquLhf7z3uHC40yFmZd/B9WIUWar41GU4rw5A4/N6BeIl8otDPBsmSR2J poGz931KeZwJbAc3QOPVk5rzPlX1Ab6mlPQSndVE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0709/1095] clk: qcom: ipq8074: set BRANCH_HALT_DELAY flag for UBI clocks Date: Mon, 15 Aug 2022 20:01:48 +0200 Message-Id: <20220815180458.716155339@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Marko [ Upstream commit 2bd357e698207e2e65db03007e4be65bf9d6a7b3 ] Currently, attempting to enable the UBI clocks will cause the stuck at off warning to be printed and clk_enable will fail. [ 14.936694] gcc_ubi1_ahb_clk status stuck at 'off' Downstream 5.4 QCA kernel has fixed this by seting the BRANCH_HALT_DELAY flag on UBI clocks, so lets do the same. Fixes: 5736294aef83 ("clk: qcom: ipq8074: add NSS clocks") Signed-off-by: Robert Marko Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220515210048.483898-6-robimarko@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-ipq8074.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/clk/qcom/gcc-ipq8074.c b/drivers/clk/qcom/gcc-ipq8074.c index f1017f2e61bd..2c2ecfc5e61f 100644 --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c @@ -3354,6 +3354,7 @@ static struct clk_branch gcc_nssnoc_ubi1_ahb_clk =3D { =20 static struct clk_branch gcc_ubi0_ahb_clk =3D { .halt_reg =3D 0x6820c, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x6820c, .enable_mask =3D BIT(0), @@ -3371,6 +3372,7 @@ static struct clk_branch gcc_ubi0_ahb_clk =3D { =20 static struct clk_branch gcc_ubi0_axi_clk =3D { .halt_reg =3D 0x68200, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68200, .enable_mask =3D BIT(0), @@ -3388,6 +3390,7 @@ static struct clk_branch gcc_ubi0_axi_clk =3D { =20 static struct clk_branch gcc_ubi0_nc_axi_clk =3D { .halt_reg =3D 0x68204, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68204, .enable_mask =3D BIT(0), @@ -3405,6 +3408,7 @@ static struct clk_branch gcc_ubi0_nc_axi_clk =3D { =20 static struct clk_branch gcc_ubi0_core_clk =3D { .halt_reg =3D 0x68210, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68210, .enable_mask =3D BIT(0), @@ -3422,6 +3426,7 @@ static struct clk_branch gcc_ubi0_core_clk =3D { =20 static struct clk_branch gcc_ubi0_mpt_clk =3D { .halt_reg =3D 0x68208, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68208, .enable_mask =3D BIT(0), @@ -3439,6 +3444,7 @@ static struct clk_branch gcc_ubi0_mpt_clk =3D { =20 static struct clk_branch gcc_ubi1_ahb_clk =3D { .halt_reg =3D 0x6822c, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x6822c, .enable_mask =3D BIT(0), @@ -3456,6 +3462,7 @@ static struct clk_branch gcc_ubi1_ahb_clk =3D { =20 static struct clk_branch gcc_ubi1_axi_clk =3D { .halt_reg =3D 0x68220, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68220, .enable_mask =3D BIT(0), @@ -3473,6 +3480,7 @@ static struct clk_branch gcc_ubi1_axi_clk =3D { =20 static struct clk_branch gcc_ubi1_nc_axi_clk =3D { .halt_reg =3D 0x68224, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68224, .enable_mask =3D BIT(0), @@ -3490,6 +3498,7 @@ static struct clk_branch gcc_ubi1_nc_axi_clk =3D { =20 static struct clk_branch gcc_ubi1_core_clk =3D { .halt_reg =3D 0x68230, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68230, .enable_mask =3D BIT(0), @@ -3507,6 +3516,7 @@ static struct clk_branch gcc_ubi1_core_clk =3D { =20 static struct clk_branch gcc_ubi1_mpt_clk =3D { .halt_reg =3D 0x68228, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68228, .enable_mask =3D BIT(0), --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54376C00140 for ; Mon, 15 Aug 2022 21:54:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348532AbiHOVyF (ORCPT ); Mon, 15 Aug 2022 17:54:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350474AbiHOVvZ (ORCPT ); Mon, 15 Aug 2022 17:51:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC0F810650C; Mon, 15 Aug 2022 12:32:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 22012B80EAD; Mon, 15 Aug 2022 19:32:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CB4EC433D7; Mon, 15 Aug 2022 19:32:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591960; bh=TC7u+XgfGfTMxPRPSERVYjV9ZDYG1QScUUBzh6/c8fc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VkEgVV8tuQ8ZZIQCw7T1EyjsrtOES7aYm2caooSl5voKpvDM0AnCoJl+ggZdMuIlN Rpi4rM/Qo9dLkXXDAb0/2A/ABMTFchf+5fOF7SJmzytf4783qnNWLyjNGrx8ao1llF RTXOFF02169K+EqmDXT5UHGZwE3a62pXC2zQVGlU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Zapolskiy , Robert Foss , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0710/1095] clk: qcom: camcc-sdm845: Fix topology around titan_top power domain Date: Mon, 15 Aug 2022 20:01:49 +0200 Message-Id: <20220815180458.763871408@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Zapolskiy [ Upstream commit 103dd2338bbff567bce7acd00fc5a09c806b38ec ] On SDM845 two found VFE GDSC power domains shall not be operated, if titan top is turned off, thus the former power domains will be set as subdomains by a GDSC registration routine. Fixes: 78412c262004 ("clk: qcom: Add camera clock controller driver for SDM= 845") Signed-off-by: Vladimir Zapolskiy Reviewed-by: Robert Foss Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220519214133.1728979-2-vladimir.zapolskiy= @linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/camcc-sdm845.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/clk/qcom/camcc-sdm845.c b/drivers/clk/qcom/camcc-sdm84= 5.c index be3f95326965..27d44188a7ab 100644 --- a/drivers/clk/qcom/camcc-sdm845.c +++ b/drivers/clk/qcom/camcc-sdm845.c @@ -1534,6 +1534,8 @@ static struct clk_branch cam_cc_sys_tmr_clk =3D { }, }; =20 +static struct gdsc titan_top_gdsc; + static struct gdsc bps_gdsc =3D { .gdscr =3D 0x6004, .pd =3D { @@ -1567,6 +1569,7 @@ static struct gdsc ife_0_gdsc =3D { .name =3D "ife_0_gdsc", }, .flags =3D POLL_CFG_GDSCR, + .parent =3D &titan_top_gdsc.pd, .pwrsts =3D PWRSTS_OFF_ON, }; =20 @@ -1576,6 +1579,7 @@ static struct gdsc ife_1_gdsc =3D { .name =3D "ife_1_gdsc", }, .flags =3D POLL_CFG_GDSCR, + .parent =3D &titan_top_gdsc.pd, .pwrsts =3D PWRSTS_OFF_ON, }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF65CC00140 for ; Mon, 15 Aug 2022 21:54:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347007AbiHOVyN (ORCPT ); Mon, 15 Aug 2022 17:54:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350488AbiHOVv1 (ORCPT ); Mon, 15 Aug 2022 17:51:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BD4B106521; Mon, 15 Aug 2022 12:32:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8D33561133; Mon, 15 Aug 2022 19:32:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80FDCC433D6; Mon, 15 Aug 2022 19:32:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591966; bh=Ykk3jmbFM3PJt62sxcizrmy6rHAzlSYX/3dokANt3sM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=stNHOsDJg54+RMlQ7xCbEwTp8z5Et5PId+itoTat9KQhxshuskEIcpLxG6FJT7Meu NyUZV2/0kIHJZViz4rtuQ+qfX3vPAkq9HeNYEkewLdcEuPqnDWObYLlPgRVPm5nDVS 11kiMrpIaLQ7I5PHGGruyMQCH3B+OjoTBcHf1DBc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Zapolskiy , Robert Foss , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0711/1095] clk: qcom: camcc-sm8250: Fix topology around titan_top power domain Date: Mon, 15 Aug 2022 20:01:50 +0200 Message-Id: <20220815180458.813027052@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Zapolskiy [ Upstream commit f8acf01a6a4f84baf05181e24bd48def4ba23f5b ] On SM8250 two found VFE GDSC power domains shall not be operated, if titan top is turned off, thus the former power domains will be set as subdomains by a GDSC registration routine. Fixes: 5d66ca79b58c ("clk: qcom: Add camera clock controller driver for SM8= 250") Signed-off-by: Vladimir Zapolskiy Reviewed-by: Robert Foss Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220519214133.1728979-3-vladimir.zapolskiy= @linaro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/camcc-sm8250.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/clk/qcom/camcc-sm8250.c b/drivers/clk/qcom/camcc-sm825= 0.c index ae4e9774f36e..9b32c56a5bc5 100644 --- a/drivers/clk/qcom/camcc-sm8250.c +++ b/drivers/clk/qcom/camcc-sm8250.c @@ -2205,6 +2205,8 @@ static struct clk_branch cam_cc_sleep_clk =3D { }, }; =20 +static struct gdsc titan_top_gdsc; + static struct gdsc bps_gdsc =3D { .gdscr =3D 0x7004, .pd =3D { @@ -2238,6 +2240,7 @@ static struct gdsc ife_0_gdsc =3D { .name =3D "ife_0_gdsc", }, .flags =3D POLL_CFG_GDSCR, + .parent =3D &titan_top_gdsc.pd, .pwrsts =3D PWRSTS_OFF_ON, }; =20 @@ -2247,6 +2250,7 @@ static struct gdsc ife_1_gdsc =3D { .name =3D "ife_1_gdsc", }, .flags =3D POLL_CFG_GDSCR, + .parent =3D &titan_top_gdsc.pd, .pwrsts =3D PWRSTS_OFF_ON, }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9232DC00140 for ; Mon, 15 Aug 2022 21:54:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348933AbiHOVyT (ORCPT ); Mon, 15 Aug 2022 17:54:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350514AbiHOVva (ORCPT ); Mon, 15 Aug 2022 17:51:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 573E3106F87; Mon, 15 Aug 2022 12:32:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E80CE6113B; Mon, 15 Aug 2022 19:32:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5176C433D6; Mon, 15 Aug 2022 19:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591973; bh=DBRad9dbqdq+e/uv1W5NXDIrcSTwjsDMioE3f8hh+bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h+j2Ua2RHDgqlmUokPdfH+5ZVsX0RQP80QrxwtxyiAuOTJNmWPqwqxkaHSJa1nWSm 7l+/HUVhZu51F+sL3z+0mVR3KJveMJaXnb3v8SgSQS/z6FUoeK5318boJDyfZF+SCE KOqd+04WfhzqfeGbSoqnWXJGVFFGsJlukv8lp3Ww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikita Travkin , Stephen Boyd , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0712/1095] clk: qcom: clk-rcg2: Fail Duty-Cycle configuration if MND divider is not enabled. Date: Mon, 15 Aug 2022 20:01:51 +0200 Message-Id: <20220815180458.859322603@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nikita Travkin [ Upstream commit bdafb609c3bb848d710ad9cd4debd2ee9d6a4049 ] In cases when MND is not enabled (e.g. when only Half Integer Divider is used), setting D registers makes no effect. Fail instead of making ineffective write. Fixes: 7f891faf596e ("clk: qcom: clk-rcg2: Add support for duty-cycle for R= CG") Signed-off-by: Nikita Travkin Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220612145955.385787-2-nikita@trvn.ru Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/clk-rcg2.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index e9c357309fd9..9611c9a7231f 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -405,7 +405,7 @@ static int clk_rcg2_get_duty_cycle(struct clk_hw *hw, s= truct clk_duty *duty) static int clk_rcg2_set_duty_cycle(struct clk_hw *hw, struct clk_duty *dut= y) { struct clk_rcg2 *rcg =3D to_clk_rcg2(hw); - u32 notn_m, n, m, d, not2d, mask, duty_per; + u32 notn_m, n, m, d, not2d, mask, duty_per, cfg; int ret; =20 /* Duty-cycle cannot be modified for non-MND RCGs */ @@ -416,6 +416,11 @@ static int clk_rcg2_set_duty_cycle(struct clk_hw *hw, = struct clk_duty *duty) =20 regmap_read(rcg->clkr.regmap, RCG_N_OFFSET(rcg), ¬n_m); regmap_read(rcg->clkr.regmap, RCG_M_OFFSET(rcg), &m); + regmap_read(rcg->clkr.regmap, RCG_CFG_OFFSET(rcg), &cfg); + + /* Duty-cycle cannot be modified if MND divider is in bypass mode. */ + if (!(cfg & CFG_MODE_MASK)) + return -EINVAL; =20 n =3D (~(notn_m) + m) & mask; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A524C00140 for ; Mon, 15 Aug 2022 21:54:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243495AbiHOVyk (ORCPT ); Mon, 15 Aug 2022 17:54:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350534AbiHOVve (ORCPT ); Mon, 15 Aug 2022 17:51:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EB8F106F97; Mon, 15 Aug 2022 12:33:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 338F36115A; Mon, 15 Aug 2022 19:33:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A0A3C433C1; Mon, 15 Aug 2022 19:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591979; bh=reaCaFSvJsZu7N/qYI/xflIODqPJK6dLRIETjCF7GMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i0TqItxlElUtjLey9HZVbY/jcGPSIU6qU78oUXfSyQmhdt4HpTzFAKmYGC7oQmfYz lXG2gDUGCsBTx76ZM48t8XxbtPZNWMNoebJ+jsfzPMSNmkKgXhqdiJIwii6EZn3tZn xyWj6P7AASHQ9NFRgsmlPQT/NMwuSI500GD31VIA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikita Travkin , Stephen Boyd , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0713/1095] clk: qcom: clk-rcg2: Make sure to not write d=0 to the NMD register Date: Mon, 15 Aug 2022 20:01:52 +0200 Message-Id: <20220815180458.895291883@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nikita Travkin [ Upstream commit d0696770cef35a1fd16ea2167e2198c18aa6fbfe ] Sometimes calculation of d value may result in 0 because of the rounding after integer division. This causes the following error: [ 113.969689] camss_gp1_clk_src: rcg didn't update its configuration. [ 113.969754] WARNING: CPU: 3 PID: 35 at drivers/clk/qcom/clk-rcg2.c:122 u= pdate_config+0xc8/0xdc Make sure that D value is never zero. Fixes: 7f891faf596e ("clk: qcom: clk-rcg2: Add support for duty-cycle for R= CG") Signed-off-by: Nikita Travkin Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220612145955.385787-3-nikita@trvn.ru Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/clk-rcg2.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index 9611c9a7231f..caafc35eecfd 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -13,6 +13,7 @@ #include #include #include +#include #include =20 #include @@ -429,9 +430,11 @@ static int clk_rcg2_set_duty_cycle(struct clk_hw *hw, = struct clk_duty *duty) /* Calculate 2d value */ d =3D DIV_ROUND_CLOSEST(n * duty_per * 2, 100); =20 - /* Check bit widths of 2d. If D is too big reduce duty cycle. */ - if (d > mask) - d =3D mask; + /* + * Check bit widths of 2d. If D is too big reduce duty cycle. + * Also make sure it is never zero. + */ + d =3D clamp_val(d, 1, mask); =20 if ((d / 2) > (n - m)) d =3D (n - m) * 2; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 841F3C00140 for ; Mon, 15 Aug 2022 21:54:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349678AbiHOVy4 (ORCPT ); Mon, 15 Aug 2022 17:54:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350586AbiHOVvm (ORCPT ); Mon, 15 Aug 2022 17:51:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C53FD106FB3; Mon, 15 Aug 2022 12:33:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E14C960FB9; Mon, 15 Aug 2022 19:33:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B440C433D6; Mon, 15 Aug 2022 19:33:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591989; bh=8O+aw44hiz3gQ+R3zmwagrKbzLPzdYibj+A58m4ChMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qupxr4FQ59hXqUMVt4lNhtKeBGAVS8TtDm3MFPKVeNOrD7muqwhvjGVXe+how6/vT EPYf1N2mvc+d2bw/xCzVX16mpFZNFIuZ2Nl0mXLE4wOszALX7BnuCjl99NCSOWzu16 lNVAy3pbfw7uioespEoAaY5z1hKaZC6Y/XTaLkmA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yushan Zhou , Sasha Levin Subject: [PATCH 5.18 0714/1095] kernfs: fix potential NULL dereference in __kernfs_remove Date: Mon, 15 Aug 2022 20:01:53 +0200 Message-Id: <20220815180458.935428494@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yushan Zhou [ Upstream commit 72b5d5aef246a0387cefa23121dd90901c7a691a ] When lockdep is enabled, lockdep_assert_held_write would cause potential NULL pointer dereference. Fix the following smatch warnings: fs/kernfs/dir.c:1353 __kernfs_remove() warn: variable dereferenced before c= heck 'kn' (see line 1346) Fixes: 393c3714081a ("kernfs: switch global kernfs_rwsem lock to per-fs loc= k") Signed-off-by: Yushan Zhou Link: https://lore.kernel.org/r/20220630082512.3482581-1-zys.zljxml@gmail.c= om Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/kernfs/dir.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 6eca72cfa1f2..1cc88ba6de90 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -1343,14 +1343,17 @@ static void __kernfs_remove(struct kernfs_node *kn) { struct kernfs_node *pos; =20 + /* Short-circuit if non-root @kn has already finished removal. */ + if (!kn) + return; + lockdep_assert_held_write(&kernfs_root(kn)->kernfs_rwsem); =20 /* - * Short-circuit if non-root @kn has already finished removal. * This is for kernfs_remove_self() which plays with active ref * after removal. */ - if (!kn || (kn->parent && RB_EMPTY_NODE(&kn->rb))) + if (kn->parent && RB_EMPTY_NODE(&kn->rb)) return; =20 pr_debug("kernfs %s: removing\n", kn->name); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A21DDC19F2C for ; Mon, 15 Aug 2022 21:55:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344981AbiHOVzH (ORCPT ); Mon, 15 Aug 2022 17:55:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349970AbiHOVwJ (ORCPT ); Mon, 15 Aug 2022 17:52:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47107107F1B; Mon, 15 Aug 2022 12:33:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5D0416114B; Mon, 15 Aug 2022 19:33:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17C7EC433C1; Mon, 15 Aug 2022 19:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591995; bh=g1Bx1HzdKI7GlDoXKpbcU4VMK32z9g/6QCn0thKghpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F2smWI5GT0vrNB+BuDYCh5iWsiVHLbmdhYXJjM3tYZ+CUdJEN7eIY3+H7TwODzI8U RouW+0KC+teKeCuC26iMmULeIxQMzDBW4lD62irqmtM/a4PCEelZq1pClv4Kk7Ytaw NTcjp4W6oo9Tb/uNl3Hh6RvwL+/GW0r8uUEjQBYc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Shi , Muchun Song , "Matthew Wilcox (Oracle)" , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 0715/1095] mm: rmap: use the correct parameter name for DEFINE_PAGE_VMA_WALK Date: Mon, 15 Aug 2022 20:01:54 +0200 Message-Id: <20220815180458.976610783@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Shi [ Upstream commit 507db7927cd181d409dd495c8384b8e14c21c600 ] The parameter used by DEFINE_PAGE_VMA_WALK is _page not page, fix the parameter name. It didn't cause any build error, it is probably because the only caller is write_protect_page() from ksm.c, which pass in page. Link: https://lkml.kernel.org/r/20220512174551.81279-1-shy828301@gmail.com Fixes: 2aff7a4755be ("mm: Convert page_vma_mapped_walk to work on PFNs") Signed-off-by: Yang Shi Reviewed-by: Muchun Song Reviewed-by: Matthew Wilcox (Oracle) Cc: Muchun Song Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/rmap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 17230c458341..a0c4a870bb48 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -220,8 +220,8 @@ struct page_vma_mapped_walk { #define DEFINE_PAGE_VMA_WALK(name, _page, _vma, _address, _flags) \ struct page_vma_mapped_walk name =3D { \ .pfn =3D page_to_pfn(_page), \ - .nr_pages =3D compound_nr(page), \ - .pgoff =3D page_to_pgoff(page), \ + .nr_pages =3D compound_nr(_page), \ + .pgoff =3D page_to_pgoff(_page), \ .vma =3D _vma, \ .address =3D _address, \ .flags =3D _flags, \ --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0908DC19F2C for ; Mon, 15 Aug 2022 21:55:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245501AbiHOVz0 (ORCPT ); Mon, 15 Aug 2022 17:55:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350388AbiHOVxC (ORCPT ); Mon, 15 Aug 2022 17:53:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39C3F108952; Mon, 15 Aug 2022 12:33:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 659646113B; Mon, 15 Aug 2022 19:33:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 192DFC433C1; Mon, 15 Aug 2022 19:33:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592001; bh=iBFQLRKRvLRH5YcOysTnGpwMBiVzFv5BluBDpRVus2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UfVXkZQr+pvdnkwR4s7jcplaiAY2ohb+jfRtRfOl4TQVSJkpmVCTBu/smTWBPdFvt 30nSjyRVQi4YaWWvsv4asIoX5rq976FQHUC7YyJFJBuqR97GSRWlAFLYnQlZHkMrmW d90ZK1YE5/uAOCEP2HDW2ezlxKW1Yzog7qg9ooPM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , Huang Ying , Alistair Popple , Christoph Hellwig , Christoph Lameter , David Hildenbrand , David Howells , Mike Kravetz , Muchun Song , Oscar Salvador , Peter Xu , Andrew Morton , Sasha Levin , kernel test robot Subject: [PATCH 5.18 0716/1095] mm/migration: return errno when isolate_huge_page failed Date: Mon, 15 Aug 2022 20:01:55 +0200 Message-Id: <20220815180459.009316794@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaohe Lin [ Upstream commit 7ce82f4c3f3ead13a9d9498768e3b1a79975c4d8 ] We might fail to isolate huge page due to e.g. the page is under migration which cleared HPageMigratable. We should return errno in this case rather than always return 1 which could confuse the user, i.e. the caller might think all of the memory is migrated while the hugetlb page is left behind. We make the prototype of isolate_huge_page consistent with isolate_lru_page as suggested by Huang Ying and rename isolate_huge_page to isolate_hugetlb as suggested by Muchun to improve the readability. Link: https://lkml.kernel.org/r/20220530113016.16663-4-linmiaohe@huawei.com Fixes: e8db67eb0ded ("mm: migrate: move_pages() supports thp migration") Signed-off-by: Miaohe Lin Suggested-by: Huang Ying Reported-by: kernel test robot (build error) Cc: Alistair Popple Cc: Christoph Hellwig Cc: Christoph Lameter Cc: David Hildenbrand Cc: David Howells Cc: Mike Kravetz Cc: Muchun Song Cc: Oscar Salvador Cc: Peter Xu Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/hugetlb.h | 6 +++--- mm/gup.c | 2 +- mm/hugetlb.c | 11 +++++------ mm/memory-failure.c | 2 +- mm/memory_hotplug.c | 2 +- mm/mempolicy.c | 2 +- mm/migrate.c | 7 ++++--- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index ac2a1d758a80..fbf4a6509fb3 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -167,7 +167,7 @@ bool hugetlb_reserve_pages(struct inode *inode, long fr= om, long to, vm_flags_t vm_flags); long hugetlb_unreserve_pages(struct inode *inode, long start, long end, long freed); -bool isolate_huge_page(struct page *page, struct list_head *list); +int isolate_hugetlb(struct page *page, struct list_head *list); int get_hwpoison_huge_page(struct page *page, bool *hugetlb); int get_huge_page_for_hwpoison(unsigned long pfn, int flags); void putback_active_hugepage(struct page *page); @@ -369,9 +369,9 @@ static inline pte_t *huge_pte_offset(struct mm_struct *= mm, unsigned long addr, return NULL; } =20 -static inline bool isolate_huge_page(struct page *page, struct list_head *= list) +static inline int isolate_hugetlb(struct page *page, struct list_head *lis= t) { - return false; + return -EBUSY; } =20 static inline int get_hwpoison_huge_page(struct page *page, bool *hugetlb) diff --git a/mm/gup.c b/mm/gup.c index c5d076d43d9b..414f0c4b4caa 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1795,7 +1795,7 @@ static long check_and_migrate_movable_pages(unsigned = long nr_pages, * Try to move out any movable page before pinning the range. */ if (folio_test_hugetlb(folio)) { - if (!isolate_huge_page(&folio->page, + if (isolate_hugetlb(&folio->page, &movable_page_list)) isolation_error_count++; continue; diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 859cfcaecddb..0090d7f98dee 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2758,8 +2758,7 @@ static int alloc_and_dissolve_huge_page(struct hstate= *h, struct page *old_page, * Fail with -EBUSY if not possible. */ spin_unlock_irq(&hugetlb_lock); - if (!isolate_huge_page(old_page, list)) - ret =3D -EBUSY; + ret =3D isolate_hugetlb(old_page, list); spin_lock_irq(&hugetlb_lock); goto free_new; } else if (!HPageFreed(old_page)) { @@ -2835,7 +2834,7 @@ int isolate_or_dissolve_huge_page(struct page *page, = struct list_head *list) if (hstate_is_gigantic(h)) return -ENOMEM; =20 - if (page_count(head) && isolate_huge_page(head, list)) + if (page_count(head) && !isolate_hugetlb(head, list)) ret =3D 0; else if (!page_count(head)) ret =3D alloc_and_dissolve_huge_page(h, head, list); @@ -6758,15 +6757,15 @@ follow_huge_pgd(struct mm_struct *mm, unsigned long= address, pgd_t *pgd, int fla return pte_page(*(pte_t *)pgd) + ((address & ~PGDIR_MASK) >> PAGE_SHIFT); } =20 -bool isolate_huge_page(struct page *page, struct list_head *list) +int isolate_hugetlb(struct page *page, struct list_head *list) { - bool ret =3D true; + int ret =3D 0; =20 spin_lock_irq(&hugetlb_lock); if (!PageHeadHuge(page) || !HPageMigratable(page) || !get_page_unless_zero(page)) { - ret =3D false; + ret =3D -EBUSY; goto unlock; } ClearHPageMigratable(page); diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 94dac77f5eba..fb8c9b0b53ab 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2211,7 +2211,7 @@ static bool isolate_page(struct page *page, struct li= st_head *pagelist) bool lru =3D PageLRU(page); =20 if (PageHuge(page)) { - isolated =3D isolate_huge_page(page, pagelist); + isolated =3D !isolate_hugetlb(page, pagelist); } else { if (lru) isolated =3D !isolate_lru_page(page); diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 416b38ca8def..3a60c1444bc7 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1627,7 +1627,7 @@ do_migrate_range(unsigned long start_pfn, unsigned lo= ng end_pfn) =20 if (PageHuge(page)) { pfn =3D page_to_pfn(head) + compound_nr(head) - 1; - isolate_huge_page(head, &source); + isolate_hugetlb(head, &source); continue; } else if (PageTransHuge(page)) pfn =3D page_to_pfn(head) + thp_nr_pages(page) - 1; diff --git a/mm/mempolicy.c b/mm/mempolicy.c index ea6dee61bc9d..b27e8d71cda3 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -607,7 +607,7 @@ static int queue_pages_hugetlb(pte_t *pte, unsigned lon= g hmask, /* With MPOL_MF_MOVE, we migrate only unshared hugepage. */ if (flags & (MPOL_MF_MOVE_ALL) || (flags & MPOL_MF_MOVE && page_mapcount(page) =3D=3D 1)) { - if (!isolate_huge_page(page, qp->pagelist) && + if (isolate_hugetlb(page, qp->pagelist) && (flags & MPOL_MF_STRICT)) /* * Failed to isolate page but allow migrating pages diff --git a/mm/migrate.c b/mm/migrate.c index 6c31ee1e1c9b..796502d0eeb9 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -133,7 +133,7 @@ static void putback_movable_page(struct page *page) * * This function shall be used whenever the isolated pageset has been * built from lru, balloon, hugetlbfs page. See isolate_migratepages_range= () - * and isolate_huge_page(). + * and isolate_hugetlb(). */ void putback_movable_pages(struct list_head *l) { @@ -1631,8 +1631,9 @@ static int add_page_for_migration(struct mm_struct *m= m, unsigned long addr, =20 if (PageHuge(page)) { if (PageHead(page)) { - isolate_huge_page(page, pagelist); - err =3D 1; + err =3D isolate_hugetlb(page, pagelist); + if (!err) + err =3D 1; } } else { struct page *head; --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13A95C00140 for ; Mon, 15 Aug 2022 21:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245195AbiHOVzi (ORCPT ); Mon, 15 Aug 2022 17:55:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347320AbiHOVxi (ORCPT ); Mon, 15 Aug 2022 17:53:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB1D5108943; Mon, 15 Aug 2022 12:33:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CF07061187; Mon, 15 Aug 2022 19:33:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8D58C433C1; Mon, 15 Aug 2022 19:33:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592008; bh=+DOIPjxFBZsLKTl55bLl3qi9FtpzQIsy81DOa3gFw8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0hu6w8vwxmyVklc0zdkUb/PEQ3AbC3INK5A/kMpoBvPKZ23CHf6wfOEIUGT/nu7Ir 7kE6rrFuiL4BPXv9g8bPQtdAgLxM6HfzTNHZFQOXdP540j6bC1OjnEL/QeVeb18Rc2 t7Ywb9fA0GI2Nzh1szhQmNRrC/q3q/LvaacscGaY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , David Hildenbrand , Alistair Popple , Christoph Hellwig , Christoph Lameter , David Howells , Huang Ying , kernel test robot , Mike Kravetz , Muchun Song , Oscar Salvador , Peter Xu , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 0717/1095] mm/migration: fix potential pte_unmap on an not mapped pte Date: Mon, 15 Aug 2022 20:01:56 +0200 Message-Id: <20220815180459.050073088@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaohe Lin [ Upstream commit ad1ac596e8a8c4b06715dfbd89853eb73c9886b2 ] __migration_entry_wait and migration_entry_wait_on_locked assume pte is always mapped from caller. But this is not the case when it's called from migration_entry_wait_huge and follow_huge_pmd. Add a hugetlbfs variant that calls hugetlb_migration_entry_wait(ptep =3D=3D NULL) to fix this issue. Link: https://lkml.kernel.org/r/20220530113016.16663-5-linmiaohe@huawei.com Fixes: 30dad30922cc ("mm: migration: add migrate_entry_wait_huge()") Signed-off-by: Miaohe Lin Suggested-by: David Hildenbrand Reviewed-by: David Hildenbrand Cc: Alistair Popple Cc: Christoph Hellwig Cc: Christoph Lameter Cc: David Howells Cc: Huang Ying Cc: kernel test robot Cc: Mike Kravetz Cc: Muchun Song Cc: Oscar Salvador Cc: Peter Xu Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/swapops.h | 12 ++++++++---- mm/hugetlb.c | 4 ++-- mm/migrate.c | 23 +++++++++++++++++++---- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/include/linux/swapops.h b/include/linux/swapops.h index d356ab4047f7..f99f0bd85724 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h @@ -216,8 +216,10 @@ extern void __migration_entry_wait(struct mm_struct *m= m, pte_t *ptep, spinlock_t *ptl); extern void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, unsigned long address); -extern void migration_entry_wait_huge(struct vm_area_struct *vma, - struct mm_struct *mm, pte_t *pte); +#ifdef CONFIG_HUGETLB_PAGE +extern void __migration_entry_wait_huge(pte_t *ptep, spinlock_t *ptl); +extern void migration_entry_wait_huge(struct vm_area_struct *vma, pte_t *p= te); +#endif #else static inline swp_entry_t make_readable_migration_entry(pgoff_t offset) { @@ -238,8 +240,10 @@ static inline void __migration_entry_wait(struct mm_st= ruct *mm, pte_t *ptep, spinlock_t *ptl) { } static inline void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, unsigned long address) { } -static inline void migration_entry_wait_huge(struct vm_area_struct *vma, - struct mm_struct *mm, pte_t *pte) { } +#ifdef CONFIG_HUGETLB_PAGE +static inline void __migration_entry_wait_huge(pte_t *ptep, spinlock_t *pt= l) { } +static inline void migration_entry_wait_huge(struct vm_area_struct *vma, p= te_t *pte) { } +#endif static inline int is_writable_migration_entry(swp_entry_t entry) { return 0; diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 0090d7f98dee..19063dbed332 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5602,7 +5602,7 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct= vm_area_struct *vma, */ entry =3D huge_ptep_get(ptep); if (unlikely(is_hugetlb_entry_migration(entry))) { - migration_entry_wait_huge(vma, mm, ptep); + migration_entry_wait_huge(vma, ptep); return 0; } else if (unlikely(is_hugetlb_entry_hwpoisoned(entry))) return VM_FAULT_HWPOISON_LARGE | @@ -6725,7 +6725,7 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long a= ddress, } else { if (is_hugetlb_entry_migration(pte)) { spin_unlock(ptl); - __migration_entry_wait(mm, (pte_t *)pmd, ptl); + __migration_entry_wait_huge((pte_t *)pmd, ptl); goto retry; } /* diff --git a/mm/migrate.c b/mm/migrate.c index 796502d0eeb9..5aba3fb612d4 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -309,13 +309,28 @@ void migration_entry_wait(struct mm_struct *mm, pmd_t= *pmd, __migration_entry_wait(mm, ptep, ptl); } =20 -void migration_entry_wait_huge(struct vm_area_struct *vma, - struct mm_struct *mm, pte_t *pte) +#ifdef CONFIG_HUGETLB_PAGE +void __migration_entry_wait_huge(pte_t *ptep, spinlock_t *ptl) { - spinlock_t *ptl =3D huge_pte_lockptr(hstate_vma(vma), mm, pte); - __migration_entry_wait(mm, pte, ptl); + pte_t pte; + + spin_lock(ptl); + pte =3D huge_ptep_get(ptep); + + if (unlikely(!is_hugetlb_entry_migration(pte))) + spin_unlock(ptl); + else + migration_entry_wait_on_locked(pte_to_swp_entry(pte), NULL, ptl); } =20 +void migration_entry_wait_huge(struct vm_area_struct *vma, pte_t *pte) +{ + spinlock_t *ptl =3D huge_pte_lockptr(hstate_vma(vma), vma->vm_mm, pte); + + __migration_entry_wait_huge(pte, ptl); +} +#endif + #ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION void pmd_migration_entry_wait(struct mm_struct *mm, pmd_t *pmd) { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22B7AC3F6B0 for ; Mon, 15 Aug 2022 21:57:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245273AbiHOV5E (ORCPT ); Mon, 15 Aug 2022 17:57:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346968AbiHOVyy (ORCPT ); Mon, 15 Aug 2022 17:54:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55653108FB5; Mon, 15 Aug 2022 12:33:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 318E16114B; Mon, 15 Aug 2022 19:33:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3715BC433C1; Mon, 15 Aug 2022 19:33:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592014; bh=jahaXvlamd6CWdDN+U8JYYu8gmqVURZdg6CocvUtzAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b//HfzCSyUmR1wZQA/j001g6X+/pwIk3oCTcgUSibpkTcNk7ymNhr1JB32EvC32sp mpJBmbegNxbjhYhU0e9SEsIohPp6wrQwcGYmaxqzyUxgbBwaRTS1RD1+9i/4Azl9Bd lSH2bO6r+JqdnPZm33J7cGN7W+DEnwAMB9UkIEcM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 0718/1095] kasan: fix zeroing vmalloc memory with HW_TAGS Date: Mon, 15 Aug 2022 20:01:57 +0200 Message-Id: <20220815180459.099775057@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrey Konovalov [ Upstream commit 6c2f761dad7851d8088b91063ccaea3c970efe78 ] HW_TAGS KASAN skips zeroing page_alloc allocations backing vmalloc mappings via __GFP_SKIP_ZERO. Instead, these pages are zeroed via kasan_unpoison_vmalloc() by passing the KASAN_VMALLOC_INIT flag. The problem is that __kasan_unpoison_vmalloc() does not zero pages when either kasan_vmalloc_enabled() or is_vmalloc_or_module_addr() fail. Thus: 1. Change __vmalloc_node_range() to only set KASAN_VMALLOC_INIT when __GFP_SKIP_ZERO is set. 2. Change __kasan_unpoison_vmalloc() to always zero pages when the KASAN_VMALLOC_INIT flag is set. 3. Add WARN_ON() asserts to check that KASAN_VMALLOC_INIT cannot be set in other early return paths of __kasan_unpoison_vmalloc(). Also clean up the comment in __kasan_unpoison_vmalloc. Link: https://lkml.kernel.org/r/4bc503537efdc539ffc3f461c1b70162eea31cf6.16= 54798516.git.andreyknvl@google.com Fixes: 23689e91fb22 ("kasan, vmalloc: add vmalloc tagging for HW_TAGS") Signed-off-by: Andrey Konovalov Cc: Marco Elver Cc: Alexander Potapenko Cc: Dmitry Vyukov Cc: Andrey Ryabinin Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- mm/kasan/hw_tags.c | 32 +++++++++++++++++++++++--------- mm/vmalloc.c | 10 +++++----- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/mm/kasan/hw_tags.c b/mm/kasan/hw_tags.c index 9e1b6544bfa8..9ad8eff71b28 100644 --- a/mm/kasan/hw_tags.c +++ b/mm/kasan/hw_tags.c @@ -257,27 +257,37 @@ static void unpoison_vmalloc_pages(const void *addr, = u8 tag) } } =20 +static void init_vmalloc_pages(const void *start, unsigned long size) +{ + const void *addr; + + for (addr =3D start; addr < start + size; addr +=3D PAGE_SIZE) { + struct page *page =3D virt_to_page(addr); + + clear_highpage_kasan_tagged(page); + } +} + void *__kasan_unpoison_vmalloc(const void *start, unsigned long size, kasan_vmalloc_flags_t flags) { u8 tag; unsigned long redzone_start, redzone_size; =20 - if (!kasan_vmalloc_enabled()) - return (void *)start; - - if (!is_vmalloc_or_module_addr(start)) + if (!kasan_vmalloc_enabled() || !is_vmalloc_or_module_addr(start)) { + if (flags & KASAN_VMALLOC_INIT) + init_vmalloc_pages(start, size); return (void *)start; + } =20 /* - * Skip unpoisoning and assigning a pointer tag for non-VM_ALLOC - * mappings as: + * Don't tag non-VM_ALLOC mappings, as: * * 1. Unlike the software KASAN modes, hardware tag-based KASAN only * supports tagging physical memory. Therefore, it can only tag a * single mapping of normal physical pages. * 2. Hardware tag-based KASAN can only tag memory mapped with special - * mapping protection bits, see arch_vmalloc_pgprot_modify(). + * mapping protection bits, see arch_vmap_pgprot_tagged(). * As non-VM_ALLOC mappings can be mapped outside of vmalloc code, * providing these bits would require tracking all non-VM_ALLOC * mappers. @@ -289,15 +299,19 @@ void *__kasan_unpoison_vmalloc(const void *start, uns= igned long size, * * For non-VM_ALLOC allocations, page_alloc memory is tagged as usual. */ - if (!(flags & KASAN_VMALLOC_VM_ALLOC)) + if (!(flags & KASAN_VMALLOC_VM_ALLOC)) { + WARN_ON(flags & KASAN_VMALLOC_INIT); return (void *)start; + } =20 /* * Don't tag executable memory. * The kernel doesn't tolerate having the PC register tagged. */ - if (!(flags & KASAN_VMALLOC_PROT_NORMAL)) + if (!(flags & KASAN_VMALLOC_PROT_NORMAL)) { + WARN_ON(flags & KASAN_VMALLOC_INIT); return (void *)start; + } =20 tag =3D kasan_random_tag(); start =3D set_tag(start, tag); diff --git a/mm/vmalloc.c b/mm/vmalloc.c index cadfbb5155ea..06c555fc5be0 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -3170,15 +3170,15 @@ void *__vmalloc_node_range(unsigned long size, unsi= gned long align, =20 /* * Mark the pages as accessible, now that they are mapped. - * The init condition should match the one in post_alloc_hook() - * (except for the should_skip_init() check) to make sure that memory - * is initialized under the same conditions regardless of the enabled - * KASAN mode. + * The condition for setting KASAN_VMALLOC_INIT should complement the + * one in post_alloc_hook() with regards to the __GFP_SKIP_ZERO check + * to make sure that memory is initialized under the same conditions. * Tag-based KASAN modes only assign tags to normal non-executable * allocations, see __kasan_unpoison_vmalloc(). */ kasan_flags |=3D KASAN_VMALLOC_VM_ALLOC; - if (!want_init_on_free() && want_init_on_alloc(gfp_mask)) + if (!want_init_on_free() && want_init_on_alloc(gfp_mask) && + (gfp_mask & __GFP_SKIP_ZERO)) kasan_flags |=3D KASAN_VMALLOC_INIT; /* KASAN_VMALLOC_PROT_NORMAL already set if required. */ area->addr =3D kasan_unpoison_vmalloc(area->addr, real_size, kasan_flags); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0429BC00140 for ; Mon, 15 Aug 2022 21:57:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344304AbiHOV5Y (ORCPT ); Mon, 15 Aug 2022 17:57:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343873AbiHOVzb (ORCPT ); Mon, 15 Aug 2022 17:55:31 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03B9A109A36; Mon, 15 Aug 2022 12:33:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id B9EE4CE12DC; Mon, 15 Aug 2022 19:33:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 946E3C433C1; Mon, 15 Aug 2022 19:33:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592024; bh=fihsa39L0YZmsw9lbsImnQhoGQm4IP/0rXY4b4egfqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0QhmSmrWMnjW53wXexmtvW0eGPyCL/r1ILiiylHcYQcjOmqbIboNN/wUSthURK6iK 9D8zIP1ocpHJ1Zznetk4YxTKvpCyKqZswh9x3J0Iq6p4n77Mha5g2DFlEdkt83ptLL KarJaB2A08j++flsL2GM5Uly6m+a1BdW0RZfpqvA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tianyu Li , Arnd Bergmann , Mark Rutland , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 0719/1095] mm/mempolicy: fix get_nodes out of bound access Date: Mon, 15 Aug 2022 20:01:58 +0200 Message-Id: <20220815180459.142421114@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tianyu Li [ Upstream commit 000eca5d044d1ee23b4ca311793cf3fc528da6c6 ] When user specified more nodes than supported, get_nodes will access nmask array out of bounds. Link: https://lkml.kernel.org/r/20220601093211.2970565-1-tianyu.li@arm.com Fixes: e130242dc351 ("mm: simplify compat numa syscalls") Signed-off-by: Tianyu Li Cc: Arnd Bergmann Cc: Mark Rutland Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- mm/mempolicy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index b27e8d71cda3..c1ccc89845f4 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1387,7 +1387,7 @@ static int get_nodes(nodemask_t *nodes, const unsigne= d long __user *nmask, unsigned long bits =3D min_t(unsigned long, maxnode, BITS_PER_LONG); unsigned long t; =20 - if (get_bitmap(&t, &nmask[maxnode / BITS_PER_LONG], bits)) + if (get_bitmap(&t, &nmask[(maxnode - 1) / BITS_PER_LONG], bits)) return -EFAULT; =20 if (maxnode - bits >=3D MAX_NUMNODES) { --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C102C00140 for ; Mon, 15 Aug 2022 21:57:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346671AbiHOV52 (ORCPT ); Mon, 15 Aug 2022 17:57:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349867AbiHOVzp (ORCPT ); Mon, 15 Aug 2022 17:55:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D471A7C307; Mon, 15 Aug 2022 12:33:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D74D961178; Mon, 15 Aug 2022 19:33:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C518BC4314A; Mon, 15 Aug 2022 19:33:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592030; bh=Gi5fhKEQRLorlItAaeCoWCufFbIzNt8b6vIbaqCylvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DiA7tadZ8M0eAByb4QdEnCbPGp5TzE6bamvZXXJTlD1lQJ9JzBsgAZxRigo8zp4bV BCpm4FYVbQ0iJi9nu+Dk82hK/fAC6nFQH2oKiwrzXRDVs/fuFgXHe8PHM01kVIGhHg RBUOTPkWj+p7gA/q1Q5GZFKweK8vrCGWt6YaI91M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Hans de Goede , Ferry Toth , Vinod Koul , Sasha Levin Subject: [PATCH 5.18 0720/1095] phy: ti: tusb1210: Dont check for write errors when powering on Date: Mon, 15 Aug 2022 20:01:59 +0200 Message-Id: <20220815180459.185252388@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andy Shevchenko [ Upstream commit d4a0a189b72a7c98e4256292b18b67c69fbc9343 ] On some platforms, like Intel Merrifield, the writing values during power on may timeout: tusb1210 dwc3.0.auto.ulpi: error -110 writing val 0x41 to reg 0x80 phy phy-dwc3.0.auto.ulpi.0: phy poweron failed --> -110 dwc3 dwc3.0.auto: error -ETIMEDOUT: failed to initialize core dwc3: probe of dwc3.0.auto failed with error -110 which effectively fails the probe of the USB controller. Drop the check as it was before the culprit commit (see Fixes tag). Fixes: 09a3512681b3 ("phy: ti: tusb1210: Improve ulpi_read()/_write() error= checking") Signed-off-by: Andy Shevchenko Acked-by: Hans de Goede Tested-by: Ferry Toth Link: https://lore.kernel.org/r/20220613160848.82746-1-andriy.shevchenko@li= nux.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/phy/ti/phy-tusb1210.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/phy/ti/phy-tusb1210.c b/drivers/phy/ti/phy-tusb1210.c index c3ab4b69ea68..669c13d6e402 100644 --- a/drivers/phy/ti/phy-tusb1210.c +++ b/drivers/phy/ti/phy-tusb1210.c @@ -105,8 +105,9 @@ static int tusb1210_power_on(struct phy *phy) msleep(TUSB1210_RESET_TIME_MS); =20 /* Restore the optional eye diagram optimization value */ - return tusb1210_ulpi_write(tusb, TUSB1210_VENDOR_SPECIFIC2, - tusb->vendor_specific2); + tusb1210_ulpi_write(tusb, TUSB1210_VENDOR_SPECIFIC2, tusb->vendor_specifi= c2); + + return 0; } =20 static int tusb1210_power_off(struct phy *phy) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D68BC00140 for ; Mon, 15 Aug 2022 21:57:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347329AbiHOV5r (ORCPT ); Mon, 15 Aug 2022 17:57:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350115AbiHOVzw (ORCPT ); Mon, 15 Aug 2022 17:55:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0227C2A715; Mon, 15 Aug 2022 12:33:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3C534610A5; Mon, 15 Aug 2022 19:33:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 266B3C433C1; Mon, 15 Aug 2022 19:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592036; bh=0wrrhUS/yrhbpDRp/29eoecL0CIsdPgCiNB8JkyesjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s8oVru1Q7pLhWWVpSXLODTOpYk7oWp8f+0ai7CrrE45N60z/GAYqPPCezMFBvRuee 6EP0B8k7dKY7trV1piF/f9z0AgVSsjvwYLcpn01fn+fkVLNV5CHTCWAI3A54Vdyzww Y6CqpH1/SPLPwB9KkRnKe7U2whHV+ZQCYE7Sdky4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Serge Semin , Bjorn Helgaas , Rob Herring , Sasha Levin Subject: [PATCH 5.18 0721/1095] PCI: dwc: Stop link on host_init errors and de-initialization Date: Mon, 15 Aug 2022 20:02:00 +0200 Message-Id: <20220815180459.224705275@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit 113fa857b74c947137d845e7e635afcf6a59c43a ] It's logically correct to undo everything that was done when an error is discovered or in the corresponding cleanup counterpart. Otherwise the host controller will be left in an undetermined state. Since the link is set up in the host_init method, deactivate it there in the cleanup-on-error block and stop the link in the antagonistic routine - dw_pcie_host_deinit(). Link deactivation is platform-specific and should be implemented in dw_pcie_ops.stop_link(). Fixes: 886a9c134755 ("PCI: dwc: Move link handling into common code") Link: https://lore.kernel.org/r/20220624143428.8334-2-Sergey.Semin@baikalel= ectronics.ru Tested-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Bjorn Helgaas Reviewed-by: Manivannan Sadhasivam Reviewed-by: Rob Herring Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../pci/controller/dwc/pcie-designware-host.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pc= i/controller/dwc/pcie-designware-host.c index 9979302532b7..bc9a7df130ef 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -421,8 +421,14 @@ int dw_pcie_host_init(struct pcie_port *pp) bridge->sysdata =3D pp; =20 ret =3D pci_host_probe(bridge); - if (!ret) - return 0; + if (ret) + goto err_stop_link; + + return 0; + +err_stop_link: + if (pci->ops && pci->ops->stop_link) + pci->ops->stop_link(pci); =20 err_free_msi: if (pp->has_msi_ctrl) @@ -433,8 +439,14 @@ EXPORT_SYMBOL_GPL(dw_pcie_host_init); =20 void dw_pcie_host_deinit(struct pcie_port *pp) { + struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); + pci_stop_root_bus(pp->bridge->bus); pci_remove_root_bus(pp->bridge->bus); + + if (pci->ops && pci->ops->stop_link) + pci->ops->stop_link(pci); + if (pp->has_msi_ctrl) dw_pcie_free_msi(pp); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBB39C25B08 for ; Mon, 15 Aug 2022 21:58:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347597AbiHOV6B (ORCPT ); Mon, 15 Aug 2022 17:58:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350466AbiHOV4T (ORCPT ); Mon, 15 Aug 2022 17:56:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C12CC10A774; Mon, 15 Aug 2022 12:34:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8D60561184; Mon, 15 Aug 2022 19:34:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B213C433D6; Mon, 15 Aug 2022 19:34:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592043; bh=ecmKP+DYRKqfBr6/umZkZvg2tAeCCDhHa8GE40xc3nA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XNUgoq+ctHR0uBsIKxvuM+wPtvRx4gjPEWvkR4LjEESeSTrW1pFJ/70h2P5su5hu+ mThEorXNFS+e07xN6vvLn7XZ+xMEDR8M1uJvPF7pj32iFmyUFymvwkdxLBzL1vrzit wFRDJzhRZvuHnzYX8JGXfYKBviHE6T5g6Xb02aT0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Serge Semin , Bjorn Helgaas , Rob Herring , Sasha Levin Subject: [PATCH 5.18 0722/1095] PCI: dwc: Add unroll iATU space support to dw_pcie_disable_atu() Date: Mon, 15 Aug 2022 20:02:01 +0200 Message-Id: <20220815180459.262093671@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit d1cf738f2b65a5640234e1da90a68d3523fbed83 ] dw_pcie_disable_atu() was introduced by f8aed6ec624f ("PCI: dwc: designware: Add EP mode support") and supported only the viewport version of the iATU CSRs. DW PCIe IP cores v4.80a and newer also support unrolled iATU/eDMA space. Callers of dw_pcie_disable_atu(), including pci_epc_ops.clear_bar(), pci_epc_ops.unmap_addr(), and dw_pcie_setup_rc(), don't work correctly when it is enabled. Add dw_pcie_disable_atu() support for controllers with unrolled iATU CSRs enabled. [bhelgaas: commit log] Fixes: f8aed6ec624f ("PCI: dwc: designware: Add EP mode support") Link: https://lore.kernel.org/r/20220624143428.8334-3-Sergey.Semin@baikalel= ectronics.ru Tested-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Bjorn Helgaas Reviewed-by: Manivannan Sadhasivam Reviewed-by: Rob Herring Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-designware.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/con= troller/dwc/pcie-designware.c index d92c8a25094f..84fef21efdbc 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -491,7 +491,7 @@ int dw_pcie_prog_inbound_atu(struct dw_pcie *pci, u8 fu= nc_no, int index, void dw_pcie_disable_atu(struct dw_pcie *pci, int index, enum dw_pcie_region_type type) { - int region; + u32 region; =20 switch (type) { case DW_PCIE_REGION_INBOUND: @@ -504,8 +504,18 @@ void dw_pcie_disable_atu(struct dw_pcie *pci, int inde= x, return; } =20 - dw_pcie_writel_dbi(pci, PCIE_ATU_VIEWPORT, region | index); - dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, ~(u32)PCIE_ATU_ENABLE); + if (pci->iatu_unroll_enabled) { + if (region =3D=3D PCIE_ATU_REGION_INBOUND) { + dw_pcie_writel_ib_unroll(pci, index, PCIE_ATU_UNR_REGION_CTRL2, + ~(u32)PCIE_ATU_ENABLE); + } else { + dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_REGION_CTRL2, + ~(u32)PCIE_ATU_ENABLE); + } + } else { + dw_pcie_writel_dbi(pci, PCIE_ATU_VIEWPORT, region | index); + dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, ~(u32)PCIE_ATU_ENABLE); + } } =20 int dw_pcie_wait_for_link(struct dw_pcie *pci) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7B0EC19F2C for ; Mon, 15 Aug 2022 21:58:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343990AbiHOV6P (ORCPT ); Mon, 15 Aug 2022 17:58:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350591AbiHOV4f (ORCPT ); Mon, 15 Aug 2022 17:56:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 710DB10AE2D; Mon, 15 Aug 2022 12:34:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CA3DC610A5; Mon, 15 Aug 2022 19:34:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BABF2C433D7; Mon, 15 Aug 2022 19:34:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592049; bh=viaFuZBfoGpqRxPtLy9x71upvo+m2Mrt9nmJ52GbDR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aF+xciMtkB9N47iR5q+jbChHIRh2donOFpEMpQ+2Ppw6LA3eP9FHmZ9bEz+GmfP5m IP/d22bXYOQC7SQxB6LPd4l5JNQWUha5rGL9hMkGEXQspZN1ZBtE76SSf2kX5+zqQE ikQllyHNoXzC9SOKYyzAdFsdSax1e1m2CN/OiUIg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Serge Semin , Bjorn Helgaas , Rob Herring , Sasha Levin Subject: [PATCH 5.18 0723/1095] PCI: dwc: Disable outbound windows only for controllers using iATU Date: Mon, 15 Aug 2022 20:02:02 +0200 Message-Id: <20220815180459.300158610@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit d60a2e281e9de2b2f67343b2e39417ca0f4fd54e ] Some DWC-based controllers (e.g., pcie-al.c and pci-keystone.c, identified by the fact that they override the default dw_child_pcie_ops) use their own address translation approach instead of the DWC internal ATU (iATU). For those controllers, skip disabling the iATU outbound windows. [bhelgaas: commit log, update multiple window comment] Fixes: 458ad06c4cdd ("PCI: dwc: Ensure all outbound ATU windows are reset") Link: https://lore.kernel.org/r/20220624143428.8334-4-Sergey.Semin@baikalel= ectronics.ru Tested-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Bjorn Helgaas Reviewed-by: Manivannan Sadhasivam Reviewed-by: Rob Herring Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-designware-host.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pc= i/controller/dwc/pcie-designware-host.c index bc9a7df130ef..d0d768f22ac3 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -543,7 +543,6 @@ static struct pci_ops dw_pcie_ops =3D { =20 void dw_pcie_setup_rc(struct pcie_port *pp) { - int i; u32 val, ctrl, num_ctrls; struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); =20 @@ -594,19 +593,22 @@ void dw_pcie_setup_rc(struct pcie_port *pp) PCI_COMMAND_MASTER | PCI_COMMAND_SERR; dw_pcie_writel_dbi(pci, PCI_COMMAND, val); =20 - /* Ensure all outbound windows are disabled so there are multiple matches= */ - for (i =3D 0; i < pci->num_ob_windows; i++) - dw_pcie_disable_atu(pci, i, DW_PCIE_REGION_OUTBOUND); - /* * If the platform provides its own child bus config accesses, it means * the platform uses its own address translation component rather than * ATU, so we should not program the ATU here. */ if (pp->bridge->child_ops =3D=3D &dw_child_pcie_ops) { - int atu_idx =3D 0; + int i, atu_idx =3D 0; struct resource_entry *entry; =20 + /* + * Disable all outbound windows to make sure a transaction + * can't match multiple windows. + */ + for (i =3D 0; i < pci->num_ob_windows; i++) + dw_pcie_disable_atu(pci, i, DW_PCIE_REGION_OUTBOUND); + /* Get last memory resource entry */ resource_list_for_each_entry(entry, &pp->bridge->windows) { if (resource_type(entry->res) !=3D IORESOURCE_MEM) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5967FC00140 for ; Mon, 15 Aug 2022 21:58:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245643AbiHOV6g (ORCPT ); Mon, 15 Aug 2022 17:58:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244035AbiHOV5B (ORCPT ); Mon, 15 Aug 2022 17:57:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 649FBE3987; Mon, 15 Aug 2022 12:34:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1FCA8B81136; Mon, 15 Aug 2022 19:34:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B16BC433C1; Mon, 15 Aug 2022 19:34:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592058; bh=5pNFoN4WOMyki5qA2Bm4cNzOEWj8zNu3HxHNC6RFfe8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ULTxBydRMp4BczPcyTNDYBxeiK/ShgvvlrQyrV2t0mcpvwomrGPbpHK41cMey4qvt ScYk9cEoawfu4mIcSvkyDqINw52SRibRYZvCNA/iY8MIXnpKD3B/PwOnLuWCc1H7bI YzDI6WXkf8xnHNRnZ2MRDYKSx8Wjuf5yKV0zCwxM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Serge Semin , Bjorn Helgaas , Rob Herring , Sasha Levin Subject: [PATCH 5.18 0724/1095] PCI: dwc: Set INCREASE_REGION_SIZE flag based on limit address Date: Mon, 15 Aug 2022 20:02:03 +0200 Message-Id: <20220815180459.333412125@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit 777e7c3ab73036105e6fc4a67ed950179dbffbab ] We program the 64-bit ATU limit address (in PCIE_ATU_LIMIT/ PCIE_ATU_UPPER_LIMIT or PCIE_ATU_UNR_LOWER_LIMIT/PCIE_ATU_UNR_UPPER_LIMIT), but in addition, the PCIE_ATU_INCREASE_REGION_SIZE bit must be set if the upper 32 bits of the limit address differ from the upper 32 bits of the base address (see [1,2]). 5b4cf0f65324 ("PCI: dwc: Add upper limit address for outbound iATU") set PCIE_ATU_INCREASE_REGION_SIZE, but only when the *size* was greater than 4GB. It did not set it when a smaller region crossed a 4GB boundary, e.g., [mem 0x0_f0000000-0x1_0fffffff]. Set PCIE_ATU_INCREASE_REGION_SIZE whenever PCIE_ATU_UPPER_LIMIT is greater than PCIE_ATU_UPPER_BASE. [1] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port, v5.40a, March 2019, fig.3-36, p.175 [2] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port, v5.40a, March 2019, fig.3-37, p.176 [bhelgaas: commit log] Fixes: 5b4cf0f65324 ("PCI: dwc: Add upper limit address for outbound iATU") Link: https://lore.kernel.org/r/20220624143428.8334-5-Sergey.Semin@baikalel= ectronics.ru Tested-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Bjorn Helgaas Reviewed-by: Manivannan Sadhasivam Reviewed-by: Rob Herring Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-designware.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/con= troller/dwc/pcie-designware.c index 84fef21efdbc..347251bf87d0 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -287,8 +287,8 @@ static void dw_pcie_prog_outbound_atu_unroll(struct dw_= pcie *pci, u8 func_no, dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_UPPER_TARGET, upper_32_bits(pci_addr)); val =3D type | PCIE_ATU_FUNC_NUM(func_no); - val =3D upper_32_bits(size - 1) ? - val | PCIE_ATU_INCREASE_REGION_SIZE : val; + if (upper_32_bits(limit_addr) > upper_32_bits(cpu_addr)) + val |=3D PCIE_ATU_INCREASE_REGION_SIZE; if (pci->version =3D=3D 0x490A) val =3D dw_pcie_enable_ecrc(val); dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_REGION_CTRL1, val); @@ -315,6 +315,7 @@ static void __dw_pcie_prog_outbound_atu(struct dw_pcie = *pci, u8 func_no, u64 pci_addr, u64 size) { u32 retries, val; + u64 limit_addr; =20 if (pci->ops && pci->ops->cpu_addr_fixup) cpu_addr =3D pci->ops->cpu_addr_fixup(pci, cpu_addr); @@ -325,6 +326,8 @@ static void __dw_pcie_prog_outbound_atu(struct dw_pcie = *pci, u8 func_no, return; } =20 + limit_addr =3D cpu_addr + size - 1; + dw_pcie_writel_dbi(pci, PCIE_ATU_VIEWPORT, PCIE_ATU_REGION_OUTBOUND | index); dw_pcie_writel_dbi(pci, PCIE_ATU_LOWER_BASE, @@ -332,17 +335,18 @@ static void __dw_pcie_prog_outbound_atu(struct dw_pci= e *pci, u8 func_no, dw_pcie_writel_dbi(pci, PCIE_ATU_UPPER_BASE, upper_32_bits(cpu_addr)); dw_pcie_writel_dbi(pci, PCIE_ATU_LIMIT, - lower_32_bits(cpu_addr + size - 1)); + lower_32_bits(limit_addr)); if (pci->version >=3D 0x460A) dw_pcie_writel_dbi(pci, PCIE_ATU_UPPER_LIMIT, - upper_32_bits(cpu_addr + size - 1)); + upper_32_bits(limit_addr)); dw_pcie_writel_dbi(pci, PCIE_ATU_LOWER_TARGET, lower_32_bits(pci_addr)); dw_pcie_writel_dbi(pci, PCIE_ATU_UPPER_TARGET, upper_32_bits(pci_addr)); val =3D type | PCIE_ATU_FUNC_NUM(func_no); - val =3D ((upper_32_bits(size - 1)) && (pci->version >=3D 0x460A)) ? - val | PCIE_ATU_INCREASE_REGION_SIZE : val; + if (upper_32_bits(limit_addr) > upper_32_bits(cpu_addr) && + pci->version >=3D 0x460A) + val |=3D PCIE_ATU_INCREASE_REGION_SIZE; if (pci->version =3D=3D 0x490A) val =3D dw_pcie_enable_ecrc(val); dw_pcie_writel_dbi(pci, PCIE_ATU_CR1, val); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB161C00140 for ; Mon, 15 Aug 2022 21:59:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245489AbiHOV71 (ORCPT ); Mon, 15 Aug 2022 17:59:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345211AbiHOV64 (ORCPT ); Mon, 15 Aug 2022 17:58:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C249B10DCCD; Mon, 15 Aug 2022 12:34:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 98A44B80EA7; Mon, 15 Aug 2022 19:34:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 990CFC433C1; Mon, 15 Aug 2022 19:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592065; bh=QlOz2Io+byC6AKMjBO+S+1VJ4N/d58bt7s1z5/Zdtc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FrOIYCFnGXdtrzTHPthc8YhjHofKgYpAmnnP+TBA75XyvfjuSKYWJ3LhR4K4JnL/j XbA6CoAlSwn5aZip5B7e8aN3RrqPLMYkdn1ijN9DynRFGFhnxIFx+XVATfsz3B1Zo/ V+wCnO5ohDChdPFMMvvdPzHGlYpPqUNuoSWZirJ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Serge Semin , Bjorn Helgaas , Rob Herring , Sasha Levin Subject: [PATCH 5.18 0725/1095] PCI: dwc: Deallocate EPC memory on dw_pcie_ep_init() errors Date: Mon, 15 Aug 2022 20:02:04 +0200 Message-Id: <20220815180459.369963169@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit 8161e9626b50892eaedbd8070ecb1586ecedb109 ] If dw_pcie_ep_init() fails to perform any action after the EPC memory is initialized and the MSI memory region is allocated, the latter parts won't be undone thus causing a memory leak. Add a cleanup-on-error path to fix these leaks. [bhelgaas: commit log] Fixes: 2fd0c9d966cc ("PCI: designware-ep: Pre-allocate memory for MSI in dw= _pcie_ep_init") Link: https://lore.kernel.org/r/20220624143428.8334-6-Sergey.Semin@baikalel= ectronics.ru Tested-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Bjorn Helgaas Reviewed-by: Rob Herring Reviewed-by: Manivannan Sadhasivam Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../pci/controller/dwc/pcie-designware-ep.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/= controller/dwc/pcie-designware-ep.c index 0eda8236c125..13c2e73f0eaf 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -780,8 +780,9 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) ep->msi_mem =3D pci_epc_mem_alloc_addr(epc, &ep->msi_mem_phys, epc->mem->window.page_size); if (!ep->msi_mem) { + ret =3D -ENOMEM; dev_err(dev, "Failed to reserve memory for MSI/MSI-X\n"); - return -ENOMEM; + goto err_exit_epc_mem; } =20 if (ep->ops->get_features) { @@ -790,6 +791,19 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) return 0; } =20 - return dw_pcie_ep_init_complete(ep); + ret =3D dw_pcie_ep_init_complete(ep); + if (ret) + goto err_free_epc_mem; + + return 0; + +err_free_epc_mem: + pci_epc_mem_free_addr(epc, ep->msi_mem_phys, ep->msi_mem, + epc->mem->window.page_size); + +err_exit_epc_mem: + pci_epc_mem_exit(epc); + + return ret; } EXPORT_SYMBOL_GPL(dw_pcie_ep_init); --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D03D2C00140 for ; Mon, 15 Aug 2022 22:10:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346177AbiHOWKS (ORCPT ); Mon, 15 Aug 2022 18:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345798AbiHOWIt (ORCPT ); Mon, 15 Aug 2022 18:08:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BCA430F66; Mon, 15 Aug 2022 12:38:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1B72BB81136; Mon, 15 Aug 2022 19:38:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DB49C433C1; Mon, 15 Aug 2022 19:38:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592281; bh=Eu2Too71nkRvOCWXDlOSR3/DmXmFVsTh3FCCzEj3Lqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xpAfMpjXOcEOryS5oSqyddKpa2DMx+6RUEBoMUa5XDNB3flVbIriK8batxx/kC7Q5 GRnyggE0txKIZuiiqdAy4EBHHUp8fmvOq63G7TePuNP+oRplUWIy8VB+XomX+5Qfgi DpT9GO1GM6pN4YKcM12XRnTNuscMCTArk2BjfvjM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Bjorn Helgaas , Vidya Sagar , Rob Herring , Manivannan Sadhasivam , Sasha Levin Subject: [PATCH 5.18 0726/1095] PCI: dwc: Always enable CDM check if "snps,enable-cdm-check" exists Date: Mon, 15 Aug 2022 20:02:05 +0200 Message-Id: <20220815180459.405688322@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit ec7b952f453ce7eabe7e1bea584626934d44f668 ] If the "snps,enable-cdm-check" property exists, we should enable the CDM check. But previously dw_pcie_setup() could exit before doing so if the "num-lanes" property was absent or invalid. Move the CDM enable earlier so we do it regardless of whether "num-lanes" is present. [bhelgaas: commit log] Fixes: 07f123def73e ("PCI: dwc: Add support to enable CDM register check") Link: https://lore.kernel.org/r/20220624143428.8334-7-Sergey.Semin@baikalel= ectronics.ru Signed-off-by: Serge Semin Signed-off-by: Bjorn Helgaas Reviewed-by: Vidya Sagar Reviewed-by: Rob Herring Reviewed-by: Manivannan Sadhasivam Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-designware.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/con= troller/dwc/pcie-designware.c index 347251bf87d0..5848cc520b52 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -740,6 +740,13 @@ void dw_pcie_setup(struct dw_pcie *pci) val |=3D PORT_LINK_DLL_LINK_EN; dw_pcie_writel_dbi(pci, PCIE_PORT_LINK_CONTROL, val); =20 + if (of_property_read_bool(np, "snps,enable-cdm-check")) { + val =3D dw_pcie_readl_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS); + val |=3D PCIE_PL_CHK_REG_CHK_REG_CONTINUOUS | + PCIE_PL_CHK_REG_CHK_REG_START; + dw_pcie_writel_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS, val); + } + of_property_read_u32(np, "num-lanes", &pci->num_lanes); if (!pci->num_lanes) { dev_dbg(pci->dev, "Using h/w default number of lanes\n"); @@ -786,11 +793,4 @@ void dw_pcie_setup(struct dw_pcie *pci) break; } dw_pcie_writel_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL, val); - - if (of_property_read_bool(np, "snps,enable-cdm-check")) { - val =3D dw_pcie_readl_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS); - val |=3D PCIE_PL_CHK_REG_CHK_REG_CONTINUOUS | - PCIE_PL_CHK_REG_CHK_REG_START; - dw_pcie_writel_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS, val); - } } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BD8FC00140 for ; Mon, 15 Aug 2022 22:02:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233168AbiHOWC0 (ORCPT ); Mon, 15 Aug 2022 18:02:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344357AbiHOV7r (ORCPT ); Mon, 15 Aug 2022 17:59:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B72E24B; Mon, 15 Aug 2022 12:35:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 36FAF610A5; Mon, 15 Aug 2022 19:34:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B7BDC433C1; Mon, 15 Aug 2022 19:34:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592084; bh=yg6v+E6w4tYGmjS7g1TgMXBUqPL+Zz2rnmZLUdugTHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PDLfeddTlAcMKRumkErsJ/AU6zrX22cQae0ybhABJXwxuLNs+omQ0e8SPHc0OvDVk Pa9rNk3BhS55GTN8px27FU4qYbTYLWSWYeF92IHFnz6lQBcq9FeoTTkBAmY6NQsFA1 EI2DaQr/bF5XbfhiN6fZDcmmDK7pKVn37RRoecv0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Rander Wang , Bard Liao , Vinod Koul , Sasha Levin Subject: [PATCH 5.18 0727/1095] soundwire: bus_type: fix remove and shutdown support Date: Mon, 15 Aug 2022 20:02:06 +0200 Message-Id: <20220815180459.449738445@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart [ Upstream commit df6407782964dc7e35ad84230abb38f46314b245 ] The bus sdw_drv_remove() and sdw_drv_shutdown() helpers are used conditionally, if the driver provides these routines. These helpers already test if the driver provides a .remove or .shutdown callback, so there's no harm in invoking the sdw_drv_remove() and sdw_drv_shutdown() unconditionally. In addition, the current code is imbalanced with dev_pm_domain_attach() called from sdw_drv_probe(), but dev_pm_domain_detach() called from sdw_drv_remove() only if the driver provides a .remove callback. Fixes: 9251345dca24b ("soundwire: Add SoundWire bus type") Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Signed-off-by: Bard Liao Link: https://lore.kernel.org/r/20220610015105.25987-1-yung-chuan.liao@linu= x.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/soundwire/bus_type.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c index 893296f3fe39..b81e04dd3a9f 100644 --- a/drivers/soundwire/bus_type.c +++ b/drivers/soundwire/bus_type.c @@ -193,12 +193,8 @@ int __sdw_register_driver(struct sdw_driver *drv, stru= ct module *owner) =20 drv->driver.owner =3D owner; drv->driver.probe =3D sdw_drv_probe; - - if (drv->remove) - drv->driver.remove =3D sdw_drv_remove; - - if (drv->shutdown) - drv->driver.shutdown =3D sdw_drv_shutdown; + drv->driver.remove =3D sdw_drv_remove; + drv->driver.shutdown =3D sdw_drv_shutdown; =20 return driver_register(&drv->driver); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4916EC25B08 for ; Mon, 15 Aug 2022 22:02:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346808AbiHOWCt (ORCPT ); Mon, 15 Aug 2022 18:02:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347213AbiHOWAj (ORCPT ); Mon, 15 Aug 2022 18:00:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D2D110FF4; Mon, 15 Aug 2022 12:35:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DD8BDB80EA7; Mon, 15 Aug 2022 19:35:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28B9AC433D7; Mon, 15 Aug 2022 19:35:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592119; bh=yP2LSs1kUhR4I5yiAyJfoW7fRrgO1ZwT2JlJkMnRY9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s5eUBA/JP0Rqvc6KgenuD85DyG0m+rCaWwY7ZTBa1uIX3ulRc42rl5OT6EEPvtZG7 IPePIU9ZCIErW5rKjsMdqEoMpr9jwnQNLs+09yo+RwjkGocIvT/Tml/QxaD7HUCcVE GM5gdKW7AQ7t6bn6XDoCMOopFpORKsClRTBIzd3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Rander Wang , Ranjani Sridharan , Bard Liao , =?UTF-8?q?P=C3=A9ter=20Ujfalusi?= , Vinod Koul , Sasha Levin Subject: [PATCH 5.18 0728/1095] soundwire: revisit driver bind/unbind and callbacks Date: Mon, 15 Aug 2022 20:02:07 +0200 Message-Id: <20220815180459.502054610@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart [ Upstream commit bd29c00edd0a5dac8b6e7332bb470cd50f92e893 ] In the SoundWire probe, we store a pointer from the driver ops into the 'slave' structure. This can lead to kernel oopses when unbinding codec drivers, e.g. with the following sequence to remove machine driver and codec driver. /sbin/modprobe -r snd_soc_sof_sdw /sbin/modprobe -r snd_soc_rt711 The full details can be found in the BugLink below, for reference the two following examples show different cases of driver ops/callbacks being invoked after the driver .remove(). kernel: BUG: kernel NULL pointer dereference, address: 0000000000000150 kernel: Workqueue: events cdns_update_slave_status_work [soundwire_cadence] kernel: RIP: 0010:mutex_lock+0x19/0x30 kernel: Call Trace: kernel: ? sdw_handle_slave_status+0x426/0xe00 [soundwire_bus 94ff184bf3985= 70c3f8ff7efe9e32529f532e4ae] kernel: ? newidle_balance+0x26a/0x400 kernel: ? cdns_update_slave_status_work+0x1e9/0x200 [soundwire_cadence 1bc= f98eebe5ba9833cd433323769ac923c9c6f82] kernel: BUG: unable to handle page fault for address: ffffffffc07654c8 kernel: Workqueue: pm pm_runtime_work kernel: RIP: 0010:sdw_bus_prep_clk_stop+0x6f/0x160 [soundwire_bus] kernel: Call Trace: kernel: kernel: sdw_cdns_clock_stop+0xb5/0x1b0 [soundwire_cadence 1bcf98eebe5ba983= 3cd433323769ac923c9c6f82] kernel: intel_suspend_runtime+0x5f/0x120 [soundwire_intel aca858f7c87048d3= 152a4a41bb68abb9b663a1dd] kernel: ? dpm_sysfs_remove+0x60/0x60 This was not detected earlier in Intel tests since the tests first remove the parent PCI device and shut down the bus. The sequence above is a corner case which keeps the bus operational but without a driver bound. While trying to solve this kernel oopses, it became clear that the existing SoundWire bus does not deal well with the unbind case. Commit 528be501b7d4a ("soundwire: sdw_slave: add probe_complete structure a= nd new fields") added a 'probed' status variable and a 'probe_complete' struct completion. This status is however not reset on remove and likewise the 'probe complete' is not re-initialized, so the bind/unbind/bind test cases would fail. The timeout used before the 'update_status' callback was also a bad idea in hindsight, there should really be no timing assumption as to if and when a driver is bound to a device. An initial draft was based on device_lock() and device_unlock() was tested. This proved too complicated, with deadlocks created during the suspend-resume sequences, which also use the same device_lock/unlock() as the bind/unbind sequences. On a CometLake device, a bad DSDT/BIOS caused spurious resumes and the use of device_lock() caused hangs during suspend. After multiple weeks or testing and painful reverse-engineering of deadlocks on different devices, we looked for alternatives that did not interfere with the device core. A bus notifier was used successfully to keep track of DRIVER_BOUND and DRIVER_UNBIND events. This solved the bind-unbind-bind case in tests, but it can still be defeated with a theoretical corner case where the memory is freed by a .remove while the callback is in use. The notifier only helps make sure the driver callbacks are valid, but not that the memory allocated in probe remains valid while the callbacks are invoked. This patch suggests the introduction of a new 'sdw_dev_lock' mutex protecting probe/remove and all driver callbacks. Since this mutex is 'local' to SoundWire only, it does not interfere with existing locks and does not create deadlocks. In addition, this patch removes the 'probe_complete' completion, instead we directly invoke the 'update_status' from the probe routine. That removes any sort of timing dependency and a much better support for the device/driver model, the driver could be bound before the bus started, or eons after the bus started and the hardware would be properly initialized in all cases. BugLink: https://github.com/thesofproject/linux/issues/3531 Fixes: 56d4fe31af77 ("soundwire: Add MIPI DisCo property helpers") Fixes: 528be501b7d4a ("soundwire: sdw_slave: add probe_complete structure a= nd new fields") Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: P=C3=A9ter Ujfalusi Link: https://lore.kernel.org/r/20220621225641.221170-2-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/soundwire/bus.c | 75 ++++++++++++++++++++--------------- drivers/soundwire/bus_type.c | 30 +++++++++++--- drivers/soundwire/slave.c | 3 +- drivers/soundwire/stream.c | 53 ++++++++++++++++--------- include/linux/soundwire/sdw.h | 6 +-- 5 files changed, 106 insertions(+), 61 deletions(-) diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index 354d3f89366f..f1cf78c6d477 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "bus.h" #include "sysfs_local.h" =20 @@ -846,15 +847,21 @@ static int sdw_slave_clk_stop_callback(struct sdw_sla= ve *slave, enum sdw_clk_stop_mode mode, enum sdw_clk_stop_type type) { - int ret; + int ret =3D 0; =20 - if (slave->ops && slave->ops->clk_stop) { - ret =3D slave->ops->clk_stop(slave, mode, type); - if (ret < 0) - return ret; + mutex_lock(&slave->sdw_dev_lock); + + if (slave->probed) { + struct device *dev =3D &slave->dev; + struct sdw_driver *drv =3D drv_to_sdw_driver(dev->driver); + + if (drv->ops && drv->ops->clk_stop) + ret =3D drv->ops->clk_stop(slave, mode, type); } =20 - return 0; + mutex_unlock(&slave->sdw_dev_lock); + + return ret; } =20 static int sdw_slave_clk_stop_prepare(struct sdw_slave *slave, @@ -1616,14 +1623,24 @@ static int sdw_handle_slave_alerts(struct sdw_slave= *slave) } =20 /* Update the Slave driver */ - if (slave_notify && slave->ops && - slave->ops->interrupt_callback) { - slave_intr.sdca_cascade =3D sdca_cascade; - slave_intr.control_port =3D clear; - memcpy(slave_intr.port, &port_status, - sizeof(slave_intr.port)); - - slave->ops->interrupt_callback(slave, &slave_intr); + if (slave_notify) { + mutex_lock(&slave->sdw_dev_lock); + + if (slave->probed) { + struct device *dev =3D &slave->dev; + struct sdw_driver *drv =3D drv_to_sdw_driver(dev->driver); + + if (drv->ops && drv->ops->interrupt_callback) { + slave_intr.sdca_cascade =3D sdca_cascade; + slave_intr.control_port =3D clear; + memcpy(slave_intr.port, &port_status, + sizeof(slave_intr.port)); + + drv->ops->interrupt_callback(slave, &slave_intr); + } + } + + mutex_unlock(&slave->sdw_dev_lock); } =20 /* Ack interrupt */ @@ -1697,29 +1714,21 @@ static int sdw_handle_slave_alerts(struct sdw_slave= *slave) static int sdw_update_slave_status(struct sdw_slave *slave, enum sdw_slave_status status) { - unsigned long time; + int ret =3D 0; =20 - if (!slave->probed) { - /* - * the slave status update is typically handled in an - * interrupt thread, which can race with the driver - * probe, e.g. when a module needs to be loaded. - * - * make sure the probe is complete before updating - * status. - */ - time =3D wait_for_completion_timeout(&slave->probe_complete, - msecs_to_jiffies(DEFAULT_PROBE_TIMEOUT)); - if (!time) { - dev_err(&slave->dev, "Probe not complete, timed out\n"); - return -ETIMEDOUT; - } + mutex_lock(&slave->sdw_dev_lock); + + if (slave->probed) { + struct device *dev =3D &slave->dev; + struct sdw_driver *drv =3D drv_to_sdw_driver(dev->driver); + + if (drv->ops && drv->ops->update_status) + ret =3D drv->ops->update_status(slave, status); } =20 - if (!slave->ops || !slave->ops->update_status) - return 0; + mutex_unlock(&slave->sdw_dev_lock); =20 - return slave->ops->update_status(slave, status); + return ret; } =20 /** diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c index b81e04dd3a9f..04b3529f8929 100644 --- a/drivers/soundwire/bus_type.c +++ b/drivers/soundwire/bus_type.c @@ -98,8 +98,6 @@ static int sdw_drv_probe(struct device *dev) if (!id) return -ENODEV; =20 - slave->ops =3D drv->ops; - /* * attach to power domain but don't turn on (last arg) */ @@ -107,19 +105,23 @@ static int sdw_drv_probe(struct device *dev) if (ret) return ret; =20 + mutex_lock(&slave->sdw_dev_lock); + ret =3D drv->probe(slave, id); if (ret) { name =3D drv->name; if (!name) name =3D drv->driver.name; + mutex_unlock(&slave->sdw_dev_lock); + dev_err(dev, "Probe of %s failed: %d\n", name, ret); dev_pm_domain_detach(dev, false); return ret; } =20 /* device is probed so let's read the properties now */ - if (slave->ops && slave->ops->read_prop) - slave->ops->read_prop(slave); + if (drv->ops && drv->ops->read_prop) + drv->ops->read_prop(slave); =20 /* init the sysfs as we have properties now */ ret =3D sdw_slave_sysfs_init(slave); @@ -139,7 +141,19 @@ static int sdw_drv_probe(struct device *dev) slave->prop.clk_stop_timeout); =20 slave->probed =3D true; - complete(&slave->probe_complete); + + /* + * if the probe happened after the bus was started, notify the codec driv= er + * of the current hardware status to e.g. start the initialization. + * Errors are only logged as warnings to avoid failing the probe. + */ + if (drv->ops && drv->ops->update_status) { + ret =3D drv->ops->update_status(slave, slave->status); + if (ret < 0) + dev_warn(dev, "%s: update_status failed with status %d\n", __func__, re= t); + } + + mutex_unlock(&slave->sdw_dev_lock); =20 dev_dbg(dev, "probe complete\n"); =20 @@ -152,9 +166,15 @@ static int sdw_drv_remove(struct device *dev) struct sdw_driver *drv =3D drv_to_sdw_driver(dev->driver); int ret =3D 0; =20 + mutex_lock(&slave->sdw_dev_lock); + + slave->probed =3D false; + if (drv->remove) ret =3D drv->remove(slave); =20 + mutex_unlock(&slave->sdw_dev_lock); + dev_pm_domain_detach(dev, false); =20 return ret; diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c index 669d7573320b..25e76b5d4a1a 100644 --- a/drivers/soundwire/slave.c +++ b/drivers/soundwire/slave.c @@ -12,6 +12,7 @@ static void sdw_slave_release(struct device *dev) { struct sdw_slave *slave =3D dev_to_sdw_dev(dev); =20 + mutex_destroy(&slave->sdw_dev_lock); kfree(slave); } =20 @@ -58,9 +59,9 @@ int sdw_slave_add(struct sdw_bus *bus, init_completion(&slave->enumeration_complete); init_completion(&slave->initialization_complete); slave->dev_num =3D 0; - init_completion(&slave->probe_complete); slave->probed =3D false; slave->first_interrupt_done =3D false; + mutex_init(&slave->sdw_dev_lock); =20 for (i =3D 0; i < SDW_MAX_PORTS; i++) init_completion(&slave->port_ready[i]); diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index f273459b2023..6963e5f7ea6d 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include "bus.h" =20 @@ -401,20 +402,26 @@ static int sdw_do_port_prep(struct sdw_slave_runtime = *s_rt, struct sdw_prepare_ch prep_ch, enum sdw_port_prep_ops cmd) { - const struct sdw_slave_ops *ops =3D s_rt->slave->ops; - int ret; + int ret =3D 0; + struct sdw_slave *slave =3D s_rt->slave; =20 - if (ops->port_prep) { - ret =3D ops->port_prep(s_rt->slave, &prep_ch, cmd); - if (ret < 0) { - dev_err(&s_rt->slave->dev, - "Slave Port Prep cmd %d failed: %d\n", - cmd, ret); - return ret; + mutex_lock(&slave->sdw_dev_lock); + + if (slave->probed) { + struct device *dev =3D &slave->dev; + struct sdw_driver *drv =3D drv_to_sdw_driver(dev->driver); + + if (drv->ops && drv->ops->port_prep) { + ret =3D drv->ops->port_prep(slave, &prep_ch, cmd); + if (ret < 0) + dev_err(dev, "Slave Port Prep cmd %d failed: %d\n", + cmd, ret); } } =20 - return 0; + mutex_unlock(&slave->sdw_dev_lock); + + return ret; } =20 static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus, @@ -578,7 +585,7 @@ static int sdw_notify_config(struct sdw_master_runtime = *m_rt) struct sdw_slave_runtime *s_rt; struct sdw_bus *bus =3D m_rt->bus; struct sdw_slave *slave; - int ret =3D 0; + int ret; =20 if (bus->ops->set_bus_conf) { ret =3D bus->ops->set_bus_conf(bus, &bus->params); @@ -589,17 +596,27 @@ static int sdw_notify_config(struct sdw_master_runtim= e *m_rt) list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) { slave =3D s_rt->slave; =20 - if (slave->ops->bus_config) { - ret =3D slave->ops->bus_config(slave, &bus->params); - if (ret < 0) { - dev_err(bus->dev, "Notify Slave: %d failed\n", - slave->dev_num); - return ret; + mutex_lock(&slave->sdw_dev_lock); + + if (slave->probed) { + struct device *dev =3D &slave->dev; + struct sdw_driver *drv =3D drv_to_sdw_driver(dev->driver); + + if (drv->ops && drv->ops->bus_config) { + ret =3D drv->ops->bus_config(slave, &bus->params); + if (ret < 0) { + dev_err(dev, "Notify Slave: %d failed\n", + slave->dev_num); + mutex_unlock(&slave->sdw_dev_lock); + return ret; + } } } + + mutex_unlock(&slave->sdw_dev_lock); } =20 - return ret; + return 0; } =20 /** diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 76ce3f3ac0f2..bf6f0decb3f6 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -646,9 +646,6 @@ struct sdw_slave_ops { * @dev_num: Current Device Number, values can be 0 or dev_num_sticky * @dev_num_sticky: one-time static Device Number assigned by Bus * @probed: boolean tracking driver state - * @probe_complete: completion utility to control potential races - * on startup between driver probe/initialization and SoundWire - * Slave state changes/implementation-defined interrupts * @enumeration_complete: completion utility to control potential races * on startup between device enumeration and read/write access to the * Slave device @@ -663,6 +660,7 @@ struct sdw_slave_ops { * for a Slave happens for the first time after enumeration * @is_mockup_device: status flag used to squelch errors in the command/co= ntrol * protocol for SoundWire mockup devices + * @sdw_dev_lock: mutex used to protect callbacks/remove races */ struct sdw_slave { struct sdw_slave_id id; @@ -680,12 +678,12 @@ struct sdw_slave { u16 dev_num; u16 dev_num_sticky; bool probed; - struct completion probe_complete; struct completion enumeration_complete; struct completion initialization_complete; u32 unattach_request; bool first_interrupt_done; bool is_mockup_device; + struct mutex sdw_dev_lock; /* protect callbacks/remove races */ }; =20 #define dev_to_sdw_dev(_dev) container_of(_dev, struct sdw_slave, dev) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68629C00140 for ; Mon, 15 Aug 2022 22:07:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347675AbiHOWHt (ORCPT ); Mon, 15 Aug 2022 18:07:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350400AbiHOWCF (ORCPT ); Mon, 15 Aug 2022 18:02:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E647610FE7; Mon, 15 Aug 2022 12:36:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8EF2BB80EA9; Mon, 15 Aug 2022 19:36:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DED6C433D7; Mon, 15 Aug 2022 19:36:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592187; bh=I0wyDQbLG/JuU5JwqWrzDV7Xw9+rd6SjzThjPNzvkho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KcHUZ/aujdRlk4Qq+LrkxeIMiXFglv0MTTnKsVc9kEHK8zDlzOThzwU5VCmsRQYRp bNsvRby1yteKEWM/l3YVkA5dg3nbEnzO2R7xEjLTwh8oS3faXcRSJOsSecTsca2INH W3BEj23mB5hrt+tmwVIWcGkwa/9a3NZVyqT/VKf8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quentin Perret , Marc Zyngier , Sasha Levin Subject: [PATCH 5.18 0729/1095] KVM: arm64: Dont return from void function Date: Mon, 15 Aug 2022 20:02:08 +0200 Message-Id: <20220815180459.542749604@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quentin Perret [ Upstream commit 1c3ace2b8b3995d3213c5e2d2aca01a0577a3b0f ] Although harmless, the return statement in kvm_unexpected_el2_exception is rather confusing as the function itself has a void return type. The C standard is also pretty clear that "A return statement with an expression shall not appear in a function whose return type is void". Given that this return statement does not seem to add any actual value, let's not pointlessly violate the standard. Build-tested with GCC 10 and CLANG 13 for good measure, the disassembled code is identical with or without the return statement. Fixes: e9ee186bb735 ("KVM: arm64: Add kvm_extable for vaxorcism code") Signed-off-by: Quentin Perret Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220705142310.3847918-1-qperret@google.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/kvm/hyp/nvhe/switch.c | 2 +- arch/arm64/kvm/hyp/vhe/switch.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/hyp/nvhe/switch.c b/arch/arm64/kvm/hyp/nvhe/swi= tch.c index 6410d21d8695..858e5be48791 100644 --- a/arch/arm64/kvm/hyp/nvhe/switch.c +++ b/arch/arm64/kvm/hyp/nvhe/switch.c @@ -371,5 +371,5 @@ void __noreturn hyp_panic(void) =20 asmlinkage void kvm_unexpected_el2_exception(void) { - return __kvm_unexpected_el2_exception(); + __kvm_unexpected_el2_exception(); } diff --git a/arch/arm64/kvm/hyp/vhe/switch.c b/arch/arm64/kvm/hyp/vhe/switc= h.c index 262dfe03134d..51ea9ac71210 100644 --- a/arch/arm64/kvm/hyp/vhe/switch.c +++ b/arch/arm64/kvm/hyp/vhe/switch.c @@ -240,5 +240,5 @@ void __noreturn hyp_panic(void) =20 asmlinkage void kvm_unexpected_el2_exception(void) { - return __kvm_unexpected_el2_exception(); + __kvm_unexpected_el2_exception(); } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B535DC00140 for ; Mon, 15 Aug 2022 22:09:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347954AbiHOWJD (ORCPT ); Mon, 15 Aug 2022 18:09:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348625AbiHOWGF (ORCPT ); Mon, 15 Aug 2022 18:06:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB8A0116ED8; Mon, 15 Aug 2022 12:37:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 632CFB80EA9; Mon, 15 Aug 2022 19:37:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 922EBC433C1; Mon, 15 Aug 2022 19:37:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592256; bh=N3qyH8pGWQC5ePmuhX+7tI2CgB4S9Qep2kWgA+wiwOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tr11Psr/zYoLN/qnRKLNyvd3RH+EsUh6L5Cdv0tJXCFCIkW6238hAcjSH9WbgIjBj YUqzVyhNc2xz5y+IJl4DfPPP58tAwuxrv2imzkiSugToifHsYjUkIBrQ5Mx8SdbmgL BR9Ph/kSIVvCkF96IX3zzvFCn9mbODWAjxZq5LgI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Viacheslav Mitrofanov , Vinod Koul , Sasha Levin Subject: [PATCH 5.18 0730/1095] dmaengine: sf-pdma: Add multithread support for a DMA channel Date: Mon, 15 Aug 2022 20:02:09 +0200 Message-Id: <20220815180459.585797127@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Viacheslav Mitrofanov [ Upstream commit b2cc5c465c2cb8ab697c3fd6583c614e3f6cfbcc ] When we get a DMA channel and try to use it in multiple threads it will cause oops and hanging the system. % echo 64 > /sys/module/dmatest/parameters/threads_per_chan % echo 10000 > /sys/module/dmatest/parameters/iterations % echo 1 > /sys/module/dmatest/parameters/run [ 89.480664] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000a0 [ 89.488725] Oops [#1] [ 89.494708] CPU: 2 PID: 1008 Comm: dma0chan0-copy0 Not tainted 5.17.0-rc5 [ 89.509385] epc : vchan_find_desc+0x32/0x46 [ 89.513553] ra : sf_pdma_tx_status+0xca/0xd6 This happens because of data race. Each thread rewrite channels's descriptor as soon as device_prep_dma_memcpy() is called. It leads to the situation when the driver thinks that it uses right descriptor that actually is freed or substituted for other one. With current fixes a descriptor changes its value only when it has been used. A new descriptor is acquired from vc->desc_issued queue that is already filled with descriptors that are ready to be sent. Threads have no direct access to DMA channel descriptor. Now it is just possible to queue a descriptor for further processing. Fixes: 6973886ad58e ("dmaengine: sf-pdma: add platform DMA support for HiFi= ve Unleashed A00") Signed-off-by: Viacheslav Mitrofanov Link: https://lore.kernel.org/r/20220701082942.12835-1-v.v.mitrofanov@yadro= .com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/dma/sf-pdma/sf-pdma.c | 44 ++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/drivers/dma/sf-pdma/sf-pdma.c b/drivers/dma/sf-pdma/sf-pdma.c index f12606aeff87..ab0ad7a2f201 100644 --- a/drivers/dma/sf-pdma/sf-pdma.c +++ b/drivers/dma/sf-pdma/sf-pdma.c @@ -52,16 +52,6 @@ static inline struct sf_pdma_desc *to_sf_pdma_desc(struc= t virt_dma_desc *vd) static struct sf_pdma_desc *sf_pdma_alloc_desc(struct sf_pdma_chan *chan) { struct sf_pdma_desc *desc; - unsigned long flags; - - spin_lock_irqsave(&chan->lock, flags); - - if (chan->desc && !chan->desc->in_use) { - spin_unlock_irqrestore(&chan->lock, flags); - return chan->desc; - } - - spin_unlock_irqrestore(&chan->lock, flags); =20 desc =3D kzalloc(sizeof(*desc), GFP_NOWAIT); if (!desc) @@ -111,7 +101,6 @@ sf_pdma_prep_dma_memcpy(struct dma_chan *dchan, dma_add= r_t dest, dma_addr_t src, desc->async_tx =3D vchan_tx_prep(&chan->vchan, &desc->vdesc, flags); =20 spin_lock_irqsave(&chan->vchan.lock, iflags); - chan->desc =3D desc; sf_pdma_fill_desc(desc, dest, src, len); spin_unlock_irqrestore(&chan->vchan.lock, iflags); =20 @@ -170,11 +159,17 @@ static size_t sf_pdma_desc_residue(struct sf_pdma_cha= n *chan, unsigned long flags; u64 residue =3D 0; struct sf_pdma_desc *desc; - struct dma_async_tx_descriptor *tx; + struct dma_async_tx_descriptor *tx =3D NULL; =20 spin_lock_irqsave(&chan->vchan.lock, flags); =20 - tx =3D &chan->desc->vdesc.tx; + list_for_each_entry(vd, &chan->vchan.desc_submitted, node) + if (vd->tx.cookie =3D=3D cookie) + tx =3D &vd->tx; + + if (!tx) + goto out; + if (cookie =3D=3D tx->chan->completed_cookie) goto out; =20 @@ -241,6 +236,19 @@ static void sf_pdma_enable_request(struct sf_pdma_chan= *chan) writel(v, regs->ctrl); } =20 +static struct sf_pdma_desc *sf_pdma_get_first_pending_desc(struct sf_pdma_= chan *chan) +{ + struct virt_dma_chan *vchan =3D &chan->vchan; + struct virt_dma_desc *vdesc; + + if (list_empty(&vchan->desc_issued)) + return NULL; + + vdesc =3D list_first_entry(&vchan->desc_issued, struct virt_dma_desc, nod= e); + + return container_of(vdesc, struct sf_pdma_desc, vdesc); +} + static void sf_pdma_xfer_desc(struct sf_pdma_chan *chan) { struct sf_pdma_desc *desc =3D chan->desc; @@ -268,8 +276,11 @@ static void sf_pdma_issue_pending(struct dma_chan *dch= an) =20 spin_lock_irqsave(&chan->vchan.lock, flags); =20 - if (vchan_issue_pending(&chan->vchan) && chan->desc) + if (!chan->desc && vchan_issue_pending(&chan->vchan)) { + /* vchan_issue_pending has made a check that desc in not NULL */ + chan->desc =3D sf_pdma_get_first_pending_desc(chan); sf_pdma_xfer_desc(chan); + } =20 spin_unlock_irqrestore(&chan->vchan.lock, flags); } @@ -298,6 +309,11 @@ static void sf_pdma_donebh_tasklet(struct tasklet_stru= ct *t) spin_lock_irqsave(&chan->vchan.lock, flags); list_del(&chan->desc->vdesc.node); vchan_cookie_complete(&chan->desc->vdesc); + + chan->desc =3D sf_pdma_get_first_pending_desc(chan); + if (chan->desc) + sf_pdma_xfer_desc(chan); + spin_unlock_irqrestore(&chan->vchan.lock, flags); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 799C6C00140 for ; Mon, 15 Aug 2022 22:09:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346331AbiHOWJm (ORCPT ); Mon, 15 Aug 2022 18:09:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347139AbiHOWHS (ORCPT ); Mon, 15 Aug 2022 18:07:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 985C5118444; Mon, 15 Aug 2022 12:37:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D1EF9B80EAD; Mon, 15 Aug 2022 19:37:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20FB1C433C1; Mon, 15 Aug 2022 19:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592274; bh=sT5pL6cUl6cZxcolgG5Lty5iulljWSDOK+DQZab1v8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ujC2tnn4EFftDYUZ/kbyBXcb5z8SSPOlHDbdCn2ahJQCmgAt12Z31zg3Osu+itXIK UEgDwdYmGiO4EsuESkSfVgqSKO0BuF52kSSAAZEN6d0+R+oy8Dpmb3D+eon5yfautK 5UjjDaBT7g3qPg+45grm1GSNI2yG42L6FZIZSqvo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shunsuke Mie , Bjorn Helgaas , Kishon Vijay Abraham I , Sasha Levin Subject: [PATCH 5.18 0731/1095] PCI: endpoint: Dont stop controller when unbinding endpoint function Date: Mon, 15 Aug 2022 20:02:10 +0200 Message-Id: <20220815180459.630969270@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shunsuke Mie [ Upstream commit 1bc2b7bfba6e2f64edf5e246f3af2967261f6c3d ] Unbinding an endpoint function from the endpoint controller shouldn't stop the controller. This is especially a problem for multi-function endpoints where other endpoints may still be active. Don't stop the controller when unbinding one of its endpoints. Normally the controller is stopped via configfs. Fixes: 349e7a85b25f ("PCI: endpoint: functions: Add an EP function to test = PCI") Link: https://lore.kernel.org/r/20220622040924.113279-1-mie@igel.co.jp Signed-off-by: Shunsuke Mie Signed-off-by: Bjorn Helgaas Acked-by: Kishon Vijay Abraham I Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pci/endpoint/functions/pci-epf-test.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/en= dpoint/functions/pci-epf-test.c index 5b833f00e980..a5ed779b0a51 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -627,7 +627,6 @@ static void pci_epf_test_unbind(struct pci_epf *epf) =20 cancel_delayed_work(&epf_test->cmd_handler); pci_epf_test_clean_dma_chan(epf_test); - pci_epc_stop(epc); for (bar =3D 0; bar < PCI_STD_NUM_BARS; bar++) { epf_bar =3D &epf->bar[bar]; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24F90C00140 for ; Mon, 15 Aug 2022 22:05:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347771AbiHOWF2 (ORCPT ); Mon, 15 Aug 2022 18:05:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345496AbiHOV76 (ORCPT ); Mon, 15 Aug 2022 17:59:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 693D621F; Mon, 15 Aug 2022 12:35:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 69F936114B; Mon, 15 Aug 2022 19:34:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58084C433C1; Mon, 15 Aug 2022 19:34:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592087; bh=mZgyq4mZcLQWF74aSysmnrWML+QTOy4RTquSjSzQl3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cZE/Y4zwEsh49GlbgalCIRkSYqzttPpq2WbNZ/Ba45w+lzLVcGWZaUkVHogaJBy78 Hwuecq0DdYmeqSyDKUXGeWOy0/kPY7dZXZ15gxhnbATZ793MVlDgaTuvsjQOAqyUmD 6FGky/UJC6KzfcmPe4uwwVPC0M2a+XnjSwC6pO6Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Vinod Koul , Sasha Levin Subject: [PATCH 5.18 0732/1095] phy: qcom-qmp: fix the QSERDES_V5_COM_CMN_MODE register Date: Mon, 15 Aug 2022 20:02:11 +0200 Message-Id: <20220815180459.679762967@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Baryshkov [ Upstream commit 488987b2d5cade4e7680f7e81590435a848d1fa9 ] Change QSERDES_V5_COM_CMN_MODE to be defined to 0x1a0 rather than 0x1a4. The only user of this register name (sm8450_qmp_gen4x2_pcie_serdes_tbl) should use the 0x1a0 register, as stated in the downstream dtsi tree. Fixes: 2c91bf6bf290 ("phy: qcom-qmp: Add SM8450 PCIe1 PHY support") Signed-off-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20220705094320.1313312-2-dmitry.baryshkov@l= inaro.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/phy/qualcomm/phy-qcom-qmp.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.h b/drivers/phy/qualcomm/phy= -qcom-qmp.h index 06b2556ed93a..b9a91520439c 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp.h +++ b/drivers/phy/qualcomm/phy-qcom-qmp.h @@ -1116,7 +1116,8 @@ #define QSERDES_V5_COM_CORE_CLK_EN 0x174 #define QSERDES_V5_COM_CMN_CONFIG 0x17c #define QSERDES_V5_COM_CMN_MISC1 0x19c -#define QSERDES_V5_COM_CMN_MODE 0x1a4 +#define QSERDES_V5_COM_CMN_MODE 0x1a0 +#define QSERDES_V5_COM_CMN_MODE_CONTD 0x1a4 #define QSERDES_V5_COM_VCO_DC_LEVEL_CTRL 0x1a8 #define QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE1_MODE0 0x1ac #define QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE2_MODE0 0x1b0 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A985EC00140 for ; Mon, 15 Aug 2022 22:05:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347327AbiHOWFY (ORCPT ); Mon, 15 Aug 2022 18:05:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241861AbiHOV75 (ORCPT ); Mon, 15 Aug 2022 17:59:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1A8BE29; Mon, 15 Aug 2022 12:35:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A304F61089; Mon, 15 Aug 2022 19:34:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5A8FC433C1; Mon, 15 Aug 2022 19:34:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592094; bh=ULVdn1u+eHqJzYIKptQEe/KzAAMdb1EsJ3McvUFHKhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V3rsYfWnwQGGG5wmUB3yfESpFCtgvqfmFSg1PKWtzpRouIiK0xrutWTIE+6E+K6Xb iOUrY93RHQU7jPQVEQOnXmyerHvGUnbP5ZbxKGJPT0JcyPgEFSs+7nmzU2C2io0CdL Vh2cI6sFRlENpVhAvQQHO5u638m7tP2HqzW2hhvU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0733/1095] scsi: qla2xxx: Check correct variable in qla24xx_async_gffid() Date: Mon, 15 Aug 2022 20:02:12 +0200 Message-Id: <20220815180459.721095427@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 7c33e477bd883f79cccec418980cb8f7f2d50347 ] There is a copy and paste bug here. It should check ".rsp" instead of ".req". The error message is copy and pasted as well so update that too. Link: https://lore.kernel.org/r/YrK1A/t3L6HKnswO@kili Fixes: 9c40c36e75ff ("scsi: qla2xxx: edif: Reduce Initiator-Initiator thras= hing") Signed-off-by: Dan Carpenter Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_gs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index 574251b2e0ef..c914b5df9c12 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3386,9 +3386,9 @@ int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port= _t *fcport, bool wait) sp->u.iocb_cmd.u.ctarg.rsp_allocated_size, &sp->u.iocb_cmd.u.ctarg.rsp_dma, GFP_KERNEL); - if (!sp->u.iocb_cmd.u.ctarg.req) { + if (!sp->u.iocb_cmd.u.ctarg.rsp) { ql_log(ql_log_warn, vha, 0xd041, - "%s: Failed to allocate ct_sns request.\n", + "%s: Failed to allocate ct_sns response.\n", __func__); goto done_free_sp; } --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4B74C00140 for ; Mon, 15 Aug 2022 22:00:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345553AbiHOWAM (ORCPT ); Mon, 15 Aug 2022 18:00:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244035AbiHOV7V (ORCPT ); Mon, 15 Aug 2022 17:59:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DCB810E952; Mon, 15 Aug 2022 12:35:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 751F5B80EA8; Mon, 15 Aug 2022 19:35:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DA44C433C1; Mon, 15 Aug 2022 19:34:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592100; bh=49uVIo5yxX6YOHCXdzDZ21EmAzU5bpz2xA4aVGHhjq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k6+2xmL2LESP2Rtlads+8xGoHogmQzhf2jI+5xHHgdLaXgP0El0orkodqZAyreNkU 7w7qmQhFcrU+/qgWCNlM9d9kLwTYCkfK2ngP7Mva0AOJJM4gcoIZ3p/TA828+8uCmM JjiYPC0QsEZbanMAj1bSeNO9wRLfRiaaIlatmT4s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Christophe JAILLET , Alexander Shishkin , Sasha Levin Subject: [PATCH 5.18 0734/1095] intel_th: Fix a resource leak in an error handling path Date: Mon, 15 Aug 2022 20:02:13 +0200 Message-Id: <20220815180459.755182054@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 086c28ab7c5699256aced0049aae9c42f1410313 ] If an error occurs after calling 'pci_alloc_irq_vectors()', 'pci_free_irq_vectors()' must be called as already done in the remove function. Fixes: 7b7036d47c35 ("intel_th: pci: Use MSI interrupt signalling") Reviewed-by: Andy Shevchenko Signed-off-by: Christophe JAILLET Signed-off-by: Alexander Shishkin Link: https://lore.kernel.org/r/20220705082637.59979-2-alexander.shishkin@l= inux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hwtracing/intel_th/pci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/= pci.c index 7da4f298ed01..fcd0aca75007 100644 --- a/drivers/hwtracing/intel_th/pci.c +++ b/drivers/hwtracing/intel_th/pci.c @@ -100,8 +100,10 @@ static int intel_th_pci_probe(struct pci_dev *pdev, } =20 th =3D intel_th_alloc(&pdev->dev, drvdata, resource, r); - if (IS_ERR(th)) - return PTR_ERR(th); + if (IS_ERR(th)) { + err =3D PTR_ERR(th); + goto err_free_irq; + } =20 th->activate =3D intel_th_pci_activate; th->deactivate =3D intel_th_pci_deactivate; @@ -109,6 +111,10 @@ static int intel_th_pci_probe(struct pci_dev *pdev, pci_set_master(pdev); =20 return 0; + +err_free_irq: + pci_free_irq_vectors(pdev); + return err; } =20 static void intel_th_pci_remove(struct pci_dev *pdev) --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BD9DC19F2C for ; Mon, 15 Aug 2022 22:02:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344164AbiHOWCq (ORCPT ); Mon, 15 Aug 2022 18:02:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344310AbiHOWA3 (ORCPT ); Mon, 15 Aug 2022 18:00:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D8FB11A1F; Mon, 15 Aug 2022 12:35:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E0F666111E; Mon, 15 Aug 2022 19:35:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2F0FC433D6; Mon, 15 Aug 2022 19:35:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592106; bh=Vi5nOn57Hq/yjy93n2CxGZ9yBwsNUVNFG9Sh/CociKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iLq1uWUIJnFcFZJjvfjoTVI0FFtK+JCCAee3qIoFfzoxx2aq/6PimIabqRoYMHXHN wyKKruGdH2/JIqBZjY9mOeebIH8akeivbCqemWLjv0pfky7JPVf1nMvM65fMwh0w3X sQpZ+JQsH2LVL1NP7jaZ5k3iiorOJZZ1MBlpWbxo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Jiasheng Jiang , Alexander Shishkin , Sasha Levin Subject: [PATCH 5.18 0735/1095] intel_th: msu-sink: Potential dereference of null pointer Date: Mon, 15 Aug 2022 20:02:14 +0200 Message-Id: <20220815180459.792701868@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 82f76a4a720791d889de775b5f7541d601efc8bd ] The return value of dma_alloc_coherent() needs to be checked. To avoid use of null pointer in sg_set_buf() in case of the failure of alloc. Fixes: f220df66f676 ("intel_th: msu-sink: An example msu buffer "sink"") Reviewed-by: Andy Shevchenko Signed-off-by: Jiasheng Jiang Signed-off-by: Alexander Shishkin Link: https://lore.kernel.org/r/20220705082637.59979-3-alexander.shishkin@l= inux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hwtracing/intel_th/msu-sink.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hwtracing/intel_th/msu-sink.c b/drivers/hwtracing/inte= l_th/msu-sink.c index 2c7f5116be12..891b28ea25fe 100644 --- a/drivers/hwtracing/intel_th/msu-sink.c +++ b/drivers/hwtracing/intel_th/msu-sink.c @@ -71,6 +71,9 @@ static int msu_sink_alloc_window(void *data, struct sg_ta= ble **sgt, size_t size) block =3D dma_alloc_coherent(priv->dev->parent->parent, PAGE_SIZE, &sg_dma_address(sg_ptr), GFP_KERNEL); + if (!block) + return -ENOMEM; + sg_set_buf(sg_ptr, block, PAGE_SIZE); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9424EC00140 for ; Mon, 15 Aug 2022 22:06:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344708AbiHOWFf (ORCPT ); Mon, 15 Aug 2022 18:05:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343666AbiHOWAA (ORCPT ); Mon, 15 Aug 2022 18:00:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E18E6E21; Mon, 15 Aug 2022 12:35:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A90A6B80EA8; Mon, 15 Aug 2022 19:35:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 039E9C433C1; Mon, 15 Aug 2022 19:35:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592112; bh=pHZiJJno5N6PtNhBHdAXqpWTived2x+RtACMOKKshSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gk9Ip5g9saG/Of8/EGps7iD1cprgYnnzeslMETL453vCukMMaUdLyMqVxPyoGNr0Y rehl5iHgYQCNogQPGDajflpTF13hBqvMICO/zIrs4ruYvHpPVAByPkmPGgaqwUuuFW UE2Fl8EPB6OOYkNLkSc/5kDyVV+Z7VAKEJ4KYiAI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Alexander Shishkin , Sasha Levin Subject: [PATCH 5.18 0736/1095] intel_th: msu: Fix vmalloced buffers Date: Mon, 15 Aug 2022 20:02:15 +0200 Message-Id: <20220815180459.827651847@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Shishkin [ Upstream commit ac12ad3ccf6d386e64a9d6a890595a2509d24edd ] After commit f5ff79fddf0e ("dma-mapping: remove CONFIG_DMA_REMAP") there's a chance of DMA buffer getting allocated via vmalloc(), which messes up the mmapping code: > RIP: msc_mmap_fault [intel_th_msu] > Call Trace: > > __do_fault > do_fault ... Fix this by accounting for vmalloc possibility. Fixes: ba39bd830605 ("intel_th: msu: Switch over to scatterlist") Reviewed-by: Andy Shevchenko Signed-off-by: Alexander Shishkin Link: https://lore.kernel.org/r/20220705082637.59979-4-alexander.shishkin@l= inux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hwtracing/intel_th/msu.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/= msu.c index 70a07b4e9967..6c8215a47a60 100644 --- a/drivers/hwtracing/intel_th/msu.c +++ b/drivers/hwtracing/intel_th/msu.c @@ -1067,6 +1067,16 @@ msc_buffer_set_uc(struct msc *msc) {} static inline void msc_buffer_set_wb(struct msc *msc) {} #endif /* CONFIG_X86 */ =20 +static struct page *msc_sg_page(struct scatterlist *sg) +{ + void *addr =3D sg_virt(sg); + + if (is_vmalloc_addr(addr)) + return vmalloc_to_page(addr); + + return sg_page(sg); +} + /** * msc_buffer_win_alloc() - alloc a window for a multiblock mode * @msc: MSC device @@ -1137,7 +1147,7 @@ static void __msc_buffer_win_free(struct msc *msc, st= ruct msc_window *win) int i; =20 for_each_sg(win->sgt->sgl, sg, win->nr_segs, i) { - struct page *page =3D sg_page(sg); + struct page *page =3D msc_sg_page(sg); =20 page->mapping =3D NULL; dma_free_coherent(msc_dev(win->msc)->parent->parent, PAGE_SIZE, @@ -1401,7 +1411,7 @@ static struct page *msc_buffer_get_page(struct msc *m= sc, unsigned long pgoff) pgoff -=3D win->pgoff; =20 for_each_sg(win->sgt->sgl, sg, win->nr_segs, blk) { - struct page *page =3D sg_page(sg); + struct page *page =3D msc_sg_page(sg); size_t pgsz =3D PFN_DOWN(sg->length); =20 if (pgoff < pgsz) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13A0FC3F6B0 for ; Mon, 15 Aug 2022 22:03:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347021AbiHOWDj (ORCPT ); Mon, 15 Aug 2022 18:03:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348511AbiHOWBP (ORCPT ); Mon, 15 Aug 2022 18:01:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B42E26DADF; Mon, 15 Aug 2022 12:35:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D45C3B81136; Mon, 15 Aug 2022 19:35:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BA35C433D6; Mon, 15 Aug 2022 19:35:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592122; bh=Fm4OrmpyXmEg2khjH7fOWPAv6wsvk3GvL1nY1SfhlpM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2SZdownYZKAI7K3ddTeK7mIKRENMBp18r/AOZ1M7IQkV01wPuk/oaooHdNUJj1SE1 TgxGsYB+10tICLEyJAPkNUOh2I76gzZrh86x98FjM/1PwalGA0DomFhu0qLoaJt2TE WKzYwpTC9lz4dQ+uBiavXpG7tywI9Eb2cNB6TorI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Carlos Llamas , Sasha Levin Subject: [PATCH 5.18 0737/1095] binder: fix redefinition of seq_file attributes Date: Mon, 15 Aug 2022 20:02:16 +0200 Message-Id: <20220815180459.870190745@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Carlos Llamas [ Upstream commit b7e241bbff24f9e106bf616408fd58bcedc44bae ] The patchset in [1] exported some definitions to binder_internal.h in order to make the debugfs entries such as 'stats' and 'transaction_log' available in a binderfs instance. However, the DEFINE_SHOW_ATTRIBUTE macro expands into a static function/variable pair, which in turn get redefined each time a source file includes this internal header. This problem was made evident after a report from the kernel test robot where several W=3D1 build warnings are seen in downstream kernels. See the following example: include/../drivers/android/binder_internal.h:111:23: warning: 'binder_sta= ts_fops' defined but not used [-Wunused-const-variable=3D] 111 | DEFINE_SHOW_ATTRIBUTE(binder_stats); | ^~~~~~~~~~~~ include/linux/seq_file.h:174:37: note: in definition of macro 'DEFINE_SHO= W_ATTRIBUTE' 174 | static const struct file_operations __name ## _fops =3D { = \ | ^~~~~~ This patch fixes the above issues by moving back the definitions into binder.c and instead creates an array of the debugfs entries which is more convenient to share with binderfs and iterate through. [1] https://lore.kernel.org/all/20190903161655.107408-1-hridya@google.com/ Fixes: 0e13e452dafc ("binder: Add stats, state and transactions files") Fixes: 03e2e07e3814 ("binder: Make transaction_log available in binderfs") Reported-by: kernel test robot Signed-off-by: Carlos Llamas Link: https://lore.kernel.org/r/20220701182041.2134313-1-cmllamas@google.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/android/binder.c | 114 +++++++++++++++++++++--------- drivers/android/binder_internal.h | 46 +++--------- drivers/android/binderfs.c | 47 +++--------- 3 files changed, 100 insertions(+), 107 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index f3b639e89dd8..5243fe0eb402 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -170,8 +170,32 @@ static inline void binder_stats_created(enum binder_st= at_types type) atomic_inc(&binder_stats.obj_created[type]); } =20 -struct binder_transaction_log binder_transaction_log; -struct binder_transaction_log binder_transaction_log_failed; +struct binder_transaction_log_entry { + int debug_id; + int debug_id_done; + int call_type; + int from_proc; + int from_thread; + int target_handle; + int to_proc; + int to_thread; + int to_node; + int data_size; + int offsets_size; + int return_error_line; + uint32_t return_error; + uint32_t return_error_param; + char context_name[BINDERFS_MAX_NAME + 1]; +}; + +struct binder_transaction_log { + atomic_t cur; + bool full; + struct binder_transaction_log_entry entry[32]; +}; + +static struct binder_transaction_log binder_transaction_log; +static struct binder_transaction_log binder_transaction_log_failed; =20 static struct binder_transaction_log_entry *binder_transaction_log_add( struct binder_transaction_log *log) @@ -6084,8 +6108,7 @@ static void print_binder_proc_stats(struct seq_file *= m, print_binder_stats(m, " ", &proc->stats); } =20 - -int binder_state_show(struct seq_file *m, void *unused) +static int state_show(struct seq_file *m, void *unused) { struct binder_proc *proc; struct binder_node *node; @@ -6124,7 +6147,7 @@ int binder_state_show(struct seq_file *m, void *unuse= d) return 0; } =20 -int binder_stats_show(struct seq_file *m, void *unused) +static int stats_show(struct seq_file *m, void *unused) { struct binder_proc *proc; =20 @@ -6140,7 +6163,7 @@ int binder_stats_show(struct seq_file *m, void *unuse= d) return 0; } =20 -int binder_transactions_show(struct seq_file *m, void *unused) +static int transactions_show(struct seq_file *m, void *unused) { struct binder_proc *proc; =20 @@ -6196,7 +6219,7 @@ static void print_binder_transaction_log_entry(struct= seq_file *m, "\n" : " (incomplete)\n"); } =20 -int binder_transaction_log_show(struct seq_file *m, void *unused) +static int transaction_log_show(struct seq_file *m, void *unused) { struct binder_transaction_log *log =3D m->private; unsigned int log_cur =3D atomic_read(&log->cur); @@ -6228,6 +6251,45 @@ const struct file_operations binder_fops =3D { .release =3D binder_release, }; =20 +DEFINE_SHOW_ATTRIBUTE(state); +DEFINE_SHOW_ATTRIBUTE(stats); +DEFINE_SHOW_ATTRIBUTE(transactions); +DEFINE_SHOW_ATTRIBUTE(transaction_log); + +const struct binder_debugfs_entry binder_debugfs_entries[] =3D { + { + .name =3D "state", + .mode =3D 0444, + .fops =3D &state_fops, + .data =3D NULL, + }, + { + .name =3D "stats", + .mode =3D 0444, + .fops =3D &stats_fops, + .data =3D NULL, + }, + { + .name =3D "transactions", + .mode =3D 0444, + .fops =3D &transactions_fops, + .data =3D NULL, + }, + { + .name =3D "transaction_log", + .mode =3D 0444, + .fops =3D &transaction_log_fops, + .data =3D &binder_transaction_log, + }, + { + .name =3D "failed_transaction_log", + .mode =3D 0444, + .fops =3D &transaction_log_fops, + .data =3D &binder_transaction_log_failed, + }, + {} /* terminator */ +}; + static int __init init_binder_device(const char *name) { int ret; @@ -6273,36 +6335,18 @@ static int __init binder_init(void) atomic_set(&binder_transaction_log_failed.cur, ~0U); =20 binder_debugfs_dir_entry_root =3D debugfs_create_dir("binder", NULL); - if (binder_debugfs_dir_entry_root) + if (binder_debugfs_dir_entry_root) { + const struct binder_debugfs_entry *db_entry; + + binder_for_each_debugfs_entry(db_entry) + debugfs_create_file(db_entry->name, + db_entry->mode, + binder_debugfs_dir_entry_root, + db_entry->data, + db_entry->fops); + binder_debugfs_dir_entry_proc =3D debugfs_create_dir("proc", binder_debugfs_dir_entry_root); - - if (binder_debugfs_dir_entry_root) { - debugfs_create_file("state", - 0444, - binder_debugfs_dir_entry_root, - NULL, - &binder_state_fops); - debugfs_create_file("stats", - 0444, - binder_debugfs_dir_entry_root, - NULL, - &binder_stats_fops); - debugfs_create_file("transactions", - 0444, - binder_debugfs_dir_entry_root, - NULL, - &binder_transactions_fops); - debugfs_create_file("transaction_log", - 0444, - binder_debugfs_dir_entry_root, - &binder_transaction_log, - &binder_transaction_log_fops); - debugfs_create_file("failed_transaction_log", - 0444, - binder_debugfs_dir_entry_root, - &binder_transaction_log_failed, - &binder_transaction_log_fops); } =20 if (!IS_ENABLED(CONFIG_ANDROID_BINDERFS) && diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_int= ernal.h index d6b6b8cb7346..1ade9799c8d5 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -107,41 +107,19 @@ static inline int __init init_binderfs(void) } #endif =20 -int binder_stats_show(struct seq_file *m, void *unused); -DEFINE_SHOW_ATTRIBUTE(binder_stats); - -int binder_state_show(struct seq_file *m, void *unused); -DEFINE_SHOW_ATTRIBUTE(binder_state); - -int binder_transactions_show(struct seq_file *m, void *unused); -DEFINE_SHOW_ATTRIBUTE(binder_transactions); - -int binder_transaction_log_show(struct seq_file *m, void *unused); -DEFINE_SHOW_ATTRIBUTE(binder_transaction_log); - -struct binder_transaction_log_entry { - int debug_id; - int debug_id_done; - int call_type; - int from_proc; - int from_thread; - int target_handle; - int to_proc; - int to_thread; - int to_node; - int data_size; - int offsets_size; - int return_error_line; - uint32_t return_error; - uint32_t return_error_param; - char context_name[BINDERFS_MAX_NAME + 1]; +struct binder_debugfs_entry { + const char *name; + umode_t mode; + const struct file_operations *fops; + void *data; }; =20 -struct binder_transaction_log { - atomic_t cur; - bool full; - struct binder_transaction_log_entry entry[32]; -}; +extern const struct binder_debugfs_entry binder_debugfs_entries[]; + +#define binder_for_each_debugfs_entry(entry) \ + for ((entry) =3D binder_debugfs_entries; \ + (entry)->name; \ + (entry)++) =20 enum binder_stat_types { BINDER_STAT_PROC, @@ -575,6 +553,4 @@ struct binder_object { }; }; =20 -extern struct binder_transaction_log binder_transaction_log; -extern struct binder_transaction_log binder_transaction_log_failed; #endif /* _LINUX_BINDER_INTERNAL_H */ diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index e3605cdd4335..6d717ed76766 100644 --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c @@ -621,6 +621,7 @@ static int init_binder_features(struct super_block *sb) static int init_binder_logs(struct super_block *sb) { struct dentry *binder_logs_root_dir, *dentry, *proc_log_dir; + const struct binder_debugfs_entry *db_entry; struct binderfs_info *info; int ret =3D 0; =20 @@ -631,43 +632,15 @@ static int init_binder_logs(struct super_block *sb) goto out; } =20 - dentry =3D binderfs_create_file(binder_logs_root_dir, "stats", - &binder_stats_fops, NULL); - if (IS_ERR(dentry)) { - ret =3D PTR_ERR(dentry); - goto out; - } - - dentry =3D binderfs_create_file(binder_logs_root_dir, "state", - &binder_state_fops, NULL); - if (IS_ERR(dentry)) { - ret =3D PTR_ERR(dentry); - goto out; - } - - dentry =3D binderfs_create_file(binder_logs_root_dir, "transactions", - &binder_transactions_fops, NULL); - if (IS_ERR(dentry)) { - ret =3D PTR_ERR(dentry); - goto out; - } - - dentry =3D binderfs_create_file(binder_logs_root_dir, - "transaction_log", - &binder_transaction_log_fops, - &binder_transaction_log); - if (IS_ERR(dentry)) { - ret =3D PTR_ERR(dentry); - goto out; - } - - dentry =3D binderfs_create_file(binder_logs_root_dir, - "failed_transaction_log", - &binder_transaction_log_fops, - &binder_transaction_log_failed); - if (IS_ERR(dentry)) { - ret =3D PTR_ERR(dentry); - goto out; + binder_for_each_debugfs_entry(db_entry) { + dentry =3D binderfs_create_file(binder_logs_root_dir, + db_entry->name, + db_entry->fops, + db_entry->data); + if (IS_ERR(dentry)) { + ret =3D PTR_ERR(dentry); + goto out; + } } =20 proc_log_dir =3D binderfs_create_dir(binder_logs_root_dir, "proc"); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C37BC25B08 for ; Mon, 15 Aug 2022 22:03:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347322AbiHOWDR (ORCPT ); Mon, 15 Aug 2022 18:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348126AbiHOWBI (ORCPT ); Mon, 15 Aug 2022 18:01:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 726962F3AC; Mon, 15 Aug 2022 12:35:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3D90FB81141; Mon, 15 Aug 2022 19:35:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BC26C433D6; Mon, 15 Aug 2022 19:35:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592128; bh=5oMPweN0I2W52x3A3m4uwENFuyrekiGkA1YmNBlQqVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UKVCybwllNcIMfuQmNum8Io2r8MnJO1+l9MQOat5ubvfJ9SRgVT9YJm8z9yFsKkks +SQVsGuEuj03rX122SrSHkIrLu0S5I5dTDHwUsu7egVFod+dW1JHPtnNkR0hs57AjZ tT8zBiZAkQIH68ueU8+gWriTCtJ2Y/kzAZEODNL8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Duoming Zhou , Sasha Levin Subject: [PATCH 5.18 0738/1095] staging: rtl8192u: Fix sleep in atomic context bug in dm_fsync_timer_callback Date: Mon, 15 Aug 2022 20:02:17 +0200 Message-Id: <20220815180459.914144058@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Duoming Zhou [ Upstream commit 6a0c054930d554ad8f8044ef1fc856d9da391c81 ] There are sleep in atomic context bugs when dm_fsync_timer_callback is executing. The root cause is that the memory allocation functions with GFP_KERNEL or GFP_NOIO parameters are called in dm_fsync_timer_callback which is a timer handler. The call paths that could trigger bugs are shown below: (interrupt context) dm_fsync_timer_callback write_nic_byte kzalloc(sizeof(data), GFP_KERNEL); //may sleep usb_control_msg kmalloc(.., GFP_NOIO); //may sleep write_nic_dword kzalloc(sizeof(data), GFP_KERNEL); //may sleep usb_control_msg kmalloc(.., GFP_NOIO); //may sleep This patch uses delayed work to replace timer and moves the operations that may sleep into the delayed work in order to mitigate bugs. Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging") Signed-off-by: Duoming Zhou Link: https://lore.kernel.org/r/20220710103002.63283-1-duoming@zju.edu.cn Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/staging/rtl8192u/r8192U.h | 2 +- drivers/staging/rtl8192u/r8192U_dm.c | 38 +++++++++++++--------------- drivers/staging/rtl8192u/r8192U_dm.h | 2 +- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r= 8192U.h index 14ca00a2789b..1942cb849374 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1013,7 +1013,7 @@ typedef struct r8192_priv { bool bis_any_nonbepkts; bool bcurrent_turbo_EDCA; bool bis_cur_rdlstate; - struct timer_list fsync_timer; + struct delayed_work fsync_work; bool bfsync_processing; /* 500ms Fsync timer is active or not */ u32 rate_record; u32 rateCountDiffRecord; diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192= u/r8192U_dm.c index 725bf5ca9e34..0fcfcaa6500b 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -2578,19 +2578,20 @@ static void dm_init_fsync(struct net_device *dev) priv->ieee80211->fsync_seconddiff_ratethreshold =3D 200; priv->ieee80211->fsync_state =3D Default_Fsync; priv->framesyncMonitor =3D 1; /* current default 0xc38 monitor on */ - timer_setup(&priv->fsync_timer, dm_fsync_timer_callback, 0); + INIT_DELAYED_WORK(&priv->fsync_work, dm_fsync_work_callback); } =20 static void dm_deInit_fsync(struct net_device *dev) { struct r8192_priv *priv =3D ieee80211_priv(dev); =20 - del_timer_sync(&priv->fsync_timer); + cancel_delayed_work_sync(&priv->fsync_work); } =20 -void dm_fsync_timer_callback(struct timer_list *t) +void dm_fsync_work_callback(struct work_struct *work) { - struct r8192_priv *priv =3D from_timer(priv, t, fsync_timer); + struct r8192_priv *priv =3D + container_of(work, struct r8192_priv, fsync_work.work); struct net_device *dev =3D priv->ieee80211->dev; u32 rate_index, rate_count =3D 0, rate_count_diff =3D 0; bool bSwitchFromCountDiff =3D false; @@ -2657,17 +2658,16 @@ void dm_fsync_timer_callback(struct timer_list *t) } } if (bDoubleTimeInterval) { - if (timer_pending(&priv->fsync_timer)) - del_timer_sync(&priv->fsync_timer); - priv->fsync_timer.expires =3D jiffies + - msecs_to_jiffies(priv->ieee80211->fsync_time_interval*priv->ieee80211-= >fsync_multiple_timeinterval); - add_timer(&priv->fsync_timer); + cancel_delayed_work_sync(&priv->fsync_work); + schedule_delayed_work(&priv->fsync_work, + msecs_to_jiffies(priv + ->ieee80211->fsync_time_interval * + priv->ieee80211->fsync_multiple_timeinterval)); } else { - if (timer_pending(&priv->fsync_timer)) - del_timer_sync(&priv->fsync_timer); - priv->fsync_timer.expires =3D jiffies + - msecs_to_jiffies(priv->ieee80211->fsync_time_interval); - add_timer(&priv->fsync_timer); + cancel_delayed_work_sync(&priv->fsync_work); + schedule_delayed_work(&priv->fsync_work, + msecs_to_jiffies(priv + ->ieee80211->fsync_time_interval)); } } else { /* Let Register return to default value; */ @@ -2695,7 +2695,7 @@ static void dm_EndSWFsync(struct net_device *dev) struct r8192_priv *priv =3D ieee80211_priv(dev); =20 RT_TRACE(COMP_HALDM, "%s\n", __func__); - del_timer_sync(&(priv->fsync_timer)); + cancel_delayed_work_sync(&priv->fsync_work); =20 /* Let Register return to default value; */ if (priv->bswitch_fsync) { @@ -2736,11 +2736,9 @@ static void dm_StartSWFsync(struct net_device *dev) if (priv->ieee80211->fsync_rate_bitmap & rateBitmap) priv->rate_record +=3D priv->stats.received_rate_histogram[1][rateIndex= ]; } - if (timer_pending(&priv->fsync_timer)) - del_timer_sync(&priv->fsync_timer); - priv->fsync_timer.expires =3D jiffies + - msecs_to_jiffies(priv->ieee80211->fsync_time_interval); - add_timer(&priv->fsync_timer); + cancel_delayed_work_sync(&priv->fsync_work); + schedule_delayed_work(&priv->fsync_work, + msecs_to_jiffies(priv->ieee80211->fsync_time_interval)); =20 write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c12cd); } diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192= u/r8192U_dm.h index 0b2a1c688597..2159018b4e38 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.h +++ b/drivers/staging/rtl8192u/r8192U_dm.h @@ -166,7 +166,7 @@ void dm_force_tx_fw_info(struct net_device *dev, void dm_init_edca_turbo(struct net_device *dev); void dm_rf_operation_test_callback(unsigned long data); void dm_rf_pathcheck_workitemcallback(struct work_struct *work); -void dm_fsync_timer_callback(struct timer_list *t); +void dm_fsync_work_callback(struct work_struct *work); void dm_cck_txpower_adjust(struct net_device *dev, bool binch14); void dm_shadow_init(struct net_device *dev); void dm_initialize_txpower_tracking(struct net_device *dev); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D3BFC25B08 for ; Mon, 15 Aug 2022 22:03:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347252AbiHOWDL (ORCPT ); Mon, 15 Aug 2022 18:03:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347956AbiHOWA6 (ORCPT ); Mon, 15 Aug 2022 18:00:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B6A52ED6A; Mon, 15 Aug 2022 12:35:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6CABE6114B; Mon, 15 Aug 2022 19:35:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74D06C433D6; Mon, 15 Aug 2022 19:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592134; bh=Jrrwpx5iQuNpEFJqO6sMVwwy8PYagWRKnEgBRYZS9fU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lXnHVm72FtZ2HgRcjorLwardk7vmpuE/cACoCLonBSMWTXVPlXVup8lEGhAi8gBLu 8XPj17Hil3nLY8L/EHqzQNlzD19vQ95V9XnO7jbyxZ1Q3DBDsdPx7ANs8kTkAKLVZ1 /eia8ykGGHaTRflCRsau/M1h97q8twLN004XK5WI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, jianchunfu , Daniel Bristot de Oliveira , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.18 0739/1095] rtla/utils: Use calloc and check the potential memory allocation failure Date: Mon, 15 Aug 2022 20:02:18 +0200 Message-Id: <20220815180459.961331642@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: jianchunfu [ Upstream commit b5f37a0b6f667f5c72340ca9dcd7703f261cb981 ] Replace malloc with calloc and add memory allocating check of mon_cpus before used. Link: https://lkml.kernel.org/r/20220615073348.6891-1-jianchunfu@cmss.china= mobile.com Fixes: 7d0dc9576dc3 ("rtla/timerlat: Add --dma-latency option") Signed-off-by: jianchunfu Acked-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/tracing/rtla/src/utils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index 5352167a1e75..5ae2fa96fde1 100644 --- a/tools/tracing/rtla/src/utils.c +++ b/tools/tracing/rtla/src/utils.c @@ -106,8 +106,9 @@ int parse_cpu_list(char *cpu_list, char **monitored_cpu= s) =20 nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); =20 - mon_cpus =3D malloc(nr_cpus * sizeof(char)); - memset(mon_cpus, 0, (nr_cpus * sizeof(char))); + mon_cpus =3D calloc(nr_cpus, sizeof(char)); + if (!mon_cpus) + goto err; =20 for (p =3D cpu_list; *p; ) { cpu =3D atoi(p); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 292F9C25B08 for ; Mon, 15 Aug 2022 22:03:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347194AbiHOWDY (ORCPT ); Mon, 15 Aug 2022 18:03:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348239AbiHOWBK (ORCPT ); Mon, 15 Aug 2022 18:01:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C53994E61D; Mon, 15 Aug 2022 12:35:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8D4316111E; Mon, 15 Aug 2022 19:35:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A24EC433C1; Mon, 15 Aug 2022 19:35:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592141; bh=SY2E2wXYD56yvEtvgGm7t9vW1KbZ8dTo7tvk4SOguHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ovMfJUecB1geD2fFrUq1r9iNGL0Y7tyz+rZ/JGjI2KfOmwZHAuQnOjes5jCJk+XYC 4ShuTTm0+ZyM11OL1yufx2ME+2hNQHKqmFZgClRgSoiNX9wsuO3CZfY4Na2PnWF+hU MABX8I4nL5QYjOriGWEOeqWOq38funG8D1cpVorU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Ulf Hansson , Sasha Levin Subject: [PATCH 5.18 0740/1095] mmc: sdhci-of-esdhc: Fix refcount leak in esdhc_signal_voltage_switch Date: Mon, 15 Aug 2022 20:02:19 +0200 Message-Id: <20220815180459.996945325@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit b5899a3e2f783a27b268e38d37f9b24c71bddf45 ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. of_node_put() checks null pointer. Fixes: ea35645a3c66 ("mmc: sdhci-of-esdhc: add support for signal voltage s= witch") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220523144255.10310-1-linmq006@gmail.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mmc/host/sdhci-of-esdhc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-= esdhc.c index d9dc41143bb3..8b3d8119f388 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -904,6 +904,7 @@ static int esdhc_signal_voltage_switch(struct mmc_host = *mmc, scfg_node =3D of_find_matching_node(NULL, scfg_device_ids); if (scfg_node) scfg_base =3D of_iomap(scfg_node, 0); + of_node_put(scfg_node); if (scfg_base) { sdhciovselcr =3D SDHCIOVSELCR_TGLEN | SDHCIOVSELCR_VSELVAL; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 608C6C00140 for ; Mon, 15 Aug 2022 22:03:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347583AbiHOWDp (ORCPT ); Mon, 15 Aug 2022 18:03:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348552AbiHOWBR (ORCPT ); Mon, 15 Aug 2022 18:01:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C751A8277A; Mon, 15 Aug 2022 12:35:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 991E56114B; Mon, 15 Aug 2022 19:35:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98152C433D6; Mon, 15 Aug 2022 19:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592147; bh=DjhUQ8cm8P60U+l9dj6IIm427jOlJO/2HHQIDVr5GKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ytorR74/mMZZcy6mdoqNP6htQPS3BSPflVs8SJcJ3EolcS3k2ZYD21uQBQUeuO0SS AleKEGpldgBINKyII+/1itiygYoThp/4J2uDjRvsETx3QhOO9YF4agZ0zv+iqFAKB4 807gNvCgbM2jhqgYVRmdWHNDLsp1v93SgQCY8hs0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Fabio Estevam , Ulf Hansson , Sasha Levin Subject: [PATCH 5.18 0741/1095] mmc: mxcmmc: Silence a clang warning Date: Mon, 15 Aug 2022 20:02:20 +0200 Message-Id: <20220815180500.028237189@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabio Estevam [ Upstream commit 7dc65e3c0ef4b746a583b7c58f99873fddf5ccfa ] Change the of_device_get_match_data() cast to (uintptr_t) to silence the following clang warning: drivers/mmc/host/mxcmmc.c:1028:18: warning: cast to smaller integer type 'e= num mxcmci_type' from 'const void *' [-Wvoid-pointer-to-enum-cast] Reported-by: kernel test robot Fixes: 8223e885e74b ("mmc: mxc: Convert the driver to DT-only") Signed-off-by: Fabio Estevam Link: https://lore.kernel.org/r/20220526010022.1163483-1-festevam@gmail.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mmc/host/mxcmmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c index 40b6878bea6c..b5940083a108 100644 --- a/drivers/mmc/host/mxcmmc.c +++ b/drivers/mmc/host/mxcmmc.c @@ -1025,7 +1025,7 @@ static int mxcmci_probe(struct platform_device *pdev) mmc->max_req_size =3D mmc->max_blk_size * mmc->max_blk_count; mmc->max_seg_size =3D mmc->max_req_size; =20 - host->devtype =3D (enum mxcmci_type)of_device_get_match_data(&pdev->dev); + host->devtype =3D (uintptr_t)of_device_get_match_data(&pdev->dev); =20 /* adjust max_segs after devtype detection */ if (!is_mpc512x_mmc(host)) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75EC3C25B08 for ; Mon, 15 Aug 2022 22:04:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346755AbiHOWEC (ORCPT ); Mon, 15 Aug 2022 18:04:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349705AbiHOWBj (ORCPT ); Mon, 15 Aug 2022 18:01:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 629DD111C2B; Mon, 15 Aug 2022 12:35:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 40C16B80EA7; Mon, 15 Aug 2022 19:35:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DD04C433C1; Mon, 15 Aug 2022 19:35:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592155; bh=n8kGDEThAQHhugP3eQZrg2pbr2WIP20ZO2NAN93hyeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mjLHHk5dYGxvfkNqxF5SmuzepBOaSMxoDT2Zu72+lae5xPMz+Xbyx8j1UYqwUn3lH wP400IVR27wRslv/r+0Hdhij53U4MrC0o9ioE5I5nlcTG1nP2P35/txsi47e+VIe6C QwsJuf9pvqpjeHqSvzjEFalVxo9OmjVwFpDeS83g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Machek , Lad Prabhakar , Geert Uytterhoeven , Wolfram Sang , Ulf Hansson , Sasha Levin Subject: [PATCH 5.18 0742/1095] mmc: renesas_sdhi: Get the reset handle early in the probe Date: Mon, 15 Aug 2022 20:02:21 +0200 Message-Id: <20220815180500.060476774@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar [ Upstream commit 0dac1e498f8130fdacfdd5289e3a7ac87ec1b9ad ] In case of devm_reset_control_get_optional_exclusive() failure we returned directly instead of jumping to the error path to roll back initialization. This patch moves devm_reset_control_get_optional_exclusive() early in the probe so that we have the reset handle prior to initialization of the hardware. Fixes: b4d86f37eacb7 ("mmc: renesas_sdhi: do hard reset if possible") Reported-by: Pavel Machek Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Link: https://lore.kernel.org/r/20220624181438.4355-2-prabhakar.mahadev-lad= .rj@bp.renesas.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mmc/host/renesas_sdhi_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesa= s_sdhi_core.c index ddb5ca2f559e..4fb49306275e 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -940,6 +940,10 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (IS_ERR(priv->clk_cd)) return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk_cd), "cannot get cd c= lock"); =20 + priv->rstc =3D devm_reset_control_get_optional_exclusive(&pdev->dev, NULL= ); + if (IS_ERR(priv->rstc)) + return PTR_ERR(priv->rstc); + priv->pinctrl =3D devm_pinctrl_get(&pdev->dev); if (!IS_ERR(priv->pinctrl)) { priv->pins_default =3D pinctrl_lookup_state(priv->pinctrl, @@ -1032,10 +1036,6 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (ret) goto efree; =20 - priv->rstc =3D devm_reset_control_get_optional_exclusive(&pdev->dev, NULL= ); - if (IS_ERR(priv->rstc)) - return PTR_ERR(priv->rstc); - ver =3D sd_ctrl_read16(host, CTL_VERSION); /* GEN2_SDR104 is first known SDHI to use 32bit block count */ if (ver < SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count > U16_MAX) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA561C19F2C for ; Mon, 15 Aug 2022 22:04:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245479AbiHOWEd (ORCPT ); Mon, 15 Aug 2022 18:04:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350086AbiHOWBv (ORCPT ); Mon, 15 Aug 2022 18:01:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0C29112FB6; Mon, 15 Aug 2022 12:36:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A1511B81142; Mon, 15 Aug 2022 19:36:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7922FC433D6; Mon, 15 Aug 2022 19:36:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592162; bh=wp7hdPxu6ia6rtSa1iMl9K8eSmzVjZoytHNlJt9raVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X0mLnWk0iCnBUUVkqG+a4MXzt1XWF560H/sjVRhn2xog4CWUZEZ4GveteevGfjBN7 3lRnSNBc/WIDvHvzA76gDyUUa3K/gPZ5Y1u41pjt9glyATJV+tZZgSKvJejDJntm+j kFYe98+fDLSoTemx1boBqimW5aMRrl3hvDEM1ZwY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Ulf Hansson , Sasha Levin Subject: [PATCH 5.18 0743/1095] memstick/ms_block: Fix some incorrect memory allocation Date: Mon, 15 Aug 2022 20:02:22 +0200 Message-Id: <20220815180500.110410011@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 2e531bc3e0d86362fcd8a577b3278d9ef3cc2ba0 ] Some functions of the bitmap API take advantage of the fact that a bitmap is an array of long. So, to make sure this assertion is correct, allocate bitmaps with bitmap_zalloc() instead of kzalloc()+hand-computed number of bytes. While at it, also use bitmap_free() instead of kfree() to keep the semantic. Fixes: 0ab30494bc4f ("memstick: add support for legacy memorysticks") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/dbf633c48c24ae6d95f852557e8d8b3bbdef65fe.16= 56155715.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/memstick/core/ms_block.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_bl= ock.c index 3993bdd4b519..f8f151163667 100644 --- a/drivers/memstick/core/ms_block.c +++ b/drivers/memstick/core/ms_block.c @@ -1341,17 +1341,17 @@ static int msb_ftl_initialize(struct msb_data *msb) msb->zone_count =3D msb->block_count / MS_BLOCKS_IN_ZONE; msb->logical_block_count =3D msb->zone_count * 496 - 2; =20 - msb->used_blocks_bitmap =3D kzalloc(msb->block_count / 8, GFP_KERNEL); - msb->erased_blocks_bitmap =3D kzalloc(msb->block_count / 8, GFP_KERNEL); + msb->used_blocks_bitmap =3D bitmap_zalloc(msb->block_count, GFP_KERNEL); + msb->erased_blocks_bitmap =3D bitmap_zalloc(msb->block_count, GFP_KERNEL); msb->lba_to_pba_table =3D kmalloc_array(msb->logical_block_count, sizeof(u16), GFP_KERNEL); =20 if (!msb->used_blocks_bitmap || !msb->lba_to_pba_table || !msb->erased_blocks_bitmap) { - kfree(msb->used_blocks_bitmap); + bitmap_free(msb->used_blocks_bitmap); + bitmap_free(msb->erased_blocks_bitmap); kfree(msb->lba_to_pba_table); - kfree(msb->erased_blocks_bitmap); return -ENOMEM; } =20 @@ -1946,7 +1946,7 @@ static DEFINE_MUTEX(msb_disk_lock); /* protects again= st races in open/release */ static void msb_data_clear(struct msb_data *msb) { kfree(msb->boot_page); - kfree(msb->used_blocks_bitmap); + bitmap_free(msb->used_blocks_bitmap); kfree(msb->lba_to_pba_table); kfree(msb->cache); msb->card =3D NULL; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1CF4C00140 for ; Mon, 15 Aug 2022 22:05:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347394AbiHOWFF (ORCPT ); Mon, 15 Aug 2022 18:05:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350190AbiHOWBy (ORCPT ); Mon, 15 Aug 2022 18:01:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F13E0113682; Mon, 15 Aug 2022 12:36:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D2834B81136; Mon, 15 Aug 2022 19:36:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B29CC43470; Mon, 15 Aug 2022 19:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592168; bh=WInj4pOrN2LEbYBEShrOBHF7IyqIhqtVGRwA7OG/tBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xpGEggu1uTwAiA0V37ZK5pSSQaFzkqYLYZ42MduTNPY3D+Tb00NEFsZ632Ddkjcyh Hk0dLVQcYsGt6CCE6dYig3HHyYueVtKcqgXfnFnzkBhMhL7GWEIuo+WUlVZEHMtdXA Flt3H7aheG1zbHurNfYuIQZnmg2x6Zmw52bpWiR0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Ulf Hansson , Sasha Levin Subject: [PATCH 5.18 0744/1095] memstick/ms_block: Fix a memory leak Date: Mon, 15 Aug 2022 20:02:23 +0200 Message-Id: <20220815180500.140907842@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 54eb7a55be6779c4d0c25eaf5056498a28595049 ] 'erased_blocks_bitmap' is never freed. As it is allocated at the same time as 'used_blocks_bitmap', it is likely that it should be freed also at the same time. Add the corresponding bitmap_free() in msb_data_clear(). Fixes: 0ab30494bc4f ("memstick: add support for legacy memorysticks") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/b3b78926569445962ea5c3b6e9102418a9effb88.16= 56155715.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/memstick/core/ms_block.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_bl= ock.c index f8f151163667..f8fdf88fb240 100644 --- a/drivers/memstick/core/ms_block.c +++ b/drivers/memstick/core/ms_block.c @@ -1947,6 +1947,7 @@ static void msb_data_clear(struct msb_data *msb) { kfree(msb->boot_page); bitmap_free(msb->used_blocks_bitmap); + bitmap_free(msb->erased_blocks_bitmap); kfree(msb->lba_to_pba_table); kfree(msb->cache); msb->card =3D NULL; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0A06C3F6B0 for ; Mon, 15 Aug 2022 22:06:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348046AbiHOWFl (ORCPT ); Mon, 15 Aug 2022 18:05:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350234AbiHOWB4 (ORCPT ); Mon, 15 Aug 2022 18:01:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A38C0111C1E; Mon, 15 Aug 2022 12:36:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3BD46610A5; Mon, 15 Aug 2022 19:36:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41435C433C1; Mon, 15 Aug 2022 19:36:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592174; bh=AQlbLQG1Rst+iVGp1L5JuWGaw0Df5Bq56jooUFeZpOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FnYH57SDXD6OX+zGWmpF5wD+SHGX2byXXjMtUSKXU2vddlBx8d9VyxS1RwiTM/tO9 +3B7t4M6/a+/U/VjaPmG50i2iwdY5Bpn4o5E52LP5dXdihFlDifJ6p9r0Lim2U73lW Ip0INdv1VpsFcGyz3bnMiA/OReDuUK+4vzetZAyI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eugen Hristev , Karl Olsen , Adrian Hunter , Ulf Hansson , Sasha Levin Subject: [PATCH 5.18 0745/1095] mmc: sdhci-of-at91: fix set_uhs_signaling rewriting of MC1R Date: Mon, 15 Aug 2022 20:02:24 +0200 Message-Id: <20220815180500.177864163@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eugen Hristev [ Upstream commit 5987e6ded29d52e42fc7b06aa575c60a25eee38e ] In set_uhs_signaling, the DDR bit is being set by fully writing the MC1R register. This can lead to accidental erase of certain bits in this register. Avoid this by doing a read-modify-write operation. Fixes: d0918764c17b ("mmc: sdhci-of-at91: fix MMC_DDR_52 timing selection") Signed-off-by: Eugen Hristev Tested-by: Karl Olsen Acked-by: Adrian Hunter Link: https://lore.kernel.org/r/20220630090926.15061-1-eugen.hristev@microc= hip.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mmc/host/sdhci-of-at91.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-a= t91.c index 10fb4cb2c731..cd0134580a90 100644 --- a/drivers/mmc/host/sdhci-of-at91.c +++ b/drivers/mmc/host/sdhci-of-at91.c @@ -100,8 +100,13 @@ static void sdhci_at91_set_clock(struct sdhci_host *ho= st, unsigned int clock) static void sdhci_at91_set_uhs_signaling(struct sdhci_host *host, unsigned int timing) { - if (timing =3D=3D MMC_TIMING_MMC_DDR52) - sdhci_writeb(host, SDMMC_MC1R_DDR, SDMMC_MC1R); + u8 mc1r; + + if (timing =3D=3D MMC_TIMING_MMC_DDR52) { + mc1r =3D sdhci_readb(host, SDMMC_MC1R); + mc1r |=3D SDMMC_MC1R_DDR; + sdhci_writeb(host, mc1r, SDMMC_MC1R); + } sdhci_set_uhs_signaling(host, timing); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96C95C25B08 for ; Mon, 15 Aug 2022 22:06:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244606AbiHOWGp (ORCPT ); Mon, 15 Aug 2022 18:06:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350354AbiHOWCD (ORCPT ); Mon, 15 Aug 2022 18:02:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36A51E8E; Mon, 15 Aug 2022 12:36:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D9D42B80EA9; Mon, 15 Aug 2022 19:36:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42DB3C433D6; Mon, 15 Aug 2022 19:36:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592180; bh=4Qx3TpTzRNC8GP0eSyB6JcW988m841SDnRGg73iCp10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kiU9NHuQksr8P+RI1nVwhwWdnU1WPcW0p5uc4rbaITaMaz1FEW+Lq0q9MfPBVHrzo sk1irWzpVUFcgWRbAzh25nCkqXkErZ77gVicmG2kqiG7kQcJ0OuxsPr+Tn7fxMHbbW kGjHgCHez94YcVttJxtKggsNtCNY5iCZX+mHKf/A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Rob Herring , Sasha Levin , Miaoqian Lin Subject: [PATCH 5.18 0746/1095] of: device: Fix missing of_node_put() in of_dma_set_restricted_buffer Date: Mon, 15 Aug 2022 20:02:25 +0200 Message-Id: <20220815180500.216731535@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit d17e37c41b7ed38459957a5d2968ba61516fd5c2 ] We should use of_node_put() for the reference 'node' returned by of_parse_phandle() which will increase the refcount. Fixes: fec9b625095f ("of: Add plumbing for restricted DMA pool") Co-authored-by: Miaoqian Lin Signed-off-by: Liang He Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20220702014449.263772-1-windhl@126.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/of/device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/of/device.c b/drivers/of/device.c index 874f031442dc..75b6cbffa755 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -81,8 +81,11 @@ of_dma_set_restricted_buffer(struct device *dev, struct = device_node *np) * restricted-dma-pool region is allowed. */ if (of_device_is_compatible(node, "restricted-dma-pool") && - of_device_is_available(node)) + of_device_is_available(node)) { + of_node_put(node); break; + } + of_node_put(node); } =20 /* --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20DF0C19F2C for ; Mon, 15 Aug 2022 22:07:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244405AbiHOWHk (ORCPT ); Mon, 15 Aug 2022 18:07:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350404AbiHOWCF (ORCPT ); Mon, 15 Aug 2022 18:02:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 684371DA78; Mon, 15 Aug 2022 12:36:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0601C6113B; Mon, 15 Aug 2022 19:36:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAE5CC433D6; Mon, 15 Aug 2022 19:36:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592190; bh=weT2Jgo6SU7o7Tg5tLuNruMypYiqKj6ujCT9fI1psWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ULFcpy/pu5eJWeE19rMh0CBbTQzpqD8OBAfQG8jDuXi4GwgrrNdq/aD6UYt2K/Q/v DUysYCmH4iWYrvYS3w6fuecdQceFtjjHHTYaoTHYsahPxddwWpLTWvraP+WxXZcJb0 eszdiLRb8Bt5KMYTimMrFgtpb++HN7a0HNEiCy9o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Loehle , Adrian Hunter , Avri Altman , Ulf Hansson , Sasha Levin Subject: [PATCH 5.18 0747/1095] mmc: block: Add single read for 4k sector cards Date: Mon, 15 Aug 2022 20:02:26 +0200 Message-Id: <20220815180500.256068333@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Loehle [ Upstream commit b3fa3e6dccc465969721b8bd2824213bd235efeb ] Cards with 4k native sector size may only be read 4k-aligned, accommodate for this in the single read recovery and use it. Fixes: 81196976ed946 (mmc: block: Add blk-mq support) Signed-off-by: Christian Loehle Acked-by: Adrian Hunter Reviewed-by: Avri Altman Link: https://lore.kernel.org/r/cf4f316274c5474586d0d99b17db4a4c@hyperstone= .com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mmc/core/block.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 23fcb7a16605..0b8d3d25ba7a 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -175,7 +175,7 @@ static inline int mmc_blk_part_switch(struct mmc_card *= card, unsigned int part_type); static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, struct mmc_card *card, - int disable_multi, + int recovery_mode, struct mmc_queue *mq); static void mmc_blk_hsq_req_done(struct mmc_request *mrq); =20 @@ -1285,7 +1285,7 @@ static void mmc_blk_eval_resp_error(struct mmc_blk_re= quest *brq) } =20 static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *= mqrq, - int disable_multi, bool *do_rel_wr_p, + int recovery_mode, bool *do_rel_wr_p, bool *do_data_tag_p) { struct mmc_blk_data *md =3D mq->blkdata; @@ -1351,12 +1351,12 @@ static void mmc_blk_data_prep(struct mmc_queue *mq,= struct mmc_queue_req *mqrq, brq->data.blocks--; =20 /* - * After a read error, we redo the request one sector + * After a read error, we redo the request one (native) sector * at a time in order to accurately determine which * sectors can be read successfully. */ - if (disable_multi) - brq->data.blocks =3D 1; + if (recovery_mode) + brq->data.blocks =3D queue_physical_block_size(mq->queue) >> 9; =20 /* * Some controllers have HW issues while operating @@ -1573,7 +1573,7 @@ static int mmc_blk_cqe_issue_rw_rq(struct mmc_queue *= mq, struct request *req) =20 static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, struct mmc_card *card, - int disable_multi, + int recovery_mode, struct mmc_queue *mq) { u32 readcmd, writecmd; @@ -1582,7 +1582,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *= mqrq, struct mmc_blk_data *md =3D mq->blkdata; bool do_rel_wr, do_data_tag; =20 - mmc_blk_data_prep(mq, mqrq, disable_multi, &do_rel_wr, &do_data_tag); + mmc_blk_data_prep(mq, mqrq, recovery_mode, &do_rel_wr, &do_data_tag); =20 brq->mrq.cmd =3D &brq->cmd; =20 @@ -1673,7 +1673,7 @@ static int mmc_blk_fix_state(struct mmc_card *card, s= truct request *req) =20 #define MMC_READ_SINGLE_RETRIES 2 =20 -/* Single sector read during recovery */ +/* Single (native) sector read during recovery */ static void mmc_blk_read_single(struct mmc_queue *mq, struct request *req) { struct mmc_queue_req *mqrq =3D req_to_mmc_queue_req(req); @@ -1681,6 +1681,7 @@ static void mmc_blk_read_single(struct mmc_queue *mq,= struct request *req) struct mmc_card *card =3D mq->card; struct mmc_host *host =3D card->host; blk_status_t error =3D BLK_STS_OK; + size_t bytes_per_read =3D queue_physical_block_size(mq->queue); =20 do { u32 status; @@ -1715,13 +1716,13 @@ static void mmc_blk_read_single(struct mmc_queue *m= q, struct request *req) else error =3D BLK_STS_OK; =20 - } while (blk_update_request(req, error, 512)); + } while (blk_update_request(req, error, bytes_per_read)); =20 return; =20 error_exit: mrq->data->bytes_xfered =3D 0; - blk_update_request(req, BLK_STS_IOERR, 512); + blk_update_request(req, BLK_STS_IOERR, bytes_per_read); /* Let it try the remaining request again */ if (mqrq->retries > MMC_MAX_RETRIES - 1) mqrq->retries =3D MMC_MAX_RETRIES - 1; @@ -1862,10 +1863,9 @@ static void mmc_blk_mq_rw_recovery(struct mmc_queue = *mq, struct request *req) return; } =20 - /* FIXME: Missing single sector read for large sector size */ - if (!mmc_large_sector(card) && rq_data_dir(req) =3D=3D READ && - brq->data.blocks > 1) { - /* Read one sector at a time */ + if (rq_data_dir(req) =3D=3D READ && brq->data.blocks > + queue_physical_block_size(mq->queue) >> 9) { + /* Read one (native) sector at a time */ mmc_blk_read_single(mq, req); return; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88D40C00140 for ; Mon, 15 Aug 2022 22:07:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344092AbiHOWHZ (ORCPT ); Mon, 15 Aug 2022 18:07:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350421AbiHOWCG (ORCPT ); Mon, 15 Aug 2022 18:02:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE02627CCE; Mon, 15 Aug 2022 12:36:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5C614610A5; Mon, 15 Aug 2022 19:36:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65DB3C433C1; Mon, 15 Aug 2022 19:36:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592196; bh=JWKploH5ZXiF/mEx7xgqrDToPZDgKAMm4bwSmyYeTTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m33XUKT3RlwTOvY+P/5UA4YjhlCh6k6Egh6nw6Jlfx0g6GcuuvK++trkUCp8Lf6Vr wE6bg1lohKVVbRZKJkvKGmShnOCA3tHAzm0EjTxVnh4uHPqOmC42NlLCVA/guPSqFL S7BBS3v3ndiopeyaQWb4mZjlxA/k4ecWdstkELu4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudio Imbrenda , Janosch Frank , Sasha Levin Subject: [PATCH 5.18 0748/1095] KVM: s390: pv: leak the topmost page table when destroy fails Date: Mon, 15 Aug 2022 20:02:27 +0200 Message-Id: <20220815180500.303645592@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Claudio Imbrenda [ Upstream commit faa2f72cb3569256480c5540d242c84e99965160 ] Each secure guest must have a unique ASCE (address space control element); we must avoid that new guests use the same page for their ASCE, to avoid errors. Since the ASCE mostly consists of the address of the topmost page table (plus some flags), we must not return that memory to the pool unless the ASCE is no longer in use. Only a successful Destroy Secure Configuration UVC will make the ASCE reusable again. If the Destroy Configuration UVC fails, the ASCE cannot be reused for a secure guest (either for the ASCE or for other memory areas). To avoid a collision, it must not be used again. This is a permanent error and the page becomes in practice unusable, so we set it aside and leak it. On failure we already leak other memory that belongs to the ultravisor (i.e. the variable and base storage for a guest) and not leaking the topmost page table was an oversight. This error (and thus the leakage) should not happen unless the hardware is broken or KVM has some unknown serious bug. Signed-off-by: Claudio Imbrenda Fixes: 29b40f105ec8d55 ("KVM: s390: protvirt: Add initial vm and cpu lifecy= cle handling") Reviewed-by: Janosch Frank Link: https://lore.kernel.org/r/20220628135619.32410-2-imbrenda@linux.ibm.c= om Message-Id: <20220628135619.32410-2-imbrenda@linux.ibm.com> Signed-off-by: Janosch Frank Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/s390/include/asm/gmap.h | 2 + arch/s390/kvm/pv.c | 9 ++-- arch/s390/mm/gmap.c | 86 ++++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 3 deletions(-) diff --git a/arch/s390/include/asm/gmap.h b/arch/s390/include/asm/gmap.h index 40264f60b0da..f4073106e1f3 100644 --- a/arch/s390/include/asm/gmap.h +++ b/arch/s390/include/asm/gmap.h @@ -148,4 +148,6 @@ void gmap_sync_dirty_log_pmd(struct gmap *gmap, unsigne= d long dirty_bitmap[4], unsigned long gaddr, unsigned long vmaddr); int gmap_mark_unmergeable(void); void s390_reset_acc(struct mm_struct *mm); +void s390_unlist_old_asce(struct gmap *gmap); +int s390_replace_asce(struct gmap *gmap); #endif /* _ASM_S390_GMAP_H */ diff --git a/arch/s390/kvm/pv.c b/arch/s390/kvm/pv.c index cc7c9599f43e..8eee3fc414e5 100644 --- a/arch/s390/kvm/pv.c +++ b/arch/s390/kvm/pv.c @@ -161,10 +161,13 @@ int kvm_s390_pv_deinit_vm(struct kvm *kvm, u16 *rc, u= 16 *rrc) atomic_set(&kvm->mm->context.is_protected, 0); KVM_UV_EVENT(kvm, 3, "PROTVIRT DESTROY VM: rc %x rrc %x", *rc, *rrc); WARN_ONCE(cc, "protvirt destroy vm failed rc %x rrc %x", *rc, *rrc); - /* Inteded memory leak on "impossible" error */ - if (!cc) + /* Intended memory leak on "impossible" error */ + if (!cc) { kvm_s390_pv_dealloc_vm(kvm); - return cc ? -EIO : 0; + return 0; + } + s390_replace_asce(kvm->arch.gmap); + return -EIO; } =20 int kvm_s390_pv_init_vm(struct kvm *kvm, u16 *rc, u16 *rrc) diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c index b8ae4a4aa2ba..85cab61d87a9 100644 --- a/arch/s390/mm/gmap.c +++ b/arch/s390/mm/gmap.c @@ -2735,3 +2735,89 @@ void s390_reset_acc(struct mm_struct *mm) mmput(mm); } EXPORT_SYMBOL_GPL(s390_reset_acc); + +/** + * s390_unlist_old_asce - Remove the topmost level of page tables from the + * list of page tables of the gmap. + * @gmap: the gmap whose table is to be removed + * + * On s390x, KVM keeps a list of all pages containing the page tables of t= he + * gmap (the CRST list). This list is used at tear down time to free all + * pages that are now not needed anymore. + * + * This function removes the topmost page of the tree (the one pointed to = by + * the ASCE) from the CRST list. + * + * This means that it will not be freed when the VM is torn down, and needs + * to be handled separately by the caller, unless a leak is actually + * intended. Notice that this function will only remove the page from the + * list, the page will still be used as a top level page table (and ASCE). + */ +void s390_unlist_old_asce(struct gmap *gmap) +{ + struct page *old; + + old =3D virt_to_page(gmap->table); + spin_lock(&gmap->guest_table_lock); + list_del(&old->lru); + /* + * Sometimes the topmost page might need to be "removed" multiple + * times, for example if the VM is rebooted into secure mode several + * times concurrently, or if s390_replace_asce fails after calling + * s390_remove_old_asce and is attempted again later. In that case + * the old asce has been removed from the list, and therefore it + * will not be freed when the VM terminates, but the ASCE is still + * in use and still pointed to. + * A subsequent call to replace_asce will follow the pointer and try + * to remove the same page from the list again. + * Therefore it's necessary that the page of the ASCE has valid + * pointers, so list_del can work (and do nothing) without + * dereferencing stale or invalid pointers. + */ + INIT_LIST_HEAD(&old->lru); + spin_unlock(&gmap->guest_table_lock); +} +EXPORT_SYMBOL_GPL(s390_unlist_old_asce); + +/** + * s390_replace_asce - Try to replace the current ASCE of a gmap with a co= py + * @gmap: the gmap whose ASCE needs to be replaced + * + * If the allocation of the new top level page table fails, the ASCE is not + * replaced. + * In any case, the old ASCE is always removed from the gmap CRST list. + * Therefore the caller has to make sure to save a pointer to it + * beforehand, unless a leak is actually intended. + */ +int s390_replace_asce(struct gmap *gmap) +{ + unsigned long asce; + struct page *page; + void *table; + + s390_unlist_old_asce(gmap); + + page =3D alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!page) + return -ENOMEM; + table =3D page_to_virt(page); + memcpy(table, gmap->table, 1UL << (CRST_ALLOC_ORDER + PAGE_SHIFT)); + + /* + * The caller has to deal with the old ASCE, but here we make sure + * the new one is properly added to the CRST list, so that + * it will be freed when the VM is torn down. + */ + spin_lock(&gmap->guest_table_lock); + list_add(&page->lru, &gmap->crst_list); + spin_unlock(&gmap->guest_table_lock); + + /* Set new table origin while preserving existing ASCE control bits */ + asce =3D (gmap->asce & ~_ASCE_ORIGIN) | __pa(table); + WRITE_ONCE(gmap->asce, asce); + WRITE_ONCE(gmap->mm->context.gmap_asce, asce); + WRITE_ONCE(gmap->table, table); + + return 0; +} +EXPORT_SYMBOL_GPL(s390_replace_asce); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA855C00140 for ; Mon, 15 Aug 2022 22:07:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245112AbiHOWHM (ORCPT ); Mon, 15 Aug 2022 18:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350434AbiHOWCI (ORCPT ); Mon, 15 Aug 2022 18:02:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3CA72F672; Mon, 15 Aug 2022 12:36:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 80E146115A; Mon, 15 Aug 2022 19:36:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BB49C433D6; Mon, 15 Aug 2022 19:36:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592202; bh=TSsNCgelctt+58xqKftZUVvkb58cH3/mqhqsM63/6wk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=br4sYLf+gjHNdw5/XyZVgmeNXfMjnPUAMuzkGBiUn2IRbi4DgQWwA9K/UoP3Gxm+Y rJYSM8SvcYCJmPPtOPMT23P150IfjDG/CvToS8vZHYj2XkIQ+AT7LZJxgw2sjR9CcL FXDh2oYCq46LBu7t3Ez4bgWQzyJl/HOeYV5HARNY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Roese , Bjorn Helgaas , =?UTF-8?q?Pali=20Roh=C3=A1r?= , "Rafael J. Wysocki" , Bharat Kumar Gogada , Michal Simek , Yao Hongbo , Naveen Naidu , Sasha Levin Subject: [PATCH 5.18 0749/1095] PCI/portdrv: Dont disable AER reporting in get_port_device_capability() Date: Mon, 15 Aug 2022 20:02:28 +0200 Message-Id: <20220815180500.336028966@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefan Roese [ Upstream commit 8795e182b02dc87e343c79e73af6b8b7f9c5e635 ] AER reporting is currently disabled in the DevCtl registers of all non Root Port PCIe devices on systems using pcie_ports_native || host->native_aer, disabling AER completely in such systems. This is because 2bd50dd800b5 ("PCI: PCIe: Disable PCIe port services during port initialization"), added a call to pci_disable_pcie_error_reporting() *after* the AER setup was completed for the PCIe device tree. Here a longer analysis about the current status of AER enabling / disabling upon bootup provided by Bjorn: pcie_portdrv_probe pcie_port_device_register get_port_device_capability pci_disable_pcie_error_reporting clear CERE NFERE FERE URRE # <-- disable for RP USP= DSP pcie_device_init device_register # new AER service device aer_probe aer_enable_rootport # RP only set_downstream_devices_error_reporting set_device_error_reporting # self (RP) if (RP || USP || DSP) pci_enable_pcie_error_reporting set CERE NFERE FERE URRE # <-- enable for RP pci_walk_bus set_device_error_reporting if (RP || USP || DSP) pci_enable_pcie_error_reporting set CERE NFERE FERE URRE # <-- enable for USP DSP In a typical Root Port -> Endpoint hierarchy, the above: - Disables Error Reporting for the Root Port, - Enables Error Reporting for the Root Port, - Does NOT enable Error Reporting for the Endpoint because it is not a Root Port or Switch Port. In a deeper Root Port -> Upstream Switch Port -> Downstream Switch Port -> Endpoint hierarchy: - Disables Error Reporting for the Root Port, - Enables Error Reporting for the Root Port, - Enables Error Reporting for both Switch Ports, - Does NOT enable Error Reporting for the Endpoint because it is not a Root Port or Switch Port, - Disables Error Reporting for the Switch Ports when pcie_portdrv_probe() claims them. AER does not re-enable it because these are not Root Ports. Remove this call to pci_disable_pcie_error_reporting() from get_port_device_capability(), leaving the already enabled AER configuration intact. With this change, AER is enabled in the Root Port and the PCIe switch upstream and downstream ports. Only the PCIe Endpoints don't have AER enabled yet. A follow-up patch will take care of this Endpoint enabling. Fixes: 2bd50dd800b5 ("PCI: PCIe: Disable PCIe port services during port ini= tialization") Link: https://lore.kernel.org/r/20220125071820.2247260-3-sr@denx.de Signed-off-by: Stefan Roese Signed-off-by: Bjorn Helgaas Reviewed-by: Pali Roh=C3=A1r Cc: Rafael J. Wysocki Cc: Bharat Kumar Gogada Cc: Michal Simek Cc: Yao Hongbo Cc: Naveen Naidu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pci/pcie/portdrv_core.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_cor= e.c index 604feeb84ee4..1ac7fec47d6f 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -222,15 +222,8 @@ static int get_port_device_capability(struct pci_dev *= dev) =20 #ifdef CONFIG_PCIEAER if (dev->aer_cap && pci_aer_available() && - (pcie_ports_native || host->native_aer)) { + (pcie_ports_native || host->native_aer)) services |=3D PCIE_PORT_SERVICE_AER; - - /* - * Disable AER on this port in case it's been enabled by the - * BIOS (the AER service driver will enable it when necessary). - */ - pci_disable_pcie_error_reporting(dev); - } #endif =20 /* Root Ports and Root Complex Event Collectors may generate PMEs */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6D09C00140 for ; Mon, 15 Aug 2022 22:07:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345496AbiHOWHA (ORCPT ); Mon, 15 Aug 2022 18:07:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350444AbiHOWCJ (ORCPT ); Mon, 15 Aug 2022 18:02:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 235841141A8; Mon, 15 Aug 2022 12:36:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9E1DEB81158; Mon, 15 Aug 2022 19:36:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC836C43162; Mon, 15 Aug 2022 19:36:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592209; bh=OSDp1ieq5oS1vHDrtwMBgB5abeqEJgh30yGEort4BEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kp6fmE21+igSdLrf9Wpd1Q1RwfLg/XJo65YIamnbbVOQrUPOFLzmXowB3oYpa5OP+ 8uXJ4QKQwaTKlg7lcxlud1WIKMLGqTM2FEMIJCIeOMbPF+lksm82gMgIBX2iFEicP4 hvee4jdzBPWN8jrIjdBjToh2iOnXwJP/WwJEpex8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Marangi , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.18 0750/1095] PCI: qcom: Set up rev 2.1.0 PARF_PHY before enabling clocks Date: Mon, 15 Aug 2022 20:02:29 +0200 Message-Id: <20220815180500.387144333@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Marangi [ Upstream commit 38f897ae3d44900f627cad708a15db498ce2ca31 ] We currently enable clocks BEFORE we write to PARF_PHY_CTRL reg to enable clocks and resets. This causes the driver to never set to a ready state with the error 'Phy link never came up'. This is caused by the PHY clock getting enabled before setting the required bits in the PARF regs. A workaround for this was set but with this new discovery we can drop the workaround and use a proper solution to the problem by just enabling the clock only AFTER the PARF_PHY_CTRL bit is set. This correctly sets up the PCIe link and makes it usable even when a bootloader leaves the PCIe link in an undefined state. Fixes: 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver") Link: https://lore.kernel.org/r/20220708222743.27019-1-ansuelsmth@gmail.com Signed-off-by: Christian Marangi Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-qcom.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index ed55421eb9ba..ab04818f6ed9 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -337,8 +337,6 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) reset_control_assert(res->ext_reset); reset_control_assert(res->phy_reset); =20 - writel(1, pcie->parf + PCIE20_PARF_PHY_CTRL); - ret =3D regulator_bulk_enable(ARRAY_SIZE(res->supplies), res->supplies); if (ret < 0) { dev_err(dev, "cannot enable regulators\n"); @@ -381,15 +379,15 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pci= e) goto err_deassert_axi; } =20 - ret =3D clk_bulk_prepare_enable(ARRAY_SIZE(res->clks), res->clks); - if (ret) - goto err_clks; - /* enable PCIe clocks and resets */ val =3D readl(pcie->parf + PCIE20_PARF_PHY_CTRL); val &=3D ~BIT(0); writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL); =20 + ret =3D clk_bulk_prepare_enable(ARRAY_SIZE(res->clks), res->clks); + if (ret) + goto err_clks; + if (of_device_is_compatible(node, "qcom,pcie-ipq8064") || of_device_is_compatible(node, "qcom,pcie-ipq8064-v2")) { writel(PCS_DEEMPH_TX_DEEMPH_GEN1(24) | --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCC52C00140 for ; Mon, 15 Aug 2022 22:07:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346869AbiHOWHy (ORCPT ); Mon, 15 Aug 2022 18:07:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350468AbiHOWCL (ORCPT ); Mon, 15 Aug 2022 18:02:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CC0C7268B; Mon, 15 Aug 2022 12:36:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CBB3D610A3; Mon, 15 Aug 2022 19:36:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACCF0C433B5; Mon, 15 Aug 2022 19:36:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592215; bh=iA3kgPdrYq8HZkBGT4PqxpGRtbzq58obzUta28Y1qg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q2xrdKKrOP+Dzl6Ec6UF8LCU7FprcIs/wirOy2J3hgcHxi/PF6kLQWF7i05kKSNrw 1cwYr77FLvWrE+PVkat6nfGE259WH9MCy5GNWGTXOqX7E4LyXcOoJ2kCi5cOHpc5b7 rgDIaypRlrPnLBTo2Oa7WEgcog1YNDi67xcuAsPA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Scott Benesh , Scott Teel , Mike McGowen , Kevin Barnett , Mahesh Rajashekhara , Don Brace , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 0751/1095] scsi: smartpqi: Fix DMA direction for RAID requests Date: Mon, 15 Aug 2022 20:02:30 +0200 Message-Id: <20220815180500.417389117@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mahesh Rajashekhara [ Upstream commit 69695aeaa6621bc49cdd7a8e5a8d1042461e496e ] Correct a SOP READ and WRITE DMA flags for some requests. This update corrects DMA direction issues with SCSI commands removed from the controller's internal lookup table. Currently, SCSI READ BLOCK LIMITS (0x5) was removed from the controller lookup table and exposed a DMA direction flag issue. SCSI READ BLOCK LIMITS was recently removed from our controller lookup table so the controller uses the respective IU flag field to set the DMA data direction. Since the DMA direction is incorrect the FW never completes the request causing a hang. Some SCSI commands which use SCSI READ BLOCK LIMITS * sg_map * mt -f /dev/stX status After updating controller firmware, users may notice their tape units failing. This patch resolves the issue. Also, the AIO path DMA direction is correct. The DMA direction flag is a day-one bug with no reported BZ. Fixes: 6c223761eb54 ("smartpqi: initial commit of Microsemi smartpqi driver= ") Link: https://lore.kernel.org/r/165730605618.177165.9054223644512926624.stg= it@brunhilda Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Reviewed-by: Mike McGowen Reviewed-by: Kevin Barnett Signed-off-by: Mahesh Rajashekhara Signed-off-by: Don Brace Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/smartpqi/smartpqi_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/= smartpqi_init.c index 7c0d069a3158..e1fc6f5b9612 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -5484,10 +5484,10 @@ static int pqi_raid_submit_scsi_cmd_with_io_request( } =20 switch (scmd->sc_data_direction) { - case DMA_TO_DEVICE: + case DMA_FROM_DEVICE: request->data_direction =3D SOP_READ_FLAG; break; - case DMA_FROM_DEVICE: + case DMA_TO_DEVICE: request->data_direction =3D SOP_WRITE_FLAG; break; case DMA_NONE: --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72B5EC19F2C for ; Mon, 15 Aug 2022 22:08:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347046AbiHOWIJ (ORCPT ); Mon, 15 Aug 2022 18:08:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232710AbiHOWCc (ORCPT ); Mon, 15 Aug 2022 18:02:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BDB682D01; Mon, 15 Aug 2022 12:37:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A10761089; Mon, 15 Aug 2022 19:37:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96580C433C1; Mon, 15 Aug 2022 19:37:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592225; bh=e+q/+ylgS+4pckBS7ntgLisdifqqYTOfxAfl92z1mJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ldZ04HBmFzXqkl1zQdxa01gsLCsC0EdZkwybkz1w0gyPmev5bTlLMCAYDrpH/oYlo 6sXNjVmDqrzi9jzl1M9VRUop3CKX7IijlpPwHI7KaAuuXQlrbrH6pRtJ0GUwfJp26D 5YaVgjWa+Ydg6T0yxPyI9Xm4bagiV1fYWnzooAjg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Filippov , Sasha Levin Subject: [PATCH 5.18 0752/1095] xtensa: iss/network: provide release() callback Date: Mon, 15 Aug 2022 20:02:31 +0200 Message-Id: <20220815180500.450054728@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Max Filippov [ Upstream commit 8864fb8359682912ee99235db7db916733a1fd7b ] Provide release() callback for the platform device embedded into struct iss_net_private and registered in the iss_net_configure so that platform_device_unregister could be called for it. Signed-off-by: Max Filippov Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/xtensa/platforms/iss/network.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/is= s/network.c index be3aaaad8bee..24f162bd5874 100644 --- a/arch/xtensa/platforms/iss/network.c +++ b/arch/xtensa/platforms/iss/network.c @@ -503,6 +503,15 @@ static const struct net_device_ops iss_netdev_ops =3D { .ndo_set_rx_mode =3D iss_net_set_multicast_list, }; =20 +static void iss_net_pdev_release(struct device *dev) +{ + struct platform_device *pdev =3D to_platform_device(dev); + struct iss_net_private *lp =3D + container_of(pdev, struct iss_net_private, pdev); + + free_netdev(lp->dev); +} + static int iss_net_configure(int index, char *init) { struct net_device *dev; @@ -559,6 +568,7 @@ static int iss_net_configure(int index, char *init) =20 lp->pdev.id =3D index; lp->pdev.name =3D DRIVER_NAME; + lp->pdev.dev.release =3D iss_net_pdev_release; platform_device_register(&lp->pdev); SET_NETDEV_DEV(dev, &lp->pdev.dev); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C933EC00140 for ; Mon, 15 Aug 2022 22:08:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232000AbiHOWIX (ORCPT ); Mon, 15 Aug 2022 18:08:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347517AbiHOWDh (ORCPT ); Mon, 15 Aug 2022 18:03:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58E7182D3A; Mon, 15 Aug 2022 12:37:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 965DEB80EA9; Mon, 15 Aug 2022 19:37:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C89CDC433D6; Mon, 15 Aug 2022 19:37:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592231; bh=PCAo73Hw2NLQ3lErF5pXmj2+7jaMLRIg15cWMfprYbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dm6eXAUMgUuq3O5ru9q2+dVZqxPwUSCSVhsMcjlPKLefYPmQzwJxOtqTAsGmkbmdP qanXvlorMGMmQLSixwblL202PZEmkYmhzX2cT7GN0RRKMUMP2DeCa0xIJgoP7AzGH+ 0de3nE18C1cjPD+T/tOF+SSZou4ArTJlmeUQhmmU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Yang Yingliang , Max Filippov , Sasha Levin Subject: [PATCH 5.18 0753/1095] xtensa: iss: fix handling error cases in iss_net_configure() Date: Mon, 15 Aug 2022 20:02:32 +0200 Message-Id: <20220815180500.490663374@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit 628ccfc8f5f79dd548319408fcc53949fe97b258 ] The 'pdev' and 'netdev' need to be released in error cases of iss_net_configure(). Change the return type of iss_net_configure() to void, because it's not used. Fixes: 7282bee78798 ("[PATCH] xtensa: Architecture support for Tensilica Xt= ensa Part 8") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Signed-off-by: Max Filippov Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/xtensa/platforms/iss/network.c | 32 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/is= s/network.c index 24f162bd5874..eee389187807 100644 --- a/arch/xtensa/platforms/iss/network.c +++ b/arch/xtensa/platforms/iss/network.c @@ -512,16 +512,15 @@ static void iss_net_pdev_release(struct device *dev) free_netdev(lp->dev); } =20 -static int iss_net_configure(int index, char *init) +static void iss_net_configure(int index, char *init) { struct net_device *dev; struct iss_net_private *lp; - int err; =20 dev =3D alloc_etherdev(sizeof(*lp)); if (dev =3D=3D NULL) { pr_err("eth_configure: failed to allocate device\n"); - return 1; + return; } =20 /* Initialize private element. */ @@ -550,7 +549,7 @@ static int iss_net_configure(int index, char *init) if (!tuntap_probe(lp, index, init)) { pr_err("%s: invalid arguments. Skipping device!\n", dev->name); - goto errout; + goto err_free_netdev; } =20 pr_info("Netdevice %d (%pM)\n", index, dev->dev_addr); @@ -558,7 +557,8 @@ static int iss_net_configure(int index, char *init) /* sysfs register */ =20 if (!driver_registered) { - platform_driver_register(&iss_net_driver); + if (platform_driver_register(&iss_net_driver)) + goto err_free_netdev; driver_registered =3D 1; } =20 @@ -569,7 +569,8 @@ static int iss_net_configure(int index, char *init) lp->pdev.id =3D index; lp->pdev.name =3D DRIVER_NAME; lp->pdev.dev.release =3D iss_net_pdev_release; - platform_device_register(&lp->pdev); + if (platform_device_register(&lp->pdev)) + goto err_free_netdev; SET_NETDEV_DEV(dev, &lp->pdev.dev); =20 dev->netdev_ops =3D &iss_netdev_ops; @@ -578,23 +579,20 @@ static int iss_net_configure(int index, char *init) dev->irq =3D -1; =20 rtnl_lock(); - err =3D register_netdevice(dev); - rtnl_unlock(); - - if (err) { + if (register_netdevice(dev)) { + rtnl_unlock(); pr_err("%s: error registering net device!\n", dev->name); - /* XXX: should we call ->remove() here? */ - free_netdev(dev); - return 1; + platform_device_unregister(&lp->pdev); + return; } + rtnl_unlock(); =20 timer_setup(&lp->tl, iss_net_user_timer_expire, 0); =20 - return 0; + return; =20 -errout: - /* FIXME: unregister; free, etc.. */ - return -EIO; +err_free_netdev: + free_netdev(dev); } =20 /* -----------------------------------------------------------------------= -- */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5952CC00140 for ; Mon, 15 Aug 2022 22:08:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344302AbiHOWIi (ORCPT ); Mon, 15 Aug 2022 18:08:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346880AbiHOWEg (ORCPT ); Mon, 15 Aug 2022 18:04:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECC041156E9; Mon, 15 Aug 2022 12:37:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E1DEC611E4; Mon, 15 Aug 2022 19:37:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB52DC433D6; Mon, 15 Aug 2022 19:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592237; bh=TAuUMR7MhN059r8wH39ZJ2WwqdyBclsgrNGwmEPdtag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YzivLhGlUZhN+Sn6ztgxULTvC9i7vqjltNLis1xXBxy5qc6NXl/CNUfmO+yqH/lpH zlw6nDelCBmKnbFJDnOn6Fo+LKjDfQXiaYe0xbatAMJrshvwd6GypGI50vyRK/ErCK jYq8zGaoptloOr8Sw4qqbyHKXFp0BDLIjciPiALU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Raviteja Garimella , Felipe Balbi , linux-usb@vger.kernel.org, Randy Dunlap , Sasha Levin Subject: [PATCH 5.18 0754/1095] usb: gadget: udc: amd5536 depends on HAS_DMA Date: Mon, 15 Aug 2022 20:02:33 +0200 Message-Id: <20220815180500.522087556@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Randy Dunlap [ Upstream commit 8097cf2fb3b2205257f1c76f4808e3398d66b6d9 ] USB_AMD5536UDC should depend on HAS_DMA since it selects USB_SNP_CORE, which depends on HAS_DMA and since 'select' does not follow any dependency chains. Fixes this kconfig warning: WARNING: unmet direct dependencies detected for USB_SNP_CORE Depends on [n]: USB_SUPPORT [=3Dy] && USB_GADGET [=3Dy] && (USB_AMD5536UD= C [=3Dy] || USB_SNP_UDC_PLAT [=3Dn]) && HAS_DMA [=3Dn] Selected by [y]: - USB_AMD5536UDC [=3Dy] && USB_SUPPORT [=3Dy] && USB_GADGET [=3Dy] && USB= _PCI [=3Dy] Fixes: 97b3ffa233b9 ("usb: gadget: udc: amd5536: split core and PCI layer") Cc: Raviteja Garimella Cc: Felipe Balbi Cc: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman Signed-off-by: Randy Dunlap Link: https://lore.kernel.org/r/20220709013601.7536-1-rdunlap@infradead.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/gadget/udc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig index 69394dc1cdfb..2cdd37be165a 100644 --- a/drivers/usb/gadget/udc/Kconfig +++ b/drivers/usb/gadget/udc/Kconfig @@ -311,7 +311,7 @@ source "drivers/usb/gadget/udc/bdc/Kconfig" =20 config USB_AMD5536UDC tristate "AMD5536 UDC" - depends on USB_PCI + depends on USB_PCI && HAS_DMA select USB_SNP_CORE help The AMD5536 UDC is part of the AMD Geode CS5536, an x86 southbridge. --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C13CC00140 for ; Mon, 15 Aug 2022 22:08:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347920AbiHOWIr (ORCPT ); Mon, 15 Aug 2022 18:08:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347136AbiHOWFF (ORCPT ); Mon, 15 Aug 2022 18:05:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D05F5115B7A; Mon, 15 Aug 2022 12:37:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C98C8B80EAB; Mon, 15 Aug 2022 19:37:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13E80C433C1; Mon, 15 Aug 2022 19:37:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592243; bh=+J+Q8LniD2ZXHJOSoRNy/SiVung7frjPqTcLHzcd/cE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V5XUvfmqvpNTOnUo4MKCe1L/ZlQeJ31KJBohUgxQLZ7LQTa4BnyXT9YYDl2EZKzm/ mDuEFapokXEiaNKW+5Qrti3PYI3DgAILJ9QpRKg3+Zy/E1U4//ywMHe9cWjyERZmmE Me7K22ZuOkOVko0KS3N226EVWgRu8LAoIv2x1E1Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Sasha Levin Subject: [PATCH 5.18 0755/1095] usb: aspeed-vhub: Fix refcount leak bug in ast_vhub_init_desc() Date: Mon, 15 Aug 2022 20:02:34 +0200 Message-Id: <20220815180500.551400079@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 220fafb4ed04187e9c17be4152da5a7f2ffbdd8c ] We should call of_node_put() for the reference returned by of_get_child_by_name() which has increased the refcount. Fixes: 30d2617fd7ed ("usb: gadget: aspeed: allow to set usb strings in devi= ce tree") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220713120528.368168-1-windhl@126.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/gadget/udc/aspeed-vhub/hub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/aspeed-vhub/hub.c b/drivers/usb/gadget/= udc/aspeed-vhub/hub.c index 65cd4e46f031..e2207d014620 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/hub.c +++ b/drivers/usb/gadget/udc/aspeed-vhub/hub.c @@ -1059,8 +1059,10 @@ static int ast_vhub_init_desc(struct ast_vhub *vhub) /* Initialize vhub String Descriptors. */ INIT_LIST_HEAD(&vhub->vhub_str_desc); desc_np =3D of_get_child_by_name(vhub_np, "vhub-strings"); - if (desc_np) + if (desc_np) { ret =3D ast_vhub_of_parse_str_desc(vhub, desc_np); + of_node_put(desc_np); + } else ret =3D ast_vhub_str_alloc_add(vhub, &ast_vhub_strings); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3E2AC00140 for ; Mon, 15 Aug 2022 22:08:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345550AbiHOWIy (ORCPT ); Mon, 15 Aug 2022 18:08:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348309AbiHOWFs (ORCPT ); Mon, 15 Aug 2022 18:05:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 886AC11609A; Mon, 15 Aug 2022 12:37:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6905A611E7; Mon, 15 Aug 2022 19:37:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 562F1C433C1; Mon, 15 Aug 2022 19:37:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592249; bh=Xq3v93P9JTZdi2AV2EUYbUde+wbxdFFKx2QgvcEJt9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jeof42bTN5mZDVAuPuNVLXsSmELPXMmuU3Kq7svhgkp0zf3Iy/yzpK8qsPFmxmGLn AtbiNEfrqIsHfJkWpb6u5dDYrZM60D1E9Eg9fyDAIiz6lHVqvgwkrlHR7oz1idrJdM mExfYsBPYq5HCT3grqGExJrcOyfKiD4Y2mUFeBDk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen , Sasha Levin Subject: [PATCH 5.18 0756/1095] usb: dwc3: core: Deprecate GCTL.CORESOFTRESET Date: Mon, 15 Aug 2022 20:02:35 +0200 Message-Id: <20220815180500.580769281@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thinh Nguyen [ Upstream commit afbd04e66e5d16ca3c7ea2e3c56eca25558eacf3 ] Synopsys IP DWC_usb32 and DWC_usb31 version 1.90a and above deprecated GCTL.CORESOFTRESET. The DRD mode switching flow is updated to remove the GCTL soft reset. Add version checks to prevent using deprecated setting in mode switching flow. Signed-off-by: Thinh Nguyen Link: https://lore.kernel.org/r/9df529fde6e55f5508321b6bc26e92848044ef2b.16= 55338967.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/dwc3/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index d28cd1a6709b..46a3b8941e40 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -158,7 +158,8 @@ static void __dwc3_set_mode(struct work_struct *work) } =20 /* For DRD host or device mode only */ - if (dwc->desired_dr_role !=3D DWC3_GCTL_PRTCAP_OTG) { + if ((DWC3_IP_IS(DWC3) || DWC3_VER_IS_PRIOR(DWC31, 190A)) && + dwc->desired_dr_role !=3D DWC3_GCTL_PRTCAP_OTG) { reg =3D dwc3_readl(dwc->regs, DWC3_GCTL); reg |=3D DWC3_GCTL_CORESOFTRESET; dwc3_writel(dwc->regs, DWC3_GCTL, reg); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18D57C00140 for ; Mon, 15 Aug 2022 22:09:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344072AbiHOWJI (ORCPT ); Mon, 15 Aug 2022 18:09:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348654AbiHOWGF (ORCPT ); Mon, 15 Aug 2022 18:06:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80478116EEF; Mon, 15 Aug 2022 12:37:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A44A8B80EAB; Mon, 15 Aug 2022 19:37:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D58DAC433D6; Mon, 15 Aug 2022 19:37:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592259; bh=GhUnTEMiB/95ekdv6mXv9gqAcCtVgrLB9cNCLk8LCWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zLIHClLQ23WQfOZDG+TT1SAoCW4MbGN8lzzqheN7yvynKXK5UhU8dY7LIspqdH+8P nzk6U/wv9uzX9WXXd2EZ0QSQmHFMwZFGS3HCgK1ynBk8LVMNUa/Ps5QQKocdVU490g X9C9ihdvUsbie4ZdpzJ8AnKs6MHIip17sTjIRN+g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rohith Kollalsi , Sasha Levin Subject: [PATCH 5.18 0757/1095] usb: dwc3: core: Do not perform GCTL_CORE_SOFTRESET during bootup Date: Mon, 15 Aug 2022 20:02:36 +0200 Message-Id: <20220815180500.610840846@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rohith Kollalsi [ Upstream commit 07903626d98853e605fe63e5ce149f1b7314bbea ] According to the programming guide, it is recommended to perform a GCTL_CORE_SOFTRESET only when switching the mode from device to host or host to device. However, it is found that during bootup when __dwc3_set_mode() is called for the first time, GCTL_CORESOFTRESET is done with suspendable bit(BIT 17) of DWC3_GUSB3PIPECTL set. This some times leads to issues like controller going into bad state and controller registers reading value zero. Until GCTL_CORESOFTRESET is done and run/stop bit is set core initialization is not complete. Setting suspendable bit of DWC3_GUSB3PIPECTL and then performing GCTL_CORESOFTRESET is therefore not recommended. Avoid this by only performing the reset if current_dr_role is set, that is, when doing subsequent role switching. Fixes: f88359e1588b ("usb: dwc3: core: Do core softreset when switch mode") Signed-off-by: Rohith Kollalsi Link: https://lore.kernel.org/r/20220714045625.20377-1-quic_rkollals@quicin= c.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/dwc3/core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 46a3b8941e40..ecec9cdfa0a6 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -157,9 +157,13 @@ static void __dwc3_set_mode(struct work_struct *work) break; } =20 - /* For DRD host or device mode only */ - if ((DWC3_IP_IS(DWC3) || DWC3_VER_IS_PRIOR(DWC31, 190A)) && - dwc->desired_dr_role !=3D DWC3_GCTL_PRTCAP_OTG) { + /* + * When current_dr_role is not set, there's no role switching. + * Only perform GCTL.CoreSoftReset when there's DRD role switching. + */ + if (dwc->current_dr_role && ((DWC3_IP_IS(DWC3) || + DWC3_VER_IS_PRIOR(DWC31, 190A)) && + dwc->desired_dr_role !=3D DWC3_GCTL_PRTCAP_OTG)) { reg =3D dwc3_readl(dwc->regs, DWC3_GCTL); reg |=3D DWC3_GCTL_CORESOFTRESET; dwc3_writel(dwc->regs, DWC3_GCTL, reg); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52230C00140 for ; Mon, 15 Aug 2022 22:09:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347257AbiHOWJV (ORCPT ); Mon, 15 Aug 2022 18:09:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349485AbiHOWGR (ORCPT ); Mon, 15 Aug 2022 18:06:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7563642EE; Mon, 15 Aug 2022 12:37:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ABB9DB80EA9; Mon, 15 Aug 2022 19:37:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E497BC433B5; Mon, 15 Aug 2022 19:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592265; bh=V8H25ZulhY1oWUWS8KPaAgWDB8FzsNqGAGC4m5li3/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JENRT8Rkp00YDKMEbQmrz/p9V7lDHAirhkOBXLz5x4SE8JrR2/O0p6K7yCp0pE6FJ 487coY55KZNw0E0xw/3TJYqDMTrPDVOFZsUlSsj7x5MApsodEKlnmnIFliK44DFaHT WPFpyz0AyotkUyWutxd/K9AV9EM/FfiyWxf/t7bQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Halaney , Johan Hovold , Sasha Levin Subject: [PATCH 5.18 0758/1095] usb: dwc3: qcom: fix missing optional irq warnings Date: Mon, 15 Aug 2022 20:02:37 +0200 Message-Id: <20220815180500.649676059@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold [ Upstream commit 69bb3520db7cecbccc9e497fc568fa5465c9d43f ] Not all platforms have all of the four currently supported wakeup interrupts so use the optional irq helpers when looking up interrupts to avoid printing error messages when an optional interrupt is not found: dwc3-qcom a6f8800.usb: error -ENXIO: IRQ hs_phy_irq not found Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver") Reviewed-by: Andrew Halaney Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20220713131340.29401-4-johan+linaro@kernel.= org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/dwc3/dwc3-qcom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index 6cba990da32e..3582fd6dfa14 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -443,9 +443,9 @@ static int dwc3_qcom_get_irq(struct platform_device *pd= ev, int ret; =20 if (np) - ret =3D platform_get_irq_byname(pdev_irq, name); + ret =3D platform_get_irq_byname_optional(pdev_irq, name); else - ret =3D platform_get_irq(pdev_irq, num); + ret =3D platform_get_irq_optional(pdev_irq, num); =20 return ret; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C8E5C00140 for ; Mon, 15 Aug 2022 22:23:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348427AbiHOWXn (ORCPT ); Mon, 15 Aug 2022 18:23:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350768AbiHOWS3 (ORCPT ); Mon, 15 Aug 2022 18:18:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 553274198D; Mon, 15 Aug 2022 12:41:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CE38E61089; Mon, 15 Aug 2022 19:41:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD6DDC433C1; Mon, 15 Aug 2022 19:41:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592485; bh=imMcvGzzPpr3rWTwGM7Bb11ZJvZPVZIPQT6qdLY3okI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GhK17yXVuBDxC8btGuf57XAG4txiCajNNbOdd6tjVDvpR0430JrbwwaOzXLd8OKbo 59AZJk/czkjg9gaWyAU6+L2PpJyVa4fwnUZKRVR/SUg0Tqn76TBAffZSvJBJZCXhAO P/EwCDQWoKxE3R75H9s22HSZ1JIpVJfInTmhisNo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Dan Carpenter , Sasha Levin Subject: [PATCH 5.18 0759/1095] eeprom: idt_89hpesx: uninitialized data in idt_dbgfs_csr_write() Date: Mon, 15 Aug 2022 20:02:38 +0200 Message-Id: <20220815180500.682064472@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 71d46f1ff2212ced4852c7e77c5176382a1bdcec ] The simple_write_to_buffer() function will return positive/success if it is able to write a single byte anywhere within the buffer. However that potentially leaves a lot of the buffer uninitialized. In this code it's better to return 0 if the offset is non-zero. This code is not written to support partial writes. And then return -EFAULT if the buffer is not completely initialized. Fixes: cfad6425382e ("eeprom: Add IDT 89HPESx EEPROM/CSR driver") Reviewed-by: Serge Semin Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/Ysg1Pu/nzSMe3r1q@kili Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/misc/eeprom/idt_89hpesx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/misc/eeprom/idt_89hpesx.c b/drivers/misc/eeprom/idt_89= hpesx.c index b0cff4b152da..7f430742ce2b 100644 --- a/drivers/misc/eeprom/idt_89hpesx.c +++ b/drivers/misc/eeprom/idt_89hpesx.c @@ -909,14 +909,18 @@ static ssize_t idt_dbgfs_csr_write(struct file *filep= , const char __user *ubuf, u32 csraddr, csrval; char *buf; =20 + if (*offp) + return 0; + /* Copy data from User-space */ buf =3D kmalloc(count + 1, GFP_KERNEL); if (!buf) return -ENOMEM; =20 - ret =3D simple_write_to_buffer(buf, count, offp, ubuf, count); - if (ret < 0) + if (copy_from_user(buf, ubuf, count)) { + ret =3D -EFAULT; goto free_buf; + } buf[count] =3D 0; =20 /* Find position of colon in the buffer */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 860CCC00140 for ; Mon, 15 Aug 2022 22:12:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344386AbiHOWM1 (ORCPT ); Mon, 15 Aug 2022 18:12:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244075AbiHOWKL (ORCPT ); Mon, 15 Aug 2022 18:10:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 005EB118DDC; Mon, 15 Aug 2022 12:38:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A185260BC2; Mon, 15 Aug 2022 19:38:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94CFCC433C1; Mon, 15 Aug 2022 19:38:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592285; bh=BWdZqPLDXsnad35DrHwcE33hAm8J1xbYtk0RGyawOr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BThENeyXsNigqO2x4HQ7fWfRyukkcDN3hrM9lCZlASxQ62IV1Ylqohws9WV87M9Q2 PxGZX3kN2TBG0DHPs8hEPl3YHdNZNPE1xavE2gxd8gbhEI3nfiNIZcrYipMDU+7eAv KVfJhfM11rloJnlSGcqg1gdAR+kRe9wrEu12RnFw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabrice Gasnier , Vinod Koul , Sasha Levin Subject: [PATCH 5.18 0760/1095] phy: stm32: fix error return in stm32_usbphyc_phy_init Date: Mon, 15 Aug 2022 20:02:39 +0200 Message-Id: <20220815180500.716285659@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabrice Gasnier [ Upstream commit 32b378a9179ae4db61cfc5d502717214e6cd1e1c ] Error code is overridden, in case the PLL doesn't lock. So, the USB initialization can continue. This leads to a platform freeze. This can be avoided by returning proper error code to avoid USB probe freezing the platform. It also displays proper errors in log. Fixes: 5b1af71280ab ("phy: stm32: rework PLL Lock detection") Signed-off-by: Fabrice Gasnier Link: https://lore.kernel.org/r/20220713133953.595134-1-fabrice.gasnier@fos= s.st.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/phy/st/phy-stm32-usbphyc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/phy/st/phy-stm32-usbphyc.c b/drivers/phy/st/phy-stm32-= usbphyc.c index 007a23c78d56..a98c911cc37a 100644 --- a/drivers/phy/st/phy-stm32-usbphyc.c +++ b/drivers/phy/st/phy-stm32-usbphyc.c @@ -358,7 +358,9 @@ static int stm32_usbphyc_phy_init(struct phy *phy) return 0; =20 pll_disable: - return stm32_usbphyc_pll_disable(usbphyc); + stm32_usbphyc_pll_disable(usbphyc); + + return ret; } =20 static int stm32_usbphyc_phy_exit(struct phy *phy) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8C3AC00140 for ; Mon, 15 Aug 2022 22:15:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243542AbiHOWPC (ORCPT ); Mon, 15 Aug 2022 18:15:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350489AbiHOWMT (ORCPT ); Mon, 15 Aug 2022 18:12:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF37A11C961; Mon, 15 Aug 2022 12:39:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6BFBC60BC2; Mon, 15 Aug 2022 19:39:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FE99C433D6; Mon, 15 Aug 2022 19:39:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592353; bh=BIuSVG4tSIEfGPXbEkEZKeip4h+jB7rKwCTaHB/ldEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AyVm09Q5For9SJl8BG/85QiRlDfjlF2VzducnjyhzHPhu/GxoKSvl5umzpAMcnxag Gt7Lzr8rHK486zqnQBCe4zFRKDQw0qIjpptK0gTEs9H2Gr2oS3vnRA63fmrkhS+LSi WYc1oGyATIWtXDEXhM/+SLEqkaNPAZc8L5cCVUf4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frank Wunderlich , Samuel Holland , Peter Geis , Vinod Koul , Sasha Levin Subject: [PATCH 5.18 0761/1095] phy: rockchip-inno-usb2: Ignore OTG IRQs in host mode Date: Mon, 15 Aug 2022 20:02:40 +0200 Message-Id: <20220815180500.756948274@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit fd7d47484125c7d04578de9294faa7fec6e5df0a ] When the OTG port is fixed to host mode, the driver does not request its IRQs, nor does it enable those IRQs in hardware. Similarly, the driver should ignore the OTG port IRQs when handling the shared interrupt. Otherwise, it would update the extcon based on an ID pin which may be in an undefined state, or try to queue a uninitialized work item. Fixes: 6a98df08ccd5 ("phy: rockchip-inno-usb2: Fix muxed interrupt support") Reported-by: Frank Wunderlich Signed-off-by: Samuel Holland Tested-by: Peter Geis Tested-by: Frank Wunderlich Link: https://lore.kernel.org/r/20220708061434.38115-1-samuel@sholland.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/ro= ckchip/phy-rockchip-inno-usb2.c index cba5c32cbaee..0c6548ac9d8a 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -942,7 +942,9 @@ static irqreturn_t rockchip_usb2phy_irq(int irq, void *= data) =20 switch (rport->port_id) { case USB2PHY_PORT_OTG: - ret |=3D rockchip_usb2phy_otg_mux_irq(irq, rport); + if (rport->mode !=3D USB_DR_MODE_HOST && + rport->mode !=3D USB_DR_MODE_UNKNOWN) + ret |=3D rockchip_usb2phy_otg_mux_irq(irq, rport); break; case USB2PHY_PORT_HOST: ret |=3D rockchip_usb2phy_linestate_irq(irq, rport); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24DCAC32762 for ; Mon, 15 Aug 2022 22:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350373AbiHOW0k (ORCPT ); Mon, 15 Aug 2022 18:26:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349919AbiHOWRR (ORCPT ); Mon, 15 Aug 2022 18:17:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65BBC3F313; Mon, 15 Aug 2022 12:40:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C01EC61217; Mon, 15 Aug 2022 19:40:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9D36C43470; Mon, 15 Aug 2022 19:40:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592423; bh=YHnaOV5Y4krgMZM6veswHxagQoNsgvH0gQzfp0blJqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xcd5ZAfeNvmAu0IIOlurHnNzaRbhtleCcmiRvztfdLL7ZK+fvpZQahqT4gSpNit6u tgJiFg7cNxJXxhjj8NQvi7e0K9FzNpWhJhyPUYfc0zqh8+JfQs3/FPJTgXQ6jTmSSB p25u947ROUD6EvyLo/comO1Y3VLNpa3hkuINYneU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurent Pinchart , Peng Fan , Georgi Djakov , Sasha Levin Subject: [PATCH 5.18 0762/1095] interconnect: imx: fix max_node_id Date: Mon, 15 Aug 2022 20:02:41 +0200 Message-Id: <20220815180500.792253160@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peng Fan [ Upstream commit bd734481e172b4827af09c9ab06c51d2ab7201e6 ] max_node_id not equal to the ARRAY_SIZE of node array, need increase 1, otherwise xlate will fail for the last entry. And rename max_node_id to num_nodes to reflect the reality. Fixes: f0d8048525d7d ("interconnect: Add imx core driver") Reviewed-by: Laurent Pinchart Signed-off-by: Peng Fan Link: https://lore.kernel.org/r/20220703091132.1412063-5-peng.fan@oss.nxp.c= om Signed-off-by: Georgi Djakov Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/interconnect/imx/imx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/interconnect/imx/imx.c b/drivers/interconnect/imx/imx.c index 249ca25d1d55..4406ec45fa90 100644 --- a/drivers/interconnect/imx/imx.c +++ b/drivers/interconnect/imx/imx.c @@ -234,16 +234,16 @@ int imx_icc_register(struct platform_device *pdev, struct device *dev =3D &pdev->dev; struct icc_onecell_data *data; struct icc_provider *provider; - int max_node_id; + int num_nodes; int ret; =20 /* icc_onecell_data is indexed by node_id, unlike nodes param */ - max_node_id =3D get_max_node_id(nodes, nodes_count); - data =3D devm_kzalloc(dev, struct_size(data, nodes, max_node_id), + num_nodes =3D get_max_node_id(nodes, nodes_count) + 1; + data =3D devm_kzalloc(dev, struct_size(data, nodes, num_nodes), GFP_KERNEL); if (!data) return -ENOMEM; - data->num_nodes =3D max_node_id; + data->num_nodes =3D num_nodes; =20 provider =3D devm_kzalloc(dev, sizeof(*provider), GFP_KERNEL); if (!provider) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6EEBC00140 for ; Mon, 15 Aug 2022 22:23:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348348AbiHOWXH (ORCPT ); Mon, 15 Aug 2022 18:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350693AbiHOWSN (ORCPT ); Mon, 15 Aug 2022 18:18:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8255123CA2; Mon, 15 Aug 2022 12:41:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5CB83B80EA8; Mon, 15 Aug 2022 19:41:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3EA4C433D6; Mon, 15 Aug 2022 19:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592476; bh=hwUVotYLPPfsowZItZNAHswZcEHPnU+JPQbbWO55Yh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VYjiEfsLDucngGw8/pwzs5BOPfNtIpxWP2DQr8FgWaLidTsBdgrDkF6dZrAVy5TWK qVaaD//4ORr83zkIN0QC1dPWnyp4j4L792Oj1wr78nxbmnJIUD+R9+l4i5ObqlO9Qd CGaX3R4YDK+4/gmrenmMi5LsVKWOiVs7Qrr8Y188= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Christopher Obbard , Richard Weinberger , Sasha Levin Subject: [PATCH 5.18 0763/1095] um: random: Dont initialise hwrng struct with zero Date: Mon, 15 Aug 2022 20:02:42 +0200 Message-Id: <20220815180500.829772755@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christopher Obbard [ Upstream commit 9e70cbd11b03889c92462cf52edb2bd023c798fa ] Initialising the hwrng struct with zeros causes a compile-time sparse warning: $ ARCH=3Dum make -j10 W=3D1 C=3D1 CF=3D'-fdiagnostic-prefix -D__CHECK_ENDI= AN__' ... CHECK arch/um/drivers/random.c arch/um/drivers/random.c:31:31: sparse: warning: Using plain integer as NU= LL pointer Fix the warning by not initialising the hwrng struct with zeros as it is initialised anyway during module init. Fixes: 72d3e093afae ("um: random: Register random as hwrng-core device") Reported-by: kernel test robot Signed-off-by: Christopher Obbard Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/um/drivers/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/drivers/random.c b/arch/um/drivers/random.c index 433a3f8f2ef3..32b3341fe970 100644 --- a/arch/um/drivers/random.c +++ b/arch/um/drivers/random.c @@ -28,7 +28,7 @@ * protects against a module being loaded twice at the same time. */ static int random_fd =3D -1; -static struct hwrng hwrng =3D { 0, }; +static struct hwrng hwrng; static DECLARE_COMPLETION(have_data); =20 static int rng_dev_read(struct hwrng *rng, void *buf, size_t max, bool blo= ck) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 317A6C00140 for ; Mon, 15 Aug 2022 22:23:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348236AbiHOWXZ (ORCPT ); Mon, 15 Aug 2022 18:23:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350763AbiHOWS1 (ORCPT ); Mon, 15 Aug 2022 18:18:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10A0E12421D; Mon, 15 Aug 2022 12:41:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 80D49B80EA8; Mon, 15 Aug 2022 19:41:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5BEEC433C1; Mon, 15 Aug 2022 19:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592482; bh=kSUwktPd62XEnkvaJwjmf6uWtQLy1ghU5YPPCWn76H0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=si6EhaPtt6GEtb7MLpDFSysLS62DiF/LwK1nn3Y+8spqj6kjNRmM2/ltalxN6JLtv sU8b6PKKUkEA01NJI+IjJnB6AYA+M80uxuSUha3RrUdnBK9H6PuWtPB/UQVPvq61mH TMK2Fdx1HB13QHWqZZ1xqe5h7EP0sw2+ddjvisLQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bartosz Sobczak , Mustafa Ismail , Shiraz Saleem , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.18 0764/1095] RDMA/irdma: Fix a window for use-after-free Date: Mon, 15 Aug 2022 20:02:43 +0200 Message-Id: <20220815180500.874753119@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mustafa Ismail [ Upstream commit 8ecef7890b3aea78c8bbb501a4b5b8134367b821 ] During a destroy CQ an interrupt may cause processing of a CQE after CQ resources are freed by irdma_cq_free_rsrc(). Fix this by moving the call to irdma_cq_free_rsrc() after the irdma_sc_cleanup_ceqes(), which is called under the cq_lock. Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs") Link: https://lore.kernel.org/r/20220705230815.265-6-shiraz.saleem@intel.com Signed-off-by: Bartosz Sobczak Signed-off-by: Mustafa Ismail Signed-off-by: Shiraz Saleem Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/hw/irdma/verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/ir= dma/verbs.c index 6daa149dcbda..b29631f6659a 100644 --- a/drivers/infiniband/hw/irdma/verbs.c +++ b/drivers/infiniband/hw/irdma/verbs.c @@ -1760,11 +1760,11 @@ static int irdma_destroy_cq(struct ib_cq *ib_cq, st= ruct ib_udata *udata) spin_unlock_irqrestore(&iwcq->lock, flags); =20 irdma_cq_wq_destroy(iwdev->rf, cq); - irdma_cq_free_rsrc(iwdev->rf, iwcq); =20 spin_lock_irqsave(&iwceq->ce_lock, flags); irdma_sc_cleanup_ceqes(cq, ceq); spin_unlock_irqrestore(&iwceq->ce_lock, flags); + irdma_cq_free_rsrc(iwdev->rf, iwcq); =20 return 0; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DCC5C00140 for ; Mon, 15 Aug 2022 22:12:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346841AbiHOWMw (ORCPT ); Mon, 15 Aug 2022 18:12:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348022AbiHOWKm (ORCPT ); Mon, 15 Aug 2022 18:10:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B78131208; Mon, 15 Aug 2022 12:38:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DBD62610A5; Mon, 15 Aug 2022 19:38:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB161C433C1; Mon, 15 Aug 2022 19:38:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592291; bh=VQGx/IU7kOtacVCrGRXqdtCla6OPAn5IxSG9vexBIsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QqvYmDH9NL4RLJ//HCXGyJ4qGtrnQ3aRbVyNKobunDsBGRu5TIc5V7sIzlr/FzK7V xpnecPgQS5Ri8if+iNnIIrLv/6aO62ifkTru59MQ9iHohUWLeMj1q2Q4rZgcwLCzf+ CG9/MURL+44MDVyhkmfVGPvj5Mgrv14O3A1QcNmQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mustafa Ismail , Shiraz Saleem , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.18 0765/1095] RDMA/irdma: Fix VLAN connection with wildcard address Date: Mon, 15 Aug 2022 20:02:44 +0200 Message-Id: <20220815180500.907639958@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mustafa Ismail [ Upstream commit 82ab2b52654c43ba24a3f6603fec40874cc5a7e5 ] When an application listens on a wildcard address, and there are VLAN and non-VLAN IP addresses, iWARP connection establishemnt can fail if the listen node VLAN ID does not match. Fix this by checking the vlan_id only if not a wildcard listen node. Fixes: 146b9756f14c ("RDMA/irdma: Add connection manager") Link: https://lore.kernel.org/r/20220705230815.265-7-shiraz.saleem@intel.com Signed-off-by: Mustafa Ismail Signed-off-by: Shiraz Saleem Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/hw/irdma/cm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/irdma/cm.c b/drivers/infiniband/hw/irdma= /cm.c index 646fa8677490..7b086fe63a24 100644 --- a/drivers/infiniband/hw/irdma/cm.c +++ b/drivers/infiniband/hw/irdma/cm.c @@ -1477,12 +1477,13 @@ irdma_find_listener(struct irdma_cm_core *cm_core, = u32 *dst_addr, u16 dst_port, list_for_each_entry (listen_node, &cm_core->listen_list, list) { memcpy(listen_addr, listen_node->loc_addr, sizeof(listen_addr)); listen_port =3D listen_node->loc_port; + if (listen_port !=3D dst_port || + !(listener_state & listen_node->listener_state)) + continue; /* compare node pair, return node handle if a match */ - if ((!memcmp(listen_addr, dst_addr, sizeof(listen_addr)) || - !memcmp(listen_addr, ip_zero, sizeof(listen_addr))) && - listen_port =3D=3D dst_port && - vlan_id =3D=3D listen_node->vlan_id && - (listener_state & listen_node->listener_state)) { + if (!memcmp(listen_addr, ip_zero, sizeof(listen_addr)) || + (!memcmp(listen_addr, dst_addr, sizeof(listen_addr)) && + vlan_id =3D=3D listen_node->vlan_id)) { refcount_inc(&listen_node->refcnt); spin_unlock_irqrestore(&cm_core->listen_list_lock, flags); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24597C00140 for ; Mon, 15 Aug 2022 22:13:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346942AbiHOWNC (ORCPT ); Mon, 15 Aug 2022 18:13:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348074AbiHOWKn (ORCPT ); Mon, 15 Aug 2022 18:10:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A541C11A2D9; Mon, 15 Aug 2022 12:38:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3F2CE611E0; Mon, 15 Aug 2022 19:38:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BA71C433D6; Mon, 15 Aug 2022 19:38:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592297; bh=hfB4SkeR3N2GlZK4RWP4xMu1+BGA1WlOWN39Ns5RwVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pz0ynarPC2a5I2FxCxrXRT2om/0h0wRUN3SiY6SkeGFIM87Zip5uw1Wf/AXj/PM3l mLcqApubVRfF+AhXujMSUkl6rTbK0/HXGG7f+/Br/qGDlHS5TYHgyHCa+fdxh2WGSD SLswA0fcIp4D/2P7xIfXJucgm/zxhNaBTyUF1R6o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mustafa Ismail , Shiraz Saleem , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.18 0766/1095] RDMA/irdma: Fix setting of QP context err_rq_idx_valid field Date: Mon, 15 Aug 2022 20:02:45 +0200 Message-Id: <20220815180500.947454221@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mustafa Ismail [ Upstream commit 3a844596ed71b7c12ac602f6f6b7b0f17e4d6a90 ] Setting err_rq_idx_valid field in QP context when the AE source of the AEQE is not associated with an RQ causes the firmware flush to fail. Set err_rq_idx_valid field in QP context only if it is associated with an RQ. Additionally, cleanup the redundant setting of this field in irdma_process_aeq. Fixes: 44d9e52977a1 ("RDMA/irdma: Implement device initialization definitio= ns") Link: https://lore.kernel.org/r/20220705230815.265-8-shiraz.saleem@intel.com Signed-off-by: Mustafa Ismail Signed-off-by: Shiraz Saleem Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/hw/irdma/hw.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/infiniband/hw/irdma/hw.c b/drivers/infiniband/hw/irdma= /hw.c index 3dc9b5801da1..c1b402a06e17 100644 --- a/drivers/infiniband/hw/irdma/hw.c +++ b/drivers/infiniband/hw/irdma/hw.c @@ -257,10 +257,6 @@ static void irdma_process_aeq(struct irdma_pci_f *rf) iwqp->last_aeq =3D info->ae_id; spin_unlock_irqrestore(&iwqp->lock, flags); ctx_info =3D &iwqp->ctx_info; - if (rdma_protocol_roce(&iwqp->iwdev->ibdev, 1)) - ctx_info->roce_info->err_rq_idx_valid =3D true; - else - ctx_info->iwarp_info->err_rq_idx_valid =3D true; } else { if (info->ae_id !=3D IRDMA_AE_CQ_OPERATION_ERROR) continue; @@ -370,16 +366,12 @@ static void irdma_process_aeq(struct irdma_pci_f *rf) case IRDMA_AE_LCE_FUNCTION_CATASTROPHIC: case IRDMA_AE_LCE_CQ_CATASTROPHIC: case IRDMA_AE_UDA_XMIT_DGRAM_TOO_LONG: - if (rdma_protocol_roce(&iwdev->ibdev, 1)) - ctx_info->roce_info->err_rq_idx_valid =3D false; - else - ctx_info->iwarp_info->err_rq_idx_valid =3D false; - fallthrough; default: ibdev_err(&iwdev->ibdev, "abnormal ae_id =3D 0x%x bool qp=3D%d qp_id = =3D %d\n", info->ae_id, info->qp, info->qp_cq_id); if (rdma_protocol_roce(&iwdev->ibdev, 1)) { - if (!info->sq && ctx_info->roce_info->err_rq_idx_valid) { + ctx_info->roce_info->err_rq_idx_valid =3D info->rq; + if (info->rq) { ctx_info->roce_info->err_rq_idx =3D info->wqe_idx; irdma_sc_qp_setctx_roce(&iwqp->sc_qp, iwqp->host_ctx.va, ctx_info); @@ -388,7 +380,8 @@ static void irdma_process_aeq(struct irdma_pci_f *rf) irdma_cm_disconn(iwqp); break; } - if (!info->sq && ctx_info->iwarp_info->err_rq_idx_valid) { + ctx_info->iwarp_info->err_rq_idx_valid =3D info->rq; + if (info->rq) { ctx_info->iwarp_info->err_rq_idx =3D info->wqe_idx; ctx_info->tcp_info_valid =3D false; ctx_info->iwarp_info_valid =3D true; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B563AC00140 for ; Mon, 15 Aug 2022 22:13:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245220AbiHOWNb (ORCPT ); Mon, 15 Aug 2022 18:13:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349250AbiHOWL0 (ORCPT ); Mon, 15 Aug 2022 18:11:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A40C31342; Mon, 15 Aug 2022 12:38:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0D48EB80EB2; Mon, 15 Aug 2022 19:38:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DF5BC433C1; Mon, 15 Aug 2022 19:38:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592303; bh=weok3iHwUqW9l/tFNEfGTuwTKgKYFlTygOvmoFYZ3F0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TOc4PtsvzyjGjxknFbnVF1c1CKpr5pVU08gSbhl7eOQYX8Gsj122EFxbLbEKMvmvr jmBdfev+YvPY8t0KPdEOSAP78SxbG0D8GfDuKh1kn7tT9b5CZBHJxkn/78aV/xl/un fPa/aEPE5vBcDSphjgZ8Rh+wSgof2bbvx9/woO9I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, jinpu.wang@ionos.com, Md Haris Iqbal , Aleksei Marov , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.18 0767/1095] RDMA/rtrs-srv: Fix modinfo output for stringify Date: Mon, 15 Aug 2022 20:02:46 +0200 Message-Id: <20220815180500.988112287@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jack Wang [ Upstream commit ed6e53820ee4f68ed927de17e5675ff2a07a47e2 ] stringify works with define, not enum. Fixes: 91fddedd439c ("RDMA/rtrs: private headers with rtrs protocol structs= and helpers") Cc: jinpu.wang@ionos.com Link: https://lore.kernel.org/r/20220712103113.617754-2-haris.iqbal@ionos.c= om Signed-off-by: Jack Wang Signed-off-by: Md Haris Iqbal Reviewed-by: Aleksei Marov Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/ulp/rtrs/rtrs-pri.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-pri.h b/drivers/infiniband/ul= p/rtrs/rtrs-pri.h index 9a1e5c2ae55c..ac0df734eba8 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-pri.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h @@ -23,6 +23,17 @@ #define RTRS_PROTO_VER_STRING __stringify(RTRS_PROTO_VER_MAJOR) "." \ __stringify(RTRS_PROTO_VER_MINOR) =20 +/* + * Max IB immediate data size is 2^28 (MAX_IMM_PAYL_BITS) + * and the minimum chunk size is 4096 (2^12). + * So the maximum sess_queue_depth is 65536 (2^16) in theory. + * But mempool_create, create_qp and ib_post_send fail with + * "cannot allocate memory" error if sess_queue_depth is too big. + * Therefore the pratical max value of sess_queue_depth is + * somewhere between 1 and 65534 and it depends on the system. + */ +#define MAX_SESS_QUEUE_DEPTH 65535 + enum rtrs_imm_const { MAX_IMM_TYPE_BITS =3D 4, MAX_IMM_TYPE_MASK =3D ((1 << MAX_IMM_TYPE_BITS) - 1), @@ -46,16 +57,6 @@ enum { =20 MAX_PATHS_NUM =3D 128, =20 - /* - * Max IB immediate data size is 2^28 (MAX_IMM_PAYL_BITS) - * and the minimum chunk size is 4096 (2^12). - * So the maximum sess_queue_depth is 65536 (2^16) in theory. - * But mempool_create, create_qp and ib_post_send fail with - * "cannot allocate memory" error if sess_queue_depth is too big. - * Therefore the pratical max value of sess_queue_depth is - * somewhere between 1 and 65534 and it depends on the system. - */ - MAX_SESS_QUEUE_DEPTH =3D 65535, MIN_CHUNK_SIZE =3D 8192, =20 RTRS_HB_INTERVAL_MS =3D 5000, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55FE4C00140 for ; Mon, 15 Aug 2022 22:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347326AbiHOWNP (ORCPT ); Mon, 15 Aug 2022 18:13:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348757AbiHOWLS (ORCPT ); Mon, 15 Aug 2022 18:11:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 146AB11B4CD; Mon, 15 Aug 2022 12:38:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1DC15B80EA8; Mon, 15 Aug 2022 19:38:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B977C433C1; Mon, 15 Aug 2022 19:38:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592309; bh=Yd5JxsAxvVeLl/3MUyNfL0UzpXOtZWTk0Y5/jmYbEdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wreLAwM4ePuSCU3AG8Qzq5scrUUnmL2yFS/iVa9ORpwG2LONRxjuFTcZlksx7BXX/ ZDM/+QmTHhagr0t/tMT4ifiOqr8YREvVTSnudvcgE/SkBXhDn7z/vNw/IrwGnuDLlQ MAsBCjqwKPzMCMe6gHbFo+Xbuffi3iQn3F2r8aH4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, jinpu.wang@ionos.com, Md Haris Iqbal , Jason Gunthorpe , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.18 0768/1095] RDMA/rtrs-clt: Replace list_next_or_null_rr_rcu with an inline function Date: Mon, 15 Aug 2022 20:02:47 +0200 Message-Id: <20220815180501.030172119@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Md Haris Iqbal [ Upstream commit c14adff285ad1bb8eefc5d8fc202ceb1f7e3a2f1 ] removes list_next_or_null_rr_rcu macro to fix below warnings. That macro is used only twice. CHECK:MACRO_ARG_REUSE: Macro argument reuse 'head' - possible side-effects? CHECK:MACRO_ARG_REUSE: Macro argument reuse 'ptr' - possible side-effects? CHECK:MACRO_ARG_REUSE: Macro argument reuse 'memb' - possible side-effects? Replaces that macro with an inline function. Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality") Cc: jinpu.wang@ionos.com Link: https://lore.kernel.org/r/20220712103113.617754-5-haris.iqbal@ionos.c= om Signed-off-by: Md Haris Iqbal Suggested-by: Jason Gunthorpe Signed-off-by: Jack Wang Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 35 ++++++++++++-------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ul= p/rtrs/rtrs-clt.c index c2c860d0c56e..65bad1dd917b 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -740,25 +740,25 @@ struct path_it { struct rtrs_clt_path *(*next_path)(struct path_it *it); }; =20 -/** - * list_next_or_null_rr_rcu - get next list element in round-robin fashion. +/* + * rtrs_clt_get_next_path_or_null - get clt path from the list or return N= ULL * @head: the head for the list. - * @ptr: the list head to take the next element from. - * @type: the type of the struct this is embedded in. - * @memb: the name of the list_head within the struct. + * @clt_path: The element to take the next clt_path from. * - * Next element returned in round-robin fashion, i.e. head will be skipped, + * Next clt path returned in round-robin fashion, i.e. head will be skippe= d, * but if list is observed as empty, NULL will be returned. * - * This primitive may safely run concurrently with the _rcu list-mutation + * This function may safely run concurrently with the _rcu list-mutation * primitives such as list_add_rcu() as long as it's guarded by rcu_read_l= ock(). */ -#define list_next_or_null_rr_rcu(head, ptr, type, memb) \ -({ \ - list_next_or_null_rcu(head, ptr, type, memb) ?: \ - list_next_or_null_rcu(head, READ_ONCE((ptr)->next), \ - type, memb); \ -}) +static inline struct rtrs_clt_path * +rtrs_clt_get_next_path_or_null(struct list_head *head, struct rtrs_clt_pat= h *clt_path) +{ + return list_next_or_null_rcu(head, &clt_path->s.entry, typeof(*clt_path),= s.entry) ?: + list_next_or_null_rcu(head, + READ_ONCE((&clt_path->s.entry)->next), + typeof(*clt_path), s.entry); +} =20 /** * get_next_path_rr() - Returns path in round-robin fashion. @@ -789,10 +789,8 @@ static struct rtrs_clt_path *get_next_path_rr(struct p= ath_it *it) path =3D list_first_or_null_rcu(&clt->paths_list, typeof(*path), s.entry); else - path =3D list_next_or_null_rr_rcu(&clt->paths_list, - &path->s.entry, - typeof(*path), - s.entry); + path =3D rtrs_clt_get_next_path_or_null(&clt->paths_list, path); + rcu_assign_pointer(*ppcpu_path, path); =20 return path; @@ -2277,8 +2275,7 @@ static void rtrs_clt_remove_path_from_arr(struct rtrs= _clt_path *clt_path) * removed. If @sess is the last element, then @next is NULL. */ rcu_read_lock(); - next =3D list_next_or_null_rr_rcu(&clt->paths_list, &clt_path->s.entry, - typeof(*next), s.entry); + next =3D rtrs_clt_get_next_path_or_null(&clt->paths_list, clt_path); rcu_read_unlock(); =20 /* --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75E4DC00140 for ; Mon, 15 Aug 2022 22:13:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346782AbiHOWNI (ORCPT ); Mon, 15 Aug 2022 18:13:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348736AbiHOWLQ (ORCPT ); Mon, 15 Aug 2022 18:11:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C1CA11B4D6; Mon, 15 Aug 2022 12:38:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A8B76611E0; Mon, 15 Aug 2022 19:38:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C8A2C433D6; Mon, 15 Aug 2022 19:38:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592316; bh=5tpxLOFXVMmaWe+/GofZvF/HThOKUCePbpZoDQOPHrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RDOIxJDAbCjUG51LQzIZ6OSJuuDNDHHZjGajBmfDWXfVV7NkJaEUeMUh5FnFNYZTz QLVo5PBGKpnrJRYOFMEo34BTFwhkkrVlp3oBZGwmvNUgEPvgwf+tno/0zefcx7nKGM XCsM/28trTZj+HIqf6W2TA9ZJVrZ3yt+DvQVC6uA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , =?UTF-8?q?Michal=20Kalderon=C2=A0?= , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.18 0769/1095] RDMA/qedr: Fix potential memory leak in __qedr_alloc_mr() Date: Mon, 15 Aug 2022 20:02:48 +0200 Message-Id: <20220815180501.063037088@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jianglei Nie [ Upstream commit b3236a64ddd125a455ef5b5316c1b9051b732974 ] __qedr_alloc_mr() allocates a memory chunk for "mr->info.pbl_table" with init_mr_info(). When rdma_alloc_tid() and rdma_register_tid() fail, "mr" is released while "mr->info.pbl_table" is not released, which will lead to a memory leak. We should release the "mr->info.pbl_table" with qedr_free_pbl() when error occurs to fix the memory leak. Fixes: e0290cce6ac0 ("qedr: Add support for memory registeration verbs") Link: https://lore.kernel.org/r/20220714061505.2342759-1-niejianglei2021@16= 3.com Signed-off-by: Jianglei Nie Acked-by: Michal Kalderon=C2=A0 Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/hw/qedr/verbs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qed= r/verbs.c index df4d7970c1ad..cc99b293f0be 100644 --- a/drivers/infiniband/hw/qedr/verbs.c +++ b/drivers/infiniband/hw/qedr/verbs.c @@ -3083,7 +3083,7 @@ static struct qedr_mr *__qedr_alloc_mr(struct ib_pd *= ibpd, else DP_ERR(dev, "roce alloc tid returned error %d\n", rc); =20 - goto err0; + goto err1; } =20 /* Index only, 18 bit long, lkey =3D itid << 8 | key */ @@ -3107,7 +3107,7 @@ static struct qedr_mr *__qedr_alloc_mr(struct ib_pd *= ibpd, rc =3D dev->ops->rdma_register_tid(dev->rdma_ctx, &mr->hw_mr); if (rc) { DP_ERR(dev, "roce register tid returned an error %d\n", rc); - goto err1; + goto err2; } =20 mr->ibmr.lkey =3D mr->hw_mr.itid << 8 | mr->hw_mr.key; @@ -3116,8 +3116,10 @@ static struct qedr_mr *__qedr_alloc_mr(struct ib_pd = *ibpd, DP_DEBUG(dev, QEDR_MSG_MR, "alloc frmr: %x\n", mr->ibmr.lkey); return mr; =20 -err1: +err2: dev->ops->rdma_free_tid(dev->rdma_ctx, mr->hw_mr.itid); +err1: + qedr_free_pbl(dev, &mr->info.pbl_info, mr->info.pbl_table); err0: kfree(mr); return ERR_PTR(rc); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFC66C19F2C for ; Mon, 15 Aug 2022 22:13:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243833AbiHOWN0 (ORCPT ); Mon, 15 Aug 2022 18:13:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348766AbiHOWLS (ORCPT ); Mon, 15 Aug 2022 18:11:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2B343135B; Mon, 15 Aug 2022 12:38:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2CB3B611FB; Mon, 15 Aug 2022 19:38:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F7EDC433C1; Mon, 15 Aug 2022 19:38:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592325; bh=7ZSlsoMSU+gfHOXsr7fwBnWNyarphMMkVXwP75Du8lw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sCewpKnsWHCWlWoZUvgdfeReCs6Amdz3INuY61OeM3dWqMGPBJ7trTJBXJ9uvpSgL fWVGgn/pxrcnoNHgbQagBGm0Os5Gsc9eKCzsPcuHZjhJQ7rSq8mfIidn7o5b4hSfwT 7lkJNxWLhss1I0bY0v2g4HFSR6eg5qr+tOdz3er0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haoyue Xu , Wenpeng Liang , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.18 0770/1095] RDMA/hns: Fix incorrect clearing of interrupt status register Date: Mon, 15 Aug 2022 20:02:49 +0200 Message-Id: <20220815180501.105273519@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Haoyue Xu [ Upstream commit ecb4db5c3590aa956b4b2c352081a5b632d1f9f9 ] The driver will clear all the interrupts in the same area when the driver handles the interrupt of type AEQ overflow. It should only set the interrupt status bit of type AEQ overflow. Fixes: a5073d6054f7 ("RDMA/hns: Add eq support of hip08") Link: https://lore.kernel.org/r/20220714134353.16700-4-liangwenpeng@huawei.= com Signed-off-by: Haoyue Xu Signed-off-by: Wenpeng Liang Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniban= d/hw/hns/hns_roce_hw_v2.c index 86f6a4aae1e5..6e7dadc3386c 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -6125,8 +6125,8 @@ static irqreturn_t hns_roce_v2_msix_interrupt_abn(int= irq, void *dev_id) =20 dev_err(dev, "AEQ overflow!\n"); =20 - int_st |=3D 1 << HNS_ROCE_V2_VF_INT_ST_AEQ_OVERFLOW_S; - roce_write(hr_dev, ROCEE_VF_ABN_INT_ST_REG, int_st); + roce_write(hr_dev, ROCEE_VF_ABN_INT_ST_REG, + 1 << HNS_ROCE_V2_VF_INT_ST_AEQ_OVERFLOW_S); =20 /* Set reset level for reset_event() */ if (ops->set_default_reset_request) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01859C25B08 for ; Mon, 15 Aug 2022 22:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347628AbiHOWNh (ORCPT ); Mon, 15 Aug 2022 18:13:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349409AbiHOWL2 (ORCPT ); Mon, 15 Aug 2022 18:11:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4796F11CF03; Mon, 15 Aug 2022 12:38:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5897C611F5; Mon, 15 Aug 2022 19:38:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C0D6C433B5; Mon, 15 Aug 2022 19:38:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592331; bh=RZ0vulzf7UEz5azfjdo4BMoZmo2urF2aS/b4lpbo9RY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yePT1WGXAgnryqI8WecNkaihgP+QOVpXkGZliP7smrvwpDi73CRge6x91vosxzcal FjsTMu7neln7bIlgJSHZGpjC+++Mn8IkSaIHTp2gLxbbVBN4Egv89prfE0SaXNRV3g XjBxxiL+1BJC52DT3basRgDCWqMaWt8xzco3/Nz0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cheng Xu , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.18 0771/1095] RDMA/siw: Fix duplicated reported IW_CM_EVENT_CONNECT_REPLY event Date: Mon, 15 Aug 2022 20:02:50 +0200 Message-Id: <20220815180501.144431648@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cheng Xu [ Upstream commit 3056fc6c32e613b760422b94c7617ac9a24a4721 ] If siw_recv_mpa_rr returns -EAGAIN, it means that the MPA reply hasn't been received completely, and should not report IW_CM_EVENT_CONNECT_REPLY in this case. This may trigger a call trace in iw_cm. A simple way to trigger this: server: ib_send_lat client: ib_send_lat -R The call trace looks like this: kernel BUG at drivers/infiniband/core/iwcm.c:894! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI <...> Workqueue: iw_cm_wq cm_work_handler [iw_cm] Call Trace: cm_work_handler+0x1dd/0x370 [iw_cm] process_one_work+0x1e2/0x3b0 worker_thread+0x49/0x2e0 ? rescuer_thread+0x370/0x370 kthread+0xe5/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 Fixes: 6c52fdc244b5 ("rdma/siw: connection management") Link: https://lore.kernel.org/r/dae34b5fd5c2ea2bd9744812c1d2653a34a94c67.16= 57706960.git.chengyou@linux.alibaba.com Signed-off-by: Cheng Xu Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/sw/siw/siw_cm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw= /siw_cm.c index 17f34d584cd9..f88d2971c2c6 100644 --- a/drivers/infiniband/sw/siw/siw_cm.c +++ b/drivers/infiniband/sw/siw/siw_cm.c @@ -725,11 +725,11 @@ static int siw_proc_mpareply(struct siw_cep *cep) enum mpa_v2_ctrl mpa_p2p_mode =3D MPA_V2_RDMA_NO_RTR; =20 rv =3D siw_recv_mpa_rr(cep); - if (rv !=3D -EAGAIN) - siw_cancel_mpatimer(cep); if (rv) goto out_err; =20 + siw_cancel_mpatimer(cep); + rep =3D &cep->mpa.hdr; =20 if (__mpa_rr_revision(rep->params.bits) > MPA_REVISION_2) { @@ -895,7 +895,8 @@ static int siw_proc_mpareply(struct siw_cep *cep) } =20 out_err: - siw_cm_upcall(cep, IW_CM_EVENT_CONNECT_REPLY, -EINVAL); + if (rv !=3D -EAGAIN) + siw_cm_upcall(cep, IW_CM_EVENT_CONNECT_REPLY, -EINVAL); =20 return rv; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E84CC00140 for ; Mon, 15 Aug 2022 22:14:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243924AbiHOWOP (ORCPT ); Mon, 15 Aug 2022 18:14:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350143AbiHOWLz (ORCPT ); Mon, 15 Aug 2022 18:11:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2934911C94B; Mon, 15 Aug 2022 12:39:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6262E611F5; Mon, 15 Aug 2022 19:38:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65D5CC433C1; Mon, 15 Aug 2022 19:38:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592337; bh=W0RD0Kg8UlRlJt7SWg7KBf6zmN9tz+GCh7MlJ0bMdVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k4B7qFU7Px+yHfNxo9vG5nFxXx3nxCPgLKf62Kcua1sX3335Q+YAx2BTPjxZryBHm wzUHH/K10VRmY1L7ZVGO3aWfXmsUjmNA6985e7VNYWAXAOEApGg0CB5P8iEFzrnPx0 a6rwQqV4UYXiDmkFlCuPF5WBeLFBXIrp9BIGEU10= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , Gwendal Grignou , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.18 0772/1095] iio: cros: Register FIFO callback after sensor is registered Date: Mon, 15 Aug 2022 20:02:51 +0200 Message-Id: <20220815180501.191507713@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gwendal Grignou [ Upstream commit 0b4ae3f6d1210c11f9baf159009c7227eacf90f2 ] Instead of registering callback to process sensor events right at initialization time, wait for the sensor to be register in the iio subsystem. Events can come at probe time (in case the kernel rebooted abruptly without switching the sensor off for instance), and be sent to IIO core before the sensor is fully registered. Fixes: aa984f1ba4a4 ("iio: cros_ec: Register to cros_ec_sensorhub when EC s= upports FIFO") Reported-by: Douglas Anderson Signed-off-by: Gwendal Grignou Reviewed-by: Douglas Anderson Link: https://lore.kernel.org/r/20220711144716.642617-1-gwendal@chromium.org Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/accel/cros_ec_accel_legacy.c | 4 +- .../cros_ec_sensors/cros_ec_lid_angle.c | 4 +- .../common/cros_ec_sensors/cros_ec_sensors.c | 6 +- .../cros_ec_sensors/cros_ec_sensors_core.c | 58 ++++++++++++++----- drivers/iio/light/cros_ec_light_prox.c | 6 +- drivers/iio/pressure/cros_ec_baro.c | 6 +- .../linux/iio/common/cros_ec_sensors_core.h | 7 ++- 7 files changed, 60 insertions(+), 31 deletions(-) diff --git a/drivers/iio/accel/cros_ec_accel_legacy.c b/drivers/iio/accel/c= ros_ec_accel_legacy.c index b6f3471b62dc..3b77fded2dc0 100644 --- a/drivers/iio/accel/cros_ec_accel_legacy.c +++ b/drivers/iio/accel/cros_ec_accel_legacy.c @@ -215,7 +215,7 @@ static int cros_ec_accel_legacy_probe(struct platform_d= evice *pdev) return -ENOMEM; =20 ret =3D cros_ec_sensors_core_init(pdev, indio_dev, true, - cros_ec_sensors_capture, NULL); + cros_ec_sensors_capture); if (ret) return ret; =20 @@ -235,7 +235,7 @@ static int cros_ec_accel_legacy_probe(struct platform_d= evice *pdev) state->sign[CROS_EC_SENSOR_Z] =3D -1; } =20 - return devm_iio_device_register(dev, indio_dev); + return cros_ec_sensors_core_register(dev, indio_dev, NULL); } =20 static struct platform_driver cros_ec_accel_platform_driver =3D { diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_lid_angle.c b/drive= rs/iio/common/cros_ec_sensors/cros_ec_lid_angle.c index af801e203623..02d3cf36acb0 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_lid_angle.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_lid_angle.c @@ -97,7 +97,7 @@ static int cros_ec_lid_angle_probe(struct platform_device= *pdev) if (!indio_dev) return -ENOMEM; =20 - ret =3D cros_ec_sensors_core_init(pdev, indio_dev, false, NULL, NULL); + ret =3D cros_ec_sensors_core_init(pdev, indio_dev, false, NULL); if (ret) return ret; =20 @@ -113,7 +113,7 @@ static int cros_ec_lid_angle_probe(struct platform_devi= ce *pdev) if (ret) return ret; =20 - return devm_iio_device_register(dev, indio_dev); + return cros_ec_sensors_core_register(dev, indio_dev, NULL); } =20 static const struct platform_device_id cros_ec_lid_angle_ids[] =3D { diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers= /iio/common/cros_ec_sensors/cros_ec_sensors.c index 376a5b30010a..5cce34fdff02 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c @@ -235,8 +235,7 @@ static int cros_ec_sensors_probe(struct platform_device= *pdev) return -ENOMEM; =20 ret =3D cros_ec_sensors_core_init(pdev, indio_dev, true, - cros_ec_sensors_capture, - cros_ec_sensors_push_data); + cros_ec_sensors_capture); if (ret) return ret; =20 @@ -297,7 +296,8 @@ static int cros_ec_sensors_probe(struct platform_device= *pdev) else state->core.read_ec_sensors_data =3D cros_ec_sensors_read_cmd; =20 - return devm_iio_device_register(dev, indio_dev); + return cros_ec_sensors_core_register(dev, indio_dev, + cros_ec_sensors_push_data); } =20 static const struct platform_device_id cros_ec_sensors_ids[] =3D { diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/dr= ivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c index b2725c6adc7f..ed9716832161 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c @@ -234,21 +234,18 @@ static void cros_ec_sensors_core_clean(void *arg) =20 /** * cros_ec_sensors_core_init() - basic initialization of the core structure - * @pdev: platform device created for the sensors + * @pdev: platform device created for the sensor * @indio_dev: iio device structure of the device * @physical_device: true if the device refers to a physical device * @trigger_capture: function pointer to call buffer is triggered, * for backward compatibility. - * @push_data: function to call when cros_ec_sensorhub receives - * a sample for that sensor. * * Return: 0 on success, -errno on failure. */ int cros_ec_sensors_core_init(struct platform_device *pdev, struct iio_dev *indio_dev, bool physical_device, - cros_ec_sensors_capture_t trigger_capture, - cros_ec_sensorhub_push_data_cb_t push_data) + cros_ec_sensors_capture_t trigger_capture) { struct device *dev =3D &pdev->dev; struct cros_ec_sensors_core_state *state =3D iio_priv(indio_dev); @@ -339,17 +336,6 @@ int cros_ec_sensors_core_init(struct platform_device *= pdev, if (ret) return ret; =20 - ret =3D cros_ec_sensorhub_register_push_data( - sensor_hub, sensor_platform->sensor_num, - indio_dev, push_data); - if (ret) - return ret; - - ret =3D devm_add_action_or_reset( - dev, cros_ec_sensors_core_clean, pdev); - if (ret) - return ret; - /* Timestamp coming from FIFO are in ns since boot. */ ret =3D iio_device_set_clock(indio_dev, CLOCK_BOOTTIME); if (ret) @@ -371,6 +357,46 @@ int cros_ec_sensors_core_init(struct platform_device *= pdev, } EXPORT_SYMBOL_GPL(cros_ec_sensors_core_init); =20 +/** + * cros_ec_sensors_core_register() - Register callback to FIFO and IIO when + * sensor is ready. + * It must be called at the end of the sensor probe routine. + * @dev: device created for the sensor + * @indio_dev: iio device structure of the device + * @push_data: function to call when cros_ec_sensorhub receives + * a sample for that sensor. + * + * Return: 0 on success, -errno on failure. + */ +int cros_ec_sensors_core_register(struct device *dev, + struct iio_dev *indio_dev, + cros_ec_sensorhub_push_data_cb_t push_data) +{ + struct cros_ec_sensor_platform *sensor_platform =3D dev_get_platdata(dev); + struct cros_ec_sensorhub *sensor_hub =3D dev_get_drvdata(dev->parent); + struct platform_device *pdev =3D to_platform_device(dev); + struct cros_ec_dev *ec =3D sensor_hub->ec; + int ret; + + ret =3D devm_iio_device_register(dev, indio_dev); + if (ret) + return ret; + + if (!push_data || + !cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) + return 0; + + ret =3D cros_ec_sensorhub_register_push_data( + sensor_hub, sensor_platform->sensor_num, + indio_dev, push_data); + if (ret) + return ret; + + return devm_add_action_or_reset( + dev, cros_ec_sensors_core_clean, pdev); +} +EXPORT_SYMBOL_GPL(cros_ec_sensors_core_register); + /** * cros_ec_motion_send_host_cmd() - send motion sense host command * @state: pointer to state information for device diff --git a/drivers/iio/light/cros_ec_light_prox.c b/drivers/iio/light/cro= s_ec_light_prox.c index de472f23d1cb..16b893bae388 100644 --- a/drivers/iio/light/cros_ec_light_prox.c +++ b/drivers/iio/light/cros_ec_light_prox.c @@ -181,8 +181,7 @@ static int cros_ec_light_prox_probe(struct platform_dev= ice *pdev) return -ENOMEM; =20 ret =3D cros_ec_sensors_core_init(pdev, indio_dev, true, - cros_ec_sensors_capture, - cros_ec_sensors_push_data); + cros_ec_sensors_capture); if (ret) return ret; =20 @@ -240,7 +239,8 @@ static int cros_ec_light_prox_probe(struct platform_dev= ice *pdev) =20 state->core.read_ec_sensors_data =3D cros_ec_sensors_read_cmd; =20 - return devm_iio_device_register(dev, indio_dev); + return cros_ec_sensors_core_register(dev, indio_dev, + cros_ec_sensors_push_data); } =20 static const struct platform_device_id cros_ec_light_prox_ids[] =3D { diff --git a/drivers/iio/pressure/cros_ec_baro.c b/drivers/iio/pressure/cro= s_ec_baro.c index 2f882e109423..0511edbf868d 100644 --- a/drivers/iio/pressure/cros_ec_baro.c +++ b/drivers/iio/pressure/cros_ec_baro.c @@ -138,8 +138,7 @@ static int cros_ec_baro_probe(struct platform_device *p= dev) return -ENOMEM; =20 ret =3D cros_ec_sensors_core_init(pdev, indio_dev, true, - cros_ec_sensors_capture, - cros_ec_sensors_push_data); + cros_ec_sensors_capture); if (ret) return ret; =20 @@ -186,7 +185,8 @@ static int cros_ec_baro_probe(struct platform_device *p= dev) =20 state->core.read_ec_sensors_data =3D cros_ec_sensors_read_cmd; =20 - return devm_iio_device_register(dev, indio_dev); + return cros_ec_sensors_core_register(dev, indio_dev, + cros_ec_sensors_push_data); } =20 static const struct platform_device_id cros_ec_baro_ids[] =3D { diff --git a/include/linux/iio/common/cros_ec_sensors_core.h b/include/linu= x/iio/common/cros_ec_sensors_core.h index c582e1a14232..7b5dbd749995 100644 --- a/include/linux/iio/common/cros_ec_sensors_core.h +++ b/include/linux/iio/common/cros_ec_sensors_core.h @@ -95,8 +95,11 @@ int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev, = unsigned long scan_mask, struct platform_device; int cros_ec_sensors_core_init(struct platform_device *pdev, struct iio_dev *indio_dev, bool physical_device, - cros_ec_sensors_capture_t trigger_capture, - cros_ec_sensorhub_push_data_cb_t push_data); + cros_ec_sensors_capture_t trigger_capture); + +int cros_ec_sensors_core_register(struct device *dev, + struct iio_dev *indio_dev, + cros_ec_sensorhub_push_data_cb_t push_data); =20 irqreturn_t cros_ec_sensors_capture(int irq, void *p); int cros_ec_sensors_push_data(struct iio_dev *indio_dev, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DC36C00140 for ; Mon, 15 Aug 2022 22:14:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244943AbiHOWOu (ORCPT ); Mon, 15 Aug 2022 18:14:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350444AbiHOWMJ (ORCPT ); Mon, 15 Aug 2022 18:12:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A8E11DF4A; Mon, 15 Aug 2022 12:39:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 80023B80EAB; Mon, 15 Aug 2022 19:39:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAC2FC433B5; Mon, 15 Aug 2022 19:39:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592344; bh=16UJqo3H+WxB6sSAYTHta5epKtDW+Ctcr72dqRouIQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tUutC2MCAgDCDLbRlFioI7BIh3Qi9aL+smv6RE5+kTaSIv+51Xjng59RLlCuuaK/y ScCCKKgS71h4OY7lP+QeLRDVVt2hq9E2pZaHybuGB204PBlZdxtXOnE/UFALOQb3Dw xpLcaO/et40wajndyNe71wYjQOeZRpK6I229xxy8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Abel Vesa , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0773/1095] clk: qcom: Drop mmcx gdsc supply for dispcc and videocc Date: Mon, 15 Aug 2022 20:02:52 +0200 Message-Id: <20220815180501.232616214@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Abel Vesa [ Upstream commit b1ec8b53c9ae5fae33d60e9638d39ca5346b941b ] Both dispcc and videocc use mmcx power domain now. Lets drop the supply mmcx from every gdsc. Cc: Dmitry Baryshkov Fixes: 266e5cf39a0f ("arm64: dts: qcom: sm8250: remove mmcx regulator") Signed-off-by: Abel Vesa Reviewed-by: Dmitry Baryshkov Reviewed-by: Bjorn Andersson Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220713143200.3686765-1-abel.vesa@linaro.o= rg Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/dispcc-sm8250.c | 1 - drivers/clk/qcom/videocc-sm8250.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/drivers/clk/qcom/dispcc-sm8250.c b/drivers/clk/qcom/dispcc-sm8= 250.c index db9379634fb2..f646fdfe6f15 100644 --- a/drivers/clk/qcom/dispcc-sm8250.c +++ b/drivers/clk/qcom/dispcc-sm8250.c @@ -1134,7 +1134,6 @@ static struct gdsc mdss_gdsc =3D { }, .pwrsts =3D PWRSTS_OFF_ON, .flags =3D HW_CTRL, - .supply =3D "mmcx", }; =20 static struct clk_regmap *disp_cc_sm8250_clocks[] =3D { diff --git a/drivers/clk/qcom/videocc-sm8250.c b/drivers/clk/qcom/videocc-s= m8250.c index 8617454e4a77..f28f2cb051d7 100644 --- a/drivers/clk/qcom/videocc-sm8250.c +++ b/drivers/clk/qcom/videocc-sm8250.c @@ -277,7 +277,6 @@ static struct gdsc mvs0c_gdsc =3D { }, .flags =3D 0, .pwrsts =3D PWRSTS_OFF_ON, - .supply =3D "mmcx", }; =20 static struct gdsc mvs1c_gdsc =3D { @@ -287,7 +286,6 @@ static struct gdsc mvs1c_gdsc =3D { }, .flags =3D 0, .pwrsts =3D PWRSTS_OFF_ON, - .supply =3D "mmcx", }; =20 static struct gdsc mvs0_gdsc =3D { @@ -297,7 +295,6 @@ static struct gdsc mvs0_gdsc =3D { }, .flags =3D HW_CTRL, .pwrsts =3D PWRSTS_OFF_ON, - .supply =3D "mmcx", }; =20 static struct gdsc mvs1_gdsc =3D { @@ -307,7 +304,6 @@ static struct gdsc mvs1_gdsc =3D { }, .flags =3D HW_CTRL, .pwrsts =3D PWRSTS_OFF_ON, - .supply =3D "mmcx", }; =20 static struct clk_regmap *video_cc_sm8250_clocks[] =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B102EC00140 for ; Mon, 15 Aug 2022 22:14:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241076AbiHOWOr (ORCPT ); Mon, 15 Aug 2022 18:14:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350380AbiHOWMG (ORCPT ); Mon, 15 Aug 2022 18:12:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C44F011D51B; Mon, 15 Aug 2022 12:39:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E1932B80EB2; Mon, 15 Aug 2022 19:39:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36FB4C433D6; Mon, 15 Aug 2022 19:39:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592350; bh=nrWhq4iCZ7BN31NlTgoGvArbe2SU4K8P3fMYiYDV4vI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eM7Dvt7IE5b7/GtR8tGk2h8E7ymKzPPtEAJTWjVm/G8Cory06sn81c4MnTEdXDDAh If4CAHK3v/m7wZlCFtkARXphe++7A6nArU46cO/n409awEPwjVZSIZl9oTVtgv4O3t VG0zhbY6NDmdy4pXHmd665mxhDCJ0sZ/8rGS1eOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bjorn Andersson , Stephen Boyd , Sasha Levin Subject: [PATCH 5.18 0774/1095] clk: qcom: gdsc: Bump parent usage count when GDSC is found enabled Date: Mon, 15 Aug 2022 20:02:53 +0200 Message-Id: <20220815180501.272373978@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bjorn Andersson [ Upstream commit 41fff779d7948147f2440c4bb134cdf8b45b22d7 ] When a GDSC is found to be enabled at boot the pm_runtime state will be unbalanced as the GDSC is later turned off. Fix this by increasing the usage counter on the power-domain, in line with how we handled the regulator state. Fixes: 1b771839de05 ("clk: qcom: gdsc: enable optional power domain support= ") Signed-off-by: Bjorn Andersson Acked-by: Stephen Boyd Link: https://lore.kernel.org/r/20220713212818.130277-1-bjorn.andersson@lin= aro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/gdsc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c index 44520efc6c72..2db0938f8dd3 100644 --- a/drivers/clk/qcom/gdsc.c +++ b/drivers/clk/qcom/gdsc.c @@ -420,6 +420,14 @@ static int gdsc_init(struct gdsc *sc) return ret; } =20 + /* ...and the power-domain */ + ret =3D gdsc_pm_runtime_get(sc); + if (ret) { + if (sc->rsupply) + regulator_disable(sc->rsupply); + return ret; + } + /* * Votable GDSCs can be ON due to Vote from other masters. * If a Votable GDSC is ON, make sure we have a Vote. --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99BC3C00140 for ; Mon, 15 Aug 2022 22:19:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231441AbiHOWTM (ORCPT ); Mon, 15 Aug 2022 18:19:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343697AbiHOWPb (ORCPT ); Mon, 15 Aug 2022 18:15:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7D2B11F754; Mon, 15 Aug 2022 12:39:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 91E1D611F9; Mon, 15 Aug 2022 19:39:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89969C433D6; Mon, 15 Aug 2022 19:39:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592360; bh=gYJQV0CYwkY4S0gra6WnEjPpMfpNO/F+S1Ngd2WqFcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JxdayhxdAPNXDwvA1bR+DW2uYai+tQdDCtd7gyN/Et30i0yrE0zh33cYQh0ZAknIS V9nAhkVaz/J64fDuqCOJRMX9HdnOeupp7QceU5I7CTRjAxpKVfIMHfKBD+zYqz7AoW +COZGFCBJcoCrjKXCDs6xDe5rhWQJLIweO4RxcRc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0775/1095] clk: qcom: gcc-msm8939: Fix weird field spacing in ftbl_gcc_camss_cci_clk Date: Mon, 15 Aug 2022 20:02:54 +0200 Message-Id: <20220815180501.323380876@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bryan O'Donoghue [ Upstream commit 2bc308ebc453ba22f3f120f777b9ac48f973ee80 ] Adding a new item to this frequency table I see the existing indentation is incorrect. Fixes: 1664014e4679 ("clk: qcom: gcc-msm8939: Add MSM8939 Generic Clock Con= troller") Signed-off-by: Bryan O'Donoghue Reviewed-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220712125922.3461675-2-bryan.odonoghue@li= naro.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-msm8939.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/qcom/gcc-msm8939.c b/drivers/clk/qcom/gcc-msm8939.c index c7377ec0f423..de0022e5450d 100644 --- a/drivers/clk/qcom/gcc-msm8939.c +++ b/drivers/clk/qcom/gcc-msm8939.c @@ -1014,7 +1014,7 @@ static struct clk_rcg2 blsp1_uart2_apps_clk_src =3D { }; =20 static const struct freq_tbl ftbl_gcc_camss_cci_clk[] =3D { - F(19200000, P_XO, 1, 0, 0), + F(19200000, P_XO, 1, 0, 0), { } }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F945C3F6B0 for ; Mon, 15 Aug 2022 22:19:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245010AbiHOWTh (ORCPT ); Mon, 15 Aug 2022 18:19:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245684AbiHOWPk (ORCPT ); Mon, 15 Aug 2022 18:15:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 852306745A; Mon, 15 Aug 2022 12:39:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 48120B80EAD; Mon, 15 Aug 2022 19:39:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98D82C433B5; Mon, 15 Aug 2022 19:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592366; bh=NnNp7DWWOboATNhkynY0ZdcfWWZJZrnmvFmpd0g1rf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RVs3aSDHMCZrozmDbROchD1tQkB/8iKtW3UmRlM4PvW6CaRYK2tXHXwIw3PtC6Uc2 81wKCHQ5u80FveA7XXQOUciFkYXBTyTJjO7NEcPwoYqKVBMiVBCPTLbiuU4Ewz8lvi YR0CBoU3bimDdYHBWfUNDsP0z/9CSUOheBBYU1Rc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , Dennis Dalessandro , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.18 0776/1095] RDMA/hfi1: fix potential memory leak in setup_base_ctxt() Date: Mon, 15 Aug 2022 20:02:55 +0200 Message-Id: <20220815180501.371731518@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jianglei Nie [ Upstream commit aa2a1df3a2c85f855af7d54466ac10bd48645d63 ] setup_base_ctxt() allocates a memory chunk for uctxt->groups with hfi1_alloc_ctxt_rcv_groups(). When init_user_ctxt() fails, uctxt->groups is not released, which will lead to a memory leak. We should release the uctxt->groups with hfi1_free_ctxt_rcv_groups() when init_user_ctxt() fails. Fixes: e87473bc1b6c ("IB/hfi1: Only set fd pointer when base context is com= pletely initialized") Link: https://lore.kernel.org/r/20220711070718.2318320-1-niejianglei2021@16= 3.com Signed-off-by: Jianglei Nie Acked-by: Dennis Dalessandro Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/hw/hfi1/file_ops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/= hfi1/file_ops.c index 3ebdd42fec36..686d170a5947 100644 --- a/drivers/infiniband/hw/hfi1/file_ops.c +++ b/drivers/infiniband/hw/hfi1/file_ops.c @@ -1179,8 +1179,10 @@ static int setup_base_ctxt(struct hfi1_filedata *fd, goto done; =20 ret =3D init_user_ctxt(fd, uctxt); - if (ret) + if (ret) { + hfi1_free_ctxt_rcv_groups(uctxt); goto done; + } =20 user_init(uctxt); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0392AC25B08 for ; Mon, 15 Aug 2022 22:19:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350602AbiHOWTH (ORCPT ); Mon, 15 Aug 2022 18:19:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345040AbiHOWOw (ORCPT ); Mon, 15 Aug 2022 18:14:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C0656745B; Mon, 15 Aug 2022 12:39:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7FB7AB81141; Mon, 15 Aug 2022 19:39:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9C6DC433D6; Mon, 15 Aug 2022 19:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592372; bh=I0yTF2qYaIgcXNTD92Ug0VZKou04HKuY/Q+ASm9ai+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oAoKuxrEFncwjGoLC0SB6MCda2sGQQ0suDsXkCdr7IutmHbIWikWatwGDMs7kP6Ud KujJKHGR2EPKIldOBo6eQlQUfY9jcOHIycpBaB4k+9+A784a3vnsXmAOWBCBkzB9I9 85hRSVKv2bDujP4EQrWA6GKRZ+XAhnZkgJfVkks0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.18 0777/1095] gpio: gpiolib-of: Fix refcount bugs in of_mm_gpiochip_add_data() Date: Mon, 15 Aug 2022 20:02:56 +0200 Message-Id: <20220815180501.410976577@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 5d07a692f9562f9c06e62cce369e9dd108173a0f ] We should use of_node_get() when a new reference of device_node is created. It is noted that the old reference stored in 'mm_gc->gc.of_node' should also be decreased. This patch is based on the fact that there is a call site in function 'qe_add_gpiochips()' of src file 'drivers\soc\fsl\qe\gpio.c'. In this function, of_mm_gpiochip_add_data() is contained in an iteration of for_each_compatible_node() which will automatically increase and decrease the refcount. So we need additional of_node_get() for the reference escape in of_mm_gpiochip_add_data(). Fixes: a19e3da5bc5f ("of/gpio: Kill of_gpio_chip and add members directly t= o gpio_chip") Signed-off-by: Liang He Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpio/gpiolib-of.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 6dec81b1f24b..5cabb9a9c272 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -861,7 +861,8 @@ int of_mm_gpiochip_add_data(struct device_node *np, if (mm_gc->save_regs) mm_gc->save_regs(mm_gc); =20 - mm_gc->gc.of_node =3D np; + of_node_put(mm_gc->gc.of_node); + mm_gc->gc.of_node =3D of_node_get(np); =20 ret =3D gpiochip_add_data(gc, data); if (ret) @@ -869,6 +870,7 @@ int of_mm_gpiochip_add_data(struct device_node *np, =20 return 0; err2: + of_node_put(np); iounmap(mm_gc->regs); err1: kfree(gc->label); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12747C00140 for ; Mon, 15 Aug 2022 22:20:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347740AbiHOWUL (ORCPT ); Mon, 15 Aug 2022 18:20:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347522AbiHOWP6 (ORCPT ); Mon, 15 Aug 2022 18:15:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E53F4120A84; Mon, 15 Aug 2022 12:39:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D9D88B80EA7; Mon, 15 Aug 2022 19:39:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3577CC433D6; Mon, 15 Aug 2022 19:39:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592378; bh=09RnNxg19SQJ4cNTRE294GN7J1KK248eGE8198Ys4xk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cCQ6pOgRr7QTGYAmZ8JNSsRI/5fAGBzAhPvC/eWhxWcZNtMcSzgBmTwOUfGkeYd+t ZvfsQuKauPFHaSfQBsGLG5wukNe87iNiTrDV+Eb6ezS9/tIgVgQLnmI49U/zjBXTD7 WL8qc7Q4wB5G9exSELvhIN8S2g3Rj9NYIEuM7AcE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.18 0778/1095] iio: adc: max1027: unlock on error path in max1027_read_single_value() Date: Mon, 15 Aug 2022 20:02:57 +0200 Message-Id: <20220815180501.444960645@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 06ee60eb507f00fb3643876ec05318c63332dc88 ] If max1027_wait_eoc() fails then call iio_device_release_direct_mode() before returning. Fixes: a0e831653ef9 ("iio: adc: max1027: Introduce an end of conversion hel= per") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YsbztVuAXnau2cIZ@kili Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iio/adc/max1027.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c index b725d012625c..136fcf753837 100644 --- a/drivers/iio/adc/max1027.c +++ b/drivers/iio/adc/max1027.c @@ -349,8 +349,7 @@ static int max1027_read_single_value(struct iio_dev *in= dio_dev, if (ret < 0) { dev_err(&indio_dev->dev, "Failed to configure conversion register\n"); - iio_device_release_direct_mode(indio_dev); - return ret; + goto release; } =20 /* @@ -360,11 +359,12 @@ static int max1027_read_single_value(struct iio_dev *= indio_dev, */ ret =3D max1027_wait_eoc(indio_dev); if (ret) - return ret; + goto release; =20 /* Read result */ ret =3D spi_read(st->spi, st->buffer, (chan->type =3D=3D IIO_TEMP) ? 4 : = 2); =20 +release: iio_device_release_direct_mode(indio_dev); =20 if (ret < 0) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 012B3C25B08 for ; Mon, 15 Aug 2022 22:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347308AbiHOWTZ (ORCPT ); Mon, 15 Aug 2022 18:19:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347010AbiHOWPg (ORCPT ); Mon, 15 Aug 2022 18:15:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8BA111F771; Mon, 15 Aug 2022 12:39:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3174CB81141; Mon, 15 Aug 2022 19:39:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FD1EC433B5; Mon, 15 Aug 2022 19:39:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592384; bh=AcJrX1xUykEM0PUZFgTpse9dGF07x7CuOQftmr59ePw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x8gwfAPk6Utxl/Bu7Fxsa2Fw6lS555OoeJT7NRpJxBW2e0ajUpfCs5XPyNTuBqDt9 6EZetjyLv2zMiBQQub+YXIPxrAWjz8VjTyxuJBB1m+/48mHjI0vz1setPUmTvhhnjQ cAlyYtlmQieYeIKLrP38plKBpfHLAz/7228TI9/0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harshit Mogalapalli , Jiri Kosina , Sasha Levin Subject: [PATCH 5.18 0779/1095] HID: mcp2221: prevent a buffer overflow in mcp_smbus_write() Date: Mon, 15 Aug 2022 20:02:58 +0200 Message-Id: <20220815180501.492424937@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Harshit Mogalapalli [ Upstream commit 62ac2473553a00229e67bdf3cb023b62cf7f5a9a ] Smatch Warning: drivers/hid/hid-mcp2221.c:388 mcp_smbus_write() error: __memcpy() '&mcp->txbuf[5]' too small (59 vs 255) drivers/hid/hid-mcp2221.c:388 mcp_smbus_write() error: __memcpy() 'buf' too small (34 vs 255) The 'len' variable can take a value between 0-255 as it can come from data->block[0] and it is user data. So add an bound check to prevent a buffer overflow in memcpy(). Fixes: 67a95c21463d ("HID: mcp2221: add usb to i2c-smbus host bridge") Signed-off-by: Harshit Mogalapalli Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hid/hid-mcp2221.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hid/hid-mcp2221.c b/drivers/hid/hid-mcp2221.c index 4211b9839209..de52e9f7bb8c 100644 --- a/drivers/hid/hid-mcp2221.c +++ b/drivers/hid/hid-mcp2221.c @@ -385,6 +385,9 @@ static int mcp_smbus_write(struct mcp2221 *mcp, u16 add= r, data_len =3D 7; break; default: + if (len > I2C_SMBUS_BLOCK_MAX) + return -EINVAL; + memcpy(&mcp->txbuf[5], buf, len); data_len =3D len + 5; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79D4EC19F2C for ; Mon, 15 Aug 2022 22:20:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229839AbiHOWU0 (ORCPT ); Mon, 15 Aug 2022 18:20:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348183AbiHOWQV (ORCPT ); Mon, 15 Aug 2022 18:16:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E9707A75C; Mon, 15 Aug 2022 12:40:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C845B611F6; Mon, 15 Aug 2022 19:39:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4A74C433C1; Mon, 15 Aug 2022 19:39:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592394; bh=Lt3I10bBaab6peJvJL+7PA1gYSbRnSA2Jze6Kx9+sVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PmPxvpXWHMww+jpn09hObe32/+sWaBSLvZ7thlNqmpfLropxZK6dISWyGD9dN7c+P tm7V0nHNnFsMtPUdpKkV34o1ugNkrAPn5ssNzNR4zWu6khO8n0/tfGl0rgUuHwg5gd KR2BtRu8YG7rPdLLpOmepxg9L5uTQ0iGt72UwHzQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Basavaraj Natikar , Jiri Kosina , Sasha Levin Subject: [PATCH 5.18 0780/1095] HID: amd_sfh: Add NULL check for hid device Date: Mon, 15 Aug 2022 20:02:59 +0200 Message-Id: <20220815180501.524385994@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Basavaraj Natikar [ Upstream commit 06aa2a43c307cf4096f422dcb575e5d2913e528f ] On removal of hid device during SFH set report may cause NULL pointer exception. Hence add NULL check for hid device before accessing. Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fus= ion Hub (SFH)") Signed-off-by: Basavaraj Natikar Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hid/amd-sfh-hid/amd_sfh_hid.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_hid.c b/drivers/hid/amd-sfh-hi= d/amd_sfh_hid.c index e2a9679e32be..54fe224050f9 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_hid.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_hid.c @@ -100,11 +100,15 @@ static int amdtp_wait_for_response(struct hid_device = *hid) =20 void amdtp_hid_wakeup(struct hid_device *hid) { - struct amdtp_hid_data *hid_data =3D hid->driver_data; - struct amdtp_cl_data *cli_data =3D hid_data->cli_data; + struct amdtp_hid_data *hid_data; + struct amdtp_cl_data *cli_data; =20 - cli_data->request_done[cli_data->cur_hid_dev] =3D true; - wake_up_interruptible(&hid_data->hid_wait); + if (hid) { + hid_data =3D hid->driver_data; + cli_data =3D hid_data->cli_data; + cli_data->request_done[cli_data->cur_hid_dev] =3D true; + wake_up_interruptible(&hid_data->hid_wait); + } } =20 static struct hid_ll_driver amdtp_hid_ll_driver =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E037C19F2C for ; Mon, 15 Aug 2022 22:21:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346923AbiHOWUf (ORCPT ); Mon, 15 Aug 2022 18:20:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348418AbiHOWQf (ORCPT ); Mon, 15 Aug 2022 18:16:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3BC71ED; Mon, 15 Aug 2022 12:40:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EDDA0611E0; Mon, 15 Aug 2022 19:40:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBAA8C433D6; Mon, 15 Aug 2022 19:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592400; bh=dnDxbrsHDl7j52sf7NppzBaeDhtDkuLyAP/XkSnlv1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iy7sLEYO9G7c104lMD//cT7+5CdOGH09/slfDqjMLJFokLyIobadWZp9flxPiGk6k 3GynYQWqZVxms8KJ8tdxMkSzySIbBvfQBzgDA6jcK9xWlG8ZXpLoF2d60whEnaVnTI KT5w4sv0AimVZhfZt6f2V/V22/O7LXjQQFK9qQHw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Fabio Estevam , Vinod Koul , Sasha Levin Subject: [PATCH 5.18 0781/1095] dmaengine: imx-dma: Cast of_device_get_match_data() with (uintptr_t) Date: Mon, 15 Aug 2022 20:03:00 +0200 Message-Id: <20220815180501.569404789@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabio Estevam [ Upstream commit c3266ee185b59e5aab3e0f982e5b7f95d31555a7 ] Change the of_device_get_match_data() cast to (uintptr_t) to silence the following clang warning: drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum = imx_dma_type' from 'const void *' [-Wvoid-pointer-to-enum-cast] Reported-by: kernel test robot Fixes: 0ab785c894e6 ("dmaengine: imx-dma: Remove unused .id_table") Signed-off-by: Fabio Estevam Link: https://lore.kernel.org/r/20220706111327.940764-1-festevam@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/dma/imx-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index 2ddc31e64db0..da31e73d24d4 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -1047,7 +1047,7 @@ static int __init imxdma_probe(struct platform_device= *pdev) return -ENOMEM; =20 imxdma->dev =3D &pdev->dev; - imxdma->devtype =3D (enum imx_dma_type)of_device_get_match_data(&pdev->de= v); + imxdma->devtype =3D (uintptr_t)of_device_get_match_data(&pdev->dev); =20 res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); imxdma->base =3D devm_ioremap_resource(&pdev->dev, res); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA572C32762 for ; Mon, 15 Aug 2022 22:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348511AbiHOWVF (ORCPT ); Mon, 15 Aug 2022 18:21:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348853AbiHOWQw (ORCPT ); Mon, 15 Aug 2022 18:16:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CCF66542; Mon, 15 Aug 2022 12:40:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CD149B80EB2; Mon, 15 Aug 2022 19:40:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A491C433D6; Mon, 15 Aug 2022 19:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592406; bh=tcRxpjtw1HiPUhUHNS8nboJEdUsZZ/FIKajP6IXJOMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nEF8YDVo47QBqSdb058a5Q181r5+gNnbyn80C2LnM5ZRLemadsYrhf4VAkvut7B6L HocJJAzv9bqBtnDduKRyqWTDN23lrxrmhSC20FKzHp+Ww0dNvC/ckKy6YbPdrBTzmL m+biQy5+rlFkbZPlgh6BDmqfkAcYBxFk1UzWWi+Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antonio Borneo , John Ogness , Petr Mladek , Sasha Levin Subject: [PATCH 5.18 0782/1095] scripts/gdb: fix lx-dmesg on 32 bits arch Date: Mon, 15 Aug 2022 20:03:01 +0200 Message-Id: <20220815180501.616913399@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antonio Borneo [ Upstream commit e3c8d33e0d62175c31ca7ab7ab01b18f0b6318d3 ] The type atomic_long_t can have size 4 or 8 bytes, depending on CONFIG_64BIT; it's only content, the field 'counter', is either an int or a s64 value. Current code incorrectly uses the fixed size utils.read_u64() to read the field 'counter' inside atomic_long_t. On 32 bits architectures reading the last element 'tail_id' of the struct prb_desc_ring: struct prb_desc_ring { ... atomic_long_t tail_id; }; causes the utils.read_u64() to access outside the boundary of the struct and the gdb command 'lx-dmesg' exits with error: Python Exception : index out of range Error occurred in Python: index out of range Query the really used atomic_long_t counter type size. Link: https://lore.kernel.org/r/20220617143758.137307-1-antonio.borneo@foss= .st.com Fixes: e60768311af8 ("scripts/gdb: update for lockless printk ringbuffer") Signed-off-by: Antonio Borneo [pmladek@suse.com: Query the really used atomic_long_t counter type size] Tested-by: Antonio Borneo Reviewed-by: John Ogness Signed-off-by: Petr Mladek Link: https://lore.kernel.org/r/20220719122831.19890-1-pmladek@suse.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- scripts/gdb/linux/dmesg.py | 9 +++------ scripts/gdb/linux/utils.py | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/scripts/gdb/linux/dmesg.py b/scripts/gdb/linux/dmesg.py index d5983cf3db7d..c771831eb077 100644 --- a/scripts/gdb/linux/dmesg.py +++ b/scripts/gdb/linux/dmesg.py @@ -22,7 +22,6 @@ prb_desc_type =3D utils.CachedType("struct prb_desc") prb_desc_ring_type =3D utils.CachedType("struct prb_desc_ring") prb_data_ring_type =3D utils.CachedType("struct prb_data_ring") printk_ringbuffer_type =3D utils.CachedType("struct printk_ringbuffer") -atomic_long_type =3D utils.CachedType("atomic_long_t") =20 class LxDmesg(gdb.Command): """Print Linux kernel log buffer.""" @@ -68,8 +67,6 @@ class LxDmesg(gdb.Command): off =3D prb_data_ring_type.get_type()['data'].bitpos // 8 text_data_addr =3D utils.read_ulong(text_data_ring, off) =20 - counter_off =3D atomic_long_type.get_type()['counter'].bitpos // 8 - sv_off =3D prb_desc_type.get_type()['state_var'].bitpos // 8 =20 off =3D prb_desc_type.get_type()['text_blk_lpos'].bitpos // 8 @@ -89,9 +86,9 @@ class LxDmesg(gdb.Command): =20 # read in tail and head descriptor ids off =3D prb_desc_ring_type.get_type()['tail_id'].bitpos // 8 - tail_id =3D utils.read_u64(desc_ring, off + counter_off) + tail_id =3D utils.read_atomic_long(desc_ring, off) off =3D prb_desc_ring_type.get_type()['head_id'].bitpos // 8 - head_id =3D utils.read_u64(desc_ring, off + counter_off) + head_id =3D utils.read_atomic_long(desc_ring, off) =20 did =3D tail_id while True: @@ -102,7 +99,7 @@ class LxDmesg(gdb.Command): desc =3D utils.read_memoryview(inf, desc_addr + desc_off, desc= _sz).tobytes() =20 # skip non-committed record - state =3D 3 & (utils.read_u64(desc, sv_off + counter_off) >> d= esc_flags_shift) + state =3D 3 & (utils.read_atomic_long(desc, sv_off) >> desc_fl= ags_shift) if state !=3D desc_committed and state !=3D desc_finalized: if did =3D=3D head_id: break diff --git a/scripts/gdb/linux/utils.py b/scripts/gdb/linux/utils.py index ff7c1799d588..1553f68716cc 100644 --- a/scripts/gdb/linux/utils.py +++ b/scripts/gdb/linux/utils.py @@ -35,13 +35,12 @@ class CachedType: =20 =20 long_type =3D CachedType("long") - +atomic_long_type =3D CachedType("atomic_long_t") =20 def get_long_type(): global long_type return long_type.get_type() =20 - def offset_of(typeobj, field): element =3D gdb.Value(0).cast(typeobj) return int(str(element[field].address).split()[0], 16) @@ -129,6 +128,17 @@ def read_ulong(buffer, offset): else: return read_u32(buffer, offset) =20 +atomic_long_counter_offset =3D atomic_long_type.get_type()['counter'].bitp= os +atomic_long_counter_sizeof =3D atomic_long_type.get_type()['counter'].type= .sizeof + +def read_atomic_long(buffer, offset): + global atomic_long_counter_offset + global atomic_long_counter_sizeof + + if atomic_long_counter_sizeof =3D=3D 8: + return read_u64(buffer, offset + atomic_long_counter_offset) + else: + return read_u32(buffer, offset + atomic_long_counter_offset) =20 target_arch =3D None =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAE52C00140 for ; Mon, 15 Aug 2022 22:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348422AbiHOWVB (ORCPT ); Mon, 15 Aug 2022 18:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348783AbiHOWQt (ORCPT ); Mon, 15 Aug 2022 18:16:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A660721AD; Mon, 15 Aug 2022 12:40:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 38A0DB80EA7; Mon, 15 Aug 2022 19:40:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A62BC433C1; Mon, 15 Aug 2022 19:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592414; bh=NHPrvVnto3EMCBY8LbHNdEtDFe8etvb83mdQkSrVy8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PJuAK5syT0w9ayFyu4eFZzmc/Y9/CwIUsEzIoQtznnel/lqTGlg30TYMmlpcmOiCT CRvH6rj/epAUV8eFd+p+ntX0X4wEldJ9wVQgQrA5UuGja7QjgijR1ERwbouMiAfl26 lh5MTA5h4T1aGhWjSHsZdyq+6bcbutCbn7f+SUoc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Pearson , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.18 0783/1095] RDMA/rxe: Fix mw bind to allow any consumer key portion Date: Mon, 15 Aug 2022 20:03:02 +0200 Message-Id: <20220815180501.656208317@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bob Pearson [ Upstream commit 1603f89935ec86d40a7667e1250392626976ccc2 ] The current implementation of rxe_check_bind_mw() in rxe_mw.c is incorrect since it requires the new key portion provided by the mw consumer to be different than the previous key portion. This is not required by the IBA. Remove the test. Link: https://lore.kernel.org/linux-rdma/fb4614e7-4cac-0dc7-3ef7-766dfd10e8= f2@gmail.com/ Fixes: 32a577b4c3a9 ("Add support for bind MW work requests") Link: https://lore.kernel.org/r/20220714204619.13396-1-rpearsonhpe@gmail.com Signed-off-by: Bob Pearson Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/sw/rxe/rxe_mw.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_mw.c b/drivers/infiniband/sw/rxe= /rxe_mw.c index c86b2efd58f2..fc1416fc7feb 100644 --- a/drivers/infiniband/sw/rxe/rxe_mw.c +++ b/drivers/infiniband/sw/rxe/rxe_mw.c @@ -69,8 +69,6 @@ int rxe_dealloc_mw(struct ib_mw *ibmw) static int rxe_check_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe, struct rxe_mw *mw, struct rxe_mr *mr) { - u32 key =3D wqe->wr.wr.mw.rkey & 0xff; - if (mw->ibmw.type =3D=3D IB_MW_TYPE_1) { if (unlikely(mw->state !=3D RXE_MW_STATE_VALID)) { pr_err_once( @@ -108,11 +106,6 @@ static int rxe_check_bind_mw(struct rxe_qp *qp, struct= rxe_send_wqe *wqe, } } =20 - if (unlikely(key =3D=3D (mw->rkey & 0xff))) { - pr_err_once("attempt to bind MW with same key\n"); - return -EINVAL; - } - /* remaining checks only apply to a nonzero MR */ if (!mr) return 0; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC1F0C32763 for ; Mon, 15 Aug 2022 22:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348757AbiHOWVT (ORCPT ); Mon, 15 Aug 2022 18:21:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349634AbiHOWRK (ORCPT ); Mon, 15 Aug 2022 18:17:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A7192C115; Mon, 15 Aug 2022 12:40:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E6BC86120F; Mon, 15 Aug 2022 19:40:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A404DC433D6; Mon, 15 Aug 2022 19:40:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592420; bh=OBgG/fVVKPQLvqHzjSlNXO7UyFxMhf3DO59n0ZEWzTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cRh8mQfu4PVUA2i2hk8g8fdTPVsrUeZWEmH5GFARgsKS89cyiP9+4CXMNidAHztyJ gjy+VLed2jojJmNLutfHcrTDyU5ik37163Qkb3NujxEIG91riXILIHBR7kUNPYzlmX 4vvs/mpXbAJNg9tCiUwUFCRD0ESna6BmWk3FGK68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Ulf Hansson , Sasha Levin Subject: [PATCH 5.18 0784/1095] mmc: core: quirks: Add of_node_put() when breaking out of loop Date: Mon, 15 Aug 2022 20:03:03 +0200 Message-Id: <20220815180501.696161709@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 883c1d6fa4368a63cae2d6ae2d9c91141c60e233 ] In mmc_fixup_of_compatible_match(), we should call of_node_put() when breaking out of for_each_child_of_node() which will increase and decrease the refcount during one iteration. Fixes: b360b1102670 ("mmc: core: allow to match the device tree to apply qu= irks") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220719091051.1210806-1-windhl@126.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mmc/core/quirks.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h index f879dc63d936..be4393988086 100644 --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h @@ -163,8 +163,10 @@ static inline bool mmc_fixup_of_compatible_match(struc= t mmc_card *card, struct device_node *np; =20 for_each_child_of_node(mmc_dev(card->host)->of_node, np) { - if (of_device_is_compatible(np, compatible)) + if (of_device_is_compatible(np, compatible)) { + of_node_put(np); return true; + } } =20 return false; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77348C3276A for ; Mon, 15 Aug 2022 22:21:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349793AbiHOWVg (ORCPT ); Mon, 15 Aug 2022 18:21:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350040AbiHOWRZ (ORCPT ); Mon, 15 Aug 2022 18:17:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A73303FA35; Mon, 15 Aug 2022 12:40:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E1A62611F6; Mon, 15 Aug 2022 19:40:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBDE4C433D6; Mon, 15 Aug 2022 19:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592429; bh=0rSuf08xxpAs4juZrf9DdyilhYifmFUsrkyHzwVov84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s7hDHTbfErnEOTcMeRb+qLK6UgQR10OORmiB6UM3yZs1bRjq4nDphHUsKuk7cj31k VPf3J/2xMQU1ogCWfpLZEshZwJbeF/rlmPxkBAj9qYHnDV/kLdUJQY4r4PmJ0AZgO4 JlpG/8CcGVdec570Cf2ICWVKbi40PytOhdPMlZKA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Robert Richter , Ulf Hansson , Sasha Levin Subject: [PATCH 5.18 0785/1095] mmc: cavium-octeon: Add of_node_put() when breaking out of loop Date: Mon, 15 Aug 2022 20:03:04 +0200 Message-Id: <20220815180501.735590717@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 19bbb49acf8d7a03cb83e05624363741a4c3ec6f ] In octeon_mmc_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which has increased and decreased the refcount during each iteration. Fixes: 01d95843335c ("mmc: cavium: Add MMC support for Octeon SOCs.") Signed-off-by: Liang He Acked-by: Robert Richter Link: https://lore.kernel.org/r/20220719095216.1241601-1-windhl@126.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mmc/host/cavium-octeon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/host/cavium-octeon.c b/drivers/mmc/host/cavium-oct= eon.c index 2c4b2df52adb..12dca91a8ef6 100644 --- a/drivers/mmc/host/cavium-octeon.c +++ b/drivers/mmc/host/cavium-octeon.c @@ -277,6 +277,7 @@ static int octeon_mmc_probe(struct platform_device *pde= v) if (ret) { dev_err(&pdev->dev, "Error populating slots\n"); octeon_mmc_set_shared_power(host, 0); + of_node_put(cn); goto error; } i++; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 579B5C32767 for ; Mon, 15 Aug 2022 22:21:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349672AbiHOWVc (ORCPT ); Mon, 15 Aug 2022 18:21:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349891AbiHOWRR (ORCPT ); Mon, 15 Aug 2022 18:17:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3D6832D97; Mon, 15 Aug 2022 12:40:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EC202B80EB2; Mon, 15 Aug 2022 19:40:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33F76C433C1; Mon, 15 Aug 2022 19:40:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592435; bh=njgtn/5vil/3SWQGkDVgSDn7wCT+1DXns7cLGzDpX1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hCC9kkHJdSqB40vf7TOjcGyoNHqTugT/D30IiAaChcJwr8UqbCap5qzHCqFCcy/hK dpW3ExLnc6LixJACP4A8whQJKePO1SGIQkBQWLkCmqGwCi/iK/3eC/QTRGyaXph7+g yLsmiFPAzIlDXbSJERTObOblTEhuYngSRbSuyqC4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Robert Richter , Ulf Hansson , Sasha Levin Subject: [PATCH 5.18 0786/1095] mmc: cavium-thunderx: Add of_node_put() when breaking out of loop Date: Mon, 15 Aug 2022 20:03:05 +0200 Message-Id: <20220815180501.775726817@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 7ee480795e41db314f2c445c65ed854a5d6e8e32 ] In thunder_mmc_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which has increased and decreased the refcount during each iteration. Fixes: 166bac38c3c5 ("mmc: cavium: Add MMC PCI driver for ThunderX SOCs") Signed-off-by: Liang He Acked-by: Robert Richter Link: https://lore.kernel.org/r/20220719095216.1241601-2-windhl@126.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mmc/host/cavium-thunderx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/cavium-thunderx.c b/drivers/mmc/host/cavium-t= hunderx.c index 76013bbbcff3..202b1d6da678 100644 --- a/drivers/mmc/host/cavium-thunderx.c +++ b/drivers/mmc/host/cavium-thunderx.c @@ -142,8 +142,10 @@ static int thunder_mmc_probe(struct pci_dev *pdev, continue; =20 ret =3D cvm_mmc_of_slot_probe(&host->slot_pdev[i]->dev, host); - if (ret) + if (ret) { + of_node_put(child_node); goto error; + } } i++; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E60CC3276B for ; Mon, 15 Aug 2022 22:21:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350060AbiHOWVo (ORCPT ); Mon, 15 Aug 2022 18:21:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350296AbiHOWRn (ORCPT ); Mon, 15 Aug 2022 18:17:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E71D10775B; Mon, 15 Aug 2022 12:40:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6E098B80EAD; Mon, 15 Aug 2022 19:40:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1022C433D6; Mon, 15 Aug 2022 19:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592442; bh=LlWXzo+ay1TYd13G3nCLValj8epFIQqO5xQfwJDSVxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gJVq61s1iYWByH/Ua3yCmkTi4TFPaDYdUObD9/STixXhubapvQ5i//NLTy/Xc7kQk b7SfmjtA7Zj3aNB/xiwgWvdSR79pv0Heo17XBmyCGfBigaREg8dBB/3ZmWtdhZKLbk 9Ze2RN+aHW1hiAYQm9QDqyBvOKCVVP25a74gP4bA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Artem Borisov , Jiri Kosina , Sasha Levin Subject: [PATCH 5.18 0787/1095] HID: alps: Declare U1_UNICORN_LEGACY support Date: Mon, 15 Aug 2022 20:03:06 +0200 Message-Id: <20220815180501.807620995@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Artem Borisov [ Upstream commit 1117d182c5d72abd7eb8b7d5e7b8c3373181c3ab ] U1_UNICORN_LEGACY id was added to the driver, but was not declared in the device id table, making it impossible to use. Fixes: 640e403 ("HID: alps: Add AUI1657 device ID") Signed-off-by: Artem Borisov Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hid/hid-alps.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c index 2b986d0dbde4..db146d0f7937 100644 --- a/drivers/hid/hid-alps.c +++ b/drivers/hid/hid-alps.c @@ -830,6 +830,8 @@ static const struct hid_device_id alps_id[] =3D { USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1_DUAL) }, { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1) }, + { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, + USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY) }, { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_T4_BTNLESS) }, { } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BFC9C00140 for ; Mon, 15 Aug 2022 22:22:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346940AbiHOWWK (ORCPT ); Mon, 15 Aug 2022 18:22:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350351AbiHOWRq (ORCPT ); Mon, 15 Aug 2022 18:17:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85A34108978; Mon, 15 Aug 2022 12:40:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E1E2AB80EA9; Mon, 15 Aug 2022 19:40:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3516DC433C1; Mon, 15 Aug 2022 19:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592448; bh=l4lXvZEXXOSETi6/YJDc4cxoVT+OkLmsyME2xliMa0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QwrQcloQWQtISI9tpJjMxSny0+k6ATNzQyZHzIHeM84WfGf3uOc8HbAhWZ9k6sHYt Y10vNV7aq8oPkXWybSx3gjy6RsMxYI4dap+Xts7aGUOX3wU4yTXst01l50RDqUp8R/ xoqfulMeoFa2B8AIPKIBZHq076d51yz5VGz0ERBM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Md Haris Iqbal , Bob Pearson , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.18 0788/1095] RDMA/rxe: For invalidate compare according to set keys in mr Date: Mon, 15 Aug 2022 20:03:07 +0200 Message-Id: <20220815180501.846579817@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Md Haris Iqbal [ Upstream commit 174e7b137042f19b5ce88beb4fc0ff4ec6b0c72a ] The 'rkey' input can be an lkey or rkey, and in rxe the lkey or rkey have the same value, including the variant bits. So, if mr->rkey is set, compare the invalidate key with it, otherwise compare with the mr->lkey. Since we already did a lookup on the non-varient bits to get this far, the check's only purpose is to confirm that the wqe has the correct variant bits. Fixes: 001345339f4c ("RDMA/rxe: Separate HW and SW l/rkeys") Link: https://lore.kernel.org/r/20220707073006.328737-1-haris.phnx@gmail.com Signed-off-by: Md Haris Iqbal Reviewed-by: Bob Pearson Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/sw/rxe/rxe_loc.h | 2 +- drivers/infiniband/sw/rxe/rxe_mr.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rx= e/rxe_loc.h index 2ffbe3390668..2b0edf360474 100644 --- a/drivers/infiniband/sw/rxe/rxe_loc.h +++ b/drivers/infiniband/sw/rxe/rxe_loc.h @@ -77,7 +77,7 @@ struct rxe_mr *lookup_mr(struct rxe_pd *pd, int access, u= 32 key, enum rxe_mr_lookup_type type); int mr_check_range(struct rxe_mr *mr, u64 iova, size_t length); int advance_dma_data(struct rxe_dma_info *dma, unsigned int length); -int rxe_invalidate_mr(struct rxe_qp *qp, u32 rkey); +int rxe_invalidate_mr(struct rxe_qp *qp, u32 key); int rxe_reg_fast_mr(struct rxe_qp *qp, struct rxe_send_wqe *wqe); int rxe_mr_set_page(struct ib_mr *ibmr, u64 addr); int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata); diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe= /rxe_mr.c index 60a31b718774..76d6498e83f9 100644 --- a/drivers/infiniband/sw/rxe/rxe_mr.c +++ b/drivers/infiniband/sw/rxe/rxe_mr.c @@ -576,22 +576,22 @@ struct rxe_mr *lookup_mr(struct rxe_pd *pd, int acces= s, u32 key, return mr; } =20 -int rxe_invalidate_mr(struct rxe_qp *qp, u32 rkey) +int rxe_invalidate_mr(struct rxe_qp *qp, u32 key) { struct rxe_dev *rxe =3D to_rdev(qp->ibqp.device); struct rxe_mr *mr; int ret; =20 - mr =3D rxe_pool_get_index(&rxe->mr_pool, rkey >> 8); + mr =3D rxe_pool_get_index(&rxe->mr_pool, key >> 8); if (!mr) { - pr_err("%s: No MR for rkey %#x\n", __func__, rkey); + pr_err("%s: No MR for key %#x\n", __func__, key); ret =3D -EINVAL; goto err; } =20 - if (rkey !=3D mr->rkey) { - pr_err("%s: rkey (%#x) doesn't match mr->rkey (%#x)\n", - __func__, rkey, mr->rkey); + if (mr->rkey ? (key !=3D mr->rkey) : (key !=3D mr->lkey)) { + pr_err("%s: wr key (%#x) doesn't match mr key (%#x)\n", + __func__, key, (mr->rkey ? mr->rkey : mr->lkey)); ret =3D -EINVAL; goto err_drop_ref; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30004C25B08 for ; Mon, 15 Aug 2022 22:21:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243799AbiHOWV4 (ORCPT ); Mon, 15 Aug 2022 18:21:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350345AbiHOWRp (ORCPT ); Mon, 15 Aug 2022 18:17:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7925440BC6; Mon, 15 Aug 2022 12:41:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EB6DFB80EB2; Mon, 15 Aug 2022 19:40:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FEAAC433D6; Mon, 15 Aug 2022 19:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592454; bh=Jb5GjFZLTcVeXQn+3A9lDRbfEAoGBt20h7nDXicjZJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qGHYfF0t6Jv1XGnDygHEnQYcJTyGZPPSjm8nbXrs00Eqx7CPy1EgkWqVi9pAa06ns 1UYaqw0TkfsXsC3xsQCx6IsV/PA/XaG4P05l+/dVQy4vd5j8CY3Bvus/7xyIuKWEZq C5PbXx3J0lnIHPqm6y3XoIOAt3As8XOtrYSA0XE4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Pearson , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.18 0789/1095] RDMA/rxe: Fix rnr retry behavior Date: Mon, 15 Aug 2022 20:03:08 +0200 Message-Id: <20220815180501.875863590@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bob Pearson [ Upstream commit 445fd4f4fb76d513de6b05b08b3a4d0bb980fc80 ] Currently the completer tasklet when retransmit timer or the rnr timer fires the same flag (qp->req.need_retry) is set so that if either timer fires it will attempt to perform a retry flow on the send queue. This has the effect of responding to an RNR NAK at the first retransmit timer event which might not allow the requested rnr timeout. This patch adds a new flag (qp->req.wait_for_rnr_timer) which, if set, prevents a retry flow until the rnr nak timer fires. This patch fixes rnr retry errors which can be observed by running the pyverbs test_rdmacm_async_traffic_external_qp multiple times. With this patch applied they do not occur. Link: https://lore.kernel.org/linux-rdma/a8287823-1408-4273-bc22-99a0678db6= 40@gmail.com/ Link: https://lore.kernel.org/linux-rdma/2bafda9e-2bb6-186d-12a1-179e8f6a26= 78@talpey.com/ Fixes: 8700e3e7c485 ("Soft RoCE driver") Link: https://lore.kernel.org/r/20220630190425.2251-6-rpearsonhpe@gmail.com Signed-off-by: Bob Pearson Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/sw/rxe/rxe_comp.c | 8 +++++++- drivers/infiniband/sw/rxe/rxe_qp.c | 1 + drivers/infiniband/sw/rxe/rxe_req.c | 15 +++++++++++++-- drivers/infiniband/sw/rxe/rxe_verbs.h | 1 + 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/r= xe/rxe_comp.c index 138b3e7d3a5f..ec671e171f13 100644 --- a/drivers/infiniband/sw/rxe/rxe_comp.c +++ b/drivers/infiniband/sw/rxe/rxe_comp.c @@ -114,6 +114,8 @@ void retransmit_timer(struct timer_list *t) { struct rxe_qp *qp =3D from_timer(qp, t, retrans_timer); =20 + pr_debug("%s: fired for qp#%d\n", __func__, qp->elem.index); + if (qp->valid) { qp->comp.timeout =3D 1; rxe_run_task(&qp->comp.task, 1); @@ -729,11 +731,15 @@ int rxe_completer(void *arg) break; =20 case COMPST_RNR_RETRY: + /* we come here if we received an RNR NAK */ if (qp->comp.rnr_retry > 0) { if (qp->comp.rnr_retry !=3D 7) qp->comp.rnr_retry--; =20 - qp->req.need_retry =3D 1; + /* don't start a retry flow until the + * rnr timer has fired + */ + qp->req.wait_for_rnr_timer =3D 1; pr_debug("qp#%d set rnr nak timer\n", qp_num(qp)); mod_timer(&qp->rnr_nak_timer, diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe= /rxe_qp.c index 62acf890af6c..7d0c4432d3fd 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -513,6 +513,7 @@ static void rxe_qp_reset(struct rxe_qp *qp) atomic_set(&qp->ssn, 0); qp->req.opcode =3D -1; qp->req.need_retry =3D 0; + qp->req.wait_for_rnr_timer =3D 0; qp->req.noack_pkts =3D 0; qp->resp.msn =3D 0; qp->resp.opcode =3D -1; diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rx= e/rxe_req.c index d574c47099b8..90669b3c56af 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -103,7 +103,11 @@ void rnr_nak_timer(struct timer_list *t) { struct rxe_qp *qp =3D from_timer(qp, t, rnr_nak_timer); =20 - pr_debug("qp#%d rnr nak timer fired\n", qp_num(qp)); + pr_debug("%s: fired for qp#%d\n", __func__, qp_num(qp)); + + /* request a send queue retry */ + qp->req.need_retry =3D 1; + qp->req.wait_for_rnr_timer =3D 0; rxe_run_task(&qp->req.task, 1); } =20 @@ -626,10 +630,17 @@ int rxe_requester(void *arg) qp->req.need_rd_atomic =3D 0; qp->req.wait_psn =3D 0; qp->req.need_retry =3D 0; + qp->req.wait_for_rnr_timer =3D 0; goto exit; } =20 - if (unlikely(qp->req.need_retry)) { + /* we come here if the retransmot timer has fired + * or if the rnr timer has fired. If the retransmit + * timer fires while we are processing an RNR NAK wait + * until the rnr timer has fired before starting the + * retry flow + */ + if (unlikely(qp->req.need_retry && !qp->req.wait_for_rnr_timer)) { req_retry(qp); qp->req.need_retry =3D 0; } diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/= rxe/rxe_verbs.h index e7eff1ca75e9..33e8d0547553 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.h +++ b/drivers/infiniband/sw/rxe/rxe_verbs.h @@ -123,6 +123,7 @@ struct rxe_req_info { int need_rd_atomic; int wait_psn; int need_retry; + int wait_for_rnr_timer; int noack_pkts; struct rxe_task task; }; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51233C00140 for ; Mon, 15 Aug 2022 22:22:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347059AbiHOWWU (ORCPT ); Mon, 15 Aug 2022 18:22:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350437AbiHOWRu (ORCPT ); Mon, 15 Aug 2022 18:17:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A42C51232D2; Mon, 15 Aug 2022 12:41:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D033C611E0; Mon, 15 Aug 2022 19:41:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF19CC433C1; Mon, 15 Aug 2022 19:41:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592464; bh=0nr3dvpuE+TRL/Rv3+CcJjSKcgLnDpBsi++iakikz4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vh2RLvpdNuVAi+bmkO3jK4pXErNtde8C7gZECoTBHPwm+n7pDiC+Ea2sJUm1pc0dZ emYTRrOPngnXW4oIKI1PezzdnhjhVHmd/CSRqsZNWD1EbPe6FABg2O4f2DPJ6V8zYY QqcxcumZDYtQ6S/S2w2Likn4Tt0YT734yHReuxCQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vidya Sagar , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.18 0790/1095] PCI: tegra194: Fix Root Port interrupt handling Date: Mon, 15 Aug 2022 20:03:09 +0200 Message-Id: <20220815180501.915410366@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vidya Sagar [ Upstream commit 6646e99bcec627e866bc84365af37942c72b4b76 ] As part of Root Port interrupt handling, level-0 register is read first and based on the bits set in that, corresponding level-1 registers are read for further interrupt processing. Since both these values are currently read into the same 'val' variable, checking level-0 bits the second time around is happening on the 'val' variable value of level-1 register contents instead of freshly reading the level-0 value again. Fix by using different variables to store level-0 and level-1 registers contents. Link: https://lore.kernel.org/r/20220721142052.25971-11-vidyas@nvidia.com Fixes: 56e15a238d92 ("PCI: tegra: Add Tegra194 PCIe support") Signed-off-by: Vidya Sagar Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-tegra194.c | 46 +++++++++++----------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/contr= oller/dwc/pcie-tegra194.c index 0888c3726414..85d405057ba8 100644 --- a/drivers/pci/controller/dwc/pcie-tegra194.c +++ b/drivers/pci/controller/dwc/pcie-tegra194.c @@ -352,15 +352,14 @@ static irqreturn_t tegra_pcie_rp_irq_handler(int irq,= void *arg) struct tegra194_pcie *pcie =3D arg; struct dw_pcie *pci =3D &pcie->pci; struct pcie_port *pp =3D &pci->pp; - u32 val, tmp; + u32 val, status_l0, status_l1; u16 val_w; =20 - val =3D appl_readl(pcie, APPL_INTR_STATUS_L0); - if (val & APPL_INTR_STATUS_L0_LINK_STATE_INT) { - val =3D appl_readl(pcie, APPL_INTR_STATUS_L1_0_0); - if (val & APPL_INTR_STATUS_L1_0_0_LINK_REQ_RST_NOT_CHGED) { - appl_writel(pcie, val, APPL_INTR_STATUS_L1_0_0); - + status_l0 =3D appl_readl(pcie, APPL_INTR_STATUS_L0); + if (status_l0 & APPL_INTR_STATUS_L0_LINK_STATE_INT) { + status_l1 =3D appl_readl(pcie, APPL_INTR_STATUS_L1_0_0); + appl_writel(pcie, status_l1, APPL_INTR_STATUS_L1_0_0); + if (status_l1 & APPL_INTR_STATUS_L1_0_0_LINK_REQ_RST_NOT_CHGED) { /* SBR & Surprise Link Down WAR */ val =3D appl_readl(pcie, APPL_CAR_RESET_OVRD); val &=3D ~APPL_CAR_RESET_OVRD_CYA_OVERRIDE_CORE_RST_N; @@ -376,15 +375,15 @@ static irqreturn_t tegra_pcie_rp_irq_handler(int irq,= void *arg) } } =20 - if (val & APPL_INTR_STATUS_L0_INT_INT) { - val =3D appl_readl(pcie, APPL_INTR_STATUS_L1_8_0); - if (val & APPL_INTR_STATUS_L1_8_0_AUTO_BW_INT_STS) { + if (status_l0 & APPL_INTR_STATUS_L0_INT_INT) { + status_l1 =3D appl_readl(pcie, APPL_INTR_STATUS_L1_8_0); + if (status_l1 & APPL_INTR_STATUS_L1_8_0_AUTO_BW_INT_STS) { appl_writel(pcie, APPL_INTR_STATUS_L1_8_0_AUTO_BW_INT_STS, APPL_INTR_STATUS_L1_8_0); apply_bad_link_workaround(pp); } - if (val & APPL_INTR_STATUS_L1_8_0_BW_MGT_INT_STS) { + if (status_l1 & APPL_INTR_STATUS_L1_8_0_BW_MGT_INT_STS) { appl_writel(pcie, APPL_INTR_STATUS_L1_8_0_BW_MGT_INT_STS, APPL_INTR_STATUS_L1_8_0); @@ -396,25 +395,24 @@ static irqreturn_t tegra_pcie_rp_irq_handler(int irq,= void *arg) } } =20 - val =3D appl_readl(pcie, APPL_INTR_STATUS_L0); - if (val & APPL_INTR_STATUS_L0_CDM_REG_CHK_INT) { - val =3D appl_readl(pcie, APPL_INTR_STATUS_L1_18); - tmp =3D dw_pcie_readl_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS); - if (val & APPL_INTR_STATUS_L1_18_CDM_REG_CHK_CMPLT) { + if (status_l0 & APPL_INTR_STATUS_L0_CDM_REG_CHK_INT) { + status_l1 =3D appl_readl(pcie, APPL_INTR_STATUS_L1_18); + val =3D dw_pcie_readl_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS); + if (status_l1 & APPL_INTR_STATUS_L1_18_CDM_REG_CHK_CMPLT) { dev_info(pci->dev, "CDM check complete\n"); - tmp |=3D PCIE_PL_CHK_REG_CHK_REG_COMPLETE; + val |=3D PCIE_PL_CHK_REG_CHK_REG_COMPLETE; } - if (val & APPL_INTR_STATUS_L1_18_CDM_REG_CHK_CMP_ERR) { + if (status_l1 & APPL_INTR_STATUS_L1_18_CDM_REG_CHK_CMP_ERR) { dev_err(pci->dev, "CDM comparison mismatch\n"); - tmp |=3D PCIE_PL_CHK_REG_CHK_REG_COMPARISON_ERROR; + val |=3D PCIE_PL_CHK_REG_CHK_REG_COMPARISON_ERROR; } - if (val & APPL_INTR_STATUS_L1_18_CDM_REG_CHK_LOGIC_ERR) { + if (status_l1 & APPL_INTR_STATUS_L1_18_CDM_REG_CHK_LOGIC_ERR) { dev_err(pci->dev, "CDM Logic error\n"); - tmp |=3D PCIE_PL_CHK_REG_CHK_REG_LOGIC_ERROR; + val |=3D PCIE_PL_CHK_REG_CHK_REG_LOGIC_ERROR; } - dw_pcie_writel_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS, tmp); - tmp =3D dw_pcie_readl_dbi(pci, PCIE_PL_CHK_REG_ERR_ADDR); - dev_err(pci->dev, "CDM Error Address Offset =3D 0x%08X\n", tmp); + dw_pcie_writel_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS, val); + val =3D dw_pcie_readl_dbi(pci, PCIE_PL_CHK_REG_ERR_ADDR); + dev_err(pci->dev, "CDM Error Address Offset =3D 0x%08X\n", val); } =20 return IRQ_HANDLED; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E4C2C19F2C for ; Mon, 15 Aug 2022 22:22:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348169AbiHOWWt (ORCPT ); Mon, 15 Aug 2022 18:22:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350595AbiHOWSG (ORCPT ); Mon, 15 Aug 2022 18:18:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D37AD1237B3; Mon, 15 Aug 2022 12:41:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A935D610A5; Mon, 15 Aug 2022 19:41:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9648CC433C1; Mon, 15 Aug 2022 19:41:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592470; bh=ZtONQ8XSpOXOQxcmGuU/YXF7E00mNmKvlX58loiVN4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J7hp62um7P6NeaU6Wmh/LOs2sTInCleG4IuMHxuv1iD9AL5moUYUE9IEX8w2fHCNN 5fp+a2t1R/6s+Qmdaz0AOfIga5dNKAkucmbvWUr5Q/GuXN/OFXBvyCW6TIxNUz44vU KneytjrT/n4uvOfBCsdnar8Zt97mcZtZ+cLwUem8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vidya Sagar , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.18 0791/1095] PCI: tegra194: Fix link up retry sequence Date: Mon, 15 Aug 2022 20:03:10 +0200 Message-Id: <20220815180501.963824498@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vidya Sagar [ Upstream commit e05fd6ae77c3e2cc0dba283005d24b6d56d2b1fa ] Add the missing DLF capability offset while clearing DL_FEATURE_EXCHANGE_EN bit during link up retry. Link: https://lore.kernel.org/r/20220721142052.25971-15-vidyas@nvidia.com Fixes: 56e15a238d92 ("PCI: tegra: Add Tegra194 PCIe support") Signed-off-by: Vidya Sagar Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-tegra194.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/contr= oller/dwc/pcie-tegra194.c index 85d405057ba8..a479e58cc8fb 100644 --- a/drivers/pci/controller/dwc/pcie-tegra194.c +++ b/drivers/pci/controller/dwc/pcie-tegra194.c @@ -978,7 +978,7 @@ static int tegra194_pcie_start_link(struct dw_pcie *pci) offset =3D dw_pcie_find_ext_capability(pci, PCI_EXT_CAP_ID_DLF); val =3D dw_pcie_readl_dbi(pci, offset + PCI_DLF_CAP); val &=3D ~PCI_DLF_EXCHANGE_ENABLE; - dw_pcie_writel_dbi(pci, offset, val); + dw_pcie_writel_dbi(pci, offset + PCI_DLF_CAP, val); =20 tegra194_pcie_host_init(pp); dw_pcie_setup_rc(pp); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A1AEC3F6B0 for ; Mon, 15 Aug 2022 22:32:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349749AbiHOWbI (ORCPT ); Mon, 15 Aug 2022 18:31:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349656AbiHOW0D (ORCPT ); Mon, 15 Aug 2022 18:26:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 659F4127BD0; Mon, 15 Aug 2022 12:44:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E96076120F; Mon, 15 Aug 2022 19:44:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D855AC433D6; Mon, 15 Aug 2022 19:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592686; bh=CUjDrPTV27jSN1ucbZYKPwsC8fO7x4ZEi5LF9MQZtMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iSBhOUASLJMzHBlOawaoIeI+YyGsl3wsvfXrX2vW/DrMDd+IW052Rij1tAaezuBAj TFAUGkHtE40KSUHMvUY4hltWyFwOcbb+0kl3Rfaipif2u4grFdQbGtNXfd5EJmWAEN MrU7EugjD1zMTGOoxV/oQV/8Ufemrw3UF3nVF5gE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Basavaraj Natikar , Jiri Kosina , Sasha Levin Subject: [PATCH 5.18 0792/1095] HID: amd_sfh: Handle condition of "no sensors" Date: Mon, 15 Aug 2022 20:03:11 +0200 Message-Id: <20220815180502.004422365@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Basavaraj Natikar [ Upstream commit 5d4d0f15657535f6a122ab26d47230b5c2b944af ] Add a check for num_hid_devices to handle special case the situation of "no sensors". Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fus= ion Hub (SFH)") Signed-off-by: Basavaraj Natikar Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hid/amd-sfh-hid/amd_sfh_client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_client.c b/drivers/hid/amd-sfh= -hid/amd_sfh_client.c index 444acd9e2cd6..8be33cf3b6c2 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c @@ -155,6 +155,8 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdat= a) dev =3D &privdata->pdev->dev; =20 cl_data->num_hid_devices =3D amd_mp2_get_sensor_num(privdata, &cl_data->s= ensor_idx[0]); + if (cl_data->num_hid_devices =3D=3D 0) + return -ENODEV; =20 INIT_DELAYED_WORK(&cl_data->work, amd_sfh_work); INIT_DELAYED_WORK(&cl_data->work_buffer, amd_sfh_work_buffer); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40F32C00140 for ; Mon, 15 Aug 2022 22:23:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348301AbiHOWXc (ORCPT ); Mon, 15 Aug 2022 18:23:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350774AbiHOWSa (ORCPT ); Mon, 15 Aug 2022 18:18:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76BCA419B2; Mon, 15 Aug 2022 12:41:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E48A161089; Mon, 15 Aug 2022 19:41:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6E72C433C1; Mon, 15 Aug 2022 19:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592488; bh=l1DpSV+JZmB6Uto3+hA8ft5nZq/mq6tTv8aWI1ilAHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p+zjfSN+TU16i/YUWxypmRwYZz2Zxy45vX615bNV8qj3djrzFiuwtL3TKMhC3I894 GMnRzJFTCeegsR9rw8fVM0uE7G7SrB3oHDt+6ghb8sLdMLw3gzNXjqB5jHfe9W0sOw E6FbO2vwPqWC4c8CJYgXdf3Byebljzh0iydS1g8Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Sasha Levin Subject: [PATCH 5.18 0793/1095] USB: serial: fix tty-port initialized comments Date: Mon, 15 Aug 2022 20:03:12 +0200 Message-Id: <20220815180502.041681392@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold [ Upstream commit 688ee1d1785c1359f9040f615dd8e6054962bce2 ] Fix up the tty-port initialized comments which got truncated and obfuscated when replacing the old ASYNCB_INITIALIZED flag. Fixes: d41861ca19c9 ("tty: Replace ASYNC_INITIALIZED bit and update atomica= lly") Reviewed-by: Greg Kroah-Hartman Signed-off-by: Johan Hovold Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/serial/sierra.c | 3 ++- drivers/usb/serial/usb-serial.c | 2 +- drivers/usb/serial/usb_wwan.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 9d56138133a9..ef6a2891f290 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -737,7 +737,8 @@ static void sierra_close(struct usb_serial_port *port) =20 /* * Need to take susp_lock to make sure port is not already being - * resumed, but no need to hold it due to initialized + * resumed, but no need to hold it due to the tty-port initialized + * flag. */ spin_lock_irq(&intfdata->susp_lock); if (--intfdata->open_ports =3D=3D 0) diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-seria= l.c index 24101bd7fcad..e35bea2235c1 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -295,7 +295,7 @@ static int serial_open(struct tty_struct *tty, struct f= ile *filp) * * Shut down a USB serial port. Serialized against activate by the * tport mutex and kept to matching open/close pairs - * of calls by the initialized flag. + * of calls by the tty-port initialized flag. * * Not called if tty is console. */ diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index dab38b63eaf7..cc81ab7ef4da 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -388,7 +388,8 @@ void usb_wwan_close(struct usb_serial_port *port) =20 /* * Need to take susp_lock to make sure port is not already being - * resumed, but no need to hold it due to initialized + * resumed, but no need to hold it due to the tty-port initialized + * flag. */ spin_lock_irq(&intfdata->susp_lock); if (--intfdata->open_ports =3D=3D 0) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEBDCC19F2C for ; Mon, 15 Aug 2022 22:24:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347539AbiHOWYx (ORCPT ); Mon, 15 Aug 2022 18:24:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350803AbiHOWSg (ORCPT ); Mon, 15 Aug 2022 18:18:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F3D565658; Mon, 15 Aug 2022 12:42:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2BCF5B80EA9; Mon, 15 Aug 2022 19:42:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DF55C433D6; Mon, 15 Aug 2022 19:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592523; bh=USaoXt23dkPCUkqdy9sXfYf2lS1Nk6uh96T3TB7tnc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PhUu8cL8MxSm/1fbx8Paz5FyYwYK5XXB8vwouMiPbZc6mmto8E+qzs3AqnlVDuBzM H/9Zng8lDJhV4RVqaHufuBpV4rOhi1YXfVoZGdSbIvg9/dcfRBGgOmSXwZhAfGVXY4 MO66A/Us22DMQFdvShOQeeAwfmq/39fmLmfzW7VE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Chen , Andrey Strachuk , Sasha Levin Subject: [PATCH 5.18 0794/1095] usb: cdns3: change place of priv_ep assignment in cdns3_gadget_ep_dequeue(), cdns3_gadget_ep_enable() Date: Mon, 15 Aug 2022 20:03:13 +0200 Message-Id: <20220815180502.091601971@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrey Strachuk [ Upstream commit c3ffc9c4ca44bfe9562166793d133e1fb0630ea6 ] If 'ep' is NULL, result of ep_to_cdns3_ep(ep) is invalid pointer and its dereference with priv_ep->cdns3_dev may cause panic. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver") Acked-by: Peter Chen Signed-off-by: Andrey Strachuk Link: https://lore.kernel.org/r/20220718160052.4188-1-strochuk@ispras.ru Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/cdns3/cdns3-gadget.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gad= get.c index d6d515d598dc..e0cf62e65075 100644 --- a/drivers/usb/cdns3/cdns3-gadget.c +++ b/drivers/usb/cdns3/cdns3-gadget.c @@ -2281,14 +2281,15 @@ static int cdns3_gadget_ep_enable(struct usb_ep *ep, int val; =20 priv_ep =3D ep_to_cdns3_ep(ep); - priv_dev =3D priv_ep->cdns3_dev; - comp_desc =3D priv_ep->endpoint.comp_desc; =20 if (!ep || !desc || desc->bDescriptorType !=3D USB_DT_ENDPOINT) { dev_dbg(priv_dev->dev, "usbss: invalid parameters\n"); return -EINVAL; } =20 + comp_desc =3D priv_ep->endpoint.comp_desc; + priv_dev =3D priv_ep->cdns3_dev; + if (!desc->wMaxPacketSize) { dev_err(priv_dev->dev, "usbss: missing wMaxPacketSize\n"); return -EINVAL; @@ -2596,7 +2597,7 @@ int cdns3_gadget_ep_dequeue(struct usb_ep *ep, struct usb_request *request) { struct cdns3_endpoint *priv_ep =3D ep_to_cdns3_ep(ep); - struct cdns3_device *priv_dev =3D priv_ep->cdns3_dev; + struct cdns3_device *priv_dev; struct usb_request *req, *req_temp; struct cdns3_request *priv_req; struct cdns3_trb *link_trb; @@ -2607,6 +2608,8 @@ int cdns3_gadget_ep_dequeue(struct usb_ep *ep, if (!ep || !request || !ep->desc) return -EINVAL; =20 + priv_dev =3D priv_ep->cdns3_dev; + spin_lock_irqsave(&priv_dev->lock, flags); =20 priv_req =3D to_cdns3_request(request); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EA41C19F2C for ; Mon, 15 Aug 2022 22:28:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350672AbiHOW1E (ORCPT ); Mon, 15 Aug 2022 18:27:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233475AbiHOWTM (ORCPT ); Mon, 15 Aug 2022 18:19:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E0C86AA0F; Mon, 15 Aug 2022 12:43:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A8A71B81141; Mon, 15 Aug 2022 19:43:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DAE6C433C1; Mon, 15 Aug 2022 19:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592592; bh=yA9DHMFC1385fMRfRW8h8EJYiVdCQ+fwbnh7w5teX2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0KYxtaO2yi62WhRVLMFdpG346LN2gaRjx+7E6HZeNWh5/2/SwutAtbZPOx3k/Ih7e UYgXhiD6EMtPmqvv/Pkn2B5tx18lVGDotDVr50foos0KTHhCzQeBTen/da4TL8LIoh tq7QIgcgCfbq/KR6JggCObW/2Fx/EsCxKj3DfJKY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrice Chotard , Tudor Ambarus , Alexander Sverdlin , Pratyush Yadav , Sasha Levin Subject: [PATCH 5.18 0795/1095] mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}() Date: Mon, 15 Aug 2022 20:03:14 +0200 Message-Id: <20220815180502.131812520@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Patrice Chotard [ Upstream commit f8cd9f632f4415b1e8838bdca8ab42cfb37a6584 ] For erase operations, reg_proto must be used as indicated in struct spi_nor description in spi-nor.h. This issue was found when DT property spi-tx-bus-width is set to 4. In this case the spi_mem_op->addr.buswidth is set to 4 for erase command which is not correct. Tested on stm32mp157c-ev1 board with mx66l51235f spi-nor. Fixes: 0e30f47232ab ("mtd: spi-nor: add support for DTR protocol") Signed-off-by: Patrice Chotard [ta: use nor->reg_proto in spi_nor_controller_ops_erase()] Signed-off-by: Tudor Ambarus Tested-by: Alexander Sverdlin Reviewed-by: Pratyush Yadav Link: https://lore.kernel.org/r/20220629133013.3382393-1-patrice.chotard@fo= ss.st.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mtd/spi-nor/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index c1630131c734..170182eb431e 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -177,7 +177,7 @@ int spi_nor_controller_ops_write_reg(struct spi_nor *no= r, u8 opcode, =20 static int spi_nor_controller_ops_erase(struct spi_nor *nor, loff_t offs) { - if (spi_nor_protocol_is_dtr(nor->write_proto)) + if (spi_nor_protocol_is_dtr(nor->reg_proto)) return -EOPNOTSUPP; =20 return nor->controller_ops->erase(nor, offs); @@ -976,7 +976,7 @@ static int spi_nor_erase_chip(struct spi_nor *nor) SPI_MEM_OP_NO_DUMMY, SPI_MEM_OP_NO_DATA); =20 - spi_nor_spimem_setup_op(nor, &op, nor->write_proto); + spi_nor_spimem_setup_op(nor, &op, nor->reg_proto); =20 ret =3D spi_mem_exec_op(nor->spimem, &op); } else { @@ -1121,7 +1121,7 @@ int spi_nor_erase_sector(struct spi_nor *nor, u32 add= r) SPI_MEM_OP_NO_DUMMY, SPI_MEM_OP_NO_DATA); =20 - spi_nor_spimem_setup_op(nor, &op, nor->write_proto); + spi_nor_spimem_setup_op(nor, &op, nor->reg_proto); =20 return spi_mem_exec_op(nor->spimem, &op); } else if (nor->controller_ops->erase) { --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D479C00140 for ; Mon, 15 Aug 2022 22:30:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348620AbiHOWaP (ORCPT ); Mon, 15 Aug 2022 18:30:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347966AbiHOWZG (ORCPT ); Mon, 15 Aug 2022 18:25:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61B95126946; Mon, 15 Aug 2022 12:44:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CA3B5B80EA9; Mon, 15 Aug 2022 19:44:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B4C2C433C1; Mon, 15 Aug 2022 19:44:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592661; bh=XxpeVCfO3+MxzdRH2WGmrs76DgLei8x/GzgiJQYmjQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C10aj8u4JhRUr9S9IvkuJxGT8NGQzbW6TgotJdgfxXbzD7H5jSOC+sFHFc1i8OxoQ t1JRStwI07GrP/IcG72u6ZvAbyVldQzq5nkn7wNpLiCAyaBNiRwQI3agx8TBrx8H+e WoluwP2ozhD4c31S/k6PMsYk+pMT5IpG5njEK73g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Suti , Sasha Levin Subject: [PATCH 5.18 0796/1095] staging: fbtft: core: set smem_len before fb_deferred_io_init call Date: Mon, 15 Aug 2022 20:03:15 +0200 Message-Id: <20220815180502.179602518@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Suti [ Upstream commit 81e878887ff82a7dd42f22951391069a5d520627 ] The fbtft_framebuffer_alloc() calls fb_deferred_io_init() before initializing info->fix.smem_len. It is set to zero by the framebuffer_alloc() function. It will trigger a WARN_ON() at the start of fb_deferred_io_init() and the function will not do anything. Fixes: 856082f021a2 ("fbdev: defio: fix the pagelist corruption") Signed-off-by: Peter Suti Link: https://lore.kernel.org/r/20220727073550.1491126-1-peter.suti@streamu= nlimited.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/staging/fbtft/fbtft-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbt= ft-core.c index 9c4d797e7ae4..4137c1a51e1b 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -656,7 +656,6 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_di= splay *display, fbdefio->delay =3D HZ / fps; fbdefio->sort_pagelist =3D true; fbdefio->deferred_io =3D fbtft_deferred_io; - fb_deferred_io_init(info); =20 snprintf(info->fix.id, sizeof(info->fix.id), "%s", dev->driver->name); info->fix.type =3D FB_TYPE_PACKED_PIXELS; @@ -667,6 +666,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_di= splay *display, info->fix.line_length =3D width * bpp / 8; info->fix.accel =3D FB_ACCEL_NONE; info->fix.smem_len =3D vmem_size; + fb_deferred_io_init(info); =20 info->var.rotate =3D pdata->rotate; info->var.xres =3D width; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45B99C25B08 for ; Mon, 15 Aug 2022 22:32:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349420AbiHOWa5 (ORCPT ); Mon, 15 Aug 2022 18:30:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349546AbiHOW0B (ORCPT ); Mon, 15 Aug 2022 18:26:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09D091272F7; Mon, 15 Aug 2022 12:44:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7629CB80EAD; Mon, 15 Aug 2022 19:44:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDFD9C433D7; Mon, 15 Aug 2022 19:44:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592680; bh=kJiAJLBI1zI4upGRqmYNzAq/cmr+YVYjwMY4ik5mLsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=msf7ebpSh+ffhLZQZr2U1t6CoY9OYXTUQYdCW+U0jxzfHceJ7+Av1AlG/k1u45tuo beHguJRKqiY6Hjhd52m2GweuRQ+jyLQFFlQ5E125MMZPXAOlYLxsy2BgOC6/eDd1Oj pEoVXY4sqPELt3OQatVNx6i412fP9o/XHsVN852k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 0797/1095] KVM: nVMX: Set UMIP bit CR4_FIXED1 MSR when emulating UMIP Date: Mon, 15 Aug 2022 20:03:16 +0200 Message-Id: <20220815180502.226505304@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit a910b5ab6b250a88fff1866bf708642d83317466 ] Make UMIP an "allowed-1" bit CR4_FIXED1 MSR when KVM is emulating UMIP. KVM emulates UMIP for both L1 and L2, and so should enumerate that L2 is allowed to have CR4.UMIP=3D1. Not setting the bit doesn't immediately break nVMX, as KVM does set/clear the bit in CR4_FIXED1 in response to a guest CPUID update, i.e. KVM will correctly (dis)allow nested VM-Entry based on whether or not UMIP is exposed to L1. That said, KVM should enumerate the bit as being allowed from time zero, e.g. userspace will see the wrong value if the MSR is read before CPUID is written. Fixes: 0367f205a3b7 ("KVM: vmx: add support for emulating UMIP") Signed-off-by: Sean Christopherson Message-Id: <20220607213604.3346000-12-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index c632df13ada2..aa287302f991 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -6790,6 +6790,9 @@ void nested_vmx_setup_ctls_msrs(struct nested_vmx_msr= s *msrs, u32 ept_caps) rdmsrl(MSR_IA32_VMX_CR0_FIXED1, msrs->cr0_fixed1); rdmsrl(MSR_IA32_VMX_CR4_FIXED1, msrs->cr4_fixed1); =20 + if (vmx_umip_emulated()) + msrs->cr4_fixed1 |=3D X86_CR4_UMIP; + msrs->vmcs_enum =3D nested_vmx_calc_vmcs_enum_msr(); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70090C00140 for ; Mon, 15 Aug 2022 22:23:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348505AbiHOWXv (ORCPT ); Mon, 15 Aug 2022 18:23:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350780AbiHOWSb (ORCPT ); Mon, 15 Aug 2022 18:18:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDA89419AA; Mon, 15 Aug 2022 12:41:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A03AEB80EA9; Mon, 15 Aug 2022 19:41:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1698C433C1; Mon, 15 Aug 2022 19:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592491; bh=LDycKYnW6ye4o2A+N5sKquPsWFCQPRnl7ImjLXfcl90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a/OhsFFxDuTB2vSbi4SpcnQOaO4Qlrh55oO7CuAgbo+9d87S/97zJiZLnx1p/w00b Ixyfges4Mhnc8biuoBOJZWvjV4ICou7GxmHAQh/mWKRdzZjsalXzY8lyKwHEtFTmTb JWl4wvloPxzgcA0EPAzp4zh8RZPpXB9xA7Wrt1A8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Hans de Goede , Sasha Levin Subject: [PATCH 5.18 0798/1095] tools/power/x86/intel-speed-select: Fix off by one check Date: Mon, 15 Aug 2022 20:03:17 +0200 Message-Id: <20220815180502.270345880@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit d9f74d98bbec978edbf860f729b531281ba0d8ff ] Change > MAX_DIE_PER_PACKAGE to >=3D MAX_DIE_PER_PACKAGE to prevent accessing one element beyond the end of the array. Fixes: 7fd786dfbd2c ("tools/power/x86/intel-speed-select: OOB daemon mode") Signed-off-by: Dan Carpenter Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/power/x86/intel-speed-select/isst-daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/power/x86/intel-speed-select/isst-daemon.c b/tools/power= /x86/intel-speed-select/isst-daemon.c index dd372924bc82..d0400c6684ba 100644 --- a/tools/power/x86/intel-speed-select/isst-daemon.c +++ b/tools/power/x86/intel-speed-select/isst-daemon.c @@ -41,7 +41,7 @@ void process_level_change(int cpu) time_t tm; int ret; =20 - if (pkg_id >=3D MAX_PACKAGE_COUNT || die_id > MAX_DIE_PER_PACKAGE) { + if (pkg_id >=3D MAX_PACKAGE_COUNT || die_id >=3D MAX_DIE_PER_PACKAGE) { debug_printf("Invalid package/die info for cpu:%d\n", cpu); return; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0591C00140 for ; Mon, 15 Aug 2022 22:24:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348531AbiHOWX7 (ORCPT ); Mon, 15 Aug 2022 18:23:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350789AbiHOWSd (ORCPT ); Mon, 15 Aug 2022 18:18:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40F5D6557E; Mon, 15 Aug 2022 12:41:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E85FEB80EA9; Mon, 15 Aug 2022 19:41:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39DB8C433C1; Mon, 15 Aug 2022 19:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592497; bh=+kx/jLvczudwRcK6z8GXOx7aUu/65FgT7dznEfehYwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rDHf75R5o2KeDjD2By42z6bncpxul2IbjyggYsaKznM7F8CbMNwwGIjj2YuNS2MIo MFZy8O9JmBHg9OlEGAKDIiFxOuSbCVx5r00+qkdkJGJ/FH6aI9UeKbKGTSCY4Lu0br SrKt5curViY5G2Jpz5cc8niqSjWIa+G3ybgKg0ug= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Michael=20Sch=C3=B6ne?= , Paul Spooren , "Matwey V. Kornilov" , Hans de Goede , Sasha Levin Subject: [PATCH 5.18 0799/1095] platform/x86: pmc_atom: Match all Lex BayTrail boards with critclk_systems DMI table Date: Mon, 15 Aug 2022 20:03:18 +0200 Message-Id: <20220815180502.315854500@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit c9d959fc32a5f9312282817052d8986614f2dc08 ] The critclk_systems[] DMI match table already contains 2 Lex BayTrail boards and patches were just submitted to add 3 more entries for the following models: 3I380NX, 3I380A, 3I380CW. Looking at: https://www.lex.com.tw/products/embedded-ipc-board/ we can see that Lex BayTrail makes many embedded boards with multiple ethernet boards and none of their products are battery powered so we don't need to worry (too much) about power consumption when suspended. Add a new DMI match which simply matches all Lex BayTrail boards and drop the 2 existing board specific quirks. Fixes: 648e921888ad ("clk: x86: Stop marking clocks as CLK_IS_CRITICAL") Reported-by: Michael Sch=C3=B6ne Reported-by: Paul Spooren Reported-by: Matwey V. Kornilov Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/platform/x86/pmc_atom.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_ato= m.c index a40fae6edc84..f24ab24f2927 100644 --- a/drivers/platform/x86/pmc_atom.c +++ b/drivers/platform/x86/pmc_atom.c @@ -402,21 +402,16 @@ static const struct dmi_system_id critclk_systems[] = =3D { }, }, { - /* pmc_plt_clk0 - 3 are used for the 4 ethernet controllers */ - .ident =3D "Lex 3I380D", + /* + * Lex System / Lex Computech Co. makes a lot of Bay Trail + * based embedded boards which often come with multiple + * ethernet controllers using multiple pmc_plt_clks. See: + * https://www.lex.com.tw/products/embedded-ipc-board/ + */ + .ident =3D "Lex BayTrail", .callback =3D dmi_callback, .matches =3D { DMI_MATCH(DMI_SYS_VENDOR, "Lex BayTrail"), - DMI_MATCH(DMI_PRODUCT_NAME, "3I380D"), - }, - }, - { - /* pmc_plt_clk* - are used for ethernet controllers */ - .ident =3D "Lex 2I385SW", - .callback =3D dmi_callback, - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "Lex BayTrail"), - DMI_MATCH(DMI_PRODUCT_NAME, "2I385SW"), }, }, { --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F35BDC00140 for ; Mon, 15 Aug 2022 22:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348073AbiHOWYg (ORCPT ); Mon, 15 Aug 2022 18:24:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350791AbiHOWSd (ORCPT ); Mon, 15 Aug 2022 18:18:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9471419AC; Mon, 15 Aug 2022 12:41:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4F2A8B80EB2; Mon, 15 Aug 2022 19:41:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D193C433D7; Mon, 15 Aug 2022 19:41:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592504; bh=dXkowuWnXR/whURw9FmRM5OATjvkSl4KRBfeUx9ZHbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oyd4fdcQGPdcMs1xeOqSf7VOkWEuwia6cOdjgqi+nsc7YT7jMYHpgHNwz2iPjSzB2 NuL9DsAdRpXFT0sYsaSFNUnYU6ZsiSQ1YNyKZpOcqojx8+7JnQkeql0Zf5IF/+9rqP 3xawNA+Wg2JmPNS9vXaUCSetNStOnYbGGgv/aW4c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vadim Pasternak , Hans de Goede , Sasha Levin Subject: [PATCH 5.18 0800/1095] platform/mellanox: mlxreg-lc: Fix error flow and extend verbosity Date: Mon, 15 Aug 2022 20:03:19 +0200 Message-Id: <20220815180502.348251593@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vadim Pasternak [ Upstream commit b4b830a34d8046633231b7fe87f6f2cb6240dc9f ] Fix error flow: - Clean-up client object in case of probing failure. - Prevent running remove routine in case of probing failure. Probing and removing are invoked by hotplug events raised upon line card insertion and removing. If probing procedure failed all data is cleared and there is nothing to do in remove routine. Fixes: 62f9529b8d5c ("platform/mellanox: mlxreg-lc: Add initial support for= Nvidia line card devices") Signed-off-by: Vadim Pasternak Link: https://lore.kernel.org/r/20220719153540.61304-1-vadimp@nvidia.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/platform/mellanox/mlxreg-lc.c | 82 ++++++++++++++++++++------- 1 file changed, 63 insertions(+), 19 deletions(-) diff --git a/drivers/platform/mellanox/mlxreg-lc.c b/drivers/platform/mella= nox/mlxreg-lc.c index c897a2f15840..55834ccb4ac7 100644 --- a/drivers/platform/mellanox/mlxreg-lc.c +++ b/drivers/platform/mellanox/mlxreg-lc.c @@ -716,8 +716,12 @@ mlxreg_lc_config_init(struct mlxreg_lc *mlxreg_lc, voi= d *regmap, switch (regval) { case MLXREG_LC_SN4800_C16: err =3D mlxreg_lc_sn4800_c16_config_init(mlxreg_lc, regmap, data); - if (err) + if (err) { + dev_err(dev, "Failed to config client %s at bus %d at addr 0x%02x\n", + data->hpdev.brdinfo->type, data->hpdev.nr, + data->hpdev.brdinfo->addr); return err; + } break; default: return -ENODEV; @@ -730,8 +734,11 @@ mlxreg_lc_config_init(struct mlxreg_lc *mlxreg_lc, voi= d *regmap, mlxreg_lc->mux =3D platform_device_register_resndata(dev, "i2c-mux-mlxcpl= d", data->hpdev.nr, NULL, 0, mlxreg_lc->mux_data, sizeof(*mlxreg_lc->mux_data)); - if (IS_ERR(mlxreg_lc->mux)) + if (IS_ERR(mlxreg_lc->mux)) { + dev_err(dev, "Failed to create mux infra for client %s at bus %d at addr= 0x%02x\n", + data->hpdev.brdinfo->type, data->hpdev.nr, data->hpdev.brdinfo->addr); return PTR_ERR(mlxreg_lc->mux); + } =20 /* Register IO access driver. */ if (mlxreg_lc->io_data) { @@ -740,6 +747,9 @@ mlxreg_lc_config_init(struct mlxreg_lc *mlxreg_lc, void= *regmap, platform_device_register_resndata(dev, "mlxreg-io", data->hpdev.nr, NULL= , 0, mlxreg_lc->io_data, sizeof(*mlxreg_lc->io_data)); if (IS_ERR(mlxreg_lc->io_regs)) { + dev_err(dev, "Failed to create regio for client %s at bus %d at addr 0x= %02x\n", + data->hpdev.brdinfo->type, data->hpdev.nr, + data->hpdev.brdinfo->addr); err =3D PTR_ERR(mlxreg_lc->io_regs); goto fail_register_io; } @@ -753,6 +763,9 @@ mlxreg_lc_config_init(struct mlxreg_lc *mlxreg_lc, void= *regmap, mlxreg_lc->led_data, sizeof(*mlxreg_lc->led_data)); if (IS_ERR(mlxreg_lc->led)) { + dev_err(dev, "Failed to create LED objects for client %s at bus %d at a= ddr 0x%02x\n", + data->hpdev.brdinfo->type, data->hpdev.nr, + data->hpdev.brdinfo->addr); err =3D PTR_ERR(mlxreg_lc->led); goto fail_register_led; } @@ -809,7 +822,8 @@ static int mlxreg_lc_probe(struct platform_device *pdev) if (!data->hpdev.adapter) { dev_err(&pdev->dev, "Failed to get adapter for bus %d\n", data->hpdev.nr); - return -EFAULT; + err =3D -EFAULT; + goto i2c_get_adapter_fail; } =20 /* Create device at the top of line card I2C tree.*/ @@ -818,32 +832,40 @@ static int mlxreg_lc_probe(struct platform_device *pd= ev) if (IS_ERR(data->hpdev.client)) { dev_err(&pdev->dev, "Failed to create client %s at bus %d at addr 0x%02x= \n", data->hpdev.brdinfo->type, data->hpdev.nr, data->hpdev.brdinfo->addr); - - i2c_put_adapter(data->hpdev.adapter); - data->hpdev.adapter =3D NULL; - return PTR_ERR(data->hpdev.client); + err =3D PTR_ERR(data->hpdev.client); + goto i2c_new_device_fail; } =20 regmap =3D devm_regmap_init_i2c(data->hpdev.client, &mlxreg_lc_regmap_conf); if (IS_ERR(regmap)) { + dev_err(&pdev->dev, "Failed to create regmap for client %s at bus %d at = addr 0x%02x\n", + data->hpdev.brdinfo->type, data->hpdev.nr, data->hpdev.brdinfo->addr); err =3D PTR_ERR(regmap); - goto mlxreg_lc_probe_fail; + goto devm_regmap_init_i2c_fail; } =20 /* Set default registers. */ for (i =3D 0; i < mlxreg_lc_regmap_conf.num_reg_defaults; i++) { err =3D regmap_write(regmap, mlxreg_lc_regmap_default[i].reg, mlxreg_lc_regmap_default[i].def); - if (err) - goto mlxreg_lc_probe_fail; + if (err) { + dev_err(&pdev->dev, "Failed to set default regmap %d for client %s at b= us %d at addr 0x%02x\n", + i, data->hpdev.brdinfo->type, data->hpdev.nr, + data->hpdev.brdinfo->addr); + goto regmap_write_fail; + } } =20 /* Sync registers with hardware. */ regcache_mark_dirty(regmap); err =3D regcache_sync(regmap); - if (err) - goto mlxreg_lc_probe_fail; + if (err) { + dev_err(&pdev->dev, "Failed to sync regmap for client %s at bus %d at ad= dr 0x%02x\n", + data->hpdev.brdinfo->type, data->hpdev.nr, data->hpdev.brdinfo->addr); + err =3D PTR_ERR(regmap); + goto regcache_sync_fail; + } =20 par_pdata =3D data->hpdev.brdinfo->platform_data; mlxreg_lc->par_regmap =3D par_pdata->regmap; @@ -854,12 +876,27 @@ static int mlxreg_lc_probe(struct platform_device *pd= ev) /* Configure line card. */ err =3D mlxreg_lc_config_init(mlxreg_lc, regmap, data); if (err) - goto mlxreg_lc_probe_fail; + goto mlxreg_lc_config_init_fail; =20 return err; =20 -mlxreg_lc_probe_fail: +mlxreg_lc_config_init_fail: +regcache_sync_fail: +regmap_write_fail: +devm_regmap_init_i2c_fail: + if (data->hpdev.client) { + i2c_unregister_device(data->hpdev.client); + data->hpdev.client =3D NULL; + } +i2c_new_device_fail: i2c_put_adapter(data->hpdev.adapter); + data->hpdev.adapter =3D NULL; +i2c_get_adapter_fail: + /* Clear event notification callback and handle. */ + if (data->notifier) { + data->notifier->user_handler =3D NULL; + data->notifier->handle =3D NULL; + } return err; } =20 @@ -868,11 +905,18 @@ static int mlxreg_lc_remove(struct platform_device *p= dev) struct mlxreg_core_data *data =3D dev_get_platdata(&pdev->dev); struct mlxreg_lc *mlxreg_lc =3D platform_get_drvdata(pdev); =20 - /* Clear event notification callback. */ - if (data->notifier) { - data->notifier->user_handler =3D NULL; - data->notifier->handle =3D NULL; - } + /* + * Probing and removing are invoked by hotplug events raised upon line ca= rd insertion and + * removing. If probing procedure fails all data is cleared. However, hot= plug event still + * will be raised on line card removing and activate removing procedure. = In this case there + * is nothing to remove. + */ + if (!data->notifier || !data->notifier->handle) + return 0; + + /* Clear event notification callback and handle. */ + data->notifier->user_handler =3D NULL; + data->notifier->handle =3D NULL; =20 /* Destroy static I2C device feeding by main power. */ mlxreg_lc_destroy_static_devices(mlxreg_lc, mlxreg_lc->main_devs, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09FA3C3F6B0 for ; Mon, 15 Aug 2022 22:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347776AbiHOWYb (ORCPT ); Mon, 15 Aug 2022 18:24:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350792AbiHOWSd (ORCPT ); Mon, 15 Aug 2022 18:18:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1034941D0E; Mon, 15 Aug 2022 12:41:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A1DBA610A3; Mon, 15 Aug 2022 19:41:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95C54C433D7; Mon, 15 Aug 2022 19:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592511; bh=PQa41Dw1cLrvGbifrXo1+Q6UP14K5C3ONaexlLXM2xo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FB8mS6C50WsgEK4gkdcKJh6ZXRhpvSOdD4zvz/iwP+9BoZHlZNcLxnyvDPrhtD3eb KzJ1+znHqxTmTmfz3rlzd6tUaywI5bCyd0Tn//BKt18cxgdroz6WoXu2onOpZnZrv8 H6q1MRfUEwDmoMV9/2POcUWz74pFtGJHWqmplyd8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Hans de Goede , Sasha Levin Subject: [PATCH 5.18 0801/1095] platform/olpc: Fix uninitialized data in debugfs write Date: Mon, 15 Aug 2022 20:03:20 +0200 Message-Id: <20220815180502.399267021@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 40ec787e1adf302c11668d4cc69838f4d584187d ] The call to: size =3D simple_write_to_buffer(cmdbuf, sizeof(cmdbuf), ppos, buf, size); will succeed if at least one byte is written to the "cmdbuf" buffer. The "*ppos" value controls which byte is written. Another problem is that this code does not check for errors so it's possible for the entire buffer to be uninitialized. Inintialize the struct to zero to prevent reading uninitialized stack data. Debugfs is normally only writable by root so the impact of this bug is very minimal. Fixes: 6cca83d498bd ("Platform: OLPC: move debugfs support from x86 EC driv= er") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YthIKn+TfZSZMEcM@kili Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/platform/olpc/olpc-ec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc-e= c.c index 4ff5c3a12991..921520475ff6 100644 --- a/drivers/platform/olpc/olpc-ec.c +++ b/drivers/platform/olpc/olpc-ec.c @@ -264,7 +264,7 @@ static ssize_t ec_dbgfs_cmd_write(struct file *file, co= nst char __user *buf, int i, m; unsigned char ec_cmd[EC_MAX_CMD_ARGS]; unsigned int ec_cmd_int[EC_MAX_CMD_ARGS]; - char cmdbuf[64]; + char cmdbuf[64] =3D ""; int ec_cmd_bytes; =20 mutex_lock(&ec_dbgfs_lock); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23AE2C00140 for ; Mon, 15 Aug 2022 22:25:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244869AbiHOWZH (ORCPT ); Mon, 15 Aug 2022 18:25:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350798AbiHOWSf (ORCPT ); Mon, 15 Aug 2022 18:18:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6898865577; Mon, 15 Aug 2022 12:41:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 05E386068D; Mon, 15 Aug 2022 19:41:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3DBEC433C1; Mon, 15 Aug 2022 19:41:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592517; bh=6KB1K5LhbCZrhA4TaHgr+wvgq+MkkC0XdMw8XVVZ2RQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oMoBi+7IcVzf5z4y1jiE+kg3WxuQb1EU5ju+jCknV3xsuJeC906gR8JTQkhJ7zs4C xaBeexnJ/G/lzvlZwIg5JCesRGgXnliT9LzGuIhXeFnSLrvxkmT99luccemimPJc1C vO0jvmSatjQGmQBQqIk39U93IyX9FORiephU0RWg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.18 0802/1095] RDMA/srpt: Duplicate port name members Date: Mon, 15 Aug 2022 20:03:21 +0200 Message-Id: <20220815180502.442574572@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit b03b1ae2a3125d4475452e4f19f5d3a6e910ff6e ] Prepare for decoupling the lifetimes of struct srpt_port and struct srpt_port_id by duplicating the port name into struct srpt_port. Link: https://lore.kernel.org/r/20220727193415.1583860-2-bvanassche@acm.org Signed-off-by: Bart Van Assche Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/ulp/srpt/ib_srpt.c | 9 ++++++--- drivers/infiniband/ulp/srpt/ib_srpt.h | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp= /srpt/ib_srpt.c index f86ee1c4b970..8253d55b9c26 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -566,14 +566,17 @@ static int srpt_refresh_port(struct srpt_port *sport) return ret; =20 sport->port_guid_id.wwn.priv =3D sport; - srpt_format_guid(sport->port_guid_id.name, - sizeof(sport->port_guid_id.name), + srpt_format_guid(sport->guid_name, ARRAY_SIZE(sport->guid_name), &sport->gid.global.interface_id); + memcpy(sport->port_guid_id.name, sport->guid_name, + ARRAY_SIZE(sport->guid_name)); sport->port_gid_id.wwn.priv =3D sport; - snprintf(sport->port_gid_id.name, sizeof(sport->port_gid_id.name), + snprintf(sport->gid_name, ARRAY_SIZE(sport->gid_name), "0x%016llx%016llx", be64_to_cpu(sport->gid.global.subnet_prefix), be64_to_cpu(sport->gid.global.interface_id)); + memcpy(sport->port_gid_id.name, sport->gid_name, + ARRAY_SIZE(sport->gid_name)); =20 if (rdma_protocol_iwarp(sport->sdev->device, sport->port)) return 0; diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp= /srpt/ib_srpt.h index 76e66f630c17..3844a7058559 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.h +++ b/drivers/infiniband/ulp/srpt/ib_srpt.h @@ -376,7 +376,7 @@ struct srpt_tpg { }; =20 /** - * struct srpt_port_id - information about an RDMA port name + * struct srpt_port_id - LIO RDMA port information * @mutex: Protects @tpg_list changes. * @tpg_list: TPGs associated with the RDMA port name. * @wwn: WWN associated with the RDMA port name. @@ -402,8 +402,10 @@ struct srpt_port_id { * @lid: cached value of the port's lid. * @gid: cached value of the port's gid. * @work: work structure for refreshing the aforementioned cached val= ues. - * @port_guid_id: target port GUID - * @port_gid_id: target port GID + * @guid_name: port name in GUID format. + * @port_guid_id: LIO target port information for the port name in GUID fo= rmat. + * @gid_name: port name in GID format. + * @port_gid_id: LIO target port information for the port name in GID form= at. * @port_attrib: Port attributes that can be accessed through configfs. * @refcount: Number of objects associated with this port. * @freed_channels: Completion that will be signaled once @refcount become= s 0. @@ -419,7 +421,9 @@ struct srpt_port { u32 lid; union ib_gid gid; struct work_struct work; + char guid_name[64]; struct srpt_port_id port_guid_id; + char gid_name[64]; struct srpt_port_id port_gid_id; struct srpt_port_attrib port_attrib; atomic_t refcount; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C23D9C00140 for ; Mon, 15 Aug 2022 22:24:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344705AbiHOWYt (ORCPT ); Mon, 15 Aug 2022 18:24:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350804AbiHOWSg (ORCPT ); Mon, 15 Aug 2022 18:18:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C973C65659; Mon, 15 Aug 2022 12:42:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 65E126068D; Mon, 15 Aug 2022 19:42:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5675DC433D6; Mon, 15 Aug 2022 19:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592526; bh=KM2BqJ70Ryu+d2ZegbEKyHkGysngUz+E2aiY5tWpnY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F8tYOk7tEjqKk8eL79vuH1pQCiILCLwF0ALe6sqysCFyEc/FlRmdYbR61Bdy4bJEy 8otQkllor7kelUjm+fQPKsybkGtjZ3iM0M2HLuo+p7jryCyR8nFPdbwA2rlQHiPRuX FyxIDZYED+1MA4HsYxOgSDoGH9qFqF+fAr7/4jH8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.18 0803/1095] RDMA/srpt: Introduce a reference count in struct srpt_device Date: Mon, 15 Aug 2022 20:03:22 +0200 Message-Id: <20220815180502.492835677@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit aa7dfbb41b5a60ab90e244d6f586b8cb5c791c3e ] This will be used to keep struct srpt_device around as long as either the RDMA port exists or a LIO target port is associated with the struct srpt_device. Link: https://lore.kernel.org/r/20220727193415.1583860-3-bvanassche@acm.org Signed-off-by: Bart Van Assche Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/ulp/srpt/ib_srpt.c | 17 +++++++++++++++-- drivers/infiniband/ulp/srpt/ib_srpt.h | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp= /srpt/ib_srpt.c index 8253d55b9c26..1fbce9225424 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -3104,6 +3104,18 @@ static int srpt_use_srq(struct srpt_device *sdev, bo= ol use_srq) return ret; } =20 +static void srpt_free_sdev(struct kref *refcnt) +{ + struct srpt_device *sdev =3D container_of(refcnt, typeof(*sdev), refcnt); + + kfree(sdev); +} + +static void srpt_sdev_put(struct srpt_device *sdev) +{ + kref_put(&sdev->refcnt, srpt_free_sdev); +} + /** * srpt_add_one - InfiniBand device addition callback function * @device: Describes a HCA. @@ -3122,6 +3134,7 @@ static int srpt_add_one(struct ib_device *device) if (!sdev) return -ENOMEM; =20 + kref_init(&sdev->refcnt); sdev->device =3D device; mutex_init(&sdev->sdev_mutex); =20 @@ -3217,7 +3230,7 @@ static int srpt_add_one(struct ib_device *device) srpt_free_srq(sdev); ib_dealloc_pd(sdev->pd); free_dev: - kfree(sdev); + srpt_sdev_put(sdev); pr_info("%s(%s) failed.\n", __func__, dev_name(&device->dev)); return ret; } @@ -3261,7 +3274,7 @@ static void srpt_remove_one(struct ib_device *device,= void *client_data) =20 ib_dealloc_pd(sdev->pd); =20 - kfree(sdev); + srpt_sdev_put(sdev); } =20 static struct ib_client srpt_client =3D { diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp= /srpt/ib_srpt.h index 3844a7058559..0cb867d580f1 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.h +++ b/drivers/infiniband/ulp/srpt/ib_srpt.h @@ -434,6 +434,7 @@ struct srpt_port { =20 /** * struct srpt_device - information associated by SRPT with a single HCA + * @refcnt: Reference count for this device. * @device: Backpointer to the struct ib_device managed by the IB c= ore. * @pd: IB protection domain. * @lkey: L_Key (local key) with write access to all local memory. @@ -449,6 +450,7 @@ struct srpt_port { * @port: Information about the ports owned by this HCA. */ struct srpt_device { + struct kref refcnt; struct ib_device *device; struct ib_pd *pd; u32 lkey; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F3D4C00140 for ; Mon, 15 Aug 2022 22:25:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348310AbiHOWZW (ORCPT ); Mon, 15 Aug 2022 18:25:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350805AbiHOWSg (ORCPT ); Mon, 15 Aug 2022 18:18:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B13565661; Mon, 15 Aug 2022 12:42:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BFF8260FB9; Mon, 15 Aug 2022 19:42:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABB1FC433C1; Mon, 15 Aug 2022 19:42:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592533; bh=5tQcWzGBH9Zfsy2940dlc+C27COTT4bscnlNFqRCDGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TMGfvnQDCSpqHLFIojp0Pt7yPLKS7vNm3uC4U0RI9hXf9glSvDR0/oS6WIq/D+TXS IZd8l2BAoVQ0yyWM+j3d9fhRoAKumo0rARYQwF3aQ6BNBXdTPwkcgze8suHyDfOVhe 989BEZjLOXEzYPZ4eXiUgU0CAGJ+BjZBYXzXkpXY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Zhijian , Bart Van Assche , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.18 0804/1095] RDMA/srpt: Fix a use-after-free Date: Mon, 15 Aug 2022 20:03:23 +0200 Message-Id: <20220815180502.534981419@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit b5605148e6ce36bb21020d49010b617693933128 ] Change the LIO port members inside struct srpt_port from regular members into pointers. Allocate the LIO port data structures from inside srpt_make_tport() and free these from inside srpt_make_tport(). Keep struct srpt_device as long as either an RDMA port or a LIO target port is associated with it. This patch decouples the lifetime of struct srpt_port (controlled by the RDMA core) and struct srpt_port_id (controlled by LIO). This patch fixes the following KASAN complaint: BUG: KASAN: use-after-free in srpt_enable_tpg+0x31/0x70 [ib_srpt] Read of size 8 at addr ffff888141cc34b8 by task check/5093 Call Trace: show_stack+0x4e/0x53 dump_stack_lvl+0x51/0x66 print_address_description.constprop.0.cold+0xea/0x41e print_report.cold+0x90/0x205 kasan_report+0xb9/0xf0 __asan_load8+0x69/0x90 srpt_enable_tpg+0x31/0x70 [ib_srpt] target_fabric_tpg_base_enable_store+0xe2/0x140 [target_core_mod] configfs_write_iter+0x18b/0x210 new_sync_write+0x1f2/0x2f0 vfs_write+0x3e3/0x540 ksys_write+0xbb/0x140 __x64_sys_write+0x42/0x50 do_syscall_64+0x34/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Link: https://lore.kernel.org/r/20220727193415.1583860-4-bvanassche@acm.org Reported-by: Li Zhijian Tested-by: Li Zhijian Fixes: a42d985bd5b2 ("ib_srpt: Initial SRP Target merge for v3.3-rc1") Signed-off-by: Bart Van Assche Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/ulp/srpt/ib_srpt.c | 130 ++++++++++++++++++-------- drivers/infiniband/ulp/srpt/ib_srpt.h | 10 +- 2 files changed, 94 insertions(+), 46 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp= /srpt/ib_srpt.c index 1fbce9225424..c3036aeac89e 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -565,18 +565,12 @@ static int srpt_refresh_port(struct srpt_port *sport) if (ret) return ret; =20 - sport->port_guid_id.wwn.priv =3D sport; srpt_format_guid(sport->guid_name, ARRAY_SIZE(sport->guid_name), &sport->gid.global.interface_id); - memcpy(sport->port_guid_id.name, sport->guid_name, - ARRAY_SIZE(sport->guid_name)); - sport->port_gid_id.wwn.priv =3D sport; snprintf(sport->gid_name, ARRAY_SIZE(sport->gid_name), "0x%016llx%016llx", be64_to_cpu(sport->gid.global.subnet_prefix), be64_to_cpu(sport->gid.global.interface_id)); - memcpy(sport->port_gid_id.name, sport->gid_name, - ARRAY_SIZE(sport->gid_name)); =20 if (rdma_protocol_iwarp(sport->sdev->device, sport->port)) return 0; @@ -2317,31 +2311,35 @@ static int srpt_cm_req_recv(struct srpt_device *con= st sdev, tag_num =3D ch->rq_size; tag_size =3D 1; /* ib_srpt does not use se_sess->sess_cmd_map */ =20 - mutex_lock(&sport->port_guid_id.mutex); - list_for_each_entry(stpg, &sport->port_guid_id.tpg_list, entry) { - if (!IS_ERR_OR_NULL(ch->sess)) - break; - ch->sess =3D target_setup_session(&stpg->tpg, tag_num, + if (sport->guid_id) { + mutex_lock(&sport->guid_id->mutex); + list_for_each_entry(stpg, &sport->guid_id->tpg_list, entry) { + if (!IS_ERR_OR_NULL(ch->sess)) + break; + ch->sess =3D target_setup_session(&stpg->tpg, tag_num, tag_size, TARGET_PROT_NORMAL, ch->sess_name, ch, NULL); + } + mutex_unlock(&sport->guid_id->mutex); } - mutex_unlock(&sport->port_guid_id.mutex); =20 - mutex_lock(&sport->port_gid_id.mutex); - list_for_each_entry(stpg, &sport->port_gid_id.tpg_list, entry) { - if (!IS_ERR_OR_NULL(ch->sess)) - break; - ch->sess =3D target_setup_session(&stpg->tpg, tag_num, + if (sport->gid_id) { + mutex_lock(&sport->gid_id->mutex); + list_for_each_entry(stpg, &sport->gid_id->tpg_list, entry) { + if (!IS_ERR_OR_NULL(ch->sess)) + break; + ch->sess =3D target_setup_session(&stpg->tpg, tag_num, tag_size, TARGET_PROT_NORMAL, i_port_id, ch, NULL); - if (!IS_ERR_OR_NULL(ch->sess)) - break; - /* Retry without leading "0x" */ - ch->sess =3D target_setup_session(&stpg->tpg, tag_num, + if (!IS_ERR_OR_NULL(ch->sess)) + break; + /* Retry without leading "0x" */ + ch->sess =3D target_setup_session(&stpg->tpg, tag_num, tag_size, TARGET_PROT_NORMAL, i_port_id + 2, ch, NULL); + } + mutex_unlock(&sport->gid_id->mutex); } - mutex_unlock(&sport->port_gid_id.mutex); =20 if (IS_ERR_OR_NULL(ch->sess)) { WARN_ON_ONCE(ch->sess =3D=3D NULL); @@ -2986,7 +2984,12 @@ static int srpt_release_sport(struct srpt_port *spor= t) return 0; } =20 -static struct se_wwn *__srpt_lookup_wwn(const char *name) +struct port_and_port_id { + struct srpt_port *sport; + struct srpt_port_id **port_id; +}; + +static struct port_and_port_id __srpt_lookup_port(const char *name) { struct ib_device *dev; struct srpt_device *sdev; @@ -3001,25 +3004,38 @@ static struct se_wwn *__srpt_lookup_wwn(const char = *name) for (i =3D 0; i < dev->phys_port_cnt; i++) { sport =3D &sdev->port[i]; =20 - if (strcmp(sport->port_guid_id.name, name) =3D=3D 0) - return &sport->port_guid_id.wwn; - if (strcmp(sport->port_gid_id.name, name) =3D=3D 0) - return &sport->port_gid_id.wwn; + if (strcmp(sport->guid_name, name) =3D=3D 0) { + kref_get(&sdev->refcnt); + return (struct port_and_port_id){ + sport, &sport->guid_id}; + } + if (strcmp(sport->gid_name, name) =3D=3D 0) { + kref_get(&sdev->refcnt); + return (struct port_and_port_id){ + sport, &sport->gid_id}; + } } } =20 - return NULL; + return (struct port_and_port_id){}; } =20 -static struct se_wwn *srpt_lookup_wwn(const char *name) +/** + * srpt_lookup_port() - Look up an RDMA port by name + * @name: ASCII port name + * + * Increments the RDMA port reference count if an RDMA port pointer is ret= urned. + * The caller must drop that reference count by calling srpt_port_put_ref(= ). + */ +static struct port_and_port_id srpt_lookup_port(const char *name) { - struct se_wwn *wwn; + struct port_and_port_id papi; =20 spin_lock(&srpt_dev_lock); - wwn =3D __srpt_lookup_wwn(name); + papi =3D __srpt_lookup_port(name); spin_unlock(&srpt_dev_lock); =20 - return wwn; + return papi; } =20 static void srpt_free_srq(struct srpt_device *sdev) @@ -3198,10 +3214,6 @@ static int srpt_add_one(struct ib_device *device) sport->port_attrib.srp_sq_size =3D DEF_SRPT_SQ_SIZE; sport->port_attrib.use_srq =3D false; INIT_WORK(&sport->work, srpt_refresh_port_work); - mutex_init(&sport->port_guid_id.mutex); - INIT_LIST_HEAD(&sport->port_guid_id.tpg_list); - mutex_init(&sport->port_gid_id.mutex); - INIT_LIST_HEAD(&sport->port_gid_id.tpg_list); =20 ret =3D srpt_refresh_port(sport); if (ret) { @@ -3302,10 +3314,10 @@ static struct srpt_port_id *srpt_wwn_to_sport_id(st= ruct se_wwn *wwn) { struct srpt_port *sport =3D wwn->priv; =20 - if (wwn =3D=3D &sport->port_guid_id.wwn) - return &sport->port_guid_id; - if (wwn =3D=3D &sport->port_gid_id.wwn) - return &sport->port_gid_id; + if (sport->guid_id && &sport->guid_id->wwn =3D=3D wwn) + return sport->guid_id; + if (sport->gid_id && &sport->gid_id->wwn =3D=3D wwn) + return sport->gid_id; WARN_ON_ONCE(true); return NULL; } @@ -3790,7 +3802,31 @@ static struct se_wwn *srpt_make_tport(struct target_= fabric_configfs *tf, struct config_group *group, const char *name) { - return srpt_lookup_wwn(name) ? : ERR_PTR(-EINVAL); + struct port_and_port_id papi =3D srpt_lookup_port(name); + struct srpt_port *sport =3D papi.sport; + struct srpt_port_id *port_id; + + if (!papi.port_id) + return ERR_PTR(-EINVAL); + if (*papi.port_id) { + /* Attempt to create a directory that already exists. */ + WARN_ON_ONCE(true); + return &(*papi.port_id)->wwn; + } + port_id =3D kzalloc(sizeof(*port_id), GFP_KERNEL); + if (!port_id) { + srpt_sdev_put(sport->sdev); + return ERR_PTR(-ENOMEM); + } + mutex_init(&port_id->mutex); + INIT_LIST_HEAD(&port_id->tpg_list); + port_id->wwn.priv =3D sport; + memcpy(port_id->name, port_id =3D=3D sport->guid_id ? sport->guid_name : + sport->gid_name, ARRAY_SIZE(port_id->name)); + + *papi.port_id =3D port_id; + + return &port_id->wwn; } =20 /** @@ -3799,6 +3835,18 @@ static struct se_wwn *srpt_make_tport(struct target_= fabric_configfs *tf, */ static void srpt_drop_tport(struct se_wwn *wwn) { + struct srpt_port_id *port_id =3D container_of(wwn, typeof(*port_id), wwn); + struct srpt_port *sport =3D wwn->priv; + + if (sport->guid_id =3D=3D port_id) + sport->guid_id =3D NULL; + else if (sport->gid_id =3D=3D port_id) + sport->gid_id =3D NULL; + else + WARN_ON_ONCE(true); + + srpt_sdev_put(sport->sdev); + kfree(port_id); } =20 static ssize_t srpt_wwn_version_show(struct config_item *item, char *buf) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp= /srpt/ib_srpt.h index 0cb867d580f1..4c46b301eea1 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.h +++ b/drivers/infiniband/ulp/srpt/ib_srpt.h @@ -393,7 +393,7 @@ struct srpt_port_id { }; =20 /** - * struct srpt_port - information associated by SRPT with a single IB port + * struct srpt_port - SRPT RDMA port information * @sdev: backpointer to the HCA information. * @mad_agent: per-port management datagram processing information. * @enabled: Whether or not this target port is enabled. @@ -403,9 +403,9 @@ struct srpt_port_id { * @gid: cached value of the port's gid. * @work: work structure for refreshing the aforementioned cached val= ues. * @guid_name: port name in GUID format. - * @port_guid_id: LIO target port information for the port name in GUID fo= rmat. + * @guid_id: LIO target port information for the port name in GUID forma= t. * @gid_name: port name in GID format. - * @port_gid_id: LIO target port information for the port name in GID form= at. + * @gid_id: LIO target port information for the port name in GID format. * @port_attrib: Port attributes that can be accessed through configfs. * @refcount: Number of objects associated with this port. * @freed_channels: Completion that will be signaled once @refcount become= s 0. @@ -422,9 +422,9 @@ struct srpt_port { union ib_gid gid; struct work_struct work; char guid_name[64]; - struct srpt_port_id port_guid_id; + struct srpt_port_id *guid_id; char gid_name[64]; - struct srpt_port_id port_gid_id; + struct srpt_port_id *gid_id; struct srpt_port_attrib port_attrib; atomic_t refcount; struct completion *freed_channels; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B49A0C00140 for ; Mon, 15 Aug 2022 22:28:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348575AbiHOWZj (ORCPT ); Mon, 15 Aug 2022 18:25:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350812AbiHOWSh (ORCPT ); Mon, 15 Aug 2022 18:18:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 267A241D0B; Mon, 15 Aug 2022 12:42:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BAB88B80EA9; Mon, 15 Aug 2022 19:42:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDFE7C433D6; Mon, 15 Aug 2022 19:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592539; bh=LI9xyrlxXoxri9GLybfnF+zXTFS4hqMK+A3lwjDVl7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xoKaxBbYYi5TgjXdNAAnkh+58Vn4o9pe7q9y46M7S3KLL74dRE79nAzbUUR9n+4RW DY9q7GgHpgsvuQvA8JSWOmmn6Yvszx90miv4TqfDVKExEf6wrA+1EPiVcFOIh/bgFh lRLOFqUpZJtiYJXMja3WtQdhjx+0n3A5FNdh6534= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+58b51ac2b04e388ab7b0@syzkaller.appspotmail.com, "Liam R. Howlett" , Minchan Kim , "Christian Brauner (Microsoft)" , Hridya Valsaraju , Joel Fernandes , Martijn Coenen , Suren Baghdasaryan , Todd Kjos , "Matthew Wilcox (Oracle)" , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 0805/1095] android: binder: stop saving a pointer to the VMA Date: Mon, 15 Aug 2022 20:03:24 +0200 Message-Id: <20220815180502.571614542@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liam R. Howlett [ Upstream commit a43cfc87caaf46710c8027a8c23b8a55f1078f19 ] Do not record a pointer to a VMA outside of the mmap_lock for later use. This is unsafe and there are a number of failure paths *after* the recorded VMA pointer may be freed during setup. There is no callback to the driver to clear the saved pointer from generic mm code. Furthermore, the VMA pointer may become stale if any number of VMA operations end up freeing the VMA so saving it was fragile to being with. Instead, change the binder_alloc struct to record the start address of the VMA and use vma_lookup() to get the vma when needed. Add lockdep mmap_lock checks on updates to the vma pointer to ensure the lock is held and depend on that lock for synchronization of readers and writers - which was already the case anyways, so the smp_wmb()/smp_rmb() was not necessary. [akpm@linux-foundation.org: fix drivers/android/binder_alloc_selftest.c] Link: https://lkml.kernel.org/r/20220621140212.vpkio64idahetbyf@revolver Fixes: da1b9564e85b ("android: binder: fix the race mmap and alloc_new_buf_= locked") Reported-by: syzbot+58b51ac2b04e388ab7b0@syzkaller.appspotmail.com Signed-off-by: Liam R. Howlett Cc: Minchan Kim Cc: Christian Brauner (Microsoft) Cc: Greg Kroah-Hartman Cc: Hridya Valsaraju Cc: Joel Fernandes Cc: Martijn Coenen Cc: Suren Baghdasaryan Cc: Todd Kjos Cc: Matthew Wilcox (Oracle) Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/android/binder_alloc.c | 30 ++++++++++++------------- drivers/android/binder_alloc.h | 2 +- drivers/android/binder_alloc_selftest.c | 2 +- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index 2ac1008a5f39..a93a7d2a8caf 100644 --- a/drivers/android/binder_alloc.c +++ b/drivers/android/binder_alloc.c @@ -213,7 +213,7 @@ static int binder_update_page_range(struct binder_alloc= *alloc, int allocate, =20 if (mm) { mmap_read_lock(mm); - vma =3D alloc->vma; + vma =3D vma_lookup(mm, alloc->vma_addr); } =20 if (!vma && need_mm) { @@ -313,16 +313,15 @@ static int binder_update_page_range(struct binder_all= oc *alloc, int allocate, static inline void binder_alloc_set_vma(struct binder_alloc *alloc, struct vm_area_struct *vma) { - if (vma) + unsigned long vm_start =3D 0; + + if (vma) { + vm_start =3D vma->vm_start; alloc->vma_vm_mm =3D vma->vm_mm; - /* - * If we see alloc->vma is not NULL, buffer data structures set up - * completely. Look at smp_rmb side binder_alloc_get_vma. - * We also want to guarantee new alloc->vma_vm_mm is always visible - * if alloc->vma is set. - */ - smp_wmb(); - alloc->vma =3D vma; + } + + mmap_assert_write_locked(alloc->vma_vm_mm); + alloc->vma_addr =3D vm_start; } =20 static inline struct vm_area_struct *binder_alloc_get_vma( @@ -330,11 +329,9 @@ static inline struct vm_area_struct *binder_alloc_get_= vma( { struct vm_area_struct *vma =3D NULL; =20 - if (alloc->vma) { - /* Look at description in binder_alloc_set_vma */ - smp_rmb(); - vma =3D alloc->vma; - } + if (alloc->vma_addr) + vma =3D vma_lookup(alloc->vma_vm_mm, alloc->vma_addr); + return vma; } =20 @@ -817,7 +814,8 @@ void binder_alloc_deferred_release(struct binder_alloc = *alloc) =20 buffers =3D 0; mutex_lock(&alloc->mutex); - BUG_ON(alloc->vma); + BUG_ON(alloc->vma_addr && + vma_lookup(alloc->vma_vm_mm, alloc->vma_addr)); =20 while ((n =3D rb_first(&alloc->allocated_buffers))) { buffer =3D rb_entry(n, struct binder_buffer, rb_node); diff --git a/drivers/android/binder_alloc.h b/drivers/android/binder_alloc.h index 7dea57a84c79..1e4fd37af5e0 100644 --- a/drivers/android/binder_alloc.h +++ b/drivers/android/binder_alloc.h @@ -100,7 +100,7 @@ struct binder_lru_page { */ struct binder_alloc { struct mutex mutex; - struct vm_area_struct *vma; + unsigned long vma_addr; struct mm_struct *vma_vm_mm; void __user *buffer; struct list_head buffers; diff --git a/drivers/android/binder_alloc_selftest.c b/drivers/android/bind= er_alloc_selftest.c index c2b323bc3b3a..43a881073a42 100644 --- a/drivers/android/binder_alloc_selftest.c +++ b/drivers/android/binder_alloc_selftest.c @@ -287,7 +287,7 @@ void binder_selftest_alloc(struct binder_alloc *alloc) if (!binder_selftest_run) return; mutex_lock(&binder_selftest_lock); - if (!binder_selftest_run || !alloc->vma) + if (!binder_selftest_run || !alloc->vma_addr) goto done; pr_info("STARTED\n"); binder_selftest_alloc_offset(alloc, end_offset, 0); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E641DC00140 for ; Mon, 15 Aug 2022 22:28:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348793AbiHOWZr (ORCPT ); Mon, 15 Aug 2022 18:25:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350817AbiHOWSi (ORCPT ); Mon, 15 Aug 2022 18:18:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2C6341D1D; Mon, 15 Aug 2022 12:42:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8F6706068D; Mon, 15 Aug 2022 19:42:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 792A1C433C1; Mon, 15 Aug 2022 19:42:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592546; bh=VWGqh+CG2Lil5Z4q1lpCoF7XgqNZB5NgJibu9/AVpOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mIRUqHJ8JfCEViZlOpV0xJqGfHw0SN68XMhN7p4kf/azDrZnGho4ascp/+uzmJDpx b6zxmUN0F7SByWTiFOMixQV1cxjIBxrooTrcPCKBwNHiwnqpArCKPhFDlFZCrLGQvH xJqApFqsVeAROGSsPQhp1Eqp+ZwUFSZABvlrpGzQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 0806/1095] mm/mmap.c: fix missing call to vm_unacct_memory in mmap_region Date: Mon, 15 Aug 2022 20:03:25 +0200 Message-Id: <20220815180502.619094244@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaohe Lin [ Upstream commit 7f82f922319ede486540e8746769865b9508d2c2 ] Since the beginning, charged is set to 0 to avoid calling vm_unacct_memory twice because vm_unacct_memory will be called by above unmap_region. But since commit 4f74d2c8e827 ("vm: remove 'nr_accounted' calculations from the unmap_vmas() interfaces"), unmap_region doesn't call vm_unacct_memory anymore. So charged shouldn't be set to 0 now otherwise the calling to paired vm_unacct_memory will be missed and leads to imbalanced account. Link: https://lkml.kernel.org/r/20220618082027.43391-1-linmiaohe@huawei.com Fixes: 4f74d2c8e827 ("vm: remove 'nr_accounted' calculations from the unmap= _vmas() interfaces") Signed-off-by: Miaohe Lin Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- mm/mmap.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mm/mmap.c b/mm/mmap.c index 313b57d55a63..6d9bfd9c94ca 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1882,7 +1882,6 @@ unsigned long mmap_region(struct file *file, unsigned= long addr, =20 /* Undo any partial mapping done by a device driver. */ unmap_region(mm, vma, prev, vma->vm_start, vma->vm_end); - charged =3D 0; if (vm_flags & VM_SHARED) mapping_unmap_writable(file->f_mapping); free_vma: --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66D55C25B0E for ; Mon, 15 Aug 2022 22:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349410AbiHOWZ7 (ORCPT ); Mon, 15 Aug 2022 18:25:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350825AbiHOWSi (ORCPT ); Mon, 15 Aug 2022 18:18:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50CFF419BD; Mon, 15 Aug 2022 12:42:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E1FF86068D; Mon, 15 Aug 2022 19:42:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE805C433C1; Mon, 15 Aug 2022 19:42:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592552; bh=gAhaqdi2MNJ7YsEZoDyKRrz/8+l523h+AKKJdZP7w0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BmoCVIKmLCppoQUllEotr3bgrfuXICximXmwvRrhsifUz9Mr26fV9Q3OxA55NPdvq wkZQWIYCf8fxsO/LkUMc8T0fy77AIgiCPIWy3WtEhsRcsTWji43mBE89wQmhOrvUVx J8iF7eIElzfXROC6GP/GUQ0kTzcODJ4QRn6fCD3c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "Souptick Joarder (HPE)" , Mike Kravetz , Shuah Khan , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 0807/1095] tools/testing/selftests/vm/hugetlb-madvise.c: silence uninitialized variable warning Date: Mon, 15 Aug 2022 20:03:26 +0200 Message-Id: <20220815180502.658060125@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 3d5367a0426da61c7cb616cc85b6239467e261dd ] This code just reads from memory without caring about the data itself. However static checkers complain that "tmp" is never properly initialized. Initialize it to zero and change the name to "dummy" to show that we don't care about the value stored in it. Link: https://lkml.kernel.org/r/YtZ8mKJmktA2GaHB@kili Fixes: c4b6cb884011 ("selftests/vm: add hugetlb madvise MADV_DONTNEED MADV_= REMOVE test") Signed-off-by: Dan Carpenter Acked-by: Souptick Joarder (HPE) Reviewed-by: Mike Kravetz Cc: Shuah Khan Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/testing/selftests/vm/hugetlb-madvise.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/vm/hugetlb-madvise.c b/tools/testing/s= elftests/vm/hugetlb-madvise.c index 6c6af40f5747..3c9943131881 100644 --- a/tools/testing/selftests/vm/hugetlb-madvise.c +++ b/tools/testing/selftests/vm/hugetlb-madvise.c @@ -89,10 +89,11 @@ void write_fault_pages(void *addr, unsigned long nr_pag= es) =20 void read_fault_pages(void *addr, unsigned long nr_pages) { - unsigned long i, tmp; + unsigned long dummy =3D 0; + unsigned long i; =20 for (i =3D 0; i < nr_pages; i++) - tmp +=3D *((unsigned long *)(addr + (i * huge_page_size))); + dummy +=3D *((unsigned long *)(addr + (i * huge_page_size))); } =20 int main(int argc, char **argv) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46F39C32770 for ; Mon, 15 Aug 2022 22:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349693AbiHOW0E (ORCPT ); Mon, 15 Aug 2022 18:26:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350832AbiHOWSk (ORCPT ); Mon, 15 Aug 2022 18:18:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AF8141D1B; Mon, 15 Aug 2022 12:42:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D3E72B80EA7; Mon, 15 Aug 2022 19:42:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 397F4C433C1; Mon, 15 Aug 2022 19:42:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592561; bh=dN16VvJHR/zUhnh0L+qtYA5bmwA3MJYkt+qkY5TKb3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x16JCQbGd4kzJ5pLX1dDkUBc+MlwhlEHDjkX8ahkgVeEohinCXx0E//GdRxeLIJ1j c0b9j4PJAo7pYYUnVsuGyhBCHWnJcOqZdX5qS3FuntRAvp5ktq+pxm38QQ551I/hM9 RZGY8t0UNtLsL4HUG5j4NOv33lh59uXCWjf8U07Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Mina Almasry , Muchun Song , Mike Kravetz , Shuah Khan , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 0808/1095] selftest/vm: uninitialized variable in main() Date: Mon, 15 Aug 2022 20:03:27 +0200 Message-Id: <20220815180502.695764789@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 360b420dbded8ad5b70a41de98e77354dd9e7d36 ] Initialize "length" to zero by default. Link: https://lkml.kernel.org/r/YtZzjvHXVXMXxpXO@kili Fixes: ff712a627f72 ("selftests/vm: cleanup hugetlb file after mremap test") Signed-off-by: Dan Carpenter Reviewed-by: Mina Almasry Reviewed-by: Muchun Song Cc: Mike Kravetz Cc: Shuah Khan Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/testing/selftests/vm/hugepage-mremap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/vm/hugepage-mremap.c b/tools/testing/s= elftests/vm/hugepage-mremap.c index 1d689084a54b..22546f279534 100644 --- a/tools/testing/selftests/vm/hugepage-mremap.c +++ b/tools/testing/selftests/vm/hugepage-mremap.c @@ -107,7 +107,7 @@ static void register_region_with_uffd(char *addr, size_= t len) =20 int main(int argc, char *argv[]) { - size_t length; + size_t length =3D 0; =20 if (argc !=3D 2 && argc !=3D 3) { printf("Usage: %s [length_in_MB] \n", argv[0]); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C362C28B2C for ; Mon, 15 Aug 2022 22:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349597AbiHOW0C (ORCPT ); Mon, 15 Aug 2022 18:26:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350844AbiHOWSm (ORCPT ); Mon, 15 Aug 2022 18:18:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59F2D65673; Mon, 15 Aug 2022 12:42:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 06D57B80EA7; Mon, 15 Aug 2022 19:42:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65E2EC433D6; Mon, 15 Aug 2022 19:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592567; bh=tCgbbTMFE+sb6E+5jCobyDRg7FlTRVX0HYOCBNbP5TI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dA/ldAr9Y3eCiGXFnNsqxQ2chrU270nhHhFZsL6WIEUTzCQzlPxjEbM0taX/dVSky VDf21hVdIppHgyIMRIRMIlx03Um2eYIscou7AkjS58GOEy7uGkTKf4FCyOQZH+6gSE C9MmFNPhNenspMKLHY0hT4iBP8hdW7MqYDDkhP9o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sedat Dilek , Daniel Bristot de Oliveira , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.18 0809/1095] rtla: Fix Makefile when called from -C tools/ Date: Mon, 15 Aug 2022 20:03:28 +0200 Message-Id: <20220815180502.735920369@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Bristot de Oliveira [ Upstream commit c7d8a598c5b1e21a0957f5dec2ef4139d2d1a23a ] Sedat Dilek reported an error on rtla Makefile when running: $ make -C tools/ clean [...] make[2]: Entering directory '/home/dileks/src/linux-kernel/git/tools/tracing/rtla' [...] '/home/dileks/src/linux-kernel/git/Documentation/tools/rtla' /bin/sh: 1: test: rtla-make[2]:: unexpected operator <------ The pro= blem rm: cannot remove '/home/dileks/src/linux-kernel/git': Is a directory make[2]: *** [Makefile:120: clean] Error 1 make[2]: Leaving directory This occurred because the rtla calls kernel's Makefile to get the version in silence mode, e.g., $ make -sC ../../.. kernelversion 5.19.0-rc4 But the -s is being ignored when rtla's makefile is called indirectly, so the output looks like this: $ make -C ../../.. kernelversion make: Entering directory '/root/linux' 5.19.0-rc4 make: Leaving directory '/root/linux' Using 'grep -v make' avoids this problem, e.g., $ make -C ../../.. kernelversion | grep -v make 5.19.0-rc4 Thus, add | grep -v make. Link: https://lkml.kernel.org/r/870c02d4d97a921f02a31fa3b229fc549af61a20.16= 57747763.git.bristot@kernel.org Fixes: 8619e32825fd ("rtla: Follow kernel version") Reported-by: Sedat Dilek Tested-by: Sedat Dilek Signed-off-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/tracing/rtla/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile index 3822f4ea5f49..1bea2d16d4c1 100644 --- a/tools/tracing/rtla/Makefile +++ b/tools/tracing/rtla/Makefile @@ -1,6 +1,6 @@ NAME :=3D rtla # Follow the kernel version -VERSION :=3D $(shell cat VERSION 2> /dev/null || make -sC ../../.. kernelv= ersion) +VERSION :=3D $(shell cat VERSION 2> /dev/null || make -sC ../../.. kernelv= ersion | grep -v make) =20 # From libtracefs: # Makefiles suck: This macro sets a default value of $(2) for the --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5ABAC2BB45 for ; Mon, 15 Aug 2022 22:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350170AbiHOW0Y (ORCPT ); Mon, 15 Aug 2022 18:26:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350874AbiHOWSp (ORCPT ); Mon, 15 Aug 2022 18:18:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA28A65827; Mon, 15 Aug 2022 12:42:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3B368B80EA9; Mon, 15 Aug 2022 19:42:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9890CC433C1; Mon, 15 Aug 2022 19:42:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592574; bh=WMHuwJF65OUTic2MXusj7pI//kwnDmHogdmjBJcNqpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kMjr+6xnfIH6EkyoCuF+aMeJRdQF/hMNwZblbzih6+IYNpy1b3xf9zDsmX5LnmkaD CkZpExMfwmooH4i0FWqJ0Zt2i5/l2++IhqZ37g0QDRztJ+ZkRY6SBhO5TKw54LlhiZ yMAzJJ7GDcANosB+sDQLkYB6v0vp5vcfa1vTJAKc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Schwab , Daniel Bristot de Oliveira , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.18 0810/1095] rtla: Fix double free Date: Mon, 15 Aug 2022 20:03:29 +0200 Message-Id: <20220815180502.775652783@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andreas Schwab [ Upstream commit 4f753c3be52c1d930afc0fe3169baa605dbaf611 ] Avoid double free by making trace_instance_destroy indempotent. When trace_instance_init fails, it calls trace_instance_destroy, but its only caller osnoise_destroy_tool calls it again. Link: https://lkml.kernel.org/r/mvmilnlkyzx.fsf_-_@suse.de Fixes: 0605bf009f18 ("rtla: Add osnoise tool") Signed-off-by: Andreas Schwab Acked-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/tracing/rtla/src/trace.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/tracing/rtla/src/trace.c b/tools/tracing/rtla/src/trace.c index 5784c9f9e570..e1ba6d9f4265 100644 --- a/tools/tracing/rtla/src/trace.c +++ b/tools/tracing/rtla/src/trace.c @@ -134,13 +134,18 @@ void trace_instance_destroy(struct trace_instance *tr= ace) if (trace->inst) { disable_tracer(trace->inst); destroy_instance(trace->inst); + trace->inst =3D NULL; } =20 - if (trace->seq) + if (trace->seq) { free(trace->seq); + trace->seq =3D NULL; + } =20 - if (trace->tep) + if (trace->tep) { tep_free(trace->tep); + trace->tep =3D NULL; + } } =20 /* --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7099CC32763 for ; Mon, 15 Aug 2022 22:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350502AbiHOW0z (ORCPT ); Mon, 15 Aug 2022 18:26:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350922AbiHOWSw (ORCPT ); Mon, 15 Aug 2022 18:18:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5477D66A74; Mon, 15 Aug 2022 12:43:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 72878B80EA7; Mon, 15 Aug 2022 19:43:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB31EC433D7; Mon, 15 Aug 2022 19:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592580; bh=siPGSWciJGt6lgMgSJxzauggUweP0sClQaAVfp+eYbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p65Jf5toj+x/aneJLFAxgs/CtN/cWlH3ED+oMn+Ejk1yDSq8HhxZU9JPnLPRyeexh 7EFlO3CS0lvvldxs5hTNU0jh7rKLAxWoTf+5MzO7doKUgtx4c6047ohkO4VlRqcnye o+izL8+af9zQUpB+WrIrLvNSngWkRi3C57BM/AlA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrei Vagin , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 0811/1095] selftests: kvm: set rax before vmcall Date: Mon, 15 Aug 2022 20:03:30 +0200 Message-Id: <20220815180502.809034018@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrei Vagin [ Upstream commit 281106f938d3daaea6f8b6723a8217a2a1ef6936 ] kvm_hypercall has to place the hypercall number in rax. Trace events show that kvm_pv_test doesn't work properly: kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0 With this change, it starts working as expected: kvm_pv_test-54285: kvm_hypercall: nr 0x5 a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-54285: kvm_hypercall: nr 0xa a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-54285: kvm_hypercall: nr 0xb a0 0x0 a1 0x0 a2 0x0 a3 0x0 Signed-off-by: Andrei Vagin Message-Id: <20220722230241.1944655-5-avagin@google.com> Fixes: ac4a4d6de22e ("selftests: kvm: test enforcement of paravirtual cpuid= features") Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/testing/selftests/kvm/lib/x86_64/processor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/tes= ting/selftests/kvm/lib/x86_64/processor.c index 33ea5e9955d9..b9984124a294 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c @@ -1423,7 +1423,7 @@ uint64_t kvm_hypercall(uint64_t nr, uint64_t a0, uint= 64_t a1, uint64_t a2, =20 asm volatile("vmcall" : "=3Da"(r) - : "b"(a0), "c"(a1), "d"(a2), "S"(a3)); + : "a"(nr), "b"(a0), "c"(a1), "d"(a2), "S"(a3)); return r; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66674C3276F for ; Mon, 15 Aug 2022 22:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350550AbiHOW07 (ORCPT ); Mon, 15 Aug 2022 18:26:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350950AbiHOWS4 (ORCPT ); Mon, 15 Aug 2022 18:18:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58C9C67CA5; Mon, 15 Aug 2022 12:43:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 818F9B81141; Mon, 15 Aug 2022 19:43:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC3FFC433C1; Mon, 15 Aug 2022 19:43:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592586; bh=Z/b5BWHJW+g75sTUAQz13S8RCfehdjJmeZQfNNJWBK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pRCcoW1SGIb2elqJnAdnxrw7igROnMI3PJQjqtlDfGJbkDrxkpENro8vj09mz86uw gw/8XCxlrzwZdPndOUkljB3s9/wbZhcZr4Ai4Y/Zqqx0UR8qNgF7/cQ6mseHxHO5hS 8hm6aa7R9W2h0bhvZMBJQG3he9EAw4YvdQ+kLOHA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xu Qiang , Rob Herring , Sasha Levin Subject: [PATCH 5.18 0812/1095] of/fdt: declared return type does not match actual return type Date: Mon, 15 Aug 2022 20:03:31 +0200 Message-Id: <20220815180502.859861917@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xu Qiang [ Upstream commit 7913145afa51bbed9eaf8e5b4ee55fa9884a71e5 ] The commit 649cab56de8e (=E2=80=9Cof: properly check for error returned by fdt_get_name()=E2=80=9D) changed the return value type from bool to int, but forgot to change the return value simultaneously. populate_node was only called in unflatten_dt_nodes, and returns with values greater than or equal to 0 were discarded without further processing. Considering that return 0 usually indicates success, return 0 instead of return true. Fixes: 649cab56de8e (=E2=80=9Cof: properly check for error returned by fdt_= get_name()=E2=80=9D) Signed-off-by: Xu Qiang Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20220801120506.11461-2-xuqiang36@huawei.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/of/fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 0f30496ce80b..d624e8b185aa 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -246,7 +246,7 @@ static int populate_node(const void *blob, } =20 *pnp =3D np; - return true; + return 0; } =20 static void reverse_nodes(struct device_node *parent) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82C56C00140 for ; Mon, 15 Aug 2022 22:28:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350765AbiHOW1L (ORCPT ); Mon, 15 Aug 2022 18:27:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347284AbiHOWTX (ORCPT ); Mon, 15 Aug 2022 18:19:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE6036AA30; Mon, 15 Aug 2022 12:43:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D6287B80EAB; Mon, 15 Aug 2022 19:43:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27582C433C1; Mon, 15 Aug 2022 19:43:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592595; bh=+mp64Pr/EQHtTObpXJCI/YKDDO+OrIRtCHdSi07jgfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MRv+ou73clbv2kF5coHX0LeUUSbnDsfgrpoGx/Vbxc5S/abIx/cohGbZz2kQAsW91 1/YmKkzGIg4s6o3tzKMDcQ2aFQRrMCkXesz1Vz94q88CP/plmoxP6hFn/bgEab0P2W RUQ3jjHKrN6dhIA4pPhWCzd15mcXRW9XVeO+Zbvo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Itay Aveksis , Maor Gottlieb , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.18 0813/1095] RDMA/mlx5: Add missing check for return value in get namespace flow Date: Mon, 15 Aug 2022 20:03:32 +0200 Message-Id: <20220815180502.902176457@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maor Gottlieb [ Upstream commit c9776457bd5eaad4ce4ecb17af8d8f3cc6957c0b ] Add missing check for return value when calling to mlx5_ib_ft_type_to_namespace, even though it can't really fail in this specific call. Fixes: 52438be44112 ("RDMA/mlx5: Allow inserting a steering rule to the FDB= ") Link: https://lore.kernel.org/r/7b9ceda217d9368a51dc47a46b769bad4af9ac92.16= 59256069.git.leonro@nvidia.com Reviewed-by: Itay Aveksis Signed-off-by: Maor Gottlieb Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/hw/mlx5/fs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/fs.c b/drivers/infiniband/hw/mlx5/f= s.c index 661ed2b44508..6092118de672 100644 --- a/drivers/infiniband/hw/mlx5/fs.c +++ b/drivers/infiniband/hw/mlx5/fs.c @@ -2265,12 +2265,10 @@ static int mlx5_ib_matcher_ns(struct uverbs_attr_bu= ndle *attrs, if (err) return err; =20 - if (flags) { - mlx5_ib_ft_type_to_namespace( + if (flags) + return mlx5_ib_ft_type_to_namespace( MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_TX, &obj->ns_type); - return 0; - } } =20 obj->ns_type =3D MLX5_FLOW_NAMESPACE_BYPASS; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2D21C32767 for ; Mon, 15 Aug 2022 22:28:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350869AbiHOW1Q (ORCPT ); Mon, 15 Aug 2022 18:27:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348074AbiHOWUn (ORCPT ); Mon, 15 Aug 2022 18:20:43 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9F8912422E; Mon, 15 Aug 2022 12:43:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 6DB92CE12C4; Mon, 15 Aug 2022 19:43:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BB2EC433D6; Mon, 15 Aug 2022 19:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592601; bh=SWJJmdINFVcc3BT0UqIxnJ+boj5QJ5bET70RPyAduao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AujAacXaBP5iKtbTCkU0cr5hFactR0TZAxw9ZY6UZyghSzvg2+bLUEfEebhUywLhA bcKHMteMjtarhMQ/Y49F/txonzydBod3hYD58n7X4sxEKZZwrxMX0wzRvHfAro46uO FcuIt60Yt1xTZkaU5YJCm67fiwX9DKlyV+hxW1B0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+833061116fa28df97f3b@syzkaller.appspotmail.com, Zhu Yanjun , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.18 0814/1095] RDMA/rxe: Fix error unwind in rxe_create_qp() Date: Mon, 15 Aug 2022 20:03:33 +0200 Message-Id: <20220815180502.952224633@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhu Yanjun [ Upstream commit fd5382c5805c4bcb50fd25b7246247d3f7114733 ] In the function rxe_create_qp(), rxe_qp_from_init() is called to initialize qp, internally things like the spin locks are not setup until rxe_qp_init_req(). If an error occures before this point then the unwind will call rxe_cleanup() and eventually to rxe_qp_do_cleanup()/rxe_cleanup_task() which will oops when trying to access the uninitialized spinlock. Move the spinlock initializations earlier before any failures. Fixes: 8700e3e7c485 ("Soft RoCE driver") Link: https://lore.kernel.org/r/20220731063621.298405-1-yanjun.zhu@linux.dev Reported-by: syzbot+833061116fa28df97f3b@syzkaller.appspotmail.com Signed-off-by: Zhu Yanjun Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/infiniband/sw/rxe/rxe_qp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe= /rxe_qp.c index 7d0c4432d3fd..4889dcae0cc8 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -186,6 +186,14 @@ static void rxe_qp_init_misc(struct rxe_dev *rxe, stru= ct rxe_qp *qp, =20 spin_lock_init(&qp->state_lock); =20 + spin_lock_init(&qp->req.task.state_lock); + spin_lock_init(&qp->resp.task.state_lock); + spin_lock_init(&qp->comp.task.state_lock); + + spin_lock_init(&qp->sq.sq_lock); + spin_lock_init(&qp->rq.producer_lock); + spin_lock_init(&qp->rq.consumer_lock); + atomic_set(&qp->ssn, 0); atomic_set(&qp->skb_out, 0); } @@ -245,7 +253,6 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct = rxe_qp *qp, qp->req.opcode =3D -1; qp->comp.opcode =3D -1; =20 - spin_lock_init(&qp->sq.sq_lock); skb_queue_head_init(&qp->req_pkts); =20 rxe_init_task(rxe, &qp->req.task, qp, @@ -296,9 +303,6 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct= rxe_qp *qp, } } =20 - spin_lock_init(&qp->rq.producer_lock); - spin_lock_init(&qp->rq.consumer_lock); - skb_queue_head_init(&qp->resp_pkts); =20 rxe_init_task(rxe, &qp->resp.task, qp, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7BB7C3276B for ; Mon, 15 Aug 2022 22:28:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350943AbiHOW1V (ORCPT ); Mon, 15 Aug 2022 18:27:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348580AbiHOWVH (ORCPT ); Mon, 15 Aug 2022 18:21:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3E759C1D2; Mon, 15 Aug 2022 12:43:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 80385610A5; Mon, 15 Aug 2022 19:43:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E529C433D7; Mon, 15 Aug 2022 19:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592607; bh=ErbsKZxnDc5fVV4xmCNmb6Y35Kw1T5Me4AnGUm3Btvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ToGX5moX7Ytbwz86tQJFs5dmR2UmkMknmj5j51n1tgXJAg23FgQDdmw6A8cTsJAJJ eTn1qPzN8Ifg2cBB2N7LyPqpZG3r7eMu9bHKUQG1e5gklBtu+Q/i651ozDbZOhnrOo kmwVx+Y8f+4XTfAhlwMkVdafs9Xy8Ys/e9lDTLVw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, gi-oh.kim@ionos.com, Md Haris Iqbal , Jack Wang , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 0815/1095] block/rnbd-srv: Set keep_id to true after mutex_trylock Date: Mon, 15 Aug 2022 20:03:34 +0200 Message-Id: <20220815180503.001150701@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Md Haris Iqbal [ Upstream commit 4bc14f3101364877dd59085f39e068a2a7ec9f2d ] After setting keep_id if the mutex trylock fails, the keep_id stays set for the rest of the sess_dev lifetime. Therefore, set keep_id to true after mutex_trylock succeeds, so that a failure of trylock does'nt touch keep_id. Fixes: b168e1d85cf3 ("block/rnbd-srv: Prevent a deadlock generated by acces= sing sysfs in parallel") Cc: gi-oh.kim@ionos.com Signed-off-by: Md Haris Iqbal Signed-off-by: Jack Wang Link: https://lore.kernel.org/r/20220707143122.460362-2-haris.iqbal@ionos.c= om Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/block/rnbd/rnbd-srv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c index f04df6294650..963df70ea026 100644 --- a/drivers/block/rnbd/rnbd-srv.c +++ b/drivers/block/rnbd/rnbd-srv.c @@ -323,10 +323,11 @@ void rnbd_srv_sess_dev_force_close(struct rnbd_srv_se= ss_dev *sess_dev, { struct rnbd_srv_session *sess =3D sess_dev->sess; =20 - sess_dev->keep_id =3D true; /* It is already started to close by client's close message. */ if (!mutex_trylock(&sess->lock)) return; + + sess_dev->keep_id =3D true; /* first remove sysfs itself to avoid deadlock */ sysfs_remove_file_self(&sess_dev->kobj, &attr->attr); rnbd_srv_destroy_dev_session_sysfs(sess_dev); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE7C6C3276D for ; Mon, 15 Aug 2022 22:28:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351033AbiHOW13 (ORCPT ); Mon, 15 Aug 2022 18:27:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348968AbiHOWVZ (ORCPT ); Mon, 15 Aug 2022 18:21:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D62112423E; Mon, 15 Aug 2022 12:43:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AF058B80EAD; Mon, 15 Aug 2022 19:43:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 007B8C433D7; Mon, 15 Aug 2022 19:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592614; bh=JKAQcE12YD+b1/CsredG6Cd/AlhWJ+dCWAGWHpNHILE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q3JiemW1PFJdKZnLd9Xf1Pd3A4/l/PJM2x0+CHpKfOz0lkRR82fs1w7lRSqGiiYx1 Z9ArmOIl/xQsDc+P3Sf6XnufoHL4K8yI3mRV3HulK6EVSO4KFs42PK/2ZuWwPaH82b m22gGfohBjbWh5v+KRKXMt9mwAW1smpsswp/73Ds= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 0816/1095] null_blk: fix ida error handling in null_add_dev() Date: Mon, 15 Aug 2022 20:03:35 +0200 Message-Id: <20220815180503.035442897@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit ee452a8d984f94fa8e894f003a52e776e4572881 ] There needs to be some error checking if ida_simple_get() fails. Also call ida_free() if there are errors later. Fixes: 94bc02e30fb8 ("nullb: use ida to manage index") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YtEhXsr6vJeoiYhd@kili Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/block/null_blk/main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index c441a4972064..3e59e824ed1f 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -2044,8 +2044,13 @@ static int null_add_dev(struct nullb_device *dev) blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, nullb->q); =20 mutex_lock(&lock); - nullb->index =3D ida_simple_get(&nullb_indexes, 0, 0, GFP_KERNEL); - dev->index =3D nullb->index; + rv =3D ida_simple_get(&nullb_indexes, 0, 0, GFP_KERNEL); + if (rv < 0) { + mutex_unlock(&lock); + goto out_cleanup_zone; + } + nullb->index =3D rv; + dev->index =3D rv; mutex_unlock(&lock); =20 blk_queue_logical_block_size(nullb->q, dev->blocksize); @@ -2065,13 +2070,16 @@ static int null_add_dev(struct nullb_device *dev) =20 rv =3D null_gendisk_register(nullb); if (rv) - goto out_cleanup_zone; + goto out_ida_free; =20 mutex_lock(&lock); list_add_tail(&nullb->list, &nullb_list); mutex_unlock(&lock); =20 return 0; + +out_ida_free: + ida_free(&nullb_indexes, nullb->index); out_cleanup_zone: null_free_zoned_dev(dev); out_cleanup_disk: --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 277FAC3276E for ; Mon, 15 Aug 2022 22:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351105AbiHOW1h (ORCPT ); Mon, 15 Aug 2022 18:27:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349406AbiHOWV3 (ORCPT ); Mon, 15 Aug 2022 18:21:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CA2BB5A58; Mon, 15 Aug 2022 12:43:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E0A761215; Mon, 15 Aug 2022 19:43:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16665C433C1; Mon, 15 Aug 2022 19:43:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592620; bh=P6zsy+Br50IxBtDghnh0AItILePGuWVPwZtgnBjUs34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dYLtOJK9Fqje69L8m6W5CO9Bv5qV90yWOT0cuQ+DbncWQ0ne2KSn1pZLGUOAMXHDo PreaIin5kNPJav+iJWnV/AShWfPCqxain+3gy17qTgJH8gHpynwPTA/I74vSQw9bu8 p/iiSsxVlBTvyhgBDiBFwRjb8KbdgGWVOKM8o1PM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bean Huo , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 0817/1095] nvme: use command_id instead of req->tag in trace_nvme_complete_rq() Date: Mon, 15 Aug 2022 20:03:36 +0200 Message-Id: <20220815180503.076313071@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bean Huo [ Upstream commit 679c54f2de672b7d79d02f8c4ad483ff6dd8ce2e ] Use command_id instead of req->tag in trace_nvme_complete_rq(), because of commit e7006de6c238 ("nvme: code command_id with a genctr for use authentication after release"), cmd->common.command_id is set to ((genctl & 0xf)< 12 | req->tag), no longer req->tag, which makes cid in trace_nvme_complete_rq and trace_nvme_setup_cmd are not the same. Fixes: e7006de6c238 ("nvme: code command_id with a genctr for use authentic= ation after release") Signed-off-by: Bean Huo Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/nvme/host/trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/trace.h b/drivers/nvme/host/trace.h index 37c7f4c89f92..6f0eaf6a1528 100644 --- a/drivers/nvme/host/trace.h +++ b/drivers/nvme/host/trace.h @@ -98,7 +98,7 @@ TRACE_EVENT(nvme_complete_rq, TP_fast_assign( __entry->ctrl_id =3D nvme_req(req)->ctrl->instance; __entry->qid =3D nvme_req_qid(req); - __entry->cid =3D req->tag; + __entry->cid =3D nvme_req(req)->cmd->common.command_id; __entry->result =3D le64_to_cpu(nvme_req(req)->result.u64); __entry->retries =3D nvme_req(req)->retries; __entry->flags =3D nvme_req(req)->flags; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEB93C00140 for ; Mon, 15 Aug 2022 22:28:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348396AbiHOW2e (ORCPT ); Mon, 15 Aug 2022 18:28:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349954AbiHOWVj (ORCPT ); Mon, 15 Aug 2022 18:21:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 694C8124F47; Mon, 15 Aug 2022 12:43:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B91F0B80EA9; Mon, 15 Aug 2022 19:43:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26AC4C4314A; Mon, 15 Aug 2022 19:43:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592629; bh=GCy6sU5OdNa/ZBPCY8OyIwcHn4s6OCqwZVqGYBE9r3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dsuOX6wsRsDUtXyTD2kOAfN9PTJBtHYQYaBypot4d3jvSeg3WIIL8XqCtztIQri0V ffd7HiZ2AbETroSLZ/tj+cs7kS/0xe82F58xVE/vKdICI3rlzk0lSoAM7R2/MszZrd Ppgk4+s8GMT8VrvQj3XPinDUX18BXhChw926Ko4w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Bowler , Guixin Liu , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 0818/1095] nvme: define compat_ioctl again to unbreak 32-bit userspace. Date: Mon, 15 Aug 2022 20:03:37 +0200 Message-Id: <20220815180503.121600294@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nick Bowler [ Upstream commit a25d4261582cf00dad884c194d21084836663d3d ] Commit 89b3d6e60550 ("nvme: simplify the compat ioctl handling") removed the initialization of compat_ioctl from the nvme block_device_operations structures. Presumably the expectation was that 32-bit ioctls would be directed through the regular handler but this is not the case: failing to assign .compat_ioctl actually means that the compat case is disabled entirely, and any attempt to submit nvme ioctls from 32-bit userspace fails outright with -ENOTTY. For example: % smartctl -x /dev/nvme0n1 [...] Read NVMe Identify Controller failed: NVME_IOCTL_ADMIN_CMD: Inappropriate= ioctl for device The blkdev_compat_ptr_ioctl helper can be used to direct compat calls through the main ioctl handler and makes things work again. Fixes: 89b3d6e60550 ("nvme: simplify the compat ioctl handling") Signed-off-by: Nick Bowler Reviewed-by: Guixin Liu Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/nvme/host/core.c | 1 + drivers/nvme/host/multipath.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index c9831daafbc6..cf7be9b4f5d3 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2093,6 +2093,7 @@ static int nvme_report_zones(struct gendisk *disk, se= ctor_t sector, static const struct block_device_operations nvme_bdev_ops =3D { .owner =3D THIS_MODULE, .ioctl =3D nvme_ioctl, + .compat_ioctl =3D blkdev_compat_ptr_ioctl, .open =3D nvme_open, .release =3D nvme_release, .getgeo =3D nvme_getgeo, diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index d464fdf978fb..b0fe23439c4a 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -408,6 +408,7 @@ const struct block_device_operations nvme_ns_head_ops = =3D { .open =3D nvme_ns_head_open, .release =3D nvme_ns_head_release, .ioctl =3D nvme_ns_head_ioctl, + .compat_ioctl =3D blkdev_compat_ptr_ioctl, .getgeo =3D nvme_getgeo, .report_zones =3D nvme_ns_head_report_zones, .pr_ops =3D &nvme_pr_ops, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8F86C25B08 for ; Mon, 15 Aug 2022 22:29:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244641AbiHOW3F (ORCPT ); Mon, 15 Aug 2022 18:29:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345968AbiHOWWI (ORCPT ); Mon, 15 Aug 2022 18:22:08 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29CD26B65D; Mon, 15 Aug 2022 12:43:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 7052BCE12C4; Mon, 15 Aug 2022 19:43:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DBDEC433D7; Mon, 15 Aug 2022 19:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592635; bh=i8C6Dc6qGwwea9fahLykl8aMjWmt2PqEQCvALcK+vZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AcwLGf+jnK70hsiHQxnptOuheAJs0dIG/iGykdNIbf/CiM+GgHse0u4bv06+RSsg9 s8lqSol9TF5AF8EVGuu/TJUCnM8Y04WRMx6GR8BNTU43hjxs3qY6p0GhYOwk9ttmXh MYNHWdF+giPMPkbtOi3ZUowpvIGKz+khNi4QHKEM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joel Granados , Christoph Hellwig , Sagi Grimberg , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 0819/1095] nvme: catch -ENODEV from nvme_revalidate_zones again Date: Mon, 15 Aug 2022 20:03:38 +0200 Message-Id: <20220815180503.162495247@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig [ Upstream commit e06b425bc835ead08b9fd935bf5e47eef473e7a0 ] nvme_revalidate_zones can also return -ENODEV if e.g. zone sizes aren't constant or not a power of two. In that case we should jump to marking the gendisk hidden and only support pass through. Fixes: 602e57c9799c ("nvme: also mark passthrough-only namespaces ready in = nvme_update_ns_info") Reported-by: Joel Granados Signed-off-by: Christoph Hellwig Reviewed-by: Joel Granados Reviewed-by: Sagi Grimberg Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/nvme/host/core.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index cf7be9b4f5d3..a58a69999dbc 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1897,8 +1897,10 @@ static int nvme_update_ns_info(struct nvme_ns *ns, s= truct nvme_id_ns *id) =20 if (ns->head->ids.csi =3D=3D NVME_CSI_ZNS) { ret =3D nvme_update_zone_info(ns, lbaf); - if (ret) - goto out_unfreeze; + if (ret) { + blk_mq_unfreeze_queue(ns->disk->queue); + goto out; + } } =20 set_disk_ro(ns->disk, (id->nsattr & NVME_NS_ATTR_RO) || @@ -1909,7 +1911,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, st= ruct nvme_id_ns *id) if (blk_queue_is_zoned(ns->queue)) { ret =3D nvme_revalidate_zones(ns); if (ret && !nvme_first_scan(ns->disk)) - return ret; + goto out; } =20 if (nvme_ns_head_multipath(ns->head)) { @@ -1924,9 +1926,9 @@ static int nvme_update_ns_info(struct nvme_ns *ns, st= ruct nvme_id_ns *id) disk_update_readahead(ns->head->disk); blk_mq_unfreeze_queue(ns->head->disk->queue); } - return 0; =20 -out_unfreeze: + ret =3D 0; +out: /* * If probing fails due an unsupported feature, hide the block device, * but still allow other access. @@ -1936,7 +1938,6 @@ static int nvme_update_ns_info(struct nvme_ns *ns, st= ruct nvme_id_ns *id) set_bit(NVME_NS_READY, &ns->flags); ret =3D 0; } - blk_mq_unfreeze_queue(ns->disk->queue); return ret; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38BFEC25B08 for ; Mon, 15 Aug 2022 22:29:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348765AbiHOW3Y (ORCPT ); Mon, 15 Aug 2022 18:29:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348309AbiHOWWz (ORCPT ); Mon, 15 Aug 2022 18:22:55 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 766EE1256D2; Mon, 15 Aug 2022 12:44:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id AF95DCE12E0; Mon, 15 Aug 2022 19:44:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87042C433C1; Mon, 15 Aug 2022 19:44:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592642; bh=APJwCdPbVBqTFnOCs9r4X7Wk+aabbWm8dDLg8pvApDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MjlS0CSIBt5eWuK7lIxm2m5MWUvYMk9lQsDH28wwC+CDHY5+hd0U5rz8VjV5HiMFF 5lWA0viWMX366kXs1w58ih0pz6x3OMDMpNjpq8Y87w8Fmx/bsMUweOhvImZsdc9rzd ALYHOIQnA+RJwspaxcsB4tmdD2VGJn8ioxw6J/nk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Keith Busch , Johannes Thumshirn , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 0820/1095] block/bio: remove duplicate append pages code Date: Mon, 15 Aug 2022 20:03:39 +0200 Message-Id: <20220815180503.212349816@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Keith Busch [ Upstream commit c58c0074c54c2e2bb3bb0d5a4d8896bb660cc8bc ] The getting pages setup for zone append and normal IO are identical. Use common code for each. Signed-off-by: Keith Busch Reviewed-by: Johannes Thumshirn Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20220610195830.3574005-3-kbusch@fb.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- block/bio.c | 102 ++++++++++++++++++++++------------------------------ 1 file changed, 42 insertions(+), 60 deletions(-) diff --git a/block/bio.c b/block/bio.c index fd73ee03d57e..6f6e6e23889c 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1129,6 +1129,37 @@ static void bio_put_pages(struct page **pages, size_= t size, size_t off) put_page(pages[i]); } =20 +static int bio_iov_add_page(struct bio *bio, struct page *page, + unsigned int len, unsigned int offset) +{ + bool same_page =3D false; + + if (!__bio_try_merge_page(bio, page, len, offset, &same_page)) { + if (WARN_ON_ONCE(bio_full(bio, len))) + return -EINVAL; + __bio_add_page(bio, page, len, offset); + return 0; + } + + if (same_page) + put_page(page); + return 0; +} + +static int bio_iov_add_zone_append_page(struct bio *bio, struct page *page, + unsigned int len, unsigned int offset) +{ + struct request_queue *q =3D bdev_get_queue(bio->bi_bdev); + bool same_page =3D false; + + if (bio_add_hw_page(q, bio, page, len, offset, + queue_max_zone_append_sectors(q), &same_page) !=3D len) + return -EINVAL; + if (same_page) + put_page(page); + return 0; +} + #define PAGE_PTRS_PER_BVEC (sizeof(struct bio_vec) / sizeof(struct pag= e *)) =20 /** @@ -1147,7 +1178,6 @@ static int __bio_iov_iter_get_pages(struct bio *bio, = struct iov_iter *iter) unsigned short entries_left =3D bio->bi_max_vecs - bio->bi_vcnt; struct bio_vec *bv =3D bio->bi_io_vec + bio->bi_vcnt; struct page **pages =3D (struct page **)bv; - bool same_page =3D false; ssize_t size, left; unsigned len, i; size_t offset; @@ -1156,7 +1186,7 @@ static int __bio_iov_iter_get_pages(struct bio *bio, = struct iov_iter *iter) * Move page array up in the allocated memory for the bio vecs as far as * possible so that we can start filling biovecs from the beginning * without overwriting the temporary page array. - */ + */ BUILD_BUG_ON(PAGE_PTRS_PER_BVEC < 2); pages +=3D entries_left * (PAGE_PTRS_PER_BVEC - 1); =20 @@ -1166,18 +1196,18 @@ static int __bio_iov_iter_get_pages(struct bio *bio= , struct iov_iter *iter) =20 for (left =3D size, i =3D 0; left > 0; left -=3D len, i++) { struct page *page =3D pages[i]; + int ret; =20 len =3D min_t(size_t, PAGE_SIZE - offset, left); + if (bio_op(bio) =3D=3D REQ_OP_ZONE_APPEND) + ret =3D bio_iov_add_zone_append_page(bio, page, len, + offset); + else + ret =3D bio_iov_add_page(bio, page, len, offset); =20 - if (__bio_try_merge_page(bio, page, len, offset, &same_page)) { - if (same_page) - put_page(page); - } else { - if (WARN_ON_ONCE(bio_full(bio, len))) { - bio_put_pages(pages + i, left, offset); - return -EINVAL; - } - __bio_add_page(bio, page, len, offset); + if (ret) { + bio_put_pages(pages + i, left, offset); + return ret; } offset =3D 0; } @@ -1186,51 +1216,6 @@ static int __bio_iov_iter_get_pages(struct bio *bio,= struct iov_iter *iter) return 0; } =20 -static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *it= er) -{ - unsigned short nr_pages =3D bio->bi_max_vecs - bio->bi_vcnt; - unsigned short entries_left =3D bio->bi_max_vecs - bio->bi_vcnt; - struct request_queue *q =3D bdev_get_queue(bio->bi_bdev); - unsigned int max_append_sectors =3D queue_max_zone_append_sectors(q); - struct bio_vec *bv =3D bio->bi_io_vec + bio->bi_vcnt; - struct page **pages =3D (struct page **)bv; - ssize_t size, left; - unsigned len, i; - size_t offset; - int ret =3D 0; - - /* - * Move page array up in the allocated memory for the bio vecs as far as - * possible so that we can start filling biovecs from the beginning - * without overwriting the temporary page array. - */ - BUILD_BUG_ON(PAGE_PTRS_PER_BVEC < 2); - pages +=3D entries_left * (PAGE_PTRS_PER_BVEC - 1); - - size =3D iov_iter_get_pages(iter, pages, LONG_MAX, nr_pages, &offset); - if (unlikely(size <=3D 0)) - return size ? size : -EFAULT; - - for (left =3D size, i =3D 0; left > 0; left -=3D len, i++) { - struct page *page =3D pages[i]; - bool same_page =3D false; - - len =3D min_t(size_t, PAGE_SIZE - offset, left); - if (bio_add_hw_page(q, bio, page, len, offset, - max_append_sectors, &same_page) !=3D len) { - bio_put_pages(pages + i, left, offset); - ret =3D -EINVAL; - break; - } - if (same_page) - put_page(page); - offset =3D 0; - } - - iov_iter_advance(iter, size - left); - return ret; -} - /** * bio_iov_iter_get_pages - add user or kernel pages to a bio * @bio: bio to add pages to @@ -1265,10 +1250,7 @@ int bio_iov_iter_get_pages(struct bio *bio, struct i= ov_iter *iter) } =20 do { - if (bio_op(bio) =3D=3D REQ_OP_ZONE_APPEND) - ret =3D __bio_iov_append_get_pages(bio, iter); - else - ret =3D __bio_iov_iter_get_pages(bio, iter); + ret =3D __bio_iov_iter_get_pages(bio, iter); } while (!ret && iov_iter_count(iter) && !bio_full(bio, 0)); =20 /* don't account direct I/O as memory stall */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03F6FC00140 for ; Mon, 15 Aug 2022 22:29:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348951AbiHOW3m (ORCPT ); Mon, 15 Aug 2022 18:29:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344115AbiHOWX7 (ORCPT ); Mon, 15 Aug 2022 18:23:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01223125D4D; Mon, 15 Aug 2022 12:44:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F1104B80EAD; Mon, 15 Aug 2022 19:44:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA33EC433C1; Mon, 15 Aug 2022 19:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592648; bh=GUWeR2HkTWqWqurKf6GRL4U6LrltBq3vNnVNzkov6Oo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M/18iCHYaWZFIJtA08G+I/KnO97auFmng/BrB8cGqCfulioErKkufsyXeVDQTRQ0y HQtJcpbvzU4e20437CsEr8xUFAigbNeu2mwphTk7rMTSQ4OUy4iUkORui5YfguPI/g KOqBFyR9lT5JwjfawzdiWz+unnBKSnu2PqUKiZ/g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Keith Busch , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 0821/1095] block: ensure iov_iter advances for added pages Date: Mon, 15 Aug 2022 20:03:40 +0200 Message-Id: <20220815180503.259550889@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Keith Busch [ Upstream commit 325347d965e7ccf5424a05398807a6d801846612 ] There are cases where a bio may not accept additional pages, and the iov needs to advance to the last data length that was accepted. The zone append used to handle this correctly, but was inadvertently broken when the setup was made common with the normal r/w case. Fixes: 576ed9135489c ("block: use bio_add_page in bio_iov_iter_get_pages") Fixes: c58c0074c54c2 ("block/bio: remove duplicate append pages code") Signed-off-by: Keith Busch Link: https://lore.kernel.org/r/20220712153256.2202024-1-kbusch@fb.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- block/bio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/block/bio.c b/block/bio.c index 6f6e6e23889c..7d4d5723350b 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1181,6 +1181,7 @@ static int __bio_iov_iter_get_pages(struct bio *bio, = struct iov_iter *iter) ssize_t size, left; unsigned len, i; size_t offset; + int ret =3D 0; =20 /* * Move page array up in the allocated memory for the bio vecs as far as @@ -1196,7 +1197,6 @@ static int __bio_iov_iter_get_pages(struct bio *bio, = struct iov_iter *iter) =20 for (left =3D size, i =3D 0; left > 0; left -=3D len, i++) { struct page *page =3D pages[i]; - int ret; =20 len =3D min_t(size_t, PAGE_SIZE - offset, left); if (bio_op(bio) =3D=3D REQ_OP_ZONE_APPEND) @@ -1207,13 +1207,13 @@ static int __bio_iov_iter_get_pages(struct bio *bio= , struct iov_iter *iter) =20 if (ret) { bio_put_pages(pages + i, left, offset); - return ret; + break; } offset =3D 0; } =20 - iov_iter_advance(iter, size); - return 0; + iov_iter_advance(iter, size - left); + return ret; } =20 /** --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94FD8C19F2C for ; Mon, 15 Aug 2022 22:30:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348288AbiHOW35 (ORCPT ); Mon, 15 Aug 2022 18:29:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348628AbiHOWYS (ORCPT ); Mon, 15 Aug 2022 18:24:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FF12125D5C; Mon, 15 Aug 2022 12:44:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B105F61206; Mon, 15 Aug 2022 19:44:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A02E8C433C1; Mon, 15 Aug 2022 19:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592655; bh=MoeozJqCnJo6pSScNpsVtHy3goijawpt8UNpV7zwa4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hTYU8sN0Em4FVdy/XYiwUpY1pAhyw+m2pqPJCu87kfpwjyQMwNdOK5bK0reTrREyi rQUMag3SKbpatkkt1YM3B/Abf3JtdBM1sYnVWEAkxZjI2KnYE7dp4OJHrYurIL0E0d wk227qmWhIe474KRTryK9PmmdeYrJgoPq4ZuuBhQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Yi , Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.18 0822/1095] jbd2: fix outstanding credits assert in jbd2_journal_commit_transaction() Date: Mon, 15 Aug 2022 20:03:41 +0200 Message-Id: <20220815180503.305558324@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhang Yi [ Upstream commit a89573ce4ad32f19f43ec669771726817e185be0 ] We catch an assert problem in jbd2_journal_commit_transaction() when doing fsstress and request falut injection tests. The problem is happened in a race condition between jbd2_journal_commit_transaction() and ext4_end_io_end(). Firstly, ext4_writepages() writeback dirty pages and start reserved handle, and then the journal was aborted due to some previous metadata IO error, jbd2_journal_abort() start to commit current running transaction, the committing procedure could be raced by ext4_end_io_end() and lead to subtract j_reserved_credits twice from commit_transaction->t_outstanding_credits, finally the t_outstanding_credits is mistakenly smaller than t_nr_buffers and trigger assert. kjournald2 kworker jbd2_journal_commit_transaction() write_unlock(&journal->j_state_lock); atomic_sub(j_reserved_credits, t_outstanding_credits); //sub once jbd2_journal_start_reserved() start_this_handle() //detect aborted journal jbd2_journal_free_reserved() //get running transaction read_lock(&journal->j_state_lock) __jbd2_journal_unreserve_handle() atomic_sub(j_reserved_credits, t_outstanding_credits); //sub again read_unlock(&journal->j_state_lock); journal->j_running_transaction =3D NULL; J_ASSERT(t_nr_buffers <=3D t_outstanding_credits) //bomb!!! Fix this issue by using journal->j_state_lock to protect the subtraction in jbd2_journal_commit_transaction(). Fixes: 96f1e0974575 ("jbd2: avoid long hold times of j_state_lock while com= mitting a transaction") Signed-off-by: Zhang Yi Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220611130426.2013258-1-yi.zhang@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/jbd2/commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index ac7f067b7bdd..f306b52b8e0b 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -551,13 +551,13 @@ void jbd2_journal_commit_transaction(journal_t *journ= al) */ jbd2_journal_switch_revoke_table(journal); =20 + write_lock(&journal->j_state_lock); /* * Reserved credits cannot be claimed anymore, free them */ atomic_sub(atomic_read(&journal->j_reserved_credits), &commit_transaction->t_outstanding_credits); =20 - write_lock(&journal->j_state_lock); trace_jbd2_commit_flushing(journal, commit_transaction); stats.run.rs_flushing =3D jiffies; stats.run.rs_locked =3D jbd2_time_diff(stats.run.rs_locked, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DED6C25B08 for ; Mon, 15 Aug 2022 22:30:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348814AbiHOWaU (ORCPT ); Mon, 15 Aug 2022 18:30:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348382AbiHOWZ1 (ORCPT ); Mon, 15 Aug 2022 18:25:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60D9D126952; Mon, 15 Aug 2022 12:44:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D9DA9B80EAD; Mon, 15 Aug 2022 19:44:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12615C433C1; Mon, 15 Aug 2022 19:44:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592664; bh=CIV5OVk+czLEgtOy8HbR0wRahzxtme8/N3oniTZI5ik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aPRt1Yqu/cNa4XF1pqiAfEHrF79B+H1kTPuA+5sOPev95UMe/bRKrXaoaDaWG73JH 1ZiU2oTYUdV7UJgL+C4f7u8tGctx3kQURWg7F6ibi1zSvfH5KNHMynonlN8jKC/vuS coescsu8AQ/jYVByHfGUEfLxWpSKB0eolrO1Da2E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Lingfeng , Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.18 0823/1095] ext4: recover csum seed of tmp_inode after migrating to extents Date: Mon, 15 Aug 2022 20:03:42 +0200 Message-Id: <20220815180503.350168933@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Li Lingfeng [ Upstream commit 07ea7a617d6b278fb7acedb5cbe1a81ce2de7d0c ] When migrating to extents, the checksum seed of temporary inode need to be replaced by inode's, otherwise the inode checksums will be incorrect when swapping the inodes data. However, the temporary inode can not match it's checksum to itself since it has lost it's own checksum seed. mkfs.ext4 -F /dev/sdc mount /dev/sdc /mnt/sdc xfs_io -fc "pwrite 4k 4k" -c "fsync" /mnt/sdc/testfile chattr -e /mnt/sdc/testfile chattr +e /mnt/sdc/testfile umount /dev/sdc fsck -fn /dev/sdc =3D=3D=3D=3D=3D=3D=3D=3D ... Pass 1: Checking inodes, blocks, and sizes Inode 13 passes checks, but checksum does not match inode. Fix? no ... =3D=3D=3D=3D=3D=3D=3D=3D The fix is simple, save the checksum seed of temporary inode, and recover it after migrating to extents. Fixes: e81c9302a6c3 ("ext4: set csum seed in tmp inode while migrating to e= xtents") Signed-off-by: Li Lingfeng Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220617062515.2113438-1-lilingfeng3@huawei= .com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ext4/migrate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index 7a5353a8cfd7..f2c4d9eee475 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c @@ -417,7 +417,7 @@ int ext4_ext_migrate(struct inode *inode) struct inode *tmp_inode =3D NULL; struct migrate_struct lb; unsigned long max_entries; - __u32 goal; + __u32 goal, tmp_csum_seed; uid_t owner[2]; =20 /* @@ -465,6 +465,7 @@ int ext4_ext_migrate(struct inode *inode) * the migration. */ ei =3D EXT4_I(inode); + tmp_csum_seed =3D EXT4_I(tmp_inode)->i_csum_seed; EXT4_I(tmp_inode)->i_csum_seed =3D ei->i_csum_seed; i_size_write(tmp_inode, i_size_read(inode)); /* @@ -575,6 +576,7 @@ int ext4_ext_migrate(struct inode *inode) * the inode is not visible to user space. */ tmp_inode->i_blocks =3D 0; + EXT4_I(tmp_inode)->i_csum_seed =3D tmp_csum_seed; =20 /* Reset the extent details */ ext4_ext_tree_init(handle, tmp_inode); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72E55C19F2C for ; Mon, 15 Aug 2022 22:30:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348447AbiHOWae (ORCPT ); Mon, 15 Aug 2022 18:30:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348783AbiHOWZp (ORCPT ); Mon, 15 Aug 2022 18:25:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0A2D12695D; Mon, 15 Aug 2022 12:44:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5A12761206; Mon, 15 Aug 2022 19:44:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F003C43147; Mon, 15 Aug 2022 19:44:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592670; bh=fARe67w7ny+A6i7gN0xjocrEatnsn/It0giNt8OH2e4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dinWvH1usGVROLcjbq9plkjJ36WMtGAadNRaYnYFPJADaiVnPsnKa51zijsg0tGwe I/bZu9TZmmsH5udAlBltr6ps4SMpTlMy+xI6W/DpzHs9SK0cxZdypvfEhaI9H9MWfT LWnuu5bPG0vobN8VkOMID8e1WK8gS7sF3V/P7B2A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Theodore Tso , Sasha Levin Subject: [PATCH 5.18 0824/1095] jbd2: fix assertion jh->b_frozen_data == NULL failure when journal aborted Date: Mon, 15 Aug 2022 20:03:43 +0200 Message-Id: <20220815180503.390849749@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhihao Cheng [ Upstream commit 4a734f0869f970b8a9b65062ea40b09a5da9dba8 ] Following process will fail assertion 'jh->b_frozen_data =3D=3D NULL' in jbd2_journal_dirty_metadata(): jbd2_journal_commit_transaction unlink(dir/a) jh->b_transaction =3D trans1 jh->b_jlist =3D BJ_Metadata journal->j_running_transaction =3D NULL trans1->t_state =3D T_COMMIT unlink(dir/b) handle->h_trans =3D trans2 do_get_write_access jh->b_modified =3D 0 jh->b_frozen_data =3D frozen_buffer jh->b_next_transaction =3D trans2 jbd2_journal_dirty_metadata is_handle_aborted is_journal_aborted // return false --> jbd2 abort <-- while (commit_transaction->t_buffers) if (is_journal_aborted) jbd2_journal_refile_buffer __jbd2_journal_refile_buffer WRITE_ONCE(jh->b_transaction, jh->b_next_transaction) WRITE_ONCE(jh->b_next_transaction, NULL) __jbd2_journal_file_buffer(jh, BJ_Reserved) J_ASSERT_JH(jh, jh->b_frozen_data =3D=3D NULL) // assertion failure= ! The reproducer (See detail in [Link]) reports: ------------[ cut here ]------------ kernel BUG at fs/jbd2/transaction.c:1629! invalid opcode: 0000 [#1] PREEMPT SMP CPU: 2 PID: 584 Comm: unlink Tainted: G W 5.19.0-rc6-00115-g4a57a8400075-dirty #697 RIP: 0010:jbd2_journal_dirty_metadata+0x3c5/0x470 RSP: 0018:ffffc90000be7ce0 EFLAGS: 00010202 Call Trace: __ext4_handle_dirty_metadata+0xa0/0x290 ext4_handle_dirty_dirblock+0x10c/0x1d0 ext4_delete_entry+0x104/0x200 __ext4_unlink+0x22b/0x360 ext4_unlink+0x275/0x390 vfs_unlink+0x20b/0x4c0 do_unlinkat+0x42f/0x4c0 __x64_sys_unlink+0x37/0x50 do_syscall_64+0x35/0x80 After journal aborting, __jbd2_journal_refile_buffer() is executed with holding @jh->b_state_lock, we can fix it by moving 'is_handle_aborted()' into the area protected by @jh->b_state_lock. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216251 Fixes: 470decc613ab20 ("[PATCH] jbd2: initial copy of files from jbd") Signed-off-by: Zhihao Cheng Link: https://lore.kernel.org/r/20220715125152.4022726-1-chengzhihao1@huawe= i.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/jbd2/transaction.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index fcb9175016a5..49f109699933 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -1486,8 +1486,6 @@ int jbd2_journal_dirty_metadata(handle_t *handle, str= uct buffer_head *bh) struct journal_head *jh; int ret =3D 0; =20 - if (is_handle_aborted(handle)) - return -EROFS; if (!buffer_jbd(bh)) return -EUCLEAN; =20 @@ -1534,6 +1532,18 @@ int jbd2_journal_dirty_metadata(handle_t *handle, st= ruct buffer_head *bh) journal =3D transaction->t_journal; spin_lock(&jh->b_state_lock); =20 + if (is_handle_aborted(handle)) { + /* + * Check journal aborting with @jh->b_state_lock locked, + * since 'jh->b_transaction' could be replaced with + * 'jh->b_next_transaction' during old transaction + * committing if journal aborted, which may fail + * assertion on 'jh->b_frozen_data =3D=3D NULL'. + */ + ret =3D -EROFS; + goto out_unlock_bh; + } + if (jh->b_modified =3D=3D 0) { /* * This buffer's got modified and becoming part --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E684BC32768 for ; Mon, 15 Aug 2022 22:38:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351051AbiHOWhe (ORCPT ); Mon, 15 Aug 2022 18:37:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349654AbiHOWbD (ORCPT ); Mon, 15 Aug 2022 18:31:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F073B12AD24; Mon, 15 Aug 2022 12:48:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CD278B80EAD; Mon, 15 Aug 2022 19:48:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20267C433C1; Mon, 15 Aug 2022 19:48:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592892; bh=TyFNt0yGMX+HCgNReElfeOZCISJv3dIiyMGCwZjmTq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v67NsUBBvRVZkArEPzYrsobbJKwOTLt2y2VOOuvkaIMpLLGKjgb89wZBLshbk21st 57GQvrmwSLeFt27Ty0bkge2YdN6h0W8uWG+npOz4O+3TCzGSOh9DB0Z+7iNQzFY5uN FAMRK6okZs58eTi8EOsnT5KFZhJSeLcUXxk+xOTI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Linus Torvalds , Sasha Levin Subject: [PATCH 5.18 0825/1095] usb: cdns3: Dont use priv_dev uninitialized in cdns3_gadget_ep_enable() Date: Mon, 15 Aug 2022 20:03:44 +0200 Message-Id: <20220815180503.436147661@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nathan Chancellor [ Upstream commit 78acd4ca433425e6dd4032cfc2156c60e34931f2 ] Clang warns: drivers/usb/cdns3/cdns3-gadget.c:2290:11: error: variable 'priv_dev' is u= ninitialized when used here [-Werror,-Wuninitialized] dev_dbg(priv_dev->dev, "usbss: invalid parameters\n"); ^~~~~~~~ include/linux/dev_printk.h:155:18: note: expanded from macro 'dev_dbg' dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) ^~~ include/linux/dynamic_debug.h:167:7: note: expanded from macro 'dynamic_d= ev_dbg' dev, fmt, ##__VA_ARGS__) ^~~ include/linux/dynamic_debug.h:152:56: note: expanded from macro '_dynamic= _func_call' __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__) ^~~~~~~~~~~ include/linux/dynamic_debug.h:134:15: note: expanded from macro '__dynami= c_func_call' func(&id, ##__VA_ARGS__); \ ^~~~~~~~~~~ drivers/usb/cdns3/cdns3-gadget.c:2278:31: note: initialize the variable '= priv_dev' to silence this warning struct cdns3_device *priv_dev; ^ =3D NULL 1 error generated. The priv_dev assignment was moved below the if statement to avoid potentially dereferencing ep before it was checked but priv_dev is used in the dev_dbg() call. To fix this, move the priv_dev and comp_desc assignments back to their original spot and hoist the ep check above those assignments with a call to pr_debug() instead of dev_dbg(). Fixes: c3ffc9c4ca44 ("usb: cdns3: change place of 'priv_ep' assignment in c= dns3_gadget_ep_dequeue(), cdns3_gadget_ep_enable()") Link: https://github.com/ClangBuiltLinux/linux/issues/1680 Signed-off-by: Nathan Chancellor Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/cdns3/cdns3-gadget.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gad= get.c index e0cf62e65075..ae049eb28b93 100644 --- a/drivers/usb/cdns3/cdns3-gadget.c +++ b/drivers/usb/cdns3/cdns3-gadget.c @@ -2280,16 +2280,20 @@ static int cdns3_gadget_ep_enable(struct usb_ep *ep, int ret =3D 0; int val; =20 + if (!ep) { + pr_debug("usbss: ep not configured?\n"); + return -EINVAL; + } + priv_ep =3D ep_to_cdns3_ep(ep); + priv_dev =3D priv_ep->cdns3_dev; + comp_desc =3D priv_ep->endpoint.comp_desc; =20 - if (!ep || !desc || desc->bDescriptorType !=3D USB_DT_ENDPOINT) { + if (!desc || desc->bDescriptorType !=3D USB_DT_ENDPOINT) { dev_dbg(priv_dev->dev, "usbss: invalid parameters\n"); return -EINVAL; } =20 - comp_desc =3D priv_ep->endpoint.comp_desc; - priv_dev =3D priv_ep->cdns3_dev; - if (!desc->wMaxPacketSize) { dev_err(priv_dev->dev, "usbss: missing wMaxPacketSize\n"); return -EINVAL; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F098C25B0E for ; Mon, 15 Aug 2022 22:32:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349879AbiHOWbM (ORCPT ); Mon, 15 Aug 2022 18:31:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349755AbiHOW0I (ORCPT ); Mon, 15 Aug 2022 18:26:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CC1D127BDF; Mon, 15 Aug 2022 12:44:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B8B43B81145; Mon, 15 Aug 2022 19:44:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA3AEC433D6; Mon, 15 Aug 2022 19:44:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592689; bh=CQV3gtFCOEyCWtZCTkXMTvy003w/H2jNvTviBBARrVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qk9xudA/hx57GE0mKnPUuCo3wje5LXqCQgLtmX1BmRNMq7DdAJcH9iHM0jCtzfsDe rSgP4HE0X9VypquIgqj+cVuZ5RfYakZSkfqO+x1SEKjX7zok1XCdJ+VBykjbB4wmGw TG/qzLBuCHtwnW2GjFbFkazMNztR08EKabG8t8W4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tang Bin , Viresh Kumar , Sasha Levin Subject: [PATCH 5.18 0826/1095] opp: Fix error check in dev_pm_opp_attach_genpd() Date: Mon, 15 Aug 2022 20:03:45 +0200 Message-Id: <20220815180503.476260372@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tang Bin [ Upstream commit 4ea9496cbc959eb5c78f3e379199aca9ef4e386b ] dev_pm_domain_attach_by_name() may return NULL in some cases, so IS_ERR() doesn't meet the requirements. Thus fix it. Fixes: 6319aee10e53 ("opp: Attach genpds to devices from within OPP core") Signed-off-by: Tang Bin [ Viresh: Replace ENODATA with ENODEV ] Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/opp/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 740407252298..e154b18ec4b1 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2413,8 +2413,8 @@ struct opp_table *dev_pm_opp_attach_genpd(struct devi= ce *dev, } =20 virt_dev =3D dev_pm_domain_attach_by_name(dev, *name); - if (IS_ERR(virt_dev)) { - ret =3D PTR_ERR(virt_dev); + if (IS_ERR_OR_NULL(virt_dev)) { + ret =3D PTR_ERR(virt_dev) ? : -ENODEV; dev_err(dev, "Couldn't attach to pm_domain: %d\n", ret); goto err; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40923C32763 for ; Mon, 15 Aug 2022 22:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350722AbiHOWcH (ORCPT ); Mon, 15 Aug 2022 18:32:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350526AbiHOW05 (ORCPT ); Mon, 15 Aug 2022 18:26:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6BB213D06; Mon, 15 Aug 2022 12:45:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D351EB81136; Mon, 15 Aug 2022 19:45:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4310BC433C1; Mon, 15 Aug 2022 19:45:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592723; bh=PGsH7X53hqcrhMfnuWcNIonub3vj1ZhhjTZV5SkOJ+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HpeRcdOe6C0VHOW3/81mwfJu2zLQm4EscnuQLSshcwDzEBGRbDAgG5cJAIe7KERGz GvH+LA6mOOf5flbO/VGoVzpEOPoaEJ2j/1S/Tz3EDjeD7Ynx9Zz5g3gotvSOlqR2nS v2S+n3Hxn6+sb3v4yYDs2+MITx7gbV0G/65kXW30= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Tzung-Bi Shih , Guenter Roeck , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0827/1095] ASoC: cros_ec_codec: Fix refcount leak in cros_ec_codec_platform_probe Date: Mon, 15 Aug 2022 20:03:46 +0200 Message-Id: <20220815180503.518632141@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 0a034d93ee929a9ea89f3fa5f1d8492435b9ee6e ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: b6bc07d4360d ("ASoC: cros_ec_codec: support WoV") Signed-off-by: Miaoqian Lin Reviewed-by: Tzung-Bi Shih Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220603131043.38907-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/codecs/cros_ec_codec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_co= dec.c index 9b92e1a0d1a3..43561ff1bb8d 100644 --- a/sound/soc/codecs/cros_ec_codec.c +++ b/sound/soc/codecs/cros_ec_codec.c @@ -994,6 +994,7 @@ static int cros_ec_codec_platform_probe(struct platform= _device *pdev) dev_dbg(dev, "ap_shm_phys_addr=3D%#llx len=3D%#x\n", priv->ap_shm_phys_addr, priv->ap_shm_len); } + of_node_put(node); } #endif =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30C6BC00140 for ; Mon, 15 Aug 2022 22:34:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349002AbiHOWew (ORCPT ); Mon, 15 Aug 2022 18:34:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351055AbiHOW1b (ORCPT ); Mon, 15 Aug 2022 18:27:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BD2E6D56E; Mon, 15 Aug 2022 12:46:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CAE856122E; Mon, 15 Aug 2022 19:46:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8139C433C1; Mon, 15 Aug 2022 19:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592794; bh=pqbpWM0ovuucZKEV5C40+B3/2rDpOTNZlRfpRdD2Tu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E4KjQHmfE/LN1mUkgOjvvnPrzPfx9nduQJG8RD9RsBZooxC3bsrzxHGZYxSb0MDQF lYfj8hy1yFtS4jv5fpfxG4Hu/eDnYi4PPRUqXRSdADHgEWGPPPciALUnW/ojoauKBx cTcthegTaUdxpzYEY+JnxiuOT3O64sH0zxdszQ6I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Krzysztof Kozlowski , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0828/1095] ASoC: samsung: Fix error handling in aries_audio_probe Date: Mon, 15 Aug 2022 20:03:47 +0200 Message-Id: <20220815180503.568896056@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 3e2649c5e8643bea0867bb1dd970fedadb0eb7f3 ] of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. This function is missing of_node_put(cpu) in the error path. Fix this by goto out label. of_node_put() will check NULL pointer. Fixes: 7a3a7671fa6c ("ASoC: samsung: Add driver for Aries boards") Signed-off-by: Miaoqian Lin Reviewed-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220603130640.37624-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/samsung/aries_wm8994.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/samsung/aries_wm8994.c b/sound/soc/samsung/aries_wm8= 994.c index 83acbe57b248..a0825da9fff9 100644 --- a/sound/soc/samsung/aries_wm8994.c +++ b/sound/soc/samsung/aries_wm8994.c @@ -628,8 +628,10 @@ static int aries_audio_probe(struct platform_device *p= dev) return -EINVAL; =20 codec =3D of_get_child_by_name(dev->of_node, "codec"); - if (!codec) - return -EINVAL; + if (!codec) { + ret =3D -EINVAL; + goto out; + } =20 for_each_card_prelinks(card, i, dai_link) { dai_link->codecs->of_node =3D of_parse_phandle(codec, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F70CC2BB45 for ; Mon, 15 Aug 2022 22:38:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350411AbiHOWgd (ORCPT ); Mon, 15 Aug 2022 18:36:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351237AbiHOW14 (ORCPT ); Mon, 15 Aug 2022 18:27:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 965066F56F; Mon, 15 Aug 2022 12:47:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B2E856122C; Mon, 15 Aug 2022 19:47:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0AA6C433C1; Mon, 15 Aug 2022 19:47:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592864; bh=yhuN0DL0yv2xRFCMow4wX3R8JWRCMkUfnbUAKDjrUfk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Exun67G81V2XPHJxiKtDxFxVMaCfuGybNbpfecSPZgzZOMVCV79ONBS6+AuX4I0ZA j0fQ6k64B/eRGQB8mcij+/ox5I16U+pf3qrbIeKrbkxvssl/CqeXSJPwikyRaBwHfg oGgVCc3m4FnJgdzVsrzGvbz5+IBAk8yQZORFIHXI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Fabio Estevam , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0829/1095] ASoC: imx-audmux: Silence a clang warning Date: Mon, 15 Aug 2022 20:03:48 +0200 Message-Id: <20220815180503.608132466@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabio Estevam [ Upstream commit 2f4a8171da06609bb6a063630ed546ee3d93dad7 ] Change the of_device_get_match_data() cast to (uintptr_t) to silence the following clang warning: sound/soc/fsl/imx-audmux.c:301:16: warning: cast to smaller integer type 'e= num imx_audmux_type' from 'const void *' [-Wvoid-pointer-to-enum-cast] Reported-by: kernel test robot Fixes: 6a8b8b582db1 ("ASoC: imx-audmux: Remove unused .id_table") Signed-off-by: Fabio Estevam Link: https://lore.kernel.org/r/20220526010543.1164793-1-festevam@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/fsl/imx-audmux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c index dfa05d40b276..a8e5e0f57faf 100644 --- a/sound/soc/fsl/imx-audmux.c +++ b/sound/soc/fsl/imx-audmux.c @@ -298,7 +298,7 @@ static int imx_audmux_probe(struct platform_device *pde= v) audmux_clk =3D NULL; } =20 - audmux_type =3D (enum imx_audmux_type)of_device_get_match_data(&pdev->dev= ); + audmux_type =3D (uintptr_t)of_device_get_match_data(&pdev->dev); =20 switch (audmux_type) { case IMX31_AUDMUX: --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90C06C32765 for ; Mon, 15 Aug 2022 22:38:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350936AbiHOWhV (ORCPT ); Mon, 15 Aug 2022 18:37:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348022AbiHOW3q (ORCPT ); Mon, 15 Aug 2022 18:29:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50E4AD742C; Mon, 15 Aug 2022 12:48:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 64376B80EAB; Mon, 15 Aug 2022 19:48:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A542DC433D7; Mon, 15 Aug 2022 19:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592886; bh=JJDjh3JMS1RvAWBuSHwFADZIku6Wki4QrQ2EVkZcrlg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WCB0r2T/19zAZwY2+N/0xnwfgk6qaeeVyOGhwiWtPzR9iXmoa6Iy1HWA+G35lXY2S k5OxaZLEEaVx3+XVOTtYm822UnXiy+YLuV2typGV6P/foMNPDbXxHDRYG6FXFlpuJa CnKULKOw3HYEFJ6rZfm57prjV+2/tdsd0kxSFCiM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0830/1095] ASoC: mediatek: mt8173: Fix refcount leak in mt8173_rt5650_rt5676_dev_probe Date: Mon, 15 Aug 2022 20:03:49 +0200 Message-Id: <20220815180503.654840844@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit ae4f11c1ed2d67192fdf3d89db719ee439827c11 ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Fix missing of_node_put() in error paths. Fixes: 94319ba10eca ("ASoC: mediatek: Use platform_of_node for machine driv= ers") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220602034144.60159-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c b/sound/soc/m= ediatek/mt8173/mt8173-rt5650-rt5676.c index 5716d9299066..c1e8633a74a7 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c @@ -256,14 +256,16 @@ static int mt8173_rt5650_rt5676_dev_probe(struct plat= form_device *pdev) if (!mt8173_rt5650_rt5676_dais[DAI_LINK_CODEC_I2S].codecs[0].of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret =3D -EINVAL; + goto put_node; } mt8173_rt5650_rt5676_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node =3D of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 1); if (!mt8173_rt5650_rt5676_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret =3D -EINVAL; + goto put_node; } mt8173_rt5650_rt5676_codec_conf[0].dlc.of_node =3D mt8173_rt5650_rt5676_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node; @@ -276,13 +278,15 @@ static int mt8173_rt5650_rt5676_dev_probe(struct plat= form_device *pdev) if (!mt8173_rt5650_rt5676_dais[DAI_LINK_HDMI_I2S].codecs->of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret =3D -EINVAL; + goto put_node; } =20 card->dev =3D &pdev->dev; =20 ret =3D devm_snd_soc_register_card(&pdev->dev, card); =20 +put_node: of_node_put(platform_node); return ret; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8734C25B08 for ; Mon, 15 Aug 2022 22:32:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349978AbiHOWbT (ORCPT ); Mon, 15 Aug 2022 18:31:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349829AbiHOW0J (ORCPT ); Mon, 15 Aug 2022 18:26:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1B14127BD8; Mon, 15 Aug 2022 12:44:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F2458610A3; Mon, 15 Aug 2022 19:44:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E42EDC433C1; Mon, 15 Aug 2022 19:44:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592692; bh=DF7PTMewUFfS/ZB+3tf2747d7ms+FLwktLmvT2BQnNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sx/pJikvw0a/2viCcrcJXg4bORHOpRYhnyLWgW+dH4RLzX4jRRB8xyetaIzT5eF13 eB4UCEvL4yxs9uuvZWUCzTTcY4f2jw+kwPFNBvHpMo43gP6hpMOflGdcvRNIe2y5qZ 5GyP2VpRKzd/uJ0YZlmLu4PNv9evjQgxZnTr0+Ks= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0831/1095] ASoC: mt6797-mt6351: Fix refcount leak in mt6797_mt6351_dev_probe Date: Mon, 15 Aug 2022 20:03:50 +0200 Message-Id: <20220815180503.691733395@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 7472eb8d7dd12b6b9b1a4f4527719cc9c7f5965f ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: f0ab0bf250da ("ASoC: add mt6797-mt6351 driver and config option") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220603083417.9011-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/mediatek/mt6797/mt6797-mt6351.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/soc/mediatek/mt6797/mt6797-mt6351.c b/sound/soc/mediatek= /mt6797/mt6797-mt6351.c index 496f32bcfb5e..d2f6213a6bfc 100644 --- a/sound/soc/mediatek/mt6797/mt6797-mt6351.c +++ b/sound/soc/mediatek/mt6797/mt6797-mt6351.c @@ -217,7 +217,8 @@ static int mt6797_mt6351_dev_probe(struct platform_devi= ce *pdev) if (!codec_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret =3D -EINVAL; + goto put_platform_node; } for_each_card_prelinks(card, i, dai_link) { if (dai_link->codecs->name) @@ -230,6 +231,9 @@ static int mt6797_mt6351_dev_probe(struct platform_devi= ce *pdev) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); =20 + of_node_put(codec_node); +put_platform_node: + of_node_put(platform_node); return ret; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9E8AC28B2B for ; Mon, 15 Aug 2022 22:32:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350207AbiHOWbc (ORCPT ); Mon, 15 Aug 2022 18:31:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350038AbiHOW0S (ORCPT ); Mon, 15 Aug 2022 18:26:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18C0812844B; Mon, 15 Aug 2022 12:44:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 41C8B61089; Mon, 15 Aug 2022 19:44:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AC9FC433D6; Mon, 15 Aug 2022 19:44:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592698; bh=C8wLxk7wMPsaN29ahyc7gGPIyxKfCJhjmUtAVYyWJfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jlxjx+8YGB9MUZdcL4Qjx7NUcH0mi1Zie10D+b0Mabc+KvhPrWZI9DYWvfYouvmdq 9RTzY8xPHyRaV2i15iAaf8bmqQmKBiYbypPuu1RVfejg1GH3yVaYqHSjGCXZBPtl5v H1jk/oGIsRVleRcKg+lDuRWRDsXg+bLH45Vpig/Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0832/1095] ASoC: codecs: da7210: add check for i2c_add_driver Date: Mon, 15 Aug 2022 20:03:51 +0200 Message-Id: <20220815180503.739967520@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 82fa8f581a954ddeec1602bed9f8b4a09d100e6e ] As i2c_add_driver could return error if fails, it should be better to check the return value. However, if the CONFIG_I2C and CONFIG_SPI_MASTER are both true, the return value of i2c_add_driver will be covered by spi_register_driver. Therefore, it is necessary to add check and return error if fails. Fixes: aa0e25caafb7 ("ASoC: da7210: Add support for spi regmap") Signed-off-by: Jiasheng Jiang Link: https://lore.kernel.org/r/20220531094712.2376759-1-jiasheng@iscas.ac.= cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/codecs/da7210.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c index 8af344b2fdbf..d75d15006f64 100644 --- a/sound/soc/codecs/da7210.c +++ b/sound/soc/codecs/da7210.c @@ -1336,6 +1336,8 @@ static int __init da7210_modinit(void) int ret =3D 0; #if IS_ENABLED(CONFIG_I2C) ret =3D i2c_add_driver(&da7210_i2c_driver); + if (ret) + return ret; #endif #if defined(CONFIG_SPI_MASTER) ret =3D spi_register_driver(&da7210_spi_driver); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3253C2BB41 for ; Mon, 15 Aug 2022 22:32:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350354AbiHOWbl (ORCPT ); Mon, 15 Aug 2022 18:31:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350191AbiHOW00 (ORCPT ); Mon, 15 Aug 2022 18:26:26 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84214128463; Mon, 15 Aug 2022 12:45:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 7E6ACCE12E4; Mon, 15 Aug 2022 19:45:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63A17C433D6; Mon, 15 Aug 2022 19:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592704; bh=zfl6Pl3K4qT0tKLKmfKOMaYKm1X2H/9fLtFsWsnGeQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hFhvVUS/pS1HoM9I2K1rsDH1Mk90rydGkCgyRMNIgir9HEvN9BvnDnWzNM+CZENvT dP+kzTKhSisSwVEEYXqs90ZMeQNh81KsvH3vXInN/8th2Wi9yRikjq8EsDQpX1XdRb pnZ5YnKE69JhXhuliUecGCFAHIOJ2WzhiON8zcEg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0833/1095] ASoC: mediatek: mt8173-rt5650: Fix refcount leak in mt8173_rt5650_dev_probe Date: Mon, 15 Aug 2022 20:03:52 +0200 Message-Id: <20220815180503.780351868@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit efe2178d1a32492f99e7f1f2568eea5c88a85729 ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Fix refcount leak in some error paths. Fixes: 0f83f9296d5c ("ASoC: mediatek: Add machine driver for ALC5650 codec") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220603124243.31358-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek= /mt8173/mt8173-rt5650.c index fc164f4f95f8..487807ee7019 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c @@ -280,7 +280,8 @@ static int mt8173_rt5650_dev_probe(struct platform_devi= ce *pdev) if (!mt8173_rt5650_dais[DAI_LINK_CODEC_I2S].codecs[0].of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret =3D -EINVAL; + goto put_platform_node; } mt8173_rt5650_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node =3D mt8173_rt5650_dais[DAI_LINK_CODEC_I2S].codecs[0].of_node; @@ -293,7 +294,7 @@ static int mt8173_rt5650_dev_probe(struct platform_devi= ce *pdev) dev_err(&pdev->dev, "%s codec_capture_dai name fail %d\n", __func__, ret); - return ret; + goto put_platform_node; } mt8173_rt5650_dais[DAI_LINK_CODEC_I2S].codecs[1].dai_name =3D codec_capture_dai; @@ -315,12 +316,14 @@ static int mt8173_rt5650_dev_probe(struct platform_de= vice *pdev) if (!mt8173_rt5650_dais[DAI_LINK_HDMI_I2S].codecs->of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret =3D -EINVAL; + goto put_platform_node; } card->dev =3D &pdev->dev; =20 ret =3D devm_snd_soc_register_card(&pdev->dev, card); =20 +put_platform_node: of_node_put(platform_node); return ret; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F188BC2BB45 for ; Mon, 15 Aug 2022 22:32:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350494AbiHOWbx (ORCPT ); Mon, 15 Aug 2022 18:31:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350228AbiHOW0a (ORCPT ); Mon, 15 Aug 2022 18:26:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21CA9128EC6; Mon, 15 Aug 2022 12:45:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 94F3061222; Mon, 15 Aug 2022 19:45:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C411C43140; Mon, 15 Aug 2022 19:45:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592711; bh=GoIK9W5tFF1ThOTmt9iGmRMGayudum/t1PMhPQgfubw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tDtR42bB7zSmpLIWurUL9CscBs8PSxD6eW/iyaHnRsWM8hMUcib8giUEOqsZTgr7i kHTMrEM4/xJgN+daIoAFEbJploEOec5K1Aq5b+04QDpU6dzmJU15RDwwsIZzj1Z/Mh rRhWDSSQuPZHpzdLe/CQ3OrA3zhgvQXxSyEFsDws= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Slaby , Sasha Levin Subject: [PATCH 5.18 0834/1095] serial: pic32: free up irq names correctly Date: Mon, 15 Aug 2022 20:03:53 +0200 Message-Id: <20220815180503.829667712@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiri Slaby [ Upstream commit fe36fa18ca77ca3ca9f90aab6cf39031416e432b ] struct pic32_sport contains built-up names for irqs. These are freed only in error path of pic32_uart_startup(). And even there, the freeing happens before free_irq(). So fix this by: * moving frees after free_irq(), and * add frees to pic32_uart_shutdown() -- the opposite of pic32_uart_startup(). Signed-off-by: Jiri Slaby Link: https://lore.kernel.org/r/20220503063122.20957-11-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/serial/pic32_uart.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uar= t.c index b7a3a1b959b1..e3535bd8c8a2 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -493,14 +493,14 @@ static int pic32_uart_startup(struct uart_port *port) return 0; =20 out_t: - kfree(sport->irq_tx_name); free_irq(sport->irq_tx, port); + kfree(sport->irq_tx_name); out_r: - kfree(sport->irq_rx_name); free_irq(sport->irq_rx, port); + kfree(sport->irq_rx_name); out_f: - kfree(sport->irq_fault_name); free_irq(sport->irq_fault, port); + kfree(sport->irq_fault_name); out_done: return ret; } @@ -519,8 +519,11 @@ static void pic32_uart_shutdown(struct uart_port *port) =20 /* free all 3 interrupts for this UART */ free_irq(sport->irq_fault, port); + kfree(sport->irq_fault_name); free_irq(sport->irq_tx, port); + kfree(sport->irq_tx_name); free_irq(sport->irq_rx, port); + kfree(sport->irq_rx_name); } =20 /* serial core request to change current uart setting */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22426C2BB9D for ; Mon, 15 Aug 2022 22:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350599AbiHOWcA (ORCPT ); Mon, 15 Aug 2022 18:32:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350398AbiHOW0m (ORCPT ); Mon, 15 Aug 2022 18:26:42 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F74F616E; Mon, 15 Aug 2022 12:45:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 9EC48CE1262; Mon, 15 Aug 2022 19:45:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF609C433D6; Mon, 15 Aug 2022 19:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592717; bh=fo3ll5pcQBNpqpQas4n+4QsnziesAAEYRt8J1PUkuz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xcndvjRerDcrVbdnPzsLYD0iekEXt7HN5HFk9HUFei3JawrFwCltKyzjpRCSHDN9+ FLM3THnCk/LYxWZaSYKzuNvJyl0vTO9P+dQDmhUarYRXy+3vUh7ihevVRB/PcPvhTw bTZPXVLisFHkVdqplzgPo5xSSxG7Fd53Yy+a/jTo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Jiri Slaby , Yang Yingliang , Sasha Levin Subject: [PATCH 5.18 0835/1095] serial: pic32: fix missing clk_disable_unprepare() on error in pic32_uart_startup() Date: Mon, 15 Aug 2022 20:03:54 +0200 Message-Id: <20220815180503.873715086@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit 6f3cdf2bf1ba9b70de6c2921a415951a0d59873b ] Fix the missing clk_disable_unprepare() before return from pic32_uart_startup() in the error handling case. Fixes: 157b9394709e ("serial: pic32_uart: Add PIC32 UART driver") Reported-by: Hulk Robot Reviewed-by: Jiri Slaby Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20220525021204.2407631-1-yangyingliang@huaw= ei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/serial/pic32_uart.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uar= t.c index e3535bd8c8a2..a967b586a0a0 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -427,7 +427,7 @@ static int pic32_uart_startup(struct uart_port *port) if (!sport->irq_fault_name) { dev_err(port->dev, "%s: kasprintf err!", __func__); ret =3D -ENOMEM; - goto out_done; + goto out_disable_clk; } irq_set_status_flags(sport->irq_fault, IRQ_NOAUTOEN); ret =3D request_irq(sport->irq_fault, pic32_uart_fault_interrupt, @@ -501,6 +501,8 @@ static int pic32_uart_startup(struct uart_port *port) out_f: free_irq(sport->irq_fault, port); kfree(sport->irq_fault_name); +out_disable_clk: + clk_disable_unprepare(sport->clk); out_done: return ret; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65654C32765 for ; Mon, 15 Aug 2022 22:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350815AbiHOWcO (ORCPT ); Mon, 15 Aug 2022 18:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350648AbiHOW1D (ORCPT ); Mon, 15 Aug 2022 18:27:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F88D2CE14; Mon, 15 Aug 2022 12:45:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6567E61226; Mon, 15 Aug 2022 19:45:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54FC6C4314B; Mon, 15 Aug 2022 19:45:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592726; bh=klIS7ycXksOFminzkbfQIkkg2qc2wVpDENS4p2ZuMMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MIuuPlUvfghqlLyoaHCK+AQy7PopzBAZOiuaPre7PhH3T/Zuok4WaMuCJVRJcsbeF JTnvWDYVc24Sn6B5Qnrp4DCJNnN2qJflvEllWkerzYqpWYmwhIQ1br/vF824zNARDG W5bgZEU67mE396vOj21TuKcpNe0Bs7V0qlO4K5Ao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.18 0836/1095] serial: 8250: Export ICR access helpers for internal use Date: Mon, 15 Aug 2022 20:03:55 +0200 Message-Id: <20220815180503.922165178@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maciej W. Rozycki [ Upstream commit cb5a40e3143bc64437858b337273fd63cc42e9c2 ] Make ICR access helpers available outside 8250_port.c, however retain them as ordinary static functions so as not to regress code generation. This is because `serial_icr_write' is currently automatically inlined by GCC, however `serial_icr_read' is not. Making them both static inline would grow code produced, e.g.: $ i386-linux-gnu-size --format=3Dgnu 8250_port-{old,new}.o text data bss total filename 15065 3378 0 18443 8250_port-old.o 15289 3378 0 18667 8250_port-new.o and: $ riscv64-linux-gnu-size --format=3Dgnu 8250_port-{old,new}.o text data bss total filename 16980 5306 0 22286 8250_port-old.o 17124 5306 0 22430 8250_port-new.o while making them external would needlessly add a new module interface and lose the benefit from `serial_icr_write' getting inlined outside 8250_port.o. Signed-off-by: Maciej W. Rozycki Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/alpine.DEB.2.21.2204181517500.9383@angie.or= cam.me.uk Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/serial/8250/8250.h | 22 ++++++++++++++++++++++ drivers/tty/serial/8250/8250_port.c | 21 --------------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h index db784ace25d8..467372534d1c 100644 --- a/drivers/tty/serial/8250/8250.h +++ b/drivers/tty/serial/8250/8250.h @@ -120,6 +120,28 @@ static inline void serial_out(struct uart_8250_port *u= p, int offset, int value) up->port.serial_out(&up->port, offset, value); } =20 +/* + * For the 16C950 + */ +static void serial_icr_write(struct uart_8250_port *up, int offset, int va= lue) +{ + serial_out(up, UART_SCR, offset); + serial_out(up, UART_ICR, value); +} + +static unsigned int __maybe_unused serial_icr_read(struct uart_8250_port *= up, + int offset) +{ + unsigned int value; + + serial_icr_write(up, UART_ACR, up->acr | UART_ACR_ICRRD); + serial_out(up, UART_SCR, offset); + value =3D serial_in(up, UART_ICR); + serial_icr_write(up, UART_ACR, up->acr); + + return value; +} + void serial8250_clear_and_reinit_fifos(struct uart_8250_port *p); =20 static inline int serial_dl_read(struct uart_8250_port *up) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/= 8250_port.c index ddaf35daf316..291fd99bd7f1 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -537,27 +537,6 @@ serial_port_out_sync(struct uart_port *p, int offset, = int value) } } =20 -/* - * For the 16C950 - */ -static void serial_icr_write(struct uart_8250_port *up, int offset, int va= lue) -{ - serial_out(up, UART_SCR, offset); - serial_out(up, UART_ICR, value); -} - -static unsigned int serial_icr_read(struct uart_8250_port *up, int offset) -{ - unsigned int value; - - serial_icr_write(up, UART_ACR, up->acr | UART_ACR_ICRRD); - serial_out(up, UART_SCR, offset); - value =3D serial_in(up, UART_ICR); - serial_icr_write(up, UART_ACR, up->acr); - - return value; -} - /* * FIFO support. */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 037F8C00140 for ; Mon, 15 Aug 2022 22:32:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348786AbiHOWcm (ORCPT ); Mon, 15 Aug 2022 18:32:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350741AbiHOW1J (ORCPT ); Mon, 15 Aug 2022 18:27:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8A4A4198F; Mon, 15 Aug 2022 12:45:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 63375B81136; Mon, 15 Aug 2022 19:45:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB13DC433C1; Mon, 15 Aug 2022 19:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592733; bh=GQzVVrODmWCT239cap0EveCqiYT9gKfYsgEnP5+XKRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VTSNDZEdi/cBywZKYptSxsJ2GiWXT/3yL3v1Go8Qx+4AtjAxJdddOkQfM0F/hEwqE JQlPzWpSxLrHnoN9FM7PbfUOmnW1fsYCDSZ42MlBC20s6qx40zflEPdIYiDHE/iFIz xEXlv97ScDQRJhbdjMMfYbemyb1Vu1D5l78J8axs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Ranjani Sridharan , Bard Liao , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0837/1095] ASoC: SOF: make ctx_store and ctx_restore as optional Date: Mon, 15 Aug 2022 20:03:56 +0200 Message-Id: <20220815180503.967711887@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Ujfalusi [ Upstream commit 03f69725749f453b9a4d454a92805f8eb5f095c2 ] Commit 657774acd00f ("ASoC: SOF: Make sof_suspend/resume IPC agnostic") did not marked ctx_store and ctx_restore as Optional. Fixes: 657774acd00f ("ASoC: SOF: Make sof_suspend/resume IPC agnostic") Signed-off-by: Peter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220610083549.16773-2-peter.ujfalusi@linux= .intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/sof/sof-priv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index c856f0d84e49..f369242dd975 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -364,8 +364,8 @@ struct snd_sof_ipc_msg { =20 /** * struct sof_ipc_pm_ops - IPC-specific PM ops - * @ctx_save: Function pointer for context save - * @ctx_restore: Function pointer for context restore + * @ctx_save: Optional function pointer for context save + * @ctx_restore: Optional function pointer for context restore */ struct sof_ipc_pm_ops { int (*ctx_save)(struct snd_sof_dev *sdev); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F2E5C3F6B0 for ; Mon, 15 Aug 2022 22:33:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348858AbiHOWcW (ORCPT ); Mon, 15 Aug 2022 18:32:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350709AbiHOW1I (ORCPT ); Mon, 15 Aug 2022 18:27:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C3B743301; Mon, 15 Aug 2022 12:45:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9AC856068D; Mon, 15 Aug 2022 19:45:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A52E1C433C1; Mon, 15 Aug 2022 19:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592739; bh=STzebAMGS8YaWORs9LTZ5121krjgl6i4VyUyXVdzzak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rjD2IF8DS++pAopQwlyYW4cKhrhIohX9WYUK70RVQCSVYHulfi3HJCchX7Eze0cw4 UKZ7rxXnxdD3q9jpcyDLF2yl9jAwlTqeQ4h6PKIksz7ez8qLForvLMFyeyyVNfrwbh FwigJGCuPB8XXBLky68k/qw34c37/0NYZwueuvjc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0838/1095] ASoC: codecs: msm8916-wcd-digital: move gains from SX_TLV to S8_TLV Date: Mon, 15 Aug 2022 20:03:57 +0200 Message-Id: <20220815180504.005544680@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Srinivas Kandagatla [ Upstream commit 5babb012c847beb6c8c7108fd78f650b7a2c6054 ] move all the digital gains form using SX_TLV to S8_TLV, these gains are actually 8 bit gains with 7th signed bit and ranges from -84dB to +40dB rest of the Qualcomm wcd codecs uses these properly. Fixes: ef8a4757a6db ("ASoC: msm8916-wcd-digital: Add sidetone support") Fixes: 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec") Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220609111901.318047-2-srinivas.kandagatla= @linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/codecs/msm8916-wcd-digital.c | 46 +++++++++++++------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8= 916-wcd-digital.c index 20a07c92b2fc..098a58990f07 100644 --- a/sound/soc/codecs/msm8916-wcd-digital.c +++ b/sound/soc/codecs/msm8916-wcd-digital.c @@ -328,8 +328,8 @@ static const struct snd_kcontrol_new rx1_mix2_inp1_mux = =3D SOC_DAPM_ENUM( static const struct snd_kcontrol_new rx2_mix2_inp1_mux =3D SOC_DAPM_ENUM( "RX2 MIX2 INP1 Mux", rx2_mix2_inp1_chain_enum); =20 -/* Digital Gain control -38.4 dB to +38.4 dB in 0.3 dB steps */ -static const DECLARE_TLV_DB_SCALE(digital_gain, -3840, 30, 0); +/* Digital Gain control -84 dB to +40 dB in 1 dB steps */ +static const DECLARE_TLV_DB_SCALE(digital_gain, -8400, 100, -8400); =20 /* Cutoff Freq for High Pass Filter at -3dB */ static const char * const hpf_cutoff_text[] =3D { @@ -510,15 +510,15 @@ static int wcd_iir_filter_info(struct snd_kcontrol *k= control, =20 static const struct snd_kcontrol_new msm8916_wcd_digital_snd_controls[] = =3D { SOC_SINGLE_S8_TLV("RX1 Digital Volume", LPASS_CDC_RX1_VOL_CTL_B2_CTL, - -128, 127, digital_gain), + -84, 40, digital_gain), SOC_SINGLE_S8_TLV("RX2 Digital Volume", LPASS_CDC_RX2_VOL_CTL_B2_CTL, - -128, 127, digital_gain), + -84, 40, digital_gain), SOC_SINGLE_S8_TLV("RX3 Digital Volume", LPASS_CDC_RX3_VOL_CTL_B2_CTL, - -128, 127, digital_gain), + -84, 40, digital_gain), SOC_SINGLE_S8_TLV("TX1 Digital Volume", LPASS_CDC_TX1_VOL_CTL_GAIN, - -128, 127, digital_gain), + -84, 40, digital_gain), SOC_SINGLE_S8_TLV("TX2 Digital Volume", LPASS_CDC_TX2_VOL_CTL_GAIN, - -128, 127, digital_gain), + -84, 40, digital_gain), SOC_ENUM("TX1 HPF Cutoff", tx1_hpf_cutoff_enum), SOC_ENUM("TX2 HPF Cutoff", tx2_hpf_cutoff_enum), SOC_SINGLE("TX1 HPF Switch", LPASS_CDC_TX1_MUX_CTL, 3, 1, 0), @@ -553,22 +553,22 @@ static const struct snd_kcontrol_new msm8916_wcd_digi= tal_snd_controls[] =3D { WCD_IIR_FILTER_CTL("IIR2 Band3", IIR2, BAND3), WCD_IIR_FILTER_CTL("IIR2 Band4", IIR2, BAND4), WCD_IIR_FILTER_CTL("IIR2 Band5", IIR2, BAND5), - SOC_SINGLE_SX_TLV("IIR1 INP1 Volume", LPASS_CDC_IIR1_GAIN_B1_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("IIR1 INP2 Volume", LPASS_CDC_IIR1_GAIN_B2_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("IIR1 INP3 Volume", LPASS_CDC_IIR1_GAIN_B3_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("IIR1 INP4 Volume", LPASS_CDC_IIR1_GAIN_B4_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("IIR2 INP1 Volume", LPASS_CDC_IIR2_GAIN_B1_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("IIR2 INP2 Volume", LPASS_CDC_IIR2_GAIN_B2_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("IIR2 INP3 Volume", LPASS_CDC_IIR2_GAIN_B3_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("IIR2 INP4 Volume", LPASS_CDC_IIR2_GAIN_B4_CTL, - 0, -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR1 INP1 Volume", LPASS_CDC_IIR1_GAIN_B1_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR1 INP2 Volume", LPASS_CDC_IIR1_GAIN_B2_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR1 INP3 Volume", LPASS_CDC_IIR1_GAIN_B3_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR1 INP4 Volume", LPASS_CDC_IIR1_GAIN_B4_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR2 INP1 Volume", LPASS_CDC_IIR2_GAIN_B1_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR2 INP2 Volume", LPASS_CDC_IIR2_GAIN_B2_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR2 INP3 Volume", LPASS_CDC_IIR2_GAIN_B3_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR2 INP4 Volume", LPASS_CDC_IIR2_GAIN_B4_CTL, + -84, 40, digital_gain), =20 }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CF8CC28B2B for ; Mon, 15 Aug 2022 22:32:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347393AbiHOWcc (ORCPT ); Mon, 15 Aug 2022 18:32:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350863AbiHOW1P (ORCPT ); Mon, 15 Aug 2022 18:27:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8861D86D5; Mon, 15 Aug 2022 12:45:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CF0AF610A5; Mon, 15 Aug 2022 19:45:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4A41C433C1; Mon, 15 Aug 2022 19:45:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592745; bh=UlC/ZwdgWHOnOhEeB4P16sIIWltlO0eFQ2wjCXWrEIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MpUwRT3p+ls+jFylSKQclnZV3l7rm7o6lLXlOqfUxri2S/QyfHUgwfmtsBXlAE9uF omVKcDLgbA797wTd5BXmUCCwUgvsBfmbwVgc6wvB5mMrun638gZDhUT77mdAJdiasu kSbnBd2frAc2dAyCj0XP8Epr34JutY7Zvb0/7tTA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0839/1095] ASoC: codecs: wcd9335: move gains from SX_TLV to S8_TLV Date: Mon, 15 Aug 2022 20:03:58 +0200 Message-Id: <20220815180504.041023074@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Srinivas Kandagatla [ Upstream commit 2fbe0953732e06b471cdedbf6f615b84235580d8 ] move all the digital gains form using SX_TLV to S8_TLV, these gains are actually 8 bit gains with 7th signed bit and ranges from -84dB to +40dB rest of the Qualcomm wcd codecs uses these properly. Fixes: 8c4f021d806a ("ASoC: wcd9335: add basic controls") Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220609111901.318047-3-srinivas.kandagatla= @linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/codecs/wcd9335.c | 81 +++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 45 deletions(-) diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index aa685980a97b..b7c5bfc44127 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -2259,51 +2259,42 @@ static int wcd9335_rx_hph_mode_put(struct snd_kcont= rol *kc, =20 static const struct snd_kcontrol_new wcd9335_snd_controls[] =3D { /* -84dB min - 40dB max */ - SOC_SINGLE_SX_TLV("RX0 Digital Volume", WCD9335_CDC_RX0_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX1 Digital Volume", WCD9335_CDC_RX1_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX2 Digital Volume", WCD9335_CDC_RX2_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX3 Digital Volume", WCD9335_CDC_RX3_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX4 Digital Volume", WCD9335_CDC_RX4_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX5 Digital Volume", WCD9335_CDC_RX5_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX6 Digital Volume", WCD9335_CDC_RX6_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX7 Digital Volume", WCD9335_CDC_RX7_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX8 Digital Volume", WCD9335_CDC_RX8_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX0 Mix Digital Volume", - WCD9335_CDC_RX0_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX1 Mix Digital Volume", - WCD9335_CDC_RX1_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX2 Mix Digital Volume", - WCD9335_CDC_RX2_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX3 Mix Digital Volume", - WCD9335_CDC_RX3_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX4 Mix Digital Volume", - WCD9335_CDC_RX4_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX5 Mix Digital Volume", - WCD9335_CDC_RX5_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX6 Mix Digital Volume", - WCD9335_CDC_RX6_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX7 Mix Digital Volume", - WCD9335_CDC_RX7_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX8 Mix Digital Volume", - WCD9335_CDC_RX8_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX0 Digital Volume", WCD9335_CDC_RX0_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX1 Digital Volume", WCD9335_CDC_RX1_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX2 Digital Volume", WCD9335_CDC_RX2_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX3 Digital Volume", WCD9335_CDC_RX3_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX4 Digital Volume", WCD9335_CDC_RX4_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX5 Digital Volume", WCD9335_CDC_RX5_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX6 Digital Volume", WCD9335_CDC_RX6_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX7 Digital Volume", WCD9335_CDC_RX7_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX8 Digital Volume", WCD9335_CDC_RX8_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX0 Mix Digital Volume", WCD9335_CDC_RX0_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX1 Mix Digital Volume", WCD9335_CDC_RX1_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX2 Mix Digital Volume", WCD9335_CDC_RX2_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX3 Mix Digital Volume", WCD9335_CDC_RX3_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX4 Mix Digital Volume", WCD9335_CDC_RX4_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX5 Mix Digital Volume", WCD9335_CDC_RX5_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX6 Mix Digital Volume", WCD9335_CDC_RX6_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX7 Mix Digital Volume", WCD9335_CDC_RX7_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX8 Mix Digital Volume", WCD9335_CDC_RX8_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), SOC_ENUM("RX INT0_1 HPF cut off", cf_int0_1_enum), SOC_ENUM("RX INT0_2 HPF cut off", cf_int0_2_enum), SOC_ENUM("RX INT1_1 HPF cut off", cf_int1_1_enum), --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9A4CC2BB9D for ; Mon, 15 Aug 2022 22:38:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350507AbiHOWgk (ORCPT ); Mon, 15 Aug 2022 18:36:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350976AbiHOW1W (ORCPT ); Mon, 15 Aug 2022 18:27:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F401512A54C; Mon, 15 Aug 2022 12:45:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AB6E8B80EA7; Mon, 15 Aug 2022 19:45:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01708C433D6; Mon, 15 Aug 2022 19:45:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592752; bh=6ACOjqndLQ3Ih+OOe30yxTbZi6HcEEwp2lVFUhXVsv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IeJJ0VjE2v8vHYmDKiQrD39UAj00laEBFlQ02FjbR7uiYb1ZOCb0oWPzQRqyVzMGH ubE4U/qc7C3RNBJzqtmvQbtgiyFcoqE9RPPp7kwbfLog+GkJ6dJWlwZVOorf1UnqQ1 PS73dldZaDuQ241CxNxiglJ07MdYKacfdMJRl/KE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.18 0840/1095] rpmsg: char: Add mutex protection for rpmsg_eptdev_open() Date: Mon, 15 Aug 2022 20:03:59 +0200 Message-Id: <20220815180504.090182580@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit abe13e9a561d6b3e82b21362c0d6dd3ecd8a5b13 ] There is no mutex protection for rpmsg_eptdev_open(), especially for eptdev->ept read and write operation. It may cause issues when multiple instances call rpmsg_eptdev_open() in parallel,the return state may be success or EBUSY. Fixes: 964e8bedd5a1 ("rpmsg: char: Return an error if device already open") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1653104105-16779-1-git-send-email-shengjiu.= wang@nxp.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/rpmsg/rpmsg_char.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c index b6183d4f62a2..4f2189111494 100644 --- a/drivers/rpmsg/rpmsg_char.c +++ b/drivers/rpmsg/rpmsg_char.c @@ -120,8 +120,11 @@ static int rpmsg_eptdev_open(struct inode *inode, stru= ct file *filp) struct rpmsg_device *rpdev =3D eptdev->rpdev; struct device *dev =3D &eptdev->dev; =20 - if (eptdev->ept) + mutex_lock(&eptdev->ept_lock); + if (eptdev->ept) { + mutex_unlock(&eptdev->ept_lock); return -EBUSY; + } =20 get_device(dev); =20 @@ -137,11 +140,13 @@ static int rpmsg_eptdev_open(struct inode *inode, str= uct file *filp) if (!ept) { dev_err(dev, "failed to open %s\n", eptdev->chinfo.name); put_device(dev); + mutex_unlock(&eptdev->ept_lock); return -EINVAL; } =20 eptdev->ept =3D ept; filp->private_data =3D eptdev; + mutex_unlock(&eptdev->ept_lock); =20 return 0; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DD93C00140 for ; Mon, 15 Aug 2022 22:33:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349641AbiHOWdV (ORCPT ); Mon, 15 Aug 2022 18:33:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350990AbiHOW1Y (ORCPT ); Mon, 15 Aug 2022 18:27:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA89B6C77F; Mon, 15 Aug 2022 12:46:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 67CA66068D; Mon, 15 Aug 2022 19:46:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58305C433D7; Mon, 15 Aug 2022 19:46:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592761; bh=F2p/WEQeJi8ajn9AXc1MfaTPlgWmnAqr2FACq5qrus4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ODAdvEENNjPyShiEzelvdqxz2rkM//KfmQ9FHYCMs/irBPRaBzvL4bQgSQL5qudwl n/8WgRoK8EnqhoUvvJ0RXuRMeGABDMgJAuNeFx/q2Dg9vEIcrgHfjRMRi8JpKESf3P b1Egf3WE0G8zp0EeBBLEVVzXFfYGIEoUJ5MbxBb0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.18 0841/1095] rpmsg: mtk_rpmsg: Fix circular locking dependency Date: Mon, 15 Aug 2022 20:04:00 +0200 Message-Id: <20220815180504.137782970@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: AngeloGioacchino Del Regno [ Upstream commit 353d9214682e65c55cdffad8c82139a3321c5f13 ] During execution of the worker that's used to register rpmsg devices we are safely locking the channels mutex but, when creating a new endpoint for such devices, we are registering a IPI on the SCP, which then makes the SCP to trigger an interrupt, lock its own mutex and in turn register more subdevices. This creates a circular locking dependency situation, as the mtk_rpmsg channels_lock will then depend on the SCP IPI lock. [ 15.447736] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D [ 15.460158] WARNING: possible circular locking dependency detected [ 15.460161] 5.17.0-next-20220324+ #399 Not tainted [ 15.460165] ------------------------------------------------------ [ 15.460166] kworker/0:3/155 is trying to acquire lock: [ 15.460170] ffff5b4d0eaf1308 (&scp->ipi_desc[i].lock){+.+.}-{4:4}, at: s= cp_ipi_lock+0x34/0x50 [mtk_scp_ipi] [ 15.504958] [] but task is already holding lock: [ 15.504960] ffff5b4d0e8f1918 (&mtk_subdev->channels_lock){+.+.}-{4:4}, a= t: mtk_register_device_work_function+0x50/0x1cc [mtk_rpmsg] [ 15.504978] [] which lock already depends on the new lock. [ 15.504980] [] the existing dependency chain (in reverse order) is: [ 15.504982] [] -> #1 (&mtk_subdev->channels_lock){+.+.}-{4:4}: [ 15.504990] lock_acquire+0x68/0x84 [ 15.504999] __mutex_lock+0xa4/0x3e0 [ 15.505007] mutex_lock_nested+0x40/0x70 [ 15.505012] mtk_rpmsg_ns_cb+0xe4/0x134 [mtk_rpmsg] [ 15.641684] mtk_rpmsg_ipi_handler+0x38/0x64 [mtk_rpmsg] [ 15.641693] scp_ipi_handler+0xbc/0x180 [mtk_scp] [ 15.663905] mt8192_scp_irq_handler+0x44/0xa4 [mtk_scp] [ 15.663915] scp_irq_handler+0x6c/0xa0 [mtk_scp] [ 15.685779] irq_thread_fn+0x34/0xa0 [ 15.685785] irq_thread+0x18c/0x240 [ 15.685789] kthread+0x104/0x110 [ 15.709579] ret_from_fork+0x10/0x20 [ 15.709586] [] -> #0 (&scp->ipi_desc[i].lock){+.+.}-{4:4}: [ 15.731271] __lock_acquire+0x11e4/0x1910 [ 15.740367] lock_acquire.part.0+0xd8/0x220 [ 15.749813] lock_acquire+0x68/0x84 [ 15.757861] __mutex_lock+0xa4/0x3e0 [ 15.766084] mutex_lock_nested+0x40/0x70 [ 15.775006] scp_ipi_lock+0x34/0x50 [mtk_scp_ipi] [ 15.785503] scp_ipi_register+0x40/0xa4 [mtk_scp_ipi] [ 15.796697] scp_register_ipi+0x1c/0x30 [mtk_scp] [ 15.807194] mtk_rpmsg_create_ept+0xa0/0x108 [mtk_rpmsg] [ 15.818912] rpmsg_create_ept+0x44/0x60 [ 15.827660] cros_ec_rpmsg_probe+0x15c/0x1f0 [ 15.837282] rpmsg_dev_probe+0x128/0x1d0 [ 15.846203] really_probe.part.0+0xa4/0x2a0 [ 15.855649] __driver_probe_device+0xa0/0x150 [ 15.865443] driver_probe_device+0x48/0x150 [ 15.877157] __device_attach_driver+0xc0/0x12c [ 15.889359] bus_for_each_drv+0x80/0xe0 [ 15.900330] __device_attach+0xe4/0x190 [ 15.911303] device_initial_probe+0x1c/0x2c [ 15.922969] bus_probe_device+0xa8/0xb0 [ 15.933927] device_add+0x3a8/0x8a0 [ 15.944193] device_register+0x28/0x40 [ 15.954970] rpmsg_register_device+0x5c/0xa0 [ 15.966782] mtk_register_device_work_function+0x148/0x1cc [mtk_rp= msg] [ 15.983146] process_one_work+0x294/0x664 [ 15.994458] worker_thread+0x7c/0x45c [ 16.005069] kthread+0x104/0x110 [ 16.014789] ret_from_fork+0x10/0x20 [ 16.025201] [] other info that might help us debug this: [ 16.047769] Possible unsafe locking scenario: [ 16.063942] CPU0 CPU1 [ 16.075166] ---- ---- [ 16.086376] lock(&mtk_subdev->channels_lock); [ 16.097592] lock(&scp->ipi_desc[i].lock); [ 16.113188] lock(&mtk_subdev->channels_lo= ck); [ 16.129482] lock(&scp->ipi_desc[i].lock); [ 16.140020] [] *** DEADLOCK *** [ 16.158282] 4 locks held by kworker/0:3/155: [ 16.168978] #0: ffff5b4d00008748 ((wq_completion)events){+.+.}-{0:0}, a= t: process_one_work+0x1fc/0x664 [ 16.190017] #1: ffff80000953bdc8 ((work_completion)(&mtk_subdev->regist= er_work)){+.+.}-{0:0}, at: process_one_work+0x1fc/0x664 [ 16.215269] #2: ffff5b4d0e8f1918 (&mtk_subdev->channels_lock){+.+.}-{4:= 4}, at: mtk_register_device_work_function+0x50/0x1cc [mtk_rpmsg] [ 16.242131] #3: ffff5b4d05964190 (&dev->mutex){....}-{4:4}, at: __devic= e_attach+0x44/0x190 To solve this, simply unlock the channels_lock mutex before calling mtk_rpmsg_register_device() and relock it right after, as safety is still ensured by the locking mechanism that happens right after through SCP. Fixes: 7017996951fd ("rpmsg: add rpmsg support for mt8183 SCP.") Signed-off-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220525091201.14210-1-angelogioacchino.del= regno@collabora.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/rpmsg/mtk_rpmsg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/rpmsg/mtk_rpmsg.c b/drivers/rpmsg/mtk_rpmsg.c index 5b4404b8be4c..d1213c33da20 100644 --- a/drivers/rpmsg/mtk_rpmsg.c +++ b/drivers/rpmsg/mtk_rpmsg.c @@ -234,7 +234,9 @@ static void mtk_register_device_work_function(struct wo= rk_struct *register_work) if (info->registered) continue; =20 + mutex_unlock(&subdev->channels_lock); ret =3D mtk_rpmsg_register_device(subdev, &info->info); + mutex_lock(&subdev->channels_lock); if (ret) { dev_err(&pdev->dev, "Can't create rpmsg_device\n"); continue; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F13C4C25B08 for ; Mon, 15 Aug 2022 22:33:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232226AbiHOWdu (ORCPT ); Mon, 15 Aug 2022 18:33:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351020AbiHOW11 (ORCPT ); Mon, 15 Aug 2022 18:27:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF7E66CD21; Mon, 15 Aug 2022 12:46:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8D5776122E; Mon, 15 Aug 2022 19:46:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 621A9C433D6; Mon, 15 Aug 2022 19:46:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592768; bh=1P0QJ7as0hYzhD5ijHWEvqmNPZKo7he6CYz7tYoqMF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c7ciNKPKhbMRdX4Rv3O235jKXhD1zp2ppVD8+QXasTfZE2tIcpDNjb0oIpOYytA+O njsNYqEUgXC805Ly/rxdk++oOtr2G0/j8wkOh5SCkzOusA+nMei/vjvx4CQqpUaUWh QiTNbLiyyGEmGFfi0ZJMg9GJk48iUNiZGsrmWNEk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Suman Anna , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.18 0842/1095] remoteproc: k3-r5: Fix refcount leak in k3_r5_cluster_of_init Date: Mon, 15 Aug 2022 20:04:01 +0200 Message-Id: <20220815180504.180823954@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit fa220c05d282e7479abe08b54e3bdffd06c25e97 ] Every iteration of for_each_available_child_of_node() decrements the reference count of the previous node. When breaking early from a for_each_available_child_of_node() loop, we need to explicitly call of_node_put() on the child node. Add missing of_node_put() to avoid refcount leak. Fixes: 6dedbd1d5443 ("remoteproc: k3-r5: Add a remoteproc driver for R5F su= bsystem") Signed-off-by: Miaoqian Lin Acked-by: Suman Anna Link: https://lore.kernel.org/r/20220605083334.23942-1-linmq006@gmail.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/remoteproc/ti_k3_r5_remoteproc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/= ti_k3_r5_remoteproc.c index 4840ad906018..0481926c6975 100644 --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c @@ -1655,6 +1655,7 @@ static int k3_r5_cluster_of_init(struct platform_devi= ce *pdev) if (!cpdev) { ret =3D -ENODEV; dev_err(dev, "could not get R5 core platform device\n"); + of_node_put(child); goto fail; } =20 @@ -1663,6 +1664,7 @@ static int k3_r5_cluster_of_init(struct platform_devi= ce *pdev) dev_err(dev, "k3_r5_core_of_init failed, ret =3D %d\n", ret); put_device(&cpdev->dev); + of_node_put(child); goto fail; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8142C00140 for ; Mon, 15 Aug 2022 22:33:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349708AbiHOWdh (ORCPT ); Mon, 15 Aug 2022 18:33:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351026AbiHOW11 (ORCPT ); Mon, 15 Aug 2022 18:27:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59AE674B9E; Mon, 15 Aug 2022 12:46:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DCD806122B; Mon, 15 Aug 2022 19:46:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9C5AC433D6; Mon, 15 Aug 2022 19:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592774; bh=ZxhMVr49eMNwslMvCFUqsr9mcAHtbfXm7urEzpKHVlo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UC5DcKpttu1xooE6uA3d6ByPVEhl2Nje9wdikkWdEFo5ZGoF1Pbblr2/pJ2fPxphO QsZKtLLFYM1GMw4z4+KP7Tl4aUNPQVOCFq5vqMzhOnE5jwd9/+nrTKWIcH/cGoMQ9J cBo+jR44FemC2Csq51clfbf4YxikE1CVNOBHlUcg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Lawrence , Petr Mladek , Sasha Levin Subject: [PATCH 5.18 0843/1095] selftests/livepatch: better synchronize test_klp_callbacks_busy Date: Mon, 15 Aug 2022 20:04:02 +0200 Message-Id: <20220815180504.214052020@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Joe Lawrence [ Upstream commit 55eb9a6c8bf3e2099863118ef53e02d9f44f85a8 ] The test_klp_callbacks_busy module conditionally blocks a future livepatch transition by busy waiting inside its workqueue function, busymod_work_func(). After scheduling this work, a test livepatch is loaded, introducing the transition under test. Both events are marked in the kernel log for later verification, but there is no synchronization to ensure that busymod_work_func() logs its function entry message before subsequent selftest commands log their own messages. This can lead to a rare test failure due to unexpected ordering like: # --- expected # +++ result # @@ -1,7 +1,7 @@ # % modprobe test_klp_callbacks_busy block_transition=3DY # test_klp_callbacks_busy: test_klp_callbacks_busy_init # -test_klp_callbacks_busy: busymod_work_func enter # % modprobe test_klp_callbacks_demo # +test_klp_callbacks_busy: busymod_work_func enter # livepatch: enabling patch 'test_klp_callbacks_demo' # livepatch: 'test_klp_callbacks_demo': initializing patching transition # test_klp_callbacks_demo: pre_patch_callback: vmlinux Force the module init function to wait until busymod_work_func() has started (and logged its message), before exiting to the next selftest steps. Fixes: 547840bd5ae5 ("selftests/livepatch: simplify test-klp-callbacks busy= target tests") Signed-off-by: Joe Lawrence Reviewed-by: Petr Mladek Signed-off-by: Petr Mladek Link: https://lore.kernel.org/r/20220602203233.979681-1-joe.lawrence@redhat= .com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- lib/livepatch/test_klp_callbacks_busy.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/lib/livepatch/test_klp_callbacks_busy.c +++ b/lib/livepatch/test_klp_callbacks_busy.c @@ -16,10 +16,12 @@ MODULE_PARM_DESC(block_transition, "bloc =20 static void busymod_work_func(struct work_struct *work); static DECLARE_WORK(work, busymod_work_func); +static DECLARE_COMPLETION(busymod_work_started); =20 static void busymod_work_func(struct work_struct *work) { pr_info("%s enter\n", __func__); + complete(&busymod_work_started); =20 while (READ_ONCE(block_transition)) { /* @@ -37,6 +39,12 @@ static int test_klp_callbacks_busy_init( pr_info("%s\n", __func__); schedule_work(&work); =20 + /* + * To synchronize kernel messages, hold the init function from + * exiting until the work function's entry message has printed. + */ + wait_for_completion(&busymod_work_started); + if (!block_transition) { /* * Serialize output: print all messages from the work From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6714FC19F2C for ; Mon, 15 Aug 2022 22:34:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345653AbiHOWeM (ORCPT ); Mon, 15 Aug 2022 18:34:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351043AbiHOW1a (ORCPT ); Mon, 15 Aug 2022 18:27:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 977B66C74C; Mon, 15 Aug 2022 12:46:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 560A4B80EAD; Mon, 15 Aug 2022 19:46:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7C26C433D6; Mon, 15 Aug 2022 19:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592781; bh=JHJ4eyTg8yKQ98NKbYPpKgA8p6VmB/eM/UU1vAAJ1kE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jf5AzzGSC4vEjgI2x8LUBbAmnnGNB49HJC4CzU8fexpwjsUNHSMuD95JVNiZIxVdQ 7c3lEdoXPl/2Jo83XvNyiMFVPHglVZj1lBdr7z8cMrIP95+eV0fqs+kQ1Z6DTWVbuh 20q77JDWN7vNOUJgKeHqLfAfGERvvykpVBJdmxfk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Zhongjin , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 0844/1095] profiling: fix shift too large makes kernel panic Date: Mon, 15 Aug 2022 20:04:03 +0200 Message-Id: <20220815180504.252126590@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chen Zhongjin [ Upstream commit 0fe6ee8f123a4dfb529a5aff07536bb481f34043 ] 2d186afd04d6 ("profiling: fix shift-out-of-bounds bugs") limits shift value by [0, BITS_PER_LONG -1], which means [0, 63]. However, syzbot found that the max shift value should be the bit number of (_etext - _stext). If shift is outside of this, the "buffer_bytes" will be zero and will cause kzalloc(0). Then the kernel panics due to dereferencing the returned pointer 16. This can be easily reproduced by passing a large number like 60 to enable profiling and then run readprofile. LOGS: BUG: kernel NULL pointer dereference, address: 0000000000000010 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page PGD 6148067 P4D 6148067 PUD 6142067 PMD 0 PREEMPT SMP CPU: 4 PID: 184 Comm: readprofile Not tainted 5.18.0+ #162 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g= 2dd4b9b3f840-prebuilt.qemu.org 04/01/2014 RIP: 0010:read_profile+0x104/0x220 RSP: 0018:ffffc900006fbe80 EFLAGS: 00000202 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: ffff888006150000 RSI: 0000000000000001 RDI: ffffffff82aba4a0 RBP: 000000000188bb60 R08: 0000000000000010 R09: ffff888006151000 R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff82aba4a0 R13: 0000000000000000 R14: ffffc900006fbf08 R15: 0000000000020c30 FS: 000000000188a8c0(0000) GS:ffff88803ed00000(0000) knlGS:00000000000000= 00 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000010 CR3: 0000000006144000 CR4: 00000000000006e0 Call Trace: proc_reg_read+0x56/0x70 vfs_read+0x9a/0x1b0 ksys_read+0xa1/0xe0 ? fpregs_assert_state_consistent+0x1e/0x40 do_syscall_64+0x3a/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 RIP: 0033:0x4d4b4e RSP: 002b:00007ffebb668d58 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 000000000188a8a0 RCX: 00000000004d4b4e RDX: 0000000000000400 RSI: 000000000188bb60 RDI: 0000000000000003 RBP: 0000000000000003 R08: 000000000000006e R09: 0000000000000000 R10: 0000000000000041 R11: 0000000000000246 R12: 000000000188bb60 R13: 0000000000000400 R14: 0000000000000000 R15: 000000000188bb60 Modules linked in: CR2: 0000000000000010 Killed ---[ end trace 0000000000000000 ]--- Check prof_len in profile_init() to prevent it be zero. Link: https://lkml.kernel.org/r/20220531012854.229439-1-chenzhongjin@huawei= .com Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Chen Zhongjin Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/profile.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/profile.c b/kernel/profile.c index 37640a0bd8a3..ae82ddfc6a68 100644 --- a/kernel/profile.c +++ b/kernel/profile.c @@ -109,6 +109,13 @@ int __ref profile_init(void) =20 /* only text is profiled */ prof_len =3D (_etext - _stext) >> prof_shift; + + if (!prof_len) { + pr_warn("profiling shift: %u too large\n", prof_shift); + prof_on =3D 0; + return -EINVAL; + } + buffer_bytes =3D prof_len*sizeof(atomic_t); =20 if (!alloc_cpumask_var(&prof_cpu_mask, GFP_KERNEL)) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4A7FC00140 for ; Mon, 15 Aug 2022 22:34:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349326AbiHOWeY (ORCPT ); Mon, 15 Aug 2022 18:34:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351049AbiHOW1a (ORCPT ); Mon, 15 Aug 2022 18:27:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7AFE6CF63; Mon, 15 Aug 2022 12:46:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6E968B80EB2; Mon, 15 Aug 2022 19:46:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5F9DC433D6; Mon, 15 Aug 2022 19:46:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592788; bh=vG/vDzx6+5VGFKUst4YBhuRJs1eVtMEp3W1+Ucpt4Yg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d0JxvcnDmOFvKGUYQJa0g4ewZ4okQFVStZhb+tNcQx+5VOocrJNQuLutFN1fA066H 7Fkr+hLm8AnzT1n6CFkoB3lzknyRsAupinOrpGEgC82/+LF9UHufkKHKpZUF+XbleK Ro2gIQ2WX80spwCXLUCA8dkmhd71MHcCgssDXR2Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.18 0845/1095] remoteproc: imx_rproc: Fix refcount leak in imx_rproc_addr_init Date: Mon, 15 Aug 2022 20:04:04 +0200 Message-Id: <20220815180504.291023472@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 61afafe8b938bc74841cf4b1a73dd08b9d287c5a ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not needed anymore. This function has two paths missing of_node_put(). Fixes: 6e962bfe56b9 ("remoteproc: imx_rproc: add missing of_node_put") Fixes: a0ff4aa6f010 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc = driver") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220512045558.7142-1-linmq006@gmail.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/remoteproc/imx_rproc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 91eb037089ef..f17bb41a6551 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -562,16 +562,17 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, =20 node =3D of_parse_phandle(np, "memory-region", a); /* Not map vdevbuffer, vdevring region */ - if (!strncmp(node->name, "vdev", strlen("vdev"))) + if (!strncmp(node->name, "vdev", strlen("vdev"))) { + of_node_put(node); continue; + } err =3D of_address_to_resource(node, 0, &res); + of_node_put(node); if (err) { dev_err(dev, "unable to resolve memory region\n"); return err; } =20 - of_node_put(node); - if (b >=3D IMX_RPROC_MEM_MAX) break; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35EE2C25B08 for ; Mon, 15 Aug 2022 22:35:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349999AbiHOWfB (ORCPT ); Mon, 15 Aug 2022 18:35:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351059AbiHOW1b (ORCPT ); Mon, 15 Aug 2022 18:27:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99193422DE; Mon, 15 Aug 2022 12:46:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2DAD26122B; Mon, 15 Aug 2022 19:46:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 184BAC433C1; Mon, 15 Aug 2022 19:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592797; bh=WX3GrhU3cMELvExJ8uFidpuIGUve/uH3dcx+G+aVKes=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FRtp7jtRvoW2BHyq+Izq8SNzbEdfQvN+fUx1PxxOIQUIh+p2naNpDX52zJzSaHlHv L/ImMU+7aUoGfvKKAwGZ+fwrjW1ZJuGylY8cLysZ8TRyXjj3zlEOjLVr/Yviz0iurR E0BPuwMj1CIJATAJBrIAglTOrk9MWaC/E3NLXy+M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0846/1095] selftests/powerpc: Skip energy_scale_info test on older firmware Date: Mon, 15 Aug 2022 20:04:05 +0200 Message-Id: <20220815180504.336731512@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Ellerman [ Upstream commit 4228a996b072d36f3baafb4afdc2d2d66d2cbadf ] Older machines don't have the firmware feature that enables the code this test is testing. Skip the test if the sysfs directory doesn't exist. Also use the FAIL_IF() macro to provide more verbose error reporting if an error is encountered. Fixes: 57201d657eb7 ("selftest/powerpc: Add PAPR sysfs attributes sniff tes= t") Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220619233103.2666171-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../powerpc/papr_attributes/attr_test.c | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/powerpc/papr_attributes/attr_test.c b/= tools/testing/selftests/powerpc/papr_attributes/attr_test.c index bab0dc06e90b..9b655be641c9 100644 --- a/tools/testing/selftests/powerpc/papr_attributes/attr_test.c +++ b/tools/testing/selftests/powerpc/papr_attributes/attr_test.c @@ -7,6 +7,7 @@ * Copyright 2022, Pratik Rajesh Sampat, IBM Corp. */ =20 +#include #include #include #include @@ -32,7 +33,7 @@ enum type { NUM_VAL }; =20 -int value_type(int id) +static int value_type(int id) { int val_type; =20 @@ -54,15 +55,21 @@ int value_type(int id) return val_type; } =20 -int verify_energy_info(void) +static int verify_energy_info(void) { const char *path =3D "/sys/firmware/papr/energy_scale_info"; struct dirent *entry; struct stat s; DIR *dirp; =20 - if (stat(path, &s) || !S_ISDIR(s.st_mode)) - return -1; + errno =3D 0; + if (stat(path, &s)) { + SKIP_IF(errno =3D=3D ENOENT); + FAIL_IF(errno); + } + + FAIL_IF(!S_ISDIR(s.st_mode)); + dirp =3D opendir(path); =20 while ((entry =3D readdir(dirp)) !=3D NULL) { @@ -76,25 +83,24 @@ int verify_energy_info(void) =20 id =3D atoi(entry->d_name); attr_type =3D value_type(id); - if (attr_type =3D=3D INVALID) - return -1; + FAIL_IF(attr_type =3D=3D INVALID); =20 /* Check if the files exist and have data in them */ sprintf(file_name, "%s/%d/desc", path, id); f =3D fopen(file_name, "r"); - if (!f || fgetc(f) =3D=3D EOF) - return -1; + FAIL_IF(!f); + FAIL_IF(fgetc(f) =3D=3D EOF); =20 sprintf(file_name, "%s/%d/value", path, id); f =3D fopen(file_name, "r"); - if (!f || fgetc(f) =3D=3D EOF) - return -1; + FAIL_IF(!f); + FAIL_IF(fgetc(f) =3D=3D EOF); =20 if (attr_type =3D=3D STR_VAL) { sprintf(file_name, "%s/%d/value_desc", path, id); f =3D fopen(file_name, "r"); - if (!f || fgetc(f) =3D=3D EOF) - return -1; + FAIL_IF(!f); + FAIL_IF(fgetc(f) =3D=3D EOF); } } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21100C00140 for ; Mon, 15 Aug 2022 22:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349891AbiHOWeg (ORCPT ); Mon, 15 Aug 2022 18:34:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351067AbiHOW1c (ORCPT ); Mon, 15 Aug 2022 18:27:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3BB96CF79; Mon, 15 Aug 2022 12:46:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 807F36122B; Mon, 15 Aug 2022 19:46:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85477C433D6; Mon, 15 Aug 2022 19:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592803; bh=yL9JrACkjVTIEMIH6qNEY4LXIxEtqVAeLLxT0WWprIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ObkOfHfsEIZ7cFVB6ShVbnfQXOzTYpaIWoTSm9g/jzSHQVC+XOjSPP9yqy+43N5yY cxLvRlpjpZpD/FUgbDcs2qGjusatg45TMcZ8xBB66ZAej9EniLoQ5XrcC/ZWQYj1uZ NvT4VQFEWDNxSqB8031apGhEyt+kGdCbDYh0BTe8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0847/1095] ASoC: samsung: h1940_uda1380: include proepr GPIO consumer header Date: Mon, 15 Aug 2022 20:04:06 +0200 Message-Id: <20220815180504.372349915@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski [ Upstream commit bd10b0dafdcf0ec1677cad70101e1f97b9e28f2e ] h1940_uda1380 uses gpiod*/GPIOD* so it should include GPIO consumer header. Fixes: 9666e27f90b9 ("ASoC: samsung: h1940: turn into platform driver") Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220627141900.470469-1-krzysztof.kozlowski= @linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/samsung/h1940_uda1380.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/samsung/h1940_uda1380.c b/sound/soc/samsung/h1940_ud= a1380.c index c994e67d1eaf..ca086243fcfd 100644 --- a/sound/soc/samsung/h1940_uda1380.c +++ b/sound/soc/samsung/h1940_uda1380.c @@ -8,7 +8,7 @@ // Based on version from Arnaud Patard =20 #include -#include +#include #include =20 #include --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 177F5C00140 for ; Mon, 15 Aug 2022 22:34:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245241AbiHOWe2 (ORCPT ); Mon, 15 Aug 2022 18:34:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351069AbiHOW1d (ORCPT ); Mon, 15 Aug 2022 18:27:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2161422CD; Mon, 15 Aug 2022 12:46:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5DD9E6068D; Mon, 15 Aug 2022 19:46:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48B01C433D6; Mon, 15 Aug 2022 19:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592810; bh=EQi5o21xtI13PAUup9loScSTHGhGe+0z7BpefkalvM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OlKw+kz9tGpTfXCWy2gFX/arab6Wpt1DOcFQdOUeldaDe+9Bfhe7lugVJMKiyp05x aru2la8orS6Q8G66h8OXNM4Ni3F3Mk+i8pW8jv3doYj4KZlLvq94CT4Ld3cnPBgaRK VONXl5mt5YZRCZ7ji5l9LDoZw5eJDw+/K4mOL/z8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Athira Rajeev , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0848/1095] powerpc/perf: Optimize clearing the pending PMI and remove WARN_ON for PMI check in power_pmu_disable Date: Mon, 15 Aug 2022 20:04:07 +0200 Message-Id: <20220815180504.415175160@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Athira Rajeev [ Upstream commit 890005a7d98f7452cfe86dcfb2aeeb7df01132ce ] commit 2c9ac51b850d ("powerpc/perf: Fix PMU callbacks to clear pending PMI before resetting an overflown PMC") added a new function "pmi_irq_pending" in hw_irq.h. This function is to check if there is a PMI marked as pending in Paca (PACA_IRQ_PMI).This is used in power_pmu_disable in a WARN_ON. The intention here is to provide a warning if there is PMI pending, but no counter is found overflown. During some of the perf runs, below warning is hit: WARNING: CPU: 36 PID: 0 at arch/powerpc/perf/core-book3s.c:1332 power_pmu_d= isable+0x25c/0x2c0 Modules linked in: ----- NIP [c000000000141c3c] power_pmu_disable+0x25c/0x2c0 LR [c000000000141c8c] power_pmu_disable+0x2ac/0x2c0 Call Trace: [c000000baffcfb90] [c000000000141c8c] power_pmu_disable+0x2ac/0x2c0 (unrel= iable) [c000000baffcfc10] [c0000000003e2f8c] perf_pmu_disable+0x4c/0x60 [c000000baffcfc30] [c0000000003e3344] group_sched_out.part.124+0x44/0x100 [c000000baffcfc80] [c0000000003e353c] __perf_event_disable+0x13c/0x240 [c000000baffcfcd0] [c0000000003dd334] event_function+0xc4/0x140 [c000000baffcfd20] [c0000000003d855c] remote_function+0x7c/0xa0 [c000000baffcfd50] [c00000000026c394] flush_smp_call_function_queue+0xd4/0= x300 [c000000baffcfde0] [c000000000065b24] smp_ipi_demux_relaxed+0xa4/0x100 [c000000baffcfe20] [c0000000000cb2b0] xive_muxed_ipi_action+0x20/0x40 [c000000baffcfe40] [c000000000207c3c] __handle_irq_event_percpu+0x8c/0x250 [c000000baffcfee0] [c000000000207e2c] handle_irq_event_percpu+0x2c/0xa0 [c000000baffcff10] [c000000000210a04] handle_percpu_irq+0x84/0xc0 [c000000baffcff40] [c000000000205f14] generic_handle_irq+0x54/0x80 [c000000baffcff60] [c000000000015740] __do_irq+0x90/0x1d0 [c000000baffcff90] [c000000000016990] __do_IRQ+0xc0/0x140 [c0000009732f3940] [c000000bafceaca8] 0xc000000bafceaca8 [c0000009732f39d0] [c000000000016b78] do_IRQ+0x168/0x1c0 [c0000009732f3a00] [c0000000000090c8] hardware_interrupt_common_virt+0x218= /0x220 This means that there is no PMC overflown among the active events in the PMU, but there is a PMU pending in Paca. The function "any_pmc_overflown" checks the PMCs on active events in cpuhw->n_events. Code snippet: <<>> if (any_pmc_overflown(cpuhw)) clear_pmi_irq_pending(); else WARN_ON(pmi_irq_pending()); <<>> Here the PMC overflown is not from active event. Example: When we do perf record, default cycles and instructions will be running on PMC6 and PMC5 respectively. It could happen that overflowed event is currently not active and pending PMI is for the inactive event. Debug logs from trace_printk: <<>> any_pmc_overflown: idx is 5: pmc value is 0xd9a power_pmu_disable: PMC1: 0x0, PMC2: 0x0, PMC3: 0x0, PMC4: 0x0, PMC5: 0xd9a,= PMC6: 0x80002011 <<>> Here active PMC (from idx) is PMC5 , but overflown PMC is PMC6(0x80002011). When we handle PMI interrupt for such cases, if the PMC overflown is from inactive event, it will be ignored. Reference commit: commit bc09c219b2e6 ("powerpc/perf: Fix finding overflowed PMC in interrupt= ") Patch addresses two changes: 1) Fix 1 : Removal of warning ( WARN_ON(pmi_irq_pending()); ) We were printing warning if no PMC is found overflown among active PMU events, but PMI pending in PACA. But this could happen in cases where PMC overflown is not in active PMC. An inactive event could have caused the overflow. Hence the warning is not needed. To know pending PMI is from an inactive event, we need to loop through all PMC's which will cause more SPR reads via mfspr and increase in context switch. Also in existing function: perf_event_interrupt, already we ignore PMI's overflown when it is from an inactive PMC. 2) Fix 2: optimization in clearing pending PMI. Currently we check for any active PMC overflown before clearing PMI pending in Paca. This is causing additional SPR read also. From point 1, we know that if PMI pending in Paca from inactive cases, that is going to be ignored during replay. Hence if there is pending PMI in Paca, just clear it irrespective of PMC overflown or not. In summary, remove the any_pmc_overflown check entirely in power_pmu_disable. ie If there is a pending PMI in Paca, clear it, since we are in pmu_disable. There could be cases where PMI is pending because of inactive PMC ( which later when replayed also will get ignored ), so WARN_ON could give false warning. Hence removing it. Fixes: 2c9ac51b850d ("powerpc/perf: Fix PMU callbacks to clear pending PMI = before resetting an overflown PMC") Signed-off-by: Athira Rajeev Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220522142256.24699-1-atrajeev@linux.vnet.= ibm.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/perf/core-book3s.c | 35 ++++++++++++++------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3= s.c index b5b42cf0a703..3adc08254875 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c @@ -1349,27 +1349,22 @@ static void power_pmu_disable(struct pmu *pmu) * a PMI happens during interrupt replay and perf counter * values are cleared by PMU callbacks before replay. * - * If any PMC corresponding to the active PMU events are - * overflown, disable the interrupt by clearing the paca - * bit for PMI since we are disabling the PMU now. - * Otherwise provide a warning if there is PMI pending, but - * no counter is found overflown. + * Disable the interrupt by clearing the paca bit for PMI + * since we are disabling the PMU now. Otherwise provide a + * warning if there is PMI pending, but no counter is found + * overflown. + * + * Since power_pmu_disable runs under local_irq_save, it + * could happen that code hits a PMC overflow without PMI + * pending in paca. Hence only clear PMI pending if it was + * set. + * + * If a PMI is pending, then MSR[EE] must be disabled (because + * the masked PMI handler disabling EE). So it is safe to + * call clear_pmi_irq_pending(). */ - if (any_pmc_overflown(cpuhw)) { - /* - * Since power_pmu_disable runs under local_irq_save, it - * could happen that code hits a PMC overflow without PMI - * pending in paca. Hence only clear PMI pending if it was - * set. - * - * If a PMI is pending, then MSR[EE] must be disabled (because - * the masked PMI handler disabling EE). So it is safe to - * call clear_pmi_irq_pending(). - */ - if (pmi_irq_pending()) - clear_pmi_irq_pending(); - } else - WARN_ON(pmi_irq_pending()); + if (pmi_irq_pending()) + clear_pmi_irq_pending(); =20 val =3D mmcra =3D cpuhw->mmcr.mmcra; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01111C32757 for ; Mon, 15 Aug 2022 22:38:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350589AbiHOWgr (ORCPT ); Mon, 15 Aug 2022 18:36:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351070AbiHOW1d (ORCPT ); Mon, 15 Aug 2022 18:27:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57961422D1; Mon, 15 Aug 2022 12:46:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 197E0B80EB2; Mon, 15 Aug 2022 19:46:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54EB7C433D6; Mon, 15 Aug 2022 19:46:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592816; bh=DxR5Te+0hr5YPpVC4TDSEMJ/BVrdzLv1VvmTAOdfL3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EdhUyics8wCDWsDBg/SbQ8KqDx+7D5ac7aTuLHBsqzzhdi6Z15FzO9nwuyJdVhw6o haCNjveIowU8LICgWHRPo2h3Rk6C2jbUIgB88bAIWBJwu2wEMS4sf/lq2z+oczf1Rk RA3oDDjOJlfmNpdlYaBnGoSiZi4eKeC84Uat5NjA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , Krzysztof Kozlowski , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0849/1095] ASoC: samsung: change gpiod_speaker_power and rx1950_audio from global to static variables Date: Mon, 15 Aug 2022 20:04:08 +0200 Message-Id: <20220815180504.456123383@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tom Rix [ Upstream commit d2294461b90e0c5b3bbfaaf2c8baff4fd3e2bb13 ] sparse reports sound/soc/samsung/rx1950_uda1380.c:131:18: warning: symbol 'gpiod_speaker_p= ower' was not declared. Should it be static? sound/soc/samsung/rx1950_uda1380.c:231:24: warning: symbol 'rx1950_audio' w= as not declared. Should it be static? Both gpiod_speaker_power and rx1950_audio are only used in rx1950_uda1380.c, so their storage class specifiers should be static. Fixes: 83d74e354200 ("ASoC: samsung: rx1950: turn into platform driver") Signed-off-by: Tom Rix Reviewed-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220629185345.910406-1-trix@redhat.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/samsung/rx1950_uda1380.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/samsung/rx1950_uda1380.c b/sound/soc/samsung/rx1950_= uda1380.c index 6ea1c8cc9167..2820097b00b9 100644 --- a/sound/soc/samsung/rx1950_uda1380.c +++ b/sound/soc/samsung/rx1950_uda1380.c @@ -128,7 +128,7 @@ static int rx1950_startup(struct snd_pcm_substream *sub= stream) &hw_rates); } =20 -struct gpio_desc *gpiod_speaker_power; +static struct gpio_desc *gpiod_speaker_power; =20 static int rx1950_spk_power(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) @@ -227,7 +227,7 @@ static int rx1950_probe(struct platform_device *pdev) return devm_snd_soc_register_card(dev, &rx1950_asoc); } =20 -struct platform_driver rx1950_audio =3D { +static struct platform_driver rx1950_audio =3D { .driver =3D { .name =3D "rx1950-audio", .pm =3D &snd_soc_pm_ops, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88FD8C00140 for ; Mon, 15 Aug 2022 22:35:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349738AbiHOWfP (ORCPT ); Mon, 15 Aug 2022 18:35:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351078AbiHOW1e (ORCPT ); Mon, 15 Aug 2022 18:27:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D817641D39; Mon, 15 Aug 2022 12:47:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 94CBAB80EB2; Mon, 15 Aug 2022 19:47:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C38A5C433D7; Mon, 15 Aug 2022 19:47:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592823; bh=ZcY8ootTVmsrvVa0ppEC/BOYMKO/1AIrNuHec3gCNc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XF89TOx+3yg9qB3iOyReuI2VvefZxYKntM3o2qbiFriR4j1uL3d95qib0JN9lR7z9 IGsNPmA1/qZDwP5BMe/VggLQSiA/ViccbHPxBUWfDvWvdHia5WgNfnk+Dx/X36DWae 0oVKCIkoEsxXk56EnIiWfdPS2DlLjXrTPjbmk1Iw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Srinivas Kandagatla , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0850/1095] ASoC: codecs: wsa881x: handle timeouts in resume path Date: Mon, 15 Aug 2022 20:04:09 +0200 Message-Id: <20220815180504.497172715@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Srinivas Kandagatla [ Upstream commit cf6af24b54903f9f70c29b3e5b19cb72cc862d60 ] Currently we do not check if SoundWire slave initialization timeout expired before continuing to access its registers. Its possible that the registers are not accessible if timeout is expired. Handle this by returning timeout in resume path. Reported-by: Pierre-Louis Bossart Fixes: 8dd552458361 ("ASoC: codecs: wsa881x: add runtime pm support") Signed-off-by: Srinivas Kandagatla Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220630130023.9308-1-srinivas.kandagatla@l= inaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/codecs/wsa881x.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c index 616b26c70c3b..649c7e73f774 100644 --- a/sound/soc/codecs/wsa881x.c +++ b/sound/soc/codecs/wsa881x.c @@ -1174,11 +1174,17 @@ static int __maybe_unused wsa881x_runtime_resume(st= ruct device *dev) struct sdw_slave *slave =3D dev_to_sdw_dev(dev); struct regmap *regmap =3D dev_get_regmap(dev, NULL); struct wsa881x_priv *wsa881x =3D dev_get_drvdata(dev); + unsigned long time; =20 gpiod_direction_output(wsa881x->sd_n, 1); =20 - wait_for_completion_timeout(&slave->initialization_complete, - msecs_to_jiffies(WSA881X_PROBE_TIMEOUT)); + time =3D wait_for_completion_timeout(&slave->initialization_complete, + msecs_to_jiffies(WSA881X_PROBE_TIMEOUT)); + if (!time) { + dev_err(dev, "Initialization not complete, timed out\n"); + gpiod_direction_output(wsa881x->sd_n, 0); + return -ETIMEDOUT; + } =20 regcache_cache_only(regmap, false); regcache_sync(regmap); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A84FCC00140 for ; Mon, 15 Aug 2022 22:35:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349752AbiHOWf1 (ORCPT ); Mon, 15 Aug 2022 18:35:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351093AbiHOW1f (ORCPT ); Mon, 15 Aug 2022 18:27:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E8E36D57F; Mon, 15 Aug 2022 12:47:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2C44F61206; Mon, 15 Aug 2022 19:47:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C35AC433C1; Mon, 15 Aug 2022 19:47:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592832; bh=FBaTAHb0GzBnCauJyhCdmmS9bjHyhSpV9lskJm3Xp3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YOcYtE896RzQuyAkUr9D4+X4uOFeRRPqmAiBa4Tm7TLJpAeiipArGN+/E6CKIm/7r IoPUhN7fw1wpckTqbTkrKbZYKDncF0wPdWQ37q1jp5Xwsufgenhf8z+rWfZaUhVS9p 03iDPZyIR9kkK7iDohYqMgBokeXtIsSxKZUgGr1E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yishai Hadas , Saeed Mahameed , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.18 0851/1095] net/mlx5: Expose mlx5_sriov_blocking_notifier_register / unregister APIs Date: Mon, 15 Aug 2022 20:04:10 +0200 Message-Id: <20220815180504.535928600@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yishai Hadas [ Upstream commit 846e437387e74c44ddc9f3eeec472fd37ca3cdb9 ] Expose mlx5_sriov_blocking_notifier_register / unregister APIs to let a VF register to be notified for its enablement / disablement by the PF. Upon VF probe it will call mlx5_sriov_blocking_notifier_register() with its notifier block and upon VF remove it will call mlx5_sriov_blocking_notifier_unregister() to drop its registration. This can give a VF the ability to clean some resources upon disable before that the command interface goes down and on the other hand sets some stuff before that it's enabled. This may be used by a VF which is migration capable in few cases.(e.g. PF load/unload upon an health recovery). Link: https://lore.kernel.org/r/20220510090206.90374-2-yishaih@nvidia.com Signed-off-by: Yishai Hadas Signed-off-by: Saeed Mahameed Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../net/ethernet/mellanox/mlx5/core/sriov.c | 65 ++++++++++++++++++- include/linux/mlx5/driver.h | 12 ++++ 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c b/drivers/net/= ethernet/mellanox/mlx5/core/sriov.c index 887ee0f729d1..2935614f6fa9 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c @@ -87,6 +87,11 @@ static int mlx5_device_enable_sriov(struct mlx5_core_dev= *dev, int num_vfs) enable_vfs_hca: num_msix_count =3D mlx5_get_default_msix_vec_count(dev, num_vfs); for (vf =3D 0; vf < num_vfs; vf++) { + /* Notify the VF before its enablement to let it set + * some stuff. + */ + blocking_notifier_call_chain(&sriov->vfs_ctx[vf].notifier, + MLX5_PF_NOTIFY_ENABLE_VF, dev); err =3D mlx5_core_enable_hca(dev, vf + 1); if (err) { mlx5_core_warn(dev, "failed to enable VF %d (%d)\n", vf, err); @@ -127,6 +132,11 @@ mlx5_device_disable_sriov(struct mlx5_core_dev *dev, i= nt num_vfs, bool clear_vf) for (vf =3D num_vfs - 1; vf >=3D 0; vf--) { if (!sriov->vfs_ctx[vf].enabled) continue; + /* Notify the VF before its disablement to let it clean + * some resources. + */ + blocking_notifier_call_chain(&sriov->vfs_ctx[vf].notifier, + MLX5_PF_NOTIFY_DISABLE_VF, dev); err =3D mlx5_core_disable_hca(dev, vf + 1); if (err) { mlx5_core_warn(dev, "failed to disable VF %d\n", vf); @@ -257,7 +267,7 @@ int mlx5_sriov_init(struct mlx5_core_dev *dev) { struct mlx5_core_sriov *sriov =3D &dev->priv.sriov; struct pci_dev *pdev =3D dev->pdev; - int total_vfs; + int total_vfs, i; =20 if (!mlx5_core_is_pf(dev)) return 0; @@ -269,6 +279,9 @@ int mlx5_sriov_init(struct mlx5_core_dev *dev) if (!sriov->vfs_ctx) return -ENOMEM; =20 + for (i =3D 0; i < total_vfs; i++) + BLOCKING_INIT_NOTIFIER_HEAD(&sriov->vfs_ctx[i].notifier); + return 0; } =20 @@ -281,3 +294,53 @@ void mlx5_sriov_cleanup(struct mlx5_core_dev *dev) =20 kfree(sriov->vfs_ctx); } + +/** + * mlx5_sriov_blocking_notifier_unregister - Unregister a VF from + * a notification block chain. + * + * @mdev: The mlx5 core device. + * @vf_id: The VF id. + * @nb: The notifier block to be unregistered. + */ +void mlx5_sriov_blocking_notifier_unregister(struct mlx5_core_dev *mdev, + int vf_id, + struct notifier_block *nb) +{ + struct mlx5_vf_context *vfs_ctx; + struct mlx5_core_sriov *sriov; + + sriov =3D &mdev->priv.sriov; + if (WARN_ON(vf_id < 0 || vf_id >=3D sriov->num_vfs)) + return; + + vfs_ctx =3D &sriov->vfs_ctx[vf_id]; + blocking_notifier_chain_unregister(&vfs_ctx->notifier, nb); +} +EXPORT_SYMBOL(mlx5_sriov_blocking_notifier_unregister); + +/** + * mlx5_sriov_blocking_notifier_register - Register a VF notification + * block chain. + * + * @mdev: The mlx5 core device. + * @vf_id: The VF id. + * @nb: The notifier block to be called upon the VF events. + * + * Returns 0 on success or an error code. + */ +int mlx5_sriov_blocking_notifier_register(struct mlx5_core_dev *mdev, + int vf_id, + struct notifier_block *nb) +{ + struct mlx5_vf_context *vfs_ctx; + struct mlx5_core_sriov *sriov; + + sriov =3D &mdev->priv.sriov; + if (vf_id < 0 || vf_id >=3D sriov->num_vfs) + return -EINVAL; + + vfs_ctx =3D &sriov->vfs_ctx[vf_id]; + return blocking_notifier_chain_register(&vfs_ctx->notifier, nb); +} +EXPORT_SYMBOL(mlx5_sriov_blocking_notifier_register); diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 9424503eb8d3..3d1594bad4ec 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h @@ -445,6 +445,11 @@ struct mlx5_qp_table { struct radix_tree_root tree; }; =20 +enum { + MLX5_PF_NOTIFY_DISABLE_VF, + MLX5_PF_NOTIFY_ENABLE_VF, +}; + struct mlx5_vf_context { int enabled; u64 port_guid; @@ -455,6 +460,7 @@ struct mlx5_vf_context { u8 port_guid_valid:1; u8 node_guid_valid:1; enum port_state_policy policy; + struct blocking_notifier_head notifier; }; =20 struct mlx5_core_sriov { @@ -1155,6 +1161,12 @@ int mlx5_dm_sw_icm_dealloc(struct mlx5_core_dev *dev= , enum mlx5_sw_icm_type type struct mlx5_core_dev *mlx5_vf_get_core_dev(struct pci_dev *pdev); void mlx5_vf_put_core_dev(struct mlx5_core_dev *mdev); =20 +int mlx5_sriov_blocking_notifier_register(struct mlx5_core_dev *mdev, + int vf_id, + struct notifier_block *nb); +void mlx5_sriov_blocking_notifier_unregister(struct mlx5_core_dev *mdev, + int vf_id, + struct notifier_block *nb); #ifdef CONFIG_MLX5_CORE_IPOIB struct net_device *mlx5_rdma_netdev_alloc(struct mlx5_core_dev *mdev, struct ib_device *ibdev, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0292BC25B08 for ; Mon, 15 Aug 2022 22:38:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350135AbiHOWfo (ORCPT ); Mon, 15 Aug 2022 18:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351104AbiHOW1g (ORCPT ); Mon, 15 Aug 2022 18:27:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA7A46DF85; Mon, 15 Aug 2022 12:47:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 39C4FB81136; Mon, 15 Aug 2022 19:47:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81BC9C433B5; Mon, 15 Aug 2022 19:47:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592838; bh=rFrCVLc72DPGbHT/rqudyydWwpDsJi9Vyl0HwKKnEwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CdkwOp9yafDbwn2CCR7Vg3LoTlIOTYGy3JR5zAFaSKZAI5Wro9NoZNLDVKXRcfEjn 88ui2qF68mKuKZqr7QVECsTI/vyUVl0I5JJzE5oISAPGxqVixkYOYW7c1LTVR/3Hjk bBtysC0Mofycu90S+Y93mAcZnffGOs0NXcpg94GI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Gunthorpe , Alex Williamson , Sasha Levin Subject: [PATCH 5.18 0852/1095] vfio/pci: Have all VFIO PCI drivers store the vfio_pci_core_device in drvdata Date: Mon, 15 Aug 2022 20:04:11 +0200 Message-Id: <20220815180504.574664484@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason Gunthorpe [ Upstream commit 91be0bd6c6cf21328017e990d3ceeb00f03821fd ] Having a consistent pointer in the drvdata will allow the next patch to make use of the drvdata from some of the core code helpers. Use a WARN_ON inside vfio_pci_core_register_device() to detect drivers that miss this. Signed-off-by: Jason Gunthorpe Link: https://lore.kernel.org/r/1-v4-c841817a0349+8f-vfio_get_from_dev_jgg@= nvidia.com Signed-off-by: Alex Williamson Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 15 +++++++++++---- drivers/vfio/pci/mlx5/main.c | 15 +++++++++++---- drivers/vfio/pci/vfio_pci.c | 2 +- drivers/vfio/pci/vfio_pci_core.c | 4 ++++ 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/= pci/hisilicon/hisi_acc_vfio_pci.c index 767b5d47631a..e92376837b29 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -337,6 +337,14 @@ static int vf_qm_cache_wb(struct hisi_qm *qm) return 0; } =20 +static struct hisi_acc_vf_core_device *hssi_acc_drvdata(struct pci_dev *pd= ev) +{ + struct vfio_pci_core_device *core_device =3D dev_get_drvdata(&pdev->dev); + + return container_of(core_device, struct hisi_acc_vf_core_device, + core_device); +} + static void vf_qm_fun_reset(struct hisi_acc_vf_core_device *hisi_acc_vdev, struct hisi_qm *qm) { @@ -962,7 +970,7 @@ hisi_acc_vfio_pci_get_device_state(struct vfio_device *= vdev, =20 static void hisi_acc_vf_pci_aer_reset_done(struct pci_dev *pdev) { - struct hisi_acc_vf_core_device *hisi_acc_vdev =3D dev_get_drvdata(&pdev->= dev); + struct hisi_acc_vf_core_device *hisi_acc_vdev =3D hssi_acc_drvdata(pdev); =20 if (hisi_acc_vdev->core_device.vdev.migration_flags !=3D VFIO_MIGRATION_STOP_COPY) @@ -1274,11 +1282,10 @@ static int hisi_acc_vfio_pci_probe(struct pci_dev *= pdev, const struct pci_device &hisi_acc_vfio_pci_ops); } =20 + dev_set_drvdata(&pdev->dev, &hisi_acc_vdev->core_device); ret =3D vfio_pci_core_register_device(&hisi_acc_vdev->core_device); if (ret) goto out_free; - - dev_set_drvdata(&pdev->dev, hisi_acc_vdev); return 0; =20 out_free: @@ -1289,7 +1296,7 @@ static int hisi_acc_vfio_pci_probe(struct pci_dev *pd= ev, const struct pci_device =20 static void hisi_acc_vfio_pci_remove(struct pci_dev *pdev) { - struct hisi_acc_vf_core_device *hisi_acc_vdev =3D dev_get_drvdata(&pdev->= dev); + struct hisi_acc_vf_core_device *hisi_acc_vdev =3D hssi_acc_drvdata(pdev); =20 vfio_pci_core_unregister_device(&hisi_acc_vdev->core_device); vfio_pci_core_uninit_device(&hisi_acc_vdev->core_device); diff --git a/drivers/vfio/pci/mlx5/main.c b/drivers/vfio/pci/mlx5/main.c index bbec5d288fee..9f59f5807b8a 100644 --- a/drivers/vfio/pci/mlx5/main.c +++ b/drivers/vfio/pci/mlx5/main.c @@ -39,6 +39,14 @@ struct mlx5vf_pci_core_device { struct mlx5_vf_migration_file *saving_migf; }; =20 +static struct mlx5vf_pci_core_device *mlx5vf_drvdata(struct pci_dev *pdev) +{ + struct vfio_pci_core_device *core_device =3D dev_get_drvdata(&pdev->dev); + + return container_of(core_device, struct mlx5vf_pci_core_device, + core_device); +} + static struct page * mlx5vf_get_migration_page(struct mlx5_vf_migration_file *migf, unsigned long offset) @@ -505,7 +513,7 @@ static int mlx5vf_pci_get_device_state(struct vfio_devi= ce *vdev, =20 static void mlx5vf_pci_aer_reset_done(struct pci_dev *pdev) { - struct mlx5vf_pci_core_device *mvdev =3D dev_get_drvdata(&pdev->dev); + struct mlx5vf_pci_core_device *mvdev =3D mlx5vf_drvdata(pdev); =20 if (!mvdev->migrate_cap) return; @@ -614,11 +622,10 @@ static int mlx5vf_pci_probe(struct pci_dev *pdev, } } =20 + dev_set_drvdata(&pdev->dev, &mvdev->core_device); ret =3D vfio_pci_core_register_device(&mvdev->core_device); if (ret) goto out_free; - - dev_set_drvdata(&pdev->dev, mvdev); return 0; =20 out_free: @@ -629,7 +636,7 @@ static int mlx5vf_pci_probe(struct pci_dev *pdev, =20 static void mlx5vf_pci_remove(struct pci_dev *pdev) { - struct mlx5vf_pci_core_device *mvdev =3D dev_get_drvdata(&pdev->dev); + struct mlx5vf_pci_core_device *mvdev =3D mlx5vf_drvdata(pdev); =20 vfio_pci_core_unregister_device(&mvdev->core_device); vfio_pci_core_uninit_device(&mvdev->core_device); diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 2b047469e02f..8c990a1a7def 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -151,10 +151,10 @@ static int vfio_pci_probe(struct pci_dev *pdev, const= struct pci_device_id *id) return -ENOMEM; vfio_pci_core_init_device(vdev, pdev, &vfio_pci_ops); =20 + dev_set_drvdata(&pdev->dev, vdev); ret =3D vfio_pci_core_register_device(vdev); if (ret) goto out_free; - dev_set_drvdata(&pdev->dev, vdev); return 0; =20 out_free: diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_c= ore.c index 06b6f3594a13..65587fd5c021 100644 --- a/drivers/vfio/pci/vfio_pci_core.c +++ b/drivers/vfio/pci/vfio_pci_core.c @@ -1821,6 +1821,10 @@ int vfio_pci_core_register_device(struct vfio_pci_co= re_device *vdev) struct pci_dev *pdev =3D vdev->pdev; int ret; =20 + /* Drivers must set the vfio_pci_core_device to their drvdata */ + if (WARN_ON(vdev !=3D dev_get_drvdata(&vdev->pdev->dev))) + return -EINVAL; + if (pdev->hdr_type !=3D PCI_HEADER_TYPE_NORMAL) return -EINVAL; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7169DC2BB41 for ; Mon, 15 Aug 2022 22:38:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350315AbiHOWgT (ORCPT ); Mon, 15 Aug 2022 18:36:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351129AbiHOW1j (ORCPT ); Mon, 15 Aug 2022 18:27:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C90ED6E2D1; Mon, 15 Aug 2022 12:47:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DB79061233; Mon, 15 Aug 2022 19:47:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFC73C433C1; Mon, 15 Aug 2022 19:47:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592845; bh=TxIdxAULtQl4TEOplGI6YrvA/gSOQygjmNf5HVhevT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z8DPly8/UaNRpbW4/P6EkPDGT06uSfcoC5c1U/IXid4O0ZDMKfad12gCKYat7hnz3 SBqkVMDDkP5yWAF4os3FsPwp/z7pkU0vcxBgU6YPz9z/Az5I1tmz/hCW2xge62VYq4 pK9kDRP6ByHccKPypweo9fne2NJ7CkDDXXy/tsIA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Alexander Lobakin , Yury Norov , Sasha Levin Subject: [PATCH 5.18 0853/1095] net/ice: fix initializing the bitmap in the switch code Date: Mon, 15 Aug 2022 20:04:12 +0200 Message-Id: <20220815180504.612499136@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Lobakin [ Upstream commit 2f7ee2a72ccec8b85a05c4644d7ec9f40c1c50c8 ] Kbuild spotted the following bug during the testing of one of the optimizations: In file included from include/linux/cpumask.h:12, [...] from drivers/net/ethernet/intel/ice/ice_switch.c:4: drivers/net/ethernet/intel/ice/ice_switch.c: In function 'ice_find_free_rec= p_res_idx.constprop': include/linux/bitmap.h:447:22: warning: 'possible_idx[0]' is used uninitial= ized [-Wuninitialized] 447 | *map |=3D GENMASK(start + nbits - 1, start); | ^~ In file included from drivers/net/ethernet/intel/ice/ice.h:7, from drivers/net/ethernet/intel/ice/ice_lib.h:7, from drivers/net/ethernet/intel/ice/ice_switch.c:4: drivers/net/ethernet/intel/ice/ice_switch.c:4929:24: note: 'possible_idx[0]= ' was declared here 4929 | DECLARE_BITMAP(possible_idx, ICE_MAX_FV_WORDS); | ^~~~~~~~~~~~ include/linux/types.h:11:23: note: in definition of macro 'DECLARE_BITMAP' 11 | unsigned long name[BITS_TO_LONGS(bits)] | ^~~~ %ICE_MAX_FV_WORDS is 48, so bitmap_set() here was initializing only 48 bits, leaving a junk in the rest 16. It was previously hidden due to that filling 48 bits makes bitmap_set() call external __bitmap_set(), but after making it use plain bit arithmetics on small bitmaps, compilers started seeing the issue. It was still working because those 16 weren't used anywhere anyhow. bitmap_{clear,set}() are not really intended to initialize bitmaps, rather to modify already initialized ones, as they don't do anything past the passed number of bits. The correct function to do this in that particular case is bitmap_fill(), so use it here. It will do `*possible_idx =3D ~0UL` instead of `*possible_idx |=3D GENMASK(47, 0)`, not leaving anything in an undefined state. Fixes: fd2a6b71e300 ("ice: create advanced switch recipe") Reported-by: kernel test robot Signed-off-by: Alexander Lobakin Signed-off-by: Yury Norov Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/intel/ice/ice_switch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethe= rnet/intel/ice/ice_switch.c index 25b8f6f726eb..73960c8f9dba 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -4874,7 +4874,7 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const u= nsigned long *profiles, bitmap_zero(recipes, ICE_MAX_NUM_RECIPES); bitmap_zero(used_idx, ICE_MAX_FV_WORDS); =20 - bitmap_set(possible_idx, 0, ICE_MAX_FV_WORDS); + bitmap_fill(possible_idx, ICE_MAX_FV_WORDS); =20 /* For each profile we are going to associate the recipe with, add the * recipes that are associated with that profile. This will give us --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 184CCC3F6B0 for ; Mon, 15 Aug 2022 22:38:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350167AbiHOWfv (ORCPT ); Mon, 15 Aug 2022 18:35:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351199AbiHOW1v (ORCPT ); Mon, 15 Aug 2022 18:27:51 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A3CB6E8BB; Mon, 15 Aug 2022 12:47:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 5220CCE1262; Mon, 15 Aug 2022 19:47:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F4E1C433C1; Mon, 15 Aug 2022 19:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592851; bh=3L4T/m9YgJO7JlfsOZH6grUtry7M7JcMnJO4As2Penk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IY8EwQuGodfZot181YLg7VD2DtjckAm7UzH+UAHB5eLI3lJ2f/Taw5AeigowJR38B 6+Nv3rqZuMhuqFsS9OaxulNpHtxKtccu6PUZbzZkywlYU/KVLNDPiQIgim5tfik1aU +YXP7b6n+35Oj8aaeECdTVfkWk7QBaOP+zlwNRME= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.18 0854/1095] tty: n_gsm: fix user open not possible at responder until initiator open Date: Mon, 15 Aug 2022 20:04:13 +0200 Message-Id: <20220815180504.657385062@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Starke [ Upstream commit ac77f0077c3265197d378158c85a55eee6d21508 ] After setting up the control channel on both sides the responder side may want to open a virtual tty to listen on until the initiator starts an application on a user channel. The current implementation allows the open() but no other operation, like termios. These fail with EINVAL. The responder sided application has no means to detect an open by the initiator sided application this way. And the initiator sided applications usually expect the responder sided application to listen on the user channel upon open. Set the user channel into half-open state on responder side once a user application opens the virtual tty to allow IO operations on it. Furthermore, keep the user channel constipated until the initiator side opens it to give the responder sided application the chance to detect the new connection and to avoid data loss if the responder sided application starts sending before the user channel is open. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701061652.39604-1-daniel.starke@siemen= s.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 9f2a8c0e1e33..e15b3b107b5e 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1510,6 +1510,8 @@ static void gsm_dlci_close(struct gsm_dlci *dlci) if (debug & 8) pr_debug("DLCI %d goes closed.\n", dlci->addr); dlci->state =3D DLCI_CLOSED; + /* Prevent us from sending data before the link is up again */ + dlci->constipated =3D true; if (dlci->addr !=3D 0) { tty_port_tty_hangup(&dlci->port, false); spin_lock_irqsave(&dlci->lock, flags); @@ -1539,6 +1541,7 @@ static void gsm_dlci_open(struct gsm_dlci *dlci) del_timer(&dlci->t1); /* This will let a tty open continue */ dlci->state =3D DLCI_OPEN; + dlci->constipated =3D false; if (debug & 8) pr_debug("DLCI %d goes open.\n", dlci->addr); /* Send current modem state */ @@ -1619,6 +1622,25 @@ static void gsm_dlci_begin_open(struct gsm_dlci *dlc= i) mod_timer(&dlci->t1, jiffies + gsm->t1 * HZ / 100); } =20 +/** + * gsm_dlci_set_opening - change state to opening + * @dlci: DLCI to open + * + * Change internal state to wait for DLCI open from initiator side. + * We set off timers and responses upon reception of an SABM. + */ +static void gsm_dlci_set_opening(struct gsm_dlci *dlci) +{ + switch (dlci->state) { + case DLCI_CLOSED: + case DLCI_CLOSING: + dlci->state =3D DLCI_OPENING; + break; + default: + break; + } +} + /** * gsm_dlci_begin_close - start channel open procedure * @dlci: DLCI to open @@ -1762,10 +1784,13 @@ static struct gsm_dlci *gsm_dlci_alloc(struct gsm_m= ux *gsm, int addr) dlci->addr =3D addr; dlci->adaption =3D gsm->adaption; dlci->state =3D DLCI_CLOSED; - if (addr) + if (addr) { dlci->data =3D gsm_dlci_data; - else + /* Prevent us from sending data before the link is up */ + dlci->constipated =3D true; + } else { dlci->data =3D gsm_dlci_command; + } gsm->dlci[addr] =3D dlci; return dlci; } @@ -3178,6 +3203,8 @@ static int gsmtty_open(struct tty_struct *tty, struct= file *filp) /* Start sending off SABM messages */ if (gsm->initiator) gsm_dlci_begin_open(dlci); + else + gsm_dlci_set_opening(dlci); /* And wait for virtual carrier */ return tty_port_block_til_ready(port, tty, filp); } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61CA5C25B0E for ; Mon, 15 Aug 2022 22:38:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350268AbiHOWgI (ORCPT ); Mon, 15 Aug 2022 18:36:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351217AbiHOW1x (ORCPT ); Mon, 15 Aug 2022 18:27:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C2956EF2B; Mon, 15 Aug 2022 12:47:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 18CD2B80EB2; Mon, 15 Aug 2022 19:47:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64E90C433C1; Mon, 15 Aug 2022 19:47:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592857; bh=CCLSED5/tp56WMWq4oqMqYuLEMQWH1GAfsi6KdxpNd8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l+PoGxOeGD9/bhqhdNbMTt79U5wcBp7aCk59Z4himTyX2oEbbK8AcYpaPmA/7REw7 AkIrl6lXxN5LGuXJ+CtljBl8A9jE2tt1kWjRAIpIZwMocdk503jze28X/UDbHw3LIo 3K9AJwvV58V0CsGFqvngnrXTvWdYly1XvzQsFMM4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.18 0855/1095] tty: n_gsm: fix tty registration before control channel open Date: Mon, 15 Aug 2022 20:04:14 +0200 Message-Id: <20220815180504.693448772@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Starke [ Upstream commit 01aecd917114577c423f07cec0d186ad007d76fc ] The current implementation registers/deregisters the user ttys at mux attach/detach. That means that the user devices are available before any control channel is open. However, user channel initialization requires an open control channel. Furthermore, the user is not informed if the mux restarts due to configuration changes. Put the registration/deregistration procedure into separate function to improve readability. Move registration to mux activation and deregistration to mux cleanup to keep the user devices only open as long as a control channel exists. The user will be informed via the device driver if the mux was reconfigured in a way that required a mux re-activation. This makes it necessary to add T2 initialization to gsmld_open() for the ldisc open code path (not the reconfiguration code path) to avoid deletion of an uninitialized T2 at mux cleanup. Fixes: d50f6dcaf22a ("tty: n_gsm: expose gsmtty device nodes at ldisc open = time") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701061652.39604-2-daniel.starke@siemen= s.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 117 ++++++++++++++++++++++++++++++-------------- 1 file changed, 79 insertions(+), 38 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index e15b3b107b5e..e80713a9d204 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -235,6 +235,7 @@ struct gsm_mux { struct gsm_dlci *dlci[NUM_DLCI]; int old_c_iflag; /* termios c_iflag value before attach */ bool constipated; /* Asked by remote to shut up */ + bool has_devices; /* Devices were registered */ =20 spinlock_t tx_lock; unsigned int tx_bytes; /* TX data outstanding */ @@ -463,6 +464,68 @@ static void gsm_hex_dump_bytes(const char *fname, cons= t u8 *data, kfree(prefix); } =20 +/** + * gsm_register_devices - register all tty devices for a given mux index + * + * @driver: the tty driver that describes the tty devices + * @index: the mux number is used to calculate the minor numbers of the + * ttys for this mux and may differ from the position in the + * mux array. + */ +static int gsm_register_devices(struct tty_driver *driver, unsigned int in= dex) +{ + struct device *dev; + int i; + unsigned int base; + + if (!driver || index >=3D MAX_MUX) + return -EINVAL; + + base =3D index * NUM_DLCI; /* first minor for this index */ + for (i =3D 1; i < NUM_DLCI; i++) { + /* Don't register device 0 - this is the control channel + * and not a usable tty interface + */ + dev =3D tty_register_device(gsm_tty_driver, base + i, NULL); + if (IS_ERR(dev)) { + if (debug & 8) + pr_info("%s failed to register device minor %u", + __func__, base + i); + for (i--; i >=3D 1; i--) + tty_unregister_device(gsm_tty_driver, base + i); + return PTR_ERR(dev); + } + } + + return 0; +} + +/** + * gsm_unregister_devices - unregister all tty devices for a given mux ind= ex + * + * @driver: the tty driver that describes the tty devices + * @index: the mux number is used to calculate the minor numbers of the + * ttys for this mux and may differ from the position in the + * mux array. + */ +static void gsm_unregister_devices(struct tty_driver *driver, + unsigned int index) +{ + int i; + unsigned int base; + + if (!driver || index >=3D MAX_MUX) + return; + + base =3D index * NUM_DLCI; /* first minor for this index */ + for (i =3D 1; i < NUM_DLCI; i++) { + /* Don't unregister device 0 - this is the control + * channel and not a usable tty interface + */ + tty_unregister_device(gsm_tty_driver, base + i); + } +} + /** * gsm_print_packet - display a frame for debug * @hdr: header to print before decode @@ -2208,6 +2271,10 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm, boo= l disc) del_timer_sync(&gsm->t2_timer); =20 /* Free up any link layer users and finally the control channel */ + if (gsm->has_devices) { + gsm_unregister_devices(gsm_tty_driver, gsm->num); + gsm->has_devices =3D false; + } for (i =3D NUM_DLCI - 1; i >=3D 0; i--) if (gsm->dlci[i]) gsm_dlci_release(gsm->dlci[i]); @@ -2231,6 +2298,7 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm, bool= disc) static int gsm_activate_mux(struct gsm_mux *gsm) { struct gsm_dlci *dlci; + int ret; =20 timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); init_waitqueue_head(&gsm->event); @@ -2242,9 +2310,14 @@ static int gsm_activate_mux(struct gsm_mux *gsm) else gsm->receive =3D gsm1_receive; =20 + ret =3D gsm_register_devices(gsm_tty_driver, gsm->num); + if (ret) + return ret; + dlci =3D gsm_dlci_alloc(gsm, 0); if (dlci =3D=3D NULL) return -ENOMEM; + gsm->has_devices =3D true; gsm->dead =3D false; /* Tty opens are now permissible */ return 0; } @@ -2504,39 +2577,14 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *da= ta, int len) * will need moving to an ioctl path. */ =20 -static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) +static void gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) { - unsigned int base; - int ret, i; - gsm->tty =3D tty_kref_get(tty); /* Turn off tty XON/XOFF handling to handle it explicitly. */ gsm->old_c_iflag =3D tty->termios.c_iflag; tty->termios.c_iflag &=3D (IXON | IXOFF); - ret =3D gsm_activate_mux(gsm); - if (ret !=3D 0) - tty_kref_put(gsm->tty); - else { - /* Don't register device 0 - this is the control channel and not - a usable tty interface */ - base =3D mux_num_to_base(gsm); /* Base for this MUX */ - for (i =3D 1; i < NUM_DLCI; i++) { - struct device *dev; - - dev =3D tty_register_device(gsm_tty_driver, - base + i, NULL); - if (IS_ERR(dev)) { - for (i--; i >=3D 1; i--) - tty_unregister_device(gsm_tty_driver, - base + i); - return PTR_ERR(dev); - } - } - } - return ret; } =20 - /** * gsmld_detach_gsm - stop doing 0710 mux * @tty: tty attached to the mux @@ -2547,12 +2595,7 @@ static int gsmld_attach_gsm(struct tty_struct *tty, = struct gsm_mux *gsm) =20 static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) { - unsigned int base =3D mux_num_to_base(gsm); /* Base for this MUX */ - int i; - WARN_ON(tty !=3D gsm->tty); - for (i =3D 1; i < NUM_DLCI; i++) - tty_unregister_device(gsm_tty_driver, base + i); /* Restore tty XON/XOFF handling. */ gsm->tty->termios.c_iflag =3D gsm->old_c_iflag; tty_kref_put(gsm->tty); @@ -2644,7 +2687,6 @@ static void gsmld_close(struct tty_struct *tty) static int gsmld_open(struct tty_struct *tty) { struct gsm_mux *gsm; - int ret; =20 if (tty->ops->write =3D=3D NULL) return -EINVAL; @@ -2660,12 +2702,11 @@ static int gsmld_open(struct tty_struct *tty) /* Attach the initial passive connection */ gsm->encoding =3D 1; =20 - ret =3D gsmld_attach_gsm(tty, gsm); - if (ret !=3D 0) { - gsm_cleanup_mux(gsm, false); - mux_put(gsm); - } - return ret; + gsmld_attach_gsm(tty, gsm); + + timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); + + return 0; } =20 /** --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C4D6C32762 for ; Mon, 15 Aug 2022 22:38:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350684AbiHOWgw (ORCPT ); Mon, 15 Aug 2022 18:36:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351255AbiHOW2A (ORCPT ); Mon, 15 Aug 2022 18:28:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D33866F563; Mon, 15 Aug 2022 12:47:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 89038B80EAD; Mon, 15 Aug 2022 19:47:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9E71C433C1; Mon, 15 Aug 2022 19:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592867; bh=Rtw4ue+iKL+T8cp7diolRRRhtkzE1UQULkLc8KNMEY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ETeuLoTbzY7bM/aopX3x3dBLjpMr7EJ3BIA/rNvzTrF05OHBLBvE9kYA3c2j/v6oj J7+kmu4r2lfZpB9eabus78bvGvs0BAcmSCTHrdsGi6Ijna8/0FkxVb6yTOnSxLTsCN P0XIlaz3XzToX7MiDUIYOMDtFHtHVNzaiLCNd1pI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.18 0856/1095] tty: n_gsm: fix wrong queuing behavior in gsm_dlci_data_output() Date: Mon, 15 Aug 2022 20:04:15 +0200 Message-Id: <20220815180504.732286635@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Starke [ Upstream commit 556fc8ac06513cced381588d6d58c184d95cc4fe ] 1) The function drains the fifo for the given user tty/DLCI without considering 'TX_THRESH_HI' and different to gsm_dlci_data_output_framed(), which moves only one packet from the user side to the internal transmission queue. We can only handle one packet at a time here if we want to allow DLCI priority handling in gsm_dlci_data_sweep() to avoid link starvation. 2) Furthermore, the additional header octet from convergence layer type 2 is not counted against MTU. It is part of the UI/UIH frame message which needs to be limited to MTU. Hence, it is wrong not to consider this octet. 3) Finally, the waiting user tty is not informed about freed space in its send queue. Take at most one packet worth of data out of the DLCI fifo to fix 1). Limit the max user data size per packet to MTU - 1 in case of convergence layer type 2 to leave space for the control signal octet which is added in the later part of the function. This fixes 2). Add tty_port_tty_wakeup() to wake up the user tty if new write space has been made available to fix 3). Fixes: 268e526b935e ("tty/n_gsm: avoid fifo overflow in gsm_dlci_data_outpu= t") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701061652.39604-3-daniel.starke@siemen= s.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 74 +++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index e80713a9d204..658d8f6e3a7d 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -886,41 +886,51 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, = struct gsm_dlci *dlci) { struct gsm_msg *msg; u8 *dp; - int len, total_size, size; - int h =3D dlci->adaption - 1; + int h, len, size; =20 - total_size =3D 0; - while (1) { - len =3D kfifo_len(&dlci->fifo); - if (len =3D=3D 0) - return total_size; - - /* MTU/MRU count only the data bits */ - if (len > gsm->mtu) - len =3D gsm->mtu; - - size =3D len + h; - - msg =3D gsm_data_alloc(gsm, dlci->addr, size, gsm->ftype); - /* FIXME: need a timer or something to kick this so it can't - get stuck with no work outstanding and no buffer free */ - if (msg =3D=3D NULL) - return -ENOMEM; - dp =3D msg->data; - switch (dlci->adaption) { - case 1: /* Unstructured */ - break; - case 2: /* Unstructed with modem bits. - Always one byte as we never send inline break data */ - *dp++ =3D (gsm_encode_modem(dlci) << 1) | EA; - break; - } - WARN_ON(kfifo_out_locked(&dlci->fifo, dp , len, &dlci->lock) !=3D len); - __gsm_data_queue(dlci, msg); - total_size +=3D size; + /* for modem bits without break data */ + h =3D ((dlci->adaption =3D=3D 1) ? 0 : 1); + + len =3D kfifo_len(&dlci->fifo); + if (len =3D=3D 0) + return 0; + + /* MTU/MRU count only the data bits but watch adaption mode */ + if ((len + h) > gsm->mtu) + len =3D gsm->mtu - h; + + size =3D len + h; + + msg =3D gsm_data_alloc(gsm, dlci->addr, size, gsm->ftype); + /* FIXME: need a timer or something to kick this so it can't + * get stuck with no work outstanding and no buffer free + */ + if (!msg) + return -ENOMEM; + dp =3D msg->data; + switch (dlci->adaption) { + case 1: /* Unstructured */ + break; + case 2: /* Unstructured with modem bits. + * Always one byte as we never send inline break data + */ + *dp++ =3D (gsm_encode_modem(dlci) << 1) | EA; + break; + default: + pr_err("%s: unsupported adaption %d\n", __func__, + dlci->adaption); + break; } + + WARN_ON(len !=3D kfifo_out_locked(&dlci->fifo, dp, len, + &dlci->lock)); + + /* Notify upper layer about available send space. */ + tty_port_tty_wakeup(&dlci->port); + + __gsm_data_queue(dlci, msg); /* Bytes of data we used up */ - return total_size; + return size; } =20 /** --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BC2EC32764 for ; Mon, 15 Aug 2022 22:38:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350727AbiHOWg5 (ORCPT ); Mon, 15 Aug 2022 18:36:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351273AbiHOW2C (ORCPT ); Mon, 15 Aug 2022 18:28:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BA1CB9FBA; Mon, 15 Aug 2022 12:47:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D80E8B80EB2; Mon, 15 Aug 2022 19:47:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 130C6C433B5; Mon, 15 Aug 2022 19:47:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592873; bh=HODngVqFqWVv1zT3/gAnCu2m52+s9L1/16HIVERNsVI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YBCaUcOtGyKqyKExOqenx9UrMnwGRl8tRYoegDxf/7DszpIXGb01voT9stRMfHTbC W5mZuOyN1nUBijUyim2e0G1rsIGNsbp1aBmHdCPsv4txssGXdnrkQqZ1pUXNXSWpy5 os6J0zbgymQ6wr+E/Yx6NSR38NIM27NT0479UZ9c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.18 0857/1095] tty: n_gsm: fix missing timer to handle stalled links Date: Mon, 15 Aug 2022 20:04:16 +0200 Message-Id: <20220815180504.780373790@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Starke [ Upstream commit c568f7086c6e771c77aad13d727c70ef70e07243 ] The current implementation does not handle the situation that no data is in the internal queue and needs to be sent out while the user tty fifo is full. Add a timer that moves more data from user tty down to the internal queue which is then serialized on the ldisc. This timer is triggered if no data was moved from a user tty to the internal queue within 10 * T1. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701061652.39604-4-daniel.starke@siemen= s.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 658d8f6e3a7d..27e72c623afb 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -244,6 +244,7 @@ struct gsm_mux { struct list_head tx_list; /* Pending data packets */ =20 /* Control messages */ + struct timer_list kick_timer; /* Kick TX queuing on timeout */ struct timer_list t2_timer; /* Retransmit timer for commands */ int cretries; /* Command retry counter */ struct gsm_control *pending_cmd;/* Our current pending command */ @@ -850,6 +851,7 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, str= uct gsm_msg *msg) list_add_tail(&msg->list, &gsm->tx_list); gsm->tx_bytes +=3D msg->len; gsm_data_kick(gsm, dlci); + mod_timer(&gsm->kick_timer, jiffies + 10 * gsm->t1 * HZ / 100); } =20 /** @@ -902,9 +904,6 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, st= ruct gsm_dlci *dlci) size =3D len + h; =20 msg =3D gsm_data_alloc(gsm, dlci->addr, size, gsm->ftype); - /* FIXME: need a timer or something to kick this so it can't - * get stuck with no work outstanding and no buffer free - */ if (!msg) return -ENOMEM; dp =3D msg->data; @@ -981,9 +980,6 @@ static int gsm_dlci_data_output_framed(struct gsm_mux *= gsm, =20 size =3D len + overhead; msg =3D gsm_data_alloc(gsm, dlci->addr, size, gsm->ftype); - - /* FIXME: need a timer or something to kick this so it can't - get stuck with no work outstanding and no buffer free */ if (msg =3D=3D NULL) { skb_queue_tail(&dlci->skb_list, dlci->skb); dlci->skb =3D NULL; @@ -1079,9 +1075,9 @@ static int gsm_dlci_modem_output(struct gsm_mux *gsm,= struct gsm_dlci *dlci, * renegotiate DLCI priorities with optional stuff. Needs optimising. */ =20 -static void gsm_dlci_data_sweep(struct gsm_mux *gsm) +static int gsm_dlci_data_sweep(struct gsm_mux *gsm) { - int len; + int len, ret =3D 0; /* Priority ordering: We should do priority with RR of the groups */ int i =3D 1; =20 @@ -1104,7 +1100,11 @@ static void gsm_dlci_data_sweep(struct gsm_mux *gsm) /* DLCI empty - try the next */ if (len =3D=3D 0) i++; + else + ret++; } + + return ret; } =20 /** @@ -1823,6 +1823,30 @@ static void gsm_dlci_command(struct gsm_dlci *dlci, = const u8 *data, int len) } } =20 +/** + * gsm_kick_timer - transmit if possible + * @t: timer contained in our gsm object + * + * Transmit data from DLCIs if the queue is empty. We can't rely on + * a tty wakeup except when we filled the pipe so we need to fire off + * new data ourselves in other cases. + */ +static void gsm_kick_timer(struct timer_list *t) +{ + struct gsm_mux *gsm =3D from_timer(gsm, t, kick_timer); + unsigned long flags; + int sent =3D 0; + + spin_lock_irqsave(&gsm->tx_lock, flags); + /* If we have nothing running then we need to fire up */ + if (gsm->tx_bytes < TX_THRESH_LO) + sent =3D gsm_dlci_data_sweep(gsm); + spin_unlock_irqrestore(&gsm->tx_lock, flags); + + if (sent && debug & 4) + pr_info("%s TX queue stalled\n", __func__); +} + /* * Allocate/Free DLCI channels */ @@ -2278,6 +2302,7 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm, bool= disc) } =20 /* Finish outstanding timers, making sure they are done */ + del_timer_sync(&gsm->kick_timer); del_timer_sync(&gsm->t2_timer); =20 /* Free up any link layer users and finally the control channel */ @@ -2310,6 +2335,7 @@ static int gsm_activate_mux(struct gsm_mux *gsm) struct gsm_dlci *dlci; int ret; =20 + timer_setup(&gsm->kick_timer, gsm_kick_timer, 0); timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); init_waitqueue_head(&gsm->event); spin_lock_init(&gsm->control_lock); @@ -2714,6 +2740,7 @@ static int gsmld_open(struct tty_struct *tty) =20 gsmld_attach_gsm(tty, gsm); =20 + timer_setup(&gsm->kick_timer, gsm_kick_timer, 0); timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); =20 return 0; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F3C9C32763 for ; Mon, 15 Aug 2022 22:38:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350848AbiHOWhO (ORCPT ); Mon, 15 Aug 2022 18:37:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351321AbiHOW2O (ORCPT ); Mon, 15 Aug 2022 18:28:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C6E7B6D64; Mon, 15 Aug 2022 12:48:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7AC986125C; Mon, 15 Aug 2022 19:48:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68066C433B5; Mon, 15 Aug 2022 19:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592879; bh=u9w3Qr4OKY9rz6FOfphAfzGgRG2hlEXEoWiTUPz5Dgo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WsAWU59+cKO4MZDicAcn6VfquaYJ7bZFOhx/Hdq8eb7yKz5P85HQTG7BtLMm49y7M bwcLpddYVfbDHSSeitzPEP4pLHokJYeDuVWUKo57LuXBY2idqHsyA0laoDypWUuyOS 7arSJg1AVbI1s07t07tvndpMCN+Yq9ivX8CV6o7k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.18 0858/1095] tty: n_gsm: fix non flow control frames during mux flow off Date: Mon, 15 Aug 2022 20:04:17 +0200 Message-Id: <20220815180504.829685375@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Starke [ Upstream commit bec0224816d19abe4fe503586d16d51890540615 ] n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010. See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDeta= ils.aspx?specificationId=3D1516 The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to the newer 27.010 here. Chapter 5.4.6.3.6 states that FCoff stops the transmission on all channels except the control channel. This is already implemented in gsm_data_kick(). However, chapter 5.4.8.1 explains that this shall result in the same behavior as software flow control on the ldisc in advanced option mode. That means only flow control frames shall be sent during flow off. The current implementation does not consider this case. Change gsm_data_kick() to send only flow control frames if constipated to abide the standard. gsm_read_ea_val() and gsm_is_flow_ctrl_msg() are introduced as helper functions for this. It is planned to use gsm_read_ea_val() in later code cleanups for other functions, too. Fixes: c01af4fec2c8 ("n_gsm : Flow control handling in Mux driver") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701061652.39604-5-daniel.starke@siemen= s.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 54 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 27e72c623afb..83ec596bba93 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -421,6 +421,27 @@ static int gsm_read_ea(unsigned int *val, u8 c) return c & EA; } =20 +/** + * gsm_read_ea_val - read a value until EA + * @val: variable holding value + * @data: buffer of data + * @dlen: length of data + * + * Processes an EA value. Updates the passed variable and + * returns the processed data length. + */ +static unsigned int gsm_read_ea_val(unsigned int *val, const u8 *data, int= dlen) +{ + unsigned int len =3D 0; + + for (; dlen > 0; dlen--) { + len++; + if (gsm_read_ea(val, *data++)) + break; + } + return len; +} + /** * gsm_encode_modem - encode modem data bits * @dlci: DLCI to encode from @@ -746,6 +767,37 @@ static struct gsm_msg *gsm_data_alloc(struct gsm_mux *= gsm, u8 addr, int len, return m; } =20 +/** + * gsm_is_flow_ctrl_msg - checks if flow control message + * @msg: message to check + * + * Returns true if the given message is a flow control command of the + * control channel. False is returned in any other case. + */ +static bool gsm_is_flow_ctrl_msg(struct gsm_msg *msg) +{ + unsigned int cmd; + + if (msg->addr > 0) + return false; + + switch (msg->ctrl & ~PF) { + case UI: + case UIH: + cmd =3D 0; + if (gsm_read_ea_val(&cmd, msg->data + 2, msg->len - 2) < 1) + break; + switch (cmd & ~PF) { + case CMD_FCOFF: + case CMD_FCON: + return true; + } + break; + } + + return false; +} + /** * gsm_data_kick - poke the queue * @gsm: GSM Mux @@ -765,7 +817,7 @@ static void gsm_data_kick(struct gsm_mux *gsm, struct g= sm_dlci *dlci) int len; =20 list_for_each_entry_safe(msg, nmsg, &gsm->tx_list, list) { - if (gsm->constipated && msg->addr) + if (gsm->constipated && !gsm_is_flow_ctrl_msg(msg)) continue; if (gsm->encoding !=3D 0) { gsm->txframe[0] =3D GSM1_SOF; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09454C00140 for ; Mon, 15 Aug 2022 22:39:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350471AbiHOWjd (ORCPT ); Mon, 15 Aug 2022 18:39:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349370AbiHOWcz (ORCPT ); Mon, 15 Aug 2022 18:32:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A53F71726; Mon, 15 Aug 2022 12:49:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B90C260FB5; Mon, 15 Aug 2022 19:48:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACE3FC433C1; Mon, 15 Aug 2022 19:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592930; bh=qugEq5AH7Mw1dkYBi+7kXa7GsbL/C2gowS+hGLws7/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mddXANWpv1PnJRCSTAdQtF8lms2EiM6RnY3w2EOfhX/kE9fYJNvh6MgVRy3Yyv5/I RvMZcxM7gSxrnuP1veOXAs3KkB0rn6kUDpvx99SdAdhyG0fAg0JMaCkOHbuoncdZuK 8Qrm0hjVtBoPvZQP8hhCMMmSPunZQi78q77VM/58= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.18 0859/1095] tty: n_gsm: fix packet re-transmission without open control channel Date: Mon, 15 Aug 2022 20:04:18 +0200 Message-Id: <20220815180504.871703687@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Starke [ Upstream commit 4fae831b3a71fc5a44cc5c7d0b8c1267ee7659f5 ] In the current implementation control packets are re-transmitted even if the control channel closed down during T2. This is wrong. Check whether the control channel is open before re-transmitting any packets. Note that control channel open/close is handled by T1 and not T2 and remains unaffected by this. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701061652.39604-7-daniel.starke@siemen= s.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 83ec596bba93..e95004217292 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1532,7 +1532,7 @@ static void gsm_control_retransmit(struct timer_list = *t) spin_lock_irqsave(&gsm->control_lock, flags); ctrl =3D gsm->pending_cmd; if (ctrl) { - if (gsm->cretries =3D=3D 0) { + if (gsm->cretries =3D=3D 0 || !gsm->dlci[0] || gsm->dlci[0]->dead) { gsm->pending_cmd =3D NULL; ctrl->error =3D -ETIMEDOUT; ctrl->done =3D 1; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A391C2BB9D for ; Mon, 15 Aug 2022 22:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351310AbiHOWlx (ORCPT ); Mon, 15 Aug 2022 18:41:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350830AbiHOWhM (ORCPT ); Mon, 15 Aug 2022 18:37:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E877A193D1; Mon, 15 Aug 2022 12:50:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CE4C3B81150; Mon, 15 Aug 2022 19:50:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DE35C433C1; Mon, 15 Aug 2022 19:49:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593000; bh=GAem095nFytx1SxT0FqDPzb4tbJ/6JEBo/T1YvkRwYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YfeRKkid/VIYsjh+S56NEHbb3Uh8IM68QCW2TAWrzV9neQCx7AYEzxkzK0P26qGgw kS4AzoLTY040zHLtidIp+nIoHNUOYK9mAX5Flw8kc73+YfM8JmH+YBeHFp7PIOFB7V PGXjnnNYIUi8iLwU/5m+aieJt7XIOCi/q91HywfA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.18 0860/1095] tty: n_gsm: fix race condition in gsmld_write() Date: Mon, 15 Aug 2022 20:04:19 +0200 Message-Id: <20220815180504.915112317@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Starke [ Upstream commit 32dd59f96924f45e33bc79854f7a00679c0fa28e ] The function may be used by the user directly and also by the n_gsm internal functions. They can lead into a race condition which results in interleaved frames if both are writing at the same time. The receiving side is not able to decode those interleaved frames correctly. Add a lock around the low side tty write to avoid race conditions and frame interleaving between user originated writes and n_gsm writes. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701061652.39604-9-daniel.starke@siemen= s.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index e95004217292..e02f761a3a31 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2863,11 +2863,24 @@ static ssize_t gsmld_read(struct tty_struct *tty, s= truct file *file, static ssize_t gsmld_write(struct tty_struct *tty, struct file *file, const unsigned char *buf, size_t nr) { - int space =3D tty_write_room(tty); + struct gsm_mux *gsm =3D tty->disc_data; + unsigned long flags; + int space; + int ret; + + if (!gsm) + return -ENODEV; + + ret =3D -ENOBUFS; + spin_lock_irqsave(&gsm->tx_lock, flags); + space =3D tty_write_room(tty); if (space >=3D nr) - return tty->ops->write(tty, buf, nr); - set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); - return -ENOBUFS; + ret =3D tty->ops->write(tty, buf, nr); + else + set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); + spin_unlock_irqrestore(&gsm->tx_lock, flags); + + return ret; } =20 /** --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01932C00140 for ; Mon, 15 Aug 2022 22:44:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351446AbiHOWn7 (ORCPT ); Mon, 15 Aug 2022 18:43:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350014AbiHOWi5 (ORCPT ); Mon, 15 Aug 2022 18:38:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AC8D72ED8; Mon, 15 Aug 2022 12:51:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CED7BB8106C; Mon, 15 Aug 2022 19:51:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E02C1C433D6; Mon, 15 Aug 2022 19:51:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593071; bh=TwWND5a4t0P5iKSpuKGQRTaJ7HpPNOUMjRwv3wSP6Tw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KANMVGK2U7fmbbgcuTrnkXxZEoe3XXWXx5TiV+KL0tJjrT6xEASBPmp+F8ap4MKiA tvGLAlE3sfggUB7VdZZzlbMb/r8eWd5oITHZ6SpJlyDE9Shu+iADmCPS24qdj/75NV k+Mw7ygnkrfE0zQ5/3E0DflBHMp1bB8Q9Nb9U5lU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.18 0861/1095] tty: n_gsm: fix deadlock and link starvation in outgoing data path Date: Mon, 15 Aug 2022 20:04:20 +0200 Message-Id: <20220815180504.953459935@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Starke [ Upstream commit 0af021678d5d30c31f5a6b631f404ead3575212a ] The current implementation queues up new control and user packets as needed and processes this queue down to the ldisc in the same code path. That means that the upper and the lower layer are hard coupled in the code. Due to this deadlocks can happen as seen below while transmitting data, especially during ldisc congestion. Furthermore, the data channels starve the control channel on high transmission load on the ldisc. Introduce an additional control channel data queue to prevent timeouts and link hangups during ldisc congestion. This is being processed before the user channel data queue in gsm_data_kick(), i.e. with the highest priority. Put the queue to ldisc data path into a workqueue and trigger it whenever new data has been put into the transmission queue. Change gsm_dlci_data_sweep() accordingly to fill up the transmission queue until TX_THRESH_HI. This solves the locking issue, keeps latency low and provides good performance on high data load. Note that now all packets from a DLCI are removed from the internal queue if the associated DLCI was closed. This ensures that no data is sent by the introduced write task to an already closed DLCI. BUG: spinlock recursion on CPU#0, test_v24_loop/124 lock: serial8250_ports+0x3a8/0x7500, .magic: dead4ead, .owner: test_v24_lo= op/124, .owner_cpu: 0 CPU: 0 PID: 124 Comm: test_v24_loop Tainted: G O 5.18.0-rc2 = #3 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/= 2014 Call Trace: dump_stack_lvl+0x34/0x44 do_raw_spin_lock+0x76/0xa0 _raw_spin_lock_irqsave+0x72/0x80 uart_write_room+0x3b/0xc0 gsm_data_kick+0x14b/0x240 [n_gsm] gsmld_write_wakeup+0x35/0x70 [n_gsm] tty_wakeup+0x53/0x60 tty_port_default_wakeup+0x1b/0x30 serial8250_tx_chars+0x12f/0x220 serial8250_handle_irq.part.0+0xfe/0x150 serial8250_default_handle_irq+0x48/0x80 serial8250_interrupt+0x56/0xa0 __handle_irq_event_percpu+0x78/0x1f0 handle_irq_event+0x34/0x70 handle_fasteoi_irq+0x90/0x1e0 __common_interrupt+0x69/0x100 common_interrupt+0x48/0xc0 asm_common_interrupt+0x1e/0x40 RIP: 0010:__do_softirq+0x83/0x34e Code: 2a 0a ff 0f b7 ed c7 44 24 10 0a 00 00 00 48 c7 c7 51 2a 64 82 e8 2d e2 d5 ff 65 66 c7 05 83 af 1e 7e 00 00 fb b8 ff ff ff ff <49> c7 c2 40 61 80 82 0f bc c5 41 89 c4 41 83 c4 01 0f 84 e6 00 00 RSP: 0018:ffffc90000003f98 EFLAGS: 00000286 RAX: 00000000ffffffff RBX: 0000000000000000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff82642a51 RDI: ffffffff825bb5e7 RBP: 0000000000000200 R08: 00000008de3271a8 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000030 R14: 0000000000000000 R15: 0000000000000000 ? __do_softirq+0x73/0x34e irq_exit_rcu+0xb5/0x100 common_interrupt+0xa4/0xc0 asm_common_interrupt+0x1e/0x40 RIP: 0010:_raw_spin_unlock_irqrestore+0x2e/0x50 Code: 00 55 48 89 fd 48 83 c7 18 53 48 89 f3 48 8b 74 24 10 e8 85 28 36 ff 48 89 ef e8 cd 58 36 ff 80 e7 02 74 01 fb bf 01 00 00 00 3d 97 33 ff 65 8b 05 96 23 2b 7e 85 c0 74 03 5b 5d c3 0f 1f 44 RSP: 0018:ffffc9000020fd08 EFLAGS: 00000202 RAX: 0000000000000000 RBX: 0000000000000246 RCX: 0000000000000000 RDX: 0000000000000004 RSI: ffffffff8257fd74 RDI: 0000000000000001 RBP: ffff8880057de3a0 R08: 00000008de233000 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000100 R14: 0000000000000202 R15: ffff8880057df0b8 ? _raw_spin_unlock_irqrestore+0x23/0x50 gsmtty_write+0x65/0x80 [n_gsm] n_tty_write+0x33f/0x530 ? swake_up_all+0xe0/0xe0 file_tty_write.constprop.0+0x1b1/0x320 ? n_tty_flush_buffer+0xb0/0xb0 new_sync_write+0x10c/0x190 vfs_write+0x282/0x310 ksys_write+0x68/0xe0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f3e5e35c15c Code: 8b 7c 24 08 89 c5 e8 c5 ff ff ff 89 ef 89 44 24 08 e8 58 bc 02 00 8b 44 24 08 48 83 c4 10 5d c3 48 63 ff b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 76 10 48 8b 15 fd fc 05 00 f7 d8 64 89 02 48 83 RSP: 002b:00007ffcee77cd18 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007ffcee77cd70 RCX: 00007f3e5e35c15c RDX: 0000000000000100 RSI: 00007ffcee77cd90 RDI: 0000000000000003 RBP: 0000000000000100 R08: 0000000000000000 R09: 7efefefefefefeff R10: 00007f3e5e3bddeb R11: 0000000000000246 R12: 00007ffcee77ce8f R13: 0000000000000001 R14: 000056214404e010 R15: 00007ffcee77cd90 Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701122332.2039-1-daniel.starke@siemens= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 407 ++++++++++++++++++++++++++++++-------------- 1 file changed, 279 insertions(+), 128 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index e02f761a3a31..ab7765afab86 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -5,6 +5,14 @@ * * * THIS IS A DEVELOPMENT SNAPSHOT IT IS NOT A FINAL RELEASE * * + * Outgoing path: + * tty -> DLCI fifo -> scheduler -> GSM MUX data queue ---o-> ldisc + * control message -> GSM MUX control queue --=C2=B4 + * + * Incoming path: + * ldisc -> gsm_queue() -o--> tty + * `-> gsm_control_response() + * * TO DO: * Mostly done: ioctls for setting modes/timing * Partly done: hooks so you can pull off frames to non tty devs @@ -210,6 +218,9 @@ struct gsm_mux { /* Events on the GSM channel */ wait_queue_head_t event; =20 + /* ldisc send work */ + struct work_struct tx_work; + /* Bits for GSM mode decoding */ =20 /* Framing Layer */ @@ -241,7 +252,8 @@ struct gsm_mux { unsigned int tx_bytes; /* TX data outstanding */ #define TX_THRESH_HI 8192 #define TX_THRESH_LO 2048 - struct list_head tx_list; /* Pending data packets */ + struct list_head tx_ctrl_list; /* Pending control packets */ + struct list_head tx_data_list; /* Pending data packets */ =20 /* Control messages */ struct timer_list kick_timer; /* Kick TX queuing on timeout */ @@ -371,6 +383,11 @@ static const u8 gsm_fcs8[256] =3D { =20 static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len); static int gsm_modem_update(struct gsm_dlci *dlci, u8 brk); +static struct gsm_msg *gsm_data_alloc(struct gsm_mux *gsm, u8 addr, int le= n, + u8 ctrl); +static int gsm_send_packet(struct gsm_mux *gsm, struct gsm_msg *msg); +static void gsmld_write_trigger(struct gsm_mux *gsm); +static void gsmld_write_task(struct work_struct *work); =20 /** * gsm_fcs_add - update FCS @@ -655,57 +672,73 @@ static int gsm_stuff_frame(const u8 *input, u8 *outpu= t, int len) * @cr: command/response bit seen as initiator * @control: control byte including PF bit * - * Format up and transmit a control frame. These do not go via the - * queueing logic as they should be transmitted ahead of data when - * they are needed. - * - * FIXME: Lock versus data TX path + * Format up and transmit a control frame. These should be transmitted + * ahead of data when they are needed. */ - -static void gsm_send(struct gsm_mux *gsm, int addr, int cr, int control) +static int gsm_send(struct gsm_mux *gsm, int addr, int cr, int control) { - int len; - u8 cbuf[10]; - u8 ibuf[3]; + struct gsm_msg *msg; + u8 *dp; int ocr; + unsigned long flags; + + msg =3D gsm_data_alloc(gsm, addr, 0, control); + if (!msg) + return -ENOMEM; =20 /* toggle C/R coding if not initiator */ ocr =3D cr ^ (gsm->initiator ? 0 : 1); =20 - switch (gsm->encoding) { - case 0: - cbuf[0] =3D GSM0_SOF; - cbuf[1] =3D (addr << 2) | (ocr << 1) | EA; - cbuf[2] =3D control; - cbuf[3] =3D EA; /* Length of data =3D 0 */ - cbuf[4] =3D 0xFF - gsm_fcs_add_block(INIT_FCS, cbuf + 1, 3); - cbuf[5] =3D GSM0_SOF; - len =3D 6; - break; - case 1: - case 2: - /* Control frame + packing (but not frame stuffing) in mode 1 */ - ibuf[0] =3D (addr << 2) | (ocr << 1) | EA; - ibuf[1] =3D control; - ibuf[2] =3D 0xFF - gsm_fcs_add_block(INIT_FCS, ibuf, 2); - /* Stuffing may double the size worst case */ - len =3D gsm_stuff_frame(ibuf, cbuf + 1, 3); - /* Now add the SOF markers */ - cbuf[0] =3D GSM1_SOF; - cbuf[len + 1] =3D GSM1_SOF; - /* FIXME: we can omit the lead one in many cases */ - len +=3D 2; - break; - default: - WARN_ON(1); - return; - } - gsmld_output(gsm, cbuf, len); - if (!gsm->initiator) { - cr =3D cr & gsm->initiator; - control =3D control & ~PF; + msg->data -=3D 3; + dp =3D msg->data; + *dp++ =3D (addr << 2) | (ocr << 1) | EA; + *dp++ =3D control; + + if (gsm->encoding =3D=3D 0) + *dp++ =3D EA; /* Length of data =3D 0 */ + + *dp =3D 0xFF - gsm_fcs_add_block(INIT_FCS, msg->data, dp - msg->data); + msg->len =3D (dp - msg->data) + 1; + + gsm_print_packet("Q->", addr, cr, control, NULL, 0); + + spin_lock_irqsave(&gsm->tx_lock, flags); + list_add_tail(&msg->list, &gsm->tx_ctrl_list); + gsm->tx_bytes +=3D msg->len; + spin_unlock_irqrestore(&gsm->tx_lock, flags); + gsmld_write_trigger(gsm); + + return 0; +} + +/** + * gsm_dlci_clear_queues - remove outstanding data for a DLCI + * @gsm: mux + * @dlci: clear for this DLCI + * + * Clears the data queues for a given DLCI. + */ +static void gsm_dlci_clear_queues(struct gsm_mux *gsm, struct gsm_dlci *dl= ci) +{ + struct gsm_msg *msg, *nmsg; + int addr =3D dlci->addr; + unsigned long flags; + + /* Clear DLCI write fifo first */ + spin_lock_irqsave(&dlci->lock, flags); + kfifo_reset(&dlci->fifo); + spin_unlock_irqrestore(&dlci->lock, flags); + + /* Clear data packets in MUX write queue */ + spin_lock_irqsave(&gsm->tx_lock, flags); + list_for_each_entry_safe(msg, nmsg, &gsm->tx_data_list, list) { + if (msg->addr !=3D addr) + continue; + gsm->tx_bytes -=3D msg->len; + list_del(&msg->list); + kfree(msg); } - gsm_print_packet("-->", addr, cr, control, NULL, 0); + spin_unlock_irqrestore(&gsm->tx_lock, flags); } =20 /** @@ -767,6 +800,45 @@ static struct gsm_msg *gsm_data_alloc(struct gsm_mux *= gsm, u8 addr, int len, return m; } =20 +/** + * gsm_send_packet - sends a single packet + * @gsm: GSM Mux + * @msg: packet to send + * + * The given packet is encoded and sent out. No memory is freed. + * The caller must hold the gsm tx lock. + */ +static int gsm_send_packet(struct gsm_mux *gsm, struct gsm_msg *msg) +{ + int len, ret; + + + if (gsm->encoding =3D=3D 0) { + gsm->txframe[0] =3D GSM0_SOF; + memcpy(gsm->txframe + 1, msg->data, msg->len); + gsm->txframe[msg->len + 1] =3D GSM0_SOF; + len =3D msg->len + 2; + } else { + gsm->txframe[0] =3D GSM1_SOF; + len =3D gsm_stuff_frame(msg->data, gsm->txframe + 1, msg->len); + gsm->txframe[len + 1] =3D GSM1_SOF; + len +=3D 2; + } + + if (debug & 4) + gsm_hex_dump_bytes(__func__, gsm->txframe, len); + gsm_print_packet("-->", msg->addr, gsm->initiator, msg->ctrl, msg->data, + msg->len); + + ret =3D gsmld_output(gsm, gsm->txframe, len); + if (ret <=3D 0) + return ret; + /* FIXME: Can eliminate one SOF in many more cases */ + gsm->tx_bytes -=3D msg->len; + + return 0; +} + /** * gsm_is_flow_ctrl_msg - checks if flow control message * @msg: message to check @@ -799,59 +871,81 @@ static bool gsm_is_flow_ctrl_msg(struct gsm_msg *msg) } =20 /** - * gsm_data_kick - poke the queue + * gsm_data_kick - poke the queue * @gsm: GSM Mux - * @dlci: DLCI sending the data * * The tty device has called us to indicate that room has appeared in - * the transmit queue. Ram more data into the pipe if we have any + * the transmit queue. Ram more data into the pipe if we have any. * If we have been flow-stopped by a CMD_FCOFF, then we can only - * send messages on DLCI0 until CMD_FCON - * - * FIXME: lock against link layer control transmissions + * send messages on DLCI0 until CMD_FCON. The caller must hold + * the gsm tx lock. */ - -static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci) +static int gsm_data_kick(struct gsm_mux *gsm) { struct gsm_msg *msg, *nmsg; - int len; + struct gsm_dlci *dlci; + int ret; =20 - list_for_each_entry_safe(msg, nmsg, &gsm->tx_list, list) { + clear_bit(TTY_DO_WRITE_WAKEUP, &gsm->tty->flags); + + /* Serialize control messages and control channel messages first */ + list_for_each_entry_safe(msg, nmsg, &gsm->tx_ctrl_list, list) { if (gsm->constipated && !gsm_is_flow_ctrl_msg(msg)) + return -EAGAIN; + ret =3D gsm_send_packet(gsm, msg); + switch (ret) { + case -ENOSPC: + return -ENOSPC; + case -ENODEV: + /* ldisc not open */ + gsm->tx_bytes -=3D msg->len; + list_del(&msg->list); + kfree(msg); continue; - if (gsm->encoding !=3D 0) { - gsm->txframe[0] =3D GSM1_SOF; - len =3D gsm_stuff_frame(msg->data, - gsm->txframe + 1, msg->len); - gsm->txframe[len + 1] =3D GSM1_SOF; - len +=3D 2; - } else { - gsm->txframe[0] =3D GSM0_SOF; - memcpy(gsm->txframe + 1 , msg->data, msg->len); - gsm->txframe[msg->len + 1] =3D GSM0_SOF; - len =3D msg->len + 2; - } - - if (debug & 4) - gsm_hex_dump_bytes(__func__, gsm->txframe, len); - if (gsmld_output(gsm, gsm->txframe, len) <=3D 0) + default: + if (ret >=3D 0) { + list_del(&msg->list); + kfree(msg); + } break; - /* FIXME: Can eliminate one SOF in many more cases */ - gsm->tx_bytes -=3D msg->len; - - list_del(&msg->list); - kfree(msg); + } + } =20 - if (dlci) { - tty_port_tty_wakeup(&dlci->port); - } else { - int i =3D 0; + if (gsm->constipated) + return -EAGAIN; =20 - for (i =3D 0; i < NUM_DLCI; i++) - if (gsm->dlci[i]) - tty_port_tty_wakeup(&gsm->dlci[i]->port); + /* Serialize other channels */ + if (list_empty(&gsm->tx_data_list)) + return 0; + list_for_each_entry_safe(msg, nmsg, &gsm->tx_data_list, list) { + dlci =3D gsm->dlci[msg->addr]; + /* Send only messages for DLCIs with valid state */ + if (dlci->state !=3D DLCI_OPEN) { + gsm->tx_bytes -=3D msg->len; + list_del(&msg->list); + kfree(msg); + continue; + } + ret =3D gsm_send_packet(gsm, msg); + switch (ret) { + case -ENOSPC: + return -ENOSPC; + case -ENODEV: + /* ldisc not open */ + gsm->tx_bytes -=3D msg->len; + list_del(&msg->list); + kfree(msg); + continue; + default: + if (ret >=3D 0) { + list_del(&msg->list); + kfree(msg); + } + break; } } + + return 1; } =20 /** @@ -900,9 +994,21 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, st= ruct gsm_msg *msg) msg->data =3D dp; =20 /* Add to the actual output queue */ - list_add_tail(&msg->list, &gsm->tx_list); + switch (msg->ctrl & ~PF) { + case UI: + case UIH: + if (msg->addr > 0) { + list_add_tail(&msg->list, &gsm->tx_data_list); + break; + } + fallthrough; + default: + list_add_tail(&msg->list, &gsm->tx_ctrl_list); + break; + } gsm->tx_bytes +=3D msg->len; - gsm_data_kick(gsm, dlci); + + gsmld_write_trigger(gsm); mod_timer(&gsm->kick_timer, jiffies + 10 * gsm->t1 * HZ / 100); } =20 @@ -1129,32 +1235,39 @@ static int gsm_dlci_modem_output(struct gsm_mux *gs= m, struct gsm_dlci *dlci, =20 static int gsm_dlci_data_sweep(struct gsm_mux *gsm) { - int len, ret =3D 0; /* Priority ordering: We should do priority with RR of the groups */ - int i =3D 1; - - while (i < NUM_DLCI) { - struct gsm_dlci *dlci; + int i, len, ret =3D 0; + bool sent; + struct gsm_dlci *dlci; =20 - if (gsm->tx_bytes > TX_THRESH_HI) - break; - dlci =3D gsm->dlci[i]; - if (dlci =3D=3D NULL || dlci->constipated) { - i++; - continue; + while (gsm->tx_bytes < TX_THRESH_HI) { + for (sent =3D false, i =3D 1; i < NUM_DLCI; i++) { + dlci =3D gsm->dlci[i]; + /* skip unused or blocked channel */ + if (!dlci || dlci->constipated) + continue; + /* skip channels with invalid state */ + if (dlci->state !=3D DLCI_OPEN) + continue; + /* count the sent data per adaption */ + if (dlci->adaption < 3 && !dlci->net) + len =3D gsm_dlci_data_output(gsm, dlci); + else + len =3D gsm_dlci_data_output_framed(gsm, dlci); + /* on error exit */ + if (len < 0) + return ret; + if (len > 0) { + ret++; + sent =3D true; + /* The lower DLCs can starve the higher DLCs! */ + break; + } + /* try next */ } - if (dlci->adaption < 3 && !dlci->net) - len =3D gsm_dlci_data_output(gsm, dlci); - else - len =3D gsm_dlci_data_output_framed(gsm, dlci); - if (len < 0) + if (!sent) break; - /* DLCI empty - try the next */ - if (len =3D=3D 0) - i++; - else - ret++; - } + }; =20 return ret; } @@ -1402,7 +1515,6 @@ static void gsm_control_message(struct gsm_mux *gsm, = unsigned int command, const u8 *data, int clen) { u8 buf[1]; - unsigned long flags; =20 switch (command) { case CMD_CLD: { @@ -1424,9 +1536,7 @@ static void gsm_control_message(struct gsm_mux *gsm, = unsigned int command, gsm->constipated =3D false; gsm_control_reply(gsm, CMD_FCON, NULL, 0); /* Kick the link in case it is idling */ - spin_lock_irqsave(&gsm->tx_lock, flags); - gsm_data_kick(gsm, NULL); - spin_unlock_irqrestore(&gsm->tx_lock, flags); + gsmld_write_trigger(gsm); break; case CMD_FCOFF: /* Modem wants us to STFU */ @@ -1629,8 +1739,6 @@ static int gsm_control_wait(struct gsm_mux *gsm, stru= ct gsm_control *control) =20 static void gsm_dlci_close(struct gsm_dlci *dlci) { - unsigned long flags; - del_timer(&dlci->t1); if (debug & 8) pr_debug("DLCI %d goes closed.\n", dlci->addr); @@ -1639,17 +1747,16 @@ static void gsm_dlci_close(struct gsm_dlci *dlci) dlci->constipated =3D true; if (dlci->addr !=3D 0) { tty_port_tty_hangup(&dlci->port, false); - spin_lock_irqsave(&dlci->lock, flags); - kfifo_reset(&dlci->fifo); - spin_unlock_irqrestore(&dlci->lock, flags); + gsm_dlci_clear_queues(dlci->gsm, dlci); /* Ensure that gsmtty_open() can return. */ tty_port_set_initialized(&dlci->port, 0); wake_up_interruptible(&dlci->port.open_wait); } else dlci->gsm->dead =3D true; - wake_up(&dlci->gsm->event); /* A DLCI 0 close is a MUX termination so we need to kick that back to userspace somehow */ + gsm_dlci_data_kick(dlci); + wake_up(&dlci->gsm->event); } =20 /** @@ -1672,6 +1779,7 @@ static void gsm_dlci_open(struct gsm_dlci *dlci) /* Send current modem state */ if (dlci->addr) gsm_modem_update(dlci, 0); + gsm_dlci_data_kick(dlci); wake_up(&dlci->gsm->event); } =20 @@ -2226,7 +2334,7 @@ static void gsm1_receive(struct gsm_mux *gsm, unsigne= d char c) } else if ((c & ISO_IEC_646_MASK) =3D=3D XOFF) { gsm->constipated =3D false; /* Kick the link in case it is idling */ - gsm_data_kick(gsm, NULL); + gsmld_write_trigger(gsm); return; } if (c =3D=3D GSM1_SOF) { @@ -2357,6 +2465,9 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm, bool= disc) del_timer_sync(&gsm->kick_timer); del_timer_sync(&gsm->t2_timer); =20 + /* Finish writing to ldisc */ + flush_work(&gsm->tx_work); + /* Free up any link layer users and finally the control channel */ if (gsm->has_devices) { gsm_unregister_devices(gsm_tty_driver, gsm->num); @@ -2368,9 +2479,12 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm, boo= l disc) mutex_unlock(&gsm->mutex); /* Now wipe the queues */ tty_ldisc_flush(gsm->tty); - list_for_each_entry_safe(txq, ntxq, &gsm->tx_list, list) + list_for_each_entry_safe(txq, ntxq, &gsm->tx_ctrl_list, list) + kfree(txq); + INIT_LIST_HEAD(&gsm->tx_ctrl_list); + list_for_each_entry_safe(txq, ntxq, &gsm->tx_data_list, list) kfree(txq); - INIT_LIST_HEAD(&gsm->tx_list); + INIT_LIST_HEAD(&gsm->tx_data_list); } =20 /** @@ -2389,6 +2503,7 @@ static int gsm_activate_mux(struct gsm_mux *gsm) =20 timer_setup(&gsm->kick_timer, gsm_kick_timer, 0); timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); + INIT_WORK(&gsm->tx_work, gsmld_write_task); init_waitqueue_head(&gsm->event); spin_lock_init(&gsm->control_lock); spin_lock_init(&gsm->tx_lock); @@ -2498,7 +2613,8 @@ static struct gsm_mux *gsm_alloc_mux(void) spin_lock_init(&gsm->lock); mutex_init(&gsm->mutex); kref_init(&gsm->ref); - INIT_LIST_HEAD(&gsm->tx_list); + INIT_LIST_HEAD(&gsm->tx_ctrl_list); + INIT_LIST_HEAD(&gsm->tx_data_list); =20 gsm->t1 =3D T1; gsm->t2 =3D T2; @@ -2655,6 +2771,47 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *dat= a, int len) return gsm->tty->ops->write(gsm->tty, data, len); } =20 + +/** + * gsmld_write_trigger - schedule ldisc write task + * @gsm: our mux + */ +static void gsmld_write_trigger(struct gsm_mux *gsm) +{ + if (!gsm || !gsm->dlci[0] || gsm->dlci[0]->dead) + return; + schedule_work(&gsm->tx_work); +} + + +/** + * gsmld_write_task - ldisc write task + * @work: our tx write work + * + * Writes out data to the ldisc if possible. We are doing this here to + * avoid dead-locking. This returns if no space or data is left for output. + */ +static void gsmld_write_task(struct work_struct *work) +{ + struct gsm_mux *gsm =3D container_of(work, struct gsm_mux, tx_work); + unsigned long flags; + int i, ret; + + /* All outstanding control channel and control messages and one data + * frame is sent. + */ + ret =3D -ENODEV; + spin_lock_irqsave(&gsm->tx_lock, flags); + if (gsm->tty) + ret =3D gsm_data_kick(gsm); + spin_unlock_irqrestore(&gsm->tx_lock, flags); + + if (ret >=3D 0) + for (i =3D 0; i < NUM_DLCI; i++) + if (gsm->dlci[i]) + tty_port_tty_wakeup(&gsm->dlci[i]->port); +} + /** * gsmld_attach_gsm - mode set up * @tty: our tty structure @@ -2794,6 +2951,7 @@ static int gsmld_open(struct tty_struct *tty) =20 timer_setup(&gsm->kick_timer, gsm_kick_timer, 0); timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); + INIT_WORK(&gsm->tx_work, gsmld_write_task); =20 return 0; } @@ -2810,16 +2968,9 @@ static int gsmld_open(struct tty_struct *tty) static void gsmld_write_wakeup(struct tty_struct *tty) { struct gsm_mux *gsm =3D tty->disc_data; - unsigned long flags; =20 /* Queue poll */ - clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); - spin_lock_irqsave(&gsm->tx_lock, flags); - gsm_data_kick(gsm, NULL); - if (gsm->tx_bytes < TX_THRESH_LO) { - gsm_dlci_data_sweep(gsm); - } - spin_unlock_irqrestore(&gsm->tx_lock, flags); + gsmld_write_trigger(gsm); } =20 /** --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D99DC00140 for ; Mon, 15 Aug 2022 22:44:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350525AbiHOWoc (ORCPT ); Mon, 15 Aug 2022 18:44:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350537AbiHOWjs (ORCPT ); Mon, 15 Aug 2022 18:39:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B4834DB2A; Mon, 15 Aug 2022 12:51:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 94650B80EAD; Mon, 15 Aug 2022 19:51:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEB59C433C1; Mon, 15 Aug 2022 19:51:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593091; bh=NMcjJwEwPiqeIaDe8zmQomMLRLCK3nydvXSKtNTM+6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tm3yy2nEoA+inXMb+Z3N0Fi4RF6iTUwZx2yh0lTbrpGryqQglnizIEUf16D64B/JY PsnNxwT/6/qU36xAhaeMcrMhGvQt4y3j8Eg+hTbeHzGYdy2bqtQ6CaIsJeBnqRbhHR iSQtKsJzhuGq8vGOXRlUxyZSfET46yXV6bO4nR+o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.18 0862/1095] tty: n_gsm: fix resource allocation order in gsm_activate_mux() Date: Mon, 15 Aug 2022 20:04:21 +0200 Message-Id: <20220815180504.996320151@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Starke [ Upstream commit 7349660438603ed19282e75949561406531785a5 ] Within gsm_activate_mux() all timers and locks are initiated before the actual resource for the control channel is allocated. This can lead to race conditions. Allocate the control channel DLCI object first to avoid race conditions. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701122332.2039-2-daniel.starke@siemens= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index ab7765afab86..17927163790e 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2501,6 +2501,10 @@ static int gsm_activate_mux(struct gsm_mux *gsm) struct gsm_dlci *dlci; int ret; =20 + dlci =3D gsm_dlci_alloc(gsm, 0); + if (dlci =3D=3D NULL) + return -ENOMEM; + timer_setup(&gsm->kick_timer, gsm_kick_timer, 0); timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); INIT_WORK(&gsm->tx_work, gsmld_write_task); @@ -2517,9 +2521,6 @@ static int gsm_activate_mux(struct gsm_mux *gsm) if (ret) return ret; =20 - dlci =3D gsm_dlci_alloc(gsm, 0); - if (dlci =3D=3D NULL) - return -ENOMEM; gsm->has_devices =3D true; gsm->dead =3D false; /* Tty opens are now permissible */ return 0; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33D61C3276B for ; Mon, 15 Aug 2022 22:38:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351128AbiHOWhj (ORCPT ); Mon, 15 Aug 2022 18:37:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349590AbiHOWbD (ORCPT ); Mon, 15 Aug 2022 18:31:03 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEDAAD7D27; Mon, 15 Aug 2022 12:48:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C13FDCE12E1; Mon, 15 Aug 2022 19:48:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BB10C433D6; Mon, 15 Aug 2022 19:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592899; bh=VNrgWDWeGuoXAxyxWEQ/kH7r5U6avZqdm5orjP6BqDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1nmSRERI2XwMxbTRdU0npZzYUhkfkcSaHV+kXt64VK4S5hXmlltxCBKBnbZFnRrWa YcNevuBTJhzpRgKfk+HUH3v2tMmr5ua77r7TUUhX3xxGLz9B1CywB+mYTjPotQOCQg RkxxUFXS9GnPD62RgMURtc7+wx872s6iJy4V3zpo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mark Brown , Sasha Levin , Miaoqian Lin Subject: [PATCH 5.18 0863/1095] ASoC: qcom: Fix missing of_node_put() in asoc_qcom_lpass_cpu_platform_probe() Date: Mon, 15 Aug 2022 20:04:22 +0200 Message-Id: <20220815180505.044102979@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit f507c0c67dac57d2bcd5dcae4b6139b0305d8957 ] We should call of_node_put() for the reference 'dsp_of_node' returned by of_parse_phandle() which will increase the refcount. Fixes: 9bae4880acee ("ASoC: qcom: move ipq806x specific bits out of lpass d= river.") Co-authored-by: Miaoqian Lin Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220702020109.263980-1-windhl@126.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/qcom/lpass-cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index e6846ad2b5fa..964eb07f46d6 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -1090,6 +1090,7 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platfor= m_device *pdev) dsp_of_node =3D of_parse_phandle(pdev->dev.of_node, "qcom,adsp", 0); if (dsp_of_node) { dev_err(dev, "DSP exists and holds audio resources\n"); + of_node_put(dsp_of_node); return -EBUSY; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DB3FC3276C for ; Mon, 15 Aug 2022 22:38:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351093AbiHOWhg (ORCPT ); Mon, 15 Aug 2022 18:37:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350159AbiHOWb2 (ORCPT ); Mon, 15 Aug 2022 18:31:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D1CC719A0; Mon, 15 Aug 2022 12:48:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D8CF3B81144; Mon, 15 Aug 2022 19:48:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 200A9C433C1; Mon, 15 Aug 2022 19:48:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592905; bh=tFMruD26R0zJmsKIkmvOkf54yAsxhFD3bcYpfWVgLpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gI2t37zLghxy12bUcdRePOLGLUGjJQqbA3YLsC7VAqFJOZHWGc4kbm7D9//FwEq8T dYuOTNYQB/MDKiCFTL5cCyGM+xuQYVlBMv7bI52C35CQJECczFR8DFm7lo8JQEzVXb S6sU+VBQ3yKrH0M5EMTuGe6m5CI4zZrZ5wXJ63A0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tiezhu Yang , Huacai Chen , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.18 0864/1095] MIPS: Loongson64: Fix section mismatch warning Date: Mon, 15 Aug 2022 20:04:23 +0200 Message-Id: <20220815180505.100421388@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tiezhu Yang [ Upstream commit 08472f6ebdc23334ad11dcd761d2d52c32897793 ] prom_init_numa_memory() is annotated __init and not used by any module, thus don't export it. Remove not needed EXPORT_SYMBOL for prom_init_numa_memory() to fix the following section mismatch warning: LD vmlinux.o MODPOST vmlinux.symvers WARNING: modpost: vmlinux.o(___ksymtab+prom_init_numa_memory+0x0): Section = mismatch in reference from the variable __ksymtab_prom_init_numa_memory to the function .init.tex= t:prom_init_numa_memory() The symbol prom_init_numa_memory is exported and annotated __init Fix this by removing the __init annotation of prom_init_numa_memory or drop= the export. This is build on Linux 5.19-rc4. Fixes: 6fbde6b492df ("MIPS: Loongson64: Move files to the top-level directo= ry") Signed-off-by: Tiezhu Yang Reviewed-by: Huacai Chen Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/mips/loongson64/numa.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c index 69a533148efd..8f61e93c0c5b 100644 --- a/arch/mips/loongson64/numa.c +++ b/arch/mips/loongson64/numa.c @@ -196,7 +196,6 @@ void __init prom_init_numa_memory(void) pr_info("CP0_PageGrain: CP0 5.1 (0x%x)\n", read_c0_pagegrain()); prom_meminit(); } -EXPORT_SYMBOL(prom_init_numa_memory); =20 pg_data_t * __init arch_alloc_nodedata(int nid) { --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8810AC32770 for ; Mon, 15 Aug 2022 22:38:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351193AbiHOWhr (ORCPT ); Mon, 15 Aug 2022 18:37:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350628AbiHOWcB (ORCPT ); Mon, 15 Aug 2022 18:32:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E74E012BFFD; Mon, 15 Aug 2022 12:48:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3B5C76123B; Mon, 15 Aug 2022 19:48:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DA54C433C1; Mon, 15 Aug 2022 19:48:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592911; bh=hoC3688rHs7GdImLyycObxElTTb+PGyVRE6FR7k3NtM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vl5Eumm5nWkXt9tXHSroJceqDKE/HiZUn/piR30C8nyf622mrKqqf05horENqj0ec 4ZRPTppi2ThgZ7/EJ9W7hBNjaZ2jyFZ9SIJUIFilvrb623wJTES9PzsiiHWKhZfk+f odD9TaEb/MBeRCf+JlFzLkXH4ghq635isKbv+n6s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0865/1095] ASoC: imx-card: Fix DSD/PDM mclk frequency Date: Mon, 15 Aug 2022 20:04:24 +0200 Message-Id: <20220815180505.150844251@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit c0fabd12a8570cb932f13d9388f3d887ad44369b ] The DSD/PDM rate not only DSD64/128/256/512, which are the multiple rate of 44.1kHz, but also support the multiple rate of 8kHz, so can't force all mclk frequency to be 22579200Hz, need to assign the frequency according to rate. Fixes: aa736700f42f ("ASoC: imx-card: Add imx-card machine driver") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1657100575-8261-1-git-send-email-shengjiu.w= ang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/fsl/imx-card.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index 6f8efd838fcc..c0eb218a254b 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -17,6 +17,9 @@ =20 #include "fsl_sai.h" =20 +#define IMX_CARD_MCLK_22P5792MHZ 22579200 +#define IMX_CARD_MCLK_24P576MHZ 24576000 + enum codec_type { CODEC_DUMMY =3D 0, CODEC_AK5558 =3D 1, @@ -353,9 +356,14 @@ static int imx_aif_hw_params(struct snd_pcm_substream = *substream, mclk_freq =3D akcodec_get_mclk_rate(substream, params, slots, slot_width= ); else mclk_freq =3D params_rate(params) * slots * slot_width; - /* Use the maximum freq from DSD512 (512*44100 =3D 22579200) */ - if (format_is_dsd(params)) - mclk_freq =3D 22579200; + + if (format_is_dsd(params)) { + /* Use the maximum freq from DSD512 (512*44100 =3D 22579200) */ + if (!(params_rate(params) % 11025)) + mclk_freq =3D IMX_CARD_MCLK_22P5792MHZ; + else + mclk_freq =3D IMX_CARD_MCLK_24P576MHZ; + } =20 ret =3D snd_soc_dai_set_sysclk(cpu_dai, link_data->cpu_sysclk_id, mclk_fr= eq, SND_SOC_CLOCK_OUT); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A51DAC00140 for ; Mon, 15 Aug 2022 22:38:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348628AbiHOWiM (ORCPT ); Mon, 15 Aug 2022 18:38:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350774AbiHOWcL (ORCPT ); Mon, 15 Aug 2022 18:32:11 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D314812D2A3; Mon, 15 Aug 2022 12:48:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C4387CE12E0; Mon, 15 Aug 2022 19:48:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B08F5C433D6; Mon, 15 Aug 2022 19:48:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592918; bh=EYeWNRRdqeLTH60vOeNeougrx1JxpB34+HdpnISTfl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GfUilLVkh1zbakPGNJ0AhJeUTHh34KmGVTauTL5Xy7/A/aqW+FV+9D8rMb7AlS1w7 Kh9YIEzAUA3dm3QrXZMtla/gg5MJ+zmirD28r5Xpq5qqclNBa8IClxT3ddfZGaTeo0 yaEt8YueszpN33anwGKXA+nViduhndiNQz0as14w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sireesh Kodali , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0866/1095] remoteproc: qcom: wcnss: Fix handling of IRQs Date: Mon, 15 Aug 2022 20:04:25 +0200 Message-Id: <20220815180505.199454822@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sireesh Kodali [ Upstream commit bed0adac1ded4cb486ba19a3a7e730fbd9a1c9c6 ] The wcnss_get_irq function is expected to return a value > 0 in the event that an IRQ is succssfully obtained, but it instead returns 0. This causes the stop and ready IRQs to never actually be used despite being defined in the device-tree. This patch fixes that. Fixes: aed361adca9f ("remoteproc: qcom: Introduce WCNSS peripheral image lo= ader") Signed-off-by: Sireesh Kodali Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220526141740.15834-2-sireeshkodali1@gmail= .com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/remoteproc/qcom_wcnss.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcns= s.c index 9a223d394087..68f37296b151 100644 --- a/drivers/remoteproc/qcom_wcnss.c +++ b/drivers/remoteproc/qcom_wcnss.c @@ -467,6 +467,7 @@ static int wcnss_request_irq(struct qcom_wcnss *wcnss, irq_handler_t thread_fn) { int ret; + int irq_number; =20 ret =3D platform_get_irq_byname(pdev, name); if (ret < 0 && optional) { @@ -477,14 +478,19 @@ static int wcnss_request_irq(struct qcom_wcnss *wcnss, return ret; } =20 + irq_number =3D ret; + ret =3D devm_request_threaded_irq(&pdev->dev, ret, NULL, thread_fn, IRQF_TRIGGER_RISING | IRQF_ONESHOT, "wcnss", wcnss); - if (ret) + if (ret) { dev_err(&pdev->dev, "request %s IRQ failed\n", name); + return ret; + } =20 - return ret; + /* Return the IRQ number if the IRQ was successfully acquired */ + return irq_number; } =20 static int wcnss_alloc_memory_region(struct qcom_wcnss *wcnss) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89A9FC25B08 for ; Mon, 15 Aug 2022 22:39:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350280AbiHOWjG (ORCPT ); Mon, 15 Aug 2022 18:39:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241207AbiHOWc2 (ORCPT ); Mon, 15 Aug 2022 18:32:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F82312E253; Mon, 15 Aug 2022 12:49:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5DABFB81144; Mon, 15 Aug 2022 19:48:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F13BC433C1; Mon, 15 Aug 2022 19:48:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592924; bh=kVKp/t6i6DaXjN4J5IYS3k0hIz/ioS3Y5JvQrfcQXvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IpNAh/Kcrcf5ynyHwY0E6H6praPZi9SdiALY1Y7wyPgKCHsvsb/aTLFt8MqBZspB6 MuOItF6aObRcEB6kBlAo+tAUOu9Tx9H4IR+DMvzJuPN5kPeFi0ilpA3oNwd4vy7w7U K1FOm30c52PnKb24E3067EFAiKIiELfoAaH+uRV0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Farman , Jason Gunthorpe , Matthew Rosato , Alex Williamson , Sasha Levin Subject: [PATCH 5.18 0867/1095] vfio/ccw: Fix FSM state if mdev probe fails Date: Mon, 15 Aug 2022 20:04:26 +0200 Message-Id: <20220815180505.232891227@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Farman [ Upstream commit f6c876d67e956de8d69349b0ee43bc7277c09e5c ] The FSM is in STANDBY state when arriving in vfio_ccw_mdev_probe(), and this routine converts it to IDLE as part of its processing. The error exit sets it to IDLE (again) but clears the private->mdev pointer. The FSM should of course be managing the state itself, but the correct thing for vfio_ccw_mdev_probe() to do would be to put the state back the way it found it. The corresponding check of private->mdev in vfio_ccw_sch_io_todo() can be removed, since the distinction is unnecessary at this point. Fixes: 3bf1311f351ef ("vfio/ccw: Convert to use vfio_register_emulated_iomm= u_dev()") Signed-off-by: Eric Farman Reviewed-by: Jason Gunthorpe Reviewed-by: Matthew Rosato Link: https://lore.kernel.org/r/20220707135737.720765-3-farman@linux.ibm.com Signed-off-by: Alex Williamson Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/s390/cio/vfio_ccw_drv.c | 5 +++-- drivers/s390/cio/vfio_ccw_ops.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_dr= v.c index ee182cfb467d..789175221e9a 100644 --- a/drivers/s390/cio/vfio_ccw_drv.c +++ b/drivers/s390/cio/vfio_ccw_drv.c @@ -107,9 +107,10 @@ static void vfio_ccw_sch_io_todo(struct work_struct *w= ork) /* * Reset to IDLE only if processing of a channel program * has finished. Do not overwrite a possible processing - * state if the final interrupt was for HSCH or CSCH. + * state if the interrupt was unsolicited, or if the final + * interrupt was for HSCH or CSCH. */ - if (private->mdev && cp_is_finished) + if (cp_is_finished) private->state =3D VFIO_CCW_STATE_IDLE; =20 if (private->io_trigger) diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_op= s.c index d8589afac272..8d76f5b26e2b 100644 --- a/drivers/s390/cio/vfio_ccw_ops.c +++ b/drivers/s390/cio/vfio_ccw_ops.c @@ -146,7 +146,7 @@ static int vfio_ccw_mdev_probe(struct mdev_device *mdev) vfio_uninit_group_dev(&private->vdev); atomic_inc(&private->avail); private->mdev =3D NULL; - private->state =3D VFIO_CCW_STATE_IDLE; + private->state =3D VFIO_CCW_STATE_STANDBY; return ret; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B675AC00140 for ; Mon, 15 Aug 2022 22:40:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348504AbiHOWkN (ORCPT ); Mon, 15 Aug 2022 18:40:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349525AbiHOWeM (ORCPT ); Mon, 15 Aug 2022 18:34:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C91F712E27B; Mon, 15 Aug 2022 12:49:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B713F61226; Mon, 15 Aug 2022 19:48:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDC39C433C1; Mon, 15 Aug 2022 19:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592933; bh=DLJUHjw7dNV0aVabRJZ7xLg7ayVN5gRvxA5ZVDd6Pmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wuZNS7tj07HjVqLceG2oSWL6+OnVZde+hoEC4/r56mKkhYezE2TKNhcoVoiQ/laDl EklbFk/KPyF8DVzaZ0wmqhjSzuNkaUkhLS4/dw7wKT6Ulk2nCWqiQntKc89QXVHbC+ inPIyGhauAyNrptm1v/P537qudIq8gtqE8Huwsq4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Farman , Matthew Rosato , Alex Williamson , Sasha Levin Subject: [PATCH 5.18 0868/1095] vfio/ccw: Do not change FSM state in subchannel event Date: Mon, 15 Aug 2022 20:04:27 +0200 Message-Id: <20220815180505.273234596@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Farman [ Upstream commit cffcc109fd682075dee79bade3d60a07152a8fd1 ] The routine vfio_ccw_sch_event() is tasked with handling subchannel events, specifically machine checks, on behalf of vfio-ccw. It correctly calls cio_update_schib(), and if that fails (meaning the subchannel is gone) it makes an FSM event call to mark the subchannel Not Operational. If that worked, however, then it decides that if the FSM state was already Not Operational (implying the subchannel just came back), then it should simply change the FSM to partially- or fully-open. Remove this trickery, since a subchannel returning will require more probing than simply "oh all is well again" to ensure it works correctly. Fixes: bbe37e4cb8970 ("vfio: ccw: introduce a finite state machine") Signed-off-by: Eric Farman Reviewed-by: Matthew Rosato Link: https://lore.kernel.org/r/20220707135737.720765-4-farman@linux.ibm.com Signed-off-by: Alex Williamson Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/s390/cio/vfio_ccw_drv.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_dr= v.c index 789175221e9a..e76a4a3cf1ce 100644 --- a/drivers/s390/cio/vfio_ccw_drv.c +++ b/drivers/s390/cio/vfio_ccw_drv.c @@ -302,19 +302,11 @@ static int vfio_ccw_sch_event(struct subchannel *sch,= int process) if (work_pending(&sch->todo_work)) goto out_unlock; =20 - if (cio_update_schib(sch)) { - vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_NOT_OPER); - rc =3D 0; - goto out_unlock; - } - - private =3D dev_get_drvdata(&sch->dev); - if (private->state =3D=3D VFIO_CCW_STATE_NOT_OPER) { - private->state =3D private->mdev ? VFIO_CCW_STATE_IDLE : - VFIO_CCW_STATE_STANDBY; - } rc =3D 0; =20 + if (cio_update_schib(sch)) + vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_NOT_OPER); + out_unlock: spin_unlock_irqrestore(sch->lock, flags); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1431C00140 for ; Mon, 15 Aug 2022 22:42:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350883AbiHOWkv (ORCPT ); Mon, 15 Aug 2022 18:40:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350519AbiHOWgl (ORCPT ); Mon, 15 Aug 2022 18:36:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 663DC60529; Mon, 15 Aug 2022 12:50:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 197FF6125B; Mon, 15 Aug 2022 19:49:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 074D0C43148; Mon, 15 Aug 2022 19:48:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592939; bh=HVlih1cUQcNP31sy4XJn3sx3uxS7BbAuTUytr980X6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W1jTto3K+nUm3sofVPbrxjS6CaWsvCxtqa5XpyffHektFLl/nMan9RgQW9x3KOwsO EcmwwMzuBk/1Cs5gcl+sJ5JYXIAEf7DWZY4re1SjsFLxlUbqsY6E40e+b7s+xG3Xwa UjsvFxECh6CAVylnHOA6Ucik1m4BhTg7QejX4/WE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuninori Morimoto , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0869/1095] ASoC: audio-graph-card2.c: use of_property_read_u32() for rate Date: Mon, 15 Aug 2022 20:04:28 +0200 Message-Id: <20220815180505.313194658@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuninori Morimoto [ Upstream commit 817a62108dfacebd548e38451bf0e7eee023e97f ] Audio Graph Card2 is using of_get_property(), but it should use of_property_read_u32() to getting rate. Otherwise the setting will be strange value. This patch fixup it. Fixes: c3a15c92a67b701 ("ASoC: audio-graph-card2: add Codec2Codec support") Signed-off-by: Kuninori Morimoto Link: https://lore.kernel.org/r/87h741s961.wl-kuninori.morimoto.gx@renesas.= com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/generic/audio-graph-card2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audi= o-graph-card2.c index c0f3907a01fd..328af836cf53 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -856,7 +856,7 @@ int audio_graph2_link_c2c(struct asoc_simple_priv *priv, struct device_node *port0, *port1, *ports; struct device_node *codec0_port, *codec1_port; struct device_node *ep0, *ep1; - u32 val; + u32 val =3D 0; int ret =3D -EINVAL; =20 /* @@ -880,7 +880,8 @@ int audio_graph2_link_c2c(struct asoc_simple_priv *priv, ports =3D of_get_parent(port0); port1 =3D of_get_next_child(ports, lnk); =20 - if (!of_get_property(ports, "rate", &val)) { + of_property_read_u32(ports, "rate", &val); + if (!val) { struct device *dev =3D simple_priv_to_dev(priv); =20 dev_err(dev, "Codec2Codec needs rate settings\n"); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D58E7C3F6B0 for ; Mon, 15 Aug 2022 22:42:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350959AbiHOWk7 (ORCPT ); Mon, 15 Aug 2022 18:40:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350633AbiHOWgs (ORCPT ); Mon, 15 Aug 2022 18:36:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAE4872846; Mon, 15 Aug 2022 12:50:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 12EE0B80EAB; Mon, 15 Aug 2022 19:49:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D5A2C433C1; Mon, 15 Aug 2022 19:49:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592945; bh=p39y+PYbrUySdsjZRfs7nDjzVMLSTQa5YZkb/iUYSn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XsqliHHYlntFGY+Sz+pvOSkN8xVlu16ERaoLAAIYil8BD5+9ndsNQyb+GVplOHipf lnSNwA3WtA9vBWvh0A6HBgTktADVo2lN5VBfRoTUPCPmex8OwDz1sSYM/yusIrGjAU OvyQu2i2I2kfkL+5cm3rbUqTB2YsuP2OPGVno+S4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Sasha Levin Subject: [PATCH 5.18 0870/1095] serial: 8250_fsl: Dont report FE, PE and OE twice Date: Mon, 15 Aug 2022 20:04:29 +0200 Message-Id: <20220815180505.360395873@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 9d3aaceb73acadf134596a2f8db9c451c1332d3d ] Some Freescale 8250 implementations have the problem that a single long break results in one irq per character frame time. The code in fsl8250_handle_irq() that is supposed to handle that uses the BI bit in lsr_saved_flags to detect such a situation and then skip the second received character. However it also stores other error bits and so after a single frame error the character received in the next irq handling is passed to the upper layer with a frame error, too. So after a spike on the data line (which is correctly recognized as a frame error) the following valid character is thrown away, because the driver reports a frame error for that one, too. To weaken this problem restrict saving LSR to only the BI bit. Note however that the handling is still broken: - lsr_saved_flags is updated using orig_lsr which is the LSR content for the first received char, but there might be more in the FIFO, so a character is thrown away that is received later and not necessarily the one following the break. - The doubled break might be the 2nd and 3rd char in the FIFO, so the workaround doesn't catch these, because serial8250_rx_chars() doesn't handle the workaround. - lsr_saved_flags might have set UART_LSR_BI at the entry of fsl8250_handle_irq() which doesn't originate from fsl8250_handle_irq()'s "up->lsr_saved_flags |=3D orig_lsr & UART_LSR_BI;" but from e.g. from serial8250_tx_empty(). - For a long or a short break this isn't about two characters, but more or only a single one. Fixes: 9deaa53ac7fa ("serial: add irq handler for Freescale 16550 errata.") Acked-by: Ilpo J=C3=A4rvinen Signed-off-by: Uwe Kleine-K=C3=B6nig Link: https://lore.kernel.org/r/20220704085119.55900-1-u.kleine-koenig@peng= utronix.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/serial/8250/8250_fsl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_fsl.c b/drivers/tty/serial/8250/8= 250_fsl.c index 9c01c531349d..71ce43685797 100644 --- a/drivers/tty/serial/8250/8250_fsl.c +++ b/drivers/tty/serial/8250/8250_fsl.c @@ -77,7 +77,7 @@ int fsl8250_handle_irq(struct uart_port *port) if ((lsr & UART_LSR_THRE) && (up->ier & UART_IER_THRI)) serial8250_tx_chars(up); =20 - up->lsr_saved_flags =3D orig_lsr; + up->lsr_saved_flags |=3D orig_lsr & UART_LSR_BI; =20 uart_unlock_and_check_sysrq_irqrestore(&up->port, flags); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A3D5C00140 for ; Mon, 15 Aug 2022 22:39:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350521AbiHOWjr (ORCPT ); Mon, 15 Aug 2022 18:39:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349650AbiHOWdY (ORCPT ); Mon, 15 Aug 2022 18:33:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53CB712D2B9; Mon, 15 Aug 2022 12:49:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BDA356068D; Mon, 15 Aug 2022 19:49:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6C03C433D6; Mon, 15 Aug 2022 19:49:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592952; bh=RFhJ7oKbxaQZgjiYqpkKAEp72wMbCyf95ly99JkvQ/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nhb8g3A1+SA3nQiDgGLROhsQgLIxqe5Q5/I14C3bFAoi43FyKpMq7Sv5mKgzGo7cn ejc4V+TrkyqVY+iP8wDkQ67ff0RC6dLVAZI7gOK4YjSsGAoztCPriIW8XotfFPndpX oEi+TqwwT3jlA8kImZgzRMg2fyzqJ1ECqysCKqeU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.18 0871/1095] tty: n_gsm: fix wrong T1 retry count handling Date: Mon, 15 Aug 2022 20:04:30 +0200 Message-Id: <20220815180505.409612638@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Starke [ Upstream commit f30e10caa80aa1f35508bc17fc302dbbde9a833c ] n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010. See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDeta= ils.aspx?specificationId=3D1516 The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to the newer 27.010 here. Chapter 5.7.3 states that the valid range for the maximum number of retransmissions (N2) is from 0 to 255 (both including). gsm_dlci_t1() handles this number incorrectly by performing N2 - 1 retransmission attempts. Setting N2 to zero results in more than 255 retransmission attempts. Fix gsm_dlci_t1() to comply with 3GPP 27.010. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220707113223.3685-1-daniel.starke@siemens= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 17927163790e..825c4b550ee0 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1805,8 +1805,8 @@ static void gsm_dlci_t1(struct timer_list *t) =20 switch (dlci->state) { case DLCI_OPENING: - dlci->retries--; if (dlci->retries) { + dlci->retries--; gsm_command(dlci->gsm, dlci->addr, SABM|PF); mod_timer(&dlci->t1, jiffies + gsm->t1 * HZ / 100); } else if (!dlci->addr && gsm->control =3D=3D (DM | PF)) { @@ -1821,8 +1821,8 @@ static void gsm_dlci_t1(struct timer_list *t) =20 break; case DLCI_CLOSING: - dlci->retries--; if (dlci->retries) { + dlci->retries--; gsm_command(dlci->gsm, dlci->addr, DISC|PF); mod_timer(&dlci->t1, jiffies + gsm->t1 * HZ / 100); } else --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EE83C2BB43 for ; Mon, 15 Aug 2022 22:42:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351164AbiHOWlc (ORCPT ); Mon, 15 Aug 2022 18:41:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350749AbiHOWg6 (ORCPT ); Mon, 15 Aug 2022 18:36:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28BEF13068F; Mon, 15 Aug 2022 12:50:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A87B1B81147; Mon, 15 Aug 2022 19:49:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08D5CC433C1; Mon, 15 Aug 2022 19:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592958; bh=kKcOqddKvol4t8kxrtOabjyXp7neAQUwgD2ykDSIVWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zlt4bkniSbDBqmXKTWW9DV57x8fD9uEjjXbiCBiWCTYNXU4ogAMQPcPEBejIFPSah trPyCH8LyD8EfnKfMfnETzG2CAUj5yZDJU14RVxvfCUBYRw9JsyiD+6wcZgqY7352a nPC/DROKNAPMbWP4u5bfZ+U0UawMN36YI+9dMeFY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.18 0872/1095] tty: n_gsm: fix DM command Date: Mon, 15 Aug 2022 20:04:31 +0200 Message-Id: <20220815180505.456559855@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Starke [ Upstream commit 18a948c7d90995d127785e308fa7b701df4c499f ] n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010. See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDeta= ils.aspx?specificationId=3D1516 The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to the newer 27.010 here. Chapter 5.3.3 defines the DM response. There exists no DM command. However, the current implementation incorrectly sends DM as command in case of unexpected UIH frames in gsm_queue(). Correct this behavior by always sending DM as response. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220707113223.3685-2-daniel.starke@siemens= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 825c4b550ee0..8b8c7312935f 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2211,7 +2211,7 @@ static void gsm_queue(struct gsm_mux *gsm) goto invalid; #endif if (dlci =3D=3D NULL || dlci->state !=3D DLCI_OPEN) { - gsm_command(gsm, address, DM|PF); + gsm_response(gsm, address, DM|PF); return; } dlci->data(dlci, gsm->buf, gsm->len); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A5E7C00140 for ; Mon, 15 Aug 2022 22:42:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350759AbiHOWkk (ORCPT ); Mon, 15 Aug 2022 18:40:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350190AbiHOWfz (ORCPT ); Mon, 15 Aug 2022 18:35:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5900371BF1; Mon, 15 Aug 2022 12:49:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2CB52B8114D; Mon, 15 Aug 2022 19:49:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E22CC433D6; Mon, 15 Aug 2022 19:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592967; bh=MNK7u5dyCfo7vAH0daYRM5AOYYJy+wYIqzg5aLVcy9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WOZmHCspgGrBey04IOvCquv4ytgK9e8vWLYBTP5qQ2JWxEhDxNcvMCfJHcz3xjASw c6AXFa0JNAFoADVH5urdlHfaXNJMFMzEC9617mpvapCRIebF1lo+6a7FA4NIeUIpCI ODDsIX+Oe/Vrh5Y4GT7WJZhk4YJLYmnSnmM0FFsM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.18 0873/1095] tty: n_gsm: fix flow control handling in tx path Date: Mon, 15 Aug 2022 20:04:32 +0200 Message-Id: <20220815180505.489476843@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Starke [ Upstream commit 59ff0680ecbfec742b1e0381e7cc46b41eb06647 ] The current implementation constipates all transmission paths during flow control except for flow control frames. However, these may not be located at the beginning of the transmission queue of the control channel. Ensure that flow control frames in the transmission queue for the control channel are always handled even if constipated by skipping through other messages. Fixes: 0af021678d5d ("tty: n_gsm: fix deadlock and link starvation in outgo= ing data path") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220707113223.3685-3-daniel.starke@siemens= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 8b8c7312935f..7749de4f269a 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -891,7 +891,7 @@ static int gsm_data_kick(struct gsm_mux *gsm) /* Serialize control messages and control channel messages first */ list_for_each_entry_safe(msg, nmsg, &gsm->tx_ctrl_list, list) { if (gsm->constipated && !gsm_is_flow_ctrl_msg(msg)) - return -EAGAIN; + continue; ret =3D gsm_send_packet(gsm, msg); switch (ret) { case -ENOSPC: --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9746BC25B08 for ; Mon, 15 Aug 2022 22:40:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350658AbiHOWkF (ORCPT ); Mon, 15 Aug 2022 18:40:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348953AbiHOWeM (ORCPT ); Mon, 15 Aug 2022 18:34:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9EB470E72; Mon, 15 Aug 2022 12:49:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C89D06122B; Mon, 15 Aug 2022 19:49:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5E5FC433D6; Mon, 15 Aug 2022 19:49:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592974; bh=HAgF+QZyq7BwwqLqpaRvWir0GnzA1N0v4RZ9HqRJ7ko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iUQ12fr9DzSratNurm9taG/M/U0q9bOQfTY85XxK36BP0zjCwNOqF5zXW/0LboxlD svvGirAcT/W6erj3IQppyzID8ckua+vf6Fi38ESASVAGTw3EawZUrCa88VSxY8ZRa5 uTo3/l84A8yHrY76Bn9C2qDQDLv8UY2ccktlWF5c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.18 0874/1095] tty: n_gsm: fix missing corner cases in gsmld_poll() Date: Mon, 15 Aug 2022 20:04:33 +0200 Message-Id: <20220815180505.522422313@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniel Starke [ Upstream commit 7e5b4322cde067e1d0f1bf8f490e93f664a7c843 ] gsmld_poll() currently fails to handle the following corner cases correctly: - remote party closed the associated tty Add the missing checks and map those to EPOLLHUP. Reorder the checks to group them by their reaction. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220707113223.3685-4-daniel.starke@siemens= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 7749de4f269a..3dd71ede4cd4 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -3057,12 +3057,15 @@ static __poll_t gsmld_poll(struct tty_struct *tty, = struct file *file, =20 poll_wait(file, &tty->read_wait, wait); poll_wait(file, &tty->write_wait, wait); + + if (gsm->dead) + mask |=3D EPOLLHUP; if (tty_hung_up_p(file)) mask |=3D EPOLLHUP; + if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) + mask |=3D EPOLLHUP; if (!tty_is_writelocked(tty) && tty_write_room(tty) > 0) mask |=3D EPOLLOUT | EPOLLWRNORM; - if (gsm->dead) - mask |=3D EPOLLHUP; return mask; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02C79C25B0E for ; Mon, 15 Aug 2022 22:42:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351054AbiHOWlR (ORCPT ); Mon, 15 Aug 2022 18:41:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350689AbiHOWgw (ORCPT ); Mon, 15 Aug 2022 18:36:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB9301256CB; Mon, 15 Aug 2022 12:50:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B984960FD8; Mon, 15 Aug 2022 19:49:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA4EEC433C1; Mon, 15 Aug 2022 19:49:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592981; bh=qV18CXrqDsPNUqyyYXpbc7vK2XRoYEx8HCVgIpmxHzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tug0/G+4FZYzPQwoscaKg/Xj211j7DwQVzy7GEvl0cXB4AawNy6+HJvi/Vjtq7ljN yrDJ/fS6d5X7pxGJ/Qi0ncAY8j6ZlVOJRmU0/4he7ZX1M8MrmjFWdF74ZVXBnw6lcw W8RkfI9S7D4UvMCFSt/nQxzuD4kiVqfA/LvrovLI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Greg Ungerer , Serge Semin , Florian Fainelli , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.18 0875/1095] MIPS: vdso: Utilize __pa() for gic_pfn Date: Mon, 15 Aug 2022 20:04:34 +0200 Message-Id: <20220815180505.557973427@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Fainelli [ Upstream commit 8baa65126e19af5ee9f3c07e7bb53da41c39e4b1 ] The GIC user offset is mapped into every process' virtual address and is therefore part of the hot-path of arch_setup_additional_pages(). Utilize __pa() such that we are more optimal even when CONFIG_DEBUG_VIRTUAL is enabled, and while at it utilize PFN_DOWN() instead of open-coding the right shift by PAGE_SHIFT. Reported-by: Greg Ungerer Suggested-by: Serge Semin Fixes: dfad83cb7193 ("MIPS: Add support for CONFIG_DEBUG_VIRTUAL") Signed-off-by: Florian Fainelli Acked-by: Greg Ungerer Tested-by: Greg Ungerer Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/mips/kernel/vdso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c index 3d0cf471f2fe..b2cc2c2dd4bf 100644 --- a/arch/mips/kernel/vdso.c +++ b/arch/mips/kernel/vdso.c @@ -159,7 +159,7 @@ int arch_setup_additional_pages(struct linux_binprm *bp= rm, int uses_interp) /* Map GIC user page. */ if (gic_size) { gic_base =3D (unsigned long)mips_gic_base + MIPS_GIC_USER_OFS; - gic_pfn =3D virt_to_phys((void *)gic_base) >> PAGE_SHIFT; + gic_pfn =3D PFN_DOWN(__pa(gic_base)); =20 ret =3D io_remap_pfn_range(vma, base, gic_pfn, gic_size, pgprot_noncached(vma->vm_page_prot)); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7ECFEC32757 for ; Mon, 15 Aug 2022 22:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351355AbiHOWmB (ORCPT ); Mon, 15 Aug 2022 18:42:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350877AbiHOWhQ (ORCPT ); Mon, 15 Aug 2022 18:37:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D01DD5F12B; Mon, 15 Aug 2022 12:50:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 37A5160FB5; Mon, 15 Aug 2022 19:49:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09E40C433C1; Mon, 15 Aug 2022 19:49:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592987; bh=u3MJlF94TEUlwGT6XhEOyGzd+wXV3YqFsvsnUO3j5f8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ld0sjg0NMsfMteaAwSPQyGG3+WPVE50Om7/lZ2o6voLHzC03sTa3qLHY0sNXkqACp U+7GQv/qszIxZaAm1x8JndbF/cXivX6ew4nqYZI8w8SxvVFw4OSyWjdC/7+ZOCceuo KvTC6CLZVH3L05GmApBVCRRuEerotYy788IXqv0M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , YC Hung , Li-Yu Yu , Ranjani Sridharan , KuanHsun Cheng , =?UTF-8?q?P=C3=A9ter=20Ujfalusi?= , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0876/1095] ASoC: SOF: mediatek: fix mt8195 StatvectorSel wrong setting Date: Mon, 15 Aug 2022 20:04:35 +0200 Message-Id: <20220815180505.597440635@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: YC Hung [ Upstream commit 99bad468846f7a255dcfc95454401c83ae02e89b ] Fix StatVectorSel wrong setting. Fixes: b7f6503830 ("ASoC: SOF: mediatek: Add fw loader and mt8195 dsp ops t= o load firmware") Signed-off-by: Pierre-Louis Bossart Signed-off-by: YC Hung Reviewed-by: Li-Yu Yu Reviewed-by: Ranjani Sridharan Reviewed-by: KuanHsun Cheng Reviewed-by: P=C3=A9ter Ujfalusi Link: https://lore.kernel.org/r/20220708203904.29214-3-pierre-louis.bossart= @linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/sof/mediatek/mt8195/mt8195-loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sof/mediatek/mt8195/mt8195-loader.c b/sound/soc/sof/= mediatek/mt8195/mt8195-loader.c index ed18d6379e92..ef2664c3cd47 100644 --- a/sound/soc/sof/mediatek/mt8195/mt8195-loader.c +++ b/sound/soc/sof/mediatek/mt8195/mt8195-loader.c @@ -21,7 +21,7 @@ void sof_hifixdsp_boot_sequence(struct snd_sof_dev *sdev,= u32 boot_addr) =20 /* pull high StatVectorSel to use AltResetVec (set bit4 to 1) */ snd_sof_dsp_update_bits(sdev, DSP_REG_BAR, DSP_RESET_SW, - DSP_RESET_SW, DSP_RESET_SW); + STATVECTOR_SEL, STATVECTOR_SEL); =20 /* toggle DReset & BReset */ /* pull high DReset & BReset */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD1F7C00140 for ; Mon, 15 Aug 2022 22:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351410AbiHOWmK (ORCPT ); Mon, 15 Aug 2022 18:42:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350912AbiHOWhT (ORCPT ); Mon, 15 Aug 2022 18:37:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFBE457278; Mon, 15 Aug 2022 12:50:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A93566125C; Mon, 15 Aug 2022 19:49:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60629C433D7; Mon, 15 Aug 2022 19:49:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592994; bh=UAcZmHsa1cU50LdsSO23W6xVAhxVJVOJgExFm4nAcdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EFsfe9F0xjALY+2FEGQ/SEeustdnKgjqjHSQyp5VvvOfv7GHHHFOFAGsU4vSWw9jS O7hrqf2PTcD/M+HgbKsr0FyXiLHpGA34c1xo5tb73kv/OwwYVaHDpK1MIt81b/bpN5 WBRefPyzSS9b426uti4nq3d8U7iMM4PgEQ33Pr2A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Murphy , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.18 0877/1095] swiotlb: fail map correctly with failed io_tlb_default_mem Date: Mon, 15 Aug 2022 20:04:36 +0200 Message-Id: <20220815180505.637602545@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robin Murphy [ Upstream commit c51ba246cb172c9e947dc6fb8868a1eaf0b2a913 ] In the failure case of trying to use a buffer which we'd previously failed to allocate, the "!mem" condition is no longer sufficient since io_tlb_default_mem became static and assigned by default. Update the condition to work as intended per the rest of that conversion. Fixes: 463e862ac63e ("swiotlb: Convert io_default_tlb_mem to static allocat= ion") Signed-off-by: Robin Murphy Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/dma/swiotlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 73a41cec9e38..90e5f5c92fdc 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -588,7 +588,7 @@ phys_addr_t swiotlb_tbl_map_single(struct device *dev, = phys_addr_t orig_addr, int index; phys_addr_t tlb_addr; =20 - if (!mem) + if (!mem || !mem->nslabs) panic("Can not allocate SWIOTLB buffer earlier and can't now provide you= with the DMA bounce buffer"); =20 if (cc_platform_has(CC_ATTR_MEM_ENCRYPT)) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF028C25B08 for ; Mon, 15 Aug 2022 22:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351425AbiHOWmN (ORCPT ); Mon, 15 Aug 2022 18:42:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350928AbiHOWhV (ORCPT ); Mon, 15 Aug 2022 18:37:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B29C2DE8; Mon, 15 Aug 2022 12:50:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0E773B81154; Mon, 15 Aug 2022 19:50:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5254AC433D7; Mon, 15 Aug 2022 19:50:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593003; bh=tkqliisyWlw//YEyiwGGxb+HGB3tuKHQvqGhfE8nTOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P8yHJUQ4ZNrSQrP6BCP9wS6eQM3e1EuMZT1FzTMSQLLWHgFiTYuPlhGEd7sHFQ98u uzMbsxU62Npbbk5X3hRgWpuhoqUC/JkOsdE8GzCeVcXW7rGd0lxNfMmEnkt3WGDH+U pYDWASujksCo7oC/3uO8PmrC8H6/7WijkfMBSk/U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Seppo Ingalsuo , Peter Ujfalusi , Ranjani Sridharan , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0878/1095] ASoC: SOF: ipc3-topology: Prevent double freeing of ipc_control_data via load_bytes Date: Mon, 15 Aug 2022 20:04:37 +0200 Message-Id: <20220815180505.688938280@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Ujfalusi [ Upstream commit d5bd47f3ca124058a8e87eae4508afeda2132611 ] We have sanity checks for byte controls and if any of the fail the locally allocated scontrol->ipc_control_data is freed up, but not set to NULL. On a rollback path of the error the higher level code will also try to free the scontrol->ipc_control_data which will eventually going to lead to memory corruption as double freeing memory is not a good thing. Fixes: b5cee8feb1d4 ("ASoC: SOF: topology: Make control parsing IPC agnosti= c") Reported-by: Seppo Ingalsuo Signed-off-by: Peter Ujfalusi Reviewed-by: Seppo Ingalsuo Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220712130103.31514-1-peter.ujfalusi@linux= .intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/sof/ipc3-topology.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c index 80fb82ece38d..74c230fbcf68 100644 --- a/sound/soc/sof/ipc3-topology.c +++ b/sound/soc/sof/ipc3-topology.c @@ -1629,6 +1629,7 @@ static int sof_ipc3_control_load_bytes(struct snd_sof= _dev *sdev, struct snd_sof_ return 0; err: kfree(scontrol->ipc_control_data); + scontrol->ipc_control_data =3D NULL; return ret; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E75DBC19F2C for ; Mon, 15 Aug 2022 22:42:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351016AbiHOWlF (ORCPT ); Mon, 15 Aug 2022 18:41:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350610AbiHOWgr (ORCPT ); Mon, 15 Aug 2022 18:36:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAFED7284E; Mon, 15 Aug 2022 12:50:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5A50561280; Mon, 15 Aug 2022 19:50:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56099C433D6; Mon, 15 Aug 2022 19:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593010; bh=9BfOsXGYkTa11M5togV2qruCjwfFzZqEaoB6aX8G2+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yZxQWnuck1tqSU6q7ObMDeihJAREjb2Y4VRNYRojOkfyfBYHmT5h2dWBGbdeUOyTL UuNrLZuxyuN+rlxwbrPzR4M92by4hbVy6HwSBKB41wF4NfKuRjv5R1vx+U6ABn+R2v dNCi/B3qFWkDGgFNyjIg2QEjUq/hb+mGN49Qbj2U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0879/1095] ASoc: audio-graph-card2: Fix refcount leak bug in __graph_get_type() Date: Mon, 15 Aug 2022 20:04:38 +0200 Message-Id: <20220815180505.728162110@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit eda26893dabfc6da7a1e1ff5f8628ed9faab3ab9 ] We should call of_node_put() for the reference before its replacement as it returned by of_get_parent() which has increased the refcount. Besides, we should also call of_node_put() before return. Fixes: c8c74939f791 ("ASoC: audio-graph-card2: add Multi CPU/Codec support") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220713071200.366729-1-windhl@126.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/generic/audio-graph-card2.c | 35 +++++++++++++++++++-------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audi= o-graph-card2.c index 328af836cf53..ba3551d9a040 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -229,7 +229,8 @@ enum graph_type { =20 static enum graph_type __graph_get_type(struct device_node *lnk) { - struct device_node *np; + struct device_node *np, *parent_np; + enum graph_type ret; =20 /* * target { @@ -240,19 +241,33 @@ static enum graph_type __graph_get_type(struct device= _node *lnk) * }; */ np =3D of_get_parent(lnk); - if (of_node_name_eq(np, "ports")) - np =3D of_get_parent(np); + if (of_node_name_eq(np, "ports")) { + parent_np =3D of_get_parent(np); + of_node_put(np); + np =3D parent_np; + } =20 - if (of_node_name_eq(np, GRAPH_NODENAME_MULTI)) - return GRAPH_MULTI; + if (of_node_name_eq(np, GRAPH_NODENAME_MULTI)) { + ret =3D GRAPH_MULTI; + goto out_put; + } =20 - if (of_node_name_eq(np, GRAPH_NODENAME_DPCM)) - return GRAPH_DPCM; + if (of_node_name_eq(np, GRAPH_NODENAME_DPCM)) { + ret =3D GRAPH_DPCM; + goto out_put; + } =20 - if (of_node_name_eq(np, GRAPH_NODENAME_C2C)) - return GRAPH_C2C; + if (of_node_name_eq(np, GRAPH_NODENAME_C2C)) { + ret =3D GRAPH_C2C; + goto out_put; + } + + ret =3D GRAPH_NORMAL; + +out_put: + of_node_put(np); + return ret; =20 - return GRAPH_NORMAL; } =20 static enum graph_type graph_get_type(struct asoc_simple_priv *priv, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DF09C28B2B for ; Mon, 15 Aug 2022 22:42:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351137AbiHOWl2 (ORCPT ); Mon, 15 Aug 2022 18:41:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350726AbiHOWg4 (ORCPT ); Mon, 15 Aug 2022 18:36:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AAD712F720; Mon, 15 Aug 2022 12:50:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CF169B8114E; Mon, 15 Aug 2022 19:50:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3C06C433C1; Mon, 15 Aug 2022 19:50:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593018; bh=YKHQv8ohmk4Xil86jK0EXwiIzBcc1yD6B4GvV0O1SNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DVBxaOOx+BxSLOJlBZjpvb29QowQe3ACJdTjyrg/OiC2Nlg0AvArywQgaapoz0wC/ mcnHmeAG6neKSGTt+IVZpRv6vxG+dmeKi08dYyruNV+XydOqKx4woBQVctVxFqM/PW /nX1zODRh0jrINgQPxRJjxcrsJwl0uRPVvGUk5hg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0880/1095] ASoC: mt6359: Fix refcount leak bug Date: Mon, 15 Aug 2022 20:04:39 +0200 Message-Id: <20220815180505.762202059@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit a8d5df69e2ec702d979f7d04ed519caf8691a032 ] In mt6359_parse_dt() and mt6359_accdet_parse_dt(), we should call of_node_put() for the reference returned by of_get_child_by_name() which has increased the refcount. Fixes: 683530285316 ("ASoC: mt6359: fix failed to parse DT properties") Fixes: eef07b9e0925 ("ASoC: mediatek: mt6359: add MT6359 accdet jack driver= ") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220713102013.367336-1-windhl@126.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/codecs/mt6359-accdet.c | 1 + sound/soc/codecs/mt6359.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-acc= det.c index 6d3d170144a0..c190628e2905 100644 --- a/sound/soc/codecs/mt6359-accdet.c +++ b/sound/soc/codecs/mt6359-accdet.c @@ -675,6 +675,7 @@ static int mt6359_accdet_parse_dt(struct mt6359_accdet = *priv) sizeof(struct three_key_threshold)); } =20 + of_node_put(node); dev_warn(priv->dev, "accdet caps=3D%x\n", priv->caps); =20 return 0; diff --git a/sound/soc/codecs/mt6359.c b/sound/soc/codecs/mt6359.c index f8532aa7e4aa..9a9c8555f720 100644 --- a/sound/soc/codecs/mt6359.c +++ b/sound/soc/codecs/mt6359.c @@ -2780,6 +2780,7 @@ static int mt6359_parse_dt(struct mt6359_priv *priv) =20 ret =3D of_property_read_u32(np, "mediatek,mic-type-2", &priv->mux_select[MUX_MIC_TYPE_2]); + of_node_put(np); if (ret) { dev_info(priv->dev, "%s() failed to read mic-type-2, use default (%d)\n", --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1830AC28B2C for ; Mon, 15 Aug 2022 22:42:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351091AbiHOWlW (ORCPT ); Mon, 15 Aug 2022 18:41:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350695AbiHOWgx (ORCPT ); Mon, 15 Aug 2022 18:36:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB12D72867; Mon, 15 Aug 2022 12:50:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 10223B8106C; Mon, 15 Aug 2022 19:50:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FED6C433C1; Mon, 15 Aug 2022 19:50:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593024; bh=hF+MWjz3NwNhxg062slqc22gSVlrgR4oKLCaB8gyQdo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y6jW55AOcd9npPd0YMh6NsHonPNDUiGhwaJxqj5skM+bz8TnM8U/6j7kLjbeDdX2N nucPXiNpa7DAhKWaC0ajHTgcZJMZaO4HfV8chXBlRXZKrmBrepd1RYg9GSGKQ8AZ1N TrJ/01gzA2CAABEMohpavhdcwzkc9tFpzk91o96M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Doug Berger , Florian Fainelli , Sasha Levin Subject: [PATCH 5.18 0881/1095] serial: 8250_bcm7271: Save/restore RTS in suspend/resume Date: Mon, 15 Aug 2022 20:04:40 +0200 Message-Id: <20220815180505.792379523@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Doug Berger [ Upstream commit 3182efd036c1b955403d131258234896cbd9fbeb ] Commit 9cabe26e65a8 ("serial: 8250_bcm7271: UART errors after resuming from S2") prevented an early enabling of RTS during resume, but it did not actively restore the RTS state after resume. Fixes: 9cabe26e65a8 ("serial: 8250_bcm7271: UART errors after resuming from= S2") Signed-off-by: Doug Berger Signed-off-by: Florian Fainelli Link: https://lore.kernel.org/r/20220714031316.404918-1-f.fainelli@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/serial/8250/8250_bcm7271.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/82= 50/8250_bcm7271.c index 9b878d023dac..8efdc271eb75 100644 --- a/drivers/tty/serial/8250/8250_bcm7271.c +++ b/drivers/tty/serial/8250/8250_bcm7271.c @@ -1139,16 +1139,19 @@ static int __maybe_unused brcmuart_suspend(struct d= evice *dev) struct brcmuart_priv *priv =3D dev_get_drvdata(dev); struct uart_8250_port *up =3D serial8250_get_port(priv->line); struct uart_port *port =3D &up->port; - - serial8250_suspend_port(priv->line); - clk_disable_unprepare(priv->baud_mux_clk); + unsigned long flags; =20 /* * This will prevent resume from enabling RTS before the - * baud rate has been resored. + * baud rate has been restored. */ + spin_lock_irqsave(&port->lock, flags); priv->saved_mctrl =3D port->mctrl; - port->mctrl =3D 0; + port->mctrl &=3D ~TIOCM_RTS; + spin_unlock_irqrestore(&port->lock, flags); + + serial8250_suspend_port(priv->line); + clk_disable_unprepare(priv->baud_mux_clk); =20 return 0; } @@ -1158,6 +1161,7 @@ static int __maybe_unused brcmuart_resume(struct devi= ce *dev) struct brcmuart_priv *priv =3D dev_get_drvdata(dev); struct uart_8250_port *up =3D serial8250_get_port(priv->line); struct uart_port *port =3D &up->port; + unsigned long flags; int ret; =20 ret =3D clk_prepare_enable(priv->baud_mux_clk); @@ -1180,7 +1184,15 @@ static int __maybe_unused brcmuart_resume(struct dev= ice *dev) start_rx_dma(serial8250_get_port(priv->line)); } serial8250_resume_port(priv->line); - port->mctrl =3D priv->saved_mctrl; + + if (priv->saved_mctrl & TIOCM_RTS) { + /* Restore RTS */ + spin_lock_irqsave(&port->lock, flags); + port->mctrl |=3D TIOCM_RTS; + port->ops->set_mctrl(port, port->mctrl); + spin_unlock_irqrestore(&port->lock, flags); + } + return 0; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26D78C25B0E for ; Mon, 15 Aug 2022 22:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350437AbiHOWmi (ORCPT ); Mon, 15 Aug 2022 18:42:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351059AbiHOWhe (ORCPT ); Mon, 15 Aug 2022 18:37:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 711AA123CAB; Mon, 15 Aug 2022 12:50:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 53126B80EAB; Mon, 15 Aug 2022 19:50:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9496BC433C1; Mon, 15 Aug 2022 19:50:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593031; bh=WYd78N6+cGqCZNCDwJNGzu9MD4xA9L78/Pgyr6dMArg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IfvZY7xXj1MOUpeC3PHay8Bo9iNLk6gTm44cMHji+TB/2X0+etxn4ZtPHA1hjkbPF 1KC+DqTK2UIEdm57K10N793HlZlAIiXPOVTwSXMiu5g5xi2mj5aCRpZ6P1tmXlkivd yeYrUTiwSEcO4jiCiGZGnvPSsfkG2XyXV6iJ8xqM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sam Protsenko , Krzysztof Kozlowski , Marek Szyprowski , Joerg Roedel , Sasha Levin Subject: [PATCH 5.18 0882/1095] iommu/exynos: Handle failed IOMMU device registration properly Date: Mon, 15 Aug 2022 20:04:41 +0200 Message-Id: <20220815180505.830831911@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sam Protsenko [ Upstream commit fce398d2d02c0a9a2bedf7c7201b123e153e8963 ] If iommu_device_register() fails in exynos_sysmmu_probe(), the previous calls have to be cleaned up. In this case, the iommu_device_sysfs_add() should be cleaned up, by calling its remove counterpart call. Fixes: d2c302b6e8b1 ("iommu/exynos: Make use of iommu_device_register inter= face") Signed-off-by: Sam Protsenko Reviewed-by: Krzysztof Kozlowski Acked-by: Marek Szyprowski Link: https://lore.kernel.org/r/20220714165550.8884-3-semen.protsenko@linar= o.org Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iommu/exynos-iommu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 71f2018e23fe..cd4b889d5537 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -630,7 +630,7 @@ static int exynos_sysmmu_probe(struct platform_device *= pdev) =20 ret =3D iommu_device_register(&data->iommu, &exynos_iommu_ops, dev); if (ret) - return ret; + goto err_iommu_register; =20 platform_set_drvdata(pdev, data); =20 @@ -657,6 +657,10 @@ static int exynos_sysmmu_probe(struct platform_device = *pdev) pm_runtime_enable(dev); =20 return 0; + +err_iommu_register: + iommu_device_sysfs_remove(&data->iommu); + return ret; } =20 static int __maybe_unused exynos_sysmmu_suspend(struct device *dev) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E07A0C32764 for ; Mon, 15 Aug 2022 22:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351441AbiHOWmR (ORCPT ); Mon, 15 Aug 2022 18:42:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350971AbiHOWhY (ORCPT ); Mon, 15 Aug 2022 18:37:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3EB438B5; Mon, 15 Aug 2022 12:50:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D397161206; Mon, 15 Aug 2022 19:50:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7410CC433D6; Mon, 15 Aug 2022 19:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593040; bh=cxXucUSZz/3hhprAB3D1nyqJ+G2drWUuZmqO81cbMuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bQcBh2d5E5j73MXWSdQxBcsQz3ErB/glsor7/7OdrnCeYedtVSrA68TILX8MiMgxy bZV2X//8TrwTINh2+yU8p7LMYJEKMqPX47p6Nhspx99OivAdOyAZKcHsqlE7gcs29I nNVPemlCPg1fvCUAvokW9gv/J5zCmIWawoPD3nIU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kent Overstreet , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Sasha Levin Subject: [PATCH 5.18 0883/1095] 9p: Drop kref usage Date: Mon, 15 Aug 2022 20:04:42 +0200 Message-Id: <20220815180505.870121290@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kent Overstreet [ Upstream commit 6cda12864cb0f99810a5809e11e3ee5b102c9a47 ] An upcoming patch is going to require passing the client through p9_req_put() -> p9_req_free(), but that's awkward with the kref indirection - so this patch switches to using refcount_t directly. Link: https://lkml.kernel.org/r/20220704014243.153050-1-kent.overstreet@gma= il.com Signed-off-by: Kent Overstreet Cc: Eric Van Hensbergen Cc: Latchesar Ionkov Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/net/9p/client.h | 6 +++--- net/9p/client.c | 19 ++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/include/net/9p/client.h b/include/net/9p/client.h index ec1d1706f43c..c038c2d73dae 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h @@ -76,7 +76,7 @@ enum p9_req_status_t { struct p9_req_t { int status; int t_err; - struct kref refcount; + refcount_t refcount; wait_queue_head_t wq; struct p9_fcall tc; struct p9_fcall rc; @@ -227,12 +227,12 @@ struct p9_req_t *p9_tag_lookup(struct p9_client *c, u= 16 tag); =20 static inline void p9_req_get(struct p9_req_t *r) { - kref_get(&r->refcount); + refcount_inc(&r->refcount); } =20 static inline int p9_req_try_get(struct p9_req_t *r) { - return kref_get_unless_zero(&r->refcount); + return refcount_inc_not_zero(&r->refcount); } =20 int p9_req_put(struct p9_req_t *r); diff --git a/net/9p/client.c b/net/9p/client.c index 8bba0d9cf975..0ee48e8b7220 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -305,7 +305,7 @@ p9_tag_alloc(struct p9_client *c, int8_t type, unsigned= int max_size) * callback), so p9_client_cb eats the second ref there * as the pointer is duplicated directly by virtqueue_add_sgs() */ - refcount_set(&req->refcount.refcount, 2); + refcount_set(&req->refcount, 2); =20 return req; =20 @@ -370,18 +370,15 @@ static int p9_tag_remove(struct p9_client *c, struct = p9_req_t *r) return p9_req_put(r); } =20 -static void p9_req_free(struct kref *ref) -{ - struct p9_req_t *r =3D container_of(ref, struct p9_req_t, refcount); - - p9_fcall_fini(&r->tc); - p9_fcall_fini(&r->rc); - kmem_cache_free(p9_req_cache, r); -} - int p9_req_put(struct p9_req_t *r) { - return kref_put(&r->refcount, p9_req_free); + if (refcount_dec_and_test(&r->refcount)) { + p9_fcall_fini(&r->tc); + p9_fcall_fini(&r->rc); + kmem_cache_free(p9_req_cache, r); + return 1; + } + return 0; } EXPORT_SYMBOL(p9_req_put); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72604C00140 for ; Mon, 15 Aug 2022 22:42:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350457AbiHOWmn (ORCPT ); Mon, 15 Aug 2022 18:42:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351073AbiHOWhf (ORCPT ); Mon, 15 Aug 2022 18:37:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B48D124F76; Mon, 15 Aug 2022 12:50:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 80959B80EAD; Mon, 15 Aug 2022 19:50:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F2CCC433D6; Mon, 15 Aug 2022 19:50:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593047; bh=OzGh4v5whBxSM1JhKPbTSzZNaqPnHVezCDzCwzOea2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R2J+Al56voI2CNSjEzmID7P0FwpNvkaAxm/aAycP8ZgsKUghxpbtXHvj+ZyNTXQki 9wRtP/Psr7/WK2kZ6OpWAVPOUm90x+1DKDj9THeQH3YpBVTnhKYRSvYH/FDF4ZgMxK +71NV+NMfS6M+UhrDdrhthMubWCFttkaKklCSevg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kent Overstreet , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Sasha Levin Subject: [PATCH 5.18 0884/1095] 9p: Add client parameter to p9_req_put() Date: Mon, 15 Aug 2022 20:04:43 +0200 Message-Id: <20220815180505.913286632@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kent Overstreet [ Upstream commit 8b11ff098af42b1fa57fc817daadd53c8b244a0c ] This is to aid in adding mempools, in the next patch. Link: https://lkml.kernel.org/r/20220704014243.153050-2-kent.overstreet@gma= il.com Signed-off-by: Kent Overstreet Cc: Eric Van Hensbergen Cc: Latchesar Ionkov Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/net/9p/client.h | 2 +- net/9p/client.c | 12 ++++++------ net/9p/trans_fd.c | 12 ++++++------ net/9p/trans_rdma.c | 2 +- net/9p/trans_virtio.c | 4 ++-- net/9p/trans_xen.c | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/net/9p/client.h b/include/net/9p/client.h index c038c2d73dae..cb78e0e33332 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h @@ -235,7 +235,7 @@ static inline int p9_req_try_get(struct p9_req_t *r) return refcount_inc_not_zero(&r->refcount); } =20 -int p9_req_put(struct p9_req_t *r); +int p9_req_put(struct p9_client *c, struct p9_req_t *r); =20 void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status); =20 diff --git a/net/9p/client.c b/net/9p/client.c index 0ee48e8b7220..a36a40137caa 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -341,7 +341,7 @@ struct p9_req_t *p9_tag_lookup(struct p9_client *c, u16= tag) if (!p9_req_try_get(req)) goto again; if (req->tc.tag !=3D tag) { - p9_req_put(req); + p9_req_put(c, req); goto again; } } @@ -367,10 +367,10 @@ static int p9_tag_remove(struct p9_client *c, struct = p9_req_t *r) spin_lock_irqsave(&c->lock, flags); idr_remove(&c->reqs, tag); spin_unlock_irqrestore(&c->lock, flags); - return p9_req_put(r); + return p9_req_put(c, r); } =20 -int p9_req_put(struct p9_req_t *r) +int p9_req_put(struct p9_client *c, struct p9_req_t *r) { if (refcount_dec_and_test(&r->refcount)) { p9_fcall_fini(&r->tc); @@ -423,7 +423,7 @@ void p9_client_cb(struct p9_client *c, struct p9_req_t = *req, int status) =20 wake_up(&req->wq); p9_debug(P9_DEBUG_MUX, "wakeup: %d\n", req->tc.tag); - p9_req_put(req); + p9_req_put(c, req); } EXPORT_SYMBOL(p9_client_cb); =20 @@ -706,7 +706,7 @@ static struct p9_req_t *p9_client_prepare_req(struct p9= _client *c, reterr: p9_tag_remove(c, req); /* We have to put also the 2nd reference as it won't be used */ - p9_req_put(req); + p9_req_put(c, req); return ERR_PTR(err); } =20 @@ -743,7 +743,7 @@ p9_client_rpc(struct p9_client *c, int8_t type, const c= har *fmt, ...) err =3D c->trans_mod->request(c, req); if (err < 0) { /* write won't happen */ - p9_req_put(req); + p9_req_put(c, req); if (err !=3D -ERESTARTSYS && err !=3D -EFAULT) c->status =3D Disconnected; goto recalc_sigpending; diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index 8f8f95e39b03..007c3f45fe05 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -378,7 +378,7 @@ static void p9_read_work(struct work_struct *work) m->rc.sdata =3D NULL; m->rc.offset =3D 0; m->rc.capacity =3D 0; - p9_req_put(m->rreq); + p9_req_put(m->client, m->rreq); m->rreq =3D NULL; } =20 @@ -492,7 +492,7 @@ static void p9_write_work(struct work_struct *work) m->wpos +=3D err; if (m->wpos =3D=3D m->wsize) { m->wpos =3D m->wsize =3D 0; - p9_req_put(m->wreq); + p9_req_put(m->client, m->wreq); m->wreq =3D NULL; } =20 @@ -695,7 +695,7 @@ static int p9_fd_cancel(struct p9_client *client, struc= t p9_req_t *req) if (req->status =3D=3D REQ_STATUS_UNSENT) { list_del(&req->req_list); req->status =3D REQ_STATUS_FLSHD; - p9_req_put(req); + p9_req_put(client, req); ret =3D 0; } spin_unlock(&client->lock); @@ -722,7 +722,7 @@ static int p9_fd_cancelled(struct p9_client *client, st= ruct p9_req_t *req) list_del(&req->req_list); req->status =3D REQ_STATUS_FLSHD; spin_unlock(&client->lock); - p9_req_put(req); + p9_req_put(client, req); =20 return 0; } @@ -883,12 +883,12 @@ static void p9_conn_destroy(struct p9_conn *m) p9_mux_poll_stop(m); cancel_work_sync(&m->rq); if (m->rreq) { - p9_req_put(m->rreq); + p9_req_put(m->client, m->rreq); m->rreq =3D NULL; } cancel_work_sync(&m->wq); if (m->wreq) { - p9_req_put(m->wreq); + p9_req_put(m->client, m->wreq); m->wreq =3D NULL; } =20 diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c index 88e563826674..d817d3745238 100644 --- a/net/9p/trans_rdma.c +++ b/net/9p/trans_rdma.c @@ -350,7 +350,7 @@ send_done(struct ib_cq *cq, struct ib_wc *wc) c->busa, c->req->tc.size, DMA_TO_DEVICE); up(&rdma->sq_sem); - p9_req_put(c->req); + p9_req_put(client, c->req); kfree(c); } =20 diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index b24a4fb0f0a2..147972bf2e79 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -199,7 +199,7 @@ static int p9_virtio_cancel(struct p9_client *client, s= truct p9_req_t *req) /* Reply won't come, so drop req ref */ static int p9_virtio_cancelled(struct p9_client *client, struct p9_req_t *= req) { - p9_req_put(req); + p9_req_put(client, req); return 0; } =20 @@ -523,7 +523,7 @@ p9_virtio_zc_request(struct p9_client *client, struct p= 9_req_t *req, kvfree(out_pages); if (!kicked) { /* reply won't come */ - p9_req_put(req); + p9_req_put(client, req); } return err; } diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c index 77883b6788cd..4cf0c78d4d22 100644 --- a/net/9p/trans_xen.c +++ b/net/9p/trans_xen.c @@ -163,7 +163,7 @@ static int p9_xen_request(struct p9_client *client, str= uct p9_req_t *p9_req) ring->intf->out_prod =3D prod; spin_unlock_irqrestore(&ring->lock, flags); notify_remote_via_irq(ring->irq); - p9_req_put(p9_req); + p9_req_put(client, p9_req); =20 return 0; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58FBDC00140 for ; Mon, 15 Aug 2022 22:43:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351034AbiHOWnU (ORCPT ); Mon, 15 Aug 2022 18:43:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351319AbiHOWh6 (ORCPT ); Mon, 15 Aug 2022 18:37:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 904251322CA; Mon, 15 Aug 2022 12:51:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 93D13B81141; Mon, 15 Aug 2022 19:50:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 000D0C433D6; Mon, 15 Aug 2022 19:50:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593053; bh=D6XnQg1CsGu7Vx9lk0X2XQu5E8oNyv90wVb7G96iflc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HtbROdUiLvTReYZFuCP3u0X3IbYWRC3Xq3e1w0bjwytEBapbnQTnDHXVscy3DfpAk JZjW5FYTqSxKF8M/hTtQBm6I0vzQs1OsNYGt9xExH4iYlzCKgcjAFkKOubLvmW4XZg 0Ga6lWQaKmv5sxg+gHG0ZrkwZCM1gPzWC1spRkxc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Dominique Martinet , Sasha Levin Subject: [PATCH 5.18 0885/1095] net: 9p: fix refcount leak in p9_read_work() error handling Date: Mon, 15 Aug 2022 20:04:44 +0200 Message-Id: <20220815180505.952394593@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hangyu Hua [ Upstream commit 4ac7573e1f9333073fa8d303acc941c9b7ab7f61 ] p9_req_put need to be called when m->rreq->rc.sdata is NULL to avoid temporary refcount leak. Link: https://lkml.kernel.org/r/20220712104438.30800-1-hbh25y@gmail.com Fixes: 728356dedeff ("9p: Add refcount to p9_req_t") Signed-off-by: Hangyu Hua [Dominique: commit wording adjustments, p9_req_put argument fixes for rebas= e] Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/9p/trans_fd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index 007c3f45fe05..e758978b44be 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -343,6 +343,7 @@ static void p9_read_work(struct work_struct *work) p9_debug(P9_DEBUG_ERROR, "No recv fcall for tag %d (req %p), disconnecting!\n", m->rc.tag, m->rreq); + p9_req_put(m->client, m->rreq); m->rreq =3D NULL; err =3D -EIO; goto error; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E44AC00140 for ; Mon, 15 Aug 2022 22:43:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351218AbiHOWn0 (ORCPT ); Mon, 15 Aug 2022 18:43:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351322AbiHOWh6 (ORCPT ); Mon, 15 Aug 2022 18:37:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77A9C1322FE; Mon, 15 Aug 2022 12:51:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4F7FA61206; Mon, 15 Aug 2022 19:51:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3039CC433C1; Mon, 15 Aug 2022 19:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593059; bh=f1yBoZdlxrrj+e56t5SpYyY3+I6Cwa8ohg4maem5XqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tf9sFFkKdx/lqKJtIVQZj0n3FcnqYVfZ8fmSnhiy3CoqVK4YZfZ0nrweKZIKGJb7H L/WhkuV/v08g/u+VPKhAzlk+IJo48CjgLE2Vy6ALsalT9bWv5lZReTLOSvZDdf9tnU 0MGhtZr4NELe01nchIoUgfEtAcxZnhD/UzHMYWzU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Serge Semin , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.18 0886/1095] MIPS: Fixed __debug_virt_addr_valid() Date: Mon, 15 Aug 2022 20:04:45 +0200 Message-Id: <20220815180505.990184416@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Fainelli [ Upstream commit 8a2b456665d1e797123669581524cbb095fb003b ] It is permissible for kernel code to call virt_to_phys() against virtual addresses that are in KSEG0 or KSEG1 and we need to be dealing with both types. Rewrite the test condition to ensure that the kernel virtual addresses are above PAGE_OFFSET which they must be, and below KSEG2 where the non-linear mapping starts. For EVA, there is not much that we can do given the linear address range that is offered, so just return any virtual address as being valid. Finally, when HIGHMEM is not enabled, all virtual addresses are assumed to be valid as well. Fixes: dfad83cb7193 ("MIPS: Add support for CONFIG_DEBUG_VIRTUAL") Signed-off-by: Florian Fainelli Reviewed-by: Serge Semin Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/mips/mm/physaddr.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/mips/mm/physaddr.c b/arch/mips/mm/physaddr.c index a1ced5e44951..f9b8c85e9843 100644 --- a/arch/mips/mm/physaddr.c +++ b/arch/mips/mm/physaddr.c @@ -5,6 +5,7 @@ #include #include =20 +#include #include #include #include @@ -12,15 +13,6 @@ =20 static inline bool __debug_virt_addr_valid(unsigned long x) { - /* high_memory does not get immediately defined, and there - * are early callers of __pa() against PAGE_OFFSET - */ - if (!high_memory && x >=3D PAGE_OFFSET) - return true; - - if (high_memory && x >=3D PAGE_OFFSET && x < (unsigned long)high_memory) - return true; - /* * MAX_DMA_ADDRESS is a virtual address that may not correspond to an * actual physical address. Enough code relies on @@ -30,7 +22,9 @@ static inline bool __debug_virt_addr_valid(unsigned long = x) if (x =3D=3D MAX_DMA_ADDRESS) return true; =20 - return false; + return x >=3D PAGE_OFFSET && (KSEGX(x) < KSEG2 || + IS_ENABLED(CONFIG_EVA) || + !IS_ENABLED(CONFIG_HIGHMEM)); } =20 phys_addr_t __virt_to_phys(volatile const void *x) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73E1AC00140 for ; Mon, 15 Aug 2022 22:43:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351386AbiHOWnp (ORCPT ); Mon, 15 Aug 2022 18:43:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351364AbiHOWiD (ORCPT ); Mon, 15 Aug 2022 18:38:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C20D013263E; Mon, 15 Aug 2022 12:51:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3DBFD6122B; Mon, 15 Aug 2022 19:51:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 468DCC433D6; Mon, 15 Aug 2022 19:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593065; bh=Da0gbbdZzQ1GHA0R171QoB/svWQr1XAmx/vQ/xxRN9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ABT+zv6HQKN2PWzFlc4pmNYzZ//+UPTM8SA4sHgXPis7LyPQNPuhNW5EBNTF2tWiv CEGEzb2vejhF8OHiAmF24xVGVB65OMCVK3WMMnwQrIa+8V9X79ip/i4asAZ+u4bFiv nu/X9ypaf/Mz95eW5ggw+WykCa4rABDhCADMke2I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0887/1095] rpmsg: qcom_smd: Fix refcount leak in qcom_smd_parse_edge Date: Mon, 15 Aug 2022 20:04:46 +0200 Message-Id: <20220815180506.030325207@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 65382585f067d4256ba087934f30f85c9b6984de ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Fixes: 53e2822e56c7 ("rpmsg: Introduce Qualcomm SMD backend") Signed-off-by: Miaoqian Lin Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220511120737.57374-1-linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/rpmsg/qcom_smd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c index 1957b27c4cf3..f7af53891ef9 100644 --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -1383,6 +1383,7 @@ static int qcom_smd_parse_edge(struct device *dev, } =20 edge->ipc_regmap =3D syscon_node_to_regmap(syscon_np); + of_node_put(syscon_np); if (IS_ERR(edge->ipc_regmap)) { ret =3D PTR_ERR(edge->ipc_regmap); goto put_node; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DF7BC00140 for ; Mon, 15 Aug 2022 22:43:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351414AbiHOWnt (ORCPT ); Mon, 15 Aug 2022 18:43:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349654AbiHOWib (ORCPT ); Mon, 15 Aug 2022 18:38:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D06D72EF1; Mon, 15 Aug 2022 12:51:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 322A2B80EA9; Mon, 15 Aug 2022 19:51:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D084C433D6; Mon, 15 Aug 2022 19:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593074; bh=JLzz5dq88jRbBg6ItZt/44TfxmNsOXXimPAGwGAhAmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LwEBUxUmt89ReIq91HbG3cJz0hTT8NlCJcN8HX63j6XDeE9nS9o1/iZP7Y2XoTocW Zjt6MfAEOFPwkw/rHC0/st1ZozZoPKhZD+Lk0MpEdN6a5WFQJad341coUnMzzh3VOb +07VenOjkFRm4wGGHQ+jWBbYO5jsadI4UXJLYpYo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Stefani Seibold , Randy Dunlap , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 0888/1095] kfifo: fix kfifo_to_user() return type Date: Mon, 15 Aug 2022 20:04:47 +0200 Message-Id: <20220815180506.061462353@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 045ed31e23aea840648c290dbde04797064960db ] The kfifo_to_user() macro is supposed to return zero for success or negative error codes. Unfortunately, there is a signedness bug so it returns unsigned int. This only affects callers which try to save the result in ssize_t and as far as I can see the only place which does that is line6_hwdep_read(). TL;DR: s/_uint/_int/. Link: https://lkml.kernel.org/r/YrVL3OJVLlNhIMFs@kili Fixes: 144ecf310eb5 ("kfifo: fix kfifo_alloc() to return a signed int value= ") Signed-off-by: Dan Carpenter Cc: Stefani Seibold Cc: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/kfifo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index 86249476b57f..0b35a41440ff 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h @@ -688,7 +688,7 @@ __kfifo_uint_must_check_helper( \ * writer, you don't need extra locking to use these macro. */ #define kfifo_to_user(fifo, to, len, copied) \ -__kfifo_uint_must_check_helper( \ +__kfifo_int_must_check_helper( \ ({ \ typeof((fifo) + 1) __tmp =3D (fifo); \ void __user *__to =3D (to); \ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BFD4C25B08 for ; Mon, 15 Aug 2022 22:44:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350459AbiHOWoF (ORCPT ); Mon, 15 Aug 2022 18:44:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350177AbiHOWi7 (ORCPT ); Mon, 15 Aug 2022 18:38:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A205D7333A; Mon, 15 Aug 2022 12:51:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E535F61231; Mon, 15 Aug 2022 19:51:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D17E1C433C1; Mon, 15 Aug 2022 19:51:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593081; bh=ZlNZIoT0xcoVZ4uXOg7Rh64aSqYXluwZIxnpm37NvZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lu8tK1LD72Uwv17ymOPA0lChmLhO421nX4fdhQAc4aO728X5zAiSXNxFaE0iyTsNI GdFIEuzOFTBZMDHUbqasdoM0pTYVuIBUNqJTjyZcZZhydiQ9UsJ9t50JX5+f4XlY6g dTzanmIPxXZqemK0iTyHFH7IJpAUifSvO3GzG3dw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tetsuo Handa , Thomas Gleixner , Alexandre Chartre , Peter Zijlstra , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 0889/1095] lib/smp_processor_id: fix imbalanced instrumentation_end() call Date: Mon, 15 Aug 2022 20:04:48 +0200 Message-Id: <20220815180506.110894226@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tetsuo Handa [ Upstream commit bd27acaac24e4b252ee28dddcabaee80456d0faf ] Currently instrumentation_end() won't be called if printk_ratelimit() returned false. Link: https://lkml.kernel.org/r/a636d8e0-ad32-5888-acac-671f7f553bb3@I-love= .SAKURA.ne.jp Fixes: 126f21f0e8d46e2c ("lib/smp_processor_id: Move it into noinstr sectio= n") Signed-off-by: Tetsuo Handa Cc: Thomas Gleixner Cc: Alexandre Chartre Cc: Peter Zijlstra Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- lib/smp_processor_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c index 046ac6297c78..a2bb7738c373 100644 --- a/lib/smp_processor_id.c +++ b/lib/smp_processor_id.c @@ -47,9 +47,9 @@ unsigned int check_preemption_disabled(const char *what1,= const char *what2) =20 printk("caller is %pS\n", __builtin_return_address(0)); dump_stack(); - instrumentation_end(); =20 out_enable: + instrumentation_end(); preempt_enable_no_resched_notrace(); out: return this_cpu; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85F6FC00140 for ; Mon, 15 Aug 2022 22:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345925AbiHOW5Q (ORCPT ); Mon, 15 Aug 2022 18:57:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352157AbiHOWzC (ORCPT ); Mon, 15 Aug 2022 18:55:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACA4C13AE32; Mon, 15 Aug 2022 12:55:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3568CB80EAB; Mon, 15 Aug 2022 19:55:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DFA8C433D7; Mon, 15 Aug 2022 19:55:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593300; bh=6kVTsHDfqSBBieDiq067IeUSj0Sy/zFJ5IjIuydqhf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jgqbbDCQ7Hcz2Xm8w7rrLswK1asGJIUOyWf9k2FHcat4etiQzMBLaV6QPMt0oKLwj yXp0sAOGFTKELLb22z1AX2Oa053DQpuBOV5pLtuLT27V+DjazQlle8kWMkTQB3oAfg 4NqBB5pwNVDv18yA+iYFbJfAn5G0U7fWjBLg2nus= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Zhang Yi , Brian Foster , Al Viro , Alexey Dobriyan , Eric Biederman , Matthew Wilcox , Baoquan He , Kalesh Singh , Yu Kuai , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 0890/1095] proc: fix a dentry lock race between release_task and lookup Date: Mon, 15 Aug 2022 20:04:49 +0200 Message-Id: <20220815180506.146166874@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhihao Cheng [ Upstream commit d919a1e79bac890421537cf02ae773007bf55e6b ] Commit 7bc3e6e55acf06 ("proc: Use a list of inodes to flush from proc") moved proc_flush_task() behind __exit_signal(). Then, process systemd can take long period high cpu usage during releasing task in following concurrent processes: systemd ps kernel_waitid stat(/proc/tgid) do_wait filename_lookup wait_consider_task lookup_fast release_task __exit_signal __unhash_process detach_pid __change_pid // remove task->pid_links d_revalidate -> pid_revalidate // 0 d_invalidate(/proc/tgid) shrink_dcache_parent(/proc/tgid) d_walk(/proc/tgid) spin_lock_nested(/proc/tgid/fd) // iterating opened fd proc_flush_pid | d_invalidate (/proc/tgid/fd) | shrink_dcache_parent(/proc/tgid/fd) | shrink_dentry_list(subdirs) =E2=86=93 shrink_lock_dentry(/proc/tgid/fd) --> race on dentry lock Function d_invalidate() will remove dentry from hash firstly, but why does proc_flush_pid() process dentry '/proc/tgid/fd' before dentry '/proc/tgid'? That's because proc_pid_make_inode() adds proc inode in reverse order by invoking hlist_add_head_rcu(). But proc should not add any inodes under '/proc/tgid' except '/proc/tgid/task/pid', fix it by adding inode into 'pid->inodes' only if the inode is /proc/tgid or /proc/tgid/task/pid. Performance regression: Create 200 tasks, each task open one file for 50,000 times. Kill all tasks when opened files exceed 10,000,000 (cat /proc/sys/fs/file-nr). Before fix: $ time killall -wq aa real 4m40.946s # During this period, we can see 'ps' and 'systemd' taking high cpu usage. After fix: $ time killall -wq aa real 1m20.732s # During this period, we can see 'systemd' taking high cpu usage. Link: https://lkml.kernel.org/r/20220713130029.4133533-1-chengzhihao1@huawe= i.com Fixes: 7bc3e6e55acf06 ("proc: Use a list of inodes to flush from proc") Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216054 Signed-off-by: Zhihao Cheng Signed-off-by: Zhang Yi Suggested-by: Brian Foster Reviewed-by: Brian Foster Cc: Al Viro Cc: Alexey Dobriyan Cc: Eric Biederman Cc: Matthew Wilcox Cc: Baoquan He Cc: Kalesh Singh Cc: Yu Kuai Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/proc/base.c | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index c1031843cc6a..2f0595e8ec4a 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -1885,7 +1885,7 @@ void proc_pid_evict_inode(struct proc_inode *ei) put_pid(pid); } =20 -struct inode *proc_pid_make_inode(struct super_block * sb, +struct inode *proc_pid_make_inode(struct super_block *sb, struct task_struct *task, umode_t mode) { struct inode * inode; @@ -1914,11 +1914,6 @@ struct inode *proc_pid_make_inode(struct super_block= * sb, =20 /* Let the pid remember us for quick removal */ ei->pid =3D pid; - if (S_ISDIR(mode)) { - spin_lock(&pid->lock); - hlist_add_head_rcu(&ei->sibling_inodes, &pid->inodes); - spin_unlock(&pid->lock); - } =20 task_dump_owner(task, 0, &inode->i_uid, &inode->i_gid); security_task_to_inode(task, inode); @@ -1931,6 +1926,39 @@ struct inode *proc_pid_make_inode(struct super_block= * sb, return NULL; } =20 +/* + * Generating an inode and adding it into @pid->inodes, so that task will + * invalidate inode's dentry before being released. + * + * This helper is used for creating dir-type entries under '/proc' and + * '/proc//task'. Other entries(eg. fd, stat) under '/proc/' + * can be released by invalidating '/proc/' dentry. + * In theory, dentries under '/proc//task' can also be released by + * invalidating '/proc/' dentry, we reserve it to handle single + * thread exiting situation: Any one of threads should invalidate its + * '/proc//task/' dentry before released. + */ +static struct inode *proc_pid_make_base_inode(struct super_block *sb, + struct task_struct *task, umode_t mode) +{ + struct inode *inode; + struct proc_inode *ei; + struct pid *pid; + + inode =3D proc_pid_make_inode(sb, task, mode); + if (!inode) + return NULL; + + /* Let proc_flush_pid find this directory inode */ + ei =3D PROC_I(inode); + pid =3D ei->pid; + spin_lock(&pid->lock); + hlist_add_head_rcu(&ei->sibling_inodes, &pid->inodes); + spin_unlock(&pid->lock); + + return inode; +} + int pid_getattr(struct user_namespace *mnt_userns, const struct path *path, struct kstat *stat, u32 request_mask, unsigned int query_flags) { @@ -3350,7 +3378,8 @@ static struct dentry *proc_pid_instantiate(struct den= try * dentry, { struct inode *inode; =20 - inode =3D proc_pid_make_inode(dentry->d_sb, task, S_IFDIR | S_IRUGO | S_I= XUGO); + inode =3D proc_pid_make_base_inode(dentry->d_sb, task, + S_IFDIR | S_IRUGO | S_IXUGO); if (!inode) return ERR_PTR(-ENOENT); =20 @@ -3649,7 +3678,8 @@ static struct dentry *proc_task_instantiate(struct de= ntry *dentry, struct task_struct *task, const void *ptr) { struct inode *inode; - inode =3D proc_pid_make_inode(dentry->d_sb, task, S_IFDIR | S_IRUGO | S_I= XUGO); + inode =3D proc_pid_make_base_inode(dentry->d_sb, task, + S_IFDIR | S_IRUGO | S_IXUGO); if (!inode) return ERR_PTR(-ENOENT); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE716C00140 for ; Mon, 15 Aug 2022 22:44:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351104AbiHOWo6 (ORCPT ); Mon, 15 Aug 2022 18:44:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350625AbiHOWkE (ORCPT ); Mon, 15 Aug 2022 18:40:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F51438B8; Mon, 15 Aug 2022 12:51:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E95A6B8106C; Mon, 15 Aug 2022 19:51:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45CA6C433D6; Mon, 15 Aug 2022 19:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593100; bh=LoJSHb0qrQT8UqNWxvAx8oeRvfZkHYrRPDuDsS5KUgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RX5YVGWXbTbmGI9olyTuCRACteaVrY14bH5lF5dY4l5WpuutSEtpV9VTTpKUKTgSY deCOleJTjZzK6RQC0HBuSJhzhwwtwMTg4qAL0Mkp6NmdHuk1zgQesKQeBzdIe/ZW9D JMpK4G0d6fIib0wycPBpRo5/dH7iCReg/d7Qm24c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Siddharth Gupta , Sibi Sankar , Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0891/1095] remoteproc: qcom: pas: Check if coredump is enabled Date: Mon, 15 Aug 2022 20:04:50 +0200 Message-Id: <20220815180506.184300424@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Siddharth Gupta [ Upstream commit 7b6ece968fca4ec9e42d34caff7e06dc84c45717 ] Client drivers need to check if coredump is enabled for the rproc before continuing with coredump generation. This change adds a check in the PAS driver. Fixes: 8ed8485c4f05 ("remoteproc: qcom: Add capability to collect minidumps= ") Signed-off-by: Siddharth Gupta Signed-off-by: Sibi Sankar Reviewed-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/1657022900-2049-5-git-send-email-quic_sibis= @quicinc.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/remoteproc/qcom_q6v5_pas.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q= 6v5_pas.c index 1ae47cc153e5..e7765bbe17a0 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -87,6 +87,9 @@ static void adsp_minidump(struct rproc *rproc) { struct qcom_adsp *adsp =3D rproc->priv; =20 + if (rproc->dump_conf =3D=3D RPROC_COREDUMP_DISABLED) + return; + qcom_minidump(rproc, adsp->minidump_id); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 977D1C00140 for ; Mon, 15 Aug 2022 22:48:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351635AbiHOWqC (ORCPT ); Mon, 15 Aug 2022 18:46:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350430AbiHOWmh (ORCPT ); Mon, 15 Aug 2022 18:42:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5CDA74346; Mon, 15 Aug 2022 12:52:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 038A261206; Mon, 15 Aug 2022 19:52:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F224AC433D6; Mon, 15 Aug 2022 19:52:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593135; bh=0uKQ4XlDoVmec3sjjPuLPu/Rai684n2yPKBqpnW4JQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uElSEXc4s1UrVFjTMkhUubkm/L2ipAZDJdCdXvO8dw/V6yDNzekjt8sAbym5Xknke fwH9Pp+aEjQTgM9iJRKIi72D98fOEGtMUhVNd6rhVyVkzQWg7Q7FU0OBBiKgGHZACc kZCMN2CfpZV1rufJPKosVQEU7mhQ+QJCYYQ1S/mE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Kaehlcke , Sibi Sankar , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0892/1095] remoteproc: sysmon: Wait for SSCTL service to come up Date: Mon, 15 Aug 2022 20:04:51 +0200 Message-Id: <20220815180506.232156171@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sibi Sankar [ Upstream commit 47c04e00eff86a81cd357c3feed04c86089bcb85 ] The SSCTL service comes up after a finite time when the remote Q6 comes out of reset. Any graceful shutdowns requested during this period will be a NOP and abrupt tearing down of the glink channel might lead to pending transactions on the remote Q6 side and will ultimately lead to a fatal error. Fix this by waiting for the SSCTL service when a graceful shutdown is requested. Fixes: 1fb82ee806d1 ("remoteproc: qcom: Introduce sysmon") Reviewed-by: Matthias Kaehlcke Signed-off-by: Sibi Sankar Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/1657022900-2049-7-git-send-email-quic_sibis= @quicinc.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/remoteproc/qcom_sysmon.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/remoteproc/qcom_sysmon.c b/drivers/remoteproc/qcom_sys= mon.c index 9fca81492863..a9f04dd83ab6 100644 --- a/drivers/remoteproc/qcom_sysmon.c +++ b/drivers/remoteproc/qcom_sysmon.c @@ -41,6 +41,7 @@ struct qcom_sysmon { struct completion comp; struct completion ind_comp; struct completion shutdown_comp; + struct completion ssctl_comp; struct mutex lock; =20 bool ssr_ack; @@ -445,6 +446,8 @@ static int ssctl_new_server(struct qmi_handle *qmi, str= uct qmi_service *svc) =20 svc->priv =3D sysmon; =20 + complete(&sysmon->ssctl_comp); + return 0; } =20 @@ -501,6 +504,7 @@ static int sysmon_start(struct rproc_subdev *subdev) .ssr_event =3D SSCTL_SSR_EVENT_AFTER_POWERUP }; =20 + reinit_completion(&sysmon->ssctl_comp); mutex_lock(&sysmon->state_lock); sysmon->state =3D SSCTL_SSR_EVENT_AFTER_POWERUP; blocking_notifier_call_chain(&sysmon_notifiers, 0, (void *)&event); @@ -545,6 +549,11 @@ static void sysmon_stop(struct rproc_subdev *subdev, b= ool crashed) if (crashed) return; =20 + if (sysmon->ssctl_instance) { + if (!wait_for_completion_timeout(&sysmon->ssctl_comp, HZ / 2)) + dev_err(sysmon->dev, "timeout waiting for ssctl service\n"); + } + if (sysmon->ssctl_version) sysmon->shutdown_acked =3D ssctl_request_shutdown(sysmon); else if (sysmon->ept) @@ -631,6 +640,7 @@ struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc= *rproc, init_completion(&sysmon->comp); init_completion(&sysmon->ind_comp); init_completion(&sysmon->shutdown_comp); + init_completion(&sysmon->ssctl_comp); mutex_init(&sysmon->lock); mutex_init(&sysmon->state_lock); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6F72C00140 for ; Mon, 15 Aug 2022 22:49:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351927AbiHOWty (ORCPT ); Mon, 15 Aug 2022 18:49:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352099AbiHOWrv (ORCPT ); Mon, 15 Aug 2022 18:47:51 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62254135AE0; Mon, 15 Aug 2022 12:53:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 5522ECE12C1; Mon, 15 Aug 2022 19:53:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CECCC433D6; Mon, 15 Aug 2022 19:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593202; bh=hyTcSWCJpM8XrR++nPsIwaPrLzF9BBedKqDgX0Srn/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kUuHy/+V3COipcsKw8jGJcNicuMAWydJ353y82ab/nsg/UmLHrCM3MbJMURuDq2J2 poZkzI5ulExEHkgFBpfF7zwy4PowRKlsu1zAxVpOaxScZZERnJmVvKsWSKkjBKMw8W w5a65Rz4LFYkoNSaEJVVXOcmkUw5KzveZsRVwLU0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Lee Jones , Sasha Levin Subject: [PATCH 5.18 0893/1095] mfd: t7l66xb: Drop platform disable callback Date: Mon, 15 Aug 2022 20:04:52 +0200 Message-Id: <20220815180506.269443880@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 128ac294e1b437cb8a7f2ff8ede1cde9082bddbe ] None of the in-tree instantiations of struct t7l66xb_platform_data provides a disable callback. So better don't dereference this function pointer unconditionally. As there is no user, drop it completely instead of calling it conditional. This is a preparation for making platform remove callbacks return void. Fixes: 1f192015ca5b ("mfd: driver for the T7L66XB TMIO SoC") Signed-off-by: Uwe Kleine-K=C3=B6nig Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20220530192430.2108217-3-u.kleine-koenig@pe= ngutronix.de Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mfd/t7l66xb.c | 6 +----- include/linux/mfd/t7l66xb.h | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c index 5369c67e3280..663ffd4b8570 100644 --- a/drivers/mfd/t7l66xb.c +++ b/drivers/mfd/t7l66xb.c @@ -397,11 +397,8 @@ static int t7l66xb_probe(struct platform_device *dev) =20 static int t7l66xb_remove(struct platform_device *dev) { - struct t7l66xb_platform_data *pdata =3D dev_get_platdata(&dev->dev); struct t7l66xb *t7l66xb =3D platform_get_drvdata(dev); - int ret; =20 - ret =3D pdata->disable(dev); clk_disable_unprepare(t7l66xb->clk48m); clk_put(t7l66xb->clk48m); clk_disable_unprepare(t7l66xb->clk32k); @@ -412,8 +409,7 @@ static int t7l66xb_remove(struct platform_device *dev) mfd_remove_devices(&dev->dev); kfree(t7l66xb); =20 - return ret; - + return 0; } =20 static struct platform_driver t7l66xb_platform_driver =3D { diff --git a/include/linux/mfd/t7l66xb.h b/include/linux/mfd/t7l66xb.h index 69632c1b07bd..ae3e7a5c5219 100644 --- a/include/linux/mfd/t7l66xb.h +++ b/include/linux/mfd/t7l66xb.h @@ -12,7 +12,6 @@ =20 struct t7l66xb_platform_data { int (*enable)(struct platform_device *dev); - int (*disable)(struct platform_device *dev); int (*suspend)(struct platform_device *dev); int (*resume)(struct platform_device *dev); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E92C8C00140 for ; Mon, 15 Aug 2022 22:54:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352290AbiHOWyN (ORCPT ); Mon, 15 Aug 2022 18:54:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352512AbiHOWwD (ORCPT ); Mon, 15 Aug 2022 18:52:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FDE91394FF; Mon, 15 Aug 2022 12:54:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2F3AE6113B; Mon, 15 Aug 2022 19:54:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20DCEC433C1; Mon, 15 Aug 2022 19:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593272; bh=9aFWhDb0sLjSYCbmI8Iu1nyBKM24DyHPC+Y0uMpBoEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zHgz+qkJCKeKJyZygYVayTKf2vekCx4q/8YNdTAqMo61SjtAYkSKCBGwuqCksf8Kh Ufun0Pw+UN/S0+23hEzzznzwT8FEovNkW2wDKmwH4aoRgqkQ/PoxOj3VehS5yQ0Pzm vaMcl7g/7E/3FS8KN/LFkzTvKlUOp61gHg+BCJ1E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Krzysztof Kozlowski , Lee Jones , Sasha Levin Subject: [PATCH 5.18 0894/1095] mfd: max77620: Fix refcount leak in max77620_initialise_fps Date: Mon, 15 Aug 2022 20:04:53 +0200 Message-Id: <20220815180506.311693811@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 1520669c8255bd637c6b248b2be910e2688d38dd ] of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 327156c59360 ("mfd: max77620: Add core driver for MAX77620/MAX20024") Signed-off-by: Miaoqian Lin Reviewed-by: Krzysztof Kozlowski Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20220601043222.64441-1-linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/mfd/max77620.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c index fec2096474ad..a6661e07035b 100644 --- a/drivers/mfd/max77620.c +++ b/drivers/mfd/max77620.c @@ -419,9 +419,11 @@ static int max77620_initialise_fps(struct max77620_chi= p *chip) ret =3D max77620_config_fps(chip, fps_child); if (ret < 0) { of_node_put(fps_child); + of_node_put(fps_np); return ret; } } + of_node_put(fps_np); =20 config =3D chip->enable_global_lpm ? MAX77620_ONOFFCNFG2_SLP_LPM_MSK : 0; ret =3D regmap_update_bits(chip->rmap, MAX77620_REG_ONOFFCNFG2, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89D4DC00140 for ; Mon, 15 Aug 2022 22:57:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244572AbiHOW5D (ORCPT ); Mon, 15 Aug 2022 18:57:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352278AbiHOWyF (ORCPT ); Mon, 15 Aug 2022 18:54:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD9D813AE07; Mon, 15 Aug 2022 12:54:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 656EB612A4; Mon, 15 Aug 2022 19:54:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B584C433D7; Mon, 15 Aug 2022 19:54:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593294; bh=lCT1j9g6C8VJGJ3kCsSS9uDzFCCqHmR/3FmqLXKyelw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KpxGVi30UFvqVFkZ5DPgzIvGHjvQ3KWWyDxqbI+evNdX+GtEdSl7XWESTmLo69Qlm 3XJGFe1UWHiZzXcu1yYZp8sqZL3ZDEZzuclMC4UsS3cgZMG4r0RjtEsE15NlZmm6aM hyXbDFDBxoYjlDDrNjh/KRd0gLvvdewzB8XRUwmg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Will Deacon , Sasha Levin Subject: [PATCH 5.18 0895/1095] iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop Date: Mon, 15 Aug 2022 20:04:54 +0200 Message-Id: <20220815180506.341318302@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit a91eb6803c1c715738682fece095145cbd68fe0b ] In qcom_iommu_has_secure_context(), we should call of_node_put() for the reference 'child' when breaking out of for_each_child_of_node() which will automatically increase and decrease the refcount. Fixes: d051f28c8807 ("iommu/qcom: Initialize secure page table") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220719124955.1242171-1-windhl@126.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/ar= m-smmu/qcom_iommu.c index 4c077c38fbd6..c11d2c2cbb62 100644 --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c @@ -750,9 +750,12 @@ static bool qcom_iommu_has_secure_context(struct qcom_= iommu_dev *qcom_iommu) { struct device_node *child; =20 - for_each_child_of_node(qcom_iommu->dev->of_node, child) - if (of_device_is_compatible(child, "qcom,msm-iommu-v1-sec")) + for_each_child_of_node(qcom_iommu->dev->of_node, child) { + if (of_device_is_compatible(child, "qcom,msm-iommu-v1-sec")) { + of_node_put(child); return true; + } + } =20 return false; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D16F3C00140 for ; Mon, 15 Aug 2022 22:44:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351525AbiHOWow (ORCPT ); Mon, 15 Aug 2022 18:44:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350628AbiHOWkE (ORCPT ); Mon, 15 Aug 2022 18:40:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC2CED92; Mon, 15 Aug 2022 12:51:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8810A6122B; Mon, 15 Aug 2022 19:51:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 752E1C433D6; Mon, 15 Aug 2022 19:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593103; bh=1nxUEJqdGrmDbqMzj+vb/mQeqj5KZSqrH9pIU4WSL2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=op7xY8D1OoI7mSRj9cJhgPMy8CY4Ss9vDeKTNFe3ngP/lGcQ8V2/iAmPDZ3CpSU0y D5dscJFFbTihqR6Ucqccti1RTrhpzL68FHVXz0ZlL4+U6V0F+3loPI6H+a08gSb+PM ojNWWRc+wnUMSSRI6sdC042qyCrm1uKZcA0Cj8WI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Andi Kleen , Ian Rogers , Jiri Olsa , kvm@vger.kernel.org, Namhyung Kim , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.18 0896/1095] perf tools: Fix dso_id inode generation comparison Date: Mon, 15 Aug 2022 20:04:55 +0200 Message-Id: <20220815180506.372132821@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adrian Hunter [ Upstream commit 68566a7cf56bf3148797c218ed45a9de078ef47c ] Synthesized MMAP events have zero ino_generation, so do not compare them to DSOs with a real ino_generation otherwise we end up with a DSO without a build id. Fixes: 0e3149f86b99ddab ("perf dso: Move dso_id from 'struct map' to 'struc= t dso'") Signed-off-by: Adrian Hunter Cc: Andi Kleen Cc: Ian Rogers Cc: Jiri Olsa Cc: kvm@vger.kernel.org Cc: Namhyung Kim Link: https://lore.kernel.org/r/20220711093218.10967-2-adrian.hunter@intel.= com [ Added clarification to the comment from Ian + more detailed explanation f= rom Adrian ] Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/perf/util/dsos.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/dsos.c b/tools/perf/util/dsos.c index b97366f77bbf..2bd23e4cf19e 100644 --- a/tools/perf/util/dsos.c +++ b/tools/perf/util/dsos.c @@ -23,8 +23,19 @@ static int __dso_id__cmp(struct dso_id *a, struct dso_id= *b) if (a->ino > b->ino) return -1; if (a->ino < b->ino) return 1; =20 - if (a->ino_generation > b->ino_generation) return -1; - if (a->ino_generation < b->ino_generation) return 1; + /* + * Synthesized MMAP events have zero ino_generation, avoid comparing + * them with MMAP events with actual ino_generation. + * + * I found it harmful because the mismatch resulted in a new + * dso that did not have a build ID whereas the original dso did have a + * build ID. The build ID was essential because the object was not found + * otherwise. - Adrian + */ + if (a->ino_generation && b->ino_generation) { + if (a->ino_generation > b->ino_generation) return -1; + if (a->ino_generation < b->ino_generation) return 1; + } =20 return 0; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A6ACC00140 for ; Mon, 15 Aug 2022 22:45:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351308AbiHOWpS (ORCPT ); Mon, 15 Aug 2022 18:45:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350656AbiHOWkE (ORCPT ); Mon, 15 Aug 2022 18:40:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DE309FD1; Mon, 15 Aug 2022 12:51:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4F559B80EAD; Mon, 15 Aug 2022 19:51:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97D00C433C1; Mon, 15 Aug 2022 19:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593110; bh=05K6e8DDsGvu0xMBaRum+fYSQ7upnYPuRy7qrtX142g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tI02wAyqbUsY3uURQdngfKEuEkscFZPMDjJgwWazPEtF8K2VGB+fh/7tfn7RgH8gI lFQCxIauZ6TXvX1ue1jVvZk2y0Hz7pMWhF0gOsHJJSfHB2bdJeWaZ0JER7kZ5TkwY+ thrFq7IihlqIBgV/os7q2xEPU+jatcbfhYZA08sU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sunil V L , Atish Patra , Palmer Dabbelt , Sasha Levin Subject: [PATCH 5.18 0897/1095] riscv: spinwait: Fix hartid variable type Date: Mon, 15 Aug 2022 20:04:56 +0200 Message-Id: <20220815180506.411004254@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sunil V L [ Upstream commit c029e487e7c00e5594a4ae946952605db34e359b ] The hartid variable is of type int but compared with ULONG_MAX(INVALID_HARTID). This issue is fixed by changing the hartid variable type to unsigned long. Fixes: c78f94f35cf6 ("RISC-V: Use __cpu_up_stack/task_pointer only for spin= wait method") Signed-off-by: Sunil V L Reviewed-by: Atish Patra Link: https://lore.kernel.org/r/20220527051743.2829940-3-sunilvl@ventanamic= ro.com Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/riscv/kernel/cpu_ops_spinwait.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/kernel/cpu_ops_spinwait.c b/arch/riscv/kernel/cpu_o= ps_spinwait.c index c662a7cf10a4..d98d19226b5f 100644 --- a/arch/riscv/kernel/cpu_ops_spinwait.c +++ b/arch/riscv/kernel/cpu_ops_spinwait.c @@ -20,7 +20,7 @@ void *__cpu_spinwait_task_pointer[NR_CPUS] __section(".da= ta"); static void cpu_update_secondary_bootdata(unsigned int cpuid, struct task_struct *tidle) { - int hartid =3D cpuid_to_hartid_map(cpuid); + unsigned long hartid =3D cpuid_to_hartid_map(cpuid); =20 /* * The hartid must be less than NR_CPUS to avoid out-of-bound access @@ -29,7 +29,7 @@ static void cpu_update_secondary_bootdata(unsigned int cp= uid, * spinwait booting is not the recommended approach for any platforms * booting Linux in S-mode and can be disabled in the future. */ - if (hartid =3D=3D INVALID_HARTID || hartid >=3D NR_CPUS) + if (hartid =3D=3D INVALID_HARTID || hartid >=3D (unsigned long) NR_CPUS) return; =20 /* Make sure tidle is updated */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7988DC00140 for ; Mon, 15 Aug 2022 22:45:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351562AbiHOWpZ (ORCPT ); Mon, 15 Aug 2022 18:45:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348549AbiHOWkN (ORCPT ); Mon, 15 Aug 2022 18:40:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49166B7EC; Mon, 15 Aug 2022 12:51:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F0BA7B80EAB; Mon, 15 Aug 2022 19:51:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C385C433C1; Mon, 15 Aug 2022 19:51:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593116; bh=I97Qp1dWAVy3IsQkQEdYvQBwCJj951psvxNp2YnwJ5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f3wVAvQfAZ+8D1hwGlb6myJtiPKeCxvOIP60aULSQv+eybB8MLKwCS2eGVJRLDaFg onC3DUMIiq3RfbcjI/GriHsfqD8slngI2HXTOKEYIbFs6Zi1Ly/gd4XoWGrHUqwTup TmCovyWMoeZw+wYJArBUC0MJ8oMrDnQLot5k3V+8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthew Wilcox , Alexander Gordeev , Sasha Levin Subject: [PATCH 5.18 0898/1095] s390/crash: fix incorrect number of bytes to copy to user space Date: Mon, 15 Aug 2022 20:04:57 +0200 Message-Id: <20220815180506.451392972@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev [ Upstream commit f6749da17a34eb08c9665f072ce7c812ff68aad2 ] The number of bytes in a chunk is correctly calculated, but instead the total number of bytes is passed to copy_to_user_real() function. Reported-by: Matthew Wilcox Fixes: df9694c7975f ("s390/dump: streamline oldmem copy functions") Signed-off-by: Alexander Gordeev Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/s390/kernel/crash_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c index 28124d0fa1d5..f8ebdd70dd31 100644 --- a/arch/s390/kernel/crash_dump.c +++ b/arch/s390/kernel/crash_dump.c @@ -199,7 +199,7 @@ static int copy_oldmem_user(void __user *dst, unsigned = long src, size_t count) } else { len =3D count; } - rc =3D copy_to_user_real(dst, src, count); + rc =3D copy_to_user_real(dst, src, len); if (rc) return rc; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A8BAC25B08 for ; Mon, 15 Aug 2022 22:45:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351576AbiHOWpi (ORCPT ); Mon, 15 Aug 2022 18:45:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350882AbiHOWkv (ORCPT ); Mon, 15 Aug 2022 18:40:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 897CA73901; Mon, 15 Aug 2022 12:52:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 36C3CB80EAB; Mon, 15 Aug 2022 19:52:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67456C433D7; Mon, 15 Aug 2022 19:52:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593122; bh=mQCrq2ntPhCcnbK41SusLBAMdtiHg3E1dAxiOPm3NqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rvVq6BIhMhi9HhDq5SkoPeUrXz9k48/5ddghfGk+5INqxyDHAzniJ5Q5nK62okqh+ 9YhPP6ECO5w4NLXFyfoIe2sG3Lkn3+mqS1KPc9ZO6QJrvPDqk5IP8nOcT4t2TjsgaN h/bAaXyEfgRfHTbbrr2Zhm7DTZ3aOrKdX7kjP5vw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthew Wilcox , Heiko Carstens , Alexander Egorenkov , Alexander Gordeev , Sasha Levin Subject: [PATCH 5.18 0899/1095] s390/zcore: fix race when reading from hardware system area Date: Mon, 15 Aug 2022 20:04:58 +0200 Message-Id: <20220815180506.482092573@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev [ Upstream commit 9ffed254d938c9e99eb7761c7f739294c84e0367 ] Memory buffer used for reading out data from hardware system area is not protected against concurrent access. Reported-by: Matthew Wilcox Fixes: 411ed3225733 ("[S390] zfcpdump support.") Acked-by: Heiko Carstens Tested-by: Alexander Egorenkov Link: https://lore.kernel.org/r/e68137f0f9a0d2558f37becc20af18e2939934f6.16= 58206891.git.agordeev@linux.ibm.com Signed-off-by: Alexander Gordeev Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/s390/char/zcore.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c index 516783ba950f..92b32ce645b9 100644 --- a/drivers/s390/char/zcore.c +++ b/drivers/s390/char/zcore.c @@ -50,6 +50,7 @@ static struct dentry *zcore_reipl_file; static struct dentry *zcore_hsa_file; static struct ipl_parameter_block *zcore_ipl_block; =20 +static DEFINE_MUTEX(hsa_buf_mutex); static char hsa_buf[PAGE_SIZE] __aligned(PAGE_SIZE); =20 /* @@ -66,19 +67,24 @@ int memcpy_hsa_user(void __user *dest, unsigned long sr= c, size_t count) if (!hsa_available) return -ENODATA; =20 + mutex_lock(&hsa_buf_mutex); while (count) { if (sclp_sdias_copy(hsa_buf, src / PAGE_SIZE + 2, 1)) { TRACE("sclp_sdias_copy() failed\n"); + mutex_unlock(&hsa_buf_mutex); return -EIO; } offset =3D src % PAGE_SIZE; bytes =3D min(PAGE_SIZE - offset, count); - if (copy_to_user(dest, hsa_buf + offset, bytes)) + if (copy_to_user(dest, hsa_buf + offset, bytes)) { + mutex_unlock(&hsa_buf_mutex); return -EFAULT; + } src +=3D bytes; dest +=3D bytes; count -=3D bytes; } + mutex_unlock(&hsa_buf_mutex); return 0; } =20 @@ -96,9 +102,11 @@ int memcpy_hsa_kernel(void *dest, unsigned long src, si= ze_t count) if (!hsa_available) return -ENODATA; =20 + mutex_lock(&hsa_buf_mutex); while (count) { if (sclp_sdias_copy(hsa_buf, src / PAGE_SIZE + 2, 1)) { TRACE("sclp_sdias_copy() failed\n"); + mutex_unlock(&hsa_buf_mutex); return -EIO; } offset =3D src % PAGE_SIZE; @@ -108,6 +116,7 @@ int memcpy_hsa_kernel(void *dest, unsigned long src, si= ze_t count) dest +=3D bytes; count -=3D bytes; } + mutex_unlock(&hsa_buf_mutex); return 0; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17F61C28B2C for ; Mon, 15 Aug 2022 22:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351599AbiHOWpr (ORCPT ); Mon, 15 Aug 2022 18:45:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351258AbiHOWlp (ORCPT ); Mon, 15 Aug 2022 18:41:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBA4A73926; Mon, 15 Aug 2022 12:52:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E70076125C; Mon, 15 Aug 2022 19:52:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4B68C433D6; Mon, 15 Aug 2022 19:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593129; bh=FlydeP6PYQGyn0AYt0muUhmpUF8x2hn0JEyYh0BdFuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QfF1BUi1344SR8SeyMUsNFO2FnSNlrqwSybJnLhP5E0fLVd9PGlrbLf1qqGjVfsm4 16cIft6JFYZI0VHk10jyz0g5WzksY3gLshR0shfXcRHYlViixqYeUOPNBvEsH7uUzL pM1tLrMT/TVGisIap/DhmCHU56n3mkFugB04x8N4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0900/1095] ASoC: fsl_asrc: force cast the asrc_format type Date: Mon, 15 Aug 2022 20:04:59 +0200 Message-Id: <20220815180506.534797777@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit c49932726de24405d45516b3f8ad2735714fdf05 ] Fix sparse warning: sound/soc/fsl/fsl_asrc.c:1177:60: sparse: warning: incorrect type in argume= nt 3 (different base types) sound/soc/fsl/fsl_asrc.c:1177:60: sparse: expected unsigned int [usertyp= e] *out_value sound/soc/fsl/fsl_asrc.c:1177:60: sparse: got restricted snd_pcm_format_= t * sound/soc/fsl/fsl_asrc.c:1200:47: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer Fixes: 4520af41fd21 ("ASoC: fsl_asrc: Support new property fsl,asrc-format") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1658399393-28777-3-git-send-email-shengjiu.= wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/fsl/fsl_asrc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index d7d1536a4f37..44dcbf49456c 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -1066,6 +1066,7 @@ static int fsl_asrc_probe(struct platform_device *pde= v) struct resource *res; void __iomem *regs; int irq, ret, i; + u32 asrc_fmt =3D 0; u32 map_idx; char tmp[16]; u32 width; @@ -1174,7 +1175,8 @@ static int fsl_asrc_probe(struct platform_device *pde= v) return ret; } =20 - ret =3D of_property_read_u32(np, "fsl,asrc-format", &asrc->asrc_format); + ret =3D of_property_read_u32(np, "fsl,asrc-format", &asrc_fmt); + asrc->asrc_format =3D (__force snd_pcm_format_t)asrc_fmt; if (ret) { ret =3D of_property_read_u32(np, "fsl,asrc-width", &width); if (ret) { @@ -1197,7 +1199,7 @@ static int fsl_asrc_probe(struct platform_device *pde= v) } } =20 - if (!(FSL_ASRC_FORMATS & (1ULL << asrc->asrc_format))) { + if (!(FSL_ASRC_FORMATS & pcm_format_to_bits(asrc->asrc_format))) { dev_warn(&pdev->dev, "unsupported width, use default S24_LE\n"); asrc->asrc_format =3D SNDRV_PCM_FORMAT_S24_LE; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72FB4C25B08 for ; Mon, 15 Aug 2022 22:48:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351620AbiHOWp5 (ORCPT ); Mon, 15 Aug 2022 18:45:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350432AbiHOWmi (ORCPT ); Mon, 15 Aug 2022 18:42:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4638974349; Mon, 15 Aug 2022 12:52:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 10CE860FB5; Mon, 15 Aug 2022 19:52:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1618C433D7; Mon, 15 Aug 2022 19:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593138; bh=AyU24YVz++nhNR4ubWOG1XjYUMz+8Y1xf/PQPu5HIz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MmTmI6/PLEmzRJusv4EGrQKrOLFVXkPyhVYQ8LfioEOxmUY7u8Rb8WJjyVdX3YZtj D5Vm11Q7U9MTjFFck0NRjaSoqZA/BgJKFLqU4zRwbLbEK3rZuE3OEGFgoK1H9TWYjS ehUFgRyNkxiWKgRebJvRPNNO84DKcV4eHP5x/odc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0901/1095] ASoC: fsl-asoc-card: force cast the asrc_format type Date: Mon, 15 Aug 2022 20:05:00 +0200 Message-Id: <20220815180506.571419022@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit 6c7b077dad62178c33f9a3ae17f90d6b0bf6e2e5 ] Fix sparse warning: sound/soc/fsl/fsl-asoc-card.c:833:45: sparse: warning: incorrect type in ar= gument 3 (different base types) sound/soc/fsl/fsl-asoc-card.c:833:45: sparse: expected unsigned int [use= rtype] *out_value sound/soc/fsl/fsl-asoc-card.c:833:45: sparse: got restricted snd_pcm_for= mat_t * Fixes: 859e364302c5 ("ASoC: fsl-asoc-card: Support new property fsl, asrc-f= ormat") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1658399393-28777-4-git-send-email-shengjiu.= wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/fsl/fsl-asoc-card.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index d9a0d4768c4d..c836848ef0a6 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -537,6 +537,7 @@ static int fsl_asoc_card_probe(struct platform_device *= pdev) struct device *codec_dev =3D NULL; const char *codec_dai_name; const char *codec_dev_name; + u32 asrc_fmt =3D 0; u32 width; int ret; =20 @@ -829,8 +830,8 @@ static int fsl_asoc_card_probe(struct platform_device *= pdev) goto asrc_fail; } =20 - ret =3D of_property_read_u32(asrc_np, "fsl,asrc-format", - &priv->asrc_format); + ret =3D of_property_read_u32(asrc_np, "fsl,asrc-format", &asrc_fmt); + priv->asrc_format =3D (__force snd_pcm_format_t)asrc_fmt; if (ret) { /* Fallback to old binding; translate to asrc_format */ ret =3D of_property_read_u32(asrc_np, "fsl,asrc-width", --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECDA7C25B08 for ; Mon, 15 Aug 2022 22:48:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351652AbiHOWqG (ORCPT ); Mon, 15 Aug 2022 18:46:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350689AbiHOWmx (ORCPT ); Mon, 15 Aug 2022 18:42:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CE537C515; Mon, 15 Aug 2022 12:52:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4D3C661206; Mon, 15 Aug 2022 19:52:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AEC5C433D6; Mon, 15 Aug 2022 19:52:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593144; bh=ZrmD6NIvlvB4c/OD2NuWsSHOYZ1Vb1Ay9jCFCc1P/sY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kZGc4H/HSuH7YRHJREmt994wazBXYuLTokoz/NY1blcsTKtK3p/4iN0c5vhXKsj4P +N64QuyMqP/mDj6OJ+fyrPsdLP77hvIqjKyrI/DWfRlOcGUXAAkHEdIikel+8bP+Je +Xrx3J1ih/JcIwvXArUx0e/kafZ6WQ8Xh40hYMhI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0902/1095] ASoC: fsl_easrc: use snd_pcm_format_t type for sample_format Date: Mon, 15 Aug 2022 20:05:01 +0200 Message-Id: <20220815180506.620039701@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit de27216cf2d645c2fd14e513707bdcd54e5b1de4 ] Fix sparse warning: sound/soc/fsl/fsl_easrc.c:562:33: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:563:34: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:565:38: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:566:39: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:608:33: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:609:34: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:615:40: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:616:41: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:1465:51: sparse: warning: incorrect type in assig= nment (different base types) sound/soc/fsl/fsl_easrc.c:1465:51: sparse: expected unsigned int sample_= format sound/soc/fsl/fsl_easrc.c:1465:51: sparse: got restricted snd_pcm_format= _t [usertype] format sound/soc/fsl/fsl_easrc.c:1467:52: sparse: warning: incorrect type in assig= nment (different base types) sound/soc/fsl/fsl_easrc.c:1467:52: sparse: expected unsigned int sample_= format sound/soc/fsl/fsl_easrc.c:1467:52: sparse: got restricted snd_pcm_format= _t [usertype] asrc_format sound/soc/fsl/fsl_easrc.c:1470:52: sparse: warning: incorrect type in assig= nment (different base types) sound/soc/fsl/fsl_easrc.c:1470:52: sparse: expected unsigned int sample_= format sound/soc/fsl/fsl_easrc.c:1470:52: sparse: got restricted snd_pcm_format= _t [usertype] format sound/soc/fsl/fsl_easrc.c:1472:51: sparse: warning: incorrect type in assig= nment (different base types) sound/soc/fsl/fsl_easrc.c:1472:51: sparse: expected unsigned int sample_= format sound/soc/fsl/fsl_easrc.c:1472:51: sparse: got restricted snd_pcm_format= _t [usertype] asrc_format sound/soc/fsl/fsl_easrc.c:1484:41: sparse: warning: incorrect type in argum= ent 2 (different base types) sound/soc/fsl/fsl_easrc.c:1484:41: sparse: expected restricted snd_pcm_f= ormat_t [usertype] *in_raw_format sound/soc/fsl/fsl_easrc.c:1484:41: sparse: got unsigned int * sound/soc/fsl/fsl_easrc.c:1485:41: sparse: warning: incorrect type in argum= ent 3 (different base types) sound/soc/fsl/fsl_easrc.c:1485:41: sparse: expected restricted snd_pcm_f= ormat_t [usertype] *out_raw_format sound/soc/fsl/fsl_easrc.c:1485:41: sparse: got unsigned int * sound/soc/fsl/fsl_easrc.c:1937:60: sparse: warning: incorrect type in argum= ent 3 (different base types) sound/soc/fsl/fsl_easrc.c:1937:60: sparse: expected unsigned int [userty= pe] *out_value sound/soc/fsl/fsl_easrc.c:1937:60: sparse: got restricted snd_pcm_format= _t * sound/soc/fsl/fsl_easrc.c:1943:49: sparse: warning: restricted snd_pcm_form= at_t degrades to integer Fixes: 955ac624058f ("ASoC: fsl_easrc: Add EASRC ASoC CPU DAI drivers") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1658399393-28777-5-git-send-email-shengjiu.= wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/fsl/fsl_easrc.c | 9 ++++++--- sound/soc/fsl/fsl_easrc.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c index be14f84796cb..cf0e10d17dbe 100644 --- a/sound/soc/fsl/fsl_easrc.c +++ b/sound/soc/fsl/fsl_easrc.c @@ -476,7 +476,8 @@ static int fsl_easrc_prefilter_config(struct fsl_asrc *= easrc, struct fsl_asrc_pair *ctx; struct device *dev; u32 inrate, outrate, offset =3D 0; - u32 in_s_rate, out_s_rate, in_s_fmt, out_s_fmt; + u32 in_s_rate, out_s_rate; + snd_pcm_format_t in_s_fmt, out_s_fmt; int ret, i; =20 if (!easrc) @@ -1873,6 +1874,7 @@ static int fsl_easrc_probe(struct platform_device *pd= ev) struct resource *res; struct device_node *np; void __iomem *regs; + u32 asrc_fmt =3D 0; int ret, irq; =20 easrc =3D devm_kzalloc(dev, sizeof(*easrc), GFP_KERNEL); @@ -1933,13 +1935,14 @@ static int fsl_easrc_probe(struct platform_device *= pdev) return ret; } =20 - ret =3D of_property_read_u32(np, "fsl,asrc-format", &easrc->asrc_format); + ret =3D of_property_read_u32(np, "fsl,asrc-format", &asrc_fmt); + easrc->asrc_format =3D (__force snd_pcm_format_t)asrc_fmt; if (ret) { dev_err(dev, "failed to asrc format\n"); return ret; } =20 - if (!(FSL_EASRC_FORMATS & (1ULL << easrc->asrc_format))) { + if (!(FSL_EASRC_FORMATS & (pcm_format_to_bits(easrc->asrc_format)))) { dev_warn(dev, "unsupported format, switching to S24_LE\n"); easrc->asrc_format =3D SNDRV_PCM_FORMAT_S24_LE; } diff --git a/sound/soc/fsl/fsl_easrc.h b/sound/soc/fsl/fsl_easrc.h index 30620d56252c..5b8469757c12 100644 --- a/sound/soc/fsl/fsl_easrc.h +++ b/sound/soc/fsl/fsl_easrc.h @@ -569,7 +569,7 @@ struct fsl_easrc_io_params { unsigned int access_len; unsigned int fifo_wtmk; unsigned int sample_rate; - unsigned int sample_format; + snd_pcm_format_t sample_format; unsigned int norm_rate; }; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FBEBC3F6B0 for ; Mon, 15 Aug 2022 22:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351699AbiHOWqR (ORCPT ); Mon, 15 Aug 2022 18:46:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351381AbiHOWnm (ORCPT ); Mon, 15 Aug 2022 18:43:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74C787C53B; Mon, 15 Aug 2022 12:52:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EA82DB80EAD; Mon, 15 Aug 2022 19:52:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4414EC433C1; Mon, 15 Aug 2022 19:52:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593150; bh=6WQcaD39Z7X1fJpxXq9yMC2ENvQGk6DSE/u5decyplU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iZVB/zn3h1zmuAkHN0cOhbFNqC6lOY4UYltqOAYSIxIdojR/1RuYaioi5WQwk1VaN /yBPwuYecqAK5tFNd+p7//s59f5DevmbHTbEPyHJWesnRbHyXfO7CWN9p9/nZ+fZ0Z HNx5nbD4f+E8jmm0mf2hWdN11PKM1AT7HWMtkdK4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0903/1095] ASoC: imx-card: use snd_pcm_format_t type for asrc_format Date: Mon, 15 Aug 2022 20:05:02 +0200 Message-Id: <20220815180506.658906582@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit 409a8652e909e323c715f3088e6c3133e37c8881 ] Fix sparse warning: sound/soc/fsl/imx-card.c:653:59: sparse: warning: incorrect type in assignm= ent (different base types) sound/soc/fsl/imx-card.c:653:59: sparse: expected unsigned int [usertype= ] asrc_format sound/soc/fsl/imx-card.c:653:59: sparse: got restricted snd_pcm_format_t= [usertype] sound/soc/fsl/imx-card.c:655:59: sparse: warning: incorrect type in assignm= ent (different base types) sound/soc/fsl/imx-card.c:655:59: sparse: expected unsigned int [usertype= ] asrc_format sound/soc/fsl/imx-card.c:655:59: sparse: got restricted snd_pcm_format_t= [usertype] Fixes: aa736700f42f ("ASoC: imx-card: Add imx-card machine driver") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1658399393-28777-6-git-send-email-shengjiu.= wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/fsl/imx-card.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index c0eb218a254b..4a8609b0d700 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -118,7 +118,7 @@ struct imx_card_data { struct snd_soc_card card; int num_dapm_routes; u32 asrc_rate; - u32 asrc_format; + snd_pcm_format_t asrc_format; }; =20 static struct imx_akcodec_fs_mul ak4458_fs_mul[] =3D { @@ -474,7 +474,7 @@ static int be_hw_params_fixup(struct snd_soc_pcm_runtim= e *rtd, =20 mask =3D hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); snd_mask_none(mask); - snd_mask_set(mask, data->asrc_format); + snd_mask_set(mask, (__force unsigned int)data->asrc_format); =20 return 0; } @@ -493,6 +493,7 @@ static int imx_card_parse_of(struct imx_card_data *data) struct dai_link_data *link_data; struct of_phandle_args args; int ret, num_links; + u32 asrc_fmt =3D 0; u32 width; =20 ret =3D snd_soc_of_parse_card_name(card, "model"); @@ -639,7 +640,8 @@ static int imx_card_parse_of(struct imx_card_data *data) goto err; } =20 - ret =3D of_property_read_u32(args.np, "fsl,asrc-format", &data->asrc_fo= rmat); + ret =3D of_property_read_u32(args.np, "fsl,asrc-format", &asrc_fmt); + data->asrc_format =3D (__force snd_pcm_format_t)asrc_fmt; if (ret) { /* Fallback to old binding; translate to asrc_format */ ret =3D of_property_read_u32(args.np, "fsl,asrc-width", &width); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98359C25B08 for ; Mon, 15 Aug 2022 22:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350971AbiHOWsJ (ORCPT ); Mon, 15 Aug 2022 18:48:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350518AbiHOWoa (ORCPT ); Mon, 15 Aug 2022 18:44:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 033B1133A62; Mon, 15 Aug 2022 12:52:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D38461206; Mon, 15 Aug 2022 19:52:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AFF6C433D6; Mon, 15 Aug 2022 19:52:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593156; bh=ELguIUk4SGcF73osMAg65DOO9y8WrYs9XvjG4oFTOso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hop7YbLBhmkzSKN6N8WRGefhwpgZZXKSrLtD6HxYzYpNKMlUvSH13gF2XlBeGQLH4 /bGlMH+SoVYgRgSqe8LBea8vfAPSB4/xi3Oi3eKsqGani5u5adwj/QVmNNaexDqj0g qBzX4aGXFdXK1t6y3O3wf6EDbSiIHB0DTU4XTsPc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0904/1095] ASoC: qcom: q6dsp: Fix an off-by-one in q6adm_alloc_copp() Date: Mon, 15 Aug 2022 20:05:03 +0200 Message-Id: <20220815180506.699055084@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 673f58f62ca6fc98979d1cf3fe89c3ff33f29b2e ] find_first_zero_bit() returns MAX_COPPS_PER_PORT at max here. So 'idx' should be tested with ">=3D" or the test can't match. Fixes: 7b20b2be51e1 ("ASoC: qdsp6: q6adm: Add q6adm driver") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/0fca3271649736053eb9649d87e1ca01b056be40.16= 58394124.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/qcom/qdsp6/q6adm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/q6adm.c b/sound/soc/qcom/qdsp6/q6adm.c index 72c5719f1d25..a0678e8cf20a 100644 --- a/sound/soc/qcom/qdsp6/q6adm.c +++ b/sound/soc/qcom/qdsp6/q6adm.c @@ -217,7 +217,7 @@ static struct q6copp *q6adm_alloc_copp(struct q6adm *ad= m, int port_idx) idx =3D find_first_zero_bit(&adm->copp_bitmap[port_idx], MAX_COPPS_PER_PORT); =20 - if (idx > MAX_COPPS_PER_PORT) + if (idx >=3D MAX_COPPS_PER_PORT) return ERR_PTR(-EBUSY); =20 c =3D kzalloc(sizeof(*c), GFP_ATOMIC); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7848CC00140 for ; Mon, 15 Aug 2022 22:50:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351946AbiHOWuE (ORCPT ); Mon, 15 Aug 2022 18:50:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350882AbiHOWpk (ORCPT ); Mon, 15 Aug 2022 18:45:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE92C134217; Mon, 15 Aug 2022 12:52:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 670636122B; Mon, 15 Aug 2022 19:52:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57259C433D6; Mon, 15 Aug 2022 19:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593162; bh=iLeyVKw30Yurlo2472vxw9O6/4uq54uc70v/ViiSn4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tr5W+6RLUOve8ganZwyvCpfn209rJUVX2quEC+0B68WxlyQjuxUGK0m6O4Ph8a3vV MKJt88T0yuVbNM3F/xKuadfYcqoC4orTqVSQrvn79xofj2yTka7EL8aCfNTkvRGPn6 lbTjZsNvXr8yU4iNBQdh5NGIl7fuJnOm9cIhIuQk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xie Yongji , Miklos Szeredi , Sasha Levin Subject: [PATCH 5.18 0905/1095] fuse: Remove the control interface for virtio-fs Date: Mon, 15 Aug 2022 20:05:04 +0200 Message-Id: <20220815180506.738034007@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xie Yongji [ Upstream commit c64797809a64c73497082aa05e401a062ec1af34 ] The commit 15c8e72e88e0 ("fuse: allow skipping control interface and forced unmount") tries to remove the control interface for virtio-fs since it does not support aborting requests which are being processed. But it doesn't work now. This patch fixes it by skipping creating the control interface if fuse_conn->no_control is set. Fixes: 15c8e72e88e0 ("fuse: allow skipping control interface and forced unm= ount") Signed-off-by: Xie Yongji Signed-off-by: Miklos Szeredi Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/fuse/control.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fuse/control.c b/fs/fuse/control.c index 7cede9a3bc96..247ef4f76761 100644 --- a/fs/fuse/control.c +++ b/fs/fuse/control.c @@ -258,7 +258,7 @@ int fuse_ctl_add_conn(struct fuse_conn *fc) struct dentry *parent; char name[32]; =20 - if (!fuse_control_sb) + if (!fuse_control_sb || fc->no_control) return 0; =20 parent =3D fuse_control_sb->s_root; @@ -296,7 +296,7 @@ void fuse_ctl_remove_conn(struct fuse_conn *fc) { int i; =20 - if (!fuse_control_sb) + if (!fuse_control_sb || fc->no_control) return; =20 for (i =3D fc->ctl_ndents - 1; i >=3D 0; i--) { --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC2C4C28B2B for ; Mon, 15 Aug 2022 22:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351494AbiHOWs2 (ORCPT ); Mon, 15 Aug 2022 18:48:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351801AbiHOWqv (ORCPT ); Mon, 15 Aug 2022 18:46:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B472134B8A; Mon, 15 Aug 2022 12:52:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B425760FB5; Mon, 15 Aug 2022 19:52:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0AF5C433C1; Mon, 15 Aug 2022 19:52:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593172; bh=WF7gVEsWaD81stKo2H4fD5esY9t3YMHFHgogMQnH3z8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DG1WQUyiOjw07gDoZ3o9elYBg4rSn/X3/KfZjfVPq9czRXYGgeFl402sLPnv3Cb46 JNnYlK4vj/8unY6No5m7+J8et2eCsEESUy6rn6E0SrADFN89E4jGAlSPhx8GIQ3I5O /0MuX8tjjv4/qJ7AwJmDtpbZt2agYAmrBlukcDxc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0906/1095] ASoC: audio-graph-card: Add of_node_put() in fail path Date: Mon, 15 Aug 2022 20:05:05 +0200 Message-Id: <20220815180506.782392479@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 65fb8e2ef3531a6e950060fca6e551c923fb0f0e ] In asoc_simple_parse_dai(), we should call of_node_put() for the reference returned by of_graph_get_port_parent() in fail path. Fixes: ae30a694da4c ("ASoC: simple-card-utils: add asoc_simple_card_parse_d= ai()") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220721144308.1301587-1-windhl@126.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/generic/audio-graph-card.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio= -graph-card.c index 2b598af8feef..b327372f2e4a 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -158,8 +158,10 @@ static int asoc_simple_parse_dai(struct device_node *e= p, * if he unbinded CPU or Codec. */ ret =3D snd_soc_get_dai_name(&args, &dlc->dai_name); - if (ret < 0) + if (ret < 0) { + of_node_put(node); return ret; + } =20 dlc->of_node =3D node; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52EEAC00140 for ; Mon, 15 Aug 2022 22:48:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351554AbiHOWst (ORCPT ); Mon, 15 Aug 2022 18:48:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351870AbiHOWrQ (ORCPT ); Mon, 15 Aug 2022 18:47:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE1F0134BA2; Mon, 15 Aug 2022 12:52:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C346861178; Mon, 15 Aug 2022 19:52:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C849DC433D6; Mon, 15 Aug 2022 19:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593178; bh=DoVPNPsANI42njFz6pFTjfBTPpPa5wfXXRlQm9pBfy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yC493F2MkfJ6eWtJd2IbYL6p2qY9L+9vcAn30fg+q78S4TMcqUO1y6XBHZHSEVvYN Ym45T3krmuQnkWmftmWMEJ8NlCM/tir6Yw/0TLZYvsmf6opCVwK05M5SC6TwbW6p8f gL2i9kwTcH962ZJz0ABhDVFB0UOCkD3GZRLxtCgs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0907/1095] ASoC: audio-graph-card2: Add of_node_put() in fail path Date: Mon, 15 Aug 2022 20:05:06 +0200 Message-Id: <20220815180506.817368388@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 8ebc4dd8250fd1cb5da2869c0fe6ae3686fe41e9 ] In asoc_simple_parse_dai(), we should call of_node_put() for the reference returned by of_graph_get_port_parent() in fail path. Fixes: 6e5f68fe3f2d ("ASoC: add Audio Graph Card2 driver") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220722141801.1304854-1-windhl@126.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/generic/audio-graph-card2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audi= o-graph-card2.c index ba3551d9a040..da782403316f 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -445,8 +445,10 @@ static int asoc_simple_parse_dai(struct device_node *e= p, * if he unbinded CPU or Codec. */ ret =3D snd_soc_get_dai_name(&args, &dlc->dai_name); - if (ret < 0) + if (ret < 0) { + of_node_put(node); return ret; + } =20 dlc->of_node =3D node; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B4BDC00140 for ; Mon, 15 Aug 2022 22:49:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351773AbiHOWtL (ORCPT ); Mon, 15 Aug 2022 18:49:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351932AbiHOWrX (ORCPT ); Mon, 15 Aug 2022 18:47:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79FA5134B9C; Mon, 15 Aug 2022 12:53:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E41E861178; Mon, 15 Aug 2022 19:53:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB43FC433D6; Mon, 15 Aug 2022 19:53:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593184; bh=n53XmxCgwLMlqFZN8KbH07lCxfM9RjyR4HTH0+4uqBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XHfhGwCZC66ElinauN7Z/MJItsmlvvDr1QfHA8TQpfFheVOSxFyHlUlDcYiLigQFp oE7QTBLrvC7c1LKipf4yCIwO5lntM34O+18S+Zg9n56QRG4h3VyIqheRn6TiaMSwm/ gxlV9OAZdAy0R0sZ/JdCe7xKGzS1DxvRObbEv4aY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 5.18 0908/1095] watchdog: f71808e_wdt: Add check for platform_driver_register Date: Mon, 15 Aug 2022 20:05:07 +0200 Message-Id: <20220815180506.855128263@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 97d5ec548150764946f38632e62e79759832b54b ] As platform_driver_register() could fail, it should be better to deal with the return value in order to maintain the code consisitency. Fixes: 27e0fe00a5c6 ("watchdog: f71808e_wdt: refactor to platform device/dr= iver pair") Signed-off-by: Jiasheng Jiang Reviewed-by: Guenter Roeck https://lore.kernel.org/r/20220526080303.1005063-1-jiasheng@iscas.ac.cn Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/watchdog/f71808e_wdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c index 7f59c680de25..6a16d3d0bb1e 100644 --- a/drivers/watchdog/f71808e_wdt.c +++ b/drivers/watchdog/f71808e_wdt.c @@ -634,7 +634,9 @@ static int __init fintek_wdt_init(void) =20 pdata.type =3D ret; =20 - platform_driver_register(&fintek_wdt_driver); + ret =3D platform_driver_register(&fintek_wdt_driver); + if (ret) + return ret; =20 wdt_res.name =3D "superio port"; wdt_res.flags =3D IORESOURCE_IO; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6621FC00140 for ; Mon, 15 Aug 2022 22:49:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351859AbiHOWta (ORCPT ); Mon, 15 Aug 2022 18:49:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351978AbiHOWr3 (ORCPT ); Mon, 15 Aug 2022 18:47:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94C2A7CA99; Mon, 15 Aug 2022 12:53:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EEC3D6122B; Mon, 15 Aug 2022 19:53:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCAAFC43140; Mon, 15 Aug 2022 19:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593190; bh=UkexD9rfgmwaolcR9QQUHVrlFEriZt7CFdO7HMCyRRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l/cWFyzIb1MB447S3abr/n3ZlQvoXCGsYUljIcwd8uZUp7G9xY65wrEJJ11SL5D77 FMy5iSgwCZHXb6bC2p3sFypJiYy+9LAOEx3R7oJVk/xT1CaGDT3yCS8Qt28xBjy0r3 bKqK+Y1UutYJdpzzsDPavJAb1r3CO7z3mPM+7Afo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jean Delvare , Terry Bowman , Wim Van Sebroeck , Guenter Roeck , Sasha Levin Subject: [PATCH 5.18 0909/1095] watchdog: sp5100_tco: Fix a memory leak of EFCH MMIO resource Date: Mon, 15 Aug 2022 20:05:08 +0200 Message-Id: <20220815180506.896913248@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jean Delvare [ Upstream commit c6d9c0798ed366a09a9e53d71edcd2266e34a6eb ] Unlike release_mem_region(), a call to release_resource() does not free the resource, so it has to be freed explicitly to avoid a memory leak. Signed-off-by: Jean Delvare Fixes: 0578fff4aae5 ("Watchdog: sp5100_tco: Add initialization using EFCH M= MIO") Cc: Terry Bowman Cc: Wim Van Sebroeck Cc: Guenter Roeck Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220621152840.420a0f4c@endymion.delvare Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/watchdog/sp5100_tco.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c index 86ffb58fbc85..ae54dd33e233 100644 --- a/drivers/watchdog/sp5100_tco.c +++ b/drivers/watchdog/sp5100_tco.c @@ -402,6 +402,7 @@ static int sp5100_tco_setupdevice_mmio(struct device *d= ev, iounmap(addr); =20 release_resource(res); + kfree(res); =20 return ret; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69441C00140 for ; Mon, 15 Aug 2022 22:49:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351901AbiHOWto (ORCPT ); Mon, 15 Aug 2022 18:49:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352039AbiHOWrl (ORCPT ); Mon, 15 Aug 2022 18:47:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3C26135AC9; Mon, 15 Aug 2022 12:53:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3BA9160FB9; Mon, 15 Aug 2022 19:53:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2549DC433C1; Mon, 15 Aug 2022 19:53:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593196; bh=sZQQJBhKBqZz1oQBCZX4pRulQOQ09eGmJoa2eOxyBZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WR9/5JmHNqP6g8X17EK5on5n0Gy71Ze8P2Q7hFNicPJLuYHUQImCEJWzYgs5uPHLj pURokytHyBUBMwK74t8XYYmSrMzenzhmOjf1yDk2kKlyH20tgFEoC5ABimzMFp53t7 u7r01ve0G9iGQU17hO+dG8zQlJiuYHu6icqGYvRU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , William Dean , Marek Beh=C3=BAn , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 5.18 0910/1095] watchdog: armada_37xx_wdt: check the return value of devm_ioremap() in armada_37xx_wdt_probe() Date: Mon, 15 Aug 2022 20:05:09 +0200 Message-Id: <20220815180506.932605582@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Dean [ Upstream commit 2d27e52841092e5831dd41f313028c668d816eb0 ] The function devm_ioremap() in armada_37xx_wdt_probe() can fail, so its return value should be checked. Fixes: 54e3d9b518c8a ("watchdog: Add support for Armada 37xx CPU watchdog") Reported-by: Hacash Robot Signed-off-by: William Dean Reviewed-by: Marek Beh=3DC3=3DBAn Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220722030938.2925156-1-williamsukatube@16= 3.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/watchdog/armada_37xx_wdt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/watchdog/armada_37xx_wdt.c b/drivers/watchdog/armada_3= 7xx_wdt.c index 1635f421ef2c..854b1cc723cb 100644 --- a/drivers/watchdog/armada_37xx_wdt.c +++ b/drivers/watchdog/armada_37xx_wdt.c @@ -274,6 +274,8 @@ static int armada_37xx_wdt_probe(struct platform_device= *pdev) if (!res) return -ENODEV; dev->reg =3D devm_ioremap(&pdev->dev, res->start, resource_size(res)); + if (!dev->reg) + return -ENOMEM; =20 /* init clock */ dev->clk =3D devm_clk_get(&pdev->dev, NULL); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D544C00140 for ; Mon, 15 Aug 2022 22:50:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351957AbiHOWuJ (ORCPT ); Mon, 15 Aug 2022 18:50:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352127AbiHOWry (ORCPT ); Mon, 15 Aug 2022 18:47:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25269135AEB; Mon, 15 Aug 2022 12:53:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2DB83B81142; Mon, 15 Aug 2022 19:53:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 732B8C433D7; Mon, 15 Aug 2022 19:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593205; bh=T42vtNvZmfSxu+bANyz8LMcHBQaRj4p58WGreN/apcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LQiGIVoODbvERF3HwuD1il+ULip4uAdR6ihoWydV6veR+i4WUI1d4KZIgkpU4XY0l yknOlajUhtY4A5TiyKYvxkUt9KplWN6akYkvry+k93L+zUQyPKsEfRoOCI8A9oie3F 5KDvRstWONLuWDJrfrYiJlhSssYPvalpbIeeTVl8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ranjani Sridharan , Yong Zhi , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0911/1095] ASoC: Intel: sof_rt5682: Perform quirk check first in card late probe Date: Mon, 15 Aug 2022 20:05:10 +0200 Message-Id: <20220815180506.966324573@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yong Zhi [ Upstream commit 371a3f01fc1862c23fae35cb2c98ffb2eec143f1 ] The check of sof_rt5682_quirk should not be skipped unless the HDMI handling code exits with error, fix by moving the quirk check to the front. Fixes: 94d2d0897474 ("ASoC: Intel: Boards: tgl_max98373: add dai_trigger fu= nction") Reviewed-by: Ranjani Sridharan Signed-off-by: Yong Zhi Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220725194909.145418-10-pierre-louis.bossa= rt@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/intel/boards/sof_rt5682.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/s= of_rt5682.c index 7126fcb63d90..d9f83b04be87 100644 --- a/sound/soc/intel/boards/sof_rt5682.c +++ b/sound/soc/intel/boards/sof_rt5682.c @@ -435,6 +435,15 @@ static int sof_card_late_probe(struct snd_soc_card *ca= rd) int err; int i =3D 0; =20 + if (sof_rt5682_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT) { + /* Disable Left and Right Spk pin after boot */ + snd_soc_dapm_disable_pin(dapm, "Left Spk"); + snd_soc_dapm_disable_pin(dapm, "Right Spk"); + err =3D snd_soc_dapm_sync(dapm); + if (err < 0) + return err; + } + /* HDMI is not supported by SOF on Baytrail/CherryTrail */ if (is_legacy_cpu || !ctx->idisp_codec) return 0; @@ -468,15 +477,6 @@ static int sof_card_late_probe(struct snd_soc_card *ca= rd) i++; } =20 - if (sof_rt5682_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT) { - /* Disable Left and Right Spk pin after boot */ - snd_soc_dapm_disable_pin(dapm, "Left Spk"); - snd_soc_dapm_disable_pin(dapm, "Right Spk"); - err =3D snd_soc_dapm_sync(dapm); - if (err < 0) - return err; - } - return hdac_hdmi_jack_port_init(component, &card->dapm); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6959C00140 for ; Mon, 15 Aug 2022 22:50:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351975AbiHOWuR (ORCPT ); Mon, 15 Aug 2022 18:50:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352189AbiHOWsC (ORCPT ); Mon, 15 Aug 2022 18:48:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C69D37DF60; Mon, 15 Aug 2022 12:53:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A6A4260FB9; Mon, 15 Aug 2022 19:53:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96A1EC433D6; Mon, 15 Aug 2022 19:53:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593212; bh=vo0TAGeRPJNhuCFG7rNuv/V9pYpe7Wt0kisbfUGzm10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VXqOxrIXx3oEUVvfQ74LZS2LROyAvxrBQ495AYqKxxzIXB+kkAF4utxGkc5HRmaPQ o5M+4OpLa+koFlYWHUyZaRQwqBXuE4mDbd/3yFDEW9BnxJf6C0ny75pI5Ej9k3Ex44 CuGwHn+cAI366MSgFSzv4zD/gorvcAOIbozIigrQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Helge Deller , Sasha Levin Subject: [PATCH 5.18 0912/1095] video: fbdev: amba-clcd: Fix refcount leak bugs Date: Mon, 15 Aug 2022 20:05:11 +0200 Message-Id: <20220815180507.015333870@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 26c2b7d9fac42eb8317f3ceefa4c1a9a9170ca69 ] In clcdfb_of_init_display(), we should call of_node_put() for the references returned by of_graph_get_next_endpoint() and of_graph_get_remote_port_parent() which have increased the refcount. Besides, we should call of_node_put() both in fail path or when the references are not used anymore. Fixes: d10715be03bd ("video: ARM CLCD: Add DT support") Signed-off-by: Liang He Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/video/fbdev/amba-clcd.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clc= d.c index 8080116aea84..f65c96d1394d 100644 --- a/drivers/video/fbdev/amba-clcd.c +++ b/drivers/video/fbdev/amba-clcd.c @@ -698,16 +698,18 @@ static int clcdfb_of_init_display(struct clcd_fb *fb) return -ENODEV; =20 panel =3D of_graph_get_remote_port_parent(endpoint); - if (!panel) - return -ENODEV; + if (!panel) { + err =3D -ENODEV; + goto out_endpoint_put; + } =20 err =3D clcdfb_of_get_backlight(&fb->dev->dev, fb->panel); if (err) - return err; + goto out_panel_put; =20 err =3D clcdfb_of_get_mode(&fb->dev->dev, panel, fb->panel); if (err) - return err; + goto out_panel_put; =20 err =3D of_property_read_u32(fb->dev->dev.of_node, "max-memory-bandwidth", &max_bandwidth); @@ -736,11 +738,21 @@ static int clcdfb_of_init_display(struct clcd_fb *fb) =20 if (of_property_read_u32_array(endpoint, "arm,pl11x,tft-r0g0b0-pads", - tft_r0b0g0, ARRAY_SIZE(tft_r0b0g0)) !=3D 0) - return -ENOENT; + tft_r0b0g0, ARRAY_SIZE(tft_r0b0g0)) !=3D 0) { + err =3D -ENOENT; + goto out_panel_put; + } + + of_node_put(panel); + of_node_put(endpoint); =20 return clcdfb_of_init_tft_panel(fb, tft_r0b0g0[0], tft_r0b0g0[1], tft_r0b0g0[2]); +out_panel_put: + of_node_put(panel); +out_endpoint_put: + of_node_put(endpoint); + return err; } =20 static int clcdfb_of_vram_setup(struct clcd_fb *fb) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39708C25B08 for ; Mon, 15 Aug 2022 22:52:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352011AbiHOWuj (ORCPT ); Mon, 15 Aug 2022 18:50:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351528AbiHOWse (ORCPT ); Mon, 15 Aug 2022 18:48:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA14D136752; Mon, 15 Aug 2022 12:53:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5AD71B80EAD; Mon, 15 Aug 2022 19:53:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B878CC433D7; Mon, 15 Aug 2022 19:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593218; bh=g+7P8x4nQek5z0FnHiv1VkueNiRjREbVGrtQV0qPJVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YXlQ0G8yLLTS/XZcOttpiiV6whOwLVT1I2kRPilprHDpe87JEpqmV4IZGiZvIL+SD /j8O6WEd0nx7PCsjj03F4xCi/jY6P8Dv3sMx3LbQgS6ntPPqRs2HD1ma4Q0cCX2P7L QK0Y5tKfxmtcV8nwpOeDllgcJS5xncZtWDGkeANY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rustam Subkhankulov , Helge Deller , Sasha Levin Subject: [PATCH 5.18 0913/1095] video: fbdev: sis: fix typos in SiS_GetModeID() Date: Mon, 15 Aug 2022 20:05:12 +0200 Message-Id: <20220815180507.050652797@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rustam Subkhankulov [ Upstream commit 3eb8fccc244bfb41a7961969e4db280d44911226 ] The second operand of a '&&' operator has no impact on expression result for cases 400 and 512 in SiS_GetModeID(). Judging by the logic and the names of the variables, in both cases a typo was made. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Rustam Subkhankulov Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/video/fbdev/sis/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/sis/init.c b/drivers/video/fbdev/sis/init.c index b568c646a76c..2ba91d62af92 100644 --- a/drivers/video/fbdev/sis/init.c +++ b/drivers/video/fbdev/sis/init.c @@ -355,12 +355,12 @@ SiS_GetModeID(int VGAEngine, unsigned int VBFlags, in= t HDisplay, int VDisplay, } break; case 400: - if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >=3D 800) && (LCDwidth >=3D 60= 0))) { + if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >=3D 800) && (LCDheight >=3D 6= 00))) { if(VDisplay =3D=3D 300) ModeIndex =3D ModeIndex_400x300[Depth]; } break; case 512: - if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >=3D 1024) && (LCDwidth >=3D 7= 68))) { + if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >=3D 1024) && (LCDheight >=3D = 768))) { if(VDisplay =3D=3D 384) ModeIndex =3D ModeIndex_512x384[Depth]; } break; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 761FFC19F2C for ; Mon, 15 Aug 2022 22:52:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351710AbiHOWwR (ORCPT ); Mon, 15 Aug 2022 18:52:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351867AbiHOWtd (ORCPT ); Mon, 15 Aug 2022 18:49:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E2EA136779; Mon, 15 Aug 2022 12:53:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E00F5B8114A; Mon, 15 Aug 2022 19:53:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34A4DC433D6; Mon, 15 Aug 2022 19:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593224; bh=PsZshobPurGVYu4Uh9WAkoFpIzsC+Nh4RYI6CN0A+XU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h4eAIkb48VaHhkKA3e981eykRqCWlMqDWRAfifIxln7X0/i9y9npB8zYggIILDh6f avup/LZlMd07/lmgOY5DmPt4syxvohdMzEH9KiZ5VLGsyan+FRTcnmy8ITjJ7c8igv oUcgwes7GuETjtq4+A7GmOfOmnovVxy4f6pAVPWs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Mark Brown , Sasha Levin Subject: [PATCH 5.18 0914/1095] ASoC: mchp-spdifrx: disable end of block interrupt on failures Date: Mon, 15 Aug 2022 20:05:13 +0200 Message-Id: <20220815180507.099580115@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea [ Upstream commit 768ac4f12ca0fda935f58eb8c5120e9d795bc6e3 ] Disable end of block interrupt in case of wait for completion timeout or errors to undo previously enable operation (done in mchp_spdifrx_isr_blockend_en()). Otherwise we can end up with an unbalanced reference counter for this interrupt. Fixes: ef265c55c1ac ("ASoC: mchp-spdifrx: add driver for SPDIF RX") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220727090814.2446111-2-claudiu.beznea@mic= rochip.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/atmel/mchp-spdifrx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sound/soc/atmel/mchp-spdifrx.c b/sound/soc/atmel/mchp-spdifrx.c index 5fc968483f2c..a7baa0385ec5 100644 --- a/sound/soc/atmel/mchp-spdifrx.c +++ b/sound/soc/atmel/mchp-spdifrx.c @@ -288,15 +288,17 @@ static void mchp_spdifrx_isr_blockend_en(struct mchp_= spdifrx_dev *dev) spin_unlock_irqrestore(&dev->blockend_lock, flags); } =20 -/* called from atomic context only */ +/* called from atomic/non-atomic context */ static void mchp_spdifrx_isr_blockend_dis(struct mchp_spdifrx_dev *dev) { - spin_lock(&dev->blockend_lock); + unsigned long flags; + + spin_lock_irqsave(&dev->blockend_lock, flags); dev->blockend_refcount--; /* don't enable BLOCKEND interrupt if it's already enabled */ if (dev->blockend_refcount =3D=3D 0) regmap_write(dev->regmap, SPDIFRX_IDR, SPDIFRX_IR_BLOCKEND); - spin_unlock(&dev->blockend_lock); + spin_unlock_irqrestore(&dev->blockend_lock, flags); } =20 static irqreturn_t mchp_spdif_interrupt(int irq, void *dev_id) @@ -575,6 +577,7 @@ static int mchp_spdifrx_subcode_ch_get(struct mchp_spdi= frx_dev *dev, if (ret <=3D 0) { dev_dbg(dev->dev, "user data for channel %d timeout\n", channel); + mchp_spdifrx_isr_blockend_dis(dev); return ret; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8D89C00140 for ; Mon, 15 Aug 2022 22:52:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351919AbiHOWw0 (ORCPT ); Mon, 15 Aug 2022 18:52:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351956AbiHOWuJ (ORCPT ); Mon, 15 Aug 2022 18:50:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46A3A13728B; Mon, 15 Aug 2022 12:53:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ED54EB80EB1; Mon, 15 Aug 2022 19:53:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55FF6C433C1; Mon, 15 Aug 2022 19:53:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593230; bh=hjKaXMlf/qIWQalHOBKYAOOd5KyNV3mEb9Uy2J+LTrM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y9FMMkVsQ2hrqsXJOVlmzx3JhJEUCVhGyv/Lt7y17Gvfeq+qDV2wi0b45VrJvXNWP scvU2ze3K6HJbpCVezCGrlXk8hq346b2TldX7B/eH5aO/+3u1aq2vSIZuhb/FEuk2E 2gXhCoq3A7KXH1n5cpQLsyTQ5A4LtyR7CYtZ18eQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0915/1095] powerpc/32: Call mmu_mark_initmem_nx() regardless of data block mapping. Date: Mon, 15 Aug 2022 20:05:14 +0200 Message-Id: <20220815180507.134696584@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe Leroy [ Upstream commit 980bbf7ca72012d317617fcdbfabe8708e4cef29 ] mark_initmem_nx() calls either mmu_mark_initmem_nx() or set_memory_attr() based on return from v_block_mapped() of _sinittext. But we can now handle text and data independently, so that text may be mapped by block even when data is mapped by pages. On the 8xx for instance, at startup 32Mbytes of memory are pinned in TLB. So the pinned entries need to go away for sinittext. In next patch a BAT will be set to also covers sinittext on book3s/32. So it will also be needed to call mmu_mark_initmem_nx() even when data above sinittext is not mapped with BATs. As this is highly dependent on the platform, call mmu_mark_initmem_nx() regardless of data block mapping. Then the platform will know what to do. Modify 8xx mmu_mark_initmem_nx() so that inittext mapping is modified only when pagealloc debug and kfence are not active, otherwise inittext is mapped with standard pages. And don't do anything on kernel text which is already mapped with PAGE_KERNEL_TEXT. Fixes: da1adea07576 ("powerpc/8xx: Allow STRICT_KERNEL_RwX with pinned TLB") Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/db3fc14f3bfa6215b0786ef58a6e2bc1e1f964d7.16= 55202804.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/mm/nohash/8xx.c | 4 ++-- arch/powerpc/mm/pgtable_32.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/mm/nohash/8xx.c b/arch/powerpc/mm/nohash/8xx.c index 27f9186ae374..1ee08c3efe5b 100644 --- a/arch/powerpc/mm/nohash/8xx.c +++ b/arch/powerpc/mm/nohash/8xx.c @@ -179,8 +179,8 @@ void mmu_mark_initmem_nx(void) unsigned long boundary =3D strict_kernel_rwx_enabled() ? sinittext : etex= t8; unsigned long einittext8 =3D ALIGN(__pa(_einittext), SZ_8M); =20 - mmu_mapin_ram_chunk(0, boundary, PAGE_KERNEL_TEXT, false); - mmu_mapin_ram_chunk(boundary, einittext8, PAGE_KERNEL, false); + if (!debug_pagealloc_enabled_or_kfence()) + mmu_mapin_ram_chunk(boundary, einittext8, PAGE_KERNEL, false); =20 mmu_pin_tlb(block_mapped_ram, false); } diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c index a56ade39dc68..3ac73f9fb5d5 100644 --- a/arch/powerpc/mm/pgtable_32.c +++ b/arch/powerpc/mm/pgtable_32.c @@ -135,9 +135,9 @@ void mark_initmem_nx(void) unsigned long numpages =3D PFN_UP((unsigned long)_einittext) - PFN_DOWN((unsigned long)_sinittext); =20 - if (v_block_mapped((unsigned long)_sinittext)) { - mmu_mark_initmem_nx(); - } else { + mmu_mark_initmem_nx(); + + if (!v_block_mapped((unsigned long)_sinittext)) { set_memory_nx((unsigned long)_sinittext, numpages); set_memory_rw((unsigned long)_sinittext, numpages); } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62C77C00140 for ; Mon, 15 Aug 2022 22:52:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352063AbiHOWwh (ORCPT ); Mon, 15 Aug 2022 18:52:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352131AbiHOWu5 (ORCPT ); Mon, 15 Aug 2022 18:50:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D1BD13790B; Mon, 15 Aug 2022 12:54:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AB00FB80EB1; Mon, 15 Aug 2022 19:54:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D60C7C433C1; Mon, 15 Aug 2022 19:53:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593240; bh=+5i3Ku8ynmuTRvV2CSEcO5qjFU81rtcPqBZQ8aw0a6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tyshf22hQDUt7az4ejbPceFhmkoTyCGb+ibG+er91cwT9qEorcX2gyimiD4SzVlLx NtjI6PzVQlpaqIYPZK6daVYfEMUThzmycwLHeByHiysSYRKkOc8jEryCo9Kbtml3Ej 6uyBp6ENqiN8ANXiUmP7Ryd2FMTrqPmLzAzUhUQI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Erhard Furtner , Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0916/1095] powerpc/32s: Fix boot failure with KASAN + SMP + JUMP_LABEL_FEATURE_CHECK_DEBUG Date: Mon, 15 Aug 2022 20:05:15 +0200 Message-Id: <20220815180507.174163072@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe Leroy [ Upstream commit 6042a1652d643d1d34fa89bb314cb102960c0800 ] Since commit 4291d085b0b0 ("powerpc/32s: Make pte_update() non atomic on 603 core"), pte_update() has been using mmu_has_feature(MMU_FTR_HPTE_TABLE) to avoid a useless atomic operation on 603 cores. When kasan_early_init() sets up the early zero shadow, it uses __set_pte_at(). On book3s/32, __set_pte_at() calls pte_update() when CONFIG_SMP is selected in order to ensure the preservation of _PAGE_HASHPTE in case of concurrent update of the PTE. But that's too early for mmu_has_feature(), so when CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG is selected, mmu_has_feature() calls printk(). That's too early to call printk() because KASAN early zero shadow page is not set up yet. It leads to a deadlock. However, when kasan_early_init() is called, there is only one CPU running and no risk of concurrent PTE update. So __set_pte_at() can be called with the 'percpu' flag. With that flag set, the PTE is written directly instead of being written via pte_update(). Fixes: 4291d085b0b0 ("powerpc/32s: Make pte_update() non atomic on 603 core= ") Reported-by: Erhard Furtner Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/2ee707512b8b212b079b877f4ceb525a1606a3fb.16= 56655567.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/mm/kasan/kasan_init_32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/mm/kasan/kasan_init_32.c b/arch/powerpc/mm/kasan/= kasan_init_32.c index f3e4d069e0ba..a70828a6d935 100644 --- a/arch/powerpc/mm/kasan/kasan_init_32.c +++ b/arch/powerpc/mm/kasan/kasan_init_32.c @@ -25,7 +25,7 @@ static void __init kasan_populate_pte(pte_t *ptep, pgprot= _t prot) int i; =20 for (i =3D 0; i < PTRS_PER_PTE; i++, ptep++) - __set_pte_at(&init_mm, va, ptep, pfn_pte(PHYS_PFN(pa), prot), 0); + __set_pte_at(&init_mm, va, ptep, pfn_pte(PHYS_PFN(pa), prot), 1); } =20 int __init kasan_init_shadow_page_tables(unsigned long k_start, unsigned l= ong k_end) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B70FC00140 for ; Mon, 15 Aug 2022 22:52:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232251AbiHOWwu (ORCPT ); Mon, 15 Aug 2022 18:52:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352247AbiHOWvO (ORCPT ); Mon, 15 Aug 2022 18:51:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F217613793D; Mon, 15 Aug 2022 12:54:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DFAB9B81142; Mon, 15 Aug 2022 19:54:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38BAEC433D6; Mon, 15 Aug 2022 19:54:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593246; bh=Tc4WXDymJ2CTXI4iMTKoY3fQcpSHQK9LM9L2XSipGUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VfY1fKP7yAkF0Lvc0oAvSDDajKaY30341en6KGTpd9CVO0HIhFjFhkLrzYhWjbG1c wyNRD7kFYiSgDujc7NQ4Crt91npSOPc62+XaYOmPgO4ZZzag+M2OLaiqLna7cNTDb0 YuuKbN6NTvToKkNiEG1vAZGA2Ji/vOMznMR58eig= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0917/1095] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32 Date: Mon, 15 Aug 2022 20:05:16 +0200 Message-Id: <20220815180507.213650069@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe Leroy [ Upstream commit 9be013b2a9ecb29b5168e4b9db0e48ed53acf37c ] Commit 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32") enlarged the CPU selection logic to PPC32 by removing depend to PPC64, and failed to restrict that depend to E5500_CPU and E6500_CPU. Fortunately that got unnoticed because -mcpu=3D8540 will override the -mcpu=3De500mc64 or -mpcu=3De6500 as they are ealier, but that's fragile and may no be right in the future. Add back the depend PPC64 on E5500_CPU and E6500_CPU. Fixes: 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32") Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/8abab4888da69ff78b73a56f64d9678a7bf684e9.16= 57549153.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/platforms/Kconfig.cputype | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platform= s/Kconfig.cputype index e2e1fec91c6e..660309559bd8 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype @@ -173,11 +173,11 @@ config POWER9_CPU =20 config E5500_CPU bool "Freescale e5500" - depends on E500 + depends on PPC64 && E500 =20 config E6500_CPU bool "Freescale e6500" - depends on E500 + depends on PPC64 && E500 =20 config 860_CPU bool "8xx family" --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32835C00140 for ; Mon, 15 Aug 2022 22:53:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352131AbiHOWxD (ORCPT ); Mon, 15 Aug 2022 18:53:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352283AbiHOWvU (ORCPT ); Mon, 15 Aug 2022 18:51:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1FE37F0B3; Mon, 15 Aug 2022 12:54:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5A9E26125B; Mon, 15 Aug 2022 19:54:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7A69C433C1; Mon, 15 Aug 2022 19:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593253; bh=sKiBEb/WO7J87SDspMwCu7A8reFqLfqYphkL3HTvZ5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NwmNId6+xu4OfAeZIS/drCX0y0MAhVgZVPLLQX/CQgWJvhjnkayjRmc1T2NmwZaVw pvXwPZ3f6GFixNZ+uV6ST9FkYDSAB/Zt0oxqH/5PPjCymm8QssA2sWrkRcUc2+QpG2 1LROKt9ZuJ0j7DRivzcgv89ETWIGRfbAC31MNnxw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Joel Stanley , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0918/1095] powerpc: fix typos in comments Date: Mon, 15 Aug 2022 20:05:17 +0200 Message-Id: <20220815180507.245822806@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Julia Lawall [ Upstream commit 1fd02f6605b855b4af2883f29a2abc88bdf17857 ] Various spelling mistakes in comments. Detected with the help of Coccinelle. Signed-off-by: Julia Lawall Reviewed-by: Joel Stanley Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220430185654.5855-1-Julia.Lawall@inria.fr Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/boot/cuboot-hotfoot.c | 2 +- arch/powerpc/crypto/aes-spe-glue.c | 2 +- arch/powerpc/kernel/cputable.c | 2 +- arch/powerpc/kernel/dawr.c | 2 +- arch/powerpc/kernel/eeh.c | 4 ++-- arch/powerpc/kernel/eeh_event.c | 2 +- arch/powerpc/kernel/fadump.c | 4 ++-- arch/powerpc/kernel/module_32.c | 2 +- arch/powerpc/kernel/module_64.c | 4 ++-- arch/powerpc/kernel/pci-common.c | 2 +- arch/powerpc/kernel/pci_of_scan.c | 2 +- arch/powerpc/kernel/process.c | 4 ++-- arch/powerpc/kernel/prom_init.c | 2 +- arch/powerpc/kernel/ptrace/ptrace-view.c | 2 +- arch/powerpc/kernel/rtas_flash.c | 2 +- arch/powerpc/kernel/setup-common.c | 2 +- arch/powerpc/kernel/signal_64.c | 2 +- arch/powerpc/kernel/smp.c | 2 +- arch/powerpc/kernel/time.c | 4 ++-- arch/powerpc/kernel/watchdog.c | 2 +- arch/powerpc/kexec/core_64.c | 2 +- arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 +- arch/powerpc/kvm/book3s_64_vio_hv.c | 2 +- arch/powerpc/kvm/book3s_emulate.c | 2 +- arch/powerpc/kvm/book3s_hv_p9_entry.c | 2 +- arch/powerpc/kvm/book3s_hv_uvmem.c | 2 +- arch/powerpc/kvm/book3s_pr.c | 2 +- arch/powerpc/kvm/book3s_xics.c | 2 +- arch/powerpc/kvm/book3s_xive.c | 6 +++--- arch/powerpc/kvm/e500mc.c | 2 +- arch/powerpc/mm/book3s64/hash_pgtable.c | 2 +- arch/powerpc/mm/book3s64/hash_utils.c | 4 ++-- arch/powerpc/mm/book3s64/pgtable.c | 2 +- arch/powerpc/mm/book3s64/radix_pgtable.c | 2 +- arch/powerpc/mm/book3s64/radix_tlb.c | 2 +- arch/powerpc/mm/book3s64/slb.c | 4 ++-- arch/powerpc/mm/init_64.c | 4 ++-- arch/powerpc/mm/nohash/book3e_hugetlbpage.c | 2 +- arch/powerpc/mm/nohash/kaslr_booke.c | 2 +- arch/powerpc/mm/pgtable-frag.c | 2 +- arch/powerpc/perf/8xx-pmu.c | 2 +- arch/powerpc/perf/core-book3s.c | 6 +++--- arch/powerpc/perf/imc-pmu.c | 4 ++-- arch/powerpc/perf/isa207-common.c | 6 +++--- arch/powerpc/platforms/512x/clock-commonclk.c | 2 +- arch/powerpc/platforms/512x/mpc512x_shared.c | 2 +- arch/powerpc/platforms/52xx/mpc52xx_common.c | 2 +- arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 2 +- arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 2 +- arch/powerpc/platforms/85xx/mpc85xx_cds.c | 2 +- arch/powerpc/platforms/86xx/gef_ppc9a.c | 2 +- arch/powerpc/platforms/86xx/gef_sbc310.c | 2 +- arch/powerpc/platforms/86xx/gef_sbc610.c | 2 +- arch/powerpc/platforms/book3s/vas-api.c | 2 +- arch/powerpc/platforms/cell/cbe_regs.c | 2 +- arch/powerpc/platforms/cell/iommu.c | 2 +- arch/powerpc/platforms/cell/spider-pci.c | 2 +- arch/powerpc/platforms/cell/spu_manage.c | 2 +- arch/powerpc/platforms/powermac/low_i2c.c | 2 +- arch/powerpc/platforms/powernv/eeh-powernv.c | 10 +++++----- arch/powerpc/platforms/powernv/idle.c | 4 ++-- arch/powerpc/platforms/powernv/ocxl.c | 2 +- arch/powerpc/platforms/powernv/opal-fadump.c | 2 +- arch/powerpc/platforms/powernv/opal-lpc.c | 2 +- arch/powerpc/platforms/powernv/opal-memory-errors.c | 2 +- arch/powerpc/platforms/powernv/pci-sriov.c | 2 +- arch/powerpc/platforms/ps3/mm.c | 2 +- arch/powerpc/platforms/ps3/system-bus.c | 2 +- arch/powerpc/platforms/pseries/eeh_pseries.c | 2 +- arch/powerpc/platforms/pseries/iommu.c | 2 +- arch/powerpc/platforms/pseries/setup.c | 4 ++-- arch/powerpc/platforms/pseries/vas-sysfs.c | 2 +- arch/powerpc/platforms/pseries/vas.c | 2 +- arch/powerpc/sysdev/fsl_lbc.c | 2 +- arch/powerpc/sysdev/fsl_pci.c | 2 +- arch/powerpc/sysdev/ge/ge_pic.c | 2 +- arch/powerpc/sysdev/mpic_msgr.c | 2 +- arch/powerpc/sysdev/mpic_msi.c | 2 +- arch/powerpc/sysdev/mpic_timer.c | 2 +- arch/powerpc/sysdev/mpic_u3msi.c | 2 +- arch/powerpc/sysdev/xive/native.c | 2 +- arch/powerpc/xmon/ppc-opc.c | 2 +- arch/powerpc/xmon/xmon.c | 2 +- 83 files changed, 104 insertions(+), 104 deletions(-) diff --git a/arch/powerpc/boot/cuboot-hotfoot.c b/arch/powerpc/boot/cuboot-= hotfoot.c index 888a6b9bfead..0e5532f855d6 100644 --- a/arch/powerpc/boot/cuboot-hotfoot.c +++ b/arch/powerpc/boot/cuboot-hotfoot.c @@ -70,7 +70,7 @@ static void hotfoot_fixups(void) =20 printf("Fixing devtree for 4M Flash\n"); =09 - /* First fix up the base addresse */ + /* First fix up the base address */ getprop(devp, "reg", regs, sizeof(regs)); regs[0] =3D 0; regs[1] =3D 0xffc00000; diff --git a/arch/powerpc/crypto/aes-spe-glue.c b/arch/powerpc/crypto/aes-s= pe-glue.c index c2b23b69d7b1..e8dfe9fb0266 100644 --- a/arch/powerpc/crypto/aes-spe-glue.c +++ b/arch/powerpc/crypto/aes-spe-glue.c @@ -404,7 +404,7 @@ static int ppc_xts_decrypt(struct skcipher_request *req) =20 /* * Algorithm definitions. Disabling alignment (cra_alignmask=3D0) was chos= en - * because the e500 platform can handle unaligned reads/writes very effice= ntly. + * because the e500 platform can handle unaligned reads/writes very effici= ently. * This improves IPsec thoughput by another few percent. Additionally we a= ssume * that AES context is always aligned to at least 8 bytes because it is cr= eated * with kmalloc() in the crypto infrastructure diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index ae0fdef0ac11..2a271a6d6924 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c @@ -2025,7 +2025,7 @@ static struct cpu_spec * __init setup_cpu_spec(unsign= ed long offset, * oprofile_cpu_type already has a value, then we are * possibly overriding a real PVR with a logical one, * and, in that case, keep the current value for - * oprofile_cpu_type. Futhermore, let's ensure that the + * oprofile_cpu_type. Furthermore, let's ensure that the * fix for the PMAO bug is enabled on compatibility mode. */ if (old.oprofile_cpu_type !=3D NULL) { diff --git a/arch/powerpc/kernel/dawr.c b/arch/powerpc/kernel/dawr.c index 64e423d2fe0f..30d4eca88d17 100644 --- a/arch/powerpc/kernel/dawr.c +++ b/arch/powerpc/kernel/dawr.c @@ -27,7 +27,7 @@ int set_dawr(int nr, struct arch_hw_breakpoint *brk) dawrx |=3D (brk->type & (HW_BRK_TYPE_PRIV_ALL)) >> 3; /* * DAWR length is stored in field MDR bits 48:53. Matches range in - * doublewords (64 bits) baised by -1 eg. 0b000000=3D1DW and + * doublewords (64 bits) biased by -1 eg. 0b000000=3D1DW and * 0b111111=3D64DW. * brk->hw_len is in bytes. * This aligns up to double word size, shifts and does the bias. diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index 28bb1e7263a6..ab316e155ea9 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c @@ -1329,7 +1329,7 @@ int eeh_pe_set_option(struct eeh_pe *pe, int option) =20 /* * EEH functionality could possibly be disabled, just - * return error for the case. And the EEH functinality + * return error for the case. And the EEH functionality * isn't expected to be disabled on one specific PE. */ switch (option) { @@ -1804,7 +1804,7 @@ static int eeh_debugfs_break_device(struct pci_dev *p= dev) * PE freeze. Using the in_8() accessor skips the eeh detection hook * so the freeze hook so the EEH Detection machinery won't be * triggered here. This is to match the usual behaviour of EEH - * where the HW will asyncronously freeze a PE and it's up to + * where the HW will asynchronously freeze a PE and it's up to * the kernel to notice and deal with it. * * 3. Turn Memory space back on. This is more important for VFs diff --git a/arch/powerpc/kernel/eeh_event.c b/arch/powerpc/kernel/eeh_even= t.c index a7a8dc182efb..c23a454af08a 100644 --- a/arch/powerpc/kernel/eeh_event.c +++ b/arch/powerpc/kernel/eeh_event.c @@ -143,7 +143,7 @@ int __eeh_send_failure_event(struct eeh_pe *pe) int eeh_send_failure_event(struct eeh_pe *pe) { /* - * If we've manually supressed recovery events via debugfs + * If we've manually suppressed recovery events via debugfs * then just drop it on the floor. */ if (eeh_debugfs_no_recover) { diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index dc2350b288cf..aa29b9b7920f 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -1665,8 +1665,8 @@ int __init setup_fadump(void) } /* * Use subsys_initcall_sync() here because there is dependency with - * crash_save_vmcoreinfo_init(), which mush run first to ensure vmcoreinfo= initialization - * is done before regisering with f/w. + * crash_save_vmcoreinfo_init(), which must run first to ensure vmcoreinfo= initialization + * is done before registering with f/w. */ subsys_initcall_sync(setup_fadump); #else /* !CONFIG_PRESERVE_FA_DUMP */ diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_3= 2.c index a0432ef46967..e25b796682cc 100644 --- a/arch/powerpc/kernel/module_32.c +++ b/arch/powerpc/kernel/module_32.c @@ -99,7 +99,7 @@ static unsigned long get_plt_size(const Elf32_Ehdr *hdr, =20 /* Sort the relocation information based on a symbol and * addend key. This is a stable O(n*log n) complexity - * alogrithm but it will reduce the complexity of + * algorithm but it will reduce the complexity of * count_relocs() to linear complexity O(n) */ sort((void *)hdr + sechdrs[i].sh_offset, diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_6= 4.c index 794720530442..2cce576edbc5 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c @@ -194,7 +194,7 @@ static unsigned long get_stubs_size(const Elf64_Ehdr *h= dr, =20 /* Sort the relocation information based on a symbol and * addend key. This is a stable O(n*log n) complexity - * alogrithm but it will reduce the complexity of + * algorithm but it will reduce the complexity of * count_relocs() to linear complexity O(n) */ sort((void *)sechdrs[i].sh_addr, @@ -361,7 +361,7 @@ static inline int create_ftrace_stub(struct ppc64_stub_= entry *entry, entry->jump[1] |=3D PPC_HA(reladdr); entry->jump[2] |=3D PPC_LO(reladdr); =20 - /* Eventhough we don't use funcdata in the stub, it's needed elsewhere. */ + /* Even though we don't use funcdata in the stub, it's needed elsewhere. = */ entry->funcdata =3D func_desc(addr); entry->magic =3D STUB_MAGIC; =20 diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-com= mon.c index 8bc9cf62cd93..9a97a93bd11c 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -1688,7 +1688,7 @@ EXPORT_SYMBOL_GPL(pcibios_scan_phb); static void fixup_hide_host_resource_fsl(struct pci_dev *dev) { int i, class =3D dev->class >> 8; - /* When configured as agent, programing interface =3D 1 */ + /* When configured as agent, programming interface =3D 1 */ int prog_if =3D dev->class & 0xf; =20 if ((class =3D=3D PCI_CLASS_PROCESSOR_POWERPC || diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of= _scan.c index c3024f104765..6f2b0cc1ddd6 100644 --- a/arch/powerpc/kernel/pci_of_scan.c +++ b/arch/powerpc/kernel/pci_of_scan.c @@ -244,7 +244,7 @@ EXPORT_SYMBOL(of_create_pci_dev); * @dev: pci_dev structure for the bridge * * of_scan_bus() calls this routine for each PCI bridge that it finds, and - * this routine in turn call of_scan_bus() recusively to scan for more chi= ld + * this routine in turn call of_scan_bus() recursively to scan for more ch= ild * devices. */ void of_scan_pci_bridge(struct pci_dev *dev) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 9be279469a85..3940db48db77 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -307,7 +307,7 @@ static void __giveup_vsx(struct task_struct *tsk) unsigned long msr =3D tsk->thread.regs->msr; =20 /* - * We should never be ssetting MSR_VSX without also setting + * We should never be setting MSR_VSX without also setting * MSR_FP and MSR_VEC */ WARN_ON((msr & MSR_VSX) && !((msr & MSR_FP) && (msr & MSR_VEC))); @@ -645,7 +645,7 @@ static void do_break_handler(struct pt_regs *regs) return; } =20 - /* Otherwise findout which DAWR caused exception and disable it. */ + /* Otherwise find out which DAWR caused exception and disable it. */ wp_get_instr_detail(regs, &instr, &type, &size, &ea); =20 for (i =3D 0; i < nr_wp_slots(); i++) { diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_ini= t.c index 0ac5faacc909..ace861ec4c4c 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -3416,7 +3416,7 @@ unsigned long __init prom_init(unsigned long r3, unsi= gned long r4, * * PowerMacs use a different mechanism to spin CPUs * - * (This must be done after instanciating RTAS) + * (This must be done after instantiating RTAS) */ if (of_platform !=3D PLATFORM_POWERMAC) prom_hold_cpus(); diff --git a/arch/powerpc/kernel/ptrace/ptrace-view.c b/arch/powerpc/kernel= /ptrace/ptrace-view.c index f15bc78caf71..076d867412c7 100644 --- a/arch/powerpc/kernel/ptrace/ptrace-view.c +++ b/arch/powerpc/kernel/ptrace/ptrace-view.c @@ -174,7 +174,7 @@ int ptrace_get_reg(struct task_struct *task, int regno,= unsigned long *data) =20 /* * softe copies paca->irq_soft_mask variable state. Since irq_soft_mask is - * no more used as a flag, lets force usr to alway see the softe value as= 1 + * no more used as a flag, lets force usr to always see the softe value a= s 1 * which means interrupts are not soft disabled. */ if (IS_ENABLED(CONFIG_PPC64) && regno =3D=3D PT_SOFTE) { diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_fl= ash.c index a99179d83538..bc817a5619d6 100644 --- a/arch/powerpc/kernel/rtas_flash.c +++ b/arch/powerpc/kernel/rtas_flash.c @@ -120,7 +120,7 @@ static struct kmem_cache *flash_block_cache =3D NULL; /* * Local copy of the flash block list. * - * The rtas_firmware_flash_list varable will be + * The rtas_firmware_flash_list variable will be * set once the data is fully read. * * For convenience as we build the list we use virtual addrs, diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup= -common.c index 518ae5aa9410..3acf2782acdf 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -279,7 +279,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) proc_freq / 1000000, proc_freq % 1000000); =20 /* If we are a Freescale core do a simple check so - * we dont have to keep adding cases in the future */ + * we don't have to keep adding cases in the future */ if (PVR_VER(pvr) & 0x8000) { switch (PVR_VER(pvr)) { case 0x8000: /* 7441/7450/7451, Voyager */ diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_6= 4.c index 73d483b07ff3..858fc13b8c51 100644 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c @@ -123,7 +123,7 @@ static long notrace __unsafe_setup_sigcontext(struct si= gcontext __user *sc, #endif struct pt_regs *regs =3D tsk->thread.regs; unsigned long msr =3D regs->msr; - /* Force usr to alway see softe as 1 (interrupts enabled) */ + /* Force usr to always see softe as 1 (interrupts enabled) */ unsigned long softe =3D 0x1; =20 BUG_ON(tsk !=3D current); diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index de0f6f09a5dd..a69df557e2b7 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -1102,7 +1102,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) DBG("smp_prepare_cpus\n"); =20 /*=20 - * setup_cpu may need to be called on the boot cpu. We havent + * setup_cpu may need to be called on the boot cpu. We haven't * spun any cpus up but lets be paranoid. */ BUG_ON(boot_cpuid !=3D smp_processor_id()); diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index f80cce0e3899..4bf757ebe13d 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -829,7 +829,7 @@ static void __read_persistent_clock(struct timespec64 *= ts) static int first =3D 1; =20 ts->tv_nsec =3D 0; - /* XXX this is a litle fragile but will work okay in the short term */ + /* XXX this is a little fragile but will work okay in the short term */ if (first) { first =3D 0; if (ppc_md.time_init) @@ -974,7 +974,7 @@ void secondary_cpu_time_init(void) */ start_cpu_decrementer(); =20 - /* FIME: Should make unrelatred change to move snapshot_timebase + /* FIME: Should make unrelated change to move snapshot_timebase * call here ! */ register_decrementer_clockevent(smp_processor_id()); } diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c index bfc27496fe7e..7d28b9553654 100644 --- a/arch/powerpc/kernel/watchdog.c +++ b/arch/powerpc/kernel/watchdog.c @@ -56,7 +56,7 @@ * solved by also having a SMP watchdog where all CPUs check all other * CPUs heartbeat. * - * The SMP checker can detect lockups on other CPUs. A gobal "pending" + * The SMP checker can detect lockups on other CPUs. A global "pending" * cpumask is kept, containing all CPUs which enable the watchdog. Each * CPU clears their pending bit in their heartbeat timer. When the bitmask * becomes empty, the last CPU to clear its pending bit updates a global diff --git a/arch/powerpc/kexec/core_64.c b/arch/powerpc/kexec/core_64.c index 6cc7793b8420..c29c639551fe 100644 --- a/arch/powerpc/kexec/core_64.c +++ b/arch/powerpc/kexec/core_64.c @@ -406,7 +406,7 @@ static int __init export_htab_values(void) if (!node) return -ENODEV; =20 - /* remove any stale propertys so ours can be found */ + /* remove any stale properties so ours can be found */ of_remove_property(node, of_find_property(node, htab_base_prop.name, NULL= )); of_remove_property(node, of_find_property(node, htab_size_prop.name, NULL= )); =20 diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_= 64_mmu_hv.c index 0aeb51738ca9..1137c4df726c 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c @@ -58,7 +58,7 @@ struct kvm_resize_hpt { /* Possible values and their usage: * <0 an error occurred during allocation, * -EBUSY allocation is in the progress, - * 0 allocation made successfuly. + * 0 allocation made successfully. */ int error; =20 diff --git a/arch/powerpc/kvm/book3s_64_vio_hv.c b/arch/powerpc/kvm/book3s_= 64_vio_hv.c index fdeda6a9cff4..fdcc7b287dd8 100644 --- a/arch/powerpc/kvm/book3s_64_vio_hv.c +++ b/arch/powerpc/kvm/book3s_64_vio_hv.c @@ -453,7 +453,7 @@ static long kvmppc_rm_ua_to_hpa(struct kvm_vcpu *vcpu, = unsigned long mmu_seq, * we are doing this on secondary cpus and current task there * is not the hypervisor. Also this is safe against THP in the * host, because an IPI to primary thread will wait for the secondary - * to exit which will agains result in the below page table walk + * to exit which will again result in the below page table walk * to finish. */ /* an rmap lock won't make it safe. because that just ensure hash diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_em= ulate.c index fdb57be71aa6..5bbfb2eed127 100644 --- a/arch/powerpc/kvm/book3s_emulate.c +++ b/arch/powerpc/kvm/book3s_emulate.c @@ -268,7 +268,7 @@ int kvmppc_core_emulate_op_pr(struct kvm_vcpu *vcpu, =20 /* * add rules to fit in ISA specification regarding TM - * state transistion in TM disable/Suspended state, + * state transition in TM disable/Suspended state, * and target TM state is TM inactive(00) state. (the * change should be suppressed). */ diff --git a/arch/powerpc/kvm/book3s_hv_p9_entry.c b/arch/powerpc/kvm/book3= s_hv_p9_entry.c index a28e5b3daabd..ac38c1cad378 100644 --- a/arch/powerpc/kvm/book3s_hv_p9_entry.c +++ b/arch/powerpc/kvm/book3s_hv_p9_entry.c @@ -379,7 +379,7 @@ void restore_p9_host_os_sprs(struct kvm_vcpu *vcpu, { /* * current->thread.xxx registers must all be restored to host - * values before a potential context switch, othrewise the context + * values before a potential context switch, otherwise the context * switch itself will overwrite current->thread.xxx with the values * from the guest SPRs. */ diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_h= v_uvmem.c index 36f2314c58e5..598006301620 100644 --- a/arch/powerpc/kvm/book3s_hv_uvmem.c +++ b/arch/powerpc/kvm/book3s_hv_uvmem.c @@ -120,7 +120,7 @@ static DEFINE_SPINLOCK(kvmppc_uvmem_bitmap_lock); * content is un-encrypted. * * (c) Normal - The GFN is a normal. The GFN is associated with - * a normal VM. The contents of the GFN is accesible to + * a normal VM. The contents of the GFN is accessible to * the Hypervisor. Its content is never encrypted. * * States of a VM. diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c index 7bf9e6ca5c2d..d6abed6e51e6 100644 --- a/arch/powerpc/kvm/book3s_pr.c +++ b/arch/powerpc/kvm/book3s_pr.c @@ -1287,7 +1287,7 @@ int kvmppc_handle_exit_pr(struct kvm_vcpu *vcpu, unsi= gned int exit_nr) =20 /* Get last sc for papr */ if (vcpu->arch.papr_enabled) { - /* The sc instuction points SRR0 to the next inst */ + /* The sc instruction points SRR0 to the next inst */ emul =3D kvmppc_get_last_inst(vcpu, INST_SC, &last_sc); if (emul !=3D EMULATE_DONE) { kvmppc_set_pc(vcpu, kvmppc_get_pc(vcpu) - 4); diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c index ab6d37d78c62..589a8f257120 100644 --- a/arch/powerpc/kvm/book3s_xics.c +++ b/arch/powerpc/kvm/book3s_xics.c @@ -462,7 +462,7 @@ static void icp_deliver_irq(struct kvmppc_xics *xics, s= truct kvmppc_icp *icp, * new guy. We cannot assume that the rejected interrupt is less * favored than the new one, and thus doesn't need to be delivered, * because by the time we exit icp_try_to_deliver() the target - * processor may well have alrady consumed & completed it, and thus + * processor may well have already consumed & completed it, and thus * the rejected interrupt might actually be already acceptable. */ if (icp_try_to_deliver(icp, new_irq, state->priority, &reject)) { diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c index c0ce5531d9bc..24d434f1f012 100644 --- a/arch/powerpc/kvm/book3s_xive.c +++ b/arch/powerpc/kvm/book3s_xive.c @@ -124,7 +124,7 @@ void kvmppc_xive_push_vcpu(struct kvm_vcpu *vcpu) * interrupt might have fired and be on its way to the * host queue while we mask it, and if we unmask it * early enough (re-cede right away), there is a - * theorical possibility that it fires again, thus + * theoretical possibility that it fires again, thus * landing in the target queue more than once which is * a big no-no. * @@ -622,7 +622,7 @@ static int xive_target_interrupt(struct kvm *kvm, =20 /* * Targetting rules: In order to avoid losing track of - * pending interrupts accross mask and unmask, which would + * pending interrupts across mask and unmask, which would * allow queue overflows, we implement the following rules: * * - Unless it was never enabled (or we run out of capacity) @@ -1073,7 +1073,7 @@ int kvmppc_xive_clr_mapped(struct kvm *kvm, unsigned = long guest_irq, /* * If old_p is set, the interrupt is pending, we switch it to * PQ=3D11. This will force a resend in the host so the interrupt - * isn't lost to whatver host driver may pick it up + * isn't lost to whatever host driver may pick it up */ if (state->old_p) xive_vm_esb_load(state->pt_data, XIVE_ESB_SET_PQ_11); diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c index fa0d8dbbe484..4ff1372e48d4 100644 --- a/arch/powerpc/kvm/e500mc.c +++ b/arch/powerpc/kvm/e500mc.c @@ -309,7 +309,7 @@ static int kvmppc_core_vcpu_create_e500mc(struct kvm_vc= pu *vcpu) BUILD_BUG_ON(offsetof(struct kvmppc_vcpu_e500, vcpu) !=3D 0); vcpu_e500 =3D to_e500(vcpu); =20 - /* Invalid PIR value -- this LPID dosn't have valid state on any cpu */ + /* Invalid PIR value -- this LPID doesn't have valid state on any cpu */ vcpu->arch.oldpir =3D 0xffffffff; =20 err =3D kvmppc_e500_tlb_init(vcpu_e500); diff --git a/arch/powerpc/mm/book3s64/hash_pgtable.c b/arch/powerpc/mm/book= 3s64/hash_pgtable.c index 7ce8914992e3..2e0cad5817ba 100644 --- a/arch/powerpc/mm/book3s64/hash_pgtable.c +++ b/arch/powerpc/mm/book3s64/hash_pgtable.c @@ -377,7 +377,7 @@ int hash__has_transparent_hugepage(void) if (mmu_psize_defs[MMU_PAGE_16M].shift !=3D PMD_SHIFT) return 0; /* - * We need to make sure that we support 16MB hugepage in a segement + * We need to make sure that we support 16MB hugepage in a segment * with base page size 64K or 4K. We only enable THP with a PAGE_SIZE * of 64K. */ diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s= 64/hash_utils.c index 985cabdd7f67..5b69b271707e 100644 --- a/arch/powerpc/mm/book3s64/hash_utils.c +++ b/arch/powerpc/mm/book3s64/hash_utils.c @@ -1343,7 +1343,7 @@ static int subpage_protection(struct mm_struct *mm, u= nsigned long ea) spp >>=3D 30 - 2 * ((ea >> 12) & 0xf); =20 /* - * 0 -> full premission + * 0 -> full permission * 1 -> Read only * 2 -> no access. * We return the flag that need to be cleared. @@ -1664,7 +1664,7 @@ DEFINE_INTERRUPT_HANDLER(do_hash_fault) =20 err =3D hash_page_mm(mm, ea, access, TRAP(regs), flags); if (unlikely(err < 0)) { - // failed to instert a hash PTE due to an hypervisor error + // failed to insert a hash PTE due to an hypervisor error if (user_mode(regs)) { if (IS_ENABLED(CONFIG_PPC_SUBPAGE_PROT) && err =3D=3D -2) _exception(SIGSEGV, regs, SEGV_ACCERR, ea); diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/= pgtable.c index 052e6590f84f..071bb66c3ad9 100644 --- a/arch/powerpc/mm/book3s64/pgtable.c +++ b/arch/powerpc/mm/book3s64/pgtable.c @@ -331,7 +331,7 @@ static pmd_t *__alloc_for_pmdcache(struct mm_struct *mm) spin_lock(&mm->page_table_lock); /* * If we find pgtable_page set, we return - * the allocated page with single fragement + * the allocated page with single fragment * count. */ if (likely(!mm->context.pmd_frag)) { diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/boo= k3s64/radix_pgtable.c index def04631a74d..db2f3d193448 100644 --- a/arch/powerpc/mm/book3s64/radix_pgtable.c +++ b/arch/powerpc/mm/book3s64/radix_pgtable.c @@ -359,7 +359,7 @@ static void __init radix_init_pgtable(void) if (!cpu_has_feature(CPU_FTR_HVMODE) && cpu_has_feature(CPU_FTR_P9_RADIX_PREFETCH_BUG)) { /* - * Older versions of KVM on these machines perfer if the + * Older versions of KVM on these machines prefer if the * guest only uses the low 19 PID bits. */ mmu_pid_bits =3D 19; diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s6= 4/radix_tlb.c index 7724af19ed7e..dda51fef2d2e 100644 --- a/arch/powerpc/mm/book3s64/radix_tlb.c +++ b/arch/powerpc/mm/book3s64/radix_tlb.c @@ -397,7 +397,7 @@ static inline void _tlbie_pid(unsigned long pid, unsign= ed long ric) =20 /* * Workaround the fact that the "ric" argument to __tlbie_pid - * must be a compile-time contraint to match the "i" constraint + * must be a compile-time constraint to match the "i" constraint * in the asm statement. */ switch (ric) { diff --git a/arch/powerpc/mm/book3s64/slb.c b/arch/powerpc/mm/book3s64/slb.c index 81091b9587f6..6956f637a38c 100644 --- a/arch/powerpc/mm/book3s64/slb.c +++ b/arch/powerpc/mm/book3s64/slb.c @@ -347,7 +347,7 @@ void slb_setup_new_exec(void) /* * We have no good place to clear the slb preload cache on exec, * flush_thread is about the earliest arch hook but that happens - * after we switch to the mm and have aleady preloaded the SLBEs. + * after we switch to the mm and have already preloaded the SLBEs. * * For the most part that's probably okay to use entries from the * previous exec, they will age out if unused. It may turn out to @@ -615,7 +615,7 @@ static void slb_cache_update(unsigned long esid_data) } else { /* * Our cache is full and the current cache content strictly - * doesn't indicate the active SLB conents. Bump the ptr + * doesn't indicate the active SLB contents. Bump the ptr * so that switch_slb() will ignore the cache. */ local_paca->slb_cache_ptr =3D SLB_CACHE_ENTRIES + 1; diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c index 83c0ee9fbf05..2e11952057f8 100644 --- a/arch/powerpc/mm/init_64.c +++ b/arch/powerpc/mm/init_64.c @@ -111,7 +111,7 @@ static int __meminit vmemmap_populated(unsigned long vm= emmap_addr, int vmemmap_m } =20 /* - * vmemmap virtual address space management does not have a traditonal page + * vmemmap virtual address space management does not have a traditional pa= ge * table to track which virtual struct pages are backed by physical mappin= g. * The virtual to physical mappings are tracked in a simple linked list * format. 'vmemmap_list' maintains the entire vmemmap physical mapping at @@ -128,7 +128,7 @@ static struct vmemmap_backing *next; =20 /* * The same pointer 'next' tracks individual chunks inside the allocated - * full page during the boot time and again tracks the freeed nodes during + * full page during the boot time and again tracks the freed nodes during * runtime. It is racy but it does not happen as they are separated by the * boot process. Will create problem if some how we have memory hotplug * operation during boot !! diff --git a/arch/powerpc/mm/nohash/book3e_hugetlbpage.c b/arch/powerpc/mm/= nohash/book3e_hugetlbpage.c index 8b88be91b622..307ca919d393 100644 --- a/arch/powerpc/mm/nohash/book3e_hugetlbpage.c +++ b/arch/powerpc/mm/nohash/book3e_hugetlbpage.c @@ -142,7 +142,7 @@ book3e_hugetlb_preload(struct vm_area_struct *vma, unsi= gned long ea, pte_t pte) tsize =3D shift - 10; /* * We can't be interrupted while we're setting up the MAS - * regusters or after we've confirmed that no tlb exists. + * registers or after we've confirmed that no tlb exists. */ local_irq_save(flags); =20 diff --git a/arch/powerpc/mm/nohash/kaslr_booke.c b/arch/powerpc/mm/nohash/= kaslr_booke.c index 5f81c076621f..37eb8d80bd53 100644 --- a/arch/powerpc/mm/nohash/kaslr_booke.c +++ b/arch/powerpc/mm/nohash/kaslr_booke.c @@ -311,7 +311,7 @@ static unsigned long __init kaslr_choose_location(void = *dt_ptr, phys_addr_t size ram =3D map_mem_in_cams(ram, CONFIG_LOWMEM_CAM_NUM, true, true); linear_sz =3D min_t(unsigned long, ram, SZ_512M); =20 - /* If the linear size is smaller than 64M, do not randmize */ + /* If the linear size is smaller than 64M, do not randomize */ if (linear_sz < SZ_64M) return 0; =20 diff --git a/arch/powerpc/mm/pgtable-frag.c b/arch/powerpc/mm/pgtable-frag.c index 97ae4935da79..20652daa1d7e 100644 --- a/arch/powerpc/mm/pgtable-frag.c +++ b/arch/powerpc/mm/pgtable-frag.c @@ -83,7 +83,7 @@ static pte_t *__alloc_for_ptecache(struct mm_struct *mm, = int kernel) spin_lock(&mm->page_table_lock); /* * If we find pgtable_page set, we return - * the allocated page with single fragement + * the allocated page with single fragment * count. */ if (likely(!pte_frag_get(&mm->context))) { diff --git a/arch/powerpc/perf/8xx-pmu.c b/arch/powerpc/perf/8xx-pmu.c index 4738c4dbf567..308a2e40d7be 100644 --- a/arch/powerpc/perf/8xx-pmu.c +++ b/arch/powerpc/perf/8xx-pmu.c @@ -157,7 +157,7 @@ static void mpc8xx_pmu_del(struct perf_event *event, in= t flags) =20 mpc8xx_pmu_read(event); =20 - /* If it was the last user, stop counting to avoid useles overhead */ + /* If it was the last user, stop counting to avoid useless overhead */ switch (event_type(event)) { case PERF_8xx_ID_CPU_CYCLES: break; diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3= s.c index 3adc08254875..03c64a0195df 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c @@ -1142,7 +1142,7 @@ static u64 check_and_compute_delta(u64 prev, u64 val) /* * POWER7 can roll back counter values, if the new value is smaller * than the previous value it will cause the delta and the counter to - * have bogus values unless we rolled a counter over. If a coutner is + * have bogus values unless we rolled a counter over. If a counter is * rolled back, it will be smaller, but within 256, which is the maximum * number of events to rollback at once. If we detect a rollback * return 0. This can lead to a small lack of precision in the @@ -2052,7 +2052,7 @@ static int power_pmu_event_init(struct perf_event *ev= ent) /* * PMU config registers have fields that are * reserved and some specific values for bit fields are reserved. - * For ex., MMCRA[61:62] is Randome Sampling Mode (SM) + * For ex., MMCRA[61:62] is Random Sampling Mode (SM) * and value of 0b11 to this field is reserved. * Check for invalid values in attr.config. */ @@ -2442,7 +2442,7 @@ static void __perf_event_interrupt(struct pt_regs *re= gs) } =20 /* - * During system wide profling or while specific CPU is monitored for an + * During system wide profiling or while specific CPU is monitored for an * event, some corner cases could cause PMC to overflow in idle path. This * will trigger a PMI after waking up from idle. Since counter values are= _not_ * saved/restored in idle path, can lead to below "Can't find PMC" messag= e. diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c index 526d4b767534..498f1a2f7658 100644 --- a/arch/powerpc/perf/imc-pmu.c +++ b/arch/powerpc/perf/imc-pmu.c @@ -521,7 +521,7 @@ static int nest_imc_event_init(struct perf_event *event) =20 /* * Nest HW counter memory resides in a per-chip reserve-memory (HOMER). - * Get the base memory addresss for this cpu. + * Get the base memory address for this cpu. */ chip_id =3D cpu_to_chip_id(event->cpu); =20 @@ -674,7 +674,7 @@ static int ppc_core_imc_cpu_offline(unsigned int cpu) /* * Check whether core_imc is registered. We could end up here * if the cpuhotplug callback registration fails. i.e, callback - * invokes the offline path for all sucessfully registered cpus. + * invokes the offline path for all successfully registered cpus. * At this stage, core_imc pmu will not be registered and we * should return here. * diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-c= ommon.c index bb5d64862bc9..42abbcfc73da 100644 --- a/arch/powerpc/perf/isa207-common.c +++ b/arch/powerpc/perf/isa207-common.c @@ -82,11 +82,11 @@ static unsigned long sdar_mod_val(u64 event) static void mmcra_sdar_mode(u64 event, unsigned long *mmcra) { /* - * MMCRA[SDAR_MODE] specifices how the SDAR should be updated in - * continous sampling mode. + * MMCRA[SDAR_MODE] specifies how the SDAR should be updated in + * continuous sampling mode. * * Incase of Power8: - * MMCRA[SDAR_MODE] will be programmed as "0b01" for continous sampling + * MMCRA[SDAR_MODE] will be programmed as "0b01" for continuous sampling * mode and will be un-changed when setting MMCRA[63] (Marked events). * * Incase of Power9/power10: diff --git a/arch/powerpc/platforms/512x/clock-commonclk.c b/arch/powerpc/p= latforms/512x/clock-commonclk.c index 0b03d812baae..0652c7e69225 100644 --- a/arch/powerpc/platforms/512x/clock-commonclk.c +++ b/arch/powerpc/platforms/512x/clock-commonclk.c @@ -663,7 +663,7 @@ static void __init mpc512x_clk_setup_mclk(struct mclk_s= etup_data *entry, size_t * the PSC/MSCAN/SPDIF (serial drivers et al) need the MCLK * for their bitrate * - in the absence of "aliases" for clocks we need to create - * individial 'struct clk' items for whatever might get + * individual 'struct clk' items for whatever might get * referenced or looked up, even if several of those items are * identical from the logical POV (their rate value) * - for easier future maintenance and for better reflection of diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/pl= atforms/512x/mpc512x_shared.c index e3411663edad..96d9cf49560d 100644 --- a/arch/powerpc/platforms/512x/mpc512x_shared.c +++ b/arch/powerpc/platforms/512x/mpc512x_shared.c @@ -289,7 +289,7 @@ static void __init mpc512x_setup_diu(void) =20 /* * We do not allocate and configure new area for bitmap buffer - * because it would requere copying bitmap data (splash image) + * because it would require copying bitmap data (splash image) * and so negatively affect boot time. Instead we reserve the * already configured frame buffer area so that it won't be * destroyed. The starting address of the area to reserve and diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/pl= atforms/52xx/mpc52xx_common.c index 565e3a83dc9e..60aa6015e284 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_common.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c @@ -308,7 +308,7 @@ int mpc5200_psc_ac97_gpio_reset(int psc_number) =20 spin_lock_irqsave(&gpio_lock, flags); =20 - /* Reconfiure pin-muxing to gpio */ + /* Reconfigure pin-muxing to gpio */ mux =3D in_be32(&simple_gpio->port_config); out_be32(&simple_gpio->port_config, mux & (~gpio)); =20 diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platf= orms/52xx/mpc52xx_gpt.c index f862b48b4824..7252d992ca9f 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c @@ -398,7 +398,7 @@ static int mpc52xx_gpt_do_start(struct mpc52xx_gpt_priv= *gpt, u64 period, set |=3D MPC52xx_GPT_MODE_CONTINUOUS; =20 /* Determine the number of clocks in the requested period. 64 bit - * arithmatic is done here to preserve the precision until the value + * arithmetic is done here to preserve the precision until the value * is scaled back down into the u32 range. Period is in 'ns', bus * frequency is in Hz. */ clocks =3D period * (u64)gpt->ipb_freq; diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/p= latforms/52xx/mpc52xx_lpbfifo.c index b91ebebd9ff2..54dfc63809d3 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c @@ -104,7 +104,7 @@ static void mpc52xx_lpbfifo_kick(struct mpc52xx_lpbfifo= _request *req) * * Configure the watermarks so DMA will always complete correctly. * It may be worth experimenting with the ALARM value to see if - * there is a performance impacit. However, if it is wrong there + * there is a performance impact. However, if it is wrong there * is a risk of DMA not transferring the last chunk of data */ if (write) { diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platf= orms/85xx/mpc85xx_cds.c index 5bd487030256..ad0b88ecfd0c 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c @@ -151,7 +151,7 @@ static void __init mpc85xx_cds_pci_irq_fixup(struct pci= _dev *dev) */ case PCI_DEVICE_ID_VIA_82C586_2: /* There are two USB controllers. - * Identify them by functon number + * Identify them by function number */ if (PCI_FUNC(dev->devfn) =3D=3D 3) dev->irq =3D 11; diff --git a/arch/powerpc/platforms/86xx/gef_ppc9a.c b/arch/powerpc/platfor= ms/86xx/gef_ppc9a.c index 44bbbc535e1d..884da08806ce 100644 --- a/arch/powerpc/platforms/86xx/gef_ppc9a.c +++ b/arch/powerpc/platforms/86xx/gef_ppc9a.c @@ -180,7 +180,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_= ID_NEC_USB, * * This function is called to determine whether the BSP is compatible with= the * supplied device-tree, which is assumed to be the correct one for the ac= tual - * board. It is expected thati, in the future, a kernel may support multip= le + * board. It is expected that, in the future, a kernel may support multiple * boards. */ static int __init gef_ppc9a_probe(void) diff --git a/arch/powerpc/platforms/86xx/gef_sbc310.c b/arch/powerpc/platfo= rms/86xx/gef_sbc310.c index 46d6d3d4957a..baaf1ab07016 100644 --- a/arch/powerpc/platforms/86xx/gef_sbc310.c +++ b/arch/powerpc/platforms/86xx/gef_sbc310.c @@ -167,7 +167,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_= ID_NEC_USB, * * This function is called to determine whether the BSP is compatible with= the * supplied device-tree, which is assumed to be the correct one for the ac= tual - * board. It is expected thati, in the future, a kernel may support multip= le + * board. It is expected that, in the future, a kernel may support multiple * boards. */ static int __init gef_sbc310_probe(void) diff --git a/arch/powerpc/platforms/86xx/gef_sbc610.c b/arch/powerpc/platfo= rms/86xx/gef_sbc610.c index acf2c6c3c1eb..120caf6af71d 100644 --- a/arch/powerpc/platforms/86xx/gef_sbc610.c +++ b/arch/powerpc/platforms/86xx/gef_sbc610.c @@ -157,7 +157,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_= ID_NEC_USB, * * This function is called to determine whether the BSP is compatible with= the * supplied device-tree, which is assumed to be the correct one for the ac= tual - * board. It is expected thati, in the future, a kernel may support multip= le + * board. It is expected that, in the future, a kernel may support multiple * boards. */ static int __init gef_sbc610_probe(void) diff --git a/arch/powerpc/platforms/book3s/vas-api.c b/arch/powerpc/platfor= ms/book3s/vas-api.c index f9a1615b74da..c0799fb26b6d 100644 --- a/arch/powerpc/platforms/book3s/vas-api.c +++ b/arch/powerpc/platforms/book3s/vas-api.c @@ -30,7 +30,7 @@ * * where "vas_copy" and "vas_paste" are defined in copy-paste.h. * copy/paste returns to the user space directly. So refer NX hardware - * documententation for exact copy/paste usage and completion / error + * documentation for exact copy/paste usage and completion / error * conditions. */ =20 diff --git a/arch/powerpc/platforms/cell/cbe_regs.c b/arch/powerpc/platform= s/cell/cbe_regs.c index 1c4c53bec66c..03512a41bd7e 100644 --- a/arch/powerpc/platforms/cell/cbe_regs.c +++ b/arch/powerpc/platforms/cell/cbe_regs.c @@ -23,7 +23,7 @@ * Current implementation uses "cpu" nodes. We build our own mapping * array of cpu numbers to cpu nodes locally for now to allow interrupt * time code to have a fast path rather than call of_get_cpu_node(). If - * we implement cpu hotplug, we'll have to install an appropriate norifier + * we implement cpu hotplug, we'll have to install an appropriate notifier * in order to release references to the cpu going away */ static struct cbe_regs_map diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/c= ell/iommu.c index 25e726bf0172..3f141cf5e580 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c @@ -582,7 +582,7 @@ static int cell_of_bus_notify(struct notifier_block *nb= , unsigned long action, { struct device *dev =3D data; =20 - /* We are only intereted in device addition */ + /* We are only interested in device addition */ if (action !=3D BUS_NOTIFY_ADD_DEVICE) return 0; =20 diff --git a/arch/powerpc/platforms/cell/spider-pci.c b/arch/powerpc/platfo= rms/cell/spider-pci.c index a1c293f42a1f..3a2ea8376e32 100644 --- a/arch/powerpc/platforms/cell/spider-pci.c +++ b/arch/powerpc/platforms/cell/spider-pci.c @@ -81,7 +81,7 @@ static int __init spiderpci_pci_setup_chip(struct pci_con= troller *phb, /* * On CellBlade, we can't know that which XDR memory is used by * kmalloc() to allocate dummy_page_va. - * In order to imporve the performance, the XDR which is used to + * In order to improve the performance, the XDR which is used to * allocate dummy_page_va is the nearest the spider-pci. * We have to select the CBE which is the nearest the spider-pci * to allocate memory from the best XDR, but I don't know that diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platfo= rms/cell/spu_manage.c index ddf8742f09a3..080ed2d2c682 100644 --- a/arch/powerpc/platforms/cell/spu_manage.c +++ b/arch/powerpc/platforms/cell/spu_manage.c @@ -457,7 +457,7 @@ static void __init init_affinity_node(int cbe) =20 /* * Walk through each phandle in vicinity property of the spu - * (tipically two vicinity phandles per spe node) + * (typically two vicinity phandles per spe node) */ for (i =3D 0; i < (lenp / sizeof(phandle)); i++) { if (vic_handles[i] =3D=3D avoid_ph) diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platf= orms/powermac/low_i2c.c index df89d916236d..9aded0188ce8 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c @@ -1472,7 +1472,7 @@ int __init pmac_i2c_init(void) smu_i2c_probe(); #endif =20 - /* Now add plaform functions for some known devices */ + /* Now add platform functions for some known devices */ pmac_i2c_devscan(pmac_i2c_dev_create); =20 return 0; diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/pl= atforms/powernv/eeh-powernv.c index 89e22c460ebf..33f7b959c810 100644 --- a/arch/powerpc/platforms/powernv/eeh-powernv.c +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c @@ -390,7 +390,7 @@ static struct eeh_dev *pnv_eeh_probe(struct pci_dev *pd= ev) * should be blocked until PE reset. MMIO access is dropped * by hardware certainly. In order to drop PCI config requests, * one more flag (EEH_PE_CFG_RESTRICTED) is introduced, which - * will be checked in the backend for PE state retrival. If + * will be checked in the backend for PE state retrieval. If * the PE becomes frozen for the first time and the flag has * been set for the PE, we will set EEH_PE_CFG_BLOCKED for * that PE to block its config space. @@ -981,7 +981,7 @@ static int pnv_eeh_do_af_flr(struct pci_dn *pdn, int op= tion) case EEH_RESET_FUNDAMENTAL: /* * Wait for Transaction Pending bit to clear. A word-aligned - * test is used, so we use the conrol offset rather than status + * test is used, so we use the control offset rather than status * and shift the test bit to match. */ pnv_eeh_wait_for_pending(pdn, "AF", @@ -1048,7 +1048,7 @@ static int pnv_eeh_reset(struct eeh_pe *pe, int optio= n) * frozen state during PE reset. However, the good idea here from * benh is to keep frozen state before we get PE reset done completely * (until BAR restore). With the frozen state, HW drops illegal IO - * or MMIO access, which can incur recrusive frozen PE during PE + * or MMIO access, which can incur recursive frozen PE during PE * reset. The side effect is that EEH core has to clear the frozen * state explicitly after BAR restore. */ @@ -1095,8 +1095,8 @@ static int pnv_eeh_reset(struct eeh_pe *pe, int optio= n) * bus is behind a hotplug slot and it will use the slot provided * reset methods to prevent spurious hotplug events during the reset. * - * Fundemental resets need to be handled internally to EEH since the - * PCI core doesn't really have a concept of a fundemental reset, + * Fundamental resets need to be handled internally to EEH since the + * PCI core doesn't really have a concept of a fundamental reset, * mainly because there's no standard way to generate one. Only a * few devices require an FRESET so it should be fine. */ diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms= /powernv/idle.c index a6677a111aca..6f94b808dd39 100644 --- a/arch/powerpc/platforms/powernv/idle.c +++ b/arch/powerpc/platforms/powernv/idle.c @@ -112,7 +112,7 @@ static int __init pnv_save_sprs_for_deep_states(void) if (rc !=3D 0) return rc; =20 - /* Only p8 needs to set extra HID regiters */ + /* Only p8 needs to set extra HID registers */ if (!cpu_has_feature(CPU_FTR_ARCH_300)) { uint64_t hid1_val =3D mfspr(SPRN_HID1); uint64_t hid4_val =3D mfspr(SPRN_HID4); @@ -1204,7 +1204,7 @@ static void __init pnv_arch300_idle_init(void) * The idle code does not deal with TB loss occurring * in a shallower state than SPR loss, so force it to * behave like SPRs are lost if TB is lost. POWER9 would - * never encouter this, but a POWER8 core would if it + * never encounter this, but a POWER8 core would if it * implemented the stop instruction. So this is for forward * compatibility. */ diff --git a/arch/powerpc/platforms/powernv/ocxl.c b/arch/powerpc/platforms= /powernv/ocxl.c index 28b009b46464..27c936075031 100644 --- a/arch/powerpc/platforms/powernv/ocxl.c +++ b/arch/powerpc/platforms/powernv/ocxl.c @@ -289,7 +289,7 @@ int pnv_ocxl_get_pasid_count(struct pci_dev *dev, int *= count) * be used by a function depends on how many functions exist * on the device. The NPU needs to be configured to know how * many bits are available to PASIDs and how many are to be - * used by the function BDF indentifier. + * used by the function BDF identifier. * * We only support one AFU-carrying function for now. */ diff --git a/arch/powerpc/platforms/powernv/opal-fadump.c b/arch/powerpc/pl= atforms/powernv/opal-fadump.c index 9d74d3950a52..c1bcd2d4826e 100644 --- a/arch/powerpc/platforms/powernv/opal-fadump.c +++ b/arch/powerpc/platforms/powernv/opal-fadump.c @@ -206,7 +206,7 @@ static u64 opal_fadump_init_mem_struct(struct fw_dump *= fadump_conf) opal_fdm->region_cnt =3D cpu_to_be16(reg_cnt); =20 /* - * Kernel metadata is passed to f/w and retrieved in capture kerenl. + * Kernel metadata is passed to f/w and retrieved in capture kernel. * So, use it to save fadump header address instead of calculating it. */ opal_fdm->fadumphdr_addr =3D cpu_to_be64(be64_to_cpu(opal_fdm->rgn[0].des= t) + diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platf= orms/powernv/opal-lpc.c index 5390c888db16..d129d6d45a50 100644 --- a/arch/powerpc/platforms/powernv/opal-lpc.c +++ b/arch/powerpc/platforms/powernv/opal-lpc.c @@ -197,7 +197,7 @@ static ssize_t lpc_debug_read(struct file *filp, char _= _user *ubuf, =20 /* * Select access size based on count and alignment and - * access type. IO and MEM only support byte acceses, + * access type. IO and MEM only support byte accesses, * FW supports all 3. */ len =3D 1; diff --git a/arch/powerpc/platforms/powernv/opal-memory-errors.c b/arch/pow= erpc/platforms/powernv/opal-memory-errors.c index 1e8e17df9ce8..a1754a28265d 100644 --- a/arch/powerpc/platforms/powernv/opal-memory-errors.c +++ b/arch/powerpc/platforms/powernv/opal-memory-errors.c @@ -82,7 +82,7 @@ static DECLARE_WORK(mem_error_work, mem_error_handler); =20 /* * opal_memory_err_event - notifier handler that queues up the opal message - * to be preocessed later. + * to be processed later. */ static int opal_memory_err_event(struct notifier_block *nb, unsigned long msg_type, void *msg) diff --git a/arch/powerpc/platforms/powernv/pci-sriov.c b/arch/powerpc/plat= forms/powernv/pci-sriov.c index 04155aaaadb1..fe3d111b881c 100644 --- a/arch/powerpc/platforms/powernv/pci-sriov.c +++ b/arch/powerpc/platforms/powernv/pci-sriov.c @@ -699,7 +699,7 @@ static int pnv_pci_sriov_enable(struct pci_dev *pdev, u= 16 num_vfs) return -ENOSPC; } =20 - /* allocate a contigious block of PEs for our VFs */ + /* allocate a contiguous block of PEs for our VFs */ base_pe =3D pnv_ioda_alloc_pe(phb, num_vfs); if (!base_pe) { pci_err(pdev, "Unable to allocate PEs for %d VFs\n", num_vfs); diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/m= m.c index 5ce924611b94..63ef61ed7597 100644 --- a/arch/powerpc/platforms/ps3/mm.c +++ b/arch/powerpc/platforms/ps3/mm.c @@ -364,7 +364,7 @@ static void __maybe_unused _dma_dump_region(const stru= ct ps3_dma_region *r, * @bus_addr: Starting ioc bus address of the area to map. * @len: Length in bytes of the area to map. * @link: A struct list_head used with struct ps3_dma_region.chunk_list, t= he - * list of all chuncks owned by the region. + * list of all chunks owned by the region. * * This implementation uses a very simple dma page manager * based on the dma_chunk structure. This scheme assumes diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platfor= ms/ps3/system-bus.c index b637bf292047..2502e9b17df4 100644 --- a/arch/powerpc/platforms/ps3/system-bus.c +++ b/arch/powerpc/platforms/ps3/system-bus.c @@ -601,7 +601,7 @@ static dma_addr_t ps3_ioc0_map_page(struct device *_dev= , struct page *page, iopte_flag |=3D CBE_IOPTE_PP_W | CBE_IOPTE_SO_RW; break; default: - /* not happned */ + /* not happened */ BUG(); } result =3D ps3_dma_map(dev->d_region, (unsigned long)ptr, size, diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/pl= atforms/pseries/eeh_pseries.c index 09fafcf2d3a0..f0b2bca750da 100644 --- a/arch/powerpc/platforms/pseries/eeh_pseries.c +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c @@ -510,7 +510,7 @@ static int pseries_eeh_set_option(struct eeh_pe *pe, in= t option) int ret =3D 0; =20 /* - * When we're enabling or disabling EEH functioality on + * When we're enabling or disabling EEH functionality on * the particular PE, the PE config address is possibly * unavailable. Therefore, we have to figure it out from * the FDT node. diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platform= s/pseries/iommu.c index 4d991cf840d9..7639e7355df2 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -1430,7 +1430,7 @@ static bool enable_ddw(struct pci_dev *dev, struct de= vice_node *pdn) =20 pci->table_group->tables[1] =3D newtbl; =20 - /* Keep default DMA window stuct if removed */ + /* Keep default DMA window struct if removed */ if (default_win_removed) { tbl->it_size =3D 0; vfree(tbl->it_map); diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platform= s/pseries/setup.c index f27735f623ba..27bed0dd866e 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -658,7 +658,7 @@ static resource_size_t pseries_get_iov_fw_value(struct = pci_dev *dev, int resno, */ num_res =3D of_read_number(&indexes[NUM_RES_PROPERTY], 1); if (resno >=3D num_res) - return 0; /* or an errror */ + return 0; /* or an error */ =20 i =3D START_OF_ENTRIES + NEXT_ENTRY * resno; switch (value) { @@ -762,7 +762,7 @@ static void pseries_pci_fixup_iov_resources(struct pci_= dev *pdev) =20 if (!pdev->is_physfn) return; - /*Firmware must support open sriov otherwise dont configure*/ + /*Firmware must support open sriov otherwise don't configure*/ indexes =3D of_get_property(dn, "ibm,open-sriov-vf-bar-info", NULL); if (indexes) of_pci_parse_iov_addrs(pdev, indexes); diff --git a/arch/powerpc/platforms/pseries/vas-sysfs.c b/arch/powerpc/plat= forms/pseries/vas-sysfs.c index ec65586cbeb3..241c84374045 100644 --- a/arch/powerpc/platforms/pseries/vas-sysfs.c +++ b/arch/powerpc/platforms/pseries/vas-sysfs.c @@ -76,7 +76,7 @@ struct vas_sysfs_entry { * Create sysfs interface: * /sys/devices/vas/vas0/gzip/default_capabilities * This directory contains the following VAS GZIP capabilities - * for the defaule credit type. + * for the default credit type. * /sys/devices/vas/vas0/gzip/default_capabilities/nr_total_credits * Total number of default credits assigned to the LPAR which * can be changed with DLPAR operation. diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/= pseries/vas.c index ec643bbdb67f..500a1fc4a1d7 100644 --- a/arch/powerpc/platforms/pseries/vas.c +++ b/arch/powerpc/platforms/pseries/vas.c @@ -801,7 +801,7 @@ int vas_reconfig_capabilties(u8 type, int new_nr_creds) atomic_set(&caps->nr_total_credits, new_nr_creds); /* * The total number of available credits may be decreased or - * inceased with DLPAR operation. Means some windows have to be + * increased with DLPAR operation. Means some windows have to be * closed / reopened. Hold the vas_pseries_mutex so that the * the user space can not open new windows. */ diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c index 1985e067e952..18acfb4e82af 100644 --- a/arch/powerpc/sysdev/fsl_lbc.c +++ b/arch/powerpc/sysdev/fsl_lbc.c @@ -37,7 +37,7 @@ EXPORT_SYMBOL(fsl_lbc_ctrl_dev); * * This function converts a base address of lbc into the right format for = the * BR register. If the SOC has eLBC then it returns 32bit physical address - * else it convers a 34bit local bus physical address to correct format of + * else it converts a 34bit local bus physical address to correct format of * 32bit address for BR register (Example: MPC8641). */ u32 fsl_lbc_addr(phys_addr_t addr_base) diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index ef49ead8bf2e..3c430a6a6a4e 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c @@ -218,7 +218,7 @@ static void setup_pci_atmu(struct pci_controller *hose) * windows have implemented the default target value as 0xf * for CCSR space.In all Freescale legacy devices the target * of 0xf is reserved for local memory space. 9132 Rev1.0 - * now has local mempry space mapped to target 0x0 instead of + * now has local memory space mapped to target 0x0 instead of * 0xf. Hence adding a workaround to remove the target 0xf * defined for memory space from Inbound window attributes. */ diff --git a/arch/powerpc/sysdev/ge/ge_pic.c b/arch/powerpc/sysdev/ge/ge_pi= c.c index 02553a8ce191..413b375c4d28 100644 --- a/arch/powerpc/sysdev/ge/ge_pic.c +++ b/arch/powerpc/sysdev/ge/ge_pic.c @@ -150,7 +150,7 @@ static struct irq_chip gef_pic_chip =3D { }; =20 =20 -/* When an interrupt is being configured, this call allows some flexibilty +/* When an interrupt is being configured, this call allows some flexibility * in deciding which irq_chip structure is used */ static int gef_pic_host_map(struct irq_domain *h, unsigned int virq, diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msg= r.c index 36ec0bdd8b63..a25413826b63 100644 --- a/arch/powerpc/sysdev/mpic_msgr.c +++ b/arch/powerpc/sysdev/mpic_msgr.c @@ -99,7 +99,7 @@ void mpic_msgr_disable(struct mpic_msgr *msgr) EXPORT_SYMBOL_GPL(mpic_msgr_disable); =20 /* The following three functions are used to compute the order and number = of - * the message register blocks. They are clearly very inefficent. Howeve= r, + * the message register blocks. They are clearly very inefficient. Howev= er, * they are called *only* a few times during device initialization. */ static unsigned int mpic_msgr_number_of_blocks(void) diff --git a/arch/powerpc/sysdev/mpic_msi.c b/arch/powerpc/sysdev/mpic_msi.c index f412d6ad0b66..9936c014ac7d 100644 --- a/arch/powerpc/sysdev/mpic_msi.c +++ b/arch/powerpc/sysdev/mpic_msi.c @@ -37,7 +37,7 @@ static int __init mpic_msi_reserve_u3_hwirqs(struct mpic = *mpic) /* Reserve source numbers we know are reserved in the HW. * * This is a bit of a mix of U3 and U4 reserves but that's going - * to work fine, we have plenty enugh numbers left so let's just + * to work fine, we have plenty enough numbers left so let's just * mark anything we don't like reserved. */ for (i =3D 0; i < 8; i++) diff --git a/arch/powerpc/sysdev/mpic_timer.c b/arch/powerpc/sysdev/mpic_ti= mer.c index 444e9ce42d0a..b2f0a73e8f93 100644 --- a/arch/powerpc/sysdev/mpic_timer.c +++ b/arch/powerpc/sysdev/mpic_timer.c @@ -255,7 +255,7 @@ EXPORT_SYMBOL(mpic_start_timer); =20 /** * mpic_stop_timer - stop hardware timer - * @handle: the timer to be stoped + * @handle: the timer to be stopped * * The timer periodically generates an interrupt. Unless user stops the ti= mer. */ diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3= msi.c index 3f4841dfefb5..73d129594078 100644 --- a/arch/powerpc/sysdev/mpic_u3msi.c +++ b/arch/powerpc/sysdev/mpic_u3msi.c @@ -78,7 +78,7 @@ static u64 find_u4_magic_addr(struct pci_dev *pdev, unsig= ned int hwirq) =20 /* U4 PCIe MSIs need to write to the special register in * the bridge that generates interrupts. There should be - * theorically a register at 0xf8005000 where you just write + * theoretically a register at 0xf8005000 where you just write * the MSI number and that triggers the right interrupt, but * unfortunately, this is busted in HW, the bridge endian swaps * the value and hits the wrong nibble in the register. diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/n= ative.c index f940428ad13f..45f72fc715fc 100644 --- a/arch/powerpc/sysdev/xive/native.c +++ b/arch/powerpc/sysdev/xive/native.c @@ -617,7 +617,7 @@ bool __init xive_native_init(void) =20 xive_tima_os =3D r.start; =20 - /* Grab size of provisionning pages */ + /* Grab size of provisioning pages */ xive_parse_provisioning(np); =20 /* Switch the XIVE to exploitation mode */ diff --git a/arch/powerpc/xmon/ppc-opc.c b/arch/powerpc/xmon/ppc-opc.c index dfb80810b16c..0774d711453e 100644 --- a/arch/powerpc/xmon/ppc-opc.c +++ b/arch/powerpc/xmon/ppc-opc.c @@ -408,7 +408,7 @@ const struct powerpc_operand powerpc_operands[] =3D #define FXM4 FXM + 1 { 0xff, 12, insert_fxm, extract_fxm, PPC_OPERAND_OPTIONAL | PPC_OPERAND_OPTIONAL_VALUE}, - /* If the FXM4 operand is ommitted, use the sentinel value -1. */ + /* If the FXM4 operand is omitted, use the sentinel value -1. */ { -1, -1, NULL, NULL, 0}, =20 /* The IMM20 field in an LI instruction. */ diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index fd72753e8ad5..27da7d5c2024 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -2024,7 +2024,7 @@ static void dump_206_sprs(void) if (!cpu_has_feature(CPU_FTR_ARCH_206)) return; =20 - /* Actually some of these pre-date 2.06, but whatevs */ + /* Actually some of these pre-date 2.06, but whatever */ =20 printf("srr0 =3D %.16lx srr1 =3D %.16lx dsisr =3D %.8lx\n", mfspr(SPRN_SRR0), mfspr(SPRN_SRR1), mfspr(SPRN_DSISR)); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D181C00140 for ; Mon, 15 Aug 2022 22:53:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352183AbiHOWxM (ORCPT ); Mon, 15 Aug 2022 18:53:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352370AbiHOWvd (ORCPT ); Mon, 15 Aug 2022 18:51:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B203143E72; Mon, 15 Aug 2022 12:54:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B0C436129E; Mon, 15 Aug 2022 19:54:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E866C433D6; Mon, 15 Aug 2022 19:54:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593260; bh=iXkXtUqltABOXs0Dj8UgtGB7/hG6I8UQqaUYRYHzw40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KCO4EHSYtRrW1JGfPbEA3256YYLfd52yYlLngaYF1qLjHsfNA/0FrC3H9yywpNaSt lC66GrjCJu+3pQJuMmZInyKDQv1l5Sg04DKvxetyeNUMMNYD4d6w23BTiQNRzC8F7y y2FwcRUTgUBlaosr0yJn/iXpapMmmx2XEz1eR0lU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kardashevskiy , Hari Bathini , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0919/1095] pseries/iommu/ddw: Fix kdump to work in absence of ibm,dma-window Date: Mon, 15 Aug 2022 20:05:18 +0200 Message-Id: <20220815180507.295091560@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexey Kardashevskiy [ Upstream commit b1fc44eaa9ba31e28c4125d6b9205a3582b47b5d ] The pseries platform uses 32bit default DMA window (always 4K pages) and optional 64bit DMA window available via DDW ("Dynamic DMA Windows"), 64K or 2M pages. For ages the default one was not removed and a huge window was created in addition. Things changed with SRIOV-enabled PowerVM which creates a default-and-bigger DMA window in 64bit space (still using 4K pages) for IOV VFs so certain OSes do not need to use the DDW API in order to utilize all available TCE budget. Linux on the other hand removes the default window and creates a bigger one (with more TCEs or/and a bigger page size - 64K/2M) in a bid to map the entire RAM, and if the new window size is smaller than that - it still uses this new bigger window. The result is that the default window is removed but the "ibm,dma-window" property is not. When kdump is invoked, the existing code tries reusing the existing 64bit DMA window which location and parameters are stored in the device tree but this fails as the new property does not make it to the kdump device tree blob. So the code falls back to the default window which does not exist anymore although the device tree says that it does. The result of that is that PCI devices become unusable and cannot be used for kdumping. This preserves the DMA64 and DIRECT64 properties in the device tree blob for the crash kernel. Since the crash kernel setup is done after device drivers are loaded and probed, the proper DMA config is stored at least for boot time devices. Because DDW window is optional and the code configures the default window first, the existing code creates an IOMMU table descriptor for the non-existing default DMA window. It is harmless for kdump as it does not touch the actual window (only reads what is mapped and marks those IO pages as used) but it is bad for kexec which clears it thinking it is a smaller default window rather than a bigger DDW window. This removes the "ibm,dma-window" property from the device tree after a bigger window is created and the crash kernel setup picks it up. Fixes: 381ceda88c4c ("powerpc/pseries/iommu: Make use of DDW for indirect m= apping") Signed-off-by: Alexey Kardashevskiy Acked-by: Hari Bathini Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220629060614.1680476-1-aik@ozlabs.ru Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/kexec/file_load_64.c | 54 ++++++++++++++++ arch/powerpc/platforms/pseries/iommu.c | 89 ++++++++++++++------------ 2 files changed, 102 insertions(+), 41 deletions(-) diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_lo= ad_64.c index b4981b651d9a..5d2c22aa34fb 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -1038,6 +1038,48 @@ static int update_cpus_node(void *fdt) return ret; } =20 +static int copy_property(void *fdt, int node_offset, const struct device_n= ode *dn, + const char *propname) +{ + const void *prop, *fdtprop; + int len =3D 0, fdtlen =3D 0, ret; + + prop =3D of_get_property(dn, propname, &len); + fdtprop =3D fdt_getprop(fdt, node_offset, propname, &fdtlen); + + if (fdtprop && !prop) + ret =3D fdt_delprop(fdt, node_offset, propname); + else if (prop) + ret =3D fdt_setprop(fdt, node_offset, propname, prop, len); + + return ret; +} + +static int update_pci_dma_nodes(void *fdt, const char *dmapropname) +{ + struct device_node *dn; + int pci_offset, root_offset, ret =3D 0; + + if (!firmware_has_feature(FW_FEATURE_LPAR)) + return 0; + + root_offset =3D fdt_path_offset(fdt, "/"); + for_each_node_with_property(dn, dmapropname) { + pci_offset =3D fdt_subnode_offset(fdt, root_offset, of_node_full_name(dn= )); + if (pci_offset < 0) + continue; + + ret =3D copy_property(fdt, pci_offset, dn, "ibm,dma-window"); + if (ret < 0) + break; + ret =3D copy_property(fdt, pci_offset, dn, dmapropname); + if (ret < 0) + break; + } + + return ret; +} + /** * setup_new_fdt_ppc64 - Update the flattend device-tree of the kernel * being loaded. @@ -1099,6 +1141,18 @@ int setup_new_fdt_ppc64(const struct kimage *image, = void *fdt, if (ret < 0) goto out; =20 +#define DIRECT64_PROPNAME "linux,direct64-ddr-window-info" +#define DMA64_PROPNAME "linux,dma64-ddr-window-info" + ret =3D update_pci_dma_nodes(fdt, DIRECT64_PROPNAME); + if (ret < 0) + goto out; + + ret =3D update_pci_dma_nodes(fdt, DMA64_PROPNAME); + if (ret < 0) + goto out; +#undef DMA64_PROPNAME +#undef DIRECT64_PROPNAME + /* Update memory reserve map */ ret =3D get_reserved_memory_ranges(&rmem); if (ret) diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platform= s/pseries/iommu.c index 7639e7355df2..a90024697c11 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -701,6 +701,33 @@ struct iommu_table_ops iommu_table_lpar_multi_ops =3D { .get =3D tce_get_pSeriesLP }; =20 +/* + * Find nearest ibm,dma-window (default DMA window) or direct DMA window or + * dynamic 64bit DMA window, walking up the device tree. + */ +static struct device_node *pci_dma_find(struct device_node *dn, + const __be32 **dma_window) +{ + const __be32 *dw =3D NULL; + + for ( ; dn && PCI_DN(dn); dn =3D dn->parent) { + dw =3D of_get_property(dn, "ibm,dma-window", NULL); + if (dw) { + if (dma_window) + *dma_window =3D dw; + return dn; + } + dw =3D of_get_property(dn, DIRECT64_PROPNAME, NULL); + if (dw) + return dn; + dw =3D of_get_property(dn, DMA64_PROPNAME, NULL); + if (dw) + return dn; + } + + return NULL; +} + static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus) { struct iommu_table *tbl; @@ -713,20 +740,10 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bu= s *bus) pr_debug("pci_dma_bus_setup_pSeriesLP: setting up bus %pOF\n", dn); =20 - /* - * Find nearest ibm,dma-window (default DMA window), walking up the - * device tree - */ - for (pdn =3D dn; pdn !=3D NULL; pdn =3D pdn->parent) { - dma_window =3D of_get_property(pdn, "ibm,dma-window", NULL); - if (dma_window !=3D NULL) - break; - } + pdn =3D pci_dma_find(dn, &dma_window); =20 - if (dma_window =3D=3D NULL) { + if (dma_window =3D=3D NULL) pr_debug(" no ibm,dma-window property !\n"); - return; - } =20 ppci =3D PCI_DN(pdn); =20 @@ -736,11 +753,13 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bu= s *bus) if (!ppci->table_group) { ppci->table_group =3D iommu_pseries_alloc_group(ppci->phb->node); tbl =3D ppci->table_group->tables[0]; - iommu_table_setparms_lpar(ppci->phb, pdn, tbl, - ppci->table_group, dma_window); + if (dma_window) { + iommu_table_setparms_lpar(ppci->phb, pdn, tbl, + ppci->table_group, dma_window); =20 - if (!iommu_init_table(tbl, ppci->phb->node, 0, 0)) - panic("Failed to initialize iommu table"); + if (!iommu_init_table(tbl, ppci->phb->node, 0, 0)) + panic("Failed to initialize iommu table"); + } iommu_register_group(ppci->table_group, pci_domain_nr(bus), 0); pr_debug(" created table: %p\n", ppci->table_group); @@ -1233,7 +1252,7 @@ static bool enable_ddw(struct pci_dev *dev, struct de= vice_node *pdn) bool default_win_removed =3D false, direct_mapping =3D false; bool pmem_present; struct pci_dn *pci =3D PCI_DN(pdn); - struct iommu_table *tbl =3D pci->table_group->tables[0]; + struct property *default_win =3D NULL; =20 dn =3D of_find_node_by_type(NULL, "ibm,pmemory"); pmem_present =3D dn !=3D NULL; @@ -1290,11 +1309,10 @@ static bool enable_ddw(struct pci_dev *dev, struct = device_node *pdn) * for extensions presence. */ if (query.windows_available =3D=3D 0) { - struct property *default_win; int reset_win_ext; =20 /* DDW + IOMMU on single window may fail if there is any allocation */ - if (iommu_table_in_use(tbl)) { + if (iommu_table_in_use(pci->table_group->tables[0])) { dev_warn(&dev->dev, "current IOMMU table in use, can't be replaced.\n"); goto out_failed; } @@ -1430,16 +1448,18 @@ static bool enable_ddw(struct pci_dev *dev, struct = device_node *pdn) =20 pci->table_group->tables[1] =3D newtbl; =20 - /* Keep default DMA window struct if removed */ - if (default_win_removed) { - tbl->it_size =3D 0; - vfree(tbl->it_map); - tbl->it_map =3D NULL; - } - set_iommu_table_base(&dev->dev, newtbl); } =20 + if (default_win_removed) { + iommu_tce_table_put(pci->table_group->tables[0]); + pci->table_group->tables[0] =3D NULL; + + /* default_win is valid here because default_win_removed =3D=3D true */ + of_remove_property(pdn, default_win); + dev_info(&dev->dev, "Removed default DMA window for %pOF\n", pdn); + } + spin_lock(&dma_win_list_lock); list_add(&window->list, &dma_win_list); spin_unlock(&dma_win_list_lock); @@ -1504,13 +1524,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_d= ev *dev) dn =3D pci_device_to_OF_node(dev); pr_debug(" node is %pOF\n", dn); =20 - for (pdn =3D dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->table_group; - pdn =3D pdn->parent) { - dma_window =3D of_get_property(pdn, "ibm,dma-window", NULL); - if (dma_window) - break; - } - + pdn =3D pci_dma_find(dn, &dma_window); if (!pdn || !PCI_DN(pdn)) { printk(KERN_WARNING "pci_dma_dev_setup_pSeriesLP: " "no DMA window found for pci dev=3D%s dn=3D%pOF\n", @@ -1541,7 +1555,6 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_de= v *dev) static bool iommu_bypass_supported_pSeriesLP(struct pci_dev *pdev, u64 dma= _mask) { struct device_node *dn =3D pci_device_to_OF_node(pdev), *pdn; - const __be32 *dma_window =3D NULL; =20 /* only attempt to use a new window if 64-bit DMA is requested */ if (dma_mask < DMA_BIT_MASK(64)) @@ -1555,13 +1568,7 @@ static bool iommu_bypass_supported_pSeriesLP(struct = pci_dev *pdev, u64 dma_mask) * search upwards in the tree until we either hit a dma-window * property, OR find a parent with a table already allocated. */ - for (pdn =3D dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->table_group; - pdn =3D pdn->parent) { - dma_window =3D of_get_property(pdn, "ibm,dma-window", NULL); - if (dma_window) - break; - } - + pdn =3D pci_dma_find(dn, NULL); if (pdn && PCI_DN(pdn)) return enable_ddw(pdev, pdn); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7291CC00140 for ; Mon, 15 Aug 2022 22:53:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352228AbiHOWxW (ORCPT ); Mon, 15 Aug 2022 18:53:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352428AbiHOWvt (ORCPT ); Mon, 15 Aug 2022 18:51:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F2BE1394C4; Mon, 15 Aug 2022 12:54:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4CB63B80EAD; Mon, 15 Aug 2022 19:54:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A29F3C433D6; Mon, 15 Aug 2022 19:54:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593266; bh=CM7F2rOUBmfcXUgNZhY9n4+a8WWv8wo3ROGfc/dqlQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cvuPv5vVf+Dnn6imBD68MUdYsSap3IZwqiHj/30lVoQBXKYwR/IhspWhvmQ41VW7i PC7xj4gRboc5XBV4/98p5E8VOjO2AOpNBKNeFK8SlPNkSZs3ufWBjEfo99xMrXBYA3 CwhTdgbubTJ6gItPlITSNEBvbsEm48UbtsrMiq50= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kardashevskiy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0920/1095] powerpc/iommu: Fix iommu_table_in_use for a small default DMA window case Date: Mon, 15 Aug 2022 20:05:19 +0200 Message-Id: <20220815180507.336070485@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexey Kardashevskiy [ Upstream commit d80f6de9d601c30b53c17f00cb7cfe3169f2ddad ] The existing iommu_table_in_use() helper checks if the kernel is using any of TCEs. There are some reserved TCEs: 1) the very first one if DMA window starts from 0 to avoid having a zero but still valid DMA handle; 2) it_reserved_start..it_reserved_end to exclude MMIO32 window in case the default window spans across that - this is the default for the first DMA window on PowerNV. When 1) is the case and 2) is not the helper does not skip 1) and returns wrong status. This only seems occurring when passing through a PCI device to a nested guest (not something we support really well) so it has not been seen before. This fixes the bug by adding a special case for no MMIO32 reservation. Fixes: 3c33066a2190 ("powerpc/kernel/iommu: Add new iommu_table_in_use() he= lper") Signed-off-by: Alexey Kardashevskiy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220714081119.3714605-1-aik@ozlabs.ru Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/kernel/iommu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index 07093b7cdcb9..a67fd54ccc57 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c @@ -776,6 +776,11 @@ bool iommu_table_in_use(struct iommu_table *tbl) /* ignore reserved bit0 */ if (tbl->it_offset =3D=3D 0) start =3D 1; + + /* Simple case with no reserved MMIO32 region */ + if (!tbl->it_reserved_start && !tbl->it_reserved_end) + return find_next_bit(tbl->it_map, tbl->it_size, start) !=3D tbl->it_size; + end =3D tbl->it_reserved_start - tbl->it_offset; if (find_next_bit(tbl->it_map, end, start) !=3D end) return true; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05A49C19F2C for ; Mon, 15 Aug 2022 22:54:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351534AbiHOWyJ (ORCPT ); Mon, 15 Aug 2022 18:54:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352523AbiHOWwE (ORCPT ); Mon, 15 Aug 2022 18:52:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 827C3139D9C; Mon, 15 Aug 2022 12:54:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F29D5B80EAB; Mon, 15 Aug 2022 19:54:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C7B4C433C1; Mon, 15 Aug 2022 19:54:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593275; bh=NyrMSadPHQ4iOESHOAaie42MIzNfVPpbp8GQaIaUq50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=crVojArAddWL8TEFv2CoxWU/hm46YQiGRTrJ7opNiZWLI8zHM2+cLblv4pQvnSEHU OsA+Jh3fbVw7HZ2wNDHJMf93myScUNzG/a4Bk5w1D77ClTY9c0SugHOmg+BHhhrYRC N9B9NZR7F/mffetvf03A4iUfPXKX5sJH+qHfefMA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0921/1095] powerpc/pci: Prefer PCI domain assignment via DT linux,pci-domain and alias Date: Mon, 15 Aug 2022 20:05:20 +0200 Message-Id: <20220815180507.367988683@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Roh=C3=A1r [ Upstream commit 0fe1e96fef0a5c53b4c0d1500d356f3906000f81 ] Other Linux architectures use DT property 'linux,pci-domain' for specifying fixed PCI domain of PCI controller specified in Device-Tree. And lot of Freescale powerpc boards have defined numbered pci alias in Device-Tree for every PCIe controller which number specify preferred PCI domain. So prefer usage of DT property 'linux,pci-domain' (via function of_get_pci_domain_nr()) and DT pci alias (via function of_alias_get_id()) on powerpc architecture for assigning PCI domain to PCI controller. Fixes: 63a72284b159 ("powerpc/pci: Assign fixed PHB number based on device-= tree properties") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220706102148.5060-2-pali@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/kernel/pci-common.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-com= mon.c index 9a97a93bd11c..7daa00f3942e 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -74,16 +74,30 @@ void __init set_pci_dma_ops(const struct dma_map_ops *d= ma_ops) static int get_phb_number(struct device_node *dn) { int ret, phb_id =3D -1; - u32 prop_32; u64 prop; =20 /* * Try fixed PHB numbering first, by checking archs and reading - * the respective device-tree properties. Firstly, try powernv by - * reading "ibm,opal-phbid", only present in OPAL environment. + * the respective device-tree properties. Firstly, try reading + * standard "linux,pci-domain", then try reading "ibm,opal-phbid" + * (only present in powernv OPAL environment), then try device-tree + * alias and as the last try to use lower bits of "reg" property. */ - ret =3D of_property_read_u64(dn, "ibm,opal-phbid", &prop); + ret =3D of_get_pci_domain_nr(dn); + if (ret >=3D 0) { + prop =3D ret; + ret =3D 0; + } + if (ret) + ret =3D of_property_read_u64(dn, "ibm,opal-phbid", &prop); + if (ret) + ret =3D of_alias_get_id(dn, "pci"); + if (ret >=3D 0) { + prop =3D ret; + ret =3D 0; + } if (ret) { + u32 prop_32; ret =3D of_property_read_u32_index(dn, "reg", 1, &prop_32); prop =3D prop_32; } @@ -95,10 +109,7 @@ static int get_phb_number(struct device_node *dn) if ((phb_id >=3D 0) && !test_and_set_bit(phb_id, phb_bitmap)) return phb_id; =20 - /* - * If not pseries nor powernv, or if fixed PHB numbering tried to add - * the same PHB number twice, then fallback to dynamic PHB numbering. - */ + /* If everything fails then fallback to dynamic PHB numbering. */ phb_id =3D find_first_zero_bit(phb_bitmap, MAX_PHBS); BUG_ON(phb_id >=3D MAX_PHBS); set_bit(phb_id, phb_bitmap); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78A0EC00140 for ; Mon, 15 Aug 2022 22:55:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352208AbiHOWzL (ORCPT ); Mon, 15 Aug 2022 18:55:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352162AbiHOWxI (ORCPT ); Mon, 15 Aug 2022 18:53:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C14DA7F10C; Mon, 15 Aug 2022 12:54:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3FB42B81144; Mon, 15 Aug 2022 19:54:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F727C433D7; Mon, 15 Aug 2022 19:54:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593281; bh=keQl0RqzTCXOjfuUaTm3QR3v50m15zFuKa0dQ4j6y1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r9j8aEMAR5LCQNrfKbKnfoxyq4Pr/HIs4z3RsrOY9R254XN24jgH0kwHarp95xnaJ 7pt3d3USjMx1e6TtU9cl7DYzrUX+rsDiFRPdHR9FVdnFT16M52a00Pt7jDdoVS5L6y Jlc1xTW1Xm2PiNFXBLOIEk32c5yLPdlhVPERj9os= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Florian Fainelli , Guo Mengqi , Sasha Levin Subject: [PATCH 5.18 0922/1095] serial: 8250_bcm2835aux: Add missing clk_disable_unprepare() Date: Mon, 15 Aug 2022 20:05:21 +0200 Message-Id: <20220815180507.406769177@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guo Mengqi [ Upstream commit b9f1736e475dba0d6da48fdcb831248ab1597886 ] The error path when get clock frequency fails in bcm2835aux_serial driver does not correctly disable the clock. This flaw was found using a static analysis tool "Hulk Robot", which reported the following warning when analyzing linux-next/master: drivers/tty/serial/8250/8250_bcm2835aux.c: warning: clk_disable_unprepare_missing.cocci The cocci script checks for the existence of clk_disable_unprepare() paired with clk_prepare_enable(). Add the missing clk_disable_unprepare() to the error path. Fixes: fcc446c8aa63 ("serial: 8250_bcm2835aux: Add ACPI support") Reported-by: Hulk Robot Reviewed-by: Florian Fainelli Signed-off-by: Guo Mengqi Link: https://lore.kernel.org/r/20220715023312.37808-1-guomengqi3@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/serial/8250/8250_bcm2835aux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial= /8250/8250_bcm2835aux.c index 2a1226a78a0c..21939bb44613 100644 --- a/drivers/tty/serial/8250/8250_bcm2835aux.c +++ b/drivers/tty/serial/8250/8250_bcm2835aux.c @@ -166,8 +166,10 @@ static int bcm2835aux_serial_probe(struct platform_dev= ice *pdev) uartclk =3D clk_get_rate(data->clk); if (!uartclk) { ret =3D device_property_read_u32(&pdev->dev, "clock-frequency", &uartclk= ); - if (ret) - return dev_err_probe(&pdev->dev, ret, "could not get clk rate\n"); + if (ret) { + dev_err_probe(&pdev->dev, ret, "could not get clk rate\n"); + goto dis_clk; + } } =20 /* the HW-clock divider for bcm2835aux is 8, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEEA4C00140 for ; Mon, 15 Aug 2022 22:55:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346074AbiHOWzY (ORCPT ); Mon, 15 Aug 2022 18:55:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242683AbiHOWyB (ORCPT ); Mon, 15 Aug 2022 18:54:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4E3E7F11F; Mon, 15 Aug 2022 12:54:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D0FBC6113B; Mon, 15 Aug 2022 19:54:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3EE8C433D6; Mon, 15 Aug 2022 19:54:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593288; bh=Zs8uX0XxC7l9T7Gv2eAAYMFzEiCbxZ8p6gV3+tEkSGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iKALp9hg5EVCoM2ZcAv95swNMolNPw5TWVFQtVNSrT+kkK33kSYM+XzdJgyv80mpp 5rMkZ9qjBzXjJoBY3dzgQv9TeRM9tm60p8hillKeaAxpHJnKK4XjeVAAR9HywQ8Ev+ t+O+a/3QCFhmn6dQyYLfKo41Eij2Gnmj1CmZr/aI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Sherry Sun , Sasha Levin Subject: [PATCH 5.18 0923/1095] tty: serial: fsl_lpuart: correct the count of break characters Date: Mon, 15 Aug 2022 20:05:22 +0200 Message-Id: <20220815180507.445957567@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sherry Sun [ Upstream commit 707f816f25590c20e056b3bd4a17ce69b03fe856 ] The LPUART can't distinguish between a break signal and a framing error, so need to count the break characters if there is a framing error and received data is zero instead of the parity error. Fixes: 5541a9bacfe5 ("serial: fsl_lpuart: handle break and make sysrq work") Reviewed-by: Michael Walle Signed-off-by: Sherry Sun Link: https://lore.kernel.org/r/20220725050115.12396-1-sherry.sun@nxp.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/serial/fsl_lpuart.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuar= t.c index 2cb89491dd09..65b76adf107c 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -990,12 +990,12 @@ static void lpuart32_rxint(struct lpuart_port *sport) =20 if (sr & (UARTSTAT_PE | UARTSTAT_OR | UARTSTAT_FE)) { if (sr & UARTSTAT_PE) { + sport->port.icount.parity++; + } else if (sr & UARTSTAT_FE) { if (is_break) sport->port.icount.brk++; else - sport->port.icount.parity++; - } else if (sr & UARTSTAT_FE) { - sport->port.icount.frame++; + sport->port.icount.frame++; } =20 if (sr & UARTSTAT_OR) @@ -1010,12 +1010,12 @@ static void lpuart32_rxint(struct lpuart_port *spor= t) sr &=3D sport->port.read_status_mask; =20 if (sr & UARTSTAT_PE) { + flg =3D TTY_PARITY; + } else if (sr & UARTSTAT_FE) { if (is_break) flg =3D TTY_BREAK; else - flg =3D TTY_PARITY; - } else if (sr & UARTSTAT_FE) { - flg =3D TTY_FRAME; + flg =3D TTY_FRAME; } =20 if (sr & UARTSTAT_OR) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E87C9C2BB47 for ; Mon, 15 Aug 2022 23:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352926AbiHOXB2 (ORCPT ); Mon, 15 Aug 2022 19:01:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352512AbiHOW6f (ORCPT ); Mon, 15 Aug 2022 18:58:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E401474E0; Mon, 15 Aug 2022 12:56:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0F800B80EAB; Mon, 15 Aug 2022 19:56:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55B02C433D6; Mon, 15 Aug 2022 19:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593409; bh=Jl6YcRGxZmnFIQ7S0vKwAI423njHCiOFiSTN7qLkT9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eO5dRmm3PrY26leKDntummwSKQsNDY2F47jqEkZIYf7Pz6D+dmmtfhfb0Eqy49a6J 1uTnHf/WsoiGOdTtYfMsFXCNf5zl4Hfv8dxPwfsTNztnVpKxU3J/inljMjFD2a+odo f/83e0NxQwLXyU44zQeL4MfASJnhkNmhJa+aOVSY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Carstens , Alexander Gordeev , Sasha Levin Subject: [PATCH 5.18 0924/1095] s390/smp: enforce lowcore protection on CPU restart Date: Mon, 15 Aug 2022 20:05:23 +0200 Message-Id: <20220815180507.484901030@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev [ Upstream commit 6f5c672d17f583b081e283927f5040f726c54598 ] As result of commit 915fea04f932 ("s390/smp: enable DAT before CPU restart callback is called") the low-address protection bit gets mistakenly unset in control register 0 save area of the absolute zero memory. That area is used when manual PSW restart happened to hit an offline CPU. In this case the low-address protection for that CPU will be dropped. Reviewed-by: Heiko Carstens Fixes: 915fea04f932 ("s390/smp: enable DAT before CPU restart callback is c= alled") Signed-off-by: Alexander Gordeev Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/s390/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 2cef49983e9e..3327412f82a6 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -508,8 +508,8 @@ static void __init setup_lowcore_dat_on(void) S390_lowcore.svc_new_psw.mask |=3D PSW_MASK_DAT; S390_lowcore.program_new_psw.mask |=3D PSW_MASK_DAT; S390_lowcore.io_new_psw.mask |=3D PSW_MASK_DAT; - __ctl_store(S390_lowcore.cregs_save_area, 0, 15); __ctl_set_bit(0, 28); + __ctl_store(S390_lowcore.cregs_save_area, 0, 15); put_abs_lowcore(restart_flags, RESTART_FLAG_CTLREGS); put_abs_lowcore(program_new_psw, lc->program_new_psw); for (cr =3D 0; cr < ARRAY_SIZE(lc->cregs_save_area); cr++) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A5CDC00140 for ; Mon, 15 Aug 2022 23:03:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352564AbiHOXDR (ORCPT ); Mon, 15 Aug 2022 19:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352954AbiHOXBl (ORCPT ); Mon, 15 Aug 2022 19:01:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C728913E9B6; Mon, 15 Aug 2022 12:57:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C96E8612A3; Mon, 15 Aug 2022 19:57:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72A7DC433D6; Mon, 15 Aug 2022 19:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593478; bh=fd2NqLhV7jAcFydZ9fuYH0BYRdt2hT/O1lKLkQvdzK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=amTZUmqmYZWrRtLl0rwNwtfpE+qqsijDq0tJxpnlrTRGfB0IK8HkmEkzzYmcsMqLe c3jBQoNgk3KQMNfA0qazw32ykeje1VCu330Ss6RSXs2vhjodMqX6Ts6c8Rdq+Ufmj6 ZTd2b+N3ERK29HPB7kSRS4kqINq8TS5/+aRkOPjo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kan Liang , Ian Rogers , Namhyung Kim , Alexander Shishkin , Andi Kleen , Ingo Molnar , Jiri Olsa , Peter Zijlstra , Xing Zhengjun , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.18 0925/1095] perf stat: Revert "perf stat: Add default hybrid events" Date: Mon, 15 Aug 2022 20:05:24 +0200 Message-Id: <20220815180507.516164896@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kan Liang [ Upstream commit ace3e31e653e79cae9b047e85f567e6b44c98532 ] This reverts commit Fixes: ac2dc29edd21f9ec ("perf stat: Add default hybrid events") Between this patch and the reverted patch, the commit 6c1912898ed21bef ("perf parse-events: Rename parse_events_error functions") and the commit 07eafd4e053a41d7 ("perf parse-event: Add init and exit to parse_event_error") clean up the parse_events_error_*() codes. The related change is also reverted. The reverted patch is hard to be extended to support new default events, e.g., Topdown events, and the existing "--detailed" option on a hybrid platform. A new solution will be proposed in the following patch to enable the perf stat default on a hybrid platform. Signed-off-by: Kan Liang Acked-by: Ian Rogers Acked-by: Namhyung Kim Cc: Alexander Shishkin Cc: Andi Kleen Cc: Ingo Molnar Cc: Jiri Olsa Cc: Peter Zijlstra Link: https://lore.kernel.org/r/20220721065706.2886112-2-zhengjun.xing@linu= x.intel.com Signed-off-by: Xing Zhengjun Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/perf/builtin-stat.c | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index f058e8cddfa8..e15fd6f9f7ea 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1663,12 +1663,6 @@ static int add_default_attributes(void) { .type =3D PERF_TYPE_HARDWARE, .config =3D PERF_COUNT_HW_BRANCH_INSTRUC= TIONS }, { .type =3D PERF_TYPE_HARDWARE, .config =3D PERF_COUNT_HW_BRANCH_MISSES = }, =20 -}; - struct perf_event_attr default_sw_attrs[] =3D { - { .type =3D PERF_TYPE_SOFTWARE, .config =3D PERF_COUNT_SW_TASK_CLOCK }, - { .type =3D PERF_TYPE_SOFTWARE, .config =3D PERF_COUNT_SW_CONTEXT_SWITCH= ES }, - { .type =3D PERF_TYPE_SOFTWARE, .config =3D PERF_COUNT_SW_CPU_MIGRATIONS= }, - { .type =3D PERF_TYPE_SOFTWARE, .config =3D PERF_COUNT_SW_PAGE_FAULTS }, }; =20 /* @@ -1910,30 +1904,6 @@ static int add_default_attributes(void) } =20 if (!evsel_list->core.nr_entries) { - if (perf_pmu__has_hybrid()) { - struct parse_events_error errinfo; - const char *hybrid_str =3D "cycles,instructions,branches,branch-misses"; - - if (target__has_cpu(&target)) - default_sw_attrs[0].config =3D PERF_COUNT_SW_CPU_CLOCK; - - if (evlist__add_default_attrs(evsel_list, - default_sw_attrs) < 0) { - return -1; - } - - parse_events_error__init(&errinfo); - err =3D parse_events(evsel_list, hybrid_str, &errinfo); - if (err) { - fprintf(stderr, - "Cannot set up hybrid events %s: %d\n", - hybrid_str, err); - parse_events_error__print(&errinfo, hybrid_str); - } - parse_events_error__exit(&errinfo); - return err ? -1 : 0; - } - if (target__has_cpu(&target)) default_attrs0[0].config =3D PERF_COUNT_SW_CPU_CLOCK; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C7CEC00140 for ; Mon, 15 Aug 2022 23:04:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347421AbiHOXEr (ORCPT ); Mon, 15 Aug 2022 19:04:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347613AbiHOXCo (ORCPT ); Mon, 15 Aug 2022 19:02:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46DEE86060; Mon, 15 Aug 2022 12:58:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 56D2BB80EAD; Mon, 15 Aug 2022 19:58:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC1DCC433C1; Mon, 15 Aug 2022 19:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593496; bh=LYJU9PjhnyJ0TJ5XqVYXIt0a/jVRtvtlLt94h9j8mpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lhgv5HsUgEtORzQ/406q4IoEH7jbgfdy+M8G+56i/Du7VXXULsbXiHdHckEMI7+0A JydvFGO2b52SO5akA43yjsVYFEXDC71XNRQm0AdRz3KCW10Wehw9AVkJOzZtwEqN8y zKoKO7Fy9JdFyF4WSsppL1H5qjj54o66qt8ufj0A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyeong-Jun Kim , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.18 0926/1095] f2fs: fix to invalidate META_MAPPING before DIO write Date: Mon, 15 Aug 2022 20:05:25 +0200 Message-Id: <20220815180507.554706160@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chao Yu [ Upstream commit 67ca06872eb02944b4c6f92cffa9242e92c63109 ] Quoted from commit e3b49ea36802 ("f2fs: invalidate META_MAPPING before IPU/DIO write") " Encrypted pages during GC are read and cached in META_MAPPING. However, due to cached pages in META_MAPPING, there is an issue where newly written pages are lost by IPU or DIO writes. Thread A - f2fs_gc() Thread B /* phase 3 */ down_write(i_gc_rwsem) ra_data_block() ---- (a) up_write(i_gc_rwsem) f2fs_direct_IO() : - down_read(i_gc_rwsem) - __blockdev_direct_io() - get_data_block_dio_write() - f2fs_dio_submit_bio() ---- (b) - up_read(i_gc_rwsem) /* phase 4 */ down_write(i_gc_rwsem) move_data_block() ---- (c) up_write(i_gc_rwsem) (a) In phase 3 of f2fs_gc(), up-to-date page is read from storage and cached in META_MAPPING. (b) In thread B, writing new data by IPU or DIO write on same blkaddr as read in (a). cached page in META_MAPPING become out-dated. (c) In phase 4 of f2fs_gc(), out-dated page in META_MAPPING is copied to new blkaddr. In conclusion, the newly written data in (b) is lost. To address this issue, invalidating pages in META_MAPPING before IPU or DIO write. " In previous commit, we missed to cover extent cache hit case, and passed wrong value for parameter @end of invalidate_mapping_pages(), fix both issues. Fixes: 6aa58d8ad20a ("f2fs: readahead encrypted block during GC") Fixes: e3b49ea36802 ("f2fs: invalidate META_MAPPING before IPU/DIO write") Cc: Hyeong-Jun Kim Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/f2fs/data.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 9a1a526f2092..1862b03a9982 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1436,9 +1436,12 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs= _map_blocks *map, *map->m_next_extent =3D pgofs + map->m_len; =20 /* for hardware encryption, but to avoid potential issue in future */ - if (flag =3D=3D F2FS_GET_BLOCK_DIO) + if (flag =3D=3D F2FS_GET_BLOCK_DIO) { f2fs_wait_on_block_writeback_range(inode, map->m_pblk, map->m_len); + invalidate_mapping_pages(META_MAPPING(sbi), + map->m_pblk, map->m_pblk + map->m_len - 1); + } =20 if (map->m_multidev_dio) { block_t blk_addr =3D map->m_pblk; @@ -1655,7 +1658,7 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_= map_blocks *map, f2fs_wait_on_block_writeback_range(inode, map->m_pblk, map->m_len); invalidate_mapping_pages(META_MAPPING(sbi), - map->m_pblk, map->m_pblk); + map->m_pblk, map->m_pblk + map->m_len - 1); =20 if (map->m_multidev_dio) { block_t blk_addr =3D map->m_pblk; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2662CC00140 for ; Mon, 15 Aug 2022 22:57:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233689AbiHOW51 (ORCPT ); Mon, 15 Aug 2022 18:57:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352242AbiHOWzV (ORCPT ); Mon, 15 Aug 2022 18:55:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6310413B88F; Mon, 15 Aug 2022 12:55:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CA264612AC; Mon, 15 Aug 2022 19:55:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF6EFC433C1; Mon, 15 Aug 2022 19:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593307; bh=++/ccFWEPTN4VQVkgkKIVVVj1aYxf7ZJD9jzJQ3EwYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ov+PjKJlosBOqHgCYeaYP4BeE4m4HA2wXhT5f3GKunAYC/cTiM3lItUkU1NSpRD4P 1L5cD5pGopOOLY4bE89C4xJDMMIzR8QA4iQ755YzpSv8wZpx0cm+UkJ541+C9Csb1f 4nxllBDO4VpswNnQj+DneOyLLMWxwORcaCXQRG2k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.18 0927/1095] f2fs: check pinfile in gc_data_segment() in advance Date: Mon, 15 Aug 2022 20:05:26 +0200 Message-Id: <20220815180507.603347042@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chao Yu [ Upstream commit a22bb5526d7dd627b94a7ee22e5a98c36e39fceb ] In order to skip migrating section which contains data of pinned file in advance. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/f2fs/gc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index ea5b93b689cd..e83c07144d8f 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1480,6 +1480,13 @@ static int gc_data_segment(struct f2fs_sb_info *sbi,= struct f2fs_summary *sum, special_file(inode->i_mode)) continue; =20 + if (is_inode_flag_set(inode, FI_PIN_FILE) && + gc_type =3D=3D FG_GC) { + f2fs_pin_file_control(inode, true); + iput(inode); + return submitted; + } + if (!f2fs_down_write_trylock( &F2FS_I(inode)->i_gc_rwsem[WRITE])) { iput(inode); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A573C00140 for ; Mon, 15 Aug 2022 22:57:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352353AbiHOW5g (ORCPT ); Mon, 15 Aug 2022 18:57:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352359AbiHOWzi (ORCPT ); Mon, 15 Aug 2022 18:55:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E8CC261E; Mon, 15 Aug 2022 12:55:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C337561178; Mon, 15 Aug 2022 19:55:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE486C433D6; Mon, 15 Aug 2022 19:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593315; bh=P5OullaDC/JY0jpGOHyzfuITkSwrD2srDkMM99RXN/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vk0A/CwQ3/LOJ73fqyR/tRZv1ZveqgATrJ2218l3LdQ7JGZnfZMb+PbVTDzw01U76 JMpgJdeKLVHN4IdKB6IXv8SZtyXuEIqL7FGnGKUnEdgt/wwQOErqK0B3Kn/2Kit8pJ ZZrr+C9OzYEVBsLh1JG5REEz2cu0wG7i1lXkw3VE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.18 0928/1095] f2fs: dont set GC_FAILURE_PIN for background GC Date: Mon, 15 Aug 2022 20:05:27 +0200 Message-Id: <20220815180507.633833003@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chao Yu [ Upstream commit 642c0969916eaa4878cb74f36752108e590b0389 ] So that it can reduce the possibility that file be unpinned forcely by foreground GC due to .i_gc_failures[GC_FAILURE_PIN] exceeds threshold. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/f2fs/gc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index e83c07144d8f..6a7e4148ff9d 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1202,7 +1202,8 @@ static int move_data_block(struct inode *inode, block= _t bidx, } =20 if (f2fs_is_pinned_file(inode)) { - f2fs_pin_file_control(inode, true); + if (gc_type =3D=3D FG_GC) + f2fs_pin_file_control(inode, true); err =3D -EAGAIN; goto out; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC65DC25B0D for ; Mon, 15 Aug 2022 22:57:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242018AbiHOW5o (ORCPT ); Mon, 15 Aug 2022 18:57:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352458AbiHOWzt (ORCPT ); Mon, 15 Aug 2022 18:55:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5A2B3C17B; Mon, 15 Aug 2022 12:55:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 34ABCB81136; Mon, 15 Aug 2022 19:55:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52EB6C433D6; Mon, 15 Aug 2022 19:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593321; bh=2zp/vsUDwQiyqPlsyHNvN09ZapKjPGhKIbd11SKCAQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=haPRck2yE/BvlRNPuHh5Gv963SrsLC2G+DP/lvT/09BNvi7VWkHehHP2mcnmWKTKB HJeKAJJBn4dR9npJ4yrdFOp63dsmFpFwPvMTBSl4viyeRlCVdbEAeEWferjvzt/LeM Kuw+8tQbYBP2qr4QQ7rQJIcxBy0qjZvFN7l0a8FY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Byungki Lee , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.18 0929/1095] f2fs: write checkpoint during FG_GC Date: Mon, 15 Aug 2022 20:05:28 +0200 Message-Id: <20220815180507.671856275@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Byungki Lee [ Upstream commit a9163b947ae8f7af7cb8d63606cd87b9facbfe74 ] If there's not enough free sections each of which consistis of large segmen= ts, we can hit no free section for upcoming section allocation. Let's reclaim s= ome prefree segments by writing checkpoints. Signed-off-by: Byungki Lee Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/f2fs/gc.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 6a7e4148ff9d..a193862ad8a5 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1790,23 +1790,31 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, if (sync) goto stop; =20 - if (has_not_enough_free_secs(sbi, sec_freed, 0)) { - if (skipped_round <=3D MAX_SKIP_GC_COUNT || - skipped_round * 2 < round) { - segno =3D NULL_SEGNO; - goto gc_more; - } + if (!has_not_enough_free_secs(sbi, sec_freed, 0)) + goto stop; =20 - if (first_skipped < last_skipped && - (last_skipped - first_skipped) > - sbi->skipped_gc_rwsem) { - f2fs_drop_inmem_pages_all(sbi, true); - segno =3D NULL_SEGNO; - goto gc_more; - } - if (gc_type =3D=3D FG_GC && !is_sbi_flag_set(sbi, SBI_CP_DISABLED)) + if (skipped_round <=3D MAX_SKIP_GC_COUNT || skipped_round * 2 < round) { + + /* Write checkpoint to reclaim prefree segments */ + if (free_sections(sbi) < NR_CURSEG_PERSIST_TYPE && + prefree_segments(sbi) && + !is_sbi_flag_set(sbi, SBI_CP_DISABLED)) { ret =3D f2fs_write_checkpoint(sbi, &cpc); - } + if (ret) + goto stop; + } + segno =3D NULL_SEGNO; + goto gc_more; + } + if (first_skipped < last_skipped && + (last_skipped - first_skipped) > + sbi->skipped_gc_rwsem) { + f2fs_drop_inmem_pages_all(sbi, true); + segno =3D NULL_SEGNO; + goto gc_more; + } + if (gc_type =3D=3D FG_GC && !is_sbi_flag_set(sbi, SBI_CP_DISABLED)) + ret =3D f2fs_write_checkpoint(sbi, &cpc); stop: SIT_I(sbi)->last_victim[ALLOC_NEXT] =3D 0; SIT_I(sbi)->last_victim[FLUSH_DEVICE] =3D init_segno; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8853CC00140 for ; Mon, 15 Aug 2022 22:57:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352404AbiHOW5s (ORCPT ); Mon, 15 Aug 2022 18:57:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352531AbiHOW4Q (ORCPT ); Mon, 15 Aug 2022 18:56:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 081C230578; Mon, 15 Aug 2022 12:55:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D3AD0B8114A; Mon, 15 Aug 2022 19:55:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B910C433C1; Mon, 15 Aug 2022 19:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593328; bh=05avqxmYXFOy+Fb6qKZzCgRFhzrIHH+pxQNlBFNqTWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HQZ1nwn7A+ozVnbGR6uindWse91RcOCoKMaqWfZxSDLXLjN1/SHFc0z+iJBhXGQPU g6qfdss9I9puRevV+JqGl/qsQG5hbJGfrwhguOk17pnP7Od8SkP/genq7odnc9LHVm 60bLoFIdErKeF72/hvzFA5HdbnfPrBagxYxkZsm4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.18 0930/1095] f2fs: give priority to select unpinned section for foreground GC Date: Mon, 15 Aug 2022 20:05:29 +0200 Message-Id: <20220815180507.708748476@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chao Yu [ Upstream commit 71419129625a50cfb5e3c5cc215948a3f98c806d ] Previously, during foreground GC, if victims contain data of pinned file, it will fail migration of the data, and meanwhile i_gc_failures of that pinned file may increase, and when it exceeds threshold, GC will unpin the file, result in breaking pinfile's semantics. In order to mitigate such condition, let's record and skip section which has pinned file's data and give priority to select unpinned one. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/f2fs/gc.c | 85 +++++++++++++++++++++++++++++++++++++++-------- fs/f2fs/segment.c | 8 +++++ fs/f2fs/segment.h | 3 ++ 3 files changed, 82 insertions(+), 14 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index a193862ad8a5..3009c0a97ab4 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -646,6 +646,54 @@ static void release_victim_entry(struct f2fs_sb_info *= sbi) f2fs_bug_on(sbi, !list_empty(&am->victim_list)); } =20 +static bool f2fs_pin_section(struct f2fs_sb_info *sbi, unsigned int segno) +{ + struct dirty_seglist_info *dirty_i =3D DIRTY_I(sbi); + unsigned int secno =3D GET_SEC_FROM_SEG(sbi, segno); + + if (!dirty_i->enable_pin_section) + return false; + if (!test_and_set_bit(secno, dirty_i->pinned_secmap)) + dirty_i->pinned_secmap_cnt++; + return true; +} + +static bool f2fs_pinned_section_exists(struct dirty_seglist_info *dirty_i) +{ + return dirty_i->pinned_secmap_cnt; +} + +static bool f2fs_section_is_pinned(struct dirty_seglist_info *dirty_i, + unsigned int secno) +{ + return dirty_i->enable_pin_section && + f2fs_pinned_section_exists(dirty_i) && + test_bit(secno, dirty_i->pinned_secmap); +} + +static void f2fs_unpin_all_sections(struct f2fs_sb_info *sbi, bool enable) +{ + unsigned int bitmap_size =3D f2fs_bitmap_size(MAIN_SECS(sbi)); + + if (f2fs_pinned_section_exists(DIRTY_I(sbi))) { + memset(DIRTY_I(sbi)->pinned_secmap, 0, bitmap_size); + DIRTY_I(sbi)->pinned_secmap_cnt =3D 0; + } + DIRTY_I(sbi)->enable_pin_section =3D enable; +} + +static int f2fs_gc_pinned_control(struct inode *inode, int gc_type, + unsigned int segno) +{ + if (!f2fs_is_pinned_file(inode)) + return 0; + if (gc_type !=3D FG_GC) + return -EBUSY; + if (!f2fs_pin_section(F2FS_I_SB(inode), segno)) + f2fs_pin_file_control(inode, true); + return -EAGAIN; +} + /* * This function is called from two paths. * One is garbage collection and the other is SSR segment selection. @@ -787,6 +835,9 @@ static int get_victim_by_default(struct f2fs_sb_info *s= bi, if (gc_type =3D=3D BG_GC && test_bit(secno, dirty_i->victim_secmap)) goto next; =20 + if (gc_type =3D=3D FG_GC && f2fs_section_is_pinned(dirty_i, secno)) + goto next; + if (is_atgc) { add_victim_entry(sbi, &p, segno); goto next; @@ -1201,12 +1252,9 @@ static int move_data_block(struct inode *inode, bloc= k_t bidx, goto out; } =20 - if (f2fs_is_pinned_file(inode)) { - if (gc_type =3D=3D FG_GC) - f2fs_pin_file_control(inode, true); - err =3D -EAGAIN; + err =3D f2fs_gc_pinned_control(inode, gc_type, segno); + if (err) goto out; - } =20 set_new_dnode(&dn, inode, NULL, NULL, 0); err =3D f2fs_get_dnode_of_data(&dn, bidx, LOOKUP_NODE); @@ -1351,12 +1399,9 @@ static int move_data_page(struct inode *inode, block= _t bidx, int gc_type, err =3D -EAGAIN; goto out; } - if (f2fs_is_pinned_file(inode)) { - if (gc_type =3D=3D FG_GC) - f2fs_pin_file_control(inode, true); - err =3D -EAGAIN; + err =3D f2fs_gc_pinned_control(inode, gc_type, segno); + if (err) goto out; - } =20 if (gc_type =3D=3D BG_GC) { if (PageWriteback(page)) { @@ -1476,14 +1521,15 @@ static int gc_data_segment(struct f2fs_sb_info *sbi= , struct f2fs_summary *sum, ofs_in_node =3D le16_to_cpu(entry->ofs_in_node); =20 if (phase =3D=3D 3) { + int err; + inode =3D f2fs_iget(sb, dni.ino); if (IS_ERR(inode) || is_bad_inode(inode) || special_file(inode->i_mode)) continue; =20 - if (is_inode_flag_set(inode, FI_PIN_FILE) && - gc_type =3D=3D FG_GC) { - f2fs_pin_file_control(inode, true); + err =3D f2fs_gc_pinned_control(inode, gc_type, segno); + if (err =3D=3D -EAGAIN) { iput(inode); return submitted; } @@ -1766,9 +1812,17 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, ret =3D -EINVAL; goto stop; } +retry: ret =3D __get_victim(sbi, &segno, gc_type); - if (ret) + if (ret) { + /* allow to search victim from sections has pinned data */ + if (ret =3D=3D -ENODATA && gc_type =3D=3D FG_GC && + f2fs_pinned_section_exists(DIRTY_I(sbi))) { + f2fs_unpin_all_sections(sbi, false); + goto retry; + } goto stop; + } =20 seg_freed =3D do_garbage_collect(sbi, segno, &gc_list, gc_type, force); if (gc_type =3D=3D FG_GC && @@ -1819,6 +1873,9 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, SIT_I(sbi)->last_victim[ALLOC_NEXT] =3D 0; SIT_I(sbi)->last_victim[FLUSH_DEVICE] =3D init_segno; =20 + if (gc_type =3D=3D FG_GC) + f2fs_unpin_all_sections(sbi, true); + trace_f2fs_gc_end(sbi->sb, ret, total_freed, sec_freed, get_pages(sbi, F2FS_DIRTY_NODES), get_pages(sbi, F2FS_DIRTY_DENTS), diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index aa0162664a1e..a914b70f8543 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -4653,6 +4653,13 @@ static int init_victim_secmap(struct f2fs_sb_info *s= bi) dirty_i->victim_secmap =3D f2fs_kvzalloc(sbi, bitmap_size, GFP_KERNEL); if (!dirty_i->victim_secmap) return -ENOMEM; + + dirty_i->pinned_secmap =3D f2fs_kvzalloc(sbi, bitmap_size, GFP_KERNEL); + if (!dirty_i->pinned_secmap) + return -ENOMEM; + + dirty_i->pinned_secmap_cnt =3D 0; + dirty_i->enable_pin_section =3D true; return 0; } =20 @@ -5241,6 +5248,7 @@ static void destroy_victim_secmap(struct f2fs_sb_info= *sbi) { struct dirty_seglist_info *dirty_i =3D DIRTY_I(sbi); =20 + kvfree(dirty_i->pinned_secmap); kvfree(dirty_i->victim_secmap); } =20 diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 1fa26a9603cb..8fbc9f6afa55 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -295,6 +295,9 @@ struct dirty_seglist_info { struct mutex seglist_lock; /* lock for segment bitmaps */ int nr_dirty[NR_DIRTY_TYPE]; /* # of dirty segments */ unsigned long *victim_secmap; /* background GC victims */ + unsigned long *pinned_secmap; /* pinned victims from foreground GC */ + unsigned int pinned_secmap_cnt; /* count of victims which has pinned dat= a */ + bool enable_pin_section; /* enable pinning section */ }; =20 /* victim selection function for cleaning and SSR */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94301C25B0D for ; Mon, 15 Aug 2022 22:58:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352435AbiHOW6R (ORCPT ); Mon, 15 Aug 2022 18:58:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352620AbiHOW41 (ORCPT ); Mon, 15 Aug 2022 18:56:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1A7630F75; Mon, 15 Aug 2022 12:55:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F2C28B80EAD; Mon, 15 Aug 2022 19:55:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EB13C433C1; Mon, 15 Aug 2022 19:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593334; bh=GIH4ddnl7odpqrS7xLLx6jo1+9V9uYFQW4dGidvphOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OPoEqgKoAPLLp8yYqIXENicjgt8IDNcDSYxakC9Vup+QMUzLNC/tbf7xEu5foW8cW 9jf5h3CKQXQof7fdubVhGseeCxVH9BcBUpWMv+Spi681cCjfeNC66DPY/H0KS+FuGJ 5421Kmit6ik65m4xuRQ2PakF3tpy71x5DrxuVRZ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daeho Jeong , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.18 0931/1095] f2fs: change the current atomic write way Date: Mon, 15 Aug 2022 20:05:30 +0200 Message-Id: <20220815180507.738744574@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daeho Jeong [ Upstream commit 3db1de0e582c358dd013f3703cd55b5fe4076436 ] Current atomic write has three major issues like below. - keeps the updates in non-reclaimable memory space and they are even hard to be migrated, which is not good for contiguous memory allocation. - disk spaces used for atomic files cannot be garbage collected, so this makes it difficult for the filesystem to be defragmented. - If atomic write operations hit the threshold of either memory usage or garbage collection failure count, All the atomic write operations will fail immediately. To resolve the issues, I will keep a COW inode internally for all the updates to be flushed from memory, when we need to flush them out in a situation like high memory pressure. These COW inodes will be tagged as orphan inodes to be reclaimed in case of sudden power-cut or system failure during atomic writes. Signed-off-by: Daeho Jeong Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/f2fs/data.c | 180 +++++++++++------ fs/f2fs/debug.c | 12 +- fs/f2fs/f2fs.h | 33 +--- fs/f2fs/file.c | 49 ++--- fs/f2fs/gc.c | 27 +-- fs/f2fs/inode.c | 3 +- fs/f2fs/namei.c | 28 ++- fs/f2fs/node.c | 4 - fs/f2fs/node.h | 1 - fs/f2fs/segment.c | 380 ++++++++++++------------------------ fs/f2fs/segment.h | 4 +- fs/f2fs/super.c | 6 +- include/trace/events/f2fs.h | 22 --- 13 files changed, 303 insertions(+), 446 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 1862b03a9982..4c1603a79745 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -69,8 +69,7 @@ static bool __is_cp_guaranteed(struct page *page) =20 if (f2fs_is_compressed_page(page)) return false; - if ((S_ISREG(inode->i_mode) && - (f2fs_is_atomic_file(inode) || IS_NOQUOTA(inode))) || + if ((S_ISREG(inode->i_mode) && IS_NOQUOTA(inode)) || page_private_gcing(page)) return true; return false; @@ -2566,7 +2565,12 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio) bool ipu_force =3D false; int err =3D 0; =20 - set_new_dnode(&dn, inode, NULL, NULL, 0); + /* Use COW inode to make dnode_of_data for atomic write */ + if (f2fs_is_atomic_file(inode)) + set_new_dnode(&dn, F2FS_I(inode)->cow_inode, NULL, NULL, 0); + else + set_new_dnode(&dn, inode, NULL, NULL, 0); + if (need_inplace_update(fio) && f2fs_lookup_extent_cache(inode, page->index, &ei)) { fio->old_blkaddr =3D ei.blk + page->index - ei.fofs; @@ -2603,6 +2607,7 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio) err =3D -EFSCORRUPTED; goto out_writepage; } + /* * If current allocation needs SSR, * it had better in-place writes for updated data. @@ -3316,6 +3321,100 @@ static int prepare_write_begin(struct f2fs_sb_info = *sbi, return err; } =20 +static int __find_data_block(struct inode *inode, pgoff_t index, + block_t *blk_addr) +{ + struct dnode_of_data dn; + struct page *ipage; + struct extent_info ei =3D {0, }; + int err =3D 0; + + ipage =3D f2fs_get_node_page(F2FS_I_SB(inode), inode->i_ino); + if (IS_ERR(ipage)) + return PTR_ERR(ipage); + + set_new_dnode(&dn, inode, ipage, ipage, 0); + + if (f2fs_lookup_extent_cache(inode, index, &ei)) { + dn.data_blkaddr =3D ei.blk + index - ei.fofs; + } else { + /* hole case */ + err =3D f2fs_get_dnode_of_data(&dn, index, LOOKUP_NODE); + if (err) { + dn.data_blkaddr =3D NULL_ADDR; + err =3D 0; + } + } + *blk_addr =3D dn.data_blkaddr; + f2fs_put_dnode(&dn); + return err; +} + +static int __reserve_data_block(struct inode *inode, pgoff_t index, + block_t *blk_addr, bool *node_changed) +{ + struct f2fs_sb_info *sbi =3D F2FS_I_SB(inode); + struct dnode_of_data dn; + struct page *ipage; + int err =3D 0; + + f2fs_do_map_lock(sbi, F2FS_GET_BLOCK_PRE_AIO, true); + + ipage =3D f2fs_get_node_page(sbi, inode->i_ino); + if (IS_ERR(ipage)) { + err =3D PTR_ERR(ipage); + goto unlock_out; + } + set_new_dnode(&dn, inode, ipage, ipage, 0); + + err =3D f2fs_get_block(&dn, index); + + *blk_addr =3D dn.data_blkaddr; + *node_changed =3D dn.node_changed; + f2fs_put_dnode(&dn); + +unlock_out: + f2fs_do_map_lock(sbi, F2FS_GET_BLOCK_PRE_AIO, false); + return err; +} + +static int prepare_atomic_write_begin(struct f2fs_sb_info *sbi, + struct page *page, loff_t pos, unsigned int len, + block_t *blk_addr, bool *node_changed) +{ + struct inode *inode =3D page->mapping->host; + struct inode *cow_inode =3D F2FS_I(inode)->cow_inode; + pgoff_t index =3D page->index; + int err =3D 0; + block_t ori_blk_addr; + + /* If pos is beyond the end of file, reserve a new block in COW inode */ + if ((pos & PAGE_MASK) >=3D i_size_read(inode)) + return __reserve_data_block(cow_inode, index, blk_addr, + node_changed); + + /* Look for the block in COW inode first */ + err =3D __find_data_block(cow_inode, index, blk_addr); + if (err) + return err; + else if (*blk_addr !=3D NULL_ADDR) + return 0; + + /* Look for the block in the original inode */ + err =3D __find_data_block(inode, index, &ori_blk_addr); + if (err) + return err; + + /* Finally, we should reserve a new block in COW inode for the update */ + err =3D __reserve_data_block(cow_inode, index, blk_addr, node_changed); + if (err) + return err; + + if (ori_blk_addr !=3D NULL_ADDR) + *blk_addr =3D ori_blk_addr; + return 0; +} + static int f2fs_write_begin(struct file *file, struct address_space *mappi= ng, loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata) @@ -3324,7 +3423,7 @@ static int f2fs_write_begin(struct file *file, struct= address_space *mapping, struct f2fs_sb_info *sbi =3D F2FS_I_SB(inode); struct page *page =3D NULL; pgoff_t index =3D ((unsigned long long) pos) >> PAGE_SHIFT; - bool need_balance =3D false, drop_atomic =3D false; + bool need_balance =3D false; block_t blkaddr =3D NULL_ADDR; int err =3D 0; =20 @@ -3335,14 +3434,6 @@ static int f2fs_write_begin(struct file *file, struc= t address_space *mapping, goto fail; } =20 - if ((f2fs_is_atomic_file(inode) && - !f2fs_available_free_memory(sbi, INMEM_PAGES)) || - is_inode_flag_set(inode, FI_ATOMIC_REVOKE_REQUEST)) { - err =3D -ENOMEM; - drop_atomic =3D true; - goto fail; - } - /* * We should check this at this moment to avoid deadlock on inode page * and #0 page. The locking rule for inline_data conversion should be: @@ -3390,7 +3481,11 @@ static int f2fs_write_begin(struct file *file, struc= t address_space *mapping, =20 *pagep =3D page; =20 - err =3D prepare_write_begin(sbi, page, pos, len, + if (f2fs_is_atomic_file(inode)) + err =3D prepare_atomic_write_begin(sbi, page, pos, len, + &blkaddr, &need_balance); + else + err =3D prepare_write_begin(sbi, page, pos, len, &blkaddr, &need_balance); if (err) goto fail; @@ -3446,8 +3541,6 @@ static int f2fs_write_begin(struct file *file, struct= address_space *mapping, fail: f2fs_put_page(page, 1); f2fs_write_failed(inode, pos + len); - if (drop_atomic) - f2fs_drop_inmem_pages_all(sbi, false); return err; } =20 @@ -3491,8 +3584,12 @@ static int f2fs_write_end(struct file *file, set_page_dirty(page); =20 if (pos + copied > i_size_read(inode) && - !f2fs_verity_in_progress(inode)) + !f2fs_verity_in_progress(inode)) { f2fs_i_size_write(inode, pos + copied); + if (f2fs_is_atomic_file(inode)) + f2fs_i_size_write(F2FS_I(inode)->cow_inode, + pos + copied); + } unlock_out: f2fs_put_page(page, 1); f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); @@ -3525,9 +3622,6 @@ void f2fs_invalidate_folio(struct folio *folio, size_= t offset, size_t length) inode->i_ino =3D=3D F2FS_COMPRESS_INO(sbi)) clear_page_private_data(&folio->page); =20 - if (page_private_atomic(&folio->page)) - return f2fs_drop_inmem_page(inode, &folio->page); - folio_detach_private(folio); } =20 @@ -3537,10 +3631,6 @@ int f2fs_release_page(struct page *page, gfp_t wait) if (PageDirty(page)) return 0; =20 - /* This is atomic written page, keep Private */ - if (page_private_atomic(page)) - return 0; - if (test_opt(F2FS_P_SB(page), COMPRESS_CACHE)) { struct inode *inode =3D page->mapping->host; =20 @@ -3566,18 +3656,6 @@ static bool f2fs_dirty_data_folio(struct address_spa= ce *mapping, folio_mark_uptodate(folio); BUG_ON(folio_test_swapcache(folio)); =20 - if (f2fs_is_atomic_file(inode) && !f2fs_is_commit_atomic_write(inode)) { - if (!page_private_atomic(&folio->page)) { - f2fs_register_inmem_page(inode, &folio->page); - return true; - } - /* - * Previously, this page has been registered, we just - * return here. - */ - return false; - } - if (!folio_test_dirty(folio)) { filemap_dirty_folio(mapping, folio); f2fs_update_dirty_folio(inode, folio); @@ -3657,42 +3735,14 @@ static sector_t f2fs_bmap(struct address_space *map= ping, sector_t block) int f2fs_migrate_page(struct address_space *mapping, struct page *newpage, struct page *page, enum migrate_mode mode) { - int rc, extra_count; - struct f2fs_inode_info *fi =3D F2FS_I(mapping->host); - bool atomic_written =3D page_private_atomic(page); + int rc, extra_count =3D 0; =20 BUG_ON(PageWriteback(page)); =20 - /* migrating an atomic written page is safe with the inmem_lock hold */ - if (atomic_written) { - if (mode !=3D MIGRATE_SYNC) - return -EBUSY; - if (!mutex_trylock(&fi->inmem_lock)) - return -EAGAIN; - } - - /* one extra reference was held for atomic_write page */ - extra_count =3D atomic_written ? 1 : 0; rc =3D migrate_page_move_mapping(mapping, newpage, page, extra_count); - if (rc !=3D MIGRATEPAGE_SUCCESS) { - if (atomic_written) - mutex_unlock(&fi->inmem_lock); + if (rc !=3D MIGRATEPAGE_SUCCESS) return rc; - } - - if (atomic_written) { - struct inmem_pages *cur; - - list_for_each_entry(cur, &fi->inmem_pages, list) - if (cur->page =3D=3D page) { - cur->page =3D newpage; - break; - } - mutex_unlock(&fi->inmem_lock); - put_page(page); - get_page(newpage); - } =20 /* guarantee to start from no stale private field */ set_page_private(newpage, 0); diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index fcdf253cd211..65f0bcf498bb 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -91,7 +91,6 @@ static void update_general_status(struct f2fs_sb_info *sb= i) si->ndirty_files =3D sbi->ndirty_inode[FILE_INODE]; si->nquota_files =3D sbi->nquota_files; si->ndirty_all =3D sbi->ndirty_inode[DIRTY_META]; - si->inmem_pages =3D get_pages(sbi, F2FS_INMEM_PAGES); si->aw_cnt =3D sbi->atomic_files; si->vw_cnt =3D atomic_read(&sbi->vw_cnt); si->max_aw_cnt =3D atomic_read(&sbi->max_aw_cnt); @@ -167,8 +166,6 @@ static void update_general_status(struct f2fs_sb_info *= sbi) si->alloc_nids =3D NM_I(sbi)->nid_cnt[PREALLOC_NID]; si->io_skip_bggc =3D sbi->io_skip_bggc; si->other_skip_bggc =3D sbi->other_skip_bggc; - si->skipped_atomic_files[BG_GC] =3D sbi->skipped_atomic_files[BG_GC]; - si->skipped_atomic_files[FG_GC] =3D sbi->skipped_atomic_files[FG_GC]; si->util_free =3D (int)(free_user_blocks(sbi) >> sbi->log_blocks_per_seg) * 100 / (int)(sbi->user_block_count >> sbi->log_blocks_per_seg) / 2; @@ -296,7 +293,6 @@ static void update_mem_info(struct f2fs_sb_info *sbi) sizeof(struct nat_entry); si->cache_mem +=3D NM_I(sbi)->nat_cnt[DIRTY_NAT] * sizeof(struct nat_entry_set); - si->cache_mem +=3D si->inmem_pages * sizeof(struct inmem_pages); for (i =3D 0; i < MAX_INO_ENTRY; i++) si->cache_mem +=3D sbi->im[i].ino_num * sizeof(struct ino_entry); si->cache_mem +=3D atomic_read(&sbi->total_ext_tree) * @@ -491,10 +487,6 @@ static int stat_show(struct seq_file *s, void *v) si->bg_data_blks); seq_printf(s, " - node blocks : %d (%d)\n", si->node_blks, si->bg_node_blks); - seq_printf(s, "Skipped : atomic write %llu (%llu)\n", - si->skipped_atomic_files[BG_GC] + - si->skipped_atomic_files[FG_GC], - si->skipped_atomic_files[BG_GC]); seq_printf(s, "BG skip : IO: %u, Other: %u\n", si->io_skip_bggc, si->other_skip_bggc); seq_puts(s, "\nExtent Cache:\n"); @@ -519,9 +511,9 @@ static int stat_show(struct seq_file *s, void *v) si->flush_list_empty, si->nr_discarding, si->nr_discarded, si->nr_discard_cmd, si->undiscard_blks); - seq_printf(s, " - inmem: %4d, atomic IO: %4d (Max. %4d), " + seq_printf(s, " - atomic IO: %4d (Max. %4d), " "volatile IO: %4d (Max. %4d)\n", - si->inmem_pages, si->aw_cnt, si->max_aw_cnt, + si->aw_cnt, si->max_aw_cnt, si->vw_cnt, si->max_vw_cnt); seq_printf(s, " - compress: %4d, hit:%8d\n", si->compress_pages, si->co= mpress_page_hit); seq_printf(s, " - nodes: %4d in %4d\n", diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 9b89f26af1f3..13140b753ba1 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -716,7 +716,6 @@ enum { =20 enum { GC_FAILURE_PIN, - GC_FAILURE_ATOMIC, MAX_GC_FAILURE }; =20 @@ -738,7 +737,6 @@ enum { FI_UPDATE_WRITE, /* inode has in-place-update data */ FI_NEED_IPU, /* used for ipu per file */ FI_ATOMIC_FILE, /* indicate atomic file */ - FI_ATOMIC_COMMIT, /* indicate the state of atomical committing */ FI_VOLATILE_FILE, /* indicate volatile file */ FI_FIRST_BLOCK_WRITTEN, /* indicate #0 data block was written */ FI_DROP_CACHE, /* drop dirty page cache */ @@ -752,7 +750,6 @@ enum { FI_EXTRA_ATTR, /* indicate file has extra attribute */ FI_PROJ_INHERIT, /* indicate file inherits projectid */ FI_PIN_FILE, /* indicate file should not be gced */ - FI_ATOMIC_REVOKE_REQUEST, /* request to drop atomic data */ FI_VERITY_IN_PROGRESS, /* building fs-verity Merkle tree */ FI_COMPRESSED_FILE, /* indicate file's data can be compressed */ FI_COMPRESS_CORRUPT, /* indicate compressed cluster is corrupted */ @@ -794,11 +791,9 @@ struct f2fs_inode_info { #endif struct list_head dirty_list; /* dirty list for dirs and files */ struct list_head gdirty_list; /* linked in global dirty list */ - struct list_head inmem_ilist; /* list for inmem inodes */ - struct list_head inmem_pages; /* inmemory pages managed by f2fs */ - struct task_struct *inmem_task; /* store inmemory task */ - struct mutex inmem_lock; /* lock for inmemory pages */ + struct task_struct *atomic_write_task; /* store atomic write task */ struct extent_tree *extent_tree; /* cached extent_tree entry */ + struct inode *cow_inode; /* copy-on-write inode for atomic write */ =20 /* avoid racing between foreground op and gc */ struct f2fs_rwsem i_gc_rwsem[2]; @@ -1092,7 +1087,6 @@ enum count_type { F2FS_DIRTY_QDATA, F2FS_DIRTY_NODES, F2FS_DIRTY_META, - F2FS_INMEM_PAGES, F2FS_DIRTY_IMETA, F2FS_WB_CP_DATA, F2FS_WB_DATA, @@ -1122,11 +1116,7 @@ enum page_type { META, NR_PAGE_TYPE, META_FLUSH, - INMEM, /* the below types are used by tracepoints only. */ - INMEM_DROP, - INMEM_INVALIDATE, - INMEM_REVOKE, - IPU, + IPU, /* the below types are used by tracepoints only. */ OPU, }; =20 @@ -1718,7 +1708,6 @@ struct f2fs_sb_info { =20 /* for skip statistic */ unsigned int atomic_files; /* # of opened atomic file */ - unsigned long long skipped_atomic_files[2]; /* FG_GC and BG_GC */ unsigned long long skipped_gc_rwsem; /* FG_GC only */ =20 /* threshold for gc trials on pinned files */ @@ -3202,11 +3191,6 @@ static inline bool f2fs_is_atomic_file(struct inode = *inode) return is_inode_flag_set(inode, FI_ATOMIC_FILE); } =20 -static inline bool f2fs_is_commit_atomic_write(struct inode *inode) -{ - return is_inode_flag_set(inode, FI_ATOMIC_COMMIT); -} - static inline bool f2fs_is_volatile_file(struct inode *inode) { return is_inode_flag_set(inode, FI_VOLATILE_FILE); @@ -3444,6 +3428,8 @@ void f2fs_handle_failed_inode(struct inode *inode); int f2fs_update_extension_list(struct f2fs_sb_info *sbi, const char *name, bool hot, bool set); struct dentry *f2fs_get_parent(struct dentry *child); +int f2fs_get_tmpfile(struct user_namespace *mnt_userns, struct inode *dir, + struct inode **new_inode); =20 /* * dir.c @@ -3579,11 +3565,8 @@ void f2fs_destroy_node_manager_caches(void); * segment.c */ bool f2fs_need_SSR(struct f2fs_sb_info *sbi); -void f2fs_register_inmem_page(struct inode *inode, struct page *page); -void f2fs_drop_inmem_pages_all(struct f2fs_sb_info *sbi, bool gc_failure); -void f2fs_drop_inmem_pages(struct inode *inode); -void f2fs_drop_inmem_page(struct inode *inode, struct page *page); -int f2fs_commit_inmem_pages(struct inode *inode); +int f2fs_commit_atomic_write(struct inode *inode); +void f2fs_abort_atomic_write(struct inode *inode, bool clean); void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need); void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi, bool from_bg); int f2fs_issue_flush(struct f2fs_sb_info *sbi, nid_t ino); @@ -3815,7 +3798,6 @@ struct f2fs_stat_info { int ext_tree, zombie_tree, ext_node; int ndirty_node, ndirty_dent, ndirty_meta, ndirty_imeta; int ndirty_data, ndirty_qdata; - int inmem_pages; unsigned int ndirty_dirs, ndirty_files, nquota_files, ndirty_all; int nats, dirty_nats, sits, dirty_sits; int free_nids, avail_nids, alloc_nids; @@ -3845,7 +3827,6 @@ struct f2fs_stat_info { int bg_node_segs, bg_data_segs; int tot_blks, data_blks, node_blks; int bg_data_blks, bg_node_blks; - unsigned long long skipped_atomic_files[2]; int curseg[NR_CURSEG_TYPE]; int cursec[NR_CURSEG_TYPE]; int curzone[NR_CURSEG_TYPE]; diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 5d1b97e852e7..9b04a7a0a368 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1816,9 +1816,8 @@ static int f2fs_release_file(struct inode *inode, str= uct file *filp) atomic_read(&inode->i_writecount) !=3D 1) return 0; =20 - /* some remained atomic pages should discarded */ if (f2fs_is_atomic_file(inode)) - f2fs_drop_inmem_pages(inode); + f2fs_abort_atomic_write(inode, true); if (f2fs_is_volatile_file(inode)) { set_inode_flag(inode, FI_DROP_CACHE); filemap_fdatawrite(inode->i_mapping); @@ -1840,8 +1839,8 @@ static int f2fs_file_flush(struct file *file, fl_owne= r_t id) * before dropping file lock, it needs to do in ->flush. */ if (f2fs_is_atomic_file(inode) && - F2FS_I(inode)->inmem_task =3D=3D current) - f2fs_drop_inmem_pages(inode); + F2FS_I(inode)->atomic_write_task =3D=3D current) + f2fs_abort_atomic_write(inode, true); return 0; } =20 @@ -2004,6 +2003,7 @@ static int f2fs_ioc_start_atomic_write(struct file *f= ilp) struct user_namespace *mnt_userns =3D file_mnt_user_ns(filp); struct f2fs_inode_info *fi =3D F2FS_I(inode); struct f2fs_sb_info *sbi =3D F2FS_I_SB(inode); + struct inode *pinode; int ret; =20 if (!inode_owner_or_capable(mnt_userns, inode)) @@ -2026,11 +2026,8 @@ static int f2fs_ioc_start_atomic_write(struct file *= filp) goto out; } =20 - if (f2fs_is_atomic_file(inode)) { - if (is_inode_flag_set(inode, FI_ATOMIC_REVOKE_REQUEST)) - ret =3D -EINVAL; + if (f2fs_is_atomic_file(inode)) goto out; - } =20 ret =3D f2fs_convert_inline_inode(inode); if (ret) @@ -2051,19 +2048,33 @@ static int f2fs_ioc_start_atomic_write(struct file = *filp) goto out; } =20 + /* Create a COW inode for atomic write */ + pinode =3D f2fs_iget(inode->i_sb, fi->i_pino); + if (IS_ERR(pinode)) { + f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); + ret =3D PTR_ERR(pinode); + goto out; + } + + ret =3D f2fs_get_tmpfile(mnt_userns, pinode, &fi->cow_inode); + iput(pinode); + if (ret) { + f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); + goto out; + } + f2fs_i_size_write(fi->cow_inode, i_size_read(inode)); + spin_lock(&sbi->inode_lock[ATOMIC_FILE]); - if (list_empty(&fi->inmem_ilist)) - list_add_tail(&fi->inmem_ilist, &sbi->inode_list[ATOMIC_FILE]); sbi->atomic_files++; spin_unlock(&sbi->inode_lock[ATOMIC_FILE]); =20 - /* add inode in inmem_list first and set atomic_file */ set_inode_flag(inode, FI_ATOMIC_FILE); - clear_inode_flag(inode, FI_ATOMIC_REVOKE_REQUEST); + set_inode_flag(fi->cow_inode, FI_ATOMIC_FILE); + clear_inode_flag(fi->cow_inode, FI_INLINE_DATA); f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); =20 f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); - F2FS_I(inode)->inmem_task =3D current; + F2FS_I(inode)->atomic_write_task =3D current; stat_update_max_atomic_write(inode); out: inode_unlock(inode); @@ -2094,21 +2105,17 @@ static int f2fs_ioc_commit_atomic_write(struct file= *filp) } =20 if (f2fs_is_atomic_file(inode)) { - ret =3D f2fs_commit_inmem_pages(inode); + ret =3D f2fs_commit_atomic_write(inode); if (ret) goto err_out; =20 ret =3D f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true); if (!ret) - f2fs_drop_inmem_pages(inode); + f2fs_abort_atomic_write(inode, false); } else { ret =3D f2fs_do_sync_file(filp, 0, LLONG_MAX, 1, false); } err_out: - if (is_inode_flag_set(inode, FI_ATOMIC_REVOKE_REQUEST)) { - clear_inode_flag(inode, FI_ATOMIC_REVOKE_REQUEST); - ret =3D -EINVAL; - } inode_unlock(inode); mnt_drop_write_file(filp); return ret; @@ -2196,15 +2203,13 @@ static int f2fs_ioc_abort_volatile_write(struct fil= e *filp) inode_lock(inode); =20 if (f2fs_is_atomic_file(inode)) - f2fs_drop_inmem_pages(inode); + f2fs_abort_atomic_write(inode, true); if (f2fs_is_volatile_file(inode)) { clear_inode_flag(inode, FI_VOLATILE_FILE); stat_dec_volatile_write(inode); ret =3D f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true); } =20 - clear_inode_flag(inode, FI_ATOMIC_REVOKE_REQUEST); - inode_unlock(inode); =20 mnt_drop_write_file(filp); diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 3009c0a97ab4..ba8e93e517be 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1245,13 +1245,6 @@ static int move_data_block(struct inode *inode, bloc= k_t bidx, goto out; } =20 - if (f2fs_is_atomic_file(inode)) { - F2FS_I(inode)->i_gc_failures[GC_FAILURE_ATOMIC]++; - F2FS_I_SB(inode)->skipped_atomic_files[gc_type]++; - err =3D -EAGAIN; - goto out; - } - err =3D f2fs_gc_pinned_control(inode, gc_type, segno); if (err) goto out; @@ -1393,12 +1386,6 @@ static int move_data_page(struct inode *inode, block= _t bidx, int gc_type, goto out; } =20 - if (f2fs_is_atomic_file(inode)) { - F2FS_I(inode)->i_gc_failures[GC_FAILURE_ATOMIC]++; - F2FS_I_SB(inode)->skipped_atomic_files[gc_type]++; - err =3D -EAGAIN; - goto out; - } err =3D f2fs_gc_pinned_control(inode, gc_type, segno); if (err) goto out; @@ -1765,8 +1752,6 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, .ilist =3D LIST_HEAD_INIT(gc_list.ilist), .iroot =3D RADIX_TREE_INIT(gc_list.iroot, GFP_NOFS), }; - unsigned long long last_skipped =3D sbi->skipped_atomic_files[FG_GC]; - unsigned long long first_skipped; unsigned int skipped_round =3D 0, round =3D 0; =20 trace_f2fs_gc_begin(sbi->sb, sync, background, @@ -1780,7 +1765,6 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, =20 cpc.reason =3D __get_cp_reason(sbi); sbi->skipped_gc_rwsem =3D 0; - first_skipped =3D last_skipped; gc_more: if (unlikely(!(sbi->sb->s_flags & SB_ACTIVE))) { ret =3D -EINVAL; @@ -1831,10 +1815,8 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, total_freed +=3D seg_freed; =20 if (gc_type =3D=3D FG_GC) { - if (sbi->skipped_atomic_files[FG_GC] > last_skipped || - sbi->skipped_gc_rwsem) + if (sbi->skipped_gc_rwsem) skipped_round++; - last_skipped =3D sbi->skipped_atomic_files[FG_GC]; round++; } =20 @@ -1860,13 +1842,6 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, segno =3D NULL_SEGNO; goto gc_more; } - if (first_skipped < last_skipped && - (last_skipped - first_skipped) > - sbi->skipped_gc_rwsem) { - f2fs_drop_inmem_pages_all(sbi, true); - segno =3D NULL_SEGNO; - goto gc_more; - } if (gc_type =3D=3D FG_GC && !is_sbi_flag_set(sbi, SBI_CP_DISABLED)) ret =3D f2fs_write_checkpoint(sbi, &cpc); stop: diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index e9818723103c..938961a9084e 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -744,9 +744,8 @@ void f2fs_evict_inode(struct inode *inode) nid_t xnid =3D F2FS_I(inode)->i_xattr_nid; int err =3D 0; =20 - /* some remained atomic pages should discarded */ if (f2fs_is_atomic_file(inode)) - f2fs_drop_inmem_pages(inode); + f2fs_abort_atomic_write(inode, true); =20 trace_f2fs_evict_inode(inode); truncate_inode_pages_final(&inode->i_data); diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 3764e12f19db..28d5981443a7 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -848,8 +848,8 @@ static int f2fs_mknod(struct user_namespace *mnt_userns= , struct inode *dir, } =20 static int __f2fs_tmpfile(struct user_namespace *mnt_userns, struct inode = *dir, - struct dentry *dentry, umode_t mode, - struct inode **whiteout) + struct dentry *dentry, umode_t mode, bool is_whiteout, + struct inode **new_inode) { struct f2fs_sb_info *sbi =3D F2FS_I_SB(dir); struct inode *inode; @@ -863,7 +863,7 @@ static int __f2fs_tmpfile(struct user_namespace *mnt_us= erns, struct inode *dir, if (IS_ERR(inode)) return PTR_ERR(inode); =20 - if (whiteout) { + if (is_whiteout) { init_special_inode(inode, inode->i_mode, WHITEOUT_DEV); inode->i_op =3D &f2fs_special_inode_operations; } else { @@ -888,21 +888,25 @@ static int __f2fs_tmpfile(struct user_namespace *mnt_= userns, struct inode *dir, f2fs_add_orphan_inode(inode); f2fs_alloc_nid_done(sbi, inode->i_ino); =20 - if (whiteout) { + if (is_whiteout) { f2fs_i_links_write(inode, false); =20 spin_lock(&inode->i_lock); inode->i_state |=3D I_LINKABLE; spin_unlock(&inode->i_lock); - - *whiteout =3D inode; } else { - d_tmpfile(dentry, inode); + if (dentry) + d_tmpfile(dentry, inode); + else + f2fs_i_links_write(inode, false); } /* link_count was changed by d_tmpfile as well. */ f2fs_unlock_op(sbi); unlock_new_inode(inode); =20 + if (new_inode) + *new_inode =3D inode; + f2fs_balance_fs(sbi, true); return 0; =20 @@ -923,7 +927,7 @@ static int f2fs_tmpfile(struct user_namespace *mnt_user= ns, struct inode *dir, if (!f2fs_is_checkpoint_ready(sbi)) return -ENOSPC; =20 - return __f2fs_tmpfile(mnt_userns, dir, dentry, mode, NULL); + return __f2fs_tmpfile(mnt_userns, dir, dentry, mode, false, NULL); } =20 static int f2fs_create_whiteout(struct user_namespace *mnt_userns, @@ -933,7 +937,13 @@ static int f2fs_create_whiteout(struct user_namespace = *mnt_userns, return -EIO; =20 return __f2fs_tmpfile(mnt_userns, dir, NULL, - S_IFCHR | WHITEOUT_MODE, whiteout); + S_IFCHR | WHITEOUT_MODE, true, whiteout); +} + +int f2fs_get_tmpfile(struct user_namespace *mnt_userns, struct inode *dir, + struct inode **new_inode) +{ + return __f2fs_tmpfile(mnt_userns, dir, NULL, S_IFREG, false, new_inode); } =20 static int f2fs_rename(struct user_namespace *mnt_userns, struct inode *ol= d_dir, diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index aedc3d334113..9dabf99eedc5 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -90,10 +90,6 @@ bool f2fs_available_free_memory(struct f2fs_sb_info *sbi= , int type) atomic_read(&sbi->total_ext_node) * sizeof(struct extent_node)) >> PAGE_SHIFT; res =3D mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1); - } else if (type =3D=3D INMEM_PAGES) { - /* it allows 20% / total_ram for inmemory pages */ - mem_size =3D get_pages(sbi, F2FS_INMEM_PAGES); - res =3D mem_size < (val.totalram / 5); } else if (type =3D=3D DISCARD_CACHE) { mem_size =3D (atomic_read(&dcc->discard_cmd_cnt) * sizeof(struct discard_cmd)) >> PAGE_SHIFT; diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h index 4c1d34bfea78..3c09cae058b0 100644 --- a/fs/f2fs/node.h +++ b/fs/f2fs/node.h @@ -147,7 +147,6 @@ enum mem_type { DIRTY_DENTS, /* indicates dirty dentry pages */ INO_ENTRIES, /* indicates inode entries */ EXTENT_CACHE, /* indicates extent cache */ - INMEM_PAGES, /* indicates inmemory pages */ DISCARD_CACHE, /* indicates memory of cached discard cmds */ COMPRESS_PAGE, /* indicates memory of cached compressed pages */ BASE_CHECK, /* check kernel status */ diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index a914b70f8543..86a3c5a5a564 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -30,7 +30,7 @@ static struct kmem_cache *discard_entry_slab; static struct kmem_cache *discard_cmd_slab; static struct kmem_cache *sit_entry_set_slab; -static struct kmem_cache *inmem_entry_slab; +static struct kmem_cache *revoke_entry_slab; =20 static unsigned long __reverse_ulong(unsigned char *str) { @@ -185,304 +185,180 @@ bool f2fs_need_SSR(struct f2fs_sb_info *sbi) SM_I(sbi)->min_ssr_sections + reserved_sections(sbi)); } =20 -void f2fs_register_inmem_page(struct inode *inode, struct page *page) +void f2fs_abort_atomic_write(struct inode *inode, bool clean) { - struct inmem_pages *new; - - set_page_private_atomic(page); - - new =3D f2fs_kmem_cache_alloc(inmem_entry_slab, - GFP_NOFS, true, NULL); - - /* add atomic page indices to the list */ - new->page =3D page; - INIT_LIST_HEAD(&new->list); + struct f2fs_sb_info *sbi =3D F2FS_I_SB(inode); + struct f2fs_inode_info *fi =3D F2FS_I(inode); =20 - /* increase reference count with clean state */ - get_page(page); - mutex_lock(&F2FS_I(inode)->inmem_lock); - list_add_tail(&new->list, &F2FS_I(inode)->inmem_pages); - inc_page_count(F2FS_I_SB(inode), F2FS_INMEM_PAGES); - mutex_unlock(&F2FS_I(inode)->inmem_lock); + if (f2fs_is_atomic_file(inode)) { + if (clean) + truncate_inode_pages_final(inode->i_mapping); + clear_inode_flag(fi->cow_inode, FI_ATOMIC_FILE); + iput(fi->cow_inode); + fi->cow_inode =3D NULL; + clear_inode_flag(inode, FI_ATOMIC_FILE); =20 - trace_f2fs_register_inmem_page(page, INMEM); + spin_lock(&sbi->inode_lock[ATOMIC_FILE]); + sbi->atomic_files--; + spin_unlock(&sbi->inode_lock[ATOMIC_FILE]); + } } =20 -static int __revoke_inmem_pages(struct inode *inode, - struct list_head *head, bool drop, bool recover, - bool trylock) +static int __replace_atomic_write_block(struct inode *inode, pgoff_t index, + block_t new_addr, block_t *old_addr, bool recover) { struct f2fs_sb_info *sbi =3D F2FS_I_SB(inode); - struct inmem_pages *cur, *tmp; - int err =3D 0; - - list_for_each_entry_safe(cur, tmp, head, list) { - struct page *page =3D cur->page; - - if (drop) - trace_f2fs_commit_inmem_page(page, INMEM_DROP); - - if (trylock) { - /* - * to avoid deadlock in between page lock and - * inmem_lock. - */ - if (!trylock_page(page)) - continue; - } else { - lock_page(page); - } - - f2fs_wait_on_page_writeback(page, DATA, true, true); - - if (recover) { - struct dnode_of_data dn; - struct node_info ni; + struct dnode_of_data dn; + struct node_info ni; + int err; =20 - trace_f2fs_commit_inmem_page(page, INMEM_REVOKE); retry: - set_new_dnode(&dn, inode, NULL, NULL, 0); - err =3D f2fs_get_dnode_of_data(&dn, page->index, - LOOKUP_NODE); - if (err) { - if (err =3D=3D -ENOMEM) { - memalloc_retry_wait(GFP_NOFS); - goto retry; - } - err =3D -EAGAIN; - goto next; - } - - err =3D f2fs_get_node_info(sbi, dn.nid, &ni, false); - if (err) { - f2fs_put_dnode(&dn); - return err; - } - - if (cur->old_addr =3D=3D NEW_ADDR) { - f2fs_invalidate_blocks(sbi, dn.data_blkaddr); - f2fs_update_data_blkaddr(&dn, NEW_ADDR); - } else - f2fs_replace_block(sbi, &dn, dn.data_blkaddr, - cur->old_addr, ni.version, true, true); - f2fs_put_dnode(&dn); - } -next: - /* we don't need to invalidate this in the sccessful status */ - if (drop || recover) { - ClearPageUptodate(page); - clear_page_private_gcing(page); + set_new_dnode(&dn, inode, NULL, NULL, 0); + err =3D f2fs_get_dnode_of_data(&dn, index, LOOKUP_NODE_RA); + if (err) { + if (err =3D=3D -ENOMEM) { + f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT); + goto retry; } - detach_page_private(page); - set_page_private(page, 0); - f2fs_put_page(page, 1); - - list_del(&cur->list); - kmem_cache_free(inmem_entry_slab, cur); - dec_page_count(F2FS_I_SB(inode), F2FS_INMEM_PAGES); + return err; } - return err; -} =20 -void f2fs_drop_inmem_pages_all(struct f2fs_sb_info *sbi, bool gc_failure) -{ - struct list_head *head =3D &sbi->inode_list[ATOMIC_FILE]; - struct inode *inode; - struct f2fs_inode_info *fi; - unsigned int count =3D sbi->atomic_files; - unsigned int looped =3D 0; -next: - spin_lock(&sbi->inode_lock[ATOMIC_FILE]); - if (list_empty(head)) { - spin_unlock(&sbi->inode_lock[ATOMIC_FILE]); - return; + err =3D f2fs_get_node_info(sbi, dn.nid, &ni, false); + if (err) { + f2fs_put_dnode(&dn); + return err; } - fi =3D list_first_entry(head, struct f2fs_inode_info, inmem_ilist); - inode =3D igrab(&fi->vfs_inode); - if (inode) - list_move_tail(&fi->inmem_ilist, head); - spin_unlock(&sbi->inode_lock[ATOMIC_FILE]); =20 - if (inode) { - if (gc_failure) { - if (!fi->i_gc_failures[GC_FAILURE_ATOMIC]) - goto skip; + if (recover) { + /* dn.data_blkaddr is always valid */ + if (!__is_valid_data_blkaddr(new_addr)) { + if (new_addr =3D=3D NULL_ADDR) + dec_valid_block_count(sbi, inode, 1); + f2fs_invalidate_blocks(sbi, dn.data_blkaddr); + f2fs_update_data_blkaddr(&dn, new_addr); + } else { + f2fs_replace_block(sbi, &dn, dn.data_blkaddr, + new_addr, ni.version, true, true); } - set_inode_flag(inode, FI_ATOMIC_REVOKE_REQUEST); - f2fs_drop_inmem_pages(inode); -skip: - iput(inode); - } - f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT); - if (gc_failure) { - if (++looped >=3D count) - return; - } - goto next; -} - -void f2fs_drop_inmem_pages(struct inode *inode) -{ - struct f2fs_sb_info *sbi =3D F2FS_I_SB(inode); - struct f2fs_inode_info *fi =3D F2FS_I(inode); + } else { + blkcnt_t count =3D 1; =20 - do { - mutex_lock(&fi->inmem_lock); - if (list_empty(&fi->inmem_pages)) { - fi->i_gc_failures[GC_FAILURE_ATOMIC] =3D 0; - - spin_lock(&sbi->inode_lock[ATOMIC_FILE]); - if (!list_empty(&fi->inmem_ilist)) - list_del_init(&fi->inmem_ilist); - if (f2fs_is_atomic_file(inode)) { - clear_inode_flag(inode, FI_ATOMIC_FILE); - sbi->atomic_files--; - } - spin_unlock(&sbi->inode_lock[ATOMIC_FILE]); + *old_addr =3D dn.data_blkaddr; + f2fs_truncate_data_blocks_range(&dn, 1); + dec_valid_block_count(sbi, F2FS_I(inode)->cow_inode, count); + inc_valid_block_count(sbi, inode, &count); + f2fs_replace_block(sbi, &dn, dn.data_blkaddr, new_addr, + ni.version, true, false); + } =20 - mutex_unlock(&fi->inmem_lock); - break; - } - __revoke_inmem_pages(inode, &fi->inmem_pages, - true, false, true); - mutex_unlock(&fi->inmem_lock); - } while (1); + f2fs_put_dnode(&dn); + return 0; } =20 -void f2fs_drop_inmem_page(struct inode *inode, struct page *page) +static void __complete_revoke_list(struct inode *inode, struct list_head *= head, + bool revoke) { - struct f2fs_inode_info *fi =3D F2FS_I(inode); - struct f2fs_sb_info *sbi =3D F2FS_I_SB(inode); - struct list_head *head =3D &fi->inmem_pages; - struct inmem_pages *cur =3D NULL; - struct inmem_pages *tmp; - - f2fs_bug_on(sbi, !page_private_atomic(page)); + struct revoke_entry *cur, *tmp; =20 - mutex_lock(&fi->inmem_lock); - list_for_each_entry(tmp, head, list) { - if (tmp->page =3D=3D page) { - cur =3D tmp; - break; - } + list_for_each_entry_safe(cur, tmp, head, list) { + if (revoke) + __replace_atomic_write_block(inode, cur->index, + cur->old_addr, NULL, true); + list_del(&cur->list); + kmem_cache_free(revoke_entry_slab, cur); } - - f2fs_bug_on(sbi, !cur); - list_del(&cur->list); - mutex_unlock(&fi->inmem_lock); - - dec_page_count(sbi, F2FS_INMEM_PAGES); - kmem_cache_free(inmem_entry_slab, cur); - - ClearPageUptodate(page); - clear_page_private_atomic(page); - f2fs_put_page(page, 0); - - detach_page_private(page); - set_page_private(page, 0); - - trace_f2fs_commit_inmem_page(page, INMEM_INVALIDATE); } =20 -static int __f2fs_commit_inmem_pages(struct inode *inode) +static int __f2fs_commit_atomic_write(struct inode *inode) { struct f2fs_sb_info *sbi =3D F2FS_I_SB(inode); struct f2fs_inode_info *fi =3D F2FS_I(inode); - struct inmem_pages *cur, *tmp; - struct f2fs_io_info fio =3D { - .sbi =3D sbi, - .ino =3D inode->i_ino, - .type =3D DATA, - .op =3D REQ_OP_WRITE, - .op_flags =3D REQ_SYNC | REQ_PRIO, - .io_type =3D FS_DATA_IO, - }; + struct inode *cow_inode =3D fi->cow_inode; + struct revoke_entry *new; struct list_head revoke_list; - bool submit_bio =3D false; - int err =3D 0; + block_t blkaddr; + struct dnode_of_data dn; + pgoff_t len =3D DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE); + pgoff_t off =3D 0, blen, index; + int ret =3D 0, i; =20 INIT_LIST_HEAD(&revoke_list); =20 - list_for_each_entry_safe(cur, tmp, &fi->inmem_pages, list) { - struct page *page =3D cur->page; + while (len) { + blen =3D min_t(pgoff_t, ADDRS_PER_BLOCK(cow_inode), len); =20 - lock_page(page); - if (page->mapping =3D=3D inode->i_mapping) { - trace_f2fs_commit_inmem_page(page, INMEM); + set_new_dnode(&dn, cow_inode, NULL, NULL, 0); + ret =3D f2fs_get_dnode_of_data(&dn, off, LOOKUP_NODE_RA); + if (ret && ret !=3D -ENOENT) { + goto out; + } else if (ret =3D=3D -ENOENT) { + ret =3D 0; + if (dn.max_level =3D=3D 0) + goto out; + goto next; + } =20 - f2fs_wait_on_page_writeback(page, DATA, true, true); + blen =3D min((pgoff_t)ADDRS_PER_PAGE(dn.node_page, cow_inode), + len); + index =3D off; + for (i =3D 0; i < blen; i++, dn.ofs_in_node++, index++) { + blkaddr =3D f2fs_data_blkaddr(&dn); =20 - set_page_dirty(page); - if (clear_page_dirty_for_io(page)) { - inode_dec_dirty_pages(inode); - f2fs_remove_dirty_inode(inode); - } -retry: - fio.page =3D page; - fio.old_blkaddr =3D NULL_ADDR; - fio.encrypted_page =3D NULL; - fio.need_lock =3D LOCK_DONE; - err =3D f2fs_do_write_data_page(&fio); - if (err) { - if (err =3D=3D -ENOMEM) { - memalloc_retry_wait(GFP_NOFS); - goto retry; - } - unlock_page(page); - break; + if (!__is_valid_data_blkaddr(blkaddr)) { + continue; + } else if (!f2fs_is_valid_blkaddr(sbi, blkaddr, + DATA_GENERIC_ENHANCE)) { + f2fs_put_dnode(&dn); + ret =3D -EFSCORRUPTED; + goto out; } - /* record old blkaddr for revoking */ - cur->old_addr =3D fio.old_blkaddr; - submit_bio =3D true; - } - unlock_page(page); - list_move_tail(&cur->list, &revoke_list); - } =20 - if (submit_bio) - f2fs_submit_merged_write_cond(sbi, inode, NULL, 0, DATA); + new =3D f2fs_kmem_cache_alloc(revoke_entry_slab, GFP_NOFS, + true, NULL); + if (!new) { + f2fs_put_dnode(&dn); + ret =3D -ENOMEM; + goto out; + } =20 - if (err) { - /* - * try to revoke all committed pages, but still we could fail - * due to no memory or other reason, if that happened, EAGAIN - * will be returned, which means in such case, transaction is - * already not integrity, caller should use journal to do the - * recovery or rewrite & commit last transaction. For other - * error number, revoking was done by filesystem itself. - */ - err =3D __revoke_inmem_pages(inode, &revoke_list, - false, true, false); + ret =3D __replace_atomic_write_block(inode, index, blkaddr, + &new->old_addr, false); + if (ret) { + f2fs_put_dnode(&dn); + kmem_cache_free(revoke_entry_slab, new); + goto out; + } =20 - /* drop all uncommitted pages */ - __revoke_inmem_pages(inode, &fi->inmem_pages, - true, false, false); - } else { - __revoke_inmem_pages(inode, &revoke_list, - false, false, false); + f2fs_update_data_blkaddr(&dn, NULL_ADDR); + new->index =3D index; + list_add_tail(&new->list, &revoke_list); + } + f2fs_put_dnode(&dn); +next: + off +=3D blen; + len -=3D blen; } =20 - return err; +out: + __complete_revoke_list(inode, &revoke_list, ret ? true : false); + + return ret; } =20 -int f2fs_commit_inmem_pages(struct inode *inode) +int f2fs_commit_atomic_write(struct inode *inode) { struct f2fs_sb_info *sbi =3D F2FS_I_SB(inode); struct f2fs_inode_info *fi =3D F2FS_I(inode); int err; =20 - f2fs_balance_fs(sbi, true); + err =3D filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); + if (err) + return err; =20 f2fs_down_write(&fi->i_gc_rwsem[WRITE]); - f2fs_lock_op(sbi); - set_inode_flag(inode, FI_ATOMIC_COMMIT); - - mutex_lock(&fi->inmem_lock); - err =3D __f2fs_commit_inmem_pages(inode); - mutex_unlock(&fi->inmem_lock); =20 - clear_inode_flag(inode, FI_ATOMIC_COMMIT); + err =3D __f2fs_commit_atomic_write(inode); =20 f2fs_unlock_op(sbi); f2fs_up_write(&fi->i_gc_rwsem[WRITE]); @@ -5359,9 +5235,9 @@ int __init f2fs_create_segment_manager_caches(void) if (!sit_entry_set_slab) goto destroy_discard_cmd; =20 - inmem_entry_slab =3D f2fs_kmem_cache_create("f2fs_inmem_page_entry", - sizeof(struct inmem_pages)); - if (!inmem_entry_slab) + revoke_entry_slab =3D f2fs_kmem_cache_create("f2fs_revoke_entry", + sizeof(struct revoke_entry)); + if (!revoke_entry_slab) goto destroy_sit_entry_set; return 0; =20 @@ -5380,5 +5256,5 @@ void f2fs_destroy_segment_manager_caches(void) kmem_cache_destroy(sit_entry_set_slab); kmem_cache_destroy(discard_cmd_slab); kmem_cache_destroy(discard_entry_slab); - kmem_cache_destroy(inmem_entry_slab); + kmem_cache_destroy(revoke_entry_slab); } diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 8fbc9f6afa55..3f277dfcb131 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -225,10 +225,10 @@ struct segment_allocation { =20 #define MAX_SKIP_GC_COUNT 16 =20 -struct inmem_pages { +struct revoke_entry { struct list_head list; - struct page *page; block_t old_addr; /* for revoking when fail to commit */ + pgoff_t index; }; =20 struct sit_info { diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 1b59f95606c7..e3539c027a6c 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1339,9 +1339,6 @@ static struct inode *f2fs_alloc_inode(struct super_bl= ock *sb) spin_lock_init(&fi->i_size_lock); INIT_LIST_HEAD(&fi->dirty_list); INIT_LIST_HEAD(&fi->gdirty_list); - INIT_LIST_HEAD(&fi->inmem_ilist); - INIT_LIST_HEAD(&fi->inmem_pages); - mutex_init(&fi->inmem_lock); init_f2fs_rwsem(&fi->i_gc_rwsem[READ]); init_f2fs_rwsem(&fi->i_gc_rwsem[WRITE]); init_f2fs_rwsem(&fi->i_xattr_sem); @@ -1382,9 +1379,8 @@ static int f2fs_drop_inode(struct inode *inode) atomic_inc(&inode->i_count); spin_unlock(&inode->i_lock); =20 - /* some remained atomic pages should discarded */ if (f2fs_is_atomic_file(inode)) - f2fs_drop_inmem_pages(inode); + f2fs_abort_atomic_write(inode, true); =20 /* should remain fi->extent_tree for writepage */ f2fs_destroy_extent_node(inode); diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 1779e133cea0..d91370377523 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -15,10 +15,6 @@ TRACE_DEFINE_ENUM(NODE); TRACE_DEFINE_ENUM(DATA); TRACE_DEFINE_ENUM(META); TRACE_DEFINE_ENUM(META_FLUSH); -TRACE_DEFINE_ENUM(INMEM); -TRACE_DEFINE_ENUM(INMEM_DROP); -TRACE_DEFINE_ENUM(INMEM_INVALIDATE); -TRACE_DEFINE_ENUM(INMEM_REVOKE); TRACE_DEFINE_ENUM(IPU); TRACE_DEFINE_ENUM(OPU); TRACE_DEFINE_ENUM(HOT); @@ -59,10 +55,6 @@ TRACE_DEFINE_ENUM(CP_RESIZE); { DATA, "DATA" }, \ { META, "META" }, \ { META_FLUSH, "META_FLUSH" }, \ - { INMEM, "INMEM" }, \ - { INMEM_DROP, "INMEM_DROP" }, \ - { INMEM_INVALIDATE, "INMEM_INVALIDATE" }, \ - { INMEM_REVOKE, "INMEM_REVOKE" }, \ { IPU, "IN-PLACE" }, \ { OPU, "OUT-OF-PLACE" }) =20 @@ -1289,20 +1281,6 @@ DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite, TP_ARGS(page, type) ); =20 -DEFINE_EVENT(f2fs__page, f2fs_register_inmem_page, - - TP_PROTO(struct page *page, int type), - - TP_ARGS(page, type) -); - -DEFINE_EVENT(f2fs__page, f2fs_commit_inmem_page, - - TP_PROTO(struct page *page, int type), - - TP_ARGS(page, type) -); - TRACE_EVENT(f2fs_filemap_fault, =20 TP_PROTO(struct inode *inode, pgoff_t index, unsigned long ret), --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAA25C3F6B0 for ; Mon, 15 Aug 2022 22:58:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352447AbiHOW63 (ORCPT ); Mon, 15 Aug 2022 18:58:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352670AbiHOW4e (ORCPT ); Mon, 15 Aug 2022 18:56:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 409A545F71; Mon, 15 Aug 2022 12:55:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 195CBB80EB1; Mon, 15 Aug 2022 19:55:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 634ABC433D6; Mon, 15 Aug 2022 19:55:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593343; bh=b8P6wp/YZFfxYrEl2lGN9d3k3AyqwUd6Z5FBEFA0Yys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k5yE7MV/IYeq5xVVqxUoW1nfK4e5nYGp+3nvPi0so3BzFYWfSc4PRZHR96QA9z8oJ WpH22FqYUQdP2b8bAYpsPHPPUh31+FrVHlbxf+YkmpHTB3Ngaaag/tDzl8pxT3C5cc F3kEGXxHNYI62XEn9Khrp/hafPeqUc3PT0adN1n4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.18 0932/1095] f2fs: kill volatile write support Date: Mon, 15 Aug 2022 20:05:31 +0200 Message-Id: <20220815180507.784381254@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jaegeuk Kim [ Upstream commit 7bc155fec5b371dbb57256e84a49c78692a09060 ] There's no user, since all can use atomic writes simply. Let's kill it. Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/f2fs/checkpoint.c | 4 +- fs/f2fs/data.c | 5 -- fs/f2fs/debug.c | 10 +--- fs/f2fs/f2fs.h | 27 +--------- fs/f2fs/file.c | 116 ++----------------------------------------- fs/f2fs/segment.c | 3 +- fs/f2fs/verity.c | 2 +- 7 files changed, 10 insertions(+), 157 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index beceac9885c3..63ab8c9d674e 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -1004,9 +1004,7 @@ static void __add_dirty_inode(struct inode *inode, en= um inode_type type) return; =20 set_inode_flag(inode, flag); - if (!f2fs_is_volatile_file(inode)) - list_add_tail(&F2FS_I(inode)->dirty_list, - &sbi->inode_list[type]); + list_add_tail(&F2FS_I(inode)->dirty_list, &sbi->inode_list[type]); stat_inc_dirty_inode(sbi, type); } =20 diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 4c1603a79745..07522e82c7c4 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2744,11 +2744,6 @@ int f2fs_write_single_data_page(struct page *page, i= nt *submitted, write: if (f2fs_is_drop_cache(inode)) goto out; - /* we should not write 0'th page having journal header */ - if (f2fs_is_volatile_file(inode) && (!page->index || - (!wbc->for_reclaim && - f2fs_available_free_memory(sbi, BASE_CHECK)))) - goto redirty_out; =20 /* Dentry/quota blocks are controlled by checkpoint */ if (S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) { diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index 65f0bcf498bb..c92625ef16d0 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -92,9 +92,7 @@ static void update_general_status(struct f2fs_sb_info *sb= i) si->nquota_files =3D sbi->nquota_files; si->ndirty_all =3D sbi->ndirty_inode[DIRTY_META]; si->aw_cnt =3D sbi->atomic_files; - si->vw_cnt =3D atomic_read(&sbi->vw_cnt); si->max_aw_cnt =3D atomic_read(&sbi->max_aw_cnt); - si->max_vw_cnt =3D atomic_read(&sbi->max_vw_cnt); si->nr_dio_read =3D get_pages(sbi, F2FS_DIO_READ); si->nr_dio_write =3D get_pages(sbi, F2FS_DIO_WRITE); si->nr_wb_cp_data =3D get_pages(sbi, F2FS_WB_CP_DATA); @@ -511,10 +509,8 @@ static int stat_show(struct seq_file *s, void *v) si->flush_list_empty, si->nr_discarding, si->nr_discarded, si->nr_discard_cmd, si->undiscard_blks); - seq_printf(s, " - atomic IO: %4d (Max. %4d), " - "volatile IO: %4d (Max. %4d)\n", - si->aw_cnt, si->max_aw_cnt, - si->vw_cnt, si->max_vw_cnt); + seq_printf(s, " - atomic IO: %4d (Max. %4d)\n", + si->aw_cnt, si->max_aw_cnt); seq_printf(s, " - compress: %4d, hit:%8d\n", si->compress_pages, si->co= mpress_page_hit); seq_printf(s, " - nodes: %4d in %4d\n", si->ndirty_node, si->node_pages); @@ -615,9 +611,7 @@ int f2fs_build_stats(struct f2fs_sb_info *sbi) for (i =3D META_CP; i < META_MAX; i++) atomic_set(&sbi->meta_count[i], 0); =20 - atomic_set(&sbi->vw_cnt, 0); atomic_set(&sbi->max_aw_cnt, 0); - atomic_set(&sbi->max_vw_cnt, 0); =20 raw_spin_lock_irqsave(&f2fs_stat_lock, flags); list_add_tail(&si->stat_list, &f2fs_stat_list); diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 13140b753ba1..ce8f496a7e5d 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -737,7 +737,6 @@ enum { FI_UPDATE_WRITE, /* inode has in-place-update data */ FI_NEED_IPU, /* used for ipu per file */ FI_ATOMIC_FILE, /* indicate atomic file */ - FI_VOLATILE_FILE, /* indicate volatile file */ FI_FIRST_BLOCK_WRITTEN, /* indicate #0 data block was written */ FI_DROP_CACHE, /* drop dirty page cache */ FI_DATA_EXIST, /* indicate data exists */ @@ -1738,9 +1737,7 @@ struct f2fs_sb_info { atomic_t inline_dir; /* # of inline_dentry inodes */ atomic_t compr_inode; /* # of compressed inodes */ atomic64_t compr_blocks; /* # of compressed blocks */ - atomic_t vw_cnt; /* # of volatile writes */ atomic_t max_aw_cnt; /* max # of atomic writes */ - atomic_t max_vw_cnt; /* max # of volatile writes */ unsigned int io_skip_bggc; /* skip background gc for in-flight IO */ unsigned int other_skip_bggc; /* skip background gc for other reasons */ unsigned int ndirty_inode[NR_INODE_TYPE]; /* # of dirty inodes */ @@ -3191,11 +3188,6 @@ static inline bool f2fs_is_atomic_file(struct inode = *inode) return is_inode_flag_set(inode, FI_ATOMIC_FILE); } =20 -static inline bool f2fs_is_volatile_file(struct inode *inode) -{ - return is_inode_flag_set(inode, FI_VOLATILE_FILE); -} - static inline bool f2fs_is_first_block_written(struct inode *inode) { return is_inode_flag_set(inode, FI_FIRST_BLOCK_WRITTEN); @@ -3815,7 +3807,7 @@ struct f2fs_stat_info { int inline_xattr, inline_inode, inline_dir, append, update, orphans; int compr_inode; unsigned long long compr_blocks; - int aw_cnt, max_aw_cnt, vw_cnt, max_vw_cnt; + int aw_cnt, max_aw_cnt; unsigned int valid_count, valid_node_count, valid_inode_count, discard_bl= ks; unsigned int bimodal, avg_vblocks; int util_free, util_valid, util_invalid; @@ -3926,17 +3918,6 @@ static inline struct f2fs_stat_info *F2FS_STAT(struc= t f2fs_sb_info *sbi) if (cur > max) \ atomic_set(&F2FS_I_SB(inode)->max_aw_cnt, cur); \ } while (0) -#define stat_inc_volatile_write(inode) \ - (atomic_inc(&F2FS_I_SB(inode)->vw_cnt)) -#define stat_dec_volatile_write(inode) \ - (atomic_dec(&F2FS_I_SB(inode)->vw_cnt)) -#define stat_update_max_volatile_write(inode) \ - do { \ - int cur =3D atomic_read(&F2FS_I_SB(inode)->vw_cnt); \ - int max =3D atomic_read(&F2FS_I_SB(inode)->max_vw_cnt); \ - if (cur > max) \ - atomic_set(&F2FS_I_SB(inode)->max_vw_cnt, cur); \ - } while (0) #define stat_inc_seg_count(sbi, type, gc_type) \ do { \ struct f2fs_stat_info *si =3D F2FS_STAT(sbi); \ @@ -3998,9 +3979,6 @@ void f2fs_update_sit_info(struct f2fs_sb_info *sbi); #define stat_add_compr_blocks(inode, blocks) do { } while (0) #define stat_sub_compr_blocks(inode, blocks) do { } while (0) #define stat_update_max_atomic_write(inode) do { } while (0) -#define stat_inc_volatile_write(inode) do { } while (0) -#define stat_dec_volatile_write(inode) do { } while (0) -#define stat_update_max_volatile_write(inode) do { } while (0) #define stat_inc_meta_count(sbi, blkaddr) do { } while (0) #define stat_inc_seg_type(sbi, curseg) do { } while (0) #define stat_inc_block_count(sbi, curseg) do { } while (0) @@ -4404,8 +4382,7 @@ static inline bool f2fs_lfs_mode(struct f2fs_sb_info = *sbi) static inline bool f2fs_may_compress(struct inode *inode) { if (IS_SWAPFILE(inode) || f2fs_is_pinned_file(inode) || - f2fs_is_atomic_file(inode) || - f2fs_is_volatile_file(inode)) + f2fs_is_atomic_file(inode)) return false; return S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode); } diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 9b04a7a0a368..ab344d5f9b82 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1818,13 +1818,6 @@ static int f2fs_release_file(struct inode *inode, st= ruct file *filp) =20 if (f2fs_is_atomic_file(inode)) f2fs_abort_atomic_write(inode, true); - if (f2fs_is_volatile_file(inode)) { - set_inode_flag(inode, FI_DROP_CACHE); - filemap_fdatawrite(inode->i_mapping); - clear_inode_flag(inode, FI_DROP_CACHE); - clear_inode_flag(inode, FI_VOLATILE_FILE); - stat_dec_volatile_write(inode); - } return 0; } =20 @@ -2099,15 +2092,10 @@ static int f2fs_ioc_commit_atomic_write(struct file= *filp) =20 inode_lock(inode); =20 - if (f2fs_is_volatile_file(inode)) { - ret =3D -EINVAL; - goto err_out; - } - if (f2fs_is_atomic_file(inode)) { ret =3D f2fs_commit_atomic_write(inode); if (ret) - goto err_out; + goto unlock_out; =20 ret =3D f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true); if (!ret) @@ -2115,108 +2103,12 @@ static int f2fs_ioc_commit_atomic_write(struct fil= e *filp) } else { ret =3D f2fs_do_sync_file(filp, 0, LLONG_MAX, 1, false); } -err_out: +unlock_out: inode_unlock(inode); mnt_drop_write_file(filp); return ret; } =20 -static int f2fs_ioc_start_volatile_write(struct file *filp) -{ - struct inode *inode =3D file_inode(filp); - struct user_namespace *mnt_userns =3D file_mnt_user_ns(filp); - int ret; - - if (!inode_owner_or_capable(mnt_userns, inode)) - return -EACCES; - - if (!S_ISREG(inode->i_mode)) - return -EINVAL; - - ret =3D mnt_want_write_file(filp); - if (ret) - return ret; - - inode_lock(inode); - - if (f2fs_is_volatile_file(inode)) - goto out; - - ret =3D f2fs_convert_inline_inode(inode); - if (ret) - goto out; - - stat_inc_volatile_write(inode); - stat_update_max_volatile_write(inode); - - set_inode_flag(inode, FI_VOLATILE_FILE); - f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); -out: - inode_unlock(inode); - mnt_drop_write_file(filp); - return ret; -} - -static int f2fs_ioc_release_volatile_write(struct file *filp) -{ - struct inode *inode =3D file_inode(filp); - struct user_namespace *mnt_userns =3D file_mnt_user_ns(filp); - int ret; - - if (!inode_owner_or_capable(mnt_userns, inode)) - return -EACCES; - - ret =3D mnt_want_write_file(filp); - if (ret) - return ret; - - inode_lock(inode); - - if (!f2fs_is_volatile_file(inode)) - goto out; - - if (!f2fs_is_first_block_written(inode)) { - ret =3D truncate_partial_data_page(inode, 0, true); - goto out; - } - - ret =3D punch_hole(inode, 0, F2FS_BLKSIZE); -out: - inode_unlock(inode); - mnt_drop_write_file(filp); - return ret; -} - -static int f2fs_ioc_abort_volatile_write(struct file *filp) -{ - struct inode *inode =3D file_inode(filp); - struct user_namespace *mnt_userns =3D file_mnt_user_ns(filp); - int ret; - - if (!inode_owner_or_capable(mnt_userns, inode)) - return -EACCES; - - ret =3D mnt_want_write_file(filp); - if (ret) - return ret; - - inode_lock(inode); - - if (f2fs_is_atomic_file(inode)) - f2fs_abort_atomic_write(inode, true); - if (f2fs_is_volatile_file(inode)) { - clear_inode_flag(inode, FI_VOLATILE_FILE); - stat_dec_volatile_write(inode); - ret =3D f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true); - } - - inode_unlock(inode); - - mnt_drop_write_file(filp); - f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); - return ret; -} - static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) { struct inode *inode =3D file_inode(filp); @@ -4155,11 +4047,9 @@ static long __f2fs_ioctl(struct file *filp, unsigned= int cmd, unsigned long arg) case F2FS_IOC_COMMIT_ATOMIC_WRITE: return f2fs_ioc_commit_atomic_write(filp); case F2FS_IOC_START_VOLATILE_WRITE: - return f2fs_ioc_start_volatile_write(filp); case F2FS_IOC_RELEASE_VOLATILE_WRITE: - return f2fs_ioc_release_volatile_write(filp); case F2FS_IOC_ABORT_VOLATILE_WRITE: - return f2fs_ioc_abort_volatile_write(filp); + return -EOPNOTSUPP; case F2FS_IOC_SHUTDOWN: return f2fs_ioc_shutdown(filp, arg); case FITRIM: diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 86a3c5a5a564..4115c6568e48 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -3167,8 +3167,7 @@ static int __get_segment_type_6(struct f2fs_io_info *= fio) return CURSEG_COLD_DATA; if (file_is_hot(inode) || is_inode_flag_set(inode, FI_HOT_DATA) || - f2fs_is_atomic_file(inode) || - f2fs_is_volatile_file(inode)) + f2fs_is_atomic_file(inode)) return CURSEG_HOT_DATA; return f2fs_rw_hint_to_seg_type(inode->i_write_hint); } else { diff --git a/fs/f2fs/verity.c b/fs/f2fs/verity.c index 3d793202cc9f..5ac7e756a1bb 100644 --- a/fs/f2fs/verity.c +++ b/fs/f2fs/verity.c @@ -128,7 +128,7 @@ static int f2fs_begin_enable_verity(struct file *filp) if (f2fs_verity_in_progress(inode)) return -EBUSY; =20 - if (f2fs_is_atomic_file(inode) || f2fs_is_volatile_file(inode)) + if (f2fs_is_atomic_file(inode)) return -EOPNOTSUPP; =20 /* --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF659C25B08 for ; Mon, 15 Aug 2022 22:58:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244887AbiHOW6g (ORCPT ); Mon, 15 Aug 2022 18:58:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352688AbiHOW4g (ORCPT ); Mon, 15 Aug 2022 18:56:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ACF145F57; Mon, 15 Aug 2022 12:55:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 11F2DB8113E; Mon, 15 Aug 2022 19:55:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 657F6C433D6; Mon, 15 Aug 2022 19:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593350; bh=orIIS7BYb3VLHuYePj/5e3TmpzqFAIGk++ZHHXrEeps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sC3YceNFatU5B/6zfKu1IYR8UWZQ7WNuUaTrhk9pbJTjFiKx+cPFqFGOZeyJlOhTA fYPXHJRyvnANogN7MniJKi7qd8ZpP0FNCAvWny3uNQqcwOYz2qmfT0pG5yuHw3IVrH nvQ2KPkk+MFVH5hA7lYmY7s/UltycpuySRJcjDMU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.18 0933/1095] f2fs: fix to check inline_data during compressed inode conversion Date: Mon, 15 Aug 2022 20:05:32 +0200 Message-Id: <20220815180507.819193313@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chao Yu [ Upstream commit 7165841d578e0592848e09dc9d131aa30be44e1b ] When converting inode to compressed one via ioctl, it needs to check inline_data, since inline_data flag and compressed flag are incompatible. Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/f2fs/f2fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index ce8f496a7e5d..3f8a3d63a971 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -4382,7 +4382,7 @@ static inline bool f2fs_lfs_mode(struct f2fs_sb_info = *sbi) static inline bool f2fs_may_compress(struct inode *inode) { if (IS_SWAPFILE(inode) || f2fs_is_pinned_file(inode) || - f2fs_is_atomic_file(inode)) + f2fs_is_atomic_file(inode) || f2fs_has_inline_data(inode)) return false; return S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode); } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30441C00140 for ; Mon, 15 Aug 2022 22:58:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352521AbiHOW6m (ORCPT ); Mon, 15 Aug 2022 18:58:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352708AbiHOW4i (ORCPT ); Mon, 15 Aug 2022 18:56:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 121DE46DBE; Mon, 15 Aug 2022 12:55:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 51D64B81142; Mon, 15 Aug 2022 19:55:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99A9CC433C1; Mon, 15 Aug 2022 19:55:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593357; bh=f0q2yyCScM3El/XPzBMiJUBWiLD23cRMwvIJWRDaL5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K+R0BFplVVMUQ3GJzuSEvbPrDWfw4RTDYdC6a0NbhioZeEmwW23XiRKRDriJHuVm2 bWmlh7PF+FfVJUeN3dqkJvJrVS45whY1xccLkANzLGkc6FSFb9oa4RAfkuLD54P7Jl +lc3tKYqb1tZYFVn75gQC/o+T7+gGvAdQkksBYOg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Chao Liu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.18 0934/1095] f2fs: fix to remove F2FS_COMPR_FL and tag F2FS_NOCOMP_FL at the same time Date: Mon, 15 Aug 2022 20:05:33 +0200 Message-Id: <20220815180507.853329901@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chao Liu [ Upstream commit 8ee236dcaa690d09ca612622e8bc8d09c302021d ] If the inode has the compress flag, it will fail to use 'chattr -c +m' to remove its compress flag and tag no compress flag. However, the same command will be successful when executed again, as shown below: $ touch foo.txt $ chattr +c foo.txt $ chattr -c +m foo.txt chattr: Invalid argument while setting flags on foo.txt $ chattr -c +m foo.txt $ f2fs_io getflags foo.txt get a flag on foo.txt ret=3D0, flags=3Dnocompression,inline_data Fix this by removing some checks in f2fs_setflags_common() that do not affect the original logic. I go through all the possible scenarios, and the results are as follows. Bold is the only thing that has changed. +---------------+-----------+-----------+----------+ | | file flags | + command +-----------+-----------+----------+ | | no flag | compr | nocompr | +---------------+-----------+-----------+----------+ | chattr +c | compr | compr | -EINVAL | | chattr -c | no flag | no flag | nocompr | | chattr +m | nocompr | -EINVAL | nocompr | | chattr -m | no flag | compr | no flag | | chattr +c +m | -EINVAL | -EINVAL | -EINVAL | | chattr +c -m | compr | compr | compr | | chattr -c +m | nocompr | *nocompr* | nocompr | | chattr -c -m | no flag | no flag | no flag | +---------------+-----------+-----------+----------+ Link: https://lore.kernel.org/linux-f2fs-devel/20220621064833.1079383-1-cha= oliu719@gmail.com/ Fixes: 4c8ff7095bef ("f2fs: support data compression") Reviewed-by: Chao Yu Signed-off-by: Chao Liu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/f2fs/file.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index ab344d5f9b82..863518695ea6 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1867,10 +1867,7 @@ static int f2fs_setflags_common(struct inode *inode,= u32 iflags, u32 mask) if (masked_flags & F2FS_COMPR_FL) { if (!f2fs_disable_compressed_file(inode)) return -EINVAL; - } - if (iflags & F2FS_NOCOMP_FL) - return -EINVAL; - if (iflags & F2FS_COMPR_FL) { + } else { if (!f2fs_may_compress(inode)) return -EINVAL; if (S_ISREG(inode->i_mode) && inode->i_size) @@ -1879,10 +1876,6 @@ static int f2fs_setflags_common(struct inode *inode,= u32 iflags, u32 mask) set_compress_context(inode); } } - if ((iflags ^ masked_flags) & F2FS_NOCOMP_FL) { - if (masked_flags & F2FS_COMPR_FL) - return -EINVAL; - } =20 fi->i_flags =3D iflags | (fi->i_flags & ~mask); f2fs_bug_on(F2FS_I_SB(inode), (fi->i_flags & F2FS_COMPR_FL) && --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FEE1C25B0D for ; Mon, 15 Aug 2022 22:59:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245449AbiHOW7C (ORCPT ); Mon, 15 Aug 2022 18:59:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352778AbiHOW44 (ORCPT ); Mon, 15 Aug 2022 18:56:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F0E945F62; Mon, 15 Aug 2022 12:56:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 55DE0B80EB1; Mon, 15 Aug 2022 19:56:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F696C433D6; Mon, 15 Aug 2022 19:56:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593363; bh=RZkPGZ2e1SCCI60hBb5F8OR1n6Td6wIz5Aoc5W4Umt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wZs76aDAWLNk5iB6fHXAPGzYIl5V1oYj2s0tsFrIl45XfouzeFZyAvOpxVDl/QFGe Im0MXRIhWanwgLqudprswmt+HF/I+125xAobp8KSeBFIixLZFRRZKKhdArXKg1b+JW obyTExyqIIatmEOZxHbeceUOoz3FHoqQMw+rhbmc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Jeff Layton , "Matthew Wilcox (Oracle)" , Steve French , Sasha Levin Subject: [PATCH 5.18 0935/1095] cifs: Fix memory leak when using fscache Date: Mon, 15 Aug 2022 20:05:34 +0200 Message-Id: <20220815180507.891590000@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Matthew Wilcox (Oracle) [ Upstream commit c6f62f81b488d00afaa86bae26c6ce9ab12c709e ] If we hit the 'index =3D=3D next_cached' case, we leak a refcount on the struct page. Fix this by using readahead_folio() which takes care of the refcount for you. Fixes: 0174ee9947bd ("cifs: Implement cache I/O by accessing the cache dire= ctly") Cc: David Howells Cc: Jeff Layton Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/cifs/file.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 58dce567ceaf..3d475f1847a4 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -4456,10 +4456,10 @@ static void cifs_readahead(struct readahead_control= *ractl) * TODO: Send a whole batch of pages to be read * by the cache. */ - page =3D readahead_page(ractl); - last_batch_size =3D 1 << thp_order(page); + struct folio *folio =3D readahead_folio(ractl); + last_batch_size =3D folio_nr_pages(folio); if (cifs_readpage_from_fscache(ractl->mapping->host, - page) < 0) { + &folio->page) < 0) { /* * TODO: Deal with cache read failure * here, but for the moment, delegate @@ -4467,7 +4467,7 @@ static void cifs_readahead(struct readahead_control *= ractl) */ caching =3D false; } - unlock_page(page); + folio_unlock(folio); next_cached++; cache_nr_pages--; if (cache_nr_pages =3D=3D 0) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E4E7C25B0D for ; Mon, 15 Aug 2022 22:59:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347762AbiHOW7U (ORCPT ); Mon, 15 Aug 2022 18:59:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352271AbiHOW5R (ORCPT ); Mon, 15 Aug 2022 18:57:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1121F62AA8; Mon, 15 Aug 2022 12:56:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7AF14B80EB1; Mon, 15 Aug 2022 19:56:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9C57C433D6; Mon, 15 Aug 2022 19:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593369; bh=FDoJxHlFo7cH3ku55qhsLbAub7KyWpXjqOlGy/VtYmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HbBnyhCqOXid8+c+rm0h8EGRVhRkNNuqqwoqmoARpHOVK9X94idFgx1ICD/wPBU+s d2czrHSD2oyUyMxlqNYexQqT84SmUjBQaQs6XMOXJd7XmphSfcoLJo1Gy1Y1CX4tRa Pqrs2YLMWHGepRRJSFDoAUbIOruGaaVY3Ay6Kgq8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Arnd Bergmann , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0936/1095] powerpc/spufs: Fix refcount leak in spufs_init_isolated_loader Date: Mon, 15 Aug 2022 20:05:35 +0200 Message-Id: <20220815180507.938063912@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 6ac059dacffa8ab2f7798f20e4bd3333890c541c ] of_find_node_by_path() returns remote device nodepointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes: 0afacde3df4c ("[POWERPC] spufs: allow isolated mode apps by starting= the SPE loader") Signed-off-by: Miaoqian Lin Acked-by: Arnd Bergmann Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220603121543.22884-1-linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/platforms/cell/spufs/inode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platf= orms/cell/spufs/inode.c index 4c702192412f..96f5e2e43018 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c @@ -660,6 +660,7 @@ spufs_init_isolated_loader(void) return; =20 loader =3D of_get_property(dn, "loader", &size); + of_node_put(dn); if (!loader) return; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FAAFC25B08 for ; Mon, 15 Aug 2022 22:59:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245226AbiHOW7k (ORCPT ); Mon, 15 Aug 2022 18:59:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244346AbiHOW6C (ORCPT ); Mon, 15 Aug 2022 18:58:02 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CF73696EE; Mon, 15 Aug 2022 12:56:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id B4483CE12C3; Mon, 15 Aug 2022 19:56:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3899C433D6; Mon, 15 Aug 2022 19:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593379; bh=An8D4+n6Jwfwj91yuPxd1/4FqbUNxpmahaeImPslgKM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VOMkSoXnxPkU16uJuio/Yx/9NzX/3HhNHtyIbErzeEcKNAeQ60b1DSiWri91atBoa xfv42pgg9a7vFnmt6nyTN+i7+JoymJwiV/NhjHhRk4QZ999sGU4HLcXszDLbCSU8gO qGfZtx5vCc1M5ofGYshtl2WAoX6wWfbKXzH5Vabg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0937/1095] powerpc/xive: Fix refcount leak in xive_get_max_prio Date: Mon, 15 Aug 2022 20:05:36 +0200 Message-Id: <20220815180507.977193732@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 255b650cbec6849443ce2e0cdd187fd5e61c218c ] of_find_node_by_path() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes: eac1e731b59e ("powerpc/xive: guest exploitation of the XIVE interrup= t controller") Signed-off-by: Miaoqian Lin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220605053225.56125-1-linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/sysdev/xive/spapr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/sysdev/xive/spapr.c b/arch/powerpc/sysdev/xive/sp= apr.c index b0d36e430dbc..013446f5cdbb 100644 --- a/arch/powerpc/sysdev/xive/spapr.c +++ b/arch/powerpc/sysdev/xive/spapr.c @@ -716,6 +716,7 @@ static bool __init xive_get_max_prio(u8 *max_prio) } =20 reg =3D of_get_property(rootdn, "ibm,plat-res-int-priorities", &len); + of_node_put(rootdn); if (!reg) { pr_err("Failed to read 'ibm,plat-res-int-priorities' property\n"); return false; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B54BC00140 for ; Mon, 15 Aug 2022 23:00:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347093AbiHOW77 (ORCPT ); Mon, 15 Aug 2022 18:59:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352461AbiHOW6c (ORCPT ); Mon, 15 Aug 2022 18:58:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A06375FD5; Mon, 15 Aug 2022 12:56:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A797A60FB5; Mon, 15 Aug 2022 19:56:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0C1DC433C1; Mon, 15 Aug 2022 19:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593385; bh=vep4ycP0V4FffTk9DpsuDGT1Dir7m6EzFiRNUMoPxTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fUReZ50fiPmC1gCxID0zB83rzO26n2gKST/b2h02IU5i+VWSZ7xuEw+EH1jl6d5mx 7Tf8F+9SBQQOMAd5pf5j3ApxL3Iw0gQ3DRqBMRjFI4AbmtJ1eZsbctodkebw4pJ+WV 4WkYqEkb3rWoBPNNcOZRL6ewKfUo4Q4K9r4D2btw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0938/1095] powerpc/cell/axon_msi: Fix refcount leak in setup_msi_msg_address Date: Mon, 15 Aug 2022 20:05:37 +0200 Message-Id: <20220815180508.011278501@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit df5d4b616ee76abc97e5bd348e22659c2b095b1c ] of_get_next_parent() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() in the error path to avoid refcount leak. Fixes: ce21b3c9648a ("[CELL] add support for MSI on Axon-based Cell systems= ") Signed-off-by: Miaoqian Lin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220605065129.63906-1-linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/platforms/cell/axon_msi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platform= s/cell/axon_msi.c index 354a58c1e6f2..dba34f4d5162 100644 --- a/arch/powerpc/platforms/cell/axon_msi.c +++ b/arch/powerpc/platforms/cell/axon_msi.c @@ -223,6 +223,7 @@ static int setup_msi_msg_address(struct pci_dev *dev, s= truct msi_msg *msg) if (!prop) { dev_dbg(&dev->dev, "axon_msi: no msi-address-(32|64) properties found\n"); + of_node_put(dn); return -ENOENT; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1C0EC00140 for ; Mon, 15 Aug 2022 23:00:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352584AbiHOXAX (ORCPT ); Mon, 15 Aug 2022 19:00:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346663AbiHOW6d (ORCPT ); Mon, 15 Aug 2022 18:58:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49C2F760C0; Mon, 15 Aug 2022 12:56:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6549AB80EAD; Mon, 15 Aug 2022 19:56:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 975FFC433D6; Mon, 15 Aug 2022 19:56:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593391; bh=wDfmcr8hqpXBUVKskBOJMr0tIJOdTKM3fBqq+O/LQL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wDUCGWni8H85LLNHmdeh8ahoSkzYPlPeZu/15aElcUkw7my7K9CMvIXpu3Ptg6kWK uVjxheY2rDpR8l/J7cNJMryyK+tV1vBxLnq8jkKoClC1h91/LYInkIwS88WgUrRcpn b3bdmpYsMn3YPwKQRHx6njbuRfjHV5GSvXv8I/XE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leo Yan , Ian Rogers , Alexander Shishkin , Jiri Olsa , Mark Rutland , Namhyung Kim , Peter Zijlstra , Stephane Eranian , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.18 0939/1095] perf symbol: Fail to read phdr workaround Date: Mon, 15 Aug 2022 20:05:38 +0200 Message-Id: <20220815180508.040651404@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ian Rogers [ Upstream commit 6d518ac7be6223811ab947897273b1bbef846180 ] The perf jvmti agent doesn't create program headers, in this case fallback on section headers as happened previously. Committer notes: To test this, from a public post by Ian: 1) download a Java workload dacapo-9.12-MR1-bach.jar from https://sourceforge.net/projects/dacapobench/ 2) build perf such as "make -C tools/perf O=3D/tmp/perf NO_LIBBFD=3D1" it should detect Java and create /tmp/perf/libperf-jvmti.so 3) run perf with the jvmti agent: perf record -k 1 java -agentpath:/tmp/perf/libperf-jvmti.so -jar dacapo-9= .12-MR1-bach.jar -n 10 fop 4) run perf inject: perf inject -i perf.data -o perf-injected.data -j 5) run perf report perf report -i perf-injected.data | grep org.apache.fop With this patch reverted I see lots of symbols like: 0.00% java jitted-388040-4656.so [.] org.apache.fop.fo.F= Obj.bind(org.apache.fop.fo.PropertyList) With the patch (2d86612aacb7805f ("perf symbol: Correct address for bss symbols")) I see lots of: dso__load_sym_internal: failed to find program header for symbol: Lorg/apache/fop/fo/FObj;bind(Lorg/apache/fop/fo/PropertyList;)V st_value: 0x40 Fixes: 2d86612aacb7805f ("perf symbol: Correct address for bss symbols") Reviewed-by: Leo Yan Signed-off-by: Ian Rogers Tested-by: Leo Yan Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Leo Yan Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lore.kernel.org/lkml/20220731164923.691193-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/perf/util/symbol-elf.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index ef6ced5c5746..cb7b24493782 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -1294,16 +1294,29 @@ dso__load_sym_internal(struct dso *dso, struct map = *map, struct symsrc *syms_ss, =20 if (elf_read_program_header(syms_ss->elf, (u64)sym.st_value, &phdr)) { - pr_warning("%s: failed to find program header for " + pr_debug4("%s: failed to find program header for " "symbol: %s st_value: %#" PRIx64 "\n", __func__, elf_name, (u64)sym.st_value); - continue; + pr_debug4("%s: adjusting symbol: st_value: %#" PRIx64 " " + "sh_addr: %#" PRIx64 " sh_offset: %#" PRIx64 "\n", + __func__, (u64)sym.st_value, (u64)shdr.sh_addr, + (u64)shdr.sh_offset); + /* + * Fail to find program header, let's rollback + * to use shdr.sh_addr and shdr.sh_offset to + * calibrate symbol's file address, though this + * is not necessary for normal C ELF file, we + * still need to handle java JIT symbols in this + * case. + */ + sym.st_value -=3D shdr.sh_addr - shdr.sh_offset; + } else { + pr_debug4("%s: adjusting symbol: st_value: %#" PRIx64 " " + "p_vaddr: %#" PRIx64 " p_offset: %#" PRIx64 "\n", + __func__, (u64)sym.st_value, (u64)phdr.p_vaddr, + (u64)phdr.p_offset); + sym.st_value -=3D phdr.p_vaddr - phdr.p_offset; } - pr_debug4("%s: adjusting symbol: st_value: %#" PRIx64 " " - "p_vaddr: %#" PRIx64 " p_offset: %#" PRIx64 "\n", - __func__, (u64)sym.st_value, (u64)phdr.p_vaddr, - (u64)phdr.p_offset); - sym.st_value -=3D phdr.p_vaddr - phdr.p_offset; } =20 demangled =3D demangle_sym(dso, kmodule, elf_name); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4EDBC00140 for ; Mon, 15 Aug 2022 23:01:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352591AbiHOXAi (ORCPT ); Mon, 15 Aug 2022 19:00:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352494AbiHOW6f (ORCPT ); Mon, 15 Aug 2022 18:58:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F943DD767; Mon, 15 Aug 2022 12:56:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E5072B80EAB; Mon, 15 Aug 2022 19:56:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28401C433C1; Mon, 15 Aug 2022 19:56:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593397; bh=6rswtPHCBmofH9wCL2FhhYPwRwY21gb1uDolVJabZu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tMJKpSEwlIK2eaHssS2eSxH0p5tmGbdudZReGqqt8sAn0kC3G6wm9vZOz5h2HbaTi jUuE5f3gSAQaoc+wAmOjKr6256+wFPG68l9A8Iw2bcqXNR8w59+STt0suwn93B8RMQ Rf8EYISYIjX1uTEGeaAX4dr5dIzaifhYG7uNXCl8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Zhongjin , Ingo Molnar , "Masami Hiramatsu (Google)" , Sasha Levin Subject: [PATCH 5.18 0940/1095] kprobes: Forbid probing on trampoline and BPF code areas Date: Mon, 15 Aug 2022 20:05:39 +0200 Message-Id: <20220815180508.075719763@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chen Zhongjin [ Upstream commit 28f6c37a2910f565b4f5960df52b2eccae28c891 ] kernel_text_address() treats ftrace_trampoline, kprobe_insn_slot and bpf_text_address as valid kprobe addresses - which is not ideal. These text areas are removable and changeable without any notification to kprobes, and probing on them can trigger unexpected behavior: https://lkml.org/lkml/2022/7/26/1148 Considering that jump_label and static_call text are already forbiden to probe, kernel_text_address() should be replaced with core_kernel_text() and is_module_text_address() to check other text areas which are unsafe to kprobe. [ mingo: Rewrote the changelog. ] Fixes: 5b485629ba0d ("kprobes, extable: Identify kprobes trampolines as ker= nel text area") Fixes: 74451e66d516 ("bpf: make jited programs visible in traces") Signed-off-by: Chen Zhongjin Signed-off-by: Ingo Molnar Acked-by: Masami Hiramatsu (Google) Link: https://lore.kernel.org/r/20220801033719.228248-1-chenzhongjin@huawei= .com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/kprobes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index f214f8c088ed..80697e5e03e4 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -1560,7 +1560,8 @@ static int check_kprobe_address_safe(struct kprobe *p, preempt_disable(); =20 /* Ensure it is not in reserved area nor out of text */ - if (!kernel_text_address((unsigned long) p->addr) || + if (!(core_kernel_text((unsigned long) p->addr) || + is_module_text_address((unsigned long) p->addr)) || within_kprobe_blacklist((unsigned long) p->addr) || jump_label_text_reserved(p->addr, p->addr) || static_call_text_reserved(p->addr, p->addr) || --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFF36C48BE4 for ; Mon, 15 Aug 2022 23:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352898AbiHOXBY (ORCPT ); Mon, 15 Aug 2022 19:01:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352509AbiHOW6f (ORCPT ); Mon, 15 Aug 2022 18:58:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50F2331DEA; Mon, 15 Aug 2022 12:56:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 05894B80EAD; Mon, 15 Aug 2022 19:56:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B798C433C1; Mon, 15 Aug 2022 19:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593403; bh=RbdrB2ItTg/BQanc9oDqPCLEHobXmx1sahtu8v1k7UQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FLqHZHHPxTeCGzssG6wpTUtDFqdR5EwSb8O2LYRZvahfyRoefvomaI9GfkYf6u8s4 yyAYZNApvA3dIf+hE7yz5XhfnIQsWspSeTtA/DDgtYuYPhPO4nVBbIjGXpMz5sQR8q eD0NBoaOYTr1kzBhDcTiYxxHOAogDJm/difcno0s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chenyi Qiang , Ingo Molnar , Tony Luck , Sasha Levin Subject: [PATCH 5.18 0941/1095] x86/bus_lock: Dont assume the init value of DEBUGCTLMSR.BUS_LOCK_DETECT to be zero Date: Mon, 15 Aug 2022 20:05:40 +0200 Message-Id: <20220815180508.118332691@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chenyi Qiang [ Upstream commit ffa6482e461ff550325356ae705b79e256702ea9 ] It's possible that this kernel has been kexec'd from a kernel that enabled bus lock detection, or (hypothetically) BIOS/firmware has set DEBUGCTLMSR_BUS_LOCK_DETECT. Disable bus lock detection explicitly if not wanted. Fixes: ebb1064e7c2e ("x86/traps: Handle #DB for bus lock") Signed-off-by: Chenyi Qiang Signed-off-by: Ingo Molnar Reviewed-by: Tony Luck Link: https://lore.kernel.org/r/20220802033206.21333-1-chenyi.qiang@intel.c= om Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kernel/cpu/intel.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 2c87d62f191e..ae7d4c85f4f4 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c @@ -1145,22 +1145,23 @@ static void bus_lock_init(void) { u64 val; =20 - /* - * Warn and fatal are handled by #AC for split lock if #AC for - * split lock is supported. - */ - if (!boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT) || - (boot_cpu_has(X86_FEATURE_SPLIT_LOCK_DETECT) && - (sld_state =3D=3D sld_warn || sld_state =3D=3D sld_fatal)) || - sld_state =3D=3D sld_off) + if (!boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT)) return; =20 - /* - * Enable #DB for bus lock. All bus locks are handled in #DB except - * split locks are handled in #AC in the fatal case. - */ rdmsrl(MSR_IA32_DEBUGCTLMSR, val); - val |=3D DEBUGCTLMSR_BUS_LOCK_DETECT; + + if ((boot_cpu_has(X86_FEATURE_SPLIT_LOCK_DETECT) && + (sld_state =3D=3D sld_warn || sld_state =3D=3D sld_fatal)) || + sld_state =3D=3D sld_off) { + /* + * Warn and fatal are handled by #AC for split lock if #AC for + * split lock is supported. + */ + val &=3D ~DEBUGCTLMSR_BUS_LOCK_DETECT; + } else { + val |=3D DEBUGCTLMSR_BUS_LOCK_DETECT; + } + wrmsrl(MSR_IA32_DEBUGCTLMSR, val); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F378C00140 for ; Mon, 15 Aug 2022 23:01:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352978AbiHOXBr (ORCPT ); Mon, 15 Aug 2022 19:01:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352507AbiHOW6f (ORCPT ); Mon, 15 Aug 2022 18:58:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C10C2753A7; Mon, 15 Aug 2022 12:56:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 60F536068D; Mon, 15 Aug 2022 19:56:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FC11C433C1; Mon, 15 Aug 2022 19:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593412; bh=KmOHx/U+CI3H4Ml+/HVt3af5XMOhhlGluF+L0ZQQOOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2pCp8FMGK/MeI4LJ4M1prcGB5FVBs5X2WPwssmxJfV2hhHWtvMgY8ZATvBjjntzLu Rz9o+F6pYqqso+UgOhpTd+wmvugBKyiDOyHW8xcsGOzgj3IR6G7L6rMe9X9hD0rxrD U7+uZ9MD63dEdGLIZY6B6ikc7qCG3OgxcdKMBSgU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0942/1095] powerpc/pci: Fix PHB numbering when using opal-phbid Date: Mon, 15 Aug 2022 20:05:41 +0200 Message-Id: <20220815180508.152502580@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Ellerman [ Upstream commit f4b39e88b42d13366b831270306326b5c20971ca ] The recent change to the PHB numbering logic has a logic error in the handling of "ibm,opal-phbid". When an "ibm,opal-phbid" property is present, &prop is written to and ret is set to zero. The following call to of_alias_get_id() is skipped because ret =3D=3D 0. But then the if (ret >=3D 0) is true, and the body of that if statement sets prop =3D ret which throws away the value that was just read from "ibm,opal-phbid". Fix the logic by only doing the ret >=3D 0 check in the of_alias_get_id() case. Fixes: 0fe1e96fef0a ("powerpc/pci: Prefer PCI domain assignment via DT 'lin= ux,pci-domain' and alias") Reviewed-by: Pali Roh=C3=A1r Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220802105723.1055178-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/kernel/pci-common.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-com= mon.c index 7daa00f3942e..aa37faeb80ee 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -90,11 +90,13 @@ static int get_phb_number(struct device_node *dn) } if (ret) ret =3D of_property_read_u64(dn, "ibm,opal-phbid", &prop); - if (ret) + + if (ret) { ret =3D of_alias_get_id(dn, "pci"); - if (ret >=3D 0) { - prop =3D ret; - ret =3D 0; + if (ret >=3D 0) { + prop =3D ret; + ret =3D 0; + } } if (ret) { u32 prop_32; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABA74C2BB41 for ; Mon, 15 Aug 2022 23:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352845AbiHOXBQ (ORCPT ); Mon, 15 Aug 2022 19:01:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344550AbiHOW6h (ORCPT ); Mon, 15 Aug 2022 18:58:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B758422D9; Mon, 15 Aug 2022 12:57:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0C8F1B80EAD; Mon, 15 Aug 2022 19:57:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44AA1C433C1; Mon, 15 Aug 2022 19:56:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593418; bh=e25EplunFs+xhOssElaZHcLWfqW4P+ZY5UR2hRo+Ob0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OThCGE48TG2ltrbitrGnORhov2UuqBJXpBHG4moL6w4rA/mWGrbwffRzXSEgT5qW7 6i+uVIqMtSigrtesPUH+UJ/dD+w7KlWuES/CmdjB7nuUuI3KPv8qctimazlUUuIfJu PqdrH0Lf/UuusZn6PZAWbHQPO6HTVvmqkeIKo9jQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?=E8=B0=AD=E6=A2=93=E7=85=8A?= , Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Jiri Olsa , John Fastabend , KP Singh , Martin KaFai Lau , Nick Terrell , Song Liu , Stephane Eranian , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.18 0943/1095] genelf: Use HAVE_LIBCRYPTO_SUPPORT, not the never defined HAVE_LIBCRYPTO Date: Mon, 15 Aug 2022 20:05:42 +0200 Message-Id: <20220815180508.184132690@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo [ Upstream commit 91cea6be90e436c55cde8770a15e4dac9d3032d0 ] When genelf was introduced it tested for HAVE_LIBCRYPTO not HAVE_LIBCRYPTO_SUPPORT, which is the define the feature test for openssl defines, fix it. This also adds disables the deprecation warning, someone has to fix this to build with openssl 3.0 before the warning becomes a hard error. Fixes: 9b07e27f88b9cd78 ("perf inject: Add jitdump mmap injection support") Reported-by: =E8=B0=AD=E6=A2=93=E7=85=8A Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Daniel Borkmann Cc: Jiri Olsa Cc: John Fastabend Cc: KP Singh Cc: Martin KaFai Lau Cc: Nick Terrell Cc: Song Liu Cc: Stephane Eranian Link: http://lore.kernel.org/lkml/YulpPqXSOG0Q4J1o@kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/perf/util/genelf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/genelf.c b/tools/perf/util/genelf.c index aed49806a09b..953338b9e887 100644 --- a/tools/perf/util/genelf.c +++ b/tools/perf/util/genelf.c @@ -30,7 +30,11 @@ =20 #define BUILD_ID_URANDOM /* different uuid for each run */ =20 -#ifdef HAVE_LIBCRYPTO +// FIXME, remove this and fix the deprecation warnings before its removed = and +// We'll break for good here... +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#ifdef HAVE_LIBCRYPTO_SUPPORT =20 #define BUILD_ID_MD5 #undef BUILD_ID_SHA /* does not seem to work well when linked with Java */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AC4FC25B08 for ; Mon, 15 Aug 2022 23:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233610AbiHOXAq (ORCPT ); Mon, 15 Aug 2022 19:00:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245438AbiHOW6x (ORCPT ); Mon, 15 Aug 2022 18:58:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE75E46DAA; Mon, 15 Aug 2022 12:57:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7BD76612A4; Mon, 15 Aug 2022 19:57:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 699F3C433C1; Mon, 15 Aug 2022 19:57:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593424; bh=Mt7AGGcZfiDtZCpqwjCJ+SIH9BMtPjFp1JhQA7qDVTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VqZvtZgDelkAtKmEH9wBRNm6W4CETkCeK06SIhKwARIlBuHPUHadGTn4xcICdoG41 nVpU3YmPjdKQQRNQ/3m0LjBUq+X8O+mOk1WR9ZI0y+IK2E6OoAH/Jp+EuiiVcrAh6P mzaPJ/HMZA7SB5yY4QVM58brT9rDp5SP5n6gXIGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , Josh Poimboeuf , Ingo Molnar , Sasha Levin Subject: [PATCH 5.18 0944/1095] scripts/faddr2line: Fix vmlinux detection on arm64 Date: Mon, 15 Aug 2022 20:05:43 +0200 Message-Id: <20220815180508.218799444@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Josh Poimboeuf [ Upstream commit b6a5068854cfe372da7dee3224dcf023ed5b00cb ] Since commit dcea997beed6 ("faddr2line: Fix overlapping text section failures, the sequel"), faddr2line is completely broken on arm64. For some reason, on arm64, the vmlinux ELF object file type is ET_DYN rather than ET_EXEC. Check for both when determining whether the object is vmlinux. Modules and vmlinux.o have type ET_REL on all arches. Fixes: dcea997beed6 ("faddr2line: Fix overlapping text section failures, th= e sequel") Reported-by: John Garry Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Tested-by: John Garry Link: https://lore.kernel.org/r/dad1999737471b06d6188ce4cdb11329aa41682c.16= 58426357.git.jpoimboe@kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- scripts/faddr2line | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/faddr2line b/scripts/faddr2line index 94ed98dd899f..57099687e5e1 100755 --- a/scripts/faddr2line +++ b/scripts/faddr2line @@ -112,7 +112,9 @@ __faddr2line() { # section offsets. local file_type=3D$(${READELF} --file-header $objfile | ${AWK} '$1 =3D=3D "Type:" { print $2; exit }') - [[ $file_type =3D "EXEC" ]] && is_vmlinux=3D1 + if [[ $file_type =3D "EXEC" ]] || [[ $file_type =3D=3D "DYN" ]]; then + is_vmlinux=3D1 + fi =20 # Go through each of the object's symbols which match the func name. # In rare cases there might be duplicates, in which case we print all --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67FE4C25B0E for ; Mon, 15 Aug 2022 23:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352780AbiHOXBF (ORCPT ); Mon, 15 Aug 2022 19:01:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352535AbiHOW6x (ORCPT ); Mon, 15 Aug 2022 18:58:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0770474DD; Mon, 15 Aug 2022 12:57:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7E38C6113B; Mon, 15 Aug 2022 19:57:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D98CC433C1; Mon, 15 Aug 2022 19:57:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593430; bh=HkyYOrUZNw75qiukQT9RI/l054amCsbfshAfs8CsLRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fCjE4EVhVL7f/3Hh8TujHuozfA3iAd4Wr6ML7bFjsJVH6QBWrQ6jnNCNuDM86p8Zk Ck9MWNwpHxACMxwy5+CPyrRWl+tvD/JpLfjRMRggyIBPYgNQO43l+q8Gz0dKPO2fuj J7euA8ABUnvHs/i8GqBT7j9aNTh27Kvn7bYZ3IRQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0945/1095] powerpc/64e: Fix kexec build error Date: Mon, 15 Aug 2022 20:05:44 +0200 Message-Id: <20220815180508.249952130@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Ellerman [ Upstream commit 4cfa6ff24a9744ba484521c38bea613134fbfcb3 ] When building ppc64_book3e_allmodconfig the build fails with: arch/powerpc/kexec/file_load_64.c:1063:14: error: implicit declaration of= function =E2=80=98firmware_has_feature=E2=80=99 1063 | if (!firmware_has_feature(FW_FEATURE_LPAR)) | ^~~~~~~~~~~~~~~~~~~~ Add a direct include of asm/firmware.h to fix the error. Fixes: b1fc44eaa9ba ("pseries/iommu/ddw: Fix kdump to work in absence of ib= m,dma-window") Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220803063152.1249270-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/kexec/file_load_64.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_lo= ad_64.c index 5d2c22aa34fb..683462e4556b 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 444B8C3F6B0 for ; Mon, 15 Aug 2022 23:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352735AbiHOXBB (ORCPT ); Mon, 15 Aug 2022 19:01:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346529AbiHOW7F (ORCPT ); Mon, 15 Aug 2022 18:59:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 412AF760ED; Mon, 15 Aug 2022 12:57:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3EB296113B; Mon, 15 Aug 2022 19:57:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 315C5C433D7; Mon, 15 Aug 2022 19:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593437; bh=wKih+8OluzBjXG4I/4G1XVSZt2R5DYaSGbSm9Hjd1ZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FXVQiexnRg2dOsM0sijWwLZiHS8ZnuB5ZuVLUtoXXwn1Lmp0iTocclAQ+ggvVVWTC 34vqkCQ8/XmPcPZoYhvqpBl6hakVfHoqoZaeCcTay7gYxhchOFu3PP1RK79Zw1tsYo QaKBYni/XiKsj+WV7ko4JvfMttQO71SHOcPyCNWU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Waiman Long , Ingo Molnar , Juri Lelli , Sasha Levin Subject: [PATCH 5.18 0946/1095] sched, cpuset: Fix dl_cpu_busy() panic due to empty cs->cpus_allowed Date: Mon, 15 Aug 2022 20:05:45 +0200 Message-Id: <20220815180508.281939119@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Waiman Long [ Upstream commit b6e8d40d43ae4dec00c8fea2593eeea3114b8f44 ] With cgroup v2, the cpuset's cpus_allowed mask can be empty indicating that the cpuset will just use the effective CPUs of its parent. So cpuset_can_attach() can call task_can_attach() with an empty mask. This can lead to cpumask_any_and() returns nr_cpu_ids causing the call to dl_bw_of() to crash due to percpu value access of an out of bound CPU value. For example: [80468.182258] BUG: unable to handle page fault for address: ffffffff8b664= 8b0 : [80468.191019] RIP: 0010:dl_cpu_busy+0x30/0x2b0 : [80468.207946] Call Trace: [80468.208947] cpuset_can_attach+0xa0/0x140 [80468.209953] cgroup_migrate_execute+0x8c/0x490 [80468.210931] cgroup_update_dfl_csses+0x254/0x270 [80468.211898] cgroup_subtree_control_write+0x322/0x400 [80468.212854] kernfs_fop_write_iter+0x11c/0x1b0 [80468.213777] new_sync_write+0x11f/0x1b0 [80468.214689] vfs_write+0x1eb/0x280 [80468.215592] ksys_write+0x5f/0xe0 [80468.216463] do_syscall_64+0x5c/0x80 [80468.224287] entry_SYSCALL_64_after_hwframe+0x44/0xae Fix that by using effective_cpus instead. For cgroup v1, effective_cpus is the same as cpus_allowed. For v2, effective_cpus is the real cpumask to be used by tasks within the cpuset anyway. Also update task_can_attach()'s 2nd argument name to cs_effective_cpus to reflect the change. In addition, a check is added to task_can_attach() to guard against the possibility that cpumask_any_and() may return a value >=3D nr_cpu_ids. Fixes: 7f51412a415d ("sched/deadline: Fix bandwidth check/update when migra= ting tasks between exclusive cpusets") Signed-off-by: Waiman Long Signed-off-by: Ingo Molnar Acked-by: Juri Lelli Link: https://lore.kernel.org/r/20220803015451.2219567-1-longman@redhat.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/sched.h | 2 +- kernel/cgroup/cpuset.c | 2 +- kernel/sched/core.c | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index a8911b1f35aa..d438e39fffe5 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1812,7 +1812,7 @@ current_restore_flags(unsigned long orig_flags, unsig= ned long flags) } =20 extern int cpuset_cpumask_can_shrink(const struct cpumask *cur, const stru= ct cpumask *trial); -extern int task_can_attach(struct task_struct *p, const struct cpumask *cs= _cpus_allowed); +extern int task_can_attach(struct task_struct *p, const struct cpumask *cs= _effective_cpus); #ifdef CONFIG_SMP extern void do_set_cpus_allowed(struct task_struct *p, const struct cpumas= k *new_mask); extern int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumas= k *new_mask); diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 71a418858a5e..58aadfda9b8b 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -2239,7 +2239,7 @@ static int cpuset_can_attach(struct cgroup_taskset *t= set) goto out_unlock; =20 cgroup_taskset_for_each(task, css, tset) { - ret =3D task_can_attach(task, cs->cpus_allowed); + ret =3D task_can_attach(task, cs->effective_cpus); if (ret) goto out_unlock; ret =3D security_task_setscheduler(task); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 72b2f277b0dd..b0f3ded147cb 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -8899,7 +8899,7 @@ int cpuset_cpumask_can_shrink(const struct cpumask *c= ur, } =20 int task_can_attach(struct task_struct *p, - const struct cpumask *cs_cpus_allowed) + const struct cpumask *cs_effective_cpus) { int ret =3D 0; =20 @@ -8918,9 +8918,11 @@ int task_can_attach(struct task_struct *p, } =20 if (dl_task(p) && !cpumask_intersects(task_rq(p)->rd->span, - cs_cpus_allowed)) { - int cpu =3D cpumask_any_and(cpu_active_mask, cs_cpus_allowed); + cs_effective_cpus)) { + int cpu =3D cpumask_any_and(cpu_active_mask, cs_effective_cpus); =20 + if (unlikely(cpu >=3D nr_cpu_ids)) + return -EINVAL; ret =3D dl_cpu_busy(cpu, p); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6705C28B2B for ; Mon, 15 Aug 2022 23:02:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233614AbiHOXCC (ORCPT ); Mon, 15 Aug 2022 19:02:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239740AbiHOW7u (ORCPT ); Mon, 15 Aug 2022 18:59:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 680CA76478; Mon, 15 Aug 2022 12:57:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 763D560FD8; Mon, 15 Aug 2022 19:57:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78538C433D7; Mon, 15 Aug 2022 19:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593446; bh=i0Q7KMBwpnuSbMDsMG/RH6Tk1dLZHV3lTCNdlvGU9MU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2na6FJ8FUXhAfXKqiDceHnQZt8x75CPHxSXwDivZRvHIV706KMGIUabFtXWrgwkgV jWSwjMAWoX55TTdukER1G5MU1KuK1TTJuEdYqvoprLWaNKdRzezB3zI94Hn87Vy4BP afd8pJThY6RuV4NmT0HRVuMKhKAGLx4gDxIBPdc8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Siddh Raman Pant , Ingo Molnar , Sasha Levin Subject: [PATCH 5.18 0947/1095] x86/numa: Use cpumask_available instead of hardcoded NULL check Date: Mon, 15 Aug 2022 20:05:46 +0200 Message-Id: <20220815180508.310832026@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Siddh Raman Pant [ Upstream commit 625395c4a0f4775e0fe00f616888d2e6c1ba49db ] GCC-12 started triggering a new warning: arch/x86/mm/numa.c: In function =E2=80=98cpumask_of_node=E2=80=99: arch/x86/mm/numa.c:916:39: warning: the comparison will always evaluate a= s =E2=80=98false=E2=80=99 for the address of =E2=80=98node_to_cpumask_map= =E2=80=99 will never be NULL [-Waddress] 916 | if (node_to_cpumask_map[node] =3D=3D NULL) { | ^~ node_to_cpumask_map is of type cpumask_var_t[]. When CONFIG_CPUMASK_OFFSTACK is set, cpumask_var_t is typedef'd to a pointer for dynamic allocation, else to an array of one element. The "wicked game" can be checked on line 700 of include/linux/cpumask.h. The original code in debug_cpumask_set_cpu() and cpumask_of_node() were probably written by the original authors with CONFIG_CPUMASK_OFFSTACK=3Dy (i.e. dynamic allocation) in mind, checking if the cpumask was available via a direct NULL check. When CONFIG_CPUMASK_OFFSTACK is not set, GCC gives the above warning while compiling the kernel. Fix that by using cpumask_available(), which does the NULL check when CONFIG_CPUMASK_OFFSTACK is set, otherwise returns true. Use it wherever such checks are made. Conditional definitions of cpumask_available() can be found along with the definition of cpumask_var_t. Check the cpumask.h reference mentioned above. Fixes: c032ef60d1aa ("cpumask: convert node_to_cpumask_map[] to cpumask_var= _t") Fixes: de2d9445f162 ("x86: Unify node_to_cpumask_map handling between 32 an= d 64bit") Signed-off-by: Siddh Raman Pant Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20220731160913.632092-1-code@siddh.me Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/mm/numa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index e8b061557887..2aadb2019b4f 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -867,7 +867,7 @@ void debug_cpumask_set_cpu(int cpu, int node, bool enab= le) return; } mask =3D node_to_cpumask_map[node]; - if (!mask) { + if (!cpumask_available(mask)) { pr_err("node_to_cpumask_map[%i] NULL\n", node); dump_stack(); return; @@ -913,7 +913,7 @@ const struct cpumask *cpumask_of_node(int node) dump_stack(); return cpu_none_mask; } - if (node_to_cpumask_map[node] =3D=3D NULL) { + if (!cpumask_available(node_to_cpumask_map[node])) { printk(KERN_WARNING "cpumask_of_node(%d): no node_to_cpumask_map!\n", node); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD156C00140 for ; Mon, 15 Aug 2022 23:02:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244786AbiHOXCN (ORCPT ); Mon, 15 Aug 2022 19:02:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245104AbiHOXAW (ORCPT ); Mon, 15 Aug 2022 19:00:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E89D78215; Mon, 15 Aug 2022 12:57:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B120460FD8; Mon, 15 Aug 2022 19:57:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F89CC433C1; Mon, 15 Aug 2022 19:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593453; bh=fsOMfTvKS1OwyHIHiFZi4yp3lzMzwBLEDwhB4KCaDkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jtMXy5dvCtwB66Jtf0ziuNaLAdCCzOwNn+VYi1PfZMEvFgp0BewYruWazUeGClJZx +7zmz+3m0Jp2HyJhr5969z3gVZfQ47wsojd3kydmt1O8ZCaswOYt5e8exl2+hn4KIN byMHTMRpNcmJvybI3EUukqwmqN22ssO2ACyUI97I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Helge Deller , Sasha Levin Subject: [PATCH 5.18 0948/1095] video: fbdev: arkfb: Fix a divide-by-zero bug in ark_set_pixclock() Date: Mon, 15 Aug 2022 20:05:47 +0200 Message-Id: <20220815180508.344597258@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheyu Ma [ Upstream commit 2f1c4523f7a3aaabe7e53d3ebd378292947e95c8 ] Since the user can control the arguments of the ioctl() from the user space, under special arguments that may result in a divide-by-zero bug in: drivers/video/fbdev/arkfb.c:784: ark_set_pixclock(info, (hdiv * info->var= .pixclock) / hmul); with hdiv=3D1, pixclock=3D1 and hmul=3D2 you end up with (1*1)/2 =3D (int) = 0. and then in: drivers/video/fbdev/arkfb.c:504: rv =3D dac_set_freq(par->dac, 0, 1000000= 000 / pixclock); we'll get a division-by-zero. The following log can reveal it: divide error: 0000 [#1] PREEMPT SMP KASAN PTI RIP: 0010:ark_set_pixclock drivers/video/fbdev/arkfb.c:504 [inline] RIP: 0010:arkfb_set_par+0x10fc/0x24c0 drivers/video/fbdev/arkfb.c:784 Call Trace: fb_set_var+0x604/0xeb0 drivers/video/fbdev/core/fbmem.c:1034 do_fb_ioctl+0x234/0x670 drivers/video/fbdev/core/fbmem.c:1110 fb_ioctl+0xdd/0x130 drivers/video/fbdev/core/fbmem.c:1189 Fix this by checking the argument of ark_set_pixclock() first. Fixes: 681e14730c73 ("arkfb: new framebuffer driver for ARK Logic cards") Signed-off-by: Zheyu Ma Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/video/fbdev/arkfb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/arkfb.c b/drivers/video/fbdev/arkfb.c index eb3e47c58c5f..ed76ddc7df3d 100644 --- a/drivers/video/fbdev/arkfb.c +++ b/drivers/video/fbdev/arkfb.c @@ -781,7 +781,12 @@ static int arkfb_set_par(struct fb_info *info) return -EINVAL; } =20 - ark_set_pixclock(info, (hdiv * info->var.pixclock) / hmul); + value =3D (hdiv * info->var.pixclock) / hmul; + if (!value) { + fb_dbg(info, "invalid pixclock\n"); + value =3D 1; + } + ark_set_pixclock(info, value); svga_set_timings(par->state.vgabase, &ark_timing_regs, &(info->var), hmul= , hdiv, (info->var.vmode & FB_VMODE_DOUBLE) ? 2 : 1, (info->var.vmode & FB_VMODE_INTERLACED) ? 2 : 1, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B5B2C25B08 for ; Mon, 15 Aug 2022 23:02:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345324AbiHOXCX (ORCPT ); Mon, 15 Aug 2022 19:02:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352677AbiHOXAx (ORCPT ); Mon, 15 Aug 2022 19:00:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC1645D12F; Mon, 15 Aug 2022 12:57:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D5DB0612AF; Mon, 15 Aug 2022 19:57:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A5D7C433D6; Mon, 15 Aug 2022 19:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593459; bh=xIKOzEbAHX9r+GH4VZhr1OOjANvkwjV7THn/VhsTL20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Du9fa77phHPBj7TG2pW4OzQQKLmm6V+aM9jAb1ZBE8ZDC8gsotVe1+ikpc7zs7iyX zUAjvF+5TeY+JcVr41Wf5bfTQV8hiP2OMNKMJBJ+nYGR73+n+VL5CDgSLB5SCzFt7q wg68cais4AO6yRl8t8RWBVjOVy+3Q4MdlDv/X0B0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 0949/1095] tools/thermal: Fix possible path truncations Date: Mon, 15 Aug 2022 20:05:48 +0200 Message-Id: <20220815180508.378746706@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Fainelli [ Upstream commit 6c58cf40e3a1d2f47c09d3489857e9476316788a ] A build with -D_FORTIFY_SOURCE=3D2 enabled will produce the following warni= ngs: sysfs.c:63:30: warning: '%s' directive output may be truncated writing up t= o 255 bytes into a region of size between 0 and 255 [-Wformat-truncation=3D] snprintf(filepath, 256, "%s/%s", path, filename); ^~ Bump up the buffer to PATH_MAX which is the limit and account for all of the possible NUL and separators that could lead to exceeding the allocated buffer sizes. Fixes: 94f69966faf8 ("tools/thermal: Introduce tmon, a tool for thermal sub= system") Signed-off-by: Florian Fainelli Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- tools/thermal/tmon/sysfs.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tools/thermal/tmon/sysfs.c b/tools/thermal/tmon/sysfs.c index b00b1bfd9d8e..cb1108bc9249 100644 --- a/tools/thermal/tmon/sysfs.c +++ b/tools/thermal/tmon/sysfs.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -33,9 +34,9 @@ int sysfs_set_ulong(char *path, char *filename, unsigned = long val) { FILE *fd; int ret =3D -1; - char filepath[256]; + char filepath[PATH_MAX + 2]; /* NUL and '/' */ =20 - snprintf(filepath, 256, "%s/%s", path, filename); + snprintf(filepath, sizeof(filepath), "%s/%s", path, filename); =20 fd =3D fopen(filepath, "w"); if (!fd) { @@ -57,9 +58,9 @@ static int sysfs_get_ulong(char *path, char *filename, un= signed long *p_ulong) { FILE *fd; int ret =3D -1; - char filepath[256]; + char filepath[PATH_MAX + 2]; /* NUL and '/' */ =20 - snprintf(filepath, 256, "%s/%s", path, filename); + snprintf(filepath, sizeof(filepath), "%s/%s", path, filename); =20 fd =3D fopen(filepath, "r"); if (!fd) { @@ -76,9 +77,9 @@ static int sysfs_get_string(char *path, char *filename, c= har *str) { FILE *fd; int ret =3D -1; - char filepath[256]; + char filepath[PATH_MAX + 2]; /* NUL and '/' */ =20 - snprintf(filepath, 256, "%s/%s", path, filename); + snprintf(filepath, sizeof(filepath), "%s/%s", path, filename); =20 fd =3D fopen(filepath, "r"); if (!fd) { @@ -199,8 +200,8 @@ static int find_tzone_cdev(struct dirent *nl, char *tz_= name, { unsigned long trip_instance =3D 0; char cdev_name_linked[256]; - char cdev_name[256]; - char cdev_trip_name[256]; + char cdev_name[PATH_MAX]; + char cdev_trip_name[PATH_MAX]; int cdev_id; =20 if (nl->d_type =3D=3D DT_LNK) { @@ -213,7 +214,8 @@ static int find_tzone_cdev(struct dirent *nl, char *tz_= name, return -EINVAL; } /* find the link to real cooling device record binding */ - snprintf(cdev_name, 256, "%s/%s", tz_name, nl->d_name); + snprintf(cdev_name, sizeof(cdev_name) - 2, "%s/%s", + tz_name, nl->d_name); memset(cdev_name_linked, 0, sizeof(cdev_name_linked)); if (readlink(cdev_name, cdev_name_linked, sizeof(cdev_name_linked) - 1) !=3D -1) { @@ -226,8 +228,8 @@ static int find_tzone_cdev(struct dirent *nl, char *tz_= name, /* find the trip point in which the cdev is binded to * in this tzone */ - snprintf(cdev_trip_name, 256, "%s%s", nl->d_name, - "_trip_point"); + snprintf(cdev_trip_name, sizeof(cdev_trip_name) - 1, + "%s%s", nl->d_name, "_trip_point"); sysfs_get_ulong(tz_name, cdev_trip_name, &trip_instance); /* validate trip point range, e.g. trip could return -1 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36BF0C00140 for ; Mon, 15 Aug 2022 23:02:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243556AbiHOXCl (ORCPT ); Mon, 15 Aug 2022 19:02:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352794AbiHOXBI (ORCPT ); Mon, 15 Aug 2022 19:01:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 463415D120; Mon, 15 Aug 2022 12:57:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 06ACB6113B; Mon, 15 Aug 2022 19:57:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17BEEC433C1; Mon, 15 Aug 2022 19:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593465; bh=5T4neKr3Jd7AuPZGVA14c6D8Q45msYSSscOIE8m2h88=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y9Fd99E4ToYyTfqcuSOan+9UggqRPLwoYUctFPKj9AYfqIertvlhwqB3irmnUu+V6 9c84OhqhGkikivImG5FYn4eBJGBdQ22IxGms7BVB2h+oqGhSS9xSG3guKylnLd4LSN hKWlEcjK9TeMcSYbT8xan9vN0umSJw4iRWGLYSS4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Valentin Schneider , Tianchen Ding , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.18 0950/1095] sched: Fix the check of nr_running at queue wakelist Date: Mon, 15 Aug 2022 20:05:49 +0200 Message-Id: <20220815180508.412896351@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tianchen Ding [ Upstream commit 28156108fecb1f808b21d216e8ea8f0d205a530c ] The commit 2ebb17717550 ("sched/core: Offload wakee task activation if it the wakee is descheduling") checked rq->nr_running <=3D 1 to avoid task stacking when WF_ON_CPU. Per the ordering of writes to p->on_rq and p->on_cpu, observing p->on_cpu (WF_ON_CPU) in ttwu_queue_cond() implies !p->on_rq, IOW p has gone through the deactivate_task() in __schedule(), thus p has been accounted out of rq->nr_running. As such, the task being the only runnable task on the rq implies reading rq->nr_running =3D=3D 0 at that point. The benchmark result is in [1]. [1] https://lore.kernel.org/all/e34de686-4e85-bde1-9f3c-9bbc86b38627@linux.= alibaba.com/ Suggested-by: Valentin Schneider Signed-off-by: Tianchen Ding Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Valentin Schneider Link: https://lore.kernel.org/r/20220608233412.327341-2-dtcccc@linux.alibab= a.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/sched/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index b0f3ded147cb..4e99f0cf727a 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3832,8 +3832,12 @@ static inline bool ttwu_queue_cond(int cpu, int wake= _flags) * CPU then use the wakelist to offload the task activation to * the soon-to-be-idle CPU as the current CPU is likely busy. * nr_running is checked to avoid unnecessary task stacking. + * + * Note that we can only get here with (wakee) p->on_rq=3D0, + * p->on_cpu can be whatever, we've done the dequeue, so + * the wakee has been accounted out of ->nr_running. */ - if ((wake_flags & WF_ON_CPU) && cpu_rq(cpu)->nr_running <=3D 1) + if ((wake_flags & WF_ON_CPU) && !cpu_rq(cpu)->nr_running) return true; =20 return false; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9093FC00140 for ; Mon, 15 Aug 2022 23:03:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352465AbiHOXDE (ORCPT ); Mon, 15 Aug 2022 19:03:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352910AbiHOXB0 (ORCPT ); Mon, 15 Aug 2022 19:01:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36D07857E9; Mon, 15 Aug 2022 12:57:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4EF3361295; Mon, 15 Aug 2022 19:57:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49C8EC433D7; Mon, 15 Aug 2022 19:57:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593471; bh=JrbZjLxAE6WonbV+c40fQnNTMkBUk55tFnGk4JeOn+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bI3o/NJybVR7kqu5LCP5vqzd27+XJyjrKuZMN0eEYJmg8b1Ll4NY+siWjNgEGZP3u 8UJFWbGxMLjNa9C+XvXgcZfTZhx/ozVqw8BDJ27wg64CZ1RHLwPvHi46rJ27eOmXCp cTf9oyT65ss9E4Vka10ZbgYg7XXRYqMt/XUcYFec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tianchen Ding , "Peter Zijlstra (Intel)" , Valentin Schneider , Sasha Levin Subject: [PATCH 5.18 0951/1095] sched: Remove the limitation of WF_ON_CPU on wakelist if wakee cpu is idle Date: Mon, 15 Aug 2022 20:05:50 +0200 Message-Id: <20220815180508.442818420@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tianchen Ding [ Upstream commit f3dd3f674555bd9455c5ae7fafce0696bd9931b3 ] Wakelist can help avoid cache bouncing and offload the overhead of waker cpu. So far, using wakelist within the same llc only happens on WF_ON_CPU, and this limitation could be removed to further improve wakeup performance. The commit 518cd6234178 ("sched: Only queue remote wakeups when crossing cache boundaries") disabled queuing tasks on wakelist when the cpus share llc. This is because, at that time, the scheduler must send IPIs to do ttwu_queue_wakelist. Nowadays, ttwu_queue_wakelist also supports TIF_POLLING, so this is not a problem now when the wakee cpu is in idle polling. Benefits: Queuing the task on idle cpu can help improving performance on waker cpu and utilization on wakee cpu, and further improve locality because the wakee cpu can handle its own rq. This patch helps improving rt on our real java workloads where wakeup happens frequently. Consider the normal condition (CPU0 and CPU1 share same llc) Before this patch: CPU0 CPU1 select_task_rq() idle rq_lock(CPU1->rq) enqueue_task(CPU1->rq) notify CPU1 (by sending IPI or CPU1 polling) resched() After this patch: CPU0 CPU1 select_task_rq() idle add to wakelist of CPU1 notify CPU1 (by sending IPI or CPU1 polling) rq_lock(CPU1->rq) enqueue_task(CPU1->rq) resched() We see CPU0 can finish its work earlier. It only needs to put task to wakelist and return. While CPU1 is idle, so let itself handle its own runqueue data. This patch brings no difference about IPI. This patch only takes effect when the wakee cpu is: 1) idle polling 2) idle not polling For 1), there will be no IPI with or without this patch. For 2), there will always be an IPI before or after this patch. Before this patch: waker cpu will enqueue task and check preempt. Since "idle" will be sure to be preempted, waker cpu must send a resched IPI. After this patch: waker cpu will put the task to the wakelist of wakee cpu, and send an IPI. Benchmark: We've tested schbench, unixbench, and hachbench on both x86 and arm64. On x86 (Intel Xeon Platinum 8269CY): schbench -m 2 -t 8 Latency percentiles (usec) before after 50.0000th: 8 6 75.0000th: 10 7 90.0000th: 11 8 95.0000th: 12 8 *99.0000th: 13 10 99.5000th: 15 11 99.9000th: 18 14 Unixbench with full threads (104) before after Dhrystone 2 using register variables 3011862938 3009935994 -0.06% Double-Precision Whetstone 617119.3 617298.5 0.03% Execl Throughput 27667.3 27627.3 -0.14% File Copy 1024 bufsize 2000 maxblocks 785871.4 784906.2 -0.12% File Copy 256 bufsize 500 maxblocks 210113.6 212635.4 1.20% File Copy 4096 bufsize 8000 maxblocks 2328862.2 2320529.1 -0.36% Pipe Throughput 145535622.8 145323033.2 -0.15% Pipe-based Context Switching 3221686.4 3583975.4 11.25% Process Creation 101347.1 103345.4 1.97% Shell Scripts (1 concurrent) 120193.5 123977.8 3.15% Shell Scripts (8 concurrent) 17233.4 17138.4 -0.55% System Call Overhead 5300604.8 5312213.6 0.22% hackbench -g 1 -l 100000 before after Time 3.246 2.251 On arm64 (Ampere Altra): schbench -m 2 -t 8 Latency percentiles (usec) before after 50.0000th: 14 10 75.0000th: 19 14 90.0000th: 22 16 95.0000th: 23 16 *99.0000th: 24 17 99.5000th: 24 17 99.9000th: 28 25 Unixbench with full threads (80) before after Dhrystone 2 using register variables 3536194249 3537019613 0.02% Double-Precision Whetstone 629383.6 629431.6 0.01% Execl Throughput 65920.5 65846.2 -0.11% File Copy 1024 bufsize 2000 maxblocks 1063722.8 1064026.8 0.03% File Copy 256 bufsize 500 maxblocks 322684.5 318724.5 -1.23% File Copy 4096 bufsize 8000 maxblocks 2348285.3 2328804.8 -0.83% Pipe Throughput 133542875.3 131619389.8 -1.44% Pipe-based Context Switching 3215356.1 3576945.1 11.25% Process Creation 108520.5 120184.6 10.75% Shell Scripts (1 concurrent) 122636.3 121888 -0.61% Shell Scripts (8 concurrent) 17462.1 17381.4 -0.46% System Call Overhead 4429998.9 4435006.7 0.11% hackbench -g 1 -l 100000 before after Time 4.217 2.916 Our patch has improvement on schbench, hackbench and Pipe-based Context Switching of unixbench when there exists idle cpus, and no obvious regression on other tests of unixbench. This can help improve rt in scenes where wakeup happens frequently. Signed-off-by: Tianchen Ding Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Valentin Schneider Link: https://lore.kernel.org/r/20220608233412.327341-3-dtcccc@linux.alibab= a.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/sched/core.c | 26 ++++++++++++++------------ kernel/sched/sched.h | 1 - 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 4e99f0cf727a..df4a8c9d1070 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3811,7 +3811,7 @@ bool cpus_share_cache(int this_cpu, int that_cpu) return per_cpu(sd_llc_id, this_cpu) =3D=3D per_cpu(sd_llc_id, that_cpu); } =20 -static inline bool ttwu_queue_cond(int cpu, int wake_flags) +static inline bool ttwu_queue_cond(int cpu) { /* * Do not complicate things with the async wake_list while the CPU is @@ -3827,17 +3827,21 @@ static inline bool ttwu_queue_cond(int cpu, int wak= e_flags) if (!cpus_share_cache(smp_processor_id(), cpu)) return true; =20 + if (cpu =3D=3D smp_processor_id()) + return false; + /* - * If the task is descheduling and the only running task on the - * CPU then use the wakelist to offload the task activation to - * the soon-to-be-idle CPU as the current CPU is likely busy. - * nr_running is checked to avoid unnecessary task stacking. + * If the wakee cpu is idle, or the task is descheduling and the + * only running task on the CPU, then use the wakelist to offload + * the task activation to the idle (or soon-to-be-idle) CPU as + * the current CPU is likely busy. nr_running is checked to + * avoid unnecessary task stacking. * * Note that we can only get here with (wakee) p->on_rq=3D0, * p->on_cpu can be whatever, we've done the dequeue, so * the wakee has been accounted out of ->nr_running. */ - if ((wake_flags & WF_ON_CPU) && !cpu_rq(cpu)->nr_running) + if (!cpu_rq(cpu)->nr_running) return true; =20 return false; @@ -3845,10 +3849,7 @@ static inline bool ttwu_queue_cond(int cpu, int wake= _flags) =20 static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_f= lags) { - if (sched_feat(TTWU_QUEUE) && ttwu_queue_cond(cpu, wake_flags)) { - if (WARN_ON_ONCE(cpu =3D=3D smp_processor_id())) - return false; - + if (sched_feat(TTWU_QUEUE) && ttwu_queue_cond(cpu)) { sched_clock_cpu(cpu); /* Sync clocks across CPUs */ __ttwu_queue_wakelist(p, cpu, wake_flags); return true; @@ -4170,7 +4171,7 @@ try_to_wake_up(struct task_struct *p, unsigned int st= ate, int wake_flags) * scheduling. */ if (smp_load_acquire(&p->on_cpu) && - ttwu_queue_wakelist(p, task_cpu(p), wake_flags | WF_ON_CPU)) + ttwu_queue_wakelist(p, task_cpu(p), wake_flags)) goto unlock; =20 /* @@ -4714,7 +4715,8 @@ static inline void prepare_task(struct task_struct *n= ext) * Claim the task as running, we do this before switching to it * such that any running task will have this set. * - * See the ttwu() WF_ON_CPU case and its ordering comment. + * See the smp_load_acquire(&p->on_cpu) case in ttwu() and + * its ordering comment. */ WRITE_ONCE(next->on_cpu, 1); #endif diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 84bba67c92dc..08fdb9ccd14d 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2042,7 +2042,6 @@ static inline int task_on_rq_migrating(struct task_st= ruct *p) =20 #define WF_SYNC 0x10 /* Waker goes to sleep after wakeup */ #define WF_MIGRATED 0x20 /* Internal use, task got migrated */ -#define WF_ON_CPU 0x40 /* Wakee is on_cpu */ =20 #ifdef CONFIG_SMP static_assert(WF_EXEC =3D=3D SD_BALANCE_EXEC); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A43E8C00140 for ; Mon, 15 Aug 2022 23:03:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243969AbiHOXDc (ORCPT ); Mon, 15 Aug 2022 19:03:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352997AbiHOXBu (ORCPT ); Mon, 15 Aug 2022 19:01:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D68D13F207; Mon, 15 Aug 2022 12:58:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DF337612BC; Mon, 15 Aug 2022 19:58:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0AAFC433D6; Mon, 15 Aug 2022 19:58:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593481; bh=pSqFm/F+9c2KAa07HAvyYA0Ppsjj8HHDA+WUMgJeHDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTiPLbAX0T4AfNg6X8gIBYSfF9rDJHxcc2exgmTh0zuSlwtD2QTRgyKAB9DpRS/QI S3AAAumMDg0Wz/FZOgykVLPRu/+eMjlfA9d72I7rAf72ZtYqvJkDqV35xK6xDstVZd 24lVKL9Qjtp6IlehHrpxyL8eoVWjGuKfrOKZZ3ng= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mel Gorman , Ingo Molnar , Sasha Levin Subject: [PATCH 5.18 0952/1095] sched/core: Do not requeue task on CPU excluded from cpus_mask Date: Mon, 15 Aug 2022 20:05:51 +0200 Message-Id: <20220815180508.490711459@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mel Gorman [ Upstream commit 751d4cbc43879229dbc124afefe240b70fd29a85 ] The following warning was triggered on a large machine early in boot on a distribution kernel but the same problem should also affect mainline. WARNING: CPU: 439 PID: 10 at ../kernel/workqueue.c:2231 process_one_work= +0x4d/0x440 Call Trace: rescuer_thread+0x1f6/0x360 kthread+0x156/0x180 ret_from_fork+0x22/0x30 Commit c6e7bd7afaeb ("sched/core: Optimize ttwu() spinning on p->on_cpu") optimises ttwu by queueing a task that is descheduling on the wakelist, but does not check if the task descheduling is still allowed to run on that= CPU. In this warning, the problematic task is a workqueue rescue thread which checks if the rescue is for a per-cpu workqueue and running on the wrong CP= U. While this is early in boot and it should be possible to create workers, the rescue thread may still used if the MAYDAY_INITIAL_TIMEOUT is reached or MAYDAY_INTERVAL and on a sufficiently large machine, the rescue thread is being used frequently. Tracing confirmed that the task should have migrated properly using the stopper thread to handle the migration. However, a parallel wakeup from udev running on another CPU that does not share CPU cache observes p->on_cpu and uses task_cpu(p), queues the task on the old CPU and triggers the warning. Check that the wakee task that is descheduling is still allowed to run on its current CPU and if not, wait for the descheduling to complete and select an allowed CPU. Fixes: c6e7bd7afaeb ("sched/core: Optimize ttwu() spinning on p->on_cpu") Signed-off-by: Mel Gorman Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20220804092119.20137-1-mgorman@techsingular= ity.net Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/sched/core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index df4a8c9d1070..9671796a11cc 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3811,7 +3811,7 @@ bool cpus_share_cache(int this_cpu, int that_cpu) return per_cpu(sd_llc_id, this_cpu) =3D=3D per_cpu(sd_llc_id, that_cpu); } =20 -static inline bool ttwu_queue_cond(int cpu) +static inline bool ttwu_queue_cond(struct task_struct *p, int cpu) { /* * Do not complicate things with the async wake_list while the CPU is @@ -3820,6 +3820,10 @@ static inline bool ttwu_queue_cond(int cpu) if (!cpu_active(cpu)) return false; =20 + /* Ensure the task will still be allowed to run on the CPU. */ + if (!cpumask_test_cpu(cpu, p->cpus_ptr)) + return false; + /* * If the CPU does not share cache, then queue the task on the * remote rqs wakelist to avoid accessing remote data. @@ -3849,7 +3853,7 @@ static inline bool ttwu_queue_cond(int cpu) =20 static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_f= lags) { - if (sched_feat(TTWU_QUEUE) && ttwu_queue_cond(cpu)) { + if (sched_feat(TTWU_QUEUE) && ttwu_queue_cond(p, cpu)) { sched_clock_cpu(cpu); /* Sync clocks across CPUs */ __ttwu_queue_wakelist(p, cpu, wake_flags); return true; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E626C00140 for ; Mon, 15 Aug 2022 23:03:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347074AbiHOXDh (ORCPT ); Mon, 15 Aug 2022 19:03:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231646AbiHOXB6 (ORCPT ); Mon, 15 Aug 2022 19:01:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B37D13F227; Mon, 15 Aug 2022 12:58:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 86AFEB80EAD; Mon, 15 Aug 2022 19:58:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D36F1C433D6; Mon, 15 Aug 2022 19:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593487; bh=mPAZIivBhuehrA9rWZjos+F/5rsjO/MsLGLXHKosBsM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=saq9aOJTENQaYj7WLJNsDF+kaqifXZJ76oPSQiFrkAq+JwYA+OGnn6lSZXUgOg66q WhO9u/p+ynOzPsekpSWYx2IA1yRQ/lg7/iDac2cfNqmWoqtMyH8vMRT7h5El9VODRt SBU3dcz9yfI0T83fe5dxQ60J/i5/tb+ErkOOxq88= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrea Righi , Ingo Molnar , Sasha Levin Subject: [PATCH 5.18 0953/1095] x86/entry: Build thunk_$(BITS) only if CONFIG_PREEMPTION=y Date: Mon, 15 Aug 2022 20:05:52 +0200 Message-Id: <20220815180508.530638561@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrea Righi [ Upstream commit de979c83574abf6e78f3fa65b716515c91b2613d ] With CONFIG_PREEMPTION disabled, arch/x86/entry/thunk_$(BITS).o becomes an empty object file. With some old versions of binutils (i.e., 2.35.90.20210113-1ubuntu1) the GNU assembler doesn't generate a symbol table for empty object files and objtool fails with the following error when a valid symbol table cannot be found: arch/x86/entry/thunk_64.o: warning: objtool: missing symbol table To prevent this from happening, build thunk_$(BITS).o only if CONFIG_PREEMPTION is enabled. BugLink: https://bugs.launchpad.net/bugs/1911359 Fixes: 320100a5ffe5 ("x86/entry: Remove the TRACE_IRQS cruft") Signed-off-by: Andrea Righi Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/Ys/Ke7EWjcX+ZlXO@arighi-desktop Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/entry/Makefile | 3 ++- arch/x86/entry/thunk_32.S | 2 -- arch/x86/entry/thunk_64.S | 4 ---- arch/x86/um/Makefile | 3 ++- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/x86/entry/Makefile b/arch/x86/entry/Makefile index eeadbd7d92cc..ca2fe186994b 100644 --- a/arch/x86/entry/Makefile +++ b/arch/x86/entry/Makefile @@ -11,12 +11,13 @@ CFLAGS_REMOVE_common.o =3D $(CC_FLAGS_FTRACE) =20 CFLAGS_common.o +=3D -fno-stack-protector =20 -obj-y :=3D entry.o entry_$(BITS).o thunk_$(BITS).o syscall_$(BITS).o +obj-y :=3D entry.o entry_$(BITS).o syscall_$(BITS).o obj-y +=3D common.o =20 obj-y +=3D vdso/ obj-y +=3D vsyscall/ =20 +obj-$(CONFIG_PREEMPTION) +=3D thunk_$(BITS).o obj-$(CONFIG_IA32_EMULATION) +=3D entry_64_compat.o syscall_32.o obj-$(CONFIG_X86_X32_ABI) +=3D syscall_x32.o =20 diff --git a/arch/x86/entry/thunk_32.S b/arch/x86/entry/thunk_32.S index 7591bab060f7..ff6e7003da97 100644 --- a/arch/x86/entry/thunk_32.S +++ b/arch/x86/entry/thunk_32.S @@ -29,10 +29,8 @@ SYM_CODE_START_NOALIGN(\name) SYM_CODE_END(\name) .endm =20 -#ifdef CONFIG_PREEMPTION THUNK preempt_schedule_thunk, preempt_schedule THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace EXPORT_SYMBOL(preempt_schedule_thunk) EXPORT_SYMBOL(preempt_schedule_notrace_thunk) -#endif =20 diff --git a/arch/x86/entry/thunk_64.S b/arch/x86/entry/thunk_64.S index 505b488fcc65..f38b07d2768b 100644 --- a/arch/x86/entry/thunk_64.S +++ b/arch/x86/entry/thunk_64.S @@ -31,14 +31,11 @@ SYM_FUNC_END(\name) _ASM_NOKPROBE(\name) .endm =20 -#ifdef CONFIG_PREEMPTION THUNK preempt_schedule_thunk, preempt_schedule THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace EXPORT_SYMBOL(preempt_schedule_thunk) EXPORT_SYMBOL(preempt_schedule_notrace_thunk) -#endif =20 -#ifdef CONFIG_PREEMPTION SYM_CODE_START_LOCAL_NOALIGN(__thunk_restore) popq %r11 popq %r10 @@ -53,4 +50,3 @@ SYM_CODE_START_LOCAL_NOALIGN(__thunk_restore) RET _ASM_NOKPROBE(__thunk_restore) SYM_CODE_END(__thunk_restore) -#endif diff --git a/arch/x86/um/Makefile b/arch/x86/um/Makefile index ba5789c35809..a8cde4e8ab11 100644 --- a/arch/x86/um/Makefile +++ b/arch/x86/um/Makefile @@ -28,7 +28,8 @@ else =20 obj-y +=3D syscalls_64.o vdso/ =20 -subarch-y =3D ../lib/csum-partial_64.o ../lib/memcpy_64.o ../entry/thunk_6= 4.o +subarch-y =3D ../lib/csum-partial_64.o ../lib/memcpy_64.o +subarch-$(CONFIG_PREEMPTION) +=3D ../entry/thunk_64.o =20 endif =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27BD1C00140 for ; Mon, 15 Aug 2022 23:18:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233330AbiHOXSE (ORCPT ); Mon, 15 Aug 2022 19:18:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245760AbiHOXO1 (ORCPT ); Mon, 15 Aug 2022 19:14:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC0267B780; Mon, 15 Aug 2022 13:01:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 43EB1612D1; Mon, 15 Aug 2022 20:01:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C75BC433D6; Mon, 15 Aug 2022 20:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593695; bh=JhNnQOE20HwpMMsPZPM6nzXHWRTIUJpndBIUOobfnog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BmU2Yz8W+Me6c2tZg5vGzW7bvNVaNm7AP6EFw+PpPjCfUjMnuf+bAAwibbA8TMP93 +v3wmoRqq/weV/bxHE88m2Wab0Gy6uCdz4uNJqfzlBdfJOdsk50jwePwJgrCL+0eeI Un4PHoQiBgd3gvnUKpLZgJQ+Z7xL0lJII6DgL6k8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sungjong Seo , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.18 0954/1095] f2fs: allow compression for mmap files in compress_mode=user Date: Mon, 15 Aug 2022 20:05:53 +0200 Message-Id: <20220815180508.570829193@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sungjong Seo [ Upstream commit 66d34fcbbe63ebd8584b792e0d741f6648100894 ] Since commit e3c548323d32 ("f2fs: let's allow compression for mmap files"), it has been allowed to compress mmap files. However, in compress_mode=3Duse= r, it is not allowed yet. To keep the same concept in both compress_modes, f2fs_ioc_(de)compress_file() should also allow it. Let's remove checking mmap files in f2fs_ioc_(de)compress_file() so that the compression for mmap files is also allowed in compress_mode=3Duser. Signed-off-by: Sungjong Seo Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/f2fs/file.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 863518695ea6..9a676ea080e4 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -3914,11 +3914,6 @@ static int f2fs_ioc_decompress_file(struct file *fil= p, unsigned long arg) goto out; } =20 - if (f2fs_is_mmap_file(inode)) { - ret =3D -EBUSY; - goto out; - } - ret =3D filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); if (ret) goto out; @@ -3986,11 +3981,6 @@ static int f2fs_ioc_compress_file(struct file *filp,= unsigned long arg) goto out; } =20 - if (f2fs_is_mmap_file(inode)) { - ret =3D -EBUSY; - goto out; - } - ret =3D filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); if (ret) goto out; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFB0AC25B0D for ; Mon, 15 Aug 2022 23:07:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243310AbiHOXHu (ORCPT ); Mon, 15 Aug 2022 19:07:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231646AbiHOXDn (ORCPT ); Mon, 15 Aug 2022 19:03:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64D0E140387; Mon, 15 Aug 2022 12:58:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6EE0961299; Mon, 15 Aug 2022 19:58:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BA6EC433C1; Mon, 15 Aug 2022 19:58:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593504; bh=v6rhzKfkgAizoOjuCss4MtEIm16S+hpSuSNYbD1EtjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JVXYvYuuxQqBTeZI/9ep/xmlcBFbH24Ju4zLw5rn0DwUjPobLmNuZTd6YbvcB9Fs5 OUG1difKCHMzMfNfzzxvb1g1uPlioRPsmeD/pAa05Xti80g2FhZzkKTsjuUr9w/sFq JgPMBy9HGSuKzyF4CobtaRInuGMR/X9i+jdsyRxU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Junbeom Yeom , Sungjong Seo , Youngjin Gil , Jaewook Kim , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.18 0955/1095] f2fs: do not allow to decompress files have FI_COMPRESS_RELEASED Date: Mon, 15 Aug 2022 20:05:54 +0200 Message-Id: <20220815180508.602611543@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jaewook Kim [ Upstream commit 90be48bd9d29ece3965e5e8b21499b6db166e57b ] If a file has FI_COMPRESS_RELEASED, all writes for it should not be allowed. However, as of now, in case of compress_mode=3Duser, writes triggered by IOCTLs like F2FS_IOC_DE/COMPRESS_FILE are allowed unexpectly, which could crash that file. To fix it, let's do not allow F2FS_IOC_DE/COMPRESS_IOCTL if a file already has FI_COMPRESS_RELEASED flag. This is the reproduction process: 1. $ touch ./file 2. $ chattr +c ./file 3. $ dd if=3D/dev/random of=3D./file bs=3D4096 count=3D30 conv=3Dnotrunc 4. $ dd if=3D/dev/zero of=3D./file bs=3D4096 count=3D34 seek=3D30 conv=3Dn= otrunc 5. $ sync 6. $ do_compress ./file ; call F2FS_IOC_COMPRESS_FILE 7. $ get_compr_blocks ./file ; call F2FS_IOC_GET_COMPRESS_BLOCKS 8. $ release ./file ; call F2FS_IOC_RELEASE_COMPRESS_BLOCKS 9. $ do_compress ./file ; call F2FS_IOC_COMPRESS_FILE again 10. $ get_compr_blocks ./file ; call F2FS_IOC_GET_COMPRESS_BLOCKS again This reproduction process is tested in 128kb cluster size. You can find compr_blocks has a negative value. Fixes: 5fdb322ff2c2b ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMP= RESS_FILE") Signed-off-by: Junbeom Yeom Signed-off-by: Sungjong Seo Signed-off-by: Youngjin Gil Signed-off-by: Jaewook Kim Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/f2fs/file.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 9a676ea080e4..c2644a085876 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -3914,6 +3914,11 @@ static int f2fs_ioc_decompress_file(struct file *fil= p, unsigned long arg) goto out; } =20 + if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) { + ret =3D -EINVAL; + goto out; + } + ret =3D filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); if (ret) goto out; @@ -3981,6 +3986,11 @@ static int f2fs_ioc_compress_file(struct file *filp,= unsigned long arg) goto out; } =20 + if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) { + ret =3D -EINVAL; + goto out; + } + ret =3D filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); if (ret) goto out; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC18FC00140 for ; Mon, 15 Aug 2022 23:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241078AbiHOXKA (ORCPT ); Mon, 15 Aug 2022 19:10:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353240AbiHOXHc (ORCPT ); Mon, 15 Aug 2022 19:07:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 804DB86B66; Mon, 15 Aug 2022 12:59:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2128BB80EAD; Mon, 15 Aug 2022 19:59:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76218C433C1; Mon, 15 Aug 2022 19:59:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593570; bh=ZkfPhjN2avtPFEMPzc3hA7bzstrynbp1NHZb4XLt1sc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fmvb6hLpwLBElnB//5/JdzD2YezkV5ztvuanTeXikwvR8IhxSFVIRmFN56aYqcDka Pbo7mOdy+pUAVXIr50l1+Bvqh8lGmID2Nc3U+ugz0r2uE9FYaVJeewAWbbxts2WMPU gcQvirMcMaFe92yFQwwhqnh2BvHzwxDsW8EOJJJU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Helge Deller , Sasha Levin Subject: [PATCH 5.18 0956/1095] video: fbdev: vt8623fb: Check the size of screen before memset_io() Date: Mon, 15 Aug 2022 20:05:55 +0200 Message-Id: <20220815180508.641844592@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheyu Ma [ Upstream commit ec0754c60217248fa77cc9005d66b2b55200ac06 ] In the function vt8623fb_set_par(), the value of 'screen_size' is calculated by the user input. If the user provides the improper value, the value of 'screen_size' may larger than 'info->screen_size', which may cause the following bug: [ 583.339036] BUG: unable to handle page fault for address: ffffc900050000= 00 [ 583.339049] #PF: supervisor write access in kernel mode [ 583.339052] #PF: error_code(0x0002) - not-present page [ 583.339074] RIP: 0010:memset_orig+0x33/0xb0 [ 583.339110] Call Trace: [ 583.339118] vt8623fb_set_par+0x11cd/0x21e0 [ 583.339146] fb_set_var+0x604/0xeb0 [ 583.339181] do_fb_ioctl+0x234/0x670 [ 583.339209] fb_ioctl+0xdd/0x130 Fix the this by checking the value of 'screen_size' before memset_io(). Fixes: 558b7bd86c32 ("vt8623fb: new framebuffer driver for VIA VT8623") Signed-off-by: Zheyu Ma Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/video/fbdev/vt8623fb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/vt8623fb.c b/drivers/video/fbdev/vt8623fb.c index a92a8c670cf0..4274c6efb249 100644 --- a/drivers/video/fbdev/vt8623fb.c +++ b/drivers/video/fbdev/vt8623fb.c @@ -507,6 +507,8 @@ static int vt8623fb_set_par(struct fb_info *info) (info->var.vmode & FB_VMODE_DOUBLE) ? 2 : 1, 1, 1, info->node); =20 + if (screen_size > info->screen_size) + screen_size =3D info->screen_size; memset_io(info->screen_base, 0x00, screen_size); =20 /* Device and screen back on */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73AB4C00140 for ; Mon, 15 Aug 2022 23:13:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243913AbiHOXNp (ORCPT ); Mon, 15 Aug 2022 19:13:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348023AbiHOXMp (ORCPT ); Mon, 15 Aug 2022 19:12:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 381D174361; Mon, 15 Aug 2022 13:00:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A160CB80EB1; Mon, 15 Aug 2022 20:00:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7ABFC433C1; Mon, 15 Aug 2022 20:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593636; bh=blUag92h8eWnSLEZbHuaNvoEH/qbG9jaiisbiWnHFkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jj09ttknZ1+FLrEmH1UVX6t/EOxwjO76O0nRiQ+kThE3DI4zzk4Bvzt9POMvsAy92 87ZECviXn+ax7xFbkQ2JlGIUjymn3CzeDej9T3kmGukoR1VRYiQ82DxxrmTM77K0t7 4RW7B3mwDmHadgDhETLezfHdv+Ek3HmOpS5NJBm8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Helge Deller , Sasha Levin Subject: [PATCH 5.18 0957/1095] video: fbdev: arkfb: Check the size of screen before memset_io() Date: Mon, 15 Aug 2022 20:05:56 +0200 Message-Id: <20220815180508.678500077@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheyu Ma [ Upstream commit 96b550971c65d54d64728d8ba973487878a06454 ] In the function arkfb_set_par(), the value of 'screen_size' is calculated by the user input. If the user provides the improper value, the value of 'screen_size' may larger than 'info->screen_size', which may cause the following bug: [ 659.399066] BUG: unable to handle page fault for address: ffffc900030000= 00 [ 659.399077] #PF: supervisor write access in kernel mode [ 659.399079] #PF: error_code(0x0002) - not-present page [ 659.399094] RIP: 0010:memset_orig+0x33/0xb0 [ 659.399116] Call Trace: [ 659.399122] arkfb_set_par+0x143f/0x24c0 [ 659.399130] fb_set_var+0x604/0xeb0 [ 659.399161] do_fb_ioctl+0x234/0x670 [ 659.399189] fb_ioctl+0xdd/0x130 Fix the this by checking the value of 'screen_size' before memset_io(). Fixes: 681e14730c73 ("arkfb: new framebuffer driver for ARK Logic cards") Signed-off-by: Zheyu Ma Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/video/fbdev/arkfb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/arkfb.c b/drivers/video/fbdev/arkfb.c index ed76ddc7df3d..a2a381631628 100644 --- a/drivers/video/fbdev/arkfb.c +++ b/drivers/video/fbdev/arkfb.c @@ -797,6 +797,8 @@ static int arkfb_set_par(struct fb_info *info) value =3D ((value * hmul / hdiv) / 8) - 5; vga_wcrt(par->state.vgabase, 0x42, (value + 1) / 2); =20 + if (screen_size > info->screen_size) + screen_size =3D info->screen_size; memset_io(info->screen_base, 0x00, screen_size); /* Device and screen back on */ svga_wcrt_mask(par->state.vgabase, 0x17, 0x80, 0x80); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A313C25B0E for ; Mon, 15 Aug 2022 23:17:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245102AbiHOXR0 (ORCPT ); Mon, 15 Aug 2022 19:17:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241157AbiHOXOZ (ORCPT ); Mon, 15 Aug 2022 19:14:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4F968A1DE; Mon, 15 Aug 2022 13:01:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 889F9B80EA8; Mon, 15 Aug 2022 20:01:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E20B6C433D6; Mon, 15 Aug 2022 20:01:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593687; bh=pNYcoTpG4Vva9kv7QzWq1FSRNEWbBS/YySs1ndBRAAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wWz0tIJz6kysUB9dUFsZZhzroMXeu7wIQUWvJrp9H2iOEAMIkElt5PPZzA8arqDb+ H9Emd2XU2aB4L4EkfH9I37Fxfzk4NAsVVncoEPZycLk/1A6ywoW62zZI0D4huBf9CB NYp9E/Q5Aat8f4Mmw0+mv2C04TtDuoxl56O1FUAc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Helge Deller , Sasha Levin Subject: [PATCH 5.18 0958/1095] video: fbdev: s3fb: Check the size of screen before memset_io() Date: Mon, 15 Aug 2022 20:05:57 +0200 Message-Id: <20220815180508.713587087@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheyu Ma [ Upstream commit 6ba592fa014f21f35a8ee8da4ca7b95a018f13e8 ] In the function s3fb_set_par(), the value of 'screen_size' is calculated by the user input. If the user provides the improper value, the value of 'screen_size' may larger than 'info->screen_size', which may cause the following bug: [ 54.083733] BUG: unable to handle page fault for address: ffffc900030000= 00 [ 54.083742] #PF: supervisor write access in kernel mode [ 54.083744] #PF: error_code(0x0002) - not-present page [ 54.083760] RIP: 0010:memset_orig+0x33/0xb0 [ 54.083782] Call Trace: [ 54.083788] s3fb_set_par+0x1ec6/0x4040 [ 54.083806] fb_set_var+0x604/0xeb0 [ 54.083836] do_fb_ioctl+0x234/0x670 Fix the this by checking the value of 'screen_size' before memset_io(). Fixes: a268422de8bf ("fbdev driver for S3 Trio/Virge") Signed-off-by: Zheyu Ma Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/video/fbdev/s3fb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/s3fb.c b/drivers/video/fbdev/s3fb.c index b93c8eb02336..5069f6f67923 100644 --- a/drivers/video/fbdev/s3fb.c +++ b/drivers/video/fbdev/s3fb.c @@ -905,6 +905,8 @@ static int s3fb_set_par(struct fb_info *info) value =3D clamp((htotal + hsstart + 1) / 2 + 2, hsstart + 4, htotal + 1); svga_wcrt_multi(par->state.vgabase, s3_dtpc_regs, value); =20 + if (screen_size > info->screen_size) + screen_size =3D info->screen_size; memset_io(info->screen_base, 0x00, screen_size); /* Device and screen back on */ svga_wcrt_mask(par->state.vgabase, 0x17, 0x80, 0x80); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44039C00140 for ; Mon, 15 Aug 2022 23:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343890AbiHOXRi (ORCPT ); Mon, 15 Aug 2022 19:17:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345701AbiHOXO0 (ORCPT ); Mon, 15 Aug 2022 19:14:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAEE579EFB; Mon, 15 Aug 2022 13:01:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 87BF5612B9; Mon, 15 Aug 2022 20:01:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83AEDC433C1; Mon, 15 Aug 2022 20:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593693; bh=abu+AWRH5S6uTZkEhznvw+0Ogzufh67MHgGaXOOZzbE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1oDmmkCbXl8yvNsUtxuLcM/bXPXmmqW26StG52cGK6pZGupQT8ImlS+wpgb0eCvrj MVW45KMvcw4lJEg3pYH1AcuUzgIkP9NHb87M1vQNcTbmK7dXLytuhcNP6mAKcyu6lt B8zQcy0TB1+ltEvEwM9FlVISZCWP52sM3idMbY5g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stanley Chu , Peter Wang , "Martin K. Petersen" Subject: [PATCH 5.18 0959/1095] scsi: ufs: core: Correct ufshcd_shutdown() flow Date: Mon, 15 Aug 2022 20:05:58 +0200 Message-Id: <20220815180508.745559584@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Wang commit 00511d2abf5708ad05dd5d1c36adb2468d274698 upstream. After ufshcd_wl_shutdown() set device power off and link off, ufshcd_shutdown() could turn off clock/power. Also remove pm_runtime_get_sync. The reason why it is safe to remove pm_runtime_get_sync() is because: - ufshcd_wl_shutdown() -> pm_runtime_get_sync() will resume hba->dev too. - device resume(turn on clk/power) is not required, even if device is in RPM_SUSPENDED. Link: https://lore.kernel.org/r/20220727030526.31022-1-peter.wang@mediatek.= com Fixes: b294ff3e3449 ("scsi: ufs: core: Enable power management for wlun") Cc: # 5.15.x Reviewed-by: Stanley Chu Signed-off-by: Peter Wang Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/ufs/ufshcd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -9500,12 +9500,8 @@ EXPORT_SYMBOL(ufshcd_runtime_resume); int ufshcd_shutdown(struct ufs_hba *hba) { if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba)) - goto out; + ufshcd_suspend(hba); =20 - pm_runtime_get_sync(hba->dev); - - ufshcd_suspend(hba); -out: hba->is_powered =3D false; /* allow force shutdown even in case of errors */ return 0; From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF6BBC25B0E for ; Mon, 15 Aug 2022 23:08:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244482AbiHOXIB (ORCPT ); Mon, 15 Aug 2022 19:08:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345177AbiHOXEU (ORCPT ); Mon, 15 Aug 2022 19:04:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DE311403AA; Mon, 15 Aug 2022 12:58:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B8E0DB8106C; Mon, 15 Aug 2022 19:58:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DE9CC433C1; Mon, 15 Aug 2022 19:58:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593511; bh=RiMHovBZYHCGWtaHr4fLln1x+ZrPOtYFkzQIgJvlNg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kXfz0Sk16b0tyi6DZnQI6KawvcCxQMTA33owHUNsm4rxcEmktJKidTVNrqBph5fda EM4K/LrKuaafQk3bBtIq2sRraACVOwvRMYwyj2NX9DVLfa5snljxHLWUj35m06Ob2Q ovbTc/TwK9edwreL0cMhHDLyddm55+fFjCvYZTm4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Block , Steffen Maier , "Martin K. Petersen" Subject: [PATCH 5.18 0960/1095] scsi: zfcp: Fix missing auto port scan and thus missing target ports Date: Mon, 15 Aug 2022 20:05:59 +0200 Message-Id: <20220815180508.792658961@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steffen Maier commit 4da8c5f76825269f28d6a89fa752934a4bcb6dfa upstream. Case (1): The only waiter on wka_port->completion_wq is zfcp_fc_wka_port_get() trying to open a WKA port. As such it should only be woken up by WKA port *open* responses, not by WKA port close responses. Case (2): A close WKA port response coming in just after having sent a new open WKA port request and before blocking for the open response with wait_event() in zfcp_fc_wka_port_get() erroneously renders the wait_event a NOP because the close handler overwrites wka_port->status. Hence the wait_event condition is erroneously true and it does not enter blocking state. With non-negligible probability, the following time space sequence happens depending on timing without this fix: user process ERP thread zfcp work queue tasklet system work queue =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D $ echo 1 > online zfcp_ccw_set_online zfcp_ccw_activate zfcp_erp_adapter_reopen msleep scan backoff zfcp_erp_strategy | ... | zfcp_erp_action_cleanup | ... | queue delayed scan_work | queue ns_up_work | ns_up_work: | zfcp_fc_wka_port_get | open wka request | open response | GSPN FC-GS | RSPN FC-GS [NPIV-only] | zfcp_fc_wka_port_put | (--wka->refcount=3D=3D0) | sched delayed wka->work | ~~~Case (1)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ zfcp_erp_wait flush scan_work | wka->work: | wka->status=3DCLOSING | close wka request | scan_work: | zfcp_fc_wka_port_get | (wka->status=3D=3DCLOSING) | wka->status=3DOPENING | open wka request | wait_event | | close response | | wka->status=3DOFFLINE | | wake_up /*WRONG*/ ~~~Case (2)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | wka->work: | wka->status=3DCLOSING | close wka request zfcp_erp_wait flush scan_work | scan_work: | zfcp_fc_wka_port_get | (wka->status=3D=3DCLOSING) | wka->status=3DOPENING | open wka request | close response | wka->status=3DOFFLINE | wake_up /*WRONG&NOP*/ | wait_event /*NOP*/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | (wka->status!=3DONLINE) | return -EIO | return early open response wka->status=3DONLINE wake_up /*NOP*/ So we erroneously end up with no automatic port scan. This is a big problem when it happens during boot. The timing is influenced by v3.19 commit 18f87a67e6d6 ("zfcp: auto port scan resiliency"). Fix it by fully mutually excluding zfcp_fc_wka_port_get() and zfcp_fc_wka_port_offline(). For that to work, we make the latter block until we got the response for a close WKA port. In order not to penalize the system workqueue, we move wka_port->work to our own adapter workqueue. Note that before v2.6.30 commit 828bc1212a68 ("[SCSI] zfcp: Set WKA-port to offline on adapter deactivation"), zfcp did block in zfcp_fc_wka_port_offline() as well, but with a different condition. While at it, make non-functional cleanups to improve code reading in zfcp_fc_wka_port_get(). If we cannot send the WKA port open request, don't rely on the subsequent wait_event condition to immediately let this case pass without blocking. Also don't want to rely on the additional condition handling the refcount to be skipped just to finally return with -EIO. Link: https://lore.kernel.org/r/20220729162529.1620730-1-maier@linux.ibm.com Fixes: 5ab944f97e09 ("[SCSI] zfcp: attach and release SAN nameserver port o= n demand") Cc: #v2.6.28+ Reviewed-by: Benjamin Block Signed-off-by: Steffen Maier Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/s390/scsi/zfcp_fc.c | 29 ++++++++++++++++++++--------- drivers/s390/scsi/zfcp_fc.h | 6 ++++-- drivers/s390/scsi/zfcp_fsf.c | 4 ++-- 3 files changed, 26 insertions(+), 13 deletions(-) --- a/drivers/s390/scsi/zfcp_fc.c +++ b/drivers/s390/scsi/zfcp_fc.c @@ -145,27 +145,33 @@ void zfcp_fc_enqueue_event(struct zfcp_a =20 static int zfcp_fc_wka_port_get(struct zfcp_fc_wka_port *wka_port) { + int ret =3D -EIO; + if (mutex_lock_interruptible(&wka_port->mutex)) return -ERESTARTSYS; =20 if (wka_port->status =3D=3D ZFCP_FC_WKA_PORT_OFFLINE || wka_port->status =3D=3D ZFCP_FC_WKA_PORT_CLOSING) { wka_port->status =3D ZFCP_FC_WKA_PORT_OPENING; - if (zfcp_fsf_open_wka_port(wka_port)) + if (zfcp_fsf_open_wka_port(wka_port)) { + /* could not even send request, nothing to wait for */ wka_port->status =3D ZFCP_FC_WKA_PORT_OFFLINE; + goto out; + } } =20 - mutex_unlock(&wka_port->mutex); - - wait_event(wka_port->completion_wq, + wait_event(wka_port->opened, wka_port->status =3D=3D ZFCP_FC_WKA_PORT_ONLINE || wka_port->status =3D=3D ZFCP_FC_WKA_PORT_OFFLINE); =20 if (wka_port->status =3D=3D ZFCP_FC_WKA_PORT_ONLINE) { atomic_inc(&wka_port->refcount); - return 0; + ret =3D 0; + goto out; } - return -EIO; +out: + mutex_unlock(&wka_port->mutex); + return ret; } =20 static void zfcp_fc_wka_port_offline(struct work_struct *work) @@ -181,9 +187,12 @@ static void zfcp_fc_wka_port_offline(str =20 wka_port->status =3D ZFCP_FC_WKA_PORT_CLOSING; if (zfcp_fsf_close_wka_port(wka_port)) { + /* could not even send request, nothing to wait for */ wka_port->status =3D ZFCP_FC_WKA_PORT_OFFLINE; - wake_up(&wka_port->completion_wq); + goto out; } + wait_event(wka_port->closed, + wka_port->status =3D=3D ZFCP_FC_WKA_PORT_OFFLINE); out: mutex_unlock(&wka_port->mutex); } @@ -193,13 +202,15 @@ static void zfcp_fc_wka_port_put(struct if (atomic_dec_return(&wka_port->refcount) !=3D 0) return; /* wait 10 milliseconds, other reqs might pop in */ - schedule_delayed_work(&wka_port->work, HZ / 100); + queue_delayed_work(wka_port->adapter->work_queue, &wka_port->work, + msecs_to_jiffies(10)); } =20 static void zfcp_fc_wka_port_init(struct zfcp_fc_wka_port *wka_port, u32 d= _id, struct zfcp_adapter *adapter) { - init_waitqueue_head(&wka_port->completion_wq); + init_waitqueue_head(&wka_port->opened); + init_waitqueue_head(&wka_port->closed); =20 wka_port->adapter =3D adapter; wka_port->d_id =3D d_id; --- a/drivers/s390/scsi/zfcp_fc.h +++ b/drivers/s390/scsi/zfcp_fc.h @@ -185,7 +185,8 @@ enum zfcp_fc_wka_status { /** * struct zfcp_fc_wka_port - representation of well-known-address (WKA) FC= port * @adapter: Pointer to adapter structure this WKA port belongs to - * @completion_wq: Wait for completion of open/close command + * @opened: Wait for completion of open command + * @closed: Wait for completion of close command * @status: Current status of WKA port * @refcount: Reference count to keep port open as long as it is in use * @d_id: FC destination id or well-known-address @@ -195,7 +196,8 @@ enum zfcp_fc_wka_status { */ struct zfcp_fc_wka_port { struct zfcp_adapter *adapter; - wait_queue_head_t completion_wq; + wait_queue_head_t opened; + wait_queue_head_t closed; enum zfcp_fc_wka_status status; atomic_t refcount; u32 d_id; --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c @@ -1907,7 +1907,7 @@ static void zfcp_fsf_open_wka_port_handl wka_port->status =3D ZFCP_FC_WKA_PORT_ONLINE; } out: - wake_up(&wka_port->completion_wq); + wake_up(&wka_port->opened); } =20 /** @@ -1966,7 +1966,7 @@ static void zfcp_fsf_close_wka_port_hand } =20 wka_port->status =3D ZFCP_FC_WKA_PORT_OFFLINE; - wake_up(&wka_port->completion_wq); + wake_up(&wka_port->closed); } =20 /** From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D38CCC00140 for ; Mon, 15 Aug 2022 23:08:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344496AbiHOXIJ (ORCPT ); Mon, 15 Aug 2022 19:08:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240571AbiHOXEo (ORCPT ); Mon, 15 Aug 2022 19:04:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 566BF140C83; Mon, 15 Aug 2022 12:58:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7DFB760FB5; Mon, 15 Aug 2022 19:58:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E15BC433D6; Mon, 15 Aug 2022 19:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593516; bh=H4/hsVFJqPIVHOEuLSJ+W+AOG4ouYb+3A7WRi0QKwP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xmhlj9szUeru1QfeDntycxOXscEuabPgzeJ2hFZOE4WgdFuGi0ha/dyB0bgndwhQP mRTY88VB9Z4s3HMmZfBEV5IfN1S0fpRAkC2LuC+K6orx980BtSihUPsHBrHPtzyMT+ eWumq8Q1cg9RTIdznWz3bybnuw/Vf1i5QJsO9Ldo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.18 0961/1095] scsi: qla2xxx: Fix imbalance vha->vref_count Date: Mon, 15 Aug 2022 20:06:00 +0200 Message-Id: <20220815180508.839080213@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran commit 63fa7f2644b4b48e1913af33092c044bf48e9321 upstream. vref_count took an extra decrement in the task management path. Add an extra ref count to compensate the imbalance. Link: https://lore.kernel.org/r/20220713052045.10683-7-njavali@marvell.com Cc: stable@vger.kernel.org Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_init.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -161,6 +161,7 @@ int qla24xx_async_abort_cmd(srb_t *cmd_s struct srb_iocb *abt_iocb; srb_t *sp; int rval =3D QLA_FUNCTION_FAILED; + uint8_t bail; =20 /* ref: INIT for ABTS command */ sp =3D qla2xxx_get_qpair_sp(cmd_sp->vha, cmd_sp->qpair, cmd_sp->fcport, @@ -168,6 +169,7 @@ int qla24xx_async_abort_cmd(srb_t *cmd_s if (!sp) return QLA_MEMORY_ALLOC_FAILED; =20 + QLA_VHA_MARK_BUSY(vha, bail); abt_iocb =3D &sp->u.iocb_cmd; sp->type =3D SRB_ABT_CMD; sp->name =3D "abort"; @@ -2007,12 +2009,14 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, struct srb_iocb *tm_iocb; srb_t *sp; int rval =3D QLA_FUNCTION_FAILED; + uint8_t bail; =20 /* ref: INIT */ sp =3D qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) goto done; =20 + QLA_VHA_MARK_BUSY(vha, bail); sp->type =3D SRB_TM_CMD; sp->name =3D "tmf"; qla2x00_init_async_sp(sp, qla2x00_get_async_timeout(vha), From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9739BC25B08 for ; Mon, 15 Aug 2022 23:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345501AbiHOXIQ (ORCPT ); Mon, 15 Aug 2022 19:08:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352560AbiHOXFn (ORCPT ); Mon, 15 Aug 2022 19:05:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09092140CAE; Mon, 15 Aug 2022 12:58:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6A81D612A3; Mon, 15 Aug 2022 19:58:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 737EAC433C1; Mon, 15 Aug 2022 19:58:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593522; bh=9/s9PwEz8qdZIEIq4LzwD7S4d3nxllJUbhvznSvycco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uGHGoHXan/UE51ElJORySsHwS5FfFGMubgG+mKEfTA4TwWufRmEvN/DFPGfuzE1MJ T39va/EmxPsM5WpLOwXlUxRyOgM5hs2waRysiZKzqdRJxZC9qI9GSwEnHUvu/20pwN Y+bq3fQZ3LiYr2ruCfIYSviSisTPywm06rOsRRbM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tony Battersby , Himanshu Madhani , Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.18 0962/1095] scsi: qla2xxx: Fix discovery issues in FC-AL topology Date: Mon, 15 Aug 2022 20:06:01 +0200 Message-Id: <20220815180508.876319591@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arun Easi commit 47ccb113cead905bdc236571bf8ac6fed90321b3 upstream. A direct attach tape device, when gets swapped with another, was not discovered. Fix this by looking at loop map and reinitialize link if there are devices present. Link: https://lore.kernel.org/linux-scsi/baef87c3-5dad-3b47-44c1-6914bfc901= 08@cybernetics.com/ Link: https://lore.kernel.org/r/20220713052045.10683-8-njavali@marvell.com Cc: stable@vger.kernel.org Reported-by: Tony Battersby Tested-by: Tony Battersby Reviewed-by: Himanshu Madhani Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_gbl.h | 3 ++- drivers/scsi/qla2xxx/qla_init.c | 29 +++++++++++++++++++++++++++++ drivers/scsi/qla2xxx/qla_mbx.c | 5 ++++- 3 files changed, 35 insertions(+), 2 deletions(-) --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -434,7 +434,8 @@ extern int qla2x00_get_resource_cnts(scsi_qla_host_t *); =20 extern int -qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map); +qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map, + u8 *num_entries); =20 extern int qla2x00_get_link_status(scsi_qla_host_t *, uint16_t, struct link_statistic= s *, --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -5505,6 +5505,22 @@ static int qla2x00_configure_n2n_loop(sc return QLA_FUNCTION_FAILED; } =20 +static void +qla_reinitialize_link(scsi_qla_host_t *vha) +{ + int rval; + + atomic_set(&vha->loop_state, LOOP_DOWN); + atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); + rval =3D qla2x00_full_login_lip(vha); + if (rval =3D=3D QLA_SUCCESS) { + ql_dbg(ql_dbg_disc, vha, 0xd050, "Link reinitialized\n"); + } else { + ql_dbg(ql_dbg_disc, vha, 0xd051, + "Link reinitialization failed (%d)\n", rval); + } +} + /* * qla2x00_configure_local_loop * Updates Fibre Channel Device Database with local loop devices. @@ -5556,6 +5572,19 @@ qla2x00_configure_local_loop(scsi_qla_ho spin_unlock_irqrestore(&vha->work_lock, flags); =20 if (vha->scan.scan_retry < MAX_SCAN_RETRIES) { + u8 loop_map_entries =3D 0; + int rc; + + rc =3D qla2x00_get_fcal_position_map(vha, NULL, + &loop_map_entries); + if (rc =3D=3D QLA_SUCCESS && loop_map_entries > 1) { + /* + * There are devices that are still not logged + * in. Reinitialize to give them a chance. + */ + qla_reinitialize_link(vha); + return QLA_FUNCTION_FAILED; + } set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); } --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -3068,7 +3068,8 @@ qla2x00_get_resource_cnts(scsi_qla_host_ * Kernel context. */ int -qla2x00_get_fcal_position_map(scsi_qla_host_t *vha, char *pos_map) +qla2x00_get_fcal_position_map(scsi_qla_host_t *vha, char *pos_map, + u8 *num_entries) { int rval; mbx_cmd_t mc; @@ -3108,6 +3109,8 @@ qla2x00_get_fcal_position_map(scsi_qla_h =20 if (pos_map) memcpy(pos_map, pmap, FCAL_MAP_SIZE); + if (num_entries) + *num_entries =3D pmap[0]; } dma_pool_free(ha->s_dma_pool, pmap, pmap_dma); From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22210C00140 for ; Mon, 15 Aug 2022 23:08:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243600AbiHOXI3 (ORCPT ); Mon, 15 Aug 2022 19:08:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352796AbiHOXGP (ORCPT ); Mon, 15 Aug 2022 19:06:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E733140CBC; Mon, 15 Aug 2022 12:58:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D986C60FD8; Mon, 15 Aug 2022 19:58:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFF53C433B5; Mon, 15 Aug 2022 19:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593529; bh=x41DbS8qV3r1/pYkKDJeNP/yz9M9kqdvIN4rxibxN+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yHxvA7O8j+DUJHmiFUaULU9ljY/bxHh61WX5EVtm7nk1xQ4SvRnUHlQULZvy24y/q CEjUXi2kLqJ1XoV4o6/l24aijpKUenZFzjF8Hj87O0BeQEBWcnVXuGq4aM8jyooLkx FYRqaI2q/Hm5kC37GKwVkBcVfN4CRlE6917Fe6NE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.18 0963/1095] scsi: qla2xxx: Turn off multi-queue for 8G adapters Date: Mon, 15 Aug 2022 20:06:02 +0200 Message-Id: <20220815180508.906617776@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran commit 5304673bdb1635e27555bd636fd5d6956f1cd552 upstream. For 8G adapters, multi-queue was enabled accidentally. Make sure multi-queue is not enabled. Link: https://lore.kernel.org/r/20220616053508.27186-5-njavali@marvell.com Cc: stable@vger.kernel.org Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_def.h | 4 ++-- drivers/scsi/qla2xxx/qla_isr.c | 16 ++++++---------- 2 files changed, 8 insertions(+), 12 deletions(-) --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -4264,8 +4264,8 @@ struct qla_hw_data { #define IS_OEM_001(ha) ((ha)->device_type & DT_OEM_001) #define HAS_EXTENDED_IDS(ha) ((ha)->device_type & DT_EXTENDED_IDS) #define IS_CT6_SUPPORTED(ha) ((ha)->device_type & DT_CT6_SUPPORTED) -#define IS_MQUE_CAPABLE(ha) ((ha)->mqenable || IS_QLA83XX(ha) || \ - IS_QLA27XX(ha) || IS_QLA28XX(ha)) +#define IS_MQUE_CAPABLE(ha) (IS_QLA83XX(ha) || IS_QLA27XX(ha) || \ + IS_QLA28XX(ha)) #define IS_BIDI_CAPABLE(ha) \ (IS_QLA25XX(ha) || IS_QLA2031(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) /* Bit 21 of fw_attributes decides the MCTP capabilities */ --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -4419,16 +4419,12 @@ msix_register_fail: } =20 /* Enable MSI-X vector for response queue update for queue 0 */ - if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) { - if (ha->msixbase && ha->mqiobase && - (ha->max_rsp_queues > 1 || ha->max_req_queues > 1 || - ql2xmqsupport)) - ha->mqenable =3D 1; - } else - if (ha->mqiobase && - (ha->max_rsp_queues > 1 || ha->max_req_queues > 1 || - ql2xmqsupport)) - ha->mqenable =3D 1; + if (IS_MQUE_CAPABLE(ha) && + (ha->msixbase && ha->mqiobase && ha->max_qpairs)) + ha->mqenable =3D 1; + else + ha->mqenable =3D 0; + ql_dbg(ql_dbg_multiq, vha, 0xc005, "mqiobase=3D%p, max_rsp_queues=3D%d, max_req_queues=3D%d.\n", ha->mqiobase, ha->max_rsp_queues, ha->max_req_queues); From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9101CC00140 for ; Mon, 15 Aug 2022 23:08:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347240AbiHOXIf (ORCPT ); Mon, 15 Aug 2022 19:08:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352892AbiHOXGi (ORCPT ); Mon, 15 Aug 2022 19:06:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D81781415DE; Mon, 15 Aug 2022 12:58:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 74949B8106C; Mon, 15 Aug 2022 19:58:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBD0BC433D6; Mon, 15 Aug 2022 19:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593535; bh=rBDcUaW6y7qrMZnKzZg6t/2s8g0030ERifBQbxVCGxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OwEt1Xizz9iXLrVdSidGlHqNbza59LgpGuKoF7aoJ2bKZ/2+9bkUGcEvCiFDCV36K +/bH9UEuUH7YlSHkulcgeUfE6udt5y5AyjOy9JS6uhVaLDM+rnxYQh1dhPW3+cx+MI mUwc2Nmvoi99S8obZFOzHU7kRjzxu6emjUKR1Qp0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.18 0964/1095] scsi: qla2xxx: Fix crash due to stale SRB access around I/O timeouts Date: Mon, 15 Aug 2022 20:06:03 +0200 Message-Id: <20220815180508.951928519@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arun Easi commit c39587bc0abaf16593f7abcdf8aeec3c038c7d52 upstream. Ensure SRB is returned during I/O timeout error escalation. If that is not possible fail the escalation path. Following crash stack was seen: BUG: unable to handle kernel paging request at 0000002f56aa90f8 IP: qla_chk_edif_rx_sa_delete_pending+0x14/0x30 [qla2xxx] Call Trace: ? qla2x00_status_entry+0x19f/0x1c50 [qla2xxx] ? qla2x00_start_sp+0x116/0x1170 [qla2xxx] ? dma_pool_alloc+0x1d6/0x210 ? mempool_alloc+0x54/0x130 ? qla24xx_process_response_queue+0x548/0x12b0 [qla2xxx] ? qla_do_work+0x2d/0x40 [qla2xxx] ? process_one_work+0x14c/0x390 Link: https://lore.kernel.org/r/20220616053508.27186-6-njavali@marvell.com Fixes: d74595278f4a ("scsi: qla2xxx: Add multiple queue pair functionality.= ") Cc: stable@vger.kernel.org Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_os.c | 43 ++++++++++++++++++++++++++++++-------= ----- 1 file changed, 31 insertions(+), 12 deletions(-) --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -1337,21 +1337,20 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) /* * Returns: QLA_SUCCESS or QLA_FUNCTION_FAILED. */ -int -qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t, - uint64_t l, enum nexus_wait_type type) +static int +__qla2x00_eh_wait_for_pending_commands(struct qla_qpair *qpair, unsigned i= nt t, + uint64_t l, enum nexus_wait_type type) { int cnt, match, status; unsigned long flags; - struct qla_hw_data *ha =3D vha->hw; - struct req_que *req; + scsi_qla_host_t *vha =3D qpair->vha; + struct req_que *req =3D qpair->req; srb_t *sp; struct scsi_cmnd *cmd; =20 status =3D QLA_SUCCESS; =20 - spin_lock_irqsave(&ha->hardware_lock, flags); - req =3D vha->req; + spin_lock_irqsave(qpair->qp_lock_ptr, flags); for (cnt =3D 1; status =3D=3D QLA_SUCCESS && cnt < req->num_outstanding_cmds; cnt++) { sp =3D req->outstanding_cmds[cnt]; @@ -1378,12 +1377,32 @@ qla2x00_eh_wait_for_pending_commands(scs if (!match) continue; =20 - spin_unlock_irqrestore(&ha->hardware_lock, flags); + spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); status =3D qla2x00_eh_wait_on_command(cmd); - spin_lock_irqsave(&ha->hardware_lock, flags); + spin_lock_irqsave(qpair->qp_lock_ptr, flags); } - spin_unlock_irqrestore(&ha->hardware_lock, flags); + spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); + + return status; +} + +int +qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t, + uint64_t l, enum nexus_wait_type type) +{ + struct qla_qpair *qpair; + struct qla_hw_data *ha =3D vha->hw; + int i, status =3D QLA_SUCCESS; =20 + status =3D __qla2x00_eh_wait_for_pending_commands(ha->base_qpair, t, l, + type); + for (i =3D 0; status =3D=3D QLA_SUCCESS && i < ha->max_qpairs; i++) { + qpair =3D ha->queue_pair_map[i]; + if (!qpair) + continue; + status =3D __qla2x00_eh_wait_for_pending_commands(qpair, t, l, + type); + } return status; } =20 @@ -1420,7 +1439,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd return err; =20 if (fcport->deleted) - return SUCCESS; + return FAILED; =20 ql_log(ql_log_info, vha, 0x8009, "DEVICE RESET ISSUED nexus=3D%ld:%d:%llu cmd=3D%p.\n", vha->host_no, @@ -1488,7 +1507,7 @@ qla2xxx_eh_target_reset(struct scsi_cmnd return err; =20 if (fcport->deleted) - return SUCCESS; + return FAILED; =20 ql_log(ql_log_info, vha, 0x8009, "TARGET RESET ISSUED nexus=3D%ld:%d cmd=3D%p.\n", vha->host_no, From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8530C00140 for ; Mon, 15 Aug 2022 23:08:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244959AbiHOXIp (ORCPT ); Mon, 15 Aug 2022 19:08:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353036AbiHOXG7 (ORCPT ); Mon, 15 Aug 2022 19:06:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCFBA86715; Mon, 15 Aug 2022 12:59:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 293C961295; Mon, 15 Aug 2022 19:59:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B284C433C1; Mon, 15 Aug 2022 19:59:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593544; bh=9xf/wJIL8Fjz7AVda5uQ/KOzGGQUM6Oll1SGbX8WFT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K/tXCsvAzMVV/d8NkfeHdRnBkVIG8EnnE56qffzsSAaoaIQS8kd8yZu+4YXScsfzX uxLHZmy4uwVuH5eEmw7o2D7g2dJJ+uQWgmTcBzWISrShdB15qT4VDAKrw8HgQaP+ug 5aR08jrJ0St4WWvuuKRSwnR/vg6DJkzYl4hcjd5E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.18 0965/1095] scsi: qla2xxx: Fix excessive I/O error messages by default Date: Mon, 15 Aug 2022 20:06:04 +0200 Message-Id: <20220815180508.991562714@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arun Easi commit bff4873c709085e09d0ffae0c25b8e65256e3205 upstream. Disable printing I/O error messages by default. The messages will be printed only when logging was enabled. Link: https://lore.kernel.org/r/20220616053508.27186-2-njavali@marvell.com Fixes: 8e2d81c6b5be ("scsi: qla2xxx: Fix excessive messages during device l= ogout") Cc: stable@vger.kernel.org Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_isr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -2637,7 +2637,7 @@ static void qla24xx_nvme_iocb_entry(scsi } =20 if (unlikely(logit)) - ql_log(ql_dbg_io, fcport->vha, 0x5060, + ql_dbg(ql_dbg_io, fcport->vha, 0x5060, "NVME-%s ERR Handling - hdl=3D%x status(%x) tr_len:%x resid=3D%x ox_= id=3D%x\n", sp->name, sp->handle, comp_status, fd->transferred_length, le32_to_cpu(sts->residual_len), @@ -3495,7 +3495,7 @@ check_scsi_status: =20 out: if (logit) - ql_log(ql_dbg_io, fcport->vha, 0x3022, + ql_dbg(ql_dbg_io, fcport->vha, 0x3022, "FCP command status: 0x%x-0x%x (0x%x) nexus=3D%ld:%d:%llu portid= =3D%02x%02x%02x oxid=3D0x%x cdb=3D%10phN len=3D0x%x rsp_info=3D0x%x resid= =3D0x%x fw_resid=3D0x%x sp=3D%p cp=3D%p.\n", comp_status, scsi_status, res, vha->host_no, cp->device->id, cp->device->lun, fcport->d_id.b.domain, From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C6ABC00140 for ; Mon, 15 Aug 2022 23:08:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343635AbiHOXIy (ORCPT ); Mon, 15 Aug 2022 19:08:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353083AbiHOXHJ (ORCPT ); Mon, 15 Aug 2022 19:07:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1CBF8673D; Mon, 15 Aug 2022 12:59:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 87D85B8106C; Mon, 15 Aug 2022 19:59:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEB1CC433C1; Mon, 15 Aug 2022 19:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593550; bh=BWkT5Y8yauvayeEYP3032GkgL1q2sJJNLjErP6LavCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BbmXzpjZ3bh4RKIKORzz6Zpefb1mjbq+zaa+Jqn4F1luElxfuiEta7dFnuAsfFWog f83k2N6x/5QlSDrlZo4UIb8rVeEAaIRHjKZ0zalKzvM2omEwzfNh10PvrVFcDc0x/e 27Ojq5xKKHW15audNXmpnHuEnCDSjHWAbUPKsE2Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naresh Bannoth , Kyle Mahlkuch , Quinn Tran , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.18 0966/1095] scsi: qla2xxx: Fix erroneous mailbox timeout after PCI error injection Date: Mon, 15 Aug 2022 20:06:05 +0200 Message-Id: <20220815180509.032325981@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran commit f260694e6463b63ae550aad25ddefe94cb1904da upstream. Clear wait for mailbox interrupt flag to prevent stale mailbox: Feb 22 05:22:56 ltcden4-lp7 kernel: qla2xxx [0135:90:00.1]-500a:4: LOOP UP = detected (16 Gbps). Feb 22 05:22:59 ltcden4-lp7 kernel: qla2xxx [0135:90:00.1]-d04c:4: MBX Comm= and timeout for cmd 69, ... To fix the issue, driver needs to clear the MBX_INTR_WAIT flag on purging the mailbox. When the stale mailbox completion does arrive, it will be dropped. Link: https://lore.kernel.org/r/20220616053508.27186-11-njavali@marvell.com Fixes: b6faaaf796d7 ("scsi: qla2xxx: Serialize mailbox request") Cc: Naresh Bannoth Cc: Kyle Mahlkuch Cc: stable@vger.kernel.org Reported-by: Naresh Bannoth Tested-by: Naresh Bannoth Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_mbx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -276,6 +276,12 @@ qla2x00_mailbox_command(scsi_qla_host_t atomic_inc(&ha->num_pend_mbx_stage3); if (!wait_for_completion_timeout(&ha->mbx_intr_comp, mcp->tov * HZ)) { + ql_dbg(ql_dbg_mbx, vha, 0x117a, + "cmd=3D%x Timeout.\n", command); + spin_lock_irqsave(&ha->hardware_lock, flags); + clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); + spin_unlock_irqrestore(&ha->hardware_lock, flags); + if (chip_reset !=3D ha->chip_reset) { eeh_delay =3D ha->flags.eeh_busy ? 1 : 0; =20 @@ -288,12 +294,6 @@ qla2x00_mailbox_command(scsi_qla_host_t rval =3D QLA_ABORTED; goto premature_exit; } - ql_dbg(ql_dbg_mbx, vha, 0x117a, - "cmd=3D%x Timeout.\n", command); - spin_lock_irqsave(&ha->hardware_lock, flags); - clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); - spin_unlock_irqrestore(&ha->hardware_lock, flags); - } else if (ha->flags.purge_mbox || chip_reset !=3D ha->chip_reset) { eeh_delay =3D ha->flags.eeh_busy ? 1 : 0; From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46B70C00140 for ; Mon, 15 Aug 2022 23:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352839AbiHOXJF (ORCPT ); Mon, 15 Aug 2022 19:09:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353131AbiHOXHP (ORCPT ); Mon, 15 Aug 2022 19:07:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEFDF1423DD; Mon, 15 Aug 2022 12:59:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7AD4DB8113E; Mon, 15 Aug 2022 19:59:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF389C433C1; Mon, 15 Aug 2022 19:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593556; bh=AO/atSuiRUhw9FDPKtlJLDzo6dX4EqskW1e8asz4lBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B00r1SdVT/dh06ypB6s6GULcJwwMDO98dZVduTopFu9PScN5gSYALIK0+pKFUHNS6 GY8FCJYZSlf7TqEZ9TgXwsrpldVy2CNQOpTiJK6gQAoMnEL2a8s0H1ewfRuC9eiw7r Q3jwTVehfyRTnjdZxFOwnP/pV1p0EH5krb1lJnh8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.18 0967/1095] scsi: qla2xxx: Wind down adapter after PCIe error Date: Mon, 15 Aug 2022 20:06:06 +0200 Message-Id: <20220815180509.072615781@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran commit d3117c83ba316b3200d9f2fe900f2b9a5525a25c upstream. Put adapter into a wind down state if OS does not make any attempt to recover the adapter after PCIe error. Link: https://lore.kernel.org/r/20220616053508.27186-4-njavali@marvell.com Cc: stable@vger.kernel.org Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_bsg.c | 10 +++++++- drivers/scsi/qla2xxx/qla_def.h | 4 +++ drivers/scsi/qla2xxx/qla_init.c | 20 ++++++++++++++++ drivers/scsi/qla2xxx/qla_os.c | 48 +++++++++++++++++++++++++++++++++++= +++++ 4 files changed, 81 insertions(+), 1 deletion(-) --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c @@ -2975,6 +2975,13 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_ =20 ql_log(ql_log_info, vha, 0x708b, "%s CMD timeout. bsg ptr %p.\n", __func__, bsg_job); + + if (qla2x00_isp_reg_stat(ha)) { + ql_log(ql_log_info, vha, 0x9007, + "PCI/Register disconnect.\n"); + qla_pci_set_eeh_busy(vha); + } + /* find the bsg job from the active list of commands */ spin_lock_irqsave(&ha->hardware_lock, flags); for (que =3D 0; que < ha->max_req_queues; que++) { @@ -2992,7 +2999,8 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_ sp->u.bsg_job =3D=3D bsg_job) { req->outstanding_cmds[cnt] =3D NULL; spin_unlock_irqrestore(&ha->hardware_lock, flags); - if (ha->isp_ops->abort_command(sp)) { + + if (!ha->flags.eeh_busy && ha->isp_ops->abort_command(sp)) { ql_log(ql_log_warn, vha, 0x7089, "mbx abort_command failed.\n"); bsg_reply->result =3D -EIO; --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -4048,6 +4048,9 @@ struct qla_hw_data { uint32_t n2n_fw_acc_sec:1; uint32_t plogi_template_valid:1; uint32_t port_isolated:1; + uint32_t eeh_flush:2; +#define EEH_FLUSH_RDY 1 +#define EEH_FLUSH_DONE 2 } flags; =20 uint16_t max_exchg; @@ -4082,6 +4085,7 @@ struct qla_hw_data { uint32_t rsp_que_len; uint32_t req_que_off; uint32_t rsp_que_off; + unsigned long eeh_jif; =20 /* Multi queue data structs */ device_reg_t *mqiobase; --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -47,6 +47,7 @@ qla2x00_sp_timeout(struct timer_list *t) { srb_t *sp =3D from_timer(sp, t, u.iocb_cmd.timer); struct srb_iocb *iocb; + scsi_qla_host_t *vha =3D sp->vha; =20 WARN_ON(irqs_disabled()); iocb =3D &sp->u.iocb_cmd; @@ -54,6 +55,12 @@ qla2x00_sp_timeout(struct timer_list *t) =20 /* ref: TMR */ kref_put(&sp->cmd_kref, qla2x00_sp_release); + + if (vha && qla2x00_isp_reg_stat(vha->hw)) { + ql_log(ql_log_info, vha, 0x9008, + "PCI/Register disconnect.\n"); + qla_pci_set_eeh_busy(vha); + } } =20 void qla2x00_sp_free(srb_t *sp) @@ -9702,6 +9709,12 @@ int qla2xxx_disable_port(struct Scsi_Hos =20 vha->hw->flags.port_isolated =3D 1; =20 + if (qla2x00_isp_reg_stat(vha->hw)) { + ql_log(ql_log_info, vha, 0x9006, + "PCI/Register disconnect, exiting.\n"); + qla_pci_set_eeh_busy(vha); + return FAILED; + } if (qla2x00_chip_is_down(vha)) return 0; =20 @@ -9717,6 +9730,13 @@ int qla2xxx_enable_port(struct Scsi_Host { scsi_qla_host_t *vha =3D shost_priv(host); =20 + if (qla2x00_isp_reg_stat(vha->hw)) { + ql_log(ql_log_info, vha, 0x9001, + "PCI/Register disconnect, exiting.\n"); + qla_pci_set_eeh_busy(vha); + return FAILED; + } + vha->hw->flags.port_isolated =3D 0; /* Set the flag to 1, so that isp_abort can proceed */ vha->flags.online =3D 1; --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -333,6 +333,11 @@ MODULE_PARM_DESC(ql2xabts_wait_nvme, "To wait for ABTS response on I/O timeouts for NVMe. (default: 1)"); =20 =20 +u32 ql2xdelay_before_pci_error_handling =3D 5; +module_param(ql2xdelay_before_pci_error_handling, uint, 0644); +MODULE_PARM_DESC(ql2xdelay_before_pci_error_handling, + "Number of seconds delayed before qla begin PCI error self-handling (defa= ult: 5).\n"); + static void qla2x00_clear_drv_active(struct qla_hw_data *); static void qla2x00_free_device(scsi_qla_host_t *); static int qla2xxx_map_queues(struct Scsi_Host *shost); @@ -7258,6 +7263,44 @@ static void qla_heart_beat(struct scsi_q } } =20 +static void qla_wind_down_chip(scsi_qla_host_t *vha) +{ + struct qla_hw_data *ha =3D vha->hw; + + if (!ha->flags.eeh_busy) + return; + if (ha->pci_error_state) + /* system is trying to recover */ + return; + + /* + * Current system is not handling PCIE error. At this point, this is + * best effort to wind down the adapter. + */ + if (time_after_eq(jiffies, ha->eeh_jif + ql2xdelay_before_pci_error_handl= ing * HZ) && + !ha->flags.eeh_flush) { + ql_log(ql_log_info, vha, 0x9009, + "PCI Error detected, attempting to reset hardware.\n"); + + ha->isp_ops->reset_chip(vha); + ha->isp_ops->disable_intrs(ha); + + ha->flags.eeh_flush =3D EEH_FLUSH_RDY; + ha->eeh_jif =3D jiffies; + + } else if (ha->flags.eeh_flush =3D=3D EEH_FLUSH_RDY && + time_after_eq(jiffies, ha->eeh_jif + 5 * HZ)) { + pci_clear_master(ha->pdev); + + /* flush all command */ + qla2x00_abort_isp_cleanup(vha); + ha->flags.eeh_flush =3D EEH_FLUSH_DONE; + + ql_log(ql_log_info, vha, 0x900a, + "PCI Error handling complete, all IOs aborted.\n"); + } +} + /************************************************************************** * qla2x00_timer * @@ -7281,6 +7324,8 @@ qla2x00_timer(struct timer_list *t) fc_port_t *fcport =3D NULL; =20 if (ha->flags.eeh_busy) { + qla_wind_down_chip(vha); + ql_dbg(ql_dbg_timer, vha, 0x6000, "EEH =3D %d, restarting timer.\n", ha->flags.eeh_busy); @@ -7861,6 +7906,9 @@ void qla_pci_set_eeh_busy(struct scsi_ql =20 spin_lock_irqsave(&base_vha->work_lock, flags); if (!ha->flags.eeh_busy) { + ha->eeh_jif =3D jiffies; + ha->flags.eeh_flush =3D 0; + ha->flags.eeh_busy =3D 1; do_cleanup =3D true; } From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 205CAC00140 for ; Mon, 15 Aug 2022 23:09:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347991AbiHOXJe (ORCPT ); Mon, 15 Aug 2022 19:09:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353169AbiHOXHU (ORCPT ); Mon, 15 Aug 2022 19:07:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08846792C9; Mon, 15 Aug 2022 12:59:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6144AB80EAD; Mon, 15 Aug 2022 19:59:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4142C433D6; Mon, 15 Aug 2022 19:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593562; bh=ckpDEeEgJ/UECDM9viJTkM7Sj1003rU4VIiNM4CXKbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m51cPvfh2mK9aAyYJkd4qTCFujqWmfgdzBrPzHBKRV/NwCqnXCdBG//Qm3PZoPfVl ZptxR5aWBXvRhOG37SnBBqRU8XQgR/8Ovm02XKmNUQ02XWe+KrVCFO2C9ywWKbt35Q Wa4o7tdDKr2J6WeqYkAiWiz3DqC8FgllB6nffbmg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.18 0968/1095] scsi: qla2xxx: Fix losing FCP-2 targets on long port disable with I/Os Date: Mon, 15 Aug 2022 20:06:07 +0200 Message-Id: <20220815180509.109325954@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arun Easi commit 2416ccd3815ba1613e10a6da0a24ef21acfe5633 upstream. FCP-2 devices were not coming back online once they were lost, login retries exhausted, and then came back up. Fix this by accepting RSCN when the device is not online. Link: https://lore.kernel.org/r/20220616053508.27186-10-njavali@marvell.com Fixes: 44c57f205876 ("scsi: qla2xxx: Changes to support FCP2 Target") Cc: stable@vger.kernel.org Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_init.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -1834,7 +1834,8 @@ void qla2x00_handle_rscn(scsi_qla_host_t case RSCN_PORT_ADDR: fcport =3D qla2x00_find_fcport_by_nportid(vha, &ea->id, 1); if (fcport) { - if (fcport->flags & FCF_FCP2_DEVICE) { + if (fcport->flags & FCF_FCP2_DEVICE && + atomic_read(&fcport->state) =3D=3D FCS_ONLINE) { ql_dbg(ql_dbg_disc, vha, 0x2115, "Delaying session delete for FCP2 portid=3D%06x %8phC ", fcport->d_id.b24, fcport->port_name); @@ -1866,7 +1867,8 @@ void qla2x00_handle_rscn(scsi_qla_host_t break; case RSCN_AREA_ADDR: list_for_each_entry(fcport, &vha->vp_fcports, list) { - if (fcport->flags & FCF_FCP2_DEVICE) + if (fcport->flags & FCF_FCP2_DEVICE && + atomic_read(&fcport->state) =3D=3D FCS_ONLINE) continue; =20 if ((ea->id.b24 & 0xffff00) =3D=3D (fcport->d_id.b24 & 0xffff00)) { @@ -1877,7 +1879,8 @@ void qla2x00_handle_rscn(scsi_qla_host_t break; case RSCN_DOM_ADDR: list_for_each_entry(fcport, &vha->vp_fcports, list) { - if (fcport->flags & FCF_FCP2_DEVICE) + if (fcport->flags & FCF_FCP2_DEVICE && + atomic_read(&fcport->state) =3D=3D FCS_ONLINE) continue; =20 if ((ea->id.b24 & 0xff0000) =3D=3D (fcport->d_id.b24 & 0xff0000)) { @@ -1889,7 +1892,8 @@ void qla2x00_handle_rscn(scsi_qla_host_t case RSCN_FAB_ADDR: default: list_for_each_entry(fcport, &vha->vp_fcports, list) { - if (fcport->flags & FCF_FCP2_DEVICE) + if (fcport->flags & FCF_FCP2_DEVICE && + atomic_read(&fcport->state) =3D=3D FCS_ONLINE) continue; =20 fcport->scan_needed =3D 1; From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EBAFC00140 for ; Mon, 15 Aug 2022 23:09:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243555AbiHOXJz (ORCPT ); Mon, 15 Aug 2022 19:09:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353231AbiHOXHa (ORCPT ); Mon, 15 Aug 2022 19:07:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64C82250; Mon, 15 Aug 2022 12:59:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 600A7B80EB1; Mon, 15 Aug 2022 19:59:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACA4DC433C1; Mon, 15 Aug 2022 19:59:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593568; bh=/SbU5TgNUUjW574cJkQIC7C8/S1kgwxyehokC/ht1GA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xd6mCglr8NfET1J3hauQ7mqfVUpQpCvKScElygYo7xqFpBKqFlIUrJzKaMMy0Ou6c 7YTGXshh1Cc0qDPGeHHSQ7G7QxZZTct4BF5WwM8L/lgsmWkFzqHkC9Du00lyR6pjjq 3Aa7YAw9Lrn+ArBMyaO/rkgyFpmRm7bkvoYzrT14= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.18 0969/1095] scsi: qla2xxx: Fix losing target when it reappears during delete Date: Mon, 15 Aug 2022 20:06:08 +0200 Message-Id: <20220815180509.144944018@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arun Easi commit 118b0c863c8f5629cc5271fc24d72d926e0715d9 upstream. FC target disappeared during port perturbation tests due to a race that tramples target state. Fix the issue by adding state checks before proceeding. Link: https://lore.kernel.org/r/20220616053508.27186-8-njavali@marvell.com Fixes: 44c57f205876 ("scsi: qla2xxx: Changes to support FCP2 Target") Cc: stable@vger.kernel.org Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_attr.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -2716,17 +2716,24 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rp if (!fcport) return; =20 - /* Now that the rport has been deleted, set the fcport state to - FCS_DEVICE_DEAD */ - qla2x00_set_fcport_state(fcport, FCS_DEVICE_DEAD); + + /* + * Now that the rport has been deleted, set the fcport state to + * FCS_DEVICE_DEAD, if the fcport is still lost. + */ + if (fcport->scan_state !=3D QLA_FCPORT_FOUND) + qla2x00_set_fcport_state(fcport, FCS_DEVICE_DEAD); =20 /* * Transport has effectively 'deleted' the rport, clear * all local references. */ spin_lock_irqsave(host->host_lock, flags); - fcport->rport =3D fcport->drport =3D NULL; - *((fc_port_t **)rport->dd_data) =3D NULL; + /* Confirm port has not reappeared before clearing pointers. */ + if (rport->port_state !=3D FC_PORTSTATE_ONLINE) { + fcport->rport =3D fcport->drport =3D NULL; + *((fc_port_t **)rport->dd_data) =3D NULL; + } spin_unlock_irqrestore(host->host_lock, flags); =20 if (test_bit(ABORT_ISP_ACTIVE, &fcport->vha->dpc_flags)) @@ -2759,9 +2766,12 @@ qla2x00_terminate_rport_io(struct fc_rpo /* * At this point all fcport's software-states are cleared. Perform any * final cleanup of firmware resources (PCBs and XCBs). + * + * Attempt to cleanup only lost devices. */ if (fcport->loop_id !=3D FC_NO_LOOP_ID) { - if (IS_FWI2_CAPABLE(fcport->vha->hw)) { + if (IS_FWI2_CAPABLE(fcport->vha->hw) && + fcport->scan_state !=3D QLA_FCPORT_FOUND) { if (fcport->loop_id !=3D FC_NO_LOOP_ID) fcport->logout_on_delete =3D 1; =20 @@ -2771,7 +2781,7 @@ qla2x00_terminate_rport_io(struct fc_rpo __LINE__); qlt_schedule_sess_for_deletion(fcport); } - } else { + } else if (!IS_FWI2_CAPABLE(fcport->vha->hw)) { qla2x00_port_logout(fcport->vha, fcport); } } From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1EA2C00140 for ; Mon, 15 Aug 2022 23:10:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243854AbiHOXKM (ORCPT ); Mon, 15 Aug 2022 19:10:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353264AbiHOXHf (ORCPT ); Mon, 15 Aug 2022 19:07:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D6781436CE; Mon, 15 Aug 2022 12:59:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DB8BDB81154; Mon, 15 Aug 2022 19:59:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BE0BC43142; Mon, 15 Aug 2022 19:59:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593576; bh=XSZt3y04SiP8tLE10pIGsc79AdnnvDgeIIf2BR6p02M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2KOAbyXOz00bCj/jmzbcrXNIn3CcSTcCu+uE1NzTN/zUuC/i/tibGcXG30bl8KYYu NpjBC6prEU272hToAMq9MAarmdzM35ydUUiKbE6l1XCam8DT2/wGN0ttMQQDPL31IG 3UCgwnSLxeoZgemVK99hDIN3vNXdczuz9RuCoftM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.18 0970/1095] scsi: qla2xxx: Fix losing FCP-2 targets during port perturbation tests Date: Mon, 15 Aug 2022 20:06:09 +0200 Message-Id: <20220815180509.193243814@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arun Easi commit 58d1c124cd79ea686b512043c5bd515590b2ed95 upstream. When a mix of FCP-2 (tape) and non-FCP-2 targets are present, FCP-2 target state was incorrectly transitioned when both of the targets were gone. Fix this by ignoring state transition for FCP-2 targets. Link: https://lore.kernel.org/r/20220616053508.27186-7-njavali@marvell.com Fixes: 44c57f205876 ("scsi: qla2xxx: Changes to support FCP2 Target") Cc: stable@vger.kernel.org Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_gs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3629,7 +3629,7 @@ login_logout: do_delete) { if (fcport->loop_id !=3D FC_NO_LOOP_ID) { if (fcport->flags & FCF_FCP2_DEVICE) - fcport->logout_on_delete =3D 0; + continue; =20 ql_log(ql_log_warn, vha, 0x20f0, "%s %d %8phC post del sess\n", From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30211C00140 for ; Mon, 15 Aug 2022 23:10:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346515AbiHOXKU (ORCPT ); Mon, 15 Aug 2022 19:10:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244999AbiHOXIK (ORCPT ); Mon, 15 Aug 2022 19:08:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13DD278BCB; Mon, 15 Aug 2022 12:59:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 87A31B80EB1; Mon, 15 Aug 2022 19:59:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF05EC433C1; Mon, 15 Aug 2022 19:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593582; bh=IKiFqsVBpkSCn9+EeYNF1YPmUb0OiOAXXHU+8G+n66w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=omZMT/fnLrno4CqjH8qzCr5u7gxcUaVHKkzCDZ0pXk5M4GM7bzRK37cazlVm6bTu8 1HI5zaBwbGzfH+hmgV5nc/eZygWRl2AU14EKSfEhaHnKvKv0UwImntpgkd5s7IVaWw wKFuKCR1ujXw0EXGbLtDWvFSa3iNpygCo3JigLcg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kim Phillips , Borislav Petkov Subject: [PATCH 5.18 0971/1095] x86/bugs: Enable STIBP for IBPB mitigated RETBleed Date: Mon, 15 Aug 2022 20:06:10 +0200 Message-Id: <20220815180509.232916030@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kim Phillips commit e6cfcdda8cbe81eaf821c897369a65fec987b404 upstream. AMD's "Technical Guidance for Mitigating Branch Type Confusion, Rev. 1.0 2022-07-12" whitepaper, under section 6.1.2 "IBPB On Privileged Mode Entry / SMT Safety" says: Similar to the Jmp2Ret mitigation, if the code on the sibling thread cannot be trusted, software should set STIBP to 1 or disable SMT to ensure SMT safety when using this mitigation. So, like already being done for retbleed=3Dunret, and now also for retbleed=3Dibpb, force STIBP on machines that have it, and report its SMT vulnerability status accordingly. [ bp: Remove the "we" and remove "[AMD]" applicability parameter which doesn't work here. ] Fixes: 3ebc17006888 ("x86/bugs: Add retbleed=3Dibpb") Signed-off-by: Kim Phillips Signed-off-by: Borislav Petkov Cc: stable@vger.kernel.org # 5.10, 5.15, 5.19 Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D206537 Link: https://lore.kernel.org/r/20220804192201.439596-1-kim.phillips@amd.com Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- Documentation/admin-guide/kernel-parameters.txt | 29 +++++++++++++++++--= ----- arch/x86/kernel/cpu/bugs.c | 10 ++++---- 2 files changed, 27 insertions(+), 12 deletions(-) --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -5130,20 +5130,33 @@ Speculative Code Execution with Return Instructions) vulnerability. =20 + AMD-based UNRET and IBPB mitigations alone do not stop + sibling threads from influencing the predictions of other + sibling threads. For that reason, STIBP is used on pro- + cessors that support it, and mitigate SMT on processors + that don't. + off - no mitigation auto - automatically select a migitation auto,nosmt - automatically select a mitigation, disabling SMT if necessary for the full mitigation (only on Zen1 and older without STIBP). - ibpb - mitigate short speculation windows on - basic block boundaries too. Safe, highest - perf impact. - unret - force enable untrained return thunks, - only effective on AMD f15h-f17h - based systems. - unret,nosmt - like unret, will disable SMT when STIBP - is not available. + ibpb - On AMD, mitigate short speculation + windows on basic block boundaries too. + Safe, highest perf impact. It also + enables STIBP if present. Not suitable + on Intel. + ibpb,nosmt - Like "ibpb" above but will disable SMT + when STIBP is not available. This is + the alternative for systems which do not + have STIBP. + unret - Force enable untrained return thunks, + only effective on AMD f15h-f17h based + systems. + unret,nosmt - Like unret, but will disable SMT when STIBP + is not available. This is the alternative for + systems which do not have STIBP. =20 Selecting 'auto' will choose a mitigation method at run time according to the CPU. --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -152,7 +152,7 @@ void __init check_bugs(void) /* * spectre_v2_user_select_mitigation() relies on the state set by * retbleed_select_mitigation(); specifically the STIBP selection is - * forced for UNRET. + * forced for UNRET or IBPB. */ spectre_v2_user_select_mitigation(); ssb_select_mitigation(); @@ -1172,7 +1172,8 @@ spectre_v2_user_select_mitigation(void) boot_cpu_has(X86_FEATURE_AMD_STIBP_ALWAYS_ON)) mode =3D SPECTRE_V2_USER_STRICT_PREFERRED; =20 - if (retbleed_mitigation =3D=3D RETBLEED_MITIGATION_UNRET) { + if (retbleed_mitigation =3D=3D RETBLEED_MITIGATION_UNRET || + retbleed_mitigation =3D=3D RETBLEED_MITIGATION_IBPB) { if (mode !=3D SPECTRE_V2_USER_STRICT && mode !=3D SPECTRE_V2_USER_STRICT_PREFERRED) pr_info("Selecting STIBP always-on mode to complement retbleed mitigati= on\n"); @@ -2353,10 +2354,11 @@ static ssize_t srbds_show_state(char *bu =20 static ssize_t retbleed_show_state(char *buf) { - if (retbleed_mitigation =3D=3D RETBLEED_MITIGATION_UNRET) { + if (retbleed_mitigation =3D=3D RETBLEED_MITIGATION_UNRET || + retbleed_mitigation =3D=3D RETBLEED_MITIGATION_IBPB) { if (boot_cpu_data.x86_vendor !=3D X86_VENDOR_AMD && boot_cpu_data.x86_vendor !=3D X86_VENDOR_HYGON) - return sprintf(buf, "Vulnerable: untrained return thunk on non-Zen u= arch\n"); + return sprintf(buf, "Vulnerable: untrained return thunk / IBPB on no= n-AMD based uarch\n"); =20 return sprintf(buf, "%s; SMT %s\n", retbleed_strings[retbleed_mitigation], From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6365DC00140 for ; Mon, 15 Aug 2022 23:11:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243165AbiHOXLh (ORCPT ); Mon, 15 Aug 2022 19:11:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352822AbiHOXI7 (ORCPT ); Mon, 15 Aug 2022 19:08:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9CDC8708C; Mon, 15 Aug 2022 12:59:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 92DBEB80EAD; Mon, 15 Aug 2022 19:59:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D92BBC433D7; Mon, 15 Aug 2022 19:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593589; bh=pA8ISevhUsGe/p5+9L1xkYfUhHfjRk8HP8uS3OlHxrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vhDjpzW/7I5qgbLnHapEpnN/MO1OgVH7qUwQeoexwGg8zIT52puU0iqm36WpxYVO9 +RVYpIztISdBAzL/9oHjCi/42JRDYF0GOUe64kqMWkbiQhJWU5GIaY68499SJ1O7Tg irvb6VI7bwoaWyKCvVeundAHmeu/jp7Mw8AehS68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "x86@kernel.org" , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Andrew Morton , "Steven Rostedt (Google)" Subject: [PATCH 5.18 0972/1095] ftrace/x86: Add back ftrace_expected assignment Date: Mon, 15 Aug 2022 20:06:11 +0200 Message-Id: <20220815180509.279790937@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) commit ac6c1b2ca77e722a1e5d651f12f437f2f237e658 upstream. When a ftrace_bug happens (where ftrace fails to modify a location) it is helpful to have what was at that location as well as what was expected to be there. But with the conversion to text_poke() the variable that assigns the expected for debugging was dropped. Unfortunately, I noticed this when I needed it. Add it back. Link: https://lkml.kernel.org/r/20220726101851.069d2e70@gandalf.local.home Cc: "x86@kernel.org" Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: Andrew Morton Cc: stable@vger.kernel.org Fixes: 768ae4406a5c ("x86/ftrace: Use text_poke()") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kernel/ftrace.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c @@ -93,6 +93,7 @@ static int ftrace_verify_code(unsigned l =20 /* Make sure it is what we expect it to be */ if (memcmp(cur_code, old_code, MCOUNT_INSN_SIZE) !=3D 0) { + ftrace_expected =3D old_code; WARN_ON(1); return -EINVAL; } From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDE3BC00140 for ; Mon, 15 Aug 2022 23:11:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344361AbiHOXLr (ORCPT ); Mon, 15 Aug 2022 19:11:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345864AbiHOXKJ (ORCPT ); Mon, 15 Aug 2022 19:10:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10F74870AE; Mon, 15 Aug 2022 12:59:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EF93061299; Mon, 15 Aug 2022 19:59:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00E9EC433D7; Mon, 15 Aug 2022 19:59:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593595; bh=ufwO8vqLDDu71bVtWRi8o3m8JUyw8NsgBLtUn+/druI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hUpRlrWAHORJJNauTBMIcUWzRhARgnSNnLWSXgveEaBzH6FyffpcI2WS4BE/c7qRL NiuuqN0H9Z1MJOFeUjgw2Re73ktcMt3fhbp/dfg3JnKBV3Z8t+eModbidrXMJ/5zeF 8MpPT+WSLu3SAslPmWziQdQkH6K2JdhrvB6S/K8E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Daniel=20M=C3=BCller?= , "Masami Hiramatsu (Google)" , Ingo Molnar Subject: [PATCH 5.18 0973/1095] x86/kprobes: Update kcb status flag after singlestepping Date: Mon, 15 Aug 2022 20:06:12 +0200 Message-Id: <20220815180509.331090424@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masami Hiramatsu (Google) commit dec8784c9088b131a1523f582c2194cfc8107dc0 upstream. Fix kprobes to update kcb (kprobes control block) status flag to KPROBE_HIT_SSDONE even if the kp->post_handler is not set. This bug may cause a kernel panic if another INT3 user runs right after kprobes because kprobe_int3_handler() misunderstands the INT3 is kprobe's single stepping INT3. Fixes: 6256e668b7af ("x86/kprobes: Use int3 instead of debug trap for singl= e-step") Reported-by: Daniel M=C3=BCller Signed-off-by: Masami Hiramatsu (Google) Signed-off-by: Ingo Molnar Tested-by: Daniel M=C3=BCller Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/20220727210136.jjgc3lpqeq42yr3m@muellerd-= fedora-PC2BDTX9 Link: https://lore.kernel.org/r/165942025658.342061.12452378391879093249.st= git@devnote2 Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kernel/kprobes/core.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c @@ -814,16 +814,20 @@ set_current_kprobe(struct kprobe *p, str static void kprobe_post_process(struct kprobe *cur, struct pt_regs *regs, struct kprobe_ctlblk *kcb) { - if ((kcb->kprobe_status !=3D KPROBE_REENTER) && cur->post_handler) { - kcb->kprobe_status =3D KPROBE_HIT_SSDONE; - cur->post_handler(cur, regs, 0); - } - /* Restore back the original saved kprobes variables and continue. */ - if (kcb->kprobe_status =3D=3D KPROBE_REENTER) + if (kcb->kprobe_status =3D=3D KPROBE_REENTER) { + /* This will restore both kcb and current_kprobe */ restore_previous_kprobe(kcb); - else + } else { + /* + * Always update the kcb status because + * reset_curent_kprobe() doesn't update kcb. + */ + kcb->kprobe_status =3D KPROBE_HIT_SSDONE; + if (cur->post_handler) + cur->post_handler(cur, regs, 0); reset_current_kprobe(); + } } NOKPROBE_SYMBOL(kprobe_post_process); =20 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88B3EC00140 for ; Mon, 15 Aug 2022 23:11:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345590AbiHOXL5 (ORCPT ); Mon, 15 Aug 2022 19:11:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353068AbiHOXKr (ORCPT ); Mon, 15 Aug 2022 19:10:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A805379A55; Mon, 15 Aug 2022 13:00:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 275E2B80EA8; Mon, 15 Aug 2022 20:00:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F22EC433C1; Mon, 15 Aug 2022 20:00:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593601; bh=StjgcR6nA87Jhlh+ZwYMvS8/tCMtuZEn7F+G7iUqQg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RujZWniObrL4LjPtnXPjATjxxJsxRZtPMyYZlf0qslmBjIqS1gC144qEt7uFXmRuX oe/4hCFkllsHD24gN5A/0Oxzkj1S6kTRlb0SD7xS1BiIjk4FB3GGn8+bS8mIi73f7w +M5eVlw3rvXOH7ClYxyI4g68xo64SX94GexlMUqQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , kernel test robot , Alexander Lobakin , Yury Norov Subject: [PATCH 5.18 0974/1095] x86/olpc: fix logical not is only applied to the left hand side Date: Mon, 15 Aug 2022 20:06:13 +0200 Message-Id: <20220815180509.382223212@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Lobakin commit 3a2ba42cbd0b669ce3837ba400905f93dd06c79f upstream. The bitops compile-time optimization series revealed one more problem in olpc-xo1-sci.c:send_ebook_state(), resulted in GCC warnings: arch/x86/platform/olpc/olpc-xo1-sci.c: In function 'send_ebook_state': arch/x86/platform/olpc/olpc-xo1-sci.c:83:63: warning: logical not is only a= pplied to the left hand side of comparison [-Wlogical-not-parentheses] 83 | if (!!test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) =3D= =3D state) | ^~ arch/x86/platform/olpc/olpc-xo1-sci.c:83:13: note: add parentheses around l= eft hand side expression to silence this warning Despite this code working as intended, this redundant double negation of boolean value, together with comparing to `char` with no explicit conversion to bool, makes compilers think the author made some unintentional logical mistakes here. Make it the other way around and negate the char instead to silence the warnings. Fixes: d2aa37411b8e ("x86/olpc/xo1/sci: Produce wakeup events for buttons a= nd switches") Cc: stable@vger.kernel.org # 3.5+ Reported-by: Guenter Roeck Reported-by: kernel test robot Reviewed-and-tested-by: Guenter Roeck Signed-off-by: Alexander Lobakin Signed-off-by: Yury Norov Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/platform/olpc/olpc-xo1-sci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/platform/olpc/olpc-xo1-sci.c +++ b/arch/x86/platform/olpc/olpc-xo1-sci.c @@ -80,7 +80,7 @@ static void send_ebook_state(void) return; } =20 - if (!!test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) =3D=3D state) + if (test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) =3D=3D !!state) return; /* Nothing new to report. */ =20 input_report_switch(ebook_switch_idev, SW_TABLET_MODE, state); From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E14BDC00140 for ; Mon, 15 Aug 2022 23:12:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241049AbiHOXMX (ORCPT ); Mon, 15 Aug 2022 19:12:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353247AbiHOXLH (ORCPT ); Mon, 15 Aug 2022 19:11:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05B7779A53; Mon, 15 Aug 2022 13:00:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0A13960FD8; Mon, 15 Aug 2022 20:00:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 067FBC433C1; Mon, 15 Aug 2022 20:00:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593610; bh=AAVDZDfssf5k6rhB/ON9yV403YnrCocT4nm7X9rDlkY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T+wMK3heW7LSt0ms0Dx1HxvItVQIelDNvJRA6OTbZLxg5xBLKqv3BoILqmDxplUPS ma+411kd2ed4wZ85wRDjMG+kJFKz8v2Lf7L+pPDxRBkdaUjyJCGweLOyCwZbvAZsG2 i6I/4Y7SejM/Pn2qjYuNgbJ1KJc5wa31iIdpOJXw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Bharath SM , Steve French Subject: [PATCH 5.18 0975/1095] SMB3: fix lease break timeout when multiple deferred close handles for the same file. Date: Mon, 15 Aug 2022 20:06:14 +0200 Message-Id: <20220815180509.436681728@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bharath SM commit 9e31678fb403eae0f4fe37c6374be098835c73cd upstream. Solution is to send lease break ack immediately even in case of deferred close handles to avoid lease break request timing out and let deferred closed handle gets closed as scheduled. Later patches could optimize cases where we then close some of these handles sooner for the cases where lease break is to 'none' Cc: stable@kernel.org Signed-off-by: Bharath SM Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/cifs/file.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -4807,8 +4807,6 @@ void cifs_oplock_break(struct work_struc struct TCP_Server_Info *server =3D tcon->ses->server; int rc =3D 0; bool purge_cache =3D false; - bool is_deferred =3D false; - struct cifs_deferred_close *dclose; =20 wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS, TASK_UNINTERRUPTIBLE); @@ -4845,22 +4843,6 @@ void cifs_oplock_break(struct work_struc =20 oplock_break_ack: /* - * When oplock break is received and there are no active - * file handles but cached, then schedule deferred close immediately. - * So, new open will not use cached handle. - */ - spin_lock(&CIFS_I(inode)->deferred_lock); - is_deferred =3D cifs_is_deferred_close(cfile, &dclose); - spin_unlock(&CIFS_I(inode)->deferred_lock); - if (is_deferred && - cfile->deferred_close_scheduled && - delayed_work_pending(&cfile->deferred)) { - if (cancel_delayed_work(&cfile->deferred)) { - _cifsFileInfo_put(cfile, false, false); - goto oplock_break_done; - } - } - /* * releasing stale oplock after recent reconnect of smb session using * a now incorrect file handle is not a data integrity issue but do * not bother sending an oplock release if session to server still is @@ -4871,7 +4853,7 @@ oplock_break_ack: cinode); cifs_dbg(FYI, "Oplock release rc =3D %d\n", rc); } -oplock_break_done: + _cifsFileInfo_put(cfile, false /* do not wait for ourself */, false); cifs_done_oplock_break(cinode); } From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C31FC00140 for ; Mon, 15 Aug 2022 23:13:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345958AbiHOXM7 (ORCPT ); Mon, 15 Aug 2022 19:12:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232933AbiHOXLg (ORCPT ); Mon, 15 Aug 2022 19:11:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8542238B3; Mon, 15 Aug 2022 13:00:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 99AEB612B8; Mon, 15 Aug 2022 20:00:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E38AC433C1; Mon, 15 Aug 2022 20:00:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593616; bh=HH4qPGidm0OUya6QXERfAKhEFrdc6+v3zuCV1SJ7ZWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DvLgj34xtBjS79KJcY+X2oBoudgW4Gb+klj5T23u+xCtTyF0dAylqFXJbFO/9x9+g Wvwbbt5fDP5j4Gnw2FD6TNwygRfxb6JyalasyPYBMku91+ii0Kge/U8b257Rsac159 srLLmxvR8NtWNIVbvuLWl0R+jVzz9fgMC970ahpY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thadeu Lima de Souza Cascardo , Thomas Gleixner Subject: [PATCH 5.18 0976/1095] posix-cpu-timers: Cleanup CPU timers before freeing them during exec Date: Mon, 15 Aug 2022 20:06:15 +0200 Message-Id: <20220815180509.486593618@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thadeu Lima de Souza Cascardo commit e362359ace6f87c201531872486ff295df306d13 upstream. Commit 55e8c8eb2c7b ("posix-cpu-timers: Store a reference to a pid not a task") started looking up tasks by PID when deleting a CPU timer. When a non-leader thread calls execve, it will switch PIDs with the leader process. Then, as it calls exit_itimers, posix_cpu_timer_del cannot find the task because the timer still points out to the old PID. That means that armed timers won't be disarmed, that is, they won't be removed from the timerqueue_list. exit_itimers will still release their memory, and when that list is later processed, it leads to a use-after-free. Clean up the timers from the de-threaded task before freeing them. This prevents a reported use-after-free. Fixes: 55e8c8eb2c7b ("posix-cpu-timers: Store a reference to a pid not a ta= sk") Signed-off-by: Thadeu Lima de Souza Cascardo Signed-off-by: Thomas Gleixner Reviewed-by: Thomas Gleixner Cc: Link: https://lore.kernel.org/r/20220809170751.164716-1-cascardo@canonical.= com Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/exec.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/exec.c +++ b/fs/exec.c @@ -1297,6 +1297,9 @@ int begin_new_exec(struct linux_binprm * bprm->mm =3D NULL; =20 #ifdef CONFIG_POSIX_TIMERS + spin_lock_irq(&me->sighand->siglock); + posix_cpu_timers_exit(me); + spin_unlock_irq(&me->sighand->siglock); exit_itimers(me); flush_itimer_signals(); #endif From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 767C1C25B08 for ; Mon, 15 Aug 2022 23:13:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347439AbiHOXNF (ORCPT ); Mon, 15 Aug 2022 19:13:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345415AbiHOXMD (ORCPT ); Mon, 15 Aug 2022 19:12:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12CC87667; Mon, 15 Aug 2022 13:00:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 935F160FD8; Mon, 15 Aug 2022 20:00:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 829FEC433C1; Mon, 15 Aug 2022 20:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593622; bh=cdnhM6keGBCbekNFSqz0/UM3k8voCBSTZYS+WXXc1WE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=unsyrNhhB0r7ctUVGJGgPxb1QvAEZoWqriUcd+FsSvc4g0MY0hI+Y6ot/j0lclWCh Y3RpMNs6eyx93QLaWMB1+n5ECV2OCNSRzsKHeF2vcDfnN93TkLPeXUC4U9l/64m7rB 7iQw1st3OvzR+hNaX8pMWoiWhtB4jGn6sVW3lJE8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , Xie Shaowen , Helge Deller Subject: [PATCH 5.18 0977/1095] Input: gscps2 - check return value of ioremap() in gscps2_probe() Date: Mon, 15 Aug 2022 20:06:16 +0200 Message-Id: <20220815180509.534782564@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xie Shaowen commit e61b3125a4f036b3c6b87ffd656fc1ab00440ae9 upstream. The function ioremap() in gscps2_probe() can fail, so its return value should be checked. Fixes: 4bdc0d676a643 ("remove ioremap_nocache and devm_ioremap_nocache") Cc: # v5.6+ Reported-by: Hacash Robot Signed-off-by: Xie Shaowen Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/input/serio/gscps2.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/input/serio/gscps2.c +++ b/drivers/input/serio/gscps2.c @@ -350,6 +350,10 @@ static int __init gscps2_probe(struct pa ps2port->port =3D serio; ps2port->padev =3D dev; ps2port->addr =3D ioremap(hpa, GSC_STATUS + 4); + if (!ps2port->addr) { + ret =3D -ENOMEM; + goto fail_nomem; + } spin_lock_init(&ps2port->lock); =20 gscps2_reset(ps2port); From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 709A0C00140 for ; Mon, 15 Aug 2022 23:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241006AbiHOXNR (ORCPT ); Mon, 15 Aug 2022 19:13:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245715AbiHOXMZ (ORCPT ); Mon, 15 Aug 2022 19:12:25 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C7BF4DB0C; Mon, 15 Aug 2022 13:00:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 99C04CE12C3; Mon, 15 Aug 2022 20:00:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A8AAC433D7; Mon, 15 Aug 2022 20:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593627; bh=NeiVTxAhI6nx6NjJa+fD0XlyRj4AyPMiZ3D5AsiipeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ooYuRksgowJjXg19BevQrInGcSXbAji9JEpeKpnYMvAjnWsq54sNyYWU2tj505D6v SAAM9lhawbyX9JjfnmsCtzbu3phumxiqOC1q9kL0ZvEu5tE/Xv8bdUzBergTT6Wsg7 WIGuOtEDj0A++qmoFAw9HzCtufhK9QPNgWI8pvZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Al Viro Subject: [PATCH 5.18 0978/1095] __follow_mount_rcu(): verify that mount_lock remains unchanged Date: Mon, 15 Aug 2022 20:06:17 +0200 Message-Id: <20220815180509.584528994@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Al Viro commit 20aac6c60981f5bfacd66661d090d907bf1482f0 upstream. Validate mount_lock seqcount as soon as we cross into mount in RCU mode. Sure, ->mnt_root is pinned and will remain so until we do rcu_read_unlock() anyway, and we will eventually fail to unlazy if the mount_lock had been touched, but we might run into a hard error (e.g. -ENOENT) before trying to unlazy. And it's possible to end up with RCU pathwalk racing with rename() and umount() in a way that would fail with -ENOENT while non-RCU pathwalk would've succeeded with any timings. Once upon a time we hadn't needed that, but analysis had been subtle, brittle and went out of window as soon as RENAME_EXCHANGE had been added. It's narrow, hard to hit and won't get you anything other than stray -ENOENT that could be arranged in much easier way with the same priveleges, but it's a bug all the same. Cc: stable@kernel.org X-sky-is-falling: unlikely Fixes: da1ce0670c14 "vfs: add cross-rename" Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/namei.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/namei.c +++ b/fs/namei.c @@ -1511,6 +1511,8 @@ static bool __follow_mount_rcu(struct na * becoming unpinned. */ flags =3D dentry->d_flags; + if (read_seqretry(&mount_lock, nd->m_seq)) + return false; continue; } if (read_seqretry(&mount_lock, nd->m_seq)) From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CD6EC00140 for ; Mon, 15 Aug 2022 23:13:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345192AbiHOXNM (ORCPT ); Mon, 15 Aug 2022 19:13:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241267AbiHOXMH (ORCPT ); Mon, 15 Aug 2022 19:12:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22C77326D9; Mon, 15 Aug 2022 13:00:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 15C1D612B9; Mon, 15 Aug 2022 20:00:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1817CC433C1; Mon, 15 Aug 2022 20:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593633; bh=SmZYZEpOelWUIJG7oTgTHs2s9xh0YRCxcCr5ctiy6do=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sxfs5qoqjcDB6yKPq8rJZuZJlPNekQJokp0ZYzt56YA2KyqlkfJMufIZCWOEFsRil 7lQlGsMkLbPjK5sEJOCyeTufZ4nPnge89FSwR2EjXYgkAOGFjBtoIuv64WQHty5FHP xDGbI7qN4M9SGg3K3GR2nkVmGndniXt0yAMHIsWQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Boyd , "Steven Rostedt (Google)" , David Collins Subject: [PATCH 5.18 0979/1095] spmi: trace: fix stack-out-of-bound access in SPMI tracing functions Date: Mon, 15 Aug 2022 20:06:18 +0200 Message-Id: <20220815180509.630450802@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Collins commit 2af28b241eea816e6f7668d1954f15894b45d7e3 upstream. trace_spmi_write_begin() and trace_spmi_read_end() both call memcpy() with a length of "len + 1". This leads to one extra byte being read beyond the end of the specified buffer. Fix this out-of-bound memory access by using a length of "len" instead. Here is a KASAN log showing the issue: BUG: KASAN: stack-out-of-bounds in trace_event_raw_event_spmi_read_end+0x1d= 0/0x234 Read of size 2 at addr ffffffc0265b7540 by task thermal@2.0-ser/1314 ... Call trace: dump_backtrace+0x0/0x3e8 show_stack+0x2c/0x3c dump_stack_lvl+0xdc/0x11c print_address_description+0x74/0x384 kasan_report+0x188/0x268 kasan_check_range+0x270/0x2b0 memcpy+0x90/0xe8 trace_event_raw_event_spmi_read_end+0x1d0/0x234 spmi_read_cmd+0x294/0x3ac spmi_ext_register_readl+0x84/0x9c regmap_spmi_ext_read+0x144/0x1b0 [regmap_spmi] _regmap_raw_read+0x40c/0x754 regmap_raw_read+0x3a0/0x514 regmap_bulk_read+0x418/0x494 adc5_gen3_poll_wait_hs+0xe8/0x1e0 [qcom_spmi_adc5_gen3] ... __arm64_sys_read+0x4c/0x60 invoke_syscall+0x80/0x218 el0_svc_common+0xec/0x1c8 ... addr ffffffc0265b7540 is located in stack of task thermal@2.0-ser/1314 at o= ffset 32 in frame: adc5_gen3_poll_wait_hs+0x0/0x1e0 [qcom_spmi_adc5_gen3] this frame has 1 object: [32, 33) 'status' Memory state around the buggy address: ffffffc0265b7400: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 ffffffc0265b7480: 04 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 >ffffffc0265b7500: 00 00 00 00 f1 f1 f1 f1 01 f3 f3 f3 00 00 00 00 ^ ffffffc0265b7580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffffffc0265b7600: f1 f1 f1 f1 01 f2 07 f2 f2 f2 01 f3 00 00 00 00 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Fixes: a9fce374815d ("spmi: add command tracepoints for SPMI") Cc: stable@vger.kernel.org Reviewed-by: Stephen Boyd Acked-by: Steven Rostedt (Google) Signed-off-by: David Collins Link: https://lore.kernel.org/r/20220627235512.2272783-1-quic_collinsd@quic= inc.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/trace/events/spmi.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/include/trace/events/spmi.h +++ b/include/trace/events/spmi.h @@ -21,15 +21,15 @@ TRACE_EVENT(spmi_write_begin, __field ( u8, sid ) __field ( u16, addr ) __field ( u8, len ) - __dynamic_array ( u8, buf, len + 1 ) + __dynamic_array ( u8, buf, len ) ), =20 TP_fast_assign( __entry->opcode =3D opcode; __entry->sid =3D sid; __entry->addr =3D addr; - __entry->len =3D len + 1; - memcpy(__get_dynamic_array(buf), buf, len + 1); + __entry->len =3D len; + memcpy(__get_dynamic_array(buf), buf, len); ), =20 TP_printk("opc=3D%d sid=3D%02d addr=3D0x%04x len=3D%d buf=3D0x[%*phD]", @@ -92,7 +92,7 @@ TRACE_EVENT(spmi_read_end, __field ( u16, addr ) __field ( int, ret ) __field ( u8, len ) - __dynamic_array ( u8, buf, len + 1 ) + __dynamic_array ( u8, buf, len ) ), =20 TP_fast_assign( @@ -100,8 +100,8 @@ TRACE_EVENT(spmi_read_end, __entry->sid =3D sid; __entry->addr =3D addr; __entry->ret =3D ret; - __entry->len =3D len + 1; - memcpy(__get_dynamic_array(buf), buf, len + 1); + __entry->len =3D len; + memcpy(__get_dynamic_array(buf), buf, len); ), =20 TP_printk("opc=3D%d sid=3D%02d addr=3D0x%04x ret=3D%d len=3D%02d buf=3D0x= [%*phD]", From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0670C00140 for ; Mon, 15 Aug 2022 23:13:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245606AbiHOXNt (ORCPT ); Mon, 15 Aug 2022 19:13:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243179AbiHOXMr (ORCPT ); Mon, 15 Aug 2022 19:12:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B128F1144E; Mon, 15 Aug 2022 13:00:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BA72B60FD8; Mon, 15 Aug 2022 20:00:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCC67C433C1; Mon, 15 Aug 2022 20:00:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593642; bh=oCQoZ/p7DA6Hwbt7h9YnDmeAd2OfPIKQCnbiaHnZFeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b2GYwe3aR5yk9Y2uppQqh6ouwi4bdrEEGULGjq0szTvEbauvDQIB1R0V6cJEFktRg dhWUaWT6BvAB/f6m893s9YVDZyNHfMjlK0X6UsTTqAtbGYzkTMJ/Xh3ht/FHhNHSqA FKd8uIwvlrLoBPTUXVVyFJIA5J3uGm2yPNF//U6s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Yury Norov , Phil Auld Subject: [PATCH 5.18 0980/1095] drivers/base: fix userspace break from using bin_attributes for cpumap and cpulist Date: Mon, 15 Aug 2022 20:06:19 +0200 Message-Id: <20220815180509.672853672@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Phil Auld commit 7ee951acd31a88f941fd6535fbdee3a1567f1d63 upstream. Using bin_attributes with a 0 size causes fstat and friends to return that 0 size. This breaks userspace code that retrieves the size before reading the file. Rather than reverting 75bd50fa841 ("drivers/base/node.c: use bin_attribute to break the size limitation of cpumap ABI") let's put in a size value at compile time. For cpulist the maximum size is on the order of NR_CPUS * (ceil(log10(NR_CPUS)) + 1)/2 which for 8192 is 20480 (8192 * 5)/2. In order to get near that you'd need a system with every other CPU on one node. For example: (0,2,4,8, ... ). To simplify the math and support larger NR_CPUS in the future we are using (NR_CPUS * 7)/2. We also set it to a min of PAGE_SIZE to retain the older behavior for smaller NR_CPUS. The cpumap file the size works out to be NR_CPUS/4 + NR_CPUS/32 - 1 (or NR_CPUS * 9/32 - 1) including the ","s. Add a set of macros for these values to cpumask.h so they can be used in multiple places. Apply these to the handful of such files in drivers/base/topology.c as well as node.c. As an example, on an 80 cpu 4-node system (NR_CPUS =3D=3D 8192): before: -r--r--r--. 1 root root 0 Jul 12 14:08 system/node/node0/cpulist -r--r--r--. 1 root root 0 Jul 11 17:25 system/node/node0/cpumap after: -r--r--r--. 1 root root 28672 Jul 13 11:32 system/node/node0/cpulist -r--r--r--. 1 root root 4096 Jul 13 11:31 system/node/node0/cpumap CONFIG_NR_CPUS =3D 16384 -r--r--r--. 1 root root 57344 Jul 13 14:03 system/node/node0/cpulist -r--r--r--. 1 root root 4607 Jul 13 14:02 system/node/node0/cpumap The actual number of cpus doesn't matter for the reported size since they are based on NR_CPUS. Fixes: 75bd50fa841d ("drivers/base/node.c: use bin_attribute to break the s= ize limitation of cpumap ABI") Fixes: bb9ec13d156e ("topology: use bin_attribute to break the size limitat= ion of cpumap ABI") Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Yury Norov Cc: stable@vger.kernel.org Acked-by: Yury Norov (for include/linux/cpumask.h) Signed-off-by: Phil Auld Link: https://lore.kernel.org/r/20220715134924.3466194-1-pauld@redhat.com Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/base/node.c | 4 ++-- drivers/base/topology.c | 32 ++++++++++++++++---------------- include/linux/cpumask.h | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+), 18 deletions(-) --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -45,7 +45,7 @@ static inline ssize_t cpumap_read(struct return n; } =20 -static BIN_ATTR_RO(cpumap, 0); +static BIN_ATTR_RO(cpumap, CPUMAP_FILE_MAX_BYTES); =20 static inline ssize_t cpulist_read(struct file *file, struct kobject *kobj, struct bin_attribute *attr, char *buf, @@ -66,7 +66,7 @@ static inline ssize_t cpulist_read(struc return n; } =20 -static BIN_ATTR_RO(cpulist, 0); +static BIN_ATTR_RO(cpulist, CPULIST_FILE_MAX_BYTES); =20 /** * struct node_access_nodes - Access class device to hold user visible --- a/drivers/base/topology.c +++ b/drivers/base/topology.c @@ -62,47 +62,47 @@ define_id_show_func(ppin, "0x%llx"); static DEVICE_ATTR_ADMIN_RO(ppin); =20 define_siblings_read_func(thread_siblings, sibling_cpumask); -static BIN_ATTR_RO(thread_siblings, 0); -static BIN_ATTR_RO(thread_siblings_list, 0); +static BIN_ATTR_RO(thread_siblings, CPUMAP_FILE_MAX_BYTES); +static BIN_ATTR_RO(thread_siblings_list, CPULIST_FILE_MAX_BYTES); =20 define_siblings_read_func(core_cpus, sibling_cpumask); -static BIN_ATTR_RO(core_cpus, 0); -static BIN_ATTR_RO(core_cpus_list, 0); +static BIN_ATTR_RO(core_cpus, CPUMAP_FILE_MAX_BYTES); +static BIN_ATTR_RO(core_cpus_list, CPULIST_FILE_MAX_BYTES); =20 define_siblings_read_func(core_siblings, core_cpumask); -static BIN_ATTR_RO(core_siblings, 0); -static BIN_ATTR_RO(core_siblings_list, 0); +static BIN_ATTR_RO(core_siblings, CPUMAP_FILE_MAX_BYTES); +static BIN_ATTR_RO(core_siblings_list, CPULIST_FILE_MAX_BYTES); =20 #ifdef TOPOLOGY_CLUSTER_SYSFS define_siblings_read_func(cluster_cpus, cluster_cpumask); -static BIN_ATTR_RO(cluster_cpus, 0); -static BIN_ATTR_RO(cluster_cpus_list, 0); +static BIN_ATTR_RO(cluster_cpus, CPUMAP_FILE_MAX_BYTES); +static BIN_ATTR_RO(cluster_cpus_list, CPULIST_FILE_MAX_BYTES); #endif =20 #ifdef TOPOLOGY_DIE_SYSFS define_siblings_read_func(die_cpus, die_cpumask); -static BIN_ATTR_RO(die_cpus, 0); -static BIN_ATTR_RO(die_cpus_list, 0); +static BIN_ATTR_RO(die_cpus, CPUMAP_FILE_MAX_BYTES); +static BIN_ATTR_RO(die_cpus_list, CPULIST_FILE_MAX_BYTES); #endif =20 define_siblings_read_func(package_cpus, core_cpumask); -static BIN_ATTR_RO(package_cpus, 0); -static BIN_ATTR_RO(package_cpus_list, 0); +static BIN_ATTR_RO(package_cpus, CPUMAP_FILE_MAX_BYTES); +static BIN_ATTR_RO(package_cpus_list, CPULIST_FILE_MAX_BYTES); =20 #ifdef TOPOLOGY_BOOK_SYSFS define_id_show_func(book_id, "%d"); static DEVICE_ATTR_RO(book_id); define_siblings_read_func(book_siblings, book_cpumask); -static BIN_ATTR_RO(book_siblings, 0); -static BIN_ATTR_RO(book_siblings_list, 0); +static BIN_ATTR_RO(book_siblings, CPUMAP_FILE_MAX_BYTES); +static BIN_ATTR_RO(book_siblings_list, CPULIST_FILE_MAX_BYTES); #endif =20 #ifdef TOPOLOGY_DRAWER_SYSFS define_id_show_func(drawer_id, "%d"); static DEVICE_ATTR_RO(drawer_id); define_siblings_read_func(drawer_siblings, drawer_cpumask); -static BIN_ATTR_RO(drawer_siblings, 0); -static BIN_ATTR_RO(drawer_siblings_list, 0); +static BIN_ATTR_RO(drawer_siblings, CPUMAP_FILE_MAX_BYTES); +static BIN_ATTR_RO(drawer_siblings_list, CPULIST_FILE_MAX_BYTES); #endif =20 static struct bin_attribute *bin_attrs[] =3D { --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -1071,4 +1071,22 @@ cpumap_print_list_to_buf(char *buf, cons [0] =3D 1UL \ } } =20 +/* + * Provide a valid theoretical max size for cpumap and cpulist sysfs files + * to avoid breaking userspace which may allocate a buffer based on the si= ze + * reported by e.g. fstat. + * + * for cpumap NR_CPUS * 9/32 - 1 should be an exact length. + * + * For cpulist 7 is (ceil(log10(NR_CPUS)) + 1) allowing for NR_CPUS to be = up + * to 2 orders of magnitude larger than 8192. And then we divide by 2 to + * cover a worst-case of every other cpu being on one of two nodes for a + * very large NR_CPUS. + * + * Use PAGE_SIZE as a minimum for smaller configurations. + */ +#define CPUMAP_FILE_MAX_BYTES ((((NR_CPUS * 9)/32 - 1) > PAGE_SIZE) \ + ? (NR_CPUS * 9)/32 - 1 : PAGE_SIZE) +#define CPULIST_FILE_MAX_BYTES (((NR_CPUS * 7)/2 > PAGE_SIZE) ? (NR_CPUS = * 7)/2 : PAGE_SIZE) + #endif /* __LINUX_CPUMASK_H */ From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6540C25B0D for ; Mon, 15 Aug 2022 23:14:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345500AbiHOXOZ (ORCPT ); Mon, 15 Aug 2022 19:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345701AbiHOXM5 (ORCPT ); Mon, 15 Aug 2022 19:12:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD4805FCD; Mon, 15 Aug 2022 13:00:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4DB94B8113E; Mon, 15 Aug 2022 20:00:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0A4EC433C1; Mon, 15 Aug 2022 20:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593648; bh=fsxIfqIiQo8bWSYD5GItZJhduZGBfHipVSilSbWRkKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fD+JboBJxgPGFlZg4lwSZ4Of8DNINuRzqLfGP0IAs1PryQLT/dfY/8L1ukg+SY/lh w/26YlMBG7tkTcg0ykqeu+Pv2RPGHWdeQlgvNsXtfNymZOhQ8QpV1imu3fxH4HS7TE W3rmgJFY5Qqz0qKtZZIk32yUzMQ1bLiaIteBWR5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jitao Shi , Xinlei Lee , AngeloGioacchino Del Regno , Rex-BC Chen , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.18 0981/1095] drm/mediatek: Keep dsi as LP00 before dcs cmds transfer Date: Mon, 15 Aug 2022 20:06:20 +0200 Message-Id: <20220815180509.714590769@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jitao Shi [ Upstream commit 39e8d062b03c3dc257d880d82bd55cdd9e185a3b ] To comply with the panel sequence, hold the mipi signal to LP00 before the dcs cmds transmission, and pull the mipi signal high from LP00 to LP11 until the start of the dcs cmds transmission. The normal panel timing is : (1) pp1800 DC pull up (2) avdd & avee AC pull high (3) lcm_reset pull high -> pull low -> pull high (4) Pull MIPI signal high (LP11) -> initial code -> send video data (HS mode) The power-off sequence is reversed. If dsi is not in cmd mode, then dsi will pull the mipi signal high in the mtk_output_dsi_enable function. The delay in lane_ready func is the reaction time of dsi_rx after pulling up the mipi signal. Fixes: 2dd8075d2185 ("drm/mediatek: mtk_dsi: Use the drm_panel_bridge API") Link: https://patchwork.kernel.org/project/linux-mediatek/patch/1653012007-= 11854-4-git-send-email-xinlei.lee@mediatek.com/ Cc: # 5.10.x: 7f6335c6a258: drm/mediatek: Modify d= si funcs to atomic operations Cc: # 5.10.x: cde7e2e35c28: drm/mediatek: Separate= poweron/poweroff from enable/disable and define new funcs Cc: # 5.10.x Signed-off-by: Jitao Shi Signed-off-by: Xinlei Lee Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Rex-BC Chen Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/mediatek/mtk_dsi.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/= mtk_dsi.c index f0f523bdafb8..e0a2d5ea40af 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -203,6 +203,7 @@ struct mtk_dsi { struct mtk_phy_timing phy_timing; int refcount; bool enabled; + bool lanes_ready; u32 irq_data; wait_queue_head_t irq_wait_queue; const struct mtk_dsi_driver_data *driver_data; @@ -649,18 +650,11 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi) mtk_dsi_reset_engine(dsi); mtk_dsi_phy_timconfig(dsi); =20 - mtk_dsi_rxtx_control(dsi); - usleep_range(30, 100); - mtk_dsi_reset_dphy(dsi); mtk_dsi_ps_control_vact(dsi); mtk_dsi_set_vm_cmd(dsi); mtk_dsi_config_vdo_timing(dsi); mtk_dsi_set_interrupt_enable(dsi); =20 - mtk_dsi_clk_ulp_mode_leave(dsi); - mtk_dsi_lane0_ulp_mode_leave(dsi); - mtk_dsi_clk_hs_mode(dsi, 0); - return 0; err_disable_engine_clk: clk_disable_unprepare(dsi->engine_clk); @@ -691,6 +685,23 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi) clk_disable_unprepare(dsi->digital_clk); =20 phy_power_off(dsi->phy); + + dsi->lanes_ready =3D false; +} + +static void mtk_dsi_lane_ready(struct mtk_dsi *dsi) +{ + if (!dsi->lanes_ready) { + dsi->lanes_ready =3D true; + mtk_dsi_rxtx_control(dsi); + usleep_range(30, 100); + mtk_dsi_reset_dphy(dsi); + mtk_dsi_clk_ulp_mode_leave(dsi); + mtk_dsi_lane0_ulp_mode_leave(dsi); + mtk_dsi_clk_hs_mode(dsi, 0); + msleep(20); + /* The reaction time after pulling up the mipi signal for dsi_rx */ + } } =20 static void mtk_output_dsi_enable(struct mtk_dsi *dsi) @@ -698,6 +709,7 @@ static void mtk_output_dsi_enable(struct mtk_dsi *dsi) if (dsi->enabled) return; =20 + mtk_dsi_lane_ready(dsi); mtk_dsi_set_mode(dsi); mtk_dsi_clk_hs_mode(dsi, 1); =20 @@ -1007,6 +1019,8 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_= host *host, if (MTK_DSI_HOST_IS_READ(msg->type)) irq_flag |=3D LPRX_RD_RDY_INT_FLAG; =20 + mtk_dsi_lane_ready(dsi); + ret =3D mtk_dsi_host_send_cmd(dsi, msg, irq_flag); if (ret) goto restore_dsi_mode; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DE8DC00140 for ; Mon, 15 Aug 2022 23:14:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233310AbiHOXOn (ORCPT ); Mon, 15 Aug 2022 19:14:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348279AbiHOXNR (ORCPT ); Mon, 15 Aug 2022 19:13:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E33CE74DEC; Mon, 15 Aug 2022 13:00:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 10160B8106C; Mon, 15 Aug 2022 20:00:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41FBAC433C1; Mon, 15 Aug 2022 20:00:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593653; bh=7aztD134fKs4NSE2xLsGUasG0MwifxkyIyUooZDoG1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R/lxpQ5Iqo8dr6RZ/PT8gHRuRfANxHgGBuuEfLI1VDbKMJ5CDmm/svAsp+0Suza3Z F0JLgP5Dr5SfbgSnx8nlgCxRX/fsIjWbnSxLOyM0i6PXwPTN/jxXHhkV3K50KQpqO1 vNv4SeljSfvZaCLSlyQpKTsXrs4+Qj+Y9wwcdpFk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, gaochao , Eric Biggers , Ard Biesheuvel , "Jason A. Donenfeld" , Herbert Xu , Sasha Levin Subject: [PATCH 5.18 0982/1095] crypto: blake2s - remove shash module Date: Mon, 15 Aug 2022 20:06:21 +0200 Message-Id: <20220815180509.751124394@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld [ Upstream commit 2d16803c562ecc644803d42ba98a8e0aef9c014e ] BLAKE2s has no currently known use as an shash. Just remove all of this unnecessary plumbing. Removing this shash was something we talked about back when we were making BLAKE2s a built-in, but I simply never got around to doing it. So this completes that project. Importantly, this fixs a bug in which the lib code depends on crypto_simd_disabled_for_test, causing linker errors. Also add more alignment tests to the selftests and compare SIMD and non-SIMD compression functions, to make up for what we lose from testmgr.c. Reported-by: gaochao Cc: Eric Biggers Cc: Ard Biesheuvel Cc: stable@vger.kernel.org Fixes: 6048fdcc5f26 ("lib/crypto: blake2s: include as built-in") Signed-off-by: Jason A. Donenfeld Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/crypto/Kconfig | 2 +- arch/arm/crypto/Makefile | 4 +- arch/arm/crypto/blake2s-shash.c | 75 ----------- arch/x86/crypto/Makefile | 4 +- arch/x86/crypto/blake2s-glue.c | 3 +- arch/x86/crypto/blake2s-shash.c | 77 ----------- crypto/Kconfig | 20 +-- crypto/Makefile | 1 - crypto/blake2s_generic.c | 75 ----------- crypto/tcrypt.c | 12 -- crypto/testmgr.c | 24 ---- crypto/testmgr.h | 217 ------------------------------ include/crypto/internal/blake2s.h | 108 --------------- lib/crypto/blake2s-selftest.c | 41 ++++++ lib/crypto/blake2s.c | 37 ++++- 15 files changed, 76 insertions(+), 624 deletions(-) delete mode 100644 arch/arm/crypto/blake2s-shash.c delete mode 100644 arch/x86/crypto/blake2s-shash.c delete mode 100644 crypto/blake2s_generic.c diff --git a/arch/arm/crypto/Kconfig b/arch/arm/crypto/Kconfig index e4dba5461cb3..149a5bd6b88c 100644 --- a/arch/arm/crypto/Kconfig +++ b/arch/arm/crypto/Kconfig @@ -63,7 +63,7 @@ config CRYPTO_SHA512_ARM using optimized ARM assembler and NEON, when available. =20 config CRYPTO_BLAKE2S_ARM - tristate "BLAKE2s digest algorithm (ARM)" + bool "BLAKE2s digest algorithm (ARM)" select CRYPTO_ARCH_HAVE_LIB_BLAKE2S help BLAKE2s digest algorithm optimized with ARM scalar instructions. This diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile index 0274f81cc8ea..971e74546fb1 100644 --- a/arch/arm/crypto/Makefile +++ b/arch/arm/crypto/Makefile @@ -9,8 +9,7 @@ obj-$(CONFIG_CRYPTO_SHA1_ARM) +=3D sha1-arm.o obj-$(CONFIG_CRYPTO_SHA1_ARM_NEON) +=3D sha1-arm-neon.o obj-$(CONFIG_CRYPTO_SHA256_ARM) +=3D sha256-arm.o obj-$(CONFIG_CRYPTO_SHA512_ARM) +=3D sha512-arm.o -obj-$(CONFIG_CRYPTO_BLAKE2S_ARM) +=3D blake2s-arm.o -obj-$(if $(CONFIG_CRYPTO_BLAKE2S_ARM),y) +=3D libblake2s-arm.o +obj-$(CONFIG_CRYPTO_BLAKE2S_ARM) +=3D libblake2s-arm.o obj-$(CONFIG_CRYPTO_BLAKE2B_NEON) +=3D blake2b-neon.o obj-$(CONFIG_CRYPTO_CHACHA20_NEON) +=3D chacha-neon.o obj-$(CONFIG_CRYPTO_POLY1305_ARM) +=3D poly1305-arm.o @@ -32,7 +31,6 @@ sha256-arm-neon-$(CONFIG_KERNEL_MODE_NEON) :=3D sha256_ne= on_glue.o sha256-arm-y :=3D sha256-core.o sha256_glue.o $(sha256-arm-neon-y) sha512-arm-neon-$(CONFIG_KERNEL_MODE_NEON) :=3D sha512-neon-glue.o sha512-arm-y :=3D sha512-core.o sha512-glue.o $(sha512-arm-neon-y) -blake2s-arm-y :=3D blake2s-shash.o libblake2s-arm-y:=3D blake2s-core.o blake2s-glue.o blake2b-neon-y :=3D blake2b-neon-core.o blake2b-neon-glue.o sha1-arm-ce-y :=3D sha1-ce-core.o sha1-ce-glue.o diff --git a/arch/arm/crypto/blake2s-shash.c b/arch/arm/crypto/blake2s-shas= h.c deleted file mode 100644 index 763c73beea2d..000000000000 --- a/arch/arm/crypto/blake2s-shash.c +++ /dev/null @@ -1,75 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * BLAKE2s digest algorithm, ARM scalar implementation - * - * Copyright 2020 Google LLC - */ - -#include -#include - -#include - -static int crypto_blake2s_update_arm(struct shash_desc *desc, - const u8 *in, unsigned int inlen) -{ - return crypto_blake2s_update(desc, in, inlen, false); -} - -static int crypto_blake2s_final_arm(struct shash_desc *desc, u8 *out) -{ - return crypto_blake2s_final(desc, out, false); -} - -#define BLAKE2S_ALG(name, driver_name, digest_size) \ - { \ - .base.cra_name =3D name, \ - .base.cra_driver_name =3D driver_name, \ - .base.cra_priority =3D 200, \ - .base.cra_flags =3D CRYPTO_ALG_OPTIONAL_KEY, \ - .base.cra_blocksize =3D BLAKE2S_BLOCK_SIZE, \ - .base.cra_ctxsize =3D sizeof(struct blake2s_tfm_ctx), \ - .base.cra_module =3D THIS_MODULE, \ - .digestsize =3D digest_size, \ - .setkey =3D crypto_blake2s_setkey, \ - .init =3D crypto_blake2s_init, \ - .update =3D crypto_blake2s_update_arm, \ - .final =3D crypto_blake2s_final_arm, \ - .descsize =3D sizeof(struct blake2s_state), \ - } - -static struct shash_alg blake2s_arm_algs[] =3D { - BLAKE2S_ALG("blake2s-128", "blake2s-128-arm", BLAKE2S_128_HASH_SIZE), - BLAKE2S_ALG("blake2s-160", "blake2s-160-arm", BLAKE2S_160_HASH_SIZE), - BLAKE2S_ALG("blake2s-224", "blake2s-224-arm", BLAKE2S_224_HASH_SIZE), - BLAKE2S_ALG("blake2s-256", "blake2s-256-arm", BLAKE2S_256_HASH_SIZE), -}; - -static int __init blake2s_arm_mod_init(void) -{ - return IS_REACHABLE(CONFIG_CRYPTO_HASH) ? - crypto_register_shashes(blake2s_arm_algs, - ARRAY_SIZE(blake2s_arm_algs)) : 0; -} - -static void __exit blake2s_arm_mod_exit(void) -{ - if (IS_REACHABLE(CONFIG_CRYPTO_HASH)) - crypto_unregister_shashes(blake2s_arm_algs, - ARRAY_SIZE(blake2s_arm_algs)); -} - -module_init(blake2s_arm_mod_init); -module_exit(blake2s_arm_mod_exit); - -MODULE_DESCRIPTION("BLAKE2s digest algorithm, ARM scalar implementation"); -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Eric Biggers "); -MODULE_ALIAS_CRYPTO("blake2s-128"); -MODULE_ALIAS_CRYPTO("blake2s-128-arm"); -MODULE_ALIAS_CRYPTO("blake2s-160"); -MODULE_ALIAS_CRYPTO("blake2s-160-arm"); -MODULE_ALIAS_CRYPTO("blake2s-224"); -MODULE_ALIAS_CRYPTO("blake2s-224-arm"); -MODULE_ALIAS_CRYPTO("blake2s-256"); -MODULE_ALIAS_CRYPTO("blake2s-256-arm"); diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile index 2831685adf6f..8ed4597fdf6a 100644 --- a/arch/x86/crypto/Makefile +++ b/arch/x86/crypto/Makefile @@ -61,9 +61,7 @@ sha256-ssse3-$(CONFIG_AS_SHA256_NI) +=3D sha256_ni_asm.o obj-$(CONFIG_CRYPTO_SHA512_SSSE3) +=3D sha512-ssse3.o sha512-ssse3-y :=3D sha512-ssse3-asm.o sha512-avx-asm.o sha512-avx2-asm.o = sha512_ssse3_glue.o =20 -obj-$(CONFIG_CRYPTO_BLAKE2S_X86) +=3D blake2s-x86_64.o -blake2s-x86_64-y :=3D blake2s-shash.o -obj-$(if $(CONFIG_CRYPTO_BLAKE2S_X86),y) +=3D libblake2s-x86_64.o +obj-$(CONFIG_CRYPTO_BLAKE2S_X86) +=3D libblake2s-x86_64.o libblake2s-x86_64-y :=3D blake2s-core.o blake2s-glue.o =20 obj-$(CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL) +=3D ghash-clmulni-intel.o diff --git a/arch/x86/crypto/blake2s-glue.c b/arch/x86/crypto/blake2s-glue.c index 69853c13e8fb..aaba21230528 100644 --- a/arch/x86/crypto/blake2s-glue.c +++ b/arch/x86/crypto/blake2s-glue.c @@ -4,7 +4,6 @@ */ =20 #include -#include =20 #include #include @@ -33,7 +32,7 @@ void blake2s_compress(struct blake2s_state *state, const = u8 *block, /* SIMD disables preemption, so relax after processing each page. */ BUILD_BUG_ON(SZ_4K / BLAKE2S_BLOCK_SIZE < 8); =20 - if (!static_branch_likely(&blake2s_use_ssse3) || !crypto_simd_usable()) { + if (!static_branch_likely(&blake2s_use_ssse3) || !may_use_simd()) { blake2s_compress_generic(state, block, nblocks, inc); return; } diff --git a/arch/x86/crypto/blake2s-shash.c b/arch/x86/crypto/blake2s-shas= h.c deleted file mode 100644 index 59ae28abe35c..000000000000 --- a/arch/x86/crypto/blake2s-shash.c +++ /dev/null @@ -1,77 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 OR MIT -/* - * Copyright (C) 2015-2019 Jason A. Donenfeld . All Right= s Reserved. - */ - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -static int crypto_blake2s_update_x86(struct shash_desc *desc, - const u8 *in, unsigned int inlen) -{ - return crypto_blake2s_update(desc, in, inlen, false); -} - -static int crypto_blake2s_final_x86(struct shash_desc *desc, u8 *out) -{ - return crypto_blake2s_final(desc, out, false); -} - -#define BLAKE2S_ALG(name, driver_name, digest_size) \ - { \ - .base.cra_name =3D name, \ - .base.cra_driver_name =3D driver_name, \ - .base.cra_priority =3D 200, \ - .base.cra_flags =3D CRYPTO_ALG_OPTIONAL_KEY, \ - .base.cra_blocksize =3D BLAKE2S_BLOCK_SIZE, \ - .base.cra_ctxsize =3D sizeof(struct blake2s_tfm_ctx), \ - .base.cra_module =3D THIS_MODULE, \ - .digestsize =3D digest_size, \ - .setkey =3D crypto_blake2s_setkey, \ - .init =3D crypto_blake2s_init, \ - .update =3D crypto_blake2s_update_x86, \ - .final =3D crypto_blake2s_final_x86, \ - .descsize =3D sizeof(struct blake2s_state), \ - } - -static struct shash_alg blake2s_algs[] =3D { - BLAKE2S_ALG("blake2s-128", "blake2s-128-x86", BLAKE2S_128_HASH_SIZE), - BLAKE2S_ALG("blake2s-160", "blake2s-160-x86", BLAKE2S_160_HASH_SIZE), - BLAKE2S_ALG("blake2s-224", "blake2s-224-x86", BLAKE2S_224_HASH_SIZE), - BLAKE2S_ALG("blake2s-256", "blake2s-256-x86", BLAKE2S_256_HASH_SIZE), -}; - -static int __init blake2s_mod_init(void) -{ - if (IS_REACHABLE(CONFIG_CRYPTO_HASH) && boot_cpu_has(X86_FEATURE_SSSE3)) - return crypto_register_shashes(blake2s_algs, ARRAY_SIZE(blake2s_algs)); - return 0; -} - -static void __exit blake2s_mod_exit(void) -{ - if (IS_REACHABLE(CONFIG_CRYPTO_HASH) && boot_cpu_has(X86_FEATURE_SSSE3)) - crypto_unregister_shashes(blake2s_algs, ARRAY_SIZE(blake2s_algs)); -} - -module_init(blake2s_mod_init); -module_exit(blake2s_mod_exit); - -MODULE_ALIAS_CRYPTO("blake2s-128"); -MODULE_ALIAS_CRYPTO("blake2s-128-x86"); -MODULE_ALIAS_CRYPTO("blake2s-160"); -MODULE_ALIAS_CRYPTO("blake2s-160-x86"); -MODULE_ALIAS_CRYPTO("blake2s-224"); -MODULE_ALIAS_CRYPTO("blake2s-224-x86"); -MODULE_ALIAS_CRYPTO("blake2s-256"); -MODULE_ALIAS_CRYPTO("blake2s-256-x86"); -MODULE_LICENSE("GPL v2"); diff --git a/crypto/Kconfig b/crypto/Kconfig index b4e00a7a046b..38601a072b99 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -692,26 +692,8 @@ config CRYPTO_BLAKE2B =20 See https://blake2.net for further information. =20 -config CRYPTO_BLAKE2S - tristate "BLAKE2s digest algorithm" - select CRYPTO_LIB_BLAKE2S_GENERIC - select CRYPTO_HASH - help - Implementation of cryptographic hash function BLAKE2s - optimized for 8-32bit platforms and can produce digests of any size - between 1 to 32. The keyed hash is also implemented. - - This module provides the following algorithms: - - - blake2s-128 - - blake2s-160 - - blake2s-224 - - blake2s-256 - - See https://blake2.net for further information. - config CRYPTO_BLAKE2S_X86 - tristate "BLAKE2s digest algorithm (x86 accelerated version)" + bool "BLAKE2s digest algorithm (x86 accelerated version)" depends on X86 && 64BIT select CRYPTO_LIB_BLAKE2S_GENERIC select CRYPTO_ARCH_HAVE_LIB_BLAKE2S diff --git a/crypto/Makefile b/crypto/Makefile index a40e6d5fb2c8..dbfa53567c92 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -83,7 +83,6 @@ obj-$(CONFIG_CRYPTO_STREEBOG) +=3D streebog_generic.o obj-$(CONFIG_CRYPTO_WP512) +=3D wp512.o CFLAGS_wp512.o :=3D $(call cc-option,-fno-schedule-insns) # https://gcc.g= nu.org/bugzilla/show_bug.cgi?id=3D79149 obj-$(CONFIG_CRYPTO_BLAKE2B) +=3D blake2b_generic.o -obj-$(CONFIG_CRYPTO_BLAKE2S) +=3D blake2s_generic.o obj-$(CONFIG_CRYPTO_GF128MUL) +=3D gf128mul.o obj-$(CONFIG_CRYPTO_ECB) +=3D ecb.o obj-$(CONFIG_CRYPTO_CBC) +=3D cbc.o diff --git a/crypto/blake2s_generic.c b/crypto/blake2s_generic.c deleted file mode 100644 index 5f96a21f8788..000000000000 --- a/crypto/blake2s_generic.c +++ /dev/null @@ -1,75 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 OR MIT -/* - * shash interface to the generic implementation of BLAKE2s - * - * Copyright (C) 2015-2019 Jason A. Donenfeld . All Right= s Reserved. - */ - -#include -#include - -#include -#include -#include - -static int crypto_blake2s_update_generic(struct shash_desc *desc, - const u8 *in, unsigned int inlen) -{ - return crypto_blake2s_update(desc, in, inlen, true); -} - -static int crypto_blake2s_final_generic(struct shash_desc *desc, u8 *out) -{ - return crypto_blake2s_final(desc, out, true); -} - -#define BLAKE2S_ALG(name, driver_name, digest_size) \ - { \ - .base.cra_name =3D name, \ - .base.cra_driver_name =3D driver_name, \ - .base.cra_priority =3D 100, \ - .base.cra_flags =3D CRYPTO_ALG_OPTIONAL_KEY, \ - .base.cra_blocksize =3D BLAKE2S_BLOCK_SIZE, \ - .base.cra_ctxsize =3D sizeof(struct blake2s_tfm_ctx), \ - .base.cra_module =3D THIS_MODULE, \ - .digestsize =3D digest_size, \ - .setkey =3D crypto_blake2s_setkey, \ - .init =3D crypto_blake2s_init, \ - .update =3D crypto_blake2s_update_generic, \ - .final =3D crypto_blake2s_final_generic, \ - .descsize =3D sizeof(struct blake2s_state), \ - } - -static struct shash_alg blake2s_algs[] =3D { - BLAKE2S_ALG("blake2s-128", "blake2s-128-generic", - BLAKE2S_128_HASH_SIZE), - BLAKE2S_ALG("blake2s-160", "blake2s-160-generic", - BLAKE2S_160_HASH_SIZE), - BLAKE2S_ALG("blake2s-224", "blake2s-224-generic", - BLAKE2S_224_HASH_SIZE), - BLAKE2S_ALG("blake2s-256", "blake2s-256-generic", - BLAKE2S_256_HASH_SIZE), -}; - -static int __init blake2s_mod_init(void) -{ - return crypto_register_shashes(blake2s_algs, ARRAY_SIZE(blake2s_algs)); -} - -static void __exit blake2s_mod_exit(void) -{ - crypto_unregister_shashes(blake2s_algs, ARRAY_SIZE(blake2s_algs)); -} - -subsys_initcall(blake2s_mod_init); -module_exit(blake2s_mod_exit); - -MODULE_ALIAS_CRYPTO("blake2s-128"); -MODULE_ALIAS_CRYPTO("blake2s-128-generic"); -MODULE_ALIAS_CRYPTO("blake2s-160"); -MODULE_ALIAS_CRYPTO("blake2s-160-generic"); -MODULE_ALIAS_CRYPTO("blake2s-224"); -MODULE_ALIAS_CRYPTO("blake2s-224-generic"); -MODULE_ALIAS_CRYPTO("blake2s-256"); -MODULE_ALIAS_CRYPTO("blake2s-256-generic"); -MODULE_LICENSE("GPL v2"); diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 2bacf8384f59..66b7ca1ccb23 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -1669,10 +1669,6 @@ static int do_test(const char *alg, u32 type, u32 ma= sk, int m, u32 num_mb) ret +=3D tcrypt_test("rmd160"); break; =20 - case 41: - ret +=3D tcrypt_test("blake2s-256"); - break; - case 42: ret +=3D tcrypt_test("blake2b-512"); break; @@ -2240,10 +2236,6 @@ static int do_test(const char *alg, u32 type, u32 ma= sk, int m, u32 num_mb) test_hash_speed("rmd160", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; fallthrough; - case 316: - test_hash_speed("blake2s-256", sec, generic_hash_speed_template); - if (mode > 300 && mode < 400) break; - fallthrough; case 317: test_hash_speed("blake2b-512", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; @@ -2352,10 +2344,6 @@ static int do_test(const char *alg, u32 type, u32 ma= sk, int m, u32 num_mb) test_ahash_speed("rmd160", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; fallthrough; - case 416: - test_ahash_speed("blake2s-256", sec, generic_hash_speed_template); - if (mode > 400 && mode < 500) break; - fallthrough; case 417: test_ahash_speed("blake2b-512", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 4948201065cc..56facdb63843 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -4324,30 +4324,6 @@ static const struct alg_test_desc alg_test_descs[] = =3D { .suite =3D { .hash =3D __VECS(blake2b_512_tv_template) } - }, { - .alg =3D "blake2s-128", - .test =3D alg_test_hash, - .suite =3D { - .hash =3D __VECS(blakes2s_128_tv_template) - } - }, { - .alg =3D "blake2s-160", - .test =3D alg_test_hash, - .suite =3D { - .hash =3D __VECS(blakes2s_160_tv_template) - } - }, { - .alg =3D "blake2s-224", - .test =3D alg_test_hash, - .suite =3D { - .hash =3D __VECS(blakes2s_224_tv_template) - } - }, { - .alg =3D "blake2s-256", - .test =3D alg_test_hash, - .suite =3D { - .hash =3D __VECS(blakes2s_256_tv_template) - } }, { .alg =3D "cbc(aes)", .test =3D alg_test_skcipher, diff --git a/crypto/testmgr.h b/crypto/testmgr.h index 4d7449fc6a65..c29658337d96 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h @@ -34034,221 +34034,4 @@ static const struct hash_testvec blake2b_512_tv_t= emplate[] =3D {{ 0xae, 0x15, 0x81, 0x15, 0xd0, 0x88, 0xa0, 0x3c, }, }}; =20 -static const struct hash_testvec blakes2s_128_tv_template[] =3D {{ - .digest =3D (u8[]){ 0x64, 0x55, 0x0d, 0x6f, 0xfe, 0x2c, 0x0a, 0x01, - 0xa1, 0x4a, 0xba, 0x1e, 0xad, 0xe0, 0x20, 0x0c, }, -}, { - .plaintext =3D blake2_ordered_sequence, - .psize =3D 64, - .digest =3D (u8[]){ 0xdc, 0x66, 0xca, 0x8f, 0x03, 0x86, 0x58, 0x01, - 0xb0, 0xff, 0xe0, 0x6e, 0xd8, 0xa1, 0xa9, 0x0e, }, -}, { - .ksize =3D 16, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 1, - .digest =3D (u8[]){ 0x88, 0x1e, 0x42, 0xe7, 0xbb, 0x35, 0x80, 0x82, - 0x63, 0x7c, 0x0a, 0x0f, 0xd7, 0xec, 0x6c, 0x2f, }, -}, { - .ksize =3D 32, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 7, - .digest =3D (u8[]){ 0xcf, 0x9e, 0x07, 0x2a, 0xd5, 0x22, 0xf2, 0xcd, - 0xa2, 0xd8, 0x25, 0x21, 0x80, 0x86, 0x73, 0x1c, }, -}, { - .ksize =3D 1, - .key =3D "B", - .plaintext =3D blake2_ordered_sequence, - .psize =3D 15, - .digest =3D (u8[]){ 0xf6, 0x33, 0x5a, 0x2c, 0x22, 0xa0, 0x64, 0xb2, - 0xb6, 0x3f, 0xeb, 0xbc, 0xd1, 0xc3, 0xe5, 0xb2, }, -}, { - .ksize =3D 16, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 247, - .digest =3D (u8[]){ 0x72, 0x66, 0x49, 0x60, 0xf9, 0x4a, 0xea, 0xbe, - 0x1f, 0xf4, 0x60, 0xce, 0xb7, 0x81, 0xcb, 0x09, }, -}, { - .ksize =3D 32, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 256, - .digest =3D (u8[]){ 0xd5, 0xa4, 0x0e, 0xc3, 0x16, 0xc7, 0x51, 0xa6, - 0x3c, 0xd0, 0xd9, 0x11, 0x57, 0xfa, 0x1e, 0xbb, }, -}}; - -static const struct hash_testvec blakes2s_160_tv_template[] =3D {{ - .plaintext =3D blake2_ordered_sequence, - .psize =3D 7, - .digest =3D (u8[]){ 0xb4, 0xf2, 0x03, 0x49, 0x37, 0xed, 0xb1, 0x3e, - 0x5b, 0x2a, 0xca, 0x64, 0x82, 0x74, 0xf6, 0x62, - 0xe3, 0xf2, 0x84, 0xff, }, -}, { - .plaintext =3D blake2_ordered_sequence, - .psize =3D 256, - .digest =3D (u8[]){ 0xaa, 0x56, 0x9b, 0xdc, 0x98, 0x17, 0x75, 0xf2, - 0xb3, 0x68, 0x83, 0xb7, 0x9b, 0x8d, 0x48, 0xb1, - 0x9b, 0x2d, 0x35, 0x05, }, -}, { - .ksize =3D 1, - .key =3D "B", - .digest =3D (u8[]){ 0x50, 0x16, 0xe7, 0x0c, 0x01, 0xd0, 0xd3, 0xc3, - 0xf4, 0x3e, 0xb1, 0x6e, 0x97, 0xa9, 0x4e, 0xd1, - 0x79, 0x65, 0x32, 0x93, }, -}, { - .ksize =3D 32, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 1, - .digest =3D (u8[]){ 0x1c, 0x2b, 0xcd, 0x9a, 0x68, 0xca, 0x8c, 0x71, - 0x90, 0x29, 0x6c, 0x54, 0xfa, 0x56, 0x4a, 0xef, - 0xa2, 0x3a, 0x56, 0x9c, }, -}, { - .ksize =3D 16, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 15, - .digest =3D (u8[]){ 0x36, 0xc3, 0x5f, 0x9a, 0xdc, 0x7e, 0xbf, 0x19, - 0x68, 0xaa, 0xca, 0xd8, 0x81, 0xbf, 0x09, 0x34, - 0x83, 0x39, 0x0f, 0x30, }, -}, { - .ksize =3D 1, - .key =3D "B", - .plaintext =3D blake2_ordered_sequence, - .psize =3D 64, - .digest =3D (u8[]){ 0x86, 0x80, 0x78, 0xa4, 0x14, 0xec, 0x03, 0xe5, - 0xb6, 0x9a, 0x52, 0x0e, 0x42, 0xee, 0x39, 0x9d, - 0xac, 0xa6, 0x81, 0x63, }, -}, { - .ksize =3D 32, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 247, - .digest =3D (u8[]){ 0x2d, 0xd8, 0xd2, 0x53, 0x66, 0xfa, 0xa9, 0x01, - 0x1c, 0x9c, 0xaf, 0xa3, 0xe2, 0x9d, 0x9b, 0x10, - 0x0a, 0xf6, 0x73, 0xe8, }, -}}; - -static const struct hash_testvec blakes2s_224_tv_template[] =3D {{ - .plaintext =3D blake2_ordered_sequence, - .psize =3D 1, - .digest =3D (u8[]){ 0x61, 0xb9, 0x4e, 0xc9, 0x46, 0x22, 0xa3, 0x91, - 0xd2, 0xae, 0x42, 0xe6, 0x45, 0x6c, 0x90, 0x12, - 0xd5, 0x80, 0x07, 0x97, 0xb8, 0x86, 0x5a, 0xfc, - 0x48, 0x21, 0x97, 0xbb, }, -}, { - .plaintext =3D blake2_ordered_sequence, - .psize =3D 247, - .digest =3D (u8[]){ 0x9e, 0xda, 0xc7, 0x20, 0x2c, 0xd8, 0x48, 0x2e, - 0x31, 0x94, 0xab, 0x46, 0x6d, 0x94, 0xd8, 0xb4, - 0x69, 0xcd, 0xae, 0x19, 0x6d, 0x9e, 0x41, 0xcc, - 0x2b, 0xa4, 0xd5, 0xf6, }, -}, { - .ksize =3D 16, - .key =3D blake2_ordered_sequence, - .digest =3D (u8[]){ 0x32, 0xc0, 0xac, 0xf4, 0x3b, 0xd3, 0x07, 0x9f, - 0xbe, 0xfb, 0xfa, 0x4d, 0x6b, 0x4e, 0x56, 0xb3, - 0xaa, 0xd3, 0x27, 0xf6, 0x14, 0xbf, 0xb9, 0x32, - 0xa7, 0x19, 0xfc, 0xb8, }, -}, { - .ksize =3D 1, - .key =3D "B", - .plaintext =3D blake2_ordered_sequence, - .psize =3D 7, - .digest =3D (u8[]){ 0x73, 0xad, 0x5e, 0x6d, 0xb9, 0x02, 0x8e, 0x76, - 0xf2, 0x66, 0x42, 0x4b, 0x4c, 0xfa, 0x1f, 0xe6, - 0x2e, 0x56, 0x40, 0xe5, 0xa2, 0xb0, 0x3c, 0xe8, - 0x7b, 0x45, 0xfe, 0x05, }, -}, { - .ksize =3D 32, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 15, - .digest =3D (u8[]){ 0x16, 0x60, 0xfb, 0x92, 0x54, 0xb3, 0x6e, 0x36, - 0x81, 0xf4, 0x16, 0x41, 0xc3, 0x3d, 0xd3, 0x43, - 0x84, 0xed, 0x10, 0x6f, 0x65, 0x80, 0x7a, 0x3e, - 0x25, 0xab, 0xc5, 0x02, }, -}, { - .ksize =3D 16, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 64, - .digest =3D (u8[]){ 0xca, 0xaa, 0x39, 0x67, 0x9c, 0xf7, 0x6b, 0xc7, - 0xb6, 0x82, 0xca, 0x0e, 0x65, 0x36, 0x5b, 0x7c, - 0x24, 0x00, 0xfa, 0x5f, 0xda, 0x06, 0x91, 0x93, - 0x6a, 0x31, 0x83, 0xb5, }, -}, { - .ksize =3D 1, - .key =3D "B", - .plaintext =3D blake2_ordered_sequence, - .psize =3D 256, - .digest =3D (u8[]){ 0x90, 0x02, 0x26, 0xb5, 0x06, 0x9c, 0x36, 0x86, - 0x94, 0x91, 0x90, 0x1e, 0x7d, 0x2a, 0x71, 0xb2, - 0x48, 0xb5, 0xe8, 0x16, 0xfd, 0x64, 0x33, 0x45, - 0xb3, 0xd7, 0xec, 0xcc, }, -}}; - -static const struct hash_testvec blakes2s_256_tv_template[] =3D {{ - .plaintext =3D blake2_ordered_sequence, - .psize =3D 15, - .digest =3D (u8[]){ 0xd9, 0x7c, 0x82, 0x8d, 0x81, 0x82, 0xa7, 0x21, - 0x80, 0xa0, 0x6a, 0x78, 0x26, 0x83, 0x30, 0x67, - 0x3f, 0x7c, 0x4e, 0x06, 0x35, 0x94, 0x7c, 0x04, - 0xc0, 0x23, 0x23, 0xfd, 0x45, 0xc0, 0xa5, 0x2d, }, -}, { - .ksize =3D 32, - .key =3D blake2_ordered_sequence, - .digest =3D (u8[]){ 0x48, 0xa8, 0x99, 0x7d, 0xa4, 0x07, 0x87, 0x6b, - 0x3d, 0x79, 0xc0, 0xd9, 0x23, 0x25, 0xad, 0x3b, - 0x89, 0xcb, 0xb7, 0x54, 0xd8, 0x6a, 0xb7, 0x1a, - 0xee, 0x04, 0x7a, 0xd3, 0x45, 0xfd, 0x2c, 0x49, }, -}, { - .ksize =3D 1, - .key =3D "B", - .plaintext =3D blake2_ordered_sequence, - .psize =3D 1, - .digest =3D (u8[]){ 0x22, 0x27, 0xae, 0xaa, 0x6e, 0x81, 0x56, 0x03, - 0xa7, 0xe3, 0xa1, 0x18, 0xa5, 0x9a, 0x2c, 0x18, - 0xf4, 0x63, 0xbc, 0x16, 0x70, 0xf1, 0xe7, 0x4b, - 0x00, 0x6d, 0x66, 0x16, 0xae, 0x9e, 0x74, 0x4e, }, -}, { - .ksize =3D 16, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 7, - .digest =3D (u8[]){ 0x58, 0x5d, 0xa8, 0x60, 0x1c, 0xa4, 0xd8, 0x03, - 0x86, 0x86, 0x84, 0x64, 0xd7, 0xa0, 0x8e, 0x15, - 0x2f, 0x05, 0xa2, 0x1b, 0xbc, 0xef, 0x7a, 0x34, - 0xb3, 0xc5, 0xbc, 0x4b, 0xf0, 0x32, 0xeb, 0x12, }, -}, { - .ksize =3D 32, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 64, - .digest =3D (u8[]){ 0x89, 0x75, 0xb0, 0x57, 0x7f, 0xd3, 0x55, 0x66, - 0xd7, 0x50, 0xb3, 0x62, 0xb0, 0x89, 0x7a, 0x26, - 0xc3, 0x99, 0x13, 0x6d, 0xf0, 0x7b, 0xab, 0xab, - 0xbd, 0xe6, 0x20, 0x3f, 0xf2, 0x95, 0x4e, 0xd4, }, -}, { - .ksize =3D 1, - .key =3D "B", - .plaintext =3D blake2_ordered_sequence, - .psize =3D 247, - .digest =3D (u8[]){ 0x2e, 0x74, 0x1c, 0x1d, 0x03, 0xf4, 0x9d, 0x84, - 0x6f, 0xfc, 0x86, 0x32, 0x92, 0x49, 0x7e, 0x66, - 0xd7, 0xc3, 0x10, 0x88, 0xfe, 0x28, 0xb3, 0xe0, - 0xbf, 0x50, 0x75, 0xad, 0x8e, 0xa4, 0xe6, 0xb2, }, -}, { - .ksize =3D 16, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 256, - .digest =3D (u8[]){ 0xb9, 0xd2, 0x81, 0x0e, 0x3a, 0xb1, 0x62, 0x9b, - 0xad, 0x44, 0x05, 0xf4, 0x92, 0x2e, 0x99, 0xc1, - 0x4a, 0x47, 0xbb, 0x5b, 0x6f, 0xb2, 0x96, 0xed, - 0xd5, 0x06, 0xb5, 0x3a, 0x7c, 0x7a, 0x65, 0x1d, }, -}}; - #endif /* _CRYPTO_TESTMGR_H */ diff --git a/include/crypto/internal/blake2s.h b/include/crypto/internal/bl= ake2s.h index 52363eee2b20..506d56530ca9 100644 --- a/include/crypto/internal/blake2s.h +++ b/include/crypto/internal/blake2s.h @@ -8,7 +8,6 @@ #define _CRYPTO_INTERNAL_BLAKE2S_H =20 #include -#include #include =20 void blake2s_compress_generic(struct blake2s_state *state, const u8 *block, @@ -19,111 +18,4 @@ void blake2s_compress(struct blake2s_state *state, cons= t u8 *block, =20 bool blake2s_selftest(void); =20 -static inline void blake2s_set_lastblock(struct blake2s_state *state) -{ - state->f[0] =3D -1; -} - -/* Helper functions for BLAKE2s shared by the library and shash APIs */ - -static __always_inline void -__blake2s_update(struct blake2s_state *state, const u8 *in, size_t inlen, - bool force_generic) -{ - const size_t fill =3D BLAKE2S_BLOCK_SIZE - state->buflen; - - if (unlikely(!inlen)) - return; - if (inlen > fill) { - memcpy(state->buf + state->buflen, in, fill); - if (force_generic) - blake2s_compress_generic(state, state->buf, 1, - BLAKE2S_BLOCK_SIZE); - else - blake2s_compress(state, state->buf, 1, - BLAKE2S_BLOCK_SIZE); - state->buflen =3D 0; - in +=3D fill; - inlen -=3D fill; - } - if (inlen > BLAKE2S_BLOCK_SIZE) { - const size_t nblocks =3D DIV_ROUND_UP(inlen, BLAKE2S_BLOCK_SIZE); - /* Hash one less (full) block than strictly possible */ - if (force_generic) - blake2s_compress_generic(state, in, nblocks - 1, - BLAKE2S_BLOCK_SIZE); - else - blake2s_compress(state, in, nblocks - 1, - BLAKE2S_BLOCK_SIZE); - in +=3D BLAKE2S_BLOCK_SIZE * (nblocks - 1); - inlen -=3D BLAKE2S_BLOCK_SIZE * (nblocks - 1); - } - memcpy(state->buf + state->buflen, in, inlen); - state->buflen +=3D inlen; -} - -static __always_inline void -__blake2s_final(struct blake2s_state *state, u8 *out, bool force_generic) -{ - blake2s_set_lastblock(state); - memset(state->buf + state->buflen, 0, - BLAKE2S_BLOCK_SIZE - state->buflen); /* Padding */ - if (force_generic) - blake2s_compress_generic(state, state->buf, 1, state->buflen); - else - blake2s_compress(state, state->buf, 1, state->buflen); - cpu_to_le32_array(state->h, ARRAY_SIZE(state->h)); - memcpy(out, state->h, state->outlen); -} - -/* Helper functions for shash implementations of BLAKE2s */ - -struct blake2s_tfm_ctx { - u8 key[BLAKE2S_KEY_SIZE]; - unsigned int keylen; -}; - -static inline int crypto_blake2s_setkey(struct crypto_shash *tfm, - const u8 *key, unsigned int keylen) -{ - struct blake2s_tfm_ctx *tctx =3D crypto_shash_ctx(tfm); - - if (keylen =3D=3D 0 || keylen > BLAKE2S_KEY_SIZE) - return -EINVAL; - - memcpy(tctx->key, key, keylen); - tctx->keylen =3D keylen; - - return 0; -} - -static inline int crypto_blake2s_init(struct shash_desc *desc) -{ - const struct blake2s_tfm_ctx *tctx =3D crypto_shash_ctx(desc->tfm); - struct blake2s_state *state =3D shash_desc_ctx(desc); - unsigned int outlen =3D crypto_shash_digestsize(desc->tfm); - - __blake2s_init(state, outlen, tctx->key, tctx->keylen); - return 0; -} - -static inline int crypto_blake2s_update(struct shash_desc *desc, - const u8 *in, unsigned int inlen, - bool force_generic) -{ - struct blake2s_state *state =3D shash_desc_ctx(desc); - - __blake2s_update(state, in, inlen, force_generic); - return 0; -} - -static inline int crypto_blake2s_final(struct shash_desc *desc, u8 *out, - bool force_generic) -{ - struct blake2s_state *state =3D shash_desc_ctx(desc); - - __blake2s_final(state, out, force_generic); - return 0; -} - #endif /* _CRYPTO_INTERNAL_BLAKE2S_H */ diff --git a/lib/crypto/blake2s-selftest.c b/lib/crypto/blake2s-selftest.c index 409e4b728770..66f505220f43 100644 --- a/lib/crypto/blake2s-selftest.c +++ b/lib/crypto/blake2s-selftest.c @@ -4,6 +4,8 @@ */ =20 #include +#include +#include #include =20 /* @@ -587,5 +589,44 @@ bool __init blake2s_selftest(void) } } =20 + for (i =3D 0; i < 32; ++i) { + enum { TEST_ALIGNMENT =3D 16 }; + u8 unaligned_block[BLAKE2S_BLOCK_SIZE + TEST_ALIGNMENT - 1] + __aligned(TEST_ALIGNMENT); + u8 blocks[BLAKE2S_BLOCK_SIZE * 3]; + struct blake2s_state state1, state2; + + get_random_bytes(blocks, sizeof(blocks)); + get_random_bytes(&state, sizeof(state)); + +#if defined(CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC) && \ + defined(CONFIG_CRYPTO_ARCH_HAVE_LIB_BLAKE2S) + memcpy(&state1, &state, sizeof(state1)); + memcpy(&state2, &state, sizeof(state2)); + blake2s_compress(&state1, blocks, 3, BLAKE2S_BLOCK_SIZE); + blake2s_compress_generic(&state2, blocks, 3, BLAKE2S_BLOCK_SIZE); + if (memcmp(&state1, &state2, sizeof(state1))) { + pr_err("blake2s random compress self-test %d: FAIL\n", + i + 1); + success =3D false; + } +#endif + + memcpy(&state1, &state, sizeof(state1)); + blake2s_compress(&state1, blocks, 1, BLAKE2S_BLOCK_SIZE); + for (l =3D 1; l < TEST_ALIGNMENT; ++l) { + memcpy(unaligned_block + l, blocks, + BLAKE2S_BLOCK_SIZE); + memcpy(&state2, &state, sizeof(state2)); + blake2s_compress(&state2, unaligned_block + l, 1, + BLAKE2S_BLOCK_SIZE); + if (memcmp(&state1, &state2, sizeof(state1))) { + pr_err("blake2s random compress align %d self-test %d: FAIL\n", + l, i + 1); + success =3D false; + } + } + } + return success; } diff --git a/lib/crypto/blake2s.c b/lib/crypto/blake2s.c index c71c09621c09..98e688c6d891 100644 --- a/lib/crypto/blake2s.c +++ b/lib/crypto/blake2s.c @@ -16,16 +16,44 @@ #include #include =20 +static inline void blake2s_set_lastblock(struct blake2s_state *state) +{ + state->f[0] =3D -1; +} + void blake2s_update(struct blake2s_state *state, const u8 *in, size_t inle= n) { - __blake2s_update(state, in, inlen, false); + const size_t fill =3D BLAKE2S_BLOCK_SIZE - state->buflen; + + if (unlikely(!inlen)) + return; + if (inlen > fill) { + memcpy(state->buf + state->buflen, in, fill); + blake2s_compress(state, state->buf, 1, BLAKE2S_BLOCK_SIZE); + state->buflen =3D 0; + in +=3D fill; + inlen -=3D fill; + } + if (inlen > BLAKE2S_BLOCK_SIZE) { + const size_t nblocks =3D DIV_ROUND_UP(inlen, BLAKE2S_BLOCK_SIZE); + blake2s_compress(state, in, nblocks - 1, BLAKE2S_BLOCK_SIZE); + in +=3D BLAKE2S_BLOCK_SIZE * (nblocks - 1); + inlen -=3D BLAKE2S_BLOCK_SIZE * (nblocks - 1); + } + memcpy(state->buf + state->buflen, in, inlen); + state->buflen +=3D inlen; } EXPORT_SYMBOL(blake2s_update); =20 void blake2s_final(struct blake2s_state *state, u8 *out) { WARN_ON(IS_ENABLED(DEBUG) && !out); - __blake2s_final(state, out, false); + blake2s_set_lastblock(state); + memset(state->buf + state->buflen, 0, + BLAKE2S_BLOCK_SIZE - state->buflen); /* Padding */ + blake2s_compress(state, state->buf, 1, state->buflen); + cpu_to_le32_array(state->h, ARRAY_SIZE(state->h)); + memcpy(out, state->h, state->outlen); memzero_explicit(state, sizeof(*state)); } EXPORT_SYMBOL(blake2s_final); @@ -38,12 +66,7 @@ static int __init blake2s_mod_init(void) return 0; } =20 -static void __exit blake2s_mod_exit(void) -{ -} - module_init(blake2s_mod_init); -module_exit(blake2s_mod_exit); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("BLAKE2s hash function"); MODULE_AUTHOR("Jason A. Donenfeld "); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EE97C25B0D for ; Mon, 15 Aug 2022 23:14:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344823AbiHOXOr (ORCPT ); Mon, 15 Aug 2022 19:14:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346544AbiHOXNW (ORCPT ); Mon, 15 Aug 2022 19:13:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0881F79A71; Mon, 15 Aug 2022 13:01:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BFCCDB81142; Mon, 15 Aug 2022 20:01:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29B42C433D6; Mon, 15 Aug 2022 20:00:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593659; bh=QG7YcB/YnSrWQNHGMYY9Gqyv7zylhFoS0ArZmhPGD6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CqTo+7wsEFfUnmlcq542/ipd9T1DdUNxlN+Oz3V04Q5hVwtsycFI56AxfZXQK+9Za mY4xu+O7YlD7cVuZYHcXy/P7EWRhRe2UywbcaEl0kPqPzxyi5LzJ/xGojt2oaJtEYO xRXea34x7CrnBAdi3+AcBRgYf/IFbYcU8RoozwWk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , Imre Deak , Jani Nikula , Sasha Levin Subject: [PATCH 5.18 0983/1095] drm/dp/mst: Read the extended DPCD capabilities during system resume Date: Mon, 15 Aug 2022 20:06:22 +0200 Message-Id: <20220815180509.790596022@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Imre Deak [ Upstream commit 7a710a8bc909313951eb9252d8419924c771d7c2 ] The WD22TB4 Thunderbolt dock at least will revert its DP_MAX_LINK_RATE from HBR3 to HBR2 after system suspend/resume if the DP_DP13_DPCD_REV registers are not read subsequently also as required. Fix this by reading DP_DP13_DPCD_REV registers as well, matching what is done during connector detection. While at it also fix up the same call in drm_dp_mst_dump_topology(). Cc: Lyude Paul Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5292 Signed-off-by: Imre Deak Reviewed-by: Jani Nikula Cc: # v5.14+ Reviewed-by: Lyude Paul Link: https://patchwork.freedesktop.org/patch/msgid/20220614094537.885472-1= -imre.deak@intel.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/dp/drm_dp_mst_topology.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/dp/drm_dp_mst_topology.c b/drivers/gpu/drm/dp/= drm_dp_mst_topology.c index 7a7cc44686f9..96869875390f 100644 --- a/drivers/gpu/drm/dp/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/dp/drm_dp_mst_topology.c @@ -3861,9 +3861,7 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_= topology_mgr *mgr, if (!mgr->mst_primary) goto out_fail; =20 - ret =3D drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, mgr->dpcd, - DP_RECEIVER_CAP_SIZE); - if (ret !=3D DP_RECEIVER_CAP_SIZE) { + if (drm_dp_read_dpcd_caps(mgr->aux, mgr->dpcd) < 0) { drm_dbg_kms(mgr->dev, "dpcd read failed - undocked during suspend?\n"); goto out_fail; } @@ -4912,8 +4910,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m, u8 buf[DP_PAYLOAD_TABLE_SIZE]; int ret; =20 - ret =3D drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZ= E); - if (ret) { + if (drm_dp_read_dpcd_caps(mgr->aux, buf) < 0) { seq_printf(m, "dpcd read failed\n"); goto out; } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EC95C25B0D for ; Mon, 15 Aug 2022 23:15:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243440AbiHOXPC (ORCPT ); Mon, 15 Aug 2022 19:15:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245556AbiHOXNl (ORCPT ); Mon, 15 Aug 2022 19:13:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3359779EF8; Mon, 15 Aug 2022 13:01:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CC9B3B80EB1; Mon, 15 Aug 2022 20:01:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34A66C433D6; Mon, 15 Aug 2022 20:01:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593665; bh=DpIsB85cAaX72M1feI13jcsxfwUbFB17TZwzeEvMRtA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LmSoWZPbP6Fp7TN4Y5OfdZieLZhiPhqdS0h/CMZhOOk5BAO9i3PR8lst4fC09rK1S nVO9hRHLht3eb5Xv7MiyPuffwf9zYIWiajJIXvAKqi5ICufMszUlUN4vV3t5tSmzhR fEr+t4upj+RllfagoA7dG51kcL46DYIgqABr+hQo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0984/1095] drm/vc4: drv: Adopt the dma configuration from the HVS or V3D component Date: Mon, 15 Aug 2022 20:06:23 +0200 Message-Id: <20220815180509.832340319@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit da8e393e23efb60eba8959856c7df88f9859f6eb ] vc4_drv isn't necessarily under the /soc node in DT as it is a virtual device, but it is the one that does the allocations. The DMA addresses are consumed by primarily the HVS or V3D, and those require VideoCore cache alias address mapping, and so will be under /soc. During probe find the a suitable device node for HVS or V3D, and adopt the DMA configuration of that node. Cc: Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-2-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_drv.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 162bc18e7497..14a7d529144d 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -209,6 +209,15 @@ static void vc4_match_add_drivers(struct device *dev, } } =20 +const struct of_device_id vc4_dma_range_matches[] =3D { + { .compatible =3D "brcm,bcm2711-hvs" }, + { .compatible =3D "brcm,bcm2835-hvs" }, + { .compatible =3D "brcm,bcm2835-v3d" }, + { .compatible =3D "brcm,cygnus-v3d" }, + { .compatible =3D "brcm,vc4-v3d" }, + {} +}; + static int vc4_drm_bind(struct device *dev) { struct platform_device *pdev =3D to_platform_device(dev); @@ -227,6 +236,16 @@ static int vc4_drm_bind(struct device *dev) vc4_drm_driver.driver_features &=3D ~DRIVER_RENDER; of_node_put(node); =20 + node =3D of_find_matching_node_and_match(NULL, vc4_dma_range_matches, + NULL); + if (node) { + ret =3D of_dma_configure(dev, node, true); + of_node_put(node); + + if (ret) + return ret; + } + vc4 =3D devm_drm_dev_alloc(dev, &vc4_drm_driver, struct vc4_dev, base); if (IS_ERR(vc4)) return PTR_ERR(vc4); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEBEBC3F6B0 for ; Mon, 15 Aug 2022 23:17:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343566AbiHOXPd (ORCPT ); Mon, 15 Aug 2022 19:15:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244510AbiHOXOX (ORCPT ); Mon, 15 Aug 2022 19:14:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4815C7B1E4; Mon, 15 Aug 2022 13:01:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1D6FB80EAD; Mon, 15 Aug 2022 20:01:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13D6EC433D6; Mon, 15 Aug 2022 20:01:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593675; bh=RFuo3WxZHd0czDWPWQq5UQkkkavjlJKyFlZDppA2rJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ye9a+lfIbFO4FCFcltTrjeGwHIaGb0aIYlYpzT+Zob/RDvck4G/yNvK9ZYwqdH/Sg rKDhKBmxEQ9BmPUjXQToNftxIaBqvdzpQs1clGyjKtaQcML0R0u4zBSsgfErbRJ6mX 2mluBBiv8Paz5VDJovcfH0ZP1urCCSlN6VHnF80o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Andrew Lunn , "David S. Miller" , Sasha Levin , Oleksij Rempel , Ferry Toth Subject: [PATCH 5.18 0985/1095] usbnet: smsc95xx: Dont clear read-only PHY interrupt Date: Mon, 15 Aug 2022 20:06:24 +0200 Message-Id: <20220815180509.873447422@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Wunner [ Upstream commit 3108871f19221372b251f7da1ac38736928b5b3a ] Upon receiving data from the Interrupt Endpoint, the SMSC LAN95xx driver attempts to clear the signaled interrupts by writing "all ones" to the Interrupt Status Register. However the driver only ever enables a single type of interrupt, namely the PHY Interrupt. And according to page 119 of the LAN950x datasheet, its bit in the Interrupt Status Register is read-only. There's no other way to clear it than in a separate PHY register: https://www.microchip.com/content/dam/mchp/documents/UNG/ProductDocuments/D= ataSheets/LAN950x-Data-Sheet-DS00001875D.pdf Consequently, writing "all ones" to the Interrupt Status Register is pointless and can be dropped. Tested-by: Oleksij Rempel # LAN9514/9512/9500 Tested-by: Ferry Toth # LAN9514 Signed-off-by: Lukas Wunner Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/usb/smsc95xx.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index edf0492ad489..2cb44d65bbc3 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -572,10 +572,6 @@ static int smsc95xx_link_reset(struct usbnet *dev) unsigned long flags; int ret; =20 - ret =3D smsc95xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL_); - if (ret < 0) - return ret; - spin_lock_irqsave(&pdata->mac_cr_lock, flags); if (pdata->phydev->duplex !=3D DUPLEX_FULL) { pdata->mac_cr &=3D ~MAC_CR_FDPX_; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 136CAC25B08 for ; Mon, 15 Aug 2022 23:17:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242124AbiHOXRP (ORCPT ); Mon, 15 Aug 2022 19:17:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345283AbiHOXOZ (ORCPT ); Mon, 15 Aug 2022 19:14:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BD1F7AC1D; Mon, 15 Aug 2022 13:01:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C2B3EB80EAD; Mon, 15 Aug 2022 20:01:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11A33C433C1; Mon, 15 Aug 2022 20:01:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593681; bh=DaELCTiURVygaN7KydWbsGgnuiXU/kiGrSZdk8PGV4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vs2wa4vDtmNlsUE74amOP4HfGOSX73+dRy3GR2gYPPdwndgKKfkEq/u1ASvoQy+DN ZBmQU1ag5jVGQzIWQnlLzpXOclpfI6G8qSllkJBESCnabtivNlanSNOPRkX5bpNEIT 2GwsSyGTwYZi22GTDN9SwJHVhVFOuZ8JN/spvaCg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Andrew Lunn , "David S. Miller" , Sasha Levin , Oleksij Rempel , Ferry Toth Subject: [PATCH 5.18 0986/1095] usbnet: smsc95xx: Avoid link settings race on interrupt reception Date: Mon, 15 Aug 2022 20:06:25 +0200 Message-Id: <20220815180509.913191496@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Wunner [ Upstream commit 8960f878e39fadc03d74292a6731f1e914cf2019 ] When a PHY interrupt is signaled, the SMSC LAN95xx driver updates the MAC full duplex mode and PHY flow control registers based on cached data in struct phy_device: smsc95xx_status() # raises EVENT_LINK_RESET usbnet_deferred_kevent() smsc95xx_link_reset() # uses cached data in phydev Simultaneously, phylib polls link status once per second and updates that cached data: phy_state_machine() phy_check_link_status() phy_read_status() lan87xx_read_status() genphy_read_status() # updates cached data in phydev If smsc95xx_link_reset() wins the race against genphy_read_status(), the registers may be updated based on stale data. E.g. if the link was previously down, phydev->duplex is set to DUPLEX_UNKNOWN and that's what smsc95xx_link_reset() will use, even though genphy_read_status() may update it to DUPLEX_FULL afterwards. PHY interrupts are currently only enabled on suspend to trigger wakeup, so the impact of the race is limited, but we're about to enable them perpetually. Avoid the race by delaying execution of smsc95xx_link_reset() until phy_state_machine() has done its job and calls back via smsc95xx_handle_link_change(). Signaling EVENT_LINK_RESET on wakeup is not necessary because phylib picks up link status changes through polling. So drop the declaration of a ->link_reset() callback. Note that the semicolon on a line by itself added in smsc95xx_status() is a placeholder for a function call which will be added in a subsequent commit. That function call will actually handle the INT_ENP_PHY_INT_ interrupt. Tested-by: Oleksij Rempel # LAN9514/9512/9500 Tested-by: Ferry Toth # LAN9514 Signed-off-by: Lukas Wunner Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/usb/smsc95xx.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 2cb44d65bbc3..f5a208948d22 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -566,7 +566,7 @@ static int smsc95xx_phy_update_flowcontrol(struct usbne= t *dev) return smsc95xx_write_reg(dev, AFC_CFG, afc_cfg); } =20 -static int smsc95xx_link_reset(struct usbnet *dev) +static void smsc95xx_mac_update_fullduplex(struct usbnet *dev) { struct smsc95xx_priv *pdata =3D dev->driver_priv; unsigned long flags; @@ -583,14 +583,16 @@ static int smsc95xx_link_reset(struct usbnet *dev) spin_unlock_irqrestore(&pdata->mac_cr_lock, flags); =20 ret =3D smsc95xx_write_reg(dev, MAC_CR, pdata->mac_cr); - if (ret < 0) - return ret; + if (ret < 0) { + if (ret !=3D -ENODEV) + netdev_warn(dev->net, + "Error updating MAC full duplex mode\n"); + return; + } =20 ret =3D smsc95xx_phy_update_flowcontrol(dev); if (ret < 0) netdev_warn(dev->net, "Error updating PHY flow control\n"); - - return ret; } =20 static void smsc95xx_status(struct usbnet *dev, struct urb *urb) @@ -607,7 +609,7 @@ static void smsc95xx_status(struct usbnet *dev, struct = urb *urb) netif_dbg(dev, link, dev->net, "intdata: 0x%08X\n", intdata); =20 if (intdata & INT_ENP_PHY_INT_) - usbnet_defer_kevent(dev, EVENT_LINK_RESET); + ; else netdev_warn(dev->net, "unexpected interrupt, intdata=3D0x%08X\n", intdata); @@ -1088,6 +1090,7 @@ static void smsc95xx_handle_link_change(struct net_de= vice *net) struct usbnet *dev =3D netdev_priv(net); =20 phy_print_status(net->phydev); + smsc95xx_mac_update_fullduplex(dev); usbnet_defer_kevent(dev, EVENT_LINK_CHANGE); } =20 @@ -1993,7 +1996,6 @@ static const struct driver_info smsc95xx_info =3D { .description =3D "smsc95xx USB 2.0 Ethernet", .bind =3D smsc95xx_bind, .unbind =3D smsc95xx_unbind, - .link_reset =3D smsc95xx_link_reset, .reset =3D smsc95xx_reset, .check_connect =3D smsc95xx_start_phy, .stop =3D smsc95xx_stop, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26F0BC25B08 for ; Mon, 15 Aug 2022 23:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344547AbiHOX0V (ORCPT ); Mon, 15 Aug 2022 19:26:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347438AbiHOXVm (ORCPT ); Mon, 15 Aug 2022 19:21:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40C2B14AEE9; Mon, 15 Aug 2022 13:04:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D007660690; Mon, 15 Aug 2022 20:04:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB06CC433D6; Mon, 15 Aug 2022 20:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593883; bh=ehe8B8zILd0oalAHC8ZfINlVH6xP1qPeuChFmGf3QbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f2C5kL1fKKE2BETF2WMgGnmA1ql1mZD8EMBADFZ/nOZh2AKwJM0T4EmYUbdXpSxij Hg4nTt8phtFuC/tn1XW8XysG8zscPNhIW7AMRnEKLh7ExGgWLJskL8tEMf9hNRogf+ HI6chdJxZvVczo2dNMcDHi76fPhf0PQzqxqAetIY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Andre Edich , "David S. Miller" , Sasha Levin , Oleksij Rempel , Ferry Toth , Andrew Lunn Subject: [PATCH 5.18 0987/1095] usbnet: smsc95xx: Forward PHY interrupts to PHY driver to avoid polling Date: Mon, 15 Aug 2022 20:06:26 +0200 Message-Id: <20220815180509.951877772@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Wunner [ Upstream commit 1ce8b37241ed291af56f7a49bbdbf20c08728e88 ] Link status of SMSC LAN95xx chips is polled once per second, even though they're capable of signaling PHY interrupts through the MAC layer. Forward those interrupts to the PHY driver to avoid polling. Benefits are reduced bus traffic, reduced CPU overhead and quicker interface bringup. Polling was introduced in 2016 by commit d69d16949346 ("usbnet: smsc95xx: fix link detection for disabled autonegotiation"). Back then, the LAN95xx driver neglected to enable the ENERGYON interrupt, hence couldn't detect link-up events when auto-negotiation was disabled. The proper solution would have been to enable the ENERGYON interrupt instead of polling. Since then, PHY handling was moved from the LAN95xx driver to the SMSC PHY driver with commit 05b35e7eb9a1 ("smsc95xx: add phylib support"). That PHY driver is capable of link detection with auto-negotiation disabled because it enables the ENERGYON interrupt. Note that signaling interrupts through the MAC layer not only works with the integrated PHY, but also with an external PHY, provided its interrupt pin is attached to LAN95xx's nPHY_INT pin. In the unlikely event that the interrupt pin of an external PHY is attached to a GPIO of the SoC (or not connected at all), the driver can be amended to retrieve the irq from the PHY's of_node. To forward PHY interrupts to phylib, it is not sufficient to call phy_mac_interrupt(). Instead, the PHY's interrupt handler needs to run so that PHY interrupts are cleared. That's because according to page 119 of the LAN950x datasheet, "The source of this interrupt is a level. The interrupt persists until it is cleared in the PHY." https://www.microchip.com/content/dam/mchp/documents/UNG/ProductDocuments/D= ataSheets/LAN950x-Data-Sheet-DS00001875D.pdf Therefore, create an IRQ domain with a single IRQ for the PHY. In the future, the IRQ domain may be extended to support the 11 GPIOs on the LAN95xx. Normally the PHY interrupt should be masked until the PHY driver has cleared it. However masking requires a (sleeping) USB transaction and interrupts are received in (non-sleepable) softirq context. I decided not to mask the interrupt at all (by using the dummy_irq_chip's noop ->irq_mask() callback): The USB interrupt endpoint is polled in 1 msec intervals and normally that's sufficient to wake the PHY driver's IRQ thread and have it clear the interrupt. If it does take longer, worst thing that can happen is the IRQ thread is woken again. No big deal. Because PHY interrupts are now perpetually enabled, there's no need to selectively enable them on suspend. So remove all invocations of smsc95xx_enable_phy_wakeup_interrupts(). In smsc95xx_resume(), move the call of phy_init_hw() before usbnet_resume() (which restarts the status URB) to ensure that the PHY is fully initialized when an interrupt is handled. Tested-by: Oleksij Rempel # LAN9514/9512/9500 Tested-by: Ferry Toth # LAN9514 Signed-off-by: Lukas Wunner Reviewed-by: Andrew Lunn # from a PHY perspective Cc: Andre Edich Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/usb/smsc95xx.c | 113 ++++++++++++++++++++----------------- 1 file changed, 61 insertions(+), 52 deletions(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index f5a208948d22..358b170cc8fb 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include #include @@ -53,6 +55,9 @@ #define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) =20 +#define SMSC95XX_NR_IRQS (1) /* raise to 12 for GPIOs */ +#define PHY_HWIRQ (SMSC95XX_NR_IRQS - 1) + struct smsc95xx_priv { u32 mac_cr; u32 hash_hi; @@ -61,6 +66,9 @@ struct smsc95xx_priv { spinlock_t mac_cr_lock; u8 features; u8 suspend_flags; + struct irq_chip irqchip; + struct irq_domain *irqdomain; + struct fwnode_handle *irqfwnode; struct mii_bus *mdiobus; struct phy_device *phydev; }; @@ -597,6 +605,8 @@ static void smsc95xx_mac_update_fullduplex(struct usbne= t *dev) =20 static void smsc95xx_status(struct usbnet *dev, struct urb *urb) { + struct smsc95xx_priv *pdata =3D dev->driver_priv; + unsigned long flags; u32 intdata; =20 if (urb->actual_length !=3D 4) { @@ -608,11 +618,15 @@ static void smsc95xx_status(struct usbnet *dev, struc= t urb *urb) intdata =3D get_unaligned_le32(urb->transfer_buffer); netif_dbg(dev, link, dev->net, "intdata: 0x%08X\n", intdata); =20 + local_irq_save(flags); + if (intdata & INT_ENP_PHY_INT_) - ; + generic_handle_domain_irq(pdata->irqdomain, PHY_HWIRQ); else netdev_warn(dev->net, "unexpected interrupt, intdata=3D0x%08X\n", intdata); + + local_irq_restore(flags); } =20 /* Enable or disable Tx & Rx checksum offload engines */ @@ -1098,8 +1112,9 @@ static int smsc95xx_bind(struct usbnet *dev, struct u= sb_interface *intf) { struct smsc95xx_priv *pdata; bool is_internal_phy; + char usb_path[64]; + int ret, phy_irq; u32 val; - int ret; =20 printk(KERN_INFO SMSC_CHIPNAME " v" SMSC_DRIVER_VERSION "\n"); =20 @@ -1139,10 +1154,38 @@ static int smsc95xx_bind(struct usbnet *dev, struct= usb_interface *intf) if (ret) goto free_pdata; =20 + /* create irq domain for use by PHY driver and GPIO consumers */ + usb_make_path(dev->udev, usb_path, sizeof(usb_path)); + pdata->irqfwnode =3D irq_domain_alloc_named_fwnode(usb_path); + if (!pdata->irqfwnode) { + ret =3D -ENOMEM; + goto free_pdata; + } + + pdata->irqdomain =3D irq_domain_create_linear(pdata->irqfwnode, + SMSC95XX_NR_IRQS, + &irq_domain_simple_ops, + pdata); + if (!pdata->irqdomain) { + ret =3D -ENOMEM; + goto free_irqfwnode; + } + + phy_irq =3D irq_create_mapping(pdata->irqdomain, PHY_HWIRQ); + if (!phy_irq) { + ret =3D -ENOENT; + goto remove_irqdomain; + } + + pdata->irqchip =3D dummy_irq_chip; + pdata->irqchip.name =3D SMSC_CHIPNAME; + irq_set_chip_and_handler_name(phy_irq, &pdata->irqchip, + handle_simple_irq, "phy"); + pdata->mdiobus =3D mdiobus_alloc(); if (!pdata->mdiobus) { ret =3D -ENOMEM; - goto free_pdata; + goto dispose_irq; } =20 ret =3D smsc95xx_read_reg(dev, HW_CFG, &val); @@ -1175,6 +1218,7 @@ static int smsc95xx_bind(struct usbnet *dev, struct u= sb_interface *intf) goto unregister_mdio; } =20 + pdata->phydev->irq =3D phy_irq; pdata->phydev->is_internal =3D is_internal_phy; =20 /* detect device revision as different features may be available */ @@ -1217,6 +1261,15 @@ static int smsc95xx_bind(struct usbnet *dev, struct = usb_interface *intf) free_mdio: mdiobus_free(pdata->mdiobus); =20 +dispose_irq: + irq_dispose_mapping(phy_irq); + +remove_irqdomain: + irq_domain_remove(pdata->irqdomain); + +free_irqfwnode: + irq_domain_free_fwnode(pdata->irqfwnode); + free_pdata: kfree(pdata); return ret; @@ -1229,6 +1282,9 @@ static void smsc95xx_unbind(struct usbnet *dev, struc= t usb_interface *intf) phy_disconnect(dev->net->phydev); mdiobus_unregister(pdata->mdiobus); mdiobus_free(pdata->mdiobus); + irq_dispose_mapping(irq_find_mapping(pdata->irqdomain, PHY_HWIRQ)); + irq_domain_remove(pdata->irqdomain); + irq_domain_free_fwnode(pdata->irqfwnode); netif_dbg(dev, ifdown, dev->net, "free pdata\n"); kfree(pdata); } @@ -1253,29 +1309,6 @@ static u32 smsc_crc(const u8 *buffer, size_t len, in= t filter) return crc << ((filter % 2) * 16); } =20 -static int smsc95xx_enable_phy_wakeup_interrupts(struct usbnet *dev, u16 m= ask) -{ - int ret; - - netdev_dbg(dev->net, "enabling PHY wakeup interrupts\n"); - - /* read to clear */ - ret =3D smsc95xx_mdio_read_nopm(dev, PHY_INT_SRC); - if (ret < 0) - return ret; - - /* enable interrupt source */ - ret =3D smsc95xx_mdio_read_nopm(dev, PHY_INT_MASK); - if (ret < 0) - return ret; - - ret |=3D mask; - - smsc95xx_mdio_write_nopm(dev, PHY_INT_MASK, ret); - - return 0; -} - static int smsc95xx_link_ok_nopm(struct usbnet *dev) { int ret; @@ -1442,7 +1475,6 @@ static int smsc95xx_enter_suspend3(struct usbnet *dev) static int smsc95xx_autosuspend(struct usbnet *dev, u32 link_up) { struct smsc95xx_priv *pdata =3D dev->driver_priv; - int ret; =20 if (!netif_running(dev->net)) { /* interface is ifconfig down so fully power down hw */ @@ -1461,27 +1493,10 @@ static int smsc95xx_autosuspend(struct usbnet *dev,= u32 link_up) } =20 netdev_dbg(dev->net, "autosuspend entering SUSPEND1\n"); - - /* enable PHY wakeup events for if cable is attached */ - ret =3D smsc95xx_enable_phy_wakeup_interrupts(dev, - PHY_INT_MASK_ANEG_COMP_); - if (ret < 0) { - netdev_warn(dev->net, "error enabling PHY wakeup ints\n"); - return ret; - } - netdev_info(dev->net, "entering SUSPEND1 mode\n"); return smsc95xx_enter_suspend1(dev); } =20 - /* enable PHY wakeup events so we remote wakeup if cable is pulled */ - ret =3D smsc95xx_enable_phy_wakeup_interrupts(dev, - PHY_INT_MASK_LINK_DOWN_); - if (ret < 0) { - netdev_warn(dev->net, "error enabling PHY wakeup ints\n"); - return ret; - } - netdev_dbg(dev->net, "autosuspend entering SUSPEND3\n"); return smsc95xx_enter_suspend3(dev); } @@ -1547,13 +1562,6 @@ static int smsc95xx_suspend(struct usb_interface *in= tf, pm_message_t message) } =20 if (pdata->wolopts & WAKE_PHY) { - ret =3D smsc95xx_enable_phy_wakeup_interrupts(dev, - (PHY_INT_MASK_ANEG_COMP_ | PHY_INT_MASK_LINK_DOWN_)); - if (ret < 0) { - netdev_warn(dev->net, "error enabling PHY wakeup ints\n"); - goto done; - } - /* if link is down then configure EDPD and enter SUSPEND1, * otherwise enter SUSPEND0 below */ @@ -1787,11 +1795,12 @@ static int smsc95xx_resume(struct usb_interface *in= tf) return ret; } =20 + phy_init_hw(pdata->phydev); + ret =3D usbnet_resume(intf); if (ret < 0) netdev_warn(dev->net, "usbnet_resume error\n"); =20 - phy_init_hw(pdata->phydev); return ret; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29D79C00140 for ; Mon, 15 Aug 2022 23:17:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344200AbiHOXR4 (ORCPT ); Mon, 15 Aug 2022 19:17:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345281AbiHOXO1 (ORCPT ); Mon, 15 Aug 2022 19:14:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91E6F895C9; Mon, 15 Aug 2022 13:01:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 040646068D; Mon, 15 Aug 2022 20:01:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D2EDC433D6; Mon, 15 Aug 2022 20:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593698; bh=lbqy4wHnoIt1xf61VddVniRbmSLd1OYAPpAf6exUzmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w7GrRqM+5LOlyMMwDMvDMjnj367/yvehljbpCSXJ02vS1e+CfZtrzl5FxCZ6GvX4y fnamq0jgx/wwzWwSUGdZquzvcVBCURzuFbIA352oIE1C39WICNRf9wU28POTRHmcb+ S8NHuTnpPTxYWuIlPyJXaDy7hN2p2b803+8DZXbo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Andre Edich , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 0988/1095] usbnet: smsc95xx: Fix deadlock on runtime resume Date: Mon, 15 Aug 2022 20:06:27 +0200 Message-Id: <20220815180509.992286291@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Wunner [ Upstream commit 7b960c967f2aa01ab8f45c5a0bd78e754cffdeee ] Commit 05b35e7eb9a1 ("smsc95xx: add phylib support") amended smsc95xx_resume() to call phy_init_hw(). That function waits for the device to runtime resume even though it is placed in the runtime resume path, causing a deadlock. The problem is that phy_init_hw() calls down to smsc95xx_mdiobus_read(), which never uses the _nopm variant of usbnet_read_cmd(). Commit b4df480f68ae ("usbnet: smsc95xx: add reset_resume function with reset operation") causes a similar deadlock on resume if the device was already runtime suspended when entering system sleep: That's because the commit introduced smsc95xx_reset_resume(), which calls down to smsc95xx_reset(), which neglects to use _nopm accessors. Fix by auto-detecting whether a device access is performed by the suspend/resume task_struct and use the _nopm variant if so. This works because the PM core guarantees that suspend/resume callbacks are run in task context. Stacktrace for posterity: INFO: task kworker/2:1:49 blocked for more than 122 seconds. Workqueue: usb_hub_wq hub_event schedule rpm_resume __pm_runtime_resume usb_autopm_get_interface usbnet_read_cmd __smsc95xx_read_reg __smsc95xx_phy_wait_not_busy __smsc95xx_mdio_read smsc95xx_mdiobus_read __mdiobus_read mdiobus_read smsc_phy_reset phy_init_hw smsc95xx_resume usb_resume_interface usb_resume_both usb_runtime_resume __rpm_callback rpm_callback rpm_resume __pm_runtime_resume usb_autoresume_device hub_event process_one_work Fixes: b4df480f68ae ("usbnet: smsc95xx: add reset_resume function with rese= t operation") Signed-off-by: Lukas Wunner Cc: stable@vger.kernel.org # v3.16+ Cc: Andre Edich Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/usb/smsc95xx.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 358b170cc8fb..515363d74078 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -71,6 +71,7 @@ struct smsc95xx_priv { struct fwnode_handle *irqfwnode; struct mii_bus *mdiobus; struct phy_device *phydev; + struct task_struct *pm_task; }; =20 static bool turbo_mode =3D true; @@ -80,13 +81,14 @@ MODULE_PARM_DESC(turbo_mode, "Enable multiple frames pe= r Rx transaction"); static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, u32 *data, int in_pm) { + struct smsc95xx_priv *pdata =3D dev->driver_priv; u32 buf; int ret; int (*fn)(struct usbnet *, u8, u8, u16, u16, void *, u16); =20 BUG_ON(!dev); =20 - if (!in_pm) + if (current !=3D pdata->pm_task) fn =3D usbnet_read_cmd; else fn =3D usbnet_read_cmd_nopm; @@ -110,13 +112,14 @@ static int __must_check __smsc95xx_read_reg(struct us= bnet *dev, u32 index, static int __must_check __smsc95xx_write_reg(struct usbnet *dev, u32 index, u32 data, int in_pm) { + struct smsc95xx_priv *pdata =3D dev->driver_priv; u32 buf; int ret; int (*fn)(struct usbnet *, u8, u8, u16, u16, const void *, u16); =20 BUG_ON(!dev); =20 - if (!in_pm) + if (current !=3D pdata->pm_task) fn =3D usbnet_write_cmd; else fn =3D usbnet_write_cmd_nopm; @@ -1508,9 +1511,12 @@ static int smsc95xx_suspend(struct usb_interface *in= tf, pm_message_t message) u32 val, link_up; int ret; =20 + pdata->pm_task =3D current; + ret =3D usbnet_suspend(intf, message); if (ret < 0) { netdev_warn(dev->net, "usbnet_suspend error\n"); + pdata->pm_task =3D NULL; return ret; } =20 @@ -1750,6 +1756,7 @@ static int smsc95xx_suspend(struct usb_interface *int= f, pm_message_t message) if (ret && PMSG_IS_AUTO(message)) usbnet_resume(intf); =20 + pdata->pm_task =3D NULL; return ret; } =20 @@ -1770,29 +1777,31 @@ static int smsc95xx_resume(struct usb_interface *in= tf) /* do this first to ensure it's cleared even in error case */ pdata->suspend_flags =3D 0; =20 + pdata->pm_task =3D current; + if (suspend_flags & SUSPEND_ALLMODES) { /* clear wake-up sources */ ret =3D smsc95xx_read_reg_nopm(dev, WUCSR, &val); if (ret < 0) - return ret; + goto done; =20 val &=3D ~(WUCSR_WAKE_EN_ | WUCSR_MPEN_); =20 ret =3D smsc95xx_write_reg_nopm(dev, WUCSR, val); if (ret < 0) - return ret; + goto done; =20 /* clear wake-up status */ ret =3D smsc95xx_read_reg_nopm(dev, PM_CTRL, &val); if (ret < 0) - return ret; + goto done; =20 val &=3D ~PM_CTL_WOL_EN_; val |=3D PM_CTL_WUPS_; =20 ret =3D smsc95xx_write_reg_nopm(dev, PM_CTRL, val); if (ret < 0) - return ret; + goto done; } =20 phy_init_hw(pdata->phydev); @@ -1801,15 +1810,20 @@ static int smsc95xx_resume(struct usb_interface *in= tf) if (ret < 0) netdev_warn(dev->net, "usbnet_resume error\n"); =20 +done: + pdata->pm_task =3D NULL; return ret; } =20 static int smsc95xx_reset_resume(struct usb_interface *intf) { struct usbnet *dev =3D usb_get_intfdata(intf); + struct smsc95xx_priv *pdata =3D dev->driver_priv; int ret; =20 + pdata->pm_task =3D current; ret =3D smsc95xx_reset(dev); + pdata->pm_task =3D NULL; if (ret < 0) return ret; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34F03C00140 for ; Mon, 15 Aug 2022 23:19:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231462AbiHOXTk (ORCPT ); Mon, 15 Aug 2022 19:19:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352987AbiHOXPr (ORCPT ); Mon, 15 Aug 2022 19:15:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3184D9D664; Mon, 15 Aug 2022 13:02:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D6228B80EAD; Mon, 15 Aug 2022 20:02:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45FD6C433B5; Mon, 15 Aug 2022 20:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593763; bh=PYKDtfJN7xItE80ybdVMebvz/REKeuxmoiaYOjlu43Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jH3K+9Y5tY64sZ41xt+VGK0yf8Pvgql6/5LlTEw22CoLEAqgqkGgpEvE/jqiLeFD/ 6Dwb/a9uPb6PqpdNiTtmcsY5lhT4R4v4iFyUoJk1/qOVnOxrio0A2ZoAaB0/B09G4g MgRGHn82RcwJuZ6Un5iGItUns9dB4FLpDn20soSA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, huhai , Jackie Liu , Sudeep Holla , Sasha Levin Subject: [PATCH 5.18 0989/1095] firmware: arm_scpi: Ensure scpi_info is not assigned if the probe fails Date: Mon, 15 Aug 2022 20:06:28 +0200 Message-Id: <20220815180510.022504747@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sudeep Holla [ Upstream commit 689640efc0a2c4e07e6f88affe6d42cd40cc3f85 ] When scpi probe fails, at any point, we need to ensure that the scpi_info is not set and will remain NULL until the probe succeeds. If it is not taken care, then it could result use-after-free as the value is exported via get_scpi_ops() and could refer to a memory allocated via devm_kzalloc() but freed when the probe fails. Link: https://lore.kernel.org/r/20220701160310.148344-1-sudeep.holla@arm.com Cc: stable@vger.kernel.org # 4.19+ Reported-by: huhai Reviewed-by: Jackie Liu Signed-off-by: Sudeep Holla Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/firmware/arm_scpi.c | 61 +++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c index ddf0b9ff9e15..435d0e2658a4 100644 --- a/drivers/firmware/arm_scpi.c +++ b/drivers/firmware/arm_scpi.c @@ -815,7 +815,7 @@ static int scpi_init_versions(struct scpi_drvinfo *info) info->firmware_version =3D le32_to_cpu(caps.platform_version); } /* Ignore error if not implemented */ - if (scpi_info->is_legacy && ret =3D=3D -EOPNOTSUPP) + if (info->is_legacy && ret =3D=3D -EOPNOTSUPP) return 0; =20 return ret; @@ -913,13 +913,14 @@ static int scpi_probe(struct platform_device *pdev) struct resource res; struct device *dev =3D &pdev->dev; struct device_node *np =3D dev->of_node; + struct scpi_drvinfo *scpi_drvinfo; =20 - scpi_info =3D devm_kzalloc(dev, sizeof(*scpi_info), GFP_KERNEL); - if (!scpi_info) + scpi_drvinfo =3D devm_kzalloc(dev, sizeof(*scpi_drvinfo), GFP_KERNEL); + if (!scpi_drvinfo) return -ENOMEM; =20 if (of_match_device(legacy_scpi_of_match, &pdev->dev)) - scpi_info->is_legacy =3D true; + scpi_drvinfo->is_legacy =3D true; =20 count =3D of_count_phandle_with_args(np, "mboxes", "#mbox-cells"); if (count < 0) { @@ -927,19 +928,19 @@ static int scpi_probe(struct platform_device *pdev) return -ENODEV; } =20 - scpi_info->channels =3D devm_kcalloc(dev, count, sizeof(struct scpi_chan), - GFP_KERNEL); - if (!scpi_info->channels) + scpi_drvinfo->channels =3D + devm_kcalloc(dev, count, sizeof(struct scpi_chan), GFP_KERNEL); + if (!scpi_drvinfo->channels) return -ENOMEM; =20 - ret =3D devm_add_action(dev, scpi_free_channels, scpi_info); + ret =3D devm_add_action(dev, scpi_free_channels, scpi_drvinfo); if (ret) return ret; =20 - for (; scpi_info->num_chans < count; scpi_info->num_chans++) { + for (; scpi_drvinfo->num_chans < count; scpi_drvinfo->num_chans++) { resource_size_t size; - int idx =3D scpi_info->num_chans; - struct scpi_chan *pchan =3D scpi_info->channels + idx; + int idx =3D scpi_drvinfo->num_chans; + struct scpi_chan *pchan =3D scpi_drvinfo->channels + idx; struct mbox_client *cl =3D &pchan->cl; struct device_node *shmem =3D of_parse_phandle(np, "shmem", idx); =20 @@ -986,45 +987,53 @@ static int scpi_probe(struct platform_device *pdev) return ret; } =20 - scpi_info->commands =3D scpi_std_commands; + scpi_drvinfo->commands =3D scpi_std_commands; =20 - platform_set_drvdata(pdev, scpi_info); + platform_set_drvdata(pdev, scpi_drvinfo); =20 - if (scpi_info->is_legacy) { + if (scpi_drvinfo->is_legacy) { /* Replace with legacy variants */ scpi_ops.clk_set_val =3D legacy_scpi_clk_set_val; - scpi_info->commands =3D scpi_legacy_commands; + scpi_drvinfo->commands =3D scpi_legacy_commands; =20 /* Fill priority bitmap */ for (idx =3D 0; idx < ARRAY_SIZE(legacy_hpriority_cmds); idx++) set_bit(legacy_hpriority_cmds[idx], - scpi_info->cmd_priority); + scpi_drvinfo->cmd_priority); } =20 - ret =3D scpi_init_versions(scpi_info); + scpi_info =3D scpi_drvinfo; + + ret =3D scpi_init_versions(scpi_drvinfo); if (ret) { dev_err(dev, "incorrect or no SCP firmware found\n"); + scpi_info =3D NULL; return ret; } =20 - if (scpi_info->is_legacy && !scpi_info->protocol_version && - !scpi_info->firmware_version) + if (scpi_drvinfo->is_legacy && !scpi_drvinfo->protocol_version && + !scpi_drvinfo->firmware_version) dev_info(dev, "SCP Protocol legacy pre-1.0 firmware\n"); else dev_info(dev, "SCP Protocol %lu.%lu Firmware %lu.%lu.%lu version\n", FIELD_GET(PROTO_REV_MAJOR_MASK, - scpi_info->protocol_version), + scpi_drvinfo->protocol_version), FIELD_GET(PROTO_REV_MINOR_MASK, - scpi_info->protocol_version), + scpi_drvinfo->protocol_version), FIELD_GET(FW_REV_MAJOR_MASK, - scpi_info->firmware_version), + scpi_drvinfo->firmware_version), FIELD_GET(FW_REV_MINOR_MASK, - scpi_info->firmware_version), + scpi_drvinfo->firmware_version), FIELD_GET(FW_REV_PATCH_MASK, - scpi_info->firmware_version)); - scpi_info->scpi_ops =3D &scpi_ops; + scpi_drvinfo->firmware_version)); + + scpi_drvinfo->scpi_ops =3D &scpi_ops; =20 - return devm_of_platform_populate(dev); + ret =3D devm_of_platform_populate(dev); + if (ret) + scpi_info =3D NULL; + + return ret; } =20 static const struct of_device_id scpi_of_match[] =3D { --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39165C00140 for ; Mon, 15 Aug 2022 23:23:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233224AbiHOXXt (ORCPT ); Mon, 15 Aug 2022 19:23:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243187AbiHOXS5 (ORCPT ); Mon, 15 Aug 2022 19:18:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4852C149A13; Mon, 15 Aug 2022 13:03:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5029C61089; Mon, 15 Aug 2022 20:03:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58577C433C1; Mon, 15 Aug 2022 20:03:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593828; bh=ideHvfhDE9wq+JxMMdoFAQuD3viIDQ424rCtYQY44JA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dzptm9vIqJVsnS/M10s6MsU9i4++YBWGEumq3Ci8SMvz+i3TlJqUFYMHiWkJcvH4+ R4OhK4vph0N27YJRV59YCnm/DRiZT54EZ7FhIbEY+qW/nuQBX0DzgVv3RHeNJVC0FP 2YL8DRyaY50toeDhMg7NYGuca4IRFlfDZ9w00GgE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , stable , Alexander Shishkin , Sasha Levin Subject: [PATCH 5.18 0990/1095] intel_th: pci: Add Meteor Lake-P support Date: Mon, 15 Aug 2022 20:06:29 +0200 Message-Id: <20220815180510.065201774@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Shishkin [ Upstream commit 802a9a0b1d91274ef10d9fe429b4cc1e8c200aef ] Add support for the Trace Hub in Meteor Lake-P. Reviewed-by: Andy Shevchenko Cc: stable Signed-off-by: Alexander Shishkin Link: https://lore.kernel.org/r/20220705082637.59979-5-alexander.shishkin@l= inux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/= pci.c index fcd0aca75007..41a31c7f505f 100644 --- a/drivers/hwtracing/intel_th/pci.c +++ b/drivers/hwtracing/intel_th/pci.c @@ -284,6 +284,11 @@ static const struct pci_device_id intel_th_pci_id_tabl= e[] =3D { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x54a6), .driver_data =3D (kernel_ulong_t)&intel_th_2x, }, + { + /* Meteor Lake-P */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7e24), + .driver_data =3D (kernel_ulong_t)&intel_th_2x, + }, { /* Alder Lake CPU */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f), --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA6FCC3F6B0 for ; Mon, 15 Aug 2022 23:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343557AbiHOX0B (ORCPT ); Mon, 15 Aug 2022 19:26:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346033AbiHOXVR (ORCPT ); Mon, 15 Aug 2022 19:21:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 562187E32E; Mon, 15 Aug 2022 13:04:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E39D26068D; Mon, 15 Aug 2022 20:04:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC1D5C433C1; Mon, 15 Aug 2022 20:04:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593874; bh=3bSndzRHGwDoEIiOezBILBR3x1ANK+Rt3C1uwr4VLqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DEkfrXn7iJTxAyccQz0QIc8fWWmulym9qWmhfcNrV6QkAZfMcGgG6piw0h8Hr2bi8 H9FV0hNNETq2xyiYCydbCWse/tvMYJXKDDr0EniZpj0w63J/BoxRxDyta/D5PMlLMN pGvgVqJuamsM821bOj1p8T8cNVLyNr0SmtOztf+c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , stable , Alexander Shishkin , Sasha Levin Subject: [PATCH 5.18 0991/1095] intel_th: pci: Add Raptor Lake-S PCH support Date: Mon, 15 Aug 2022 20:06:30 +0200 Message-Id: <20220815180510.102890328@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Shishkin [ Upstream commit 23e2de5826e2fc4dd43e08bab3a2ea1a5338b063 ] Add support for the Trace Hub in Raptor Lake-S PCH. Reviewed-by: Andy Shevchenko Cc: stable Signed-off-by: Alexander Shishkin Link: https://lore.kernel.org/r/20220705082637.59979-6-alexander.shishkin@l= inux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/= pci.c index 41a31c7f505f..5b6da26f1b63 100644 --- a/drivers/hwtracing/intel_th/pci.c +++ b/drivers/hwtracing/intel_th/pci.c @@ -289,6 +289,11 @@ static const struct pci_device_id intel_th_pci_id_tabl= e[] =3D { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7e24), .driver_data =3D (kernel_ulong_t)&intel_th_2x, }, + { + /* Raptor Lake-S */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7a26), + .driver_data =3D (kernel_ulong_t)&intel_th_2x, + }, { /* Alder Lake CPU */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f), --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 089D1C25B0E for ; Mon, 15 Aug 2022 23:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344449AbiHOX0S (ORCPT ); Mon, 15 Aug 2022 19:26:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347057AbiHOXVl (ORCPT ); Mon, 15 Aug 2022 19:21:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FAAF7E31F; Mon, 15 Aug 2022 13:04:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 71DD7B810C5; Mon, 15 Aug 2022 20:04:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FE2AC433D6; Mon, 15 Aug 2022 20:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593880; bh=Ay0IweHselRBK0obV5DxogBP40yGNMeQhj7FwCdegvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xEsqcAz/tFjPycl1LSlv7AHNIKUtmOLsRxmiD7ZepWwbudiqDZ5eGO64ifQpszWo0 2nWTb6Kz1lLj4TdKWn9xL8wXwrGUp6Resok65831a3y046HnVRQQCTnGP1Tg/r9TyB djJraody+t7PwGPJqd1KB3NZATIr/U7sdjB702Ck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , stable , Alexander Shishkin , Sasha Levin Subject: [PATCH 5.18 0992/1095] intel_th: pci: Add Raptor Lake-S CPU support Date: Mon, 15 Aug 2022 20:06:31 +0200 Message-Id: <20220815180510.151055064@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Shishkin [ Upstream commit ff46a601afc5a66a81c3945b83d0a2caeb88e8bc ] Add support for the Trace Hub in Raptor Lake-S CPU. Reviewed-by: Andy Shevchenko Cc: stable Signed-off-by: Alexander Shishkin Link: https://lore.kernel.org/r/20220705082637.59979-7-alexander.shishkin@l= inux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/= pci.c index 5b6da26f1b63..147d338c191e 100644 --- a/drivers/hwtracing/intel_th/pci.c +++ b/drivers/hwtracing/intel_th/pci.c @@ -294,6 +294,11 @@ static const struct pci_device_id intel_th_pci_id_tabl= e[] =3D { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7a26), .driver_data =3D (kernel_ulong_t)&intel_th_2x, }, + { + /* Raptor Lake-S CPU */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa76f), + .driver_data =3D (kernel_ulong_t)&intel_th_2x, + }, { /* Alder Lake CPU */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f), --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C053FC25B0D for ; Mon, 15 Aug 2022 23:22:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347943AbiHOXVr (ORCPT ); Mon, 15 Aug 2022 19:21:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343725AbiHOXO2 (ORCPT ); Mon, 15 Aug 2022 19:14:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8591895FD; Mon, 15 Aug 2022 13:01:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9BA47B80EAD; Mon, 15 Aug 2022 20:01:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1393C433D7; Mon, 15 Aug 2022 20:01:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593704; bh=8JZ/Ppu8+/LJWNS3QNboIv0bypIL+9qabo0OOgziros=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uj+pWQZkhcqtVSxZiltBW9ExxMXH/3CRmisrtcfQs+k4FDhM54WVfHEO0MLeVeIWb bOBm3D3ML7cZWe1UKXA3x7ggwOGcESuh1GxKAow3sG57sYlSoaoj57RCy+7TpthHB2 ZohQJzBXJpVeqcOSgFDDN8O7XthXSfvZl3ylM/Ko= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lev Kujawski , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 0993/1095] KVM: set_msr_mce: Permit guests to ignore single-bit ECC errors Date: Mon, 15 Aug 2022 20:06:32 +0200 Message-Id: <20220815180510.188201325@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lev Kujawski [ Upstream commit 0471a7bd1bca2a47a5f378f2222c5cf39ce94152 ] Certain guest operating systems (e.g., UNIXWARE) clear bit 0 of MC1_CTL to ignore single-bit ECC data errors. Single-bit ECC data errors are always correctable and thus are safe to ignore because they are informational in nature rather than signaling a loss of data integrity. Prior to this patch, these guests would crash upon writing MC1_CTL, with resultant error messages like the following: error: kvm run failed Operation not permitted EAX=3Dfffffffe EBX=3Dfffffffe ECX=3D00000404 EDX=3Dffffffff ESI=3Dffffffff EDI=3D00000001 EBP=3Dfffdaba4 ESP=3Dfffdab20 EIP=3Dc01333a5 EFL=3D00000246 [---Z-P-] CPL=3D0 II=3D0 A20=3D1 SMM=3D0 HLT= =3D0 ES =3D0108 00000000 ffffffff 00c09300 DPL=3D0 DS [-WA] CS =3D0100 00000000 ffffffff 00c09b00 DPL=3D0 CS32 [-RA] SS =3D0108 00000000 ffffffff 00c09300 DPL=3D0 DS [-WA] DS =3D0108 00000000 ffffffff 00c09300 DPL=3D0 DS [-WA] FS =3D0000 00000000 ffffffff 00c00000 GS =3D0000 00000000 ffffffff 00c00000 LDT=3D0118 c1026390 00000047 00008200 DPL=3D0 LDT TR =3D0110 ffff5af0 00000067 00008b00 DPL=3D0 TSS32-busy GDT=3D ffff5020 000002cf IDT=3D ffff52f0 000007ff CR0=3D8001003b CR2=3D00000000 CR3=3D0100a000 CR4=3D00000230 DR0=3D00000000 DR1=3D00000000 DR2=3D00000000 DR3=3D00000000 DR6=3Dffff0ff0 DR7=3D00000400 EFER=3D0000000000000000 Code=3D08 89 01 89 51 04 c3 8b 4c 24 08 8b 01 8b 51 04 8b 4c 24 04 <0f> 30 c3 f7 05 a4 6d ff ff 10 00 00 00 74 03 0f 31 c3 33 c0 33 d2 c3 8d 74 26 00 0f 31 c3 Signed-off-by: Lev Kujawski Message-Id: <20220521081511.187388-1-lkujaw@member.fsf.org> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/x86.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 767a61e29f51..2316c978b598 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3226,10 +3226,13 @@ static int set_msr_mce(struct kvm_vcpu *vcpu, struc= t msr_data *msr_info) /* only 0 or all 1s can be written to IA32_MCi_CTL * some Linux kernels though clear bit 10 in bank 4 to * workaround a BIOS/GART TBL issue on AMD K8s, ignore - * this to avoid an uncatched #GP in the guest + * this to avoid an uncatched #GP in the guest. + * + * UNIXWARE clears bit 0 of MC1_CTL to ignore + * correctable, single-bit ECC data errors. */ if ((offset & 0x3) =3D=3D 0 && - data !=3D 0 && (data | (1 << 10)) !=3D ~(u64)0) + data !=3D 0 && (data | (1 << 10) | 1) !=3D ~(u64)0) return -1; =20 /* MCi_STATUS */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71495C2BB9D for ; Mon, 15 Aug 2022 23:22:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353271AbiHOXWA (ORCPT ); Mon, 15 Aug 2022 19:22:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344591AbiHOXO3 (ORCPT ); Mon, 15 Aug 2022 19:14:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B8147A530; Mon, 15 Aug 2022 13:01:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BCC9B61299; Mon, 15 Aug 2022 20:01:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1DA5C433C1; Mon, 15 Aug 2022 20:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593710; bh=uWra+Qzx8ugDojYZaaq+pat/bESp/okATL7sH1tOtCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QPie6zsPD2LRg5oww06kOVWV+MxtSmQl9Gs0cwl4N2Sg+luR2pK/lwy5nzV0nHrmv Uo7kryncDsICRT7vAKRqpzV6xVKzWYrRLkg/s293dT0kEHF1IWXQp+0oFFPrM5oxZv ScSOKF2Dx9R90fFHRcitPZCQvR30sQeIVMW1kCq4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Jim Mattson , Sasha Levin Subject: [PATCH 5.18 0994/1095] KVM: x86: Signal #GP, not -EPERM, on bad WRMSR(MCi_CTL/STATUS) Date: Mon, 15 Aug 2022 20:06:33 +0200 Message-Id: <20220815180510.231278419@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit 2368048bf5c2ec4b604ac3431564071e89a0bc71 ] Return '1', not '-1', when handling an illegal WRMSR to a MCi_CTL or MCi_STATUS MSR. The behavior of "all zeros' or "all ones" for CTL MSRs is architectural, as is the "only zeros" behavior for STATUS MSRs. I.e. the intent is to inject a #GP, not exit to userspace due to an unhandled emulation case. Returning '-1' gets interpreted as -EPERM up the stack and effecitvely kills the guest. Fixes: 890ca9aefa78 ("KVM: Add MCE support") Fixes: 9ffd986c6e4e ("KVM: X86: #GP when guest attempts to write MCi_STATUS= register w/o 0") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Reviewed-by: Jim Mattson Link: https://lore.kernel.org/r/20220512222716.4112548-2-seanjc@google.com Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 2316c978b598..0d6cea0d33a9 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3233,13 +3233,13 @@ static int set_msr_mce(struct kvm_vcpu *vcpu, struc= t msr_data *msr_info) */ if ((offset & 0x3) =3D=3D 0 && data !=3D 0 && (data | (1 << 10) | 1) !=3D ~(u64)0) - return -1; + return 1; =20 /* MCi_STATUS */ if (!msr_info->host_initiated && (offset & 0x3) =3D=3D 1 && data !=3D 0) { if (!can_set_mci_status(vcpu)) - return -1; + return 1; } =20 vcpu->arch.mce_banks[offset] =3D data; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C167C2BB47 for ; Mon, 15 Aug 2022 23:22:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353414AbiHOXWH (ORCPT ); Mon, 15 Aug 2022 19:22:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345716AbiHOXOg (ORCPT ); Mon, 15 Aug 2022 19:14:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC5737B7B6; Mon, 15 Aug 2022 13:01:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 69716B80EB1; Mon, 15 Aug 2022 20:01:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6DCFC433D6; Mon, 15 Aug 2022 20:01:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593716; bh=geG3EKKdOHyDZLYebALnLg3fdfRC7s9NhQsW9+1V4lE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jejkiS8mf9RZzInKyWGvtX9+lKe0WRpCIRqXNYS9sU744jeI79wOpRAgoM8pX9+YS RbWfIiHu7WoSyR5fl1eeCbhGYJ+ah8rvrXg8aY30IT5g1JNBMH3pkZhpnrliDCIoh6 moRP/1mzK/u3caM5ZURlMZn5+Aac47t5fAzEwd6w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Alexander Lobakin , Andy Shevchenko , Lu Baolu , Yury Norov , Sasha Levin Subject: [PATCH 5.18 0995/1095] iommu/vt-d: avoid invalid memory access via node_online(NUMA_NO_NODE) Date: Mon, 15 Aug 2022 20:06:34 +0200 Message-Id: <20220815180510.283977673@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Lobakin [ Upstream commit b0b0b77ea611e3088e9523e60860f4f41b62b235 ] KASAN reports: [ 4.668325][ T0] BUG: KASAN: wild-memory-access in dmar_parse_one_rhsa (arc= h/x86/include/asm/bitops.h:214 arch/x86/include/asm/bitops.h:226 include/as= m-generic/bitops/instrumented-non-atomic.h:142 include/linux/nodemask.h:415= drivers/iommu/intel/dmar.c:497) [ 4.676149][ T0] Read of size 8 at addr 1fffffff85115558 by task swap= per/0/0 [ 4.683454][ T0] [ 4.685638][ T0] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.19.0-rc3= -00004-g0e862838f290 #1 [ 4.694331][ T0] Hardware name: Supermicro SYS-5018D-FN4T/X10SDV-8C-T= LN4F, BIOS 1.1 03/02/2016 [ 4.703196][ T0] Call Trace: [ 4.706334][ T0] [ 4.709133][ T0] ? dmar_parse_one_rhsa (arch/x86/include/asm/bitops.h:214 a= rch/x86/include/asm/bitops.h:226 include/asm-generic/bitops/instrumented-no= n-atomic.h:142 include/linux/nodemask.h:415 drivers/iommu/intel/dmar.c:497) after converting the type of the first argument (@nr, bit number) of arch_test_bit() from `long` to `unsigned long`[0]. Under certain conditions (for example, when ACPI NUMA is disabled via command line), pxm_to_node() can return %NUMA_NO_NODE (-1). It is valid 'magic' number of NUMA node, but not valid bit number to use in bitops. node_online() eventually descends to test_bit() without checking for the input, assuming it's on caller side (which might be good for perf-critical tasks). There, -1 becomes %ULONG_MAX which leads to an insane array index when calculating bit position in memory. For now, add an explicit check for @node being not %NUMA_NO_NODE before calling test_bit(). The actual logics didn't change here at all. [0] https://github.com/norov/linux/commit/0e862838f290147ea9c16db852d8d494b= 552d38d Fixes: ee34b32d8c29 ("dmar: support for parsing Remapping Hardware Static A= ffinity structure") Cc: stable@vger.kernel.org # 2.6.33+ Reported-by: kernel test robot Signed-off-by: Alexander Lobakin Reviewed-by: Andy Shevchenko Reviewed-by: Lu Baolu Signed-off-by: Yury Norov Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/iommu/intel/dmar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c index 497c5bd95caf..2a10c9b54064 100644 --- a/drivers/iommu/intel/dmar.c +++ b/drivers/iommu/intel/dmar.c @@ -495,7 +495,7 @@ static int dmar_parse_one_rhsa(struct acpi_dmar_header = *header, void *arg) if (drhd->reg_base_addr =3D=3D rhsa->base_address) { int node =3D pxm_to_node(rhsa->proximity_domain); =20 - if (!node_online(node)) + if (node !=3D NUMA_NO_NODE && !node_online(node)) node =3D NUMA_NO_NODE; drhd->iommu->node =3D node; return 0; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCE34C00140 for ; Mon, 15 Aug 2022 23:22:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229547AbiHOXWT (ORCPT ); Mon, 15 Aug 2022 19:22:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346068AbiHOXOg (ORCPT ); Mon, 15 Aug 2022 19:14:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55C807C193; Mon, 15 Aug 2022 13:02:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E89F26068D; Mon, 15 Aug 2022 20:02:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7524C433C1; Mon, 15 Aug 2022 20:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593722; bh=ztuiYlmLkVZncfWoJY2ReqlKwgNsbOSNGQvAWdyy7tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IzzGW/4AvwkQSF5nL1wqjtmX8Hi6k3BScUm0jgMiyCABX5LVb8LziOZOeB96ypijA uEOJgGsqdHsCRk872WSQnDLkh2/SZAUvR0NH6QCIkPvE6abEgrr6O16mma2scijHjc Slcso2JL3ejLlKdqYXmUo+mT0Om0vKidibOOJLUY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meeta Saggi , Mohamed Khalfella , Bjorn Helgaas , Eric Badger , Sasha Levin Subject: [PATCH 5.18 0996/1095] PCI/AER: Iterate over error counters instead of error strings Date: Mon, 15 Aug 2022 20:06:35 +0200 Message-Id: <20220815180510.317409848@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mohamed Khalfella [ Upstream commit 5e6ae050955b566484f3cc6a66e3925eae87a0ed ] Previously we iterated over AER stat *names*, e.g., aer_correctable_error_string[32], but the actual stat *counters* may not be that large, e.g., pdev->aer_stats->dev_cor_errs[16], which means that we printed junk in the sysfs stats files. Iterate over the stat counter arrays instead of the names to avoid this junk. Also, added a build time check to make sure all counters have entries in strings array. Fixes: 0678e3109a3c ("PCI/AER: Simplify __aer_print_error()") Link: https://lore.kernel.org/r/20220509181441.31884-1-mkhalfella@purestora= ge.com Reported-by: Meeta Saggi Signed-off-by: Mohamed Khalfella Signed-off-by: Bjorn Helgaas Reviewed-by: Meeta Saggi Reviewed-by: Eric Badger Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pci/pcie/aer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 7952e5efd6cf..a1e38ca93cd9 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -538,7 +538,7 @@ static const char *aer_agent_string[] =3D { u64 *stats =3D pdev->aer_stats->stats_array; \ size_t len =3D 0; \ \ - for (i =3D 0; i < ARRAY_SIZE(strings_array); i++) { \ + for (i =3D 0; i < ARRAY_SIZE(pdev->aer_stats->stats_array); i++) {\ if (strings_array[i]) \ len +=3D sysfs_emit_at(buf, len, "%s %llu\n", \ strings_array[i], \ @@ -1347,6 +1347,11 @@ static int aer_probe(struct pcie_device *dev) struct device *device =3D &dev->device; struct pci_dev *port =3D dev->port; =20 + BUILD_BUG_ON(ARRAY_SIZE(aer_correctable_error_string) < + AER_MAX_TYPEOF_COR_ERRS); + BUILD_BUG_ON(ARRAY_SIZE(aer_uncorrectable_error_string) < + AER_MAX_TYPEOF_UNCOR_ERRS); + /* Limit to Root Ports or Root Complex Event Collectors */ if ((pci_pcie_type(port) !=3D PCI_EXP_TYPE_RC_EC) && (pci_pcie_type(port) !=3D PCI_EXP_TYPE_ROOT_PORT)) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9552C3F6B0 for ; Mon, 15 Aug 2022 23:22:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237857AbiHOXWi (ORCPT ); Mon, 15 Aug 2022 19:22:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242510AbiHOXOo (ORCPT ); Mon, 15 Aug 2022 19:14:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C32A27C19B; Mon, 15 Aug 2022 13:02:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7CF4FB80EAD; Mon, 15 Aug 2022 20:02:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEF43C433C1; Mon, 15 Aug 2022 20:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593728; bh=BemgTh73EFokSEYvo9fSAFZ/Xw3eMO33zGf+eGqVfDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x4U/97X/e4oeOk2aJQ+tg9rzACj4zHMjjCakqa5LqNO3TJzbUVP3w+evRXelYsrnD x3+PsoAwLUdK5NYxWYk5Cf9bTJq3F6uNuyldaNQItBe+IFpeaTc8V3AecyWcwFLEvo NCirdZHVgRNOXMHeIMlhxs1X+oJzn2rwtifwNzU0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Bjorn Helgaas , Dmitry Baryshkov , Sasha Levin Subject: [PATCH 5.18 0997/1095] PCI: qcom: Power on PHY before IPQ8074 DBI register accesses Date: Mon, 15 Aug 2022 20:06:36 +0200 Message-Id: <20220815180510.361269733@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Marko [ Upstream commit a0e43bb9973b06ce5c666f0901e104e2037c1b34 ] Currently the Gen2 port in IPQ8074 will cause the system to hang as it accesses DBI registers in qcom_pcie_init_2_3_3(), and those are only accesible after phy_power_on(). Move the DBI read/writes to a new qcom_pcie_post_init_2_3_3(), which is executed after phy_power_on(). Link: https://lore.kernel.org/r/20220623155004.688090-1-robimarko@gmail.com Fixes: a0fd361db8e5 ("PCI: dwc: Move "dbi", "dbi2", and "addr_space" resour= ce setup into common code") Signed-off-by: Robert Marko Signed-off-by: Bjorn Helgaas Reviewed-by: Dmitry Baryshkov Cc: stable@vger.kernel.org # v5.11+ Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-qcom.c | 48 +++++++++++++++----------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index ab04818f6ed9..340542aab8a5 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -1036,9 +1036,7 @@ static int qcom_pcie_init_2_3_3(struct qcom_pcie *pci= e) struct qcom_pcie_resources_2_3_3 *res =3D &pcie->res.v2_3_3; struct dw_pcie *pci =3D pcie->pci; struct device *dev =3D pci->dev; - u16 offset =3D dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); int i, ret; - u32 val; =20 for (i =3D 0; i < ARRAY_SIZE(res->rst); i++) { ret =3D reset_control_assert(res->rst[i]); @@ -1095,6 +1093,33 @@ static int qcom_pcie_init_2_3_3(struct qcom_pcie *pc= ie) goto err_clk_aux; } =20 + return 0; + +err_clk_aux: + clk_disable_unprepare(res->ahb_clk); +err_clk_ahb: + clk_disable_unprepare(res->axi_s_clk); +err_clk_axi_s: + clk_disable_unprepare(res->axi_m_clk); +err_clk_axi_m: + clk_disable_unprepare(res->iface); +err_clk_iface: + /* + * Not checking for failure, will anyway return + * the original failure in 'ret'. + */ + for (i =3D 0; i < ARRAY_SIZE(res->rst); i++) + reset_control_assert(res->rst[i]); + + return ret; +} + +static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *pcie) +{ + struct dw_pcie *pci =3D pcie->pci; + u16 offset =3D dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); + u32 val; + writel(SLV_ADDR_SPACE_SZ, pcie->parf + PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE); =20 @@ -1122,24 +1147,6 @@ static int qcom_pcie_init_2_3_3(struct qcom_pcie *pc= ie) PCI_EXP_DEVCTL2); =20 return 0; - -err_clk_aux: - clk_disable_unprepare(res->ahb_clk); -err_clk_ahb: - clk_disable_unprepare(res->axi_s_clk); -err_clk_axi_s: - clk_disable_unprepare(res->axi_m_clk); -err_clk_axi_m: - clk_disable_unprepare(res->iface); -err_clk_iface: - /* - * Not checking for failure, will anyway return - * the original failure in 'ret'. - */ - for (i =3D 0; i < ARRAY_SIZE(res->rst); i++) - reset_control_assert(res->rst[i]); - - return ret; } =20 static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie) @@ -1465,6 +1472,7 @@ static const struct qcom_pcie_ops ops_2_4_0 =3D { static const struct qcom_pcie_ops ops_2_3_3 =3D { .get_resources =3D qcom_pcie_get_resources_2_3_3, .init =3D qcom_pcie_init_2_3_3, + .post_init =3D qcom_pcie_post_init_2_3_3, .deinit =3D qcom_pcie_deinit_2_3_3, .ltssm_enable =3D qcom_pcie_2_3_2_ltssm_enable, }; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F09C1C00140 for ; Mon, 15 Aug 2022 23:22:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242701AbiHOXWs (ORCPT ); Mon, 15 Aug 2022 19:22:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243999AbiHOXOr (ORCPT ); Mon, 15 Aug 2022 19:14:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39B157C744; Mon, 15 Aug 2022 13:02:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C3465612DA; Mon, 15 Aug 2022 20:02:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B16AFC433C1; Mon, 15 Aug 2022 20:02:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593737; bh=P8GQnbQLC+qgRVnKQimFpEPL2VoCMHFCbwyyvs/xq+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TK51KMwDqFDmOfz4c6aMuRZ5CexowqF4EWH06pxtmGRPgHdT4yDf5C2lr9CHooV88 YgC1mPQ062DnRbJ2dAiB/A24F3+q50nwfZcf3SiC8N6AHLT60j/uIB9v62DQ46gPUa 9vt4j5lYf25NKIbKO5VqT9pFr7q3Argwd092zg88= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.18 0998/1095] serial: 8250: Fold EndRun device support into OxSemi Tornado code Date: Mon, 15 Aug 2022 20:06:37 +0200 Message-Id: <20220815180510.397151785@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maciej W. Rozycki [ Upstream commit 1f32c65bad24b9787d3e52843de375430e3df822 ] The EndRun PTP/1588 dual serial port device is based on the Oxford Semiconductor OXPCIe952 UART device with the PCI vendor:device ID set for EndRun Technologies and uses the same sequence to determine the number of ports available. Despite that we have duplicate code specific to the EndRun device. Remove redundant code then and factor out OxSemi Tornado device detection. Signed-off-by: Maciej W. Rozycki Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/alpine.DEB.2.21.2204181516220.9383@angie.or= cam.me.uk Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/serial/8250/8250_pci.c | 76 ++++++++++-------------------- 1 file changed, 25 insertions(+), 51 deletions(-) diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8= 250_pci.c index a293e9f107d0..4b0e84e01e55 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -994,41 +994,29 @@ static void pci_ite887x_exit(struct pci_dev *dev) } =20 /* - * EndRun Technologies. - * Determine the number of ports available on the device. + * Oxford Semiconductor Inc. + * Check if an OxSemi device is part of the Tornado range of devices. */ #define PCI_VENDOR_ID_ENDRUN 0x7401 #define PCI_DEVICE_ID_ENDRUN_1588 0xe100 =20 -static int pci_endrun_init(struct pci_dev *dev) +static bool pci_oxsemi_tornado_p(struct pci_dev *dev) { - u8 __iomem *p; - unsigned long deviceID; - unsigned int number_uarts =3D 0; + /* OxSemi Tornado devices are all 0xCxxx */ + if (dev->vendor =3D=3D PCI_VENDOR_ID_OXSEMI && + (dev->device & 0xf000) !=3D 0xc000) + return false; =20 - /* EndRun device is all 0xexxx */ + /* EndRun devices are all 0xExxx */ if (dev->vendor =3D=3D PCI_VENDOR_ID_ENDRUN && - (dev->device & 0xf000) !=3D 0xe000) - return 0; - - p =3D pci_iomap(dev, 0, 5); - if (p =3D=3D NULL) - return -ENOMEM; + (dev->device & 0xf000) !=3D 0xe000) + return false; =20 - deviceID =3D ioread32(p); - /* EndRun device */ - if (deviceID =3D=3D 0x07000200) { - number_uarts =3D ioread8(p + 4); - pci_dbg(dev, "%d ports detected on EndRun PCI Express device\n", number_= uarts); - } - pci_iounmap(dev, p); - return number_uarts; + return true; } =20 /* - * Oxford Semiconductor Inc. - * Check that device is part of the Tornado range of devices, then determi= ne - * the number of ports available on the device. + * Determine the number of ports available on a Tornado device. */ static int pci_oxsemi_tornado_init(struct pci_dev *dev) { @@ -1036,9 +1024,7 @@ static int pci_oxsemi_tornado_init(struct pci_dev *de= v) unsigned long deviceID; unsigned int number_uarts =3D 0; =20 - /* OxSemi Tornado devices are all 0xCxxx */ - if (dev->vendor =3D=3D PCI_VENDOR_ID_OXSEMI && - (dev->device & 0xF000) !=3D 0xC000) + if (!pci_oxsemi_tornado_p(dev)) return 0; =20 p =3D pci_iomap(dev, 0, 5); @@ -1049,7 +1035,10 @@ static int pci_oxsemi_tornado_init(struct pci_dev *d= ev) /* Tornado device */ if (deviceID =3D=3D 0x07000200) { number_uarts =3D ioread8(p + 4); - pci_dbg(dev, "%d ports detected on Oxford PCI Express device\n", number_= uarts); + pci_dbg(dev, "%d ports detected on %s PCI Express device\n", + number_uarts, + dev->vendor =3D=3D PCI_VENDOR_ID_ENDRUN ? + "EndRun" : "Oxford"); } pci_iounmap(dev, p); return number_uarts; @@ -2244,7 +2233,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = =3D { .device =3D PCI_ANY_ID, .subvendor =3D PCI_ANY_ID, .subdevice =3D PCI_ANY_ID, - .init =3D pci_endrun_init, + .init =3D pci_oxsemi_tornado_init, .setup =3D pci_default_setup, }, /* @@ -2667,7 +2656,6 @@ enum pci_board_num_t { pbn_panacom2, pbn_panacom4, pbn_plx_romulus, - pbn_endrun_2_3906250, pbn_oxsemi, pbn_oxsemi_1_3906250, pbn_oxsemi_2_3906250, @@ -3189,20 +3177,6 @@ static struct pciserial_board pci_boards[] =3D { .first_offset =3D 0x03, }, =20 - /* - * EndRun Technologies - * Uses the size of PCI Base region 0 to - * signal now many ports are available - * 2 port 952 Uart support - */ - [pbn_endrun_2_3906250] =3D { - .flags =3D FL_BASE0, - .num_ports =3D 2, - .base_baud =3D 3906250, - .uart_offset =3D 0x200, - .first_offset =3D 0x1000, - }, - /* * This board uses the size of PCI Base region 0 to * signal now many ports are available @@ -4109,13 +4083,6 @@ static const struct pci_device_id serial_pci_tbl[] = =3D { { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_ROMULUS, 0x10b5, 0x106a, 0, 0, pbn_plx_romulus }, - /* - * EndRun Technologies. PCI express device range. - * EndRun PTP/1588 has 2 Native UARTs. - */ - { PCI_VENDOR_ID_ENDRUN, PCI_DEVICE_ID_ENDRUN_1588, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_endrun_2_3906250 }, /* * Quatech cards. These actually have configurable clocks but for * now we just use the default. @@ -4377,6 +4344,13 @@ static const struct pci_device_id serial_pci_tbl[] = =3D { { PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_2_OX_IBM, PCI_SUBVENDOR_ID_IBM, PCI_ANY_ID, 0, 0, pbn_oxsemi_2_3906250 }, + /* + * EndRun Technologies. PCI express device range. + * EndRun PTP/1588 has 2 Native UARTs utilizing OxSemi 952. + */ + { PCI_VENDOR_ID_ENDRUN, PCI_DEVICE_ID_ENDRUN_1588, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, + pbn_oxsemi_2_3906250 }, =20 /* * SBS Technologies, Inc. P-Octal and PMC-OCTPRO cards, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F26FDC00140 for ; Mon, 15 Aug 2022 23:18:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244691AbiHOXSV (ORCPT ); Mon, 15 Aug 2022 19:18:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345541AbiHOXPL (ORCPT ); Mon, 15 Aug 2022 19:15:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63EA163F09; Mon, 15 Aug 2022 13:02:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D24616068D; Mon, 15 Aug 2022 20:02:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0745C433D6; Mon, 15 Aug 2022 20:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593743; bh=q6IyDpGkrAdLngl+rwSHei6Z2j5eQ9gqNEgI0K3X3OY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LXD6Vy+Yyvw7BGxHHgPkRXiQ9iXFhC3ALMeNNqLboBvgCIEeHgyXayk5VdDndPcqc 477IHVQgYb5wQk74uAccYtvmtoeK3vYBMdFG5SyrN0UB1SG2IAd1FXjqamE7bQrbrp ir3tsvlCI02brEJosG6z1MflaHCXgp+S5NSbPrD4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Sasha Levin Subject: [PATCH 5.18 0999/1095] serial: 8250: Add proper clock handling for OxSemi PCIe devices Date: Mon, 15 Aug 2022 20:06:38 +0200 Message-Id: <20220815180510.450781260@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maciej W. Rozycki [ Upstream commit 366f6c955d4d1a5125ffcd6875ead26a3c7a2a1c ] Oxford Semiconductor PCIe (Tornado) 950 serial port devices are driven by a fixed 62.5MHz clock input derived from the 100MHz PCI Express clock. We currently drive the device using its default oversampling rate of 16 and the clock prescaler disabled, consequently yielding the baud base of 3906250. This base is inadequate for some of the high-speed baud rates such as 460800bps, for which the closest rate possible can be obtained by dividing the baud base by 8, yielding the baud rate of 488281.25bps, which is off by 5.9638%. This is enough for data communication to break with the remote end talking actual 460800bps, where missed stop bits have been observed. We can do better however, by taking advantage of a reduced oversampling rate, which can be set to any integer value from 4 to 16 inclusive by programming the TCR register, and by using the clock prescaler, which can be set to any value from 1 to 63.875 in increments of 0.125 in the CPR/CPR2 register pair. The prescaler has to be explicitly enabled though by setting bit 7 in the MCR or otherwise it is bypassed (in the enhanced mode that we enable) as if the value of 1 was used. Make use of these features then as follows: - Set the baud base to 15625000, reflecting the minimum oversampling rate of 4 with the clock prescaler and divisor both set to 1. - Override the `set_mctrl' and set the MCR shadow there so as to have MCR[7] always set and have the 8250 core propagate these settings. - Override the `get_divisor' handler and determine a good combination of parameters by using a lookup table with predetermined value pairs of the oversampling rate and the clock prescaler and finding a pair that divides the input clock such that the quotient, when rounded to the nearest integer, deviates the least from the exact result. Calculate the clock divisor accordingly. Scale the resulting oversampling rate (only by powers of two) if possible so as to maximise it, reducing the divisor accordingly, and avoid a divisor overflow for very low baud rates by scaling the oversampling rate and/or the prescaler even if that causes some accuracy loss. Also handle the historic spd_cust feature so as to allow one to set all the three parameters manually to arbitrary values, by keeping the low 16 bits for the divisor and then putting TCR in bits 19:16 and CPR/CPR2 in bits 28:20, sanitising the bit pattern supplied such as to clamp CPR/CPR2 values between 0.000 and 0.875 inclusive to 33.875. This preserves compatibility with any existing setups, that is where requesting a custom divisor that only has any bits set among the low 16 the oversampling rate of 16 and the clock prescaler of 33.875 will be used as with the original 8250. Finally abuse the `frac' argument to store the determined bit patterns for the TCR, CPR and CPR2 registers. - Override the `set_divisor' handler so as to set the TCR, CPR and CPR2 registers from the `frac' value supplied. Set the divisor as usual. With the baud base set to 15625000 and the unsigned 16-bit UART_DIV_MAX limitation imposed by `serial8250_get_baud_rate' standard baud rates below 300bps become unavailable in the regular way, e.g. the rate of 200bps requires the baud base to be divided by 78125 and that is beyond the unsigned 16-bit range. The historic spd_cust feature can still be used to obtain such rates if so required. See Documentation/tty/device_drivers/oxsemi-tornado.rst for more details. Signed-off-by: Maciej W. Rozycki Link: https://lore.kernel.org/r/alpine.DEB.2.21.2204181519450.9383@angie.or= cam.me.uk Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- .../tty/device_drivers/oxsemi-tornado.rst | 129 +++++++ drivers/tty/serial/8250/8250_pci.c | 339 ++++++++++++++---- 2 files changed, 400 insertions(+), 68 deletions(-) create mode 100644 Documentation/tty/device_drivers/oxsemi-tornado.rst diff --git a/Documentation/tty/device_drivers/oxsemi-tornado.rst b/Document= ation/tty/device_drivers/oxsemi-tornado.rst new file mode 100644 index 000000000000..0180d8bb0881 --- /dev/null +++ b/Documentation/tty/device_drivers/oxsemi-tornado.rst @@ -0,0 +1,129 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Notes on Oxford Semiconductor PCIe (Tornado) 950 serial port devices +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Oxford Semiconductor PCIe (Tornado) 950 serial port devices are driven +by a fixed 62.5MHz clock input derived from the 100MHz PCI Express clock. + +The baud rate produced by the baud generator is obtained from this input +frequency by dividing it by the clock prescaler, which can be set to any +value from 1 to 63.875 in increments of 0.125, and then the usual 16-bit +divisor is used as with the original 8250, to divide the frequency by a +value from 1 to 65535. Finally a programmable oversampling rate is used +that can take any value from 4 to 16 to divide the frequency further and +determine the actual baud rate used. Baud rates from 15625000bps down +to 0.933bps can be obtained this way. + +By default the oversampling rate is set to 16 and the clock prescaler is +set to 33.875, meaning that the frequency to be used as the reference +for the usual 16-bit divisor is 115313.653, which is close enough to the +frequency of 115200 used by the original 8250 for the same values to be +used for the divisor to obtain the requested baud rates by software that +is unaware of the extra clock controls available. + +The oversampling rate is programmed with the TCR register and the clock +prescaler is programmed with the CPR/CPR2 register pair[1][2][3][4]. +To switch away from the default value of 33.875 for the prescaler the +the enhanced mode has to be explicitly enabled though, by setting bit 4 +of the EFR. In that mode setting bit 7 in the MCR enables the prescaler +or otherwise it is bypassed as if the value of 1 was used. Additionally +writing any value to CPR clears CPR2 for compatibility with old software +written for older conventional PCI Oxford Semiconductor devices that do +not have the extra prescaler's 9th bit in CPR2, so the CPR/CPR2 register +pair has to be programmed in the right order. + +By using these parameters rates from 15625000bps down to 1bps can be +obtained, with either exact or highly-accurate actual bit rates for +standard and many non-standard rates. + +Here are the figures for the standard and some non-standard baud rates +(including those quoted in Oxford Semiconductor documentation), giving +the requested rate (r), the actual rate yielded (a) and its deviation +from the requested rate (d), and the values of the oversampling rate +(tcr), the clock prescaler (cpr) and the divisor (div) produced by the +new `get_divisor' handler: + +r: 15625000, a: 15625000.00, d: 0.0000%, tcr: 4, cpr: 1.000, div: 1 +r: 12500000, a: 12500000.00, d: 0.0000%, tcr: 5, cpr: 1.000, div: 1 +r: 10416666, a: 10416666.67, d: 0.0000%, tcr: 6, cpr: 1.000, div: 1 +r: 8928571, a: 8928571.43, d: 0.0000%, tcr: 7, cpr: 1.000, div: 1 +r: 7812500, a: 7812500.00, d: 0.0000%, tcr: 8, cpr: 1.000, div: 1 +r: 4000000, a: 4000000.00, d: 0.0000%, tcr: 5, cpr: 3.125, div: 1 +r: 3686400, a: 3676470.59, d: -0.2694%, tcr: 8, cpr: 2.125, div: 1 +r: 3500000, a: 3496503.50, d: -0.0999%, tcr: 13, cpr: 1.375, div: 1 +r: 3000000, a: 2976190.48, d: -0.7937%, tcr: 14, cpr: 1.500, div: 1 +r: 2500000, a: 2500000.00, d: 0.0000%, tcr: 10, cpr: 2.500, div: 1 +r: 2000000, a: 2000000.00, d: 0.0000%, tcr: 10, cpr: 3.125, div: 1 +r: 1843200, a: 1838235.29, d: -0.2694%, tcr: 16, cpr: 2.125, div: 1 +r: 1500000, a: 1492537.31, d: -0.4975%, tcr: 5, cpr: 8.375, div: 1 +r: 1152000, a: 1152073.73, d: 0.0064%, tcr: 14, cpr: 3.875, div: 1 +r: 921600, a: 919117.65, d: -0.2694%, tcr: 16, cpr: 2.125, div: 2 +r: 576000, a: 576036.87, d: 0.0064%, tcr: 14, cpr: 3.875, div: 2 +r: 460800, a: 460829.49, d: 0.0064%, tcr: 7, cpr: 3.875, div: 5 +r: 230400, a: 230414.75, d: 0.0064%, tcr: 14, cpr: 3.875, div: 5 +r: 115200, a: 115207.37, d: 0.0064%, tcr: 14, cpr: 1.250, div: 31 +r: 57600, a: 57603.69, d: 0.0064%, tcr: 8, cpr: 3.875, div: 35 +r: 38400, a: 38402.46, d: 0.0064%, tcr: 14, cpr: 3.875, div: 30 +r: 19200, a: 19201.23, d: 0.0064%, tcr: 8, cpr: 3.875, div: 105 +r: 9600, a: 9600.06, d: 0.0006%, tcr: 9, cpr: 1.125, div: 643 +r: 4800, a: 4799.98, d: -0.0004%, tcr: 7, cpr: 2.875, div: 647 +r: 2400, a: 2400.02, d: 0.0008%, tcr: 9, cpr: 2.250, div: 1286 +r: 1200, a: 1200.00, d: 0.0000%, tcr: 14, cpr: 2.875, div: 1294 +r: 300, a: 300.00, d: 0.0000%, tcr: 11, cpr: 2.625, div: 7215 +r: 200, a: 200.00, d: 0.0000%, tcr: 16, cpr: 1.250, div: 15625 +r: 150, a: 150.00, d: 0.0000%, tcr: 13, cpr: 2.250, div: 14245 +r: 134, a: 134.00, d: 0.0000%, tcr: 11, cpr: 2.625, div: 16153 +r: 110, a: 110.00, d: 0.0000%, tcr: 12, cpr: 1.000, div: 47348 +r: 75, a: 75.00, d: 0.0000%, tcr: 4, cpr: 5.875, div: 35461 +r: 50, a: 50.00, d: 0.0000%, tcr: 16, cpr: 1.250, div: 62500 +r: 25, a: 25.00, d: 0.0000%, tcr: 16, cpr: 2.500, div: 62500 +r: 4, a: 4.00, d: 0.0000%, tcr: 16, cpr: 20.000, div: 48828 +r: 2, a: 2.00, d: 0.0000%, tcr: 16, cpr: 40.000, div: 48828 +r: 1, a: 1.00, d: 0.0000%, tcr: 16, cpr: 63.875, div: 61154 + +With the baud base set to 15625000 and the unsigned 16-bit UART_DIV_MAX +limitation imposed by `serial8250_get_baud_rate' standard baud rates +below 300bps become unavailable in the regular way, e.g. the rate of +200bps requires the baud base to be divided by 78125 and that is beyond +the unsigned 16-bit range. The historic spd_cust feature can still be +used by encoding the values for, the prescaler, the oversampling rate +and the clock divisor (DLM/DLL) as follows to obtain such rates if so +required: + + 31 29 28 20 19 16 15 0 ++-----+-----------------+-------+-------------------------------+ +|0 0 0| CPR2:CPR | TCR | DLM:DLL | ++-----+-----------------+-------+-------------------------------+ + +Use a value such encoded for the `custom_divisor' field along with the +ASYNC_SPD_CUST flag set in the `flags' field in `struct serial_struct' +passed with the TIOCSSERIAL ioctl(2), such as with the setserial(8) +utility and its `divisor' and `spd_cust' parameters, and the select +the baud rate of 38400bps. Note that the value of 0 in TCR sets the +oversampling rate to 16 and prescaler values below 1 in CPR2/CPR are +clamped by the driver to 1. + +For example the value of 0x1f4004e2 will set CPR2/CPR, TCR and DLM/DLL +respectively to 0x1f4, 0x0 and 0x04e2, choosing the prescaler value, +the oversampling rate and the clock divisor of 62.500, 16 and 1250 +respectively. These parameters will set the baud rate for the serial +port to 62500000 / 62.500 / 1250 / 16 =3D 50bps. + +References: + +[1] "OXPCIe200 PCI Express Multi-Port Bridge", Oxford Semiconductor, + Inc., DS-0045, 10 Nov 2008, Section "950 Mode", pp. 64-65 + +[2] "OXPCIe952 PCI Express Bridge to Dual Serial & Parallel Port", + Oxford Semiconductor, Inc., DS-0046, Mar 06 08, Section "950 Mode", + p. 20 + +[3] "OXPCIe954 PCI Express Bridge to Quad Serial Port", Oxford + Semiconductor, Inc., DS-0047, Feb 08, Section "950 Mode", p. 20 + +[4] "OXPCIe958 PCI Express Bridge to Octal Serial Port", Oxford + Semiconductor, Inc., DS-0048, Feb 08, Section "950 Mode", p. 20 + +Maciej W. Rozycki diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8= 250_pci.c index 4b0e84e01e55..818ed6cd3132 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -1044,6 +1045,208 @@ static int pci_oxsemi_tornado_init(struct pci_dev *= dev) return number_uarts; } =20 +/* Tornado-specific constants for the TCR and CPR registers; see below. */ +#define OXSEMI_TORNADO_TCR_MASK 0xf +#define OXSEMI_TORNADO_CPR_MASK 0x1ff +#define OXSEMI_TORNADO_CPR_MIN 0x008 +#define OXSEMI_TORNADO_CPR_DEF 0x10f + +/* + * Determine the oversampling rate, the clock prescaler, and the clock + * divisor for the requested baud rate. The clock rate is 62.5 MHz, + * which is four times the baud base, and the prescaler increments in + * steps of 1/8. Therefore to make calculations on integers we need + * to use a scaled clock rate, which is the baud base multiplied by 32 + * (or our assumed UART clock rate multiplied by 2). + * + * The allowed oversampling rates are from 4 up to 16 inclusive (values + * from 0 to 3 inclusive map to 16). Likewise the clock prescaler allows + * values between 1.000 and 63.875 inclusive (operation for values from + * 0.000 to 0.875 has not been specified). The clock divisor is the usual + * unsigned 16-bit integer. + * + * For the most accurate baud rate we use a table of predetermined + * oversampling rates and clock prescalers that records all possible + * products of the two parameters in the range from 4 up to 255 inclusive, + * and additionally 335 for the 1500000bps rate, with the prescaler scaled + * by 8. The table is sorted by the decreasing value of the oversampling + * rate and ties are resolved by sorting by the decreasing value of the + * product. This way preference is given to higher oversampling rates. + * + * We iterate over the table and choose the product of an oversampling + * rate and a clock prescaler that gives the lowest integer division + * result deviation, or if an exact integer divider is found we stop + * looking for it right away. We do some fixup if the resulting clock + * divisor required would be out of its unsigned 16-bit integer range. + * + * Finally we abuse the supposed fractional part returned to encode the + * 4-bit value of the oversampling rate and the 9-bit value of the clock + * prescaler which will end up in the TCR and CPR/CPR2 registers. + */ +static unsigned int pci_oxsemi_tornado_get_divisor(struct uart_port *port, + unsigned int baud, + unsigned int *frac) +{ + static u8 p[][2] =3D { + { 16, 14, }, { 16, 13, }, { 16, 12, }, { 16, 11, }, + { 16, 10, }, { 16, 9, }, { 16, 8, }, { 15, 17, }, + { 15, 16, }, { 15, 15, }, { 15, 14, }, { 15, 13, }, + { 15, 12, }, { 15, 11, }, { 15, 10, }, { 15, 9, }, + { 15, 8, }, { 14, 18, }, { 14, 17, }, { 14, 14, }, + { 14, 13, }, { 14, 12, }, { 14, 11, }, { 14, 10, }, + { 14, 9, }, { 14, 8, }, { 13, 19, }, { 13, 18, }, + { 13, 17, }, { 13, 13, }, { 13, 12, }, { 13, 11, }, + { 13, 10, }, { 13, 9, }, { 13, 8, }, { 12, 19, }, + { 12, 18, }, { 12, 17, }, { 12, 11, }, { 12, 9, }, + { 12, 8, }, { 11, 23, }, { 11, 22, }, { 11, 21, }, + { 11, 20, }, { 11, 19, }, { 11, 18, }, { 11, 17, }, + { 11, 11, }, { 11, 10, }, { 11, 9, }, { 11, 8, }, + { 10, 25, }, { 10, 23, }, { 10, 20, }, { 10, 19, }, + { 10, 17, }, { 10, 10, }, { 10, 9, }, { 10, 8, }, + { 9, 27, }, { 9, 23, }, { 9, 21, }, { 9, 19, }, + { 9, 18, }, { 9, 17, }, { 9, 9, }, { 9, 8, }, + { 8, 31, }, { 8, 29, }, { 8, 23, }, { 8, 19, }, + { 8, 17, }, { 8, 8, }, { 7, 35, }, { 7, 31, }, + { 7, 29, }, { 7, 25, }, { 7, 23, }, { 7, 21, }, + { 7, 19, }, { 7, 17, }, { 7, 15, }, { 7, 14, }, + { 7, 13, }, { 7, 12, }, { 7, 11, }, { 7, 10, }, + { 7, 9, }, { 7, 8, }, { 6, 41, }, { 6, 37, }, + { 6, 31, }, { 6, 29, }, { 6, 23, }, { 6, 19, }, + { 6, 17, }, { 6, 13, }, { 6, 11, }, { 6, 10, }, + { 6, 9, }, { 6, 8, }, { 5, 67, }, { 5, 47, }, + { 5, 43, }, { 5, 41, }, { 5, 37, }, { 5, 31, }, + { 5, 29, }, { 5, 25, }, { 5, 23, }, { 5, 19, }, + { 5, 17, }, { 5, 15, }, { 5, 13, }, { 5, 11, }, + { 5, 10, }, { 5, 9, }, { 5, 8, }, { 4, 61, }, + { 4, 59, }, { 4, 53, }, { 4, 47, }, { 4, 43, }, + { 4, 41, }, { 4, 37, }, { 4, 31, }, { 4, 29, }, + { 4, 23, }, { 4, 19, }, { 4, 17, }, { 4, 13, }, + { 4, 9, }, { 4, 8, }, + }; + /* Scale the quotient for comparison to get the fractional part. */ + const unsigned int quot_scale =3D 65536; + unsigned int sclk =3D port->uartclk * 2; + unsigned int sdiv =3D DIV_ROUND_CLOSEST(sclk, baud); + unsigned int best_squot; + unsigned int squot; + unsigned int quot; + u16 cpr; + u8 tcr; + int i; + + /* Old custom speed handling. */ + if (baud =3D=3D 38400 && (port->flags & UPF_SPD_MASK) =3D=3D UPF_SPD_CUST= ) { + unsigned int cust_div =3D port->custom_divisor; + + quot =3D cust_div & UART_DIV_MAX; + tcr =3D (cust_div >> 16) & OXSEMI_TORNADO_TCR_MASK; + cpr =3D (cust_div >> 20) & OXSEMI_TORNADO_CPR_MASK; + if (cpr < OXSEMI_TORNADO_CPR_MIN) + cpr =3D OXSEMI_TORNADO_CPR_DEF; + } else { + best_squot =3D quot_scale; + for (i =3D 0; i < ARRAY_SIZE(p); i++) { + unsigned int spre; + unsigned int srem; + u8 cp; + u8 tc; + + tc =3D p[i][0]; + cp =3D p[i][1]; + spre =3D tc * cp; + + srem =3D sdiv % spre; + if (srem > spre / 2) + srem =3D spre - srem; + squot =3D DIV_ROUND_CLOSEST(srem * quot_scale, spre); + + if (srem =3D=3D 0) { + tcr =3D tc; + cpr =3D cp; + quot =3D sdiv / spre; + break; + } else if (squot < best_squot) { + best_squot =3D squot; + tcr =3D tc; + cpr =3D cp; + quot =3D DIV_ROUND_CLOSEST(sdiv, spre); + } + } + while (tcr <=3D (OXSEMI_TORNADO_TCR_MASK + 1) >> 1 && + quot % 2 =3D=3D 0) { + quot >>=3D 1; + tcr <<=3D 1; + } + while (quot > UART_DIV_MAX) { + if (tcr <=3D (OXSEMI_TORNADO_TCR_MASK + 1) >> 1) { + quot >>=3D 1; + tcr <<=3D 1; + } else if (cpr <=3D OXSEMI_TORNADO_CPR_MASK >> 1) { + quot >>=3D 1; + cpr <<=3D 1; + } else { + quot =3D quot * cpr / OXSEMI_TORNADO_CPR_MASK; + cpr =3D OXSEMI_TORNADO_CPR_MASK; + } + } + } + + *frac =3D (cpr << 8) | (tcr & OXSEMI_TORNADO_TCR_MASK); + return quot; +} + +/* + * Set the oversampling rate in the transmitter clock cycle register (TCR), + * the clock prescaler in the clock prescaler register (CPR and CPR2), and + * the clock divisor in the divisor latch (DLL and DLM). Note that for + * backwards compatibility any write to CPR clears CPR2 and therefore CPR + * has to be written first, followed by CPR2, which occupies the location + * of CKS used with earlier UART designs. + */ +static void pci_oxsemi_tornado_set_divisor(struct uart_port *port, + unsigned int baud, + unsigned int quot, + unsigned int quot_frac) +{ + struct uart_8250_port *up =3D up_to_u8250p(port); + u8 cpr2 =3D quot_frac >> 16; + u8 cpr =3D quot_frac >> 8; + u8 tcr =3D quot_frac; + + serial_icr_write(up, UART_TCR, tcr); + serial_icr_write(up, UART_CPR, cpr); + serial_icr_write(up, UART_CKS, cpr2); + serial8250_do_set_divisor(port, baud, quot, 0); +} + +/* + * For Tornado devices we force MCR[7] set for the Divide-by-M N/8 baud ra= te + * generator prescaler (CPR and CPR2). Otherwise no prescaler would be us= ed. + */ +static void pci_oxsemi_tornado_set_mctrl(struct uart_port *port, + unsigned int mctrl) +{ + struct uart_8250_port *up =3D up_to_u8250p(port); + + up->mcr |=3D UART_MCR_CLKSEL; + serial8250_do_set_mctrl(port, mctrl); +} + +static int pci_oxsemi_tornado_setup(struct serial_private *priv, + const struct pciserial_board *board, + struct uart_8250_port *up, int idx) +{ + struct pci_dev *dev =3D priv->dev; + + if (pci_oxsemi_tornado_p(dev)) { + up->port.get_divisor =3D pci_oxsemi_tornado_get_divisor; + up->port.set_divisor =3D pci_oxsemi_tornado_set_divisor; + up->port.set_mctrl =3D pci_oxsemi_tornado_set_mctrl; + } + + return pci_default_setup(priv, board, up, idx); +} + static int pci_asix_setup(struct serial_private *priv, const struct pciserial_board *board, struct uart_8250_port *port, int idx) @@ -2245,7 +2448,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = =3D { .subvendor =3D PCI_ANY_ID, .subdevice =3D PCI_ANY_ID, .init =3D pci_oxsemi_tornado_init, - .setup =3D pci_default_setup, + .setup =3D pci_oxsemi_tornado_setup, }, { .vendor =3D PCI_VENDOR_ID_MAINPINE, @@ -2253,7 +2456,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = =3D { .subvendor =3D PCI_ANY_ID, .subdevice =3D PCI_ANY_ID, .init =3D pci_oxsemi_tornado_init, - .setup =3D pci_default_setup, + .setup =3D pci_oxsemi_tornado_setup, }, { .vendor =3D PCI_VENDOR_ID_DIGI, @@ -2261,7 +2464,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = =3D { .subvendor =3D PCI_SUBVENDOR_ID_IBM, .subdevice =3D PCI_ANY_ID, .init =3D pci_oxsemi_tornado_init, - .setup =3D pci_default_setup, + .setup =3D pci_oxsemi_tornado_setup, }, { .vendor =3D PCI_VENDOR_ID_INTEL, @@ -2578,7 +2781,7 @@ enum pci_board_num_t { pbn_b0_2_1843200, pbn_b0_4_1843200, =20 - pbn_b0_1_3906250, + pbn_b0_1_15625000, =20 pbn_b0_bt_1_115200, pbn_b0_bt_2_115200, @@ -2657,10 +2860,10 @@ enum pci_board_num_t { pbn_panacom4, pbn_plx_romulus, pbn_oxsemi, - pbn_oxsemi_1_3906250, - pbn_oxsemi_2_3906250, - pbn_oxsemi_4_3906250, - pbn_oxsemi_8_3906250, + pbn_oxsemi_1_15625000, + pbn_oxsemi_2_15625000, + pbn_oxsemi_4_15625000, + pbn_oxsemi_8_15625000, pbn_intel_i960, pbn_sgi_ioc3, pbn_computone_4, @@ -2803,10 +3006,10 @@ static struct pciserial_board pci_boards[] =3D { .uart_offset =3D 8, }, =20 - [pbn_b0_1_3906250] =3D { + [pbn_b0_1_15625000] =3D { .flags =3D FL_BASE0, .num_ports =3D 1, - .base_baud =3D 3906250, + .base_baud =3D 15625000, .uart_offset =3D 8, }, =20 @@ -3187,31 +3390,31 @@ static struct pciserial_board pci_boards[] =3D { .base_baud =3D 115200, .uart_offset =3D 8, }, - [pbn_oxsemi_1_3906250] =3D { + [pbn_oxsemi_1_15625000] =3D { .flags =3D FL_BASE0, .num_ports =3D 1, - .base_baud =3D 3906250, + .base_baud =3D 15625000, .uart_offset =3D 0x200, .first_offset =3D 0x1000, }, - [pbn_oxsemi_2_3906250] =3D { + [pbn_oxsemi_2_15625000] =3D { .flags =3D FL_BASE0, .num_ports =3D 2, - .base_baud =3D 3906250, + .base_baud =3D 15625000, .uart_offset =3D 0x200, .first_offset =3D 0x1000, }, - [pbn_oxsemi_4_3906250] =3D { + [pbn_oxsemi_4_15625000] =3D { .flags =3D FL_BASE0, .num_ports =3D 4, - .base_baud =3D 3906250, + .base_baud =3D 15625000, .uart_offset =3D 0x200, .first_offset =3D 0x1000, }, - [pbn_oxsemi_8_3906250] =3D { + [pbn_oxsemi_8_15625000] =3D { .flags =3D FL_BASE0, .num_ports =3D 8, - .base_baud =3D 3906250, + .base_baud =3D 15625000, .uart_offset =3D 0x200, .first_offset =3D 0x1000, }, @@ -4192,165 +4395,165 @@ static const struct pci_device_id serial_pci_tbl[= ] =3D { */ { PCI_VENDOR_ID_OXSEMI, 0xc101, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc105, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc11b, /* OXPCIe952 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc11f, /* OXPCIe952 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc120, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc124, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc138, /* OXPCIe952 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc13d, /* OXPCIe952 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc140, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc141, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc144, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc145, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc158, /* OXPCIe952 2 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_2_3906250 }, + pbn_oxsemi_2_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc15d, /* OXPCIe952 2 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_2_3906250 }, + pbn_oxsemi_2_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc208, /* OXPCIe954 4 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_4_3906250 }, + pbn_oxsemi_4_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc20d, /* OXPCIe954 4 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_4_3906250 }, + pbn_oxsemi_4_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc308, /* OXPCIe958 8 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_8_3906250 }, + pbn_oxsemi_8_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc30d, /* OXPCIe958 8 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_8_3906250 }, + pbn_oxsemi_8_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc40b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc40f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc41b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc41f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc42b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc42f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc43b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc43f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc44b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc44f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc45b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc45f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc46b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc46f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc47b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc47f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc48b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc48f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc49b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc49f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc4ab, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc4af, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc4bb, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc4bf, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc4cb, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc4cf, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, /* * Mainpine Inc. IQ Express "Rev3" utilizing OxSemi Tornado */ { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 1 Port V.34 Super-G3 Fax = */ PCI_VENDOR_ID_MAINPINE, 0x4001, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 2 Port V.34 Super-G3 Fax = */ PCI_VENDOR_ID_MAINPINE, 0x4002, 0, 0, - pbn_oxsemi_2_3906250 }, + pbn_oxsemi_2_15625000 }, { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 4 Port V.34 Super-G3 Fax = */ PCI_VENDOR_ID_MAINPINE, 0x4004, 0, 0, - pbn_oxsemi_4_3906250 }, + pbn_oxsemi_4_15625000 }, { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 8 Port V.34 Super-G3 Fax = */ PCI_VENDOR_ID_MAINPINE, 0x4008, 0, 0, - pbn_oxsemi_8_3906250 }, + pbn_oxsemi_8_15625000 }, =20 /* * Digi/IBM PCIe 2-port Async EIA-232 Adapter utilizing OxSemi Tornado */ { PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_2_OX_IBM, PCI_SUBVENDOR_ID_IBM, PCI_ANY_ID, 0, 0, - pbn_oxsemi_2_3906250 }, + pbn_oxsemi_2_15625000 }, /* * EndRun Technologies. PCI express device range. * EndRun PTP/1588 has 2 Native UARTs utilizing OxSemi 952. */ { PCI_VENDOR_ID_ENDRUN, PCI_DEVICE_ID_ENDRUN_1588, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_2_3906250 }, + pbn_oxsemi_2_15625000 }, =20 /* * SBS Technologies, Inc. P-Octal and PMC-OCTPRO cards, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9FA2C00140 for ; Mon, 15 Aug 2022 23:19:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243540AbiHOXS5 (ORCPT ); Mon, 15 Aug 2022 19:18:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347438AbiHOXP3 (ORCPT ); Mon, 15 Aug 2022 19:15:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31B1E63F27; Mon, 15 Aug 2022 13:02:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A61186068D; Mon, 15 Aug 2022 20:02:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0701C433D6; Mon, 15 Aug 2022 20:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593749; bh=74aVVp2GcXBM2zXtNUT99Bg7mljouCS0TeZFGzM9fcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t5zoMMg+Hmg/Z1ffZYbHiq1XxSmN2cz/0c3jk/SybhE0wy30eORhlWnssRs9yHKtG NnBqI9CdH3T2pJ4zCK7iftcKx3AFzlyfX874lQrksx6gI561MgT2BvJIPjNkPc0ggT ZaQVNBSGBuJ2lBK4XU9RwAhsbhGaEC6Tb1qUJmM4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cameron Williams , stable , Sasha Levin Subject: [PATCH 5.18 1000/1095] tty: 8250: Add support for Brainboxes PX cards. Date: Mon, 15 Aug 2022 20:06:39 +0200 Message-Id: <20220815180510.485567793@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cameron Williams [ Upstream commit ef5a03a26c87a760bc3d86b5af7b773e82f8b1b7 ] Add support for some of the Brainboxes PCIe (PX) range of serial cards, including the PX-101, PX-235/PX-246, PX-203/PX-257, PX-260/PX-701, PX-310, PX-313, PX-320/PX-324/PX-376/PX-387, PX-335/PX-346, PX-368, PX-420, PX-803 and PX-846. Signed-off-by: Cameron Williams Cc: stable Link: https://lore.kernel.org/r/AM5PR0202MB2564669252BDC59BF55A6E87C4879@AM= 5PR0202MB2564.eurprd02.prod.outlook.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/tty/serial/8250/8250_pci.c | 109 +++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8= 250_pci.c index 818ed6cd3132..aeac20f7cbb2 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -5063,6 +5063,115 @@ static const struct pci_device_id serial_pci_tbl[] = =3D { PCI_ANY_ID, PCI_ANY_ID, 0, 0, pbn_b2_4_115200 }, + /* + * Brainboxes PX-101 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4005, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b0_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x4019, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_2_15625000 }, + /* + * Brainboxes PX-235/246 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4004, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b0_1_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x4016, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_1_15625000 }, + /* + * Brainboxes PX-203/PX-257 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4006, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b0_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x4015, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_4_15625000 }, + /* + * Brainboxes PX-260/PX-701 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x400A, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_4_15625000 }, + /* + * Brainboxes PX-310 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x400E, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_2_15625000 }, + /* + * Brainboxes PX-313 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x400C, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_2_15625000 }, + /* + * Brainboxes PX-320/324/PX-376/PX-387 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x400B, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_1_15625000 }, + /* + * Brainboxes PX-335/346 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x400F, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_4_15625000 }, + /* + * Brainboxes PX-368 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4010, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_4_15625000 }, + /* + * Brainboxes PX-420 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4000, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b0_4_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x4011, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_4_15625000 }, + /* + * Brainboxes PX-803 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4009, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b0_1_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x401E, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_1_15625000 }, + /* + * Brainboxes PX-846 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4008, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b0_1_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x4017, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_1_15625000 }, + /* * Perle PCI-RAS cards */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E64FC00140 for ; Mon, 15 Aug 2022 23:19:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244469AbiHOXTP (ORCPT ); Mon, 15 Aug 2022 19:19:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348202AbiHOXPg (ORCPT ); Mon, 15 Aug 2022 19:15:36 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F40C79D64A; Mon, 15 Aug 2022 13:02:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 57B73CE12E8; Mon, 15 Aug 2022 20:02:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ABA8C433C1; Mon, 15 Aug 2022 20:02:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593754; bh=+skbTRi2GS+5nB4ubqEygyjM5jHzwVEmhibFxuKJtwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eDCyAGOQ8h7YpX4452KEQ/6QPMxXkaUjEHJNoAM8AVce88p2g8femmF5IXpCuXRx0 n5pyPftgSm+5i/DQxlc//cmvXHEVdzRmUrqfT3yURqKehazWQdVUNcWD125WLVL5/Q q325L3J+Egro83eg228NvwdSl0GtdAK/I7ugBN/s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.18 1001/1095] dm writecache: set a default MAX_WRITEBACK_JOBS Date: Mon, 15 Aug 2022 20:06:40 +0200 Message-Id: <20220815180510.528171361@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka [ Upstream commit ca7dc242e358e46d963b32f9d9dd829785a9e957 ] dm-writecache has the capability to limit the number of writeback jobs in progress. However, this feature was off by default. As such there were some out-of-memory crashes observed when lowering the low watermark while the cache is full. This commit enables writeback limit by default. It is set to 256MiB or 1/16 of total system memory, whichever is smaller. Cc: stable@vger.kernel.org Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/md/dm-writecache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index e5acb393f70b..27557b852c94 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -22,7 +22,7 @@ =20 #define HIGH_WATERMARK 50 #define LOW_WATERMARK 45 -#define MAX_WRITEBACK_JOBS 0 +#define MAX_WRITEBACK_JOBS min(0x10000000 / PAGE_SIZE, totalram_pages() /= 16) #define ENDIO_LATENCY 16 #define WRITEBACK_LATENCY 64 #define AUTOCOMMIT_BLOCKS_SSD 65536 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2AF6C00140 for ; Mon, 15 Aug 2022 23:19:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240525AbiHOXTV (ORCPT ); Mon, 15 Aug 2022 19:19:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352821AbiHOXPl (ORCPT ); Mon, 15 Aug 2022 19:15:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 369AC9D662; Mon, 15 Aug 2022 13:02:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 70EF1612D7; Mon, 15 Aug 2022 20:02:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AF5BC433C1; Mon, 15 Aug 2022 20:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593760; bh=sNb4+ZAn3O50JBBASa2PrC1yJwl/IWN7d2PqSNYzrhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KkquZGbzo5KXlS9vQ9j3sIUv+5d/urqlh6VeL1tWxQ2X5g6RbLiZU8WRz66cPwttD kss706wAWNComusSjNmD1CWM1AHs4dLfW1LrtX6tRBDagtIs355fVndNQg45avXChs GS82PXLkb1U3gyZKCkM5ihM9PGfTlFOS7Fz7cxx0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Naveen N. Rao" , Eric Biederman , Andrew Morton , Mimi Zohar , Sasha Levin Subject: [PATCH 5.18 1002/1095] kexec_file: drop weak attribute from functions Date: Mon, 15 Aug 2022 20:06:41 +0200 Message-Id: <20220815180510.560337099@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naveen N. Rao [ Upstream commit 65d9a9a60fd71be964effb2e94747a6acb6e7015 ] As requested (http://lkml.kernel.org/r/87ee0q7b92.fsf@email.froward.int.ebiederm.org), this series converts weak functions in kexec to use the #ifdef approach. Quoting the 3e35142ef99fe ("kexec_file: drop weak attribute from arch_kexec_apply_relocations[_add]") changelog: : Since commit d1bcae833b32f1 ("ELF: Don't generate unused section symbols") : [1], binutils (v2.36+) started dropping section symbols that it thought : were unused. This isn't an issue in general, but with kexec_file.c, gcc : is placing kexec_arch_apply_relocations[_add] into a separate : .text.unlikely section and the section symbol ".text.unlikely" is being : dropped. Due to this, recordmcount is unable to find a non-weak symbol in : .text.unlikely to generate a relocation record against. This patch (of 2); Drop __weak attribute from functions in kexec_file.c: - arch_kexec_kernel_image_probe() - arch_kimage_file_post_load_cleanup() - arch_kexec_kernel_image_load() - arch_kexec_locate_mem_hole() - arch_kexec_kernel_verify_sig() arch_kexec_kernel_image_load() calls into kexec_image_load_default(), so drop the static attribute for the latter. arch_kexec_kernel_verify_sig() is not overridden by any architecture, so drop the __weak attribute. Link: https://lkml.kernel.org/r/cover.1656659357.git.naveen.n.rao@linux.vne= t.ibm.com Link: https://lkml.kernel.org/r/2cd7ca1fe4d6bb6ca38e3283c717878388ed6788.16= 56659357.git.naveen.n.rao@linux.vnet.ibm.com Signed-off-by: Naveen N. Rao Suggested-by: Eric Biederman Signed-off-by: Andrew Morton Signed-off-by: Mimi Zohar Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm64/include/asm/kexec.h | 4 ++- arch/powerpc/include/asm/kexec.h | 9 +++++++ arch/s390/include/asm/kexec.h | 3 +++ arch/x86/include/asm/kexec.h | 6 +++++ include/linux/kexec.h | 44 +++++++++++++++++++++++++++----- kernel/kexec_file.c | 35 ++----------------------- 6 files changed, 61 insertions(+), 40 deletions(-) diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h index 9839bfc163d7..78d272b26ebd 100644 --- a/arch/arm64/include/asm/kexec.h +++ b/arch/arm64/include/asm/kexec.h @@ -115,7 +115,9 @@ extern const struct kexec_file_ops kexec_image_ops; =20 struct kimage; =20 -extern int arch_kimage_file_post_load_cleanup(struct kimage *image); +int arch_kimage_file_post_load_cleanup(struct kimage *image); +#define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_clea= nup + extern int load_other_segments(struct kimage *image, unsigned long kernel_load_addr, unsigned long kernel_size, char *initrd, unsigned long initrd_len, diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/ke= xec.h index 2aefe14e1442..1e5e9b6ec78d 100644 --- a/arch/powerpc/include/asm/kexec.h +++ b/arch/powerpc/include/asm/kexec.h @@ -120,6 +120,15 @@ int setup_purgatory(struct kimage *image, const void *= slave_code, #ifdef CONFIG_PPC64 struct kexec_buf; =20 +int arch_kexec_kernel_image_probe(struct kimage *image, void *buf, unsigne= d long buf_len); +#define arch_kexec_kernel_image_probe arch_kexec_kernel_image_probe + +int arch_kimage_file_post_load_cleanup(struct kimage *image); +#define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_clea= nup + +int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf); +#define arch_kexec_locate_mem_hole arch_kexec_locate_mem_hole + int load_crashdump_segments_ppc64(struct kimage *image, struct kexec_buf *kbuf); int setup_purgatory_ppc64(struct kimage *image, const void *slave_code, diff --git a/arch/s390/include/asm/kexec.h b/arch/s390/include/asm/kexec.h index 63098df81c9f..d13bd221cd37 100644 --- a/arch/s390/include/asm/kexec.h +++ b/arch/s390/include/asm/kexec.h @@ -92,5 +92,8 @@ int arch_kexec_apply_relocations_add(struct purgatory_inf= o *pi, const Elf_Shdr *relsec, const Elf_Shdr *symtab); #define arch_kexec_apply_relocations_add arch_kexec_apply_relocations_add + +int arch_kimage_file_post_load_cleanup(struct kimage *image); +#define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_clea= nup #endif #endif /*_S390_KEXEC_H */ diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h index 6ad8d946cd3e..5ec359c1b50c 100644 --- a/arch/x86/include/asm/kexec.h +++ b/arch/x86/include/asm/kexec.h @@ -193,6 +193,12 @@ int arch_kexec_apply_relocations_add(struct purgatory_= info *pi, const Elf_Shdr *relsec, const Elf_Shdr *symtab); #define arch_kexec_apply_relocations_add arch_kexec_apply_relocations_add + +void *arch_kexec_kernel_image_load(struct kimage *image); +#define arch_kexec_kernel_image_load arch_kexec_kernel_image_load + +int arch_kimage_file_post_load_cleanup(struct kimage *image); +#define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_clea= nup #endif #endif =20 diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 8d573baaab29..87c1795297b0 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -188,21 +188,53 @@ int kexec_purgatory_get_set_symbol(struct kimage *ima= ge, const char *name, void *buf, unsigned int size, bool get_value); void *kexec_purgatory_get_symbol_addr(struct kimage *image, const char *na= me); +void *kexec_image_load_default(struct kimage *image); + +#ifndef arch_kexec_kernel_image_probe +static inline int +arch_kexec_kernel_image_probe(struct kimage *image, void *buf, unsigned lo= ng buf_len) +{ + return kexec_image_probe_default(image, buf, buf_len); +} +#endif + +#ifndef arch_kimage_file_post_load_cleanup +static inline int arch_kimage_file_post_load_cleanup(struct kimage *image) +{ + return kexec_image_post_load_cleanup_default(image); +} +#endif + +#ifndef arch_kexec_kernel_image_load +static inline void *arch_kexec_kernel_image_load(struct kimage *image) +{ + return kexec_image_load_default(image); +} +#endif =20 -/* Architectures may override the below functions */ -int arch_kexec_kernel_image_probe(struct kimage *image, void *buf, - unsigned long buf_len); -void *arch_kexec_kernel_image_load(struct kimage *image); -int arch_kimage_file_post_load_cleanup(struct kimage *image); #ifdef CONFIG_KEXEC_SIG int arch_kexec_kernel_verify_sig(struct kimage *image, void *buf, unsigned long buf_len); #endif -int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf); =20 extern int kexec_add_buffer(struct kexec_buf *kbuf); int kexec_locate_mem_hole(struct kexec_buf *kbuf); =20 +#ifndef arch_kexec_locate_mem_hole +/** + * arch_kexec_locate_mem_hole - Find free memory to place the segments. + * @kbuf: Parameters for the memory search. + * + * On success, kbuf->mem will have the start address of the memory region = found. + * + * Return: 0 on success, negative errno on error. + */ +static inline int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf) +{ + return kexec_locate_mem_hole(kbuf); +} +#endif + /* Alignment required for elf header segment */ #define ELF_CORE_HEADER_ALIGN 4096 =20 diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index bb0fb63f563c..925953dfef05 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -62,14 +62,7 @@ int kexec_image_probe_default(struct kimage *image, void= *buf, return ret; } =20 -/* Architectures can provide this probe function */ -int __weak arch_kexec_kernel_image_probe(struct kimage *image, void *buf, - unsigned long buf_len) -{ - return kexec_image_probe_default(image, buf, buf_len); -} - -static void *kexec_image_load_default(struct kimage *image) +void *kexec_image_load_default(struct kimage *image) { if (!image->fops || !image->fops->load) return ERR_PTR(-ENOEXEC); @@ -80,11 +73,6 @@ static void *kexec_image_load_default(struct kimage *ima= ge) image->cmdline_buf_len); } =20 -void * __weak arch_kexec_kernel_image_load(struct kimage *image) -{ - return kexec_image_load_default(image); -} - int kexec_image_post_load_cleanup_default(struct kimage *image) { if (!image->fops || !image->fops->cleanup) @@ -93,11 +81,6 @@ int kexec_image_post_load_cleanup_default(struct kimage = *image) return image->fops->cleanup(image->image_loader_data); } =20 -int __weak arch_kimage_file_post_load_cleanup(struct kimage *image) -{ - return kexec_image_post_load_cleanup_default(image); -} - #ifdef CONFIG_KEXEC_SIG static int kexec_image_verify_sig_default(struct kimage *image, void *buf, unsigned long buf_len) @@ -110,8 +93,7 @@ static int kexec_image_verify_sig_default(struct kimage = *image, void *buf, return image->fops->verify_sig(buf, buf_len); } =20 -int __weak arch_kexec_kernel_verify_sig(struct kimage *image, void *buf, - unsigned long buf_len) +int arch_kexec_kernel_verify_sig(struct kimage *image, void *buf, unsigned= long buf_len) { return kexec_image_verify_sig_default(image, buf, buf_len); } @@ -621,19 +603,6 @@ int kexec_locate_mem_hole(struct kexec_buf *kbuf) return ret =3D=3D 1 ? 0 : -EADDRNOTAVAIL; } =20 -/** - * arch_kexec_locate_mem_hole - Find free memory to place the segments. - * @kbuf: Parameters for the memory search. - * - * On success, kbuf->mem will have the start address of the memory region = found. - * - * Return: 0 on success, negative errno on error. - */ -int __weak arch_kexec_locate_mem_hole(struct kexec_buf *kbuf) -{ - return kexec_locate_mem_hole(kbuf); -} - /** * kexec_add_buffer - place a buffer in a kexec segment * @kbuf: Buffer contents and memory parameters. --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E2C8C25B08 for ; Mon, 15 Aug 2022 23:19:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244324AbiHOXTw (ORCPT ); Mon, 15 Aug 2022 19:19:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353063AbiHOXPv (ORCPT ); Mon, 15 Aug 2022 19:15:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDB857CB69; Mon, 15 Aug 2022 13:02:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 547DD612D7; Mon, 15 Aug 2022 20:02:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 464B7C433C1; Mon, 15 Aug 2022 20:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593769; bh=TbANiIQd+FPDA4iJn6Ixa9itBumf/koL+SuMqUIt8yg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T1ByAi9uw/oYAMI5X3qTyx2VstCKenTdy6G502GePe8K8rQXHSe9M2OTHk6GoOhnR bzr0VPSP4lTV7ULvmI9D1P0UC2JUTnAD5mhlN5Zh0FV4foNjOBa/eSGCmnlfdfj+70 ebR/CMWHKZcygvu/uwAn8yn0I/PWcGLHPqTpWBPk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Eric W. Biederman" , Michal Suchanek , Baoquan He , Coiby Xu , Mimi Zohar , Sasha Levin Subject: [PATCH 5.18 1003/1095] kexec: clean up arch_kexec_kernel_verify_sig Date: Mon, 15 Aug 2022 20:06:42 +0200 Message-Id: <20220815180510.604450713@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Coiby Xu [ Upstream commit 689a71493bd2f31c024f8c0395f85a1fd4b2138e ] Before commit 105e10e2cf1c ("kexec_file: drop weak attribute from functions"), there was already no arch-specific implementation of arch_kexec_kernel_verify_sig. With weak attribute dropped by that commit, arch_kexec_kernel_verify_sig is completely useless. So clean it up. Note later patches are dependent on this patch so it should be backported to the stable tree as well. Cc: stable@vger.kernel.org Suggested-by: Eric W. Biederman Reviewed-by: Michal Suchanek Acked-by: Baoquan He Signed-off-by: Coiby Xu [zohar@linux.ibm.com: reworded patch description "Note"] Link: https://lore.kernel.org/linux-integrity/20220714134027.394370-1-coxu@= redhat.com/ Signed-off-by: Mimi Zohar Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/kexec.h | 5 ----- kernel/kexec_file.c | 33 +++++++++++++-------------------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 87c1795297b0..f3e7680befcc 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -212,11 +212,6 @@ static inline void *arch_kexec_kernel_image_load(struc= t kimage *image) } #endif =20 -#ifdef CONFIG_KEXEC_SIG -int arch_kexec_kernel_verify_sig(struct kimage *image, void *buf, - unsigned long buf_len); -#endif - extern int kexec_add_buffer(struct kexec_buf *kbuf); int kexec_locate_mem_hole(struct kexec_buf *kbuf); =20 diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 925953dfef05..ad005cd184a4 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -81,24 +81,6 @@ int kexec_image_post_load_cleanup_default(struct kimage = *image) return image->fops->cleanup(image->image_loader_data); } =20 -#ifdef CONFIG_KEXEC_SIG -static int kexec_image_verify_sig_default(struct kimage *image, void *buf, - unsigned long buf_len) -{ - if (!image->fops || !image->fops->verify_sig) { - pr_debug("kernel loader does not support signature verification.\n"); - return -EKEYREJECTED; - } - - return image->fops->verify_sig(buf, buf_len); -} - -int arch_kexec_kernel_verify_sig(struct kimage *image, void *buf, unsigned= long buf_len) -{ - return kexec_image_verify_sig_default(image, buf, buf_len); -} -#endif - /* * Free up memory used by kernel, initrd, and command line. This is tempor= ary * memory allocation which is not needed any more after these buffers have @@ -141,13 +123,24 @@ void kimage_file_post_load_cleanup(struct kimage *ima= ge) } =20 #ifdef CONFIG_KEXEC_SIG +static int kexec_image_verify_sig(struct kimage *image, void *buf, + unsigned long buf_len) +{ + if (!image->fops || !image->fops->verify_sig) { + pr_debug("kernel loader does not support signature verification.\n"); + return -EKEYREJECTED; + } + + return image->fops->verify_sig(buf, buf_len); +} + static int kimage_validate_signature(struct kimage *image) { int ret; =20 - ret =3D arch_kexec_kernel_verify_sig(image, image->kernel_buf, - image->kernel_buf_len); + ret =3D kexec_image_verify_sig(image, image->kernel_buf, + image->kernel_buf_len); if (ret) { =20 if (sig_enforce) { --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9819C00140 for ; Mon, 15 Aug 2022 23:20:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245037AbiHOXUG (ORCPT ); Mon, 15 Aug 2022 19:20:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353125AbiHOXP5 (ORCPT ); Mon, 15 Aug 2022 19:15:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C344146CED; Mon, 15 Aug 2022 13:02:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1449F612E4; Mon, 15 Aug 2022 20:02:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0708C433C1; Mon, 15 Aug 2022 20:02:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593775; bh=VHaLffJQoHaI+IOtGGNDfDZgg2sKNs5qPuw8gRU1Og8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J1JwuGdCa+ibvAmw02UbD58s1FCY22nDrZzh7I5wQi8wFYXc1m5JFaRz9oPXnZyEX TVKTKq1lgQpUlspYS/D73eAzzPQam7Qo2hcW0BQHJvZ3q1wAFCeHqbol0O7h+aW24/ T/Qn3S8puWLcB4x+nGA4jCW1vx+SD4jeGMUpcDkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philipp Rudo , kexec@lists.infradead.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, Michal Suchanek , "Lee, Chun-Yi" , Baoquan He , Coiby Xu , Heiko Carstens , Mimi Zohar , Sasha Levin Subject: [PATCH 5.18 1004/1095] kexec, KEYS, s390: Make use of built-in and secondary keyring for signature verification Date: Mon, 15 Aug 2022 20:06:43 +0200 Message-Id: <20220815180510.636878336@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Suchanek [ Upstream commit 0828c4a39be57768b8788e8cbd0d84683ea757e5 ] commit e23a8020ce4e ("s390/kexec_file: Signature verification prototype") adds support for KEXEC_SIG verification with keys from platform keyring but the built-in keys and secondary keyring are not used. Add support for the built-in keys and secondary keyring as x86 does. Fixes: e23a8020ce4e ("s390/kexec_file: Signature verification prototype") Cc: stable@vger.kernel.org Cc: Philipp Rudo Cc: kexec@lists.infradead.org Cc: keyrings@vger.kernel.org Cc: linux-security-module@vger.kernel.org Signed-off-by: Michal Suchanek Reviewed-by: "Lee, Chun-Yi" Acked-by: Baoquan He Signed-off-by: Coiby Xu Acked-by: Heiko Carstens Signed-off-by: Mimi Zohar Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/s390/kernel/machine_kexec_file.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/s390/kernel/machine_kexec_file.c b/arch/s390/kernel/machi= ne_kexec_file.c index 8f43575a4dd3..fc6d5f58debe 100644 --- a/arch/s390/kernel/machine_kexec_file.c +++ b/arch/s390/kernel/machine_kexec_file.c @@ -31,6 +31,7 @@ int s390_verify_sig(const char *kernel, unsigned long ker= nel_len) const unsigned long marker_len =3D sizeof(MODULE_SIG_STRING) - 1; struct module_signature *ms; unsigned long sig_len; + int ret; =20 /* Skip signature verification when not secure IPLed. */ if (!ipl_secure_flag) @@ -65,11 +66,18 @@ int s390_verify_sig(const char *kernel, unsigned long k= ernel_len) return -EBADMSG; } =20 - return verify_pkcs7_signature(kernel, kernel_len, - kernel + kernel_len, sig_len, - VERIFY_USE_PLATFORM_KEYRING, - VERIFYING_MODULE_SIGNATURE, - NULL, NULL); + ret =3D verify_pkcs7_signature(kernel, kernel_len, + kernel + kernel_len, sig_len, + VERIFY_USE_SECONDARY_KEYRING, + VERIFYING_MODULE_SIGNATURE, + NULL, NULL); + if (ret =3D=3D -ENOKEY && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING)) + ret =3D verify_pkcs7_signature(kernel, kernel_len, + kernel + kernel_len, sig_len, + VERIFY_USE_PLATFORM_KEYRING, + VERIFYING_MODULE_SIGNATURE, + NULL, NULL); + return ret; } #endif /* CONFIG_KEXEC_SIG */ =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84872C00140 for ; Mon, 15 Aug 2022 23:20:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233838AbiHOXUU (ORCPT ); Mon, 15 Aug 2022 19:20:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353300AbiHOXQQ (ORCPT ); Mon, 15 Aug 2022 19:16:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F0ED147421; Mon, 15 Aug 2022 13:03:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 90FCCB81142; Mon, 15 Aug 2022 20:03:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0EF3C433D7; Mon, 15 Aug 2022 20:03:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593781; bh=UdYZI1riOsDbDH0atDWZkwjVT6LhIpkFlQ5M1a7XQrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nqCzr65tPSvGxEnVJ8gXdZ/z5++5gxCsKiyGk6vILBJm6JkJxezn9n6VBng+U4x5C 4O0Qr0g4CNyx0pF0Zgtvicu+TZ3i5qiN+Y02c+fOZ/TM/rOQmRhEdmrRMzHhNDHXW8 33GipBMO55ziBxIo1dkv8y8djCogDyVNWa/100lQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dennis Dalessandro , Ingo Molnar , Andrew Morton , Jason Gunthorpe , Leon Romanovsky , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Arend van Spriel , Franky Lin , Hante Meuleman , Gregory Greenman , Peter Chen , Mathias Nyman , Chunfeng Yun , Bin Liu , Marek Lindner , Simon Wunderlich , Antonio Quartulli , Sven Eckelmann , Johannes Berg , Jim Cromie , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.18 1005/1095] tracing/events: Add __vstring() and __assign_vstr() helper macros Date: Mon, 15 Aug 2022 20:06:44 +0200 Message-Id: <20220815180510.669145492@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) [ Upstream commit 0563231f93c6d1f582b168a47753b345c1e20d81 ] There's several places that open code the following logic: TP_STRUCT__entry(__dynamic_array(char, msg, MSG_MAX)), TP_fast_assign(vsnprintf(__get_str(msg), MSG_MAX, vaf->fmt, *vaf->va);) To load a string created by variable array va_list. The main issue with this approach is that "MSG_MAX" usage in the __dynamic_array() portion. That actually just reserves the MSG_MAX in the event, and even wastes space because there's dynamic meta data also saved in the event to denote the offset and size of the dynamic array. It would have been better to just use a static __array() field. Instead, create __vstring() and __assign_vstr() that work like __string and __assign_str() but instead of taking a destination string to copy, take a format string and a va_list pointer and fill in the values. It uses the helper: #define __trace_event_vstr_len(fmt, va) \ ({ \ va_list __ap; \ int __ret; \ \ va_copy(__ap, *(va)); \ __ret =3D vsnprintf(NULL, 0, fmt, __ap) + 1; \ va_end(__ap); \ \ min(__ret, TRACE_EVENT_STR_MAX); \ }) To figure out the length to store the string. It may be slightly slower as it needs to run the vsnprintf() twice, but it now saves space on the ring buffer. Link: https://lkml.kernel.org/r/20220705224749.053570613@goodmis.org Cc: Dennis Dalessandro Cc: Ingo Molnar Cc: Andrew Morton Cc: Jason Gunthorpe Cc: Leon Romanovsky Cc: Kalle Valo Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: Arend van Spriel Cc: Franky Lin Cc: Hante Meuleman Cc: Gregory Greenman Cc: Peter Chen Cc: Greg Kroah-Hartman Cc: Mathias Nyman Cc: Chunfeng Yun Cc: Bin Liu Cc: Marek Lindner Cc: Simon Wunderlich Cc: Antonio Quartulli Cc: Sven Eckelmann Cc: Johannes Berg Cc: Jim Cromie Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/trace_events.h | 18 ++++++++++++++++++ include/trace/stages/stage1_struct_define.h | 3 +++ include/trace/stages/stage2_data_offsets.h | 3 +++ include/trace/stages/stage4_event_fields.h | 3 +++ include/trace/stages/stage5_get_offsets.h | 4 ++++ include/trace/stages/stage6_event_callback.h | 7 +++++++ 6 files changed, 38 insertions(+) diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index e6e95a9f07a5..b18759a673c6 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -916,6 +916,24 @@ perf_trace_buf_submit(void *raw_data, int size, int rc= tx, u16 type, =20 #endif =20 +#define TRACE_EVENT_STR_MAX 512 + +/* + * gcc warns that you can not use a va_list in an inlined + * function. But lets me make it into a macro :-/ + */ +#define __trace_event_vstr_len(fmt, va) \ +({ \ + va_list __ap; \ + int __ret; \ + \ + va_copy(__ap, *(va)); \ + __ret =3D vsnprintf(NULL, 0, fmt, __ap) + 1; \ + va_end(__ap); \ + \ + min(__ret, TRACE_EVENT_STR_MAX); \ +}) + #endif /* _LINUX_TRACE_EVENT_H */ =20 /* diff --git a/include/trace/stages/stage1_struct_define.h b/include/trace/st= ages/stage1_struct_define.h index a16783419687..1b7bab60434c 100644 --- a/include/trace/stages/stage1_struct_define.h +++ b/include/trace/stages/stage1_struct_define.h @@ -26,6 +26,9 @@ #undef __string_len #define __string_len(item, src, len) __dynamic_array(char, item, -1) =20 +#undef __vstring +#define __vstring(item, fmt, ap) __dynamic_array(char, item, -1) + #undef __bitmask #define __bitmask(item, nr_bits) __dynamic_array(char, item, -1) =20 diff --git a/include/trace/stages/stage2_data_offsets.h b/include/trace/sta= ges/stage2_data_offsets.h index 42fd1e8813ec..1b7a8f764fdd 100644 --- a/include/trace/stages/stage2_data_offsets.h +++ b/include/trace/stages/stage2_data_offsets.h @@ -32,6 +32,9 @@ #undef __string_len #define __string_len(item, src, len) __dynamic_array(char, item, -1) =20 +#undef __vstring +#define __vstring(item, fmt, ap) __dynamic_array(char, item, -1) + #undef __bitmask #define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1) =20 diff --git a/include/trace/stages/stage4_event_fields.h b/include/trace/sta= ges/stage4_event_fields.h index e80cdc397a43..c3790ec7a453 100644 --- a/include/trace/stages/stage4_event_fields.h +++ b/include/trace/stages/stage4_event_fields.h @@ -38,6 +38,9 @@ #undef __string_len #define __string_len(item, src, len) __dynamic_array(char, item, -1) =20 +#undef __vstring +#define __vstring(item, fmt, ap) __dynamic_array(char, item, -1) + #undef __bitmask #define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1) =20 diff --git a/include/trace/stages/stage5_get_offsets.h b/include/trace/stag= es/stage5_get_offsets.h index 7ee5931300e6..fba4c24ed9e6 100644 --- a/include/trace/stages/stage5_get_offsets.h +++ b/include/trace/stages/stage5_get_offsets.h @@ -39,6 +39,10 @@ #undef __string_len #define __string_len(item, src, len) __dynamic_array(char, item, (len) + 1) =20 +#undef __vstring +#define __vstring(item, fmt, ap) __dynamic_array(char, item, \ + __trace_event_vstr_len(fmt, ap)) + #undef __rel_dynamic_array #define __rel_dynamic_array(type, item, len) \ __item_length =3D (len) * sizeof(type); \ diff --git a/include/trace/stages/stage6_event_callback.h b/include/trace/s= tages/stage6_event_callback.h index e1724f73594b..0f51f6b3ab70 100644 --- a/include/trace/stages/stage6_event_callback.h +++ b/include/trace/stages/stage6_event_callback.h @@ -24,6 +24,9 @@ #undef __string_len #define __string_len(item, src, len) __dynamic_array(char, item, -1) =20 +#undef __vstring +#define __vstring(item, fmt, ap) __dynamic_array(char, item, -1) + #undef __assign_str #define __assign_str(dst, src) \ strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)"); @@ -35,6 +38,10 @@ __get_str(dst)[len] =3D '\0'; \ } while(0) =20 +#undef __assign_vstr +#define __assign_vstr(dst, fmt, va) \ + vsnprintf(__get_str(dst), TRACE_EVENT_STR_MAX, fmt, *(va)) + #undef __bitmask #define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1) =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42803C00140 for ; Mon, 15 Aug 2022 23:22:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240507AbiHOXUc (ORCPT ); Mon, 15 Aug 2022 19:20:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353366AbiHOXQV (ORCPT ); Mon, 15 Aug 2022 19:16:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D86B914743C; Mon, 15 Aug 2022 13:03:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C1255612D8; Mon, 15 Aug 2022 20:03:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4829C433D6; Mon, 15 Aug 2022 20:03:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593787; bh=9Pf3I5L9YkcRINMhHJWI5bH6f4UjHn55TDvvn+Jqi+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lWhdNPTKnz1nXMq4w1pOAwymlC6FAxTEJjBrXHFL/fb+ZIFYDeXsu0j2nOooaLMLr 2RFiwr6jqi7ZsmUdIhutqDlFf9h3jKEDEieMJ6BrAd1Z/TR4QWCOWTZVftt7viozw4 APzSPR7UsGa4Kj3o8aGu94BL4fGsYDjS0wXTQYcs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Luo Meng , Mike Snitzer , Sasha Levin Subject: [PATCH 5.18 1006/1095] dm thin: fix use-after-free crash in dm_sm_register_threshold_callback Date: Mon, 15 Aug 2022 20:06:45 +0200 Message-Id: <20220815180510.712920490@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luo Meng [ Upstream commit 3534e5a5ed2997ca1b00f44a0378a075bd05e8a3 ] Fault inject on pool metadata device reports: BUG: KASAN: use-after-free in dm_pool_register_metadata_threshold+0x40/0x= 80 Read of size 8 at addr ffff8881b9d50068 by task dmsetup/950 CPU: 7 PID: 950 Comm: dmsetup Tainted: G W 5.19.0-rc6 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1.fc33= 04/01/2014 Call Trace: dump_stack_lvl+0x34/0x44 print_address_description.constprop.0.cold+0xeb/0x3f4 kasan_report.cold+0xe6/0x147 dm_pool_register_metadata_threshold+0x40/0x80 pool_ctr+0xa0a/0x1150 dm_table_add_target+0x2c8/0x640 table_load+0x1fd/0x430 ctl_ioctl+0x2c4/0x5a0 dm_ctl_ioctl+0xa/0x10 __x64_sys_ioctl+0xb3/0xd0 do_syscall_64+0x35/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 This can be easily reproduced using: echo offline > /sys/block/sda/device/state dd if=3D/dev/zero of=3D/dev/mapper/thin bs=3D4k count=3D10 dmsetup load pool --table "0 20971520 thin-pool /dev/sda /dev/sdb 128 0 0" If a metadata commit fails, the transaction will be aborted and the metadata space maps will be destroyed. If a DM table reload then happens for this failed thin-pool, a use-after-free will occur in dm_sm_register_threshold_callback (called from dm_pool_register_metadata_threshold). Fix this by in dm_pool_register_metadata_threshold() by returning the -EINVAL error if the thin-pool is in fail mode. Also fail pool_ctr() with a new error message: "Error registering metadata threshold". Fixes: ac8c3f3df65e4 ("dm thin: generate event when metadata threshold pass= ed") Cc: stable@vger.kernel.org Reported-by: Hulk Robot Signed-off-by: Luo Meng Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/md/dm-thin-metadata.c | 7 +++++-- drivers/md/dm-thin.c | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index 2db7030aba00..a27395c8621f 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c @@ -2045,10 +2045,13 @@ int dm_pool_register_metadata_threshold(struct dm_p= ool_metadata *pmd, dm_sm_threshold_fn fn, void *context) { - int r; + int r =3D -EINVAL; =20 pmd_write_lock_in_core(pmd); - r =3D dm_sm_register_threshold_callback(pmd->metadata_sm, threshold, fn, = context); + if (!pmd->fail_io) { + r =3D dm_sm_register_threshold_callback(pmd->metadata_sm, + threshold, fn, context); + } pmd_write_unlock(pmd); =20 return r; diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 4d25d0e27031..53ac6ae870ac 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -3382,8 +3382,10 @@ static int pool_ctr(struct dm_target *ti, unsigned a= rgc, char **argv) calc_metadata_threshold(pt), metadata_low_callback, pool); - if (r) + if (r) { + ti->error =3D "Error registering metadata threshold"; goto out_flags_changed; + } =20 dm_pool_register_pre_commit_callback(pool->pmd, metadata_pre_commit_callback, pool); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3123FC3F6B0 for ; Mon, 15 Aug 2022 23:22:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344261AbiHOXUx (ORCPT ); Mon, 15 Aug 2022 19:20:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353434AbiHOXQc (ORCPT ); Mon, 15 Aug 2022 19:16:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30D771481FD; Mon, 15 Aug 2022 13:03:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 920AC61299; Mon, 15 Aug 2022 20:03:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 964AEC433D6; Mon, 15 Aug 2022 20:03:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593793; bh=5Yp6igdeXS+EWXG2NTOm4EuzoPMlhsDncrfw0qxvFDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z33Hk1t7duRNQxsHXNJ1H3hJqNtH4LHj+M1WRJqS3zCed6qvBeZGPSrZeOlCiZ5dX AqkiWCoS4nd5ziQfUzqC0UCdTVJMNP50+tV2T267a3aK1KnbcVppfX/LxOHRMctWma FsA01KmZTMxy9sOZJMUkE8GyT791ZQSqeE4LUsQc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tyler Hicks , Christian Schoenebeck , Dominique Martinet , Sasha Levin Subject: [PATCH 5.18 1007/1095] net/9p: Initialize the iounit field during fid creation Date: Mon, 15 Aug 2022 20:06:46 +0200 Message-Id: <20220815180510.754918285@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tyler Hicks [ Upstream commit aa7aeee169480e98cf41d83c01290a37e569be6d ] Ensure that the fid's iounit field is set to zero when a new fid is created. Certain 9P operations, such as OPEN and CREATE, allow the server to reply with an iounit size which the client code assigns to the p9_fid struct shortly after the fid is created by p9_fid_create(). On the other hand, an XATTRWALK operation doesn't allow for the server to specify an iounit value. The iounit field of the newly allocated p9_fid struct remained uninitialized in that case. Depending on allocation patterns, the iounit value could have been something reasonable that was carried over from previously freed fids or, in the worst case, could have been arbitrary values from non-fid related usages of the memory location. The bug was detected in the Windows Subsystem for Linux 2 (WSL2) kernel after the uninitialized iounit field resulted in the typical sequence of two getxattr(2) syscalls, one to get the size of an xattr and another after allocating a sufficiently sized buffer to fit the xattr value, to hit an unexpected ERANGE error in the second call to getxattr(2). An uninitialized iounit field would sometimes force rsize to be smaller than the xattr value size in p9_client_read_once() and the 9P server in WSL refused to chunk up the READ on the attr_fid and, instead, returned ERANGE to the client. The virtfs server in QEMU seems happy to chunk up the READ and this problem goes undetected there. Link: https://lkml.kernel.org/r/20220710141402.803295-1-tyhicks@linux.micro= soft.com Fixes: ebf46264a004 ("fs/9p: Add support user. xattr") Cc: stable@vger.kernel.org Signed-off-by: Tyler Hicks Reviewed-by: Christian Schoenebeck Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/9p/client.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/9p/client.c b/net/9p/client.c index a36a40137caa..87cde948f628 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -886,16 +886,13 @@ static struct p9_fid *p9_fid_create(struct p9_client = *clnt) struct p9_fid *fid; =20 p9_debug(P9_DEBUG_FID, "clnt %p\n", clnt); - fid =3D kmalloc(sizeof(*fid), GFP_KERNEL); + fid =3D kzalloc(sizeof(*fid), GFP_KERNEL); if (!fid) return NULL; =20 - memset(&fid->qid, 0, sizeof(fid->qid)); fid->mode =3D -1; fid->uid =3D current_fsuid(); fid->clnt =3D clnt; - fid->rdir =3D NULL; - fid->fid =3D 0; refcount_set(&fid->count, 1); =20 idr_preload(GFP_KERNEL); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3B64C00140 for ; Mon, 15 Aug 2022 23:22:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345842AbiHOXVI (ORCPT ); Mon, 15 Aug 2022 19:21:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353491AbiHOXQk (ORCPT ); Mon, 15 Aug 2022 19:16:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FA8D47B8E; Mon, 15 Aug 2022 13:03:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A005B810C5; Mon, 15 Aug 2022 20:03:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6F41C433D6; Mon, 15 Aug 2022 20:03:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593802; bh=PjvIlGHNLRN6F/T3nDYHHiN9EJ37PSPnqadsUE8gwZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z3mXJGnTv5EwOw7n/T0Eodr7YNEoOUyQxcnCNch80qwrt/EN9JHdzn+5AY//v5Un+ fIp3NdNjrROpUVW5Y4ZGAG3qUv/WF6Ow4DDPWcsTpRE1LvvuAxC9Ap546Rf823TdIk 6UVLpn8bFC7QAiSZyxFSpEAl2ahOYdKXavoWXt44= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Eric Biggers , "Jason A. Donenfeld" , Sasha Levin Subject: [PATCH 5.18 1008/1095] timekeeping: contribute wall clock to rng on time change Date: Mon, 15 Aug 2022 20:06:47 +0200 Message-Id: <20220815180510.803483817@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld [ Upstream commit b8ac29b40183a6038919768b5d189c9bd91ce9b4 ] The rng's random_init() function contributes the real time to the rng at boot time, so that events can at least start in relation to something particular in the real world. But this clock might not yet be set that point in boot, so nothing is contributed. In addition, the relation between minor clock changes from, say, NTP, and the cycle counter is potentially useful entropic data. This commit addresses this by mixing in a time stamp on calls to settimeofday and adjtimex. No entropy is credited in doing so, so it doesn't make initialization faster, but it is still useful input to have. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reviewed-by: Thomas Gleixner Reviewed-by: Eric Biggers Signed-off-by: Jason A. Donenfeld Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/time/timekeeping.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 871c912860ed..d6a0ff68df41 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -23,6 +23,7 @@ #include #include #include +#include =20 #include "tick-internal.h" #include "ntp_internal.h" @@ -1326,8 +1327,10 @@ int do_settimeofday64(const struct timespec64 *ts) /* Signal hrtimers about time change */ clock_was_set(CLOCK_SET_WALL); =20 - if (!ret) + if (!ret) { audit_tk_injoffset(ts_delta); + add_device_randomness(ts, sizeof(*ts)); + } =20 return ret; } @@ -2413,6 +2416,7 @@ int do_adjtimex(struct __kernel_timex *txc) ret =3D timekeeping_validate_timex(txc); if (ret) return ret; + add_device_randomness(txc, sizeof(*txc)); =20 if (txc->modes & ADJ_SETOFFSET) { struct timespec64 delta; @@ -2430,6 +2434,7 @@ int do_adjtimex(struct __kernel_timex *txc) audit_ntp_init(&ad); =20 ktime_get_real_ts64(&ts); + add_device_randomness(&ts, sizeof(ts)); =20 raw_spin_lock_irqsave(&timekeeper_lock, flags); write_seqcount_begin(&tk_core.seq); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD7F7C2BB41 for ; Mon, 15 Aug 2022 23:22:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346153AbiHOXV1 (ORCPT ); Mon, 15 Aug 2022 19:21:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353534AbiHOXQw (ORCPT ); Mon, 15 Aug 2022 19:16:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C57B5AF497; Mon, 15 Aug 2022 13:03:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3C328B80EAD; Mon, 15 Aug 2022 20:03:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FF78C433D6; Mon, 15 Aug 2022 20:03:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593807; bh=1UQTlE+KgZKe/65niCjLYaTpKD6QDiBXlSIHeo+yO74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zFRsddy7MwPZ1e2RdZ/FPyqAjjFX/Vwn2sftMAmEDMyZcwBnmdKjAPZx7l8tAoAAH xX3XHzK9+rBpqUlnRS8xyFP6kKBI+FYwH+pjI27wbJMnVbr4I9rG1E7YCgUageFnVI /ERYh115uEl0WzGgEOJk9qbjxGaISP0TIiRZRlIo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen jingwen , Chen Zhongjin , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.18 1009/1095] locking/csd_lock: Change csdlock_debug from early_param to __setup Date: Mon, 15 Aug 2022 20:06:48 +0200 Message-Id: <20220815180510.844804678@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chen Zhongjin [ Upstream commit 9c9b26b0df270d4f9246e483a44686fca951a29c ] The csdlock_debug kernel-boot parameter is parsed by the early_param() function csdlock_debug(). If set, csdlock_debug() invokes static_branch_enable() to enable csd_lock_wait feature, which triggers a panic on arm64 for kernels built with CONFIG_SPARSEMEM=3Dy and CONFIG_SPARSEMEM_VMEMMAP=3Dn. With CONFIG_SPARSEMEM_VMEMMAP=3Dn, __nr_to_section is called in static_key_enable() and returns NULL, resulting in a NULL dereference because mem_section is initialized only later in sparse_init(). This is also a problem for powerpc because early_param() functions are invoked earlier than jump_label_init(), also resulting in static_key_enable() failures. These failures cause the warning "static key 'xxx' used before call to jump_label_init()". Thus, early_param is too early for csd_lock_wait to run static_branch_enable(), so changes it to __setup to fix these. Fixes: 8d0968cc6b8f ("locking/csd_lock: Add boot parameter for controlling = CSD lock debugging") Cc: stable@vger.kernel.org Reported-by: Chen jingwen Signed-off-by: Chen Zhongjin Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/smp.c b/kernel/smp.c index 65a630f62363..381eb15cd28f 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -174,9 +174,9 @@ static int __init csdlock_debug(char *str) if (val) static_branch_enable(&csdlock_debug_enabled); =20 - return 0; + return 1; } -early_param("csdlock_debug", csdlock_debug); +__setup("csdlock_debug=3D", csdlock_debug); =20 static DEFINE_PER_CPU(call_single_data_t *, cur_csd); static DEFINE_PER_CPU(smp_call_func_t, cur_csd_func); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FE4DC00140 for ; Mon, 15 Aug 2022 23:23:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233687AbiHOXXM (ORCPT ); Mon, 15 Aug 2022 19:23:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353579AbiHOXQ6 (ORCPT ); Mon, 15 Aug 2022 19:16:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 881557C18D; Mon, 15 Aug 2022 13:03:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A52861226; Mon, 15 Aug 2022 20:03:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D145C433C1; Mon, 15 Aug 2022 20:03:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593814; bh=/BFaRg1u6qCe8vxEaMLKAqBdBVsQGZo/dzYZ3T2e9as=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ghoN2hBUO1NQ1Jbx6IAqP7BTFNuTgj8ZLOfIVmiuP9OB9tGOf8kJuSpF28DXfVO76 h7fMwUUqhNtTF0M/GNuNUsdLcgAr5Oxz9InjT65AzOq+q8SKRTi7jsBhuNQgvJfUgr kzAHSDkPjaCH5hmKoBJN8DYpfWQ1EAyfLmpqn/V0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 1010/1095] block: serialize all debugfs operations using q->debugfs_mutex Date: Mon, 15 Aug 2022 20:06:49 +0200 Message-Id: <20220815180510.893822245@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig [ Upstream commit 5cf9c91ba927119fc6606b938b1895bb2459d3bc ] Various places like I/O schedulers or the QOS infrastructure try to register debugfs files on demans, which can race with creating and removing the main queue debugfs directory. Use the existing debugfs_mutex to serialize all debugfs operations that rely on q->debugfs_dir or the directories hanging off it. To make the teardown code a little simpler declare all debugfs dentry pointers and not just the main one uncoditionally in blkdev.h. Move debugfs_mutex next to the dentries that it protects and document what it is used for. Signed-off-by: Christoph Hellwig Link: https://lore.kernel.org/r/20220614074827.458955-3-hch@lst.de Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- block/blk-mq-debugfs.c | 25 ++++++++++++++++++++----- block/blk-mq-debugfs.h | 5 ----- block/blk-mq-sched.c | 11 +++++++++++ block/blk-rq-qos.c | 2 ++ block/blk-rq-qos.h | 7 ++++++- block/blk-sysfs.c | 20 +++++++++----------- include/linux/blkdev.h | 8 ++++---- kernel/trace/blktrace.c | 3 --- 8 files changed, 52 insertions(+), 29 deletions(-) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 34bee263936c..d491b6eb0ab9 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -713,11 +713,6 @@ void blk_mq_debugfs_register(struct request_queue *q) } } =20 -void blk_mq_debugfs_unregister(struct request_queue *q) -{ - q->sched_debugfs_dir =3D NULL; -} - static void blk_mq_debugfs_register_ctx(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx) { @@ -751,6 +746,8 @@ void blk_mq_debugfs_register_hctx(struct request_queue = *q, =20 void blk_mq_debugfs_unregister_hctx(struct blk_mq_hw_ctx *hctx) { + if (!hctx->queue->debugfs_dir) + return; debugfs_remove_recursive(hctx->debugfs_dir); hctx->sched_debugfs_dir =3D NULL; hctx->debugfs_dir =3D NULL; @@ -778,6 +775,8 @@ void blk_mq_debugfs_register_sched(struct request_queue= *q) { struct elevator_type *e =3D q->elevator->type; =20 + lockdep_assert_held(&q->debugfs_mutex); + /* * If the parent directory has not been created yet, return, we will be * called again later on and the directory/files will be created then. @@ -795,6 +794,8 @@ void blk_mq_debugfs_register_sched(struct request_queue= *q) =20 void blk_mq_debugfs_unregister_sched(struct request_queue *q) { + lockdep_assert_held(&q->debugfs_mutex); + debugfs_remove_recursive(q->sched_debugfs_dir); q->sched_debugfs_dir =3D NULL; } @@ -816,6 +817,10 @@ static const char *rq_qos_id_to_name(enum rq_qos_id id) =20 void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos) { + lockdep_assert_held(&rqos->q->debugfs_mutex); + + if (!rqos->q->debugfs_dir) + return; debugfs_remove_recursive(rqos->debugfs_dir); rqos->debugfs_dir =3D NULL; } @@ -825,6 +830,8 @@ void blk_mq_debugfs_register_rqos(struct rq_qos *rqos) struct request_queue *q =3D rqos->q; const char *dir_name =3D rq_qos_id_to_name(rqos->id); =20 + lockdep_assert_held(&q->debugfs_mutex); + if (rqos->debugfs_dir || !rqos->ops->debugfs_attrs) return; =20 @@ -840,6 +847,8 @@ void blk_mq_debugfs_register_rqos(struct rq_qos *rqos) =20 void blk_mq_debugfs_unregister_queue_rqos(struct request_queue *q) { + lockdep_assert_held(&q->debugfs_mutex); + debugfs_remove_recursive(q->rqos_debugfs_dir); q->rqos_debugfs_dir =3D NULL; } @@ -849,6 +858,8 @@ void blk_mq_debugfs_register_sched_hctx(struct request_= queue *q, { struct elevator_type *e =3D q->elevator->type; =20 + lockdep_assert_held(&q->debugfs_mutex); + /* * If the parent debugfs directory has not been created yet, return; * We will be called again later on with appropriate parent debugfs @@ -868,6 +879,10 @@ void blk_mq_debugfs_register_sched_hctx(struct request= _queue *q, =20 void blk_mq_debugfs_unregister_sched_hctx(struct blk_mq_hw_ctx *hctx) { + lockdep_assert_held(&hctx->queue->debugfs_mutex); + + if (!hctx->queue->debugfs_dir) + return; debugfs_remove_recursive(hctx->sched_debugfs_dir); hctx->sched_debugfs_dir =3D NULL; } diff --git a/block/blk-mq-debugfs.h b/block/blk-mq-debugfs.h index 69918f4170d6..771d45832878 100644 --- a/block/blk-mq-debugfs.h +++ b/block/blk-mq-debugfs.h @@ -21,7 +21,6 @@ int __blk_mq_debugfs_rq_show(struct seq_file *m, struct r= equest *rq); int blk_mq_debugfs_rq_show(struct seq_file *m, void *v); =20 void blk_mq_debugfs_register(struct request_queue *q); -void blk_mq_debugfs_unregister(struct request_queue *q); void blk_mq_debugfs_register_hctx(struct request_queue *q, struct blk_mq_hw_ctx *hctx); void blk_mq_debugfs_unregister_hctx(struct blk_mq_hw_ctx *hctx); @@ -42,10 +41,6 @@ static inline void blk_mq_debugfs_register(struct reques= t_queue *q) { } =20 -static inline void blk_mq_debugfs_unregister(struct request_queue *q) -{ -} - static inline void blk_mq_debugfs_register_hctx(struct request_queue *q, struct blk_mq_hw_ctx *hctx) { diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index 9e56a69422b6..e84bec39fd3a 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c @@ -593,7 +593,9 @@ int blk_mq_init_sched(struct request_queue *q, struct e= levator_type *e) if (ret) goto err_free_map_and_rqs; =20 + mutex_lock(&q->debugfs_mutex); blk_mq_debugfs_register_sched(q); + mutex_unlock(&q->debugfs_mutex); =20 queue_for_each_hw_ctx(q, hctx, i) { if (e->ops.init_hctx) { @@ -606,7 +608,9 @@ int blk_mq_init_sched(struct request_queue *q, struct e= levator_type *e) return ret; } } + mutex_lock(&q->debugfs_mutex); blk_mq_debugfs_register_sched_hctx(q, hctx); + mutex_unlock(&q->debugfs_mutex); } =20 return 0; @@ -647,14 +651,21 @@ void blk_mq_exit_sched(struct request_queue *q, struc= t elevator_queue *e) unsigned int flags =3D 0; =20 queue_for_each_hw_ctx(q, hctx, i) { + mutex_lock(&q->debugfs_mutex); blk_mq_debugfs_unregister_sched_hctx(hctx); + mutex_unlock(&q->debugfs_mutex); + if (e->type->ops.exit_hctx && hctx->sched_data) { e->type->ops.exit_hctx(hctx, i); hctx->sched_data =3D NULL; } flags =3D hctx->flags; } + + mutex_lock(&q->debugfs_mutex); blk_mq_debugfs_unregister_sched(q); + mutex_unlock(&q->debugfs_mutex); + if (e->type->ops.exit_sched) e->type->ops.exit_sched(e); blk_mq_sched_tags_teardown(q, flags); diff --git a/block/blk-rq-qos.c b/block/blk-rq-qos.c index e83af7bc7591..249a6f05dd3b 100644 --- a/block/blk-rq-qos.c +++ b/block/blk-rq-qos.c @@ -294,7 +294,9 @@ void rq_qos_wait(struct rq_wait *rqw, void *private_dat= a, =20 void rq_qos_exit(struct request_queue *q) { + mutex_lock(&q->debugfs_mutex); blk_mq_debugfs_unregister_queue_rqos(q); + mutex_unlock(&q->debugfs_mutex); =20 while (q->rq_qos) { struct rq_qos *rqos =3D q->rq_qos; diff --git a/block/blk-rq-qos.h b/block/blk-rq-qos.h index 68267007da1c..0e46052b018a 100644 --- a/block/blk-rq-qos.h +++ b/block/blk-rq-qos.h @@ -104,8 +104,11 @@ static inline void rq_qos_add(struct request_queue *q,= struct rq_qos *rqos) =20 blk_mq_unfreeze_queue(q); =20 - if (rqos->ops->debugfs_attrs) + if (rqos->ops->debugfs_attrs) { + mutex_lock(&q->debugfs_mutex); blk_mq_debugfs_register_rqos(rqos); + mutex_unlock(&q->debugfs_mutex); + } } =20 static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos) @@ -129,7 +132,9 @@ static inline void rq_qos_del(struct request_queue *q, = struct rq_qos *rqos) =20 blk_mq_unfreeze_queue(q); =20 + mutex_lock(&q->debugfs_mutex); blk_mq_debugfs_unregister_rqos(rqos); + mutex_unlock(&q->debugfs_mutex); } =20 typedef bool (acquire_inflight_cb_t)(struct rq_wait *rqw, void *private_da= ta); diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 88bd41d4cb59..6e4801b217a7 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -779,14 +779,13 @@ static void blk_release_queue(struct kobject *kobj) if (queue_is_mq(q)) blk_mq_release(q); =20 - blk_trace_shutdown(q); mutex_lock(&q->debugfs_mutex); + blk_trace_shutdown(q); debugfs_remove_recursive(q->debugfs_dir); + q->debugfs_dir =3D NULL; + q->sched_debugfs_dir =3D NULL; mutex_unlock(&q->debugfs_mutex); =20 - if (queue_is_mq(q)) - blk_mq_debugfs_unregister(q); - bioset_exit(&q->bio_split); =20 if (blk_queue_has_srcu(q)) @@ -836,17 +835,16 @@ int blk_register_queue(struct gendisk *disk) goto unlock; } =20 + if (queue_is_mq(q)) + __blk_mq_register_dev(dev, q); + mutex_lock(&q->sysfs_lock); + mutex_lock(&q->debugfs_mutex); q->debugfs_dir =3D debugfs_create_dir(kobject_name(q->kobj.parent), blk_debugfs_root); - mutex_unlock(&q->debugfs_mutex); - - if (queue_is_mq(q)) { - __blk_mq_register_dev(dev, q); + if (queue_is_mq(q)) blk_mq_debugfs_register(q); - } - - mutex_lock(&q->sysfs_lock); + mutex_unlock(&q->debugfs_mutex); =20 ret =3D disk_register_independent_access_ranges(disk, NULL); if (ret) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 108e3d114bfc..cc6b24a5098f 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -466,7 +466,6 @@ struct request_queue { #endif /* CONFIG_BLK_DEV_ZONED */ =20 int node; - struct mutex debugfs_mutex; #ifdef CONFIG_BLK_DEV_IO_TRACE struct blk_trace __rcu *blk_trace; #endif @@ -510,11 +509,12 @@ struct request_queue { struct bio_set bio_split; =20 struct dentry *debugfs_dir; - -#ifdef CONFIG_BLK_DEBUG_FS struct dentry *sched_debugfs_dir; struct dentry *rqos_debugfs_dir; -#endif + /* + * Serializes all debugfs metadata operations using the above dentries. + */ + struct mutex debugfs_mutex; =20 bool mq_sysfs_init_done; =20 diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index f22219495541..f0500b5cfefe 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -770,14 +770,11 @@ int blk_trace_ioctl(struct block_device *bdev, unsign= ed cmd, char __user *arg) **/ void blk_trace_shutdown(struct request_queue *q) { - mutex_lock(&q->debugfs_mutex); if (rcu_dereference_protected(q->blk_trace, lockdep_is_held(&q->debugfs_mutex))) { __blk_trace_startstop(q, 0); __blk_trace_remove(q); } - - mutex_unlock(&q->debugfs_mutex); } =20 #ifdef CONFIG_BLK_CGROUP --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27727C00140 for ; Mon, 15 Aug 2022 23:23:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243234AbiHOXXT (ORCPT ); Mon, 15 Aug 2022 19:23:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234174AbiHOXRH (ORCPT ); Mon, 15 Aug 2022 19:17:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FA44149A15; Mon, 15 Aug 2022 13:03:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 59A7C612DA; Mon, 15 Aug 2022 20:03:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6259DC433C1; Mon, 15 Aug 2022 20:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593819; bh=AwT3hcAJvFxenTj1NVvhczIFkFp0UrMMz3+/fm3VJqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CLDQNZUrX6wFUFph7R5/J3kTquN8ReRyi3Kh5aL1Ow2WyRjspaQTmY6bW++Zaz1bA 4FiyUf+BER0Bv38Q8w6EvJnYSCySqrOz7+6+QdMIerCBYiNhgxhxXlRq47n6s6M2ri kNmr3uyAB1ULvEHw8VDdZLNCDQ8FrHlFYKnYniVQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jinke Han , Muchun Song , Tejun Heo , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 1011/1095] block: dont allow the same type rq_qos add more than once Date: Mon, 15 Aug 2022 20:06:50 +0200 Message-Id: <20220815180510.943662166@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jinke Han [ Upstream commit 14a6e2eb7df5c7897c15b109cba29ab0c4a791b6 ] In our test of iocost, we encountered some list add/del corruptions of inner_walk list in ioc_timer_fn. The reason can be described as follows: cpu 0 cpu 1 ioc_qos_write ioc_qos_write ioc =3D q_to_ioc(queue); if (!ioc) { ioc =3D kzalloc(); ioc =3D q_to_ioc(queue); if (!ioc) { ioc =3D kzalloc(); ... rq_qos_add(q, rqos); } ... rq_qos_add(q, rqos); ... } When the io.cost.qos file is written by two cpus concurrently, rq_qos may be added to one disk twice. In that case, there will be two iocs enabled and running on one disk. They own different iocgs on their active list. In the ioc_timer_fn function, because of the iocgs from two iocs have the same root iocg, the root iocg's walk_list may be overwritten by each other and this leads to list add/del corruptions in building or destroying the inner_walk list. And so far, the blk-rq-qos framework works in case that one instance for one type rq_qos per queue by default. This patch make this explicit and also fix the crash above. Signed-off-by: Jinke Han Reviewed-by: Muchun Song Acked-by: Tejun Heo Cc: Link: https://lore.kernel.org/r/20220720093616.70584-1-hanjinke.666@bytedan= ce.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- block/blk-iocost.c | 20 +++++++++++++------- block/blk-iolatency.c | 18 +++++++++++------- block/blk-rq-qos.h | 11 ++++++++++- block/blk-wbt.c | 12 +++++++++++- 4 files changed, 45 insertions(+), 16 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 16705fbd0699..a19f2db4eeb2 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -2893,15 +2893,21 @@ static int blk_iocost_init(struct request_queue *q) * called before policy activation completion, can't assume that the * target bio has an iocg associated and need to test for NULL iocg. */ - rq_qos_add(q, rqos); + ret =3D rq_qos_add(q, rqos); + if (ret) + goto err_free_ioc; + ret =3D blkcg_activate_policy(q, &blkcg_policy_iocost); - if (ret) { - rq_qos_del(q, rqos); - free_percpu(ioc->pcpu_stat); - kfree(ioc); - return ret; - } + if (ret) + goto err_del_qos; return 0; + +err_del_qos: + rq_qos_del(q, rqos); +err_free_ioc: + free_percpu(ioc->pcpu_stat); + kfree(ioc); + return ret; } =20 static struct blkcg_policy_data *ioc_cpd_alloc(gfp_t gfp) diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c index 9568bf8dfe82..7845dca5fcfd 100644 --- a/block/blk-iolatency.c +++ b/block/blk-iolatency.c @@ -773,19 +773,23 @@ int blk_iolatency_init(struct request_queue *q) rqos->ops =3D &blkcg_iolatency_ops; rqos->q =3D q; =20 - rq_qos_add(q, rqos); - + ret =3D rq_qos_add(q, rqos); + if (ret) + goto err_free; ret =3D blkcg_activate_policy(q, &blkcg_policy_iolatency); - if (ret) { - rq_qos_del(q, rqos); - kfree(blkiolat); - return ret; - } + if (ret) + goto err_qos_del; =20 timer_setup(&blkiolat->timer, blkiolatency_timer_fn, 0); INIT_WORK(&blkiolat->enable_work, blkiolatency_enable_work_fn); =20 return 0; + +err_qos_del: + rq_qos_del(q, rqos); +err_free: + kfree(blkiolat); + return ret; } =20 static void iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val) diff --git a/block/blk-rq-qos.h b/block/blk-rq-qos.h index 0e46052b018a..08b856570ad1 100644 --- a/block/blk-rq-qos.h +++ b/block/blk-rq-qos.h @@ -86,7 +86,7 @@ static inline void rq_wait_init(struct rq_wait *rq_wait) init_waitqueue_head(&rq_wait->wait); } =20 -static inline void rq_qos_add(struct request_queue *q, struct rq_qos *rqos) +static inline int rq_qos_add(struct request_queue *q, struct rq_qos *rqos) { /* * No IO can be in-flight when adding rqos, so freeze queue, which @@ -98,6 +98,8 @@ static inline void rq_qos_add(struct request_queue *q, st= ruct rq_qos *rqos) blk_mq_freeze_queue(q); =20 spin_lock_irq(&q->queue_lock); + if (rq_qos_id(q, rqos->id)) + goto ebusy; rqos->next =3D q->rq_qos; q->rq_qos =3D rqos; spin_unlock_irq(&q->queue_lock); @@ -109,6 +111,13 @@ static inline void rq_qos_add(struct request_queue *q,= struct rq_qos *rqos) blk_mq_debugfs_register_rqos(rqos); mutex_unlock(&q->debugfs_mutex); } + + return 0; +ebusy: + spin_unlock_irq(&q->queue_lock); + blk_mq_unfreeze_queue(q); + return -EBUSY; + } =20 static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos) diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 0c119be0e813..ae6ea0b54579 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -820,6 +820,7 @@ int wbt_init(struct request_queue *q) { struct rq_wb *rwb; int i; + int ret; =20 rwb =3D kzalloc(sizeof(*rwb), GFP_KERNEL); if (!rwb) @@ -846,7 +847,10 @@ int wbt_init(struct request_queue *q) /* * Assign rwb and add the stats callback. */ - rq_qos_add(q, &rwb->rqos); + ret =3D rq_qos_add(q, &rwb->rqos); + if (ret) + goto err_free; + blk_stat_add_callback(q, rwb->cb); =20 rwb->min_lat_nsec =3D wbt_default_latency_nsec(q); @@ -855,4 +859,10 @@ int wbt_init(struct request_queue *q) wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); =20 return 0; + +err_free: + blk_stat_free_callback(rwb->cb); + kfree(rwb); + return ret; + } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01114C00140 for ; Mon, 15 Aug 2022 23:23:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243717AbiHOXXi (ORCPT ); Mon, 15 Aug 2022 19:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242854AbiHOXSV (ORCPT ); Mon, 15 Aug 2022 19:18:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D98A47B90; Mon, 15 Aug 2022 13:03:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1787AB81154; Mon, 15 Aug 2022 20:03:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D8DBC433D6; Mon, 15 Aug 2022 20:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593825; bh=FxJJEqP1tmkFWKmlZHUmnsWUH7SsVvsMr/bvbkSXlck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kebNOPonG/+e9wXEqahaT+FRwnQgXMRatHRcUVGPUVAyGpTgEeuJMs1aHurjTuvI2 ZL/uj/X8EQIq7kC5tRmyny9QgddBXTarh0oNUe0IvbUCE7D5uRSZ8XWF3JXQHilbua 3fv6PQY9lDuunDd/OkhUgbUwvE/rFYUMURVMRnpU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , Josef Bacik , David Sterba , Sasha Levin Subject: [PATCH 5.18 1012/1095] btrfs: tree-log: make the return value for log syncing consistent Date: Mon, 15 Aug 2022 20:06:51 +0200 Message-Id: <20220815180510.972639183@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Josef Bacik [ Upstream commit f31f09f6be1c6c1a673e0566e258281a7bbaaa51 ] Currently we will return 1 or -EAGAIN if we decide we need to commit the transaction rather than sync the log. In practice this doesn't really matter, we interpret any !0 and !BTRFS_NO_LOG_SYNC as needing to commit the transaction. However this makes it hard to figure out what the correct thing to do is. Fix this up by defining BTRFS_LOG_FORCE_COMMIT and using this in all the places where we want to force the transaction to be committed. CC: stable@vger.kernel.org # 5.15+ Reviewed-by: Filipe Manana Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/file.c | 2 +- fs/btrfs/tree-log.c | 18 +++++++++--------- fs/btrfs/tree-log.h | 3 +++ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 153920acd226..2d24f2dcc0ea 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2344,7 +2344,7 @@ int btrfs_sync_file(struct file *file, loff_t start, = loff_t end, int datasync) btrfs_release_log_ctx_extents(&ctx); if (ret < 0) { /* Fallthrough and commit/free transaction. */ - ret =3D 1; + ret =3D BTRFS_LOG_FORCE_COMMIT; } =20 /* we've logged all the items and now have a consistent diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index e65633686378..08917069a125 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -171,7 +171,7 @@ static int start_log_trans(struct btrfs_trans_handle *t= rans, int index =3D (root->log_transid + 1) % 2; =20 if (btrfs_need_log_full_commit(trans)) { - ret =3D -EAGAIN; + ret =3D BTRFS_LOG_FORCE_COMMIT; goto out; } =20 @@ -194,7 +194,7 @@ static int start_log_trans(struct btrfs_trans_handle *t= rans, * writing. */ if (zoned && !created) { - ret =3D -EAGAIN; + ret =3D BTRFS_LOG_FORCE_COMMIT; goto out; } =20 @@ -3122,7 +3122,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, =20 /* bail out if we need to do a full commit */ if (btrfs_need_log_full_commit(trans)) { - ret =3D -EAGAIN; + ret =3D BTRFS_LOG_FORCE_COMMIT; mutex_unlock(&root->log_mutex); goto out; } @@ -3223,7 +3223,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, } btrfs_wait_tree_log_extents(log, mark); mutex_unlock(&log_root_tree->log_mutex); - ret =3D -EAGAIN; + ret =3D BTRFS_LOG_FORCE_COMMIT; goto out; } =20 @@ -3262,7 +3262,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, blk_finish_plug(&plug); btrfs_wait_tree_log_extents(log, mark); mutex_unlock(&log_root_tree->log_mutex); - ret =3D -EAGAIN; + ret =3D BTRFS_LOG_FORCE_COMMIT; goto out_wake_log_root; } =20 @@ -5849,7 +5849,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle = *trans, inode_only =3D=3D LOG_INODE_ALL && inode->last_unlink_trans >=3D trans->transid) { btrfs_set_log_full_commit(trans); - ret =3D 1; + ret =3D BTRFS_LOG_FORCE_COMMIT; goto out_unlock; } =20 @@ -6563,12 +6563,12 @@ static int btrfs_log_inode_parent(struct btrfs_tran= s_handle *trans, bool log_dentries =3D false; =20 if (btrfs_test_opt(fs_info, NOTREELOG)) { - ret =3D 1; + ret =3D BTRFS_LOG_FORCE_COMMIT; goto end_no_trans; } =20 if (btrfs_root_refs(&root->root_item) =3D=3D 0) { - ret =3D 1; + ret =3D BTRFS_LOG_FORCE_COMMIT; goto end_no_trans; } =20 @@ -6666,7 +6666,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_= handle *trans, end_trans: if (ret < 0) { btrfs_set_log_full_commit(trans); - ret =3D 1; + ret =3D BTRFS_LOG_FORCE_COMMIT; } =20 if (ret) diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h index 1620f8170629..57ab5f3b8dc7 100644 --- a/fs/btrfs/tree-log.h +++ b/fs/btrfs/tree-log.h @@ -12,6 +12,9 @@ /* return value for btrfs_log_dentry_safe that means we don't need to log = it at all */ #define BTRFS_NO_LOG_SYNC 256 =20 +/* We can't use the tree log for whatever reason, force a transaction comm= it */ +#define BTRFS_LOG_FORCE_COMMIT (1) + struct btrfs_log_ctx { int log_ret; int log_transid; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F70BC2BB47 for ; Mon, 15 Aug 2022 23:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345552AbiHOX0v (ORCPT ); Mon, 15 Aug 2022 19:26:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240822AbiHOXTE (ORCPT ); Mon, 15 Aug 2022 19:19:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A2E014A1C6; Mon, 15 Aug 2022 13:03:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2496B61089; Mon, 15 Aug 2022 20:03:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23159C433C1; Mon, 15 Aug 2022 20:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593834; bh=tR7DPSIp4Nw+YZPrGRHaKGiNk5UW/pvct4lAxpVCj08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nrdL13bSKEznogFdPbVIvB+7s0hP+iIErED+ead6zkymWpW7e13NspikS6vjoHW/w ZeDuQpCIhe3Tq15QHvzxPwnzSZNPt+ILkkHEVTYAIbnePGTVBJveqx+qq22/B9mCYG YYgPg242FOfsubtbX7j8kc41y99HdBTCAWTjnKm4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , Naohiro Aota , David Sterba , Sasha Levin Subject: [PATCH 5.18 1013/1095] btrfs: ensure pages are unlocked on cow_file_range() failure Date: Mon, 15 Aug 2022 20:06:52 +0200 Message-Id: <20220815180511.013269350@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit 9ce7466f372d83054c7494f6b3e4b9abaf3f0355 ] There is a hung_task report on zoned btrfs like below. https://github.com/naota/linux/issues/59 [726.328648] INFO: task rocksdb:high0:11085 blocked for more than 241 sec= onds. [726.329839] Not tainted 5.16.0-rc1+ #1 [726.330484] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables = this message. [726.331603] task:rocksdb:high0 state:D stack: 0 pid:11085 ppid: 110= 82 flags:0x00000000 [726.331608] Call Trace: [726.331611] [726.331614] __schedule+0x2e5/0x9d0 [726.331622] schedule+0x58/0xd0 [726.331626] io_schedule+0x3f/0x70 [726.331629] __folio_lock+0x125/0x200 [726.331634] ? find_get_entries+0x1bc/0x240 [726.331638] ? filemap_invalidate_unlock_two+0x40/0x40 [726.331642] truncate_inode_pages_range+0x5b2/0x770 [726.331649] truncate_inode_pages_final+0x44/0x50 [726.331653] btrfs_evict_inode+0x67/0x480 [726.331658] evict+0xd0/0x180 [726.331661] iput+0x13f/0x200 [726.331664] do_unlinkat+0x1c0/0x2b0 [726.331668] __x64_sys_unlink+0x23/0x30 [726.331670] do_syscall_64+0x3b/0xc0 [726.331674] entry_SYSCALL_64_after_hwframe+0x44/0xae [726.331677] RIP: 0033:0x7fb9490a171b [726.331681] RSP: 002b:00007fb943ffac68 EFLAGS: 00000246 ORIG_RAX: 000000= 0000000057 [726.331684] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fb9490= a171b [726.331686] RDX: 00007fb943ffb040 RSI: 000055a6bbe6ec20 RDI: 00007fb9440= 0d300 [726.331687] RBP: 00007fb943ffad00 R08: 0000000000000000 R09: 00000000000= 00000 [726.331688] R10: 0000000000000031 R11: 0000000000000246 R12: 00007fb943f= fb000 [726.331690] R13: 00007fb943ffb040 R14: 0000000000000000 R15: 00007fb943f= fd260 [726.331693] While we debug the issue, we found running fstests generic/551 on 5GB non-zoned null_blk device in the emulated zoned mode also had a similar hung issue. Also, we can reproduce the same symptom with an error injected cow_file_range() setup. The hang occurs when cow_file_range() fails in the middle of allocation. cow_file_range() called from do_allocation_zoned() can split the give region ([start, end]) for allocation depending on current block group usages. When btrfs can allocate bytes for one part of the split regions but fails for the other region (e.g. because of -ENOSPC), we return the error leaving the pages in the succeeded regions locked. Technically, this occurs only when @unlock =3D=3D 0. Otherwise, we unlock the pages in an allocated region after creating an ordered extent. Considering the callers of cow_file_range(unlock=3D0) won't write out the pages, we can unlock the pages on error exit from cow_file_range(). So, we can ensure all the pages except @locked_page are unlocked on error case. In summary, cow_file_range now behaves like this: - page_started =3D=3D 1 (return value) - All the pages are unlocked. IO is started. - unlock =3D=3D 1 - All the pages except @locked_page are unlocked in any case - unlock =3D=3D 0 - On success, all the pages are locked for writing out them - On failure, all the pages except @locked_page are unlocked Fixes: 42c011000963 ("btrfs: zoned: introduce dedicated data write path for= zoned filesystems") CC: stable@vger.kernel.org # 5.12+ Reviewed-by: Filipe Manana Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/inode.c | 72 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5d15e374d032..54afa9e538c5 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1097,6 +1097,28 @@ static u64 get_extent_allocation_hint(struct btrfs_i= node *inode, u64 start, * *page_started is set to one if we unlock locked_page and do everything * required to start IO on it. It may be clean and already done with * IO when we return. + * + * When unlock =3D=3D 1, we unlock the pages in successfully allocated reg= ions. + * When unlock =3D=3D 0, we leave them locked for writing them out. + * + * However, we unlock all the pages except @locked_page in case of failure. + * + * In summary, page locking state will be as follow: + * + * - page_started =3D=3D 1 (return value) + * - All the pages are unlocked. IO is started. + * - Note that this can happen only on success + * - unlock =3D=3D 1 + * - All the pages except @locked_page are unlocked in any case + * - unlock =3D=3D 0 + * - On success, all the pages are locked for writing out them + * - On failure, all the pages except @locked_page are unlocked + * + * When a failure happens in the second or later iteration of the + * while-loop, the ordered extents created in previous iterations are kept + * intact. So, the caller must clean them up by calling + * btrfs_cleanup_ordered_extents(). See btrfs_run_delalloc_range() for + * example. */ static noinline int cow_file_range(struct btrfs_inode *inode, struct page *locked_page, @@ -1106,6 +1128,7 @@ static noinline int cow_file_range(struct btrfs_inode= *inode, struct btrfs_root *root =3D inode->root; struct btrfs_fs_info *fs_info =3D root->fs_info; u64 alloc_hint =3D 0; + u64 orig_start =3D start; u64 num_bytes; unsigned long ram_size; u64 cur_alloc_size =3D 0; @@ -1293,18 +1316,44 @@ static noinline int cow_file_range(struct btrfs_ino= de *inode, btrfs_dec_block_group_reservations(fs_info, ins.objectid); btrfs_free_reserved_extent(fs_info, ins.objectid, ins.offset, 1); out_unlock: + /* + * Now, we have three regions to clean up: + * + * |-------(1)----|---(2)---|-------------(3)----------| + * `- orig_start `- start `- start + cur_alloc_size `- end + * + * We process each region below. + */ + clear_bits =3D EXTENT_LOCKED | EXTENT_DELALLOC | EXTENT_DELALLOC_NEW | EXTENT_DEFRAG | EXTENT_CLEAR_META_RESV; page_ops =3D PAGE_UNLOCK | PAGE_START_WRITEBACK | PAGE_END_WRITEBACK; + /* - * If we reserved an extent for our delalloc range (or a subrange) and - * failed to create the respective ordered extent, then it means that - * when we reserved the extent we decremented the extent's size from - * the data space_info's bytes_may_use counter and incremented the - * space_info's bytes_reserved counter by the same amount. We must make - * sure extent_clear_unlock_delalloc() does not try to decrement again - * the data space_info's bytes_may_use counter, therefore we do not pass - * it the flag EXTENT_CLEAR_DATA_RESV. + * For the range (1). We have already instantiated the ordered extents + * for this region. They are cleaned up by + * btrfs_cleanup_ordered_extents() in e.g, + * btrfs_run_delalloc_range(). EXTENT_LOCKED | EXTENT_DELALLOC are + * already cleared in the above loop. And, EXTENT_DELALLOC_NEW | + * EXTENT_DEFRAG | EXTENT_CLEAR_META_RESV are handled by the cleanup + * function. + * + * However, in case of unlock =3D=3D 0, we still need to unlock the pages + * (except @locked_page) to ensure all the pages are unlocked. + */ + if (!unlock && orig_start < start) + extent_clear_unlock_delalloc(inode, orig_start, start - 1, + locked_page, 0, page_ops); + + /* + * For the range (2). If we reserved an extent for our delalloc range + * (or a subrange) and failed to create the respective ordered extent, + * then it means that when we reserved the extent we decremented the + * extent's size from the data space_info's bytes_may_use counter and + * incremented the space_info's bytes_reserved counter by the same + * amount. We must make sure extent_clear_unlock_delalloc() does not try + * to decrement again the data space_info's bytes_may_use counter, + * therefore we do not pass it the flag EXTENT_CLEAR_DATA_RESV. */ if (extent_reserved) { extent_clear_unlock_delalloc(inode, start, @@ -1316,6 +1365,13 @@ static noinline int cow_file_range(struct btrfs_inod= e *inode, if (start >=3D end) goto out; } + + /* + * For the range (3). We never touched the region. In addition to the + * clear_bits above, we add EXTENT_CLEAR_DATA_RESV to release the data + * space_info's bytes_may_use counter, reserved in + * btrfs_check_data_free_space(). + */ extent_clear_unlock_delalloc(inode, start, end, locked_page, clear_bits | EXTENT_CLEAR_DATA_RESV, page_ops); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BEA6C00140 for ; Mon, 15 Aug 2022 23:24:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244694AbiHOXYP (ORCPT ); Mon, 15 Aug 2022 19:24:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245427AbiHOXTS (ORCPT ); Mon, 15 Aug 2022 19:19:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3E8514A1DF; Mon, 15 Aug 2022 13:04:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 314B3612DF; Mon, 15 Aug 2022 20:04:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07189C433D6; Mon, 15 Aug 2022 20:03:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593840; bh=kdQprRVNjt2FpuiOyeH0A+5fDsgo/qokRp7Jrnl5duM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kbP9ZGM5ie30XzDkNojqtZIr2SS5ZyHynojoxels9lmZunVw2+Jzo3PS2r9UX9NGK GSZDAw1GA+00n6dsoaA6mu+NjGjNso3tzugk2JWgHAyQ5hs4fXSwVJIwJCjK5zaamR 8iND2vzGtZ0Tkn6xBrohSFfnowoA2TWaZmS2Y9As= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , Naohiro Aota , David Sterba , Sasha Levin Subject: [PATCH 5.18 1014/1095] btrfs: fix error handling of fallback uncompress write Date: Mon, 15 Aug 2022 20:06:53 +0200 Message-Id: <20220815180511.050514969@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit 71aa147b4d9d81fa65afa6016f50d7818b64a54f ] When cow_file_range() fails in the middle of the allocation loop, it unlocks the pages but leaves the ordered extents intact. Thus, we need to call btrfs_cleanup_ordered_extents() to finish the created ordered extents. Also, we need to call end_extent_writepage() if locked_page is available because btrfs_cleanup_ordered_extents() never processes the region on the locked_page. Furthermore, we need to set the mapping as error if locked_page is unavailable before unlocking the pages, so that the errno is properly propagated to the user space. CC: stable@vger.kernel.org # 5.18+ Reviewed-by: Filipe Manana Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/inode.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 54afa9e538c5..1e404476fe6a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -891,8 +891,18 @@ static int submit_uncompressed_range(struct btrfs_inod= e *inode, goto out; } if (ret < 0) { - if (locked_page) + btrfs_cleanup_ordered_extents(inode, locked_page, start, end - start + 1= ); + if (locked_page) { + const u64 page_start =3D page_offset(locked_page); + const u64 page_end =3D page_start + PAGE_SIZE - 1; + + btrfs_page_set_error(inode->root->fs_info, locked_page, + page_start, PAGE_SIZE); + set_page_writeback(locked_page); + end_page_writeback(locked_page); + end_extent_writepage(locked_page, ret, page_start, page_end); unlock_page(locked_page); + } goto out; } =20 @@ -1341,9 +1351,12 @@ static noinline int cow_file_range(struct btrfs_inod= e *inode, * However, in case of unlock =3D=3D 0, we still need to unlock the pages * (except @locked_page) to ensure all the pages are unlocked. */ - if (!unlock && orig_start < start) + if (!unlock && orig_start < start) { + if (!locked_page) + mapping_set_error(inode->vfs_inode.i_mapping, ret); extent_clear_unlock_delalloc(inode, orig_start, start - 1, locked_page, 0, page_ops); + } =20 /* * For the range (2). If we reserved an extent for our delalloc range --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D49DCC00140 for ; Mon, 15 Aug 2022 23:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240581AbiHOXYc (ORCPT ); Mon, 15 Aug 2022 19:24:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245066AbiHOXUJ (ORCPT ); Mon, 15 Aug 2022 19:20:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A830F14A1F4; Mon, 15 Aug 2022 13:04:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 44E68612E8; Mon, 15 Aug 2022 20:04:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CC46C433D6; Mon, 15 Aug 2022 20:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593846; bh=PTZjMZz3dY7nGwXr/zmNJG3phN1LRfO3lK1lVY9wDPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ypWxWOvwn4gDr8s0uDyhRPlRAlaEa9s4G08qS26f2msANaR28armkDKCXPbvR3/Xm 3imAiZjZ78lmTcLB8Pxj40mbdsvU8x4qCnGIDJWtEzaA714f3hgc8FcYrONr75jpDT 9QZviPRj6KIuAmtZkcqNSkLlZQaiViIKsDybkRUc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , Josef Bacik , David Sterba , Sasha Levin Subject: [PATCH 5.18 1015/1095] btrfs: reset block group chunk force if we have to wait Date: Mon, 15 Aug 2022 20:06:54 +0200 Message-Id: <20220815180511.083835595@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Josef Bacik [ Upstream commit 1314ca78b2c35d3e7d0f097268a2ee6dc0d369ef ] If you try to force a chunk allocation, but you race with another chunk allocation, you will end up waiting on the chunk allocation that just occurred and then allocate another chunk. If you have many threads all doing this at once you can way over-allocate chunks. Fix this by resetting force to NO_FORCE, that way if we think we need to allocate we can, otherwise we don't force another chunk allocation if one is already happening. Reviewed-by: Filipe Manana CC: stable@vger.kernel.org # 5.4+ Signed-off-by: Josef Bacik Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/block-group.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 667b7025d503..1deca5164c23 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -3724,6 +3724,7 @@ int btrfs_chunk_alloc(struct btrfs_trans_handle *tran= s, u64 flags, * attempt. */ wait_for_alloc =3D true; + force =3D CHUNK_ALLOC_NO_FORCE; spin_unlock(&space_info->lock); mutex_lock(&fs_info->chunk_mutex); mutex_unlock(&fs_info->chunk_mutex); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1853BC00140 for ; Mon, 15 Aug 2022 23:24:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245074AbiHOXYn (ORCPT ); Mon, 15 Aug 2022 19:24:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343624AbiHOXUl (ORCPT ); Mon, 15 Aug 2022 19:20:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ED9FB4E80; Mon, 15 Aug 2022 13:04:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 99CAD61226; Mon, 15 Aug 2022 20:04:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84EEBC433B5; Mon, 15 Aug 2022 20:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593853; bh=jB0ttoGjb7G3INqAt6pTRAlPqBFKPCcILx++1gjZ16o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PpQ2WRJpdP2bFVxiNAmoMhsHZJWO6X4+7ndhW0RXuIvzRDra6KQM0bvMWXuKphdU6 FyncAfc+76mJYLX2GtXdToioYRQZiGwHYgiW4rKvRb5OJksrS7f7Rg27GBXrtjimEi b2cAMq6qW8pd63gsu9oqAMMM282ooDUEuwBceR+k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qu Wenruo , Nikolay Borisov , David Sterba , Sasha Levin Subject: [PATCH 5.18 1016/1095] btrfs: properly flag filesystem with BTRFS_FEATURE_INCOMPAT_BIG_METADATA Date: Mon, 15 Aug 2022 20:06:55 +0200 Message-Id: <20220815180511.125864340@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nikolay Borisov [ Upstream commit e26b04c4c91925dba57324db177a24e18e2d0013 ] Commit 6f93e834fa7c seemingly inadvertently moved the code responsible for flagging the filesystem as having BIG_METADATA to a place where setting the flag was essentially lost. This means that filesystems created with kernels containing this bug (starting with 5.15) can potentially be mounted by older (pre-3.4) kernels. In reality chances for this happening are low because there are other incompat flags introduced in the mean time. Still the correct behavior is to set INCOMPAT_BIG_METADATA flag and persist this in the superblock. Fixes: 6f93e834fa7c ("btrfs: fix upper limit for max_inline for page size 6= 4K") CC: stable@vger.kernel.org # 5.4+ Reviewed-by: Qu Wenruo Signed-off-by: Nikolay Borisov Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/disk-io.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index f45470798022..34cd57d799e4 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3577,16 +3577,6 @@ int __cold open_ctree(struct super_block *sb, struct= btrfs_fs_devices *fs_device */ fs_info->compress_type =3D BTRFS_COMPRESS_ZLIB; =20 - /* - * Flag our filesystem as having big metadata blocks if they are bigger - * than the page size. - */ - if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) { - if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA)) - btrfs_info(fs_info, - "flagging fs with big metadata feature"); - features |=3D BTRFS_FEATURE_INCOMPAT_BIG_METADATA; - } =20 /* Set up fs_info before parsing mount options */ nodesize =3D btrfs_super_nodesize(disk_super); @@ -3627,6 +3617,17 @@ int __cold open_ctree(struct super_block *sb, struct= btrfs_fs_devices *fs_device if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA) btrfs_info(fs_info, "has skinny extents"); =20 + /* + * Flag our filesystem as having big metadata blocks if they are bigger + * than the page size. + */ + if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) { + if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA)) + btrfs_info(fs_info, + "flagging fs with big metadata feature"); + features |=3D BTRFS_FEATURE_INCOMPAT_BIG_METADATA; + } + /* * mixed block groups end up with duplicate but slightly offset * extent buffers for the same range. It leads to corruptions --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3263FC25B0D for ; Mon, 15 Aug 2022 23:25:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243494AbiHOXZD (ORCPT ); Mon, 15 Aug 2022 19:25:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345022AbiHOXU4 (ORCPT ); Mon, 15 Aug 2022 19:20:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F562B4EAC; Mon, 15 Aug 2022 13:04:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BF1A460693; Mon, 15 Aug 2022 20:04:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C01D4C433C1; Mon, 15 Aug 2022 20:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593859; bh=NGilHNjrd5uqftgXcB6CgRGd4vGCjA/xtz5PynTnumU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qBF663ivHNTIZh49MIWyHHjyTHdT+tTEiUnJdnLx8TMWVOvPu3Qe1MK+RFcx+rnkx Ed1/4KnwBqr4/tCqQMzo9Dr0S9Tys4y2kowmHsc1dG6K2tdATFWVuzoNKm4+M9MDSz 4/77LrC8vsN1HIDPa1H4P4HaB3ytIxc0JqX26LmE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Damien Le Moal , "Martin K. Petersen" , Johannes Thumshirn , Chaitanya Kulkarni , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 1017/1095] block: add a bdev_max_zone_append_sectors helper Date: Mon, 15 Aug 2022 20:06:56 +0200 Message-Id: <20220815180511.162001359@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig [ Upstream commit 2aba0d19f4d8c8929b4b3b94a9cfde2aa20e6ee2 ] Add a helper to check the max supported sectors for zone append based on the block_device instead of having to poke into the block layer internal request_queue. Signed-off-by: Christoph Hellwig Acked-by: Damien Le Moal Reviewed-by: Martin K. Petersen Reviewed-by: Johannes Thumshirn Reviewed-by: Chaitanya Kulkarni Link: https://lore.kernel.org/r/20220415045258.199825-16-hch@lst.de Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/nvme/target/zns.c | 3 +-- fs/zonefs/super.c | 3 +-- include/linux/blkdev.h | 6 ++++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c index e34718b09550..82b61acf7a72 100644 --- a/drivers/nvme/target/zns.c +++ b/drivers/nvme/target/zns.c @@ -34,8 +34,7 @@ static int validate_conv_zones_cb(struct blk_zone *z, =20 bool nvmet_bdev_zns_enable(struct nvmet_ns *ns) { - struct request_queue *q =3D ns->bdev->bd_disk->queue; - u8 zasl =3D nvmet_zasl(queue_max_zone_append_sectors(q)); + u8 zasl =3D nvmet_zasl(bdev_max_zone_append_sectors(ns->bdev)); struct gendisk *bd_disk =3D ns->bdev->bd_disk; int ret; =20 diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index 15a4c7c07a3b..b68798a572fc 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -723,13 +723,12 @@ static ssize_t zonefs_file_dio_append(struct kiocb *i= ocb, struct iov_iter *from) struct inode *inode =3D file_inode(iocb->ki_filp); struct zonefs_inode_info *zi =3D ZONEFS_I(inode); struct block_device *bdev =3D inode->i_sb->s_bdev; - unsigned int max; + unsigned int max =3D bdev_max_zone_append_sectors(bdev); struct bio *bio; ssize_t size; int nr_pages; ssize_t ret; =20 - max =3D queue_max_zone_append_sectors(bdev_get_queue(bdev)); max =3D ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize); iov_iter_truncate(from, max); =20 diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index cc6b24a5098f..34f2b88dfd6e 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1190,6 +1190,12 @@ static inline unsigned int queue_max_zone_append_sec= tors(const struct request_qu return min(l->max_zone_append_sectors, l->max_sectors); } =20 +static inline unsigned int +bdev_max_zone_append_sectors(struct block_device *bdev) +{ + return queue_max_zone_append_sectors(bdev_get_queue(bdev)); +} + static inline unsigned queue_logical_block_size(const struct request_queue= *q) { int retval =3D 512; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E07C0C00140 for ; Mon, 15 Aug 2022 23:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245427AbiHOXZr (ORCPT ); Mon, 15 Aug 2022 19:25:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345768AbiHOXVH (ORCPT ); Mon, 15 Aug 2022 19:21:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C675D7D790; Mon, 15 Aug 2022 13:04:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 79153B80EAD; Mon, 15 Aug 2022 20:04:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D17B1C433C1; Mon, 15 Aug 2022 20:04:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593868; bh=RhcSSngBtNJqlypII+iNFiSmycad2c4LfRwUEb29heI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OngrY+iYwanTr5cQLbCGZNvXM1+zZWU0nandkupwb8Lxf6nGcF7/SNx4nBwU75967 nMoTd8CmXaLewa8DtGdnAcs/3x7o61Ohe9hAZE9D//ax1ZRNLuR5bQ4CbvXTCefwXX Wym1r4ilTx6/x0O3rDkEX2Ldr0tlK+ywSvZvGihY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Thumshirn , Jens Axboe , Christoph Hellwig , Naohiro Aota , David Sterba , Sasha Levin Subject: [PATCH 5.18 1018/1095] block: add bdev_max_segments() helper Date: Mon, 15 Aug 2022 20:06:57 +0200 Message-Id: <20220815180511.200844214@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit 65ea1b66482f415d51cd46515b02477257330339 ] Add bdev_max_segments() like other queue parameters. Reviewed-by: Johannes Thumshirn Reviewed-by: Jens Axboe Reviewed-by: Christoph Hellwig Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/blkdev.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 34f2b88dfd6e..7927480b9cf7 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1196,6 +1196,11 @@ bdev_max_zone_append_sectors(struct block_device *bd= ev) return queue_max_zone_append_sectors(bdev_get_queue(bdev)); } =20 +static inline unsigned int bdev_max_segments(struct block_device *bdev) +{ + return queue_max_segments(bdev_get_queue(bdev)); +} + static inline unsigned queue_logical_block_size(const struct request_queue= *q) { int retval =3D 512; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF3B1C25B0D for ; Mon, 15 Aug 2022 23:37:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353611AbiHOXfn (ORCPT ); Mon, 15 Aug 2022 19:35:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347802AbiHOXbS (ORCPT ); Mon, 15 Aug 2022 19:31:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 222F014F95C; Mon, 15 Aug 2022 13:08:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1B9EAB80EA8; Mon, 15 Aug 2022 20:08:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F0DDC433C1; Mon, 15 Aug 2022 20:08:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594086; bh=SKEygmUBXzgJPwifGS9B38zKqN9dE7k1jJLKHwEV9f0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KlB6QNRoi/t6gIGCreXAVVhkCUhPcLYEbBBbQB845pnFpwObS4CoQ+NDiNHGhaLqW g/r2B9OkHpE+wwjvfOn8Ik3CnCtCzqu31BrPk57qck3dpxcfJ+5b0NS13915WweQOl 2ReJMqLByhjWXQpff6zP7pGitMrhovfvd3l3Z39g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Thumshirn , Naohiro Aota , David Sterba , Sasha Levin Subject: [PATCH 5.18 1019/1095] btrfs: zoned: revive max_zone_append_bytes Date: Mon, 15 Aug 2022 20:06:58 +0200 Message-Id: <20220815180511.239026764@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit c2ae7b772ef4e86c5ddf3fd47bf59045ae96a414 ] This patch is basically a revert of commit 5a80d1c6a270 ("btrfs: zoned: remove max_zone_append_size logic"), but without unnecessary ASSERT and check. The max_zone_append_size will be used as a hint to estimate the number of extents to cover delalloc/writeback region in the later commits. The size of a ZONE APPEND bio is also limited by queue_max_segments(), so this commit considers it to calculate max_zone_append_size. Technically, a bio can be larger than queue_max_segments() * PAGE_SIZE if the pages are contiguous. But, it is safe to consider "queue_max_segments() * PAGE_SIZE" as an upper limit of an extent size to calculate the number of extents needed to write data. Reviewed-by: Johannes Thumshirn Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/ctree.h | 2 ++ fs/btrfs/zoned.c | 17 +++++++++++++++++ fs/btrfs/zoned.h | 1 + 3 files changed, 20 insertions(+) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 077c95e9baa5..1c377bcfe787 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1050,6 +1050,8 @@ struct btrfs_fs_info { u64 zoned; }; =20 + /* Max size to emit ZONE_APPEND write command */ + u64 max_zone_append_size; struct mutex zoned_meta_io_lock; spinlock_t treelog_bg_lock; u64 treelog_bg; diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 84b6d39509bd..1d5b9308f5ef 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -407,6 +407,16 @@ int btrfs_get_dev_zone_info(struct btrfs_device *devic= e, bool populate_cache) nr_sectors =3D bdev_nr_sectors(bdev); zone_info->zone_size_shift =3D ilog2(zone_info->zone_size); zone_info->nr_zones =3D nr_sectors >> ilog2(zone_sectors); + /* + * We limit max_zone_append_size also by max_segments * + * PAGE_SIZE. Technically, we can have multiple pages per segment. But, + * since btrfs adds the pages one by one to a bio, and btrfs cannot + * increase the metadata reservation even if it increases the number of + * extents, it is safe to stick with the limit. + */ + zone_info->max_zone_append_size =3D + min_t(u64, (u64)bdev_max_zone_append_sectors(bdev) << SECTOR_SHIFT, + (u64)bdev_max_segments(bdev) << PAGE_SHIFT); if (!IS_ALIGNED(nr_sectors, zone_sectors)) zone_info->nr_zones++; =20 @@ -632,6 +642,7 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_inf= o) u64 zoned_devices =3D 0; u64 nr_devices =3D 0; u64 zone_size =3D 0; + u64 max_zone_append_size =3D 0; const bool incompat_zoned =3D btrfs_fs_incompat(fs_info, ZONED); int ret =3D 0; =20 @@ -666,6 +677,11 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_in= fo) ret =3D -EINVAL; goto out; } + if (!max_zone_append_size || + (zone_info->max_zone_append_size && + zone_info->max_zone_append_size < max_zone_append_size)) + max_zone_append_size =3D + zone_info->max_zone_append_size; } nr_devices++; } @@ -715,6 +731,7 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_inf= o) } =20 fs_info->zone_size =3D zone_size; + fs_info->max_zone_append_size =3D max_zone_append_size; fs_info->fs_devices->chunk_alloc_policy =3D BTRFS_CHUNK_ALLOC_ZONED; =20 /* diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h index cf6320feef46..2d6da8f4b55a 100644 --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -23,6 +23,7 @@ struct btrfs_zoned_device_info { */ u64 zone_size; u8 zone_size_shift; + u64 max_zone_append_size; u32 nr_zones; unsigned int max_active_zones; atomic_t active_zones_left; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94DB8C25B08 for ; Mon, 15 Aug 2022 23:28:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244067AbiHOX2l (ORCPT ); Mon, 15 Aug 2022 19:28:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353441AbiHOXWJ (ORCPT ); Mon, 15 Aug 2022 19:22:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B45085A2DC; Mon, 15 Aug 2022 13:05:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 74284B80EAB; Mon, 15 Aug 2022 20:05:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7F7AC433D6; Mon, 15 Aug 2022 20:05:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593920; bh=Eq8eSXAO7AI98iFwI2ICNmDoDHefxB5aC7RyN/7HY9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r4QPNCYQc9z4JJ+YsL/Xs1olmeyR/DtPLN/7omFI+4JNS5pSnZ0rNXduPmDWRm/iR ztefRYA8pF4dFE0CndGnkLdaQAjk3PVGwvWB5YU69UMVUAYh+d7JfCeEfyUCarF+if Qs16T+XlfOWoYZpmO7XcVPQqsykj+SEdIKl9I/N0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Thumshirn , Naohiro Aota , David Sterba , Sasha Levin Subject: [PATCH 5.18 1020/1095] btrfs: replace BTRFS_MAX_EXTENT_SIZE with fs_info->max_extent_size Date: Mon, 15 Aug 2022 20:06:59 +0200 Message-Id: <20220815180511.287497337@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit f7b12a62f008a3041f42f2426983e59a6a0a3c59 ] On zoned filesystem, data write out is limited by max_zone_append_size, and a large ordered extent is split according the size of a bio. OTOH, the number of extents to be written is calculated using BTRFS_MAX_EXTENT_SIZE, and that estimated number is used to reserve the metadata bytes to update and/or create the metadata items. The metadata reservation is done at e.g, btrfs_buffered_write() and then released according to the estimation changes. Thus, if the number of extent increases massively, the reserved metadata can run out. The increase of the number of extents easily occurs on zoned filesystem if BTRFS_MAX_EXTENT_SIZE > max_zone_append_size. And, it causes the following warning on a small RAM environment with disabling metadata over-commit (in the following patch). [75721.498492] ------------[ cut here ]------------ [75721.505624] BTRFS: block rsv 1 returned -28 [75721.512230] WARNING: CPU: 24 PID: 2327559 at fs/btrfs/block-rsv.c:537 bt= rfs_use_block_rsv+0x560/0x760 [btrfs] [75721.581854] CPU: 24 PID: 2327559 Comm: kworker/u64:10 Kdump: loaded Tain= ted: G W 5.18.0-rc2-BTRFS-ZNS+ #109 [75721.597200] Hardware name: Supermicro Super Server/H12SSL-NT, BIOS 2.0 0= 2/22/2021 [75721.607310] Workqueue: btrfs-endio-write btrfs_work_helper [btrfs] [75721.616209] RIP: 0010:btrfs_use_block_rsv+0x560/0x760 [btrfs] [75721.646649] RSP: 0018:ffffc9000fbdf3e0 EFLAGS: 00010286 [75721.654126] RAX: 0000000000000000 RBX: 0000000000004000 RCX: 00000000000= 00000 [75721.663524] RDX: 0000000000000004 RSI: 0000000000000008 RDI: fffff52001f= 7be6e [75721.672921] RBP: ffffc9000fbdf420 R08: 0000000000000001 R09: ffff889f8d1= fc6c7 [75721.682493] R10: ffffed13f1a3f8d8 R11: 0000000000000001 R12: ffff88980a3= c0e28 [75721.692284] R13: ffff889b66590000 R14: ffff88980a3c0e40 R15: ffff88980a3= c0e8a [75721.701878] FS: 0000000000000000(0000) GS:ffff889f8d000000(0000) knlGS:= 0000000000000000 [75721.712601] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [75721.720726] CR2: 000055d12e05c018 CR3: 0000800193594000 CR4: 00000000003= 50ee0 [75721.730499] Call Trace: [75721.735166] [75721.739886] btrfs_alloc_tree_block+0x1e1/0x1100 [btrfs] [75721.747545] ? btrfs_alloc_logged_file_extent+0x550/0x550 [btrfs] [75721.756145] ? btrfs_get_32+0xea/0x2d0 [btrfs] [75721.762852] ? btrfs_get_32+0xea/0x2d0 [btrfs] [75721.769520] ? push_leaf_left+0x420/0x620 [btrfs] [75721.776431] ? memcpy+0x4e/0x60 [75721.781931] split_leaf+0x433/0x12d0 [btrfs] [75721.788392] ? btrfs_get_token_32+0x580/0x580 [btrfs] [75721.795636] ? push_for_double_split.isra.0+0x420/0x420 [btrfs] [75721.803759] ? leaf_space_used+0x15d/0x1a0 [btrfs] [75721.811156] btrfs_search_slot+0x1bc3/0x2790 [btrfs] [75721.818300] ? lock_downgrade+0x7c0/0x7c0 [75721.824411] ? free_extent_buffer.part.0+0x107/0x200 [btrfs] [75721.832456] ? split_leaf+0x12d0/0x12d0 [btrfs] [75721.839149] ? free_extent_buffer.part.0+0x14f/0x200 [btrfs] [75721.846945] ? free_extent_buffer+0x13/0x20 [btrfs] [75721.853960] ? btrfs_release_path+0x4b/0x190 [btrfs] [75721.861429] btrfs_csum_file_blocks+0x85c/0x1500 [btrfs] [75721.869313] ? rcu_read_lock_sched_held+0x16/0x80 [75721.876085] ? lock_release+0x552/0xf80 [75721.881957] ? btrfs_del_csums+0x8c0/0x8c0 [btrfs] [75721.888886] ? __kasan_check_write+0x14/0x20 [75721.895152] ? do_raw_read_unlock+0x44/0x80 [75721.901323] ? _raw_write_lock_irq+0x60/0x80 [75721.907983] ? btrfs_global_root+0xb9/0xe0 [btrfs] [75721.915166] ? btrfs_csum_root+0x12b/0x180 [btrfs] [75721.921918] ? btrfs_get_global_root+0x820/0x820 [btrfs] [75721.929166] ? _raw_write_unlock+0x23/0x40 [75721.935116] ? unpin_extent_cache+0x1e3/0x390 [btrfs] [75721.942041] btrfs_finish_ordered_io.isra.0+0xa0c/0x1dc0 [btrfs] [75721.949906] ? try_to_wake_up+0x30/0x14a0 [75721.955700] ? btrfs_unlink_subvol+0xda0/0xda0 [btrfs] [75721.962661] ? rcu_read_lock_sched_held+0x16/0x80 [75721.969111] ? lock_acquire+0x41b/0x4c0 [75721.974982] finish_ordered_fn+0x15/0x20 [btrfs] [75721.981639] btrfs_work_helper+0x1af/0xa80 [btrfs] [75721.988184] ? _raw_spin_unlock_irq+0x28/0x50 [75721.994643] process_one_work+0x815/0x1460 [75722.000444] ? pwq_dec_nr_in_flight+0x250/0x250 [75722.006643] ? do_raw_spin_trylock+0xbb/0x190 [75722.013086] worker_thread+0x59a/0xeb0 [75722.018511] kthread+0x2ac/0x360 [75722.023428] ? process_one_work+0x1460/0x1460 [75722.029431] ? kthread_complete_and_exit+0x30/0x30 [75722.036044] ret_from_fork+0x22/0x30 [75722.041255] [75722.045047] irq event stamp: 0 [75722.049703] hardirqs last enabled at (0): [<0000000000000000>] 0x0 [75722.057610] hardirqs last disabled at (0): [] copy_pro= cess+0x1c1a/0x66b0 [75722.067533] softirqs last enabled at (0): [] copy_pro= cess+0x1c59/0x66b0 [75722.077423] softirqs last disabled at (0): [<0000000000000000>] 0x0 [75722.085335] ---[ end trace 0000000000000000 ]--- To fix the estimation, we need to introduce fs_info->max_extent_size to replace BTRFS_MAX_EXTENT_SIZE, which allow setting the different size for regular vs zoned filesystem. Set fs_info->max_extent_size to BTRFS_MAX_EXTENT_SIZE by default. On zoned filesystem, it is set to fs_info->max_zone_append_size. CC: stable@vger.kernel.org # 5.12+ Fixes: d8e3fb106f39 ("btrfs: zoned: use ZONE_APPEND write for zoned mode") Reviewed-by: Johannes Thumshirn Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/ctree.h | 6 ++++++ fs/btrfs/disk-io.c | 2 ++ fs/btrfs/extent_io.c | 4 +++- fs/btrfs/inode.c | 6 ++++-- fs/btrfs/zoned.c | 5 ++++- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 1c377bcfe787..97f5a3d320ff 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1032,6 +1032,12 @@ struct btrfs_fs_info { u32 csums_per_leaf; u32 stripesize; =20 + /* + * Maximum size of an extent. BTRFS_MAX_EXTENT_SIZE on regular + * filesystem, on zoned it depends on the device constraints. + */ + u64 max_extent_size; + /* Block groups and devices containing active swapfiles. */ spinlock_t swapfile_pins_lock; struct rb_root swapfile_pins; diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 34cd57d799e4..bf5c6ac67e87 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3246,6 +3246,8 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info) fs_info->sectorsize_bits =3D ilog2(4096); fs_info->stripesize =3D 4096; =20 + fs_info->max_extent_size =3D BTRFS_MAX_EXTENT_SIZE; + spin_lock_init(&fs_info->swapfile_pins_lock); fs_info->swapfile_pins =3D RB_ROOT; =20 diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 68ddd90685d9..bfc7d5b31156 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -1992,10 +1992,12 @@ noinline_for_stack bool find_lock_delalloc_range(st= ruct inode *inode, struct page *locked_page, u64 *start, u64 *end) { + struct btrfs_fs_info *fs_info =3D btrfs_sb(inode->i_sb); struct extent_io_tree *tree =3D &BTRFS_I(inode)->io_tree; const u64 orig_start =3D *start; const u64 orig_end =3D *end; - u64 max_bytes =3D BTRFS_MAX_EXTENT_SIZE; + /* The sanity tests may not set a valid fs_info. */ + u64 max_bytes =3D fs_info ? fs_info->max_extent_size : BTRFS_MAX_EXTENT_S= IZE; u64 delalloc_start; u64 delalloc_end; bool found; diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 1e404476fe6a..c50288d90c66 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2102,6 +2102,7 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inod= e, struct page *locked_page void btrfs_split_delalloc_extent(struct inode *inode, struct extent_state *orig, u64 split) { + struct btrfs_fs_info *fs_info =3D btrfs_sb(inode->i_sb); u64 size; =20 /* not delalloc, ignore it */ @@ -2109,7 +2110,7 @@ void btrfs_split_delalloc_extent(struct inode *inode, return; =20 size =3D orig->end - orig->start + 1; - if (size > BTRFS_MAX_EXTENT_SIZE) { + if (size > fs_info->max_extent_size) { u32 num_extents; u64 new_size; =20 @@ -2138,6 +2139,7 @@ void btrfs_split_delalloc_extent(struct inode *inode, void btrfs_merge_delalloc_extent(struct inode *inode, struct extent_state = *new, struct extent_state *other) { + struct btrfs_fs_info *fs_info =3D btrfs_sb(inode->i_sb); u64 new_size, old_size; u32 num_extents; =20 @@ -2151,7 +2153,7 @@ void btrfs_merge_delalloc_extent(struct inode *inode,= struct extent_state *new, new_size =3D other->end - new->start + 1; =20 /* we're not bigger than the max, unreserve the space and go */ - if (new_size <=3D BTRFS_MAX_EXTENT_SIZE) { + if (new_size <=3D fs_info->max_extent_size) { spin_lock(&BTRFS_I(inode)->lock); btrfs_mod_outstanding_extents(BTRFS_I(inode), -1); spin_unlock(&BTRFS_I(inode)->lock); diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 1d5b9308f5ef..a0bf2c20fa61 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -731,8 +731,11 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_in= fo) } =20 fs_info->zone_size =3D zone_size; - fs_info->max_zone_append_size =3D max_zone_append_size; + fs_info->max_zone_append_size =3D ALIGN_DOWN(max_zone_append_size, + fs_info->sectorsize); fs_info->fs_devices->chunk_alloc_policy =3D BTRFS_CHUNK_ALLOC_ZONED; + if (fs_info->max_zone_append_size < fs_info->max_extent_size) + fs_info->max_extent_size =3D fs_info->max_zone_append_size; =20 /* * Check mount options here, because we might change fs_info->zoned --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3631DC00140 for ; Mon, 15 Aug 2022 23:32:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353468AbiHOXbp (ORCPT ); Mon, 15 Aug 2022 19:31:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343985AbiHOX0K (ORCPT ); Mon, 15 Aug 2022 19:26:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 685947FE5C; Mon, 15 Aug 2022 13:06:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 04AA86069E; Mon, 15 Aug 2022 20:06:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB8C9C433D6; Mon, 15 Aug 2022 20:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593990; bh=OoFLweGMGU3hs6aXiOhf2CsOVzv7McoV0UwXcZHxGHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q+sDy9HvSIhcil2q8gyBgRI7qul0gwlFoJ7Y5vS/yd3dFHSeaMcJLGuYybdKzCXhK 6DYuTGFxhk+MsVVAela91Wr0CA8JTvUMI7yeTKS40gXpCN4bW1t/K1mlXsOEBNaIB0 wso/UoUNt5gNeF8q315N+XHWKz98ZpKiCp1SSLT4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Thumshirn , Naohiro Aota , David Sterba , Sasha Levin Subject: [PATCH 5.18 1021/1095] btrfs: let can_allocate_chunk return error Date: Mon, 15 Aug 2022 20:07:00 +0200 Message-Id: <20220815180511.327770468@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit bb9950d3df7169a673c594d38fb74e241ed4fb2a ] For the later patch, convert the return type from bool to int and return errors. No functional changes. Reviewed-by: Johannes Thumshirn Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/extent-tree.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index f45ecd939a2c..8bdcbc0c6d60 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3985,12 +3985,12 @@ static void found_extent(struct find_free_extent_ct= l *ffe_ctl, } } =20 -static bool can_allocate_chunk(struct btrfs_fs_info *fs_info, - struct find_free_extent_ctl *ffe_ctl) +static int can_allocate_chunk(struct btrfs_fs_info *fs_info, + struct find_free_extent_ctl *ffe_ctl) { switch (ffe_ctl->policy) { case BTRFS_EXTENT_ALLOC_CLUSTERED: - return true; + return 0; case BTRFS_EXTENT_ALLOC_ZONED: /* * If we have enough free space left in an already @@ -4000,8 +4000,8 @@ static bool can_allocate_chunk(struct btrfs_fs_info *= fs_info, */ if (ffe_ctl->max_extent_size >=3D ffe_ctl->min_alloc_size && !btrfs_can_activate_zone(fs_info->fs_devices, ffe_ctl->flags)) - return false; - return true; + return -ENOSPC; + return 0; default: BUG(); } @@ -4083,8 +4083,9 @@ static int find_free_extent_update_loop(struct btrfs_= fs_info *fs_info, int exist =3D 0; =20 /*Check if allocation policy allows to create a new chunk */ - if (!can_allocate_chunk(fs_info, ffe_ctl)) - return -ENOSPC; + ret =3D can_allocate_chunk(fs_info, ffe_ctl); + if (ret) + return ret; =20 trans =3D current->journal_info; if (trans) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D55BAC00140 for ; Mon, 15 Aug 2022 23:35:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353557AbiHOXfT (ORCPT ); Mon, 15 Aug 2022 19:35:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353479AbiHOX2O (ORCPT ); Mon, 15 Aug 2022 19:28:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 746D914EC87; Mon, 15 Aug 2022 13:07:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 22661B80EAD; Mon, 15 Aug 2022 20:07:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A790C433C1; Mon, 15 Aug 2022 20:07:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594058; bh=gWsxSCTfUMFkP5mLAfYdZw5JsGtOXLYtNCGw75jvoI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nMH1bwBIeBvbUNcdJaiBrDY1Sicgz6nK/tXYk5b5Wc7V2CLVL4inH9ELDvMo9LY11 hCBeJRg5W8jvCZG3CECV0RqZDlTbB7t6eDHTQsxjbg9OREcQirbPwKhFZtYRP2uKIB 2FjhM2aoCvKR9lGbGeHAH3gfEWNU24vQ3cofYC7o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Thumshirn , Naohiro Aota , David Sterba , Sasha Levin Subject: [PATCH 5.18 1022/1095] btrfs: zoned: finish least available block group on data bg allocation Date: Mon, 15 Aug 2022 20:07:01 +0200 Message-Id: <20220815180511.365198396@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit 393f646e34c18b85d0f41272bfcbd475ae3a0d34 ] When we run out of active zones and no sufficient space is left in any block groups, we need to finish one block group to make room to activate a new block group. However, we cannot do this for metadata block groups because we can cause a deadlock by waiting for a running transaction commit. So, do that only for a data block group. Furthermore, the block group to be finished has two requirements. First, the block group must not have reserved bytes left. Having reserved bytes means we have an allocated region but did not yet send bios for it. If that region is allocated by the thread calling btrfs_zone_finish(), it results in a deadlock. Second, the block group to be finished must not be a SYSTEM block group. Finishing a SYSTEM block group easily breaks further chunk allocation by nullifying the SYSTEM free space. In a certain case, we cannot find any zone finish candidate or btrfs_zone_finish() may fail. In that case, we fall back to split the allocation bytes and fill the last spaces left in the block groups. CC: stable@vger.kernel.org # 5.16+ Fixes: afba2bc036b0 ("btrfs: zoned: implement active zone tracking") Reviewed-by: Johannes Thumshirn Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/extent-tree.c | 50 +++++++++++++++++++++++++++++++++--------- fs/btrfs/zoned.c | 40 +++++++++++++++++++++++++++++++++ fs/btrfs/zoned.h | 7 ++++++ 3 files changed, 87 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 8bdcbc0c6d60..bdebd77f31b4 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3985,6 +3985,45 @@ static void found_extent(struct find_free_extent_ctl= *ffe_ctl, } } =20 +static int can_allocate_chunk_zoned(struct btrfs_fs_info *fs_info, + struct find_free_extent_ctl *ffe_ctl) +{ + /* If we can activate new zone, just allocate a chunk and use it */ + if (btrfs_can_activate_zone(fs_info->fs_devices, ffe_ctl->flags)) + return 0; + + /* + * We already reached the max active zones. Try to finish one block + * group to make a room for a new block group. This is only possible + * for a data block group because btrfs_zone_finish() may need to wait + * for a running transaction which can cause a deadlock for metadata + * allocation. + */ + if (ffe_ctl->flags & BTRFS_BLOCK_GROUP_DATA) { + int ret =3D btrfs_zone_finish_one_bg(fs_info); + + if (ret =3D=3D 1) + return 0; + else if (ret < 0) + return ret; + } + + /* + * If we have enough free space left in an already active block group + * and we can't activate any other zone now, do not allow allocating a + * new chunk and let find_free_extent() retry with a smaller size. + */ + if (ffe_ctl->max_extent_size >=3D ffe_ctl->min_alloc_size) + return -ENOSPC; + + /* + * We cannot activate a new block group and no enough space left in any + * block groups. So, allocating a new block group may not help. But, + * there is nothing to do anyway, so let's go with it. + */ + return 0; +} + static int can_allocate_chunk(struct btrfs_fs_info *fs_info, struct find_free_extent_ctl *ffe_ctl) { @@ -3992,16 +4031,7 @@ static int can_allocate_chunk(struct btrfs_fs_info *= fs_info, case BTRFS_EXTENT_ALLOC_CLUSTERED: return 0; case BTRFS_EXTENT_ALLOC_ZONED: - /* - * If we have enough free space left in an already - * active block group and we can't activate any other - * zone now, do not allow allocating a new chunk and - * let find_free_extent() retry with a smaller size. - */ - if (ffe_ctl->max_extent_size >=3D ffe_ctl->min_alloc_size && - !btrfs_can_activate_zone(fs_info->fs_devices, ffe_ctl->flags)) - return -ENOSPC; - return 0; + return can_allocate_chunk_zoned(fs_info, ffe_ctl); default: BUG(); } diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index a0bf2c20fa61..0a6a3d6f5af7 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -2176,3 +2176,43 @@ void btrfs_zoned_release_data_reloc_bg(struct btrfs_= fs_info *fs_info, u64 logica spin_unlock(&block_group->lock); btrfs_put_block_group(block_group); } + +int btrfs_zone_finish_one_bg(struct btrfs_fs_info *fs_info) +{ + struct btrfs_block_group *block_group; + struct btrfs_block_group *min_bg =3D NULL; + u64 min_avail =3D U64_MAX; + int ret; + + spin_lock(&fs_info->zone_active_bgs_lock); + list_for_each_entry(block_group, &fs_info->zone_active_bgs, + active_bg_list) { + u64 avail; + + spin_lock(&block_group->lock); + if (block_group->reserved || + (block_group->flags & BTRFS_BLOCK_GROUP_SYSTEM)) { + spin_unlock(&block_group->lock); + continue; + } + + avail =3D block_group->zone_capacity - block_group->alloc_offset; + if (min_avail > avail) { + if (min_bg) + btrfs_put_block_group(min_bg); + min_bg =3D block_group; + min_avail =3D avail; + btrfs_get_block_group(min_bg); + } + spin_unlock(&block_group->lock); + } + spin_unlock(&fs_info->zone_active_bgs_lock); + + if (!min_bg) + return 0; + + ret =3D btrfs_zone_finish(min_bg); + btrfs_put_block_group(min_bg); + + return ret < 0 ? ret : 1; +} diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h index 2d6da8f4b55a..c424417e19bb 100644 --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -83,6 +83,7 @@ void btrfs_clear_data_reloc_bg(struct btrfs_block_group *= bg); void btrfs_free_zone_cache(struct btrfs_fs_info *fs_info); void btrfs_zoned_release_data_reloc_bg(struct btrfs_fs_info *fs_info, u64 = logical, u64 length); +int btrfs_zone_finish_one_bg(struct btrfs_fs_info *fs_info); #else /* CONFIG_BLK_DEV_ZONED */ static inline int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos, struct blk_zone *zone) @@ -247,6 +248,12 @@ static inline void btrfs_free_zone_cache(struct btrfs_= fs_info *fs_info) { } =20 static inline void btrfs_zoned_release_data_reloc_bg(struct btrfs_fs_info = *fs_info, u64 logical, u64 length) { } + +static inline int btrfs_zone_finish_one_bg(struct btrfs_fs_info *fs_info) +{ + return 1; +} + #endif =20 static inline bool btrfs_dev_is_sequential(struct btrfs_device *device, u6= 4 pos) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDC61C00140 for ; Mon, 15 Aug 2022 23:37:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353601AbiHOXfg (ORCPT ); Mon, 15 Aug 2022 19:35:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346106AbiHOXaT (ORCPT ); Mon, 15 Aug 2022 19:30:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3365FBB939; Mon, 15 Aug 2022 13:08:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 125B5B80EA8; Mon, 15 Aug 2022 20:08:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44273C433D7; Mon, 15 Aug 2022 20:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594080; bh=5n/75u9yLbFTG8wLPL2EQWKA9GGqPhXQKNdg9xemZ4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BXnOuT5KFe0eONja7kHiiV0eSjnpUJjAIK1p3HXtFWi4dt0cWsGn5WnEqSPhjKT3z AlgEUcNhaDKm/jZME0tb4j4FlJUaAAS1T8ZIdSXNcvKK8G4HrJa/azTxeoxaJFkVc1 jadc/TbQn385Xggq8fOqiCVbjn/WHbTCihT/SJdk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , Johannes Thumshirn , David Sterba , Sasha Levin Subject: [PATCH 5.18 1023/1095] btrfs: zoned: disable metadata overcommit for zoned Date: Mon, 15 Aug 2022 20:07:02 +0200 Message-Id: <20220815180511.403729523@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit 79417d040f4f77b19c701bccc23013b9cdac358d ] The metadata overcommit makes the space reservation flexible but it is also harmful to active zone tracking. Since we cannot finish a block group from the metadata allocation context, we might not activate a new block group and might not be able to actually write out the overcommit reservations. So, disable metadata overcommit for zoned filesystems. We will ensure the reservations are under active_total_bytes in the following patches. CC: stable@vger.kernel.org # 5.16+ Fixes: afba2bc036b0 ("btrfs: zoned: implement active zone tracking") Signed-off-by: Naohiro Aota Reviewed-by: Johannes Thumshirn Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/space-info.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index b87931a458eb..56a7c99fc03e 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -340,7 +340,10 @@ int btrfs_can_overcommit(struct btrfs_fs_info *fs_info, return 0; =20 used =3D btrfs_space_info_used(space_info, true); - avail =3D calc_available_free_space(fs_info, space_info, flush); + if (btrfs_is_zoned(fs_info) && (space_info->flags & BTRFS_BLOCK_GROUP_MET= ADATA)) + avail =3D 0; + else + avail =3D calc_available_free_space(fs_info, space_info, flush); =20 if (used + bytes < space_info->total_bytes + avail) return 1; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D947C28B2C for ; Mon, 15 Aug 2022 23:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344958AbiHOX0c (ORCPT ); Mon, 15 Aug 2022 19:26:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347820AbiHOXVp (ORCPT ); Mon, 15 Aug 2022 19:21:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E6D67E334; Mon, 15 Aug 2022 13:04:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2B09A6068D; Mon, 15 Aug 2022 20:04:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20802C433D7; Mon, 15 Aug 2022 20:04:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593889; bh=5ZU6X8oaR8xjXctu3ueiBJ3MhQdIAk1kx0PHsF8cpTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=we3JILC+b5wRUNYU2S/0f7Ut6Xtt3THzhARarDzKLdySSt7O2UABTIYAlJbFWFj9n T1di6mXQZdBUEqBsRzmTs+W04v6IjUmvKrV7RwU3Ac9lFbv7qkDibD0xrH47XYS2HE 58MuQubeWFsfPp3znas049+NOuJNxa/C0Sk2syBw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pankaj Raghav , Josef Bacik , Johannes Thumshirn , David Sterba , Sasha Levin Subject: [PATCH 5.18 1024/1095] btrfs: make the bg_reclaim_threshold per-space info Date: Mon, 15 Aug 2022 20:07:03 +0200 Message-Id: <20220815180511.435577823@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Josef Bacik [ Upstream commit bb5a098d9791f184899499531ff4411089e2a5e0 ] For non-zoned file systems it's useful to have the auto reclaim feature, however there are different use cases for non-zoned, for example we may not want to reclaim metadata chunks ever, only data chunks. Move this sysfs flag to per-space_info. This won't affect current users because this tunable only ever did anything for zoned, and that is currently hidden behind BTRFS_CONFIG_DEBUG. Tested-by: Pankaj Raghav Signed-off-by: Josef Bacik [ jth restore global bg_reclaim_threshold ] Signed-off-by: Johannes Thumshirn Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/free-space-cache.c | 7 +++++-- fs/btrfs/space-info.c | 9 +++++++++ fs/btrfs/space-info.h | 6 ++++++ fs/btrfs/sysfs.c | 37 +++++++++++++++++++++++++++++++++++++ fs/btrfs/zoned.h | 6 +----- 5 files changed, 58 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 01a408db5683..ef84bc5030cd 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -2630,16 +2630,19 @@ int __btrfs_add_free_space(struct btrfs_block_group= *block_group, static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_gr= oup, u64 bytenr, u64 size, bool used) { - struct btrfs_fs_info *fs_info =3D block_group->fs_info; + struct btrfs_space_info *sinfo =3D block_group->space_info; struct btrfs_free_space_ctl *ctl =3D block_group->free_space_ctl; u64 offset =3D bytenr - block_group->start; u64 to_free, to_unusable; - const int bg_reclaim_threshold =3D READ_ONCE(fs_info->bg_reclaim_threshol= d); + int bg_reclaim_threshold =3D 0; bool initial =3D (size =3D=3D block_group->length); u64 reclaimable_unusable; =20 WARN_ON(!initial && offset + size > block_group->zone_capacity); =20 + if (!initial) + bg_reclaim_threshold =3D READ_ONCE(sinfo->bg_reclaim_threshold); + spin_lock(&ctl->tree_lock); if (!used) to_free =3D size; diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 56a7c99fc03e..85608acb9557 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -181,6 +181,12 @@ void btrfs_clear_space_info_full(struct btrfs_fs_info = *info) found->full =3D 0; } =20 +/* + * Block groups with more than this value (percents) of unusable space wil= l be + * scheduled for background reclaim. + */ +#define BTRFS_DEFAULT_ZONED_RECLAIM_THRESH (75) + static int create_space_info(struct btrfs_fs_info *info, u64 flags) { =20 @@ -203,6 +209,9 @@ static int create_space_info(struct btrfs_fs_info *info= , u64 flags) INIT_LIST_HEAD(&space_info->priority_tickets); space_info->clamp =3D 1; =20 + if (btrfs_is_zoned(info)) + space_info->bg_reclaim_threshold =3D BTRFS_DEFAULT_ZONED_RECLAIM_THRESH; + ret =3D btrfs_sysfs_add_space_info_type(info, space_info); if (ret) return ret; diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h index d841fed73492..a803e29bd781 100644 --- a/fs/btrfs/space-info.h +++ b/fs/btrfs/space-info.h @@ -24,6 +24,12 @@ struct btrfs_space_info { the space info if we had an ENOSPC in the allocator. */ =20 + /* + * Once a block group drops below this threshold (percents) we'll + * schedule it for reclaim. + */ + int bg_reclaim_threshold; + int clamp; /* Used to scale our threshold for preemptive flushing. The value is >> clamp, so turns out to be a 2^clamp divisor. */ diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index ba78ca5aabbb..43845cae0c74 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -722,6 +722,42 @@ SPACE_INFO_ATTR(bytes_zone_unusable); SPACE_INFO_ATTR(disk_used); SPACE_INFO_ATTR(disk_total); =20 +static ssize_t btrfs_sinfo_bg_reclaim_threshold_show(struct kobject *kobj, + struct kobj_attribute *a, + char *buf) +{ + struct btrfs_space_info *space_info =3D to_space_info(kobj); + ssize_t ret; + + ret =3D sysfs_emit(buf, "%d\n", READ_ONCE(space_info->bg_reclaim_threshol= d)); + + return ret; +} + +static ssize_t btrfs_sinfo_bg_reclaim_threshold_store(struct kobject *kobj, + struct kobj_attribute *a, + const char *buf, size_t len) +{ + struct btrfs_space_info *space_info =3D to_space_info(kobj); + int thresh; + int ret; + + ret =3D kstrtoint(buf, 10, &thresh); + if (ret) + return ret; + + if (thresh !=3D 0 && (thresh <=3D 50 || thresh > 100)) + return -EINVAL; + + WRITE_ONCE(space_info->bg_reclaim_threshold, thresh); + + return len; +} + +BTRFS_ATTR_RW(space_info, bg_reclaim_threshold, + btrfs_sinfo_bg_reclaim_threshold_show, + btrfs_sinfo_bg_reclaim_threshold_store); + /* * Allocation information about block group types. * @@ -738,6 +774,7 @@ static struct attribute *space_info_attrs[] =3D { BTRFS_ATTR_PTR(space_info, bytes_zone_unusable), BTRFS_ATTR_PTR(space_info, disk_used), BTRFS_ATTR_PTR(space_info, disk_total), + BTRFS_ATTR_PTR(space_info, bg_reclaim_threshold), NULL, }; ATTRIBUTE_GROUPS(space_info); diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h index c424417e19bb..199b69670fa2 100644 --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -10,11 +10,7 @@ #include "block-group.h" #include "btrfs_inode.h" =20 -/* - * Block groups with more than this value (percents) of unusable space wil= l be - * scheduled for background reclaim. - */ -#define BTRFS_DEFAULT_RECLAIM_THRESH 75 +#define BTRFS_DEFAULT_RECLAIM_THRESH (75) =20 struct btrfs_zoned_device_info { /* --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A332C00140 for ; Mon, 15 Aug 2022 23:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345216AbiHOX0m (ORCPT ); Mon, 15 Aug 2022 19:26:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353043AbiHOXVv (ORCPT ); Mon, 15 Aug 2022 19:21:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63391B8A4A; Mon, 15 Aug 2022 13:04:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5E206B80EA8; Mon, 15 Aug 2022 20:04:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B24DC433C1; Mon, 15 Aug 2022 20:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593896; bh=9060AYX/nv6AX4P/LEhYbVTwMkxdy/Fg7Y502/K8E4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u8wPh13OEvMM9/ma9NloniTOEdzVM3+Tc+M6tZT9P5j0KPqJcget8dYCIIA8TTS+j iRPf9CgcuDBVvlxKqz15YhfcC21TyBbDnWt4SetIZlqCYSpuskSWjpNJzRzR7uVPCR Xqi+O/1AODr7CK6WfrG7dFg7RMs5Fd+0+9DsuJ74= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Thumshirn , Naohiro Aota , David Sterba , Sasha Levin Subject: [PATCH 5.18 1025/1095] btrfs: zoned: introduce btrfs_zoned_bg_is_full Date: Mon, 15 Aug 2022 20:07:04 +0200 Message-Id: <20220815180511.473182359@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit 1bfd476754a2d63f899ef9c3e253b17766b8fb73 ] Introduce a wrapper to check if all the space in a block group is allocated or not. Reviewed-by: Johannes Thumshirn Signed-off-by: Naohiro Aota Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/extent-tree.c | 3 +-- fs/btrfs/zoned.c | 2 +- fs/btrfs/zoned.h | 6 ++++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index bdebd77f31b4..56185541e188 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3803,8 +3803,7 @@ static int do_allocation_zoned(struct btrfs_block_gro= up *block_group, =20 /* Check RO and no space case before trying to activate it */ spin_lock(&block_group->lock); - if (block_group->ro || - block_group->alloc_offset =3D=3D block_group->zone_capacity) { + if (block_group->ro || btrfs_zoned_bg_is_full(block_group)) { ret =3D 1; /* * May need to clear fs_info->{treelog,data_reloc}_bg. diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 0a6a3d6f5af7..170681797283 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1859,7 +1859,7 @@ bool btrfs_zone_activate(struct btrfs_block_group *bl= ock_group) } =20 /* No space left */ - if (block_group->alloc_offset =3D=3D block_group->zone_capacity) { + if (btrfs_zoned_bg_is_full(block_group)) { ret =3D false; goto out_unlock; } diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h index 199b69670fa2..0740458894ac 100644 --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -384,4 +384,10 @@ static inline void btrfs_zoned_data_reloc_unlock(struc= t btrfs_inode *inode) mutex_unlock(&root->fs_info->zoned_data_reloc_io_lock); } =20 +static inline bool btrfs_zoned_bg_is_full(const struct btrfs_block_group *= bg) +{ + ASSERT(btrfs_is_zoned(bg->fs_info)); + return (bg->alloc_offset =3D=3D bg->zone_capacity); +} + #endif --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65C9FC2BB45 for ; Mon, 15 Aug 2022 23:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345826AbiHOX0z (ORCPT ); Mon, 15 Aug 2022 19:26:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353243AbiHOXV7 (ORCPT ); Mon, 15 Aug 2022 19:21:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01270B8A71; Mon, 15 Aug 2022 13:05:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 69899B810C5; Mon, 15 Aug 2022 20:05:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBA52C433D6; Mon, 15 Aug 2022 20:05:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593902; bh=EEjmf405LNrMDtwoW4T4dQcTdvYr84kbFyhUwm15N4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FTpxd8M7YeeCNf8iQKHJuH2I1rPr1eMZO+Z2VP0nqz5yUlFRyKoWWeOz0Fc3BwdX5 F3s3PR5SjPFL2Sd6M5MqDDqGxZc2v1zjRMpqhpuPtuHspsyU7OeJHzVN9d2juHTSj7 K6+wmhHxBy6sFZEKszerCFn9CBfqmzjKv51D9hzo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Roesch , David Sterba , Sasha Levin Subject: [PATCH 5.18 1026/1095] btrfs: store chunk size in space-info struct Date: Mon, 15 Aug 2022 20:07:05 +0200 Message-Id: <20220815180511.503866440@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stefan Roesch [ Upstream commit f6fca3917b4d99d8c13901738afec35f570a3c2f ] The chunk size is stored in the btrfs_space_info structure. It is initialized at the start and is then used. A new API is added to update the current chunk size. This API is used to be able to expose the chunk_size as a sysfs setting. Signed-off-by: Stefan Roesch Reviewed-by: David Sterba [ rename and merge helpers, switch atomic type to u64, style fixes ] Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/space-info.c | 32 ++++++++++++++++++++++++++++++++ fs/btrfs/space-info.h | 4 ++++ fs/btrfs/volumes.c | 28 +++++++++------------------- 3 files changed, 45 insertions(+), 19 deletions(-) diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 85608acb9557..98a84b523be6 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -187,6 +187,37 @@ void btrfs_clear_space_info_full(struct btrfs_fs_info = *info) */ #define BTRFS_DEFAULT_ZONED_RECLAIM_THRESH (75) =20 +/* + * Calculate chunk size depending on volume type (regular or zoned). + */ +static u64 calc_chunk_size(const struct btrfs_fs_info *fs_info, u64 flags) +{ + if (btrfs_is_zoned(fs_info)) + return fs_info->zone_size; + + ASSERT(flags & BTRFS_BLOCK_GROUP_TYPE_MASK); + + if (flags & BTRFS_BLOCK_GROUP_DATA) + return SZ_1G; + else if (flags & BTRFS_BLOCK_GROUP_SYSTEM) + return SZ_32M; + + /* Handle BTRFS_BLOCK_GROUP_METADATA */ + if (fs_info->fs_devices->total_rw_bytes > 50ULL * SZ_1G) + return SZ_1G; + + return SZ_256M; +} + +/* + * Update default chunk size. + */ +void btrfs_update_space_info_chunk_size(struct btrfs_space_info *space_inf= o, + u64 chunk_size) +{ + WRITE_ONCE(space_info->chunk_size, chunk_size); +} + static int create_space_info(struct btrfs_fs_info *info, u64 flags) { =20 @@ -208,6 +239,7 @@ static int create_space_info(struct btrfs_fs_info *info= , u64 flags) INIT_LIST_HEAD(&space_info->tickets); INIT_LIST_HEAD(&space_info->priority_tickets); space_info->clamp =3D 1; + btrfs_update_space_info_chunk_size(space_info, calc_chunk_size(info, flag= s)); =20 if (btrfs_is_zoned(info)) space_info->bg_reclaim_threshold =3D BTRFS_DEFAULT_ZONED_RECLAIM_THRESH; diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h index a803e29bd781..137206b8049f 100644 --- a/fs/btrfs/space-info.h +++ b/fs/btrfs/space-info.h @@ -23,6 +23,8 @@ struct btrfs_space_info { u64 max_extent_size; /* This will hold the maximum extent size of the space info if we had an ENOSPC in the allocator. */ + /* Chunk size in bytes */ + u64 chunk_size; =20 /* * Once a block group drops below this threshold (percents) we'll @@ -121,6 +123,8 @@ void btrfs_update_space_info(struct btrfs_fs_info *info= , u64 flags, u64 total_bytes, u64 bytes_used, u64 bytes_readonly, u64 bytes_zone_unusable, struct btrfs_space_info **space_info); +void btrfs_update_space_info_chunk_size(struct btrfs_space_info *space_inf= o, + u64 chunk_size); struct btrfs_space_info *btrfs_find_space_info(struct btrfs_fs_info *info, u64 flags); u64 __pure btrfs_space_info_used(struct btrfs_space_info *s_info, diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 659575526e9f..4bc97e7d8e46 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -5091,26 +5091,16 @@ static void init_alloc_chunk_ctl_policy_regular( struct btrfs_fs_devices *fs_devices, struct alloc_chunk_ctl *ctl) { - u64 type =3D ctl->type; + struct btrfs_space_info *space_info; =20 - if (type & BTRFS_BLOCK_GROUP_DATA) { - ctl->max_stripe_size =3D SZ_1G; - ctl->max_chunk_size =3D BTRFS_MAX_DATA_CHUNK_SIZE; - } else if (type & BTRFS_BLOCK_GROUP_METADATA) { - /* For larger filesystems, use larger metadata chunks */ - if (fs_devices->total_rw_bytes > 50ULL * SZ_1G) - ctl->max_stripe_size =3D SZ_1G; - else - ctl->max_stripe_size =3D SZ_256M; - ctl->max_chunk_size =3D ctl->max_stripe_size; - } else if (type & BTRFS_BLOCK_GROUP_SYSTEM) { - ctl->max_stripe_size =3D SZ_32M; - ctl->max_chunk_size =3D 2 * ctl->max_stripe_size; - ctl->devs_max =3D min_t(int, ctl->devs_max, - BTRFS_MAX_DEVS_SYS_CHUNK); - } else { - BUG(); - } + space_info =3D btrfs_find_space_info(fs_devices->fs_info, ctl->type); + ASSERT(space_info); + + ctl->max_chunk_size =3D READ_ONCE(space_info->chunk_size); + ctl->max_stripe_size =3D ctl->max_chunk_size; + + if (ctl->type & BTRFS_BLOCK_GROUP_SYSTEM) + ctl->devs_max =3D min_t(int, ctl->devs_max, BTRFS_MAX_DEVS_SYS_CHUNK); =20 /* We don't want a chunk larger than 10% of writable space */ ctl->max_chunk_size =3D min(div_factor(fs_devices->total_rw_bytes, 1), --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8580AC2BB9D for ; Mon, 15 Aug 2022 23:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346203AbiHOX1P (ORCPT ); Mon, 15 Aug 2022 19:27:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353346AbiHOXWC (ORCPT ); Mon, 15 Aug 2022 19:22:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B33F014C34A; Mon, 15 Aug 2022 13:05:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 52A2FB81135; Mon, 15 Aug 2022 20:05:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3C5AC433D7; Mon, 15 Aug 2022 20:05:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593908; bh=VpCDzShdxFhdZnxU+YYKI2qg0GUWCXpqqGVdw0mJvoc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pI5VN2DY5/vYCzZMRPBHUVn/EyIW3q9j6tliB/vAzPnPveRGemKqMbJbuTTOYjQ+k 8jhyqzkPRRdLZsYwL/iTM71pSxPOafQUeemRBSztUb23F+g34IWQB3gpDPJFnvSPRY qKmco9NSCQxQ/HJtqm8FoAa8etSdCGm6ZBnaBm5A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , David Sterba , Sasha Levin Subject: [PATCH 5.18 1027/1095] btrfs: zoned: introduce space_info->active_total_bytes Date: Mon, 15 Aug 2022 20:07:06 +0200 Message-Id: <20220815180511.534462522@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit 6a921de589926a350634e6e279f43fa5b9dbf5ba ] The active_total_bytes, like the total_bytes, accounts for the total bytes of active block groups in the space_info. With an introduction of active_total_bytes, we can check if the reserved bytes can be written to the block groups without activating a new block group. The check is necessary for metadata allocation on zoned filesystem. We cannot finish a block group, which may require waiting for the current transaction, from the metadata allocation context. Instead, we need to ensure the ongoing allocation (reserved bytes) fits in active block groups. Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/block-group.c | 12 +++++++++--- fs/btrfs/space-info.c | 41 ++++++++++++++++++++++++++++++++--------- fs/btrfs/space-info.h | 4 +++- fs/btrfs/zoned.c | 6 ++++++ 4 files changed, 50 insertions(+), 13 deletions(-) diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 1deca5164c23..88f59a2e4113 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -1033,8 +1033,13 @@ int btrfs_remove_block_group(struct btrfs_trans_hand= le *trans, < block_group->zone_unusable); WARN_ON(block_group->space_info->disk_total < block_group->length * factor); + WARN_ON(block_group->zone_is_active && + block_group->space_info->active_total_bytes + < block_group->length); } block_group->space_info->total_bytes -=3D block_group->length; + if (block_group->zone_is_active) + block_group->space_info->active_total_bytes -=3D block_group->length; block_group->space_info->bytes_readonly -=3D (block_group->length - block_group->zone_unusable); block_group->space_info->bytes_zone_unusable -=3D @@ -2102,7 +2107,8 @@ static int read_one_block_group(struct btrfs_fs_info = *info, trace_btrfs_add_block_group(info, cache, 0); btrfs_update_space_info(info, cache->flags, cache->length, cache->used, cache->bytes_super, - cache->zone_unusable, &space_info); + cache->zone_unusable, cache->zone_is_active, + &space_info); =20 cache->space_info =3D space_info; =20 @@ -2172,7 +2178,7 @@ static int fill_dummy_bgs(struct btrfs_fs_info *fs_in= fo) } =20 btrfs_update_space_info(fs_info, bg->flags, em->len, em->len, - 0, 0, &space_info); + 0, 0, false, &space_info); bg->space_info =3D space_info; link_block_group(bg); =20 @@ -2553,7 +2559,7 @@ struct btrfs_block_group *btrfs_make_block_group(stru= ct btrfs_trans_handle *tran trace_btrfs_add_block_group(fs_info, cache, 1); btrfs_update_space_info(fs_info, cache->flags, size, bytes_used, cache->bytes_super, cache->zone_unusable, - &cache->space_info); + cache->zone_is_active, &cache->space_info); btrfs_update_global_block_rsv(fs_info); =20 link_block_group(cache); diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 98a84b523be6..4867199cf983 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -295,7 +295,7 @@ int btrfs_init_space_info(struct btrfs_fs_info *fs_info) void btrfs_update_space_info(struct btrfs_fs_info *info, u64 flags, u64 total_bytes, u64 bytes_used, u64 bytes_readonly, u64 bytes_zone_unusable, - struct btrfs_space_info **space_info) + bool active, struct btrfs_space_info **space_info) { struct btrfs_space_info *found; int factor; @@ -306,6 +306,8 @@ void btrfs_update_space_info(struct btrfs_fs_info *info= , u64 flags, ASSERT(found); spin_lock(&found->lock); found->total_bytes +=3D total_bytes; + if (active) + found->active_total_bytes +=3D total_bytes; found->disk_total +=3D total_bytes * factor; found->bytes_used +=3D bytes_used; found->disk_used +=3D bytes_used * factor; @@ -369,6 +371,22 @@ static u64 calc_available_free_space(struct btrfs_fs_i= nfo *fs_info, return avail; } =20 +static inline u64 writable_total_bytes(struct btrfs_fs_info *fs_info, + struct btrfs_space_info *space_info) +{ + /* + * On regular filesystem, all total_bytes are always writable. On zoned + * filesystem, there may be a limitation imposed by max_active_zones. + * For metadata allocation, we cannot finish an existing active block + * group to avoid a deadlock. Thus, we need to consider only the active + * groups to be writable for metadata space. + */ + if (!btrfs_is_zoned(fs_info) || (space_info->flags & BTRFS_BLOCK_GROUP_DA= TA)) + return space_info->total_bytes; + + return space_info->active_total_bytes; +} + int btrfs_can_overcommit(struct btrfs_fs_info *fs_info, struct btrfs_space_info *space_info, u64 bytes, enum btrfs_reserve_flush_enum flush) @@ -386,7 +404,7 @@ int btrfs_can_overcommit(struct btrfs_fs_info *fs_info, else avail =3D calc_available_free_space(fs_info, space_info, flush); =20 - if (used + bytes < space_info->total_bytes + avail) + if (used + bytes < writable_total_bytes(fs_info, space_info) + avail) return 1; return 0; } @@ -422,7 +440,7 @@ void btrfs_try_granting_tickets(struct btrfs_fs_info *f= s_info, ticket =3D list_first_entry(head, struct reserve_ticket, list); =20 /* Check and see if our ticket can be satisfied now. */ - if ((used + ticket->bytes <=3D space_info->total_bytes) || + if ((used + ticket->bytes <=3D writable_total_bytes(fs_info, space_info)= ) || btrfs_can_overcommit(fs_info, space_info, ticket->bytes, flush)) { btrfs_space_info_update_bytes_may_use(fs_info, @@ -753,6 +771,7 @@ btrfs_calc_reclaim_metadata_size(struct btrfs_fs_info *= fs_info, { u64 used; u64 avail; + u64 total; u64 to_reclaim =3D space_info->reclaim_size; =20 lockdep_assert_held(&space_info->lock); @@ -767,8 +786,9 @@ btrfs_calc_reclaim_metadata_size(struct btrfs_fs_info *= fs_info, * space. If that's the case add in our overage so we make sure to put * appropriate pressure on the flushing state machine. */ - if (space_info->total_bytes + avail < used) - to_reclaim +=3D used - (space_info->total_bytes + avail); + total =3D writable_total_bytes(fs_info, space_info); + if (total + avail < used) + to_reclaim +=3D used - (total + avail); =20 return to_reclaim; } @@ -778,9 +798,12 @@ static bool need_preemptive_reclaim(struct btrfs_fs_in= fo *fs_info, { u64 global_rsv_size =3D fs_info->global_block_rsv.reserved; u64 ordered, delalloc; - u64 thresh =3D div_factor_fine(space_info->total_bytes, 90); + u64 total =3D writable_total_bytes(fs_info, space_info); + u64 thresh; u64 used; =20 + thresh =3D div_factor_fine(total, 90); + lockdep_assert_held(&space_info->lock); =20 /* If we're just plain full then async reclaim just slows us down. */ @@ -842,8 +865,8 @@ static bool need_preemptive_reclaim(struct btrfs_fs_inf= o *fs_info, BTRFS_RESERVE_FLUSH_ALL); used =3D space_info->bytes_used + space_info->bytes_reserved + space_info->bytes_readonly + global_rsv_size; - if (used < space_info->total_bytes) - thresh +=3D space_info->total_bytes - used; + if (used < total) + thresh +=3D total - used; thresh >>=3D space_info->clamp; =20 used =3D space_info->bytes_pinned; @@ -1560,7 +1583,7 @@ static int __reserve_bytes(struct btrfs_fs_info *fs_i= nfo, * can_overcommit() to ensure we can overcommit to continue. */ if (!pending_tickets && - ((used + orig_bytes <=3D space_info->total_bytes) || + ((used + orig_bytes <=3D writable_total_bytes(fs_info, space_info)) || btrfs_can_overcommit(fs_info, space_info, orig_bytes, flush))) { btrfs_space_info_update_bytes_may_use(fs_info, space_info, orig_bytes); diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h index 137206b8049f..b8cee27df213 100644 --- a/fs/btrfs/space-info.h +++ b/fs/btrfs/space-info.h @@ -17,6 +17,8 @@ struct btrfs_space_info { u64 bytes_may_use; /* number of bytes that may be used for delalloc/allocations */ u64 bytes_readonly; /* total bytes that are read only */ + /* Total bytes in the space, but only accounts active block groups. */ + u64 active_total_bytes; u64 bytes_zone_unusable; /* total bytes that are unusable until resetting the device zone */ =20 @@ -122,7 +124,7 @@ int btrfs_init_space_info(struct btrfs_fs_info *fs_info= ); void btrfs_update_space_info(struct btrfs_fs_info *info, u64 flags, u64 total_bytes, u64 bytes_used, u64 bytes_readonly, u64 bytes_zone_unusable, - struct btrfs_space_info **space_info); + bool active, struct btrfs_space_info **space_info); void btrfs_update_space_info_chunk_size(struct btrfs_space_info *space_inf= o, u64 chunk_size); struct btrfs_space_info *btrfs_find_space_info(struct btrfs_fs_info *info, diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 170681797283..2ffc6d50d20d 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1841,6 +1841,7 @@ struct btrfs_device *btrfs_zoned_get_device(struct bt= rfs_fs_info *fs_info, bool btrfs_zone_activate(struct btrfs_block_group *block_group) { struct btrfs_fs_info *fs_info =3D block_group->fs_info; + struct btrfs_space_info *space_info =3D block_group->space_info; struct map_lookup *map; struct btrfs_device *device; u64 physical; @@ -1852,6 +1853,7 @@ bool btrfs_zone_activate(struct btrfs_block_group *bl= ock_group) =20 map =3D block_group->physical_map; =20 + spin_lock(&space_info->lock); spin_lock(&block_group->lock); if (block_group->zone_is_active) { ret =3D true; @@ -1880,7 +1882,10 @@ bool btrfs_zone_activate(struct btrfs_block_group *b= lock_group) =20 /* Successfully activated all the zones */ block_group->zone_is_active =3D 1; + space_info->active_total_bytes +=3D block_group->length; spin_unlock(&block_group->lock); + btrfs_try_granting_tickets(fs_info, space_info); + spin_unlock(&space_info->lock); =20 /* For the active block group list */ btrfs_get_block_group(block_group); @@ -1893,6 +1898,7 @@ bool btrfs_zone_activate(struct btrfs_block_group *bl= ock_group) =20 out_unlock: spin_unlock(&block_group->lock); + spin_unlock(&space_info->lock); return ret; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1D0FC28B2B for ; Mon, 15 Aug 2022 23:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245165AbiHOX3L (ORCPT ); Mon, 15 Aug 2022 19:29:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353388AbiHOXWF (ORCPT ); Mon, 15 Aug 2022 19:22:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E6C1D67; Mon, 15 Aug 2022 13:05:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D18896069E; Mon, 15 Aug 2022 20:05:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6F6AC433D6; Mon, 15 Aug 2022 20:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593914; bh=HAit6q//nCXyfWWa9qlHHFJtTuNenQLXeie9SQkaEQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RKszgwVpRT1rofZVgRCp/WrdwrG5pSYNCa8gxTMF+W1o6xgLtWtnTUzR7Rp9WDaZd n3EV8xVzHFrS9Cm+OeMs/thT4JfGJKXs46Z2dHqdmeNX1ZVuDF9xk7n3psDC844bLq MOXdseg3BfDpeH1k5WUtAty9iri3PXctc1G1dkg8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , David Sterba , Sasha Levin Subject: [PATCH 5.18 1028/1095] btrfs: zoned: activate metadata block group on flush_space Date: Mon, 15 Aug 2022 20:07:07 +0200 Message-Id: <20220815180511.572995227@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit b0931513913633044ed6e3800334c28433c007b0 ] For metadata space on zoned filesystem, reaching ALLOC_CHUNK{,_FORCE} means we don't have enough space left in the active_total_bytes. Before allocating a new chunk, we can try to activate an existing block group in this case. Also, allocating a chunk is not enough to grant a ticket for metadata space on zoned filesystem we need to activate the block group to increase the active_total_bytes. btrfs_zoned_activate_one_bg() implements the activation feature. It will activate a block group by (maybe) finishing a block group. It will give up activating a block group if it cannot finish any block group. CC: stable@vger.kernel.org # 5.16+ Fixes: afba2bc036b0 ("btrfs: zoned: implement active zone tracking") Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/space-info.c | 30 ++++++++++++++++++++++++ fs/btrfs/zoned.c | 53 +++++++++++++++++++++++++++++++++++++++++++ fs/btrfs/zoned.h | 10 ++++++++ 3 files changed, 93 insertions(+) diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 4867199cf983..104cbc901c0e 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -9,6 +9,7 @@ #include "ordered-data.h" #include "transaction.h" #include "block-group.h" +#include "zoned.h" =20 /* * HOW DOES SPACE RESERVATION WORK @@ -724,6 +725,18 @@ static void flush_space(struct btrfs_fs_info *fs_info, break; case ALLOC_CHUNK: case ALLOC_CHUNK_FORCE: + /* + * For metadata space on zoned filesystem, reaching here means we + * don't have enough space left in active_total_bytes. Try to + * activate a block group first, because we may have inactive + * block group already allocated. + */ + ret =3D btrfs_zoned_activate_one_bg(fs_info, space_info, false); + if (ret < 0) + break; + else if (ret =3D=3D 1) + break; + trans =3D btrfs_join_transaction(root); if (IS_ERR(trans)) { ret =3D PTR_ERR(trans); @@ -734,6 +747,23 @@ static void flush_space(struct btrfs_fs_info *fs_info, (state =3D=3D ALLOC_CHUNK) ? CHUNK_ALLOC_NO_FORCE : CHUNK_ALLOC_FORCE); btrfs_end_transaction(trans); + + /* + * For metadata space on zoned filesystem, allocating a new chunk + * is not enough. We still need to activate the block * group. + * Active the newly allocated block group by (maybe) finishing + * a block group. + */ + if (ret =3D=3D 1) { + ret =3D btrfs_zoned_activate_one_bg(fs_info, space_info, true); + /* + * Revert to the original ret regardless we could finish + * one block group or not. + */ + if (ret >=3D 0) + ret =3D 1; + } + if (ret > 0 || ret =3D=3D -ENOSPC) ret =3D 0; break; diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 2ffc6d50d20d..0c2d81b0e3d3 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -2222,3 +2222,56 @@ int btrfs_zone_finish_one_bg(struct btrfs_fs_info *f= s_info) =20 return ret < 0 ? ret : 1; } + +int btrfs_zoned_activate_one_bg(struct btrfs_fs_info *fs_info, + struct btrfs_space_info *space_info, + bool do_finish) +{ + struct btrfs_block_group *bg; + int index; + + if (!btrfs_is_zoned(fs_info) || (space_info->flags & BTRFS_BLOCK_GROUP_DA= TA)) + return 0; + + /* No more block groups to activate */ + if (space_info->active_total_bytes =3D=3D space_info->total_bytes) + return 0; + + for (;;) { + int ret; + bool need_finish =3D false; + + down_read(&space_info->groups_sem); + for (index =3D 0; index < BTRFS_NR_RAID_TYPES; index++) { + list_for_each_entry(bg, &space_info->block_groups[index], + list) { + if (!spin_trylock(&bg->lock)) + continue; + if (btrfs_zoned_bg_is_full(bg) || bg->zone_is_active) { + spin_unlock(&bg->lock); + continue; + } + spin_unlock(&bg->lock); + + if (btrfs_zone_activate(bg)) { + up_read(&space_info->groups_sem); + return 1; + } + + need_finish =3D true; + } + } + up_read(&space_info->groups_sem); + + if (!do_finish || !need_finish) + break; + + ret =3D btrfs_zone_finish_one_bg(fs_info); + if (ret =3D=3D 0) + break; + if (ret < 0) + return ret; + } + + return 0; +} diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h index 0740458894ac..1cac32266276 100644 --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -80,6 +80,8 @@ void btrfs_free_zone_cache(struct btrfs_fs_info *fs_info); void btrfs_zoned_release_data_reloc_bg(struct btrfs_fs_info *fs_info, u64 = logical, u64 length); int btrfs_zone_finish_one_bg(struct btrfs_fs_info *fs_info); +int btrfs_zoned_activate_one_bg(struct btrfs_fs_info *fs_info, + struct btrfs_space_info *space_info, bool do_finish); #else /* CONFIG_BLK_DEV_ZONED */ static inline int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos, struct blk_zone *zone) @@ -250,6 +252,14 @@ static inline int btrfs_zone_finish_one_bg(struct btrf= s_fs_info *fs_info) return 1; } =20 +static inline int btrfs_zoned_activate_one_bg(struct btrfs_fs_info *fs_inf= o, + struct btrfs_space_info *space_info, + bool do_finish) +{ + /* Consider all the block groups are active */ + return 0; +} + #endif =20 static inline bool btrfs_dev_is_sequential(struct btrfs_device *device, u6= 4 pos) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19A14C00140 for ; Mon, 15 Aug 2022 23:29:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244861AbiHOX2z (ORCPT ); Mon, 15 Aug 2022 19:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353468AbiHOXWR (ORCPT ); Mon, 15 Aug 2022 19:22:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66EA65D138; Mon, 15 Aug 2022 13:05:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 726FDB80EB1; Mon, 15 Aug 2022 20:05:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCEEFC433D7; Mon, 15 Aug 2022 20:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593923; bh=rfv18tYRRuE5kOUwwHi+YUZvKlCKY5Ad8oTOAlFiY/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gh6hIILyp/wi831+gcCwJuhPxI90blok2KbRAaXi9Y9wDFc5kxi/BJ57O9jPMB51X jsEz2W8u/a1G1zNM33Mih5gzwxlzPDDIa8JaMQCLGO+ZycIuJzQrL4Ghc4tnJLAt0y 5OE4ie0hASZL3FD3JaGS1lHD0mb6Bes/BOVuWc4A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , David Sterba , Sasha Levin Subject: [PATCH 5.18 1029/1095] btrfs: zoned: activate necessary block group Date: Mon, 15 Aug 2022 20:07:08 +0200 Message-Id: <20220815180511.621961976@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit b6a98021e4019c562a23ad151a7e40adfa9f91e5 ] There are two places where allocating a chunk is not enough. These two places are trying to ensure the space by allocating a chunk. To meet the condition for active_total_bytes, we also need to activate a block group there. CC: stable@vger.kernel.org # 5.16+ Fixes: afba2bc036b0 ("btrfs: zoned: implement active zone tracking") Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/block-group.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 88f59a2e4113..0c7fe3142d7c 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -2659,6 +2659,14 @@ int btrfs_inc_block_group_ro(struct btrfs_block_grou= p *cache, ret =3D btrfs_chunk_alloc(trans, alloc_flags, CHUNK_ALLOC_FORCE); if (ret < 0) goto out; + /* + * We have allocated a new chunk. We also need to activate that chunk to + * grant metadata tickets for zoned filesystem. + */ + ret =3D btrfs_zoned_activate_one_bg(fs_info, cache->space_info, true); + if (ret < 0) + goto out; + ret =3D inc_block_group_ro(cache, 0); if (ret =3D=3D -ETXTBSY) goto unlock_out; @@ -3853,6 +3861,14 @@ static void reserve_chunk_space(struct btrfs_trans_h= andle *trans, if (IS_ERR(bg)) { ret =3D PTR_ERR(bg); } else { + /* + * We have a new chunk. We also need to activate it for + * zoned filesystem. + */ + ret =3D btrfs_zoned_activate_one_bg(fs_info, info, true); + if (ret < 0) + return; + /* * If we fail to add the chunk item here, we end up * trying again at phase 2 of chunk allocation, at --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39D19C25B0D for ; Mon, 15 Aug 2022 23:29:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343725AbiHOX30 (ORCPT ); Mon, 15 Aug 2022 19:29:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243106AbiHOXW5 (ORCPT ); Mon, 15 Aug 2022 19:22:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A5716BD5B; Mon, 15 Aug 2022 13:05:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 84486B80EAB; Mon, 15 Aug 2022 20:05:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9F50C433D6; Mon, 15 Aug 2022 20:05:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593929; bh=/MzQJ5n7+F1uV7sadg9ptua/nEpjYv7/PHCeA+5hmCA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A6+p9EvamKd+vUXSes+GSebPLNWlfSc3S7VARueU/F3JoR6k6s2uzLmB6U0Fbomwz 0v2rSIj2i4U3w7QK3YxqwGRkVlDhuQUqe40hNyBoFgP3GDfTy29QCQ0xMYsUE2RnPp lWLtnSNlm8GtXSwGgZlIK+Y/Wi4Dr5dx90d3Ldv4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , David Sterba , Sasha Levin Subject: [PATCH 5.18 1030/1095] btrfs: zoned: write out partially allocated region Date: Mon, 15 Aug 2022 20:07:09 +0200 Message-Id: <20220815180511.664298207@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit 898793d992c23dac6126a6a94ad893eae1a2c9df ] cow_file_range() works in an all-or-nothing way: if it fails to allocate an extent for a part of the given region, it gives up all the region including the successfully allocated parts. On cow_file_range(), run_delalloc_zoned() writes data for the region only when it successfully allocate all the region. This all-or-nothing allocation and write-out are problematic when available space in all the block groups are get tight with the active zone restriction. btrfs_reserve_extent() try hard to utilize the left space in the active block groups and gives up finally and fails with -ENOSPC. However, if we send IOs for the successfully allocated region, we can finish a zone and can continue on the rest of the allocation on a newly allocated block group. This patch implements the partial write-out for run_delalloc_zoned(). With this patch applied, cow_file_range() returns -EAGAIN to tell the caller to do something to progress the further allocation, and tells the successfully allocated region with done_offset. Furthermore, the zoned extent allocator returns -EAGAIN to tell cow_file_range() going back to the caller side. Actually, we still need to wait for an IO to complete to continue the allocation. The next patch implements that part. CC: stable@vger.kernel.org # 5.16+ Fixes: afba2bc036b0 ("btrfs: zoned: implement active zone tracking") Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/extent-tree.c | 10 +++++++ fs/btrfs/inode.c | 63 ++++++++++++++++++++++++++++++++---------- 2 files changed, 59 insertions(+), 14 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 56185541e188..eee68a6f2be7 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -4015,6 +4015,16 @@ static int can_allocate_chunk_zoned(struct btrfs_fs_= info *fs_info, if (ffe_ctl->max_extent_size >=3D ffe_ctl->min_alloc_size) return -ENOSPC; =20 + /* + * Even min_alloc_size is not left in any block groups. Since we cannot + * activate a new block group, allocating it may not help. Let's tell a + * caller to try again and hope it progress something by writing some + * parts of the region. That is only possible for data block groups, + * where a part of the region can be written. + */ + if (ffe_ctl->flags & BTRFS_BLOCK_GROUP_DATA) + return -EAGAIN; + /* * We cannot activate a new block group and no enough space left in any * block groups. So, allocating a new block group may not help. But, diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c50288d90c66..9753fc47e488 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -92,7 +92,8 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_e= xtent *ordered_extent); static noinline int cow_file_range(struct btrfs_inode *inode, struct page *locked_page, u64 start, u64 end, int *page_started, - unsigned long *nr_written, int unlock); + unsigned long *nr_written, int unlock, + u64 *done_offset); static struct extent_map *create_io_em(struct btrfs_inode *inode, u64 star= t, u64 len, u64 orig_start, u64 block_start, u64 block_len, u64 orig_block_len, @@ -884,7 +885,7 @@ static int submit_uncompressed_range(struct btrfs_inode= *inode, * can directly submit them without interruption. */ ret =3D cow_file_range(inode, locked_page, start, end, &page_started, - &nr_written, 0); + &nr_written, 0, NULL); /* Inline extent inserted, page gets unlocked and everything is done */ if (page_started) { ret =3D 0; @@ -1133,7 +1134,8 @@ static u64 get_extent_allocation_hint(struct btrfs_in= ode *inode, u64 start, static noinline int cow_file_range(struct btrfs_inode *inode, struct page *locked_page, u64 start, u64 end, int *page_started, - unsigned long *nr_written, int unlock) + unsigned long *nr_written, int unlock, + u64 *done_offset) { struct btrfs_root *root =3D inode->root; struct btrfs_fs_info *fs_info =3D root->fs_info; @@ -1326,6 +1328,21 @@ static noinline int cow_file_range(struct btrfs_inod= e *inode, btrfs_dec_block_group_reservations(fs_info, ins.objectid); btrfs_free_reserved_extent(fs_info, ins.objectid, ins.offset, 1); out_unlock: + /* + * If done_offset is non-NULL and ret =3D=3D -EAGAIN, we expect the + * caller to write out the successfully allocated region and retry. + */ + if (done_offset && ret =3D=3D -EAGAIN) { + if (orig_start < start) + *done_offset =3D start - 1; + else + *done_offset =3D start; + return ret; + } else if (ret =3D=3D -EAGAIN) { + /* Convert to -ENOSPC since the caller cannot retry. */ + ret =3D -ENOSPC; + } + /* * Now, we have three regions to clean up: * @@ -1571,19 +1588,37 @@ static noinline int run_delalloc_zoned(struct btrfs= _inode *inode, u64 end, int *page_started, unsigned long *nr_written) { + u64 done_offset =3D end; int ret; + bool locked_page_done =3D false; =20 - ret =3D cow_file_range(inode, locked_page, start, end, page_started, - nr_written, 0); - if (ret) - return ret; + while (start <=3D end) { + ret =3D cow_file_range(inode, locked_page, start, end, page_started, + nr_written, 0, &done_offset); + if (ret && ret !=3D -EAGAIN) + return ret; =20 - if (*page_started) - return 0; + if (*page_started) { + ASSERT(ret =3D=3D 0); + return 0; + } + + if (ret =3D=3D 0) + done_offset =3D end; + + if (done_offset =3D=3D start) + return -ENOSPC; + + if (!locked_page_done) { + __set_page_dirty_nobuffers(locked_page); + account_page_redirty(locked_page); + } + locked_page_done =3D true; + extent_write_locked_range(&inode->vfs_inode, start, done_offset); + + start =3D done_offset + 1; + } =20 - __set_page_dirty_nobuffers(locked_page); - account_page_redirty(locked_page); - extent_write_locked_range(&inode->vfs_inode, start, end); *page_started =3D 1; =20 return 0; @@ -1675,7 +1710,7 @@ static int fallback_to_cow(struct btrfs_inode *inode,= struct page *locked_page, } =20 return cow_file_range(inode, locked_page, start, end, page_started, - nr_written, 1); + nr_written, 1, NULL); } =20 /* @@ -2086,7 +2121,7 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inod= e, struct page *locked_page page_started, nr_written); else ret =3D cow_file_range(inode, locked_page, start, end, - page_started, nr_written, 1); + page_started, nr_written, 1, NULL); } else { set_bit(BTRFS_INODE_HAS_ASYNC_EXTENT, &inode->runtime_flags); ret =3D cow_file_range_async(inode, wbc, locked_page, start, end, --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CFC8C00140 for ; Mon, 15 Aug 2022 23:29:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344903AbiHOX3w (ORCPT ); Mon, 15 Aug 2022 19:29:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243449AbiHOXXW (ORCPT ); Mon, 15 Aug 2022 19:23:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D429760E1; Mon, 15 Aug 2022 13:05:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B4E2160A09; Mon, 15 Aug 2022 20:05:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2606C433D6; Mon, 15 Aug 2022 20:05:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593935; bh=bTsCd9Icqv/0YCZZqzLOPav4xkPiWJdkMSgwWN2iyyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wxknUGqeKsRZAV8kJenlW21RgFJ0uOXLZJ/THC+RCCg0f3aF79d6dIZrDQQWM488U jTTClOw05Cf0csdWBVEZ0PMuVlxsbvHJ/LbrNJHIAcqfWEn+/scyjE70yJw27Ppp4X GGdnJn4MgN3aTS9Bg2R1sRvN9hlK3uQ/StqCMfeY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , David Sterba , Sasha Levin Subject: [PATCH 5.18 1031/1095] btrfs: zoned: wait until zone is finished when allocation didnt progress Date: Mon, 15 Aug 2022 20:07:10 +0200 Message-Id: <20220815180511.711054007@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit 2ce543f478433a0eec0f72090d7e814f1d53d456 ] When the allocated position doesn't progress, we cannot submit IOs to finish a block group, but there should be ongoing IOs that will finish a block group. So, in that case, we wait for a zone to be finished and retry the allocation after that. Introduce a new flag BTRFS_FS_NEED_ZONE_FINISH for fs_info->flags to indicate we need a zone finish to have proceeded. The flag is set when the allocator detected it cannot activate a new block group. And, it is cleared once a zone is finished. CC: stable@vger.kernel.org # 5.16+ Fixes: afba2bc036b0 ("btrfs: zoned: implement active zone tracking") Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/ctree.h | 5 +++++ fs/btrfs/disk-io.c | 1 + fs/btrfs/inode.c | 9 +++++++-- fs/btrfs/zoned.c | 6 ++++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 97f5a3d320ff..76fbe4cf2a28 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -635,6 +635,9 @@ enum { /* Indicate we have half completed snapshot deletions pending. */ BTRFS_FS_UNFINISHED_DROPS, =20 + /* Indicate we have to finish a zone to do next allocation. */ + BTRFS_FS_NEED_ZONE_FINISH, + #if BITS_PER_LONG =3D=3D 32 /* Indicate if we have error/warn message printed on 32bit systems */ BTRFS_FS_32BIT_ERROR, @@ -1074,6 +1077,8 @@ struct btrfs_fs_info { =20 spinlock_t zone_active_bgs_lock; struct list_head zone_active_bgs; + /* Waiters when BTRFS_FS_NEED_ZONE_FINISH is set */ + wait_queue_head_t zone_finish_wait; =20 #ifdef CONFIG_BTRFS_FS_REF_VERIFY spinlock_t ref_verify_lock; diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index bf5c6ac67e87..59fa7bf3a2e5 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3239,6 +3239,7 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info) init_waitqueue_head(&fs_info->transaction_blocked_wait); init_waitqueue_head(&fs_info->async_submit_wait); init_waitqueue_head(&fs_info->delayed_iputs_wait); + init_waitqueue_head(&fs_info->zone_finish_wait); =20 /* Usable values until the real ones are cached from the superblock */ fs_info->nodesize =3D 4096; diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 9753fc47e488..64d310ecbb84 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1606,8 +1606,13 @@ static noinline int run_delalloc_zoned(struct btrfs_= inode *inode, if (ret =3D=3D 0) done_offset =3D end; =20 - if (done_offset =3D=3D start) - return -ENOSPC; + if (done_offset =3D=3D start) { + struct btrfs_fs_info *info =3D inode->root->fs_info; + + wait_var_event(&info->zone_finish_wait, + !test_bit(BTRFS_FS_NEED_ZONE_FINISH, &info->flags)); + continue; + } =20 if (!locked_page_done) { __set_page_dirty_nobuffers(locked_page); diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 0c2d81b0e3d3..45e29b8c705c 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1993,6 +1993,9 @@ int btrfs_zone_finish(struct btrfs_block_group *block= _group) /* For active_bg_list */ btrfs_put_block_group(block_group); =20 + clear_bit(BTRFS_FS_NEED_ZONE_FINISH, &fs_info->flags); + wake_up_all(&fs_info->zone_finish_wait); + return 0; } =20 @@ -2021,6 +2024,9 @@ bool btrfs_can_activate_zone(struct btrfs_fs_devices = *fs_devices, u64 flags) } mutex_unlock(&fs_info->chunk_mutex); =20 + if (!ret) + set_bit(BTRFS_FS_NEED_ZONE_FINISH, &fs_info->flags); + return ret; } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F9CDC00140 for ; Mon, 15 Aug 2022 23:30:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345105AbiHOXaK (ORCPT ); Mon, 15 Aug 2022 19:30:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244724AbiHOXYS (ORCPT ); Mon, 15 Aug 2022 19:24:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 512FB83F0A; Mon, 15 Aug 2022 13:05:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 112E0B80EA8; Mon, 15 Aug 2022 20:05:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7436DC433D7; Mon, 15 Aug 2022 20:05:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593940; bh=U8UoyS0+Bri2GFi3RY7EKgWLY6hzotOmbRvxg6553RQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TEB+8cfYZz3AsflU7MamORMyqjwMu4kwh1lJ5iDfYzakSj+fx43O/TFReSkRT4vMi 31p4b7B/MAIuPBbD9jsGekrxgk0LXg/l5ZEh4Qu1rjRp/Utryre17pXRDS7Q7c7dPO dxpE4Wc6wYe+aC3ZCqDdezrbbgFDsh8J3SI0OcX0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Rui , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 1032/1095] intel_idle: Add AlderLake support Date: Mon, 15 Aug 2022 20:07:11 +0200 Message-Id: <20220815180511.754732096@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhang Rui [ Upstream commit d1cf8bbfed1edc5108220342ab39e4544d55fbc3 ] Similar to SPR, the C1 and C1E states on ADL are mutually exclusive. Only one of them can be enabled at a time. But contrast to SPR, which usually has a strong latency requirement as a Xeon processor, C1E is preferred on ADL for better energy efficiency. Add custom C-state tables for ADL with both C1 and C1E, and 1. Enable the "C1E promotion" bit in MSR_IA32_POWER_CTL and mark C1 with the CPUIDLE_FLAG_UNUSABLE flag, so C1 is not available by default. 2. Add support for the "preferred_cstates" module parameter, so that users can choose to use C1 instead of C1E by booting with "intel_idle.preferred_cstates=3D2". Separate custom C-state tables are introduced for the ADL mobile and desktop processors, because of the exit latency differences between these two variants, especially with respect to PC10. Signed-off-by: Zhang Rui [ rjw: Changelog edits, code rearrangement ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/idle/intel_idle.c | 133 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index 47b68c6071be..907700d1e78e 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c @@ -811,6 +811,106 @@ static struct cpuidle_state icx_cstates[] __initdata = =3D { .enter =3D NULL } }; =20 +/* + * On AlderLake C1 has to be disabled if C1E is enabled, and vice versa. + * C1E is enabled only if "C1E promotion" bit is set in MSR_IA32_POWER_CTL. + * But in this case there is effectively no C1, because C1 requests are + * promoted to C1E. If the "C1E promotion" bit is cleared, then both C1 + * and C1E requests end up with C1, so there is effectively no C1E. + * + * By default we enable C1E and disable C1 by marking it with + * 'CPUIDLE_FLAG_UNUSABLE'. + */ +static struct cpuidle_state adl_cstates[] __initdata =3D { + { + .name =3D "C1", + .desc =3D "MWAIT 0x00", + .flags =3D MWAIT2flg(0x00) | CPUIDLE_FLAG_UNUSABLE, + .exit_latency =3D 1, + .target_residency =3D 1, + .enter =3D &intel_idle, + .enter_s2idle =3D intel_idle_s2idle, }, + { + .name =3D "C1E", + .desc =3D "MWAIT 0x01", + .flags =3D MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, + .exit_latency =3D 2, + .target_residency =3D 4, + .enter =3D &intel_idle, + .enter_s2idle =3D intel_idle_s2idle, }, + { + .name =3D "C6", + .desc =3D "MWAIT 0x20", + .flags =3D MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, + .exit_latency =3D 220, + .target_residency =3D 600, + .enter =3D &intel_idle, + .enter_s2idle =3D intel_idle_s2idle, }, + { + .name =3D "C8", + .desc =3D "MWAIT 0x40", + .flags =3D MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED, + .exit_latency =3D 280, + .target_residency =3D 800, + .enter =3D &intel_idle, + .enter_s2idle =3D intel_idle_s2idle, }, + { + .name =3D "C10", + .desc =3D "MWAIT 0x60", + .flags =3D MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED, + .exit_latency =3D 680, + .target_residency =3D 2000, + .enter =3D &intel_idle, + .enter_s2idle =3D intel_idle_s2idle, }, + { + .enter =3D NULL } +}; + +static struct cpuidle_state adl_l_cstates[] __initdata =3D { + { + .name =3D "C1", + .desc =3D "MWAIT 0x00", + .flags =3D MWAIT2flg(0x00) | CPUIDLE_FLAG_UNUSABLE, + .exit_latency =3D 1, + .target_residency =3D 1, + .enter =3D &intel_idle, + .enter_s2idle =3D intel_idle_s2idle, }, + { + .name =3D "C1E", + .desc =3D "MWAIT 0x01", + .flags =3D MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, + .exit_latency =3D 2, + .target_residency =3D 4, + .enter =3D &intel_idle, + .enter_s2idle =3D intel_idle_s2idle, }, + { + .name =3D "C6", + .desc =3D "MWAIT 0x20", + .flags =3D MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, + .exit_latency =3D 170, + .target_residency =3D 500, + .enter =3D &intel_idle, + .enter_s2idle =3D intel_idle_s2idle, }, + { + .name =3D "C8", + .desc =3D "MWAIT 0x40", + .flags =3D MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED, + .exit_latency =3D 200, + .target_residency =3D 600, + .enter =3D &intel_idle, + .enter_s2idle =3D intel_idle_s2idle, }, + { + .name =3D "C10", + .desc =3D "MWAIT 0x60", + .flags =3D MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED, + .exit_latency =3D 230, + .target_residency =3D 700, + .enter =3D &intel_idle, + .enter_s2idle =3D intel_idle_s2idle, }, + { + .enter =3D NULL } +}; + /* * On Sapphire Rapids Xeon C1 has to be disabled if C1E is enabled, and vi= ce * versa. On SPR C1E is enabled only if "C1E promotion" bit is set in @@ -1194,6 +1294,14 @@ static const struct idle_cpu idle_cpu_icx __initcons= t =3D { .use_acpi =3D true, }; =20 +static const struct idle_cpu idle_cpu_adl __initconst =3D { + .state_table =3D adl_cstates, +}; + +static const struct idle_cpu idle_cpu_adl_l __initconst =3D { + .state_table =3D adl_l_cstates, +}; + static const struct idle_cpu idle_cpu_spr __initconst =3D { .state_table =3D spr_cstates, .disable_promotion_to_c1e =3D true, @@ -1262,6 +1370,8 @@ static const struct x86_cpu_id intel_idle_ids[] __ini= tconst =3D { X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_X, &idle_cpu_skx), X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X, &idle_cpu_icx), X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_D, &idle_cpu_icx), + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, &idle_cpu_adl), + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, &idle_cpu_adl_l), X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &idle_cpu_spr), X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNL, &idle_cpu_knl), X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNM, &idle_cpu_knl), @@ -1620,6 +1730,25 @@ static void __init skx_idle_state_table_update(void) } } =20 +/** + * adl_idle_state_table_update - Adjust AlderLake idle states table. + */ +static void __init adl_idle_state_table_update(void) +{ + /* Check if user prefers C1 over C1E. */ + if (preferred_states_mask & BIT(1) && !(preferred_states_mask & BIT(2))) { + cpuidle_state_table[0].flags &=3D ~CPUIDLE_FLAG_UNUSABLE; + cpuidle_state_table[1].flags |=3D CPUIDLE_FLAG_UNUSABLE; + + /* Disable C1E by clearing the "C1E promotion" bit. */ + c1e_promotion =3D C1E_PROMOTION_DISABLE; + return; + } + + /* Make sure C1E is enabled by default */ + c1e_promotion =3D C1E_PROMOTION_ENABLE; +} + /** * spr_idle_state_table_update - Adjust Sapphire Rapids idle states table. */ @@ -1689,6 +1818,10 @@ static void __init intel_idle_init_cstates_icpu(stru= ct cpuidle_driver *drv) case INTEL_FAM6_SAPPHIRERAPIDS_X: spr_idle_state_table_update(); break; + case INTEL_FAM6_ALDERLAKE: + case INTEL_FAM6_ALDERLAKE_L: + adl_idle_state_table_update(); + break; } =20 for (cstate =3D 0; cstate < CPUIDLE_STATE_MAX; ++cstate) { --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17586C00140 for ; Mon, 15 Aug 2022 23:30:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345979AbiHOXaR (ORCPT ); Mon, 15 Aug 2022 19:30:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244637AbiHOXYP (ORCPT ); Mon, 15 Aug 2022 19:24:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AD7F876B6; Mon, 15 Aug 2022 13:05:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DDA2B6068D; Mon, 15 Aug 2022 20:05:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D03EAC433D6; Mon, 15 Aug 2022 20:05:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593947; bh=kcuCtULqp2kPi5vMU4qtw7Ki1COObkUW6h4KdKchGMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z3tSE//f4wVND0u8N9564HmSFHTwpmPtj/AS6191Eb732JJwYk83QBLtKfHQqXFaQ yQQlcK5Nvam3ho9xou4lISKcz7sfvUo72iJoXhD7qq639NCb84ogQBRm12OO0CaD6C DGfLBL4AxPa0SBggoB2Dh59+qCkDcr8fAAiULqnw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Artem Bityutskiy , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 1033/1095] intel_idle: make SPR C1 and C1E be independent Date: Mon, 15 Aug 2022 20:07:12 +0200 Message-Id: <20220815180511.794102365@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Artem Bityutskiy [ Upstream commit 1548fac47a114b42063def551eb152a536ed9697 ] This patch partially reverts the changes made by the following commit: da0e58c038e6 intel_idle: add 'preferred_cstates' module argument As that commit describes, on early Sapphire Rapids Xeon platforms the C1 and C1E states were mutually exclusive, so that users could only have either C1= and C6, or C1E and C6. However, Intel firmware engineers managed to remove this limitation and mak= e C1 and C1E to be completely independent, just like on previous Xeon platforms. Therefore, this patch: * Removes commentary describing the old, and now non-existing SPR C1E limitation. * Marks SPR C1E as available by default. * Removes the 'preferred_cstates' parameter handling for SPR. Both C1 and C1E will be available regardless of 'preferred_cstates' value. We expect that all SPR systems are shipping with new firmware, which includ= es the C1/C1E improvement. Cc: v5.18+ # v5.18+ Signed-off-by: Artem Bityutskiy Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/idle/intel_idle.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index 907700d1e78e..9515a3146dc9 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c @@ -911,16 +911,6 @@ static struct cpuidle_state adl_l_cstates[] __initdata= =3D { .enter =3D NULL } }; =20 -/* - * On Sapphire Rapids Xeon C1 has to be disabled if C1E is enabled, and vi= ce - * versa. On SPR C1E is enabled only if "C1E promotion" bit is set in - * MSR_IA32_POWER_CTL. But in this case there effectively no C1, because C1 - * requests are promoted to C1E. If the "C1E promotion" bit is cleared, th= en - * both C1 and C1E requests end up with C1, so there is effectively no C1E. - * - * By default we enable C1 and disable C1E by marking it with - * 'CPUIDLE_FLAG_UNUSABLE'. - */ static struct cpuidle_state spr_cstates[] __initdata =3D { { .name =3D "C1", @@ -933,8 +923,7 @@ static struct cpuidle_state spr_cstates[] __initdata = =3D { { .name =3D "C1E", .desc =3D "MWAIT 0x01", - .flags =3D MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE | - CPUIDLE_FLAG_UNUSABLE, + .flags =3D MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE, .exit_latency =3D 2, .target_residency =3D 4, .enter =3D &intel_idle, @@ -1756,17 +1745,6 @@ static void __init spr_idle_state_table_update(void) { unsigned long long msr; =20 - /* Check if user prefers C1E over C1. */ - if ((preferred_states_mask & BIT(2)) && - !(preferred_states_mask & BIT(1))) { - /* Disable C1 and enable C1E. */ - spr_cstates[0].flags |=3D CPUIDLE_FLAG_UNUSABLE; - spr_cstates[1].flags &=3D ~CPUIDLE_FLAG_UNUSABLE; - - /* Enable C1E using the "C1E promotion" bit. */ - c1e_promotion =3D C1E_PROMOTION_ENABLE; - } - /* * By default, the C6 state assumes the worst-case scenario of package * C6. However, if PC6 is disabled, we update the numbers to match --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56D07C3F6B0 for ; Mon, 15 Aug 2022 23:32:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347057AbiHOXbF (ORCPT ); Mon, 15 Aug 2022 19:31:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242854AbiHOXZ0 (ORCPT ); Mon, 15 Aug 2022 19:25:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC43C14C376; Mon, 15 Aug 2022 13:05:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7EFA2B80EAB; Mon, 15 Aug 2022 20:05:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3947C433C1; Mon, 15 Aug 2022 20:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593956; bh=lEN1fCLC/6iKvx1k5nKAURL3pxUzJBCCafkLf8DB6jY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gEdGA1wukE2NIGPL7JM6e3SN+pobzmKv5q+nIMm4RjvWZY9zJlsy75bYLWuoGVCuR PLAXvoMc9lm0mRE2RhYFfi2V39Qn2h4imL0WofMUl9y9Zc1O003Z/qrhxaIWCxT2jl Il2hK/36GF6z9bJnTcoazgTAQZi+L2eSPHr80QeE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 1034/1095] ACPI: CPPC: Do not prevent CPPC from working in the future Date: Mon, 15 Aug 2022 20:07:13 +0200 Message-Id: <20220815180511.845105655@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki [ Upstream commit 4f4179fcf420873002035cf1941d844c9e0e7cb3 ] There is a problem with the current revision checks in is_cppc_supported() that they essentially prevent the CPPC support from working if a new _CPC package format revision being a proper superset of the v3 and only causing _CPC to return a package with more entries (while retaining the types and meaning of the entries defined by the v3) is introduced in the future and used by the platform firmware. In that case, as long as the number of entries in the _CPC return package is at least CPPC_V3_NUM_ENT, it should be perfectly fine to use the v3 support code and disregard the additional package entries added by the new package format revision. For this reason, drop is_cppc_supported() altogether, put the revision checks directly into acpi_cppc_processor_probe() so they are easier to follow and rework them to take the case mentioned above into account. Fixes: 4773e77cdc9b ("ACPI / CPPC: Add support for CPPC v3") Cc: 4.18+ # 4.18+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/acpi/cppc_acpi.c | 54 ++++++++++++++++++---------------------- include/acpi/cppc_acpi.h | 2 +- 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index b8e26b6b5523..35d894674eba 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -600,33 +600,6 @@ static int pcc_data_alloc(int pcc_ss_id) return 0; } =20 -/* Check if CPPC revision + num_ent combination is supported */ -static bool is_cppc_supported(int revision, int num_ent) -{ - int expected_num_ent; - - switch (revision) { - case CPPC_V2_REV: - expected_num_ent =3D CPPC_V2_NUM_ENT; - break; - case CPPC_V3_REV: - expected_num_ent =3D CPPC_V3_NUM_ENT; - break; - default: - pr_debug("Firmware exports unsupported CPPC revision: %d\n", - revision); - return false; - } - - if (expected_num_ent !=3D num_ent) { - pr_debug("Firmware exports %d entries. Expected: %d for CPPC rev:%d\n", - num_ent, expected_num_ent, revision); - return false; - } - - return true; -} - /* * An example CPC table looks like the following. * @@ -715,7 +688,6 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) cpc_obj->type, pr->id); goto out_free; } - cpc_ptr->num_entries =3D num_ent; =20 /* Second entry should be revision. */ cpc_obj =3D &out_obj->package.elements[1]; @@ -726,10 +698,32 @@ int acpi_cppc_processor_probe(struct acpi_processor *= pr) cpc_obj->type, pr->id); goto out_free; } - cpc_ptr->version =3D cpc_rev; =20 - if (!is_cppc_supported(cpc_rev, num_ent)) + if (cpc_rev < CPPC_V2_REV) { + pr_debug("Unsupported _CPC Revision (%d) for CPU:%d\n", cpc_rev, + pr->id); + goto out_free; + } + + /* + * Disregard _CPC if the number of entries in the return pachage is not + * as expected, but support future revisions being proper supersets of + * the v3 and only causing more entries to be returned by _CPC. + */ + if ((cpc_rev =3D=3D CPPC_V2_REV && num_ent !=3D CPPC_V2_NUM_ENT) || + (cpc_rev =3D=3D CPPC_V3_REV && num_ent !=3D CPPC_V3_NUM_ENT) || + (cpc_rev > CPPC_V3_REV && num_ent <=3D CPPC_V3_NUM_ENT)) { + pr_debug("Unexpected number of _CPC return package entries (%d) for CPU:= %d\n", + num_ent, pr->id); goto out_free; + } + if (cpc_rev > CPPC_V3_REV) { + num_ent =3D CPPC_V3_NUM_ENT; + cpc_rev =3D CPPC_V3_REV; + } + + cpc_ptr->num_entries =3D num_ent; + cpc_ptr->version =3D cpc_rev; =20 /* Iterate through remaining entries in _CPC */ for (i =3D 2; i < num_ent; i++) { diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h index 181907349b49..a76f8c6b732d 100644 --- a/include/acpi/cppc_acpi.h +++ b/include/acpi/cppc_acpi.h @@ -17,7 +17,7 @@ #include #include =20 -/* Support CPPCv2 and CPPCv3 */ +/* CPPCv2 and CPPCv3 support */ #define CPPC_V2_REV 2 #define CPPC_V3_REV 3 #define CPPC_V2_NUM_ENT 21 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 880C8C28B2C for ; Mon, 15 Aug 2022 23:32:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347751AbiHOXbR (ORCPT ); Mon, 15 Aug 2022 19:31:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245481AbiHOXZt (ORCPT ); Mon, 15 Aug 2022 19:25:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BA8DBA168; Mon, 15 Aug 2022 13:06:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B4F3FB81135; Mon, 15 Aug 2022 20:06:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A2CAC433D6; Mon, 15 Aug 2022 20:06:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593962; bh=1XOe91fxNjGIb2u9g3lgu/kzddDaw0ZvQ1Xl6XRc3yk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=evaDNqB9QF9C/jNwSjmm/FNDqg3wMpTnZwbnSXTvfERcQHx2E0uDQwCqTww+CbvWu BV5KBhriCOD26Dvp81jfrcON9T6JwCgHfAkguHNkatvZTathJqSHJ55nIUwCllxmje KZBm6RLVfbLrMGNJDyF/YLQxIK3lzz69F9fNi1ig= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Sachin Sant , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 1035/1095] powerpc/powernv/kvm: Use darn for H_RANDOM on Power9 Date: Mon, 15 Aug 2022 20:07:14 +0200 Message-Id: <20220815180511.894527899@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld [ Upstream commit 7ef3d06f1bc4a5e62273726f3dc2bd258ae1c71f ] The existing logic in KVM to support guests calling H_RANDOM only works on Power8, because it looks for an RNG in the device tree, but on Power9 we just use darn. In addition the existing code needs to work in real mode, so we have the special cased powernv_get_random_real_mode() to deal with that. Instead just have KVM call ppc_md.get_random_seed(), and do the real mode check inside of there, that way we use whatever RNG is available, including darn on Power9. Fixes: e928e9cb3601 ("KVM: PPC: Book3S HV: Add fast real-mode H_RANDOM impl= ementation.") Cc: stable@vger.kernel.org # v4.1+ Signed-off-by: Jason A. Donenfeld Tested-by: Sachin Sant [mpe: Rebase on previous commit, update change log appropriately] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220727143219.2684192-2-mpe@ellerman.id.au Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/include/asm/archrandom.h | 5 ---- arch/powerpc/kvm/book3s_hv_builtin.c | 7 +++--- arch/powerpc/platforms/powernv/rng.c | 36 ++++++--------------------- 3 files changed, 12 insertions(+), 36 deletions(-) diff --git a/arch/powerpc/include/asm/archrandom.h b/arch/powerpc/include/a= sm/archrandom.h index 9a53e29680f4..258174304904 100644 --- a/arch/powerpc/include/asm/archrandom.h +++ b/arch/powerpc/include/asm/archrandom.h @@ -38,12 +38,7 @@ static inline bool __must_check arch_get_random_seed_int= (unsigned int *v) #endif /* CONFIG_ARCH_RANDOM */ =20 #ifdef CONFIG_PPC_POWERNV -int powernv_hwrng_present(void); int powernv_get_random_long(unsigned long *v); -int powernv_get_random_real_mode(unsigned long *v); -#else -static inline int powernv_hwrng_present(void) { return 0; } -static inline int powernv_get_random_real_mode(unsigned long *v) { return = 0; } #endif =20 #endif /* _ASM_POWERPC_ARCHRANDOM_H */ diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s= _hv_builtin.c index 7e52d0beee77..5e4251b76e75 100644 --- a/arch/powerpc/kvm/book3s_hv_builtin.c +++ b/arch/powerpc/kvm/book3s_hv_builtin.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -176,13 +176,14 @@ EXPORT_SYMBOL_GPL(kvmppc_hcall_impl_hv_realmode); =20 int kvmppc_hwrng_present(void) { - return powernv_hwrng_present(); + return ppc_md.get_random_seed !=3D NULL; } EXPORT_SYMBOL_GPL(kvmppc_hwrng_present); =20 long kvmppc_rm_h_random(struct kvm_vcpu *vcpu) { - if (powernv_get_random_real_mode(&vcpu->arch.regs.gpr[4])) + if (ppc_md.get_random_seed && + ppc_md.get_random_seed(&vcpu->arch.regs.gpr[4])) return H_SUCCESS; =20 return H_HARDWARE; diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/= powernv/rng.c index 2287c9cd0cd5..d19305292e1e 100644 --- a/arch/powerpc/platforms/powernv/rng.c +++ b/arch/powerpc/platforms/powernv/rng.c @@ -29,15 +29,6 @@ struct powernv_rng { =20 static DEFINE_PER_CPU(struct powernv_rng *, powernv_rng); =20 -int powernv_hwrng_present(void) -{ - struct powernv_rng *rng; - - rng =3D get_cpu_var(powernv_rng); - put_cpu_var(rng); - return rng !=3D NULL; -} - static unsigned long rng_whiten(struct powernv_rng *rng, unsigned long val) { unsigned long parity; @@ -58,19 +49,6 @@ static unsigned long rng_whiten(struct powernv_rng *rng,= unsigned long val) return val; } =20 -int powernv_get_random_real_mode(unsigned long *v) -{ - struct powernv_rng *rng; - - rng =3D raw_cpu_read(powernv_rng); - if (!rng) - return 0; - - *v =3D rng_whiten(rng, __raw_rm_readq(rng->regs_real)); - - return 1; -} - static int powernv_get_random_darn(unsigned long *v) { unsigned long val; @@ -107,12 +85,14 @@ int powernv_get_random_long(unsigned long *v) { struct powernv_rng *rng; =20 - rng =3D get_cpu_var(powernv_rng); - - *v =3D rng_whiten(rng, in_be64(rng->regs)); - - put_cpu_var(rng); - + if (mfmsr() & MSR_DR) { + rng =3D get_cpu_var(powernv_rng); + *v =3D rng_whiten(rng, in_be64(rng->regs)); + put_cpu_var(rng); + } else { + rng =3D raw_cpu_read(powernv_rng); + *v =3D rng_whiten(rng, __raw_rm_readq(rng->regs_real)); + } return 1; } EXPORT_SYMBOL_GPL(powernv_get_random_long); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF1EFC2BB45 for ; Mon, 15 Aug 2022 23:32:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353299AbiHOXbh (ORCPT ); Mon, 15 Aug 2022 19:31:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245630AbiHOXZx (ORCPT ); Mon, 15 Aug 2022 19:25:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5332804BF; Mon, 15 Aug 2022 13:06:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 67A60B80EA9; Mon, 15 Aug 2022 20:06:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32AF3C433D6; Mon, 15 Aug 2022 20:06:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593971; bh=7tARl1TSUtB1EY1AcMUAeuoi5nZ03zGTLEJW5dprqRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HAZ++Ns56R8X5/BFl89RKywzrcHgEWOAn1cWiPZIe6WiPFAhg2vSQVt0tttjss7/j 3n1bYFnxmKdv56EBthkFuoLm2IAQgtvp2FN0R694lhNmqkkeUoKSJ9N7Vkl/Rz2Anb MkdQr4GAnSA3ZjQM/rEJLyQBH+mfguKMymTwk3Mk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Gorbik , Sumanth Korikkar , Alexander Gordeev , Sasha Levin Subject: [PATCH 5.18 1036/1095] s390/unwind: fix fgraph return address recovery Date: Mon, 15 Aug 2022 20:07:15 +0200 Message-Id: <20220815180511.945321111@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sumanth Korikkar [ Upstream commit ded466e1806686794b403ebf031133bbaca76bb2 ] When HAVE_FUNCTION_GRAPH_RET_ADDR_PTR is defined, the return address to the fgraph caller is recovered by tagging it along with the stack pointer of ftrace stack. This makes the stack unwinding more reliable. When the fgraph return address is modified to return_to_handler, ftrace_graph_ret_addr tries to restore it to the original value using tagged stack pointer. Fix this by passing tagged sp to ftrace_graph_ret_addr. Fixes: d81675b60d09 ("s390/unwind: recover kretprobe modified return addres= s in stacktrace") Cc: # 5.18 Reviewed-by: Vasily Gorbik Signed-off-by: Sumanth Korikkar Signed-off-by: Alexander Gordeev Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/s390/include/asm/unwind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/include/asm/unwind.h b/arch/s390/include/asm/unwind.h index 0bf06f1682d8..02462e7100c1 100644 --- a/arch/s390/include/asm/unwind.h +++ b/arch/s390/include/asm/unwind.h @@ -47,7 +47,7 @@ struct unwind_state { static inline unsigned long unwind_recover_ret_addr(struct unwind_state *s= tate, unsigned long ip) { - ip =3D ftrace_graph_ret_addr(state->task, &state->graph_idx, ip, NULL); + ip =3D ftrace_graph_ret_addr(state->task, &state->graph_idx, ip, (void *)= state->sp); if (is_kretprobe_trampoline(ip)) ip =3D kretprobe_find_ret_addr(state->task, (void *)state->sp, &state->k= r_cur); return ip; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD149C2BB43 for ; Mon, 15 Aug 2022 23:32:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353043AbiHOXb1 (ORCPT ); Mon, 15 Aug 2022 19:31:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343905AbiHOX0K (ORCPT ); Mon, 15 Aug 2022 19:26:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77A7A47BBE; Mon, 15 Aug 2022 13:06:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 156EB6069F; Mon, 15 Aug 2022 20:06:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F32BC433D6; Mon, 15 Aug 2022 20:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593977; bh=LbYr9atvpCd18aFJFyM1+zLJDnqYHvtoUfsb5FBaeuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h2nV5w0kTBGYmGhaMu4EQXQ4EdyR4k0QtAsjw1llYtinQv9K7Yhoe0X83EF2IfR/y E7Fc/Q1CwDrBPeS1/V5vPKCwPOwY85rAx6Z5NDlXdzBp0051ANTFzpe/srE+zP/wPt ZOJKLV8vCTOtcQTYJ+tl+82x4hvTfs8BuTGFA5sA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luwei Kang , Like Xu , "Peter Zijlstra (Intel)" , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 1037/1095] KVM: x86/pmu: Introduce the ctrl_mask value for fixed counter Date: Mon, 15 Aug 2022 20:07:16 +0200 Message-Id: <20220815180511.988000689@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Like Xu [ Upstream commit 2c985527dd8d283e786ad7a67e532ef7f6f00fac ] The mask value of fixed counter control register should be dynamic adjusted with the number of fixed counters. This patch introduces a variable that includes the reserved bits of fixed counter control registers. This is a generic code refactoring. Co-developed-by: Luwei Kang Signed-off-by: Luwei Kang Signed-off-by: Like Xu Acked-by: Peter Zijlstra (Intel) Message-Id: <20220411101946.20262-6-likexu@tencent.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/vmx/pmu_intel.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_hos= t.h index 57550a427789..35c7a1fce8ea 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -508,6 +508,7 @@ struct kvm_pmu { unsigned nr_arch_fixed_counters; unsigned available_event_types; u64 fixed_ctr_ctrl; + u64 fixed_ctr_ctrl_mask; u64 global_ctrl; u64 global_status; u64 counter_bitmask[2]; diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index b82b6709d7a8..040d598622e3 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -395,7 +395,7 @@ static int intel_pmu_set_msr(struct kvm_vcpu *vcpu, str= uct msr_data *msr_info) case MSR_CORE_PERF_FIXED_CTR_CTRL: if (pmu->fixed_ctr_ctrl =3D=3D data) return 0; - if (!(data & 0xfffffffffffff444ull)) { + if (!(data & pmu->fixed_ctr_ctrl_mask)) { reprogram_fixed_counters(pmu, data); return 0; } @@ -479,6 +479,7 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) struct kvm_cpuid_entry2 *entry; union cpuid10_eax eax; union cpuid10_edx edx; + int i; =20 pmu->nr_arch_gp_counters =3D 0; pmu->nr_arch_fixed_counters =3D 0; @@ -487,6 +488,7 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) pmu->version =3D 0; pmu->reserved_bits =3D 0xffffffff00200000ull; pmu->raw_event_mask =3D X86_RAW_EVENT_MASK; + pmu->fixed_ctr_ctrl_mask =3D ~0ull; =20 entry =3D kvm_find_cpuid_entry(vcpu, 0xa, 0); if (!entry || !vcpu->kvm->arch.enable_pmu) @@ -522,6 +524,8 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) setup_fixed_pmc_eventsel(pmu); } =20 + for (i =3D 0; i < pmu->nr_arch_fixed_counters; i++) + pmu->fixed_ctr_ctrl_mask &=3D ~(0xbull << (i * 4)); pmu->global_ctrl =3D ((1ull << pmu->nr_arch_gp_counters) - 1) | (((1ull << pmu->nr_arch_fixed_counters) - 1) << INTEL_PMC_IDX_FIXED); pmu->global_ctrl_mask =3D ~pmu->global_ctrl; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EC21C3F6B0 for ; Mon, 15 Aug 2022 23:32:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353656AbiHOXcL (ORCPT ); Mon, 15 Aug 2022 19:32:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343945AbiHOX0K (ORCPT ); Mon, 15 Aug 2022 19:26:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BFD8474EF; Mon, 15 Aug 2022 13:06:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 27E406069E; Mon, 15 Aug 2022 20:06:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E4CBC433C1; Mon, 15 Aug 2022 20:06:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593983; bh=kHv0r+d23SoO64trFnjf9d24zrqlp/NQZLqRYFXhOkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dBrpIkvF+ertWXwm//w4waRgLMbddceBeQJgIKz0qhCBYUGmVMzB735QX4jujJ5FI pPFHPazyrl2j5+pzXFDO58FCt6QMGoBntUvOo+EGjU70f57FYmJMBvyqSGLLaRXjp5 wHVWDDWkcjG7dKEHN6eRLeasM/QCiJwjQTfYChs4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 1038/1095] KVM: VMX: Mark all PERF_GLOBAL_(OVF)_CTRL bits reserved if theres no vPMU Date: Mon, 15 Aug 2022 20:07:17 +0200 Message-Id: <20220815180512.038537874@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit 93255bf92939d948bc86d81c6bb70bb0fecc5db1 ] Mark all MSR_CORE_PERF_GLOBAL_CTRL and MSR_CORE_PERF_GLOBAL_OVF_CTRL bits as reserved if there is no guest vPMU. The nVMX VM-Entry consistency checks do not check for a valid vPMU prior to consuming the masks via kvm_valid_perf_global_ctrl(), i.e. may incorrectly allow a non-zero mask to be loaded via VM-Enter or VM-Exit (well, attempted to be loaded, the actual MSR load will be rejected by intel_is_valid_msr()). Fixes: f5132b01386b ("KVM: Expose a version 2 architectural PMU to a guests= ") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220722224409.1336532-3-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/vmx/pmu_intel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index 040d598622e3..cd2d0454f8b0 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -488,6 +488,8 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) pmu->version =3D 0; pmu->reserved_bits =3D 0xffffffff00200000ull; pmu->raw_event_mask =3D X86_RAW_EVENT_MASK; + pmu->global_ctrl_mask =3D ~0ull; + pmu->global_ovf_ctrl_mask =3D ~0ull; pmu->fixed_ctr_ctrl_mask =3D ~0ull; =20 entry =3D kvm_find_cpuid_entry(vcpu, 0xa, 0); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76E35C25B08 for ; Mon, 15 Aug 2022 23:32:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233701AbiHOXca (ORCPT ); Mon, 15 Aug 2022 19:32:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343991AbiHOX0K (ORCPT ); Mon, 15 Aug 2022 19:26:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 044387FE77; Mon, 15 Aug 2022 13:06:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B1DEAB80EA8; Mon, 15 Aug 2022 20:06:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03928C433C1; Mon, 15 Aug 2022 20:06:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593993; bh=7OXU0rqd51gmgEtu/3maRQVaWYMA60F/ZGx4Urwez44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sq5JOao/AOlGeSJNHzyaf/r7uxeAe6Q1J5UvdPOx/w7X8k6QGFxt4Y5nvGqwEr00q LzDNXBk89PRiakYrjxM9s/girzl/p9296YArY4SnoZSA0XcNShx7YIg3fxuYAZQ9uf iQoKHA3/PH0WGYeb/6M7vRbots9Qh8DNyp38sBrY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Like Xu , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 1039/1095] KVM: x86/pmu: Ignore pmu->global_ctrl check if vPMU doesnt support global_ctrl Date: Mon, 15 Aug 2022 20:07:18 +0200 Message-Id: <20220815180512.079838805@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Like Xu [ Upstream commit 98defd2e17803263f49548fea930cfc974d505aa ] MSR_CORE_PERF_GLOBAL_CTRL is introduced as part of Architecture PMU V2, as indicated by Intel SDM 19.2.2 and the intel_is_valid_msr() function. So in the absence of global_ctrl support, all PMCs are enabled as AMD does. Signed-off-by: Like Xu Message-Id: <20220509102204.62389-1-likexu@tencent.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/vmx/pmu_intel.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index cd2d0454f8b0..2cbd5f183ab5 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -98,6 +98,9 @@ static bool intel_pmc_is_enabled(struct kvm_pmc *pmc) { struct kvm_pmu *pmu =3D pmc_to_pmu(pmc); =20 + if (pmu->version < 2) + return true; + return test_bit(pmc->idx, (unsigned long *)&pmu->global_ctrl); } =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 804F9C25B08 for ; Mon, 15 Aug 2022 23:32:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244401AbiHOXcg (ORCPT ); Mon, 15 Aug 2022 19:32:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344156AbiHOX0K (ORCPT ); Mon, 15 Aug 2022 19:26:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 820828048A; Mon, 15 Aug 2022 13:06:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 168396069F; Mon, 15 Aug 2022 20:06:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BCB8C433C1; Mon, 15 Aug 2022 20:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593999; bh=M5ZHIbu1TKuEQtFj2vxw4lKQ1U5GhVRC3YEpgB+BG6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i5g1rADzvzs6jtykUn/TNBuMGb6jfLrQHxI9DJLnNEfOCfW81EL2rLBs7HEK04uIY r9Pg8FbXLSlvWgK7xuGauWwimGoaDpqafSR6WQHXw7009hElOsL7unAlXVqvgS69Do 8hAkSTTwYJsyQZKpSx7gBPFjt/RAXEqp/OlvRbYY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 1040/1095] KVM: VMX: Add helper to check if the guest PMU has PERF_GLOBAL_CTRL Date: Mon, 15 Aug 2022 20:07:19 +0200 Message-Id: <20220815180512.120876879@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit b663f0b5f3d665c261256d1f76e98f077c6e56af ] Add a helper to check of the guest PMU has PERF_GLOBAL_CTRL, which is unintuitive _and_ diverges from Intel's architecturally defined behavior. Even worse, KVM currently implements the check using two different (but equivalent) checks, _and_ there has been at least one attempt to add a _third_ flavor. Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220722224409.1336532-4-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/vmx/pmu_intel.c | 4 ++-- arch/x86/kvm/vmx/vmx.h | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index 2cbd5f183ab5..8bd154f8c966 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -98,7 +98,7 @@ static bool intel_pmc_is_enabled(struct kvm_pmc *pmc) { struct kvm_pmu *pmu =3D pmc_to_pmu(pmc); =20 - if (pmu->version < 2) + if (!intel_pmu_has_perf_global_ctrl(pmu)) return true; =20 return test_bit(pmc->idx, (unsigned long *)&pmu->global_ctrl); @@ -215,7 +215,7 @@ static bool intel_is_valid_msr(struct kvm_vcpu *vcpu, u= 32 msr) case MSR_CORE_PERF_GLOBAL_STATUS: case MSR_CORE_PERF_GLOBAL_CTRL: case MSR_CORE_PERF_GLOBAL_OVF_CTRL: - ret =3D pmu->version > 1; + return intel_pmu_has_perf_global_ctrl(pmu); break; default: ret =3D get_gp_pmc(pmu, msr, MSR_IA32_PERFCTR0) || diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h index 1e7f9453894b..93aa1f3ea01e 100644 --- a/arch/x86/kvm/vmx/vmx.h +++ b/arch/x86/kvm/vmx/vmx.h @@ -92,6 +92,18 @@ union vmx_exit_reason { u32 full; }; =20 +static inline bool intel_pmu_has_perf_global_ctrl(struct kvm_pmu *pmu) +{ + /* + * Architecturally, Intel's SDM states that IA32_PERF_GLOBAL_CTRL is + * supported if "CPUID.0AH: EAX[7:0] > 0", i.e. if the PMU version is + * greater than zero. However, KVM only exposes and emulates the MSR + * to/for the guest if the guest PMU supports at least "Architectural + * Performance Monitoring Version 2". + */ + return pmu->version > 1; +} + #define vcpu_to_lbr_desc(vcpu) (&to_vmx(vcpu)->lbr_desc) #define vcpu_to_lbr_records(vcpu) (&to_vmx(vcpu)->lbr_desc.records) =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09253C00140 for ; Mon, 15 Aug 2022 23:33:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242505AbiHOXdC (ORCPT ); Mon, 15 Aug 2022 19:33:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344421AbiHOX0R (ORCPT ); Mon, 15 Aug 2022 19:26:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 680F88051D; Mon, 15 Aug 2022 13:06:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1698AB80EAB; Mon, 15 Aug 2022 20:06:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62E4EC433D6; Mon, 15 Aug 2022 20:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594005; bh=BxxQGjGKz5O0tnAGdtnCyKK1ppGvz7kj0lavPH7jdEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mzC6kd5icMBraJ47qteRWd7q5uZSZeXAwK6zkGjX/qS22eJLvWlfO7Fu4BggxMtK9 EB1Je50px1k8HukTtfyNjU3tbSHh06OrLXIHWsaObDWIKI3QRieBgiQF1lP/09zuX5 4vQLHIEzMnv2WEBdEk71upVeD2Y6lTsdrzFMMWaA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 1041/1095] KVM: nVMX: Attempt to load PERF_GLOBAL_CTRL on nVMX xfer iff it exists Date: Mon, 15 Aug 2022 20:07:20 +0200 Message-Id: <20220815180512.159575135@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit 4496a6f9b45e8cd83343ad86a3984d614e22cf54 ] Attempt to load PERF_GLOBAL_CTRL during nested VM-Enter/VM-Exit if and only if the MSR exists (according to the guest vCPU model). KVM has very misguided handling of VM_{ENTRY,EXIT}_LOAD_IA32_PERF_GLOBAL_CTRL and attempts to force the nVMX MSR settings to match the vPMU model, i.e. to hide/expose the control based on whether or not the MSR exists from the guest's perspective. KVM's modifications fail to handle the scenario where the vPMU is hidden from the guest _after_ being exposed to the guest, e.g. by userspace doing multiple KVM_SET_CPUID2 calls, which is allowed if done before any KVM_RUN. nested_vmx_pmu_refresh() is called if and only if there's a recognized vPMU, i.e. KVM will leave the bits in the allow state and then ultimately reject the MSR load and WARN. KVM should not force the VMX MSRs in the first place. KVM taking control of the MSRs was a misguided attempt at mimicking what commit 5f76f6f5ff96 ("KVM: nVMX: Do not expose MPX VMX controls when guest MPX disabled", 2018-10-01) did for MPX. However, the MPX commit was a workaround for another KVM bug and not something that should be imitated (and it should never been done in the first place). In other words, KVM's ABI _should_ be that userspace has full control over the MSRs, at which point triggering the WARN that loading the MSR must not fail is trivial. The intent of the WARN is still valid; KVM has consistency checks to ensure that vmcs12->{guest,host}_ia32_perf_global_ctrl is valid. The problem is that '0' must be considered a valid value at all times, and so the simple/obvious solution is to just not actually load the MSR when it does not exist. It is userspace's responsibility to provide a sane vCPU model, i.e. KVM is well within its ABI and Intel's VMX architecture to skip the loads if the MSR does not exist. Fixes: 03a8871add95 ("KVM: nVMX: Expose load IA32_PERF_GLOBAL_CTRL VM-{Entr= y,Exit} control") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220722224409.1336532-5-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index aa287302f991..5c62e552082a 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -2621,6 +2621,7 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, stru= ct vmcs12 *vmcs12, vcpu->arch.walk_mmu->inject_page_fault =3D vmx_inject_page_fault_nested; =20 if ((vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL) && + intel_pmu_has_perf_global_ctrl(vcpu_to_pmu(vcpu)) && WARN_ON_ONCE(kvm_set_msr(vcpu, MSR_CORE_PERF_GLOBAL_CTRL, vmcs12->guest_ia32_perf_global_ctrl))) { *entry_failure_code =3D ENTRY_FAIL_DEFAULT; @@ -4346,7 +4347,8 @@ static void load_vmcs12_host_state(struct kvm_vcpu *v= cpu, vmcs_write64(GUEST_IA32_PAT, vmcs12->host_ia32_pat); vcpu->arch.pat =3D vmcs12->host_ia32_pat; } - if (vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL) + if ((vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL) && + intel_pmu_has_perf_global_ctrl(vcpu_to_pmu(vcpu))) WARN_ON_ONCE(kvm_set_msr(vcpu, MSR_CORE_PERF_GLOBAL_CTRL, vmcs12->host_ia32_perf_global_ctrl)); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F001CC00140 for ; Mon, 15 Aug 2022 23:33:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345398AbiHOXdU (ORCPT ); Mon, 15 Aug 2022 19:33:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345396AbiHOX0s (ORCPT ); Mon, 15 Aug 2022 19:26:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E32A80F52; Mon, 15 Aug 2022 13:06:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 50894B810C5; Mon, 15 Aug 2022 20:06:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87050C433C1; Mon, 15 Aug 2022 20:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594012; bh=RhHLeYGdNEDcEC9n0pCBwyvJaJEEUECb9tN9lvLQVCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=INXs3dCRb7zt6q6uqj3RJ1sBsmpDebeYyWHUebY/YsDJV4Ggbjtg4mDG05w5fg8aF UeYwjqwTpuLxAcase/evdp3+jGP2IHOJgs9C0QCGOUrjighLCujK8twFMTfpu9ffZ4 1WG+uQh+X4qNZyhzFh+3+F/jFRglr9sMsaCFxkwg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.18 1042/1095] dm raid: fix address sanitizer warning in raid_status Date: Mon, 15 Aug 2022 20:07:21 +0200 Message-Id: <20220815180512.194205458@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka [ Upstream commit 1fbeea217d8f297fe0e0956a1516d14ba97d0396 ] There is this warning when using a kernel with the address sanitizer and running this testsuite: https://gitlab.com/cki-project/kernel-tests/-/tree/main/storage/swraid/scsi= _raid =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BUG: KASAN: slab-out-of-bounds in raid_status+0x1747/0x2820 [dm_raid] Read of size 4 at addr ffff888079d2c7e8 by task lvcreate/13319 CPU: 0 PID: 13319 Comm: lvcreate Not tainted 5.18.0-0.rc3. #1 Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 Call Trace: dump_stack_lvl+0x6a/0x9c print_address_description.constprop.0+0x1f/0x1e0 print_report.cold+0x55/0x244 kasan_report+0xc9/0x100 raid_status+0x1747/0x2820 [dm_raid] dm_ima_measure_on_table_load+0x4b8/0xca0 [dm_mod] table_load+0x35c/0x630 [dm_mod] ctl_ioctl+0x411/0x630 [dm_mod] dm_ctl_ioctl+0xa/0x10 [dm_mod] __x64_sys_ioctl+0x12a/0x1a0 do_syscall_64+0x5b/0x80 The warning is caused by reading conf->max_nr_stripes in raid_status. The code in raid_status reads mddev->private, casts it to struct r5conf and reads the entry max_nr_stripes. However, if we have different raid type than 4/5/6, mddev->private doesn't point to struct r5conf; it may point to struct r0conf, struct r1conf, struct r10conf or struct mpconf. If we cast a pointer to one of these structs to struct r5conf, we will be reading invalid memory and KASAN warns about it. Fix this bug by reading struct r5conf only if raid type is 4, 5 or 6. Cc: stable@vger.kernel.org Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/md/dm-raid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index e362a7471512..92e6b731f9d6 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -3514,7 +3514,7 @@ static void raid_status(struct dm_target *ti, status_= type_t type, { struct raid_set *rs =3D ti->private; struct mddev *mddev =3D &rs->md; - struct r5conf *conf =3D mddev->private; + struct r5conf *conf =3D rs_is_raid456(rs) ? mddev->private : NULL; int i, max_nr_stripes =3D conf ? conf->max_nr_stripes : 0; unsigned long recovery; unsigned int raid_param_cnt =3D 1; /* at least 1 for chunksize */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75710C00140 for ; Mon, 15 Aug 2022 23:34:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353398AbiHOXeh (ORCPT ); Mon, 15 Aug 2022 19:34:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345722AbiHOX0y (ORCPT ); Mon, 15 Aug 2022 19:26:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF1E580F5F; Mon, 15 Aug 2022 13:07:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 42581B80EA8; Mon, 15 Aug 2022 20:06:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CFC4C433D7; Mon, 15 Aug 2022 20:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594018; bh=rX//Aoamy1LKUauQAarWRD1cEgjxTas3z55cPZZLqUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U8F1LDmvBq0NLpXLWbXd+bh9WfQkrpRcN6thyfnrpdCO8T8zWlmb4/EjSlPvKyBXW wmK7WEp8Iyc3pRaZTKEgsORJpEAZAUg12yi0F5dM0sdwX5dYoXi8rMUnuibyG24G51 w0W+DO5qirrih3oeicx07jyvfi5Xuk//qqM8oMsQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.18 1043/1095] dm raid: fix address sanitizer warning in raid_resume Date: Mon, 15 Aug 2022 20:07:22 +0200 Message-Id: <20220815180512.226178217@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka [ Upstream commit 7dad24db59d2d2803576f2e3645728866a056dab ] There is a KASAN warning in raid_resume when running the lvm test lvconvert-raid.sh. The reason for the warning is that mddev->raid_disks is greater than rs->raid_disks, so the loop touches one entry beyond the allocated length. Cc: stable@vger.kernel.org Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/md/dm-raid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 92e6b731f9d6..a55d6f6f294b 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -3824,7 +3824,7 @@ static void attempt_restore_of_faulty_devices(struct = raid_set *rs) =20 memset(cleared_failed_devices, 0, sizeof(cleared_failed_devices)); =20 - for (i =3D 0; i < mddev->raid_disks; i++) { + for (i =3D 0; i < rs->raid_disks; i++) { r =3D &rs->dev[i].rdev; /* HM FIXME: enhance journal device recovery processing */ if (test_bit(Journal, &r->flags)) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 798E7C00140 for ; Mon, 15 Aug 2022 23:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232157AbiHOXeB (ORCPT ); Mon, 15 Aug 2022 19:34:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346406AbiHOX1S (ORCPT ); Mon, 15 Aug 2022 19:27:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF843BA17C; Mon, 15 Aug 2022 13:07:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EAED16068D; Mon, 15 Aug 2022 20:07:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3D33C433C1; Mon, 15 Aug 2022 20:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594027; bh=RDj5KPfi2DGB835dglTgPaPt8BgMLgpCXvMGM1nKy5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EJj2YeTiohuzD8LhKevfl7RSSX63LGzqIW0kX/CuUxJJP6CkY/1f/Q4pauFl9/0qz INYouWvdPhKkB7rM0f5DKBFT3h84IvvGgWPIN9PjIegrApHGTSEZz3wcv0ExG1UiUN o8yDVNYWV+NZEAikYNVKigPNpIn1nafocKdr0gTw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , SeongJae Park , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 1044/1095] mm/damon/reclaim: fix potential memory leak in damon_reclaim_init() Date: Mon, 15 Aug 2022 20:07:23 +0200 Message-Id: <20220815180512.274821489@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jianglei Nie [ Upstream commit 188043c7f4f2bd662f2a55957d684fffa543e600 ] damon_reclaim_init() allocates a memory chunk for ctx with damon_new_ctx(). When damon_select_ops() fails, ctx is not released, which will lead to a memory leak. We should release the ctx with damon_destroy_ctx() when damon_select_ops() fails to fix the memory leak. Link: https://lkml.kernel.org/r/20220714063746.2343549-1-niejianglei2021@16= 3.com Fixes: 4d69c3457821 ("mm/damon/reclaim: use damon_select_ops() instead of d= amon_{v,p}a_set_operations()") Signed-off-by: Jianglei Nie Reviewed-by: SeongJae Park Cc: Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- mm/damon/reclaim.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c index e34c4d0c4d93..11982685508e 100644 --- a/mm/damon/reclaim.c +++ b/mm/damon/reclaim.c @@ -384,8 +384,10 @@ static int __init damon_reclaim_init(void) if (!ctx) return -ENOMEM; =20 - if (damon_select_ops(ctx, DAMON_OPS_PADDR)) + if (damon_select_ops(ctx, DAMON_OPS_PADDR)) { + damon_destroy_ctx(ctx); return -EINVAL; + } =20 ctx->callback.after_aggregation =3D damon_reclaim_after_aggregation; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55AA1C00140 for ; Mon, 15 Aug 2022 23:34:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346702AbiHOXeQ (ORCPT ); Mon, 15 Aug 2022 19:34:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347132AbiHOX12 (ORCPT ); Mon, 15 Aug 2022 19:27:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB6BFD5E98; Mon, 15 Aug 2022 13:07:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F203FB80EAD; Mon, 15 Aug 2022 20:07:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 345BEC433C1; Mon, 15 Aug 2022 20:07:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594033; bh=k/jl+hiL7h61ReI0pIPxD1nbi8Tvs1yvqiCnRfOIhME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ob29ykvkrRfC0QIu3ygNtbXfq2rNmv8dGqKW5NuEv3Ush80Y/R4LjpKwqdga+gKe4 qqkO/VBueYo6SanGR8O7cDOXtMmXQVGrld42+0W3rp9dH9gZIN6yR7KLbFXeglfPrR XMSDeRa4zqCLP3GW2HEXcGSdepp/uXaPuhL+8TRQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , Muchun Song , Kees Cook , Mike Kravetz , Mina Almasry , Shakeel Butt , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 1045/1095] hugetlb_cgroup: fix wrong hugetlb cgroup numa stat Date: Mon, 15 Aug 2022 20:07:24 +0200 Message-Id: <20220815180512.318076322@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaohe Lin [ Upstream commit 2727cfe4072a35ce813e3708f74c135de7da8897 ] We forget to set cft->private for numa stat file. As a result, numa stat of hstates[0] is always showed for all hstates. Encode the hstates index into cft->private to fix this issue. Link: https://lkml.kernel.org/r/20220723073804.53035-1-linmiaohe@huawei.com Fixes: f47761999052 ("hugetlb: add hugetlb.*.numa_stat file") Signed-off-by: Miaohe Lin Acked-by: Muchun Song Cc: Kees Cook Cc: Mike Kravetz Cc: Mina Almasry Cc: Shakeel Butt Cc: Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- mm/hugetlb_cgroup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index f9942841df18..c86691c431fd 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -772,6 +772,7 @@ static void __init __hugetlb_cgroup_file_dfl_init(int i= dx) /* Add the numa stat file */ cft =3D &h->cgroup_files_dfl[6]; snprintf(cft->name, MAX_CFTYPE_NAME, "%s.numa_stat", buf); + cft->private =3D MEMFILE_PRIVATE(idx, 0); cft->seq_show =3D hugetlb_cgroup_read_numa_stat; cft->flags =3D CFTYPE_NOT_ON_ROOT; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B569C00140 for ; Mon, 15 Aug 2022 23:34:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353378AbiHOXe0 (ORCPT ); Mon, 15 Aug 2022 19:34:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352832AbiHOX1h (ORCPT ); Mon, 15 Aug 2022 19:27:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0BFC14D722; Mon, 15 Aug 2022 13:07:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2366FB80EAD; Mon, 15 Aug 2022 20:07:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3ECA9C433D6; Mon, 15 Aug 2022 20:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594039; bh=ZVE2RNHPOttuDHZ2xX2gbbcEhpFNhv9Nt5X6GeRZKSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VkWP08ORQ9PtPN7Mzdle9M/hAVKlXcelGbkgd0qOqBUhS/EKcrgG5f3IWAfpXKAGY pih3xQvWhJm3AYZWXY/s5d3qU2h8eROXz505NQ878M4N4Hq04+8PbSuCpalfnC1Z0T mJkappOehipy8pTdlE63bt+8qC3lCLRgTij/AmDY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Lindner , Ingo Molnar , Andrew Morton , Simon Wunderlich , Antonio Quartulli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , b.a.t.m.a.n@lists.open-mesh.org, netdev@vger.kernel.org, Sven Eckelmann , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.18 1046/1095] batman-adv: tracing: Use the new __vstring() helper Date: Mon, 15 Aug 2022 20:07:25 +0200 Message-Id: <20220815180512.360819821@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) [ Upstream commit 9abc291812d784bd4a26c01af4ebdbf9f2dbf0bb ] Instead of open coding a __dynamic_array() with a fixed length (which defeats the purpose of the dynamic array in the first place). Use the new __vstring() helper that will use a va_list and only write enough of the string into the ring buffer that is needed. Link: https://lkml.kernel.org/r/20220724191650.236b1355@rorschach.local.home Cc: Marek Lindner Cc: Ingo Molnar Cc: Andrew Morton Cc: Simon Wunderlich Cc: Antonio Quartulli Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: b.a.t.m.a.n@lists.open-mesh.org Cc: netdev@vger.kernel.org Acked-by: Sven Eckelmann Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/batman-adv/trace.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/net/batman-adv/trace.h b/net/batman-adv/trace.h index d673ebdd0426..31c8f922651d 100644 --- a/net/batman-adv/trace.h +++ b/net/batman-adv/trace.h @@ -28,8 +28,6 @@ =20 #endif /* CONFIG_BATMAN_ADV_TRACING */ =20 -#define BATADV_MAX_MSG_LEN 256 - TRACE_EVENT(batadv_dbg, =20 TP_PROTO(struct batadv_priv *bat_priv, @@ -40,16 +38,13 @@ TRACE_EVENT(batadv_dbg, TP_STRUCT__entry( __string(device, bat_priv->soft_iface->name) __string(driver, KBUILD_MODNAME) - __dynamic_array(char, msg, BATADV_MAX_MSG_LEN) + __vstring(msg, vaf->fmt, vaf->va) ), =20 TP_fast_assign( __assign_str(device, bat_priv->soft_iface->name); __assign_str(driver, KBUILD_MODNAME); - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), - BATADV_MAX_MSG_LEN, - vaf->fmt, - *vaf->va) >=3D BATADV_MAX_MSG_LEN); + __assign_vstr(msg, vaf->fmt, vaf->va); ), =20 TP_printk( --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E37CAC25B08 for ; Mon, 15 Aug 2022 23:34:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353449AbiHOXex (ORCPT ); Mon, 15 Aug 2022 19:34:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353352AbiHOX14 (ORCPT ); Mon, 15 Aug 2022 19:27:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA1D114E113; Mon, 15 Aug 2022 13:07:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 57F20B81142; Mon, 15 Aug 2022 20:07:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70FA7C433C1; Mon, 15 Aug 2022 20:07:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594046; bh=fKV254h6rlaIOkZW+7MI6wx3Yxyt5S+adxZmtrAb6Ks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QfdhulPrNobuY0bmXMLIAgevj3ALf0SW/XRtFxsYIchArZF8qliXdm39RSXQxlIc7 zDzYByMxoRTppNAz2OR024dzWxcPvYd1NW6vcKnISOFiN6ZtMch4uLOVNZyShuS44T sR0In83F8ybFljbKj0jRuoGFG+/z5U/0aub1yuwI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Andrew Morton , Peter Zijlstra , Thomas Gleixner , Masami Hiramatsu , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.18 1047/1095] tracing: Use a struct alignof to determine trace event field alignment Date: Mon, 15 Aug 2022 20:07:26 +0200 Message-Id: <20220815180512.392209275@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) [ Upstream commit 4c3d2f9388d36eb28640a220a6f908328442d873 ] alignof() gives an alignment of types as they would be as standalone variables. But alignment in structures might be different, and when building the fields of events, the alignment must be the actual alignment otherwise the field offsets may not match what they actually are. This caused trace-cmd to crash, as libtraceevent did not check if the field offset was bigger than the event. The write_msr and read_msr events on 32 bit had their fields incorrect, because it had a u64 field between two ints. alignof(u64) would give 8, but the u64 field was at a 4 byte alignment. Define a macro as: ALIGN_STRUCTFIELD(type) ((int)(offsetof(struct {char a; type b;}, b))) which gives the actual alignment of types in a structure. Link: https://lkml.kernel.org/r/20220731015928.7ab3a154@rorschach.local.home Cc: Ingo Molnar Cc: Andrew Morton Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Masami Hiramatsu Cc: stable@vger.kernel.org Fixes: 04ae87a52074e ("ftrace: Rework event_create_dir()") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/trace/stages/stage4_event_fields.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/trace/stages/stage4_event_fields.h b/include/trace/sta= ges/stage4_event_fields.h index c3790ec7a453..80d34f396555 100644 --- a/include/trace/stages/stage4_event_fields.h +++ b/include/trace/stages/stage4_event_fields.h @@ -2,16 +2,18 @@ =20 /* Stage 4 definitions for creating trace events */ =20 +#define ALIGN_STRUCTFIELD(type) ((int)(offsetof(struct {char a; type b;}, = b))) + #undef __field_ext #define __field_ext(_type, _item, _filter_type) { \ .type =3D #_type, .name =3D #_item, \ - .size =3D sizeof(_type), .align =3D __alignof__(_type), \ + .size =3D sizeof(_type), .align =3D ALIGN_STRUCTFIELD(_type), \ .is_signed =3D is_signed_type(_type), .filter_type =3D _filter_type }, =20 #undef __field_struct_ext #define __field_struct_ext(_type, _item, _filter_type) { \ .type =3D #_type, .name =3D #_item, \ - .size =3D sizeof(_type), .align =3D __alignof__(_type), \ + .size =3D sizeof(_type), .align =3D ALIGN_STRUCTFIELD(_type), \ 0, .filter_type =3D _filter_type }, =20 #undef __field @@ -23,7 +25,7 @@ #undef __array #define __array(_type, _item, _len) { \ .type =3D #_type"["__stringify(_len)"]", .name =3D #_item, \ - .size =3D sizeof(_type[_len]), .align =3D __alignof__(_type), \ + .size =3D sizeof(_type[_len]), .align =3D ALIGN_STRUCTFIELD(_type), \ .is_signed =3D is_signed_type(_type), .filter_type =3D FILTER_OTHER }, =20 #undef __dynamic_array --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8A65C00140 for ; Mon, 15 Aug 2022 23:35:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353514AbiHOXfF (ORCPT ); Mon, 15 Aug 2022 19:35:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353413AbiHOX2L (ORCPT ); Mon, 15 Aug 2022 19:28:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C66AE14E12B; Mon, 15 Aug 2022 13:07:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CBA15B81158; Mon, 15 Aug 2022 20:07:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D359C433B5; Mon, 15 Aug 2022 20:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594052; bh=RxDjTeYo2nNQwW/9yi+9WMD7splED4n7H/+zLWc2KMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QGB5Vn5DjwfOEN/QaAPcP5QcUDf4F0kncXszJkg1gkvIOZToITgqXCjHDG3FSqhml vOJbt2JEb4RWEOt5wHJ+KqZcIZrVkH/S7dcDECESMz7OyOnmOlYvLmTZNbxfeO7e1V 1EralQvYF1zSH4sXpUzkhoroof7UUcEW1GI6gX14= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marios Makassikis , Namjae Jeon , Steve French , Sasha Levin Subject: [PATCH 5.18 1048/1095] ksmbd: validate length in smb2_write() Date: Mon, 15 Aug 2022 20:07:27 +0200 Message-Id: <20220815180512.428425284@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marios Makassikis [ Upstream commit 158a66b245739e15858de42c0ba60fcf3de9b8e6 ] The SMB2 Write packet contains data that is to be written to a file or to a pipe. Depending on the client, there may be padding between the header and the data field. Currently, the length is validated only in the case padding is present. Since the DataOffset field always points to the beginning of the data, there is no need to have a special case for padding. By removing this, the length is validated in both cases. Signed-off-by: Marios Makassikis Acked-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ksmbd/smb2pdu.c | 49 +++++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -6344,23 +6344,18 @@ static noinline int smb2_write_pipe(stru length =3D le32_to_cpu(req->Length); id =3D req->VolatileFileId; =20 - if (le16_to_cpu(req->DataOffset) =3D=3D - offsetof(struct smb2_write_req, Buffer)) { - data_buf =3D (char *)&req->Buffer[0]; - } else { - if ((u64)le16_to_cpu(req->DataOffset) + length > - get_rfc1002_len(work->request_buf)) { - pr_err("invalid write data offset %u, smb_len %u\n", - le16_to_cpu(req->DataOffset), - get_rfc1002_len(work->request_buf)); - err =3D -EINVAL; - goto out; - } - - data_buf =3D (char *)(((char *)&req->hdr.ProtocolId) + - le16_to_cpu(req->DataOffset)); + if ((u64)le16_to_cpu(req->DataOffset) + length > + get_rfc1002_len(work->request_buf)) { + pr_err("invalid write data offset %u, smb_len %u\n", + le16_to_cpu(req->DataOffset), + get_rfc1002_len(work->request_buf)); + err =3D -EINVAL; + goto out; } =20 + data_buf =3D (char *)(((char *)&req->hdr.ProtocolId) + + le16_to_cpu(req->DataOffset)); + rpc_resp =3D ksmbd_rpc_write(work->sess, id, data_buf, length); if (rpc_resp) { if (rpc_resp->flags =3D=3D KSMBD_RPC_ENOTIMPLEMENTED) { @@ -6505,22 +6500,16 @@ int smb2_write(struct ksmbd_work *work) =20 if (req->Channel !=3D SMB2_CHANNEL_RDMA_V1 && req->Channel !=3D SMB2_CHANNEL_RDMA_V1_INVALIDATE) { - if (le16_to_cpu(req->DataOffset) =3D=3D - offsetof(struct smb2_write_req, Buffer)) { - data_buf =3D (char *)&req->Buffer[0]; - } else { - if ((u64)le16_to_cpu(req->DataOffset) + length > - get_rfc1002_len(work->request_buf)) { - pr_err("invalid write data offset %u, smb_len %u\n", - le16_to_cpu(req->DataOffset), - get_rfc1002_len(work->request_buf)); - err =3D -EINVAL; - goto out; - } - - data_buf =3D (char *)(((char *)&req->hdr.ProtocolId) + - le16_to_cpu(req->DataOffset)); + if ((u64)le16_to_cpu(req->DataOffset) + length > + get_rfc1002_len(work->request_buf)) { + pr_err("invalid write data offset %u, smb_len %u\n", + le16_to_cpu(req->DataOffset), + get_rfc1002_len(work->request_buf)); + err =3D -EINVAL; + goto out; } + data_buf =3D (char *)(((char *)&req->hdr.ProtocolId) + + le16_to_cpu(req->DataOffset)); =20 ksmbd_debug(SMB, "flags %u\n", le32_to_cpu(req->Flags)); if (le32_to_cpu(req->Flags) & SMB2_WRITEFLAG_WRITE_THROUGH) From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BD74C25B0E for ; Mon, 15 Aug 2022 23:37:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353749AbiHOXgM (ORCPT ); Mon, 15 Aug 2022 19:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353489AbiHOX2Q (ORCPT ); Mon, 15 Aug 2022 19:28:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 839D414EC8D; Mon, 15 Aug 2022 13:07:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 38092B80EA8; Mon, 15 Aug 2022 20:07:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77507C433D6; Mon, 15 Aug 2022 20:07:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594061; bh=uxd7EsReGra/kxKK0MUI8FhFK70UAPwYm5or0x5vyGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dRFHwtetQADb+N/0Dx/lD4xyA5lldub/nCjISAhZBRGagzy0ktGg+orYgqqRw7dzd PLPlq5HiGQUA5E3v7kusZlA0aoArEB3lJPaBwFP+OgEqqwTs+kYKTlaZaSY1jywPot YDd5Qm+5BH7r/IUVY9oSpeE746EstcYDnShkD1kc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunchul Lee , Namjae Jeon , Steve French , Sasha Levin Subject: [PATCH 5.18 1049/1095] ksmbd: smbd: change prototypes of RDMA read/write related functions Date: Mon, 15 Aug 2022 20:07:28 +0200 Message-Id: <20220815180512.469753235@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hyunchul Lee [ Upstream commit 1807abcf8778bcbbf584fe54da9ccbe9029c49bb ] Change the prototypes of RDMA read/write operations to accept a pointer and length of buffer descriptors. Signed-off-by: Hyunchul Lee Acked-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ksmbd/connection.c | 20 ++++++++++---------- fs/ksmbd/connection.h | 27 ++++++++++++++++----------- fs/ksmbd/smb2pdu.c | 23 ++++++++--------------- fs/ksmbd/transport_rdma.c | 30 +++++++++++++++++------------- 4 files changed, 51 insertions(+), 49 deletions(-) diff --git a/fs/ksmbd/connection.c b/fs/ksmbd/connection.c index bc6050b67256..e8f476c5f189 100644 --- a/fs/ksmbd/connection.c +++ b/fs/ksmbd/connection.c @@ -205,31 +205,31 @@ int ksmbd_conn_write(struct ksmbd_work *work) return 0; } =20 -int ksmbd_conn_rdma_read(struct ksmbd_conn *conn, void *buf, - unsigned int buflen, u32 remote_key, u64 remote_offset, - u32 remote_len) +int ksmbd_conn_rdma_read(struct ksmbd_conn *conn, + void *buf, unsigned int buflen, + struct smb2_buffer_desc_v1 *desc, + unsigned int desc_len) { int ret =3D -EINVAL; =20 if (conn->transport->ops->rdma_read) ret =3D conn->transport->ops->rdma_read(conn->transport, buf, buflen, - remote_key, remote_offset, - remote_len); + desc, desc_len); return ret; } =20 -int ksmbd_conn_rdma_write(struct ksmbd_conn *conn, void *buf, - unsigned int buflen, u32 remote_key, - u64 remote_offset, u32 remote_len) +int ksmbd_conn_rdma_write(struct ksmbd_conn *conn, + void *buf, unsigned int buflen, + struct smb2_buffer_desc_v1 *desc, + unsigned int desc_len) { int ret =3D -EINVAL; =20 if (conn->transport->ops->rdma_write) ret =3D conn->transport->ops->rdma_write(conn->transport, buf, buflen, - remote_key, remote_offset, - remote_len); + desc, desc_len); return ret; } =20 diff --git a/fs/ksmbd/connection.h b/fs/ksmbd/connection.h index 7a59aacb5daa..98c1cbe45ec9 100644 --- a/fs/ksmbd/connection.h +++ b/fs/ksmbd/connection.h @@ -122,11 +122,14 @@ struct ksmbd_transport_ops { int (*writev)(struct ksmbd_transport *t, struct kvec *iovs, int niov, int size, bool need_invalidate_rkey, unsigned int remote_key); - int (*rdma_read)(struct ksmbd_transport *t, void *buf, unsigned int len, - u32 remote_key, u64 remote_offset, u32 remote_len); - int (*rdma_write)(struct ksmbd_transport *t, void *buf, - unsigned int len, u32 remote_key, u64 remote_offset, - u32 remote_len); + int (*rdma_read)(struct ksmbd_transport *t, + void *buf, unsigned int len, + struct smb2_buffer_desc_v1 *desc, + unsigned int desc_len); + int (*rdma_write)(struct ksmbd_transport *t, + void *buf, unsigned int len, + struct smb2_buffer_desc_v1 *desc, + unsigned int desc_len); }; =20 struct ksmbd_transport { @@ -148,12 +151,14 @@ struct ksmbd_conn *ksmbd_conn_alloc(void); void ksmbd_conn_free(struct ksmbd_conn *conn); bool ksmbd_conn_lookup_dialect(struct ksmbd_conn *c); int ksmbd_conn_write(struct ksmbd_work *work); -int ksmbd_conn_rdma_read(struct ksmbd_conn *conn, void *buf, - unsigned int buflen, u32 remote_key, u64 remote_offset, - u32 remote_len); -int ksmbd_conn_rdma_write(struct ksmbd_conn *conn, void *buf, - unsigned int buflen, u32 remote_key, u64 remote_offset, - u32 remote_len); +int ksmbd_conn_rdma_read(struct ksmbd_conn *conn, + void *buf, unsigned int buflen, + struct smb2_buffer_desc_v1 *desc, + unsigned int desc_len); +int ksmbd_conn_rdma_write(struct ksmbd_conn *conn, + void *buf, unsigned int buflen, + struct smb2_buffer_desc_v1 *desc, + unsigned int desc_len); void ksmbd_conn_enqueue_request(struct ksmbd_work *work); int ksmbd_conn_try_dequeue_request(struct ksmbd_work *work); void ksmbd_conn_init_server_callbacks(struct ksmbd_conn_ops *ops); diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index 5df87fe18905..8f86b8d6765f 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -6132,7 +6132,6 @@ static noinline int smb2_read_pipe(struct ksmbd_work = *work) static int smb2_set_remote_key_for_rdma(struct ksmbd_work *work, struct smb2_buffer_desc_v1 *desc, __le32 Channel, - __le16 ChannelInfoOffset, __le16 ChannelInfoLength) { unsigned int i, ch_count; @@ -6158,7 +6157,8 @@ static int smb2_set_remote_key_for_rdma(struct ksmbd_= work *work, =20 work->need_invalidate_rkey =3D (Channel =3D=3D SMB2_CHANNEL_RDMA_V1_INVALIDATE); - work->remote_key =3D le32_to_cpu(desc->token); + if (Channel =3D=3D SMB2_CHANNEL_RDMA_V1_INVALIDATE) + work->remote_key =3D le32_to_cpu(desc->token); return 0; } =20 @@ -6166,14 +6166,12 @@ static ssize_t smb2_read_rdma_channel(struct ksmbd_= work *work, struct smb2_read_req *req, void *data_buf, size_t length) { - struct smb2_buffer_desc_v1 *desc =3D - (struct smb2_buffer_desc_v1 *)&req->Buffer[0]; int err; =20 err =3D ksmbd_conn_rdma_write(work->conn, data_buf, length, - le32_to_cpu(desc->token), - le64_to_cpu(desc->offset), - le32_to_cpu(desc->length)); + (struct smb2_buffer_desc_v1 *) + ((char *)req + le16_to_cpu(req->ReadChannelInfoOffset)), + le16_to_cpu(req->ReadChannelInfoLength)); if (err) return err; =20 @@ -6217,7 +6215,6 @@ int smb2_read(struct ksmbd_work *work) (struct smb2_buffer_desc_v1 *) ((char *)req + ch_offset), req->Channel, - req->ReadChannelInfoOffset, req->ReadChannelInfoLength); if (err) goto out; @@ -6395,21 +6392,18 @@ static ssize_t smb2_write_rdma_channel(struct ksmbd= _work *work, struct ksmbd_file *fp, loff_t offset, size_t length, bool sync) { - struct smb2_buffer_desc_v1 *desc; char *data_buf; int ret; ssize_t nbytes; =20 - desc =3D (struct smb2_buffer_desc_v1 *)&req->Buffer[0]; - data_buf =3D kvmalloc(length, GFP_KERNEL | __GFP_ZERO); if (!data_buf) return -ENOMEM; =20 ret =3D ksmbd_conn_rdma_read(work->conn, data_buf, length, - le32_to_cpu(desc->token), - le64_to_cpu(desc->offset), - le32_to_cpu(desc->length)); + (struct smb2_buffer_desc_v1 *) + ((char *)req + le16_to_cpu(req->WriteChannelInfoOffset)), + le16_to_cpu(req->WriteChannelInfoLength)); if (ret < 0) { kvfree(data_buf); return ret; @@ -6461,7 +6455,6 @@ int smb2_write(struct ksmbd_work *work) (struct smb2_buffer_desc_v1 *) ((char *)req + ch_offset), req->Channel, - req->WriteChannelInfoOffset, req->WriteChannelInfoLength); if (err) goto out; diff --git a/fs/ksmbd/transport_rdma.c b/fs/ksmbd/transport_rdma.c index 3f5d13571694..479d279ee146 100644 --- a/fs/ksmbd/transport_rdma.c +++ b/fs/ksmbd/transport_rdma.c @@ -1352,14 +1352,18 @@ static void write_done(struct ib_cq *cq, struct ib_= wc *wc) read_write_done(cq, wc, DMA_TO_DEVICE); } =20 -static int smb_direct_rdma_xmit(struct smb_direct_transport *t, void *buf, - int buf_len, u32 remote_key, u64 remote_offset, - u32 remote_len, bool is_read) +static int smb_direct_rdma_xmit(struct smb_direct_transport *t, + void *buf, int buf_len, + struct smb2_buffer_desc_v1 *desc, + unsigned int desc_len, + bool is_read) { struct smb_direct_rdma_rw_msg *msg; int ret; DECLARE_COMPLETION_ONSTACK(completion); struct ib_send_wr *first_wr =3D NULL; + u32 remote_key =3D le32_to_cpu(desc[0].token); + u64 remote_offset =3D le64_to_cpu(desc[0].offset); =20 ret =3D wait_for_credits(t, &t->wait_rw_avail_ops, &t->rw_avail_ops); if (ret < 0) @@ -1424,22 +1428,22 @@ static int smb_direct_rdma_xmit(struct smb_direct_t= ransport *t, void *buf, return ret; } =20 -static int smb_direct_rdma_write(struct ksmbd_transport *t, void *buf, - unsigned int buflen, u32 remote_key, - u64 remote_offset, u32 remote_len) +static int smb_direct_rdma_write(struct ksmbd_transport *t, + void *buf, unsigned int buflen, + struct smb2_buffer_desc_v1 *desc, + unsigned int desc_len) { return smb_direct_rdma_xmit(smb_trans_direct_transfort(t), buf, buflen, - remote_key, remote_offset, - remote_len, false); + desc, desc_len, false); } =20 -static int smb_direct_rdma_read(struct ksmbd_transport *t, void *buf, - unsigned int buflen, u32 remote_key, - u64 remote_offset, u32 remote_len) +static int smb_direct_rdma_read(struct ksmbd_transport *t, + void *buf, unsigned int buflen, + struct smb2_buffer_desc_v1 *desc, + unsigned int desc_len) { return smb_direct_rdma_xmit(smb_trans_direct_transfort(t), buf, buflen, - remote_key, remote_offset, - remote_len, true); + desc, desc_len, true); } =20 static void smb_direct_disconnect(struct ksmbd_transport *t) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C1E1C25B08 for ; Mon, 15 Aug 2022 23:37:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353705AbiHOXgD (ORCPT ); Mon, 15 Aug 2022 19:36:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353520AbiHOX2T (ORCPT ); Mon, 15 Aug 2022 19:28:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 658A714ECA3; Mon, 15 Aug 2022 13:07:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9BD3B60B69; Mon, 15 Aug 2022 20:07:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EFEFC433D6; Mon, 15 Aug 2022 20:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594068; bh=Ycp0s2Glg8mhvTj7X08fjKGg5VeHENMBJ1BiPadpejc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O1ZsTV26xlaci6EevSOFWAn5Ny/oRo5vfCF6c5UzPXn8I37x4BYvIXvEhO1ZI5S4F 6aQMZ0AbZwYrE/MgpB1MUo9AfGeUN0DpwIih/RCLNLFyPCeHE50UviiWfy+VHclBzW UHNo6EHeLMv5gmT/LajrUa+FN0vrHb8uEq31is1o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunchul Lee , Namjae Jeon , Steve French , Sasha Levin Subject: [PATCH 5.18 1050/1095] ksmbd: smbd: introduce read/write credits for RDMA read/write Date: Mon, 15 Aug 2022 20:07:29 +0200 Message-Id: <20220815180512.513026047@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hyunchul Lee [ Upstream commit ddbdc861e37c168cf2fb8a7b7477f5d18b4daf76 ] SMB2_READ/SMB2_WRITE request has to be granted the number of rw credits, the pages the request wants to transfer / the maximum pages which can be registered with one MR to read and write a file. And allocate enough RDMA resources for the maximum number of rw credits allowed by ksmbd. Signed-off-by: Hyunchul Lee Acked-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ksmbd/transport_rdma.c | 120 ++++++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 49 deletions(-) diff --git a/fs/ksmbd/transport_rdma.c b/fs/ksmbd/transport_rdma.c index 479d279ee146..b44a5e584bac 100644 --- a/fs/ksmbd/transport_rdma.c +++ b/fs/ksmbd/transport_rdma.c @@ -80,9 +80,7 @@ static int smb_direct_max_fragmented_recv_size =3D 1024 *= 1024; /* The maximum single-message size which can be received */ static int smb_direct_max_receive_size =3D 8192; =20 -static int smb_direct_max_read_write_size =3D 524224; - -static int smb_direct_max_outstanding_rw_ops =3D 8; +static int smb_direct_max_read_write_size =3D 8 * 1024 * 1024; =20 static LIST_HEAD(smb_direct_device_list); static DEFINE_RWLOCK(smb_direct_device_lock); @@ -147,10 +145,12 @@ struct smb_direct_transport { atomic_t send_credits; spinlock_t lock_new_recv_credits; int new_recv_credits; - atomic_t rw_avail_ops; + int max_rw_credits; + int pages_per_rw_credit; + atomic_t rw_credits; =20 wait_queue_head_t wait_send_credits; - wait_queue_head_t wait_rw_avail_ops; + wait_queue_head_t wait_rw_credits; =20 mempool_t *sendmsg_mempool; struct kmem_cache *sendmsg_cache; @@ -377,7 +377,7 @@ static struct smb_direct_transport *alloc_transport(str= uct rdma_cm_id *cm_id) t->reassembly_queue_length =3D 0; init_waitqueue_head(&t->wait_reassembly_queue); init_waitqueue_head(&t->wait_send_credits); - init_waitqueue_head(&t->wait_rw_avail_ops); + init_waitqueue_head(&t->wait_rw_credits); =20 spin_lock_init(&t->receive_credit_lock); spin_lock_init(&t->recvmsg_queue_lock); @@ -984,18 +984,19 @@ static int smb_direct_flush_send_list(struct smb_dire= ct_transport *t, } =20 static int wait_for_credits(struct smb_direct_transport *t, - wait_queue_head_t *waitq, atomic_t *credits) + wait_queue_head_t *waitq, atomic_t *total_credits, + int needed) { int ret; =20 do { - if (atomic_dec_return(credits) >=3D 0) + if (atomic_sub_return(needed, total_credits) >=3D 0) return 0; =20 - atomic_inc(credits); + atomic_add(needed, total_credits); ret =3D wait_event_interruptible(*waitq, - atomic_read(credits) > 0 || - t->status !=3D SMB_DIRECT_CS_CONNECTED); + atomic_read(total_credits) >=3D needed || + t->status !=3D SMB_DIRECT_CS_CONNECTED); =20 if (t->status !=3D SMB_DIRECT_CS_CONNECTED) return -ENOTCONN; @@ -1016,7 +1017,19 @@ static int wait_for_send_credits(struct smb_direct_t= ransport *t, return ret; } =20 - return wait_for_credits(t, &t->wait_send_credits, &t->send_credits); + return wait_for_credits(t, &t->wait_send_credits, &t->send_credits, 1); +} + +static int wait_for_rw_credits(struct smb_direct_transport *t, int credits) +{ + return wait_for_credits(t, &t->wait_rw_credits, &t->rw_credits, credits); +} + +static int calc_rw_credits(struct smb_direct_transport *t, + char *buf, unsigned int len) +{ + return DIV_ROUND_UP(get_buf_page_count(buf, len), + t->pages_per_rw_credit); } =20 static int smb_direct_create_header(struct smb_direct_transport *t, @@ -1332,8 +1345,8 @@ static void read_write_done(struct ib_cq *cq, struct = ib_wc *wc, smb_direct_disconnect_rdma_connection(t); } =20 - if (atomic_inc_return(&t->rw_avail_ops) > 0) - wake_up(&t->wait_rw_avail_ops); + if (atomic_inc_return(&t->rw_credits) > 0) + wake_up(&t->wait_rw_credits); =20 rdma_rw_ctx_destroy(&msg->rw_ctx, t->qp, t->qp->port, msg->sg_list, msg->sgt.nents, dir); @@ -1364,8 +1377,10 @@ static int smb_direct_rdma_xmit(struct smb_direct_tr= ansport *t, struct ib_send_wr *first_wr =3D NULL; u32 remote_key =3D le32_to_cpu(desc[0].token); u64 remote_offset =3D le64_to_cpu(desc[0].offset); + int credits_needed; =20 - ret =3D wait_for_credits(t, &t->wait_rw_avail_ops, &t->rw_avail_ops); + credits_needed =3D calc_rw_credits(t, buf, buf_len); + ret =3D wait_for_rw_credits(t, credits_needed); if (ret < 0) return ret; =20 @@ -1373,7 +1388,7 @@ static int smb_direct_rdma_xmit(struct smb_direct_tra= nsport *t, msg =3D kmalloc(offsetof(struct smb_direct_rdma_rw_msg, sg_list) + sizeof(struct scatterlist) * SG_CHUNK_SIZE, GFP_KERNEL); if (!msg) { - atomic_inc(&t->rw_avail_ops); + atomic_add(credits_needed, &t->rw_credits); return -ENOMEM; } =20 @@ -1382,7 +1397,7 @@ static int smb_direct_rdma_xmit(struct smb_direct_tra= nsport *t, get_buf_page_count(buf, buf_len), msg->sg_list, SG_CHUNK_SIZE); if (ret) { - atomic_inc(&t->rw_avail_ops); + atomic_add(credits_needed, &t->rw_credits); kfree(msg); return -ENOMEM; } @@ -1418,7 +1433,7 @@ static int smb_direct_rdma_xmit(struct smb_direct_tra= nsport *t, return 0; =20 err: - atomic_inc(&t->rw_avail_ops); + atomic_add(credits_needed, &t->rw_credits); if (first_wr) rdma_rw_ctx_destroy(&msg->rw_ctx, t->qp, t->qp->port, msg->sg_list, msg->sgt.nents, @@ -1643,11 +1658,19 @@ static int smb_direct_prepare_negotiation(struct sm= b_direct_transport *t) return ret; } =20 +static unsigned int smb_direct_get_max_fr_pages(struct smb_direct_transpor= t *t) +{ + return min_t(unsigned int, + t->cm_id->device->attrs.max_fast_reg_page_list_len, + 256); +} + static int smb_direct_init_params(struct smb_direct_transport *t, struct ib_qp_cap *cap) { struct ib_device *device =3D t->cm_id->device; - int max_send_sges, max_pages, max_rw_wrs, max_send_wrs; + int max_send_sges, max_rw_wrs, max_send_wrs; + unsigned int max_sge_per_wr, wrs_per_credit; =20 /* need 2 more sge. because a SMB_DIRECT header will be mapped, * and maybe a send buffer could be not page aligned. @@ -1659,25 +1682,31 @@ static int smb_direct_init_params(struct smb_direct= _transport *t, return -EINVAL; } =20 - /* - * allow smb_direct_max_outstanding_rw_ops of in-flight RDMA - * read/writes. HCA guarantees at least max_send_sge of sges for - * a RDMA read/write work request, and if memory registration is used, - * we need reg_mr, local_inv wrs for each read/write. + /* Calculate the number of work requests for RDMA R/W. + * The maximum number of pages which can be registered + * with one Memory region can be transferred with one + * R/W credit. And at least 4 work requests for each credit + * are needed for MR registration, RDMA R/W, local & remote + * MR invalidation. */ t->max_rdma_rw_size =3D smb_direct_max_read_write_size; - max_pages =3D DIV_ROUND_UP(t->max_rdma_rw_size, PAGE_SIZE) + 1; - max_rw_wrs =3D DIV_ROUND_UP(max_pages, SMB_DIRECT_MAX_SEND_SGES); - max_rw_wrs +=3D rdma_rw_mr_factor(device, t->cm_id->port_num, - max_pages) * 2; - max_rw_wrs *=3D smb_direct_max_outstanding_rw_ops; + t->pages_per_rw_credit =3D smb_direct_get_max_fr_pages(t); + t->max_rw_credits =3D DIV_ROUND_UP(t->max_rdma_rw_size, + (t->pages_per_rw_credit - 1) * + PAGE_SIZE); + + max_sge_per_wr =3D min_t(unsigned int, device->attrs.max_send_sge, + device->attrs.max_sge_rd); + wrs_per_credit =3D max_t(unsigned int, 4, + DIV_ROUND_UP(t->pages_per_rw_credit, + max_sge_per_wr) + 1); + max_rw_wrs =3D t->max_rw_credits * wrs_per_credit; =20 max_send_wrs =3D smb_direct_send_credit_target + max_rw_wrs; if (max_send_wrs > device->attrs.max_cqe || max_send_wrs > device->attrs.max_qp_wr) { - pr_err("consider lowering send_credit_target =3D %d, or max_outstanding_= rw_ops =3D %d\n", - smb_direct_send_credit_target, - smb_direct_max_outstanding_rw_ops); + pr_err("consider lowering send_credit_target =3D %d\n", + smb_direct_send_credit_target); pr_err("Possible CQE overrun, device reporting max_cqe %d max_qp_wr %d\n= ", device->attrs.max_cqe, device->attrs.max_qp_wr); return -EINVAL; @@ -1712,7 +1741,7 @@ static int smb_direct_init_params(struct smb_direct_t= ransport *t, =20 t->send_credit_target =3D smb_direct_send_credit_target; atomic_set(&t->send_credits, 0); - atomic_set(&t->rw_avail_ops, smb_direct_max_outstanding_rw_ops); + atomic_set(&t->rw_credits, t->max_rw_credits); =20 t->max_send_size =3D smb_direct_max_send_size; t->max_recv_size =3D smb_direct_max_receive_size; @@ -1720,12 +1749,10 @@ static int smb_direct_init_params(struct smb_direct= _transport *t, =20 cap->max_send_wr =3D max_send_wrs; cap->max_recv_wr =3D t->recv_credit_max; - cap->max_send_sge =3D SMB_DIRECT_MAX_SEND_SGES; + cap->max_send_sge =3D max_sge_per_wr; cap->max_recv_sge =3D SMB_DIRECT_MAX_RECV_SGES; cap->max_inline_data =3D 0; - cap->max_rdma_ctxs =3D - rdma_rw_mr_factor(device, t->cm_id->port_num, max_pages) * - smb_direct_max_outstanding_rw_ops; + cap->max_rdma_ctxs =3D t->max_rw_credits; return 0; } =20 @@ -1818,7 +1845,8 @@ static int smb_direct_create_qpair(struct smb_direct_= transport *t, } =20 t->send_cq =3D ib_alloc_cq(t->cm_id->device, t, - t->send_credit_target, 0, IB_POLL_WORKQUEUE); + smb_direct_send_credit_target + cap->max_rdma_ctxs, + 0, IB_POLL_WORKQUEUE); if (IS_ERR(t->send_cq)) { pr_err("Can't create RDMA send CQ\n"); ret =3D PTR_ERR(t->send_cq); @@ -1827,8 +1855,7 @@ static int smb_direct_create_qpair(struct smb_direct_= transport *t, } =20 t->recv_cq =3D ib_alloc_cq(t->cm_id->device, t, - cap->max_send_wr + cap->max_rdma_ctxs, - 0, IB_POLL_WORKQUEUE); + t->recv_credit_max, 0, IB_POLL_WORKQUEUE); if (IS_ERR(t->recv_cq)) { pr_err("Can't create RDMA recv CQ\n"); ret =3D PTR_ERR(t->recv_cq); @@ -1857,17 +1884,12 @@ static int smb_direct_create_qpair(struct smb_direc= t_transport *t, =20 pages_per_rw =3D DIV_ROUND_UP(t->max_rdma_rw_size, PAGE_SIZE) + 1; if (pages_per_rw > t->cm_id->device->attrs.max_sgl_rd) { - int pages_per_mr, mr_count; - - pages_per_mr =3D min_t(int, pages_per_rw, - t->cm_id->device->attrs.max_fast_reg_page_list_len); - mr_count =3D DIV_ROUND_UP(pages_per_rw, pages_per_mr) * - atomic_read(&t->rw_avail_ops); - ret =3D ib_mr_pool_init(t->qp, &t->qp->rdma_mrs, mr_count, - IB_MR_TYPE_MEM_REG, pages_per_mr, 0); + ret =3D ib_mr_pool_init(t->qp, &t->qp->rdma_mrs, + t->max_rw_credits, IB_MR_TYPE_MEM_REG, + t->pages_per_rw_credit, 0); if (ret) { pr_err("failed to init mr pool count %d pages %d\n", - mr_count, pages_per_mr); + t->max_rw_credits, t->pages_per_rw_credit); goto err; } } --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1EAFC00140 for ; Mon, 15 Aug 2022 23:35:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345526AbiHOXfb (ORCPT ); Mon, 15 Aug 2022 19:35:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245013AbiHOX3H (ORCPT ); Mon, 15 Aug 2022 19:29:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16A60BB908; Mon, 15 Aug 2022 13:07:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AD16AB81142; Mon, 15 Aug 2022 20:07:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A91FC433D6; Mon, 15 Aug 2022 20:07:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594074; bh=PubY1hmrGCf0b7CV+WmrD1xQ9cFgoAo/s7Yj5UkVxNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=margB09aOgF1l4NRzrTpPWFqnGcSUaJDufbfn1A4/D1sfuLIPj6TMC1C79tC4pFBD 7IIsWXCzYyZ2Z24tDmy6SZ5bs6fTbTI78ev8XWMR0sIpGkfZ0BRIMlj0cVkTYmfjCi uAEltIyYGt1mh+ndTu+L3cvc7wK2FqodP/GXiC00= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Hyunchul Lee , Steve French , Sasha Levin Subject: [PATCH 5.18 1051/1095] ksmbd: add smbd max io size parameter Date: Mon, 15 Aug 2022 20:07:30 +0200 Message-Id: <20220815180512.555659116@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namjae Jeon [ Upstream commit 65bb45b97b578c8eed1ffa80caec84708df49729 ] Add 'smbd max io size' parameter to adjust smbd-direct max read/write size. Signed-off-by: Namjae Jeon Reviewed-by: Hyunchul Lee Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ksmbd/ksmbd_netlink.h | 3 ++- fs/ksmbd/transport_ipc.c | 3 +++ fs/ksmbd/transport_rdma.c | 8 +++++++- fs/ksmbd/transport_rdma.h | 6 ++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/fs/ksmbd/ksmbd_netlink.h b/fs/ksmbd/ksmbd_netlink.h index ebe6ca08467a..52aa0adeb951 100644 --- a/fs/ksmbd/ksmbd_netlink.h +++ b/fs/ksmbd/ksmbd_netlink.h @@ -104,7 +104,8 @@ struct ksmbd_startup_request { */ __u32 sub_auth[3]; /* Subauth value for Security ID */ __u32 smb2_max_credits; /* MAX credits */ - __u32 reserved[128]; /* Reserved room */ + __u32 smbd_max_io_size; /* smbd read write size */ + __u32 reserved[127]; /* Reserved room */ __u32 ifc_list_sz; /* interfaces list size */ __s8 ____payload[]; }; diff --git a/fs/ksmbd/transport_ipc.c b/fs/ksmbd/transport_ipc.c index 3ad6881e0f7e..7cb0eeb07c80 100644 --- a/fs/ksmbd/transport_ipc.c +++ b/fs/ksmbd/transport_ipc.c @@ -26,6 +26,7 @@ #include "mgmt/ksmbd_ida.h" #include "connection.h" #include "transport_tcp.h" +#include "transport_rdma.h" =20 #define IPC_WAIT_TIMEOUT (2 * HZ) =20 @@ -303,6 +304,8 @@ static int ipc_server_config_on_startup(struct ksmbd_st= artup_request *req) init_smb2_max_trans_size(req->smb2_max_trans); if (req->smb2_max_credits) init_smb2_max_credits(req->smb2_max_credits); + if (req->smbd_max_io_size) + init_smbd_max_io_size(req->smbd_max_io_size); =20 ret =3D ksmbd_set_netbios_name(req->netbios_name); ret |=3D ksmbd_set_server_string(req->server_string); diff --git a/fs/ksmbd/transport_rdma.c b/fs/ksmbd/transport_rdma.c index b44a5e584bac..afc66b9765e7 100644 --- a/fs/ksmbd/transport_rdma.c +++ b/fs/ksmbd/transport_rdma.c @@ -80,7 +80,7 @@ static int smb_direct_max_fragmented_recv_size =3D 1024 *= 1024; /* The maximum single-message size which can be received */ static int smb_direct_max_receive_size =3D 8192; =20 -static int smb_direct_max_read_write_size =3D 8 * 1024 * 1024; +static int smb_direct_max_read_write_size =3D SMBD_DEFAULT_IOSIZE; =20 static LIST_HEAD(smb_direct_device_list); static DEFINE_RWLOCK(smb_direct_device_lock); @@ -214,6 +214,12 @@ struct smb_direct_rdma_rw_msg { struct scatterlist sg_list[]; }; =20 +void init_smbd_max_io_size(unsigned int sz) +{ + sz =3D clamp_val(sz, SMBD_MIN_IOSIZE, SMBD_MAX_IOSIZE); + smb_direct_max_read_write_size =3D sz; +} + static inline int get_buf_page_count(void *buf, int size) { return DIV_ROUND_UP((uintptr_t)buf + size, PAGE_SIZE) - diff --git a/fs/ksmbd/transport_rdma.h b/fs/ksmbd/transport_rdma.h index 5567d93a6f96..e7b4e6790fab 100644 --- a/fs/ksmbd/transport_rdma.h +++ b/fs/ksmbd/transport_rdma.h @@ -7,6 +7,10 @@ #ifndef __KSMBD_TRANSPORT_RDMA_H__ #define __KSMBD_TRANSPORT_RDMA_H__ =20 +#define SMBD_DEFAULT_IOSIZE (8 * 1024 * 1024) +#define SMBD_MIN_IOSIZE (512 * 1024) +#define SMBD_MAX_IOSIZE (16 * 1024 * 1024) + /* SMB DIRECT negotiation request packet [MS-SMBD] 2.2.1 */ struct smb_direct_negotiate_req { __le16 min_version; @@ -52,10 +56,12 @@ struct smb_direct_data_transfer { int ksmbd_rdma_init(void); void ksmbd_rdma_destroy(void); bool ksmbd_rdma_capable_netdev(struct net_device *netdev); +void init_smbd_max_io_size(unsigned int sz); #else static inline int ksmbd_rdma_init(void) { return 0; } static inline int ksmbd_rdma_destroy(void) { return 0; } static inline bool ksmbd_rdma_capable_netdev(struct net_device *netdev) { = return false; } +static inline void init_smbd_max_io_size(unsigned int sz) { } #endif =20 #endif /* __KSMBD_TRANSPORT_RDMA_H__ */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E211C25B0D for ; Mon, 15 Aug 2022 23:42:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354011AbiHOXks (ORCPT ); Mon, 15 Aug 2022 19:40:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232665AbiHOXha (ORCPT ); Mon, 15 Aug 2022 19:37:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 209A683BF1; Mon, 15 Aug 2022 13:09:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6683560B6E; Mon, 15 Aug 2022 20:09:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77478C43144; Mon, 15 Aug 2022 20:09:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594191; bh=QXTGSx7ODr0ZLVLHfecCAQdyOcrmgkVGa7p1m1KvxRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yiz1cTXLOYouXRJUfCSPTutkGEAh9bDQ5gcczP2tOiqhhVNWvkGXjR5HoXWCEg9Tx tR3R/sUyu19FcjyQCgJfkxu/5xZ4nyNhV+FQJJwYHqfIaTBM0IyDFcMq6oV8JBRBZc Ji7sANSAjv5itcUWUZmxoZf34JJHBTs0+o9hDK8Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Hyunchul Lee , Steve French , Sasha Levin Subject: [PATCH 5.18 1052/1095] ksmbd: fix wrong smbd max read/write size check Date: Mon, 15 Aug 2022 20:07:31 +0200 Message-Id: <20220815180512.596642150@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namjae Jeon [ Upstream commit 7a84399e1ce3f5f2fbec3e7dd93459ba25badc2f ] smb-direct max read/write size can be different with smb2 max read/write size. So smb2_read() can return error by wrong max read/write size check. This patch use smb_direct_max_read_write_size for this check in smb-direct read/write(). Signed-off-by: Namjae Jeon Reviewed-by: Hyunchul Lee Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ksmbd/smb2pdu.c | 39 +++++++++++++++++++++++++-------------- fs/ksmbd/transport_rdma.c | 5 +++++ fs/ksmbd/transport_rdma.h | 2 ++ 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index 8f86b8d6765f..6c8dd718b5db 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -6194,6 +6194,8 @@ int smb2_read(struct ksmbd_work *work) size_t length, mincount; ssize_t nbytes =3D 0, remain_bytes =3D 0; int err =3D 0; + bool is_rdma_channel =3D false; + unsigned int max_read_size =3D conn->vals->max_read_size; =20 WORK_BUFFERS(work, req, rsp); =20 @@ -6205,6 +6207,11 @@ int smb2_read(struct ksmbd_work *work) =20 if (req->Channel =3D=3D SMB2_CHANNEL_RDMA_V1_INVALIDATE || req->Channel =3D=3D SMB2_CHANNEL_RDMA_V1) { + is_rdma_channel =3D true; + max_read_size =3D get_smbd_max_read_write_size(); + } + + if (is_rdma_channel =3D=3D true) { unsigned int ch_offset =3D le16_to_cpu(req->ReadChannelInfoOffset); =20 if (ch_offset < offsetof(struct smb2_read_req, Buffer)) { @@ -6236,9 +6243,9 @@ int smb2_read(struct ksmbd_work *work) length =3D le32_to_cpu(req->Length); mincount =3D le32_to_cpu(req->MinimumCount); =20 - if (length > conn->vals->max_read_size) { + if (length > max_read_size) { ksmbd_debug(SMB, "limiting read size to max size(%u)\n", - conn->vals->max_read_size); + max_read_size); err =3D -EINVAL; goto out; } @@ -6270,8 +6277,7 @@ int smb2_read(struct ksmbd_work *work) ksmbd_debug(SMB, "nbytes %zu, offset %lld mincount %zu\n", nbytes, offset, mincount); =20 - if (req->Channel =3D=3D SMB2_CHANNEL_RDMA_V1_INVALIDATE || - req->Channel =3D=3D SMB2_CHANNEL_RDMA_V1) { + if (is_rdma_channel =3D=3D true) { /* write data to the client using rdma channel */ remain_bytes =3D smb2_read_rdma_channel(work, req, work->aux_payload_buf, @@ -6432,8 +6438,9 @@ int smb2_write(struct ksmbd_work *work) size_t length; ssize_t nbytes; char *data_buf; - bool writethrough =3D false; + bool writethrough =3D false, is_rdma_channel =3D false; int err =3D 0; + unsigned int max_write_size =3D work->conn->vals->max_write_size; =20 WORK_BUFFERS(work, req, rsp); =20 @@ -6442,8 +6449,17 @@ int smb2_write(struct ksmbd_work *work) return smb2_write_pipe(work); } =20 + offset =3D le64_to_cpu(req->Offset); + length =3D le32_to_cpu(req->Length); + if (req->Channel =3D=3D SMB2_CHANNEL_RDMA_V1 || req->Channel =3D=3D SMB2_CHANNEL_RDMA_V1_INVALIDATE) { + is_rdma_channel =3D true; + max_write_size =3D get_smbd_max_read_write_size(); + length =3D le32_to_cpu(req->RemainingBytes); + } + + if (is_rdma_channel =3D=3D true) { unsigned int ch_offset =3D le16_to_cpu(req->WriteChannelInfoOffset); =20 if (req->Length !=3D 0 || req->DataOffset !=3D 0 || @@ -6478,12 +6494,9 @@ int smb2_write(struct ksmbd_work *work) goto out; } =20 - offset =3D le64_to_cpu(req->Offset); - length =3D le32_to_cpu(req->Length); - - if (length > work->conn->vals->max_write_size) { + if (length > max_write_size) { ksmbd_debug(SMB, "limiting write size to max size(%u)\n", - work->conn->vals->max_write_size); + max_write_size); err =3D -EINVAL; goto out; } @@ -6491,8 +6504,7 @@ int smb2_write(struct ksmbd_work *work) if (le32_to_cpu(req->Flags) & SMB2_WRITEFLAG_WRITE_THROUGH) writethrough =3D true; =20 - if (req->Channel !=3D SMB2_CHANNEL_RDMA_V1 && - req->Channel !=3D SMB2_CHANNEL_RDMA_V1_INVALIDATE) { + if (is_rdma_channel =3D=3D false) { if ((u64)le16_to_cpu(req->DataOffset) + length > get_rfc1002_len(work->request_buf)) { pr_err("invalid write data offset %u, smb_len %u\n", @@ -6518,8 +6530,7 @@ int smb2_write(struct ksmbd_work *work) /* read data from the client using rdma channel, and * write the data. */ - nbytes =3D smb2_write_rdma_channel(work, req, fp, offset, - le32_to_cpu(req->RemainingBytes), + nbytes =3D smb2_write_rdma_channel(work, req, fp, offset, length, writethrough); if (nbytes < 0) { err =3D (int)nbytes; diff --git a/fs/ksmbd/transport_rdma.c b/fs/ksmbd/transport_rdma.c index afc66b9765e7..c6af8d89b7f7 100644 --- a/fs/ksmbd/transport_rdma.c +++ b/fs/ksmbd/transport_rdma.c @@ -220,6 +220,11 @@ void init_smbd_max_io_size(unsigned int sz) smb_direct_max_read_write_size =3D sz; } =20 +unsigned int get_smbd_max_read_write_size(void) +{ + return smb_direct_max_read_write_size; +} + static inline int get_buf_page_count(void *buf, int size) { return DIV_ROUND_UP((uintptr_t)buf + size, PAGE_SIZE) - diff --git a/fs/ksmbd/transport_rdma.h b/fs/ksmbd/transport_rdma.h index e7b4e6790fab..77aee4e5c9dc 100644 --- a/fs/ksmbd/transport_rdma.h +++ b/fs/ksmbd/transport_rdma.h @@ -57,11 +57,13 @@ int ksmbd_rdma_init(void); void ksmbd_rdma_destroy(void); bool ksmbd_rdma_capable_netdev(struct net_device *netdev); void init_smbd_max_io_size(unsigned int sz); +unsigned int get_smbd_max_read_write_size(void); #else static inline int ksmbd_rdma_init(void) { return 0; } static inline int ksmbd_rdma_destroy(void) { return 0; } static inline bool ksmbd_rdma_capable_netdev(struct net_device *netdev) { = return false; } static inline void init_smbd_max_io_size(unsigned int sz) { } +static inline unsigned int get_smbd_max_read_write_size(void) { return 0; } #endif =20 #endif /* __KSMBD_TRANSPORT_RDMA_H__ */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 648FBC00140 for ; Mon, 15 Aug 2022 23:44:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354281AbiHOXoL (ORCPT ); Mon, 15 Aug 2022 19:44:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354177AbiHOXlf (ORCPT ); Mon, 15 Aug 2022 19:41:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ED87155CB0; Mon, 15 Aug 2022 13:11:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9307860F0C; Mon, 15 Aug 2022 20:11:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ADB8C433D6; Mon, 15 Aug 2022 20:10:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594259; bh=fURGpxVz5I525vPI7qpZ0McbgzYcZ8ZMftWrLfsrvYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gOJFRRYoMCL9PZNfXio41LVYwX/GgTfJAolmpsLVQMx8j/c5K1b8x9SNi+E5cpGs8 /Q6ROxIZuf7ifJW3JiWgSjGYC00ku0jxqyb+PHs9jPopgccoTB8rklqFJY9KynNOzk ZeY11MF6ccVOGDG40DQSnPiuw+yx3AuJQuBuFk4Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunchul Lee , Namjae Jeon , Steve French , Sasha Levin , zdi-disclosures@trendmicro.com Subject: [PATCH 5.18 1053/1095] ksmbd: prevent out of bound read for SMB2_WRITE Date: Mon, 15 Aug 2022 20:07:32 +0200 Message-Id: <20220815180512.627050344@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hyunchul Lee [ Upstream commit ac60778b87e45576d7bfdbd6f53df902654e6f09 ] OOB read memory can be written to a file, if DataOffset is 0 and Length is too large in SMB2_WRITE request of compound request. To prevent this, when checking the length of the data area of SMB2_WRITE in smb2_get_data_area_len(), let the minimum of DataOffset be the size of SMB2 header + the size of SMB2_WRITE header. This bug can lead an oops looking something like: [ 798.008715] BUG: KASAN: slab-out-of-bounds in copy_page_from_iter_atomic= +0xd3d/0x14b0 [ 798.008724] Read of size 252 at addr ffff88800f863e90 by task kworker/0:= 2/2859 ... [ 798.008754] Call Trace: [ 798.008756] [ 798.008759] dump_stack_lvl+0x49/0x5f [ 798.008764] print_report.cold+0x5e/0x5cf [ 798.008768] ? __filemap_get_folio+0x285/0x6d0 [ 798.008774] ? copy_page_from_iter_atomic+0xd3d/0x14b0 [ 798.008777] kasan_report+0xaa/0x120 [ 798.008781] ? copy_page_from_iter_atomic+0xd3d/0x14b0 [ 798.008784] kasan_check_range+0x100/0x1e0 [ 798.008788] memcpy+0x24/0x60 [ 798.008792] copy_page_from_iter_atomic+0xd3d/0x14b0 [ 798.008795] ? pagecache_get_page+0x53/0x160 [ 798.008799] ? iov_iter_get_pages_alloc+0x1590/0x1590 [ 798.008803] ? ext4_write_begin+0xfc0/0xfc0 [ 798.008807] ? current_time+0x72/0x210 [ 798.008811] generic_perform_write+0x2c8/0x530 [ 798.008816] ? filemap_fdatawrite_wbc+0x180/0x180 [ 798.008820] ? down_write+0xb4/0x120 [ 798.008824] ? down_write_killable+0x130/0x130 [ 798.008829] ext4_buffered_write_iter+0x137/0x2c0 [ 798.008833] ext4_file_write_iter+0x40b/0x1490 [ 798.008837] ? __fsnotify_parent+0x275/0xb20 [ 798.008842] ? __fsnotify_update_child_dentry_flags+0x2c0/0x2c0 [ 798.008846] ? ext4_buffered_write_iter+0x2c0/0x2c0 [ 798.008851] __kernel_write+0x3a1/0xa70 [ 798.008855] ? __x64_sys_preadv2+0x160/0x160 [ 798.008860] ? security_file_permission+0x4a/0xa0 [ 798.008865] kernel_write+0xbb/0x360 [ 798.008869] ksmbd_vfs_write+0x27e/0xb90 [ksmbd] [ 798.008881] ? ksmbd_vfs_read+0x830/0x830 [ksmbd] [ 798.008892] ? _raw_read_unlock+0x2a/0x50 [ 798.008896] smb2_write+0xb45/0x14e0 [ksmbd] [ 798.008909] ? __kasan_check_write+0x14/0x20 [ 798.008912] ? _raw_spin_lock_bh+0xd0/0xe0 [ 798.008916] ? smb2_read+0x15e0/0x15e0 [ksmbd] [ 798.008927] ? memcpy+0x4e/0x60 [ 798.008931] ? _raw_spin_unlock+0x19/0x30 [ 798.008934] ? ksmbd_smb2_check_message+0x16af/0x2350 [ksmbd] [ 798.008946] ? _raw_spin_lock_bh+0xe0/0xe0 [ 798.008950] handle_ksmbd_work+0x30e/0x1020 [ksmbd] [ 798.008962] process_one_work+0x778/0x11c0 [ 798.008966] ? _raw_spin_lock_irq+0x8e/0xe0 [ 798.008970] worker_thread+0x544/0x1180 [ 798.008973] ? __cpuidle_text_end+0x4/0x4 [ 798.008977] kthread+0x282/0x320 [ 798.008982] ? process_one_work+0x11c0/0x11c0 [ 798.008985] ? kthread_complete_and_exit+0x30/0x30 [ 798.008989] ret_from_fork+0x1f/0x30 [ 798.008995] Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-17817 Signed-off-by: Hyunchul Lee Acked-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ksmbd/smb2misc.c | 7 +++++-- fs/ksmbd/smb2pdu.c | 8 +++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/ksmbd/smb2misc.c b/fs/ksmbd/smb2misc.c index 03bcd7ce0c75..6e25ace36568 100644 --- a/fs/ksmbd/smb2misc.c +++ b/fs/ksmbd/smb2misc.c @@ -131,8 +131,11 @@ static int smb2_get_data_area_len(unsigned int *off, u= nsigned int *len, *len =3D le16_to_cpu(((struct smb2_read_req *)hdr)->ReadChannelInfoLengt= h); break; case SMB2_WRITE: - if (((struct smb2_write_req *)hdr)->DataOffset) { - *off =3D le16_to_cpu(((struct smb2_write_req *)hdr)->DataOffset); + if (((struct smb2_write_req *)hdr)->DataOffset || + ((struct smb2_write_req *)hdr)->Length) { + *off =3D max_t(unsigned int, + le16_to_cpu(((struct smb2_write_req *)hdr)->DataOffset), + offsetof(struct smb2_write_req, Buffer)); *len =3D le32_to_cpu(((struct smb2_write_req *)hdr)->Length); break; } diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index 6c8dd718b5db..85a9ed7156ea 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -6505,14 +6505,12 @@ int smb2_write(struct ksmbd_work *work) writethrough =3D true; =20 if (is_rdma_channel =3D=3D false) { - if ((u64)le16_to_cpu(req->DataOffset) + length > - get_rfc1002_len(work->request_buf)) { - pr_err("invalid write data offset %u, smb_len %u\n", - le16_to_cpu(req->DataOffset), - get_rfc1002_len(work->request_buf)); + if (le16_to_cpu(req->DataOffset) < + offsetof(struct smb2_write_req, Buffer)) { err =3D -EINVAL; goto out; } + data_buf =3D (char *)(((char *)&req->hdr.ProtocolId) + le16_to_cpu(req->DataOffset)); =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 375E6C00140 for ; Mon, 15 Aug 2022 23:48:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354528AbiHOXsa (ORCPT ); Mon, 15 Aug 2022 19:48:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354232AbiHOXll (ORCPT ); Mon, 15 Aug 2022 19:41:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4E4E614A; Mon, 15 Aug 2022 13:11:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 786796077B; Mon, 15 Aug 2022 20:11:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63E5AC433C1; Mon, 15 Aug 2022 20:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594277; bh=ECYLy6ZnFKRuF+2gIewQOS7C8kcMwJoNV5HEHpGO02I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oIbewXdUyfAcOZNuwzEBddBydJ1oW4G7l1IuZfpd5YkHs0mEBVL4xBB8JSlFehD2M Otu0v7gG1pgIwlYaXS1SeFKKuRq1cjsxYiAmI+AQcUyuii5c5h2JRW8f9jHFRGLVgB uCwvKE5+str4VFLe1OKhlTRqYVHyXJ7nhb6M9xBA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , stable@kernel.org, Andreas Dilger , Sasha Levin Subject: [PATCH 5.18 1054/1095] ext4: update s_overhead_clusters in the superblock during an on-line resize Date: Mon, 15 Aug 2022 20:07:33 +0200 Message-Id: <20220815180512.668476663@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Theodore Ts'o [ Upstream commit de394a86658ffe4e89e5328fd4993abfe41b7435 ] When doing an online resize, the on-disk superblock on-disk wasn't updated. This means that when the file system is unmounted and remounted, and the on-disk overhead value is non-zero, this would result in the results of statfs(2) to be incorrect. This was partially fixed by Commits 10b01ee92df5 ("ext4: fix overhead calculation to account for the reserved gdt blocks"), 85d825dbf489 ("ext4: force overhead calculation if the s_overhead_cluster makes no sense"), and eb7054212eac ("ext4: update the cached overhead value in the superblock"). However, since it was too expensive to forcibly recalculate the overhead for bigalloc file systems at every mount, this didn't fix the problem for bigalloc file systems. This commit should address the problem when resizing file systems with the bigalloc feature enabled. Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Reviewed-by: Andreas Dilger Link: https://lore.kernel.org/r/20220629040026.112371-1-tytso@mit.edu Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ext4/resize.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 8b70a4701293..e5c2713aa11a 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -1484,6 +1484,7 @@ static void ext4_update_super(struct super_block *sb, * Update the fs overhead information */ ext4_calculate_overhead(sb); + es->s_overhead_clusters =3D cpu_to_le32(sbi->s_overhead); =20 if (test_opt(sb, DEBUG)) printk(KERN_DEBUG "EXT4-fs: added group %u:" --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B088C28B2C for ; Mon, 15 Aug 2022 23:37:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353782AbiHOXg1 (ORCPT ); Mon, 15 Aug 2022 19:36:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353433AbiHOXbk (ORCPT ); Mon, 15 Aug 2022 19:31:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 919F214F97C; Mon, 15 Aug 2022 13:08:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8CB0160B6E; Mon, 15 Aug 2022 20:08:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97F19C433C1; Mon, 15 Aug 2022 20:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594093; bh=qbzUrqN7cH0JP7uC2Tl4OalEZ7Wbjp6GiUMN+PORSdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zGJsLcPEu4VGkYlSlCo2vlCPEIdfOsRSexEd8ljeM3DkD6YNUa7zqb1Z/iYjynFR+ 98ioYc8UedVte2xhp/a3Bw2SSNhuCXS199yOqPa7S+awO54vKAahVRR9S9n0d/HYsR RneL7NgOFoCVJmO6r+RfbzhmYBjR5pmp3LFnrywc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Eric Whitney , Theodore Tso , Sasha Levin Subject: [PATCH 5.18 1055/1095] ext4: fix extent status tree race in writeback error recovery path Date: Mon, 15 Aug 2022 20:07:34 +0200 Message-Id: <20220815180512.700807649@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Whitney [ Upstream commit 7f0d8e1d607c1a4fa9a27362a108921d82230874 ] A race can occur in the unlikely event ext4 is unable to allocate a physical cluster for a delayed allocation in a bigalloc file system during writeback. Failure to allocate a cluster forces error recovery that includes a call to mpage_release_unused_pages(). That function removes any corresponding delayed allocated blocks from the extent status tree. If a new delayed write is in progress on the same cluster simultaneously, resulting in the addition of an new extent containing one or more blocks in that cluster to the extent status tree, delayed block accounting can be thrown off if that delayed write then encounters a similar cluster allocation failure during future writeback. Write lock the i_data_sem in mpage_release_unused_pages() to fix this problem. Ext4's block/cluster accounting code for bigalloc relies on i_data_sem for mutual exclusion, as is found in the delayed write path, and the locking in mpage_release_unused_pages() is missing. Cc: stable@kernel.org Reported-by: Ye Bin Signed-off-by: Eric Whitney Link: https://lore.kernel.org/r/20220615160530.1928801-1-enwlinux@gmail.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ext4/inode.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index beed9e32571c..826e2deb10f8 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1559,7 +1559,14 @@ static void mpage_release_unused_pages(struct mpage_= da_data *mpd, ext4_lblk_t start, last; start =3D index << (PAGE_SHIFT - inode->i_blkbits); last =3D end << (PAGE_SHIFT - inode->i_blkbits); + + /* + * avoid racing with extent status tree scans made by + * ext4_insert_delayed_block() + */ + down_write(&EXT4_I(inode)->i_data_sem); ext4_es_remove_extent(inode, start, last - start + 1); + up_write(&EXT4_I(inode)->i_data_sem); } =20 pagevec_init(&pvec); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19332C00140 for ; Mon, 15 Aug 2022 23:37:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353560AbiHOXhk (ORCPT ); Mon, 15 Aug 2022 19:37:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353612AbiHOXcF (ORCPT ); Mon, 15 Aug 2022 19:32:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6087150169; Mon, 15 Aug 2022 13:08:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EC7AF6069F; Mon, 15 Aug 2022 20:08:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2D2AC433C1; Mon, 15 Aug 2022 20:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594099; bh=AJ9Cae9twUPm3oRt+U4Os2vYeJaUHtnMyscaHzAnWyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AvanK4xyHqh/iXDwJCPL6aoTS+pm0HX8hbeuqorn04d9FPhaKZE13bpVcd1ZoeX7k pjL/aN+prNGPZCW/0szg+aam9YDZPlA9ytx/sSanjr+pBo7wuaG1kw/4UtcUlshCH3 SQ3mGRUyJXa9DiXIWCdmTW/8NLSA88ztr5JKGLs8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baokun Li , Jan Kara , "Ritesh Harjani (IBM)" , Theodore Tso , Sasha Levin Subject: [PATCH 5.18 1056/1095] ext4: add EXT4_INODE_HAS_XATTR_SPACE macro in xattr.h Date: Mon, 15 Aug 2022 20:07:35 +0200 Message-Id: <20220815180512.742230869@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baokun Li [ Upstream commit 179b14152dcb6a24c3415200603aebca70ff13af ] When adding an xattr to an inode, we must ensure that the inode_size is not less than EXT4_GOOD_OLD_INODE_SIZE + extra_isize + pad. Otherwise, the end position may be greater than the start position, resulting in UAF. Signed-off-by: Baokun Li Reviewed-by: Jan Kara Reviewed-by: Ritesh Harjani (IBM) Link: https://lore.kernel.org/r/20220616021358.2504451-2-libaokun1@huawei.c= om Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ext4/xattr.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h index 77efb9a627ad..f885f362add4 100644 --- a/fs/ext4/xattr.h +++ b/fs/ext4/xattr.h @@ -95,6 +95,19 @@ struct ext4_xattr_entry { =20 #define EXT4_ZERO_XATTR_VALUE ((void *)-1) =20 +/* + * If we want to add an xattr to the inode, we should make sure that + * i_extra_isize is not 0 and that the inode size is not less than + * EXT4_GOOD_OLD_INODE_SIZE + extra_isize + pad. + * EXT4_GOOD_OLD_INODE_SIZE extra_isize header entry pad data + * |--------------------------|------------|------|---------|---|-------| + */ +#define EXT4_INODE_HAS_XATTR_SPACE(inode) \ + ((EXT4_I(inode)->i_extra_isize !=3D 0) && \ + (EXT4_GOOD_OLD_INODE_SIZE + EXT4_I(inode)->i_extra_isize + \ + sizeof(struct ext4_xattr_ibody_header) + EXT4_XATTR_PAD <=3D \ + EXT4_INODE_SIZE((inode)->i_sb))) + struct ext4_xattr_info { const char *name; const void *value; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC1D1C25B08 for ; Mon, 15 Aug 2022 23:37:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353496AbiHOXhd (ORCPT ); Mon, 15 Aug 2022 19:37:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244663AbiHOXch (ORCPT ); Mon, 15 Aug 2022 19:32:37 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7EDB150BA1; Mon, 15 Aug 2022 13:08:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 09DA9CE12E7; Mon, 15 Aug 2022 20:08:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C29CCC433D6; Mon, 15 Aug 2022 20:08:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594105; bh=wlL1Y8aNRe0v0Bc7HGBJS/rY5In1hAG+X05x15i94HY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tb4rRmi5b7IdaCUTcG61qba8+Sw8YwFCQJHJUApSeD6MjtiWbrc+h7n9/MaozKE3X hU/SueOr11stxO8S3gZXl6aN1u+HRllScI+EhmkphMICXV5viTRZD5a0/LJJteVVM+ UgLblBO1K2lIQD4/UEa2mGrcPdsVm/jjAP8Xwbpw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Hulk Robot , Baokun Li , "Ritesh Harjani (IBM)" , Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.18 1057/1095] ext4: fix use-after-free in ext4_xattr_set_entry Date: Mon, 15 Aug 2022 20:07:36 +0200 Message-Id: <20220815180512.774510385@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baokun Li [ Upstream commit 67d7d8ad99beccd9fe92d585b87f1760dc9018e3 ] Hulk Robot reported a issue: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BUG: KASAN: use-after-free in ext4_xattr_set_entry+0x18ab/0x3500 Write of size 4105 at addr ffff8881675ef5f4 by task syz-executor.0/7092 CPU: 1 PID: 7092 Comm: syz-executor.0 Not tainted 4.19.90-dirty #17 Call Trace: [...] memcpy+0x34/0x50 mm/kasan/kasan.c:303 ext4_xattr_set_entry+0x18ab/0x3500 fs/ext4/xattr.c:1747 ext4_xattr_ibody_inline_set+0x86/0x2a0 fs/ext4/xattr.c:2205 ext4_xattr_set_handle+0x940/0x1300 fs/ext4/xattr.c:2386 ext4_xattr_set+0x1da/0x300 fs/ext4/xattr.c:2498 __vfs_setxattr+0x112/0x170 fs/xattr.c:149 __vfs_setxattr_noperm+0x11b/0x2a0 fs/xattr.c:180 __vfs_setxattr_locked+0x17b/0x250 fs/xattr.c:238 vfs_setxattr+0xed/0x270 fs/xattr.c:255 setxattr+0x235/0x330 fs/xattr.c:520 path_setxattr+0x176/0x190 fs/xattr.c:539 __do_sys_lsetxattr fs/xattr.c:561 [inline] __se_sys_lsetxattr fs/xattr.c:557 [inline] __x64_sys_lsetxattr+0xc2/0x160 fs/xattr.c:557 do_syscall_64+0xdf/0x530 arch/x86/entry/common.c:298 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x459fe9 RSP: 002b:00007fa5e54b4c08 EFLAGS: 00000246 ORIG_RAX: 00000000000000bd RAX: ffffffffffffffda RBX: 000000000051bf60 RCX: 0000000000459fe9 RDX: 00000000200003c0 RSI: 0000000020000180 RDI: 0000000020000140 RBP: 000000000051bf60 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000001009 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc73c93fc0 R14: 000000000051bf60 R15: 00007fa5e54b4d80 [...] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Above issue may happen as follows: Reported-by: Hulk Robot Reviewed-by: Jan Kara Reviewed-by: Ritesh Harjani (IBM) Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan ------------------------------------- ext4_xattr_set ext4_xattr_set_handle ext4_xattr_ibody_find >> s->end < s->base >> no EXT4_STATE_XATTR >> xattr_check_inode is not executed ext4_xattr_ibody_set ext4_xattr_set_entry >> size_t min_offs =3D s->end - s->base >> UAF in memcpy we can easily reproduce this problem with the following commands: mkfs.ext4 -F /dev/sda mount -o debug_want_extra_isize=3D128 /dev/sda /mnt touch /mnt/file setfattr -n user.cat -v `seq -s z 4096|tr -d '[:digit:]'` /mnt/file In ext4_xattr_ibody_find, we have the following assignment logic: header =3D IHDR(inode, raw_inode) =3D raw_inode + EXT4_GOOD_OLD_INODE_SIZE + i_extra_isize is->s.base =3D IFIRST(header) =3D header + sizeof(struct ext4_xattr_ibody_header) is->s.end =3D raw_inode + s_inode_size In ext4_xattr_set_entry min_offs =3D s->end - s->base =3D s_inode_size - EXT4_GOOD_OLD_INODE_SIZE - i_extra_isize - sizeof(struct ext4_xattr_ibody_header) last =3D s->first free =3D min_offs - ((void *)last - s->base) - sizeof(__u32) =3D s_inode_size - EXT4_GOOD_OLD_INODE_SIZE - i_extra_isize - sizeof(struct ext4_xattr_ibody_header) - sizeof(__u32) In the calculation formula, all values except s_inode_size and i_extra_size are fixed values. When i_extra_size is the maximum value s_inode_size - EXT4_GOOD_OLD_INODE_SIZE, min_offs is -4 and free is -8. The value overflows. As a result, the preceding issue is triggered when memcpy is executed. Therefore, when finding xattr or setting xattr, check whether there is space for storing xattr in the inode to resolve this issue. Cc: stable@kernel.org Reported-by: Hulk Robot Signed-off-by: Baokun Li Reviewed-by: Ritesh Harjani (IBM) Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220616021358.2504451-3-libaokun1@huawei.c= om Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/xattr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 042325349098..c3c3194f3ee1 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -2176,8 +2176,9 @@ int ext4_xattr_ibody_find(struct inode *inode, struct= ext4_xattr_info *i, struct ext4_inode *raw_inode; int error; =20 - if (EXT4_I(inode)->i_extra_isize =3D=3D 0) + if (!EXT4_INODE_HAS_XATTR_SPACE(inode)) return 0; + raw_inode =3D ext4_raw_inode(&is->iloc); header =3D IHDR(inode, raw_inode); is->s.base =3D is->s.first =3D IFIRST(header); @@ -2205,8 +2206,9 @@ int ext4_xattr_ibody_set(handle_t *handle, struct ino= de *inode, struct ext4_xattr_search *s =3D &is->s; int error; =20 - if (EXT4_I(inode)->i_extra_isize =3D=3D 0) + if (!EXT4_INODE_HAS_XATTR_SPACE(inode)) return -ENOSPC; + error =3D ext4_xattr_set_entry(i, s, handle, inode, false /* is_block */); if (error) return error; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63852C00140 for ; Mon, 15 Aug 2022 23:38:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353688AbiHOXiK (ORCPT ); Mon, 15 Aug 2022 19:38:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345797AbiHOXdt (ORCPT ); Mon, 15 Aug 2022 19:33:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 099B2150BBC; Mon, 15 Aug 2022 13:08:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5CDDB60DE3; Mon, 15 Aug 2022 20:08:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63FE9C433D6; Mon, 15 Aug 2022 20:08:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594111; bh=RmNKvD35h9Y3GLfCIV0/RmfmsLrHutDhGr23sfglY6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uo0ppJNZVdKAcHxEFdJaH4ujDrgTYsh/NRZZ/Aw+OX6YTjj+aKrAYQUVAt4gvfjDy O5YHwxAUnmw1XJK0FrRtEUtElWBuVo+6qdgYlXGGiUa8uzVIOvop+ScEXfIRzB8opN OocK4PnPLi0n1Z006ELKxLGiWdxtskie54ZbRHKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Baokun Li , "Ritesh Harjani (IBM)" , Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.18 1058/1095] ext4: correct max_inline_xattr_value_size computing Date: Mon, 15 Aug 2022 20:07:37 +0200 Message-Id: <20220815180512.805385354@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baokun Li [ Upstream commit c9fd167d57133c5b748d16913c4eabc55e531c73 ] If the ext4 inode does not have xattr space, 0 is returned in the get_max_inline_xattr_value_size function. Otherwise, the function returns a negative value when the inode does not contain EXT4_STATE_XATTR. Cc: stable@kernel.org Signed-off-by: Baokun Li Reviewed-by: Ritesh Harjani (IBM) Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220616021358.2504451-4-libaokun1@huawei.c= om Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ext4/inline.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index e9ef5cf30969..84fcd06a8e8a 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -35,6 +35,9 @@ static int get_max_inline_xattr_value_size(struct inode *= inode, struct ext4_inode *raw_inode; int free, min_offs; =20 + if (!EXT4_INODE_HAS_XATTR_SPACE(inode)) + return 0; + min_offs =3D EXT4_SB(inode->i_sb)->s_inode_size - EXT4_GOOD_OLD_INODE_SIZE - EXT4_I(inode)->i_extra_isize - --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49369C00140 for ; Mon, 15 Aug 2022 23:38:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353838AbiHOXil (ORCPT ); Mon, 15 Aug 2022 19:38:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346117AbiHOXds (ORCPT ); Mon, 15 Aug 2022 19:33:48 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29371959C; Mon, 15 Aug 2022 13:08:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 9314BCE12E7; Mon, 15 Aug 2022 20:08:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C9D3C433C1; Mon, 15 Aug 2022 20:08:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594117; bh=ZnymPQFspFL40QedNmT9etLRZlQVld7+zT63dbaFmGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YMzUsz9j5m0iYJLWSAcTvkT/q/QWJEfqkMnKunDnDMCaa9+8Mgaq9md6co5dJDGIp zNWJMLZipHn6QDhOnZbmavBz7E43vz4XJ+WQZPt+FNUjaLmXBjvdkwVZaAA06nDvAk anBUxQOrxq8FRgk2qaLfh6ijLq2uWIWlE+Xybo0M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Baokun Li , "Ritesh Harjani (IBM)" , Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.18 1059/1095] ext4: correct the misjudgment in ext4_iget_extra_inode Date: Mon, 15 Aug 2022 20:07:38 +0200 Message-Id: <20220815180512.842967020@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baokun Li [ Upstream commit fd7e672ea98b95b9d4c9dae316639f03c16a749d ] Use the EXT4_INODE_HAS_XATTR_SPACE macro to more accurately determine whether the inode have xattr space. Cc: stable@kernel.org Signed-off-by: Baokun Li Reviewed-by: Ritesh Harjani (IBM) Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220616021358.2504451-5-libaokun1@huawei.c= om Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ext4/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 826e2deb10f8..e478cac3b8f2 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4681,8 +4681,7 @@ static inline int ext4_iget_extra_inode(struct inode = *inode, __le32 *magic =3D (void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize; =20 - if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize + sizeof(__le32) <=3D - EXT4_INODE_SIZE(inode->i_sb) && + if (EXT4_INODE_HAS_XATTR_SPACE(inode) && *magic =3D=3D cpu_to_le32(EXT4_XATTR_MAGIC)) { ext4_set_inode_state(inode, EXT4_STATE_XATTR); return ext4_find_inline_data_nolock(inode); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 240B5C00140 for ; Mon, 15 Aug 2022 23:37:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353679AbiHOXhz (ORCPT ); Mon, 15 Aug 2022 19:37:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346135AbiHOXds (ORCPT ); Mon, 15 Aug 2022 19:33:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 500653DF33; Mon, 15 Aug 2022 13:08:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F0612B80EAB; Mon, 15 Aug 2022 20:08:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47CA4C433C1; Mon, 15 Aug 2022 20:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594127; bh=bjeh28CCsaCSegsI7JD1Z+8K+VqCVOxgFvTP1Iv6SyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f7ssJzaw4ZcoHrNV6KxLCxWurvsAaZkQMF9BIFAPNPbalyOXGGYpMatKdzyPbybz2 KqBx/eHLseH9mo9QtC5ewNLGt0E3819y9aEnz6tFwYXV8kiyf8pakl9vPEK2dcdLNG mkrUnD8BEiyMrUT4IR+OwF/iuDyzNxvi+wMX5bEo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Bin , Theodore Tso , stable@kernel.org, Sasha Levin Subject: [PATCH 5.18 1060/1095] ext4: fix warning in ext4_iomap_begin as race between bmap and write Date: Mon, 15 Aug 2022 20:07:39 +0200 Message-Id: <20220815180512.888049886@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ye Bin [ Upstream commit 51ae846cff568c8c29921b1b28eb2dfbcd4ac12d ] We got issue as follows: Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan ------------[ cut here ]------------ WARNING: CPU: 3 PID: 9310 at fs/ext4/inode.c:3441 ext4_iomap_begin+0x182/0x= 5d0 RIP: 0010:ext4_iomap_begin+0x182/0x5d0 RSP: 0018:ffff88812460fa08 EFLAGS: 00010293 RAX: ffff88811f168000 RBX: 0000000000000000 RCX: ffffffff97793c12 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003 RBP: ffff88812c669160 R08: ffff88811f168000 R09: ffffed10258cd20f R10: ffff88812c669077 R11: ffffed10258cd20e R12: 0000000000000001 R13: 00000000000000a4 R14: 000000000000000c R15: ffff88812c6691ee FS: 00007fd0d6ff3740(0000) GS:ffff8883af180000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fd0d6dda290 CR3: 0000000104a62000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: iomap_apply+0x119/0x570 iomap_bmap+0x124/0x150 ext4_bmap+0x14f/0x250 bmap+0x55/0x80 do_vfs_ioctl+0x952/0xbd0 __x64_sys_ioctl+0xc6/0x170 do_syscall_64+0x33/0x40 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Above issue may happen as follows: bmap write bmap ext4_bmap iomap_bmap ext4_iomap_begin ext4_file_write_iter ext4_buffered_write_iter generic_perform_write ext4_da_write_begin ext4_da_write_inline_data_begin ext4_prepare_inline_data ext4_create_inline_data ext4_set_inode_flag(inode, EXT4_INODE_INLINE_DATA); if (WARN_ON_ONCE(ext4_has_inline_data(inode))) ->trigger bug_on To solved above issue hold inode lock in ext4_bamp. Signed-off-by: Ye Bin Link: https://lore.kernel.org/r/20220617013935.397596-1-yebin10@huawei.com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Sasha Levin --- fs/ext4/inode.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index e478cac3b8f2..9ef6f41a5250 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3137,13 +3137,15 @@ static sector_t ext4_bmap(struct address_space *map= ping, sector_t block) { struct inode *inode =3D mapping->host; journal_t *journal; + sector_t ret =3D 0; int err; =20 + inode_lock_shared(inode); /* * We can get here for an inline file via the FIBMAP ioctl */ if (ext4_has_inline_data(inode)) - return 0; + goto out; =20 if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY) && test_opt(inode->i_sb, DELALLOC)) { @@ -3182,10 +3184,14 @@ static sector_t ext4_bmap(struct address_space *map= ping, sector_t block) jbd2_journal_unlock_updates(journal); =20 if (err) - return 0; + goto out; } =20 - return iomap_bmap(mapping, block, &ext4_iomap_ops); + ret =3D iomap_bmap(mapping, block, &ext4_iomap_ops); + +out: + inode_unlock_shared(inode); + return ret; } =20 static int ext4_readpage(struct file *file, struct page *page) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23603C25B0E for ; Mon, 15 Aug 2022 23:38:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353818AbiHOXi3 (ORCPT ); Mon, 15 Aug 2022 19:38:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346510AbiHOXdz (ORCPT ); Mon, 15 Aug 2022 19:33:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E687141D22; Mon, 15 Aug 2022 13:08:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 786C760B6E; Mon, 15 Aug 2022 20:08:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 683D2C433C1; Mon, 15 Aug 2022 20:08:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594133; bh=MocSc+kjVl31gpAfXFOr29Q2CZ+U55YySsFzpGjechA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rAWTmoBeQTPvMTjlWFba/ovARp0RB6FH4sXzT5ebRE0LCkZ2tCQRSkJW++ydn8/4f WMKWOK8tlGwykSHFGc4vPDCoOoJi8ZrU24dd+v8eh1HX5e1aUqLUIYnYj2WxtuOfqI pqC0dwDayb72yYa6Mus7D0rFX5XmbodTClvg4iMU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Czerner , Andreas Dilger , Theodore Tso , Sasha Levin Subject: [PATCH 5.18 1061/1095] ext4: check if directory block is within i_size Date: Mon, 15 Aug 2022 20:07:40 +0200 Message-Id: <20220815180512.921755458@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Czerner [ Upstream commit 65f8ea4cd57dbd46ea13b41dc8bac03176b04233 ] Currently ext4 directory handling code implicitly assumes that the directory blocks are always within the i_size. In fact ext4_append() will attempt to allocate next directory block based solely on i_size and the i_size is then appropriately increased after a successful allocation. However, for this to work it requires i_size to be correct. If, for any reason, the directory inode i_size is corrupted in a way that the directory tree refers to a valid directory block past i_size, we could end up corrupting parts of the directory tree structure by overwriting already used directory blocks when modifying the directory. Fix it by catching the corruption early in __ext4_read_dirblock(). Addresses Red-Hat-Bugzilla: #2070205 CVE: CVE-2022-1184 Signed-off-by: Lukas Czerner Cc: stable@vger.kernel.org Reviewed-by: Andreas Dilger Link: https://lore.kernel.org/r/20220704142721.157985-1-lczerner@redhat.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ext4/namei.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 4f0420b1ff3e..2bc3e4b27204 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -110,6 +110,13 @@ static struct buffer_head *__ext4_read_dirblock(struct= inode *inode, struct ext4_dir_entry *dirent; int is_dx_block =3D 0; =20 + if (block >=3D inode->i_size) { + ext4_error_inode(inode, func, line, block, + "Attempting to read directory block (%u) that is past i_size (%ll= u)", + block, inode->i_size); + return ERR_PTR(-EFSCORRUPTED); + } + if (ext4_simulate_fail(inode->i_sb, EXT4_SIM_DIRBLOCK_EIO)) bh =3D ERR_PTR(-EIO); else --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BE47C00140 for ; Mon, 15 Aug 2022 23:38:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353851AbiHOXir (ORCPT ); Mon, 15 Aug 2022 19:38:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233663AbiHOXeC (ORCPT ); Mon, 15 Aug 2022 19:34:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE0D065645; Mon, 15 Aug 2022 13:09:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4876860B6E; Mon, 15 Aug 2022 20:09:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BE09C433C1; Mon, 15 Aug 2022 20:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594139; bh=QNFvrSfmF8jPkO6xUgA/cBgya04LXm/x8wg9L+Oyn58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dm/cD26K5fi7Fn3wbY4Y1NOttyccfcVsPa7NW6eND7ySTgyCIS6LpSyLLA1Jdq0Ea 1iItk3WeQyyKWxWhB3Eph7D2Dq9K84kZhCaOVkteJLGhbRXyqInlUWbBYdzr5xsPnp rna53rHQlaAnCfa0yl0fHMxX8BNyZ8aGsyHEQc7M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Lukas Czerner , Andreas Dilger , Theodore Tso , Sasha Levin Subject: [PATCH 5.18 1062/1095] ext4: make sure ext4_append() always allocates new block Date: Mon, 15 Aug 2022 20:07:41 +0200 Message-Id: <20220815180512.959795540@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Czerner [ Upstream commit b8a04fe77ef1360fbf73c80fddbdfeaa9407ed1b ] ext4_append() must always allocate a new block, otherwise we run the risk of overwriting existing directory block corrupting the directory tree in the process resulting in all manner of problems later on. Add a sanity check to see if the logical block is already allocated and error out if it is. Cc: stable@kernel.org Signed-off-by: Lukas Czerner Reviewed-by: Andreas Dilger Link: https://lore.kernel.org/r/20220704142721.157985-2-lczerner@redhat.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ext4/namei.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 2bc3e4b27204..13b6265848c2 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -54,6 +54,7 @@ static struct buffer_head *ext4_append(handle_t *handle, struct inode *inode, ext4_lblk_t *block) { + struct ext4_map_blocks map; struct buffer_head *bh; int err; =20 @@ -63,6 +64,21 @@ static struct buffer_head *ext4_append(handle_t *handle, return ERR_PTR(-ENOSPC); =20 *block =3D inode->i_size >> inode->i_sb->s_blocksize_bits; + map.m_lblk =3D *block; + map.m_len =3D 1; + + /* + * We're appending new directory block. Make sure the block is not + * allocated yet, otherwise we will end up corrupting the + * directory. + */ + err =3D ext4_map_blocks(NULL, inode, &map, 0); + if (err < 0) + return ERR_PTR(err); + if (err) { + EXT4_ERROR_INODE(inode, "Logical block already allocated"); + return ERR_PTR(-EFSCORRUPTED); + } =20 bh =3D ext4_bread(handle, inode, *block, EXT4_GET_BLOCKS_CREATE); if (IS_ERR(bh)) --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7CF9C00140 for ; Mon, 15 Aug 2022 23:39:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353867AbiHOXjB (ORCPT ); Mon, 15 Aug 2022 19:39:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353617AbiHOXfo (ORCPT ); Mon, 15 Aug 2022 19:35:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B716672ED5; Mon, 15 Aug 2022 13:09:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 30D95B80EAD; Mon, 15 Aug 2022 20:09:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 736B0C433D6; Mon, 15 Aug 2022 20:09:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594145; bh=cNi4JLBqXW0guprOQqIvlJggX6vKfUgM0ghIRDf5R5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gl8aVdF3Ym9cvWWEY0/1Y9pTq/a10x+7H6dnyOwwFfCCuAOokRigCVsD1kSCWgiwV 1gXXtjwxv2/U53Zh1mjPNDJKAzD5rE8JpwsfoV3d7ADtLNzUYZMRY6VVOg1dQcrrg3 nOS9guILcJCa1x+xfel3uDtoO4IZepFxq0nlm8Us= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.18 1063/1095] ext4: remove EA inode entry from mbcache on inode eviction Date: Mon, 15 Aug 2022 20:07:42 +0200 Message-Id: <20220815180513.007694070@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara [ Upstream commit 6bc0d63dad7f9f54d381925ee855b402f652fa39 ] Currently we remove EA inode from mbcache as soon as its xattr refcount drops to zero. However there can be pending attempts to reuse the inode and thus refcount handling code has to handle the situation when refcount increases from zero anyway. So save some work and just keep EA inode in mbcache until it is getting evicted. At that moment we are sure following iget() of EA inode will fail anyway (or wait for eviction to finish and load things from the disk again) and so removing mbcache entry at that moment is fine and simplifies the code a bit. CC: stable@vger.kernel.org Fixes: 82939d7999df ("ext4: convert to mbcache2") Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220712105436.32204-3-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ext4/inode.c | 2 ++ fs/ext4/xattr.c | 24 ++++++++---------------- fs/ext4/xattr.h | 1 + 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 9ef6f41a5250..e94ec798dce1 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -178,6 +178,8 @@ void ext4_evict_inode(struct inode *inode) =20 trace_ext4_evict_inode(inode); =20 + if (EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL) + ext4_evict_ea_inode(inode); if (inode->i_nlink) { /* * When journalling data dirty buffers are tracked only in the diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index c3c3194f3ee1..b57fd07fbdba 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -436,6 +436,14 @@ static int ext4_xattr_inode_iget(struct inode *parent,= unsigned long ea_ino, return err; } =20 +/* Remove entry from mbcache when EA inode is getting evicted */ +void ext4_evict_ea_inode(struct inode *inode) +{ + if (EA_INODE_CACHE(inode)) + mb_cache_entry_delete(EA_INODE_CACHE(inode), + ext4_xattr_inode_get_hash(inode), inode->i_ino); +} + static int ext4_xattr_inode_verify_hashes(struct inode *ea_inode, struct ext4_xattr_entry *entry, void *buffer, @@ -976,10 +984,8 @@ int __ext4_xattr_set_credits(struct super_block *sb, s= truct inode *inode, static int ext4_xattr_inode_update_ref(handle_t *handle, struct inode *ea_= inode, int ref_change) { - struct mb_cache *ea_inode_cache =3D EA_INODE_CACHE(ea_inode); struct ext4_iloc iloc; s64 ref_count; - u32 hash; int ret; =20 inode_lock(ea_inode); @@ -1002,14 +1008,6 @@ static int ext4_xattr_inode_update_ref(handle_t *han= dle, struct inode *ea_inode, =20 set_nlink(ea_inode, 1); ext4_orphan_del(handle, ea_inode); - - if (ea_inode_cache) { - hash =3D ext4_xattr_inode_get_hash(ea_inode); - mb_cache_entry_create(ea_inode_cache, - GFP_NOFS, hash, - ea_inode->i_ino, - true /* reusable */); - } } } else { WARN_ONCE(ref_count < 0, "EA inode %lu ref_count=3D%lld", @@ -1022,12 +1020,6 @@ static int ext4_xattr_inode_update_ref(handle_t *han= dle, struct inode *ea_inode, =20 clear_nlink(ea_inode); ext4_orphan_add(handle, ea_inode); - - if (ea_inode_cache) { - hash =3D ext4_xattr_inode_get_hash(ea_inode); - mb_cache_entry_delete(ea_inode_cache, hash, - ea_inode->i_ino); - } } } =20 diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h index f885f362add4..e5e36bd11f05 100644 --- a/fs/ext4/xattr.h +++ b/fs/ext4/xattr.h @@ -191,6 +191,7 @@ extern void ext4_xattr_inode_array_free(struct ext4_xat= tr_inode_array *array); =20 extern int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_i= size, struct ext4_inode *raw_inode, handle_t *handle); +extern void ext4_evict_ea_inode(struct inode *inode); =20 extern const struct xattr_handler *ext4_xattr_handlers[]; =20 --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 275F5C00140 for ; Mon, 15 Aug 2022 23:39:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353617AbiHOXjI (ORCPT ); Mon, 15 Aug 2022 19:39:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353690AbiHOXf5 (ORCPT ); Mon, 15 Aug 2022 19:35:57 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58A7815176D; Mon, 15 Aug 2022 13:09:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 67EB0CE1262; Mon, 15 Aug 2022 20:09:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53E2EC433C1; Mon, 15 Aug 2022 20:09:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594151; bh=Ohh3paW8dP4iCobD3rCYKby9TRKkA45xwCV8Vho5sgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VGtIFwRZh5BOUO7rnukeY/16OOfNmT89JqoNjCHqKJMzv/RPoz4CxCd/G5ddzYbi8 4m6c2X5h4X+WAanO0Lld3wv/brHCxV0Kr6ULuQzjEWDdfuKC5Q0iLDLeHHF0hPHbUB vNBMukOmAmy4CZxp3aYjH0Exyq1gmNSOnKH7zrVE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuqi Zhang , Ritesh Harjani , Theodore Tso , Sasha Levin Subject: [PATCH 5.18 1064/1095] ext4: use kmemdup() to replace kmalloc + memcpy Date: Mon, 15 Aug 2022 20:07:43 +0200 Message-Id: <20220815180513.053676857@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shuqi Zhang [ Upstream commit 4efd9f0d120c55b08852ee5605dbb02a77089a5d ] Replace kmalloc + memcpy with kmemdup() Signed-off-by: Shuqi Zhang Reviewed-by: Ritesh Harjani Link: https://lore.kernel.org/r/20220525030120.803330-1-zhangshuqi3@huawei.= com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ext4/xattr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index b57fd07fbdba..d92d50de5a01 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -1887,11 +1887,10 @@ ext4_xattr_block_set(handle_t *handle, struct inode= *inode, =20 unlock_buffer(bs->bh); ea_bdebug(bs->bh, "cloning"); - s->base =3D kmalloc(bs->bh->b_size, GFP_NOFS); + s->base =3D kmemdup(BHDR(bs->bh), bs->bh->b_size, GFP_NOFS); error =3D -ENOMEM; if (s->base =3D=3D NULL) goto cleanup; - memcpy(s->base, BHDR(bs->bh), bs->bh->b_size); s->first =3D ENTRY(header(s->base)+1); header(s->base)->h_refcount =3D cpu_to_le32(1); s->here =3D ENTRY(s->base + offset); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73B11C3F6B0 for ; Mon, 15 Aug 2022 23:39:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353355AbiHOXjd (ORCPT ); Mon, 15 Aug 2022 19:39:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353854AbiHOXgp (ORCPT ); Mon, 15 Aug 2022 19:36:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8037BCCF1; Mon, 15 Aug 2022 13:09:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 02386B80EA8; Mon, 15 Aug 2022 20:09:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56FE1C433D7; Mon, 15 Aug 2022 20:09:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594160; bh=FMs/sWj9WFMQUIEfGyLx6NRo6/tJlhfm8nDKhrM5/EY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0p1NqNdUJdaQ0+wdlTySLPCOAz/knS3tpvh9lQ6294w95ngOHTKZHRAmAn1p53UzR aEPG4BO3NfDEuvGPZw7dDqEFmx8nsulCox+hv73OjWl/butlm/xhicaYsLOpieuUDq xOkcqBSWlEqtJcHdX6fO5Y5CyCxt6su2f4cQsTGA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.18 1065/1095] ext4: unindent codeblock in ext4_xattr_block_set() Date: Mon, 15 Aug 2022 20:07:44 +0200 Message-Id: <20220815180513.102937573@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara [ Upstream commit fd48e9acdf26d0cbd80051de07d4a735d05d29b2 ] Remove unnecessary else (and thus indentation level) from a code block in ext4_xattr_block_set(). It will also make following code changes easier. No functional changes. CC: stable@vger.kernel.org Fixes: 82939d7999df ("ext4: convert to mbcache2") Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220712105436.32204-4-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ext4/xattr.c | 77 ++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index d92d50de5a01..a25942a74929 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -1850,6 +1850,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *= inode, #define header(x) ((struct ext4_xattr_header *)(x)) =20 if (s->base) { + int offset =3D (char *)s->here - bs->bh->b_data; + BUFFER_TRACE(bs->bh, "get_write_access"); error =3D ext4_journal_get_write_access(handle, sb, bs->bh, EXT4_JTR_NONE); @@ -1882,49 +1884,46 @@ ext4_xattr_block_set(handle_t *handle, struct inode= *inode, if (error) goto cleanup; goto inserted; - } else { - int offset =3D (char *)s->here - bs->bh->b_data; + } + unlock_buffer(bs->bh); + ea_bdebug(bs->bh, "cloning"); + s->base =3D kmemdup(BHDR(bs->bh), bs->bh->b_size, GFP_NOFS); + error =3D -ENOMEM; + if (s->base =3D=3D NULL) + goto cleanup; + s->first =3D ENTRY(header(s->base)+1); + header(s->base)->h_refcount =3D cpu_to_le32(1); + s->here =3D ENTRY(s->base + offset); + s->end =3D s->base + bs->bh->b_size; =20 - unlock_buffer(bs->bh); - ea_bdebug(bs->bh, "cloning"); - s->base =3D kmemdup(BHDR(bs->bh), bs->bh->b_size, GFP_NOFS); - error =3D -ENOMEM; - if (s->base =3D=3D NULL) + /* + * If existing entry points to an xattr inode, we need + * to prevent ext4_xattr_set_entry() from decrementing + * ref count on it because the reference belongs to the + * original block. In this case, make the entry look + * like it has an empty value. + */ + if (!s->not_found && s->here->e_value_inum) { + ea_ino =3D le32_to_cpu(s->here->e_value_inum); + error =3D ext4_xattr_inode_iget(inode, ea_ino, + le32_to_cpu(s->here->e_hash), + &tmp_inode); + if (error) goto cleanup; - s->first =3D ENTRY(header(s->base)+1); - header(s->base)->h_refcount =3D cpu_to_le32(1); - s->here =3D ENTRY(s->base + offset); - s->end =3D s->base + bs->bh->b_size; =20 - /* - * If existing entry points to an xattr inode, we need - * to prevent ext4_xattr_set_entry() from decrementing - * ref count on it because the reference belongs to the - * original block. In this case, make the entry look - * like it has an empty value. - */ - if (!s->not_found && s->here->e_value_inum) { - ea_ino =3D le32_to_cpu(s->here->e_value_inum); - error =3D ext4_xattr_inode_iget(inode, ea_ino, - le32_to_cpu(s->here->e_hash), - &tmp_inode); - if (error) - goto cleanup; - - if (!ext4_test_inode_state(tmp_inode, - EXT4_STATE_LUSTRE_EA_INODE)) { - /* - * Defer quota free call for previous - * inode until success is guaranteed. - */ - old_ea_inode_quota =3D le32_to_cpu( - s->here->e_value_size); - } - iput(tmp_inode); - - s->here->e_value_inum =3D 0; - s->here->e_value_size =3D 0; + if (!ext4_test_inode_state(tmp_inode, + EXT4_STATE_LUSTRE_EA_INODE)) { + /* + * Defer quota free call for previous + * inode until success is guaranteed. + */ + old_ea_inode_quota =3D le32_to_cpu( + s->here->e_value_size); } + iput(tmp_inode); + + s->here->e_value_inum =3D 0; + s->here->e_value_size =3D 0; } } else { /* Allocate a buffer where we construct the new block. */ --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC816C00140 for ; Mon, 15 Aug 2022 23:39:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242637AbiHOXjp (ORCPT ); Mon, 15 Aug 2022 19:39:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353888AbiHOXgu (ORCPT ); Mon, 15 Aug 2022 19:36:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE5D482FB9; Mon, 15 Aug 2022 13:09:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 13A7DB810C5; Mon, 15 Aug 2022 20:09:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68D64C433C1; Mon, 15 Aug 2022 20:09:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594166; bh=v79BDIz+bJxNdmMCpKkjIK9UA5+kvyKRUyd0IFt9G2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IUMgZ9pqZaYZlwUMb9EPaEuUc5GDv9pPzl+/nLtqlcAMDj+Rtq5nIOgWPmvZ67X/E XUKYXNk2qBw1DHNcfglVu7mdbVEEe3Su1qR1YR7CJXprNNakxm2L1N9K8FEX059W1v qi9iEdshRg85XOFF3dX/qTiuVFDyz6elcjjaLMF0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Theodore Tso , Sasha Levin , Ritesh Harjani Subject: [PATCH 5.18 1066/1095] ext4: fix race when reusing xattr blocks Date: Mon, 15 Aug 2022 20:07:45 +0200 Message-Id: <20220815180513.145436023@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara [ Upstream commit 65f8b80053a1b2fd602daa6814e62d6fa90e5e9b ] When ext4_xattr_block_set() decides to remove xattr block the following race can happen: CPU1 CPU2 ext4_xattr_block_set() ext4_xattr_release_block() new_bh =3D ext4_xattr_block_cache_find() lock_buffer(bh); ref =3D le32_to_cpu(BHDR(bh)->h_r= efcount); if (ref =3D=3D 1) { ... mb_cache_entry_delete(); unlock_buffer(bh); ext4_free_blocks(); ... ext4_forget(..., bh, ...); jbd2_journal_revoke(..., bh= ); ext4_journal_get_write_access(..., new_bh, ...) do_get_write_access() jbd2_journal_cancel_revoke(..., new_bh); Later the code in ext4_xattr_block_set() finds out the block got freed and cancels reusal of the block but the revoke stays canceled and so in case of block reuse and journal replay the filesystem can get corrupted. If the race works out slightly differently, we can also hit assertions in the jbd2 code. Fix the problem by making sure that once matching mbcache entry is found, code dropping the last xattr block reference (or trying to modify xattr block in place) waits until the mbcache entry reference is dropped. This way code trying to reuse xattr block is protected from someone trying to drop the last reference to xattr block. Reported-and-tested-by: Ritesh Harjani CC: stable@vger.kernel.org Fixes: 82939d7999df ("ext4: convert to mbcache2") Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220712105436.32204-5-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/ext4/xattr.c | 67 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 22 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index a25942a74929..533216e80fa2 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -439,9 +439,16 @@ static int ext4_xattr_inode_iget(struct inode *parent,= unsigned long ea_ino, /* Remove entry from mbcache when EA inode is getting evicted */ void ext4_evict_ea_inode(struct inode *inode) { - if (EA_INODE_CACHE(inode)) - mb_cache_entry_delete(EA_INODE_CACHE(inode), - ext4_xattr_inode_get_hash(inode), inode->i_ino); + struct mb_cache_entry *oe; + + if (!EA_INODE_CACHE(inode)) + return; + /* Wait for entry to get unused so that we can remove it */ + while ((oe =3D mb_cache_entry_delete_or_get(EA_INODE_CACHE(inode), + ext4_xattr_inode_get_hash(inode), inode->i_ino))) { + mb_cache_entry_wait_unused(oe); + mb_cache_entry_put(EA_INODE_CACHE(inode), oe); + } } =20 static int @@ -1229,6 +1236,7 @@ ext4_xattr_release_block(handle_t *handle, struct ino= de *inode, if (error) goto out; =20 +retry_ref: lock_buffer(bh); hash =3D le32_to_cpu(BHDR(bh)->h_hash); ref =3D le32_to_cpu(BHDR(bh)->h_refcount); @@ -1238,9 +1246,18 @@ ext4_xattr_release_block(handle_t *handle, struct in= ode *inode, * This must happen under buffer lock for * ext4_xattr_block_set() to reliably detect freed block */ - if (ea_block_cache) - mb_cache_entry_delete(ea_block_cache, hash, - bh->b_blocknr); + if (ea_block_cache) { + struct mb_cache_entry *oe; + + oe =3D mb_cache_entry_delete_or_get(ea_block_cache, hash, + bh->b_blocknr); + if (oe) { + unlock_buffer(bh); + mb_cache_entry_wait_unused(oe); + mb_cache_entry_put(ea_block_cache, oe); + goto retry_ref; + } + } get_bh(bh); unlock_buffer(bh); =20 @@ -1867,9 +1884,20 @@ ext4_xattr_block_set(handle_t *handle, struct inode = *inode, * ext4_xattr_block_set() to reliably detect modified * block */ - if (ea_block_cache) - mb_cache_entry_delete(ea_block_cache, hash, - bs->bh->b_blocknr); + if (ea_block_cache) { + struct mb_cache_entry *oe; + + oe =3D mb_cache_entry_delete_or_get(ea_block_cache, + hash, bs->bh->b_blocknr); + if (oe) { + /* + * Xattr block is getting reused. Leave + * it alone. + */ + mb_cache_entry_put(ea_block_cache, oe); + goto clone_block; + } + } ea_bdebug(bs->bh, "modifying in-place"); error =3D ext4_xattr_set_entry(i, s, handle, inode, true /* is_block */); @@ -1885,6 +1913,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *= inode, goto cleanup; goto inserted; } +clone_block: unlock_buffer(bs->bh); ea_bdebug(bs->bh, "cloning"); s->base =3D kmemdup(BHDR(bs->bh), bs->bh->b_size, GFP_NOFS); @@ -1990,18 +2019,13 @@ ext4_xattr_block_set(handle_t *handle, struct inode= *inode, lock_buffer(new_bh); /* * We have to be careful about races with - * freeing, rehashing or adding references to - * xattr block. Once we hold buffer lock xattr - * block's state is stable so we can check - * whether the block got freed / rehashed or - * not. Since we unhash mbcache entry under - * buffer lock when freeing / rehashing xattr - * block, checking whether entry is still - * hashed is reliable. Same rules hold for - * e_reusable handling. + * adding references to xattr block. Once we + * hold buffer lock xattr block's state is + * stable so we can check the additional + * reference fits. */ - if (hlist_bl_unhashed(&ce->e_hash_list) || - !ce->e_reusable) { + ref =3D le32_to_cpu(BHDR(new_bh)->h_refcount) + 1; + if (ref > EXT4_XATTR_REFCOUNT_MAX) { /* * Undo everything and check mbcache * again. @@ -2016,9 +2040,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *= inode, new_bh =3D NULL; goto inserted; } - ref =3D le32_to_cpu(BHDR(new_bh)->h_refcount) + 1; BHDR(new_bh)->h_refcount =3D cpu_to_le32(ref); - if (ref >=3D EXT4_XATTR_REFCOUNT_MAX) + if (ref =3D=3D EXT4_XATTR_REFCOUNT_MAX) ce->e_reusable =3D 0; ea_bdebug(new_bh, "reusing; refcount now=3D%d", ref); --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E02F1C00140 for ; Mon, 15 Aug 2022 23:40:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353938AbiHOXkA (ORCPT ); Mon, 15 Aug 2022 19:40:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353929AbiHOXg5 (ORCPT ); Mon, 15 Aug 2022 19:36:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C72A152411; Mon, 15 Aug 2022 13:09:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E67E260DE3; Mon, 15 Aug 2022 20:09:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB6EBC433D7; Mon, 15 Aug 2022 20:09:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594173; bh=kxzoYOEPOH9+Y+3lO+DaaJftUEo51nXgjw+Ns0g0fJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PBaGZb9ljwf2AccU0achhb3OJLG65Ratxl1Qt4XGE/5N6r8aTM6Yq4BXBW8QpWXVM i96k1fOTu/2Zj00wiPgPpFvNSvFj6QtlTfKOFrIfMinl4L97xIaJ3ARxUzQKnlIA4k HKiPliBgkuGWZKEgrKgWWNtLoGWWWUzcTLF5I1K4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Biggers , Tianjia Zhang , Jarkko Sakkinen , Sasha Levin Subject: [PATCH 5.18 1067/1095] KEYS: asymmetric: enforce SM2 signature use pkey algo Date: Mon, 15 Aug 2022 20:07:46 +0200 Message-Id: <20220815180513.186363638@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tianjia Zhang [ Upstream commit 0815291a8fd66cdcf7db1445d4d99b0d16065829 ] The signature verification of SM2 needs to add the Za value and recalculate sig->digest, which requires the detection of the pkey_algo in public_key_verify_signature(). As Eric Biggers said, the pkey_algo field in sig is attacker-controlled and should be use pkey->pkey_algo instead of sig->pkey_algo, and secondly, if sig->pkey_algo is NULL, it will also cause signature verification failure. The software_key_determine_akcipher() already forces the algorithms are matched, so the SM3 algorithm is enforced in the SM2 signature, although this has been checked, we still avoid using any algorithm information in the signature as input. Fixes: 215525639631 ("X.509: support OSCCA SM2-with-SM3 certificate verific= ation") Reported-by: Eric Biggers Cc: stable@vger.kernel.org # v5.10+ Signed-off-by: Tianjia Zhang Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- crypto/asymmetric_keys/public_key.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/p= ublic_key.c index 7c9e6be35c30..2f8352e88860 100644 --- a/crypto/asymmetric_keys/public_key.c +++ b/crypto/asymmetric_keys/public_key.c @@ -304,6 +304,10 @@ static int cert_sig_digest_update(const struct public_= key_signature *sig, =20 BUG_ON(!sig->data); =20 + /* SM2 signatures always use the SM3 hash algorithm */ + if (!sig->hash_algo || strcmp(sig->hash_algo, "sm3") !=3D 0) + return -EINVAL; + ret =3D sm2_compute_z_digest(tfm_pkey, SM2_DEFAULT_USERID, SM2_DEFAULT_USERID_LEN, dgst); if (ret) @@ -414,8 +418,7 @@ int public_key_verify_signature(const struct public_key= *pkey, if (ret) goto error_free_key; =20 - if (sig->pkey_algo && strcmp(sig->pkey_algo, "sm2") =3D=3D 0 && - sig->data_size) { + if (strcmp(pkey->pkey_algo, "sm2") =3D=3D 0 && sig->data_size) { ret =3D cert_sig_digest_update(sig, tfm); if (ret) goto error_free_key; --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 603C8C00140 for ; Mon, 15 Aug 2022 23:40:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353954AbiHOXkO (ORCPT ); Mon, 15 Aug 2022 19:40:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353958AbiHOXhE (ORCPT ); Mon, 15 Aug 2022 19:37:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8818F82FB5; Mon, 15 Aug 2022 13:09:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2656660F11; Mon, 15 Aug 2022 20:09:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23909C433D6; Mon, 15 Aug 2022 20:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594179; bh=dg9/iLNoP90yeUEWFEyZvSjml0J6j+qZ3W5XqIRkfYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ibZ+2aqQCj0YQJyN2O3GFCm/m01TioONuKUaTtTTVcN500yh2pzk+BR3hml11vUxU 3JSPAcjT6gXU1iQcE4u955Voq0PiCTPndtApGzsCv4+RyQ/BsCVqjspq5yNy+4cJte GGLT4dqxbHn3cGieSo1dEv1SxEDwMDlVlcPZCLHU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, WANG Xuerui , Huacai Chen , Jarkko Sakkinen , Sasha Levin Subject: [PATCH 5.18 1068/1095] tpm: eventlog: Fix section mismatch for DEBUG_SECTION_MISMATCH Date: Mon, 15 Aug 2022 20:07:47 +0200 Message-Id: <20220815180513.219516805@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Huacai Chen [ Upstream commit bed4593645366ad7362a3aa7bc0d100d8d8236a8 ] If DEBUG_SECTION_MISMATCH enabled, __calc_tpm2_event_size() will not be inlined, this cause section mismatch like this: WARNING: modpost: vmlinux.o(.text.unlikely+0xe30c): Section mismatch in ref= erence from the variable L0 to the function .init.text:early_ioremap() The function L0() references the function __init early_memremap(). This is often because L0 lacks a __init annotation or the annotation of early_ioremap is wrong. Fix it by using __always_inline instead of inline for the called-once function __calc_tpm2_event_size(). Fixes: 44038bc514a2 ("tpm: Abstract crypto agile event size calculations") Cc: stable@vger.kernel.org # v5.3 Reported-by: WANG Xuerui Signed-off-by: Huacai Chen Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/tpm_eventlog.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/tpm_eventlog.h b/include/linux/tpm_eventlog.h index 739ba9a03ec1..20c0ff54b7a0 100644 --- a/include/linux/tpm_eventlog.h +++ b/include/linux/tpm_eventlog.h @@ -157,7 +157,7 @@ struct tcg_algorithm_info { * Return: size of the event on success, 0 on failure */ =20 -static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, +static __always_inline int __calc_tpm2_event_size(struct tcg_pcr_event2_he= ad *event, struct tcg_pcr_event *event_header, bool do_mapping) { --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DF01C00140 for ; Mon, 15 Aug 2022 23:40:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353987AbiHOXkc (ORCPT ); Mon, 15 Aug 2022 19:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346108AbiHOXhT (ORCPT ); Mon, 15 Aug 2022 19:37:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52D19152436; Mon, 15 Aug 2022 13:09:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 09739B81135; Mon, 15 Aug 2022 20:09:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53C3FC433C1; Mon, 15 Aug 2022 20:09:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594185; bh=VcECr1scfMi6H8ackDqfW47OlIEhZMW7KEnHNf/qPdY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rBVtPQj9O6H7UkzU0D15oZE6GayGUI7AfAyHcr9rJzPZ6etXGHnA7orR1xo4U8yei bx8kcah5rqBMFFMuqIMfeeiF5tEMVbjj1JgpIpaaB+udMpF1Wl+gdJdPS/9IF+DRp3 gfmVIwV9PfGthbF4mYRcMYPiSAUs9XaHciENHBac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?M=C3=A5rten=20Lindahl?= , Jarkko Sakkinen , Sasha Levin Subject: [PATCH 5.18 1069/1095] tpm: Add check for Failure mode for TPM2 modules Date: Mon, 15 Aug 2022 20:07:48 +0200 Message-Id: <20220815180513.262690780@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: M=C3=A5rten Lindahl [ Upstream commit 863ed94c589fcd1984f4e3080f069d30508044bb ] In commit 0aa698787aa2 ("tpm: Add Upgrade/Reduced mode support for TPM2 modules") it was said that: "If the TPM is in Failure mode, it will successfully respond to both tpm2_do_selftest() and tpm2_startup() calls. Although, will fail to answer to tpm2_get_cc_attrs_tbl(). Use this fact to conclude that TPM is in Failure mode." But a check was never added in the commit when calling tpm2_get_cc_attrs_tbl() to conclude that the TPM is in Failure mode. This commit corrects this by adding a check. Fixes: 0aa698787aa2 ("tpm: Add Upgrade/Reduced mode support for TPM2 module= s") Cc: stable@vger.kernel.org # v5.17+ Signed-off-by: M=C3=A5rten Lindahl Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/char/tpm/tpm2-cmd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c index 04a3e23a4afc..4419593d9531 100644 --- a/drivers/char/tpm/tpm2-cmd.c +++ b/drivers/char/tpm/tpm2-cmd.c @@ -752,6 +752,12 @@ int tpm2_auto_startup(struct tpm_chip *chip) } =20 rc =3D tpm2_get_cc_attrs_tbl(chip); + if (rc =3D=3D TPM2_RC_FAILURE || (rc < 0 && rc !=3D -ENOMEM)) { + dev_info(&chip->dev, + "TPM in field failure mode, requires firmware upgrade\n"); + chip->flags |=3D TPM_CHIP_FLAG_FIRMWARE_UPGRADE; + rc =3D 0; + } =20 out: if (rc =3D=3D TPM2_RC_UPGRADE) { --=20 2.35.1 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E65B3C25B08 for ; Mon, 15 Aug 2022 23:42:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354026AbiHOXkv (ORCPT ); Mon, 15 Aug 2022 19:40:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353643AbiHOXhs (ORCPT ); Mon, 15 Aug 2022 19:37:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 804ADBD1D6; Mon, 15 Aug 2022 13:09:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1DA80B80EA9; Mon, 15 Aug 2022 20:09:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6760DC433D6; Mon, 15 Aug 2022 20:09:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594194; bh=Sc7BqZDk1f59iz6GdHTuaXWtnjTzvHo7f/8963wEQ2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uk/o8MJ03ySba3xU45X7uYcpcz6Dr1JGx+y/NbVYdnse7UaBNZ2HVHiTCLEePgYRx ZH/BJFPWEXyStDaZ0P6tq6Ofcj84NuDln8mnWjSx9WFRo98Ke/gCN73GJTh3uREbuA qIwmvDNTUC6DM9rbB0En5VlIKVLk9nWSPVX1/zeM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maximilian Heyne , SeongJae Park , Juergen Gross Subject: [PATCH 5.18 1070/1095] xen-blkback: fix persistent grants negotiation Date: Mon, 15 Aug 2022 20:07:49 +0200 Message-Id: <20220815180513.313695090@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: SeongJae Park commit fc9be616bb8f3ed9cf560308f86904f5c06be205 upstream. Persistent grants feature can be used only when both backend and the frontend supports the feature. The feature was always supported by 'blkback', but commit aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants") has introduced a parameter for disabling it runtime. To avoid the parameter be updated while being used by 'blkback', the commit caches the parameter into 'vbd->feature_gnt_persistent' in 'xen_vbd_create()', and then check if the guest also supports the feature and finally updates the field in 'connect_ring()'. However, 'connect_ring()' could be called before 'xen_vbd_create()', so later execution of 'xen_vbd_create()' can wrongly overwrite 'true' to 'vbd->feature_gnt_persistent'. As a result, 'blkback' could try to use 'persistent grants' feature even if the guest doesn't support the feature. This commit fixes the issue by moving the parameter value caching to 'xen_blkif_alloc()', which allocates the 'blkif'. Because the struct embeds 'vbd' object, which will be used by 'connect_ring()' later, this should be called before 'connect_ring()' and therefore this should be the right and safe place to do the caching. Fixes: aac8a70db24b ("xen-blkback: add a parameter for disabling of persist= ent grants") Cc: # 5.10.x Signed-off-by: Maximilian Heyne Signed-off-by: SeongJae Park Reviewed-by: Maximilian Heyne Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20220715225108.193398-2-sj@kernel.org Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/block/xen-blkback/xenbus.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -157,6 +157,11 @@ static int xen_blkif_alloc_rings(struct return 0; } =20 +/* Enable the persistent grants feature. */ +static bool feature_persistent =3D true; +module_param(feature_persistent, bool, 0644); +MODULE_PARM_DESC(feature_persistent, "Enables the persistent grants featur= e"); + static struct xen_blkif *xen_blkif_alloc(domid_t domid) { struct xen_blkif *blkif; @@ -181,6 +186,8 @@ static struct xen_blkif *xen_blkif_alloc __module_get(THIS_MODULE); INIT_WORK(&blkif->free_work, xen_blkif_deferred_free); =20 + blkif->vbd.feature_gnt_persistent =3D feature_persistent; + return blkif; } =20 @@ -472,12 +479,6 @@ static void xen_vbd_free(struct xen_vbd vbd->bdev =3D NULL; } =20 -/* Enable the persistent grants feature. */ -static bool feature_persistent =3D true; -module_param(feature_persistent, bool, 0644); -MODULE_PARM_DESC(feature_persistent, - "Enables the persistent grants feature"); - static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle, unsigned major, unsigned minor, int readonly, int cdrom) @@ -523,8 +524,6 @@ static int xen_vbd_create(struct xen_blk if (q && blk_queue_secure_erase(q)) vbd->discard_secure =3D true; =20 - vbd->feature_gnt_persistent =3D feature_persistent; - pr_debug("Successful creation of handle=3D%04x (dom=3D%u)\n", handle, blkif->domid); return 0; From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B034DC28B2B for ; Mon, 15 Aug 2022 23:42:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354052AbiHOXlC (ORCPT ); Mon, 15 Aug 2022 19:41:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353846AbiHOXiq (ORCPT ); Mon, 15 Aug 2022 19:38:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA52ABD1FC; Mon, 15 Aug 2022 13:10:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 168A6B81142; Mon, 15 Aug 2022 20:10:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74960C433C1; Mon, 15 Aug 2022 20:10:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594200; bh=XwU2KySf+JC57WNAe8FlkvldQht3KiaNezMWifSjFNA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w3ODtJqPRLbyK4aDLVR+7Zkcn2mSEc1v5XoV+5kLYH0Tu/kyfI8TEppy4SY/sesm6 DrO4MgebiOzfDDs9CgNGtc37Tip9oHAgnTtElRdaKxRdTrGVQIg/cWsy2tVyME5qJR 71s54zheObr4hYrouTW0UDFTUUx0OrliRZavCShk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Chepurnyi , Maximilian Heyne , SeongJae Park , Juergen Gross Subject: [PATCH 5.18 1071/1095] xen-blkback: Apply feature_persistent parameter when connect Date: Mon, 15 Aug 2022 20:07:50 +0200 Message-Id: <20220815180513.354466286@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maximilian Heyne commit e94c6101e151b019b8babc518ac2a6ada644a5a1 upstream. In some use cases[1], the backend is created while the frontend doesn't support the persistent grants feature, but later the frontend can be changed to support the feature and reconnect. In the past, 'blkback' enabled the persistent grants feature since it unconditionally checked if frontend supports the persistent grants feature for every connect ('connect_ring()') and decided whether it should use persistent grans or not. However, commit aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants") has mistakenly changed the behavior. It made the frontend feature support check to not be repeated once it shown the 'feature_persistent' as 'false', or the frontend doesn't support persistent grants. This commit changes the behavior of the parameter to make effect for every connect, so that the previous workflow can work again as expected. [1] https://lore.kernel.org/xen-devel/CAJwUmVB6H3iTs-C+U=3Dv-pwJB7-_ZRHPxHz= KRJZ22xEPW7z8a=3Dg@mail.gmail.com/ Reported-by: Andrii Chepurnyi Fixes: aac8a70db24b ("xen-blkback: add a parameter for disabling of persist= ent grants") Cc: # 5.10.x Signed-off-by: Maximilian Heyne Signed-off-by: SeongJae Park Reviewed-by: Maximilian Heyne Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20220715225108.193398-3-sj@kernel.org Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- Documentation/ABI/testing/sysfs-driver-xen-blkback | 2 +- drivers/block/xen-blkback/xenbus.c | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) --- a/Documentation/ABI/testing/sysfs-driver-xen-blkback +++ b/Documentation/ABI/testing/sysfs-driver-xen-blkback @@ -42,5 +42,5 @@ KernelVersion: 5.10 Contact: SeongJae Park Description: Whether to enable the persistent grants feature or not. N= ote - that this option only takes effect on newly created backen= ds. + that this option only takes effect on newly connected back= ends. The default is Y (enable). --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -186,8 +186,6 @@ static struct xen_blkif *xen_blkif_alloc __module_get(THIS_MODULE); INIT_WORK(&blkif->free_work, xen_blkif_deferred_free); =20 - blkif->vbd.feature_gnt_persistent =3D feature_persistent; - return blkif; } =20 @@ -1090,10 +1088,9 @@ static int connect_ring(struct backend_i xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol); return -ENOSYS; } - if (blkif->vbd.feature_gnt_persistent) - blkif->vbd.feature_gnt_persistent =3D - xenbus_read_unsigned(dev->otherend, - "feature-persistent", 0); + + blkif->vbd.feature_gnt_persistent =3D feature_persistent && + xenbus_read_unsigned(dev->otherend, "feature-persistent", 0); =20 blkif->vbd.overflow_max_grants =3D 0; From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72D6DC25B0D for ; Mon, 15 Aug 2022 23:42:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347927AbiHOXmh (ORCPT ); Mon, 15 Aug 2022 19:42:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353901AbiHOXjV (ORCPT ); Mon, 15 Aug 2022 19:39:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFB2F153D19; Mon, 15 Aug 2022 13:10:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 432C660DDC; Mon, 15 Aug 2022 20:10:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51A82C433D6; Mon, 15 Aug 2022 20:10:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594206; bh=nDA1+g2NaubviFa1DOmu3ipBe0bol/bx3Ni3Zx8vy+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UcfCvveoIHZRDZ6adTt/MnSEcNQFuoXb7CPGDzgKKE3IHgzSoq1Odmfp6vhjWF91M wb7uMLPGDacHRLblEkV5Mpx4igy46X3TWkOMdEnjRy4cTOfznKed6G2RqfNiPgnt9g 8kmPH2SnbZr53+21WqC1lnae+mvCnZ55BebBAlQQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, SeongJae Park , Maximilian Heyne , Juergen Gross Subject: [PATCH 5.18 1072/1095] xen-blkfront: Apply feature_persistent parameter when connect Date: Mon, 15 Aug 2022 20:07:51 +0200 Message-Id: <20220815180513.394355050@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: SeongJae Park commit 402c43ea6b34a1b371ffeed9adf907402569eaf5 upstream. In some use cases[1], the backend is created while the frontend doesn't support the persistent grants feature, but later the frontend can be changed to support the feature and reconnect. In the past, 'blkback' enabled the persistent grants feature since it unconditionally checked if frontend supports the persistent grants feature for every connect ('connect_ring()') and decided whether it should use persistent grans or not. However, commit aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants") has mistakenly changed the behavior. It made the frontend feature support check to not be repeated once it shown the 'feature_persistent' as 'false', or the frontend doesn't support persistent grants. Similar behavioral change has made on 'blkfront' by commit 74a852479c68 ("xen-blkfront: add a parameter for disabling of persistent grants"). This commit changes the behavior of the parameter to make effect for every connect, so that the previous behavior of 'blkfront' can be restored. [1] https://lore.kernel.org/xen-devel/CAJwUmVB6H3iTs-C+U=3Dv-pwJB7-_ZRHPxHz= KRJZ22xEPW7z8a=3Dg@mail.gmail.com/ Fixes: 74a852479c68 ("xen-blkfront: add a parameter for disabling of persis= tent grants") Cc: # 5.10.x Signed-off-by: SeongJae Park Reviewed-by: Maximilian Heyne Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20220715225108.193398-4-sj@kernel.org Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- Documentation/ABI/testing/sysfs-driver-xen-blkfront | 2 +- drivers/block/xen-blkfront.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) --- a/Documentation/ABI/testing/sysfs-driver-xen-blkfront +++ b/Documentation/ABI/testing/sysfs-driver-xen-blkfront @@ -15,5 +15,5 @@ KernelVersion: 5.10 Contact: SeongJae Park Description: Whether to enable the persistent grants feature or not. N= ote - that this option only takes effect on newly created fronte= nds. + that this option only takes effect on newly connected fron= tends. The default is Y (enable). --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -2011,8 +2011,6 @@ static int blkfront_probe(struct xenbus_ info->vdevice =3D vdevice; info->connected =3D BLKIF_STATE_DISCONNECTED; =20 - info->feature_persistent =3D feature_persistent; - /* Front end dir is a number, which is used as the id. */ info->handle =3D simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0); dev_set_drvdata(&dev->dev, info); @@ -2306,7 +2304,7 @@ static void blkfront_gather_backend_feat if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0)) blkfront_setup_discard(info); =20 - if (info->feature_persistent) + if (feature_persistent) info->feature_persistent =3D !!xenbus_read_unsigned(info->xbdev->otherend, "feature-persistent", 0); From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05CB6C25B0D for ; Mon, 15 Aug 2022 23:42:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353858AbiHOXmv (ORCPT ); Mon, 15 Aug 2022 19:42:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353955AbiHOXkP (ORCPT ); Mon, 15 Aug 2022 19:40:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DED263F00; Mon, 15 Aug 2022 13:10:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DD2EDB80EA8; Mon, 15 Aug 2022 20:10:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EBF4C433D6; Mon, 15 Aug 2022 20:10:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594213; bh=xjwEAjQmDMvwXBghWtChvjHsn8c+SsVYe94+bRZyOQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hIH7gHdRIwguCdIk09jrzJ62inqsVJpWelTwzOdbmY8XzTI0n5WgG1ayjL/1fr3ki KY7h+/xz8MeZjOyTLEUn1xqPYU0Zk83axljLu93b/vbEJf/ToP5m4QV3RL/XVCEnun meiw1mEmeuHl/UT+AWXFcBomzqReW1PuOYJW9smg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Christophe Leroy , Segher Boessenkool , Michael Ellerman Subject: [PATCH 5.18 1073/1095] powerpc: Fix eh field when calling lwarx on PPC32 Date: Mon, 15 Aug 2022 20:07:52 +0200 Message-Id: <20220815180513.434410333@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy commit 18db466a9a306406dab3b134014d9f6ed642471c upstream. Commit 9401f4e46cf6 ("powerpc: Use lwarx/ldarx directly instead of PPC_LWARX/LDARX macros") properly handled the eh field of lwarx in asm/bitops.h but failed to clear it for PPC32 in asm/simple_spinlock.h So, do as in arch_atomic_try_cmpxchg_lock(), set it to 1 if PPC64 but set it to 0 if PPC32. For that use IS_ENABLED(CONFIG_PPC64) which returns 1 when CONFIG_PPC64 is set and 0 otherwise. Fixes: 9401f4e46cf6 ("powerpc: Use lwarx/ldarx directly instead of PPC_LWAR= X/LDARX macros") Cc: stable@vger.kernel.org # v5.15+ Reported-by: Pali Roh=C3=A1r Signed-off-by: Christophe Leroy Tested-by: Pali Roh=C3=A1r Reviewed-by: Segher Boessenkool [mpe: Use symbolic names, use 'n' constraint per Segher] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/a1176e19e627dd6a1b8d24c6c457a8ab874b7d12.16= 59430931.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/include/asm/simple_spinlock.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/arch/powerpc/include/asm/simple_spinlock.h +++ b/arch/powerpc/include/asm/simple_spinlock.h @@ -48,10 +48,11 @@ static inline int arch_spin_is_locked(ar static inline unsigned long __arch_spin_trylock(arch_spinlock_t *lock) { unsigned long tmp, token; + unsigned int eh =3D IS_ENABLED(CONFIG_PPC64); =20 token =3D LOCK_TOKEN; __asm__ __volatile__( -"1: lwarx %0,0,%2,1\n\ +"1: lwarx %0,0,%2,%[eh]\n\ cmpwi 0,%0,0\n\ bne- 2f\n\ stwcx. %1,0,%2\n\ @@ -59,7 +60,7 @@ static inline unsigned long __arch_spin_ PPC_ACQUIRE_BARRIER "2:" : "=3D&r" (tmp) - : "r" (token), "r" (&lock->slock) + : "r" (token), "r" (&lock->slock), [eh] "n" (eh) : "cr0", "memory"); =20 return tmp; @@ -156,9 +157,10 @@ static inline void arch_spin_unlock(arch static inline long __arch_read_trylock(arch_rwlock_t *rw) { long tmp; + unsigned int eh =3D IS_ENABLED(CONFIG_PPC64); =20 __asm__ __volatile__( -"1: lwarx %0,0,%1,1\n" +"1: lwarx %0,0,%1,%[eh]\n" __DO_SIGN_EXTEND " addic. %0,%0,1\n\ ble- 2f\n" @@ -166,7 +168,7 @@ static inline long __arch_read_trylock(a bne- 1b\n" PPC_ACQUIRE_BARRIER "2:" : "=3D&r" (tmp) - : "r" (&rw->lock) + : "r" (&rw->lock), [eh] "n" (eh) : "cr0", "xer", "memory"); =20 return tmp; @@ -179,17 +181,18 @@ static inline long __arch_read_trylock(a static inline long __arch_write_trylock(arch_rwlock_t *rw) { long tmp, token; + unsigned int eh =3D IS_ENABLED(CONFIG_PPC64); =20 token =3D WRLOCK_TOKEN; __asm__ __volatile__( -"1: lwarx %0,0,%2,1\n\ +"1: lwarx %0,0,%2,%[eh]\n\ cmpwi 0,%0,0\n\ bne- 2f\n" " stwcx. %1,0,%2\n\ bne- 1b\n" PPC_ACQUIRE_BARRIER "2:" : "=3D&r" (tmp) - : "r" (token), "r" (&rw->lock) + : "r" (token), "r" (&rw->lock), [eh] "n" (eh) : "cr0", "memory"); =20 return tmp; From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45184C00140 for ; Mon, 15 Aug 2022 23:43:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353978AbiHOXm7 (ORCPT ); Mon, 15 Aug 2022 19:42:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353855AbiHOXkj (ORCPT ); Mon, 15 Aug 2022 19:40:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BF207AC36; Mon, 15 Aug 2022 13:10:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 91D1760025; Mon, 15 Aug 2022 20:10:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FFB7C433C1; Mon, 15 Aug 2022 20:10:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594220; bh=erej0F3HfFa9PrnUxX23hPKwC7NbDr3RNag2SKdL+00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ziiJtNo8uYw8Gmr43LpcGU1HHR8ea/nkpNyc7G3JCnnOy/PlIbhnA8+WUaRTN3zLH IXL342TBgcu5WbrjHZ1JjHUrfhCdH9jWNv1rCIuq8BGPiNVeh6fnBjMA+ks9OVf3QI 5jvreosYmogmNKETC2mskvbMwCtvpwV3ALQek/Cw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zygo Blaxell , Josef Bacik , Filipe Manana , David Sterba Subject: [PATCH 5.18 1074/1095] btrfs: join running log transaction when logging new name Date: Mon, 15 Aug 2022 20:07:53 +0200 Message-Id: <20220815180513.477170920@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Filipe Manana commit 723df2bcc9e166ac7fb82b3932a53e09415dfcde upstream. When logging a new name, in case of a rename, we pin the log before changing it. We then either delete a directory entry from the log or insert a key range item to mark the old name for deletion on log replay. However when doing one of those log changes we may have another task that started writing out the log (at btrfs_sync_log()) and it started before we pinned the log root. So we may end up changing a log tree while its writeback is being started by another task syncing the log. This can lead to inconsistencies in a log tree and other unexpected results during log replay, because we can get some committed node pointing to a node/leaf that ends up not getting written to disk before the next log commit. The problem, conceptually, started to happen in commit 88d2beec7e53fc ("btrfs: avoid logging all directory changes during renames"), because there we started to update the log without joining its current transaction first. However the problem only became visible with commit 259c4b96d78dda ("btrfs: stop doing unnecessary log updates during a rename"), and that is because we used to pin the log at btrfs_rename() and then before entering btrfs_log_new_name(), when unlinking the old dentry, we ended up at btrfs_del_inode_ref_in_log() and btrfs_del_dir_entries_in_log(). Both of them join the current log transaction, effectively waiting for any log transaction writeout (due to acquiring the root's log_mutex). This made it safe even after leaving the current log transaction, because we remained with the log pinned when we called btrfs_log_new_name(). Then in commit 259c4b96d78dda ("btrfs: stop doing unnecessary log updates during a rename"), we removed the log pinning from btrfs_rename() and stopped calling btrfs_del_inode_ref_in_log() and btrfs_del_dir_entries_in_log() during the rename, and started to do all the needed work at btrfs_log_new_name(), but without joining the current log transaction, only pinning the log, which is racy because another task may have started writeout of the log tree right before we pinned the log. Both commits landed in kernel 5.18, so it doesn't make any practical difference which should be blamed, but I'm blaming the second commit only because with the first one, by chance, the problem did not happen due to the fact we joined the log transaction after pinning the log and unpinned it only after calling btrfs_log_new_name(). So make btrfs_log_new_name() join the current log transaction instead of pinning it, so that we never do log updates if it's writeout is starting. Fixes: 259c4b96d78dda ("btrfs: stop doing unnecessary log updates during a = rename") CC: stable@vger.kernel.org # 5.18+ Reported-by: Zygo Blaxell Tested-by: Zygo Blaxell Reviewed-by: Josef Bacik Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/tree-log.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -7030,8 +7030,15 @@ void btrfs_log_new_name(struct btrfs_tra * anyone from syncing the log until we have updated both inodes * in the log. */ + ret =3D join_running_log_trans(root); + /* + * At least one of the inodes was logged before, so this should + * not fail, but if it does, it's not serious, just bail out and + * mark the log for a full commit. + */ + if (WARN_ON_ONCE(ret < 0)) + goto out; log_pinned =3D true; - btrfs_pin_log_trans(root); =20 path =3D btrfs_alloc_path(); if (!path) { From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8935C00140 for ; Mon, 15 Aug 2022 23:43:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354117AbiHOXnL (ORCPT ); Mon, 15 Aug 2022 19:43:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354082AbiHOXlJ (ORCPT ); Mon, 15 Aug 2022 19:41:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2A95AF48D; Mon, 15 Aug 2022 13:10:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 802746069F; Mon, 15 Aug 2022 20:10:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 878E2C433D6; Mon, 15 Aug 2022 20:10:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594228; bh=iBlodVhxIf0LxzgFBWgv4W30nDtMAnVEY5Fng0C0a7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vy+moCRcXiNaCVSxeDnGb2CrWad2aEmHltzReBCsdwydGsTgri2amuzmfU1qjo5Qa 4YyK3CBPwT3yUf7oWL2n5aVepFks+aQrR+zei3nA6ZKI9cyCLChim8YotuboFJKNLZ uA/SQFZJoOzyxM4OCokPq1Kg4Po7Onu5r/QccaU0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , David Sterba Subject: [PATCH 5.18 1075/1095] btrfs: convert count_max_extents() to use fs_info->max_extent_size Date: Mon, 15 Aug 2022 20:07:54 +0200 Message-Id: <20220815180513.510007223@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota commit 7d7672bc5d1038c745716c397d892d21e29de71c upstream. If count_max_extents() uses BTRFS_MAX_EXTENT_SIZE to calculate the number of extents needed, btrfs release the metadata reservation too much on its way to write out the data. Now that BTRFS_MAX_EXTENT_SIZE is replaced with fs_info->max_extent_size, convert count_max_extents() to use it instead, and fix the calculation of the metadata reservation. CC: stable@vger.kernel.org # 5.12+ Fixes: d8e3fb106f39 ("btrfs: zoned: use ZONE_APPEND write for zoned mode") Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/btrfs/ctree.h | 21 +++++++++++++-------- fs/btrfs/delalloc-space.c | 6 +++--- fs/btrfs/inode.c | 16 ++++++++-------- 3 files changed, 24 insertions(+), 19 deletions(-) --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -107,14 +107,6 @@ struct btrfs_ioctl_encoded_io_args; #define BTRFS_STAT_CURR 0 #define BTRFS_STAT_PREV 1 =20 -/* - * Count how many BTRFS_MAX_EXTENT_SIZE cover the @size - */ -static inline u32 count_max_extents(u64 size) -{ - return div_u64(size + BTRFS_MAX_EXTENT_SIZE - 1, BTRFS_MAX_EXTENT_SIZE); -} - static inline unsigned long btrfs_chunk_item_size(int num_stripes) { BUG_ON(num_stripes =3D=3D 0); @@ -3945,6 +3937,19 @@ static inline bool btrfs_is_zoned(const return fs_info->zoned !=3D 0; } =20 +/* + * Count how many fs_info->max_extent_size cover the @size + */ +static inline u32 count_max_extents(struct btrfs_fs_info *fs_info, u64 siz= e) +{ +#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS + if (!fs_info) + return div_u64(size + BTRFS_MAX_EXTENT_SIZE - 1, BTRFS_MAX_EXTENT_SIZE); +#endif + + return div_u64(size + fs_info->max_extent_size - 1, fs_info->max_extent_s= ize); +} + static inline bool btrfs_is_data_reloc_root(const struct btrfs_root *root) { return root->root_key.objectid =3D=3D BTRFS_DATA_RELOC_TREE_OBJECTID; --- a/fs/btrfs/delalloc-space.c +++ b/fs/btrfs/delalloc-space.c @@ -273,7 +273,7 @@ static void calc_inode_reservations(stru u64 num_bytes, u64 disk_num_bytes, u64 *meta_reserve, u64 *qgroup_reserve) { - u64 nr_extents =3D count_max_extents(num_bytes); + u64 nr_extents =3D count_max_extents(fs_info, num_bytes); u64 csum_leaves =3D btrfs_csum_bytes_to_leaves(fs_info, disk_num_bytes); u64 inode_update =3D btrfs_calc_metadata_size(fs_info, 1); =20 @@ -349,7 +349,7 @@ int btrfs_delalloc_reserve_metadata(stru * needs to free the reservation we just made. */ spin_lock(&inode->lock); - nr_extents =3D count_max_extents(num_bytes); + nr_extents =3D count_max_extents(fs_info, num_bytes); btrfs_mod_outstanding_extents(inode, nr_extents); inode->csum_bytes +=3D disk_num_bytes; btrfs_calculate_inode_block_rsv_size(fs_info, inode); @@ -412,7 +412,7 @@ void btrfs_delalloc_release_extents(stru unsigned num_extents; =20 spin_lock(&inode->lock); - num_extents =3D count_max_extents(num_bytes); + num_extents =3D count_max_extents(fs_info, num_bytes); btrfs_mod_outstanding_extents(inode, -num_extents); btrfs_calculate_inode_block_rsv_size(fs_info, inode); spin_unlock(&inode->lock); --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2159,10 +2159,10 @@ void btrfs_split_delalloc_extent(struct * applies here, just in reverse. */ new_size =3D orig->end - split + 1; - num_extents =3D count_max_extents(new_size); + num_extents =3D count_max_extents(fs_info, new_size); new_size =3D split - orig->start; - num_extents +=3D count_max_extents(new_size); - if (count_max_extents(size) >=3D num_extents) + num_extents +=3D count_max_extents(fs_info, new_size); + if (count_max_extents(fs_info, size) >=3D num_extents) return; } =20 @@ -2219,10 +2219,10 @@ void btrfs_merge_delalloc_extent(struct * this case. */ old_size =3D other->end - other->start + 1; - num_extents =3D count_max_extents(old_size); + num_extents =3D count_max_extents(fs_info, old_size); old_size =3D new->end - new->start + 1; - num_extents +=3D count_max_extents(old_size); - if (count_max_extents(new_size) >=3D num_extents) + num_extents +=3D count_max_extents(fs_info, old_size); + if (count_max_extents(fs_info, new_size) >=3D num_extents) return; =20 spin_lock(&BTRFS_I(inode)->lock); @@ -2301,7 +2301,7 @@ void btrfs_set_delalloc_extent(struct in if (!(state->state & EXTENT_DELALLOC) && (*bits & EXTENT_DELALLOC)) { struct btrfs_root *root =3D BTRFS_I(inode)->root; u64 len =3D state->end + 1 - state->start; - u32 num_extents =3D count_max_extents(len); + u32 num_extents =3D count_max_extents(fs_info, len); bool do_list =3D !btrfs_is_free_space_inode(BTRFS_I(inode)); =20 spin_lock(&BTRFS_I(inode)->lock); @@ -2343,7 +2343,7 @@ void btrfs_clear_delalloc_extent(struct struct btrfs_inode *inode =3D BTRFS_I(vfs_inode); struct btrfs_fs_info *fs_info =3D btrfs_sb(vfs_inode->i_sb); u64 len =3D state->end + 1 - state->start; - u32 num_extents =3D count_max_extents(len); + u32 num_extents =3D count_max_extents(fs_info, len); =20 if ((state->state & EXTENT_DEFRAG) && (*bits & EXTENT_DEFRAG)) { spin_lock(&inode->lock); From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F381C25B08 for ; Mon, 15 Aug 2022 23:43:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354144AbiHOXni (ORCPT ); Mon, 15 Aug 2022 19:43:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354103AbiHOXlO (ORCPT ); Mon, 15 Aug 2022 19:41:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6240D4B0D4; Mon, 15 Aug 2022 13:10:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1D77BB80EA8; Mon, 15 Aug 2022 20:10:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70987C433C1; Mon, 15 Aug 2022 20:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594234; bh=ScgBIY3HQMCcOzB+zPgCsLe9LaGbzeQNrwHYt+biqjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tw2FWiykrK1bkhIv8qkcZitUaQUIHdNeTchXoUhE2C6TauVC28CVTbuxS03LzI6GN ErWqSjA+uEor2/GncMkfG/B4DQyeBfv+PHY2ZMoMfu66IYlKYo1SRFGYVBOY8b4Jqp 5aNQ6X7kpSglz+pcvbVYCkLNJ2tt5RnaE/Av7+1o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhenpeng Lin , Thadeu Lima de Souza Cascardo , Kamal Mostafa , Jamal Hadi Salim , Jakub Kicinski Subject: [PATCH 5.18 1076/1095] net_sched: cls_route: remove from list when handle is 0 Date: Mon, 15 Aug 2022 20:07:55 +0200 Message-Id: <20220815180513.560350758@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thadeu Lima de Souza Cascardo commit 9ad36309e2719a884f946678e0296be10f0bb4c1 upstream. When a route filter is replaced and the old filter has a 0 handle, the old one won't be removed from the hashtable, while it will still be freed. The test was there since before commit 1109c00547fc ("net: sched: RCU cls_route"), when a new filter was not allocated when there was an old one. The old filter was reused and the reinserting would only be necessary if an old filter was replaced. That was still wrong for the same case where the old handle was 0. Remove the old filter from the list independently from its handle value. This fixes CVE-2022-2588, also reported as ZDI-CAN-17440. Reported-by: Zhenpeng Lin Signed-off-by: Thadeu Lima de Souza Cascardo Reviewed-by: Kamal Mostafa Cc: Acked-by: Jamal Hadi Salim Link: https://lore.kernel.org/r/20220809170518.164662-1-cascardo@canonical.= com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/sched/cls_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c @@ -526,7 +526,7 @@ static int route4_change(struct net *net rcu_assign_pointer(f->next, f1); rcu_assign_pointer(*fp, f); =20 - if (fold && fold->handle && f->handle !=3D fold->handle) { + if (fold) { th =3D to_hash(fold->handle); h =3D from_hash(fold->handle >> 16); b =3D rtnl_dereference(head->table[th]); From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FE01C25B08 for ; Mon, 15 Aug 2022 23:43:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354209AbiHOXn4 (ORCPT ); Mon, 15 Aug 2022 19:43:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354126AbiHOXl0 (ORCPT ); Mon, 15 Aug 2022 19:41:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 617C0B8A51; Mon, 15 Aug 2022 13:10:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F33B260025; Mon, 15 Aug 2022 20:10:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0ADE0C433D6; Mon, 15 Aug 2022 20:10:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594241; bh=wrdV1fXSBKWOJtHJ7kC8djl55hFYUK2qDMkSXC92H5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kra0gckRklY9r7iD3KaeTZKDmLJqQ5njHdp24jb08Ex1v4l8m9YrOB4fNZhFbMfKy fzI4/sszj7I2mci5nFzQCms6BOJ6FB5S6hcHjti7MrZeSCYnSBKOJ0G8d0+HZ466Cy MV4SygCs3XEU4qWg/+tp6JFS90n91CPj9TCyZnTQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Soheil Hassas Yeganeh , Shakeel Butt , Wei Wang , "David S. Miller" Subject: [PATCH 5.18 1077/1095] tcp: fix over estimation in sk_forced_mem_schedule() Date: Mon, 15 Aug 2022 20:07:56 +0200 Message-Id: <20220815180513.603052216@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet commit c4ee118561a0f74442439b7b5b486db1ac1ddfeb upstream. sk_forced_mem_schedule() has a bug similar to ones fixed in commit 7c80b038d23e ("net: fix sk_wmem_schedule() and sk_rmem_schedule() errors") While this bug has little chance to trigger in old kernels, we need to fix it before the following patch. Fixes: d83769a580f1 ("tcp: fix possible deadlock in tcp_send_fin()") Signed-off-by: Eric Dumazet Acked-by: Soheil Hassas Yeganeh Reviewed-by: Shakeel Butt Reviewed-by: Wei Wang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/ipv4/tcp_output.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -3367,11 +3367,12 @@ void tcp_xmit_retransmit_queue(struct so */ void sk_forced_mem_schedule(struct sock *sk, int size) { - int amt; + int delta, amt; =20 - if (size <=3D sk->sk_forward_alloc) + delta =3D size - sk->sk_forward_alloc; + if (delta <=3D 0) return; - amt =3D sk_mem_pages(size); + amt =3D sk_mem_pages(delta); sk->sk_forward_alloc +=3D amt * SK_MEM_QUANTUM; sk_memory_allocated_add(sk, amt); From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28181C25B08 for ; Mon, 15 Aug 2022 23:44:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354258AbiHOXoG (ORCPT ); Mon, 15 Aug 2022 19:44:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354153AbiHOXl3 (ORCPT ); Mon, 15 Aug 2022 19:41:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ABC213263F; Mon, 15 Aug 2022 13:10:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 04E1C60B6E; Mon, 15 Aug 2022 20:10:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11464C433D6; Mon, 15 Aug 2022 20:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594247; bh=vDkvebUt7MZA8+U3hS5joEOkD7qc/yPP/d1mBQwSSSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=knRDWrs4cwEwisOzd9V0laaCCsJS3E98QZ4K+20hjQOjPcvMZD4WX6toC8eUZoQI7 2L9s3/LU8MHYQscLM/5tJFrwzE5E1n7kY5LmOk17utfaoJ4VQUAGF1KdiotFIGHMxo cTFqIy/yPxWcsbHc8JjVFJNq/xudHS+55Wpcadjk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , "Jason A. Donenfeld" , Herbert Xu Subject: [PATCH 5.18 1078/1095] crypto: lib/blake2s - reduce stack frame usage in self test Date: Mon, 15 Aug 2022 20:07:57 +0200 Message-Id: <20220815180513.639968639@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld commit d6c14da474bf260d73953fbf7992c98d9112aec7 upstream. Using 3 blocks here doesn't give us much more than using 2, and it causes a stack frame size warning on certain compiler/config/arch combinations: lib/crypto/blake2s-selftest.c: In function 'blake2s_selftest': >> lib/crypto/blake2s-selftest.c:632:1: warning: the frame size of 1088 byt= es is larger than 1024 bytes [-Wframe-larger-than=3D] 632 | } | ^ So this patch just reduces the block from 3 to 2, which makes the warning go away. Reported-by: kernel test robot Link: https://lore.kernel.org/linux-crypto/202206200851.gE3MHCgd-lkp@intel.= com Fixes: 2d16803c562e ("crypto: blake2s - remove shash module") Signed-off-by: Jason A. Donenfeld Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- lib/crypto/blake2s-selftest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/lib/crypto/blake2s-selftest.c +++ b/lib/crypto/blake2s-selftest.c @@ -593,7 +593,7 @@ bool __init blake2s_selftest(void) enum { TEST_ALIGNMENT =3D 16 }; u8 unaligned_block[BLAKE2S_BLOCK_SIZE + TEST_ALIGNMENT - 1] __aligned(TEST_ALIGNMENT); - u8 blocks[BLAKE2S_BLOCK_SIZE * 3]; + u8 blocks[BLAKE2S_BLOCK_SIZE * 2]; struct blake2s_state state1, state2; =20 get_random_bytes(blocks, sizeof(blocks)); @@ -603,8 +603,8 @@ bool __init blake2s_selftest(void) defined(CONFIG_CRYPTO_ARCH_HAVE_LIB_BLAKE2S) memcpy(&state1, &state, sizeof(state1)); memcpy(&state2, &state, sizeof(state2)); - blake2s_compress(&state1, blocks, 3, BLAKE2S_BLOCK_SIZE); - blake2s_compress_generic(&state2, blocks, 3, BLAKE2S_BLOCK_SIZE); + blake2s_compress(&state1, blocks, 2, BLAKE2S_BLOCK_SIZE); + blake2s_compress_generic(&state2, blocks, 2, BLAKE2S_BLOCK_SIZE); if (memcmp(&state1, &state2, sizeof(state1))) { pr_err("blake2s random compress self-test %d: FAIL\n", i + 1); From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1D9FC00140 for ; Mon, 15 Aug 2022 23:44:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353968AbiHOXo0 (ORCPT ); Mon, 15 Aug 2022 19:44:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354171AbiHOXle (ORCPT ); Mon, 15 Aug 2022 19:41:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A2A1BC9; Mon, 15 Aug 2022 13:10:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 08283B80EA9; Mon, 15 Aug 2022 20:10:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DC45C433C1; Mon, 15 Aug 2022 20:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594253; bh=RZ1/XKi6ZZB/5Yh58YWyGEnCsTUCnClIq0g2pJhdLjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KeFuE6cyAuR343bBVOsTpoR83IXVLUUshFvzyFyeeD/nLOl1MsxvLf3mEUUtE3RAD OhlWpWBA3mj/PMLP2L8eslkhUnmubTZSIi2sJlvi46LWzrCmw/PJE/AhGel6iYtOlJ QMWbuuBeK4NAtlxHUW9UfI9MX/WbWUO36TTzTs7Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Eric Dumazet , Jonathan Lemon , Jakub Kicinski Subject: [PATCH 5.18 1079/1095] raw: remove unused variables from raw6_icmp_error() Date: Mon, 15 Aug 2022 20:07:58 +0200 Message-Id: <20220815180513.671224904@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet commit c4fceb46add65481ef0dfb79cad24c3c269b4cad upstream. saddr and daddr are set but not used. Fixes: ba44f8182ec2 ("raw: use more conventional iterators") Reported-by: kernel test robot Signed-off-by: Eric Dumazet Acked-by: Jonathan Lemon Link: https://lore.kernel.org/r/20220622032303.159394-1-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/ipv6/raw.c | 3 --- 1 file changed, 3 deletions(-) --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -332,7 +332,6 @@ static void rawv6_err(struct sock *sk, s void raw6_icmp_error(struct sk_buff *skb, int nexthdr, u8 type, u8 code, int inner_offset, __be32 info) { - const struct in6_addr *saddr, *daddr; struct net *net =3D dev_net(skb->dev); struct hlist_nulls_head *hlist; struct hlist_nulls_node *hnode; @@ -345,8 +344,6 @@ void raw6_icmp_error(struct sk_buff *skb hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) { /* Note: ipv6_hdr(skb) !=3D skb->data */ const struct ipv6hdr *ip6h =3D (const struct ipv6hdr *)skb->data; - saddr =3D &ip6h->saddr; - daddr =3D &ip6h->daddr; =20 if (!raw_v6_match(net, sk, nexthdr, &ip6h->saddr, &ip6h->daddr, inet6_iif(skb), inet6_iif(skb))) From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F09ABC00140 for ; Mon, 15 Aug 2022 23:44:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354073AbiHOXoq (ORCPT ); Mon, 15 Aug 2022 19:44:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354188AbiHOXlg (ORCPT ); Mon, 15 Aug 2022 19:41:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7052B83F33; Mon, 15 Aug 2022 13:11:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2016EB80EA9; Mon, 15 Aug 2022 20:11:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CC8FC433C1; Mon, 15 Aug 2022 20:11:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594262; bh=iYfeC75j6U9orOtsHn0ahFpgAnuaEkZWkuIbvo+iqNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u64gb0jRgJoe0w7lPzZ388S6+U4QUaZQ/R13i9ixk+lIGyFmnPOFuPWGAW2EfgZeV yUczRPdpnMT3+rhCfZkmC8styx/pFF8AMrwjllGsmXKFGlYkOZ1CAKCFYzwwTHeSGL QDEz00Vd4R8p27pwkEpW0Tlo3EMBUAG00mYmRLx4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Sperbeck , Eric Dumazet , Jakub Kicinski Subject: [PATCH 5.18 1080/1095] raw: fix a typo in raw_icmp_error() Date: Mon, 15 Aug 2022 20:07:59 +0200 Message-Id: <20220815180513.710889691@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet commit 97a4d46b1516250d640c1ae0c9e7129d160d6a1c upstream. I accidentally broke IPv4 traceroute, by swapping iph->saddr and iph->daddr. Probably because raw_icmp_error() and raw_v4_input() use different order for iph->saddr and iph->daddr. Fixes: ba44f8182ec2 ("raw: use more conventional iterators") Reported-by: John Sperbeck Signed-off-by: Eric Dumazet Link: https://lore.kernel.org/r/20220623193540.2851799-1-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/ipv4/raw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -278,7 +278,7 @@ void raw_icmp_error(struct sk_buff *skb, hlist_nulls_for_each_entry(sk, hnode, hlist, sk_nulls_node) { iph =3D (const struct iphdr *)skb->data; if (!raw_v4_match(net, sk, iph->protocol, - iph->saddr, iph->daddr, dif, sdif)) + iph->daddr, iph->saddr, dif, sdif)) continue; raw_err(sk, skb, info); } From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAFA0C25B08 for ; Mon, 15 Aug 2022 23:45:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354380AbiHOXo6 (ORCPT ); Mon, 15 Aug 2022 19:44:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354202AbiHOXli (ORCPT ); Mon, 15 Aug 2022 19:41:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DF272705; Mon, 15 Aug 2022 13:11:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 71A1E60B9B; Mon, 15 Aug 2022 20:11:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AF9AC433C1; Mon, 15 Aug 2022 20:11:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594268; bh=UsI/1rvqLECPRbEyqNSSrEWNvQrZbquWROC02DqDgvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xSiu7KmR+75O08RVUGFCu0rEEjaxTtdG2qq/lxvaOuWsAnViKDLnWHBhiyGldILeJ FNSSTLpdZ2gVz3jMivUOBvxgRao9yNk85lX13DxjrpOEAC3OckgAQ4dNpdj1Dk7aUi mY4azbbGBluaSU5ptGn5v1pNTpUbU5BwJszerSUQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Duoming Zhou , Brian Norris , Johannes Berg , Stephen Rothwell Subject: [PATCH 5.18 1081/1095] Revert "mwifiex: fix sleep in atomic context bugs caused by dev_coredumpv" Date: Mon, 15 Aug 2022 20:08:00 +0200 Message-Id: <20220815180513.748936524@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Greg Kroah-Hartman commit 5f8954e099b8ae96e7de1bb95950e00c85bedd40 upstream. This reverts commit a52ed4866d2b90dd5e4ae9dabd453f3ed8fa3cbc as it causes build problems in linux-next. It needs to be reintroduced in a way that can allow the api to evolve and not require a "flag day" to catch all users. Link: https://lore.kernel.org/r/20220623160723.7a44b573@canb.auug.org.au Cc: Duoming Zhou Cc: Brian Norris Cc: Johannes Berg Reported-by: Stephen Rothwell Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/marvell/mwifiex/init.c | 9 ++++----- drivers/net/wireless/marvell/mwifiex/main.h | 3 +-- drivers/net/wireless/marvell/mwifiex/sta_event.c | 6 +++--- 3 files changed, 8 insertions(+), 10 deletions(-) --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -63,10 +63,9 @@ static void wakeup_timer_fn(struct timer adapter->if_ops.card_reset(adapter); } =20 -static void fw_dump_work(struct work_struct *work) +static void fw_dump_timer_fn(struct timer_list *t) { - struct mwifiex_adapter *adapter =3D - container_of(work, struct mwifiex_adapter, devdump_work.work); + struct mwifiex_adapter *adapter =3D from_timer(adapter, t, devdump_timer); =20 mwifiex_upload_device_dump(adapter); } @@ -322,7 +321,7 @@ static void mwifiex_init_adapter(struct adapter->active_scan_triggered =3D false; timer_setup(&adapter->wakeup_timer, wakeup_timer_fn, 0); adapter->devdump_len =3D 0; - INIT_DELAYED_WORK(&adapter->devdump_work, fw_dump_work); + timer_setup(&adapter->devdump_timer, fw_dump_timer_fn, 0); } =20 /* @@ -401,7 +400,7 @@ static void mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter) { del_timer(&adapter->wakeup_timer); - cancel_delayed_work_sync(&adapter->devdump_work); + del_timer_sync(&adapter->devdump_timer); mwifiex_cancel_all_pending_cmd(adapter); wake_up_interruptible(&adapter->cmd_wait_q.wait); wake_up_interruptible(&adapter->hs_activate_wait_q); --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -49,7 +49,6 @@ #include #include #include -#include =20 #include "decl.h" #include "ioctl.h" @@ -1056,7 +1055,7 @@ struct mwifiex_adapter { /* Device dump data/length */ void *devdump_data; int devdump_len; - struct delayed_work devdump_work; + struct timer_list devdump_timer; =20 bool ignore_btcoex_events; }; --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c @@ -623,8 +623,8 @@ mwifiex_fw_dump_info_event(struct mwifie * transmission event get lost, in this cornel case, * user would still get partial of the dump. */ - schedule_delayed_work(&adapter->devdump_work, - msecs_to_jiffies(MWIFIEX_TIMER_10S)); + mod_timer(&adapter->devdump_timer, + jiffies + msecs_to_jiffies(MWIFIEX_TIMER_10S)); } =20 /* Overflow check */ @@ -643,7 +643,7 @@ mwifiex_fw_dump_info_event(struct mwifie return; =20 upload_dump: - cancel_delayed_work_sync(&adapter->devdump_work); + del_timer_sync(&adapter->devdump_timer); mwifiex_upload_device_dump(adapter); } From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07C2FC00140 for ; Mon, 15 Aug 2022 23:49:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344003AbiHOXti (ORCPT ); Mon, 15 Aug 2022 19:49:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354152AbiHOXnk (ORCPT ); Mon, 15 Aug 2022 19:43:40 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A8EA8688C; Mon, 15 Aug 2022 13:13:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 1EAC0CE12C5; Mon, 15 Aug 2022 20:13:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE059C433D6; Mon, 15 Aug 2022 20:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594434; bh=HPQ3uqaqAfVf4S6PuzQ/p3Xy42uW6oBrQE6d2Cc8B6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A+A6i+uW4cNheT+2uiJ4SP4aJjYwdGX2IO/0viOOcwWnE2mfGRulsy8Nmxk595nb6 poRvT3fF+FH+C+JYUqaQwFKEwZcBaOfFGWn89ST6oK1Amc968MCARCggsJPQYKBlFo qlaG2ySYGs6i/gwSfm22NSFTdJmIFFkOJ13LFWDo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Abeni , Mat Martineau , "David S. Miller" Subject: [PATCH 5.18 1082/1095] mptcp: refine memory scheduling Date: Mon, 15 Aug 2022 20:08:01 +0200 Message-Id: <20220815180513.787011365@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paolo Abeni commit 69d93daec026cdda98e29e8edb12534bfa5b1a9b upstream. Similar to commit 7c80b038d23e ("net: fix sk_wmem_schedule() and sk_rmem_schedule() errors"), let the MPTCP receive path schedule exactly the required amount of memory. Signed-off-by: Paolo Abeni Signed-off-by: Mat Martineau Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/mptcp/protocol.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -323,9 +323,10 @@ static bool mptcp_rmem_schedule(struct s struct mptcp_sock *msk =3D mptcp_sk(sk); int amt, amount; =20 - if (size < msk->rmem_fwd_alloc) + if (size <=3D msk->rmem_fwd_alloc) return true; =20 + size -=3D msk->rmem_fwd_alloc; amt =3D sk_mem_pages(size); amount =3D amt << SK_MEM_QUANTUM_SHIFT; msk->rmem_fwd_alloc +=3D amount; From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01DE2C25B0D for ; Mon, 15 Aug 2022 23:45:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354412AbiHOXpO (ORCPT ); Mon, 15 Aug 2022 19:45:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354262AbiHOXlo (ORCPT ); Mon, 15 Aug 2022 19:41:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 530FDA187; Mon, 15 Aug 2022 13:11:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 936F66077B; Mon, 15 Aug 2022 20:11:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99A39C433D6; Mon, 15 Aug 2022 20:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594287; bh=ee2XvZp7qZ5NKC+jn6QmcSc84kcU65loMihwoesT/Xw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sgORQLLwqSN3H7Jwafe7gwiNMZx6WWOhzUHs1r8H7xsqkmXKxDSaZXNsqGxr3O0nT +Jd4s9fFdSnxeBPaAI9MHMPjvgELfoNTefN38Upa3L8Pmx1f73g+a67/7QrfGQu33T RzLYg3jfbwXSEK+zFHIUL5egDzsBsFDyv7AjVDRs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arun Easi , "Steven Rostedt (Google)" Subject: [PATCH 5.18 1083/1095] tracing: Use a copy of the va_list for __assign_vstr() Date: Mon, 15 Aug 2022 20:08:02 +0200 Message-Id: <20220815180513.836978465@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steven Rostedt (Google) commit 3a2dcbaf4d31023106975d6ae75b6df080c454cb upstream. If an instance of tracing enables the same trace event as another instance, or the top level instance, or even perf, then the va_list passed into some tracepoints can be used more than once. As va_list can only be traversed once, this can cause issues: # cat /sys/kernel/tracing/instances/qla2xxx/trace cat-56106 [012] ..... 2419873.470098: ql_dbg_log: qla2xxx [0= 000:05:00.0]-1054:14: Entered (null). cat-56106 [012] ..... 2419873.470101: ql_dbg_log: qla2xxx [0= 000:05:00.0]-1000:14: Entered =C3=97+<96>=C2=B2=C3=9C<98>^H. cat-56106 [012] ..... 2419873.470102: ql_dbg_log: qla2xxx [0= 000:05:00.0]-1006:14: Prepare to issue mbox cmd=3D0xde589000. # cat /sys/kernel/tracing/trace cat-56106 [012] ..... 2419873.470097: ql_dbg_log: qla2xxx [0= 000:05:00.0]-1054:14: Entered qla2x00_get_firmware_state. cat-56106 [012] ..... 2419873.470100: ql_dbg_log: qla2xxx [0= 000:05:00.0]-1000:14: Entered qla2x00_mailbox_command. cat-56106 [012] ..... 2419873.470102: ql_dbg_log: qla2xxx [0= 000:05:00.0]-1006:14: Prepare to issue mbox cmd=3D0x69. The instance version is corrupted because the top level instance iterated the va_list first. Use va_copy() in the __assign_vstr() macro to make sure that each trace event for each use case gets a fresh va_list. Link: https://lore.kernel.org/all/259d53a5-958e-6508-4e45-74dba2821242@marv= ell.com/ Link: https://lkml.kernel.org/r/20220719182004.21daa83e@gandalf.local.home Fixes: 0563231f93c6d ("tracing/events: Add __vstring() and __assign_vstr() = helper macros") Reported-by: Arun Easi Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/trace/stages/stage6_event_callback.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/trace/stages/stage6_event_callback.h b/include/trace/s= tages/stage6_event_callback.h index 0f51f6b3ab70..3c554a585320 100644 --- a/include/trace/stages/stage6_event_callback.h +++ b/include/trace/stages/stage6_event_callback.h @@ -40,7 +40,12 @@ =20 #undef __assign_vstr #define __assign_vstr(dst, fmt, va) \ - vsnprintf(__get_str(dst), TRACE_EVENT_STR_MAX, fmt, *(va)) + do { \ + va_list __cp_va; \ + va_copy(__cp_va, *(va)); \ + vsnprintf(__get_str(dst), TRACE_EVENT_STR_MAX, fmt, __cp_va); \ + va_end(__cp_va); \ + } while (0) =20 #undef __bitmask #define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1) --=20 2.37.2 From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58CFDC2BB9D for ; Mon, 15 Aug 2022 23:47:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355005AbiHOXq5 (ORCPT ); Mon, 15 Aug 2022 19:46:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354326AbiHOXlx (ORCPT ); Mon, 15 Aug 2022 19:41:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B73572C665; Mon, 15 Aug 2022 13:12:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 53C116077B; Mon, 15 Aug 2022 20:12:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 541F9C433C1; Mon, 15 Aug 2022 20:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594356; bh=Y7dWTjLqANNjbJKqLAbtLdNNLRyhsxmBAvgy0geNrzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TTv6G4IfScpWIDNA/Vnmb1rtgz2GFc9biFIAP7ZR2rjEBl9PAIjq169ih7PhWV4yd ItbccRauNFSoJHo9ZVq+bvwlFB2s/6e/IPcIh44SZAY5sNwq2RBlH7IfW00TVf9SVY SDldB4yVGLtVrKFU6Ocy5cbb84HF/tqmwoEwCfgo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski Subject: [PATCH 5.18 1084/1095] net: dsa: felix: fix min gate len calculation for tc when its first gate is closed Date: Mon, 15 Aug 2022 20:08:03 +0200 Message-Id: <20220815180513.883761274@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean commit 7e4babffa6f340a74c820d44d44d16511e666424 upstream. min_gate_len[tc] is supposed to track the shortest interval of continuously open gates for a traffic class. For example, in the following case: TC 76543210 t0 00000001b 200000 ns t1 00000010b 200000 ns min_gate_len[0] and min_gate_len[1] should be 200000, while min_gate_len[2-7] should be 0. However what happens is that min_gate_len[0] is 200000, but min_gate_len[1] ends up being 0 (despite gate_len[1] being 200000 at the point where the logic detects the gate close event for TC 1). The problem is that the code considers a "gate close" event whenever it sees that there is a 0 for that TC (essentially it's level rather than edge triggered). By doing that, any time a gate is seen as closed without having been open prior, gate_len, which is 0, will be written into min_gate_len. Once min_gate_len becomes 0, it's impossible for it to track anything higher than that (the length of actually open intervals). To fix this, we make the writing to min_gate_len[tc] be edge-triggered, which avoids writes for gates that are closed in consecutive intervals. However what this does is it makes us need to special-case the permanently closed gates at the end. Fixes: 55a515b1f5a9 ("net: dsa: felix: drop oversized frames with tc-taprio= instead of hanging the port") Signed-off-by: Vladimir Oltean Link: https://lore.kernel.org/r/20220804202817.1677572-1-vladimir.oltean@nx= p.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/dsa/ocelot/felix_vsc9959.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1133,6 +1133,7 @@ static void vsc9959_tas_min_gate_lengths { struct tc_taprio_sched_entry *entry; u64 gate_len[OCELOT_NUM_TC]; + u8 gates_ever_opened =3D 0; int tc, i, n; =20 /* Initialize arrays */ @@ -1160,16 +1161,28 @@ static void vsc9959_tas_min_gate_lengths for (tc =3D 0; tc < OCELOT_NUM_TC; tc++) { if (entry->gate_mask & BIT(tc)) { gate_len[tc] +=3D entry->interval; + gates_ever_opened |=3D BIT(tc); } else { /* Gate closes now, record a potential new * minimum and reinitialize length */ - if (min_gate_len[tc] > gate_len[tc]) + if (min_gate_len[tc] > gate_len[tc] && + gate_len[tc]) min_gate_len[tc] =3D gate_len[tc]; gate_len[tc] =3D 0; } } } + + /* min_gate_len[tc] actually tracks minimum *open* gate time, so for + * permanently closed gates, min_gate_len[tc] will still be U64_MAX. + * Therefore they are currently indistinguishable from permanently + * open gates. Overwrite the gate len with 0 when we know they're + * actually permanently closed, i.e. after the loop above. + */ + for (tc =3D 0; tc < OCELOT_NUM_TC; tc++) + if (!(gates_ever_opened & BIT(tc))) + min_gate_len[tc] =3D 0; } =20 /* Update QSYS_PORT_MAX_SDU to make sure the static guard bands added by t= he From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88A57C00140 for ; Mon, 15 Aug 2022 23:49:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354635AbiHOXtB (ORCPT ); Mon, 15 Aug 2022 19:49:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354557AbiHOXm0 (ORCPT ); Mon, 15 Aug 2022 19:42:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FBD248EBE; Mon, 15 Aug 2022 13:13:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7B385B80EAB; Mon, 15 Aug 2022 20:13:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8543C433C1; Mon, 15 Aug 2022 20:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594419; bh=6aBMzaqoaG5/pDLHyavSbk3RURz9kTZQdE3pp1Q3vSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O9tvYZ+B3Fzt3+SLHyGIX+is8o7NtN7Qc9DMujxwgS9VFmEDDx3S9/LMAy3OGIGuI yx8IBIg9PIstsg5g4YhK6X+Ts7B0Jqp3EtHONG944SubmVej3BNtzqF4fttLc7rc3u gAMOZLYNXS/+AsMGX0qcIwA45dW9gcADZefVl+lE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Gordeev Subject: [PATCH 5.18 1085/1095] Revert "s390/smp: enforce lowcore protection on CPU restart" Date: Mon, 15 Aug 2022 20:08:04 +0200 Message-Id: <20220815180513.931633763@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev commit 953503751a426413ea8aee2299ae3ee971b70d9b upstream. This reverts commit 6f5c672d17f583b081e283927f5040f726c54598. This breaks normal crash dump when CPU0 is offline. Signed-off-by: Alexander Gordeev Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/s390/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -508,8 +508,8 @@ static void __init setup_lowcore_dat_on( S390_lowcore.svc_new_psw.mask |=3D PSW_MASK_DAT; S390_lowcore.program_new_psw.mask |=3D PSW_MASK_DAT; S390_lowcore.io_new_psw.mask |=3D PSW_MASK_DAT; - __ctl_set_bit(0, 28); __ctl_store(S390_lowcore.cregs_save_area, 0, 15); + __ctl_set_bit(0, 28); put_abs_lowcore(restart_flags, RESTART_FLAG_CTLREGS); put_abs_lowcore(program_new_psw, lc->program_new_psw); for (cr =3D 0; cr < ARRAY_SIZE(lc->cregs_save_area); cr++) From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F9DFC00140 for ; Mon, 15 Aug 2022 23:49:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354655AbiHOXtP (ORCPT ); Mon, 15 Aug 2022 19:49:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353643AbiHOXma (ORCPT ); Mon, 15 Aug 2022 19:42:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B386D84EF0; Mon, 15 Aug 2022 13:13:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CE58060F0C; Mon, 15 Aug 2022 20:13:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6C81C433D6; Mon, 15 Aug 2022 20:13:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594425; bh=nOfKq7c1vjoucNhMxCONBAKa9x7dzyly5obHXmxWhyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IdqOUL0wOlOJ8A6oyy+SFAZpiLEGyyFzOCrYdZTmwMBPFosYfAoSb5aU8vWR0xNfL /xQJ9hdCmxmjkRt91FicrPUvCpRDYprn07hcmQ8WzDx6XfAPJxAmN5kfBD+lv8nTCQ zBFAN8ZhOXFbkrcMmeD+q+qtef7mzPZvIfTz8X8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Russell Currey , Michael Ellerman Subject: [PATCH 5.18 1086/1095] powerpc/kexec: Fix build failure from uninitialised variable Date: Mon, 15 Aug 2022 20:08:05 +0200 Message-Id: <20220815180513.963060377@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Russell Currey commit 83ee9f23763a432a4077bf20624ee35de87bce99 upstream. clang 14 won't build because ret is uninitialised and can be returned if both prop and fdtprop are NULL. Drop the ret variable and return an error in that failure case. Fixes: b1fc44eaa9ba ("pseries/iommu/ddw: Fix kdump to work in absence of ib= m,dma-window") Suggested-by: Christophe Leroy Signed-off-by: Russell Currey Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220810054331.373761-1-ruscur@russell.cc Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/powerpc/kexec/file_load_64.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -1043,17 +1043,17 @@ static int copy_property(void *fdt, int const char *propname) { const void *prop, *fdtprop; - int len =3D 0, fdtlen =3D 0, ret; + int len =3D 0, fdtlen =3D 0; =20 prop =3D of_get_property(dn, propname, &len); fdtprop =3D fdt_getprop(fdt, node_offset, propname, &fdtlen); =20 if (fdtprop && !prop) - ret =3D fdt_delprop(fdt, node_offset, propname); + return fdt_delprop(fdt, node_offset, propname); else if (prop) - ret =3D fdt_setprop(fdt, node_offset, propname, prop, len); - - return ret; + return fdt_setprop(fdt, node_offset, propname, prop, len); + else + return -FDT_ERR_NOTFOUND; } =20 static int update_pci_dma_nodes(void *fdt, const char *dmapropname) From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9188C00140 for ; Mon, 15 Aug 2022 23:49:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354682AbiHOXt3 (ORCPT ); Mon, 15 Aug 2022 19:49:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354067AbiHOXnB (ORCPT ); Mon, 15 Aug 2022 19:43:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB1D585F9D; Mon, 15 Aug 2022 13:13:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CF8BD60B9B; Mon, 15 Aug 2022 20:13:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5CF7C433D6; Mon, 15 Aug 2022 20:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594431; bh=DifRuWLDUKTF16Tjj2WmuoGaULdZ8SmwCsUER15xP5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qFTbN+G7pUukMEC1vD5HnWfCXcoCgv/G4nGBs0F4CcjuXGs4siZa7wOoNbV159D8N hHKr3KezNZOcceJg9tVk1mue30FTr3dQp5qYNmrxU6Vuda2BhKznfmmM0/osnkBCih LcPH11X6WCBTZBY4TAWyFPdHOzArcul4V4gPGAOo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Jonas Karlman , Laurent Pinchart , Lucas Stach , Maxime Ripard , Neil Armstrong , Robert Foss , Sam Ravnborg Subject: [PATCH 5.18 1087/1095] drm/bridge: tc358767: Fix (e)DP bridge endpoint parsing in dedicated function Date: Mon, 15 Aug 2022 20:08:06 +0200 Message-Id: <20220815180514.002598256@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marek Vasut commit 9030a9e571b3ba250d3d450a98310e3c74ecaff4 upstream. Per toshiba,tc358767.yaml DT binding document, port@2 the output (e)DP port is optional. In case this port is not described in DT, the bridge driver operates in DPI-to-DP mode. The drm_of_find_panel_or_bridge() call in tc_probe_edp_bridge_endpoint() returns -ENODEV in case port@2 is not present in DT and this specific return value is incorrectly propagated outside of tc_probe_edp_bridge_endpoint() function. All other error values must be propagated and are propagated correctly. Return 0 in case the port@2 is missing instead, that reinstates the original behavior before the commit this patch fixes. Fixes: 8478095a8c4b ("drm/bridge: tc358767: Move (e)DP bridge endpoint pars= ing into dedicated function") Signed-off-by: Marek Vasut Cc: Jonas Karlman Cc: Laurent Pinchart Cc: Lucas Stach Cc: Marek Vasut Cc: Maxime Ripard Cc: Neil Armstrong Cc: Robert Foss Cc: Sam Ravnborg Reviewed-by: Lucas Stach Link: https://patchwork.freedesktop.org/patch/msgid/20220428213132.447890-1= -marex@denx.de Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/tc358767.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1573,7 +1573,7 @@ static int tc_probe_edp_bridge_endpoint( tc->bridge.type =3D DRM_MODE_CONNECTOR_DisplayPort; } =20 - return ret; + return 0; } =20 static void tc_clk_disable(void *data) From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE481C25B0D for ; Mon, 15 Aug 2022 23:45:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245558AbiHOXpW (ORCPT ); Mon, 15 Aug 2022 19:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354283AbiHOXlr (ORCPT ); Mon, 15 Aug 2022 19:41:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 244CAB86B; Mon, 15 Aug 2022 13:11:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B4ED06077B; Mon, 15 Aug 2022 20:11:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA20AC433C1; Mon, 15 Aug 2022 20:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594293; bh=m6tmQ3fcvqEazC3ml2tP0P8yC/apYVAOn4jfufH1sJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tjp8GdQThCTq0OsWotrGBEoZ04KsIiLE2Ewu0rqN3H/W8P5QyUnvAEuRnCm6IrYMe 3gRCJ/sg+ox56h2cT3F96k2BowJMq83KkGn+GSck2+5lnVL9bLspwswb2VNA/lyCrU bL4Wm/s1IKa05iU3GlVAJQqxmQdRDVExW4vYPcAQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Kumar Kartikeya Dwivedi , Alexei Starovoitov Subject: [PATCH 5.18 1088/1095] bpf: Fix sparse warning for bpf_kptr_xchg_proto Date: Mon, 15 Aug 2022 20:08:07 +0200 Message-Id: <20220815180514.042329632@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kumar Kartikeya Dwivedi commit 5b74c690e1c55953ec99fd9dab74f72dbee4fe95 upstream. Kernel Test Robot complained about missing static storage class annotation for bpf_kptr_xchg_proto variable. sparse: symbol 'bpf_kptr_xchg_proto' was not declared. Should it be static? This caused by missing extern definition in the header. Add it to suppress the sparse warning. Fixes: c0a5a21c25f3 ("bpf: Allow storing referenced kptr in map") Reported-by: kernel test robot Signed-off-by: Kumar Kartikeya Dwivedi Link: https://lore.kernel.org/r/20220511194654.765705-2-memxor@gmail.com Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/linux/bpf.h | 1 + 1 file changed, 1 insertion(+) --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -2228,6 +2228,7 @@ extern const struct bpf_func_proto bpf_f extern const struct bpf_func_proto bpf_loop_proto; extern const struct bpf_func_proto bpf_strncmp_proto; extern const struct bpf_func_proto bpf_copy_from_user_task_proto; +extern const struct bpf_func_proto bpf_kptr_xchg_proto; =20 const struct bpf_func_proto *tracing_prog_func_proto( enum bpf_func_id func_id, const struct bpf_prog *prog); From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B63DFC00140 for ; Mon, 15 Aug 2022 23:47:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354435AbiHOXpj (ORCPT ); Mon, 15 Aug 2022 19:45:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354288AbiHOXls (ORCPT ); Mon, 15 Aug 2022 19:41:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46E2DF5B1; Mon, 15 Aug 2022 13:11:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D6C5960B9B; Mon, 15 Aug 2022 20:11:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D41B6C433D6; Mon, 15 Aug 2022 20:11:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594299; bh=umu5Qdb7zS/cnY4uOR10gFUBOzmjDd7cXOrW7/1kgDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mQosnbe/+YJLiaoC4wq6go5MGrK7+uxXsUV6uYAzAJxpXJpYaRe5bAglI8p78viDG 8jLs1/RERKnOEseqdFxXFJz8ZbEGnsctXlJLlJMK6dGQDwkj9tvY2cTPiX/Wbpvn91 ml6WvvptAY7TurzYRqYy6YHt56ykGNIz5EPTq/fg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Kumar Kartikeya Dwivedi , Daniel Borkmann Subject: [PATCH 5.18 1089/1095] bpf: Suppress passing zero to PTR_ERR warning Date: Mon, 15 Aug 2022 20:08:08 +0200 Message-Id: <20220815180514.073914895@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kumar Kartikeya Dwivedi commit 1ec5ee8c8a5a65ea377f8bea64bf4d5b743f6f79 upstream. Kernel Test Robot complains about passing zero to PTR_ERR for the said line, suppress it by using PTR_ERR_OR_ZERO. Fixes: c0a5a21c25f3 ("bpf: Allow storing referenced kptr in map") Reported-by: kernel test robot Signed-off-by: Kumar Kartikeya Dwivedi Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20220521132620.1976921-1-memxor@gmail.com Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -5327,7 +5327,7 @@ static int process_kptr_func(struct bpf_ return -EINVAL; } if (!map_value_has_kptrs(map_ptr)) { - ret =3D PTR_ERR(map_ptr->kptr_off_tab); + ret =3D PTR_ERR_OR_ZERO(map_ptr->kptr_off_tab); if (ret =3D=3D -E2BIG) verbose(env, "map '%s' has more than %d kptr\n", map_ptr->name, BPF_MAP_VALUE_OFF_MAX); From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E6C9C2BB41 for ; Mon, 15 Aug 2022 23:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233487AbiHOXpn (ORCPT ); Mon, 15 Aug 2022 19:45:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354296AbiHOXlt (ORCPT ); Mon, 15 Aug 2022 19:41:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7499D2A414; Mon, 15 Aug 2022 13:11:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2B560B80EAD; Mon, 15 Aug 2022 20:11:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70F53C433C1; Mon, 15 Aug 2022 20:11:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594305; bh=sCNQHxIcqQE3JOMnC1htlcE1nC/bTIllDvjHDq3ZsNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HSK4rZgK/gKM4ACwZ8Oj3El+DDhRafw/kkAo9U/difW93scZTw04MQSuPFrNK+xAf IkuH3/0+iSQnegXB3E7iqjdHWAzfN6PGSsrwd9+fpH6HfBrkKPeDG3ayDwDYtwt6OK f/sbUcWZbX87TpThJCCxKwtZFsNItSwGYboiBmxI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Simon Han , Lukas Wunner , Jakub Kicinski Subject: [PATCH 5.18 1090/1095] net: phy: smsc: Disable Energy Detect Power-Down in interrupt mode Date: Mon, 15 Aug 2022 20:08:09 +0200 Message-Id: <20220815180514.105918423@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Wunner commit 2642cc6c3bbe0900ba15bab078fd15ad8baccbc5 upstream. Simon reports that if two LAN9514 USB adapters are directly connected without an intermediate switch, the link fails to come up and link LEDs remain dark. The issue was introduced by commit 1ce8b37241ed ("usbnet: smsc95xx: Forward PHY interrupts to PHY driver to avoid polling"). The PHY suffers from a known erratum wherein link detection becomes unreliable if Energy Detect Power-Down is used. In poll mode, the driver works around the erratum by briefly disabling EDPD for 640 msec to detect a neighbor, then re-enabling it to save power. In interrupt mode, no interrupt is signaled if EDPD is used by both link partners, so it must not be enabled at all. We'll recoup the power savings by enabling SUSPEND1 mode on affected LAN95xx chips in a forthcoming commit. Fixes: 1ce8b37241ed ("usbnet: smsc95xx: Forward PHY interrupts to PHY drive= r to avoid polling") Reported-by: Simon Han Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/439a3f3168c2f9d44b5fd9bb8d2b551711316be6.16= 55714438.git.lukas@wunner.de Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/phy/smsc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -110,7 +110,7 @@ static int smsc_phy_config_init(struct p struct smsc_phy_priv *priv =3D phydev->priv; int rc; =20 - if (!priv->energy_enable) + if (!priv->energy_enable || phydev->irq !=3D PHY_POLL) return 0; =20 rc =3D phy_read(phydev, MII_LAN83C185_CTRL_STATUS); @@ -210,6 +210,8 @@ static int lan95xx_config_aneg_ext(struc * response on link pulses to detect presence of plugged Ethernet cable. * The Energy Detect Power-Down mode is enabled again in the end of proced= ure to * save approximately 220 mW of power if cable is unplugged. + * The workaround is only applicable to poll mode. Energy Detect Power-Dow= n may + * not be used in interrupt mode lest link change detection becomes unreli= able. */ static int lan87xx_read_status(struct phy_device *phydev) { @@ -217,7 +219,7 @@ static int lan87xx_read_status(struct ph =20 int err =3D genphy_read_status(phydev); =20 - if (!phydev->link && priv->energy_enable) { + if (!phydev->link && priv->energy_enable && phydev->irq =3D=3D PHY_POLL) { /* Disable EDPD to wake up PHY */ int rc =3D phy_read(phydev, MII_LAN83C185_CTRL_STATUS); if (rc < 0) From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B8DEC25B0E for ; Mon, 15 Aug 2022 23:47:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354647AbiHOXqH (ORCPT ); Mon, 15 Aug 2022 19:46:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354302AbiHOXlt (ORCPT ); Mon, 15 Aug 2022 19:41:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D2132AC7A; Mon, 15 Aug 2022 13:11:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5D9DDB80EAB; Mon, 15 Aug 2022 20:11:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD6A2C433D6; Mon, 15 Aug 2022 20:11:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594313; bh=p/O0LDyyq9AqZBejxAuS6ttpxfyeEiB6lwRwgZJz5hM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x5+GHC+a0jsSEkFXEHZX8jtx1vh64/+WQk00eQmZnksDQ9dkgo75KsWa6aEOZkedS 2WkDj25XkK1KvvuIKLUICdCQhGKOrK5zJLLTM7XcE8NY56qd9VcC6H15cIiaQFflAi zRFa0psc5F235VWRXB5Yo+dSh/YT9PTZG++kAtvo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daeho Jeong , Chao Yu , Jaegeuk Kim Subject: [PATCH 5.18 1091/1095] f2fs: revive F2FS_IOC_ABORT_VOLATILE_WRITE Date: Mon, 15 Aug 2022 20:08:10 +0200 Message-Id: <20220815180514.151114549@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daeho Jeong commit 23339e5752d01a4b5e122759b002cf896d26f6c1 upstream. F2FS_IOC_ABORT_VOLATILE_WRITE was used to abort a atomic write before. However it was removed accidentally. So revive it by changing the name, since volatile write had gone. Signed-off-by: Daeho Jeong Fiexes: 7bc155fec5b3("f2fs: kill volatile write support") Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/f2fs/file.c | 30 ++++++++++++++++++++++++++++-- include/uapi/linux/f2fs.h | 2 +- 2 files changed, 29 insertions(+), 3 deletions(-) --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2102,6 +2102,31 @@ unlock_out: return ret; } =20 +static int f2fs_ioc_abort_atomic_write(struct file *filp) +{ + struct inode *inode =3D file_inode(filp); + struct user_namespace *mnt_userns =3D file_mnt_user_ns(filp); + int ret; + + if (!inode_owner_or_capable(mnt_userns, inode)) + return -EACCES; + + ret =3D mnt_want_write_file(filp); + if (ret) + return ret; + + inode_lock(inode); + + if (f2fs_is_atomic_file(inode)) + f2fs_abort_atomic_write(inode, true); + + inode_unlock(inode); + + mnt_drop_write_file(filp); + f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); + return ret; +} + static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) { struct inode *inode =3D file_inode(filp); @@ -4039,9 +4064,10 @@ static long __f2fs_ioctl(struct file *fi return f2fs_ioc_start_atomic_write(filp); case F2FS_IOC_COMMIT_ATOMIC_WRITE: return f2fs_ioc_commit_atomic_write(filp); + case F2FS_IOC_ABORT_ATOMIC_WRITE: + return f2fs_ioc_abort_atomic_write(filp); case F2FS_IOC_START_VOLATILE_WRITE: case F2FS_IOC_RELEASE_VOLATILE_WRITE: - case F2FS_IOC_ABORT_VOLATILE_WRITE: return -EOPNOTSUPP; case F2FS_IOC_SHUTDOWN: return f2fs_ioc_shutdown(filp, arg); @@ -4666,7 +4692,7 @@ long f2fs_compat_ioctl(struct file *file case F2FS_IOC_COMMIT_ATOMIC_WRITE: case F2FS_IOC_START_VOLATILE_WRITE: case F2FS_IOC_RELEASE_VOLATILE_WRITE: - case F2FS_IOC_ABORT_VOLATILE_WRITE: + case F2FS_IOC_ABORT_ATOMIC_WRITE: case F2FS_IOC_SHUTDOWN: case FITRIM: case FS_IOC_SET_ENCRYPTION_POLICY: --- a/include/uapi/linux/f2fs.h +++ b/include/uapi/linux/f2fs.h @@ -13,7 +13,7 @@ #define F2FS_IOC_COMMIT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 2) #define F2FS_IOC_START_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 3) #define F2FS_IOC_RELEASE_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 4) -#define F2FS_IOC_ABORT_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 5) +#define F2FS_IOC_ABORT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 5) #define F2FS_IOC_GARBAGE_COLLECT _IOW(F2FS_IOCTL_MAGIC, 6, __u32) #define F2FS_IOC_WRITE_CHECKPOINT _IO(F2FS_IOCTL_MAGIC, 7) #define F2FS_IOC_DEFRAGMENT _IOWR(F2FS_IOCTL_MAGIC, 8, \ From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CAD8C25B0D for ; Mon, 15 Aug 2022 23:47:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354609AbiHOXqB (ORCPT ); Mon, 15 Aug 2022 19:46:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354305AbiHOXlu (ORCPT ); Mon, 15 Aug 2022 19:41:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8BD52BB24; Mon, 15 Aug 2022 13:12:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9CB26B80EA8; Mon, 15 Aug 2022 20:12:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5A01C433D6; Mon, 15 Aug 2022 20:11:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594319; bh=MiXMrstoPWpyTCuBDxKm+tRaMe6TlgPj+u9hx714plc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HhWZM0s3IIBzGxwSScSTWoE+30kJetG/u0pxcI4I+c45rW2TUYBLAAcfjWz/hmPIm ssR9ZOjshSlfu2DeOUYegcZvs7Ol15Jm4Fq4gMWcWkEvVnxBFJNdpnTRN8RVpaD+Ke wse2Yl72CuFut0Yp+m9OaEzHd/fYFiBo+cIlytN4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , Maxime Ripard Subject: [PATCH 5.18 1092/1095] drm/vc4: change vc4_dma_range_matches from a global to static Date: Mon, 15 Aug 2022 20:08:11 +0200 Message-Id: <20220815180514.184361196@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tom Rix commit 63569d90863ff26c8b10c8971d1271c17a45224b upstream. sparse reports drivers/gpu/drm/vc4/vc4_drv.c:270:27: warning: symbol 'vc4_dma_range_matche= s' was not declared. Should it be static? vc4_dma_range_matches is only used in vc4_drv.c, so it's storage class spec= ifier should be static. Fixes: da8e393e23ef ("drm/vc4: drv: Adopt the dma configuration from the HV= S or V3D component") Signed-off-by: Tom Rix Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20220629200101.498138-1= -trix@redhat.com Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -209,7 +209,7 @@ static void vc4_match_add_drivers(struct } } =20 -const struct of_device_id vc4_dma_range_matches[] =3D { +static const struct of_device_id vc4_dma_range_matches[] =3D { { .compatible =3D "brcm,bcm2711-hvs" }, { .compatible =3D "brcm,bcm2835-hvs" }, { .compatible =3D "brcm,bcm2835-v3d" }, From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6121C28B2B for ; Mon, 15 Aug 2022 23:47:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354704AbiHOXqP (ORCPT ); Mon, 15 Aug 2022 19:46:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354313AbiHOXlv (ORCPT ); Mon, 15 Aug 2022 19:41:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C14F2C12B; Mon, 15 Aug 2022 13:12:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5F848B80EAD; Mon, 15 Aug 2022 20:12:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0FBAC433D7; Mon, 15 Aug 2022 20:12:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594328; bh=1YBFdy1O2IEzCfN13KPtg/6oT27WVmCDpW1qbY3k+RM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UtRTQrQDZIYuMhupih7in6oY3fmO75m1vOD62ilaylSfnUbI4eiyW8isxSmm+AEWs wr9f14uYAaDroKmpqfgoOxoVFqjBiOLKojFoaiLGX+eBNbAdIYIHvlq/3J1fYQE7GF bm52Av93lFykVxoueGTaGFZhXKCy3wVAAWO6asdE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Bin , Chao Yu , Jaegeuk Kim Subject: [PATCH 5.18 1093/1095] f2fs: fix null-ptr-deref in f2fs_get_dnode_of_data Date: Mon, 15 Aug 2022 20:08:12 +0200 Message-Id: <20220815180514.218935451@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ye Bin commit 4a2c5b7994960fac29cf8a3f4e62855bae1b27d4 upstream. There is issue as follows when test f2fs atomic write: F2FS-fs (loop0): Can't find valid F2FS filesystem in 2th superblock F2FS-fs (loop0): invalid crc_offset: 0 F2FS-fs (loop0): f2fs_check_nid_range: out-of-range nid=3D1, run fsck to fi= x. F2FS-fs (loop0): f2fs_check_nid_range: out-of-range nid=3D2, run fsck to fi= x. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BUG: KASAN: null-ptr-deref in f2fs_get_dnode_of_data+0xac/0x16d0 Read of size 8 at addr 0000000000000028 by task rep/1990 CPU: 4 PID: 1990 Comm: rep Not tainted 5.19.0-rc6-next-20220715 #266 Call Trace: dump_stack_lvl+0x6e/0x91 print_report.cold+0x49a/0x6bb kasan_report+0xa8/0x130 f2fs_get_dnode_of_data+0xac/0x16d0 f2fs_do_write_data_page+0x2a5/0x1030 move_data_page+0x3c5/0xdf0 do_garbage_collect+0x2015/0x36c0 f2fs_gc+0x554/0x1d30 f2fs_balance_fs+0x7f5/0xda0 f2fs_write_single_data_page+0xb66/0xdc0 f2fs_write_cache_pages+0x716/0x1420 f2fs_write_data_pages+0x84f/0x9a0 do_writepages+0x130/0x3a0 filemap_fdatawrite_wbc+0x87/0xa0 file_write_and_wait_range+0x157/0x1c0 f2fs_do_sync_file+0x206/0x12d0 f2fs_sync_file+0x99/0xc0 vfs_fsync_range+0x75/0x140 f2fs_file_write_iter+0xd7b/0x1850 vfs_write+0x645/0x780 ksys_write+0xf1/0x1e0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd As 3db1de0e582c commit changed atomic write way which new a cow_inode for atomic write file, and also mark cow_inode as FI_ATOMIC_FILE. When f2fs_do_write_data_page write cow_inode will use cow_inode's cow_inode which is NULL. Then will trigger null-ptr-deref. To solve above issue, introduce FI_COW_FILE flag for COW inode. Fiexes: 3db1de0e582c("f2fs: change the current atomic write way") Signed-off-by: Ye Bin Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/f2fs/f2fs.h | 6 ++++++ fs/f2fs/file.c | 2 +- fs/f2fs/segment.c | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -756,6 +756,7 @@ enum { FI_ENABLE_COMPRESS, /* enable compression in "user" compression mode */ FI_COMPRESS_RELEASED, /* compressed blocks were released */ FI_ALIGNED_WRITE, /* enable aligned write */ + FI_COW_FILE, /* indicate COW file */ FI_MAX, /* max flag, never be used */ }; =20 @@ -3188,6 +3189,11 @@ static inline bool f2fs_is_atomic_file(s return is_inode_flag_set(inode, FI_ATOMIC_FILE); } =20 +static inline bool f2fs_is_cow_file(struct inode *inode) +{ + return is_inode_flag_set(inode, FI_COW_FILE); +} + static inline bool f2fs_is_first_block_written(struct inode *inode) { return is_inode_flag_set(inode, FI_FIRST_BLOCK_WRITTEN); --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2055,7 +2055,7 @@ static int f2fs_ioc_start_atomic_write(s spin_unlock(&sbi->inode_lock[ATOMIC_FILE]); =20 set_inode_flag(inode, FI_ATOMIC_FILE); - set_inode_flag(fi->cow_inode, FI_ATOMIC_FILE); + set_inode_flag(fi->cow_inode, FI_COW_FILE); clear_inode_flag(fi->cow_inode, FI_INLINE_DATA); f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); =20 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -193,7 +193,7 @@ void f2fs_abort_atomic_write(struct inod if (f2fs_is_atomic_file(inode)) { if (clean) truncate_inode_pages_final(inode->i_mapping); - clear_inode_flag(fi->cow_inode, FI_ATOMIC_FILE); + clear_inode_flag(fi->cow_inode, FI_COW_FILE); iput(fi->cow_inode); fi->cow_inode =3D NULL; clear_inode_flag(inode, FI_ATOMIC_FILE); @@ -3167,7 +3167,7 @@ static int __get_segment_type_6(struct f return CURSEG_COLD_DATA; if (file_is_hot(inode) || is_inode_flag_set(inode, FI_HOT_DATA) || - f2fs_is_atomic_file(inode)) + f2fs_is_cow_file(inode)) return CURSEG_HOT_DATA; return f2fs_rw_hint_to_seg_type(inode->i_write_hint); } else { From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83947C25B08 for ; Mon, 15 Aug 2022 23:47:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354678AbiHOXqJ (ORCPT ); Mon, 15 Aug 2022 19:46:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354315AbiHOXlw (ORCPT ); Mon, 15 Aug 2022 19:41:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03BE62C64D; Mon, 15 Aug 2022 13:12:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BC76FB80EA9; Mon, 15 Aug 2022 20:12:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FC26C433D6; Mon, 15 Aug 2022 20:12:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594334; bh=WkeaMXg8g2mDWR9wbrsSqC/qSPKJQjDfLTRD4TGn7zs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x9rYiX/vwMDh9S3NQigifed4vlelYja8A/rWjOzlezFGhIA+P5XHDg234CbNJgJVJ UxYbu/W2VQF6mKjDFpEDicSTJH2gKXWtjJIq1OUznFcvSzcUKTcw8AaDrvP3LtivmT 0Ne7HDXh94BuHAzH+QSpXMh/zUdEKcyvjieZ6lmU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 5.18 1094/1095] io_uring: mem-account pbuf buckets Date: Mon, 15 Aug 2022 20:08:13 +0200 Message-Id: <20220815180514.265719320@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavel Begunkov commit cc18cc5e82033d406f54144ad6f8092206004684 upstream. Potentially, someone may create as many pbuf bucket as there are indexes in an xarray without any other restrictions bounding our memory usage, put memory needed for the buckets under memory accounting. Cc: Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/d34c452e45793e978d26e2606211ec9070d329ea.16= 59622312.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- io_uring/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -4927,7 +4927,7 @@ static int io_provide_buffers(struct io_ =20 bl =3D io_buffer_get_list(ctx, p->bgid); if (unlikely(!bl)) { - bl =3D kmalloc(sizeof(*bl), GFP_KERNEL); + bl =3D kzalloc(sizeof(*bl), GFP_KERNEL_ACCOUNT); if (!bl) { ret =3D -ENOMEM; goto err; From nobody Fri Oct 24 20:17:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 679BAC32757 for ; Mon, 15 Aug 2022 23:47:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355065AbiHOXrB (ORCPT ); Mon, 15 Aug 2022 19:47:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354318AbiHOXlx (ORCPT ); Mon, 15 Aug 2022 19:41:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72D312C652; Mon, 15 Aug 2022 13:12:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 10DFD60B6E; Mon, 15 Aug 2022 20:12:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 004B1C433C1; Mon, 15 Aug 2022 20:12:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594341; bh=tO76lJ66HsVJV3KXENX1SUk8oeNUKoWrD0rDT+0Y+lI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=png/pixYqbv4AWNf90gVIJIwv3RHazrRqi66RMiEWiTHUGfb0pHCrocjMF59yFMQE wjhmlGn8FdsVLAnwt+Ut5AtW2wDtdMPI/IqRq2ZcneUzNoSWOOGsCB5B+qcmTcpNSv leg2t+1NAL425nu4WGzEmuJRqoQIz2acLsltX+Yw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Luiz Augusto von Dentz Subject: [PATCH 5.18 1095/1095] Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm regression Date: Mon, 15 Aug 2022 20:08:14 +0200 Message-Id: <20220815180514.297750540@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luiz Augusto von Dentz commit 332f1795ca202489c665a75e62e18ff6284de077 upstream. The patch d0be8347c623: "Bluetooth: L2CAP: Fix use-after-free caused by l2cap_chan_put" from Jul 21, 2022, leads to the following Smatch static checker warning: net/bluetooth/l2cap_core.c:1977 l2cap_global_chan_by_psm() error: we previously assumed 'c' could be null (see line 1996) Fixes: d0be8347c623 ("Bluetooth: L2CAP: Fix use-after-free caused by l2cap_= chan_put") Reported-by: Dan Carpenter Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Greg Kroah-Hartman Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/bluetooth/l2cap_core.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -1969,11 +1969,11 @@ static struct l2cap_chan *l2cap_global_c bdaddr_t *dst, u8 link_type) { - struct l2cap_chan *c, *c1 =3D NULL; + struct l2cap_chan *c, *tmp, *c1 =3D NULL; =20 read_lock(&chan_list_lock); =20 - list_for_each_entry(c, &chan_list, global_l) { + list_for_each_entry_safe(c, tmp, &chan_list, global_l) { if (state && c->state !=3D state) continue; =20 @@ -1992,11 +1992,10 @@ static struct l2cap_chan *l2cap_global_c dst_match =3D !bacmp(&c->dst, dst); if (src_match && dst_match) { c =3D l2cap_chan_hold_unless_zero(c); - if (!c) - continue; - - read_unlock(&chan_list_lock); - return c; + if (c) { + read_unlock(&chan_list_lock); + return c; + } } =20 /* Closest match */