[PATCH] nvme-pci: 512 byte aligned dma pool segment quirk
Keith Busch
kbusch at kernel.org
Tue Nov 12 12:47:01 PST 2024
On Tue, Nov 12, 2024 at 07:50:00PM +0000, Bob Beckett wrote:
> @@ -2700,8 +2700,8 @@ static int nvme_setup_prp_pools(struct nvme_dev *dev)
> return -ENOMEM;
>
> /* Optimisation for I/Os between 4k and 128k */
> - dev->prp_small_pool = dma_pool_create("prp list 256", dev->dev,
> - 256, 256, 0);
> + dev->prp_small_pool = dma_pool_create("prp list 256", dev->dev,256,
> + dev->ctrl.quirks & NVME_QUIRK_DMAPOOL_ALIGN_512 ? 512 : 256, 0);
This line is overly long and a bit difficult to read that way. I changed
it to this:
---
@@ -2693,15 +2693,20 @@ static int nvme_disable_prepare_reset(struct nvme_dev *dev, bool shutdown)
static int nvme_setup_prp_pools(struct nvme_dev *dev)
{
+ size_t small_align = 256;
+
dev->prp_page_pool = dma_pool_create("prp list page", dev->dev,
NVME_CTRL_PAGE_SIZE,
NVME_CTRL_PAGE_SIZE, 0);
if (!dev->prp_page_pool)
return -ENOMEM;
+ if (dev->ctrl.quirks & NVME_QUIRK_DMAPOOL_ALIGN_512)
+ small_align = 512;
+
/* Optimisation for I/Os between 4k and 128k */
dev->prp_small_pool = dma_pool_create("prp list 256", dev->dev,
- 256, 256, 0);
+ 256, small_align, 0);
if (!dev->prp_small_pool) {
dma_pool_destroy(dev->prp_page_pool);
return -ENOMEM;
--
More information about the Linux-nvme
mailing list