Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/drm2/linux reservation_object_lock/lock_int...



details:   https://anonhg.NetBSD.org/src/rev/59302dd7da47
branches:  trunk
changeset: 1027949:59302dd7da47
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 01:20:30 2021 +0000

description:
reservation_object_lock/lock_interruptible/trylock/unlock

diffstat:

 sys/external/bsd/drm2/include/linux/reservation.h |  12 ++++-
 sys/external/bsd/drm2/linux/linux_reservation.c   |  63 +++++++++++++++++++++-
 2 files changed, 71 insertions(+), 4 deletions(-)

diffs (120 lines):

diff -r 499b1f204037 -r 59302dd7da47 sys/external/bsd/drm2/include/linux/reservation.h
--- a/sys/external/bsd/drm2/include/linux/reservation.h Sun Dec 19 01:20:22 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/reservation.h Sun Dec 19 01:20:30 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: reservation.h,v 1.10 2021/12/19 01:20:22 riastradh Exp $       */
+/*     $NetBSD: reservation.h,v 1.11 2021/12/19 01:20:30 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -71,9 +71,13 @@
 #define        reservation_object_held                 linux_reservation_object_held
 #define        reservation_object_init                 linux_reservation_object_init
 #define        reservation_object_kqfilter             linux_reservation_object_kqfilter
+#define        reservation_object_lock                 linux_reservation_object_lock
+#define        reservation_object_lock_interruptible   linux_reservation_object_lock_interruptible
 #define        reservation_object_poll                 linux_reservation_object_poll
 #define        reservation_object_reserve_shared       linux_reservation_object_reserve_shared
 #define        reservation_object_test_signaled_rcu    linux_reservation_object_test_signaled_rcu
+#define        reservation_object_trylock              linux_reservation_object_trylock
+#define        reservation_object_unlock               linux_reservation_object_unlock
 #define        reservation_object_wait_timeout_rcu     linux_reservation_object_wait_timeout_rcu
 #define        reservation_poll_fini                   linux_reservation_poll_fini
 #define        reservation_poll_init                   linux_reservation_poll_init
@@ -83,6 +87,12 @@
 
 void   reservation_object_init(struct reservation_object *);
 void   reservation_object_fini(struct reservation_object *);
+int    reservation_object_lock(struct reservation_object *,
+           struct ww_acquire_ctx *);
+int    reservation_object_lock_interruptible(struct reservation_object *,
+           struct ww_acquire_ctx *);
+bool   reservation_object_trylock(struct reservation_object *) __must_check;
+void   reservation_object_unlock(struct reservation_object *);
 bool   reservation_object_held(struct reservation_object *);
 struct dma_fence *
        reservation_object_get_excl(struct reservation_object *);
diff -r 499b1f204037 -r 59302dd7da47 sys/external/bsd/drm2/linux/linux_reservation.c
--- a/sys/external/bsd/drm2/linux/linux_reservation.c   Sun Dec 19 01:20:22 2021 +0000
+++ b/sys/external/bsd/drm2/linux/linux_reservation.c   Sun Dec 19 01:20:30 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_reservation.c,v 1.16 2021/12/19 01:20:22 riastradh Exp $ */
+/*     $NetBSD: linux_reservation.c,v 1.17 2021/12/19 01:20:30 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_reservation.c,v 1.16 2021/12/19 01:20:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_reservation.c,v 1.17 2021/12/19 01:20:30 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/poll.h>
@@ -120,7 +120,64 @@
 }
 
 /*
- * reservation_object_held(roj)
+ * reservation_object_lock(robj, ctx)
+ *
+ *     Acquire a reservation object's lock.  Return 0 on success,
+ *     -EALREADY if caller already holds it, -EDEADLK if a
+ *     higher-priority owner holds it and the caller must back out and
+ *     retry.
+ */
+int
+reservation_object_lock(struct reservation_object *robj,
+    struct ww_acquire_ctx *ctx)
+{
+
+       return ww_mutex_lock(&robj->lock, ctx);
+}
+
+/*
+ * reservation_object_lock_interruptible(robj, ctx)
+ *
+ *     Acquire a reservation object's lock.  Return 0 on success,
+ *     -EALREADY if caller already holds it, -EDEADLK if a
+ *     higher-priority owner holds it and the caller must back out and
+ *     retry, -ERESTART/-EINTR if interrupted.
+ */
+int
+reservation_object_lock_interruptible(struct reservation_object *robj,
+    struct ww_acquire_ctx *ctx)
+{
+
+       return ww_mutex_lock_interruptible(&robj->lock, ctx);
+}
+
+/*
+ * reservation_object_trylock(robj)
+ *
+ *     Try to acquire a reservation object's lock without blocking.
+ *     Return true on success, false on failure.
+ */
+bool
+reservation_object_trylock(struct reservation_object *robj)
+{
+
+       return ww_mutex_trylock(&robj->lock);
+}
+
+/*
+ * reservation_object_unlock(robj)
+ *
+ *     Release a reservation object's lock.
+ */
+void
+reservation_object_unlock(struct reservation_object *robj)
+{
+
+       return ww_mutex_unlock(&robj->lock);
+}
+
+/*
+ * reservation_object_held(robj)
  *
  *     True if robj is locked.
  */



Home | Main Index | Thread Index | Old Index