[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231220142736.GE3544@thinkpad>
Date: Wed, 20 Dec 2023 19:57:36 +0530
From: Manivannan Sadhasivam <mani@...nel.org>
To: Frank Li <Frank.Li@....com>
Cc: allenbh@...il.com, bhelgaas@...gle.com, dave.jiang@...el.com,
imx@...ts.linux.dev, jdmason@...zu.us, kishon@...nel.org,
kw@...ux.com, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org, lpieralisi@...nel.org,
ntb@...ts.linux.dev
Subject: Re: [PATCH v2 1/1] PCI: endpoint: pci-epf-vntb: Fix transfer fail
when BAR1 is fixed size
On Tue, Dec 19, 2023 at 09:24:03AM -0500, Frank Li wrote:
> ntb_netdev transfer is failing when epc controller's BAR1 is fix size, such
> as 64K. Certain controller(like dwc) require memory address must be align
> with the fixed bar size.
>
> For example:
> If BAR1's fix size is 64K, and other size programmable BAR's
> alignment is 4K.
> vntb call pci_epf_alloc_space() get 4K aligned address, like
> 0x104E31000. But root complex actually write to address 0x104E30000 when
> write BAR1.
>
> Adds bar_fixed_size check and sets correct alignment for fixed-size BAR.
>
Change looks fine by me, but I have a hard time understanding this commit
message.
The change just checks the size of the doorbell BAR if a fixed size BAR is used
by the controller and uses the fixed size. In the commit message you are talking
about alignment and root complex writing to the BAR which are just confusing.
Please reword this commit message to make it understandable.
> Signed-off-by: Frank Li <Frank.Li@....com>
> ---
>
> Notes:
> Change from v1 to v2
> - Remove unnessary set align when fix_bar_size.
>
> drivers/pci/endpoint/functions/pci-epf-vntb.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> index 3f60128560ed0..ec3922f404efe 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> @@ -550,6 +550,14 @@ static int epf_ntb_db_bar_init(struct epf_ntb *ntb)
>
> barno = ntb->epf_ntb_bar[BAR_DB];
>
> + if (epc_features->bar_fixed_size[barno]) {
> + if (size > epc_features->bar_fixed_size[barno]) {
> + dev_err(dev, "Fixed BAR%d is too small for doorbell\n", barno);
> + return -EINVAL;
-ENOMEM?
- Mani
> + }
> + size = epc_features->bar_fixed_size[barno];
> + }
> +
> mw_addr = pci_epf_alloc_space(ntb->epf, size, barno, align, 0);
> if (!mw_addr) {
> dev_err(dev, "Failed to allocate OB address\n");
> --
> 2.34.1
>
--
மணிவண்ணன் சதாசிவம்
Powered by blists - more mailing lists