public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: "Manivannan Sadhasivam" <mani@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: Manikanta Maddireddy <mmaddireddy@nvidia.com>,
	Koichiro Den <den@valinux.co.jp>,
	Damien Le Moal <dlemoal@kernel.org>,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH 8/9] misc: pci_endpoint_test: Give reserved BARs a distinct error code
Date: Tue, 17 Feb 2026 22:45:47 +0100	[thread overview]
Message-ID: <aZThizkq5MbGK4NA@ryzen> (raw)
In-Reply-To: <20260217212707.2450423-19-cassel@kernel.org>

On Tue, Feb 17, 2026 at 10:27:14PM +0100, Niklas Cassel wrote:
> Give reserved BARs a distinct error code, such that the pci_endpoint_test
> selftest will be able to skip test cases that are run against reserved
> BARs.
> 
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
> ---
>  drivers/misc/pci_endpoint_test.c | 32 ++++++++++++++++++++++++++++++--
>  1 file changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
> index 74ab5b5b9011..7cffb6e77c4d 100644
> --- a/drivers/misc/pci_endpoint_test.c
> +++ b/drivers/misc/pci_endpoint_test.c
> @@ -84,6 +84,12 @@
>  #define CAP_MSIX				BIT(2)
>  #define CAP_INTX				BIT(3)
>  #define CAP_SUBRANGE_MAPPING			BIT(4)
> +#define CAP_BAR0_RESERVED			BIT(5)
> +#define CAP_BAR1_RESERVED			BIT(6)
> +#define CAP_BAR2_RESERVED			BIT(7)
> +#define CAP_BAR3_RESERVED			BIT(8)
> +#define CAP_BAR4_RESERVED			BIT(9)
> +#define CAP_BAR5_RESERVED			BIT(10)
>  
>  #define PCI_ENDPOINT_TEST_DB_BAR		0x34
>  #define PCI_ENDPOINT_TEST_DB_OFFSET		0x38
> @@ -275,6 +281,23 @@ static int pci_endpoint_test_request_irq(struct pci_endpoint_test *test)
>  	return ret;
>  }
>  
> +static bool bar_is_reserved(struct pci_endpoint_test *test, enum pci_barno bar)
> +{
> +	if (bar == BAR_0 && test->ep_caps & CAP_BAR0_RESERVED)
> +		return true;
> +	else if (bar == BAR_1 && test->ep_caps & CAP_BAR1_RESERVED)
> +		return true;
> +	else if (bar == BAR_2 && test->ep_caps & CAP_BAR2_RESERVED)
> +		return true;
> +	else if (bar == BAR_3 && test->ep_caps & CAP_BAR3_RESERVED)
> +		return true;
> +	else if (bar == BAR_4 && test->ep_caps & CAP_BAR4_RESERVED)
> +		return true;
> +	else if (bar == BAR_5 && test->ep_caps & CAP_BAR5_RESERVED)
> +		return true;
> +	return false;

All these "else if" could be replaced with regular "if" since they have
have a return statement inside the if statement.


Kind regards,
Niklas

  reply	other threads:[~2026-02-17 21:45 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-17 21:27 [PATCH 0/9] PCI: endpoint differentiate between disabled and reserved BARs Niklas Cassel
2026-02-17 21:27 ` [PATCH 1/9] PCI: endpoint: Introduce pci_epc_bar_type BAR_64BIT_UPPER Niklas Cassel
2026-02-17 21:57   ` Frank Li
     [not found]     ` <81af7f88-b9c1-457f-9a21-a7b15a13d374@nvidia.com>
2026-02-23 10:14       ` Geert Uytterhoeven
2026-02-24 13:54         ` Manikanta Maddireddy
2026-02-17 21:27 ` [PATCH 2/9] PCI: endpoint: Describe reserved subregions within BARs Niklas Cassel
2026-02-23  4:06   ` Manikanta Maddireddy
2026-02-17 21:27 ` [PATCH 3/9] PCI: dw-rockchip: Describe RK3588 BAR4 DMA ctrl window Niklas Cassel
2026-02-23  4:10   ` Manikanta Maddireddy
2026-02-17 21:27 ` [PATCH 4/9] PCI: endpoint: Introduce pci_epc_bar_type BAR_DISABLED Niklas Cassel
2026-02-17 22:03   ` Frank Li
2026-02-18 10:33     ` Niklas Cassel
2026-02-18 16:01       ` Frank Li
2026-02-23  4:17     ` Manikanta Maddireddy
2026-02-17 21:27 ` [PATCH 5/9] PCI: dwc: Replace BAR_RESERVED with BAR_DISABLED in glue drivers Niklas Cassel
2026-02-17 22:15   ` Frank Li
2026-02-23  4:46     ` Manikanta Maddireddy
2026-02-25 14:56       ` Niklas Cassel
2026-02-17 21:27 ` [PATCH 6/9] PCI: dwc: Disable BARs in common code instead of in each glue driver Niklas Cassel
2026-02-17 23:00   ` Frank Li
2026-02-17 21:27 ` [PATCH 7/9] PCI: endpoint: pci-epf-test: Advertise reserved BARs Niklas Cassel
2026-02-17 23:02   ` Frank Li
2026-02-18 10:43     ` Niklas Cassel
2026-02-18 16:00       ` Frank Li
2026-02-19  9:35         ` Niklas Cassel
2026-02-19 17:12           ` Frank Li
2026-02-23  4:57             ` Manikanta Maddireddy
2026-02-17 21:27 ` [PATCH 8/9] misc: pci_endpoint_test: Give reserved BARs a distinct error code Niklas Cassel
2026-02-17 21:45   ` Niklas Cassel [this message]
2026-02-17 23:07   ` Frank Li
2026-02-18 10:44     ` Niklas Cassel
2026-02-23  5:00       ` Manikanta Maddireddy
2026-02-25 15:46         ` Niklas Cassel
2026-02-17 21:27 ` [PATCH 9/9] selftests: pci_endpoint: Skip reserved BARs Niklas Cassel
2026-02-17 23:11   ` Frank Li
2026-02-23  5:03     ` Manikanta Maddireddy
2026-02-23  3:49 ` [PATCH 0/9] PCI: endpoint differentiate between disabled and " Manikanta Maddireddy

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=aZThizkq5MbGK4NA@ryzen \
    --to=cassel@kernel.org \
    --cc=arnd@arndb.de \
    --cc=den@valinux.co.jp \
    --cc=dlemoal@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kishon@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=mmaddireddy@nvidia.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