Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Pighin <anthony.pighin@nokia.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: Madalin Bucur <madalin.bucur@nxp.com>,
	"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	Camelia Groza <camelia.groza@nxp.com>,
	linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org, stable@vger.kernel.org,
	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 13:59:01 -0500	[thread overview]
Message-ID: <20261203185901.1734264-1-anthony.pighin@nokia.com> (raw)
In-Reply-To: <axGb8nky2QhSX8xx@lxl00025.wbi.nxp.com>

Hi Vladimir, Madalin,

Thanks for the quick look.

On Thu, Dec 03, 2026 at 07:01:13PM +0200, Vladimir Oltean wrote:

> Technically here, dcache_clean_poc() is sufficient, correct? Cache flush
> is what we need, not necessarily invalidate (there are no subsequent reads).

Yes. Only a dirty line written back over data the hardware has stored
does harm. Clean lines are never written back, and the CPU does not read
these regions.

> The major difference between QMan and BMan is that bm_set_memory() does
> not do any memset. So what am I missing, who dirties the cache lines for
> FBPR, and why is FBPR even mapped by the CPU?

In Linux it is not mapped at all. The regions are no-map reserved-memory
nodes without a reg property, which early Linux places at the top of
DRAM and keeps out of the linear map. Before that, the boot chain runs
under UEFI with all of DRAM mapped cacheable, and on our LS1043A board
the EFI memory map puts all of FBPR and most of FQD inside a 32 MiB
EfiLoaderCode allocation. Cache lines outlive the mapping that brought
them in, and the arm64 boot protocol only requires the kernel image to
be clean to the PoC, so nothing ensures there is no dirty line over that
memory when BMan is given it.

I have not caught such a line, though. Counting the cached lines of each
region just before its registers are programmed found none over eight
boots, three of them power cycles, while a control of deliberately
cached lines was caught every time it ran. I have not tried kexec, but
we have hit this without it.

What I can show is the consequence. Forcing a dirty line over FBPR to be
written back after BMan is enabled makes BMan hand out zero-address
buffers. The field hits match. With an out-of-tree check that drops Rx
frames whose buffer address is zero, one board logged this burst at
boot:

  rx_default_dqrr(mgmt): NULL buffer! format=0, offset=256, length=97, status=0x4
  rx_default_dqrr(mgmt): NULL buffer! format=0, offset=256, length=342, status=0x4

Only the address is zero. The offset is the usual Rx headroom and the
lengths are real frames, so FMan received into zero-address buffers
taken from the pool. A zeroed PFDR would have cleared the whole frame
descriptor instead.

So the BMan half rests on the same requirement as the QMan half. Memory
handed to hardware that does not snoop must have no dirty line over it.

> Note that out of all 3 DPAA reserved memory regions, only QMan FQD needs
> zero-initialization.

Agreed that only FQD needs zeroing.

Thanks,
Anthony


  reply	other threads:[~2026-12-03 18:59 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 [this message]
2026-12-03 19:14     ` Christophe Leroy (CS GROUP)

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=20261203185901.1734264-1-anthony.pighin@nokia.com \
    --to=anthony.pighin@nokia.com \
    --cc=camelia.groza@nxp.com \
    --cc=chleroy@kernel.org \
    --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