All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: jxgao@google.com, gregkh@linuxfoundation.org
Cc: saravanak@google.com, konrad.wilk@oracle.com, marcorr@google.com,
	linux-nvme@lists.infradead.org, kbusch@kernel.org,
	iommu@lists.linux-foundation.org, erdemaktas@google.com,
	robin.murphy@arm.com, m.szyprowski@samsung.com
Subject: [PATCH 9/9] nvme-pci: set min_align_mask
Date: Sun,  7 Feb 2021 17:03:27 +0100	[thread overview]
Message-ID: <20210207160327.2955490-10-hch@lst.de> (raw)
In-Reply-To: <20210207160327.2955490-1-hch@lst.de>

From: Jianxiong Gao <jxgao@google.com>

The PRP addressing scheme requires all PRP entries except for the
first one to have a zero offset into the NVMe controller pages (which
can be different from the Linux PAGE_SIZE).  Use the min_align_mask
device parameter to ensure that swiotlb does not change the address
of the buffer modulo the device page size to ensure that the PRPs
won't be malformed.

Signed-off-by: Jianxiong Gao <jxgao@google.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 81e6389b204205..83303e4e301924 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2629,6 +2629,7 @@ static void nvme_reset_work(struct work_struct *work)
 	 * Don't limit the IOMMU merged segment size.
 	 */
 	dma_set_max_seg_size(dev->dev, 0xffffffff);
+	dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1);
 
 	mutex_unlock(&dev->shutdown_lock);
 
-- 
2.29.2


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: jxgao@google.com, gregkh@linuxfoundation.org
Cc: saravanak@google.com, konrad.wilk@oracle.com, marcorr@google.com,
	linux-nvme@lists.infradead.org, kbusch@kernel.org,
	iommu@lists.linux-foundation.org, robin.murphy@arm.com
Subject: [PATCH 9/9] nvme-pci: set min_align_mask
Date: Sun,  7 Feb 2021 17:03:27 +0100	[thread overview]
Message-ID: <20210207160327.2955490-10-hch@lst.de> (raw)
In-Reply-To: <20210207160327.2955490-1-hch@lst.de>

From: Jianxiong Gao <jxgao@google.com>

The PRP addressing scheme requires all PRP entries except for the
first one to have a zero offset into the NVMe controller pages (which
can be different from the Linux PAGE_SIZE).  Use the min_align_mask
device parameter to ensure that swiotlb does not change the address
of the buffer modulo the device page size to ensure that the PRPs
won't be malformed.

Signed-off-by: Jianxiong Gao <jxgao@google.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 81e6389b204205..83303e4e301924 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2629,6 +2629,7 @@ static void nvme_reset_work(struct work_struct *work)
 	 * Don't limit the IOMMU merged segment size.
 	 */
 	dma_set_max_seg_size(dev->dev, 0xffffffff);
+	dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1);
 
 	mutex_unlock(&dev->shutdown_lock);
 
-- 
2.29.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  parent reply	other threads:[~2021-02-07 16:04 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-07 16:03 preserve DMA offsets when using swiotlb v2 Christoph Hellwig
2021-02-07 16:03 ` Christoph Hellwig
2021-02-07 16:03 ` [PATCH 1/9] driver core: add a min_align_mask field to struct device_dma_parameters Christoph Hellwig
2021-02-07 16:03   ` Christoph Hellwig
2021-02-07 16:03 ` [PATCH 2/9] swiotlb: add a IO_TLB_SIZE define Christoph Hellwig
2021-02-07 16:03   ` Christoph Hellwig
2021-02-07 16:03 ` [PATCH 3/9] swiotlb: factor out an io_tlb_offset helper Christoph Hellwig
2021-02-07 16:03   ` Christoph Hellwig
2021-02-07 16:03 ` [PATCH 4/9] swiotlb: factor out a nr_slots helper Christoph Hellwig
2021-02-07 16:03   ` Christoph Hellwig
2021-02-07 16:03 ` [PATCH 5/9] swiotlb: clean up swiotlb_tbl_unmap_single Christoph Hellwig
2021-02-07 16:03   ` Christoph Hellwig
2021-02-07 16:03 ` [PATCH 6/9] swiotlb: refactor swiotlb_tbl_map_single Christoph Hellwig
2021-02-07 16:03   ` Christoph Hellwig
2021-02-22 19:05   ` Nicolas Saenz Julienne
2021-02-22 19:05     ` Nicolas Saenz Julienne
2021-02-22 19:29     ` Konrad Rzeszutek Wilk
2021-02-22 19:29       ` Konrad Rzeszutek Wilk
2021-02-23  7:25       ` Christoph Hellwig
2021-02-23  7:25         ` Christoph Hellwig
2021-02-07 16:03 ` [PATCH 7/9] swiotlb: don't modify orig_addr in swiotlb_tbl_sync_single Christoph Hellwig
2021-02-07 16:03   ` Christoph Hellwig
2021-02-07 16:03 ` [PATCH 8/9] swiotlb: respect min_align_mask Christoph Hellwig
2021-02-07 16:03   ` Christoph Hellwig
2021-02-07 16:03 ` Christoph Hellwig [this message]
2021-02-07 16:03   ` [PATCH 9/9] nvme-pci: set min_align_mask Christoph Hellwig
2021-02-09  8:41 ` preserve DMA offsets when using swiotlb v2 Christoph Hellwig
2021-02-09  8:46   ` Greg KH
2021-02-09  8:46     ` Greg KH
2021-02-09 19:49   ` Jianxiong Gao
2021-02-09 19:49     ` Jianxiong Gao via iommu
2021-02-19 18:13     ` Konrad Rzeszutek Wilk
2021-02-19 18:13       ` Konrad Rzeszutek Wilk

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=20210207160327.2955490-10-hch@lst.de \
    --to=hch@lst.de \
    --cc=erdemaktas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jxgao@google.com \
    --cc=kbusch@kernel.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=m.szyprowski@samsung.com \
    --cc=marcorr@google.com \
    --cc=robin.murphy@arm.com \
    --cc=saravanak@google.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.