From patchwork Thu May 9 19:46:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Lutomirski X-Patchwork-Id: 2546791 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 0527E3FE80 for ; Thu, 9 May 2013 22:40:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E1BE9E63CA for ; Thu, 9 May 2013 15:40:28 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com [209.85.160.53]) by gabe.freedesktop.org (Postfix) with ESMTP id 1C688E5C59 for ; Thu, 9 May 2013 12:47:00 -0700 (PDT) Received: by mail-pb0-f53.google.com with SMTP id un1so2212594pbc.12 for ; Thu, 09 May 2013 12:47:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references:x-gm-message-state; bh=YyIUCgcEUVv8Bn2DO4S4VP9DwjAMyhxmx/cRmlFg4+A=; b=iSWXhAHmWpGL/7YzpaCpeLE2ZA1vDUO7RG0heeaKgIL72uvS5vpgxL55EbYycPR5Ut oYA/lIPxo6AxEjyyJZDyuox88qo4RwYrPjcjsCrFsw9twMI/Ey1oNUNgoqZxJsNtOHqr wjaY3LagSht6ZI39P1bjhZWBoHdGiSFHBKEX0QPWZeuM6MYXCeG6TizqFYHya+esYK/r uAvsD7jAvoBY06oQw2bNmRh9Buaeh9rPOP+xuv+Qy2oXMMj8UjOjqXQuCuiLBPt/4UB2 N3qv+RZv8ZyoMUd9o09u5s1sOPSKX8vGQJF4ZFR/CxAfRywzaZ5sK9hk4UVGiJmHRT+m 57Tg== X-Received: by 10.68.251.201 with SMTP id zm9mr9485492pbc.135.1368128820832; Thu, 09 May 2013 12:47:00 -0700 (PDT) Received: from localhost (50-76-60-73-ip-static.hfc.comcastbusiness.net. [50.76.60.73]) by mx.google.com with ESMTPSA id qb1sm4078670pbb.33.2013.05.09.12.46.59 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 09 May 2013 12:47:00 -0700 (PDT) From: Andy Lutomirski To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org Subject: [RFC/PATCH v2 5/8] i915: Use arch_phys_wc_{add,del} Date: Thu, 9 May 2013 12:46:24 -0700 Message-Id: <2d9af02b508eaf182c72b6e60a63070de265a759.1368128020.git.luto@amacapital.net> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQkLTexXh7FjS6v/PT2UgX8ONz1qnxv9bex+mUdho1FPxaXi6z9QqgCWovSZnVVxKu43K6J7 X-Mailman-Approved-At: Thu, 09 May 2013 15:36:02 -0700 Cc: Daniel Vetter , Andy Lutomirski X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org i915 open-coded logic that was essentially equivalent to the new API. Signed-off-by: Andy Lutomirski --- Changes from v1: More cleanup drivers/gpu/drm/i915/i915_dma.c | 44 ++++++----------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 4fa6beb..cfdfb45 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -42,7 +42,6 @@ #include #include #include -#include #define LP_RING(d) (&((struct drm_i915_private *)(d))->ring[RCS]) @@ -1393,29 +1392,6 @@ void i915_master_destroy(struct drm_device *dev, struct drm_master *master) 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) { struct apertures_struct *ap; @@ -1552,8 +1528,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) goto out_rmmap; } - i915_mtrr_setup(dev_priv, dev_priv->gtt.mappable_base, - aperture_size); + dev_priv->mm.gtt_mtrr = arch_phys_wc_add(dev_priv->gtt.mappable_base, + aperture_size); /* The i915 workqueue is primarily used for batched retirement of * requests (and thus managing bo) once the task has been completed @@ -1656,12 +1632,8 @@ out_gem_unload: intel_teardown_mchbar(dev); destroy_workqueue(dev_priv->wq); out_mtrrfree: - if (dev_priv->mm.gtt_mtrr >= 0) { - mtrr_del(dev_priv->mm.gtt_mtrr, - dev_priv->gtt.mappable_base, - aperture_size); - dev_priv->mm.gtt_mtrr = -1; - } + arch_phys_wc_del(dev_priv->mm.gtt_mtrr); + dev_priv->mm.gtt_mtrr = 0; io_mapping_free(dev_priv->gtt.mappable); out_rmmap: pci_iounmap(dev->pdev, dev_priv->regs); @@ -1697,12 +1669,8 @@ int i915_driver_unload(struct drm_device *dev) cancel_delayed_work_sync(&dev_priv->mm.retire_work); io_mapping_free(dev_priv->gtt.mappable); - if (dev_priv->mm.gtt_mtrr >= 0) { - mtrr_del(dev_priv->mm.gtt_mtrr, - dev_priv->gtt.mappable_base, - dev_priv->gtt.mappable_end); - dev_priv->mm.gtt_mtrr = -1; - } + arch_phys_wc_del(dev_priv->mm.gtt_mtrr); + dev_priv->mm.gtt_mtrr = 0; acpi_video_unregister();