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 03/11] PCI: endpoint: pci-epf-vntb: Add packed MW layout handling
Date: Mon, 03 Aug 2026 18:25:48 +0000 [thread overview]
Message-ID: <20260803182549.3798E1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260803180439.1963864-4-den@valinux.co.jp>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] The packed_mws feature is entirely unreachable as it cannot be configured by userspace.
- [Medium] Outbound ATU mapping is completely broken for packed memory windows due to explicit rejection.
- [Medium] Inbound translations for packed configurations are unusable and dynamically corrupt the shared BAR.
--
--- Patch [3]: [PATCH 03/11] PCI: endpoint: pci-epf-vntb: Add packed MW layout handling ---
commit b1065455da6e47589efee078ad0c8d01095b3f1a
Author: Koichiro Den <den@valinux.co.jp>
PCI: endpoint: pci-epf-vntb: Add packed MW layout handling
Teach pci-epf-vntb to build a packed layout and advertise its logical
MWs as one version 1 translation group. Non-packed configurations keep
the version 0 layout and one MW per BAR.
> diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> index c3caec927d748..f22459e5a8c69 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
[ ... ]
> @@ -129,17 +132,27 @@ struct epf_ntb_ctrl {
> u32 db_entry_size;
> u32 db_data[MAX_DB_COUNT];
> u32 db_offset[MAX_DB_COUNT];
> + u32 mw_bar;
> + u32 mw_group_size;
> } __packed;
>
> +struct epf_ntb_mw_layout {
> + enum pci_barno barno;
> + u64 offset;
> + u64 size;
> +};
> +
> struct epf_ntb {
> struct ntb_dev ntb;
> struct pci_epf *epf;
> struct config_group group;
>
> u32 num_mws;
> + u32 packed_mws;
[Severity: Medium]
Will userspace be able to configure packed_mws?
It appears that there is no EPF_NTB_W(packed_mws) macro or a corresponding
entry in the epf_ntb_attrs[] configfs array, which means this field might
not be writable by userspace.
Additionally, looking at epf_ntb_num_mws_store(), it restricts num_mws to
MAX_MW (4), so the new EPF_NTB_MAX_MW (16) limit for packed configurations
cannot be reached.
[ ... ]
> @@ -227,13 +254,23 @@ static int epf_ntb_configure_mw(struct epf_ntb *ntb, u32 mw)
> {
> phys_addr_t phys_addr;
> u8 func_no, vfunc_no;
> + unsigned int count;
> u64 addr, size;
> - int ret = 0;
> + int ret;
> +
> + ret = epf_ntb_get_mw_group(ntb, mw, NULL, &count);
> + if (ret)
> + return ret;
> + if (count > 1)
> + return -EOPNOTSUPP;
[Severity: Medium]
How will outbound memory windows be mapped for packed layouts?
If count > 1 is explicitly rejected here with -EOPNOTSUPP, and there is no
COMMAND_CONFIGURE_MW_GROUP handler in epf_ntb_cmd_handler() to manage packed
layouts, will the NTB host always receive a COMMAND_STATUS_ERROR when
attempting to map an outbound grouped window?
[ ... ]
> @@ -1656,6 +1838,7 @@ static const struct ntb_dev_ops vntb_epf_ops = {
> .db_vector_count = vntb_epf_db_vector_count,
> .db_vector_mask = vntb_epf_db_vector_mask,
> .db_set_mask = vntb_epf_db_set_mask,
> + .mw_get_trans_group = vntb_epf_mw_get_trans_group,
[Severity: Medium]
Are the .mw_set_trans_group and .mw_clear_trans_group callbacks missing?
Without the group callbacks, the NTB subsystem falls back to using
.mw_set_trans (vntb_epf_mw_set_trans), which locklessly overwrites
epf_bar->phys_addr and epf_bar->size with a single segment's attributes.
Because all segments of a packed MW share the same BAR, won't calling this
for each segment continuously overwrite the entire BAR's inbound translation
and corrupt the mappings for all other windows in the group?
> .mw_set_trans = vntb_epf_mw_set_trans,
> .mw_clear_trans = vntb_epf_mw_clear_trans,
> .peer_mw_get_addr = vntb_epf_peer_mw_get_addr,
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260803180439.1963864-1-den@valinux.co.jp?part=3
next prev parent reply other threads:[~2026-08-03 18:25 UTC|newest]
Thread overview: 25+ 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 [this message]
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-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
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=20260803182549.3798E1F00A3A@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