From patchwork Mon Aug 5 06:08:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaqing Zhao X-Patchwork-Id: 13753133 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75ECB38385; Mon, 5 Aug 2024 06:08:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722838125; cv=none; b=HxTcXdnVtPibrmaY+RiBe+FkgQGIZSGMCwM7SvqycS40DCDHC7EZsXtETZhaAaA/zIV4fgM5dBLujFQZUMrCTWnDXUB3/7l4fCwB8c5lpQFljuWmwHTX+gSmVlDuQ1jZAcRlqOalVqldtWJpPYLAPmk20cRlEsvEjufG4ec2TbA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722838125; c=relaxed/simple; bh=I5rn0gZJfSjx9FVF+npEArcFtQead6gawu43H7Jv0gM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nz97ej9qesEltB/Akf5TGkVtMR03WjAP2jlKqVHq//xgYEh6sTqNg67N7WtTOBvUPihXFQJQTakX+6dF83/CMzuzJHXc78HPaVN4ic1C8DjV1JW0BqP7bNPbX29WvsruiMMiCNcgMaDgzyvy912/sGUO597f7gu0bI5/1z9ejzE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=JZu9O1Bw; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JZu9O1Bw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722838124; x=1754374124; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=I5rn0gZJfSjx9FVF+npEArcFtQead6gawu43H7Jv0gM=; b=JZu9O1Bw5kJgc94vhNyIKzeOVwkbFzkqV6MEqkJNbRXvf7nqj507gflv s9sGOSr+qx4AJUAAYFpp1YFuMSoUe+fZAGmAaAYV5UqY5JY6tNrFwNEQZ 9sFsmiA7VK1lAse0gP10WmZ2KxS9xEBDyJrkcjkDSqSv6r1CQyMnCFofZ MNGCrxxO/3i7ODZwMwaBfqj4I46I5Lv3253CWQjAPFXBZw8+Qt9Xs6nPv T7LHWm/5mS/OPgV14hJtZ8S7QBNgrGaZTq+A5HkhsXKGQQII9UGmZgfxF 06+YvRggNzziJruSpxTC5lbYOREcyTcUTL9tajFBKPJlrMZdciAEe1XR2 Q==; X-CSE-ConnectionGUID: QQ2Dr/cCTTOvqk1VhU9stg== X-CSE-MsgGUID: FD3rRM3LQOmlr1szy/NY2w== X-IronPort-AV: E=McAfee;i="6700,10204,11154"; a="31360134" X-IronPort-AV: E=Sophos;i="6.09,263,1716274800"; d="scan'208";a="31360134" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2024 23:08:43 -0700 X-CSE-ConnectionGUID: z/RH9liMT7OlPxXLKzlJFw== X-CSE-MsgGUID: CxL5VrkQStmT8TuLmwWcqg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,263,1716274800"; d="scan'208";a="61028949" Received: from unknown (HELO jiaqingz-acrn-container.sh.intel.com) ([10.239.43.235]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2024 23:08:41 -0700 From: Jiaqing Zhao To: Robert Moore , "Rafael J. Wysocki" , Len Brown , linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev Cc: linux-kernel@vger.kernel.org, Jiaqing Zhao Subject: [PATCH 1/2] ACPICA: Detect FACS in reduced hardware model Date: Mon, 5 Aug 2024 06:08:12 +0000 Message-ID: <20240805060812.1002004-3-jiaqing.zhao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240805060812.1002004-2-jiaqing.zhao@linux.intel.com> References: <20240805060812.1002004-2-jiaqing.zhao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 According to Section 5.2.10 of ACPI Specification, FACS is optional in reduced hardware model. Enable the detection for "Hardware-reduced ACPI support only" build (CONFIG_ACPI_REDUCED_HARDWARE_ONLY=y) also. Signed-off-by: Jiaqing Zhao --- drivers/acpi/acpica/acglobal.h | 6 +----- drivers/acpi/acpica/tbutils.c | 5 +---- drivers/acpi/acpica/utxfinit.c | 24 ++++++++++++------------ include/acpi/acconfig.h | 1 - 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index f4c90fc99be2..309ce8efb4f6 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h @@ -29,11 +29,7 @@ ACPI_INIT_GLOBAL(u32, acpi_gbl_dsdt_index, ACPI_INVALID_TABLE_INDEX); ACPI_INIT_GLOBAL(u32, acpi_gbl_facs_index, ACPI_INVALID_TABLE_INDEX); ACPI_INIT_GLOBAL(u32, acpi_gbl_xfacs_index, ACPI_INVALID_TABLE_INDEX); ACPI_INIT_GLOBAL(u32, acpi_gbl_fadt_index, ACPI_INVALID_TABLE_INDEX); - -#if (!ACPI_REDUCED_HARDWARE) -ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS); - -#endif /* !ACPI_REDUCED_HARDWARE */ +ACPI_INIT_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS, NULL); /* These addresses are calculated from the FADT Event Block addresses */ diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index 15fa68a5ea6e..356700349b45 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c @@ -18,7 +18,6 @@ ACPI_MODULE_NAME("tbutils") static acpi_physical_address acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size); -#if (!ACPI_REDUCED_HARDWARE) /******************************************************************************* * * FUNCTION: acpi_tb_initialize_facs @@ -37,8 +36,7 @@ acpi_status acpi_tb_initialize_facs(void) struct acpi_table_facs *facs; if (acpi_gbl_FADT.Xfacs && - (!acpi_gbl_FADT.facs - || !acpi_gbl_use32_bit_facs_addresses)) { + (!acpi_gbl_FADT.facs || !acpi_gbl_use32_bit_facs_addresses)) { (void)acpi_get_table_by_index(acpi_gbl_xfacs_index, ACPI_CAST_INDIRECT_PTR(struct acpi_table_header, @@ -56,7 +54,6 @@ acpi_status acpi_tb_initialize_facs(void) return (AE_OK); } -#endif /* !ACPI_REDUCED_HARDWARE */ /******************************************************************************* * diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c index 1915bec2b279..70ae0afa7939 100644 --- a/drivers/acpi/acpica/utxfinit.c +++ b/drivers/acpi/acpica/utxfinit.c @@ -120,6 +120,18 @@ acpi_status ACPI_INIT_FUNCTION acpi_enable_subsystem(u32 flags) */ acpi_gbl_early_initialization = FALSE; + /* + * Obtain a permanent mapping for the FACS. This is required for the + * Global Lock and the Firmware Waking Vector + */ + if (!(flags & ACPI_NO_FACS_INIT)) { + status = acpi_tb_initialize_facs(); + if (ACPI_FAILURE(status)) { + ACPI_WARNING((AE_INFO, "Could not map the FACS table")); + return_ACPI_STATUS(status); + } + } + #if (!ACPI_REDUCED_HARDWARE) /* Enable ACPI mode */ @@ -137,18 +149,6 @@ acpi_status ACPI_INIT_FUNCTION acpi_enable_subsystem(u32 flags) } } - /* - * Obtain a permanent mapping for the FACS. This is required for the - * Global Lock and the Firmware Waking Vector - */ - if (!(flags & ACPI_NO_FACS_INIT)) { - status = acpi_tb_initialize_facs(); - if (ACPI_FAILURE(status)) { - ACPI_WARNING((AE_INFO, "Could not map the FACS table")); - return_ACPI_STATUS(status); - } - } - /* * Initialize ACPI Event handling (Fixed and General Purpose) * diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index d768d9c568cf..2da5f4a6e814 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -67,7 +67,6 @@ * General Purpose Events (GPEs) * Global Lock * ACPI PM timer - * FACS table (Waking vectors and Global Lock) */ #ifndef ACPI_REDUCED_HARDWARE #define ACPI_REDUCED_HARDWARE FALSE From patchwork Mon Aug 5 06:08:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaqing Zhao X-Patchwork-Id: 13753134 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2F66145B2C; Mon, 5 Aug 2024 06:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722838127; cv=none; b=GI5+/8EzO3o85/YdQGb03ZFdxVuK4JUPhNURjU6bbJPnQXf5HU3GMeEe2PVGZW2hoiyxJdopVuaoqYDv8UM739wgrdxYrN4wNGDmHktd4XPwoDChjzrvr36vpFhHLgAVNCHO8bdiXxcPxElcw4amYshYo0l6AmBLp8Otfd7uUsg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722838127; c=relaxed/simple; bh=MGahE53/xciKSDi5AfqYOyKwYWzKT+vXGLdiEURlXFg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tnnav9mOxJBFUaYujHC+L+9Axv8+OUOykpysCdHgjSzaui0+afNeDlQXRMGEOcZJVRzLOuNR1d5iTGhuhwZe4x33T+Gqc0aC7nD56xBCUlGSVCCqfvKDwjz/4PMUMBiFls8H+6XMJJTRhOErAGFDPfDqORct1UMuyLi29V2Pjnk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mEtV1RFs; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mEtV1RFs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722838126; x=1754374126; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MGahE53/xciKSDi5AfqYOyKwYWzKT+vXGLdiEURlXFg=; b=mEtV1RFsxAw8CxAm4vBRjE6ErZCqD3ekus2t+7K0uNWbVZLSbW9XwUO4 AE5nHhaf+I+xeveHy2ZPD1LwTYbm8LbwfgcSByUKv+6bUy+7tE71EDLJh sFD/cXJ1XhNwIf3gnn3Y32PPVqI9l0yZtq+PCF9IUSm/70FPK336BWPa1 M0VimBCkrwtIxC24gA4U7YCtUcJav0aOhza5HCYUc14y0eoQT1sqOi/Sb 6s3WhfumKb/4bJ9QWiCifPBb4PhCmcXrRXsJz2+xWD7OHJI+oEzdSg9Xl l6R+xbqpUUE+jk8v9GdkPN8Mwd6Fk/kmTW9z8tAO0/OfvokpD+3h4X6kC Q==; X-CSE-ConnectionGUID: Owyo2DQiTlS8lH+EhDEr/g== X-CSE-MsgGUID: U7+XzWdeQSylxc+Q46m8EA== X-IronPort-AV: E=McAfee;i="6700,10204,11154"; a="31360138" X-IronPort-AV: E=Sophos;i="6.09,263,1716274800"; d="scan'208";a="31360138" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2024 23:08:45 -0700 X-CSE-ConnectionGUID: 1dUzj8iCREy30I467iieQQ== X-CSE-MsgGUID: Rg46K8n+TTKsTzVXcwE7Jg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,263,1716274800"; d="scan'208";a="61028957" Received: from unknown (HELO jiaqingz-acrn-container.sh.intel.com) ([10.239.43.235]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2024 23:08:43 -0700 From: Jiaqing Zhao To: Robert Moore , "Rafael J. Wysocki" , Len Brown , linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev Cc: linux-kernel@vger.kernel.org, Jiaqing Zhao Subject: [PATCH 2/2] ACPICA: Allow setting waking vector in reduced hardware model Date: Mon, 5 Aug 2024 06:08:13 +0000 Message-ID: <20240805060812.1002004-4-jiaqing.zhao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240805060812.1002004-2-jiaqing.zhao@linux.intel.com> References: <20240805060812.1002004-2-jiaqing.zhao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Allow setting waking vector in FACS table on hardware-reduced platforms to support S3 wakeup on such platform. Signed-off-by: Jiaqing Zhao --- drivers/acpi/acpica/hwxfsleep.c | 21 ++++++--------------- include/acpi/acpixf.h | 8 ++++---- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c index 36ea48f64110..1bf7520a0b18 100644 --- a/drivers/acpi/acpica/hwxfsleep.c +++ b/drivers/acpi/acpica/hwxfsleep.c @@ -15,21 +15,6 @@ #define _COMPONENT ACPI_HARDWARE ACPI_MODULE_NAME("hwxfsleep") -/* Local prototypes */ -#if (!ACPI_REDUCED_HARDWARE) -static acpi_status -acpi_hw_set_firmware_waking_vector(struct acpi_table_facs *facs, - acpi_physical_address physical_address, - acpi_physical_address physical_address64); -#endif - -/* - * These functions are removed for the ACPI_REDUCED_HARDWARE case: - * acpi_set_firmware_waking_vector - * acpi_enter_sleep_state_s4bios - */ - -#if (!ACPI_REDUCED_HARDWARE) /******************************************************************************* * * FUNCTION: acpi_hw_set_firmware_waking_vector @@ -115,6 +100,12 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address, ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) +/* + * These functions are removed for the ACPI_REDUCED_HARDWARE case: + * acpi_enter_sleep_state_s4bios + */ + +#if (!ACPI_REDUCED_HARDWARE) /******************************************************************************* * * FUNCTION: acpi_enter_sleep_state_s4bios diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 80dc36f9d527..99bb45a46600 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -881,10 +881,10 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)) ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_leave_sleep_state(u8 sleep_state)) -ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status - acpi_set_firmware_waking_vector - (acpi_physical_address physical_address, - acpi_physical_address physical_address64)) +ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_set_firmware_waking_vector + (acpi_physical_address physical_address, + acpi_physical_address physical_address64)) /* * ACPI Timer interfaces */