diff mbox series

[5/6] drm/vmwgfx: Add basic support for SVGA3

Message ID 20210505035740.286923-6-zackr@vmware.com (mailing list archive)
State New, archived
Headers show
Series drm/vmwgfx: SVGA v3 and arm64 support | expand

Commit Message

Zack Rusin May 5, 2021, 3:57 a.m. UTC
SVGA3 is the next version of our PCI device. Some of the changes
include using MMIO for register accesses instead of ioports,
deprecating the FIFO MMIO and removing a lot of the old and
legacy functionality. SVGA3 doesn't support guest backed
objects right now so everything except 3D is working.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Cc: Martin Krastev <krastevm@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
---
 .../gpu/drm/vmwgfx/device_include/svga_reg.h  |  55 ++++++-
 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c           | 114 +++++++--------
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c           | 136 ++++++++++++++----
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h           | 120 ++++++++++++----
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c       |   2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_fence.c         |  16 +--
 drivers/gpu/drm/vmwgfx/vmwgfx_fence.h         |   2 -
 drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c         |  49 +------
 drivers/gpu/drm/vmwgfx/vmwgfx_irq.c           |  75 ++--------
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c           |  23 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c           |  36 +++--
 drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c       |   2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_reg.h           |   4 -
 13 files changed, 363 insertions(+), 271 deletions(-)

Comments

kernel test robot May 5, 2021, 7:46 a.m. UTC | #1
Hi Zack,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[also build test WARNING on linus/master next-20210505]
[cannot apply to drm-intel/for-linux-next drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm/drm-next v5.12]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Zack-Rusin/drm-vmwgfx-SVGA-v3-and-arm64-support/20210505-120026
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: x86_64-randconfig-a012-20210505 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/4acf63c8eca79f6073ada0994b0e2a03c8fcfb71
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Zack-Rusin/drm-vmwgfx-SVGA-v3-and-arm64-support/20210505-120026
        git checkout 4acf63c8eca79f6073ada0994b0e2a03c8fcfb71
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c:477: warning: expecting prototype for vmw_fifo_commit_flush(). Prototype was for vmw_cmd_commit_flush() instead
   drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c:492: warning: expecting prototype for vmw_fifo_flush(). Prototype was for vmw_cmd_flush() instead
>> drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c:650: warning: expecting prototype for vmw_cmd_emit_dummy_gb_query(). Prototype was for vmw_cmd_emit_dummy_query() instead
   drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c:667: warning: Function parameter or member 'vmw' not described in 'vmw_cmd_supported'
   drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c:667: warning: Excess function parameter 'dev_priv' description in 'vmw_cmd_supported'


vim +650 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c

ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  628  
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  629  
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  630  /**
4acf63c8eca79f6 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin       2021-05-04  631   * vmw_cmd_emit_dummy_gb_query - emits a dummy query to the fifo using
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  632   * appropriate resource query commands.
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  633   *
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  634   * @dev_priv: The device private structure.
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  635   * @cid: The hardware context id used for the query.
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  636   *
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  637   * This function is used to emit a dummy occlusion query with
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  638   * no primitives rendered between query begin and query end.
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  639   * It's used to provide a query barrier, in order to know that when
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  640   * this query is finished, all preceding queries are also finished.
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  641   *
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  642   * A Query results structure should have been initialized at the start
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  643   * of the dev_priv->dummy_query_bo buffer object. And that buffer object
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  644   * must also be either reserved or pinned when this function is called.
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  645   *
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  646   * Returns -ENOMEM on failure to reserve fifo space.
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  647   */
8426ed9c4b42f41 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin       2020-11-18  648  int vmw_cmd_emit_dummy_query(struct vmw_private *dev_priv,
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  649  			      uint32_t cid)
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21 @650  {
ddcda24e3bec1d4 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom 2012-11-21  651  	if (dev_priv->has_mob)
4acf63c8eca79f6 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin       2021-05-04  652  		return vmw_cmd_emit_dummy_gb_query(dev_priv, cid);
4acf63c8eca79f6 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin       2021-05-04  653  
4acf63c8eca79f6 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin       2021-05-04  654  	return vmw_cmd_emit_dummy_legacy_query(dev_priv, cid);
4acf63c8eca79f6 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin       2021-05-04  655  }
4acf63c8eca79f6 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin       2021-05-04  656  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot May 5, 2021, 8:23 a.m. UTC | #2
Hi Zack,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[also build test WARNING on linus/master next-20210505]
[cannot apply to drm-intel/for-linux-next drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm/drm-next v5.12]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Zack-Rusin/drm-vmwgfx-SVGA-v3-and-arm64-support/20210505-120026
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: x86_64-randconfig-s021-20210505 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/4acf63c8eca79f6073ada0994b0e2a03c8fcfb71
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Zack-Rusin/drm-vmwgfx-SVGA-v3-and-arm64-support/20210505-120026
        git checkout 4acf63c8eca79f6073ada0994b0e2a03c8fcfb71
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:718:28: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned int [usertype] *rmmio @@     got void [noderef] __iomem * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:718:28: sparse:     expected unsigned int [usertype] *rmmio
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:718:28: sparse:     got void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.c: note: in included file:
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
--
   drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c: note: in included file:
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
--
   drivers/gpu/drm/vmwgfx/vmwgfx_kms.c: note: in included file (through drivers/gpu/drm/vmwgfx/vmwgfx_kms.h):
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
--
   drivers/gpu/drm/vmwgfx/vmwgfx_irq.c: note: in included file:
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
--
>> drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c:105:24: sparse: sparse: Using plain integer as NULL pointer
   drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c:674:33: sparse: sparse: Using plain integer as NULL pointer
   drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c: note: in included file:
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
--
   drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c: note: in included file (through drivers/gpu/drm/vmwgfx/vmwgfx_kms.h):
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
--
   drivers/gpu/drm/vmwgfx/vmwgfx_fence.c: note: in included file:
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     expected void const [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:683:48: sparse:     got unsigned int [usertype] *
--
   drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c: note: in included file:
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *
>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int [usertype] * @@
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     expected void [noderef] __iomem *
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h:668:50: sparse:     got unsigned int [usertype] *

vim +718 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c

   692	
   693	static int vmw_setup_pci_resources(struct vmw_private *dev,
   694					   unsigned long pci_id)
   695	{
   696		resource_size_t rmmio_start;
   697		resource_size_t rmmio_size;
   698		resource_size_t fifo_start;
   699		resource_size_t fifo_size;
   700		int ret;
   701		struct pci_dev *pdev = to_pci_dev(dev->drm.dev);
   702	
   703		pci_set_master(pdev);
   704	
   705		ret = pci_request_regions(pdev, "vmwgfx probe");
   706		if (ret)
   707			return ret;
   708	
   709		dev->pci_id = pci_id;
   710		if (pci_id == VMWGFX_PCI_ID_SVGA3) {
   711			rmmio_start = pci_resource_start(pdev, 0);
   712			rmmio_size = pci_resource_len(pdev, 0);
   713			dev->vram_start = pci_resource_start(pdev, 2);
   714			dev->vram_size = pci_resource_len(pdev, 2);
   715	
   716			DRM_INFO("Register MMIO at 0x%pa size is %llu kiB\n",
   717				 &rmmio_start, (uint64_t)rmmio_size / 1024);
 > 718			dev->rmmio = devm_ioremap(dev->drm.dev,
   719						  rmmio_start,
   720						  rmmio_size);
   721			if (IS_ERR(dev->rmmio)) {
   722				DRM_ERROR("Failed mapping registers mmio memory.\n");
   723				pci_release_regions(pdev);
   724				return PTR_ERR(dev->rmmio);
   725			}
   726		} else if (pci_id == VMWGFX_PCI_ID_SVGA2) {
   727			dev->io_start = pci_resource_start(pdev, 0);
   728			dev->vram_start = pci_resource_start(pdev, 1);
   729			dev->vram_size = pci_resource_len(pdev, 1);
   730			fifo_start = pci_resource_start(pdev, 2);
   731			fifo_size = pci_resource_len(pdev, 2);
   732	
   733			DRM_INFO("FIFO at %pa size is %llu kiB\n",
   734				 &fifo_start, (uint64_t)fifo_size / 1024);
   735			dev->fifo_mem = devm_memremap(dev->drm.dev,
   736						      fifo_start,
   737						      fifo_size,
   738						      MEMREMAP_WB);
   739	
   740			if (IS_ERR(dev->fifo_mem)) {
   741				DRM_ERROR("Failed mapping FIFO memory.\n");
   742				pci_release_regions(pdev);
   743				return PTR_ERR(dev->fifo_mem);
   744			}
   745		} else {
   746			pci_release_regions(pdev);
   747			return -EINVAL;
   748		}
   749	
   750		/*
   751		 * This is approximate size of the vram, the exact size will only
   752		 * be known after we read SVGA_REG_VRAM_SIZE. The PCI resource
   753		 * size will be equal to or bigger than the size reported by
   754		 * SVGA_REG_VRAM_SIZE.
   755		 */
   756		DRM_INFO("VRAM at %pa size is %llu kiB\n",
   757			 &dev->vram_start, (uint64_t)dev->vram_size / 1024);
   758	
   759		return 0;
   760	}
   761	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot May 5, 2021, 10:10 a.m. UTC | #3
Hi Zack,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[also build test WARNING on linus/master next-20210505]
[cannot apply to drm-intel/for-linux-next drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm/drm-next v5.12]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Zack-Rusin/drm-vmwgfx-SVGA-v3-and-arm64-support/20210505-120026
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: x86_64-randconfig-c003-20210505 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/4acf63c8eca79f6073ada0994b0e2a03c8fcfb71
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Zack-Rusin/drm-vmwgfx-SVGA-v3-and-arm64-support/20210505-120026
        git checkout 4acf63c8eca79f6073ada0994b0e2a03c8fcfb71
        # save the attached .config to linux build tree
        make W=1 W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c:477: warning: expecting prototype for vmw_fifo_commit_flush(). Prototype was for vmw_cmd_commit_flush() instead
   drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c:492: warning: expecting prototype for vmw_fifo_flush(). Prototype was for vmw_cmd_flush() instead
>> drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c:650: warning: expecting prototype for vmw_cmd_emit_dummy_gb_query(). Prototype was for vmw_cmd_emit_dummy_query() instead
   drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c:667: warning: Function parameter or member 'vmw' not described in 'vmw_cmd_supported'
   drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c:667: warning: Excess function parameter 'dev_priv' description in 'vmw_cmd_supported'


cocci warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c:674:25-26: WARNING comparing pointer to 0

Please review and possibly fold the followup patch.

vim +650 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c

3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  468  
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  469  
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  470  /**
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  471   * vmw_fifo_commit_flush - Commit fifo space and flush any buffered commands.
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  472   *
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  473   * @dev_priv: Pointer to device private structure.
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  474   * @bytes: Number of bytes to commit.
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  475   */
8426ed9c4b42f4 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2020-11-18  476  void vmw_cmd_commit_flush(struct vmw_private *dev_priv, uint32_t bytes)
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25 @477  {
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  478  	if (dev_priv->cman)
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  479  		vmw_cmdbuf_commit(dev_priv->cman, bytes, NULL, true);
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  480  	else
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  481  		vmw_local_fifo_commit(dev_priv, bytes);
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  482  }
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  483  
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  484  /**
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  485   * vmw_fifo_flush - Flush any buffered commands and make sure command processing
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  486   * starts.
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  487   *
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  488   * @dev_priv: Pointer to device private structure.
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  489   * @interruptible: Whether to wait interruptible if function needs to sleep.
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  490   */
8426ed9c4b42f4 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2020-11-18  491  int vmw_cmd_flush(struct vmw_private *dev_priv, bool interruptible)
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  492  {
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  493  	might_sleep();
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  494  
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  495  	if (dev_priv->cman)
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  496  		return vmw_cmdbuf_cur_flush(dev_priv->cman, interruptible);
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  497  	else
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  498  		return 0;
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  499  }
3eab3d9eef6504 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-25  500  
8426ed9c4b42f4 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2020-11-18  501  int vmw_cmd_send_fence(struct vmw_private *dev_priv, uint32_t *seqno)
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  502  {
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  503  	struct svga_fifo_cmd_fence *cmd_fence;
b9eb1a6174e58e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-04-02  504  	u32 *fm;
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  505  	int ret = 0;
b9eb1a6174e58e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-04-02  506  	uint32_t bytes = sizeof(u32) + sizeof(*cmd_fence);
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  507  
8426ed9c4b42f4 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2020-11-18  508  	fm = VMW_CMD_RESERVE(dev_priv, bytes);
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  509  	if (unlikely(fm == NULL)) {
6bcd8d3c782b7b drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-09-01  510  		*seqno = atomic_read(&dev_priv->marker_seq);
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  511  		ret = -ENOMEM;
6bcd8d3c782b7b drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-09-01  512  		(void)vmw_fallback_wait(dev_priv, false, true, *seqno,
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  513  					false, 3*HZ);
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  514  		goto out_err;
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  515  	}
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  516  
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  517  	do {
6bcd8d3c782b7b drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-09-01  518  		*seqno = atomic_add_return(1, &dev_priv->marker_seq);
6bcd8d3c782b7b drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-09-01  519  	} while (*seqno == 0);
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  520  
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  521  	if (!(vmw_fifo_caps(dev_priv) & SVGA_FIFO_CAP_FENCE)) {
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  522  
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  523  		/*
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  524  		 * Don't request hardware to send a fence. The
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  525  		 * waiting code in vmwgfx_irq.c will emulate this.
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  526  		 */
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  527  
8426ed9c4b42f4 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2020-11-18  528  		vmw_cmd_commit(dev_priv, 0);
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  529  		return 0;
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  530  	}
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  531  
b9eb1a6174e58e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-04-02  532  	*fm++ = SVGA_CMD_FENCE;
b9eb1a6174e58e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-04-02  533  	cmd_fence = (struct svga_fifo_cmd_fence *) fm;
b9eb1a6174e58e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-04-02  534  	cmd_fence->fence = *seqno;
8426ed9c4b42f4 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2020-11-18  535  	vmw_cmd_commit_flush(dev_priv, bytes);
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  536  	vmw_update_seqno(dev_priv);
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  537  
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  538  out_err:
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  539  	return ret;
fb1d9738ca053e drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Jakob Bornecrantz 2009-12-10  540  }
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  541  
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  542  /**
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  543   * vmw_cmd_emit_dummy_legacy_query - emits a dummy query to the fifo using
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  544   * legacy query commands.
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  545   *
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  546   * @dev_priv: The device private structure.
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  547   * @cid: The hardware context id used for the query.
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  548   *
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  549   * See the vmw_cmd_emit_dummy_query documentation.
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  550   */
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  551  static int vmw_cmd_emit_dummy_legacy_query(struct vmw_private *dev_priv,
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  552  					    uint32_t cid)
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  553  {
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  554  	/*
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  555  	 * A query wait without a preceding query end will
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  556  	 * actually finish all queries for this cid
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  557  	 * without writing to the query result structure.
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  558  	 */
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  559  
459d0fa7359654 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-26  560  	struct ttm_buffer_object *bo = &dev_priv->dummy_query_bo->base;
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  561  	struct {
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  562  		SVGA3dCmdHeader header;
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  563  		SVGA3dCmdWaitForQuery body;
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  564  	} *cmd;
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  565  
8426ed9c4b42f4 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2020-11-18  566  	cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
11c454196610ae drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Deepak Rawat      2019-02-14  567  	if (unlikely(cmd == NULL))
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  568  		return -ENOMEM;
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  569  
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  570  	cmd->header.id = SVGA_3D_CMD_WAIT_FOR_QUERY;
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  571  	cmd->header.size = sizeof(cmd->body);
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  572  	cmd->body.cid = cid;
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  573  	cmd->body.type = SVGA3D_QUERYTYPE_OCCLUSION;
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  574  
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  575  	if (bo->mem.mem_type == TTM_PL_VRAM) {
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  576  		cmd->body.guestResult.gmrId = SVGA_GMR_FRAMEBUFFER;
0b17fc08e396d0 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Nirmoy Das        2020-06-24  577  		cmd->body.guestResult.offset = bo->mem.start << PAGE_SHIFT;
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  578  	} else {
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  579  		cmd->body.guestResult.gmrId = bo->mem.start;
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  580  		cmd->body.guestResult.offset = 0;
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  581  	}
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  582  
8426ed9c4b42f4 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2020-11-18  583  	vmw_cmd_commit(dev_priv, sizeof(*cmd));
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  584  
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  585  	return 0;
e2fa3a76839ada drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2011-10-04  586  }
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  587  
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  588  /**
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  589   * vmw_cmd_emit_dummy_gb_query - emits a dummy query to the fifo using
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  590   * guest-backed resource query commands.
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  591   *
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  592   * @dev_priv: The device private structure.
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  593   * @cid: The hardware context id used for the query.
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  594   *
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  595   * See the vmw_cmd_emit_dummy_query documentation.
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  596   */
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  597  static int vmw_cmd_emit_dummy_gb_query(struct vmw_private *dev_priv,
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  598  				       uint32_t cid)
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  599  {
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  600  	/*
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  601  	 * A query wait without a preceding query end will
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  602  	 * actually finish all queries for this cid
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  603  	 * without writing to the query result structure.
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  604  	 */
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  605  
459d0fa7359654 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2015-06-26  606  	struct ttm_buffer_object *bo = &dev_priv->dummy_query_bo->base;
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  607  	struct {
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  608  		SVGA3dCmdHeader header;
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  609  		SVGA3dCmdWaitForGBQuery body;
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  610  	} *cmd;
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  611  
8426ed9c4b42f4 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2020-11-18  612  	cmd = VMW_CMD_RESERVE(dev_priv, sizeof(*cmd));
11c454196610ae drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Deepak Rawat      2019-02-14  613  	if (unlikely(cmd == NULL))
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  614  		return -ENOMEM;
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  615  
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  616  	cmd->header.id = SVGA_3D_CMD_WAIT_FOR_GB_QUERY;
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  617  	cmd->header.size = sizeof(cmd->body);
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  618  	cmd->body.cid = cid;
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  619  	cmd->body.type = SVGA3D_QUERYTYPE_OCCLUSION;
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  620  	BUG_ON(bo->mem.mem_type != VMW_PL_MOB);
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  621  	cmd->body.mobid = bo->mem.start;
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  622  	cmd->body.offset = 0;
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  623  
8426ed9c4b42f4 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2020-11-18  624  	vmw_cmd_commit(dev_priv, sizeof(*cmd));
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  625  
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  626  	return 0;
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  627  }
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  628  
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  629  
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  630  /**
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  631   * vmw_cmd_emit_dummy_gb_query - emits a dummy query to the fifo using
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  632   * appropriate resource query commands.
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  633   *
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  634   * @dev_priv: The device private structure.
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  635   * @cid: The hardware context id used for the query.
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  636   *
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  637   * This function is used to emit a dummy occlusion query with
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  638   * no primitives rendered between query begin and query end.
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  639   * It's used to provide a query barrier, in order to know that when
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  640   * this query is finished, all preceding queries are also finished.
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  641   *
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  642   * A Query results structure should have been initialized at the start
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  643   * of the dev_priv->dummy_query_bo buffer object. And that buffer object
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  644   * must also be either reserved or pinned when this function is called.
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  645   *
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  646   * Returns -ENOMEM on failure to reserve fifo space.
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  647   */
8426ed9c4b42f4 drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2020-11-18  648  int vmw_cmd_emit_dummy_query(struct vmw_private *dev_priv,
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  649  			      uint32_t cid)
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21 @650  {
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  651  	if (dev_priv->has_mob)
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  652  		return vmw_cmd_emit_dummy_gb_query(dev_priv, cid);
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  653  
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  654  	return vmw_cmd_emit_dummy_legacy_query(dev_priv, cid);
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  655  }
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  656  
ddcda24e3bec1d drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c Thomas Hellstrom  2012-11-21  657  
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  658  /**
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  659   * vmw_cmd_supported - returns true if the given device supports
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  660   * command queues.
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  661   *
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  662   * @dev_priv: The device private structure.
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  663   *
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  664   * Returns true if we can issue commands.
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  665   */
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  666  bool vmw_cmd_supported(struct vmw_private *vmw)
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  667  {
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  668  	if ((vmw->capabilities & (SVGA_CAP_COMMAND_BUFFERS |
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  669  				  SVGA_CAP_CMD_BUFFERS_2)) != 0)
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  670  		return true;
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  671  	/*
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  672  	 * We have FIFO cmd's
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04  673  	 */
4acf63c8eca79f drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c  Zack Rusin        2021-05-04 @674  	return vmw->fifo_mem != 0;

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vmwgfx/device_include/svga_reg.h b/drivers/gpu/drm/vmwgfx/device_include/svga_reg.h
index 19fb9e3299e7..193a57f6aae5 100644
--- a/drivers/gpu/drm/vmwgfx/device_include/svga_reg.h
+++ b/drivers/gpu/drm/vmwgfx/device_include/svga_reg.h
@@ -1,6 +1,6 @@ 
 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**********************************************************
- * Copyright 1998-2015 VMware, Inc.
+ * Copyright 1998-2021 VMware, Inc.
  *
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation
@@ -98,6 +98,10 @@  typedef uint32 SVGAMobId;
 #define SVGA_MAGIC         0x900000UL
 #define SVGA_MAKE_ID(ver)  (SVGA_MAGIC << 8 | (ver))
 
+/* Version 3 has the control bar instead of the FIFO */
+#define SVGA_VERSION_3     3
+#define SVGA_ID_3          SVGA_MAKE_ID(SVGA_VERSION_3)
+
 /* Version 2 let the address of the frame buffer be unsigned on Win32 */
 #define SVGA_VERSION_2     2
 #define SVGA_ID_2          SVGA_MAKE_ID(SVGA_VERSION_2)
@@ -129,11 +133,12 @@  typedef uint32 SVGAMobId;
  * Interrupts are only supported when the
  * SVGA_CAP_IRQMASK capability is present.
  */
-#define SVGA_IRQFLAG_ANY_FENCE            0x1    /* Any fence was passed */
-#define SVGA_IRQFLAG_FIFO_PROGRESS        0x2    /* Made forward progress in the FIFO */
-#define SVGA_IRQFLAG_FENCE_GOAL           0x4    /* SVGA_FIFO_FENCE_GOAL reached */
-#define SVGA_IRQFLAG_COMMAND_BUFFER       0x8    /* Command buffer completed */
-#define SVGA_IRQFLAG_ERROR                0x10   /* Error while processing commands */
+#define SVGA_IRQFLAG_ANY_FENCE            (1 << 0) /* Any fence was passed */
+#define SVGA_IRQFLAG_FIFO_PROGRESS        (1 << 1) /* Made forward progress in the FIFO */
+#define SVGA_IRQFLAG_FENCE_GOAL           (1 << 2) /* SVGA_FIFO_FENCE_GOAL reached */
+#define SVGA_IRQFLAG_COMMAND_BUFFER       (1 << 3) /* Command buffer completed */
+#define SVGA_IRQFLAG_ERROR                (1 << 4) /* Error while processing commands */
+#define SVGA_IRQFLAG_MAX                  (1 << 5)
 
 /*
  * The byte-size is the size of the actual cursor data,
@@ -286,7 +291,32 @@  enum {
     */
    SVGA_REG_GBOBJECT_MEM_SIZE_KB = 76,
 
-   SVGA_REG_TOP = 77,               /* Must be 1 more than the last register */
+   /*
+    +    * These registers are for the addresses of the memory BARs for SVGA3
+    */
+   SVGA_REG_REGS_START_HIGH32 = 77,
+   SVGA_REG_REGS_START_LOW32 = 78,
+   SVGA_REG_FB_START_HIGH32 = 79,
+   SVGA_REG_FB_START_LOW32 = 80,
+
+   /*
+    * A hint register that recommends which quality level the guest should
+    * currently use to define multisample surfaces.
+    *
+    * If the register is SVGA_REG_MSHINT_DISABLED,
+    * the guest is only allowed to use SVGA3D_MS_QUALITY_FULL.
+    *
+    * Otherwise, this is a live value that can change while the VM is
+    * powered on with the hint suggestion for which quality level the guest
+    * should be using.  Guests are free to ignore the hint and use either
+    * RESOLVE or FULL quality.
+    */
+   SVGA_REG_MSHINT = 81,
+
+   SVGA_REG_IRQ_STATUS = 82,
+   SVGA_REG_DIRTY_TRACKING = 83,
+
+   SVGA_REG_TOP = 84,               /* Must be 1 more than the last register */
 
    SVGA_PALETTE_BASE = 1024,        /* Base of SVGA color map */
    /* Next 768 (== 256*3) registers exist for colormap */
@@ -310,6 +340,17 @@  typedef enum SVGARegGuestDriverId {
    SVGA_REG_GUEST_DRIVER_ID_SUBMIT  = MAX_UINT32,
 } SVGARegGuestDriverId;
 
+typedef enum SVGARegMSHint {
+   SVGA_REG_MSHINT_DISABLED = 0,
+   SVGA_REG_MSHINT_FULL     = 1,
+   SVGA_REG_MSHINT_RESOLVED = 2,
+} SVGARegMSHint;
+
+typedef enum SVGARegDirtyTracking {
+   SVGA_REG_DIRTY_TRACKING_PER_IMAGE = 0,
+   SVGA_REG_DIRTY_TRACKING_PER_SURFACE = 1,
+} SVGARegDirtyTracking;
+
 
 /*
  * Guest memory regions (GMRs):
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c
index 20246a7c97c9..5dae8a7066b6 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c
@@ -31,15 +31,10 @@ 
 
 #include "vmwgfx_drv.h"
 
-struct vmw_temp_set_context {
-	SVGA3dCmdHeader header;
-	SVGA3dCmdDXTempSetContext body;
-};
-
 bool vmw_supports_3d(struct vmw_private *dev_priv)
 {
 	uint32_t fifo_min, hwversion;
-	const struct vmw_fifo_state *fifo = &dev_priv->fifo;
+	const struct vmw_fifo_state *fifo = dev_priv->fifo;
 
 	if (!(dev_priv->capabilities & SVGA_CAP_3D))
 		return false;
@@ -61,6 +56,8 @@  bool vmw_supports_3d(struct vmw_private *dev_priv)
 	if (!(dev_priv->capabilities & SVGA_CAP_EXTENDED_FIFO))
 		return false;
 
+	BUG_ON(vmw_is_svga_v3(dev_priv));
+
 	fifo_min = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_MIN);
 	if (fifo_min <= SVGA_FIFO_3D_HWVERSION * sizeof(unsigned int))
 		return false;
@@ -98,16 +95,20 @@  bool vmw_fifo_have_pitchlock(struct vmw_private *dev_priv)
 	return false;
 }
 
-int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
+struct vmw_fifo_state *vmw_fifo_create(struct vmw_private *dev_priv)
 {
+	struct vmw_fifo_state *fifo;
 	uint32_t max;
 	uint32_t min;
 
-	fifo->dx = false;
+	if (!dev_priv->fifo_mem)
+		return 0;
+
+	fifo = kzalloc(sizeof(*fifo), GFP_KERNEL);
 	fifo->static_buffer_size = VMWGFX_FIFO_STATIC_SIZE;
 	fifo->static_buffer = vmalloc(fifo->static_buffer_size);
 	if (unlikely(fifo->static_buffer == NULL))
-		return -ENOMEM;
+		return ERR_PTR(-ENOMEM);
 
 	fifo->dynamic_buffer = NULL;
 	fifo->reserved_size = 0;
@@ -115,20 +116,6 @@  int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
 
 	mutex_init(&fifo->fifo_mutex);
 	init_rwsem(&fifo->rwsem);
-
-	DRM_INFO("width %d\n", vmw_read(dev_priv, SVGA_REG_WIDTH));
-	DRM_INFO("height %d\n", vmw_read(dev_priv, SVGA_REG_HEIGHT));
-	DRM_INFO("bpp %d\n", vmw_read(dev_priv, SVGA_REG_BITS_PER_PIXEL));
-
-	dev_priv->enable_state = vmw_read(dev_priv, SVGA_REG_ENABLE);
-	dev_priv->config_done_state = vmw_read(dev_priv, SVGA_REG_CONFIG_DONE);
-	dev_priv->traces_state = vmw_read(dev_priv, SVGA_REG_TRACES);
-
-	vmw_write(dev_priv, SVGA_REG_ENABLE, SVGA_REG_ENABLE_ENABLE |
-		  SVGA_REG_ENABLE_HIDE);
-
-	vmw_write(dev_priv, SVGA_REG_TRACES, 0);
-
 	min = 4;
 	if (dev_priv->capabilities & SVGA_CAP_EXTENDED_FIFO)
 		min = vmw_read(dev_priv, SVGA_REG_MEM_REGS);
@@ -155,35 +142,23 @@  int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
 		 (unsigned int) max,
 		 (unsigned int) min,
 		 (unsigned int) fifo->capabilities);
-
-	atomic_set(&dev_priv->marker_seq, dev_priv->last_read_seqno);
-	vmw_fifo_mem_write(dev_priv, SVGA_FIFO_FENCE, dev_priv->last_read_seqno);
-
-	return 0;
+	return fifo;
 }
 
 void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason)
 {
 	u32 *fifo_mem = dev_priv->fifo_mem;
-
-	if (cmpxchg(fifo_mem + SVGA_FIFO_BUSY, 0, 1) == 0)
+	if (fifo_mem && cmpxchg(fifo_mem + SVGA_FIFO_BUSY, 0, 1) == 0)
 		vmw_write(dev_priv, SVGA_REG_SYNC, reason);
+
 }
 
-void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
+void vmw_fifo_destroy(struct vmw_private *dev_priv)
 {
-	vmw_write(dev_priv, SVGA_REG_SYNC, SVGA_SYNC_GENERIC);
-	while (vmw_read(dev_priv, SVGA_REG_BUSY) != 0)
-		;
+	struct vmw_fifo_state *fifo = dev_priv->fifo;
 
-	dev_priv->last_read_seqno = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_FENCE);
-
-	vmw_write(dev_priv, SVGA_REG_CONFIG_DONE,
-		  dev_priv->config_done_state);
-	vmw_write(dev_priv, SVGA_REG_ENABLE,
-		  dev_priv->enable_state);
-	vmw_write(dev_priv, SVGA_REG_TRACES,
-		  dev_priv->traces_state);
+	if (!fifo)
+		return;
 
 	if (likely(fifo->static_buffer != NULL)) {
 		vfree(fifo->static_buffer);
@@ -194,6 +169,8 @@  void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
 		vfree(fifo->dynamic_buffer);
 		fifo->dynamic_buffer = NULL;
 	}
+	kfree(fifo);
+	dev_priv->fifo = NULL;
 }
 
 static bool vmw_fifo_is_full(struct vmw_private *dev_priv, uint32_t bytes)
@@ -289,7 +266,7 @@  static int vmw_fifo_wait(struct vmw_private *dev_priv,
 static void *vmw_local_fifo_reserve(struct vmw_private *dev_priv,
 				    uint32_t bytes)
 {
-	struct vmw_fifo_state *fifo_state = &dev_priv->fifo;
+	struct vmw_fifo_state *fifo_state = dev_priv->fifo;
 	u32  *fifo_mem = dev_priv->fifo_mem;
 	uint32_t max;
 	uint32_t min;
@@ -438,16 +415,12 @@  static void vmw_fifo_slow_copy(struct vmw_fifo_state *fifo_state,
 
 static void vmw_local_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes)
 {
-	struct vmw_fifo_state *fifo_state = &dev_priv->fifo;
+	struct vmw_fifo_state *fifo_state = dev_priv->fifo;
 	uint32_t next_cmd = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_NEXT_CMD);
 	uint32_t max = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_MAX);
 	uint32_t min = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_MIN);
 	bool reserveable = fifo_state->capabilities & SVGA_FIFO_CAP_RESERVE;
 
-	if (fifo_state->dx)
-		bytes += sizeof(struct vmw_temp_set_context);
-
-	fifo_state->dx = false;
 	BUG_ON((bytes & 3) != 0);
 	BUG_ON(bytes > fifo_state->reserved_size);
 
@@ -527,7 +500,6 @@  int vmw_cmd_flush(struct vmw_private *dev_priv, bool interruptible)
 
 int vmw_cmd_send_fence(struct vmw_private *dev_priv, uint32_t *seqno)
 {
-	struct vmw_fifo_state *fifo_state = &dev_priv->fifo;
 	struct svga_fifo_cmd_fence *cmd_fence;
 	u32 *fm;
 	int ret = 0;
@@ -546,7 +518,7 @@  int vmw_cmd_send_fence(struct vmw_private *dev_priv, uint32_t *seqno)
 		*seqno = atomic_add_return(1, &dev_priv->marker_seq);
 	} while (*seqno == 0);
 
-	if (!(fifo_state->capabilities & SVGA_FIFO_CAP_FENCE)) {
+	if (!(vmw_fifo_caps(dev_priv) & SVGA_FIFO_CAP_FENCE)) {
 
 		/*
 		 * Don't request hardware to send a fence. The
@@ -561,22 +533,22 @@  int vmw_cmd_send_fence(struct vmw_private *dev_priv, uint32_t *seqno)
 	cmd_fence = (struct svga_fifo_cmd_fence *) fm;
 	cmd_fence->fence = *seqno;
 	vmw_cmd_commit_flush(dev_priv, bytes);
-	vmw_update_seqno(dev_priv, fifo_state);
+	vmw_update_seqno(dev_priv);
 
 out_err:
 	return ret;
 }
 
 /**
- * vmw_fifo_emit_dummy_legacy_query - emits a dummy query to the fifo using
+ * vmw_cmd_emit_dummy_legacy_query - emits a dummy query to the fifo using
  * legacy query commands.
  *
  * @dev_priv: The device private structure.
  * @cid: The hardware context id used for the query.
  *
- * See the vmw_fifo_emit_dummy_query documentation.
+ * See the vmw_cmd_emit_dummy_query documentation.
  */
-static int vmw_fifo_emit_dummy_legacy_query(struct vmw_private *dev_priv,
+static int vmw_cmd_emit_dummy_legacy_query(struct vmw_private *dev_priv,
 					    uint32_t cid)
 {
 	/*
@@ -614,16 +586,16 @@  static int vmw_fifo_emit_dummy_legacy_query(struct vmw_private *dev_priv,
 }
 
 /**
- * vmw_fifo_emit_dummy_gb_query - emits a dummy query to the fifo using
+ * vmw_cmd_emit_dummy_gb_query - emits a dummy query to the fifo using
  * guest-backed resource query commands.
  *
  * @dev_priv: The device private structure.
  * @cid: The hardware context id used for the query.
  *
- * See the vmw_fifo_emit_dummy_query documentation.
+ * See the vmw_cmd_emit_dummy_query documentation.
  */
-static int vmw_fifo_emit_dummy_gb_query(struct vmw_private *dev_priv,
-					uint32_t cid)
+static int vmw_cmd_emit_dummy_gb_query(struct vmw_private *dev_priv,
+				       uint32_t cid)
 {
 	/*
 	 * A query wait without a preceding query end will
@@ -656,7 +628,7 @@  static int vmw_fifo_emit_dummy_gb_query(struct vmw_private *dev_priv,
 
 
 /**
- * vmw_fifo_emit_dummy_gb_query - emits a dummy query to the fifo using
+ * vmw_cmd_emit_dummy_gb_query - emits a dummy query to the fifo using
  * appropriate resource query commands.
  *
  * @dev_priv: The device private structure.
@@ -677,7 +649,27 @@  int vmw_cmd_emit_dummy_query(struct vmw_private *dev_priv,
 			      uint32_t cid)
 {
 	if (dev_priv->has_mob)
-		return vmw_fifo_emit_dummy_gb_query(dev_priv, cid);
+		return vmw_cmd_emit_dummy_gb_query(dev_priv, cid);
+
+	return vmw_cmd_emit_dummy_legacy_query(dev_priv, cid);
+}
 
-	return vmw_fifo_emit_dummy_legacy_query(dev_priv, cid);
+
+/**
+ * vmw_cmd_supported - returns true if the given device supports
+ * command queues.
+ *
+ * @dev_priv: The device private structure.
+ *
+ * Returns true if we can issue commands.
+ */
+bool vmw_cmd_supported(struct vmw_private *vmw)
+{
+	if ((vmw->capabilities & (SVGA_CAP_COMMAND_BUFFERS |
+				  SVGA_CAP_CMD_BUFFERS_2)) != 0)
+		return true;
+	/*
+	 * We have FIFO cmd's
+	 */
+	return vmw->fifo_mem != 0;
 }
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 22a2874116c9..3c44091ff44f 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -246,6 +246,7 @@  static const struct drm_ioctl_desc vmw_ioctls[] = {
 
 static const struct pci_device_id vmw_pci_id_list[] = {
 	{ PCI_DEVICE(0x15ad, VMWGFX_PCI_ID_SVGA2) },
+	{ PCI_DEVICE(0x15ad, VMWGFX_PCI_ID_SVGA3) },
 	{ }
 };
 MODULE_DEVICE_TABLE(pci, vmw_pci_id_list);
@@ -393,6 +394,60 @@  static int vmw_dummy_query_bo_create(struct vmw_private *dev_priv)
 	return ret;
 }
 
+static int vmw_device_init(struct vmw_private *dev_priv)
+{
+	bool uses_fb_traces = false;
+
+	DRM_INFO("width %d\n", vmw_read(dev_priv, SVGA_REG_WIDTH));
+	DRM_INFO("height %d\n", vmw_read(dev_priv, SVGA_REG_HEIGHT));
+	DRM_INFO("bpp %d\n", vmw_read(dev_priv, SVGA_REG_BITS_PER_PIXEL));
+
+	dev_priv->enable_state = vmw_read(dev_priv, SVGA_REG_ENABLE);
+	dev_priv->config_done_state = vmw_read(dev_priv, SVGA_REG_CONFIG_DONE);
+	dev_priv->traces_state = vmw_read(dev_priv, SVGA_REG_TRACES);
+
+	vmw_write(dev_priv, SVGA_REG_ENABLE, SVGA_REG_ENABLE_ENABLE |
+		  SVGA_REG_ENABLE_HIDE);
+
+	uses_fb_traces = !vmw_cmd_supported(dev_priv) &&
+			 (dev_priv->capabilities & SVGA_CAP_TRACES) != 0;
+
+	vmw_write(dev_priv, SVGA_REG_TRACES, uses_fb_traces);
+	dev_priv->fifo = vmw_fifo_create(dev_priv);
+	if (IS_ERR(dev_priv->fifo)) {
+		int err = PTR_ERR(dev_priv->fifo);
+		dev_priv->fifo = NULL;
+		return err;
+	} else if (!dev_priv->fifo) {
+		vmw_write(dev_priv, SVGA_REG_CONFIG_DONE, 1);
+	}
+
+	dev_priv->last_read_seqno = vmw_fence_read(dev_priv);
+	atomic_set(&dev_priv->marker_seq, dev_priv->last_read_seqno);
+	return 0;
+}
+
+static void vmw_device_fini(struct vmw_private *vmw)
+{
+	/*
+	 * Legacy sync
+	 */
+	vmw_write(vmw, SVGA_REG_SYNC, SVGA_SYNC_GENERIC);
+	while (vmw_read(vmw, SVGA_REG_BUSY) != 0)
+		;
+
+	vmw->last_read_seqno = vmw_fence_read(vmw);
+
+	vmw_write(vmw, SVGA_REG_CONFIG_DONE,
+		  vmw->config_done_state);
+	vmw_write(vmw, SVGA_REG_ENABLE,
+		  vmw->enable_state);
+	vmw_write(vmw, SVGA_REG_TRACES,
+		  vmw->traces_state);
+
+	vmw_fifo_destroy(vmw);
+}
+
 /**
  * vmw_request_device_late - Perform late device setup
  *
@@ -433,9 +488,9 @@  static int vmw_request_device(struct vmw_private *dev_priv)
 {
 	int ret;
 
-	ret = vmw_fifo_init(dev_priv, &dev_priv->fifo);
+	ret = vmw_device_init(dev_priv);
 	if (unlikely(ret != 0)) {
-		DRM_ERROR("Unable to initialize FIFO.\n");
+		DRM_ERROR("Unable to initialize the device.\n");
 		return ret;
 	}
 	vmw_fence_fifo_up(dev_priv->fman);
@@ -469,7 +524,7 @@  static int vmw_request_device(struct vmw_private *dev_priv)
 		vmw_cmdbuf_man_destroy(dev_priv->cman);
 out_no_mob:
 	vmw_fence_fifo_down(dev_priv->fman);
-	vmw_fifo_release(dev_priv, &dev_priv->fifo);
+	vmw_device_fini(dev_priv);
 	return ret;
 }
 
@@ -517,7 +572,7 @@  static void vmw_release_device_late(struct vmw_private *dev_priv)
 	if (dev_priv->cman)
 		vmw_cmdbuf_man_destroy(dev_priv->cman);
 
-	vmw_fifo_release(dev_priv, &dev_priv->fifo);
+	vmw_device_fini(dev_priv);
 }
 
 /*
@@ -638,6 +693,8 @@  static void vmw_vram_manager_fini(struct vmw_private *dev_priv)
 static int vmw_setup_pci_resources(struct vmw_private *dev,
 				   unsigned long pci_id)
 {
+	resource_size_t rmmio_start;
+	resource_size_t rmmio_size;
 	resource_size_t fifo_start;
 	resource_size_t fifo_size;
 	int ret;
@@ -649,23 +706,45 @@  static int vmw_setup_pci_resources(struct vmw_private *dev,
 	if (ret)
 		return ret;
 
-	dev->io_start = pci_resource_start(pdev, 0);
-	dev->vram_start = pci_resource_start(pdev, 1);
-	dev->vram_size = pci_resource_len(pdev, 1);
-	fifo_start = pci_resource_start(pdev, 2);
-	fifo_size = pci_resource_len(pdev, 2);
-
-	DRM_INFO("FIFO at %pa size is %llu kiB\n",
-		 &fifo_start, (uint64_t)fifo_size / 1024);
-	dev->fifo_mem = devm_memremap(dev->drm.dev,
-				      fifo_start,
-				      fifo_size,
-				      MEMREMAP_WB);
-
-	if (IS_ERR(dev->fifo_mem)) {
-		DRM_ERROR("Failed mapping FIFO memory.\n");
+	dev->pci_id = pci_id;
+	if (pci_id == VMWGFX_PCI_ID_SVGA3) {
+		rmmio_start = pci_resource_start(pdev, 0);
+		rmmio_size = pci_resource_len(pdev, 0);
+		dev->vram_start = pci_resource_start(pdev, 2);
+		dev->vram_size = pci_resource_len(pdev, 2);
+
+		DRM_INFO("Register MMIO at 0x%pa size is %llu kiB\n",
+			 &rmmio_start, (uint64_t)rmmio_size / 1024);
+		dev->rmmio = devm_ioremap(dev->drm.dev,
+					  rmmio_start,
+					  rmmio_size);
+		if (IS_ERR(dev->rmmio)) {
+			DRM_ERROR("Failed mapping registers mmio memory.\n");
+			pci_release_regions(pdev);
+			return PTR_ERR(dev->rmmio);
+		}
+	} else if (pci_id == VMWGFX_PCI_ID_SVGA2) {
+		dev->io_start = pci_resource_start(pdev, 0);
+		dev->vram_start = pci_resource_start(pdev, 1);
+		dev->vram_size = pci_resource_len(pdev, 1);
+		fifo_start = pci_resource_start(pdev, 2);
+		fifo_size = pci_resource_len(pdev, 2);
+
+		DRM_INFO("FIFO at %pa size is %llu kiB\n",
+			 &fifo_start, (uint64_t)fifo_size / 1024);
+		dev->fifo_mem = devm_memremap(dev->drm.dev,
+					      fifo_start,
+					      fifo_size,
+					      MEMREMAP_WB);
+
+		if (IS_ERR(dev->fifo_mem)) {
+			DRM_ERROR("Failed mapping FIFO memory.\n");
+			pci_release_regions(pdev);
+			return PTR_ERR(dev->fifo_mem);
+		}
+	} else {
 		pci_release_regions(pdev);
-		return PTR_ERR(dev->fifo_mem);
+		return -EINVAL;
 	}
 
 	/*
@@ -684,13 +763,16 @@  static int vmw_detect_version(struct vmw_private *dev)
 {
 	uint32_t svga_id;
 
-	vmw_write(dev, SVGA_REG_ID, SVGA_ID_2);
+	vmw_write(dev, SVGA_REG_ID, vmw_is_svga_v3(dev) ?
+			  SVGA_ID_3 : SVGA_ID_2);
 	svga_id = vmw_read(dev, SVGA_REG_ID);
-	if (svga_id != SVGA_ID_2) {
+	if (svga_id != SVGA_ID_2 && svga_id != SVGA_ID_3) {
 		DRM_ERROR("Unsupported SVGA ID 0x%x on chipset 0x%x\n",
 			  svga_id, dev->vmw_chipset);
 		return -ENOSYS;
 	}
+	BUG_ON(vmw_is_svga_v3(dev) && (svga_id != SVGA_ID_3));
+	DRM_INFO("Running on SVGA version %d.\n", (svga_id & 0xff));
 	return 0;
 }
 
@@ -703,7 +785,6 @@  static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)
 	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
 
 	dev_priv->vmw_chipset = pci_id;
-	dev_priv->last_read_seqno = (uint32_t) -100;
 	dev_priv->drm.dev_private = dev_priv;
 
 	mutex_init(&dev_priv->cmdbuf_mutex);
@@ -824,6 +905,8 @@  static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)
 	vmw_print_capabilities(dev_priv->capabilities);
 	if (dev_priv->capabilities & SVGA_CAP_CAP2_REGISTER)
 		vmw_print_capabilities2(dev_priv->capabilities2);
+	DRM_INFO("Supports command queues = %d\n",
+		 vmw_cmd_supported((dev_priv)));
 
 	ret = vmw_dma_masks(dev_priv);
 	if (unlikely(ret != 0))
@@ -1390,8 +1473,7 @@  static int vmw_pm_restore(struct device *kdev)
 	struct vmw_private *dev_priv = vmw_priv(dev);
 	int ret;
 
-	vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);
-	(void) vmw_read(dev_priv, SVGA_REG_ID);
+	vmw_detect_version(dev_priv);
 
 	if (dev_priv->enable_fb)
 		vmw_fifo_resource_inc(dev_priv);
@@ -1428,8 +1510,8 @@  static const struct file_operations vmwgfx_driver_fops = {
 	.release = drm_release,
 	.unlocked_ioctl = vmw_unlocked_ioctl,
 	.mmap = vmw_mmap,
-	.poll = vmw_fops_poll,
-	.read = vmw_fops_read,
+	.poll = drm_poll,
+	.read = drm_read,
 #if defined(CONFIG_COMPAT)
 	.compat_ioctl = vmw_compat_ioctl,
 #endif
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index 2fb6898ceca9..696ea7086140 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -66,6 +66,7 @@ 
 #define VMWGFX_ENABLE_SCREEN_TARGET_OTABLE 1
 
 #define VMWGFX_PCI_ID_SVGA2              0x0405
+#define VMWGFX_PCI_ID_SVGA3              0x0406
 
 /*
  * Perhaps we should have sysfs entries for these.
@@ -284,7 +285,6 @@  struct vmw_fifo_state {
 	uint32_t capabilities;
 	struct mutex fifo_mutex;
 	struct rw_semaphore rwsem;
-	bool dx;
 };
 
 /**
@@ -485,14 +485,14 @@  struct vmw_private {
 	struct drm_device drm;
 	struct ttm_device bdev;
 
-	struct vmw_fifo_state fifo;
-
 	struct drm_vma_offset_manager vma_manager;
+	unsigned long pci_id;
 	u32 vmw_chipset;
 	resource_size_t io_start;
 	resource_size_t vram_start;
 	resource_size_t vram_size;
 	resource_size_t prim_bb_mem;
+	u32 *rmmio;
 	u32 *fifo_mem;
 	resource_size_t fifo_mem_size;
 	uint32_t fb_max_width;
@@ -623,6 +623,7 @@  struct vmw_private {
 	 */
 	struct vmw_otable_batch otable_batch;
 
+	struct vmw_fifo_state *fifo;
 	struct vmw_cmdbuf_man *cman;
 	DECLARE_BITMAP(irqthread_pending, VMW_IRQTHREAD_MAX);
 
@@ -645,6 +646,14 @@  static inline struct vmw_fpriv *vmw_fpriv(struct drm_file *file_priv)
 	return (struct vmw_fpriv *)file_priv->driver_priv;
 }
 
+/*
+ * SVGA v3 has mmio register access and lacks fifo cmds
+ */
+static inline bool vmw_is_svga_v3(const struct vmw_private *dev)
+{
+	return dev->pci_id == VMWGFX_PCI_ID_SVGA3;
+}
+
 /*
  * The locking here is fine-grained, so that it is performed once
  * for every read- and write operation. This is of course costly, but we
@@ -655,10 +664,14 @@  static inline struct vmw_fpriv *vmw_fpriv(struct drm_file *file_priv)
 static inline void vmw_write(struct vmw_private *dev_priv,
 			     unsigned int offset, uint32_t value)
 {
-	spin_lock(&dev_priv->hw_lock);
-	outl(offset, dev_priv->io_start + VMWGFX_INDEX_PORT);
-	outl(value, dev_priv->io_start + VMWGFX_VALUE_PORT);
-	spin_unlock(&dev_priv->hw_lock);
+	if (vmw_is_svga_v3(dev_priv)) {
+		iowrite32(value, dev_priv->rmmio + offset);
+	} else {
+		spin_lock(&dev_priv->hw_lock);
+		outl(offset, dev_priv->io_start + SVGA_INDEX_PORT);
+		outl(value, dev_priv->io_start + SVGA_VALUE_PORT);
+		spin_unlock(&dev_priv->hw_lock);
+	}
 }
 
 static inline uint32_t vmw_read(struct vmw_private *dev_priv,
@@ -666,10 +679,14 @@  static inline uint32_t vmw_read(struct vmw_private *dev_priv,
 {
 	u32 val;
 
-	spin_lock(&dev_priv->hw_lock);
-	outl(offset, dev_priv->io_start + VMWGFX_INDEX_PORT);
-	val = inl(dev_priv->io_start + VMWGFX_VALUE_PORT);
-	spin_unlock(&dev_priv->hw_lock);
+	if (vmw_is_svga_v3(dev_priv)) {
+		val = ioread32(dev_priv->rmmio + offset);
+	} else {
+		spin_lock(&dev_priv->hw_lock);
+		outl(offset, dev_priv->io_start + SVGA_INDEX_PORT);
+		val = inl(dev_priv->io_start + SVGA_VALUE_PORT);
+		spin_unlock(&dev_priv->hw_lock);
+	}
 
 	return val;
 }
@@ -932,19 +949,14 @@  extern int vmw_present_ioctl(struct drm_device *dev, void *data,
 			     struct drm_file *file_priv);
 extern int vmw_present_readback_ioctl(struct drm_device *dev, void *data,
 				      struct drm_file *file_priv);
-extern __poll_t vmw_fops_poll(struct file *filp,
-				  struct poll_table_struct *wait);
-extern ssize_t vmw_fops_read(struct file *filp, char __user *buffer,
-			     size_t count, loff_t *offset);
 
 /**
  * Fifo utilities - vmwgfx_fifo.c
  */
 
-extern int vmw_fifo_init(struct vmw_private *dev_priv,
-			 struct vmw_fifo_state *fifo);
-extern void vmw_fifo_release(struct vmw_private *dev_priv,
-			     struct vmw_fifo_state *fifo);
+extern struct vmw_fifo_state *vmw_fifo_create(struct vmw_private *dev_priv);
+extern void vmw_fifo_destroy(struct vmw_private *dev_priv);
+extern bool vmw_cmd_supported(struct vmw_private *vmw);
 extern void *
 vmw_cmd_ctx_reserve(struct vmw_private *dev_priv, uint32_t bytes, int ctx_id);
 extern void vmw_cmd_commit(struct vmw_private *dev_priv, uint32_t bytes);
@@ -970,6 +982,31 @@  extern int vmw_cmd_flush(struct vmw_private *dev_priv,
 #define VMW_CMD_RESERVE(__priv, __bytes)                                     \
 	VMW_CMD_CTX_RESERVE(__priv, __bytes, SVGA3D_INVALID_ID)
 
+
+/**
+ * vmw_fifo_caps - Returns the capabilities of the FIFO command
+ * queue or 0 if fifo memory isn't present.
+ * @dev_priv: The device private context
+ */
+static inline uint32_t vmw_fifo_caps(const struct vmw_private *dev_priv)
+{
+	if (!dev_priv->fifo_mem || !dev_priv->fifo)
+		return 0;
+	return dev_priv->fifo->capabilities;
+}
+
+
+/**
+ * vmw_is_cursor_bypass3_enabled - Returns TRUE iff Cursor Bypass 3
+ * is enabled in the FIFO.
+ * @dev_priv: The device private context
+ */
+static inline bool
+vmw_is_cursor_bypass3_enabled(const struct vmw_private *dev_priv)
+{
+	return (vmw_fifo_caps(dev_priv) & SVGA_FIFO_CAP_CURSOR_BYPASS_3) != 0;
+}
+
 /**
  * TTM glue - vmwgfx_ttm_glue.c
  */
@@ -1079,9 +1116,6 @@  bool vmw_cmd_describe(const void *buf, u32 *size, char const **cmd);
  * IRQs and wating - vmwgfx_irq.c
  */
 
-extern int vmw_wait_seqno(struct vmw_private *dev_priv, bool lazy,
-			  uint32_t seqno, bool interruptible,
-			  unsigned long timeout);
 extern int vmw_irq_install(struct drm_device *dev, int irq);
 extern void vmw_irq_uninstall(struct drm_device *dev);
 extern bool vmw_seqno_passed(struct vmw_private *dev_priv,
@@ -1092,8 +1126,7 @@  extern int vmw_fallback_wait(struct vmw_private *dev_priv,
 			     uint32_t seqno,
 			     bool interruptible,
 			     unsigned long timeout);
-extern void vmw_update_seqno(struct vmw_private *dev_priv,
-				struct vmw_fifo_state *fifo_state);
+extern void vmw_update_seqno(struct vmw_private *dev_priv);
 extern void vmw_seqno_waiter_add(struct vmw_private *dev_priv);
 extern void vmw_seqno_waiter_remove(struct vmw_private *dev_priv);
 extern void vmw_goal_waiter_add(struct vmw_private *dev_priv);
@@ -1572,6 +1605,7 @@  static inline void vmw_fifo_resource_dec(struct vmw_private *dev_priv)
  */
 static inline u32 vmw_fifo_mem_read(struct vmw_private *vmw, uint32 fifo_reg)
 {
+	BUG_ON(vmw_is_svga_v3(vmw));
 	return READ_ONCE(*(vmw->fifo_mem + fifo_reg));
 }
 
@@ -1586,6 +1620,44 @@  static inline u32 vmw_fifo_mem_read(struct vmw_private *vmw, uint32 fifo_reg)
 static inline void vmw_fifo_mem_write(struct vmw_private *vmw, u32 fifo_reg,
 				      u32 value)
 {
+	BUG_ON(vmw_is_svga_v3(vmw));
 	WRITE_ONCE(*(vmw->fifo_mem + fifo_reg), value);
 }
+
+static inline u32 vmw_fence_read(struct vmw_private *dev_priv)
+{
+	u32 fence;
+	if (vmw_is_svga_v3(dev_priv))
+		fence = vmw_read(dev_priv, SVGA_REG_FENCE);
+	else
+		fence = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_FENCE);
+	return fence;
+}
+
+static inline void vmw_fence_write(struct vmw_private *dev_priv,
+				  u32 fence)
+{
+	BUG_ON(vmw_is_svga_v3(dev_priv));
+	vmw_fifo_mem_write(dev_priv, SVGA_FIFO_FENCE, fence);
+}
+
+static inline u32 vmw_irq_status_read(struct vmw_private *vmw)
+{
+	u32 status;
+	if (vmw_is_svga_v3(vmw))
+		status = vmw_read(vmw, SVGA_REG_IRQ_STATUS);
+	else
+		status = inl(vmw->io_start + SVGA_IRQSTATUS_PORT);
+	return status;
+}
+
+static inline void vmw_irq_status_write(struct vmw_private *vmw,
+					uint32 status)
+{
+	if (vmw_is_svga_v3(vmw))
+		vmw_write(vmw, SVGA_REG_IRQ_STATUS, status);
+	else
+		outl(status, vmw->io_start + SVGA_IRQSTATUS_PORT);
+}
+
 #endif
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 3ad07657b7d2..b79a2ba68411 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -3841,7 +3841,7 @@  vmw_execbuf_copy_fence_user(struct vmw_private *dev_priv,
 
 		fence_rep.handle = fence_handle;
 		fence_rep.seqno = fence->base.seqno;
-		vmw_update_seqno(dev_priv, &dev_priv->fifo);
+		vmw_update_seqno(dev_priv);
 		fence_rep.passed_seqno = dev_priv->last_read_seqno;
 	}
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
index 23523eb3cac2..7fe744da9919 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
@@ -139,12 +139,10 @@  static bool vmw_fence_enable_signaling(struct dma_fence *f)
 	struct vmw_fence_manager *fman = fman_from_fence(fence);
 	struct vmw_private *dev_priv = fman->dev_priv;
 
-	u32 seqno = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_FENCE);
+	u32 seqno = vmw_fence_read(dev_priv);
 	if (seqno - fence->base.seqno < VMW_FENCE_WRAP)
 		return false;
 
-	vmw_fifo_ping_host(dev_priv, SVGA_SYNC_GENERIC);
-
 	return true;
 }
 
@@ -177,7 +175,6 @@  static long vmw_fence_wait(struct dma_fence *f, bool intr, signed long timeout)
 	if (likely(vmw_fence_obj_signaled(fence)))
 		return timeout;
 
-	vmw_fifo_ping_host(dev_priv, SVGA_SYNC_GENERIC);
 	vmw_seqno_waiter_add(dev_priv);
 
 	spin_lock(f->lock);
@@ -464,7 +461,7 @@  static void __vmw_fences_update(struct vmw_fence_manager *fman)
 	bool needs_rerun;
 	uint32_t seqno, new_seqno;
 
-	seqno = vmw_fifo_mem_read(fman->dev_priv, SVGA_FIFO_FENCE);
+	seqno = vmw_fence_read(fman->dev_priv);
 rerun:
 	list_for_each_entry_safe(fence, next_fence, &fman->fence_list, head) {
 		if (seqno - fence->base.seqno < VMW_FENCE_WRAP) {
@@ -486,7 +483,7 @@  static void __vmw_fences_update(struct vmw_fence_manager *fman)
 
 	needs_rerun = vmw_fence_goal_new_locked(fman, seqno);
 	if (unlikely(needs_rerun)) {
-		new_seqno = vmw_fifo_mem_read(fman->dev_priv, SVGA_FIFO_FENCE);
+		new_seqno = vmw_fence_read(fman->dev_priv);
 		if (new_seqno != seqno) {
 			seqno = new_seqno;
 			goto rerun;
@@ -529,13 +526,6 @@  int vmw_fence_obj_wait(struct vmw_fence_obj *fence, bool lazy,
 		return ret;
 }
 
-void vmw_fence_obj_flush(struct vmw_fence_obj *fence)
-{
-	struct vmw_private *dev_priv = fman_from_fence(fence)->dev_priv;
-
-	vmw_fifo_ping_host(dev_priv, SVGA_SYNC_GENERIC);
-}
-
 static void vmw_fence_destroy(struct vmw_fence_obj *fence)
 {
 	dma_fence_free(&fence->base);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.h b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.h
index 50e9fdd7acf1..079ab4f3ba51 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.h
@@ -94,8 +94,6 @@  extern int vmw_fence_obj_wait(struct vmw_fence_obj *fence,
 			      bool lazy,
 			      bool interruptible, unsigned long timeout);
 
-extern void vmw_fence_obj_flush(struct vmw_fence_obj *fence);
-
 extern int vmw_fence_create(struct vmw_fence_manager *fman,
 			    uint32_t seqno,
 			    struct vmw_fence_obj **p_fence);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
index 6763d0638450..4fdacf9924e6 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
@@ -60,15 +60,13 @@  int vmw_getparam_ioctl(struct drm_device *dev, void *data,
 		param->value = dev_priv->capabilities2;
 		break;
 	case DRM_VMW_PARAM_FIFO_CAPS:
-		param->value = dev_priv->fifo.capabilities;
+		param->value = vmw_fifo_caps(dev_priv);
 		break;
 	case DRM_VMW_PARAM_MAX_FB_SIZE:
 		param->value = dev_priv->prim_bb_mem;
 		break;
 	case DRM_VMW_PARAM_FIFO_HW_VERSION:
 	{
-		const struct vmw_fifo_state *fifo = &dev_priv->fifo;
-
 		if ((dev_priv->capabilities & SVGA_CAP_GBOBJECTS)) {
 			param->value = SVGA3D_HWVERSION_WS8_B1;
 			break;
@@ -76,7 +74,7 @@  int vmw_getparam_ioctl(struct drm_device *dev, void *data,
 
 		param->value =
 			vmw_fifo_mem_read(dev_priv,
-					  ((fifo->capabilities &
+					  ((vmw_fifo_caps(dev_priv) &
 					    SVGA_FIFO_CAP_3D_HWVERSION_REVISED) ?
 						   SVGA_FIFO_3D_HWVERSION_REVISED :
 						   SVGA_FIFO_3D_HWVERSION));
@@ -398,46 +396,3 @@  int vmw_present_readback_ioctl(struct drm_device *dev, void *data,
 out_clips:
 	return ret;
 }
-
-
-/**
- * vmw_fops_poll - wrapper around the drm_poll function
- *
- * @filp: See the linux fops poll documentation.
- * @wait: See the linux fops poll documentation.
- *
- * Wrapper around the drm_poll function that makes sure the device is
- * processing the fifo if drm_poll decides to wait.
- */
-__poll_t vmw_fops_poll(struct file *filp, struct poll_table_struct *wait)
-{
-	struct drm_file *file_priv = filp->private_data;
-	struct vmw_private *dev_priv =
-		vmw_priv(file_priv->minor->dev);
-
-	vmw_fifo_ping_host(dev_priv, SVGA_SYNC_GENERIC);
-	return drm_poll(filp, wait);
-}
-
-
-/**
- * vmw_fops_read - wrapper around the drm_read function
- *
- * @filp: See the linux fops read documentation.
- * @buffer: See the linux fops read documentation.
- * @count: See the linux fops read documentation.
- * @offset: See the linux fops read documentation.
- *
- * Wrapper around the drm_read function that makes sure the device is
- * processing the fifo if drm_read decides to wait.
- */
-ssize_t vmw_fops_read(struct file *filp, char __user *buffer,
-		      size_t count, loff_t *offset)
-{
-	struct drm_file *file_priv = filp->private_data;
-	struct vmw_private *dev_priv =
-		vmw_priv(file_priv->minor->dev);
-
-	vmw_fifo_ping_host(dev_priv, SVGA_SYNC_GENERIC);
-	return drm_read(filp, buffer, count, offset);
-}
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c b/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
index 6c2a569f1fcb..dafc5fa65bb2 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
@@ -82,11 +82,11 @@  static irqreturn_t vmw_irq_handler(int irq, void *arg)
 	uint32_t status, masked_status;
 	irqreturn_t ret = IRQ_HANDLED;
 
-	status = inl(dev_priv->io_start + VMWGFX_IRQSTATUS_PORT);
+	status = vmw_irq_status_read(dev_priv);
 	masked_status = status & READ_ONCE(dev_priv->irq_mask);
 
 	if (likely(status))
-		outl(status, dev_priv->io_start + VMWGFX_IRQSTATUS_PORT);
+		vmw_irq_status_write(dev_priv, status);
 
 	if (!status)
 		return IRQ_NONE;
@@ -114,10 +114,9 @@  static bool vmw_fifo_idle(struct vmw_private *dev_priv, uint32_t seqno)
 	return (vmw_read(dev_priv, SVGA_REG_BUSY) == 0);
 }
 
-void vmw_update_seqno(struct vmw_private *dev_priv,
-			 struct vmw_fifo_state *fifo_state)
+void vmw_update_seqno(struct vmw_private *dev_priv)
 {
-	uint32_t seqno = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_FENCE);
+	uint32_t seqno = vmw_fence_read(dev_priv);
 
 	if (dev_priv->last_read_seqno != seqno) {
 		dev_priv->last_read_seqno = seqno;
@@ -128,18 +127,16 @@  void vmw_update_seqno(struct vmw_private *dev_priv,
 bool vmw_seqno_passed(struct vmw_private *dev_priv,
 			 uint32_t seqno)
 {
-	struct vmw_fifo_state *fifo_state;
 	bool ret;
 
 	if (likely(dev_priv->last_read_seqno - seqno < VMW_FENCE_WRAP))
 		return true;
 
-	fifo_state = &dev_priv->fifo;
-	vmw_update_seqno(dev_priv, fifo_state);
+	vmw_update_seqno(dev_priv);
 	if (likely(dev_priv->last_read_seqno - seqno < VMW_FENCE_WRAP))
 		return true;
 
-	if (!(fifo_state->capabilities & SVGA_FIFO_CAP_FENCE) &&
+	if (!(vmw_fifo_caps(dev_priv) & SVGA_FIFO_CAP_FENCE) &&
 	    vmw_fifo_idle(dev_priv, seqno))
 		return true;
 
@@ -161,7 +158,7 @@  int vmw_fallback_wait(struct vmw_private *dev_priv,
 		      bool interruptible,
 		      unsigned long timeout)
 {
-	struct vmw_fifo_state *fifo_state = &dev_priv->fifo;
+	struct vmw_fifo_state *fifo_state = dev_priv->fifo;
 
 	uint32_t count = 0;
 	uint32_t signal_seq;
@@ -221,7 +218,7 @@  int vmw_fallback_wait(struct vmw_private *dev_priv,
 	}
 	finish_wait(&dev_priv->fence_queue, &__wait);
 	if (ret == 0 && fifo_idle)
-		vmw_fifo_mem_write(dev_priv, SVGA_FIFO_FENCE, signal_seq);
+		vmw_fence_write(dev_priv, signal_seq);
 
 	wake_up_all(&dev_priv->fence_queue);
 out_err:
@@ -236,7 +233,7 @@  void vmw_generic_waiter_add(struct vmw_private *dev_priv,
 {
 	spin_lock_bh(&dev_priv->waiter_lock);
 	if ((*waiter_count)++ == 0) {
-		outl(flag, dev_priv->io_start + VMWGFX_IRQSTATUS_PORT);
+		vmw_irq_status_write(dev_priv, flag);
 		dev_priv->irq_mask |= flag;
 		vmw_write(dev_priv, SVGA_REG_IRQMASK, dev_priv->irq_mask);
 	}
@@ -278,59 +275,13 @@  void vmw_goal_waiter_remove(struct vmw_private *dev_priv)
 				  &dev_priv->goal_queue_waiters);
 }
 
-int vmw_wait_seqno(struct vmw_private *dev_priv,
-		      bool lazy, uint32_t seqno,
-		      bool interruptible, unsigned long timeout)
-{
-	long ret;
-	struct vmw_fifo_state *fifo = &dev_priv->fifo;
-
-	if (likely(dev_priv->last_read_seqno - seqno < VMW_FENCE_WRAP))
-		return 0;
-
-	if (likely(vmw_seqno_passed(dev_priv, seqno)))
-		return 0;
-
-	vmw_fifo_ping_host(dev_priv, SVGA_SYNC_GENERIC);
-
-	if (!(fifo->capabilities & SVGA_FIFO_CAP_FENCE))
-		return vmw_fallback_wait(dev_priv, lazy, true, seqno,
-					 interruptible, timeout);
-
-	if (!(dev_priv->capabilities & SVGA_CAP_IRQMASK))
-		return vmw_fallback_wait(dev_priv, lazy, false, seqno,
-					 interruptible, timeout);
-
-	vmw_seqno_waiter_add(dev_priv);
-
-	if (interruptible)
-		ret = wait_event_interruptible_timeout
-		    (dev_priv->fence_queue,
-		     vmw_seqno_passed(dev_priv, seqno),
-		     timeout);
-	else
-		ret = wait_event_timeout
-		    (dev_priv->fence_queue,
-		     vmw_seqno_passed(dev_priv, seqno),
-		     timeout);
-
-	vmw_seqno_waiter_remove(dev_priv);
-
-	if (unlikely(ret == 0))
-		ret = -EBUSY;
-	else if (likely(ret > 0))
-		ret = 0;
-
-	return ret;
-}
-
 static void vmw_irq_preinstall(struct drm_device *dev)
 {
 	struct vmw_private *dev_priv = vmw_priv(dev);
 	uint32_t status;
 
-	status = inl(dev_priv->io_start + VMWGFX_IRQSTATUS_PORT);
-	outl(status, dev_priv->io_start + VMWGFX_IRQSTATUS_PORT);
+	status = vmw_irq_status_read(dev_priv);
+	vmw_irq_status_write(dev_priv, status);
 }
 
 void vmw_irq_uninstall(struct drm_device *dev)
@@ -346,8 +297,8 @@  void vmw_irq_uninstall(struct drm_device *dev)
 
 	vmw_write(dev_priv, SVGA_REG_IRQMASK, 0);
 
-	status = inl(dev_priv->io_start + VMWGFX_IRQSTATUS_PORT);
-	outl(status, dev_priv->io_start + VMWGFX_IRQSTATUS_PORT);
+	status = vmw_irq_status_read(dev_priv);
+	vmw_irq_status_write(dev_priv, status);
 
 	dev->irq_enabled = false;
 	free_irq(dev->irq, dev);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 67f693acea5f..2768ab1f60a1 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -38,8 +38,10 @@ 
 
 void vmw_du_cleanup(struct vmw_display_unit *du)
 {
+	struct vmw_private *dev_priv = vmw_priv(du->primary.dev);
 	drm_plane_cleanup(&du->primary);
-	drm_plane_cleanup(&du->cursor);
+	if (vmw_cmd_supported(dev_priv))
+		drm_plane_cleanup(&du->cursor);
 
 	drm_connector_unregister(&du->connector);
 	drm_crtc_cleanup(&du->crtc);
@@ -128,11 +130,17 @@  static void vmw_cursor_update_position(struct vmw_private *dev_priv,
 	uint32_t count;
 
 	spin_lock(&dev_priv->cursor_lock);
-	vmw_fifo_mem_write(dev_priv, SVGA_FIFO_CURSOR_ON, show ? 1 : 0);
-	vmw_fifo_mem_write(dev_priv, SVGA_FIFO_CURSOR_X, x);
-	vmw_fifo_mem_write(dev_priv, SVGA_FIFO_CURSOR_Y, y);
-	count = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_CURSOR_COUNT);
-	vmw_fifo_mem_write(dev_priv, SVGA_FIFO_CURSOR_COUNT, ++count);
+	if (vmw_is_cursor_bypass3_enabled(dev_priv)) {
+		vmw_fifo_mem_write(dev_priv, SVGA_FIFO_CURSOR_ON, show ? 1 : 0);
+		vmw_fifo_mem_write(dev_priv, SVGA_FIFO_CURSOR_X, x);
+		vmw_fifo_mem_write(dev_priv, SVGA_FIFO_CURSOR_Y, y);
+		count = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_CURSOR_COUNT);
+		vmw_fifo_mem_write(dev_priv, SVGA_FIFO_CURSOR_COUNT, ++count);
+	} else {
+		vmw_write(dev_priv, SVGA_REG_CURSOR_X, x);
+		vmw_write(dev_priv, SVGA_REG_CURSOR_Y, y);
+		vmw_write(dev_priv, SVGA_REG_CURSOR_ON, show ? 1 : 0);
+	}
 	spin_unlock(&dev_priv->cursor_lock);
 }
 
@@ -1045,7 +1053,8 @@  static int vmw_framebuffer_bo_dirty_ext(struct drm_framebuffer *framebuffer,
 {
 	struct vmw_private *dev_priv = vmw_priv(framebuffer->dev);
 
-	if (dev_priv->active_display_unit == vmw_du_legacy)
+	if (dev_priv->active_display_unit == vmw_du_legacy &&
+	    vmw_cmd_supported(dev_priv))
 		return vmw_framebuffer_bo_dirty(framebuffer, file_priv, flags,
 						color, clips, num_clips);
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index 87e0b303d900..d85c7eab9469 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -404,19 +404,24 @@  static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
 
 	drm_plane_helper_add(primary, &vmw_ldu_primary_plane_helper_funcs);
 
-	/* Initialize cursor plane */
-	ret = drm_universal_plane_init(dev, &ldu->base.cursor,
-			0, &vmw_ldu_cursor_funcs,
-			vmw_cursor_plane_formats,
-			ARRAY_SIZE(vmw_cursor_plane_formats),
-			NULL, DRM_PLANE_TYPE_CURSOR, NULL);
-	if (ret) {
-		DRM_ERROR("Failed to initialize cursor plane");
-		drm_plane_cleanup(&ldu->base.primary);
-		goto err_free;
-	}
+	/*
+	 * We're going to be using traces and software cursors
+	 */
+	if (vmw_cmd_supported(dev_priv)) {
+		/* Initialize cursor plane */
+		ret = drm_universal_plane_init(dev, &ldu->base.cursor,
+					       0, &vmw_ldu_cursor_funcs,
+					       vmw_cursor_plane_formats,
+					       ARRAY_SIZE(vmw_cursor_plane_formats),
+					       NULL, DRM_PLANE_TYPE_CURSOR, NULL);
+		if (ret) {
+			DRM_ERROR("Failed to initialize cursor plane");
+			drm_plane_cleanup(&ldu->base.primary);
+			goto err_free;
+		}
 
-	drm_plane_helper_add(cursor, &vmw_ldu_cursor_plane_helper_funcs);
+		drm_plane_helper_add(cursor, &vmw_ldu_cursor_plane_helper_funcs);
+	}
 
 	ret = drm_connector_init(dev, connector, &vmw_legacy_connector_funcs,
 				 DRM_MODE_CONNECTOR_VIRTUAL);
@@ -445,9 +450,10 @@  static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
 		goto err_free_encoder;
 	}
 
-	ret = drm_crtc_init_with_planes(dev, crtc, &ldu->base.primary,
-					&ldu->base.cursor,
-					&vmw_legacy_crtc_funcs, NULL);
+	ret = drm_crtc_init_with_planes(
+		      dev, crtc, &ldu->base.primary,
+		      vmw_cmd_supported(dev_priv) ? &ldu->base.cursor : NULL,
+		      &vmw_legacy_crtc_funcs, NULL);
 	if (ret) {
 		DRM_ERROR("Failed to initialize CRTC\n");
 		goto err_free_unregister;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
index ac4a9b722279..54c5d16eb3b7 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
@@ -421,7 +421,7 @@  int vmw_overlay_pause_all(struct vmw_private *dev_priv)
 static bool vmw_overlay_available(const struct vmw_private *dev_priv)
 {
 	return (dev_priv->overlay_priv != NULL &&
-		((dev_priv->fifo.capabilities & VMW_OVERLAY_CAP_MASK) ==
+		((vmw_fifo_caps(dev_priv) & VMW_OVERLAY_CAP_MASK) ==
 		 VMW_OVERLAY_CAP_MASK));
 }
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_reg.h b/drivers/gpu/drm/vmwgfx/vmwgfx_reg.h
index e99f6cdbb091..cf585dfe5669 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_reg.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_reg.h
@@ -34,10 +34,6 @@ 
 
 #include <linux/types.h>
 
-#define VMWGFX_INDEX_PORT     0x0
-#define VMWGFX_VALUE_PORT     0x1
-#define VMWGFX_IRQSTATUS_PORT 0x8
-
 struct svga_guest_mem_descriptor {
 	u32 ppn;
 	u32 num_pages;