From patchwork Mon Mar 11 12:19:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 13627115 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6A056C4345F for ; Fri, 12 Apr 2024 08:04:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Date:From: Message-Id:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=S2z5dMgKljjWbpalhQH0HfV5RTypoJg2anh1oM5Is00=; b=Bmi8GokRJY9wxB QaBD++t1EgAvo5txbUBfBi4akydOgzzg6juskGJi5ei6t1kn9eb3tfD8G961gUfVnjFTSi7Cgv4NI TXZEyFM+c3PpJMUDyb7jWSTlIaRRTw3CKeRWbtMAHCk4UUh1Hgr8GidjfAr+V+uKDyKSapydqaVhf BAc9dPgm43Ue5FLDfD4apduSs4ebApekDNrfBapxOPhefCSUq9j6SBwJ1/8G7MZjctV0JPDfNYqmv rQ7ZubN38wAHzkOFNyIDumPlIXWuV8BZ41kuQPVYmQhw2NyuEGlNMEDRMAdKlaI2hPVxzuFRhgrb2 l4S5DlTRdntI+0yDZkdA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvBta-0000000Fyt6-0iM2; Fri, 12 Apr 2024 08:04:26 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvBtS-0000000FymU-22fG for linux-arm-kernel@bombadil.infradead.org; Fri, 12 Apr 2024 08:04:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Cc:To:Subject:Date:From: Message-Id:References:In-Reply-To:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=LA9H/eqQ3lA2kMt4RACHsdsipUNelRXWxmYww27ZE+g=; b=oyRWCkpBqEeoK84MFBcO1qR0Id KoNAhcGT9XqMHthfd06OAwMAToy/Ii2wvAFjlXMYJtEDl7XnpuhALxCS0k6Xt7V8A8c/+DIb8urX2 j1r5raqhXsg0LSeKPp3I34QVotLLvWvR1vu3chgCqPHNgBzbgZKKrX6ulkzpevx1l1l+LloO96QBc UkEmD97XegHMeTap6AM9ioZDE3OM42552dFvHyHFeJoM088fAWen90g9SOfiZ27jdl++aCPWWLGrh jNwDahv0Tz5TrkCggZQUnzOykNpq7siBXOXrYMStvmpM690Ud9boKebMj2MHSlWOUFsT4VMe9avtq CRhkczlw==; Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvBtP-0000000926r-2kcE; Fri, 12 Apr 2024 08:04:16 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvBtO-00000009KT4-42mn; Fri, 12 Apr 2024 09:04:14 +0100 In-Reply-To: <20240412073530.2222496-1-dwmw2@infradead.org> References: <20240412073530.2222496-1-dwmw2@infradead.org> Message-Id: <20240412073530.2222496-2-dwmw2@infradead.org> From: David Woodhouse Date: Mon, 11 Mar 2024 12:19:14 +0000 Subject: [PATCH v2 1/2] ACPICA: Detect FACS even for hardware reduced platforms To: Catalin Marinas , Will Deacon Cc: Robert Moore , "Rafael J. Wysocki" , Len Brown , Sudeep Holla , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: David Woodhouse ACPICA commit 44fc328a1a14b097d92b8be83989e4bf69b6e6cb The FACS is optional even on hardware reduced platforms, and may exist for the purpose of communicating the hardware_signature field to provoke a clean reboot instead of a resume from hibernation. Signed-off-by: David Woodhouse --- drivers/acpi/acpica/tbfadt.c | 30 +++++++++++++----------------- drivers/acpi/acpica/tbutils.c | 7 +------ 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index 44267a92bce5..3c126c6d306b 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c @@ -315,23 +315,19 @@ void acpi_tb_parse_fadt(void) ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, NULL, FALSE, TRUE, &acpi_gbl_dsdt_index); - /* If Hardware Reduced flag is set, there is no FACS */ - - if (!acpi_gbl_reduced_hardware) { - if (acpi_gbl_FADT.facs) { - acpi_tb_install_standard_table((acpi_physical_address) - acpi_gbl_FADT.facs, - ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, - NULL, FALSE, TRUE, - &acpi_gbl_facs_index); - } - if (acpi_gbl_FADT.Xfacs) { - acpi_tb_install_standard_table((acpi_physical_address) - acpi_gbl_FADT.Xfacs, - ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, - NULL, FALSE, TRUE, - &acpi_gbl_xfacs_index); - } + if (acpi_gbl_FADT.facs) { + acpi_tb_install_standard_table((acpi_physical_address) + acpi_gbl_FADT.facs, + ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, + NULL, FALSE, TRUE, + &acpi_gbl_facs_index); + } + if (acpi_gbl_FADT.Xfacs) { + acpi_tb_install_standard_table((acpi_physical_address) + acpi_gbl_FADT.Xfacs, + ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, + NULL, FALSE, TRUE, + &acpi_gbl_xfacs_index); } } diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index bb4a56e5673a..15fa68a5ea6e 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c @@ -36,12 +36,7 @@ acpi_status acpi_tb_initialize_facs(void) { struct acpi_table_facs *facs; - /* If Hardware Reduced flag is set, there is no FACS */ - - if (acpi_gbl_reduced_hardware) { - acpi_gbl_FACS = NULL; - return (AE_OK); - } else if (acpi_gbl_FADT.Xfacs && + if (acpi_gbl_FADT.Xfacs && (!acpi_gbl_FADT.facs || !acpi_gbl_use32_bit_facs_addresses)) { (void)acpi_get_table_by_index(acpi_gbl_xfacs_index, From patchwork Mon Mar 11 13:04:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 13627114 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 99700C04FF6 for ; Fri, 12 Apr 2024 08:04:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Date:From: Message-Id:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0Nd+hQsXqhFHac/8SSeY5DCcakr1T6frqX6uWdwONZo=; b=VEzKNHstoZ3iVd vGHC4XinUGMjBSw/7HyKpzOdZPTR38fzNwXws8wJyL9+HcTBgTdQbeG+IIK2oy3L47rhxJhyMAkLR GwgR70Q8i1CcWUjdlMjsWrjuLF5iDrqfa9kSkl2OGn1hse9R5o9aDuMF7kBkNzu4wCXGZrLfzAjFb 1fh5DWwUAbh+PXGN6XgLq9CP7yvhF90eSL8gkRPMFiExUdiH1KJz2LaoaR5ChnGmQr6UOQnjgZbYE 8oWyc3Mn0TjRa+Jo/vxeWpE58ldmOFikYMCFcBmyrCK9f+Yl3vxoCiyL80EdXXOlFjB86YLjrTFWo QyMIukWWQkAhKqMhTeHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvBtb-0000000Fytp-34GO; Fri, 12 Apr 2024 08:04:28 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvBtY-0000000Fyqf-1ROq for linux-arm-kernel@bombadil.infradead.org; Fri, 12 Apr 2024 08:04:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Cc:To:Subject:Date:From: Message-Id:References:In-Reply-To:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=GHkEo0uIXHettMVCbsHimID5bYVEU0q/Ed8abuN0cqo=; b=KiUuUVgqBsUbNnmujmNFQgElNs vZoxYrB+KxLxZM8vSWCv7Wb/4/fiOLou9IESxOTDVSW30YLzoQxzONYa02q7gx7TiixdWhtDBq++9 yq/3xK4KOCRAcA9fYeJjAeHU5N3GxU0wNz3+IAN+UHgLPhbdsS9i08JWzSYOhksV/7AZ6wTFiPax2 YGyRJ3Micen4JqhKU5U8SWSj2d60wZPf23KPTBm06XzvUqggj5PN5qy/UJ4NmnLzeG7Y1uek29ekF WtsqJPMJCp0V6rjjByZKuwzsXP/FU/3YxkR2mF//E7u1c3Mm1aB2vY9jTvZeecIGFqEcHejpBn0es F3Xa3sYQ==; Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvBtV-00000008izc-39VM; Fri, 12 Apr 2024 08:04:21 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvBtV-00000009KTB-0quC; Fri, 12 Apr 2024 09:04:21 +0100 In-Reply-To: <20240412073530.2222496-1-dwmw2@infradead.org> References: <20240412073530.2222496-1-dwmw2@infradead.org> Message-Id: <20240412073530.2222496-3-dwmw2@infradead.org> From: David Woodhouse Date: Mon, 11 Mar 2024 13:04:07 +0000 Subject: [PATCH v2 2/2] arm64: acpi: Honour firmware_signature field of FACS, if it exists To: Catalin Marinas , Will Deacon Cc: Robert Moore , "Rafael J. Wysocki" , Len Brown , Sudeep Holla , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: David Woodhouse If the firmware_signature changes then OSPM should not attempt to resume from hibernate, but should instead perform a clean reboot. Set the global swsusp_hardware_signature to allow the generic code to include the value in the swsusp header on disk, and perform the appropriate check on resume. Signed-off-by: David Woodhouse Acked-by: Sudeep Holla --- arch/arm64/kernel/acpi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c index dba8fcec7f33..e0e7b93c16cc 100644 --- a/arch/arm64/kernel/acpi.c +++ b/arch/arm64/kernel/acpi.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -227,6 +228,15 @@ void __init acpi_boot_table_init(void) if (earlycon_acpi_spcr_enable) early_init_dt_scan_chosen_stdout(); } else { +#ifdef CONFIG_HIBERNATION + struct acpi_table_header *facs = NULL; + acpi_get_table(ACPI_SIG_FACS, 1, &facs); + if (facs) { + swsusp_hardware_signature = + ((struct acpi_table_facs *)facs)->hardware_signature; + acpi_put_table(facs); + } +#endif acpi_parse_spcr(earlycon_acpi_spcr_enable, true); if (IS_ENABLED(CONFIG_ACPI_BGRT)) acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt);