Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Koichiro Den" <den@valinux.co.jp>
Cc: linux-pci@vger.kernel.org, ntb@lists.linux.dev
Subject: Re: [PATCH v7 05/10] PCI: endpoint: pci-epf-vntb: Export endpoint DMA channels
Date: Wed, 21 Oct 2026 04:47:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-179795@kernel.org> (raw)
In-Reply-To: <20261021042229.2280937-6-den@valinux.co.jp>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] PCI: endpoint: pci-epf-vntb: return error in epf_ntb_dma_set_bar() when !dma
--

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

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

This commit adds support for exporting endpoint-local DMA read channels to
the RC through a configurable dma_bar configfs attribute and a control-region
extension. When configured, it reserves the read direction channels, maps
unassigned resources through the selected BAR, and adds the
EPF_NTB_COMMAND_SETUP_DMA_BAR command to install the BAR submappings.

> diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> index 3adbaa9d85db2..ac83af54122f7 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c

[ ... ]

> +static int epf_ntb_dma_set_bar(struct epf_ntb *ntb)
> +{
> +	struct pci_epf_bar_submap *old_submap;
> +	struct epf_ntb_dma *dma = ntb->dma;
> +	unsigned int old_num_submap;
> +	struct pci_epf_bar *bar;
> +	int restore, ret;
> +
> +	if (!dma)
> +		return 0;

[Severity: Medium]
Should epf_ntb_dma_set_bar() return a negative error code (such as -EINVAL
or -EOPNOTSUPP) instead of 0 when dma is NULL?

When dma_bar is left unassigned (NO_BAR), epf_ntb_dma_collect() leaves
ntb->dma as NULL. The only caller of epf_ntb_dma_set_bar() is
epf_ntb_cmd_handler() when servicing EPF_NTB_COMMAND_SETUP_DMA_BAR:

	case EPF_NTB_COMMAND_SETUP_DMA_BAR:
		ret = epf_ntb_dma_set_bar(ntb);
		ctrl->command_status = ret ? EPF_NTB_COMMAND_STATUS_ERROR :
					     EPF_NTB_COMMAND_STATUS_OK;
		break;

Returning 0 here causes epf_ntb_cmd_handler() to report
EPF_NTB_COMMAND_STATUS_OK to the host peer even though DMA export is
disabled and no DMA BAR was configured.

[ ... ]

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

  reply	other threads:[~2026-10-21  4:47 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21  4:22 [PATCH v7 00/10] PCI: endpoint: Remote DMA support via vNTB Koichiro Den
2026-10-21  4:22 ` [PATCH v7 01/10] PCI: endpoint: Add DMA auxiliary resource metadata Koichiro Den
2026-10-21  4:27   ` sashiko-bot
2026-10-21  4:22 ` [PATCH v7 02/10] PCI: dwc: Expose endpoint DMA resources Koichiro Den
2026-10-21  4:38   ` sashiko-bot
2026-10-21  4:22 ` [PATCH v7 03/10] PCI: endpoint: pci-epf-vntb: Move epf_ntb_is_bar_used() up Koichiro Den
2026-10-21  4:25   ` sashiko-bot
2026-10-21  4:22 ` [PATCH v7 04/10] PCI: endpoint: Add pci-epf-ntb.h for the shared NTB control layout Koichiro Den
2026-10-21  4:25   ` sashiko-bot
2026-10-21  4:22 ` [PATCH v7 05/10] PCI: endpoint: pci-epf-vntb: Export endpoint DMA channels Koichiro Den
2026-10-21  4:47   ` sashiko-bot [this message]
2026-10-21  4:22 ` [PATCH v7 06/10] PCI: endpoint: pci-epf-vntb: Allow DMA and MW to share a BAR Koichiro Den
2026-10-21  4:43   ` sashiko-bot
2026-10-21 15:52   ` Frank Li
2026-10-21 16:35     ` Koichiro Den
2026-10-21 19:00       ` Frank Li
2026-10-21  4:22 ` [PATCH v7 07/10] Documentation: PCI: endpoint: Document vNTB DMA export Koichiro Den
2026-10-21  4:25   ` sashiko-bot
2026-10-21  4:22 ` [PATCH v7 08/10] NTB: ntb_hw_epf: Use the shared NTB control layout Koichiro Den
2026-10-21  4:26   ` sashiko-bot
2026-10-21 15:53   ` Frank Li
2026-10-21  4:22 ` [PATCH v7 09/10] NTB: ntb_hw_epf: Discover vNTB-embedded DMA Koichiro Den
2026-10-21  4:36   ` sashiko-bot
2026-10-21  4:22 ` [PATCH v7 10/10] NTB: ntb_hw_epf: Support DMA and MW sharing a BAR Koichiro Den
2026-10-21  4:33   ` sashiko-bot
2026-10-21 15:58   ` Frank Li
2026-10-21 16:57     ` Koichiro Den
2026-10-21 18:51       ` Frank Li

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-179795@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