From: Keith Busch <kbusch@kernel.org>
To: linux-nvme@lists.infradead.org, hch@lst.de, sagi@grimberg.me
Cc: John Levon <levon@movementarian.org>, Keith Busch <kbusch@kernel.org>
Subject: [PATCHv2 1/2] nvme-pci: clear shadow doorbell memory on resets
Date: Thu, 14 Oct 2021 09:45:42 -0700 [thread overview]
Message-ID: <20211014164543.1821327-2-kbusch@kernel.org> (raw)
In-Reply-To: <20211014164543.1821327-1-kbusch@kernel.org>
The host memory doorbell and event buffers need to be initialized on
each reset so the driver doesn't observe stale values from the previous
instantiation.
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
drivers/nvme/host/pci.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 0dd4b44b59cd..9dd173bfa57b 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -245,8 +245,15 @@ static int nvme_dbbuf_dma_alloc(struct nvme_dev *dev)
{
unsigned int mem_size = nvme_dbbuf_size(dev);
- if (dev->dbbuf_dbs)
+ if (dev->dbbuf_dbs) {
+ /*
+ * Clear the dbbuf memory so the driver doesn't observe stale
+ * values from the previous instantiation.
+ */
+ memset(dev->dbbuf_dbs, 0, mem_size);
+ memset(dev->dbbuf_eis, 0, mem_size);
return 0;
+ }
dev->dbbuf_dbs = dma_alloc_coherent(dev->dev, mem_size,
&dev->dbbuf_dbs_dma_addr,
--
2.25.4
next prev parent reply other threads:[~2021-10-14 16:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-14 16:45 [PATCHv2 0/2] nvme shadow doorbel buf fixes Keith Busch
2021-10-14 16:45 ` Keith Busch [this message]
2021-10-14 21:21 ` [PATCHv2 1/2] nvme-pci: clear shadow doorbell memory on resets John Levon
2021-10-20 17:23 ` Christoph Hellwig
2021-10-14 16:45 ` [PATCHv2 2/2] nvme-pci: remove cached shadow doorbell offsets Keith Busch
2021-10-14 16:53 ` Christoph Hellwig
2021-10-14 17:09 ` John Levon
2021-10-14 17:49 ` Keith Busch
2021-10-14 18:33 ` John Levon
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=20211014164543.1821327-2-kbusch@kernel.org \
--to=kbusch@kernel.org \
--cc=hch@lst.de \
--cc=levon@movementarian.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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.