All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Williams, Dan J" <dan.j.williams@intel.com>
To: "thellstrom@vmware.com" <thellstrom@vmware.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm/vmwgfx: switch from ioremap_cache to memremap
Date: Mon, 19 Oct 2015 21:34:11 +0000	[thread overview]
Message-ID: <1445290450.27395.2.camel@intel.com> (raw)
In-Reply-To: <561D52FE.5080304@vmware.com>

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 <dan.j.williams@intel.com>

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 <airlied@linux.ie>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 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);

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: "Williams, Dan J" <dan.j.williams@intel.com>
To: "thellstrom@vmware.com" <thellstrom@vmware.com>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"syeh@vmware.com" <syeh@vmware.com>,
	"airlied@linux.ie" <airlied@linux.ie>
Subject: Re: [PATCH] drm/vmwgfx: switch from ioremap_cache to memremap
Date: Mon, 19 Oct 2015 21:34:11 +0000	[thread overview]
Message-ID: <1445290450.27395.2.camel@intel.com> (raw)
In-Reply-To: <561D52FE.5080304@vmware.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2678 bytes --]

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 <dan.j.williams@intel.com>

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 <airlied@linux.ie>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 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);

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

  reply	other threads:[~2015-10-19 21:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 22:35 [PATCH] drm/vmwgfx: switch from ioremap_cache to memremap Dan Williams
2015-10-13  5:18 ` Thomas Hellstrom
2015-10-13  5:18   ` Thomas Hellstrom
2015-10-13 16:35   ` Dan Williams
2015-10-13 18:37     ` Thomas Hellstrom
2015-10-13 18:37       ` Thomas Hellstrom
2015-10-13 18:48       ` Dan Williams
2015-10-13 18:52         ` Thomas Hellstrom
2015-10-13 18:52           ` Thomas Hellstrom
2015-10-19 21:34           ` Williams, Dan J [this message]
2015-10-19 21:34             ` Williams, Dan J
2015-10-28  7:05             ` Thomas Hellstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1445290450.27395.2.camel@intel.com \
    --to=dan.j.williams@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thellstrom@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.