All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.william.auld@gmail.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	ML dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 01/13] drm/ttm: add ttm_sys_manager v2
Date: Fri, 30 Apr 2021 11:09:43 +0100	[thread overview]
Message-ID: <CAM0jSHPGHP_5gLBt_onFbaN=2saT2TVEnrvv2PMb5zB35mMs_g@mail.gmail.com> (raw)
In-Reply-To: <20210430092508.60710-1-christian.koenig@amd.com>

On Fri, 30 Apr 2021 at 10:25, Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> Add a separate manager for the system domain and make function tables
> mandatory.
>
> v2: debug is still optional
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/gpu/drm/ttm/Makefile          |  2 +-
>  drivers/gpu/drm/ttm/ttm_device.c      | 17 +-----------
>  drivers/gpu/drm/ttm/ttm_module.h      |  3 ++
>  drivers/gpu/drm/ttm/ttm_resource.c    | 11 ++------
>  drivers/gpu/drm/ttm/ttm_sys_manager.c | 40 +++++++++++++++++++++++++++
>  5 files changed, 48 insertions(+), 25 deletions(-)
>  create mode 100644 drivers/gpu/drm/ttm/ttm_sys_manager.c
>
> diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile
> index 40e5e9da7953..f906b22959cf 100644
> --- a/drivers/gpu/drm/ttm/Makefile
> +++ b/drivers/gpu/drm/ttm/Makefile
> @@ -4,7 +4,7 @@
>
>  ttm-y := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
>         ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \
> -       ttm_device.o
> +       ttm_device.o ttm_sys_manager.o
>  ttm-$(CONFIG_AGP) += ttm_agp_backend.o
>
>  obj-$(CONFIG_DRM_TTM) += ttm.o
> diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
> index b169e9a4f5d4..460953dcad11 100644
> --- a/drivers/gpu/drm/ttm/ttm_device.c
> +++ b/drivers/gpu/drm/ttm/ttm_device.c
> @@ -165,21 +165,6 @@ int ttm_device_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx,
>  }
>  EXPORT_SYMBOL(ttm_device_swapout);
>
> -static void ttm_init_sysman(struct ttm_device *bdev)
> -{
> -       struct ttm_resource_manager *man = &bdev->sysman;
> -
> -       /*
> -        * Initialize the system memory buffer type.
> -        * Other types need to be driver / IOCTL initialized.
> -        */
> -       man->use_tt = true;
> -
> -       ttm_resource_manager_init(man, 0);
> -       ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, man);
> -       ttm_resource_manager_set_used(man, true);
> -}
> -
>  static void ttm_device_delayed_workqueue(struct work_struct *work)
>  {
>         struct ttm_device *bdev =
> @@ -222,7 +207,7 @@ int ttm_device_init(struct ttm_device *bdev, struct ttm_device_funcs *funcs,
>
>         bdev->funcs = funcs;
>
> -       ttm_init_sysman(bdev);
> +       ttm_sys_man_init(bdev);
>         ttm_pool_init(&bdev->pool, dev, use_dma_alloc, use_dma32);
>
>         bdev->vma_manager = vma_manager;
> diff --git a/drivers/gpu/drm/ttm/ttm_module.h b/drivers/gpu/drm/ttm/ttm_module.h
> index d7cac5d4b835..26564a98958f 100644
> --- a/drivers/gpu/drm/ttm/ttm_module.h
> +++ b/drivers/gpu/drm/ttm/ttm_module.h
> @@ -34,7 +34,10 @@
>  #define TTM_PFX "[TTM] "
>
>  struct dentry;
> +struct ttm_device;
>
>  extern struct dentry *ttm_debugfs_root;
>
> +int ttm_sys_man_init(struct ttm_device *bdev);
> +
>  #endif /* _TTM_MODULE_H_ */
> diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c
> index 04f2eef653ab..fc351700d035 100644
> --- a/drivers/gpu/drm/ttm/ttm_resource.c
> +++ b/drivers/gpu/drm/ttm/ttm_resource.c
> @@ -33,9 +33,6 @@ int ttm_resource_alloc(struct ttm_buffer_object *bo,
>                 ttm_manager_type(bo->bdev, res->mem_type);
>
>         res->mm_node = NULL;
> -       if (!man->func || !man->func->alloc)
> -               return 0;
> -
>         return man->func->alloc(man, bo, place, res);
>  }
>
> @@ -44,9 +41,7 @@ void ttm_resource_free(struct ttm_buffer_object *bo, struct ttm_resource *res)
>         struct ttm_resource_manager *man =
>                 ttm_manager_type(bo->bdev, res->mem_type);
>
> -       if (man->func && man->func->free)
> -               man->func->free(man, res);
> -
> +       man->func->free(man, res);
>         res->mm_node = NULL;
>         res->mem_type = TTM_PL_SYSTEM;
>  }
> @@ -139,7 +134,7 @@ void ttm_resource_manager_debug(struct ttm_resource_manager *man,
>         drm_printf(p, "  use_type: %d\n", man->use_type);
>         drm_printf(p, "  use_tt: %d\n", man->use_tt);
>         drm_printf(p, "  size: %llu\n", man->size);
> -       if (man->func && man->func->debug)
> -               (*man->func->debug)(man, p);
> +       if (man->func->debug)
> +               man->func->debug(man, p);
>  }
>  EXPORT_SYMBOL(ttm_resource_manager_debug);
> diff --git a/drivers/gpu/drm/ttm/ttm_sys_manager.c b/drivers/gpu/drm/ttm/ttm_sys_manager.c
> new file mode 100644
> index 000000000000..ed92615214e3
> --- /dev/null
> +++ b/drivers/gpu/drm/ttm/ttm_sys_manager.c
> @@ -0,0 +1,40 @@
> +/* SPDX-License-Identifier: GPL-2.0 OR MIT */
> +
> +#include <drm/ttm/ttm_resource.h>
> +#include <drm/ttm/ttm_device.h>
> +#include <drm/ttm/ttm_placement.h>
> +
> +static int ttm_sys_man_alloc(struct ttm_resource_manager *man,
> +                            struct ttm_buffer_object *bo,
> +                            const struct ttm_place *place,
> +                            struct ttm_resource *mem)
> +{
> +       return 0;
> +}
> +
> +static void ttm_sys_man_free(struct ttm_resource_manager *man,
> +                            struct ttm_resource *mem)
> +{
> +}
> +
> +static const struct ttm_resource_manager_func ttm_sys_manager_func = {
> +       .alloc = ttm_sys_man_alloc,
> +       .free = ttm_sys_man_free,
> +};
> +
> +int ttm_sys_man_init(struct ttm_device *bdev)
> +{
> +       struct ttm_resource_manager *man = &bdev->sysman;
> +
> +       /*
> +        * Initialize the system memory buffer type.
> +        * Other types need to be driver / IOCTL initialized.
> +        */
> +       man->use_tt = true;
> +       man->func = &ttm_sys_manager_func;
> +
> +       ttm_resource_manager_init(man, 0);
> +       ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, man);
> +       ttm_resource_manager_set_used(man, true);
> +       return 0;
> +}

Can this return non-zero value later in the series? If not, we can
maybe just make this void.

Either way,
Reviewed-by: Matthew Auld <matthew.auld@intel.com>

> --
> 2.25.1
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      parent reply	other threads:[~2021-04-30 10:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30  9:24 [PATCH 01/13] drm/ttm: add ttm_sys_manager v2 Christian König
2021-04-30  9:24 ` [PATCH 02/13] drm/ttm: always initialize the full ttm_resource Christian König
2021-04-30 12:05   ` Matthew Auld
2021-04-30 12:51     ` Christian König
2021-04-30  9:24 ` [PATCH 03/13] drm/ttm: properly allocate sys resource during swapout Christian König
2021-04-30 10:22   ` Matthew Auld
2021-04-30  9:24 ` [PATCH 04/13] drm/ttm: rename bo->mem and make it a pointer Christian König
2021-04-30  9:25 ` [PATCH 05/13] drm/ttm: allocate resource object instead of embedding it Christian König
2021-04-30 11:19   ` Matthew Auld
2021-04-30  9:25 ` [PATCH 06/13] drm/ttm: flip over the range manager to self allocated nodes Christian König
2021-04-30 13:14   ` Matthew Auld
2021-05-29 15:48   ` Thomas Hellström (Intel)
2021-05-30 16:51     ` Christian König
2021-05-31  8:56       ` Thomas Hellström (Intel)
2021-04-30  9:25 ` [PATCH 07/13] drm/ttm: flip over the sys " Christian König
2021-04-30 13:16   ` Matthew Auld
2021-04-30 15:04   ` Matthew Auld
2021-05-03 11:08     ` Christian König
2021-04-30  9:25 ` [PATCH 08/13] drm/amdgpu: revert "drm/amdgpu: stop allocating dummy GTT nodes" Christian König
2021-05-05 16:48   ` Matthew Auld
2021-04-30  9:25 ` [PATCH 09/13] drm/amdgpu: switch the GTT backend to self alloc Christian König
2021-04-30 14:43   ` Matthew Auld
2021-04-30  9:25 ` [PATCH 10/13] drm/amdgpu: switch the VRAM " Christian König
2021-04-30 14:53   ` Matthew Auld
2021-04-30  9:25 ` [PATCH 11/13] drm/nouveau: switch the TTM backends " Christian König
2021-04-30 15:02   ` Matthew Auld
2021-05-03 11:14     ` Christian König
2021-05-05 16:46       ` Matthew Auld
2021-04-30  9:25 ` [PATCH 12/13] drm/vmwgfx: " Christian König
2021-05-05 16:49   ` Matthew Auld
2021-04-30  9:25 ` [PATCH 13/13] drm/ttm: flip the switch for driver allocated resources Christian König
2021-05-03 16:15   ` Nirmoy
2021-05-05 16:44   ` Matthew Auld
2021-04-30 10:09 ` Matthew Auld [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM0jSHPGHP_5gLBt_onFbaN=2saT2TVEnrvv2PMb5zB35mMs_g@mail.gmail.com' \
    --to=matthew.william.auld@gmail.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.