]> Pileus Git - ~andy/linux/blobdiff - drivers/gpu/drm/drm_bufs.c
Merge tag 'asoc-v3.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
[~andy/linux] / drivers / gpu / drm / drm_bufs.c
index 0128147265f3620204495e5853c78d4e2d9e4c4a..5a4dbb410b71591f6f7b61a7d89f6f7609438578 100644 (file)
@@ -210,12 +210,16 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
                if (drm_core_has_MTRR(dev)) {
                        if (map->type == _DRM_FRAME_BUFFER ||
                            (map->flags & _DRM_WRITE_COMBINING)) {
-                               map->mtrr = mtrr_add(map->offset, map->size,
-                                                    MTRR_TYPE_WRCOMB, 1);
+                               map->mtrr =
+                                       arch_phys_wc_add(map->offset, map->size);
                        }
                }
                if (map->type == _DRM_REGISTERS) {
-                       map->handle = ioremap(map->offset, map->size);
+                       if (map->flags & _DRM_WRITE_COMBINING)
+                               map->handle = ioremap_wc(map->offset,
+                                                        map->size);
+                       else
+                               map->handle = ioremap(map->offset, map->size);
                        if (!map->handle) {
                                kfree(map);
                                return -ENOMEM;
@@ -410,6 +414,15 @@ int drm_addmap_ioctl(struct drm_device *dev, void *data,
 
        /* avoid a warning on 64-bit, this casting isn't very nice, but the API is set so too late */
        map->handle = (void *)(unsigned long)maplist->user_token;
+
+       /*
+        * It appears that there are no users of this value whatsoever --
+        * drmAddMap just discards it.  Let's not encourage its use.
+        * (Keeping drm_addmap_core's returned mtrr value would be wrong --
+        *  it's not a real mtrr index anymore.)
+        */
+       map->mtrr = -1;
+
        return 0;
 }
 
@@ -451,11 +464,8 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
                iounmap(map->handle);
                /* FALLTHROUGH */
        case _DRM_FRAME_BUFFER:
-               if (drm_core_has_MTRR(dev) && map->mtrr >= 0) {
-                       int retcode;
-                       retcode = mtrr_del(map->mtrr, map->offset, map->size);
-                       DRM_DEBUG("mtrr_del=%d\n", retcode);
-               }
+               if (drm_core_has_MTRR(dev))
+                       arch_phys_wc_del(map->mtrr);
                break;
        case _DRM_SHM:
                vfree(map->handle);