[PATCH 1/3] nvme-pci: clear shadow doorbell memory on resets
John Levon
levon at movementarian.org
Mon Oct 4 02:35:04 PDT 2021
On Mon, Apr 27, 2020 at 04:52:41PM -0700, Keith Busch wrote:
> 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 at kernel.org>
> ---
> drivers/nvme/host/pci.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index cf386c84588b..d388fff9c358 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -228,8 +228,11 @@ static int nvme_dbbuf_dma_alloc(struct nvme_dev *dev)
> {
> unsigned int mem_size = nvme_dbbuf_size(dev->db_stride);
>
> - if (dev->dbbuf_dbs)
> + if (dev->dbbuf_dbs) {
> + 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,
Hi Keith, we came across this issue recently, and we just found this above
patch. Was there any specific reason it was never merged?
thanks
john
More information about the Linux-nvme
mailing list