NetBSD-Bugs archive

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

kern/43327: Allowing suspend with radeondrm on NetBSD 5



>Number:         43327
>Category:       kern
>Synopsis:       It is currently not possible to suspend with radeondrm 
>configured
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 19 11:10:00 +0000 2010
>Originator:     Pierre Pronchery
>Release:        NetBSD 5.1_RC1
>Organization:
>Environment:
System: NetBSD kwarx.defora.lan 5.1_RC1 NetBSD 5.1_RC1 (GENERIC) #2: Wed May 5 
04:21:36 CEST 2010 
khorben%kwarx.defora.lan@localhost:/usr/obj/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

A fix was committed two months ago by mrg@ to "make suspend/resume actually 
work" with radeondrm configured. I have just backported and tested these 
changes, which I think would be nice to have in the netbsd-5 branch.

>How-To-Repeat:
Enable radeondrm in the kernel and try to suspend; it refuses:

| Devices without power management support: radeondrm0

With the following patch, suspend and resume works fine, even though I could 
observe the following errors with my Lenovo ThinkPad T60 on docking station:

| ACPI Error (utmutex-0422): Mutex [4] is not acquired, cannot release 
[20080321] ACPI Error (dswstate-0259): Failed to extend the result stack 
[20080321]
| ACPI Error (dswstate-0185): Result stack is empty! State=0xffff800004878000 
[20080321]
| ACPI Error (utmutex-0422): ACPI Error (psparse-0627): Mutex [4] is not 
acquired, cannot releaseMethod parse/execution failed  [20080321]
[\_GPE._L01] (Node 0xffff800004019be0), AE_NO_MEMORY                            
ACPI Exception (evgpe-0711): AE_NO_MEMORY, while evaluating GPE method [_L01] 
[20080321]
| ACPI Error (utmutex-0422): Mutex [1] is not acquired, cannot release 
[20080321] ACPI Error (utmutex-0422): Mutex [0] is not acquired, cannot release 
[20080321]
| ACPI Error (exutils-0249): Could not release AML Interpreter mutex [20080321] 
  ioapic0 reenabling
| ACPI Error (utmutex-0422): Mutex [0] is not acquired, cannot release 
[20080321] ACPI Error (exutils-0249): Could not release AML Interpreter mutex 
[20080321]

>Fix:

Index: sys/external/bsd/drm/dist/bsd-core/radeon_drv.c
===================================================================
RCS file: /cvsroot/src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c,v
retrieving revision 1.2.10.1
diff -p -u -r1.2.10.1 radeon_drv.c
--- sys/external/bsd/drm/dist/bsd-core/radeon_drv.c     20 Jun 2009 23:36:59 
-0000      1.2.10.1
+++ sys/external/bsd/drm/dist/bsd-core/radeon_drv.c     19 May 2010 10:41:47 
-0000
@@ -134,6 +134,38 @@ MODULE_DEPEND(radeon, drm, 1, 1, 1);
 
 #elif   defined(__NetBSD__)
 
+static bool
+radeondrm_suspend(device_t self PMF_FN_ARGS)
+{
+       struct drm_device *dev = device_private(self);
+       drm_radeon_cp_stop_t stop_args;
+       bool rv = true;
+
+       stop_args.flush = stop_args.idle = 0;
+       DRM_LOCK();
+       if (drm_find_file_by_proc(dev, curlwp->l_proc) &&
+           radeon_cp_stop(dev, &stop_args, dev->lock.file_priv) != 0)
+               rv = false;
+       DRM_UNLOCK();
+
+       return rv;
+}
+
+static bool
+radeondrm_resume(device_t self PMF_FN_ARGS)
+{
+       struct drm_device *dev = device_private(self);
+       bool rv = true;
+
+       DRM_LOCK();
+       if (drm_find_file_by_proc(dev, curlwp->l_proc) &&
+           radeon_cp_resume(dev, NULL, NULL) != 0)
+               rv =  false;
+       DRM_UNLOCK();
+       
+       return rv;
+}
+
 static int
 radeondrm_probe(device_t parent, cfdata_t match, void *aux)
 {
@@ -152,11 +184,22 @@ radeondrm_attach(device_t parent, device
 
        radeon_configure(dev);
 
+       if (!pmf_device_register(self, radeondrm_suspend, radeondrm_resume))
+               aprint_error_dev(self, "couldn't establish power handler\n");
+
        drm_attach(self, pa, radeon_pciidlist);
 }
 
+static int
+radeondrm_detach(device_t self, int flags)
+{
+       pmf_device_deregister(self);
+
+       return drm_detach(self, flags);
+}
+
 CFATTACH_DECL_NEW(radeondrm, sizeof(struct drm_device),
-    radeondrm_probe, radeondrm_attach, drm_detach, drm_activate);
+    radeondrm_probe, radeondrm_attach, radeondrm_detach, NULL);
 
 #ifdef _MODULE
 



Home | Main Index | Thread Index | Old Index