From: sashiko-bot@kernel.org
To: "Grégoire Layet" <gregoire.layet@9elements.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v4 5/7] soc: aspeed: add host-side PCIe BMC device driver
Date: Wed, 08 Jul 2026 15:48:43 +0000 [thread overview]
Message-ID: <20260708154843.8B2BB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <51e455417bdcfe608270c6cb2806b1fd971fb998.1783524645.git.gregoire.layet@9elements.com>
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
- [High] The physical address of the PCI BAR is stored in an `unsigned long`, which silently truncates addresses on 32-bit architectures with 64-bit physical addressing.
- [Medium] The driver requests legacy INTx interrupt fallback but enforces a minimum vector count of 32 and hardcodes MSI vector indices, making INTx support impossible.
- [Low] Missing newline character `\n` at the end of a `pr_err` message string.
- [Low] The probe error message references a non-existent function `aspeed_pci_setup_irq_resource()` instead of `pci_alloc_irq_vectors()`.
- [Low] The driver computes a physical memory address for the UART mapped registers by adding a fixed offset to the base of PCI BAR 1, but fails to verify if BAR 1 exists or is large enough to contain this offset.
--
--- Patch [5]: [PATCH v4 5/7] soc: aspeed: add host-side PCIe BMC device driver ---
commit 466ab6d1aa3de4b6bd606a9368f52aa1b3fbe52e
Author: Grégoire Layet <gregoire.layet@9elements.com>
Subject: soc: aspeed: add host-side PCIe BMC device driver
This patch adds a host-side driver for the ASPEED AST2600 BMC PCIe device.
It exposes two 8250-compatible VUART ports over PCIe between the BMC and
the host.
> diff --git a/drivers/soc/aspeed/aspeed-host-bmc-dev.c b/drivers/soc/aspeed/aspeed-host-bmc-dev.c
> new file mode 100644
> index 0000000000000..e586d05055775
> --- /dev/null
> +++ b/drivers/soc/aspeed/aspeed-host-bmc-dev.c
[ ... ]
> +struct aspeed_pci_bmc_dev {
> + unsigned long message_bar_base;
[Severity: High]
Can this cause address truncation on 32-bit architectures with 64-bit physical
addressing?
The physical address returned by pci_resource_start() is stored in an
unsigned long, which is 32 bits on 32-bit platforms.
Should message_bar_base be typed as resource_size_t or phys_addr_t instead?
[ ... ]
> +static int aspeed_pci_bmc_device_setup_vuart(struct pci_dev *pdev, int idx)
> +{
[ ... ]
> + uart->port.iotype = UPIO_MEM32;
> + uart->port.iobase = 0;
> + uart->port.mapbase = pci_bmc_dev->message_bar_base + vuart_ioport;
[Severity: Low]
Is it safe to add the VUART offset to the base of BAR 1 without validation?
If BAR 1 is uninitialized or not large enough to contain vuart_ioport, this
could result in an invalid physical memory address.
Should this code check pci_resource_len() before adding the offset?
[ ... ]
> +static int aspeed_pci_host_setup(struct pci_dev *pdev)
> +{
> + struct aspeed_pci_bmc_dev *pci_bmc_dev = pci_get_drvdata(pdev);
> + int rc = 0;
> +
> + pci_bmc_dev->message_bar_base = pci_resource_start(pdev, 1);
> +
> + if (pdev->revision == 0x27) {
> + pr_err("AST2700 detected but not supported");
[Severity: Low]
This isn't a bug, but there's a missing newline character at the end of this
error message. Without the \n, subsequent printk messages might be accidentally
concatenated onto the same line.
[ ... ]
> +static int aspeed_pci_host_bmc_device_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> +{
[ ... ]
> + pci_set_master(pdev);
> + pci_set_drvdata(pdev, pci_bmc_dev);
> +
> + rc = pci_alloc_irq_vectors(pdev, BMC_MULTI_MSI, BMC_MULTI_MSI, PCI_IRQ_INTX | PCI_IRQ_MSI);
[Severity: Medium]
Does this PCI_IRQ_INTX fallback function as intended?
The allocation requests a minimum of 32 vectors (BMC_MULTI_MSI), but INTx only
supports a single vector, so the fallback will always fail.
Also, aspeed_pci_bmc_device_setup_vuart() hardcodes the vector indices:
uart->port.irq = pci_irq_vector(pdev, vuart_msi_index[idx]);
Since indices 16 and 17 are invalid for INTx, will this driver completely fail
to initialize on systems where MSI is disabled or unavailable?
> + if (rc < 0) {
> + dev_err(&pdev->dev, "aspeed_pci_setup_irq_resource() returned error %d\n", rc);
[Severity: Low]
Is the function name in this log message incorrect? It references
aspeed_pci_setup_irq_resource() instead of pci_alloc_irq_vectors(), which
might make debugging confusing.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1783524645.git.gregoire.layet@9elements.com?part=5
next prev parent reply other threads:[~2026-07-08 15:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 15:35 [PATCH v4 0/7] soc: aspeed: Add BMC and host driver for PCIe BMC device Grégoire Layet
2026-07-08 15:35 ` [PATCH v4 1/7] dt-bindings: serial: 8250: aspeed: add compatible string for ast2600 Grégoire Layet
2026-07-08 16:38 ` Andrew Lunn
2026-07-09 8:50 ` Krzysztof Kozlowski
2026-07-09 14:21 ` Grégoire Layet
2026-07-08 15:35 ` [PATCH v4 2/7] dt-bindings: serial: 8250: aspeed: add aspeed,vuart-over-pci bool prop Grégoire Layet
2026-07-08 15:45 ` sashiko-bot
2026-07-09 8:54 ` Krzysztof Kozlowski
2026-07-08 15:35 ` [PATCH v4 3/7] serial: 8250_aspeed_vuart: add aspeed,ast2600-vuart compatible string Grégoire Layet
2026-07-08 15:49 ` sashiko-bot
2026-07-08 15:35 ` [PATCH v4 4/7] serial: 8250_aspeed_vuart: add VUART over PCI Grégoire Layet
2026-07-08 15:47 ` sashiko-bot
2026-07-08 16:46 ` Andrew Lunn
2026-07-09 5:18 ` Jiri Slaby
2026-07-09 5:17 ` Jiri Slaby
2026-07-08 15:35 ` [PATCH v4 5/7] soc: aspeed: add host-side PCIe BMC device driver Grégoire Layet
2026-07-08 15:48 ` sashiko-bot [this message]
2026-07-09 5:27 ` Jiri Slaby
2026-07-08 15:35 ` [PATCH v4 6/7] ARM: dts: aspeed: g6: Change vuart compatible string for ast2600 Grégoire Layet
2026-07-08 15:35 ` [PATCH v4 7/7] ARM: dts: aspeed: g6: add aspeed,vuart-over-pci prop to vuart3 and 4 Grégoire Layet
2026-07-08 15:49 ` 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=20260708154843.8B2BB1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregoire.layet@9elements.com \
--cc=robh@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