]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nvme-pci: clean up CMBMSC when registering CMB fails
authorIcenowy Zheng <uwu@icenowy.me>
Wed, 12 Feb 2025 17:04:43 +0000 (01:04 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:32:03 +0000 (14:32 +0200)
[ Upstream commit 6a3572e10f740acd48e2713ef37e92186a3ce5e8 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/pci.c

index 2eb692876f695974b9a504db4e3f4d6bf5b70597..39df3ac10a21ff30e3dc23a633fe2bf989439757 100644 (file)
@@ -1870,6 +1870,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;
        }