From: Matthew Brost <matthew.brost@intel.com>
To: Francois Dugast <francois.dugast@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
Mateusz Jablonski <mateusz.jablonski@intel.com>,
Michal Mrozek <michal.mrozek@intel.com>
Subject: Re: [PATCH v1 1/1] drm/xe/uapi: Restore flags VM_BIND_FLAG_READONLY and VM_BIND_FLAG_IMMEDIATE
Date: Thu, 28 Mar 2024 17:00:09 +0000 [thread overview]
Message-ID: <ZgWiGejixyevimsF@DUT025-TGLU.fm.intel.com> (raw)
In-Reply-To: <20240328143742.7-2-francois.dugast@intel.com>
On Thu, Mar 28, 2024 at 02:37:42PM +0000, Francois Dugast wrote:
> The commit 84a1ed5e6756 ("drm/xe/uapi: Remove unused flags") is partially
> reverted. At the time, flags not used by user space were removed during
> some cleanup. There is now a need for flags DRM_XE_VM_BIND_FLAG_READONLY
> and DRM_XE_VM_BIND_FLAG_IMMEDIATE by the compute runtime, so they are
> brought back.
>
I'd include the link to PR in the commit message too so it will be
included in the log directly.
With that:
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> Cc: Mateusz Jablonski <mateusz.jablonski@intel.com>
> Cc: Michal Mrozek <michal.mrozek@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Francois Dugast <francois.dugast@intel.com>
> ---
> drivers/gpu/drm/xe/xe_vm.c | 13 +++++++++++--
> drivers/gpu/drm/xe/xe_vm_types.h | 4 ++++
> include/uapi/drm/xe_drm.h | 6 ++++++
> 3 files changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 8b32aa5003df..6e56b9a3985b 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -2212,6 +2212,10 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
> struct xe_vma_op *op = gpuva_op_to_vma_op(__op);
>
> if (__op->op == DRM_GPUVA_OP_MAP) {
> + op->map.immediate =
> + flags & DRM_XE_VM_BIND_FLAG_IMMEDIATE;
> + op->map.read_only =
> + flags & DRM_XE_VM_BIND_FLAG_READONLY;
> op->map.is_null = flags & DRM_XE_VM_BIND_FLAG_NULL;
> op->map.dumpable = flags & DRM_XE_VM_BIND_FLAG_DUMPABLE;
> op->map.pat_index = pat_index;
> @@ -2406,6 +2410,8 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct xe_exec_queue *q,
> switch (op->base.op) {
> case DRM_GPUVA_OP_MAP:
> {
> + flags |= op->map.read_only ?
> + VMA_CREATE_FLAG_READ_ONLY : 0;
> flags |= op->map.is_null ?
> VMA_CREATE_FLAG_IS_NULL : 0;
> flags |= op->map.dumpable ?
> @@ -2550,7 +2556,7 @@ static int op_execute(struct drm_exec *exec, struct xe_vm *vm,
> case DRM_GPUVA_OP_MAP:
> err = xe_vm_bind(vm, vma, op->q, xe_vma_bo(vma),
> op->syncs, op->num_syncs,
> - !xe_vm_in_fault_mode(vm),
> + op->map.immediate || !xe_vm_in_fault_mode(vm),
> op->flags & XE_VMA_OP_FIRST,
> op->flags & XE_VMA_OP_LAST);
> break;
> @@ -2825,7 +2831,10 @@ static int vm_bind_ioctl_ops_execute(struct xe_vm *vm,
> return 0;
> }
>
> -#define SUPPORTED_FLAGS (DRM_XE_VM_BIND_FLAG_NULL | \
> +#define SUPPORTED_FLAGS \
> + (DRM_XE_VM_BIND_FLAG_READONLY | \
> + DRM_XE_VM_BIND_FLAG_IMMEDIATE | \
> + DRM_XE_VM_BIND_FLAG_NULL | \
> DRM_XE_VM_BIND_FLAG_DUMPABLE)
> #define XE_64K_PAGE_MASK 0xffffull
> #define ALL_DRM_XE_SYNCS_FLAGS (DRM_XE_SYNCS_FLAG_WAIT_FOR_OP)
> diff --git a/drivers/gpu/drm/xe/xe_vm_types.h b/drivers/gpu/drm/xe/xe_vm_types.h
> index badf3945083d..0447c79c40a2 100644
> --- a/drivers/gpu/drm/xe/xe_vm_types.h
> +++ b/drivers/gpu/drm/xe/xe_vm_types.h
> @@ -276,6 +276,10 @@ struct xe_vm {
> struct xe_vma_op_map {
> /** @vma: VMA to map */
> struct xe_vma *vma;
> + /** @immediate: Immediate bind */
> + bool immediate;
> + /** @read_only: Read only */
> + bool read_only;
> /** @is_null: is NULL binding */
> bool is_null;
> /** @dumpable: whether BO is dumped on GPU hang */
> diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
> index 808ad1c308ec..94e1f3cfe705 100644
> --- a/include/uapi/drm/xe_drm.h
> +++ b/include/uapi/drm/xe_drm.h
> @@ -871,6 +871,10 @@ struct drm_xe_vm_destroy {
> * - %DRM_XE_VM_BIND_OP_PREFETCH
> *
> * and the @flags can be:
> + * - %DRM_XE_VM_BIND_FLAG_READONLY
> + * - %DRM_XE_VM_BIND_FLAG_IMMEDIATE - Valid on a faulting VM only, do the
> + * MAP operation immediately rather than deferring the MAP to the page
> + * fault handler.
> * - %DRM_XE_VM_BIND_FLAG_NULL - When the NULL flag is set, the page
> * tables are setup with a special bit which indicates writes are
> * dropped and all reads return zero. In the future, the NULL flags
> @@ -963,6 +967,8 @@ struct drm_xe_vm_bind_op {
> /** @op: Bind operation to perform */
> __u32 op;
>
> +#define DRM_XE_VM_BIND_FLAG_READONLY (1 << 0)
> +#define DRM_XE_VM_BIND_FLAG_IMMEDIATE (1 << 1)
> #define DRM_XE_VM_BIND_FLAG_NULL (1 << 2)
> #define DRM_XE_VM_BIND_FLAG_DUMPABLE (1 << 3)
> /** @flags: Bind flags */
> --
> 2.34.1
>
next prev parent reply other threads:[~2024-03-28 16:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-28 14:37 [PATCH v1 0/1] Restore flags VM_BIND_FLAG_READONLY and VM_BIND_FLAG_IMMEDIATE Francois Dugast
2024-03-28 14:37 ` [PATCH v1 1/1] drm/xe/uapi: " Francois Dugast
2024-03-28 17:00 ` Matthew Brost [this message]
2024-03-28 20:18 ` ✓ CI.Patch_applied: success for " Patchwork
2024-03-28 20:18 ` ✓ CI.checkpatch: " Patchwork
2024-03-28 20:19 ` ✓ CI.KUnit: " Patchwork
2024-03-28 20:31 ` ✓ CI.Build: " Patchwork
2024-03-28 20:33 ` ✓ CI.Hooks: " Patchwork
2024-03-28 20:34 ` ✓ CI.checksparse: " Patchwork
2024-03-28 21:03 ` ✓ CI.BAT: " Patchwork
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=ZgWiGejixyevimsF@DUT025-TGLU.fm.intel.com \
--to=matthew.brost@intel.com \
--cc=francois.dugast@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=mateusz.jablonski@intel.com \
--cc=michal.mrozek@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox