aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c29
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h1
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c6
3 files changed, 25 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index ee64b7301f6..1e01e784715 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -966,10 +966,6 @@ static int i915_load_modeset_init(struct drm_device *dev)
966 if (ret) 966 if (ret)
967 goto kfree_devname; 967 goto kfree_devname;
968 968
969 dev_priv->mm.gtt_mapping =
970 io_mapping_create_wc(dev->agp->base,
971 dev->agp->agp_info.aper_size * 1024*1024);
972
973 /* Allow hardware batchbuffers unless told otherwise. 969 /* Allow hardware batchbuffers unless told otherwise.
974 */ 970 */
975 dev_priv->allow_batchbuffer = 1; 971 dev_priv->allow_batchbuffer = 1;
@@ -1081,6 +1077,23 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1081 goto free_priv; 1077 goto free_priv;
1082 } 1078 }
1083 1079
1080 dev_priv->mm.gtt_mapping =
1081 io_mapping_create_wc(dev->agp->base,
1082 dev->agp->agp_info.aper_size * 1024*1024);
1083 /* Set up a WC MTRR for non-PAT systems. This is more common than
1084 * one would think, because the kernel disables PAT on first
1085 * generation Core chips because WC PAT gets overridden by a UC
1086 * MTRR if present. Even if a UC MTRR isn't present.
1087 */
1088 dev_priv->mm.gtt_mtrr = mtrr_add(dev->agp->base,
1089 dev->agp->agp_info.aper_size *
1090 1024 * 1024,
1091 MTRR_TYPE_WRCOMB, 1);
1092 if (dev_priv->mm.gtt_mtrr < 0) {
1093 DRM_INFO("MTRR allocation failed\n. Graphics "
1094 "performance may suffer.\n");
1095 }
1096
1084#ifdef CONFIG_HIGHMEM64G 1097#ifdef CONFIG_HIGHMEM64G
1085 /* don't enable GEM on PAE - needs agp + set_memory_* interface fixes */ 1098 /* don't enable GEM on PAE - needs agp + set_memory_* interface fixes */
1086 dev_priv->has_gem = 0; 1099 dev_priv->has_gem = 0;
@@ -1145,8 +1158,14 @@ int i915_driver_unload(struct drm_device *dev)
1145{ 1158{
1146 struct drm_i915_private *dev_priv = dev->dev_private; 1159 struct drm_i915_private *dev_priv = dev->dev_private;
1147 1160
1161 io_mapping_free(dev_priv->mm.gtt_mapping);
1162 if (dev_priv->mm.gtt_mtrr >= 0) {
1163 mtrr_del(dev_priv->mm.gtt_mtrr, dev->agp->base,
1164 dev->agp->agp_info.aper_size * 1024 * 1024);
1165 dev_priv->mm.gtt_mtrr = -1;
1166 }
1167
1148 if (drm_core_check_feature(dev, DRIVER_MODESET)) { 1168 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
1149 io_mapping_free(dev_priv->mm.gtt_mapping);
1150 drm_irq_uninstall(dev); 1169 drm_irq_uninstall(dev);
1151 } 1170 }
1152 1171
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e1351825200..f471d218b89 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -284,6 +284,7 @@ typedef struct drm_i915_private {
284 struct drm_mm gtt_space; 284 struct drm_mm gtt_space;
285 285
286 struct io_mapping *gtt_mapping; 286 struct io_mapping *gtt_mapping;
287 int gtt_mtrr;
287 288
288 /** 289 /**
289 * List of objects currently involved in rendering from the 290 * List of objects currently involved in rendering from the
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index a590d61ff69..af8034d5251 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3229,10 +3229,6 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data,
3229 dev_priv->mm.wedged = 0; 3229 dev_priv->mm.wedged = 0;
3230 } 3230 }
3231 3231
3232 dev_priv->mm.gtt_mapping = io_mapping_create_wc(dev->agp->base,
3233 dev->agp->agp_info.aper_size
3234 * 1024 * 1024);
3235
3236 mutex_lock(&dev->struct_mutex); 3232 mutex_lock(&dev->struct_mutex);
3237 dev_priv->mm.suspended = 0; 3233 dev_priv->mm.suspended = 0;
3238 3234
@@ -3255,7 +3251,6 @@ int
3255i915_gem_leavevt_ioctl(struct drm_device *dev, void *data, 3251i915_gem_leavevt_ioctl(struct drm_device *dev, void *data,
3256 struct drm_file *file_priv) 3252 struct drm_file *file_priv)
3257{ 3253{
3258 drm_i915_private_t *dev_priv = dev->dev_private;
3259 int ret; 3254 int ret;
3260 3255
3261 if (drm_core_check_feature(dev, DRIVER_MODESET)) 3256 if (drm_core_check_feature(dev, DRIVER_MODESET))
@@ -3264,7 +3259,6 @@ i915_gem_leavevt_ioctl(struct drm_device *dev, void *data,
3264 ret = i915_gem_idle(dev); 3259 ret = i915_gem_idle(dev);
3265 drm_irq_uninstall(dev); 3260 drm_irq_uninstall(dev);
3266 3261
3267 io_mapping_free(dev_priv->mm.gtt_mapping);
3268 return ret; 3262 return ret;
3269} 3263}
3270 3264