Skip to content

Commit 8326be9

Browse files
davejiangvinodkoul
authored andcommitted
dmaengine: idxd: fix mapping of portal size
Portal size is 4k. Current code is mapping all 4 portals in a single chunk. Restrict the mapped portal size to a single portal to ensure that submission only goes to the intended portal address. Fixes: c52ca47 ("dmaengine: idxd: add configuration component of driver") Signed-off-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/160513342642.510187.16450549281618747065.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 29a25b9 commit 8326be9

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/dma/idxd/device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ int idxd_wq_map_portal(struct idxd_wq *wq)
271271
resource_size_t start;
272272

273273
start = pci_resource_start(pdev, IDXD_WQ_BAR);
274-
start = start + wq->id * IDXD_PORTAL_SIZE;
274+
start += idxd_get_wq_portal_full_offset(wq->id, IDXD_PORTAL_LIMITED);
275275

276276
wq->dportal = devm_ioremap(dev, start, IDXD_PORTAL_SIZE);
277277
if (!wq->dportal)

drivers/dma/idxd/registers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#define IDXD_MMIO_BAR 0
1010
#define IDXD_WQ_BAR 2
11-
#define IDXD_PORTAL_SIZE 0x4000
11+
#define IDXD_PORTAL_SIZE PAGE_SIZE
1212

1313
/* MMIO Device BAR0 Registers */
1414
#define IDXD_VER_OFFSET 0x00

drivers/dma/idxd/submit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc)
7474
if (idxd->state != IDXD_DEV_ENABLED)
7575
return -EIO;
7676

77-
portal = wq->dportal + idxd_get_wq_portal_offset(IDXD_PORTAL_UNLIMITED);
77+
portal = wq->dportal;
7878
/*
7979
* The wmb() flushes writes to coherent DMA data before possibly
8080
* triggering a DMA read. The wmb() is necessary even on UP because

0 commit comments

Comments
 (0)