Re: [PATCH] soc: fsl: qbman: flush the private memory before enabling QMan and BMan

From: Anthony Pighin

Date: Thu Dec 03 2026 - 13:59:18 EST


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