mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: Frank Li <Frank.li@nxp.com>
Cc: "Manivannan Sadhasivam" <mani@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Jon Mason" <jdmason@kudzu.us>,
	"Dave Jiang" <dave.jiang@intel.com>,
	"Allen Hubbe" <allenbh@gmail.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	ntb@lists.linux.dev, imx@lists.linux.dev
Subject: Re: [PATCH v4 1/3] PCI: endpoint: Add helper function pci_epf_get_bar_required_size()
Date: Wed, 08 Oct 2025 01:45:48 +0200	[thread overview]
Message-ID: <247854C3-B81F-48E2-A68C-CCA5F4338600@kernel.org> (raw)
In-Reply-To: <aOVbOb5UyhM7c7p1@lizhi-Precision-Tower-5810>

On 7 October 2025 20:26:01 CEST, Frank Li <Frank.li@nxp.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


  reply	other threads:[~2025-10-07 23:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-30 20:39 [PATCH v4 0/3] pci: endpoint: vntb: add MSI doorbell support Frank Li
2025-09-30 20:39 ` [PATCH v4 1/3] PCI: endpoint: Add helper function pci_epf_get_bar_required_size() Frank Li
2025-10-06 10:43   ` Niklas Cassel
2025-10-07 18:26     ` Frank Li
2025-10-07 23:45       ` Niklas Cassel [this message]
2025-09-30 20:39 ` [PATCH v4 2/3] PCI: endpoint: Add API pci_epf_assign_bar_space() Frank Li
2025-10-06 18:55   ` [External] : " ALOK TIWARI
2025-10-07 15:11     ` Frank Li
2025-10-07 15:44       ` ALOK TIWARI
2025-09-30 20:39 ` [PATCH v4 3/3] PCI: endpoint: pci-epf-vntb: Add MSI doorbell support Frank Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=247854C3-B81F-48E2-A68C-CCA5F4338600@kernel.org \
    --to=cassel@kernel.org \
    --cc=Frank.li@nxp.com \
    --cc=allenbh@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=dave.jiang@intel.com \
    --cc=imx@lists.linux.dev \
    --cc=jdmason@kudzu.us \
    --cc=kishon@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=ntb@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®