From: Matthew Auld <matthew.auld@intel.com>
To: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>,
igt-dev@lists.freedesktop.org
Cc: tvrtko.ursulin@intel.com, thomas.hellstrom@intel.com,
daniel.vetter@intel.com, petri.latvala@intel.com
Subject: Re: [igt-dev] [PATCH i-g-t v4 04/11] lib/vm_bind: Add vm_bind specific library functions
Date: Tue, 18 Oct 2022 10:26:39 +0100 [thread overview]
Message-ID: <06b92e9e-818b-44da-e788-beff6785e112@intel.com> (raw)
In-Reply-To: <20221018071705.3906-5-niranjana.vishwanathapura@intel.com>
On 18/10/2022 08:16, Niranjana Vishwanathapura wrote:
> Add vm_bind specific library interfaces.
>
> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
> ---
> lib/i915/i915_vm_bind.c | 61 +++++++++++++++++++++++++++++++++++++++++
> lib/i915/i915_vm_bind.h | 16 +++++++++++
> lib/meson.build | 1 +
> 3 files changed, 78 insertions(+)
> create mode 100644 lib/i915/i915_vm_bind.c
> create mode 100644 lib/i915/i915_vm_bind.h
>
> diff --git a/lib/i915/i915_vm_bind.c b/lib/i915/i915_vm_bind.c
> new file mode 100644
> index 0000000000..5624f589b5
> --- /dev/null
> +++ b/lib/i915/i915_vm_bind.c
> @@ -0,0 +1,61 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2022 Intel Corporation
> + */
> +
> +#include <errno.h>
> +#include <string.h>
> +#include <sys/ioctl.h>
> +
> +#include "ioctl_wrappers.h"
> +#include "i915_drm.h"
> +#include "i915_drm_local.h"
> +#include "i915_vm_bind.h"
> +
> +void i915_vm_bind(int i915, uint32_t vm_id, uint64_t va, uint32_t handle,
> + uint64_t offset, uint64_t length, uint32_t syncobj,
It's not possible to have a valid syncobj = 0 right?
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
> + uint64_t fence_value)
> +{
> + struct drm_i915_gem_vm_bind bind;
> +
> + memset(&bind, 0, sizeof(bind));
> + bind.vm_id = vm_id;
> + bind.handle = handle;
> + bind.start = va;
> + bind.offset = offset;
> + bind.length = length;
> + if (syncobj) {
> + bind.fence.handle = syncobj;
> + bind.fence.value = fence_value;
> + bind.fence.flags = I915_TIMELINE_FENCE_SIGNAL;
> + }
> +
> + gem_vm_bind(i915, &bind);
> +}
> +
> +void i915_vm_unbind(int i915, uint32_t vm_id, uint64_t va, uint64_t length)
> +{
> + struct drm_i915_gem_vm_unbind unbind;
> +
> + memset(&unbind, 0, sizeof(unbind));
> + unbind.vm_id = vm_id;
> + unbind.start = va;
> + unbind.length = length;
> +
> + gem_vm_unbind(i915, &unbind);
> +}
> +
> +int i915_vm_bind_version(int i915)
> +{
> + struct drm_i915_getparam gp;
> + int value = 0;
> +
> + memset(&gp, 0, sizeof(gp));
> + gp.param = I915_PARAM_VM_BIND_VERSION;
> + gp.value = &value;
> +
> + ioctl(i915, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp));
> + errno = 0;
> +
> + return value;
> +}
> diff --git a/lib/i915/i915_vm_bind.h b/lib/i915/i915_vm_bind.h
> new file mode 100644
> index 0000000000..46a382c032
> --- /dev/null
> +++ b/lib/i915/i915_vm_bind.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2022 Intel Corporation
> + */
> +#ifndef _I915_VM_BIND_H_
> +#define _I915_VM_BIND_H_
> +
> +#include <stdint.h>
> +
> +void i915_vm_bind(int i915, uint32_t vm_id, uint64_t va, uint32_t handle,
> + uint64_t offset, uint64_t length, uint32_t syncobj,
> + uint64_t fence_value);
> +void i915_vm_unbind(int i915, uint32_t vm_id, uint64_t va, uint64_t length);
> +int i915_vm_bind_version(int i915);
> +
> +#endif /* _I915_VM_BIND_ */
> diff --git a/lib/meson.build b/lib/meson.build
> index 8d6c8a244a..e50a2b0e79 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -14,6 +14,7 @@ lib_sources = [
> 'i915/intel_mocs.c',
> 'i915/i915_blt.c',
> 'i915/i915_crc.c',
> + 'i915/i915_vm_bind.c',
> 'igt_collection.c',
> 'igt_color_encoding.c',
> 'igt_crc.c',
next prev parent reply other threads:[~2022-10-18 9:26 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-18 7:16 [igt-dev] [PATCH i-g-t v4 00/11] vm_bind: Add VM_BIND validation support Niranjana Vishwanathapura
2022-10-18 7:16 ` [igt-dev] [PATCH i-g-t v4 01/11] lib/vm_bind: import uapi definitions Niranjana Vishwanathapura
2022-10-18 7:16 ` [igt-dev] [PATCH i-g-t v4 02/11] lib/vm_bind: Add vm_bind/unbind and execbuf3 ioctls Niranjana Vishwanathapura
2022-10-18 7:16 ` [igt-dev] [PATCH i-g-t v4 03/11] lib/vm_bind: Add vm_bind mode support for VM Niranjana Vishwanathapura
2022-10-18 7:16 ` [igt-dev] [PATCH i-g-t v4 04/11] lib/vm_bind: Add vm_bind specific library functions Niranjana Vishwanathapura
2022-10-18 9:26 ` Matthew Auld [this message]
2022-10-18 14:43 ` Niranjana Vishwanathapura
2022-10-18 7:16 ` [igt-dev] [PATCH i-g-t v4 05/11] lib/vm_bind: Add __prime_handle_to_fd() Niranjana Vishwanathapura
2022-10-18 7:17 ` [igt-dev] [PATCH i-g-t v4 06/11] tests/i915/vm_bind: Add vm_bind sanity test Niranjana Vishwanathapura
2022-10-18 7:17 ` [igt-dev] [PATCH i-g-t v4 07/11] tests/i915/vm_bind: Add basic VM_BIND test support Niranjana Vishwanathapura
2022-10-21 16:27 ` Matthew Auld
2022-10-25 7:06 ` Niranjana Vishwanathapura
2022-10-28 16:38 ` Matthew Auld
2022-10-18 7:17 ` [igt-dev] [PATCH i-g-t v4 08/11] tests/i915/vm_bind: Add userptr subtest Niranjana Vishwanathapura
2022-10-18 7:17 ` [igt-dev] [PATCH i-g-t v4 09/11] tests/i915/vm_bind: Add gem_exec3_basic test Niranjana Vishwanathapura
2022-10-18 9:34 ` Matthew Auld
2022-10-18 14:46 ` Niranjana Vishwanathapura
2022-10-18 7:17 ` [igt-dev] [PATCH i-g-t v4 10/11] tests/i915/vm_bind: Add gem_exec3_balancer test Niranjana Vishwanathapura
2022-10-21 16:42 ` Matthew Auld
2022-10-21 20:11 ` Niranjana Vishwanathapura
2022-10-21 20:47 ` Niranjana Vishwanathapura
2022-10-24 15:26 ` Matthew Auld
2022-10-25 7:08 ` Niranjana Vishwanathapura
2022-10-18 7:17 ` [igt-dev] [PATCH i-g-t v4 11/11] tests/i915/vm_bind: Add gem_lmem_swapping@vm_bind sub test Niranjana Vishwanathapura
2022-10-21 17:20 ` Matthew Auld
2022-10-25 7:10 ` Niranjana Vishwanathapura
2022-10-18 7:45 ` [igt-dev] ✓ Fi.CI.BAT: success for vm_bind: Add VM_BIND validation support (rev8) Patchwork
2022-10-18 22:13 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=06b92e9e-818b-44da-e788-beff6785e112@intel.com \
--to=matthew.auld@intel.com \
--cc=daniel.vetter@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=niranjana.vishwanathapura@intel.com \
--cc=petri.latvala@intel.com \
--cc=thomas.hellstrom@intel.com \
--cc=tvrtko.ursulin@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