Re: [PATCH] nvme: allow use of cmb on v1.4 controllers
From: Keith Busch <kbusch@kernel.org>
Date: 2021-01-14 18:15:41
On Thu, Jan 14, 2021 at 10:06:00AM -0800, Keith Busch wrote:
On Thu, Jan 14, 2021 at 02:24:41PM +0100, Klaus Jensen wrote:quoted
@@ -1795,6 +1796,15 @@ static void nvme_map_cmb(struct nvme_dev *dev) if (dev->cmb_size) return; + vs = readl(dev->bar + NVME_REG_VS); + + if (vs >= NVME_VS(1, 4, 0)) { + if (!NVME_CAP_CMBS(dev->ctrl.cap)) + return; + + writel(NVME_CMBMSC_CRE, dev->bar + NVME_REG_CMBMSC); + } + dev->cmbsz = readl(dev->bar + NVME_REG_CMBSZ); if (!dev->cmbsz) return;@@ -1805,6 +1815,19 @@ static void nvme_map_cmb(struct nvme_dev *dev) bar = NVME_CMB_BIR(dev->cmbloc); bar_size = pci_resource_len(pdev, bar); + if (vs >= NVME_VS(1, 4, 0)) { + cmbmsc = pci_resource_start(pdev, bar);Shouldn't this have a '+ offset' in case the CMB doesn't start at the beginning of the bar?
One other thing, I believe pci_bus_address() is required instead of pci_resource_start(). _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme