From patchwork Fri Jan 26 07:50:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ivanhu X-Patchwork-Id: 1891169 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TLqdC6xkTz23fD for ; Fri, 26 Jan 2024 18:51:11 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rTGzR-00088t-6V; Fri, 26 Jan 2024 07:51:05 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rTGzL-00088F-2r for fwts-devel@lists.ubuntu.com; Fri, 26 Jan 2024 07:50:59 +0000 Received: from canonical.com (118-163-61-247.hinet-ip.hinet.net [118.163.61.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 5B98F419F2 for ; Fri, 26 Jan 2024 07:50:53 +0000 (UTC) From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH] acpi: s3: enable debug messages on S0ix failure for Intel platforms Date: Fri, 26 Jan 2024 15:50:49 +0800 Message-Id: <20240126075049.35922-1-ivan.hu@canonical.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" BugLink: https://bugs.launchpad.net/fwts/+bug/2051336 Signed-off-by: Ivan Hu --- src/acpi/s3/s3.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c index 15e5e871..903f22f4 100644 --- a/src/acpi/s3/s3.c +++ b/src/acpi/s3/s3.c @@ -37,10 +37,13 @@ #define PM_SUSPEND_TOTAL_HW_SLEEP "/sys/power/suspend_stats/total_hw_sleep" #define WAKEUP_SOURCE_PATH "/sys/kernel/debug/wakeup_sources" #define INTEL_PM_S2IDLE_SLP_S0 "/sys/kernel/debug/pmc_core/slp_s0_residency_usec" +#define INTEL_PM_S0IX_WARN "/sys/module/intel_pmc_core/parameters/warn_on_s0ix_failures" static char sleep_type[7]; static char sleep_type_orig[7]; +static bool s0ix2_warn_enable_orig = false; + static int s3_multiple = 1; /* number of s3 multiple tests to run */ static int s3_min_delay = 0; /* min time between resume and next suspend */ static int s3_max_delay = 30; /* max time between resume and next suspend */ @@ -222,15 +225,32 @@ static int s3_init(fwts_framework *fw) strncpy(sleep_type, "S3", strlen("S3") + 1); } + str = fwts_get(INTEL_PM_S0IX_WARN); + if (str && strstr(str, "N")) + (void)fwts_set(INTEL_PM_S0IX_WARN, "Y"); + else if (str && strstr(str, "Y")) + s0ix2_warn_enable_orig = true; + if (str) + free(str); + return FWTS_OK; } static int s3_deinit(fwts_framework *fw) { + char *str; FWTS_UNUSED(fw); (void)fwts_set(PM_SUSPEND_PATH, sleep_type_orig); + str = fwts_get(INTEL_PM_S0IX_WARN); + if (str && strstr(str, "N") && s0ix2_warn_enable_orig) + (void)fwts_set(INTEL_PM_S0IX_WARN, "Y"); + else if (str && strstr(str, "Y") && !s0ix2_warn_enable_orig) + (void)fwts_set(INTEL_PM_S0IX_WARN, "N"); + if (str) + free(str); + return FWTS_OK; }