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/include/linux/sched amdgpu: make most ...



details:   https://anonhg.NetBSD.org/src/rev/2ca4c5d12062
branches:  trunk
changeset: 1028874:2ca4c5d12062
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:22:28 2021 +0000

description:
amdgpu: make most of amdgpu_vm.c build

Not quite done yet -- need to adapt the DMA address logic to use
bus_dmamap_t.

diffstat:

 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c       |  16 ++++++---
 sys/external/bsd/drm2/include/linux/interval_tree_generic.h |  20 ++++++++++++-
 sys/external/bsd/drm2/include/linux/sched/mm.h              |  15 +++++++++-
 3 files changed, 43 insertions(+), 8 deletions(-)

diffs (147 lines):

diff -r d046e8328e0f -r 2ca4c5d12062 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c     Sun Dec 19 12:22:19 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c     Sun Dec 19 12:22:28 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_vm.c,v 1.5 2021/12/18 23:44:58 riastradh Exp $  */
+/*     $NetBSD: amdgpu_vm.c,v 1.6 2021/12/19 12:22:28 riastradh Exp $  */
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -28,7 +28,7 @@
  *          Jerome Glisse
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_vm.c,v 1.5 2021/12/18 23:44:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_vm.c,v 1.6 2021/12/19 12:22:28 riastradh Exp $");
 
 #include <linux/dma-fence-array.h>
 #include <linux/interval_tree_generic.h>
@@ -2194,7 +2194,7 @@
        if (tmp) {
                /* bo and tmp overlap, invalid addr */
                dev_err(adev->dev, "bo %p va 0x%010"PRIx64"-0x%010"PRIx64" conflict with "
-                       "0x%010Lx-0x%010Lx\n", bo, saddr, eaddr,
+                       "0x%010"PRIx64"-0x%010"PRIx64"\n", bo, saddr, eaddr,
                        tmp->start, tmp->last + 1);
                return -EINVAL;
        }
@@ -2396,7 +2396,7 @@
                list_del(&tmp->list);
                list_add(&tmp->list, &removed);
 
-               tmp = amdgpu_vm_it_iter_next(tmp, saddr, eaddr);
+               tmp = amdgpu_vm_it_iter_next(&vm->va, tmp, saddr, eaddr);
        }
 
        /* And free them up */
@@ -2469,7 +2469,7 @@
                return;
 
        for (mapping = amdgpu_vm_it_iter_first(&vm->va, 0, U64_MAX); mapping;
-            mapping = amdgpu_vm_it_iter_next(mapping, 0, U64_MAX)) {
+            mapping = amdgpu_vm_it_iter_next(&vm->va, mapping, 0, U64_MAX)) {
                if (mapping->bo_va && mapping->bo_va->base.bo) {
                        struct amdgpu_bo *bo;
 
@@ -2775,7 +2775,7 @@
        int r, i;
 
 #ifdef __NetBSD__
-       interval_tree_init(&vm->va);
+       amdgpu_vm_it_init(&vm->va);
 #else
        vm->va = RB_ROOT_CACHED;
 #endif
@@ -3228,6 +3228,7 @@
 void amdgpu_vm_get_task_info(struct amdgpu_device *adev, unsigned int pasid,
                         struct amdgpu_task_info *task_info)
 {
+#ifndef __NetBSD__             /* XXX amdgpu task info */
        struct amdgpu_vm *vm;
        unsigned long flags;
 
@@ -3238,6 +3239,7 @@
                *task_info = vm->task_info;
 
        spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, flags);
+#endif
 }
 
 /**
@@ -3247,6 +3249,7 @@
  */
 void amdgpu_vm_set_task_info(struct amdgpu_vm *vm)
 {
+#ifndef __NetBSD__             /* XXX amdgpu task info */
        if (vm->task_info.pid)
                return;
 
@@ -3258,6 +3261,7 @@
 
        vm->task_info.tgid = current->group_leader->pid;
        get_task_comm(vm->task_info.process_name, current->group_leader);
+#endif
 }
 
 /**
diff -r d046e8328e0f -r 2ca4c5d12062 sys/external/bsd/drm2/include/linux/interval_tree_generic.h
--- a/sys/external/bsd/drm2/include/linux/interval_tree_generic.h       Sun Dec 19 12:22:19 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/interval_tree_generic.h       Sun Dec 19 12:22:28 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: interval_tree_generic.h,v 1.3 2021/12/19 11:00:18 riastradh Exp $      */
+/*     $NetBSD: interval_tree_generic.h,v 1.4 2021/12/19 12:22:28 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -108,6 +108,24 @@
                return NULL;                                                  \
                                                                              \
        return __node;                                                        \
+}                                                                            \
+                                                                             \
+QUAL T *                                                                     \
+PREFIX##_iter_next(struct rb_root_cached *__root, T *__node,                 \
+    KT __start, KT __last)                                                   \
+{                                                                            \
+       T *__next;                                                            \
+                                                                             \
+       KASSERT(__node != NULL);                                              \
+       __next = rb_tree_iterate(&__root->rb_root.rbr_tree, __node,           \
+           RB_DIR_RIGHT);                                                    \
+       if (__next == NULL)                                                   \
+               return NULL;                                                  \
+       if (__last < START(__next))                                           \
+               return NULL;                                                  \
+       KASSERT(LAST(__next) >= __start);                                     \
+                                                                             \
+       return __next;                                                        \
 }
 
 #endif /* _LINUX_INTERVAL_TREE_GENERIC_H_ */
diff -r d046e8328e0f -r 2ca4c5d12062 sys/external/bsd/drm2/include/linux/sched/mm.h
--- a/sys/external/bsd/drm2/include/linux/sched/mm.h    Sun Dec 19 12:22:19 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/sched/mm.h    Sun Dec 19 12:22:28 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mm.h,v 1.3 2021/12/19 11:55:58 riastradh Exp $ */
+/*     $NetBSD: mm.h,v 1.4 2021/12/19 12:22:28 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -57,4 +57,17 @@
 {
 }
 
+static inline unsigned
+memalloc_nofs_save(void)
+{
+       return 0xeb13162c;
+}
+
+static inline void
+memalloc_nofs_restore(unsigned flags)
+{
+
+       KASSERT(flags == 0xeb13162c);
+}
+
 #endif /* _LINUX_SCHED_MM_H_ */



Home | Main Index | Thread Index | Old Index