Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c0f6749 authored by Andy Lutomirski's avatar Andy Lutomirski Committed by Dave Airlie
Browse files

i915: Use arch_phys_wc_{add,del}



i915 open-coded logic that was essentially equivalent to the new API.

Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent f435046d
Loading
Loading
Loading
Loading
+4 −38
Original line number Original line Diff line number Diff line
@@ -42,7 +42,6 @@
#include <linux/vga_switcheroo.h>
#include <linux/vga_switcheroo.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <acpi/video.h>
#include <acpi/video.h>
#include <asm/pat.h>


#define LP_RING(d) (&((struct drm_i915_private *)(d))->ring[RCS])
#define LP_RING(d) (&((struct drm_i915_private *)(d))->ring[RCS])


@@ -1397,29 +1396,6 @@ void i915_master_destroy(struct drm_device *dev, struct drm_master *master)
	master->driver_priv = NULL;
	master->driver_priv = NULL;
}
}


static void
i915_mtrr_setup(struct drm_i915_private *dev_priv, unsigned long base,
		unsigned long size)
{
	dev_priv->mm.gtt_mtrr = -1;

#if defined(CONFIG_X86_PAT)
	if (cpu_has_pat)
		return;
#endif

	/* Set up a WC MTRR for non-PAT systems.  This is more common than
	 * one would think, because the kernel disables PAT on first
	 * generation Core chips because WC PAT gets overridden by a UC
	 * MTRR if present.  Even if a UC MTRR isn't present.
	 */
	dev_priv->mm.gtt_mtrr = mtrr_add(base, size, MTRR_TYPE_WRCOMB, 1);
	if (dev_priv->mm.gtt_mtrr < 0) {
		DRM_INFO("MTRR allocation failed.  Graphics "
			 "performance may suffer.\n");
	}
}

static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
{
{
	struct apertures_struct *ap;
	struct apertures_struct *ap;
@@ -1578,7 +1554,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
		goto out_rmmap;
		goto out_rmmap;
	}
	}


	i915_mtrr_setup(dev_priv, dev_priv->gtt.mappable_base,
	dev_priv->mm.gtt_mtrr = arch_phys_wc_add(dev_priv->gtt.mappable_base,
						 aperture_size);
						 aperture_size);


	/* The i915 workqueue is primarily used for batched retirement of
	/* The i915 workqueue is primarily used for batched retirement of
@@ -1684,12 +1660,7 @@ out_gem_unload:
	intel_teardown_mchbar(dev);
	intel_teardown_mchbar(dev);
	destroy_workqueue(dev_priv->wq);
	destroy_workqueue(dev_priv->wq);
out_mtrrfree:
out_mtrrfree:
	if (dev_priv->mm.gtt_mtrr >= 0) {
	arch_phys_wc_del(dev_priv->mm.gtt_mtrr);
		mtrr_del(dev_priv->mm.gtt_mtrr,
			 dev_priv->gtt.mappable_base,
			 aperture_size);
		dev_priv->mm.gtt_mtrr = -1;
	}
	io_mapping_free(dev_priv->gtt.mappable);
	io_mapping_free(dev_priv->gtt.mappable);
	dev_priv->gtt.gtt_remove(dev);
	dev_priv->gtt.gtt_remove(dev);
out_rmmap:
out_rmmap:
@@ -1724,12 +1695,7 @@ int i915_driver_unload(struct drm_device *dev)
	cancel_delayed_work_sync(&dev_priv->mm.retire_work);
	cancel_delayed_work_sync(&dev_priv->mm.retire_work);


	io_mapping_free(dev_priv->gtt.mappable);
	io_mapping_free(dev_priv->gtt.mappable);
	if (dev_priv->mm.gtt_mtrr >= 0) {
	arch_phys_wc_del(dev_priv->mm.gtt_mtrr);
		mtrr_del(dev_priv->mm.gtt_mtrr,
			 dev_priv->gtt.mappable_base,
			 dev_priv->gtt.mappable_end);
		dev_priv->mm.gtt_mtrr = -1;
	}


	acpi_video_unregister();
	acpi_video_unregister();