aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c25
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c5
-rw-r--r--drivers/gpu/drm/i915/intel_overlay.c5
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bios.c8
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_util.c8
5 files changed, 24 insertions, 27 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 90b1d6753b9d..eb6c473c6d1b 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -155,11 +155,11 @@ fast_shmem_read(struct page **pages,
155 char __iomem *vaddr; 155 char __iomem *vaddr;
156 int unwritten; 156 int unwritten;
157 157
158 vaddr = kmap_atomic(pages[page_base >> PAGE_SHIFT], KM_USER0); 158 vaddr = kmap_atomic(pages[page_base >> PAGE_SHIFT]);
159 if (vaddr == NULL) 159 if (vaddr == NULL)
160 return -ENOMEM; 160 return -ENOMEM;
161 unwritten = __copy_to_user_inatomic(data, vaddr + page_offset, length); 161 unwritten = __copy_to_user_inatomic(data, vaddr + page_offset, length);
162 kunmap_atomic(vaddr, KM_USER0); 162 kunmap_atomic(vaddr);
163 163
164 if (unwritten) 164 if (unwritten)
165 return -EFAULT; 165 return -EFAULT;
@@ -509,10 +509,10 @@ fast_user_write(struct io_mapping *mapping,
509 char *vaddr_atomic; 509 char *vaddr_atomic;
510 unsigned long unwritten; 510 unsigned long unwritten;
511 511
512 vaddr_atomic = io_mapping_map_atomic_wc(mapping, page_base, KM_USER0); 512 vaddr_atomic = io_mapping_map_atomic_wc(mapping, page_base);
513 unwritten = __copy_from_user_inatomic_nocache(vaddr_atomic + page_offset, 513 unwritten = __copy_from_user_inatomic_nocache(vaddr_atomic + page_offset,
514 user_data, length); 514 user_data, length);
515 io_mapping_unmap_atomic(vaddr_atomic, KM_USER0); 515 io_mapping_unmap_atomic(vaddr_atomic);
516 if (unwritten) 516 if (unwritten)
517 return -EFAULT; 517 return -EFAULT;
518 return 0; 518 return 0;
@@ -551,11 +551,11 @@ fast_shmem_write(struct page **pages,
551 char __iomem *vaddr; 551 char __iomem *vaddr;
552 unsigned long unwritten; 552 unsigned long unwritten;
553 553
554 vaddr = kmap_atomic(pages[page_base >> PAGE_SHIFT], KM_USER0); 554 vaddr = kmap_atomic(pages[page_base >> PAGE_SHIFT]);
555 if (vaddr == NULL) 555 if (vaddr == NULL)
556 return -ENOMEM; 556 return -ENOMEM;
557 unwritten = __copy_from_user_inatomic(vaddr + page_offset, data, length); 557 unwritten = __copy_from_user_inatomic(vaddr + page_offset, data, length);
558 kunmap_atomic(vaddr, KM_USER0); 558 kunmap_atomic(vaddr);
559 559
560 if (unwritten) 560 if (unwritten)
561 return -EFAULT; 561 return -EFAULT;
@@ -3346,8 +3346,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
3346 reloc_offset = obj_priv->gtt_offset + reloc->offset; 3346 reloc_offset = obj_priv->gtt_offset + reloc->offset;
3347 reloc_page = io_mapping_map_atomic_wc(dev_priv->mm.gtt_mapping, 3347 reloc_page = io_mapping_map_atomic_wc(dev_priv->mm.gtt_mapping,
3348 (reloc_offset & 3348 (reloc_offset &
3349 ~(PAGE_SIZE - 1)), 3349 ~(PAGE_SIZE - 1)));
3350 KM_USER0);
3351 reloc_entry = (uint32_t __iomem *)(reloc_page + 3350 reloc_entry = (uint32_t __iomem *)(reloc_page +
3352 (reloc_offset & (PAGE_SIZE - 1))); 3351 (reloc_offset & (PAGE_SIZE - 1)));
3353 reloc_val = target_obj_priv->gtt_offset + reloc->delta; 3352 reloc_val = target_obj_priv->gtt_offset + reloc->delta;
@@ -3358,7 +3357,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
3358 readl(reloc_entry), reloc_val); 3357 readl(reloc_entry), reloc_val);
3359#endif 3358#endif
3360 writel(reloc_val, reloc_entry); 3359 writel(reloc_val, reloc_entry);
3361 io_mapping_unmap_atomic(reloc_page, KM_USER0); 3360 io_mapping_unmap_atomic(reloc_page);
3362 3361
3363 /* The updated presumed offset for this entry will be 3362 /* The updated presumed offset for this entry will be
3364 * copied back out to the user. 3363 * copied back out to the user.
@@ -4772,11 +4771,11 @@ void i915_gem_detach_phys_object(struct drm_device *dev,
4772 page_count = obj->size / PAGE_SIZE; 4771 page_count = obj->size / PAGE_SIZE;
4773 4772
4774 for (i = 0; i < page_count; i++) { 4773 for (i = 0; i < page_count; i++) {
4775 char *dst = kmap_atomic(obj_priv->pages[i], KM_USER0); 4774 char *dst = kmap_atomic(obj_priv->pages[i]);
4776 char *src = obj_priv->phys_obj->handle->vaddr + (i * PAGE_SIZE); 4775 char *src = obj_priv->phys_obj->handle->vaddr + (i * PAGE_SIZE);
4777 4776
4778 memcpy(dst, src, PAGE_SIZE); 4777 memcpy(dst, src, PAGE_SIZE);
4779 kunmap_atomic(dst, KM_USER0); 4778 kunmap_atomic(dst);
4780 } 4779 }
4781 drm_clflush_pages(obj_priv->pages, page_count); 4780 drm_clflush_pages(obj_priv->pages, page_count);
4782 drm_agp_chipset_flush(dev); 4781 drm_agp_chipset_flush(dev);
@@ -4833,11 +4832,11 @@ i915_gem_attach_phys_object(struct drm_device *dev,
4833 page_count = obj->size / PAGE_SIZE; 4832 page_count = obj->size / PAGE_SIZE;
4834 4833
4835 for (i = 0; i < page_count; i++) { 4834 for (i = 0; i < page_count; i++) {
4836 char *src = kmap_atomic(obj_priv->pages[i], KM_USER0); 4835 char *src = kmap_atomic(obj_priv->pages[i]);
4837 char *dst = obj_priv->phys_obj->handle->vaddr + (i * PAGE_SIZE); 4836 char *dst = obj_priv->phys_obj->handle->vaddr + (i * PAGE_SIZE);
4838 4837
4839 memcpy(dst, src, PAGE_SIZE); 4838 memcpy(dst, src, PAGE_SIZE);
4840 kunmap_atomic(src, KM_USER0); 4839 kunmap_atomic(src);
4841 } 4840 }
4842 4841
4843 i915_gem_object_put_pages(obj); 4842 i915_gem_object_put_pages(obj);
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 744225ebb4b2..b80010f0c4c9 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -456,10 +456,9 @@ i915_error_object_create(struct drm_device *dev,
456 456
457 local_irq_save(flags); 457 local_irq_save(flags);
458 s = io_mapping_map_atomic_wc(dev_priv->mm.gtt_mapping, 458 s = io_mapping_map_atomic_wc(dev_priv->mm.gtt_mapping,
459 reloc_offset, 459 reloc_offset);
460 KM_IRQ0);
461 memcpy_fromio(d, s, PAGE_SIZE); 460 memcpy_fromio(d, s, PAGE_SIZE);
462 io_mapping_unmap_atomic(s, KM_IRQ0); 461 io_mapping_unmap_atomic(s);
463 local_irq_restore(flags); 462 local_irq_restore(flags);
464 463
465 dst->pages[page] = d; 464 dst->pages[page] = d;
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index 1d306a458be6..3264bbd47e65 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -187,8 +187,7 @@ static struct overlay_registers *intel_overlay_map_regs_atomic(struct intel_over
187 187
188 if (OVERLAY_NONPHYSICAL(overlay->dev)) { 188 if (OVERLAY_NONPHYSICAL(overlay->dev)) {
189 regs = io_mapping_map_atomic_wc(dev_priv->mm.gtt_mapping, 189 regs = io_mapping_map_atomic_wc(dev_priv->mm.gtt_mapping,
190 overlay->reg_bo->gtt_offset, 190 overlay->reg_bo->gtt_offset);
191 KM_USER0);
192 191
193 if (!regs) { 192 if (!regs) {
194 DRM_ERROR("failed to map overlay regs in GTT\n"); 193 DRM_ERROR("failed to map overlay regs in GTT\n");
@@ -203,7 +202,7 @@ static struct overlay_registers *intel_overlay_map_regs_atomic(struct intel_over
203static void intel_overlay_unmap_regs_atomic(struct intel_overlay *overlay) 202static void intel_overlay_unmap_regs_atomic(struct intel_overlay *overlay)
204{ 203{
205 if (OVERLAY_NONPHYSICAL(overlay->dev)) 204 if (OVERLAY_NONPHYSICAL(overlay->dev))
206 io_mapping_unmap_atomic(overlay->virt_addr, KM_USER0); 205 io_mapping_unmap_atomic(overlay->virt_addr);
207 206
208 overlay->virt_addr = NULL; 207 overlay->virt_addr = NULL;
209 208
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c
index 974b0f8ae048..8fa339600fe3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bios.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
@@ -2167,11 +2167,11 @@ peek_fb(struct drm_device *dev, struct io_mapping *fb,
2167 2167
2168 if (off < pci_resource_len(dev->pdev, 1)) { 2168 if (off < pci_resource_len(dev->pdev, 1)) {
2169 uint8_t __iomem *p = 2169 uint8_t __iomem *p =
2170 io_mapping_map_atomic_wc(fb, off & PAGE_MASK, KM_USER0); 2170 io_mapping_map_atomic_wc(fb, off & PAGE_MASK);
2171 2171
2172 val = ioread32(p + (off & ~PAGE_MASK)); 2172 val = ioread32(p + (off & ~PAGE_MASK));
2173 2173
2174 io_mapping_unmap_atomic(p, KM_USER0); 2174 io_mapping_unmap_atomic(p);
2175 } 2175 }
2176 2176
2177 return val; 2177 return val;
@@ -2183,12 +2183,12 @@ poke_fb(struct drm_device *dev, struct io_mapping *fb,
2183{ 2183{
2184 if (off < pci_resource_len(dev->pdev, 1)) { 2184 if (off < pci_resource_len(dev->pdev, 1)) {
2185 uint8_t __iomem *p = 2185 uint8_t __iomem *p =
2186 io_mapping_map_atomic_wc(fb, off & PAGE_MASK, KM_USER0); 2186 io_mapping_map_atomic_wc(fb, off & PAGE_MASK);
2187 2187
2188 iowrite32(val, p + (off & ~PAGE_MASK)); 2188 iowrite32(val, p + (off & ~PAGE_MASK));
2189 wmb(); 2189 wmb();
2190 2190
2191 io_mapping_unmap_atomic(p, KM_USER0); 2191 io_mapping_unmap_atomic(p);
2192 } 2192 }
2193} 2193}
2194 2194
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 3451a82adba7..e8a73e65da69 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -170,7 +170,7 @@ static int ttm_copy_io_ttm_page(struct ttm_tt *ttm, void *src,
170 src = (void *)((unsigned long)src + (page << PAGE_SHIFT)); 170 src = (void *)((unsigned long)src + (page << PAGE_SHIFT));
171 171
172#ifdef CONFIG_X86 172#ifdef CONFIG_X86
173 dst = kmap_atomic_prot(d, KM_USER0, prot); 173 dst = kmap_atomic_prot(d, prot);
174#else 174#else
175 if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) 175 if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL))
176 dst = vmap(&d, 1, 0, prot); 176 dst = vmap(&d, 1, 0, prot);
@@ -183,7 +183,7 @@ static int ttm_copy_io_ttm_page(struct ttm_tt *ttm, void *src,
183 memcpy_fromio(dst, src, PAGE_SIZE); 183 memcpy_fromio(dst, src, PAGE_SIZE);
184 184
185#ifdef CONFIG_X86 185#ifdef CONFIG_X86
186 kunmap_atomic(dst, KM_USER0); 186 kunmap_atomic(dst);
187#else 187#else
188 if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) 188 if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL))
189 vunmap(dst); 189 vunmap(dst);
@@ -206,7 +206,7 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst,
206 206
207 dst = (void *)((unsigned long)dst + (page << PAGE_SHIFT)); 207 dst = (void *)((unsigned long)dst + (page << PAGE_SHIFT));
208#ifdef CONFIG_X86 208#ifdef CONFIG_X86
209 src = kmap_atomic_prot(s, KM_USER0, prot); 209 src = kmap_atomic_prot(s, prot);
210#else 210#else
211 if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) 211 if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL))
212 src = vmap(&s, 1, 0, prot); 212 src = vmap(&s, 1, 0, prot);
@@ -219,7 +219,7 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst,
219 memcpy_toio(dst, src, PAGE_SIZE); 219 memcpy_toio(dst, src, PAGE_SIZE);
220 220
221#ifdef CONFIG_X86 221#ifdef CONFIG_X86
222 kunmap_atomic(src, KM_USER0); 222 kunmap_atomic(src);
223#else 223#else
224 if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) 224 if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL))
225 vunmap(src); 225 vunmap(src);