From patchwork Mon Oct 19 21:34:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7440011 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BF1DEBEEA4 for ; Mon, 19 Oct 2015 21:34:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7886206E0 for ; Mon, 19 Oct 2015 21:34:30 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C3552206F1 for ; Mon, 19 Oct 2015 21:34:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5F4566E0C9; Mon, 19 Oct 2015 14:34:26 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id A76FD6E0C9 for ; Mon, 19 Oct 2015 14:34:24 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 19 Oct 2015 14:34:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,704,1437462000"; d="scan'208";a="830685274" Received: from orsmsx103.amr.corp.intel.com ([10.22.225.130]) by fmsmga002.fm.intel.com with ESMTP; 19 Oct 2015 14:34:18 -0700 Received: from orsmsx113.amr.corp.intel.com (10.22.240.9) by ORSMSX103.amr.corp.intel.com (10.22.225.130) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 19 Oct 2015 14:34:13 -0700 Received: from orsmsx107.amr.corp.intel.com ([169.254.1.53]) by ORSMSX113.amr.corp.intel.com ([169.254.7.138]) with mapi id 14.03.0248.002; Mon, 19 Oct 2015 14:34:12 -0700 From: "Williams, Dan J" To: "thellstrom@vmware.com" Subject: Re: [PATCH] drm/vmwgfx: switch from ioremap_cache to memremap Thread-Topic: [PATCH] drm/vmwgfx: switch from ioremap_cache to memremap Thread-Index: AQHRBT8t1WpP3+StG0GqllnVa+O7H55pWA2AgABp5IKAAARvvYAKEEIA Date: Mon, 19 Oct 2015 21:34:11 +0000 Message-ID: <1445290450.27395.2.camel@intel.com> References: <20151012223527.34143.87313.stgit@dwillia2-desk3.jf.intel.com> <561C9427.8020001@vmware.com> <561D4F65.5080908@vmware.com> <561D52FE.5080304@vmware.com> In-Reply-To: <561D52FE.5080304@vmware.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.22.254.139] Content-ID: MIME-Version: 1.0 Cc: "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, 2015-10-13 at 20:52 +0200, Thomas Hellstrom wrote: > > Ok, I'll make local read_fifo() and write_fifo() macros to make this > > explicit. Are these names ok with you? > > Sure. > So I ended up just leaving the __iomem annotation on mmio_virt for now until the implementation can be converted to use explicit barriers where necessary. 8<----- Subject: drm/vmwgfx: switch from ioremap_cache to memremap From: Dan Williams Per commit 2e586a7e017a "drm/vmwgfx: Map the fifo as cached" the driver expects the fifo registers to be cacheable. In preparation for deprecating ioremap_cache() convert its usage in vmwgfx to memremap(). Cc: David Airlie Cc: Thomas Hellstrom Cc: Sinclair Yeh Cc: dri-devel@lists.freedesktop.org Signed-off-by: Dan Williams Reviewed-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 2c7a25c71af2..33e9eda77bad 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -752,8 +752,14 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) ttm_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM); dev_priv->active_master = &dev_priv->fbdev_master; - dev_priv->mmio_virt = ioremap_cache(dev_priv->mmio_start, - dev_priv->mmio_size); + /* + * Force __iomem for this mapping until the implied compiler + * barriers and {READ|WRITE}_ONCE semantics from the + * io{read|write}32() accessors can be replaced with explicit + * barriers. + */ + dev_priv->mmio_virt = (void __iomem *) memremap(dev_priv->mmio_start, + dev_priv->mmio_size, MEMREMAP_WB); if (unlikely(dev_priv->mmio_virt == NULL)) { ret = -ENOMEM; @@ -907,7 +913,7 @@ out_no_irq: out_no_device: ttm_object_device_release(&dev_priv->tdev); out_err4: - iounmap(dev_priv->mmio_virt); + memunmap((void __force *) dev_priv->mmio_virt); out_err3: vmw_ttm_global_release(dev_priv); out_err0: @@ -958,7 +964,7 @@ static int vmw_driver_unload(struct drm_device *dev) pci_release_regions(dev->pdev); ttm_object_device_release(&dev_priv->tdev); - iounmap(dev_priv->mmio_virt); + memunmap((void __force *) dev_priv->mmio_virt); if (dev_priv->ctx.staged_bindings) vmw_binding_state_free(dev_priv->ctx.staged_bindings); vmw_ttm_global_release(dev_priv);