On Fri, Sep 05, 2025 at 09:32:03AM +0200, Jerome Brunet wrote: > On Thu 04 Sep 2025 at 14:28, Niklas Cassel <cassel@xxxxxxxxxx> wrote: > >> > >> 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]; > > > > +1 > > It's what pci_epf_alloc_space() does too. so it makes sense but it also > means the side must stay aligned. Not really, pci_epf_alloc_space() will give you 'fixed_size' if you request size < fixed_size. If you request more, it will give you an error. > > If a rework is needed, maybe it would be better to get size from > pci_epf_alloc_space() instead of recomputing it ? The pci-epf-test driver is just a test driver and we can use whatever BAR size we want for each BAR. However, I don't think that pci_epf_alloc_space() can always give us a BAR size. Sure, for fixed_size BARs, there is only a single size that is possible. But for Programmable and Resizable BARs, there are many possible sizes, so which size should pci_epf_alloc_space() then return? And not all EPF drivers might be happy with an aribitrary BAR size (which is the case for pci-epf-test), some EPF drivers might have strict minimum sizes for a BAR. So, I still think this proposal is the best thing we can do. At least it appears that we only need to patch pci-epf-test. Kind regards, Niklas