From owner-svn-src-stable-11@freebsd.org Fri Jun 22 10:39:24 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00E00101681F; Fri, 22 Jun 2018 10:39:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 953008A7A6; Fri, 22 Jun 2018 10:39:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 722DF1F8B2; Fri, 22 Jun 2018 10:39:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5MAdNEW070047; Fri, 22 Jun 2018 10:39:23 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5MAdMm5070044; Fri, 22 Jun 2018 10:39:22 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201806221039.w5MAdMm5070044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 22 Jun 2018 10:39:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335554 - in stable/11/sys: dev/acpica dev/acpica/Osd x86/acpica X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/11/sys: dev/acpica dev/acpica/Osd x86/acpica X-SVN-Commit-Revision: 335554 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2018 10:39:24 -0000 Author: avg Date: Fri Jun 22 10:39:22 2018 New Revision: 335554 URL: https://svnweb.freebsd.org/changeset/base/335554 Log: MFC r332918, r333222: go deeper for ACPI suspend bounce test debug.acpi.suspend_bounce sysctl now allows a deeper dive into the sleep abyss. The system will execute the suspend sequence up to the call to AcpiEnterSleepState(). That includes saving processor contexts and parking APs. Then, instead of actually entering the sleep state, the BSP will call resumectx() to emulate the wakeup. The APs should get restarted by the sequence of Init and Startup IPIs that BSP sends to them. AcpiOsEnterSleep() is used to implement this feature. Joint work with jkim. Modified: stable/11/sys/dev/acpica/Osd/OsdHardware.c stable/11/sys/dev/acpica/acpi.c stable/11/sys/x86/acpica/acpi_wakeup.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/acpica/Osd/OsdHardware.c ============================================================================== --- stable/11/sys/dev/acpica/Osd/OsdHardware.c Fri Jun 22 10:23:32 2018 (r335553) +++ stable/11/sys/dev/acpica/Osd/OsdHardware.c Fri Jun 22 10:39:22 2018 (r335554) @@ -37,9 +37,15 @@ __FBSDID("$FreeBSD$"); #include #include +extern int acpi_susp_bounce; + ACPI_STATUS AcpiOsEnterSleep(UINT8 SleepState, UINT32 RegaValue, UINT32 RegbValue) { + + /* If testing device suspend only, back out of everything here. */ + if (acpi_susp_bounce) + return (AE_CTRL_TERMINATE); return (AE_OK); } Modified: stable/11/sys/dev/acpica/acpi.c ============================================================================== --- stable/11/sys/dev/acpica/acpi.c Fri Jun 22 10:23:32 2018 (r335553) +++ stable/11/sys/dev/acpica/acpi.c Fri Jun 22 10:39:22 2018 (r335554) @@ -291,7 +291,7 @@ SYSCTL_INT(_debug_acpi, OID_AUTO, reset_clock, CTLFLAG /* Allow users to override quirks. */ TUNABLE_INT("debug.acpi.quirks", &acpi_quirks); -static int acpi_susp_bounce; +int acpi_susp_bounce; SYSCTL_INT(_debug_acpi, OID_AUTO, suspend_bounce, CTLFLAG_RW, &acpi_susp_bounce, 0, "Don't actually suspend, just test devices."); @@ -2897,10 +2897,6 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state) goto backout; } slp_state = ACPI_SS_DEV_SUSPEND; - - /* If testing device suspend only, back out of everything here. */ - if (acpi_susp_bounce) - goto backout; status = AcpiEnterSleepStatePrep(state); if (ACPI_FAILURE(status)) { Modified: stable/11/sys/x86/acpica/acpi_wakeup.c ============================================================================== --- stable/11/sys/x86/acpica/acpi_wakeup.c Fri Jun 22 10:23:32 2018 (r335553) +++ stable/11/sys/x86/acpica/acpi_wakeup.c Fri Jun 22 10:39:22 2018 (r335554) @@ -77,6 +77,7 @@ CTASSERT(sizeof(wakecode) < PAGE_SIZE - 1024); extern int acpi_resume_beep; extern int acpi_reset_video; +extern int acpi_susp_bounce; #ifdef SMP extern struct susppcb **susppcbs; @@ -257,6 +258,9 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) AcpiFormatException(status)); return (0); /* couldn't sleep */ } + + if (acpi_susp_bounce) + resumectx(pcb); for (;;) ia32_pause();