ntb.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <mani@kernel.org>
To: Frank Li <Frank.Li@nxp.com>
Cc: mani@kernel.org, allenbh@gmail.com, bhelgaas@google.com,
	dave.jiang@intel.com, imx@lists.linux.dev, jdmason@kudzu.us,
	kishon@kernel.org, kw@linux.com, linux-kernel@vger.kernel.org,
	linux-pci@vger.kernel.org, lpieralisi@kernel.org,
	ntb@lists.linux.dev
Subject: Re: [PATCH v3 1/1] PCI: endpoint: pci-epf-vntb: Fix transfer failure for fixed size BARs
Date: Mon, 8 Jan 2024 13:53:03 +0530	[thread overview]
Message-ID: <20240108082303.GA12822@thinkpad> (raw)
In-Reply-To: <20231220192427.1530460-1-Frank.Li@nxp.com>

On Wed, Dec 20, 2023 at 02:24:27PM -0500, Frank Li wrote:
> For the inbound MEM/IO TLPs, iATU on the endpoint expects the target
> address to be aligned to the size of the BAR. For configurable BARs, there
> is no issue because both host and endpoint will know the exact size of the
> BAR region. But for fixed size BARs available in some controllers, if the
> BAR size advertised by the endpoint is not same as of the actual BAR size
> used in the controller, then the MEM/IO TLPs generated by the host will not
> be translated properly by the endpoint iATU.
> 
> So if the fixed size BARs are available in endpoint controllers, always use
> the actual BAR size.
> 

You should add a note saying that you are fixing the issue only for DB BAR and a
similar fix is needed for other MW BARs.

> Fixes: e35f56bb0330 ("PCI: endpoint: Support NTB transfer between RC and EP")
> Cc: stable@vger.kernel.org
> Signed-off-by: Frank Li <Frank.Li@nxp.com>

With that,

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

- Mani

> ---
> 
> Notes:
>     Change from v2 to v3
>     - rework commti message
>     - add fixes and cc stable
>     - return -ENOMEN when request size > fix bar size
>     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..85120978fb8c9 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 -ENOMEM;
> +		}
> +		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
> 
> 

-- 
மணிவண்ணன் சதாசிவம்

      reply	other threads:[~2024-01-08  8:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20 19:24 [PATCH v3 1/1] PCI: endpoint: pci-epf-vntb: Fix transfer failure for fixed size BARs Frank Li
2024-01-08  8:23 ` Manivannan Sadhasivam [this message]

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=20240108082303.GA12822@thinkpad \
    --to=mani@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=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).