On Wed, Mar 13, 2024 at 11:57:53AM +0100, Niklas Cassel wrote: > pci_epf_test_alloc_space() currently skips the BAR succeeding a 64-bit BAR > if the 64-bit flag is set, before calling pci_epf_alloc_space(). > > However, pci_epf_alloc_space() will set the 64-bit flag if we request an > allocation of 4 GB or larger, even if it wasn't set before the allocation. > Max BAR size is 1MB currently, so I believe you are adding the check just for the sake of correctness. If so, please mention it explicitly. - Mani > Thus, we need to check the flag also after pci_epf_alloc_space(). > > Signed-off-by: Niklas Cassel <cassel@xxxxxxxxxx> > --- > 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 cd4ffb39dcdc..01ba088849cc 100644 > --- a/drivers/pci/endpoint/functions/pci-epf-test.c > +++ b/drivers/pci/endpoint/functions/pci-epf-test.c > @@ -865,6 +865,12 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) > dev_err(dev, "Failed to allocate space for BAR%d\n", > bar); > epf_test->reg[bar] = base; > + > + /* > + * pci_epf_alloc_space() might have given us a 64-bit BAR, > + * if we requested a size larger than 4 GB. > + */ > + add = (epf_bar->flags & PCI_BASE_ADDRESS_MEM_TYPE_64) ? 2 : 1; > } > > return 0; > -- > 2.44.0 > -- மணிவண்ணன் சதாசிவம்