summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIcenowy Zheng <uwu@icenowy.me>2025-02-12 20:04:43 +0300
committerKeith Busch <kbusch@kernel.org>2025-02-25 03:21:24 +0300
commit6a3572e10f740acd48e2713ef37e92186a3ce5e8 (patch)
tree785154b870cf6d7e075caa48e8af255b02a0e806
parent8c1624b63a7d24142a2bbc3a5ee7e95f004ea36e (diff)
downloadlinux-6a3572e10f740acd48e2713ef37e92186a3ce5e8.tar.xz
nvme-pci: clean up CMBMSC when registering CMB fails
CMB decoding should get disabled when the CMB block isn't successfully registered to P2P DMA subsystem. Clean up the CMBMSC register in this error handling codepath to disable CMB decoding (and CMBLOC/CMBSZ registers). Signed-off-by: Icenowy Zheng <uwu@icenowy.me> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Keith Busch <kbusch@kernel.org>
-rw-r--r--drivers/nvme/host/pci.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 950289405ef2..218506e3dabe 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2003,6 +2003,7 @@ static void nvme_map_cmb(struct nvme_dev *dev)
if (pci_p2pdma_add_resource(pdev, bar, size, offset)) {
dev_warn(dev->ctrl.device,
"failed to register the CMB\n");
+ hi_lo_writeq(0, dev->bar + NVME_REG_CMBMSC);
return;
}