From: Dave Jiang <dave.jiang@intel.com>
To: jdmason@kudzu.us
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/6] ntb: Add alignment check to meet hardware requirement
Date: Thu, 28 Aug 2014 13:53:02 -0700 [thread overview]
Message-ID: <20140828205302.165750.3398.stgit@djiang5-desk2.amr.corp.intel.com> (raw)
In-Reply-To: <20140828204947.165750.64364.stgit@djiang5-desk2.amr.corp.intel.com>
The NTB translate register must have the value to be BAR size aligned.
This alignment check make sure that the DMA memory allocated has the
proper alignment. Another requirement for NTB to function properly with
memory window BAR size greater or equal to 4M is to use the CMA feature
in 3.16 kernel with the appropriate CONFIG_CMA_ALIGNMENT and
CONFIG_CMA_SIZE_MBYTES set.
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
drivers/ntb/ntb_transport.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 611fef4..24f0ac1 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -576,6 +576,19 @@ static int ntb_set_mw(struct ntb_transport *nt, int num_mw, unsigned int size)
return -ENOMEM;
}
+ /*
+ * we must ensure that the memory address allocated is BAR size
+ * aligned in order for the XLAT register to take the value. This
+ * is a requirement of the hardware. It is recommended to setup CMA
+ * for BAR sizes equal or greater than 4MB.
+ */
+ if (!IS_ALIGNED(mw->dma_addr, mw->size)) {
+ dev_err(&pdev->dev, "DMA memory %#Lx not aligned to BAR size\n",
+ mw->dma_addr);
+ ntb_free_mw(nt, num_mw);
+ return -ENOMEM;
+ }
+
/* Notify HW the memory location of the receive buffer */
ntb_set_mw_addr(nt->ndev, num_mw, mw->dma_addr);
next prev parent reply other threads:[~2014-08-28 20:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-28 20:52 [PATCH 0/6] NTB bug fixes and hardware workarounds Dave Jiang
2014-08-28 20:53 ` Dave Jiang [this message]
2014-08-28 20:53 ` [PATCH 2/6] ntb: move platform detection to separate function Dave Jiang
2014-08-28 20:53 ` [PATCH 3/6] ntb: conslidate reading of PPD to move platform detection earlier Dave Jiang
2014-08-28 20:53 ` [PATCH 4/6] ntb: use errata flag set via DID to implement workaround Dave Jiang
2014-08-28 20:53 ` [PATCH 5/6] ntb: Adding split BAR support for Haswell platforms Dave Jiang
2014-08-28 20:53 ` [PATCH 6/6] ntb: workaround for high traffic hardware hang Dave Jiang
2014-09-08 3:19 ` Jon Mason
2014-09-08 2:54 ` [PATCH 0/6] NTB bug fixes and hardware workarounds Jon Mason
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=20140828205302.165750.3398.stgit@djiang5-desk2.amr.corp.intel.com \
--to=dave.jiang@intel.com \
--cc=jdmason@kudzu.us \
--cc=linux-kernel@vger.kernel.org \
/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®