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 i915: more work



details:   https://anonhg.NetBSD.org/src/rev/c82a8158a1cf
branches:  trunk
changeset: 1028673:c82a8158a1cf
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 11:39:24 2021 +0000

description:
i915: more work

diffstat:

 sys/external/bsd/common/include/linux/list.h             |   4 +-
 sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine_cs.c |   6 +-
 sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c     |  12 +-
 sys/external/bsd/drm2/i915drm/files.i915drmkms           |   8 +-
 sys/external/bsd/drm2/include/linux/llist.h              |   7 +-
 sys/external/bsd/drm2/include/linux/notifier.h           |  40 ++++--
 sys/external/bsd/drm2/linux/files.drmkms_linux           |   3 +-
 sys/external/bsd/drm2/linux/linux_notifier.c             |  95 ++++++++++++++++
 8 files changed, 145 insertions(+), 30 deletions(-)

diffs (truncated from 316 to 300 lines):

diff -r f34e7836844a -r c82a8158a1cf sys/external/bsd/common/include/linux/list.h
--- a/sys/external/bsd/common/include/linux/list.h      Sun Dec 19 11:39:10 2021 +0000
+++ b/sys/external/bsd/common/include/linux/list.h      Sun Dec 19 11:39:24 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: list.h,v 1.31 2021/12/19 11:38:03 riastradh Exp $      */
+/*     $NetBSD: list.h,v 1.32 2021/12/19 11:39:24 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -47,6 +47,8 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 
+#define        POISON_INUSE    0x5a    /* XXX */
+
 /*
  * Doubly-linked lists.  Type defined in <linux/types.h>.
  */
diff -r f34e7836844a -r c82a8158a1cf 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:39:10 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine_cs.c  Sun Dec 19 11:39:24 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_engine_cs.c,v 1.5 2021/12/19 11:38:37 riastradh Exp $    */
+/*     $NetBSD: intel_engine_cs.c,v 1.6 2021/12/19 11:39:24 riastradh Exp $    */
 
 /*
  * Copyright © 2016 Intel Corporation
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_engine_cs.c,v 1.5 2021/12/19 11:38:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_engine_cs.c,v 1.6 2021/12/19 11:39:24 riastradh Exp $");
 
 #include <drm/drm_print.h>
 
@@ -490,7 +490,7 @@
                memset(execlists->inflight, 0, sizeof(execlists->inflight));
 
        execlists->queue_priority_hint = INT_MIN;
-       execlists->queue = RB_ROOT_CACHED;
+       i915_sched_init(execlists);
 }
 
 static void cleanup_status_page(struct intel_engine_cs *engine)
diff -r f34e7836844a -r c82a8158a1cf sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c      Sun Dec 19 11:39:10 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c      Sun Dec 19 11:39:24 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_scheduler.c,v 1.5 2021/12/19 11:37:50 riastradh Exp $     */
+/*     $NetBSD: i915_scheduler.c,v 1.6 2021/12/19 11:39:24 riastradh Exp $     */
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_scheduler.c,v 1.5 2021/12/19 11:37:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_scheduler.c,v 1.6 2021/12/19 11:39:24 riastradh Exp $");
 
 #include <linux/mutex.h>
 
@@ -116,16 +116,20 @@
        .rbto_node_offset = offsetof(struct i915_priolist, node),
 };
 
+#endif
+
 void
 i915_sched_init(struct intel_engine_execlists *execlists)
 {
 
+#ifdef __NetBSD__
        rb_tree_init(&execlists->queue.rb_root.rbr_tree,
            &i915_priolist_rb_ops);
+#else
+       execlists->queue = RB_ROOT_CACHED;
+#endif
 }
 
-#endif
-
 struct list_head *
 i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio)
 {
diff -r f34e7836844a -r c82a8158a1cf sys/external/bsd/drm2/i915drm/files.i915drmkms
--- a/sys/external/bsd/drm2/i915drm/files.i915drmkms    Sun Dec 19 11:39:10 2021 +0000
+++ b/sys/external/bsd/drm2/i915drm/files.i915drmkms    Sun Dec 19 11:39:24 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.i915drmkms,v 1.76 2021/12/19 11:38:37 riastradh Exp $
+#      $NetBSD: files.i915drmkms,v 1.77 2021/12/19 11:39:24 riastradh Exp $
 
 version        20180827
 
@@ -13,10 +13,7 @@
 # overflow is OK.
 makeoptions    i915drmkms      "COPTS.i915drmkms"+="-fwrapv"
 
-makeoptions    intelfb         "CPPFLAGS.intelfb"+="-I$S/external/bsd/drm2/i915drm"
 makeoptions    i915drmkms      "CPPFLAGS.i915drmkms"+="-I$S/external/bsd/drm2/i915drm"
-
-makeoptions    intelfb         "CPPFLAGS.intelfb"+="-I$S/external/bsd/drm2/dist/drm/i915"
 makeoptions    i915drmkms      "CPPFLAGS.i915drmkms"+="-I$S/external/bsd/drm2/dist/drm/i915"
 
 makeoptions    i915drmkms      "CPPFLAGS.i915drmkms"+="-DCONFIG_DRM_FBDEV_EMULATION=1"
@@ -50,6 +47,9 @@
 makeoptions    i915drmkms      "CWARNFLAGS.intel_display.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-implicit-fallthrough :}"
 makeoptions    i915drmkms      "CWARNFLAGS.intel_sdvo.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-implicit-fallthrough :}"
 
+makeoptions    intelfb         "CPPFLAGS.intelfb"+="${CPPFLAGS.i915drmkms}"
+makeoptions    intelfb         "CWARNFLAGS.intelfb"+="${CWARNFLAGS.i915drmkms}"
+
 file   external/bsd/drm2/i915drm/i915_gem_userptr.c    i915drmkms
 file   external/bsd/drm2/i915drm/i915_gemfs.c  i915drmkms
 file   external/bsd/drm2/i915drm/i915_module.c         i915drmkms
diff -r f34e7836844a -r c82a8158a1cf sys/external/bsd/drm2/include/linux/llist.h
--- a/sys/external/bsd/drm2/include/linux/llist.h       Sun Dec 19 11:39:10 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/llist.h       Sun Dec 19 11:39:24 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: llist.h,v 1.4 2021/12/19 11:36:48 riastradh Exp $      */
+/*     $NetBSD: llist.h,v 1.5 2021/12/19 11:39:24 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -110,6 +110,11 @@
            llist_entry(_NODE, __typeof__(*(ENTRY)), FIELD));                 \
 })
 
+#define        llist_for_each_safe(NODE, TMP, HEAD)                                  \
+       for ((NODE) = (HEAD);                                                 \
+               (NODE) && ((TMP) = (NODE)->next, 1);                          \
+               (NODE) = (TMP))
+
 #define        llist_for_each_entry(ENTRY, NODE, FIELD)                              \
        for ((ENTRY) = ((NODE) == NULL ? NULL :                               \
                    (membar_datadep_consumer(),                               \
diff -r f34e7836844a -r c82a8158a1cf sys/external/bsd/drm2/include/linux/notifier.h
--- a/sys/external/bsd/drm2/include/linux/notifier.h    Sun Dec 19 11:39:10 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/notifier.h    Sun Dec 19 11:39:24 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: notifier.h,v 1.3 2018/08/27 07:18:18 riastradh Exp $   */
+/*     $NetBSD: notifier.h,v 1.4 2021/12/19 11:39:24 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,30 +34,38 @@
 
 #include <sys/cdefs.h>
 
+#include <sys/pslist.h>
+
+#include <linux/spinlock.h>
+
+/* namespace */
+#define        ATOMIC_INIT_NOTIFIER_HEAD       linux_ATOMIC_INIT_NOTIFIER_HEAD
+#define        ATOMIC_CLEANUP_NOTIFIER_HEAD    linux_ATOMIC_CLEANUP_NOTIFIER_HEAD
+#define        atomic_notifier_call_chain      linux_atomic_notifier_call_chain
+#define        atomic_notifier_chain_register  linux_atomic_notifier_chain_register
+#define        atomic_notifier_chain_unregister linux_atomic_notifier_chain_unregister
+
 #define        NOTIFY_DONE     0
 #define        NOTIFY_OK       1
 
 struct notifier_block {
-       int     (*notifier_call)(struct notifier_block *, unsigned long,
-                   void *);
+       int (*notifier_call)(struct notifier_block *, unsigned long, void *);
+       struct pslist_entry     nb_entry;
 };
 
 struct atomic_notifier_head {
-       char    anh_blahdittyblahblah;
+       spinlock_t              anh_lock;
+       struct pslist_head      anh_list;
 };
 
-static struct atomic_notifier_head panic_notifier_list __unused;
+void ATOMIC_INIT_NOTIFIER_HEAD(struct atomic_notifier_head *);
+void ATOMIC_CLEANUP_NOTIFIER_HEAD(struct atomic_notifier_head *);
 
-static inline void
-atomic_notifier_chain_register(struct atomic_notifier_head *head __unused,
-    struct notifier_block *block __unused)
-{
-}
-
-static inline void
-atomic_notifier_chain_unregister(struct atomic_notifier_head *head __unused,
-    struct notifier_block *block __unused)
-{
-}
+void atomic_notifier_chain_register(struct atomic_notifier_head *,
+    struct notifier_block *);
+void atomic_notifier_chain_unregister(struct atomic_notifier_head *,
+    struct notifier_block *);
+void atomic_notifier_chain_call(struct atomic_notifier_head *, unsigned long,
+    void *);
 
 #endif  /* _LINUX_NOTIFIER_H_ */
diff -r f34e7836844a -r c82a8158a1cf sys/external/bsd/drm2/linux/files.drmkms_linux
--- a/sys/external/bsd/drm2/linux/files.drmkms_linux    Sun Dec 19 11:39:10 2021 +0000
+++ b/sys/external/bsd/drm2/linux/files.drmkms_linux    Sun Dec 19 11:39:24 2021 +0000
@@ -1,4 +1,4 @@
-#       $NetBSD: files.drmkms_linux,v 1.32 2021/12/19 11:33:31 riastradh Exp $
+#       $NetBSD: files.drmkms_linux,v 1.33 2021/12/19 11:39:24 riastradh Exp $
 
 define drmkms_linux: i2cexec, i2c_bitbang
 
@@ -19,6 +19,7 @@
 file   external/bsd/drm2/linux/linux_kmap.c            drmkms_linux
 file   external/bsd/drm2/linux/linux_list_sort.c       drmkms_linux
 file   external/bsd/drm2/linux/linux_module.c          drmkms_linux
+file   external/bsd/drm2/linux/linux_notifier.c        drmkms_linux
 file   external/bsd/drm2/linux/linux_pci.c             drmkms_linux
 file   external/bsd/drm2/linux/linux_rwsem.c           drmkms_linux
 file   external/bsd/drm2/linux/linux_sg.c              drmkms_linux
diff -r f34e7836844a -r c82a8158a1cf sys/external/bsd/drm2/linux/linux_notifier.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/external/bsd/drm2/linux/linux_notifier.c      Sun Dec 19 11:39:24 2021 +0000
@@ -0,0 +1,95 @@
+/*     $NetBSD: linux_notifier.c,v 1.1 2021/12/19 11:39:24 riastradh Exp $     */
+
+/*-
+ * Copyright (c) 2021 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Taylor R. Campbell.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: linux_notifier.c,v 1.1 2021/12/19 11:39:24 riastradh Exp $");
+
+#include <sys/types.h>
+
+#include <sys/pserialize.h>
+#include <sys/xcall.h>
+
+#include <linux/notifier.h>
+#include <linux/spinlock.h>
+
+void
+ATOMIC_INIT_NOTIFIER_HEAD(struct atomic_notifier_head *H)
+{
+
+       spin_lock_init(&H->anh_lock);
+       PSLIST_INIT(&H->anh_list);
+}
+
+void
+ATOMIC_CLEANUP_NOTIFIER_HEAD(struct atomic_notifier_head *H)
+{
+
+       PSLIST_DESTROY(&H->anh_list);
+       spin_lock_destroy(&H->anh_lock);
+}
+
+void
+atomic_notifier_chain_register(struct atomic_notifier_head *H,
+    struct notifier_block *B)
+{
+
+       spin_lock(&H->anh_lock);
+       PSLIST_WRITER_INSERT_HEAD(&H->anh_list, B, nb_entry);
+       spin_unlock(&H->anh_lock);
+}
+
+void
+atomic_notifier_chain_unregister(struct atomic_notifier_head *H,
+    struct notifier_block *B)
+{
+
+       spin_lock(&H->anh_lock);
+       PSLIST_WRITER_REMOVE(B, nb_entry);
+       spin_unlock(&H->anh_lock);
+
+       xc_barrier(0);
+}



Home | Main Index | Thread Index | Old Index