Commit d8dab00d authored by Chris Wilson's avatar Chris Wilson

io-mapping: Specify mapping size for io_mapping_map_wc()

The ioremap() hidden behind the io_mapping_map_wc() convenience helper
can be used for remapping multiple pages. Extend the helper so that
future callers can use it for larger ranges.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Yishai Hadas <yishaih@mellanox.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
Cc: Luis R. Rodriguez <mcgrof@kernel.org>
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: netdev@vger.kernel.org
Cc: linux-rdma@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1461833819-3991-3-git-send-email-chris@chris-wilson.co.uk
parent da6ca034
...@@ -198,7 +198,8 @@ intel_overlay_map_regs(struct intel_overlay *overlay) ...@@ -198,7 +198,8 @@ intel_overlay_map_regs(struct intel_overlay *overlay)
regs = (struct overlay_registers __iomem *)overlay->reg_bo->phys_handle->vaddr; regs = (struct overlay_registers __iomem *)overlay->reg_bo->phys_handle->vaddr;
else else
regs = io_mapping_map_wc(ggtt->mappable, regs = io_mapping_map_wc(ggtt->mappable,
overlay->flip_addr); overlay->flip_addr,
PAGE_SIZE);
return regs; return regs;
} }
......
...@@ -205,7 +205,9 @@ int mlx4_bf_alloc(struct mlx4_dev *dev, struct mlx4_bf *bf, int node) ...@@ -205,7 +205,9 @@ int mlx4_bf_alloc(struct mlx4_dev *dev, struct mlx4_bf *bf, int node)
goto free_uar; goto free_uar;
} }
uar->bf_map = io_mapping_map_wc(priv->bf_mapping, uar->index << PAGE_SHIFT); uar->bf_map = io_mapping_map_wc(priv->bf_mapping,
uar->index << PAGE_SHIFT,
PAGE_SIZE);
if (!uar->bf_map) { if (!uar->bf_map) {
err = -ENOMEM; err = -ENOMEM;
goto unamp_uar; goto unamp_uar;
......
...@@ -100,14 +100,16 @@ io_mapping_unmap_atomic(void __iomem *vaddr) ...@@ -100,14 +100,16 @@ io_mapping_unmap_atomic(void __iomem *vaddr)
} }
static inline void __iomem * static inline void __iomem *
io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) io_mapping_map_wc(struct io_mapping *mapping,
unsigned long offset,
unsigned long size)
{ {
resource_size_t phys_addr; resource_size_t phys_addr;
BUG_ON(offset >= mapping->size); BUG_ON(offset >= mapping->size);
phys_addr = mapping->base + offset; phys_addr = mapping->base + offset;
return ioremap_wc(phys_addr, PAGE_SIZE); return ioremap_wc(phys_addr, size);
} }
static inline void static inline void
...@@ -155,7 +157,9 @@ io_mapping_unmap_atomic(void __iomem *vaddr) ...@@ -155,7 +157,9 @@ io_mapping_unmap_atomic(void __iomem *vaddr)
/* Non-atomic map/unmap */ /* Non-atomic map/unmap */
static inline void __iomem * static inline void __iomem *
io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) io_mapping_map_wc(struct io_mapping *mapping,
unsigned long offset,
unsigned long size)
{ {
return ((char __force __iomem *) mapping) + offset; return ((char __force __iomem *) mapping) + offset;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment