Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
To: Vladimir Oltean <vladimir.oltean@nxp.com>,
	Anthony Pighin <anthony.pighin@nokia.com>
Cc: Madalin Bucur <madalin.bucur@nxp.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	Camelia Alexandra Groza <camelia.groza@nxp.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] soc: fsl: qbman: flush the private memory before enabling QMan and BMan
Date: Thu, 3 Dec 2026 20:14:07 +0100	[thread overview]
Message-ID: <1e16caf1-c4ee-4af5-bcf6-5faacd987703@kernel.org> (raw)
In-Reply-To: <axGb8nky2QhSX8xx@lxl00025.wbi.nxp.com>



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 <anthony.pighin@nokia.com>
>> <snip>
>>> 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



      parent reply	other threads:[~2026-12-03 19:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 16:01 [PATCH] soc: fsl: qbman: flush the private memory before enabling QMan and BMan Anthony Pighin
2026-12-03 16:41 ` Madalin Bucur
2026-12-03 17:01   ` Vladimir Oltean
2026-12-03 18:59     ` Anthony Pighin
2026-12-03 19:14     ` Christophe Leroy (CS GROUP) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1e16caf1-c4ee-4af5-bcf6-5faacd987703@kernel.org \
    --to=chleroy@kernel.org \
    --cc=anthony.pighin@nokia.com \
    --cc=camelia.groza@nxp.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=madalin.bucur@nxp.com \
    --cc=stable@vger.kernel.org \
    --cc=vladimir.oltean@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox