NetBSD Problem Report #56825

From reinoud@gorilla.13thmonkey.org  Mon May  9 07:09:54 2022
Return-Path: <reinoud@gorilla.13thmonkey.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D36C41A9239
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  9 May 2022 07:09:53 +0000 (UTC)
Message-Id: <20220509070950.319BD2FF0743@gorilla.13thmonkey.org>
Date: Mon,  9 May 2022 09:09:50 +0200 (CEST)
From: reinoud@13thmonkey.org
Reply-To: reinoud@gorilla.13thmonkey.org
To: gnats-bugs@NetBSD.org
Subject: No powermanagement support in amdsmn and amdccp preventing sleep
X-Send-Pr-Version: 3.95

>Number:         56825
>Category:       kern
>Synopsis:       No powermanagement support in amdsmn and amdccp preventing sleep
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 09 07:10:00 +0000 2022
>Last-Modified:  Mon May 09 14:10:01 +0000 2022
>Originator:     Reinoud Zandijk
>Release:        NetBSD 9.99.94
>Organization:
NetBSD

>Environment:


System: NetBSD gorilla.13thmonkey.org 9.99.94 NetBSD 9.99.94 (GENERIC) #7: Fri Mar 18 15:24:47 CET 2022 reinoud@gorilla.13thmonkey.org:/tmp/obj-udf/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

When trying to suspend/sleep my machine with an AMD CPU its prevented by the
missing power support :
[   337.910356] acpi0: entering state S4
[   337.910356] Devices without power management support: amdsmn0 amdccp0
[   337.910356] acpi0: autoconfiguration error: aborting suspend

Detected by autoconf:
[     1.048885] amdsmn0 at pci0 dev 0 function 0: AMD System Management Network
[     1.048885] amdzentemp0 at amdsmn0: AMD CPU Temperature Sensors (Family17h)
[     1.048885] amdccp0 at pci11 dev 0 function 1: AMD Cryptographic Coprocessor


>How-To-Repeat:
Try to suspend/sleep the machine with 
sysctl -w hw.acpi.sleep.state=4


>Fix:
Implement possibly trivial power management hooks



>Audit-Trail:
From: Reinoud Zandijk <reinoud@NetBSD.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/56825: No powermanagement support in amdsmn and amdccp
 preventing sleep
Date: Mon, 9 May 2022 16:05:43 +0200

 Using the following patches providing minimal dummy PMF support the machine
 seems to shutdown, syncing its discs etc, the screen goes blank but it just
 resets into UEFI again.

 > cvs -q -z1 diff -up sys/dev/ sys/arch/x86/
 Index: sys/dev/acpi/amdccp_acpi.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/acpi/amdccp_acpi.c,v
 retrieving revision 1.5
 diff -u -p -r1.5 amdccp_acpi.c
 --- sys/dev/acpi/amdccp_acpi.c	29 Jan 2021 15:49:55 -0000	1.5
 +++ sys/dev/acpi/amdccp_acpi.c	9 May 2022 14:02:25 -0000
 @@ -104,6 +104,9 @@ amdccp_acpi_attach(device_t parent, devi

  	amdccp_common_attach(sc);

 +	if (!pmf_device_register(self, NULL, NULL))
 +		aprint_error_dev(self, "couldn't establish power handler\n");
 +
  done:
  	acpi_resource_cleanup(&res);
  }
 Index: sys/dev/fdt/amdccp_fdt.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/fdt/amdccp_fdt.c,v
 retrieving revision 1.6
 diff -u -p -r1.6 amdccp_fdt.c
 --- sys/dev/fdt/amdccp_fdt.c	27 Jan 2021 03:10:21 -0000	1.6
 +++ sys/dev/fdt/amdccp_fdt.c	9 May 2022 14:02:26 -0000
 @@ -89,4 +89,7 @@ amdccp_fdt_attach(device_t parent, devic
  	aprint_normal(": AMD CCP\n");

  	amdccp_common_attach(sc);
 +
 +	if (!pmf_device_register(self, NULL, NULL))
 +		aprint_error_dev(self, "couldn't establish power handler\n");
  }
 Index: sys/dev/pci/amdccp_pci.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/amdccp_pci.c,v
 retrieving revision 1.2
 diff -u -p -r1.2 amdccp_pci.c
 --- sys/dev/pci/amdccp_pci.c	25 Jun 2020 16:40:40 -0000	1.2
 +++ sys/dev/pci/amdccp_pci.c	9 May 2022 14:02:26 -0000
 @@ -116,4 +116,7 @@ amdccp_pci_attach(device_t parent, devic
  	}

  	amdccp_common_attach(sc);
 +
 +	if (!pmf_device_register(self, NULL, NULL))
 +		aprint_error_dev(self, "couldn't establish power handler\n");
  }
 Index: sys/arch/x86/pci/amdsmn.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/x86/pci/amdsmn.c,v
 retrieving revision 1.13
 diff -u -p -r1.13 amdsmn.c
 --- sys/arch/x86/pci/amdsmn.c	27 Apr 2022 06:59:25 -0000	1.13
 +++ sys/arch/x86/pci/amdsmn.c	9 May 2022 14:02:26 -0000
 @@ -149,6 +149,10 @@ amdsmn_attach(device_t parent, device_t 

  	// aprint_normal(": AMD Family 17h System Management Network\n");
  	aprint_normal(": AMD System Management Network\n");
 +
 +	if (!pmf_device_register(self, NULL, NULL))
 +		aprint_error_dev(self, "couldn't establish power handler\n");
 +
  	amdsmn_rescan(self, NULL, NULL);
  }

 @@ -168,6 +172,8 @@ amdsmn_detach(device_t self, int flags)
  {
  	struct amdsmn_softc *sc = device_private(self);

 +	pmf_device_deregister(self);
 +
  	mutex_destroy(&sc->smn_lock);
  	aprint_normal_dev(self,"detach!\n");


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.