Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp14900914rwb; Mon, 28 Nov 2022 06:09:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf5936i55IPGKFYboet6fHIWy/3GjOWLMlpi2NnGiGyoH5rZv3FB/K0REQX7aq2e3X3cmtnL X-Received: by 2002:a6b:5904:0:b0:6af:ed54:1c81 with SMTP id n4-20020a6b5904000000b006afed541c81mr16400089iob.106.1669644553975; Mon, 28 Nov 2022 06:09:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669644553; cv=none; d=google.com; s=arc-20160816; b=A5GHswieH0NxrBi8vOh4XNzXQ91erV6VxQfw9UW+63OniDxnGRbedp+tcDjLiyyoJu hXysOpRc5cxzgac9KgF+/FahC4uAwm5N3Jmvo+KwlWkfXxiqxQZcx898Mn3I+SCkvWix bUJuGUeiykriaJM1lWIHYIgQ2Dos4gXu6zeCUmnn4tLEnXdCtMILKwbIHlcBRUUeXivB IPeovqMAYMHdHI8LodrG/QARMVUyEtzosZMrXT6VHzBJka+Rm44MB/Eh4zptoW2tr095 MDONDgqNkMpsFMlEvvs4C9xWH2IC+OJ65rMCErEStoSszB2JKS3Kz6NZk2SaWSECNrtI u34w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:user-agent:cc:to:references :in-reply-to:from:subject:content-transfer-encoding:mime-version :dkim-signature; bh=r1T09i+C5L8U93OCD6Ehfr9+wMUp74F/NQVIRoBtn0A=; b=gcKw/2RZMv4/+dEQZWftItlZcVAfm1+xperEWyj39QPCIsUibLx9gE6+mg0eGitAqc TXy0FW839OkQL4apmZ5WhT4FFFjex7UgdFEa54sTjS14EetU0PSyIid+GG6uoVltC6+C ODGXDT/eXVDHJe/mlmYC3UKpTE/GjcgVUJUmG94hTuRlntOZF1nR/NdgJWPPU8ncKSZP b4r73q0uDLU+bAcw5vCnFJ2bT2+vRBSQO8mX3FPqCIdWUdIWprnnaa1J1v9RXqv+bwZ3 adXo0ZK2Eip5q1trWVUPVMipwFj3wwr/lshglqRjalDfmeozDY9Tt9j/N3QdyCfzMvA2 9i2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e1CbmSuU; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v4-20020a50a444000000b0046995c42775si8669288edb.148.2022.11.28.06.08.53; Mon, 28 Nov 2022 06:09:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e1CbmSuU; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231833AbiK1N7G (ORCPT + 67 others); Mon, 28 Nov 2022 08:59:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231830AbiK1N7D (ORCPT ); Mon, 28 Nov 2022 08:59:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AF8CDA4 for ; Mon, 28 Nov 2022 05:59:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D310CB80DBF for ; Mon, 28 Nov 2022 13:59:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1D52C433C1; Mon, 28 Nov 2022 13:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669643940; bh=QMkvviKD3gsVJI4hfNMMNMhDR/UdQTDhv1GhtdjTd8I=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=e1CbmSuU4CTeAk/WnreA0ZUQiS/2m6Equ4p1yAqKzFDE4rUNZDj0juH9AFG8yBkWf tyW8O41Sjshmx4dQwlQJKx7Qbvm+jd3PUqApNhzdHOl7/eFdeOzMCjIcE5FKN9l0lu Dhq5rW1RKCB7rQZXFTkNWGR/mVsFKL0Q9QStxjrMgMUZMshNQIfgoaUClc83KJZk8u X5BvPmVcogeeEiqAZcTUX+eiAbyywnh0CV1Hd/bOUsglh1whYpn9VsphxapVjWvhD7 4NRCk4EoiBjUenwh+EbYL5KAFVY0s9eFz1VMVNs8nWhMPiF5ireRnsBm0E9gnubIYD pzmueRJguMCPw== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH] wifi: rtw88: fix race condition when doing H2C command From: Kalle Valo In-Reply-To: <20221124064442.28042-1-pkshih@realtek.com> References: <20221124064442.28042-1-pkshih@realtek.com> To: Ping-Ke Shih Cc: , , User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.7.3 Message-ID: <166964393792.4701.9928917528260013977.kvalo@kernel.org> Date: Mon, 28 Nov 2022 13:58:59 +0000 (UTC) X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Ping-Ke Shih wrote: > From: Ji-Pin Jou > > For SDIO/USB interface, since the tranferring speed is slower than > that in PCIE, it may have race condition when the driver sets down > H2C command to the FW. > > In the function rtw_fw_send_h2c_command, before the patch, box_reg > is written first, then box_ex_reg is written. FW starts to work and > fetch the value of box_ex_reg, when the most significant byte of > box_reg(4 bytes) is written. Meanwhile, for SDIO/USB interface, > since the transferring speed is slow, the driver is still in writing > the new value of box_ex_reg through the bus, and FW may get the > wrong value of box_ex_reg at the moment. > > To prevent the above driver/FW racing situation, box_ex_reg is > written first then box_reg. Furthermore, it is written in 4 bytes at > a time, instead of written in one byte one by one. It can increase > the speed for SDIO/USB interface. > > Signed-off-by: Ji-Pin Jou > Signed-off-by: Ping-Ke Shih > Tested-by: Sascha Hauer Patch applied to wireless-next.git, thanks. 823092a53556 wifi: rtw88: fix race condition when doing H2C command -- https://patchwork.kernel.org/project/linux-wireless/patch/20221124064442.28042-1-pkshih@realtek.com/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches