Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-10]: src/sys Pull up following revision(s) (requested by mrg in t...



details:   https://anonhg.NetBSD.org/src/rev/f4805b731e7b
branches:  netbsd-10
changeset: 373922:f4805b731e7b
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Mar 20 17:24:14 2023 +0000

description:
Pull up following revision(s) (requested by mrg in ticket #122):

        sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c: revision 1.11
        sys/external/bsd/drm2/nouveau/nouveau_pci.c: revision 1.37
        sys/external/bsd/drm2/radeon/radeon_pci.c: revision 1.22
        sys/dev/wscons/wsdisplay.c: revision 1.166
        sys/dev/wscons/wsdisplayvar.h: revision 1.57

amdgpu: Fix bogus loop invariant assertions in amdgpu_gart_map.
nouveau: Kick out genfb on firmware framebuffer before initializing.

PR kern/53126

radeon: Kick out genfb on firmware framebuffer before initializing.
this is the same change as nouveau_pci.c:1.37, and should fix at
least PR#56714 and i thought at least another PR i can't find right
now.  it fixes at least 2 different radeon cards for me on UEFI
booted system.

diffstat:

 sys/dev/wscons/wsdisplay.c                              |  13 ++++++-
 sys/dev/wscons/wsdisplayvar.h                           |   3 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c |   8 ++--
 sys/external/bsd/drm2/nouveau/nouveau_pci.c             |  28 +++++++++++++++-
 sys/external/bsd/drm2/radeon/radeon_pci.c               |  28 +++++++++++++++-
 5 files changed, 69 insertions(+), 11 deletions(-)

diffs (204 lines):

diff -r 05166e8cf001 -r f4805b731e7b sys/dev/wscons/wsdisplay.c
--- a/sys/dev/wscons/wsdisplay.c        Thu Mar 16 07:19:51 2023 +0000
+++ b/sys/dev/wscons/wsdisplay.c        Mon Mar 20 17:24:14 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.165 2022/07/17 11:43:39 riastradh Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.165.4.1 2023/03/20 17:24:15 martin Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.165 2022/07/17 11:43:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.165.4.1 2023/03/20 17:24:15 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_wsdisplay_compat.h"
@@ -982,6 +982,15 @@
 }
 
 void
+wsdisplay_predetach(void)
+{
+       KASSERT(wsdisplay_console_initted == 1);
+
+       cn_tab = wsdisplay_ocn;
+       wsdisplay_console_initted = 0;
+}
+
+void
 wsdisplay_cndetach(void)
 {
        KASSERT(wsdisplay_console_initted == 2);
diff -r 05166e8cf001 -r f4805b731e7b sys/dev/wscons/wsdisplayvar.h
--- a/sys/dev/wscons/wsdisplayvar.h     Thu Mar 16 07:19:51 2023 +0000
+++ b/sys/dev/wscons/wsdisplayvar.h     Mon Mar 20 17:24:14 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplayvar.h,v 1.56 2022/01/29 01:19:30 uwe Exp $ */
+/* $NetBSD: wsdisplayvar.h,v 1.56.4.1 2023/03/20 17:24:15 martin Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -172,6 +172,7 @@
             long);
 void   wsdisplay_preattach(const struct wsscreen_descr *, void *, int, int,
             long);
+void   wsdisplay_predetach(void);
 void   wsdisplay_cndetach(void);
 void   wsdisplay_multicons_suspend(bool);
 
diff -r 05166e8cf001 -r f4805b731e7b sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c   Thu Mar 16 07:19:51 2023 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c   Mon Mar 20 17:24:14 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_gart.c,v 1.10 2022/07/30 17:12:39 riastradh Exp $       */
+/*     $NetBSD: amdgpu_gart.c,v 1.10.4.1 2023/03/20 17:24:14 martin Exp $      */
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_gart.c,v 1.10 2022/07/30 17:12:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_gart.c,v 1.10.4.1 2023/03/20 17:24:14 martin Exp $");
 
 #include <linux/pci.h>
 #include <linux/vmalloc.h>
@@ -440,8 +440,9 @@
        t = gpu_start / AMDGPU_GPU_PAGE_SIZE;
 
        for (i = 0; npages --> 0;) {
-               KASSERT(i < dmamap->dm_nsegs);
                for (j = 0; j < AMDGPU_GPU_PAGES_IN_CPU_PAGE; j++) {
+                       KASSERT(i < dmamap->dm_nsegs);
+                       KASSERT(seg_off < dmamap->dm_segs[i].ds_len);
                        amdgpu_gmc_set_pte_pde(adev, dst, t,
                            dmamap->dm_segs[i].ds_addr + seg_off, flags);
                        seg_off += AMDGPU_GPU_PAGE_SIZE;
@@ -449,7 +450,6 @@
                                i++;
                                seg_off = 0;
                        }
-                       KASSERT(seg_off < dmamap->dm_segs[i].ds_len);
                }
        }
 
diff -r 05166e8cf001 -r f4805b731e7b sys/external/bsd/drm2/nouveau/nouveau_pci.c
--- a/sys/external/bsd/drm2/nouveau/nouveau_pci.c       Thu Mar 16 07:19:51 2023 +0000
+++ b/sys/external/bsd/drm2/nouveau/nouveau_pci.c       Mon Mar 20 17:24:14 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_pci.c,v 1.36 2022/07/18 23:34:02 riastradh Exp $       */
+/*     $NetBSD: nouveau_pci.c,v 1.36.4.1 2023/03/20 17:24:15 martin Exp $      */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,9 +30,10 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.36 2022/07/18 23:34:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.36.4.1 2023/03/20 17:24:15 martin Exp $");
 
 #ifdef _KERNEL_OPT
+#include "genfb.h"
 #if defined(__arm__) || defined(__aarch64__)
 #include "opt_fdt.h"
 #endif
@@ -49,6 +50,11 @@
 #include <dev/fdt/fdtvar.h>
 #endif
 
+#if NGENFB > 0
+#include <dev/wscons/wsdisplayvar.h>
+#include <dev/wsfb/genfbvar.h>
+#endif
+
 #include <drm/drm_pci.h>
 
 #include <core/device.h>
@@ -220,6 +226,24 @@
        }
        sc->sc_pci_attached = true;
 
+#if NGENFB > 0
+       /*
+        * If MD initialization has selected this as the console device
+        * with a firmware-provided framebuffer address, we may have to
+        * turn it off early, before we are ready to switch the console
+        * over -- something goes wrong if we're still writing to the
+        * firmware-provided framebuffer during nouveau initialization.
+        */
+    {
+       bool is_console;
+       if (prop_dictionary_get_bool(device_properties(self), "is_console",
+               &is_console) &&
+           is_console &&
+           genfb_is_console())
+               wsdisplay_predetach();
+    }
+#endif
+
        /* XXX errno Linux->NetBSD */
        error = -nouveau_drm_device_init(sc->sc_drm_dev);
        if (error) {
diff -r 05166e8cf001 -r f4805b731e7b sys/external/bsd/drm2/radeon/radeon_pci.c
--- a/sys/external/bsd/drm2/radeon/radeon_pci.c Thu Mar 16 07:19:51 2023 +0000
+++ b/sys/external/bsd/drm2/radeon/radeon_pci.c Mon Mar 20 17:24:14 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: radeon_pci.c,v 1.21 2022/07/18 23:34:03 riastradh Exp $        */
+/*     $NetBSD: radeon_pci.c,v 1.21.4.1 2023/03/20 17:24:15 martin Exp $       */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,9 +30,10 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.21 2022/07/18 23:34:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.21.4.1 2023/03/20 17:24:15 martin Exp $");
 
 #ifdef _KERNEL_OPT
+#include "genfb.h"
 #include "vga.h"
 #if defined(__arm__) || defined(__aarch64__)
 #include "opt_fdt.h"
@@ -73,6 +74,11 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_pci.h>
 
+#if NGENFB > 0
+#include <dev/wscons/wsdisplayvar.h>
+#include <dev/wsfb/genfbvar.h>
+#endif
+
 #include <radeon.h>
 #include "radeon_drv.h"
 #include "radeon_task.h"
@@ -273,6 +279,24 @@
        }
        sc->sc_pci_attached = true;
 
+#if NGENFB > 0
+       /*
+        * If MD initialization has selected this as the console device
+        * with a firmware-provided framebuffer address, we may have to
+        * turn it off early, before we are ready to switch the console
+        * over -- something goes wrong if we're still writing to the
+        * firmware-provided framebuffer during nouveau initialization.
+        */
+    {
+       bool is_console;
+       if (prop_dictionary_get_bool(device_properties(self), "is_console",
+               &is_console) &&
+           is_console &&
+           genfb_is_console())
+               wsdisplay_predetach();
+    }
+#endif
+
        /* XXX errno Linux->NetBSD */
        error = -drm_dev_register(sc->sc_drm_dev, flags);
        if (error) {



Home | Main Index | Thread Index | Old Index