Changing the memory window BAR mappings to write combining significantly
boosts the performance. We will also use memcpy that uses non-temporal
store, which showed performance improvement when doing non-cached
memcpys.
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/types.h>
+#include <linux/uaccess.h>
#include "linux/ntb.h"
#include "linux/ntb_transport.h"
#include "linux/ntb.h"
#include "linux/ntb_transport.h"
- mw->vbase = ioremap(mw->phys_addr, mw->phys_size);
+ mw->vbase = ioremap_wc(mw->phys_addr, mw->phys_size);
if (!mw->vbase) {
rc = -ENOMEM;
goto err1;
if (!mw->vbase) {
rc = -ENOMEM;
goto err1;
static void ntb_memcpy_tx(struct ntb_queue_entry *entry, void __iomem *offset)
{
static void ntb_memcpy_tx(struct ntb_queue_entry *entry, void __iomem *offset)
{
+#ifdef ARCH_HAS_NOCACHE_UACCESS
+ /*
+ * Using non-temporal mov to improve performance on non-cached
+ * writes, even though we aren't actually copying from user space.
+ */
+ __copy_from_user_inatomic_nocache(offset, entry->buf, entry->len);
+#else
memcpy_toio(offset, entry->buf, entry->len);
memcpy_toio(offset, entry->buf, entry->len);
/* Ensure that the data is fully copied out before setting the flags */
wmb();
/* Ensure that the data is fully copied out before setting the flags */
wmb();