Module Name:    src
Committed By:   martin
Date:           Fri Aug 11 14:48:35 UTC 2023

Modified Files:
        src/sys/external/bsd/drm2/amdgpu [netbsd-10]: amdgpu_pci.c
        src/sys/external/bsd/drm2/nouveau [netbsd-10]: nouveau_pci.c
        src/sys/external/bsd/drm2/radeon [netbsd-10]: radeon_pci.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #321):

        sys/external/bsd/drm2/amdgpu/amdgpu_pci.c: revision 1.12
        sys/external/bsd/drm2/nouveau/nouveau_pci.c: revision 1.38
        sys/external/bsd/drm2/radeon/radeon_pci.c: revision 1.24

amdgpu: Suspend ioctls while device is suspended.
nouveau: Suspend ioctls while device is suspended.
radeon: Suspend ioctls while device is suspended.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/external/bsd/drm2/amdgpu/amdgpu_pci.c
cvs rdiff -u -r1.36.4.1 -r1.36.4.2 \
    src/sys/external/bsd/drm2/nouveau/nouveau_pci.c
cvs rdiff -u -r1.21.4.1 -r1.21.4.2 \
    src/sys/external/bsd/drm2/radeon/radeon_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/amdgpu/amdgpu_pci.c
diff -u src/sys/external/bsd/drm2/amdgpu/amdgpu_pci.c:1.11 src/sys/external/bsd/drm2/amdgpu/amdgpu_pci.c:1.11.4.1
--- src/sys/external/bsd/drm2/amdgpu/amdgpu_pci.c:1.11	Mon Jul 18 23:34:02 2022
+++ src/sys/external/bsd/drm2/amdgpu/amdgpu_pci.c	Fri Aug 11 14:48:34 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_pci.c,v 1.11 2022/07/18 23:34:02 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_pci.c,v 1.11.4.1 2023/08/11 14:48:34 martin Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_pci.c,v 1.11 2022/07/18 23:34:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_pci.c,v 1.11.4.1 2023/08/11 14:48:34 martin Exp $");
 
 #include <sys/types.h>
 #include <sys/atomic.h>
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: amdgpu_pci.c
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_fb_helper.h>
+#include <drm/drm_ioctl.h>
 #include <drm/drm_pci.h>
 
 #include <amdgpu.h>
@@ -260,6 +261,8 @@ amdgpu_do_suspend(device_t self, const p
 	struct drm_device *const dev = sc->sc_drm_dev;
 	int ret;
 
+	drm_suspend_ioctl(dev);
+
 	ret = amdgpu_device_suspend(dev, /*fbcon*/true);
 	if (ret)
 		return false;
@@ -276,9 +279,10 @@ amdgpu_do_resume(device_t self, const pm
 
 	ret = amdgpu_device_resume(dev, /*fbcon*/true);
 	if (ret)
-		return false;
+		goto out;
 
-	return true;
+out:	drm_resume_ioctl(dev);
+	return ret == 0;
 }
 
 static void

Index: src/sys/external/bsd/drm2/nouveau/nouveau_pci.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.36.4.1 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.36.4.2
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.36.4.1	Mon Mar 20 17:24:15 2023
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c	Fri Aug 11 14:48:34 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_pci.c,v 1.36.4.1 2023/03/20 17:24:15 martin Exp $	*/
+/*	$NetBSD: nouveau_pci.c,v 1.36.4.2 2023/08/11 14:48:34 martin Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.36.4.1 2023/03/20 17:24:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.36.4.2 2023/08/11 14:48:34 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "genfb.h"
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_pci.
 #include <dev/wsfb/genfbvar.h>
 #endif
 
+#include <drm/drm_ioctl.h>
 #include <drm/drm_pci.h>
 
 #include <core/device.h>
@@ -316,16 +317,31 @@ static bool
 nouveau_pci_suspend(device_t self, const pmf_qual_t *qual __unused)
 {
 	struct nouveau_pci_softc *const sc = device_private(self);
+	struct drm_device *const dev = sc->sc_drm_dev;
+	int ret;
+
+	drm_suspend_ioctl(dev);
+
+	ret = nouveau_pmops_suspend(dev);
+	if (ret)
+		return false;
 
-	return nouveau_pmops_suspend(sc->sc_drm_dev) == 0;
+	return true;
 }
 
 static bool
 nouveau_pci_resume(device_t self, const pmf_qual_t *qual)
 {
 	struct nouveau_pci_softc *const sc = device_private(self);
+	struct drm_device *const dev = sc->sc_drm_dev;
+	int ret;
+
+	ret = nouveau_pmops_resume(sc->sc_drm_dev);
+	if (ret)
+		goto out;
 
-	return nouveau_pmops_resume(sc->sc_drm_dev) == 0;
+out:	drm_resume_ioctl(dev);
+	return ret == 0;
 }
 
 static void

Index: src/sys/external/bsd/drm2/radeon/radeon_pci.c
diff -u src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.21.4.1 src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.21.4.2
--- src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.21.4.1	Mon Mar 20 17:24:15 2023
+++ src/sys/external/bsd/drm2/radeon/radeon_pci.c	Fri Aug 11 14:48:34 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeon_pci.c,v 1.21.4.1 2023/03/20 17:24:15 martin Exp $	*/
+/*	$NetBSD: radeon_pci.c,v 1.21.4.2 2023/08/11 14:48:34 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.21.4.1 2023/03/20 17:24:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.21.4.2 2023/08/11 14:48:34 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "genfb.h"
@@ -72,6 +72,7 @@ __KERNEL_RCSID(0, "$NetBSD: radeon_pci.c
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_fb_helper.h>
+#include <drm/drm_ioctl.h>
 #include <drm/drm_pci.h>
 
 #if NGENFB > 0
@@ -366,6 +367,8 @@ radeon_do_suspend(device_t self, const p
 	int ret;
 	bool is_console = true; /* XXX */
 
+	drm_suspend_ioctl(dev);
+
 	ret = radeon_suspend_kms(dev, true, is_console, false);
 	if (ret)
 		return false;
@@ -383,9 +386,10 @@ radeon_do_resume(device_t self, const pm
 
 	ret = radeon_resume_kms(dev, true, is_console);
 	if (ret)
-		return false;
+		goto out;
 
-	return true;
+out:	drm_resume_ioctl(dev);
+	return ret == 0;
 }
 
 static void

Reply via email to