diff options
author | Keith Busch <[email protected]> | 2021-10-14 09:45:42 -0700 |
---|---|---|
committer | Christoph Hellwig <[email protected]> | 2021-10-20 19:23:29 +0200 |
commit | 58847f12fe7823c56f844218abcca6920901097d (patch) | |
tree | 99d693288812f084c2cd71ff1226b873962b800d | |
parent | 09748122009aed7bfaa7acc33c10c083a4758322 (diff) |
nvme-pci: clear shadow doorbell memory on resets
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 <[email protected]>
Tested-by: John Levon <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
-rw-r--r-- | drivers/nvme/host/pci.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index ed684874842f..6e05cfb4879f 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, |