]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ACPI: PRM: Reduce unnecessary printing to avoid user confusion
authorZhu Qiyu <qiyuzhu2@amd.com>
Fri, 4 Jul 2025 01:41:04 +0000 (01:41 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:25:53 +0000 (16:25 +0200)
[ Upstream commit 3db5648c4d608b5483470efc1da9780b081242dd ]

Commit 088984c8d54c ("ACPI: PRM: Find EFI_MEMORY_RUNTIME block for PRM
handler and context") introduced non-essential printing "Failed to find
VA for GUID: xxxx, PA: 0x0" which may confuse users to think that
something wrong is going on while it is not the case.

According to the PRM Spec Section 4.1.2 [1], both static data buffer
address and ACPI parameter buffer address may be NULL if they are not
needed, so there is no need to print out the "Failed to find VA ... "
in those cases.

Link: https://uefi.org/sites/default/files/resources/Platform%20Runtime%20Mechanism%20-%20with%20legal%20notice.pdf
Signed-off-by: Zhu Qiyu <qiyuzhu2@amd.com>
Link: https://patch.msgid.link/20250704014104.82524-1-qiyuzhu2@amd.com
[ rjw: Edits in new comments, subject and changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/acpi/prmt.c

index 7747ca4168ab265d13740c87a070ead4dcac1c3b..215ca8d60616fc6bfc3d8128be02881e7f0d09b0 100644 (file)
@@ -85,8 +85,6 @@ static u64 efi_pa_va_lookup(efi_guid_t *guid, u64 pa)
                }
        }
 
-       pr_warn("Failed to find VA for GUID: %pUL, PA: 0x%llx", guid, pa);
-
        return 0;
 }
 
@@ -154,13 +152,37 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
                guid_copy(&th->guid, (guid_t *)handler_info->handler_guid);
                th->handler_addr =
                        (void *)efi_pa_va_lookup(&th->guid, handler_info->handler_address);
+               /*
+                * Print a warning message if handler_addr is zero which is not expected to
+                * ever happen.
+                */
+               if (unlikely(!th->handler_addr))
+                       pr_warn("Failed to find VA of handler for GUID: %pUL, PA: 0x%llx",
+                               &th->guid, handler_info->handler_address);
 
                th->static_data_buffer_addr =
                        efi_pa_va_lookup(&th->guid, handler_info->static_data_buffer_address);
+               /*
+                * According to the PRM specification, static_data_buffer_address can be zero,
+                * so avoid printing a warning message in that case.  Otherwise, if the
+                * return value of efi_pa_va_lookup() is zero, print the message.
+                */
+               if (unlikely(!th->static_data_buffer_addr && handler_info->static_data_buffer_address))
+                       pr_warn("Failed to find VA of static data buffer for GUID: %pUL, PA: 0x%llx",
+                               &th->guid, handler_info->static_data_buffer_address);
 
                th->acpi_param_buffer_addr =
                        efi_pa_va_lookup(&th->guid, handler_info->acpi_param_buffer_address);
 
+               /*
+                * According to the PRM specification, acpi_param_buffer_address can be zero,
+                * so avoid printing a warning message in that case.  Otherwise, if the
+                * return value of efi_pa_va_lookup() is zero, print the message.
+                */
+               if (unlikely(!th->acpi_param_buffer_addr && handler_info->acpi_param_buffer_address))
+                       pr_warn("Failed to find VA of acpi param buffer for GUID: %pUL, PA: 0x%llx",
+                               &th->guid, handler_info->acpi_param_buffer_address);
+
        } while (++cur_handler < tm->handler_count && (handler_info = get_next_handler(handler_info)));
 
        return 0;