From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EB43606A322 for ; Thu, 3 Dec 2026 19:14:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=XAyryhwK; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=mMFQyhvJ DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=EzSKZ9IC7OVHidoHxX1hRNfNzNT0301u7mQdEmySCUE=; b=XAyryhwKdhqd30 rm69Zk28I2wzTB2iQ334XEWF5CrF93V3CTOFrhBK3061akwaiMnmiw2EGEVHTTV3vwNuJDzfWm3J4 +MVGeWzd6iuaL2rghaxzWmuMDPyf9zc8Ruip9b/GmlB4w90wJN06d8NDQh9Yq15OiCKFv3hQcfopt JcpbJrCNLbNRh8rUgSKNQhv/6MxZcgoktAjs3Aq5v31JSqen/DaK+MFwzKR0rQceDLYc0Wr3L3Gfm 5MxQqYLvMyd5DkjkvBAs2R0nEtV+zms53n39vQIZmJgUyPTcuAlI5jfljxhFgHvDaghjQ0FNvvxas qFnpPQZn+9dhzbEfgC2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZCGB-0000000Fii1-1ieq; Thu, 03 Dec 2026 19:14:27 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZCFz-0000000FifD-3MU0 for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2026 19:14:22 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id A70334345E; Thu, 3 Dec 2026 19:14:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C1901F000C2; Thu, 3 Dec 2026 19:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796325254; bh=EzSKZ9IC7OVHidoHxX1hRNfNzNT0301u7mQdEmySCUE=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=mMFQyhvJrD1rqUiNPYOr5o6pcozHjgl216hHWsdCWVrYdD0+y7LXc9WiHbbah1Tm3 ieSKPhx4dGCHHZLS0unWxpTGK8NmrTnTKIN/gOKx/7z1XELXmXZCJ2R1GpJ+0R+gU7 qyIhIg8IV0gEjQhC1dzWyLk3cq3YXyoBR86R3C0s7SF98AQiOILWaYkZfBF5DHo9jb oVvkDVWslkjape9rO6ybDgvb7HYyPIcPFuJPLi0NaO+MqI9I1MZ+RXLVHvP45zAjdc aV2oM3uc12ClQoDLR0jzesdRYGmw7UcYNpScnc3U443Tp/xMhrXWu5y5Q5tACL9y0D SjPU9VYt3FJoA== Message-ID: <1e16caf1-c4ee-4af5-bcf6-5faacd987703@kernel.org> Date: Thu, 3 Dec 2026 20:14:07 +0100 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] soc: fsl: qbman: flush the private memory before enabling QMan and BMan To: Vladimir Oltean , Anthony Pighin Cc: Madalin Bucur , Claudiu Manoil , Camelia Alexandra Groza , "linuxppc-dev@lists.ozlabs.org" , "linux-arm-kernel@lists.infradead.org" , "stable@vger.kernel.org" , lkml References: <20261203160158.766599-1-anthony.pighin@nokia.com> Content-Language: fr-FR From: "Christophe Leroy (CS GROUP)" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-7.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Le 03/12/2026 à 18:01, Vladimir Oltean a écrit : > Hi Anthony, > > On Thu, Dec 03, 2026 at 06:41:07PM +0200, Madalin Bucur wrote: >>> -----Original Message----- >>> From: Anthony Pighin >> >>> Subject: [PATCH] soc: fsl: qbman: flush the private memory before enabling >>> QMan and BMan >>> >>> QMan and BMan do not snoop the CPU caches when accessing their private >>> memory (FQD, PFDR and FBPR). The LS1043A DPAA reference manual >>> describes >>> these as non-coherent regions owned by QMan and BMan, and says that >>> BMan >>> starts writing its free list as soon as FBPR_AR[SIZE] is set. >>> >>> On arm64 the driver never cleans the FBPR area from the CPU caches, so >>> stale dirty lines remain there. A line written back after BMan has >>> stored an FBPR at that address overwrites it. A zeroed FBPR yields eight >>> zero-address buffers and loses the link to the next one, truncating the >>> pool. A frame received into such a buffer crashes the DPAA Ethernet >>> driver (x4 is phys_to_virt(0)): >>> >>> Unable to handle kernel paging request at virtual address ffff4bcd800000f8 >>> Internal error: Oops: 96000005 [#1] PREEMPT SMP >>> pc : rx_default_dqrr+0x30c/0x530 [fsl_dpa] >>> lr : rx_default_dqrr+0x2fc/0x530 [fsl_dpa] >>> x5 : 0000000000000000 x4 : ffff4bcd80000000 x3 : ffffdec2e49fe008 >>> Call trace: >>> rx_default_dqrr+0x30c/0x530 [fsl_dpa] >>> __poll_portal_fast+0x190/0x1b0 >>> qman_p_poll_dqrr+0x1c/0x30 >>> dpaa_eth_poll+0x30/0xc0 [fsl_dpa] >>> PHYS_OFFSET: 0xffffb43280000000 >>> >>> Commit 97777078d695 ("soc/fsl/qbman: Rework QBMan private memory >>> setup") >>> started zeroing FQD and PFDR through a cacheable mapping and flushed it >>> because QMan's accesses are non-coherent, but only on PPC. On arm64, >>> memunmap() leaves the dirty lines in place, so QMan is also exposed. >>> >>> This was reproduced on an LS1043A by dirtying a line over a record that >>> BMan had just written, letting it be written back and acquiring the >>> buffers again. Groups of eight zero-address buffers came back and the >>> pool chain was cut short. >>> >>> Clean and invalidate the private memory to the point of coherency before >>> handing it to QMan or BMan, on arm64 as well as PPC. >>> >>> Fixes: e868adf21c0a ("soc/fsl/qbman: Enable FSL_LAYERSCAPE config on >>> ARM") >>> Fixes: 97777078d695 ("soc/fsl/qbman: Rework QBMan private memory >>> setup") >>> +/* >>> + * QMan and BMan access their private memory without snooping the CPU >>> + * caches, so no line of it may be held in a cache once the hardware is >>> + * given the region. >>> + */ >>> +static inline void dpaa_flush_private_mem(void *ptr, size_t size) >>> +{ >>> +#if defined(CONFIG_PPC) >>> + flush_dcache_range((unsigned long)ptr, (unsigned long)ptr + size); >>> +#elif defined(CONFIG_ARM64) >>> + dcache_clean_inval_poc((unsigned long)ptr, (unsigned long)ptr + > > Technically here, dcache_clean_poc() is sufficient, correct? Cache flush > is what we need, not necessarily invalidate (there are no subsequent reads). > > Note that we already have this distinction in the existing dpaa_flush() > and dpaa_invalidate() macros. These are only implemented for PPC, however. > I am not requesting you to reuse these macros on arm64, because that > would create a larger change than the minimal fix for the issue. > But once cache maintenance operations are also implemented on arm64, > dpaa_flush_private_mem() should be replaced by dpaa_flush(), not by > dpaa_invalidate(). And while on PPC they map to the same primitives > (hence the latter being mapped to the former), on arm64 they don't. On powerpc, shouldn't dpaa_invalidate() call invalidate_dcache_range() instead ? Christophe