Re: [PATCH] soc: fsl: qbman: flush the private memory before enabling QMan and BMan
From: Vladimir Oltean
Date: Fri Dec 04 2026 - 05:35:38 EST
On Thu, Dec 03, 2026 at 06:05:04PM -0500, Anthony Pighin wrote:
> Rare crashes in the DPAA Rx path during boot, on a buffer at physical
> address 0 (x4 is phys_to_virt(0)):
>
> [ 20.202676] Unable to handle kernel paging request at virtual address ffff4bcd800000f8
> [ 20.258552] Internal error: Oops: 96000005 [#1] PREEMPT SMP
> [ 20.341545] pc : rx_default_dqrr+0x30c/0x530 [fsl_dpa]
> [ 20.346687] lr : rx_default_dqrr+0x2fc/0x530 [fsl_dpa]
> [ 20.412177] x5 : 0000000000000000 x4 : ffff4bcd80000000 x3 : ffffdec2e49fe008
> [ 20.430868] Call trace:
> [ 20.433305] rx_default_dqrr+0x30c/0x530 [fsl_dpa]
> [ 20.438095] __poll_portal_fast+0x190/0x1b0
> [ 20.442276] qman_p_poll_dqrr+0x1c/0x30
> [ 20.446105] dpaa_eth_poll+0x30/0xc0 [fsl_dpa]
>
> After the fact, we added a check to rx_default_dqrr() that drops any
> frame whose buffer address is zero and logs the first five. One board
> then logged, 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
> rx_default_dqrr(mgmt): NULL buffer! format=0, offset=256, length=342, status=0x4
> rx_default_dqrr(mgmt): NULL buffer! format=0, offset=256, length=342, status=0x4
> rx_default_dqrr(mgmt): NULL buffer! format=0, offset=256, length=342, status=0x4
>
> The address is zero but the offset, length and status are real, so FMan
> received into zero-address buffers acquired from BMan, rather than QMan
> handing out a zeroed FD. I found no software path that releases a zero
> address into the pool.
>
> A zeroed FBPR fits that. It holds eight buffer addresses, so the five
> logged, all within 90 ms, fit one zeroed record. What I have not found
> is what zeroes it on the failing boots.
The fact is that I don't see how a zeroed FBPR could possibly fit your
symptoms. Did you ever reproduce this problem with the upstream driver
that you're patching?
DPAARM section 4.3.6.1 FBPR Format describes:
Offset Size Field Required value for your symptoms Checked by BMan?
0x00 6 BP0 0 no
0x06 6 BP1 0 no
0x0c 4 FBPR_BPA X yes: must match the address it was read from
0x10 6 BP2 0 no
0x16 6 BP3 0 no
0x1c 4 reserved X not documented
0x20 6 BP4 0 no
0x26 6 BP5 0 no
0x2c 4 BPID X yes: must match the list being walked
0x30 6 BP6 0 no
0x36 6 BP7 0 no
0x3c 4 FBPR_IDX X indirectly (see below)
FBPR_IDX is the FBPR index to the next FBPR in the singly-linked list.
All-zero indicates the end of the list. So BMan would lose track of the
remaining buffers in this pool, while the driver would still think there
is no reason to refill.
BPID is this:
$ for eth in fm1-mac3 fm1-mac4 fm1-mac5 fm1-mac6 fm1-mac9 fm1-mac10; do cat /sys/class/net/$eth/bpids; done
0
1
2
3
4
5
So a corruption with an all-zero FBPR entry is only plausible for fm1-mac3,
since that's the only interface using BPID 0 with the upstream driver
(in downstream, they all use BPID 32).
But the manual also has these statements: "The BMan never uses FBPR index zero."
and:
| FBPR_BPA and BPID are intended as a crude debug check to test for memory scribbling by other entities
| or FBPR pool corruption but do not provide any guarantees that this behavior will be caught. When an
| FBPR belongs to the FBPR pool, the buffer pointer ID (BPID) is set to 0xff, and FBPR_BPA matches BP0.
| An EMCI error interrupt is raised and the linked list of the pool is dropped if, the FBPR_BPA and BPID
| on an FBPR read do not match their expected values. If BPID = 0xff (FBPR pool), then BP0 is also checked
| to confirm that it matches FBPR_BPA.
If you write an all-zero FBPR entry, it would not pass those crude debug
checks that BMan performs, and it would raise an EMCI interrupt (which I
see we don't process).
You would essentially need to craft FBPR entries with the FBPR_BPA field
written back with the exact value that BMan generated, and just the
BP0-BP7 fields zeroed out. To me, the more mundane explanation that
someone is handing buffers with address 0 to bman_release() seems
infinitely more likely than such an accidental corruption.
You also didn't mention which interface was receiving traffic, and what
BPID it was using?
Do you see the message below with the port under heavy traffic and the
patch attached? Heavy traffic is needed because the on-chip stockpile
must first be exhausted in order for BMan to reach out to FBPR in DRAM.
[ 55.475284] bman_ccsr 1890000.bman: ErrInt: External Memory Corruption
[ 55.475322] bman_ccsr 1890000.bman: ErrInt: CECR LID=0x02 CEAR FBPR index=0x003ff57
---
diff --git a/drivers/soc/fsl/qbman/bman_ccsr.c b/drivers/soc/fsl/qbman/bman_ccsr.c
index b0f26f6f731e..17046b528d8b 100644
--- a/drivers/soc/fsl/qbman/bman_ccsr.c
+++ b/drivers/soc/fsl/qbman/bman_ccsr.c
@@ -39,6 +39,10 @@ EXPORT_SYMBOL(bman_ip_rev);
#define REG_ECIR 0x0a04
#define REG_EADR 0x0a08
#define REG_EDATA(n) (0x0a10 + ((n) * 0x04))
+#define REG_CECR 0x0a34
+#define REG_CEAR 0x0a38
+#define REG_AECR 0x0a44
+#define REG_AEAR 0x0a48
#define REG_SBEC(n) (0x0a80 + ((n) * 0x04))
#define REG_IP_REV_1 0x0bf8
#define REG_IP_REV_2 0x0bfc
@@ -52,6 +56,8 @@ EXPORT_SYMBOL(bman_ip_rev);
#define REG_ERR_ISDR 0x0e08
/* Used by all error interrupt registers except 'inhibit' */
+#define BM_EIRQ_EMAI 0x00000040 /* External Memory Access */
+#define BM_EIRQ_EMCI 0x00000020 /* External Memory Corruption */
#define BM_EIRQ_IVCI 0x00000010 /* Invalid Command Verb */
#define BM_EIRQ_FLWI 0x00000008 /* FBPR Low Watermark */
#define BM_EIRQ_MBEI 0x00000004 /* Multi-bit ECC Error */
@@ -64,6 +70,8 @@ struct bman_hwerr_txt {
};
static const struct bman_hwerr_txt bman_hwerr_txts[] = {
+ { BM_EIRQ_EMAI, "External Memory Access" },
+ { BM_EIRQ_EMCI, "External Memory Corruption" },
{ BM_EIRQ_IVCI, "Invalid Command Verb" },
{ BM_EIRQ_FLWI, "FBPR Low Watermark" },
{ BM_EIRQ_MBEI, "Multi-bit ECC Error" },
@@ -161,6 +169,14 @@ static irqreturn_t bman_isr(int irq, void *ptr)
if (bman_hwerr_txts[i].mask & isr_mask) {
dev_err_ratelimited(dev, "ErrInt: %s\n",
bman_hwerr_txts[i].txt);
+ if (bman_hwerr_txts[i].mask & BM_EIRQ_EMCI)
+ dev_err_ratelimited(dev, "ErrInt: CECR LID=0x%02x CEAR FBPR index=0x%07x\n",
+ bm_ccsr_in(REG_CECR) & 0xff,
+ bm_ccsr_in(REG_CEAR) & 0x0fffffff);
+ if (bman_hwerr_txts[i].mask & BM_EIRQ_EMAI)
+ dev_err_ratelimited(dev, "ErrInt: AECR LID=0x%02x AEAR FBPR index=0x%07x\n",
+ bm_ccsr_in(REG_AECR) & 0xff,
+ bm_ccsr_in(REG_AEAR) & 0x0fffffff);
if (bman_hwerr_txts[i].mask & ecsr_val) {
/* Re-arm error capture registers */
bm_ccsr_out(REG_ECSR, ecsr_val);
---