forked from Minki/linux
drm,io-mapping: Specify slot to use for atomic mappings
This is required should we ever attempt to use an io-mapping where KM_USER0 is verboten, such as inside an IRQ context. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Eric Anholt <eric@anholt.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
430f70d59d
commit
fca3ec01e0
@ -496,10 +496,10 @@ fast_user_write(struct io_mapping *mapping,
|
||||
char *vaddr_atomic;
|
||||
unsigned long unwritten;
|
||||
|
||||
vaddr_atomic = io_mapping_map_atomic_wc(mapping, page_base);
|
||||
vaddr_atomic = io_mapping_map_atomic_wc(mapping, page_base, KM_USER0);
|
||||
unwritten = __copy_from_user_inatomic_nocache(vaddr_atomic + page_offset,
|
||||
user_data, length);
|
||||
io_mapping_unmap_atomic(vaddr_atomic);
|
||||
io_mapping_unmap_atomic(vaddr_atomic, KM_USER0);
|
||||
if (unwritten)
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
@ -3487,7 +3487,8 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
|
||||
reloc_offset = obj_priv->gtt_offset + reloc->offset;
|
||||
reloc_page = io_mapping_map_atomic_wc(dev_priv->mm.gtt_mapping,
|
||||
(reloc_offset &
|
||||
~(PAGE_SIZE - 1)));
|
||||
~(PAGE_SIZE - 1)),
|
||||
KM_USER0);
|
||||
reloc_entry = (uint32_t __iomem *)(reloc_page +
|
||||
(reloc_offset & (PAGE_SIZE - 1)));
|
||||
reloc_val = target_obj_priv->gtt_offset + reloc->delta;
|
||||
@ -3498,7 +3499,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
|
||||
readl(reloc_entry), reloc_val);
|
||||
#endif
|
||||
writel(reloc_val, reloc_entry);
|
||||
io_mapping_unmap_atomic(reloc_page);
|
||||
io_mapping_unmap_atomic(reloc_page, KM_USER0);
|
||||
|
||||
/* The updated presumed offset for this entry will be
|
||||
* copied back out to the user.
|
||||
|
@ -185,7 +185,8 @@ static struct overlay_registers *intel_overlay_map_regs_atomic(struct intel_over
|
||||
|
||||
if (OVERLAY_NONPHYSICAL(overlay->dev)) {
|
||||
regs = io_mapping_map_atomic_wc(dev_priv->mm.gtt_mapping,
|
||||
overlay->reg_bo->gtt_offset);
|
||||
overlay->reg_bo->gtt_offset,
|
||||
KM_USER0);
|
||||
|
||||
if (!regs) {
|
||||
DRM_ERROR("failed to map overlay regs in GTT\n");
|
||||
@ -200,7 +201,7 @@ static struct overlay_registers *intel_overlay_map_regs_atomic(struct intel_over
|
||||
static void intel_overlay_unmap_regs_atomic(struct intel_overlay *overlay)
|
||||
{
|
||||
if (OVERLAY_NONPHYSICAL(overlay->dev))
|
||||
io_mapping_unmap_atomic(overlay->virt_addr);
|
||||
io_mapping_unmap_atomic(overlay->virt_addr, KM_USER0);
|
||||
|
||||
overlay->virt_addr = NULL;
|
||||
|
||||
|
@ -2083,11 +2083,11 @@ peek_fb(struct drm_device *dev, struct io_mapping *fb,
|
||||
uint32_t val = 0;
|
||||
|
||||
if (off < pci_resource_len(dev->pdev, 1)) {
|
||||
uint32_t __iomem *p = io_mapping_map_atomic_wc(fb, off);
|
||||
uint32_t __iomem *p = io_mapping_map_atomic_wc(fb, off, KM_USER0);
|
||||
|
||||
val = ioread32(p);
|
||||
|
||||
io_mapping_unmap_atomic(p);
|
||||
io_mapping_unmap_atomic(p, KM_USER0);
|
||||
}
|
||||
|
||||
return val;
|
||||
@ -2098,12 +2098,12 @@ poke_fb(struct drm_device *dev, struct io_mapping *fb,
|
||||
uint32_t off, uint32_t val)
|
||||
{
|
||||
if (off < pci_resource_len(dev->pdev, 1)) {
|
||||
uint32_t __iomem *p = io_mapping_map_atomic_wc(fb, off);
|
||||
uint32_t __iomem *p = io_mapping_map_atomic_wc(fb, off, KM_USER0);
|
||||
|
||||
iowrite32(val, p);
|
||||
wmb();
|
||||
|
||||
io_mapping_unmap_atomic(p);
|
||||
io_mapping_unmap_atomic(p, KM_USER0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,9 @@ io_mapping_free(struct io_mapping *mapping)
|
||||
|
||||
/* Atomic map/unmap */
|
||||
static inline void *
|
||||
io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset)
|
||||
io_mapping_map_atomic_wc(struct io_mapping *mapping,
|
||||
unsigned long offset,
|
||||
int slot)
|
||||
{
|
||||
resource_size_t phys_addr;
|
||||
unsigned long pfn;
|
||||
@ -87,13 +89,13 @@ io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset)
|
||||
BUG_ON(offset >= mapping->size);
|
||||
phys_addr = mapping->base + offset;
|
||||
pfn = (unsigned long) (phys_addr >> PAGE_SHIFT);
|
||||
return iomap_atomic_prot_pfn(pfn, KM_USER0, mapping->prot);
|
||||
return iomap_atomic_prot_pfn(pfn, slot, mapping->prot);
|
||||
}
|
||||
|
||||
static inline void
|
||||
io_mapping_unmap_atomic(void *vaddr)
|
||||
io_mapping_unmap_atomic(void *vaddr, int slot)
|
||||
{
|
||||
iounmap_atomic(vaddr, KM_USER0);
|
||||
iounmap_atomic(vaddr, slot);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
@ -133,13 +135,15 @@ io_mapping_free(struct io_mapping *mapping)
|
||||
|
||||
/* Atomic map/unmap */
|
||||
static inline void *
|
||||
io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset)
|
||||
io_mapping_map_atomic_wc(struct io_mapping *mapping,
|
||||
unsigned long offset,
|
||||
int slot)
|
||||
{
|
||||
return ((char *) mapping) + offset;
|
||||
}
|
||||
|
||||
static inline void
|
||||
io_mapping_unmap_atomic(void *vaddr)
|
||||
io_mapping_unmap_atomic(void *vaddr, int slot)
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user