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 drm/mm: Allow hole address ra...



details:   https://anonhg.NetBSD.org/src/rev/95e13c961119
branches:  trunk
changeset: 361569:95e13c961119
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Feb 14 13:22:21 2022 +0000

description:
drm/mm: Allow hole address range queries.

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_mm.c |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (50 lines):

diff -r 222c6b225795 -r 95e13c961119 sys/external/bsd/drm2/dist/drm/drm_mm.c
--- a/sys/external/bsd/drm2/dist/drm/drm_mm.c   Mon Feb 14 13:22:11 2022 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_mm.c   Mon Feb 14 13:22:21 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_mm.c,v 1.16 2022/02/14 13:22:11 riastradh Exp $    */
+/*     $NetBSD: drm_mm.c,v 1.17 2022/02/14 13:22:21 riastradh Exp $    */
 
 /**************************************************************************
  *
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_mm.c,v 1.16 2022/02/14 13:22:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_mm.c,v 1.17 2022/02/14 13:22:21 riastradh Exp $");
 
 #include <linux/export.h>
 #include <linux/interval_tree_generic.h>
@@ -240,6 +240,13 @@
        const u64 aa = __drm_mm_hole_node_start(a);
        const u64 ba = __drm_mm_hole_node_start(b);
 
+       KASSERTMSG((aa == ba ||
+               aa + a->hole_size <= ba ||
+               aa >= ba + b->hole_size),
+           "overlapping holes: [0x%"PRIx64", 0x%"PRIx64"),"
+           " [0x%"PRIx64", 0x%"PRIx64")",
+           aa, aa + a->hole_size,
+           ba, ba + b->hole_size);
        if (aa < ba)
                return -1;
        if (aa > ba)
@@ -256,7 +263,7 @@
 
        if (a < *k)
                return -1;
-       if (a > *k)
+       if (a + n->hole_size >= *k) /* allows range lookups */
                return +1;
        return 0;
 }
@@ -432,7 +439,7 @@
 #ifdef __NetBSD__
        struct drm_mm_node *node;
 
-       node = rb_tree_find_node_leq(&mm->holes_addr.rbr_tree, &addr);
+       node = rb_tree_find_node(&mm->holes_addr.rbr_tree, &addr);
        KASSERT(node == NULL || __drm_mm_hole_node_start(node) <= addr);
        KASSERT(node == NULL || addr <
            __drm_mm_hole_node_start(node) + node->hole_size);



Home | Main Index | Thread Index | Old Index