summaryrefslogtreecommitdiff
path: root/tests/i915/gem_vm_create.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2020-03-19 14:31:54 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2020-03-24 21:06:42 +0000
commitd663bfe84ed9ad122ccf87cc05d153ee28554c01 (patch)
treef24a4986d9b6a30ded35760c7a55cf69515c8a9b /tests/i915/gem_vm_create.c
parentbf17da7fdd7f1d3b4b2f21bccd2a4d17813e5ba7 (diff)
i915/gem_vm_create: Update of active VM disallowed
Allow the kernel the rights to reject updating an active VM with -EBUSY. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/i915/gem_vm_create.c')
-rw-r--r--tests/i915/gem_vm_create.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/i915/gem_vm_create.c b/tests/i915/gem_vm_create.c
index e14b07b5..a6d2dd91 100644
--- a/tests/i915/gem_vm_create.c
+++ b/tests/i915/gem_vm_create.c
@@ -164,6 +164,7 @@ static void check_same_vm(int i915, uint32_t ctx_a, uint32_t ctx_b)
eb.rsvd1 = ctx_a;
gem_execbuf(i915, &eb);
igt_assert_eq_u64(batch.offset, 48 << 20);
+ gem_sync(i915, batch.handle); /* be still */
/* An already active VMA will try to keep its offset */
batch.offset = 0;
@@ -224,6 +225,7 @@ static void execbuf(int i915)
batch.offset = 48 << 20;
gem_execbuf(i915, &eb);
igt_assert_eq_u64(batch.offset, 48 << 20);
+ gem_sync(i915, batch.handle);
arg.value = gem_vm_create(i915);
gem_context_set_param(i915, &arg);
@@ -231,6 +233,8 @@ static void execbuf(int i915)
igt_assert_eq_u64(batch.offset, 48 << 20);
gem_vm_destroy(i915, arg.value);
+ gem_sync(i915, batch.handle); /* be idle! */
+
arg.value = gem_vm_create(i915);
gem_context_set_param(i915, &arg);
batch.offset = 0;
@@ -354,13 +358,18 @@ static void async_destroy(int i915)
.param = I915_CONTEXT_PARAM_VM,
};
igt_spin_t *spin[2];
+ int err;
spin[0] = igt_spin_new(i915,
.ctx = arg.ctx_id,
.flags = IGT_SPIN_POLL_RUN);
igt_spin_busywait_until_started(spin[0]);
- gem_context_set_param(i915, &arg);
+ err = __gem_context_set_param(i915, &arg);
+ if (err == -EBUSY) /* update while busy may be verboten, let it ride. */
+ err = 0;
+ igt_assert_eq(err, 0);
+
spin[1] = __igt_spin_new(i915, .ctx = arg.ctx_id);
igt_spin_end(spin[0]);