ntb.lists.linux.dev archive mirror
 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 05/11] PCI: endpoint: pci-epf-vntb: Allocate packed outbound MW space
Date: Mon, 03 Aug 2026 18:32:21 +0000	[thread overview]
Message-ID: <20260803183222.654851F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260803180439.1963864-6-den@valinux.co.jp>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Packed outbound MW space is allocated but can never be mapped to the host, rendering it unusable.
--

--- Patch [5]: [PATCH 05/11] PCI: endpoint: pci-epf-vntb: Allocate packed outbound MW space ---
commit 1f91a957de194db5f5786ea1932b0222be01c3a2
Author: Koichiro Den <den@valinux.co.jp>

PCI: endpoint: pci-epf-vntb: Allocate packed outbound MW space

A packed MW group can use one outbound iATU region only when its EPC
address range is contiguous.

Allocate one EPC address range for the group and expose each logical MW
as a subrange. Singleton MWs keep separate allocations.

> diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> index 0c72b907c2896..aa8d304fe861f 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
[ ... ]
> @@ -926,6 +936,9 @@ static int epf_ntb_mw_bar_init(struct epf_ntb *ntb)
>  
>  alloc_vpci_mw:
>  		/* Allocate EPC outbound memory windows to vpci vntb device */
> +		count = ntb->packed_mws ? ntb->packed_mws : 1;
> +		size = epf_ntb_mw_group_size(ntb, i, count);
> +		/* Only the group head owns the allocation handle. */
>  		ntb->vpci_mw_addr[i] = pci_epc_mem_alloc_addr(ntb->epf->epc,
>  							      &ntb->vpci_mw_phy[i],
>  							      size);

[Severity: High]
Will the newly allocated packed MW space ever be mapped to the host, or does
it remain unusable?

In epf_ntb_configure_mw() (which handles VHOST CMD_CONFIGURE_MW requests from
the host), the driver explicitly rejects packed groups:

drivers/pci/endpoint/functions/pci-epf-vntb.c:epf_ntb_configure_mw() {
	...
	ret = epf_ntb_get_mw_group(ntb, mw, NULL, &count);
	if (ret)
		return ret;
	if (count > 1)
		return -EOPNOTSUPP;
	...
}

Since mapping of packed groups returns -EOPNOTSUPP without calling
pci_epc_map_addr(), won't the configuration fail when requested by the host?
If so, does the memory allocated here go unused, preventing host memory access
for packed MW groups?

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

  reply	other threads:[~2026-08-03 18:32 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 18:04 [PATCH 00/11] PCI/NTB: endpoint: packed vNTB memory windows Koichiro Den
2026-08-03 18:04 ` [PATCH 01/11] NTB: Add atomic MW translation group operations Koichiro Den
2026-08-03 18:10   ` sashiko-bot
2026-08-03 18:04 ` [PATCH 02/11] NTB: epf: Parse a versioned packed MW layout Koichiro Den
2026-08-03 18:23   ` sashiko-bot
2026-08-03 18:04 ` [PATCH 03/11] PCI: endpoint: pci-epf-vntb: Add packed MW layout handling Koichiro Den
2026-08-03 18:25   ` sashiko-bot
2026-08-03 18:04 ` [PATCH 04/11] PCI: endpoint: pci-epf-vntb: Implement MW group translation callbacks Koichiro Den
2026-08-03 18:25   ` sashiko-bot
2026-08-04  1:41     ` Koichiro Den
2026-08-03 18:04 ` [PATCH 05/11] PCI: endpoint: pci-epf-vntb: Allocate packed outbound MW space Koichiro Den
2026-08-03 18:32   ` sashiko-bot [this message]
2026-08-03 18:04 ` [PATCH 06/11] PCI: endpoint: pci-epf-vntb: Add outbound MW group commands Koichiro Den
2026-08-03 18:28   ` sashiko-bot
2026-08-03 18:04 ` [PATCH 07/11] NTB: epf: Implement MW group translation callbacks Koichiro Den
2026-08-03 18:29   ` sashiko-bot
2026-08-03 18:04 ` [PATCH 08/11] NTB: perf: Reject grouped memory windows Koichiro Den
2026-08-03 18:25   ` sashiko-bot
2026-08-03 18:04 ` [PATCH 09/11] NTB/msi: Require a singleton memory window Koichiro Den
2026-08-03 18:23   ` sashiko-bot
2026-08-03 18:04 ` [PATCH 10/11] NTB: ntb_transport: Use atomic MW translation groups Koichiro Den
2026-08-03 18:40   ` sashiko-bot
2026-08-03 18:04 ` [PATCH 11/11] PCI: endpoint: pci-epf-vntb: Expose packed MWs through configfs Koichiro Den
2026-08-03 18:40   ` sashiko-bot
2026-08-03 23:00 ` [PATCH 00/11] PCI/NTB: endpoint: packed vNTB memory windows Randy Dunlap
2026-08-04  0:55   ` Koichiro Den

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=20260803183222.654851F000E9@smtp.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;
as well as URLs for NNTP newsgroup(s).