From: Luis Chamberlain <mcgrof@kernel.org>
To: leon@kernel.org, hch@lst.de, kbusch@kernel.org, sagi@grimberg.me,
axboe@kernel.dk, joro@8bytes.org, brauner@kernel.org,
hare@suse.de, willy@infradead.org, david@fromorbit.com,
djwong@kernel.org
Cc: john.g.garry@oracle.com, ritesh.list@gmail.com,
linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org,
linux-mm@kvack.org, gost.dev@samsung.com, p.raghav@samsung.com,
da.gomez@samsung.com, kernel@pankajraghav.com, mcgrof@kernel.org
Subject: [RFC 4/4] nvme-pci: add quirk for qemu with bogus NOWS
Date: Thu, 20 Mar 2025 04:13:28 -0700 [thread overview]
Message-ID: <20250320111328.2841690-5-mcgrof@kernel.org> (raw)
In-Reply-To: <20250320111328.2841690-1-mcgrof@kernel.org>
The NOWS value for qemu is bogus but that means we need
to be mucking with userspace when testing large IO, so just
add a quirk to use sensible max limits, in this case just use
MDTS as these drives are virtualized.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
drivers/nvme/host/core.c | 2 ++
drivers/nvme/host/nvme.h | 5 +++++
drivers/nvme/host/pci.c | 3 ++-
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f028913e2e62..8f516de16281 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2070,6 +2070,8 @@ static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id,
/* NOWS = Namespace Optimal Write Size */
if (id->nows)
io_opt = bs * (1 + le16_to_cpu(id->nows));
+ else if (ns->ctrl->quirks & NVME_QUIRK_BOGUS_NOWS)
+ io_opt = lim->max_hw_sectors << SECTOR_SHIFT;
}
/*
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 7be92d07430e..c63a804db462 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -178,6 +178,11 @@ enum nvme_quirks {
* Align dma pool segment size to 512 bytes
*/
NVME_QUIRK_DMAPOOL_ALIGN_512 = (1 << 22),
+
+ /*
+ * Reports a NOWS of 0 which is 1 logical block size which is bogus
+ */
+ NVME_QUIRK_BOGUS_NOWS = (1 << 23),
};
/*
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 27b830072c14..577d8f909139 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3469,7 +3469,8 @@ static const struct pci_device_id nvme_id_table[] = {
NVME_QUIRK_DISABLE_WRITE_ZEROES |
NVME_QUIRK_BOGUS_NID, },
{ PCI_VDEVICE(REDHAT, 0x0010), /* Qemu emulated controller */
- .driver_data = NVME_QUIRK_BOGUS_NID, },
+ .driver_data = NVME_QUIRK_BOGUS_NID |
+ NVME_QUIRK_BOGUS_NOWS, },
{ PCI_DEVICE(0x1217, 0x8760), /* O2 Micro 64GB Steam Deck */
.driver_data = NVME_QUIRK_DMAPOOL_ALIGN_512, },
{ PCI_DEVICE(0x126f, 0x2262), /* Silicon Motion generic */
--
2.47.2
prev parent reply other threads:[~2025-03-20 12:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-20 11:13 [RFC 0/4] nvme-pci: breaking the 512 KiB max IO boundary Luis Chamberlain
2025-03-20 11:13 ` [RFC 1/4] iomap: use BLK_MAX_BLOCK_SIZE for the iomap zero page Luis Chamberlain
2025-03-20 11:13 ` [RFC 2/4] blkdev: lift BLK_MAX_BLOCK_SIZE to page cache limit Luis Chamberlain
2025-03-20 16:01 ` Bart Van Assche
2025-03-20 16:06 ` Matthew Wilcox
2025-03-20 16:15 ` Bart Van Assche
2025-03-20 16:27 ` Matthew Wilcox
2025-03-20 16:34 ` Bart Van Assche
2025-03-20 16:44 ` Christoph Hellwig
2025-03-24 10:58 ` Bart Van Assche
2025-03-24 15:02 ` Matthew Wilcox
2025-03-20 11:13 ` [RFC 3/4] nvme-pci: bump segments to what the device can use Luis Chamberlain
2025-03-20 11:13 ` Luis Chamberlain [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=20250320111328.2841690-5-mcgrof@kernel.org \
--to=mcgrof@kernel.org \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=da.gomez@samsung.com \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=gost.dev@samsung.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=john.g.garry@oracle.com \
--cc=joro@8bytes.org \
--cc=kbusch@kernel.org \
--cc=kernel@pankajraghav.com \
--cc=leon@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=p.raghav@samsung.com \
--cc=ritesh.list@gmail.com \
--cc=sagi@grimberg.me \
--cc=willy@infradead.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