Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Koichiro Den" <den@valinux.co.jp>
Cc: ntb@lists.linux.dev, linux-pci@vger.kernel.org
Subject: Re: [PATCH v5 4/7] PCI: endpoint: pci-epf-vntb: Export endpoint DMA channels
Date: Fri, 09 Oct 2026 05:11:38 +0000	[thread overview]
Message-ID: <sashiko-outbox-164873@kernel.org> (raw)
In-Reply-To: <20261009045949.1109871-5-den@valinux.co.jp>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] pci-epf-vntb: Build failure due to non-constant expression in offsetof()
--

commit d7f27f0fe4a25aa5e8eb677eb623fec735ae8a53
Author: Koichiro Den <den@valinux.co.jp>

PCI: endpoint: pci-epf-vntb: Export endpoint DMA channels

An RC may use endpoint-local DMA read channels to transfer data directly
to an endpoint DMA address once both sides agree to use them. This commit
reserves read channels, describes the controller, adds a dma_bar configfs
attribute, and maps resources through the selected dma_bar.

Link: https://lore.kernel.org/r/3tgny5jkxjw3foqgkohlgmw4lh4trv63swgdc3kvi7qxzpf222@avh4tiacqn2a/

> diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
[ ... ]
> +static int epf_ntb_dw_edma_collect(struct epf_ntb *ntb,
> +				   struct epf_ntb_dma *dma,
> +				   const struct pci_epc_aux_resource *ctrl,
> +				   const struct pci_epc_aux_resource *resources,
> +				   unsigned int count)
> +{
[ ... ]
> +	dma->ctrl.magic = EPF_NTB_DMA_MAGIC;
> +	dma->ctrl.revision = EPF_NTB_DMA_REVISION;
> +	dma->ctrl.type = EPF_NTB_DMA_TYPE_DW_EDMA;
> +	dma->ctrl.submap.bar = barno;
> +	dma->ctrl.length = offsetof(struct epf_ntb_dma_ctrl,
> +				    chan[dma->rd_ch_cnt]);

[Severity: Low]
Will this cause a build failure on Clang? The code uses a runtime variable
(dma->rd_ch_cnt) as an array index inside the offsetof macro. 

While GCC may tolerate this as an extension, Clang strictly rejects 
non-constant indices in __builtin_offsetof, which is what the kernel's 
offsetof relies on. Could this size be calculated manually using struct_size 
or a similar approach instead?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009045949.1109871-1-den@valinux.co.jp?part=4

  reply	other threads:[~2026-10-09  5:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09  4:59 [PATCH v5 0/7] PCI: endpoint: Remote DMA support via vNTB Koichiro Den
2026-10-09  4:59 ` [PATCH v5 1/7] PCI: endpoint: Add DMA auxiliary resource metadata Koichiro Den
2026-10-09  5:03   ` sashiko-bot
2026-10-09  4:59 ` [PATCH v5 2/7] PCI: dwc: Expose endpoint DMA resources Koichiro Den
2026-10-09  5:05   ` sashiko-bot
2026-10-09  4:59 ` [PATCH v5 3/7] PCI: endpoint: pci-epf-vntb: Move epf_ntb_is_bar_used() up Koichiro Den
2026-10-09  5:09   ` sashiko-bot
2026-10-09  4:59 ` [PATCH v5 4/7] PCI: endpoint: pci-epf-vntb: Export endpoint DMA channels Koichiro Den
2026-10-09  5:11   ` sashiko-bot [this message]
2026-10-09  4:59 ` [PATCH v5 5/7] PCI: endpoint: pci-epf-vntb: Allow DMA and MW to share a BAR Koichiro Den
2026-10-09  5:12   ` sashiko-bot
2026-10-09  4:59 ` [PATCH v5 6/7] NTB: ntb_hw_epf: Discover vNTB-embedded DMA Koichiro Den
2026-10-09  5:14   ` sashiko-bot
2026-10-09  4:59 ` [PATCH v5 7/7] Documentation: PCI: endpoint: Document vNTB DMA export Koichiro Den
2026-10-09  5:01   ` 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=sashiko-outbox-164873@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=den@valinux.co.jp \
    --cc=linux-pci@vger.kernel.org \
    --cc=ntb@lists.linux.dev \
    --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