[PATCH] vmwgfx: allow building with CONFIG_HAS_IOPORT disabled

Zack Rusin zack.rusin at broadcom.com
Thu Oct 10 19:58:56 UTC 2024


On Fri, Oct 4, 2024 at 4:50 PM Arnd Bergmann <arnd at kernel.org> wrote:
>
> From: Arnd Bergmann <arnd at 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 at 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
>

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

Reviewed-by: Zack Rusin <zack.rusin at broadcom.com>

z


More information about the dri-devel mailing list