From: sashiko-bot@kernel.org
To: "Leon Romanovsky" <leon@kernel.org>
Cc: linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-rdma@vger.kernel.org, kvm@vger.kernel.org,
media-ci@linuxtv.org
Subject: Re: [PATCH v12 15/19] PCI: Add KUnit coverage for ACS isolation checks
Date: Tue, 03 Nov 2026 11:11:10 +0000 [thread overview]
Message-ID: <sashiko-outbox-195118@kernel.org> (raw)
In-Reply-To: <20261103-fix-p2p-acs-v4-0-v12-15-912101f93517@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] PCI: duplicated mock device setup in pci_acs_flags_enabled_test()
--
commit cd21c328560f2b4befdb418098279304a429237f
Author: Leon Romanovsky <leon@kernel.org>
PCI: Add KUnit coverage for ACS isolation checks
This commit exposes pci_acs_flags_enabled() when KUnit is enabled and adds
KUnit tests in drivers/pci/pci_acs_test.c using mock config-space operations
to verify ACS isolation checks, missing capabilities, and failed config reads.
> diff --git a/drivers/pci/pci_acs_test.c b/drivers/pci/pci_acs_test.c
> index 18c697226762d..369444d2a04a0 100644
> --- a/drivers/pci/pci_acs_test.c
> +++ b/drivers/pci/pci_acs_test.c
> @@ -103,10 +103,145 @@ static void pci_acs_p2pdma_completion_test(struct kunit *test)
[ ... ]
> +static void pci_acs_flags_enabled_test(struct kunit *test)
> +{
> + const struct acs_isolation_case *c = test->param_value;
> + struct acs_ctrl_cfg cfg = {
> + .devfn = PCI_DEVFN(0, 0),
> + .cap = ACS_TEST_CAP,
> + .ctrl = c->ctrl,
> + };
> + struct pci_bus *bus = kunit_kzalloc(test, sizeof(*bus), GFP_KERNEL);
> + struct pci_dev *pdev = kunit_kzalloc(test, sizeof(*pdev), GFP_KERNEL);
> +
> + KUNIT_ASSERT_NOT_NULL(test, bus);
> + KUNIT_ASSERT_NOT_NULL(test, pdev);
> +
> + bus->ops = &acs_ctrl_ops;
> + bus->sysdata = &cfg;
> +
> + pdev->bus = bus;
> + pdev->devfn = cfg.devfn;
> + pdev->acs_cap = ACS_TEST_CAP;
> + pdev->acs_capabilities = ACS_ALL_CAPS;
> +
> + KUNIT_EXPECT_EQ(test, pci_acs_flags_enabled(pdev, c->req), c->expect);
> +}
> +
> +static bool acs_isolated(struct kunit *test, struct acs_ctrl_cfg *cfg,
> + u16 acs_cap, u16 acs_flags)
> +{
> + struct pci_bus *bus = kunit_kzalloc(test, sizeof(*bus), GFP_KERNEL);
> + struct pci_dev *pdev = kunit_kzalloc(test, sizeof(*pdev), GFP_KERNEL);
> +
> + KUNIT_ASSERT_NOT_NULL(test, bus);
> + KUNIT_ASSERT_NOT_NULL(test, pdev);
> +
> + bus->ops = &acs_ctrl_ops;
> + bus->sysdata = cfg;
> +
> + pdev->bus = bus;
> + pdev->devfn = cfg->devfn;
> + pdev->acs_cap = acs_cap;
> + pdev->acs_capabilities = ACS_ALL_CAPS;
> +
> + return pci_acs_flags_enabled(pdev, acs_flags);
> +}
[Severity: Low]
This isn't a bug, but in drivers/pci/pci_acs_test.c,
pci_acs_flags_enabled_test() open-codes the same mock struct pci_bus and
struct pci_dev allocation and initialization that acs_isolated() performs
immediately below it.
Also, struct acs_ctrl_cfg already carries the cap field, which every caller
initializes to the same value passed as the separate acs_cap argument to
acs_isolated().
Could acs_isolated() set pdev->acs_cap from cfg->cap directly, and could
pci_acs_flags_enabled_test() call acs_isolated() to avoid duplicating the
setup?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261103-fix-p2p-acs-v4-0-v12-0-912101f93517@nvidia.com?part=15
next prev parent reply other threads:[~2026-11-03 11:11 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 8:29 [PATCH v12 00/19] PCI/P2PDMA: Route peer-to-peer DMA by TLP class Leon Romanovsky
2026-11-03 8:29 ` [PATCH v12 01/19] PCI/P2PDMA: Honor device-specific ACS redirection Leon Romanovsky
2026-11-03 8:43 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 02/19] PCI/P2PDMA: Document the TLP attribute assumptions Leon Romanovsky
2026-11-03 8:45 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 03/19] PCI/P2PDMA: Derive routing from directional ACS controls Leon Romanovsky
2026-11-03 9:02 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 04/19] PCI: Reject unreadable ACS controls in isolation checks Leon Romanovsky
2026-11-03 9:09 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 05/19] PCI/P2PDMA: Evaluate ACS controls at the path divergence Leon Romanovsky
2026-11-03 9:31 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 06/19] PCI/P2PDMA: Document directional ACS routing Leon Romanovsky
2026-11-03 9:39 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 07/19] PCI/P2PDMA: Collect the path's ACS controls before deciding Leon Romanovsky
2026-11-03 9:53 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 08/19] PCI/P2PDMA: Answer routing per TLP class Leon Romanovsky
2026-11-03 10:06 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 09/19] PCI/P2PDMA: Route Relaxed Ordering Completions directly Leon Romanovsky
2026-11-03 10:10 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 10/19] PCI/P2PDMA: Reject Translated Requests blocked by Translation Blocking Leon Romanovsky
2026-11-03 10:34 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 11/19] PCI/P2PDMA: Route Translated Requests under Direct Translated P2P Leon Romanovsky
2026-11-03 10:45 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 12/19] PCI/P2PDMA: Log detailed ACS routing diagnostics Leon Romanovsky
2026-11-03 11:01 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 13/19] PCI/P2PDMA: Add KUnit tests for the ACS routing decisions Leon Romanovsky
2026-11-03 11:03 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 14/19] PCI/P2PDMA: Test the ACS P2P routing walk Leon Romanovsky
2026-11-03 11:07 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 15/19] PCI: Add KUnit coverage for ACS isolation checks Leon Romanovsky
2026-11-03 11:11 ` sashiko-bot [this message]
2026-11-03 8:29 ` [PATCH v12 16/19] PCI/P2PDMA: Document TLP-class routing Leon Romanovsky
2026-11-03 11:12 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 17/19] PCI/P2PDMA: Let a client declare that it selects ATS per mapping Leon Romanovsky
2026-11-03 11:15 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 18/19] PCI/P2PDMA: Evaluate the ATS path for clients with ATS enabled Leon Romanovsky
2026-11-03 11:34 ` sashiko-bot
2026-11-03 8:29 ` [PATCH v12 19/19] PCI/P2PDMA: Test the routing of " Leon Romanovsky
2026-11-03 11:37 ` sashiko-bot
2026-11-03 23:37 ` [PATCH v12 00/19] PCI/P2PDMA: Route peer-to-peer DMA by TLP class Bjorn Helgaas
2026-11-04 8:43 ` Leon Romanovsky
2026-11-04 17:14 ` Bjorn Helgaas
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-195118@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kvm@vger.kernel.org \
--cc=leon@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=media-ci@linuxtv.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.