On Thu, Jan 07, 2021 at 11:31:36PM +0000, Darren Salt wrote:
I demand that Bjorn Helgaas may or may not have written...
?
+static inline int pci_rebar_bytes_to_size(u64 bytes) +{
- bytes = roundup_pow_of_two(bytes);
- return max(ilog2(bytes), 20) - 20;
This isn't returning a "size", is it? It looks like it's returning the log2 of the number of MB the BAR will be, i.e., the encoding used by the Resizable BAR Control register "BAR Size" field. Needs a brief comment to that effect and/or a different function name.
Given that, it seems to me that pci_rebar_size_to_bytes should be similarly commented and/or renamed.
Makes sense. Something like this is sufficient:
return 1ULL << (size + 20); /* Convert PCI_REBAR_CTRL "BAR Size" */