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/dist/drm/i915/gt NetBSD-ize execlists_...



details:   https://anonhg.NetBSD.org/src/rev/1c57677c8a39
branches:  trunk
changeset: 1028480:1c57677c8a39
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 11:08:40 2021 +0000

description:
NetBSD-ize execlists_active_{un,}lock_bh


Author: Maya Rashish <maya%NetBSD.org@localhost>
Committer: Taylor R Campbell <riastradh%NetBSD.org@localhost>

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine.h    |  19 ++++++++++++++-
 sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine_cs.c |  20 ++++++++++++++-
 2 files changed, 36 insertions(+), 3 deletions(-)

diffs (106 lines):

diff -r d26a256fd4b0 -r 1c57677c8a39 sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine.h
--- a/sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine.h     Sun Dec 19 11:08:32 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine.h     Sun Dec 19 11:08:40 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_engine.h,v 1.2 2021/12/18 23:45:30 riastradh Exp $       */
+/*     $NetBSD: intel_engine.h,v 1.3 2021/12/19 11:08:40 riastradh Exp $       */
 
 /* SPDX-License-Identifier: MIT */
 #ifndef _INTEL_RINGBUFFER_H_
@@ -112,6 +112,7 @@
        return *READ_ONCE(execlists->active);
 }
 
+#ifdef __linux__
 static inline void
 execlists_active_lock_bh(struct intel_engine_execlists *execlists)
 {
@@ -125,6 +126,22 @@
        tasklet_unlock(&execlists->tasklet);
        local_bh_enable(); /* restore softirq, and kick ksoftirqd! */
 }
+#else
+static inline int
+execlists_active_lock_bh(struct intel_engine_execlists *execlists)
+{
+       int s = splsoftserial(); /* prevent local softirq and lock recursion */
+       tasklet_lock(&execlists->tasklet);
+       return s;
+}
+
+static inline void
+execlists_active_unlock_bh(struct intel_engine_execlists *execlists, int s)
+{
+       tasklet_unlock(&execlists->tasklet);
+       splraise(s); /* restore softirq, and kick ksoftirqd! */
+}
+#endif
 
 struct i915_request *
 execlists_unwind_incomplete_requests(struct intel_engine_execlists *execlists);
diff -r d26a256fd4b0 -r 1c57677c8a39 sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine_cs.c
--- a/sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine_cs.c  Sun Dec 19 11:08:32 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine_cs.c  Sun Dec 19 11:08:40 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_engine_cs.c,v 1.3 2021/12/19 01:21:53 riastradh Exp $    */
+/*     $NetBSD: intel_engine_cs.c,v 1.4 2021/12/19 11:08:40 riastradh Exp $    */
 
 /*
  * Copyright © 2016 Intel Corporation
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_engine_cs.c,v 1.3 2021/12/19 01:21:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_engine_cs.c,v 1.4 2021/12/19 11:08:40 riastradh Exp $");
 
 #include <drm/drm_print.h>
 
@@ -1345,7 +1345,11 @@
                                   idx, hws[idx * 2], hws[idx * 2 + 1]);
                }
 
+#ifdef __linux__
                execlists_active_lock_bh(execlists);
+#else
+               int s = execlists_active_lock_bh(execlists);
+#endif
                rcu_read_lock();
                for (port = execlists->active; (rq = *port); port++) {
                        char hdr[80];
@@ -1385,7 +1389,11 @@
                                intel_timeline_put(tl);
                }
                rcu_read_unlock();
+#ifdef __linux__
                execlists_active_unlock_bh(execlists);
+#else
+               execlists_active_unlock_bh(execlists, s);
+#endif
        } else if (INTEL_GEN(dev_priv) > 6) {
                drm_printf(m, "\tPP_DIR_BASE: 0x%08x\n",
                           ENGINE_READ(engine, RING_PP_DIR_BASE));
@@ -1548,7 +1556,11 @@
        if (!intel_engine_supports_stats(engine))
                return -ENODEV;
 
+#ifdef __linux__
        execlists_active_lock_bh(execlists);
+#else
+       int s = execlists_active_lock_bh(execlists);
+#endif
        write_seqlock_irqsave(&engine->stats.lock, flags);
 
        if (unlikely(engine->stats.enabled == ~0)) {
@@ -1578,7 +1590,11 @@
 
 unlock:
        write_sequnlock_irqrestore(&engine->stats.lock, flags);
+#ifdef __linux__
        execlists_active_unlock_bh(execlists);
+#else
+       execlists_active_unlock_bh(execlists, s);
+#endif
 
        return err;
 }



Home | Main Index | Thread Index | Old Index