public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Zack Rusin <zack.rusin@broadcom.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: Niklas Schnelle <schnelle@linux.ibm.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	Martin Krastev <martin.krastev@broadcom.com>,
	Javier Martinez Canillas <javierm@redhat.com>,
	Ian Forbes <ian.forbes@broadcom.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH] vmwgfx: allow building with CONFIG_HAS_IOPORT disabled
Date: Fri,  4 Oct 2024 20:50:34 +0000	[thread overview]
Message-ID: <20241004205053.1068629-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

The older version of the vmwgfx driver requires port I/O in order to work:

In file included from arch/arm64/include/asm/io.h:298,
                 from drivers/gpu/drm/vmwgfx/vmwgfx_kms.c:28:
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h: In function 'vmw_read':
include/asm-generic/io.h:626:15: error: call to '_outl' declared with attribute error: outl() requires CONFIG_HAS_IOPORT
  626 | #define _outl _outl
include/asm-generic/io.h:663:14: note: in expansion of macro '_outl'
  663 | #define outl _outl
      |              ^~~~~
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:692:17: note: in expansion of macro 'outl'
  692 |                 outl(offset, dev_priv->io_start + SVGA_INDEX_PORT);
      |                 ^~~~

Change the version check to hardcode the v3 version and remove the PCI
ID for v2 in configurations that only support v3.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 ++
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 2825dd3149ed..dfb4b2ba23c6 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -262,7 +262,9 @@ static const struct drm_ioctl_desc vmw_ioctls[] = {
 };
 
 static const struct pci_device_id vmw_pci_id_list[] = {
+#ifdef CONFIG_HAS_IOPORT
 	{ PCI_DEVICE(PCI_VENDOR_ID_VMWARE, VMWGFX_PCI_ID_SVGA2) },
+#endif
 	{ PCI_DEVICE(PCI_VENDOR_ID_VMWARE, VMWGFX_PCI_ID_SVGA3) },
 	{ }
 };
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index 3f4719b3c268..a2fda4d43b4e 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -655,8 +655,11 @@ static inline struct vmw_fpriv *vmw_fpriv(struct drm_file *file_priv)
 /*
  * SVGA v3 has mmio register access and lacks fifo cmds
  */
-static inline bool vmw_is_svga_v3(const struct vmw_private *dev)
+static __always_inline bool vmw_is_svga_v3(const struct vmw_private *dev)
 {
+	if (!IS_ENABLED(CONFIG_HAS_IOPORT))
+		return true;
+
 	return dev->pci_id == VMWGFX_PCI_ID_SVGA3;
 }
 
-- 
2.39.2


             reply	other threads:[~2024-10-04 20:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-04 20:50 Arnd Bergmann [this message]
2024-10-10 19:58 ` [PATCH] vmwgfx: allow building with CONFIG_HAS_IOPORT disabled Zack Rusin

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=20241004205053.1068629-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=airlied@gmail.com \
    --cc=arnd@arndb.de \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ian.forbes@broadcom.com \
    --cc=javierm@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=martin.krastev@broadcom.com \
    --cc=mripard@kernel.org \
    --cc=schnelle@linux.ibm.com \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=zack.rusin@broadcom.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox