Skip to content

Commit

Permalink
dmaengine: idxd: fix mapping of portal size
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
davejiang authored and vinodkoul committed Nov 16, 2020
1 parent 29a25b9 commit 8326be9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/dma/idxd/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ int idxd_wq_map_portal(struct idxd_wq *wq)
resource_size_t start;

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

wq->dportal = devm_ioremap(dev, start, IDXD_PORTAL_SIZE);
if (!wq->dportal)
Expand Down
2 changes: 1 addition & 1 deletion drivers/dma/idxd/registers.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#define IDXD_MMIO_BAR 0
#define IDXD_WQ_BAR 2
#define IDXD_PORTAL_SIZE 0x4000
#define IDXD_PORTAL_SIZE PAGE_SIZE

/* MMIO Device BAR0 Registers */
#define IDXD_VER_OFFSET 0x00
Expand Down
2 changes: 1 addition & 1 deletion drivers/dma/idxd/submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc)
if (idxd->state != IDXD_DEV_ENABLED)
return -EIO;

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

0 comments on commit 8326be9

Please sign in to comment.