Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@mailbox.org>
To: Damien Le Moal <dlemoal@kernel.org>, linux-pci@vger.kernel.org
Cc: "Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Frank Li" <Frank.Li@nxp.com>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Niklas Cassel" <cassel@kernel.org>,
	"Wang Jiang" <jiangwang@kylinos.cn>,
	linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH] PCI: endpoint: pci-epf-test: Limit PCIe BAR size for fixed BARs
Date: Thu, 4 Sep 2025 19:35:41 +0200	[thread overview]
Message-ID: <99657eb0-e70d-4db3-ac09-6d15c0eb73dd@mailbox.org> (raw)
In-Reply-To: <d7bf992f-0342-450d-8830-f0523ac11e2a@kernel.org>

On 9/4/25 5:39 AM, Damien Le Moal wrote:
> On 9/4/25 12:32 PM, Marek Vasut wrote:
>> On 9/4/25 4:40 AM, Damien Le Moal wrote:
>>
>> Hello Damien,
>>
>>>> @@ -1050,7 +1051,13 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf)
>>>>            if (bar == test_reg_bar)
>>>>                continue;
>>>>    -        base = pci_epf_alloc_space(epf, bar_size[bar], bar,
>>>> +        test_bar_size = bar_size[bar];
>>>> +
>>>> +        bar_fixed_size = epc_features->bar[bar].fixed_size;
>>>> +        if (epc_features->bar[bar].type == BAR_FIXED && bar_fixed_size)
>>>> +            test_bar_size = min(bar_size[bar], bar_fixed_size);
>>>
>>> I think this can be simplified to:
>>>
>>>          if (epc_features->bar[bar].type == BAR_FIXED)
>>>              test_bar_size = epc_features->bar[bar].fixed_size;
>>>          else
>>>              test_bar_size = bar_size[bar];
>>>
>>> because if the bar type is BAR_FIXED, then the size of the bar can only be its
>>> fixed size.
>> That is correct, however, please consider the following case:
>>
>> - The BAR under test is BAR4 , therefore the size requested by this driver is
>> bar_size[4] = 131072 Bytes
>> - The BAR4 on a hypothetical hardware is a fixed size BAR , 262144 Bytes large
>>
>> With your proposed change, the "test_bar_size" would end up being 262144
>> Bytes , instead of 131072 Bytes without your proposed change , which I think is
>> not the desired behavior.
>>
>> What do you think ?
> 
> The bar size for the test is arbitrary. If the bar being tested is not a fixed
> bar, anything is OK. But in the case of a fixed bar, you can only use the fixed
> bar size so we should force that.
OK, understood. I'll run tests on V2 and then submit a V2.

Thanks !

  reply	other threads:[~2025-09-04 17:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04  2:37 [PATCH] PCI: endpoint: pci-epf-test: Limit PCIe BAR size for fixed BARs Marek Vasut
2025-09-04  2:40 ` Damien Le Moal
2025-09-04  3:32   ` Marek Vasut
2025-09-04  3:39     ` Damien Le Moal
2025-09-04 17:35       ` Marek Vasut [this message]
2025-09-04 12:28   ` Niklas Cassel
2025-09-04 21:29     ` Marek Vasut
2025-09-05  7:43       ` Jerome Brunet
2025-09-05 11:38         ` Marek Vasut
2025-09-05  7:32     ` Jerome Brunet
2025-09-05  8:36       ` Niklas Cassel
2025-09-05 12:14         ` Marek Vasut

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=99657eb0-e70d-4db3-ac09-6d15c0eb73dd@mailbox.org \
    --to=marek.vasut@mailbox.org \
    --cc=Frank.Li@nxp.com \
    --cc=bhelgaas@google.com \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=jiangwang@kylinos.cn \
    --cc=kishon@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mani@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