From: Niklas Cassel <cassel@kernel.org>
To: Koichiro Den <den@valinux.co.jp>
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
"Christian Bruel" <christian.bruel@foss.st.com>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Frank Li" <Frank.Li@nxp.com>, "Kees Cook" <kees@kernel.org>,
"Shin'ichiro Kawasaki" <shinichiro.kawasaki@wdc.com>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Bhanu Seshu Kumar Valluri" <bhanuseshukumar@gmail.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: endpoint: pci-epf-test: Roll back BAR mapping when subrange setup fails
Date: Mon, 16 Mar 2026 17:19:26 +0100 [thread overview]
Message-ID: <abgtiT6aI9GMEADH@ryzen> (raw)
In-Reply-To: <20260316140225.1481658-1-den@valinux.co.jp>
On Mon, Mar 16, 2026 at 11:02:25PM +0900, Koichiro Den wrote:
> When the BAR subrange mapping test on DWC-based platforms fails due to
> insufficient free inbound iATU regions,
> pci_epf_test_bar_subrange_setup() returns an error (-ENOSPC) but does
> not restore the original BAR mapping. This causes subsequent test runs
> to become confusing, since the failure may leave room for the next
> subrange mapping test to pass.
>
> Fix this by restoring the original BAR mapping when preparation of the
> subrange mapping fails, so that no side effect remains regardless of the
> test success or failure.
>
> Fixes: 6c5e6101423b ("PCI: endpoint: pci-epf-test: Add BAR subrange mapping test support")
> Reported-by: Christian Bruel <christian.bruel@foss.st.com>
> Closes: https://lore.kernel.org/linux-pci/b2b03ebe-9482-4a13-b22f-7b44da096eed@foss.st.com/
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
> ---
> drivers/pci/endpoint/functions/pci-epf-test.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
> index 14e61ebe1f11..f44c36f5cac5 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -898,16 +898,22 @@ static void pci_epf_test_bar_subrange_setup(struct pci_epf_test *epf_test,
> bar->submap = submap;
> bar->num_submap = nsub;
>
> ret = pci_epc_set_bar(epc, epf->func_no, epf->vfunc_no, bar);
> if (ret) {
> dev_err(&epf->dev, "pci_epc_set_bar() failed: %d\n", ret);
> bar->submap = old_submap;
> bar->num_submap = old_nsub;
> + ret = pci_epc_set_bar(epc, epf->func_no, epf->vfunc_no, bar);
> + if (ret)
> + dev_warn(&epf->dev,
> + "failed to restore the original BAR mapping: %d\n",
Nit:
I would use a capitalized F:
"Failed to restore ..."
in order to match most other prints in this file.
Reviewed-by: Niklas Cassel <cassel@kernel.org>
next prev parent reply other threads:[~2026-03-16 16:19 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-16 14:02 [PATCH] PCI: endpoint: pci-epf-test: Roll back BAR mapping when subrange setup fails Koichiro Den
2026-03-16 14:36 ` Koichiro Den
2026-03-16 14:41 ` Koichiro Den
2026-03-16 16:19 ` Niklas Cassel [this message]
2026-03-17 2:57 ` Koichiro Den
2026-03-17 3:27 ` Manivannan Sadhasivam
2026-03-17 9:13 ` Christian Bruel
2026-03-17 9:24 ` Niklas Cassel
2026-03-17 9:55 ` Christian Bruel
2026-03-17 10:01 ` Christian Bruel
2026-03-17 10:12 ` Niklas Cassel
2026-03-17 10:29 ` Christian Bruel
2026-03-17 10:46 ` Niklas Cassel
2026-03-17 15:14 ` Koichiro Den
2026-03-18 8:02 ` Christian Bruel
2026-03-18 8:35 ` Christian Bruel
2026-03-18 8:58 ` Niklas Cassel
2026-03-18 12:58 ` Christian Bruel
2026-03-17 15:17 ` Koichiro Den
2026-03-17 9:59 ` Manivannan Sadhasivam
2026-03-17 10:02 ` Christian Bruel
2026-03-17 10:05 ` Niklas Cassel
2026-03-17 15:27 ` 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=abgtiT6aI9GMEADH@ryzen \
--to=cassel@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bhanuseshukumar@gmail.com \
--cc=bhelgaas@google.com \
--cc=christian.bruel@foss.st.com \
--cc=den@valinux.co.jp \
--cc=kees@kernel.org \
--cc=kishon@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mani@kernel.org \
--cc=shinichiro.kawasaki@wdc.com \
/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