stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jianxiong Gao <jxgao@google.com>
To: stable@vger.kernel.org, hch@lst.de, marcorr@google.com,
	sashal@kernel.org
Cc: Jianxiong Gao <jxgao@google.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH v2 5.10 9/9] nvme-pci: set min_align_mask
Date: Thu, 29 Apr 2021 17:33:15 +0000	[thread overview]
Message-ID: <20210429173315.1252465-10-jxgao@google.com> (raw)
In-Reply-To: <20210429173315.1252465-1-jxgao@google.com>

commit: 3d2d861eb03e8ee96dc430a54361c900cbe28afd

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>
Tested-by: Jianxiong Gao <jxgao@google.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 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 4dca58f4afdf..716039ea4450 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2634,6 +2634,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.31.1.498.g6c1eba8ee3d-goog


  parent reply	other threads:[~2021-04-29 17:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 17:33 [PATCH v2 5.10 0/9] preserve DMA offsets when using swiotlb Jianxiong Gao
2021-04-29 17:33 ` [PATCH v2 5.10 1/9] driver core: add a min_align_mask field to struct device_dma_parameters Jianxiong Gao
2021-04-29 17:33 ` [PATCH v2 5.10 2/9] swiotlb: add a IO_TLB_SIZE define Jianxiong Gao
2021-04-29 17:33 ` [PATCH v2 5.10 3/9] swiotlb: factor out an io_tlb_offset helper Jianxiong Gao
2021-04-29 17:33 ` [PATCH v2 5.10 4/9] swiotlb: factor out a nr_slots helper Jianxiong Gao
2021-04-29 17:33 ` [PATCH v2 5.10 5/9] swiotlb: clean up swiotlb_tbl_unmap_single Jianxiong Gao
2021-04-29 17:33 ` [PATCH v2 5.10 6/9] swiotlb: refactor swiotlb_tbl_map_single Jianxiong Gao
2021-04-29 17:33 ` [PATCH v2 5.10 7/9] swiotlb: don't modify orig_addr in swiotlb_tbl_sync_single Jianxiong Gao
2021-04-29 17:33 ` [PATCH v2 5.10 8/9] swiotlb: respect min_align_mask Jianxiong Gao
2021-04-29 17:33 ` Jianxiong Gao [this message]
2021-05-04 20:22 ` [PATCH v2 5.10 0/9] preserve DMA offsets when using swiotlb Marc Orr
2021-05-05  5:08   ` Christoph Hellwig
2021-05-05  7:23 ` Greg KH
2021-05-05  7:44   ` Greg KH

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=20210429173315.1252465-10-jxgao@google.com \
    --to=jxgao@google.com \
    --cc=hch@lst.de \
    --cc=konrad.wilk@oracle.com \
    --cc=marcorr@google.com \
    --cc=sashal@kernel.org \
    --cc=stable@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;
as well as URLs for NNTP newsgroup(s).