From patchwork Mon May 13 23:58:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Lutomirski X-Patchwork-Id: 2561291 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D6911DFE75 for ; Tue, 14 May 2013 00:00:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755469Ab3ENAAy (ORCPT ); Mon, 13 May 2013 20:00:54 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:54751 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755338Ab3EMX7M (ORCPT ); Mon, 13 May 2013 19:59:12 -0400 Received: by mail-pd0-f178.google.com with SMTP id w11so4838212pde.37 for ; Mon, 13 May 2013 16:59:11 -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=u6FzKMXltuGwOkpptTeevZiOYbF1Ik1S7eDoxrygI2o=; b=gNNcwMV2RgicnZFq+SUJpurzhQq23RI7oApH2ccm4VYTd8o7W5LHFXK/oz9/M/MSnE cVXAZvxmXuU8N7ZfP59vIjN8qBl3s9Vbfa5XwqMF4vUW7HCzjlYGhYi1W0aKUkGu3FN/ Gq+K+8KZbQcXAjC4LxmEzPeB6Er4kAqeuuF1r6jslrSXTyAfQZphnRJOJ6HcV5DxusFr 5cmIbwhjv/bXTaAL0LwECUzGAsdMQgX0XjZvuh8P2OgRep5ki9pr+WdJDd0k8VYftYNg s+eJcG5g4VAKtcI+YX4SqQxkgGnyH+vRT6/JHvKRC+Km99qDd2mybUcTtOvOG1cJPSB+ u36A== X-Received: by 10.68.172.5 with SMTP id ay5mr31693815pbc.73.1368489551773; Mon, 13 May 2013 16:59:11 -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 ea15sm16726281pad.16.2013.05.13.16.59.09 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 13 May 2013 16:59:10 -0700 (PDT) From: Andy Lutomirski To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org Cc: Daniel Vetter , Jerome Glisse , Alex Deucher , Dave Airlie , Andy Lutomirski Subject: [PATCH v3 5/9] i915: Use arch_phys_wc_{add,del} Date: Mon, 13 May 2013 16:58:44 -0700 Message-Id: <75d51e06d6f05f9455b863fe590ca02f788f75e5.1368485053.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: ALoCoQm3LzKYNPNYkYcYKaZVDmUCuAMSPm0DNNPuX1M3naoGFaJ8vvduHtJOVD21bneKie2GcZ78 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org i915 open-coded logic that was essentially equivalent to the new API. Reviewed-by: Daniel Vetter Signed-off-by: Andy Lutomirski --- Changes from v1: Don't zero the mtrr handle after freeing it drivers/gpu/drm/i915/i915_dma.c | 42 ++++------------------------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 4fa6beb..b0bb381 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,7 @@ 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); io_mapping_free(dev_priv->gtt.mappable); out_rmmap: pci_iounmap(dev->pdev, dev_priv->regs); @@ -1697,12 +1668,7 @@ 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); acpi_video_unregister();