From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 839F1C433EF for ; Sat, 21 May 2022 17:44:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344343AbiEURoi (ORCPT ); Sat, 21 May 2022 13:44:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229897AbiEURoe (ORCPT ); Sat, 21 May 2022 13:44:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E69C5D5F6; Sat, 21 May 2022 10:44: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 4017F60C85; Sat, 21 May 2022 17:44:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29773C385A5; Sat, 21 May 2022 17:44:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653155072; bh=EO84JGczgpntqsBiE0PFKKUwtkIBC7vQT45PS1nrYTM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mLf/GRtnZ3q1ciVMuzDkYnEOKTsDT2jfwFJXyiuutQp8dgnkLSAC+iqUKGoddB38U eNtiepYn+un7FTXa4fS+9fUCbQRWSC4uQZp7J5AsFGqxplizWSjG824CwOEi4IAViT V8Q8rSPKq2THHVLB0DQhc6CuWzygK3Pllx91p4JRconHLosADsY2jespf42KWlWxnG kYda1VOAsx28iaQfIdjkqflGklVkLc47XuInXCyEOnksXin+L2PQqm4dWZr8KNAagF vVA0cZohdBxcoqO/yOR7IxARweX4iEqPGvLppqn31NPcPEuHk/gsgkfUTq7C1es5vO CFajLlyyvFlBA== Date: Sat, 21 May 2022 10:44:30 -0700 From: Jakub Kicinski To: Christophe Leroy Cc: =?UTF-8?B?TcOlbnMgUnVsbGfDpXJk?= , Pantelis Antoniou , "David S. Miller" , Eric Dumazet , Paolo Abeni , Vitaly Bordug , Dan Malek , Joakim Tjernlund , "linuxppc-dev@lists.ozlabs.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] net: fs_enet: sync rx dma buffer before reading Message-ID: <20220521104430.1212bed5@kernel.org> In-Reply-To: References: <20220519192443.28681-1-mans@mansr.com> <03f24864-9d4d-b4f9-354a-f3b271c0ae66@csgroup.eu> <20220520104347.2b1b658a@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 21 May 2022 06:44:41 +0000 Christophe Leroy wrote: > > Hm, I think the patch is necessary, sorry if you're also saying that > > and I'm misinterpreting. > > Well, I say the contrary. > > On the mainline the patch may be applied as is, it won't harm. > > However, it is gets applied to kernel 4.9 (based on the fixes: tag), it > will break the driver for at least powerpc 8xx. I see, we should make a note of that in the commit message so it doesn't get sucked into stable. > > Without the dma_sync_single_for_cpu() if swiotlb is used the data > > will not be copied back into the original buffer if there is no sync. > > I don't know how SWIOTLB works or even what it is, does any of the > microcontrollers embedding freescale ethernet uses that at all ? AFAIU SWIOTLB basically forces the use of bounce buffers even if the device can reach the entire DRAM. I think some people also use it for added security? IDK. I mostly use it to check if I'm using the DMA API "right" :) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3C672C433EF for ; Sat, 21 May 2022 17:45:15 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4L59wT44czz3cL8 for ; Sun, 22 May 2022 03:45:13 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=mLf/GRtn; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=kuba@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=mLf/GRtn; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4L59vm0Sjkz2xKf for ; Sun, 22 May 2022 03:44:35 +1000 (AEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3C9CD60D2C; Sat, 21 May 2022 17:44:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29773C385A5; Sat, 21 May 2022 17:44:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653155072; bh=EO84JGczgpntqsBiE0PFKKUwtkIBC7vQT45PS1nrYTM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mLf/GRtnZ3q1ciVMuzDkYnEOKTsDT2jfwFJXyiuutQp8dgnkLSAC+iqUKGoddB38U eNtiepYn+un7FTXa4fS+9fUCbQRWSC4uQZp7J5AsFGqxplizWSjG824CwOEi4IAViT V8Q8rSPKq2THHVLB0DQhc6CuWzygK3Pllx91p4JRconHLosADsY2jespf42KWlWxnG kYda1VOAsx28iaQfIdjkqflGklVkLc47XuInXCyEOnksXin+L2PQqm4dWZr8KNAagF vVA0cZohdBxcoqO/yOR7IxARweX4iEqPGvLppqn31NPcPEuHk/gsgkfUTq7C1es5vO CFajLlyyvFlBA== Date: Sat, 21 May 2022 10:44:30 -0700 From: Jakub Kicinski To: Christophe Leroy Subject: Re: [PATCH] net: fs_enet: sync rx dma buffer before reading Message-ID: <20220521104430.1212bed5@kernel.org> In-Reply-To: References: <20220519192443.28681-1-mans@mansr.com> <03f24864-9d4d-b4f9-354a-f3b271c0ae66@csgroup.eu> <20220520104347.2b1b658a@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?B?TcOlbnMgUnVsbGfDpXJk?= , "linuxppc-dev@lists.ozlabs.org" , Dan Malek , "linux-kernel@vger.kernel.org" , Eric Dumazet , "netdev@vger.kernel.org" , Vitaly Bordug , Paolo Abeni , Joakim Tjernlund , "David S. Miller" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Sat, 21 May 2022 06:44:41 +0000 Christophe Leroy wrote: > > Hm, I think the patch is necessary, sorry if you're also saying that > > and I'm misinterpreting. > > Well, I say the contrary. > > On the mainline the patch may be applied as is, it won't harm. > > However, it is gets applied to kernel 4.9 (based on the fixes: tag), it > will break the driver for at least powerpc 8xx. I see, we should make a note of that in the commit message so it doesn't get sucked into stable. > > Without the dma_sync_single_for_cpu() if swiotlb is used the data > > will not be copied back into the original buffer if there is no sync. > > I don't know how SWIOTLB works or even what it is, does any of the > microcontrollers embedding freescale ethernet uses that at all ? AFAIU SWIOTLB basically forces the use of bounce buffers even if the device can reach the entire DRAM. I think some people also use it for added security? IDK. I mostly use it to check if I'm using the DMA API "right" :)