[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <247854C3-B81F-48E2-A68C-CCA5F4338600@kernel.org>
Date: Wed, 08 Oct 2025 01:45:48 +0200
From: Niklas Cassel <cassel@...nel.org>
To: Frank Li <Frank.li@....com>
CC: Manivannan Sadhasivam <mani@...nel.org>,
Krzysztof WilczyĆski <kwilczynski@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>, Jon Mason <jdmason@...zu.us>,
Dave Jiang <dave.jiang@...el.com>, Allen Hubbe <allenbh@...il.com>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org, ntb@...ts.linux.dev,
imx@...ts.linux.dev
Subject: Re: [PATCH v4 1/3] PCI: endpoint: Add helper function pci_epf_get_bar_required_size()
On 7 October 2025 20:26:01 CEST, Frank Li <Frank.li@....com> wrote:
>On Mon, Oct 06, 2025 at 12:43:52PM +0200, Niklas Cassel wrote:
>> On Tue, Sep 30, 2025 at 04:39:37PM -0400, Frank Li wrote:
>> > Introduce pci_epf_get_bar_required_size() to retrieve the required BAR
>> > size and memory size. Prepare for adding support to set an MMIO address to
>> > a specific BAR.
>> >
>> > Use two variables 'aligned_bar_size' and 'aligned_mem_size' to avoid
>> > confuse.
>>
>> 'aligned_bar_size' has been renamed, so this sentence should be updated.
>>
>>
>> (snip)
>>
>> > @@ -308,7 +327,9 @@ void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar,
>> > }
>> >
>> > dev = epc->dev.parent;
>> > - space = dma_alloc_coherent(dev, aligned_size, &phys_addr, GFP_KERNEL);
>> > +
>> > + space = dma_alloc_coherent(dev, aligned_mem_size,
>> > + &phys_addr, GFP_KERNEL);
>> > if (!space) {
>> > dev_err(dev, "failed to allocate mem space\n");
>> > return NULL;
>> > @@ -317,7 +338,7 @@ void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar,
>> > epf_bar[bar].phys_addr = phys_addr;
>> > epf_bar[bar].addr = space;
>> > epf_bar[bar].size = size;
>> > - epf_bar[bar].aligned_size = aligned_size;
>> > + epf_bar[bar].aligned_size = aligned_mem_size;
>>
>> I like that this local variable is now named aligned_mem_size
>> to more clearly highlight that it is the aligned _memory_ size.
>>
>> Perhaps you could also rename the struct pci_epf_bar struct member
>> 'aligned_size' to 'aligned_mem_size' or perhaps even better,
>> 'backing_mem_size' or 'mem_size' ?
>
>How about alloc_mem_size ? which actually used for dma_free() function.
I prefer mem_size, but I am not the maintainer.
Hopefully Mani has an option to avoid bike shedding :)
Have an awesome day!
/Niklas
Powered by blists - more mailing lists