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 i915: Fix gen6 pd_vma...



details:   https://anonhg.NetBSD.org/src/rev/add955b2bdc9
branches:  trunk
changeset: 1028910:add955b2bdc9
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:27:32 2021 +0000

description:
i915: Fix gen6 pd_vma_bind.

We only need space for the ppgtt in this vma, not space for the whole
VM.

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/gt/gen6_ppgtt.c |  24 ++++++++++----------
 1 files changed, 12 insertions(+), 12 deletions(-)

diffs (52 lines):

diff -r b4033a6678a4 -r add955b2bdc9 sys/external/bsd/drm2/dist/drm/i915/gt/gen6_ppgtt.c
--- a/sys/external/bsd/drm2/dist/drm/i915/gt/gen6_ppgtt.c       Sun Dec 19 12:27:25 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/gt/gen6_ppgtt.c       Sun Dec 19 12:27:32 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gen6_ppgtt.c,v 1.7 2021/12/19 12:27:25 riastradh Exp $ */
+/*     $NetBSD: gen6_ppgtt.c,v 1.8 2021/12/19 12:27:32 riastradh Exp $ */
 
 // SPDX-License-Identifier: MIT
 /*
@@ -6,7 +6,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gen6_ppgtt.c,v 1.7 2021/12/19 12:27:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gen6_ppgtt.c,v 1.8 2021/12/19 12:27:32 riastradh Exp $");
 
 #include <linux/log2.h>
 
@@ -347,23 +347,23 @@
        px_base(ppgtt->base.pd)->ggtt_offset = ggtt_offset * sizeof(gen6_pte_t);
 #ifdef __NetBSD__
     {
-       bus_size_t vm_nbytes = ggtt->vm.total;
-       bus_size_t vm_npgs = vm_nbytes >> PAGE_SHIFT;
-       bus_size_t gtt_nbytes = vm_npgs * sizeof(gen6_pte_t);
+       bus_size_t npgs = vma->size >> PAGE_SHIFT;
+       bus_size_t gtt_nbytes = npgs * sizeof(gen6_pte_t);
        bus_size_t ggtt_offset_bytes =
            (bus_size_t)ggtt_offset * sizeof(gen6_pte_t);
        int ret;
 
        KASSERTMSG(gtt_nbytes <= ggtt->gsmsz - ggtt_offset_bytes,
-           "oversize ggtt vm total 0x%"PRIx64" bytes 0x%"PRIx64" pgs,"
+           "oversize ppgtt size 0x%"PRIx64" bytes 0x%"PRIx64" pgs,"
            " requiring 0x%"PRIx64" bytes of ptes at 0x%"PRIx64";"
-           " gsm has 0x%"PRIx64" bytes total with only 0x%"PRIx64" for ptes",
-           vm_nbytes, vm_npgs,
-           gtt_nbytes, ggtt_offset_bytes,
-           ggtt->gsmsz, ggtt->gsmsz - ggtt_offset_bytes);
+           " gsm has 0x%"PRIx64" bytes total"
+           " with only 0x%"PRIx64" for ptes",
+           (uint64_t)vma->size, (uint64_t)npgs,
+           (uint64_t)gtt_nbytes, (uint64_t)ggtt_offset_bytes,
+           (uint64_t)ggtt->gsmsz,
+           (uint64_t)(ggtt->gsmsz - ggtt_offset_bytes));
        ret = -bus_space_subregion(ggtt->gsmt, ggtt->gsmh, ggtt_offset_bytes,
-           MIN(gtt_nbytes, ggtt->gsmsz - ggtt_offset_bytes),
-           &ppgtt->pd_bsh);
+           gtt_nbytes, &ppgtt->pd_bsh);
        if (ret) {
                DRM_ERROR("Unable to subregion the GGTT: %d\n", ret);
                return ret;



Home | Main Index | Thread Index | Old Index