Re: [PATCH v2 3/8] drm/vmwgfx: Rename vmw_buffer_object to vmw_bo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/30/23 19:35, Zack Rusin wrote:
> From: Zack Rusin <zackr@xxxxxxxxxx>
> 
> The rest of the drivers which are using ttm have mostly standardized on
> driver_prefix_bo as the name for subclasses of the TTM buffer object.
> Make vmwgfx match the rest of the drivers and follow the same naming
> semantics.
> 
> This is especially clear given that the name of the file in which the
> object was defined is vmw_bo.c.
> 
> Signed-off-by: Zack Rusin <zackr@xxxxxxxxxx>
> Reviewed-by: Martin Krastev <krastevm@xxxxxxxxxx>
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_bo.c           |  94 ++++-----
>  drivers/gpu/drm/vmwgfx/vmwgfx_bo.h           | 189 +++++++++++++++++++
>  drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c          |  10 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c       |   9 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_context.c      |  11 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c      |   9 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_drv.c          |   7 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_drv.h          | 184 ++----------------
>  drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c      |  53 +++---
>  drivers/gpu/drm/vmwgfx/vmwgfx_fence.c        |   2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_gem.c          |  27 +--
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c          |  17 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.h          |  12 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_mob.c          |   7 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c      |  18 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c   |  27 +--
>  drivers/gpu/drm/vmwgfx/vmwgfx_resource.c     |  29 +--
>  drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c         |  15 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_shader.c       |  15 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c         |  13 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_streamoutput.c |   9 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_surface.c      |   9 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c   |   3 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_validation.c   |  30 +--
>  drivers/gpu/drm/vmwgfx/vmwgfx_validation.h   |   6 +-
>  25 files changed, 419 insertions(+), 386 deletions(-)
>  create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_bo.h
> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
> index 8aaeeecd2016..b6dc0baef350 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright © 2011-2018 VMware, Inc., Palo Alto, CA., USA
> + * Copyright © 2011-2023 VMware, Inc., Palo Alto, CA., USA
>   * All Rights Reserved.
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
> @@ -26,55 +26,41 @@
>   *
>   **************************************************************************/
>  
> -#include <drm/ttm/ttm_placement.h>
> -
> +#include "vmwgfx_bo.h"
>  #include "vmwgfx_drv.h"
> -#include "ttm_object.h"
>  
>  
> -/**
> - * vmw_buffer_object - Convert a struct ttm_buffer_object to a struct
> - * vmw_buffer_object.
> - *
> - * @bo: Pointer to the TTM buffer object.
> - * Return: Pointer to the struct vmw_buffer_object embedding the
> - * TTM buffer object.
> - */
> -static struct vmw_buffer_object *
> -vmw_buffer_object(struct ttm_buffer_object *bo)
> -{
> -	return container_of(bo, struct vmw_buffer_object, base);
> -}
> +#include <drm/ttm/ttm_placement.h>
>  
>  /**
> - * vmw_bo_bo_free - vmw buffer object destructor
> + * vmw_bo_free - vmw_bo destructor
>   *
>   * @bo: Pointer to the embedded struct ttm_buffer_object
>   */
> -static void vmw_bo_bo_free(struct ttm_buffer_object *bo)
> +static void vmw_bo_free(struct ttm_buffer_object *bo)
>  {
> -	struct vmw_buffer_object *vmw_bo = vmw_buffer_object(bo);
> +	struct vmw_bo *vbo = to_vmw_bo(&bo->base);
>  
> -	WARN_ON(vmw_bo->dirty);
> -	WARN_ON(!RB_EMPTY_ROOT(&vmw_bo->res_tree));
> -	vmw_bo_unmap(vmw_bo);
> +	WARN_ON(vbo->dirty);
> +	WARN_ON(!RB_EMPTY_ROOT(&vbo->res_tree));
> +	vmw_bo_unmap(vbo);
>  	drm_gem_object_release(&bo->base);
> -	kfree(vmw_bo);
> +	kfree(vbo);
>  }
>  
>  /**
> - * bo_is_vmw - check if the buffer object is a &vmw_buffer_object
> + * bo_is_vmw - check if the buffer object is a &vmw_bo
>   * @bo: ttm buffer object to be checked
>   *
>   * Uses destroy function associated with the object to determine if this is
> - * a &vmw_buffer_object.
> + * a &vmw_bo.
>   *
>   * Returns:
> - * true if the object is of &vmw_buffer_object type, false if not.
> + * true if the object is of &vmw_bo type, false if not.
>   */
>  static bool bo_is_vmw(struct ttm_buffer_object *bo)
>  {
> -	return bo->destroy == &vmw_bo_bo_free;
> +	return bo->destroy == &vmw_bo_free;
>  }
>  
>  /**
> @@ -88,7 +74,7 @@ static bool bo_is_vmw(struct ttm_buffer_object *bo)
>   * -ERESTARTSYS if interrupted by a signal
>   */
>  int vmw_bo_pin_in_placement(struct vmw_private *dev_priv,
> -			    struct vmw_buffer_object *buf,
> +			    struct vmw_bo *buf,
>  			    struct ttm_placement *placement,
>  			    bool interruptible)
>  {
> @@ -130,7 +116,7 @@ int vmw_bo_pin_in_placement(struct vmw_private *dev_priv,
>   * -ERESTARTSYS if interrupted by a signal
>   */
>  int vmw_bo_pin_in_vram_or_gmr(struct vmw_private *dev_priv,
> -			      struct vmw_buffer_object *buf,
> +			      struct vmw_bo *buf,
>  			      bool interruptible)
>  {
>  	struct ttm_operation_ctx ctx = {interruptible, false };
> @@ -178,7 +164,7 @@ int vmw_bo_pin_in_vram_or_gmr(struct vmw_private *dev_priv,
>   * -ERESTARTSYS if interrupted by a signal
>   */
>  int vmw_bo_pin_in_vram(struct vmw_private *dev_priv,
> -		       struct vmw_buffer_object *buf,
> +		       struct vmw_bo *buf,
>  		       bool interruptible)
>  {
>  	return vmw_bo_pin_in_placement(dev_priv, buf, &vmw_vram_placement,
> @@ -199,7 +185,7 @@ int vmw_bo_pin_in_vram(struct vmw_private *dev_priv,
>   * -ERESTARTSYS if interrupted by a signal
>   */
>  int vmw_bo_pin_in_start_of_vram(struct vmw_private *dev_priv,
> -				struct vmw_buffer_object *buf,
> +				struct vmw_bo *buf,
>  				bool interruptible)
>  {
>  	struct ttm_operation_ctx ctx = {interruptible, false };
> @@ -263,7 +249,7 @@ int vmw_bo_pin_in_start_of_vram(struct vmw_private *dev_priv,
>   * -ERESTARTSYS if interrupted by a signal
>   */
>  int vmw_bo_unpin(struct vmw_private *dev_priv,
> -		 struct vmw_buffer_object *buf,
> +		 struct vmw_bo *buf,
>  		 bool interruptible)
>  {
>  	struct ttm_buffer_object *bo = &buf->base;
> @@ -308,7 +294,7 @@ void vmw_bo_get_guest_ptr(const struct ttm_buffer_object *bo,
>   * @pin: Whether to pin or unpin.
>   *
>   */
> -void vmw_bo_pin_reserved(struct vmw_buffer_object *vbo, bool pin)
> +void vmw_bo_pin_reserved(struct vmw_bo *vbo, bool pin)
>  {
>  	struct ttm_operation_ctx ctx = { false, true };
>  	struct ttm_place pl;
> @@ -356,7 +342,7 @@ void vmw_bo_pin_reserved(struct vmw_buffer_object *vbo, bool pin)
>   * 3) Buffer object destruction
>   *
>   */
> -void *vmw_bo_map_and_cache(struct vmw_buffer_object *vbo)
> +void *vmw_bo_map_and_cache(struct vmw_bo *vbo)
>  {
>  	struct ttm_buffer_object *bo = &vbo->base;
>  	bool not_used;
> @@ -381,9 +367,9 @@ void *vmw_bo_map_and_cache(struct vmw_buffer_object *vbo)
>   * @vbo: The buffer object whose map we are tearing down.
>   *
>   * This function tears down a cached map set up using
> - * vmw_buffer_object_map_and_cache().
> + * vmw_bo_map_and_cache().
>   */
> -void vmw_bo_unmap(struct vmw_buffer_object *vbo)
> +void vmw_bo_unmap(struct vmw_bo *vbo)
>  {
>  	if (vbo->map.bo == NULL)
>  		return;
> @@ -447,7 +433,7 @@ int vmw_bo_create_kernel(struct vmw_private *dev_priv, unsigned long size,
>  int vmw_bo_create(struct vmw_private *vmw,
>  		  size_t size, struct ttm_placement *placement,
>  		  bool interruptible, bool pin,
> -		  struct vmw_buffer_object **p_bo)
> +		  struct vmw_bo **p_bo)
>  {
>  	int ret;
>  
> @@ -473,7 +459,7 @@ int vmw_bo_create(struct vmw_private *vmw,
>   * vmw_bo_init - Initialize a vmw buffer object
>   *
>   * @dev_priv: Pointer to the device private struct
> - * @vmw_bo: Pointer to the struct vmw_buffer_object to initialize.
> + * @vmw_bo: Pointer to the struct vmw_bo to initialize.
>   * @size: Buffer object size in bytes.
>   * @placement: Initial placement.
>   * @interruptible: Whether waits should be performed interruptible.
> @@ -483,7 +469,7 @@ int vmw_bo_create(struct vmw_private *vmw,
>   * Note that on error, the code will free the buffer object.
>   */
>  int vmw_bo_init(struct vmw_private *dev_priv,
> -		struct vmw_buffer_object *vmw_bo,
> +		struct vmw_bo *vmw_bo,
>  		size_t size, struct ttm_placement *placement,
>  		bool interruptible, bool pin)
>  {
> @@ -504,7 +490,7 @@ int vmw_bo_init(struct vmw_private *dev_priv,
>  	drm_gem_private_object_init(vdev, &vmw_bo->base.base, size);
>  
>  	ret = ttm_bo_init_reserved(bdev, &vmw_bo->base, ttm_bo_type_device,
> -				   placement, 0, &ctx, NULL, NULL, vmw_bo_bo_free);
> +				   placement, 0, &ctx, NULL, NULL, vmw_bo_free);
>  	if (unlikely(ret)) {
>  		return ret;
>  	}
> @@ -517,7 +503,7 @@ int vmw_bo_init(struct vmw_private *dev_priv,
>  }
>  
>  /**
> - * vmw_user_bo_synccpu_grab - Grab a struct vmw_buffer_object for cpu
> + * vmw_user_bo_synccpu_grab - Grab a struct vmw_bo for cpu
>   * access, idling previous GPU operations on the buffer and optionally
>   * blocking it for further command submissions.
>   *
> @@ -530,7 +516,7 @@ int vmw_bo_init(struct vmw_private *dev_priv,
>   *
>   * A blocking grab will be automatically released when @tfile is closed.
>   */
> -static int vmw_user_bo_synccpu_grab(struct vmw_buffer_object *vmw_bo,
> +static int vmw_user_bo_synccpu_grab(struct vmw_bo *vmw_bo,
>  				    uint32_t flags)
>  {
>  	bool nonblock = !!(flags & drm_vmw_synccpu_dontblock);
> @@ -577,7 +563,7 @@ static int vmw_user_bo_synccpu_release(struct drm_file *filp,
>  				       uint32_t handle,
>  				       uint32_t flags)
>  {
> -	struct vmw_buffer_object *vmw_bo;
> +	struct vmw_bo *vmw_bo;
>  	int ret = vmw_user_bo_lookup(filp, handle, &vmw_bo);
>  
>  	if (!ret) {
> @@ -608,7 +594,7 @@ int vmw_user_bo_synccpu_ioctl(struct drm_device *dev, void *data,
>  {
>  	struct drm_vmw_synccpu_arg *arg =
>  		(struct drm_vmw_synccpu_arg *) data;
> -	struct vmw_buffer_object *vbo;
> +	struct vmw_bo *vbo;
>  	int ret;
>  
>  	if ((arg->flags & (drm_vmw_synccpu_read | drm_vmw_synccpu_write)) == 0
> @@ -681,14 +667,14 @@ int vmw_bo_unref_ioctl(struct drm_device *dev, void *data,
>   * @filp: The file the handle is registered with.
>   * @handle: The user buffer object handle
>   * @out: Pointer to a where a pointer to the embedded
> - * struct vmw_buffer_object should be placed.
> + * struct vmw_bo should be placed.
>   * Return: Zero on success, Negative error code on error.
>   *
>   * The vmw buffer object pointer will be refcounted.
>   */
>  int vmw_user_bo_lookup(struct drm_file *filp,
>  		       uint32_t handle,
> -		       struct vmw_buffer_object **out)
> +		       struct vmw_bo **out)
>  {
>  	struct drm_gem_object *gobj;
>  
> @@ -699,7 +685,7 @@ int vmw_user_bo_lookup(struct drm_file *filp,
>  		return -ESRCH;
>  	}
>  
> -	*out = gem_to_vmw_bo(gobj);
> +	*out = to_vmw_bo(gobj);
>  	ttm_bo_get(&(*out)->base);
>  	drm_gem_object_put(gobj);
>  
> @@ -759,7 +745,7 @@ int vmw_dumb_create(struct drm_file *file_priv,
>  		    struct drm_mode_create_dumb *args)
>  {
>  	struct vmw_private *dev_priv = vmw_priv(dev);
> -	struct vmw_buffer_object *vbo;
> +	struct vmw_bo *vbo;
>  	int cpp = DIV_ROUND_UP(args->bpp, 8);
>  	int ret;
>  
> @@ -793,12 +779,12 @@ int vmw_dumb_create(struct drm_file *file_priv,
>   */
>  void vmw_bo_swap_notify(struct ttm_buffer_object *bo)
>  {
> -	/* Is @bo embedded in a struct vmw_buffer_object? */
> +	/* Is @bo embedded in a struct vmw_bo? */
>  	if (!bo_is_vmw(bo))
>  		return;
>  
>  	/* Kill any cached kernel maps before swapout */
> -	vmw_bo_unmap(vmw_buffer_object(bo));
> +	vmw_bo_unmap(to_vmw_bo(&bo->base));
>  }
>  
>  
> @@ -815,13 +801,13 @@ void vmw_bo_swap_notify(struct ttm_buffer_object *bo)
>  void vmw_bo_move_notify(struct ttm_buffer_object *bo,
>  			struct ttm_resource *mem)
>  {
> -	struct vmw_buffer_object *vbo;
> +	struct vmw_bo *vbo;
>  
> -	/* Make sure @bo is embedded in a struct vmw_buffer_object? */
> +	/* Make sure @bo is embedded in a struct vmw_bo? */
>  	if (!bo_is_vmw(bo))
>  		return;
>  
> -	vbo = container_of(bo, struct vmw_buffer_object, base);
> +	vbo = container_of(bo, struct vmw_bo, base);
>  
>  	/*
>  	 * Kill any cached kernel maps before move to or from VRAM.
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.h b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.h
> new file mode 100644
> index 000000000000..03ef4059c0d2
> --- /dev/null
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.h
> @@ -0,0 +1,189 @@
> +/* SPDX-License-Identifier: GPL-2.0 OR MIT */
> +/**************************************************************************
> + *
> + * Copyright 2023 VMware, Inc., Palo Alto, CA., USA
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> + * "Software"), to deal in the Software without restriction, including
> + * without limitation the rights to use, copy, modify, merge, publish,
> + * distribute, sub license, and/or sell copies of the Software, and to
> + * permit persons to whom the Software is furnished to do so, subject to
> + * the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the
> + * next paragraph) shall be included in all copies or substantial portions
> + * of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
> + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
> + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
> + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
> + * USE OR OTHER DEALINGS IN THE SOFTWARE.
> + *
> + **************************************************************************/
> +
> +#ifndef VMWGFX_BO_H
> +#define VMWGFX_BO_H
> +
> +#include "device_include/svga_reg.h"
> +
> +#include <drm/ttm/ttm_bo_api.h>
> +
> +#include <linux/rbtree_types.h>
> +#include <linux/types.h>
> +
> +struct vmw_bo_dirty;
> +struct vmw_fence_obj;
> +struct vmw_private;
> +struct vmw_resource;
> +
> +/**
> + * struct vmw_bo - TTM buffer object with vmwgfx additions
> + * @base: The TTM buffer object
> + * @res_tree: RB tree of resources using this buffer object as a backing MOB
> + * @base_mapped_count: ttm BO mapping count; used by KMS atomic helpers.
> + * @cpu_writers: Number of synccpu write grabs. Protected by reservation when
> + * increased. May be decreased without reservation.
> + * @dx_query_ctx: DX context if this buffer object is used as a DX query MOB
> + * @map: Kmap object for semi-persistent mappings
> + * @res_prios: Eviction priority counts for attached resources
> + * @dirty: structure for user-space dirty-tracking
> + */
> +struct vmw_bo {
> +	struct ttm_buffer_object base;
> +	struct rb_root res_tree;
> +	/* For KMS atomic helpers: ttm bo mapping count */
> +	atomic_t base_mapped_count;
> +
> +	atomic_t cpu_writers;
> +	/* Not ref-counted.  Protected by binding_mutex */
> +	struct vmw_resource *dx_query_ctx;
> +	/* Protected by reservation */
> +	struct ttm_bo_kmap_obj map;
> +	u32 res_prios[TTM_MAX_BO_PRIORITY];
> +	struct vmw_bo_dirty *dirty;
> +};
> +
> +int vmw_bo_create_kernel(struct vmw_private *dev_priv,
> +			 unsigned long size,
> +			 struct ttm_placement *placement,
> +			 struct ttm_buffer_object **p_bo);
> +int vmw_bo_create(struct vmw_private *dev_priv,
> +		  size_t size, struct ttm_placement *placement,
> +		  bool interruptible, bool pin,
> +		  struct vmw_bo **p_bo);
> +int vmw_bo_init(struct vmw_private *dev_priv,
> +		struct vmw_bo *vmw_bo,
> +		size_t size, struct ttm_placement *placement,
> +		bool interruptible, bool pin);
> +int vmw_bo_unref_ioctl(struct drm_device *dev, void *data,
> +		       struct drm_file *file_priv);
> +
> +int vmw_bo_pin_in_placement(struct vmw_private *vmw_priv,
> +			    struct vmw_bo *bo,
> +			    struct ttm_placement *placement,
> +			    bool interruptible);
> +int vmw_bo_pin_in_vram(struct vmw_private *dev_priv,
> +		       struct vmw_bo *buf,
> +		       bool interruptible);
> +int vmw_bo_pin_in_vram_or_gmr(struct vmw_private *dev_priv,
> +			      struct vmw_bo *buf,
> +			      bool interruptible);
> +int vmw_bo_pin_in_start_of_vram(struct vmw_private *vmw_priv,
> +				struct vmw_bo *bo,
> +				bool interruptible);
> +void vmw_bo_pin_reserved(struct vmw_bo *bo, bool pin);
> +int vmw_bo_unpin(struct vmw_private *vmw_priv,
> +		 struct vmw_bo *bo,
> +		 bool interruptible);
> +
> +void vmw_bo_get_guest_ptr(const struct ttm_buffer_object *buf,
> +			  SVGAGuestPtr *ptr);
> +int vmw_user_bo_synccpu_ioctl(struct drm_device *dev, void *data,
> +			      struct drm_file *file_priv);
> +int vmw_user_bo_lookup(struct drm_file *filp,
> +		       uint32_t handle,
> +		       struct vmw_bo **out);
> +void vmw_bo_fence_single(struct ttm_buffer_object *bo,
> +			 struct vmw_fence_obj *fence);
> +
> +void *vmw_bo_map_and_cache(struct vmw_bo *vbo);
> +void vmw_bo_unmap(struct vmw_bo *vbo);
> +
> +void vmw_bo_move_notify(struct ttm_buffer_object *bo,
> +			struct ttm_resource *mem);
> +void vmw_bo_swap_notify(struct ttm_buffer_object *bo);
> +
> +/**
> + * vmw_bo_adjust_prio - Adjust the buffer object eviction priority
> + * according to attached resources
> + * @vbo: The struct vmw_bo
> + */
> +static inline void vmw_bo_prio_adjust(struct vmw_bo *vbo)
> +{
> +	int i = ARRAY_SIZE(vbo->res_prios);
> +
> +	while (i--) {
> +		if (vbo->res_prios[i]) {
> +			vbo->base.priority = i;
> +			return;
> +		}
> +	}
> +
> +	vbo->base.priority = 3;
> +}
> +
> +/**
> + * vmw_bo_prio_add - Notify a buffer object of a newly attached resource
> + * eviction priority
> + * @vbo: The struct vmw_bo
> + * @prio: The resource priority
> + *
> + * After being notified, the code assigns the highest resource eviction priority
> + * to the backing buffer object (mob).
> + */
> +static inline void vmw_bo_prio_add(struct vmw_bo *vbo, int prio)
> +{
> +	if (vbo->res_prios[prio]++ == 0)
> +		vmw_bo_prio_adjust(vbo);
> +}
> +
> +/**
> + * vmw_bo_prio_del - Notify a buffer object of a resource with a certain
> + * priority being removed
> + * @vbo: The struct vmw_bo
> + * @prio: The resource priority
> + *
> + * After being notified, the code assigns the highest resource eviction priority
> + * to the backing buffer object (mob).
> + */
> +static inline void vmw_bo_prio_del(struct vmw_bo *vbo, int prio)
> +{
> +	if (--vbo->res_prios[prio] == 0)
> +		vmw_bo_prio_adjust(vbo);
> +}
> +
> +static inline void vmw_bo_unreference(struct vmw_bo **buf)
> +{
> +	struct vmw_bo *tmp_buf = *buf;
> +
> +	*buf = NULL;
> +	if (tmp_buf)
> +		ttm_bo_put(&tmp_buf->base);
> +}
> +
> +static inline struct vmw_bo *vmw_bo_reference(struct vmw_bo *buf)
> +{
> +	ttm_bo_get(&buf->base);
> +	return buf;
> +}
> +
> +static inline struct vmw_bo *to_vmw_bo(struct drm_gem_object *gobj)
> +{
> +	return container_of((gobj), struct vmw_bo, base.base);
> +}
> +
> +#endif // VMWGFX_BO_H
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c
> index 162dfeb1cc5a..b1e7810032d3 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2009-2020 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2009-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -24,13 +24,13 @@
>   * USE OR OTHER DEALINGS IN THE SOFTWARE.
>   *
>   **************************************************************************/
> -
> -#include <linux/sched/signal.h>
> +#include "vmwgfx_bo.h"
> +#include "vmwgfx_drv.h"
> +#include "vmwgfx_devcaps.h"
>  
>  #include <drm/ttm/ttm_placement.h>
>  
> -#include "vmwgfx_drv.h"
> -#include "vmwgfx_devcaps.h"
> +#include <linux/sched/signal.h>
>  
>  bool vmw_supports_3d(struct vmw_private *dev_priv)
>  {
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
> index 3c06df2a5474..6bcd3acdbeab 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2015 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2015-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -25,12 +25,13 @@
>   *
>   **************************************************************************/
>  
> -#include <linux/dmapool.h>
> -#include <linux/pci.h>
> +#include "vmwgfx_bo.h"
> +#include "vmwgfx_drv.h"
>  
>  #include <drm/ttm/ttm_bo_api.h>
>  
> -#include "vmwgfx_drv.h"
> +#include <linux/dmapool.h>
> +#include <linux/pci.h>
>  
>  /*
>   * Size of inline command buffers. Try to make sure that a page size is a
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
> index e0f48cd9529b..cc02be6a9884 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2009-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -27,9 +27,10 @@
>  
>  #include <drm/ttm/ttm_placement.h>
>  
> +#include "vmwgfx_binding.h"
> +#include "vmwgfx_bo.h"
>  #include "vmwgfx_drv.h"
>  #include "vmwgfx_resource_priv.h"
> -#include "vmwgfx_binding.h"
>  
>  struct vmw_user_context {
>  	struct ttm_base_object base;
> @@ -38,7 +39,7 @@ struct vmw_user_context {
>  	struct vmw_cmdbuf_res_manager *man;
>  	struct vmw_resource *cotables[SVGA_COTABLE_MAX];
>  	spinlock_t cotable_lock;
> -	struct vmw_buffer_object *dx_query_mob;
> +	struct vmw_bo *dx_query_mob;
>  };
>  
>  static void vmw_user_context_free(struct vmw_resource *res);
> @@ -853,7 +854,7 @@ vmw_context_binding_state(struct vmw_resource *ctx)
>   * specified in the parameter.  0 otherwise.
>   */
>  int vmw_context_bind_dx_query(struct vmw_resource *ctx_res,
> -			      struct vmw_buffer_object *mob)
> +			      struct vmw_bo *mob)
>  {
>  	struct vmw_user_context *uctx =
>  		container_of(ctx_res, struct vmw_user_context, res);
> @@ -885,7 +886,7 @@ int vmw_context_bind_dx_query(struct vmw_resource *ctx_res,
>   *
>   * @ctx_res: The context resource
>   */
> -struct vmw_buffer_object *
> +struct vmw_bo *
>  vmw_context_get_dx_query_mob(struct vmw_resource *ctx_res)
>  {
>  	struct vmw_user_context *uctx =
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
> index 87455446a6f9..9193faae8dab 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2014-2015 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2014-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -30,13 +30,14 @@
>   * whenever the backing MOB is evicted.
>   */
>  
> -#include <drm/ttm/ttm_placement.h>
> -
> +#include "vmwgfx_bo.h"
>  #include "vmwgfx_drv.h"
>  #include "vmwgfx_mksstat.h"
>  #include "vmwgfx_resource_priv.h"
>  #include "vmwgfx_so.h"
>  
> +#include <drm/ttm/ttm_placement.h>
> +
>  /**
>   * struct vmw_cotable - Context Object Table resource
>   *
> @@ -399,7 +400,7 @@ static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size)
>  	struct ttm_operation_ctx ctx = { false, false };
>  	struct vmw_private *dev_priv = res->dev_priv;
>  	struct vmw_cotable *vcotbl = vmw_cotable(res);
> -	struct vmw_buffer_object *buf, *old_buf = res->backup;
> +	struct vmw_bo *buf, *old_buf = res->backup;
>  	struct ttm_buffer_object *bo, *old_bo = &res->backup->base;
>  	size_t old_size = res->backup_size;
>  	size_t old_size_read_back = vcotbl->size_read_back;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> index 7272aff7855d..60d08185a71f 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2009-2022 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2009-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -28,9 +28,10 @@
>  
>  #include "vmwgfx_drv.h"
>  
> +#include "vmwgfx_bo.h"
> +#include "vmwgfx_binding.h"
>  #include "vmwgfx_devcaps.h"
>  #include "vmwgfx_mksstat.h"
> -#include "vmwgfx_binding.h"
>  #include "ttm_object.h"
>  
>  #include <drm/drm_aperture.h>
> @@ -387,7 +388,7 @@ static void vmw_print_sm_type(struct vmw_private *dev_priv)
>  static int vmw_dummy_query_bo_create(struct vmw_private *dev_priv)
>  {
>  	int ret;
> -	struct vmw_buffer_object *vbo;
> +	struct vmw_bo *vbo;
>  	struct ttm_bo_kmap_obj map;
>  	volatile SVGA3dQueryResult *result;
>  	bool dummy;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
> index 3e8ab2ce5b94..e9a16a1e043d 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
> @@ -1,7 +1,7 @@
>  /* SPDX-License-Identifier: GPL-2.0 OR MIT */
>  /**************************************************************************
>   *
> - * Copyright 2009-2022 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2009-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -115,32 +115,6 @@ struct vmwgfx_hash_item {
>  	unsigned long key;
>  };
>  
> -/**
> - * struct vmw_buffer_object - TTM buffer object with vmwgfx additions
> - * @base: The TTM buffer object
> - * @res_tree: RB tree of resources using this buffer object as a backing MOB
> - * @base_mapped_count: ttm BO mapping count; used by KMS atomic helpers.
> - * @cpu_writers: Number of synccpu write grabs. Protected by reservation when
> - * increased. May be decreased without reservation.
> - * @dx_query_ctx: DX context if this buffer object is used as a DX query MOB
> - * @map: Kmap object for semi-persistent mappings
> - * @res_prios: Eviction priority counts for attached resources
> - * @dirty: structure for user-space dirty-tracking
> - */
> -struct vmw_buffer_object {
> -	struct ttm_buffer_object base;
> -	struct rb_root res_tree;
> -	/* For KMS atomic helpers: ttm bo mapping count */
> -	atomic_t base_mapped_count;
> -
> -	atomic_t cpu_writers;
> -	/* Not ref-counted.  Protected by binding_mutex */
> -	struct vmw_resource *dx_query_ctx;
> -	/* Protected by reservation */
> -	struct ttm_bo_kmap_obj map;
> -	u32 res_prios[TTM_MAX_BO_PRIORITY];
> -	struct vmw_bo_dirty *dirty;
> -};
>  
>  /**
>   * struct vmw_validate_buffer - Carries validation info about buffers.
> @@ -188,6 +162,7 @@ struct vmw_res_func;
>   * @hw_destroy: Callback to destroy the resource on the device, as part of
>   * resource destruction.
>   */
> +struct vmw_bo;
>  struct vmw_resource_dirty;
>  struct vmw_resource {
>  	struct kref kref;
> @@ -198,7 +173,7 @@ struct vmw_resource {
>  	u32 res_dirty : 1;
>  	u32 backup_dirty : 1;
>  	u32 coherent : 1;
> -	struct vmw_buffer_object *backup;
> +	struct vmw_bo *backup;
>  	unsigned long backup_offset;
>  	unsigned long pin_count;
>  	const struct vmw_res_func *func;
> @@ -444,7 +419,7 @@ struct vmw_sw_context{
>  	struct drm_file *filp;
>  	uint32_t *cmd_bounce;
>  	uint32_t cmd_bounce_size;
> -	struct vmw_buffer_object *cur_query_bo;
> +	struct vmw_bo *cur_query_bo;
>  	struct list_head bo_relocations;
>  	struct list_head res_relocations;
>  	uint32_t *buf_start;
> @@ -456,7 +431,7 @@ struct vmw_sw_context{
>  	struct list_head staged_cmd_res;
>  	struct list_head ctx_list;
>  	struct vmw_ctx_validation_info *dx_ctx_node;
> -	struct vmw_buffer_object *dx_query_mob;
> +	struct vmw_bo *dx_query_mob;
>  	struct vmw_resource *dx_query_ctx;
>  	struct vmw_cmdbuf_res_manager *man;
>  	struct vmw_validation_context *ctx;
> @@ -630,8 +605,8 @@ struct vmw_private {
>  	 * are protected by the cmdbuf mutex.
>  	 */
>  
> -	struct vmw_buffer_object *dummy_query_bo;
> -	struct vmw_buffer_object *pinned_bo;
> +	struct vmw_bo *dummy_query_bo;
> +	struct vmw_bo *pinned_bo;
>  	uint32_t query_cid;
>  	uint32_t query_cid_valid;
>  	bool dummy_query_bo_pinned;
> @@ -675,11 +650,6 @@ struct vmw_private {
>  #endif
>  };
>  
> -static inline struct vmw_buffer_object *gem_to_vmw_bo(struct drm_gem_object *gobj)
> -{
> -	return container_of((gobj), struct vmw_buffer_object, base.base);
> -}
> -
>  static inline struct vmw_surface *vmw_res_to_srf(struct vmw_resource *res)
>  {
>  	return container_of(res, struct vmw_surface, res);
> @@ -823,7 +793,7 @@ extern int vmw_user_lookup_handle(struct vmw_private *dev_priv,
>  				  struct drm_file *filp,
>  				  uint32_t handle,
>  				  struct vmw_surface **out_surf,
> -				  struct vmw_buffer_object **out_buf);
> +				  struct vmw_bo **out_buf);
>  extern int vmw_user_resource_lookup_handle(
>  	struct vmw_private *dev_priv,
>  	struct ttm_object_file *tfile,
> @@ -843,19 +813,19 @@ extern void vmw_resource_unreserve(struct vmw_resource *res,
>  				   bool dirty_set,
>  				   bool dirty,
>  				   bool switch_backup,
> -				   struct vmw_buffer_object *new_backup,
> +				   struct vmw_bo *new_backup,
>  				   unsigned long new_backup_offset);
>  extern void vmw_query_move_notify(struct ttm_buffer_object *bo,
>  				  struct ttm_resource *old_mem,
>  				  struct ttm_resource *new_mem);
> -extern int vmw_query_readback_all(struct vmw_buffer_object *dx_query_mob);
> -extern void vmw_resource_evict_all(struct vmw_private *dev_priv);
> -extern void vmw_resource_unbind_list(struct vmw_buffer_object *vbo);
> +int vmw_query_readback_all(struct vmw_bo *dx_query_mob);
> +void vmw_resource_evict_all(struct vmw_private *dev_priv);
> +void vmw_resource_unbind_list(struct vmw_bo *vbo);
>  void vmw_resource_mob_attach(struct vmw_resource *res);
>  void vmw_resource_mob_detach(struct vmw_resource *res);
>  void vmw_resource_dirty_update(struct vmw_resource *res, pgoff_t start,
>  			       pgoff_t end);
> -int vmw_resources_clean(struct vmw_buffer_object *vbo, pgoff_t start,
> +int vmw_resources_clean(struct vmw_bo *vbo, pgoff_t start,
>  			pgoff_t end, pgoff_t *num_prefault);
>  
>  /**
> @@ -869,104 +839,6 @@ static inline bool vmw_resource_mob_attached(const struct vmw_resource *res)
>  	return !RB_EMPTY_NODE(&res->mob_node);
>  }
>  
> -/**
> - * Buffer object helper functions - vmwgfx_bo.c
> - */
> -extern int vmw_bo_pin_in_placement(struct vmw_private *vmw_priv,
> -				   struct vmw_buffer_object *bo,
> -				   struct ttm_placement *placement,
> -				   bool interruptible);
> -extern int vmw_bo_pin_in_vram(struct vmw_private *dev_priv,
> -			      struct vmw_buffer_object *buf,
> -			      bool interruptible);
> -extern int vmw_bo_pin_in_vram_or_gmr(struct vmw_private *dev_priv,
> -				     struct vmw_buffer_object *buf,
> -				     bool interruptible);
> -extern int vmw_bo_pin_in_start_of_vram(struct vmw_private *vmw_priv,
> -				       struct vmw_buffer_object *bo,
> -				       bool interruptible);
> -extern int vmw_bo_unpin(struct vmw_private *vmw_priv,
> -			struct vmw_buffer_object *bo,
> -			bool interruptible);
> -extern void vmw_bo_get_guest_ptr(const struct ttm_buffer_object *buf,
> -				 SVGAGuestPtr *ptr);
> -extern void vmw_bo_pin_reserved(struct vmw_buffer_object *bo, bool pin);
> -extern int vmw_bo_create_kernel(struct vmw_private *dev_priv,
> -				unsigned long size,
> -				struct ttm_placement *placement,
> -				struct ttm_buffer_object **p_bo);
> -extern int vmw_bo_create(struct vmw_private *dev_priv,
> -			 size_t size, struct ttm_placement *placement,
> -			 bool interruptible, bool pin,
> -			 struct vmw_buffer_object **p_bo);
> -extern int vmw_bo_init(struct vmw_private *dev_priv,
> -		       struct vmw_buffer_object *vmw_bo,
> -		       size_t size, struct ttm_placement *placement,
> -		       bool interruptible, bool pin);
> -extern int vmw_bo_unref_ioctl(struct drm_device *dev, void *data,
> -			      struct drm_file *file_priv);
> -extern int vmw_user_bo_synccpu_ioctl(struct drm_device *dev, void *data,
> -				     struct drm_file *file_priv);
> -extern int vmw_user_bo_lookup(struct drm_file *filp,
> -			      uint32_t handle,
> -			      struct vmw_buffer_object **out);
> -extern void vmw_bo_fence_single(struct ttm_buffer_object *bo,
> -				struct vmw_fence_obj *fence);
> -extern void *vmw_bo_map_and_cache(struct vmw_buffer_object *vbo);
> -extern void vmw_bo_unmap(struct vmw_buffer_object *vbo);
> -extern void vmw_bo_move_notify(struct ttm_buffer_object *bo,
> -			       struct ttm_resource *mem);
> -extern void vmw_bo_swap_notify(struct ttm_buffer_object *bo);
> -
> -/**
> - * vmw_bo_adjust_prio - Adjust the buffer object eviction priority
> - * according to attached resources
> - * @vbo: The struct vmw_buffer_object
> - */
> -static inline void vmw_bo_prio_adjust(struct vmw_buffer_object *vbo)
> -{
> -	int i = ARRAY_SIZE(vbo->res_prios);
> -
> -	while (i--) {
> -		if (vbo->res_prios[i]) {
> -			vbo->base.priority = i;
> -			return;
> -		}
> -	}
> -
> -	vbo->base.priority = 3;
> -}
> -
> -/**
> - * vmw_bo_prio_add - Notify a buffer object of a newly attached resource
> - * eviction priority
> - * @vbo: The struct vmw_buffer_object
> - * @prio: The resource priority
> - *
> - * After being notified, the code assigns the highest resource eviction priority
> - * to the backing buffer object (mob).
> - */
> -static inline void vmw_bo_prio_add(struct vmw_buffer_object *vbo, int prio)
> -{
> -	if (vbo->res_prios[prio]++ == 0)
> -		vmw_bo_prio_adjust(vbo);
> -}
> -
> -/**
> - * vmw_bo_prio_del - Notify a buffer object of a resource with a certain
> - * priority being removed
> - * @vbo: The struct vmw_buffer_object
> - * @prio: The resource priority
> - *
> - * After being notified, the code assigns the highest resource eviction priority
> - * to the backing buffer object (mob).
> - */
> -static inline void vmw_bo_prio_del(struct vmw_buffer_object *vbo, int prio)
> -{
> -	if (--vbo->res_prios[prio] == 0)
> -		vmw_bo_prio_adjust(vbo);
> -}
> -
>  /**
>   * GEM related functionality - vmwgfx_gem.c
>   */
> @@ -974,7 +846,7 @@ extern int vmw_gem_object_create_with_handle(struct vmw_private *dev_priv,
>  					     struct drm_file *filp,
>  					     uint32_t size,
>  					     uint32_t *handle,
> -					     struct vmw_buffer_object **p_vbo);
> +					     struct vmw_bo **p_vbo);
>  extern int vmw_gem_object_create_ioctl(struct drm_device *dev, void *data,
>  				       struct drm_file *filp);
>  extern void vmw_debugfs_gem_init(struct vmw_private *vdev);
> @@ -1285,8 +1157,8 @@ vmw_context_binding_state(struct vmw_resource *ctx);
>  extern void vmw_dx_context_scrub_cotables(struct vmw_resource *ctx,
>  					  bool readback);
>  extern int vmw_context_bind_dx_query(struct vmw_resource *ctx_res,
> -				     struct vmw_buffer_object *mob);
> -extern struct vmw_buffer_object *
> +				     struct vmw_bo *mob);
> +extern struct vmw_bo *
>  vmw_context_get_dx_query_mob(struct vmw_resource *ctx_res);
>  
>  
> @@ -1511,12 +1383,12 @@ int vmw_mksstat_remove_all(struct vmw_private *dev_priv);
>  	DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__)
>  
>  /* Resource dirtying - vmwgfx_page_dirty.c */
> -void vmw_bo_dirty_scan(struct vmw_buffer_object *vbo);
> -int vmw_bo_dirty_add(struct vmw_buffer_object *vbo);
> +void vmw_bo_dirty_scan(struct vmw_bo *vbo);
> +int vmw_bo_dirty_add(struct vmw_bo *vbo);
>  void vmw_bo_dirty_transfer_to_res(struct vmw_resource *res);
>  void vmw_bo_dirty_clear_res(struct vmw_resource *res);
> -void vmw_bo_dirty_release(struct vmw_buffer_object *vbo);
> -void vmw_bo_dirty_unmap(struct vmw_buffer_object *vbo,
> +void vmw_bo_dirty_release(struct vmw_bo *vbo);
> +void vmw_bo_dirty_unmap(struct vmw_bo *vbo,
>  			pgoff_t start, pgoff_t end);
>  vm_fault_t vmw_bo_vm_fault(struct vm_fault *vmf);
>  vm_fault_t vmw_bo_vm_mkwrite(struct vm_fault *vmf);
> @@ -1549,22 +1421,6 @@ static inline struct vmw_surface *vmw_surface_reference(struct vmw_surface *srf)
>  	return srf;
>  }
>  
> -static inline void vmw_bo_unreference(struct vmw_buffer_object **buf)
> -{
> -	struct vmw_buffer_object *tmp_buf = *buf;
> -
> -	*buf = NULL;
> -	if (tmp_buf != NULL)
> -		ttm_bo_put(&tmp_buf->base);
> -}
> -
> -static inline struct vmw_buffer_object *
> -vmw_bo_reference(struct vmw_buffer_object *buf)
> -{
> -	ttm_bo_get(&buf->base);
> -	return buf;
> -}
> -
>  static inline void vmw_fifo_resource_inc(struct vmw_private *dev_priv)
>  {
>  	atomic_inc(&dev_priv->num_fifo_resources);
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
> index a44d53e33cdb..687c6926bc00 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2009 - 2022 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2009 - 2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -24,17 +24,16 @@
>   * USE OR OTHER DEALINGS IN THE SOFTWARE.
>   *
>   **************************************************************************/
> -#include <linux/sync_file.h>
> -#include <linux/hashtable.h>
> -
> -#include "vmwgfx_drv.h"
> -#include "vmwgfx_reg.h"
> -#include <drm/ttm/ttm_bo_api.h>
> -#include <drm/ttm/ttm_placement.h>
> -#include "vmwgfx_so.h"
>  #include "vmwgfx_binding.h"
> +#include "vmwgfx_bo.h"
> +#include "vmwgfx_drv.h"
>  #include "vmwgfx_mksstat.h"
> +#include "vmwgfx_so.h"
> +
> +#include <drm/ttm/ttm_bo_api.h>
>  
> +#include <linux/sync_file.h>
> +#include <linux/hashtable.h>
>  
>  /*
>   * Helper macro to get dx_ctx_node if available otherwise print an error
> @@ -65,7 +64,7 @@
>   */
>  struct vmw_relocation {
>  	struct list_head head;
> -	struct vmw_buffer_object *vbo;
> +	struct vmw_bo *vbo;
>  	union {
>  		SVGAMobId *mob_loc;
>  		SVGAGuestPtr *location;
> @@ -149,7 +148,7 @@ static int vmw_resource_context_res_add(struct vmw_private *dev_priv,
>  static int vmw_translate_mob_ptr(struct vmw_private *dev_priv,
>  				 struct vmw_sw_context *sw_context,
>  				 SVGAMobId *id,
> -				 struct vmw_buffer_object **vmw_bo_p);
> +				 struct vmw_bo **vmw_bo_p);
>  /**
>   * vmw_ptr_diff - Compute the offset from a to b in bytes
>   *
> @@ -475,7 +474,7 @@ static int vmw_resource_context_res_add(struct vmw_private *dev_priv,
>  
>  	if (has_sm4_context(dev_priv) &&
>  	    vmw_res_type(ctx) == vmw_res_dx_context) {
> -		struct vmw_buffer_object *dx_query_mob;
> +		struct vmw_bo *dx_query_mob;
>  
>  		dx_query_mob = vmw_context_get_dx_query_mob(ctx);
>  		if (dx_query_mob)
> @@ -596,7 +595,7 @@ static int vmw_resources_reserve(struct vmw_sw_context *sw_context)
>  		return ret;
>  
>  	if (sw_context->dx_query_mob) {
> -		struct vmw_buffer_object *expected_dx_query_mob;
> +		struct vmw_bo *expected_dx_query_mob;
>  
>  		expected_dx_query_mob =
>  			vmw_context_get_dx_query_mob(sw_context->dx_query_ctx);
> @@ -703,7 +702,7 @@ vmw_cmd_res_check(struct vmw_private *dev_priv,
>  static int vmw_rebind_all_dx_query(struct vmw_resource *ctx_res)
>  {
>  	struct vmw_private *dev_priv = ctx_res->dev_priv;
> -	struct vmw_buffer_object *dx_query_mob;
> +	struct vmw_bo *dx_query_mob;
>  	VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdDXBindAllQuery);
>  
>  	dx_query_mob = vmw_context_get_dx_query_mob(ctx_res);
> @@ -1017,7 +1016,7 @@ static int vmw_cmd_present_check(struct vmw_private *dev_priv,
>   * after successful submission of the current command batch.
>   */
>  static int vmw_query_bo_switch_prepare(struct vmw_private *dev_priv,
> -				       struct vmw_buffer_object *new_query_bo,
> +				       struct vmw_bo *new_query_bo,
>  				       struct vmw_sw_context *sw_context)
>  {
>  	struct vmw_res_cache_entry *ctx_entry =
> @@ -1145,9 +1144,9 @@ static void vmw_query_bo_switch_commit(struct vmw_private *dev_priv,
>  static int vmw_translate_mob_ptr(struct vmw_private *dev_priv,
>  				 struct vmw_sw_context *sw_context,
>  				 SVGAMobId *id,
> -				 struct vmw_buffer_object **vmw_bo_p)
> +				 struct vmw_bo **vmw_bo_p)
>  {
> -	struct vmw_buffer_object *vmw_bo;
> +	struct vmw_bo *vmw_bo;
>  	uint32_t handle = *id;
>  	struct vmw_relocation *reloc;
>  	int ret;
> @@ -1199,9 +1198,9 @@ static int vmw_translate_mob_ptr(struct vmw_private *dev_priv,
>  static int vmw_translate_guest_ptr(struct vmw_private *dev_priv,
>  				   struct vmw_sw_context *sw_context,
>  				   SVGAGuestPtr *ptr,
> -				   struct vmw_buffer_object **vmw_bo_p)
> +				   struct vmw_bo **vmw_bo_p)
>  {
> -	struct vmw_buffer_object *vmw_bo;
> +	struct vmw_bo *vmw_bo;
>  	uint32_t handle = ptr->gmrId;
>  	struct vmw_relocation *reloc;
>  	int ret;
> @@ -1278,7 +1277,7 @@ static int vmw_cmd_dx_bind_query(struct vmw_private *dev_priv,
>  				 SVGA3dCmdHeader *header)
>  {
>  	VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdDXBindQuery);
> -	struct vmw_buffer_object *vmw_bo;
> +	struct vmw_bo *vmw_bo;
>  	int ret;
>  
>  	cmd = container_of(header, typeof(*cmd), header);
> @@ -1361,7 +1360,7 @@ static int vmw_cmd_end_gb_query(struct vmw_private *dev_priv,
>  				struct vmw_sw_context *sw_context,
>  				SVGA3dCmdHeader *header)
>  {
> -	struct vmw_buffer_object *vmw_bo;
> +	struct vmw_bo *vmw_bo;
>  	VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdEndGBQuery);
>  	int ret;
>  
> @@ -1391,7 +1390,7 @@ static int vmw_cmd_end_query(struct vmw_private *dev_priv,
>  			     struct vmw_sw_context *sw_context,
>  			     SVGA3dCmdHeader *header)
>  {
> -	struct vmw_buffer_object *vmw_bo;
> +	struct vmw_bo *vmw_bo;
>  	VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdEndQuery);
>  	int ret;
>  
> @@ -1437,7 +1436,7 @@ static int vmw_cmd_wait_gb_query(struct vmw_private *dev_priv,
>  				 struct vmw_sw_context *sw_context,
>  				 SVGA3dCmdHeader *header)
>  {
> -	struct vmw_buffer_object *vmw_bo;
> +	struct vmw_bo *vmw_bo;
>  	VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdWaitForGBQuery);
>  	int ret;
>  
> @@ -1465,7 +1464,7 @@ static int vmw_cmd_wait_query(struct vmw_private *dev_priv,
>  			      struct vmw_sw_context *sw_context,
>  			      SVGA3dCmdHeader *header)
>  {
> -	struct vmw_buffer_object *vmw_bo;
> +	struct vmw_bo *vmw_bo;
>  	VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdWaitForQuery);
>  	int ret;
>  
> @@ -1502,7 +1501,7 @@ static int vmw_cmd_dma(struct vmw_private *dev_priv,
>  		       struct vmw_sw_context *sw_context,
>  		       SVGA3dCmdHeader *header)
>  {
> -	struct vmw_buffer_object *vmw_bo = NULL;
> +	struct vmw_bo *vmw_bo = NULL;
>  	struct vmw_surface *srf = NULL;
>  	VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdSurfaceDMA);
>  	int ret;
> @@ -1668,7 +1667,7 @@ static int vmw_cmd_check_define_gmrfb(struct vmw_private *dev_priv,
>  				      struct vmw_sw_context *sw_context,
>  				      void *buf)
>  {
> -	struct vmw_buffer_object *vmw_bo;
> +	struct vmw_bo *vmw_bo;
>  
>  	struct {
>  		uint32_t header;
> @@ -1699,7 +1698,7 @@ static int vmw_cmd_res_switch_backup(struct vmw_private *dev_priv,
>  				     struct vmw_resource *res, uint32_t *buf_id,
>  				     unsigned long backup_offset)
>  {
> -	struct vmw_buffer_object *vbo;
> +	struct vmw_bo *vbo;
>  	void *info;
>  	int ret;
>  
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> index 66cc35dc223e..2a0cda324703 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2011-2014 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2011-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gem.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gem.c
> index ae39029fec4a..c7ebcd4f3afa 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_gem.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gem.c
> @@ -1,6 +1,6 @@
>  /* SPDX-License-Identifier: GPL-2.0 OR MIT */
>  /*
> - * Copyright 2021 VMware, Inc.
> + * Copyright 2021-2023 VMware, Inc.
>   *
>   * Permission is hereby granted, free of charge, to any person
>   * obtaining a copy of this software and associated documentation
> @@ -24,25 +24,12 @@
>   *
>   */
>  
> +#include "vmwgfx_bo.h"
>  #include "vmwgfx_drv.h"
>  
>  #include "drm/drm_prime.h"
>  #include "drm/drm_gem_ttm_helper.h"
>  
> -/**
> - * vmw_buffer_object - Convert a struct ttm_buffer_object to a struct
> - * vmw_buffer_object.
> - *
> - * @bo: Pointer to the TTM buffer object.
> - * Return: Pointer to the struct vmw_buffer_object embedding the
> - * TTM buffer object.
> - */
> -static struct vmw_buffer_object *
> -vmw_buffer_object(struct ttm_buffer_object *bo)
> -{
> -	return container_of(bo, struct vmw_buffer_object, base);
> -}
> -
>  static void vmw_gem_object_free(struct drm_gem_object *gobj)
>  {
>  	struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gobj);
> @@ -65,7 +52,7 @@ static void vmw_gem_object_close(struct drm_gem_object *obj,
>  static int vmw_gem_pin_private(struct drm_gem_object *obj, bool do_pin)
>  {
>  	struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(obj);
> -	struct vmw_buffer_object *vbo = vmw_buffer_object(bo);
> +	struct vmw_bo *vbo = to_vmw_bo(obj);
>  	int ret;
>  
>  	ret = ttm_bo_reserve(bo, false, false, NULL);
> @@ -129,7 +116,7 @@ int vmw_gem_object_create_with_handle(struct vmw_private *dev_priv,
>  				      struct drm_file *filp,
>  				      uint32_t size,
>  				      uint32_t *handle,
> -				      struct vmw_buffer_object **p_vbo)
> +				      struct vmw_bo **p_vbo)
>  {
>  	int ret;
>  
> @@ -159,7 +146,7 @@ int vmw_gem_object_create_ioctl(struct drm_device *dev, void *data,
>  	    (union drm_vmw_alloc_dmabuf_arg *)data;
>  	struct drm_vmw_alloc_dmabuf_req *req = &arg->req;
>  	struct drm_vmw_dmabuf_rep *rep = &arg->rep;
> -	struct vmw_buffer_object *vbo;
> +	struct vmw_bo *vbo;
>  	uint32_t handle;
>  	int ret;
>  
> @@ -178,7 +165,7 @@ int vmw_gem_object_create_ioctl(struct drm_device *dev, void *data,
>  
>  #if defined(CONFIG_DEBUG_FS)
>  
> -static void vmw_bo_print_info(int id, struct vmw_buffer_object *bo, struct seq_file *m)
> +static void vmw_bo_print_info(int id, struct vmw_bo *bo, struct seq_file *m)
>  {
>  	const char *placement;
>  	const char *type;
> @@ -259,7 +246,7 @@ static int vmw_debugfs_gem_info_show(struct seq_file *m, void *unused)
>  
>  		spin_lock(&file->table_lock);
>  		idr_for_each_entry(&file->object_idr, gobj, id) {
> -			struct vmw_buffer_object *bo = gem_to_vmw_bo(gobj);
> +			struct vmw_bo *bo = to_vmw_bo(gobj);
>  
>  			vmw_bo_print_info(id, bo, m);
>  		}
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index 257f090071f1..ad41396c0a5d 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2009-2022 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2009-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -24,8 +24,9 @@
>   * USE OR OTHER DEALINGS IN THE SOFTWARE.
>   *
>   **************************************************************************/
> -
>  #include "vmwgfx_kms.h"
> +
> +#include "vmwgfx_bo.h"
>  #include "vmw_surface_cache.h"
>  
>  #include <drm/drm_atomic.h>
> @@ -1493,7 +1494,7 @@ static const struct drm_framebuffer_funcs vmw_framebuffer_bo_funcs = {
>  static int vmw_framebuffer_pin(struct vmw_framebuffer *vfb)
>  {
>  	struct vmw_private *dev_priv = vmw_priv(vfb->base.dev);
> -	struct vmw_buffer_object *buf;
> +	struct vmw_bo *buf;
>  	struct ttm_placement *placement;
>  	int ret;
>  
> @@ -1538,7 +1539,7 @@ static int vmw_framebuffer_pin(struct vmw_framebuffer *vfb)
>  static int vmw_framebuffer_unpin(struct vmw_framebuffer *vfb)
>  {
>  	struct vmw_private *dev_priv = vmw_priv(vfb->base.dev);
> -	struct vmw_buffer_object *buf;
> +	struct vmw_bo *buf;
>  
>  	buf = vfb->bo ?  vmw_framebuffer_to_vfbd(&vfb->base)->buffer :
>  		vmw_framebuffer_to_vfbs(&vfb->base)->surface->res.backup;
> @@ -1566,7 +1567,7 @@ static int vmw_framebuffer_unpin(struct vmw_framebuffer *vfb)
>   */
>  static int vmw_create_bo_proxy(struct drm_device *dev,
>  			       const struct drm_mode_fb_cmd2 *mode_cmd,
> -			       struct vmw_buffer_object *bo_mob,
> +			       struct vmw_bo *bo_mob,
>  			       struct vmw_surface **srf_out)
>  {
>  	struct vmw_surface_metadata metadata = {0};
> @@ -1630,7 +1631,7 @@ static int vmw_create_bo_proxy(struct drm_device *dev,
>  
>  
>  static int vmw_kms_new_framebuffer_bo(struct vmw_private *dev_priv,
> -				      struct vmw_buffer_object *bo,
> +				      struct vmw_bo *bo,
>  				      struct vmw_framebuffer **out,
>  				      const struct drm_mode_fb_cmd2
>  				      *mode_cmd)
> @@ -1718,7 +1719,7 @@ vmw_kms_srf_ok(struct vmw_private *dev_priv, uint32_t width, uint32_t height)
>   */
>  struct vmw_framebuffer *
>  vmw_kms_new_framebuffer(struct vmw_private *dev_priv,
> -			struct vmw_buffer_object *bo,
> +			struct vmw_bo *bo,
>  			struct vmw_surface *surface,
>  			bool only_2d,
>  			const struct drm_mode_fb_cmd2 *mode_cmd)
> @@ -1782,7 +1783,7 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
>  	struct vmw_private *dev_priv = vmw_priv(dev);
>  	struct vmw_framebuffer *vfb = NULL;
>  	struct vmw_surface *surface = NULL;
> -	struct vmw_buffer_object *bo = NULL;
> +	struct vmw_bo *bo = NULL;
>  	int ret;
>  
>  	/* returns either a bo or surface */
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
> index 4d6e7b555db7..2d097ba20ad8 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
> @@ -233,7 +233,7 @@ struct vmw_clip_rect {
>  struct vmw_framebuffer_surface {
>  	struct vmw_framebuffer base;
>  	struct vmw_surface *surface;
> -	struct vmw_buffer_object *buffer;
> +	struct vmw_bo *buffer;
>  	struct list_head head;
>  	bool is_bo_proxy;  /* true if this is proxy surface for DMA buf */
>  };
> @@ -241,7 +241,7 @@ struct vmw_framebuffer_surface {
>  
>  struct vmw_framebuffer_bo {
>  	struct vmw_framebuffer base;
> -	struct vmw_buffer_object *buffer;
> +	struct vmw_bo *buffer;
>  };
>  
>  
> @@ -293,7 +293,7 @@ struct vmw_cursor_plane_state {
>  struct vmw_plane_state {
>  	struct drm_plane_state base;
>  	struct vmw_surface *surf;
> -	struct vmw_buffer_object *bo;
> +	struct vmw_bo *bo;
>  
>  	int content_fb_type;
>  	unsigned long bo_size;
> @@ -364,7 +364,7 @@ struct vmw_display_unit {
>  	struct vmw_cursor_plane cursor;
>  
>  	struct vmw_surface *cursor_surface;
> -	struct vmw_buffer_object *cursor_bo;
> +	struct vmw_bo *cursor_bo;
>  	size_t cursor_age;
>  
>  	int cursor_x;
> @@ -397,7 +397,7 @@ struct vmw_display_unit {
>  
>  struct vmw_validation_ctx {
>  	struct vmw_resource *res;
> -	struct vmw_buffer_object *buf;
> +	struct vmw_bo *buf;
>  };
>  
>  #define vmw_crtc_to_du(x) \
> @@ -458,7 +458,7 @@ int vmw_kms_readback(struct vmw_private *dev_priv,
>  		     uint32_t num_clips);
>  struct vmw_framebuffer *
>  vmw_kms_new_framebuffer(struct vmw_private *dev_priv,
> -			struct vmw_buffer_object *bo,
> +			struct vmw_bo *bo,
>  			struct vmw_surface *surface,
>  			bool only_2d,
>  			const struct drm_mode_fb_cmd2 *mode_cmd);
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
> index 0a8cc28d6606..6b3f53b533dc 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2012-2021 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2012-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -25,10 +25,11 @@
>   *
>   **************************************************************************/
>  
> -#include <linux/highmem.h>
> -
> +#include "vmwgfx_bo.h"
>  #include "vmwgfx_drv.h"
>  
> +#include <linux/highmem.h>
> +
>  #ifdef CONFIG_64BIT
>  #define VMW_PPN_SIZE 8
>  #define VMW_MOBFMT_PTDEPTH_0 SVGA3D_MOBFMT_PT64_0
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
> index e9f5c89b4ca6..b415e86b26db 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2009-2014 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2009-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -24,19 +24,19 @@
>   * USE OR OTHER DEALINGS IN THE SOFTWARE.
>   *
>   **************************************************************************/
> -
> -#include <drm/ttm/ttm_placement.h>
> +#include "vmwgfx_bo.h"
> +#include "vmwgfx_drv.h"
>  
>  #include "device_include/svga_overlay.h"
>  #include "device_include/svga_escape.h"
>  
> -#include "vmwgfx_drv.h"
> +#include <drm/ttm/ttm_placement.h>
>  
>  #define VMW_MAX_NUM_STREAMS 1
>  #define VMW_OVERLAY_CAP_MASK (SVGA_FIFO_CAP_VIDEO | SVGA_FIFO_CAP_ESCAPE)
>  
>  struct vmw_stream {
> -	struct vmw_buffer_object *buf;
> +	struct vmw_bo *buf;
>  	bool claimed;
>  	bool paused;
>  	struct drm_vmw_control_stream_arg saved;
> @@ -92,7 +92,7 @@ static inline void fill_flush(struct vmw_escape_video_flush *cmd,
>   * -ERESTARTSYS if interrupted by a signal.
>   */
>  static int vmw_overlay_send_put(struct vmw_private *dev_priv,
> -				struct vmw_buffer_object *buf,
> +				struct vmw_bo *buf,
>  				struct drm_vmw_control_stream_arg *arg,
>  				bool interruptible)
>  {
> @@ -223,7 +223,7 @@ static int vmw_overlay_send_stop(struct vmw_private *dev_priv,
>   * used with GMRs instead of being locked to vram.
>   */
>  static int vmw_overlay_move_buffer(struct vmw_private *dev_priv,
> -				   struct vmw_buffer_object *buf,
> +				   struct vmw_bo *buf,
>  				   bool pin, bool inter)
>  {
>  	if (!pin)
> @@ -295,7 +295,7 @@ static int vmw_overlay_stop(struct vmw_private *dev_priv,
>   * -ERESTARTSYS if interrupted.
>   */
>  static int vmw_overlay_update_stream(struct vmw_private *dev_priv,
> -				     struct vmw_buffer_object *buf,
> +				     struct vmw_bo *buf,
>  				     struct drm_vmw_control_stream_arg *arg,
>  				     bool interruptible)
>  {
> @@ -433,7 +433,7 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data,
>  	struct vmw_overlay *overlay = dev_priv->overlay_priv;
>  	struct drm_vmw_control_stream_arg *arg =
>  	    (struct drm_vmw_control_stream_arg *)data;
> -	struct vmw_buffer_object *buf;
> +	struct vmw_bo *buf;
>  	struct vmw_resource *res;
>  	int ret;
>  
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c b/drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c
> index f41f041559f4..c92ca6dabe3c 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2019 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2019-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -24,6 +24,7 @@
>   * USE OR OTHER DEALINGS IN THE SOFTWARE.
>   *
>   **************************************************************************/
> +#include "vmwgfx_bo.h"
>  #include "vmwgfx_drv.h"
>  
>  /*
> @@ -78,7 +79,7 @@ struct vmw_bo_dirty {
>   * dirty structure with the results. This function may change the
>   * dirty-tracking method.
>   */
> -static void vmw_bo_dirty_scan_pagetable(struct vmw_buffer_object *vbo)
> +static void vmw_bo_dirty_scan_pagetable(struct vmw_bo *vbo)
>  {
>  	struct vmw_bo_dirty *dirty = vbo->dirty;
>  	pgoff_t offset = drm_vma_node_start(&vbo->base.base.vma_node);
> @@ -116,7 +117,7 @@ static void vmw_bo_dirty_scan_pagetable(struct vmw_buffer_object *vbo)
>   *
>   * This function may change the dirty-tracking method.
>   */
> -static void vmw_bo_dirty_scan_mkwrite(struct vmw_buffer_object *vbo)
> +static void vmw_bo_dirty_scan_mkwrite(struct vmw_bo *vbo)
>  {
>  	struct vmw_bo_dirty *dirty = vbo->dirty;
>  	unsigned long offset = drm_vma_node_start(&vbo->base.base.vma_node);
> @@ -160,7 +161,7 @@ static void vmw_bo_dirty_scan_mkwrite(struct vmw_buffer_object *vbo)
>   *
>   * This function may change the dirty tracking method.
>   */
> -void vmw_bo_dirty_scan(struct vmw_buffer_object *vbo)
> +void vmw_bo_dirty_scan(struct vmw_bo *vbo)
>  {
>  	struct vmw_bo_dirty *dirty = vbo->dirty;
>  
> @@ -181,7 +182,7 @@ void vmw_bo_dirty_scan(struct vmw_buffer_object *vbo)
>   * when calling unmap_mapping_range(). This function makes sure we pick
>   * up all dirty pages.
>   */
> -static void vmw_bo_dirty_pre_unmap(struct vmw_buffer_object *vbo,
> +static void vmw_bo_dirty_pre_unmap(struct vmw_bo *vbo,
>  				   pgoff_t start, pgoff_t end)
>  {
>  	struct vmw_bo_dirty *dirty = vbo->dirty;
> @@ -206,7 +207,7 @@ static void vmw_bo_dirty_pre_unmap(struct vmw_buffer_object *vbo,
>   *
>   * This is similar to ttm_bo_unmap_virtual() except it takes a subrange.
>   */
> -void vmw_bo_dirty_unmap(struct vmw_buffer_object *vbo,
> +void vmw_bo_dirty_unmap(struct vmw_bo *vbo,
>  			pgoff_t start, pgoff_t end)
>  {
>  	unsigned long offset = drm_vma_node_start(&vbo->base.base.vma_node);
> @@ -227,7 +228,7 @@ void vmw_bo_dirty_unmap(struct vmw_buffer_object *vbo,
>   *
>   * Return: Zero on success, -ENOMEM on memory allocation failure.
>   */
> -int vmw_bo_dirty_add(struct vmw_buffer_object *vbo)
> +int vmw_bo_dirty_add(struct vmw_bo *vbo)
>  {
>  	struct vmw_bo_dirty *dirty = vbo->dirty;
>  	pgoff_t num_pages = PFN_UP(vbo->base.resource->size);
> @@ -284,7 +285,7 @@ int vmw_bo_dirty_add(struct vmw_buffer_object *vbo)
>   *
>   * Return: Zero on success, -ENOMEM on memory allocation failure.
>   */
> -void vmw_bo_dirty_release(struct vmw_buffer_object *vbo)
> +void vmw_bo_dirty_release(struct vmw_bo *vbo)
>  {
>  	struct vmw_bo_dirty *dirty = vbo->dirty;
>  
> @@ -306,7 +307,7 @@ void vmw_bo_dirty_release(struct vmw_buffer_object *vbo)
>   */
>  void vmw_bo_dirty_transfer_to_res(struct vmw_resource *res)
>  {
> -	struct vmw_buffer_object *vbo = res->backup;
> +	struct vmw_bo *vbo = res->backup;
>  	struct vmw_bo_dirty *dirty = vbo->dirty;
>  	pgoff_t start, cur, end;
>  	unsigned long res_start = res->backup_offset;
> @@ -353,7 +354,7 @@ void vmw_bo_dirty_clear_res(struct vmw_resource *res)
>  {
>  	unsigned long res_start = res->backup_offset;
>  	unsigned long res_end = res->backup_offset + res->backup_size;
> -	struct vmw_buffer_object *vbo = res->backup;
> +	struct vmw_bo *vbo = res->backup;
>  	struct vmw_bo_dirty *dirty = vbo->dirty;
>  
>  	res_start >>= PAGE_SHIFT;
> @@ -380,7 +381,7 @@ vm_fault_t vmw_bo_vm_mkwrite(struct vm_fault *vmf)
>  	vm_fault_t ret;
>  	unsigned long page_offset;
>  	unsigned int save_flags;
> -	struct vmw_buffer_object *vbo =
> +	struct vmw_bo *vbo =
>  		container_of(bo, typeof(*vbo), base);
>  
>  	/*
> @@ -419,8 +420,8 @@ vm_fault_t vmw_bo_vm_fault(struct vm_fault *vmf)
>  	struct vm_area_struct *vma = vmf->vma;
>  	struct ttm_buffer_object *bo = (struct ttm_buffer_object *)
>  	    vma->vm_private_data;
> -	struct vmw_buffer_object *vbo =
> -		container_of(bo, struct vmw_buffer_object, base);
> +	struct vmw_bo *vbo =
> +		container_of(bo, struct vmw_bo, base);
>  	pgoff_t num_prefault;
>  	pgprot_t prot;
>  	vm_fault_t ret;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
> index 5879e8b9950a..54e412f8c2d1 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2009-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -27,9 +27,10 @@
>  
>  #include <drm/ttm/ttm_placement.h>
>  
> -#include "vmwgfx_resource_priv.h"
>  #include "vmwgfx_binding.h"
> +#include "vmwgfx_bo.h"
>  #include "vmwgfx_drv.h"
> +#include "vmwgfx_resource_priv.h"
>  
>  #define VMW_RES_EVICT_ERR_COUNT 10
>  
> @@ -39,7 +40,7 @@
>   */
>  void vmw_resource_mob_attach(struct vmw_resource *res)
>  {
> -	struct vmw_buffer_object *backup = res->backup;
> +	struct vmw_bo *backup = res->backup;
>  	struct rb_node **new = &backup->res_tree.rb_node, *parent = NULL;
>  
>  	dma_resv_assert_held(res->backup->base.base.resv);
> @@ -67,7 +68,7 @@ void vmw_resource_mob_attach(struct vmw_resource *res)
>   */
>  void vmw_resource_mob_detach(struct vmw_resource *res)
>  {
> -	struct vmw_buffer_object *backup = res->backup;
> +	struct vmw_bo *backup = res->backup;
>  
>  	dma_resv_assert_held(backup->base.base.resv);
>  	if (vmw_resource_mob_attached(res)) {
> @@ -290,7 +291,7 @@ int vmw_user_lookup_handle(struct vmw_private *dev_priv,
>  			   struct drm_file *filp,
>  			   uint32_t handle,
>  			   struct vmw_surface **out_surf,
> -			   struct vmw_buffer_object **out_buf)
> +			   struct vmw_bo **out_buf)
>  {
>  	struct ttm_object_file *tfile = vmw_fpriv(filp)->tfile;
>  	struct vmw_resource *res;
> @@ -322,7 +323,7 @@ static int vmw_resource_buf_alloc(struct vmw_resource *res,
>  				  bool interruptible)
>  {
>  	unsigned long size = PFN_ALIGN(res->backup_size);
> -	struct vmw_buffer_object *backup;
> +	struct vmw_bo *backup;
>  	int ret;
>  
>  	if (likely(res->backup)) {
> @@ -438,7 +439,7 @@ void vmw_resource_unreserve(struct vmw_resource *res,
>  			    bool dirty_set,
>  			    bool dirty,
>  			    bool switch_backup,
> -			    struct vmw_buffer_object *new_backup,
> +			    struct vmw_bo *new_backup,
>  			    unsigned long new_backup_offset)
>  {
>  	struct vmw_private *dev_priv = res->dev_priv;
> @@ -739,7 +740,7 @@ int vmw_resource_validate(struct vmw_resource *res, bool intr,
>   * validation code, since resource validation and eviction
>   * both require the backup buffer to be reserved.
>   */
> -void vmw_resource_unbind_list(struct vmw_buffer_object *vbo)
> +void vmw_resource_unbind_list(struct vmw_bo *vbo)
>  {
>  	struct ttm_validate_buffer val_buf = {
>  		.bo = &vbo->base,
> @@ -772,7 +773,7 @@ void vmw_resource_unbind_list(struct vmw_buffer_object *vbo)
>   * Read back cached states from the device if they exist.  This function
>   * assumes binding_mutex is held.
>   */
> -int vmw_query_readback_all(struct vmw_buffer_object *dx_query_mob)
> +int vmw_query_readback_all(struct vmw_bo *dx_query_mob)
>  {
>  	struct vmw_resource *dx_query_ctx;
>  	struct vmw_private *dev_priv;
> @@ -821,7 +822,7 @@ void vmw_query_move_notify(struct ttm_buffer_object *bo,
>  			   struct ttm_resource *old_mem,
>  			   struct ttm_resource *new_mem)
>  {
> -	struct vmw_buffer_object *dx_query_mob;
> +	struct vmw_bo *dx_query_mob;
>  	struct ttm_device *bdev = bo->bdev;
>  	struct vmw_private *dev_priv;
>  
> @@ -834,7 +835,7 @@ void vmw_query_move_notify(struct ttm_buffer_object *bo,
>  	    old_mem->mem_type == VMW_PL_MOB) {
>  		struct vmw_fence_obj *fence;
>  
> -		dx_query_mob = container_of(bo, struct vmw_buffer_object, base);
> +		dx_query_mob = container_of(bo, struct vmw_bo, base);
>  		if (!dx_query_mob || !dx_query_mob->dx_query_ctx) {
>  			mutex_unlock(&dev_priv->binding_mutex);
>  			return;
> @@ -958,7 +959,7 @@ int vmw_resource_pin(struct vmw_resource *res, bool interruptible)
>  		goto out_no_reserve;
>  
>  	if (res->pin_count == 0) {
> -		struct vmw_buffer_object *vbo = NULL;
> +		struct vmw_bo *vbo = NULL;
>  
>  		if (res->backup) {
>  			vbo = res->backup;
> @@ -1016,7 +1017,7 @@ void vmw_resource_unpin(struct vmw_resource *res)
>  
>  	WARN_ON(res->pin_count == 0);
>  	if (--res->pin_count == 0 && res->backup) {
> -		struct vmw_buffer_object *vbo = res->backup;
> +		struct vmw_bo *vbo = res->backup;
>  
>  		(void) ttm_bo_reserve(&vbo->base, false, false, NULL);
>  		vmw_bo_pin_reserved(vbo, false);
> @@ -1061,7 +1062,7 @@ void vmw_resource_dirty_update(struct vmw_resource *res, pgoff_t start,
>   * @num_prefault: Returns how many pages including the first have been
>   * cleaned and are ok to prefault
>   */
> -int vmw_resources_clean(struct vmw_buffer_object *vbo, pgoff_t start,
> +int vmw_resources_clean(struct vmw_bo *vbo, pgoff_t start,
>  			pgoff_t end, pgoff_t *num_prefault)
>  {
>  	struct rb_node *cur = vbo->res_tree.rb_node;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
> index e51a63c05943..a04897f04c13 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2011-2022 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2011-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -25,13 +25,14 @@
>   *
>   **************************************************************************/
>  
> +#include "vmwgfx_bo.h"
> +#include "vmwgfx_kms.h"
> +
>  #include <drm/drm_atomic.h>
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_damage_helper.h>
>  #include <drm/drm_fourcc.h>
>  
> -#include "vmwgfx_kms.h"
> -
>  #define vmw_crtc_to_sou(x) \
>  	container_of(x, struct vmw_screen_object_unit, base.crtc)
>  #define vmw_encoder_to_sou(x) \
> @@ -89,7 +90,7 @@ struct vmw_screen_object_unit {
>  	struct vmw_display_unit base;
>  
>  	unsigned long buffer_size; /**< Size of allocated buffer */
> -	struct vmw_buffer_object *buffer; /**< Backing store buffer */
> +	struct vmw_bo *buffer; /**< Backing store buffer */
>  
>  	bool defined;
>  };
> @@ -947,7 +948,7 @@ int vmw_kms_sou_init_display(struct vmw_private *dev_priv)
>  static int do_bo_define_gmrfb(struct vmw_private *dev_priv,
>  				  struct vmw_framebuffer *framebuffer)
>  {
> -	struct vmw_buffer_object *buf =
> +	struct vmw_bo *buf =
>  		container_of(framebuffer, struct vmw_framebuffer_bo,
>  			     base)->buffer;
>  	int depth = framebuffer->base.format->depth;
> @@ -1216,7 +1217,7 @@ int vmw_kms_sou_do_bo_dirty(struct vmw_private *dev_priv,
>  				struct vmw_fence_obj **out_fence,
>  				struct drm_crtc *crtc)
>  {
> -	struct vmw_buffer_object *buf =
> +	struct vmw_bo *buf =
>  		container_of(framebuffer, struct vmw_framebuffer_bo,
>  			     base)->buffer;
>  	struct vmw_kms_dirty dirty;
> @@ -1323,7 +1324,7 @@ int vmw_kms_sou_readback(struct vmw_private *dev_priv,
>  			 uint32_t num_clips,
>  			 struct drm_crtc *crtc)
>  {
> -	struct vmw_buffer_object *buf =
> +	struct vmw_bo *buf =
>  		container_of(vfb, struct vmw_framebuffer_bo, base)->buffer;
>  	struct vmw_kms_dirty dirty;
>  	DECLARE_VAL_CONTEXT(val_ctx, NULL, 0);
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
> index 93b1400aed4a..b186d0993d83 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2009-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -27,9 +27,10 @@
>  
>  #include <drm/ttm/ttm_placement.h>
>  
> +#include "vmwgfx_binding.h"
> +#include "vmwgfx_bo.h"
>  #include "vmwgfx_drv.h"
>  #include "vmwgfx_resource_priv.h"
> -#include "vmwgfx_binding.h"
>  
>  struct vmw_shader {
>  	struct vmw_resource res;
> @@ -158,7 +159,7 @@ static int vmw_gb_shader_init(struct vmw_private *dev_priv,
>  			      SVGA3dShaderType type,
>  			      uint8_t num_input_sig,
>  			      uint8_t num_output_sig,
> -			      struct vmw_buffer_object *byte_code,
> +			      struct vmw_bo *byte_code,
>  			      void (*res_free) (struct vmw_resource *res))
>  {
>  	struct vmw_shader *shader = vmw_res_to_shader(res);
> @@ -680,7 +681,7 @@ int vmw_shader_destroy_ioctl(struct drm_device *dev, void *data,
>  }
>  
>  static int vmw_user_shader_alloc(struct vmw_private *dev_priv,
> -				 struct vmw_buffer_object *buffer,
> +				 struct vmw_bo *buffer,
>  				 size_t shader_size,
>  				 size_t offset,
>  				 SVGA3dShaderType shader_type,
> @@ -734,7 +735,7 @@ static int vmw_user_shader_alloc(struct vmw_private *dev_priv,
>  
>  
>  static struct vmw_resource *vmw_shader_alloc(struct vmw_private *dev_priv,
> -					     struct vmw_buffer_object *buffer,
> +					     struct vmw_bo *buffer,
>  					     size_t shader_size,
>  					     size_t offset,
>  					     SVGA3dShaderType shader_type)
> @@ -771,7 +772,7 @@ static int vmw_shader_define(struct drm_device *dev, struct drm_file *file_priv,
>  {
>  	struct vmw_private *dev_priv = vmw_priv(dev);
>  	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
> -	struct vmw_buffer_object *buffer = NULL;
> +	struct vmw_bo *buffer = NULL;
>  	SVGA3dShaderType shader_type;
>  	int ret;
>  
> @@ -883,7 +884,7 @@ int vmw_compat_shader_add(struct vmw_private *dev_priv,
>  			  struct list_head *list)
>  {
>  	struct ttm_operation_ctx ctx = { false, true };
> -	struct vmw_buffer_object *buf;
> +	struct vmw_bo *buf;
>  	struct ttm_bo_kmap_obj map;
>  	bool is_iomem;
>  	int ret;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> index 0090abe89254..4745537fed25 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /******************************************************************************
>   *
> - * COPYRIGHT (C) 2014-2022 VMware, Inc., Palo Alto, CA., USA
> + * COPYRIGHT (C) 2014-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -25,14 +25,15 @@
>   *
>   ******************************************************************************/
>  
> +#include "vmwgfx_bo.h"
> +#include "vmwgfx_kms.h"
> +#include "vmw_surface_cache.h"
> +
>  #include <drm/drm_atomic.h>
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_damage_helper.h>
>  #include <drm/drm_fourcc.h>
>  
> -#include "vmwgfx_kms.h"
> -#include "vmw_surface_cache.h"
> -
>  #define vmw_crtc_to_stdu(x) \
>  	container_of(x, struct vmw_screen_target_display_unit, base.crtc)
>  #define vmw_encoder_to_stdu(x) \
> @@ -70,7 +71,7 @@ struct vmw_stdu_dirty {
>  	s32 fb_left, fb_top;
>  	u32 pitch;
>  	union {
> -		struct vmw_buffer_object *buf;
> +		struct vmw_bo *buf;
>  		u32 sid;
>  	};
>  };
> @@ -688,7 +689,7 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv,
>  		     bool interruptible,
>  		     struct drm_crtc *crtc)
>  {
> -	struct vmw_buffer_object *buf =
> +	struct vmw_bo *buf =
>  		container_of(vfb, struct vmw_framebuffer_bo, base)->buffer;
>  	struct vmw_stdu_dirty ddirty;
>  	int ret;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_streamoutput.c b/drivers/gpu/drm/vmwgfx/vmwgfx_streamoutput.c
> index 2de97419d5c9..71ce89150ba7 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_streamoutput.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_streamoutput.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright © 2018-2019 VMware, Inc., Palo Alto, CA., USA
> + * Copyright © 2018-2023 VMware, Inc., Palo Alto, CA., USA
>   * All Rights Reserved.
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
> @@ -26,11 +26,12 @@
>   *
>   **************************************************************************/
>  
> -#include <drm/ttm/ttm_placement.h>
> -
> +#include "vmwgfx_binding.h"
> +#include "vmwgfx_bo.h"
>  #include "vmwgfx_drv.h"
>  #include "vmwgfx_resource_priv.h"
> -#include "vmwgfx_binding.h"
> +
> +#include <drm/ttm/ttm_placement.h>
>  
>  /**
>   * struct vmw_dx_streamoutput - Streamoutput resource metadata.
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> index 3bc63ae768f3..296d903c5acb 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2009-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -25,8 +25,7 @@
>   *
>   **************************************************************************/
>  
> -#include <drm/ttm/ttm_placement.h>
> -
> +#include "vmwgfx_bo.h"
>  #include "vmwgfx_drv.h"
>  #include "vmwgfx_resource_priv.h"
>  #include "vmwgfx_so.h"
> @@ -34,6 +33,8 @@
>  #include "vmw_surface_cache.h"
>  #include "device_include/svga3d_surfacedefs.h"
>  
> +#include <drm/ttm/ttm_placement.h>
> +
>  #define SVGA3D_FLAGS_64(upper32, lower32) (((uint64_t)upper32 << 32) | lower32)
>  #define SVGA3D_FLAGS_UPPER_32(svga3d_flags) (svga3d_flags >> 32)
>  #define SVGA3D_FLAGS_LOWER_32(svga3d_flags) \
> @@ -1529,7 +1530,7 @@ vmw_gb_surface_define_internal(struct drm_device *dev,
>  	}
>  
>  	if (req->base.drm_surface_flags & drm_vmw_surface_flag_coherent) {
> -		struct vmw_buffer_object *backup = res->backup;
> +		struct vmw_bo *backup = res->backup;
>  
>  		ttm_bo_reserve(&backup->base, false, false, NULL);
>  		if (!res->func->dirty_alloc)
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
> index 4e3938e62c08..41480af87255 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
> + * Copyright 2009-2023 VMware, Inc., Palo Alto, CA., USA
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the
> @@ -25,6 +25,7 @@
>   *
>   **************************************************************************/
>  
> +#include "vmwgfx_bo.h"
>  #include "vmwgfx_drv.h"
>  #include <drm/ttm/ttm_bo_driver.h>
>  #include <drm/ttm/ttm_placement.h>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_validation.c b/drivers/gpu/drm/vmwgfx/vmwgfx_validation.c
> index f5c4a40fb16d..770b1b53bde7 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_validation.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_validation.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0 OR MIT
>  /**************************************************************************
>   *
> - * Copyright © 2018 - 2022 VMware, Inc., Palo Alto, CA., USA
> + * Copyright © 2018 - 2023 VMware, Inc., Palo Alto, CA., USA
>   * All Rights Reserved.
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
> @@ -25,9 +25,11 @@
>   * USE OR OTHER DEALINGS IN THE SOFTWARE.
>   *
>   **************************************************************************/
> -#include <linux/slab.h>
> -#include "vmwgfx_validation.h"
> +#include "vmwgfx_bo.h"
>  #include "vmwgfx_drv.h"
> +#include "vmwgfx_validation.h"
> +
> +#include <linux/slab.h>
>  
>  
>  #define VMWGFX_VALIDATION_MEM_GRAN (16*PAGE_SIZE)
> @@ -77,7 +79,7 @@ struct vmw_validation_res_node {
>  	struct list_head head;
>  	struct vmwgfx_hash_item hash;
>  	struct vmw_resource *res;
> -	struct vmw_buffer_object *new_backup;
> +	struct vmw_bo *new_backup;
>  	unsigned long new_backup_offset;
>  	u32 no_buffer_needed : 1;
>  	u32 switching_backup : 1;
> @@ -173,7 +175,7 @@ static void vmw_validation_mem_free(struct vmw_validation_context *ctx)
>   */
>  static struct vmw_validation_bo_node *
>  vmw_validation_find_bo_dup(struct vmw_validation_context *ctx,
> -			   struct vmw_buffer_object *vbo)
> +			   struct vmw_bo *vbo)
>  {
>  	struct  vmw_validation_bo_node *bo_node = NULL;
>  
> @@ -264,7 +266,7 @@ vmw_validation_find_res_dup(struct vmw_validation_context *ctx,
>   * Return: Zero on success, negative error code otherwise.
>   */
>  int vmw_validation_add_bo(struct vmw_validation_context *ctx,
> -			  struct vmw_buffer_object *vbo,
> +			  struct vmw_bo *vbo,
>  			  bool as_mob,
>  			  bool cpu_blit)
>  {
> @@ -410,7 +412,7 @@ void vmw_validation_res_set_dirty(struct vmw_validation_context *ctx,
>   */
>  void vmw_validation_res_switch_backup(struct vmw_validation_context *ctx,
>  				      void *val_private,
> -				      struct vmw_buffer_object *vbo,
> +				      struct vmw_bo *vbo,
>  				      unsigned long backup_offset)
>  {
>  	struct vmw_validation_res_node *val;
> @@ -451,7 +453,7 @@ int vmw_validation_res_reserve(struct vmw_validation_context *ctx,
>  
>  		val->reserved = 1;
>  		if (res->backup) {
> -			struct vmw_buffer_object *vbo = res->backup;
> +			struct vmw_bo *vbo = res->backup;
>  
>  			ret = vmw_validation_add_bo
>  				(ctx, vbo, vmw_resource_needs_backup(res),
> @@ -526,8 +528,8 @@ int vmw_validation_bo_validate_single(struct ttm_buffer_object *bo,
>  				      bool interruptible,
>  				      bool validate_as_mob)
>  {
> -	struct vmw_buffer_object *vbo =
> -		container_of(bo, struct vmw_buffer_object, base);
> +	struct vmw_bo *vbo =
> +		container_of(bo, struct vmw_bo, base);
>  	struct ttm_operation_ctx ctx = {
>  		.interruptible = interruptible,
>  		.no_wait_gpu = false
> @@ -578,7 +580,7 @@ int vmw_validation_bo_validate(struct vmw_validation_context *ctx, bool intr)
>  	int ret;
>  
>  	list_for_each_entry(entry, &ctx->bo_list, base.head) {
> -		struct vmw_buffer_object *vbo =
> +		struct vmw_bo *vbo =
>  			container_of(entry->base.bo, typeof(*vbo), base);
>  
>  		if (entry->cpu_blit) {
> @@ -639,7 +641,7 @@ int vmw_validation_res_validate(struct vmw_validation_context *ctx, bool intr)
>  
>  	list_for_each_entry(val, &ctx->resource_list, head) {
>  		struct vmw_resource *res = val->res;
> -		struct vmw_buffer_object *backup = res->backup;
> +		struct vmw_bo *backup = res->backup;
>  
>  		ret = vmw_resource_validate(res, intr, val->dirty_set &&
>  					    val->dirty);
> @@ -651,7 +653,7 @@ int vmw_validation_res_validate(struct vmw_validation_context *ctx, bool intr)
>  
>  		/* Check if the resource switched backup buffer */
>  		if (backup && res->backup && (backup != res->backup)) {
> -			struct vmw_buffer_object *vbo = res->backup;
> +			struct vmw_bo *vbo = res->backup;
>  
>  			ret = vmw_validation_add_bo
>  				(ctx, vbo, vmw_resource_needs_backup(res),
> @@ -889,7 +891,7 @@ void vmw_validation_bo_backoff(struct vmw_validation_context *ctx)
>  	list_for_each_entry(entry, &ctx->bo_list, base.head) {
>  		if (entry->coherent_count) {
>  			unsigned int coherent_count = entry->coherent_count;
> -			struct vmw_buffer_object *vbo =
> +			struct vmw_bo *vbo =
>  				container_of(entry->base.bo, typeof(*vbo),
>  					     base);
>  
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h b/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
> index ab9ec226f433..4aa4f700c65e 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
> @@ -73,7 +73,7 @@ struct vmw_validation_context {
>  	size_t total_mem;
>  };
>  
> -struct vmw_buffer_object;
> +struct vmw_bo;
>  struct vmw_resource;
>  struct vmw_fence_obj;
>  
> @@ -159,7 +159,7 @@ static inline unsigned int vmw_validation_align(unsigned int val)
>  }
>  
>  int vmw_validation_add_bo(struct vmw_validation_context *ctx,
> -			  struct vmw_buffer_object *vbo,
> +			  struct vmw_bo *vbo,
>  			  bool as_mob, bool cpu_blit);
>  int vmw_validation_bo_validate_single(struct ttm_buffer_object *bo,
>  				      bool interruptible,
> @@ -179,7 +179,7 @@ void vmw_validation_res_unreserve(struct vmw_validation_context *ctx,
>  				  bool backoff);
>  void vmw_validation_res_switch_backup(struct vmw_validation_context *ctx,
>  				      void *val_private,
> -				      struct vmw_buffer_object *vbo,
> +				      struct vmw_bo *vbo,
>  				      unsigned long backup_offset);
>  int vmw_validation_res_validate(struct vmw_validation_context *ctx, bool intr);
>  

LGTM!

Reviewed-by: Maaz Mombasawala <mombasawalam@xxxxxxxxxx>

-- 
Maaz Mombasawala (VMware) <maazm@xxxxxxxxxxxx>




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux