Skip to contentSkip to conversation

vmwgfx: allow building with CONFIG_HAS_IOPORT disabled

PATCH In review Arnd Bergmann 2 participants 2 messages Oct 4, 2024 – Oct 10, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vmwgfx: allow building with CONFIG_HAS_IOPORT disabled

From: Arnd Bergmann <[email protected]>

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.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 ++
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +2 -0
index 2825dd3149ed..dfb4b2ba23c6 100644
@@ -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) },
 	{ }
 };
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +4 -1
index 3f4719b3c268..a2fda4d43b4e 100644
@@ -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;
 }
 
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 58 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 ++
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +2 -0
index 2825dd3149ed..dfb4b2ba23c6 100644
@@ -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) },
        { }
 };
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +4 -2
index 3f4719b3c268..a2fda4d43b4e 100644
@@ -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;
 }
 
--
Quoted 2 lines

2.39.2

Thanks! Looks good. Would you like me to push this through drm-misc-fixes?

z