From: sashiko-bot@kernel.org
To: "Jim Quinlan" <james.quinlan@broadcom.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH 12/13] PCI: brcmstb: Use order-0 indexing for inbound BAR window array
Date: Fri, 11 Sep 2026 23:47:30 +0000 [thread overview]
Message-ID: <20260911234730.C5EDB1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260911233541.1650895-13-james.quinlan@broadcom.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The shift from 1-based to 0-based array indexing for `inbound_wins` broke the MSI target address calculation. `brcm_pcie_setup()` was not updated and continues to evaluate the hardcoded index 2, which now points to a 0-sized disabled window (or uninitialized memory), forcing an incorrect MSI target address.
--
commit cc21218055610569186c9058228a2b11645c3501
Author: Jim Quinlan <james.quinlan@broadcom.com>
PCI: brcmstb: Use order-0 indexing for inbound BAR window array
The register names for the inbound BAR registers use order-1 indexing,
e.g. the first is BAR1. The code followed this nomenclature by not using
the 0th element of the inbound array. This commit undoes this approach
and uses order-0 indexing.
> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> index 8bca98e6f5fa4..53984cfa2c96f 100644
> --- a/drivers/pci/controller/pcie-brcmstb.c
> +++ b/drivers/pci/controller/pcie-brcmstb.c
[ ... ]
> @@ -1202,11 +1195,11 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
> u32p_replace_bits(&tmp, 1, PCIE_MISC_MISC_CTRL_PCIE_RCB_64B_MODE_MASK);
> writel(tmp, base + PCIE_MISC_MISC_CTRL);
>
> - num_inbound_wins = brcm_pcie_get_inbound_wins(pcie, inbound_wins);
> + num_inbound_wins = brcm_pcie_get_ib_wins(pcie, inbound_wins);
[Severity: High]
By changing the inbound_wins array indexing from 1-based to 0-based, the main
inbound window for non-7712 chips has shifted from index 2 to index 1.
Does this break the MSI target address configuration further down in
brcm_pcie_setup()?
Later in brcm_pcie_setup(), the code still unconditionally evaluates index 2:
if (inbound_wins[2].pci_offset >= SZ_4G ||
(inbound_wins[2].size + inbound_wins[2].pci_offset) < SZ_4G)
pcie->msi_target_addr = BRCM_MSI_TARGET_ADDR_LT_4GB;
else
pcie->msi_target_addr = BRCM_MSI_TARGET_ADDR_GT_4GB;
For non-7712 chips, inbound_wins[2] will now point to the disabled zero-size
window, forcing the condition to always evaluate to true. This incorrectly
forces BRCM_MSI_TARGET_ADDR_LT_4GB and breaks >4GB MSI allocation.
Additionally, for BCM7712 chips with fewer than three dma-ranges,
inbound_wins[2] is never initialized and will result in an uninitialized stack
memory read. This issue remains unfixed in subsequent patches of the series.
> if (num_inbound_wins < 0)
> return num_inbound_wins;
>
> - set_inbound_win_registers(pcie, inbound_wins, num_inbound_wins);
> + brcm_pcie_set_ib_win_registers(pcie, inbound_wins, num_inbound_wins);
>
> if (!brcm_pcie_rc_mode(pcie)) {
> dev_err(pcie->dev, "PCIe RC controller misconfigured as Endpoint\n");
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260911233541.1650895-1-james.quinlan@broadcom.com?part=12
next prev parent reply other threads:[~2026-09-11 23:47 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 23:35 [PATCH 00/13] PCI: brcmstb: Stop using chip numbers for conditions Jim Quinlan
2026-09-11 23:35 ` [PATCH 01/13] PCI: brcmstb: Remove redundant const specifier for struct fields Jim Quinlan
2026-09-11 23:39 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 02/13] PCI: brcmstb: Use flags u32 instead of bools Jim Quinlan
2026-09-11 23:47 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 03/13] PCI: brcmstb: Add Broadcom quirks macro Jim Quinlan
2026-09-11 23:40 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 04/13] PCI: brcmstb: Declare and assign quirk OB_WIN_32BIT_ADDR Jim Quinlan
2026-09-11 23:42 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 05/13] PCI: brcmstb: Declare and assign quirk OB_WIN_MAXSZ_128MB Jim Quinlan
2026-09-11 23:47 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 06/13] PCI: brcmstb: Declare and assign flag IS_BMIPS Jim Quinlan
2026-09-11 23:41 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 07/13] PCI: brcmstb: Declare and assign quirk 32BIT_PCI_OPS Jim Quinlan
2026-09-11 23:47 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 08/13] PCI: brcmstb: Declare and assign quirk NO_RGR1_TIMER Jim Quinlan
2026-09-11 23:43 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 09/13] PCI: brcmstb: Declare and assign quirk EARLY_PERST_ASSERT Jim Quinlan
2026-09-11 23:42 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 10/13] PCI: brcmstb: Declare and assign quirk PERST_PCIE_REV_CUTOFF Jim Quinlan
2026-09-11 23:49 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 11/13] PCI: brcmstb: Put max_burst_size setting in cfg_data Jim Quinlan
2026-09-11 23:42 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 12/13] PCI: brcmstb: Use order-0 indexing for inbound BAR window array Jim Quinlan
2026-09-11 23:47 ` sashiko-bot [this message]
2026-09-11 23:35 ` [PATCH 13/13] PCI: brcmstb: Split up complicated function into two variants Jim Quinlan
2026-09-11 23:54 ` sashiko-bot
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=20260911234730.C5EDB1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=james.quinlan@broadcom.com \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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;
as well as URLs for NNTP newsgroup(s).