From: Niklas Cassel <cassel@kernel.org>
To: bhelgaas@google.com, kw@linux.com
Cc: linux-pci@vger.kernel.org, shuah@kernel.org,
linux-kselftest@vger.kernel.org,
manivannan.sadhasivam@linaro.org
Subject: Re: [PATCH 1/2] misc: pci_endpoint_test: Give disabled BARs a distinct error code
Date: Thu, 13 Feb 2025 14:48:02 +0100 [thread overview]
Message-ID: <Z634EqRu3LhKoF7F@ryzen> (raw)
In-Reply-To: <20250123120147.3603409-3-cassel@kernel.org>
On Thu, Jan 23, 2025 at 01:01:48PM +0100, Niklas Cassel wrote:
> The current code returns -ENOMEM if test->bar[barno] is NULL.
>
> There can be two reasons why test->bar[barno] is NULL:
> 1) The pci_ioremap_bar() call in pci_endpoint_test_probe() failed.
> 2) The BAR was skipped, because it is disabled by the endpoint.
>
> Many PCI endpoint controller drivers will disable all BARs in their
> init function. A disabled BAR will have a size of 0.
>
> A PCI endpoint function driver will be able to enable any BAR that
> is not marked as BAR_RESERVED (which means that the BAR should not
> be touched by the EPF driver).
>
> Thus, perform check if the size is 0, before checking if
> test->bar[barno] is NULL, such that we can return different errors.
>
> This will allow the selftests to return SKIP instead of FAIL for
> disabled BARs.
>
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
> ---
> Hello PCI maintainers.
> This patch might give a trivial conflict with:
> https://lore.kernel.org/linux-pci/20250123095906.3578241-2-cassel@kernel.org/T/#u
> because the context lines (lines that haven't been changed)
> might be different. If there is a conflict, simply look at
> this patch by itself, and resolution should be trivial.
>
> drivers/misc/pci_endpoint_test.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
> index d5ac71a49386..b95980b29eb9 100644
> --- a/drivers/misc/pci_endpoint_test.c
> +++ b/drivers/misc/pci_endpoint_test.c
> @@ -292,11 +292,13 @@ static int pci_endpoint_test_bar(struct pci_endpoint_test *test,
> void *read_buf __free(kfree) = NULL;
> struct pci_dev *pdev = test->pdev;
>
> + bar_size = pci_resource_len(pdev, barno);
> + if (!bar_size)
> + return -ENODATA;
> +
> if (!test->bar[barno])
> return -ENOMEM;
>
> - bar_size = pci_resource_len(pdev, barno);
> -
> if (barno == test->test_reg_bar)
> bar_size = 0x4;
>
> --
> 2.48.1
>
Gentle ping on this series.
Kind regards,
Niklas
next prev parent reply other threads:[~2025-02-13 13:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-23 12:01 [PATCH 1/2] misc: pci_endpoint_test: Give disabled BARs a distinct error code Niklas Cassel
2025-01-23 12:01 ` [PATCH 2/2] selftests: pci_endpoint: Skip disabled BARs Niklas Cassel
2025-02-03 16:49 ` Manivannan Sadhasivam
2025-02-14 17:45 ` Manivannan Sadhasivam
2025-01-27 16:31 ` [PATCH 1/2] misc: pci_endpoint_test: Give disabled BARs a distinct error code Niklas Cassel
2025-02-03 16:46 ` Manivannan Sadhasivam
2025-02-13 13:48 ` Niklas Cassel [this message]
2025-02-14 17:44 ` Manivannan Sadhasivam
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=Z634EqRu3LhKoF7F@ryzen \
--to=cassel@kernel.org \
--cc=bhelgaas@google.com \
--cc=kw@linux.com \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=shuah@kernel.org \
/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