Hello Rick, On Tue, Jul 23, 2024 at 06:06:26PM +0200, Rick Wertenbroek wrote: > > > > But like you suggested in the other mail, the right thing is to merge > > alloc_space() and set_bar() anyway. (Basically instead of where EPF drivers > > currently call set_bar(), the should call alloc_and_set_bar() (or whatever) > > instead.) > > > > Yes, if we merge both, the code will need to be in the EPC code > (because of the set_bar), and then the pci_epf_alloc_space (if needed) > would be called internally in the EPC code and not in the endpoint > function code. > > The only downside, as I said in my other mail, is the very niche case > where the contents of a BAR should be moved and remain unchanged when > rebinding a given endpoint function from one controller to another. > But this is not expected in any endpoint function currently, and with > the new changes, the endpoint could simply copy the BAR contents to a > local buffer and then set the contents in the BAR of the new > controller. > Anyways, probably no one is moving live functions between controllers, > and if needed it still can be done, so no problem here... I think we need to wait for Mani's opinion, but I've never heard of anyone doing so, and I agree with your suggested feature to copy the BAR contents in case anyone actually changes the backing EPC controller to an EPF. (You would need to stop the EPC to unbind + bind anyway, IIRC.) Converting pci-epf-test to a new alloc_and_set_bar() API/helper which is done at .epc_init()-time instead of at .bind()-time shouldn't be too hard. pci-epf-ntb and pci-epf-vntb looks a lot less trivial, but perhaps it is okay to convert pci-epf-test, and let the other more complex EPF drivers continue to use the lower-level APIs. Kind regards, Niklas