Commit 9d7f2ea2 authored by Lv Zheng's avatar Lv Zheng Committed by Sasha Levin

ACPICA: Utilities: split IO address types from data type models.

[ Upstream commit 2b876010 ]

ACPICA commit aacf863cfffd46338e268b7415f7435cae93b451

It is reported that on a physically 64-bit addressed machine, 32-bit kernel
can trigger crashes in accessing the memory regions that are beyond the
32-bit boundary. The region field's start address should still be 32-bit
compliant, but after a calculation (adding some offsets), it may exceed the
32-bit boundary. This case is rare and buggy, but there are real BIOSes
leaked with such issues (see References below).

This patch fixes this gap by always defining IO addresses as 64-bit, and
allows OSPMs to optimize it for a real 32-bit machine to reduce the size of
the internal objects.

Internal acpi_physical_address usages in the structures that can be fixed
by this change include:
 1. struct acpi_object_region:
    acpi_physical_address		address;
 2. struct acpi_address_range:
    acpi_physical_address		start_address;
    acpi_physical_address		end_address;
 3. struct acpi_mem_space_context;
    acpi_physical_address		address;
 4. struct acpi_table_desc
    acpi_physical_address		address;
See known issues 1 for other usages.

Note that acpi_io_address which is used for ACPI_PROCESSOR may also suffer
from same problem, so this patch changes it accordingly.

For iasl, it will enforce acpi_physical_address as 32-bit to generate
32-bit OSPM compatible tables on 32-bit platforms, we need to define
ACPI_32BIT_PHYSICAL_ADDRESS for it in acenv.h.

Known issues:
 1. Cleanup of mapped virtual address
   In struct acpi_mem_space_context, acpi_physical_address is used as a virtual
   address:
    acpi_physical_address                   mapped_physical_address;
   It is better to introduce acpi_virtual_address or use acpi_size instead.
   This patch doesn't make such a change. Because this should be done along
   with a change to acpi_os_map_memory()/acpi_os_unmap_memory().
   There should be no functional problem to leave this unchanged except
   that only this structure is enlarged unexpectedly.

Link: https://github.com/acpica/acpica/commit/aacf863c
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=87971
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=79501Reported-and-tested-by: default avatarPaul Menzel <paulepanter@users.sourceforge.net>
Reported-and-tested-by: default avatarSial Nije <sialnije@gmail.com>
Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 28cafa98
...@@ -199,9 +199,29 @@ typedef int s32; ...@@ -199,9 +199,29 @@ typedef int s32;
typedef s32 acpi_native_int; typedef s32 acpi_native_int;
typedef u32 acpi_size; typedef u32 acpi_size;
#ifdef ACPI_32BIT_PHYSICAL_ADDRESS
/*
* OSPMs can define this to shrink the size of the structures for 32-bit
* none PAE environment. ASL compiler may always define this to generate
* 32-bit OSPM compliant tables.
*/
typedef u32 acpi_io_address; typedef u32 acpi_io_address;
typedef u32 acpi_physical_address; typedef u32 acpi_physical_address;
#else /* ACPI_32BIT_PHYSICAL_ADDRESS */
/*
* It is reported that, after some calculations, the physical addresses can
* wrap over the 32-bit boundary on 32-bit PAE environment.
* https://bugzilla.kernel.org/show_bug.cgi?id=87971
*/
typedef u64 acpi_io_address;
typedef u64 acpi_physical_address;
#endif /* ACPI_32BIT_PHYSICAL_ADDRESS */
#define ACPI_MAX_PTR ACPI_UINT32_MAX #define ACPI_MAX_PTR ACPI_UINT32_MAX
#define ACPI_SIZE_MAX ACPI_UINT32_MAX #define ACPI_SIZE_MAX ACPI_UINT32_MAX
......
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
#define ACPI_LARGE_NAMESPACE_NODE #define ACPI_LARGE_NAMESPACE_NODE
#define ACPI_DATA_TABLE_DISASSEMBLY #define ACPI_DATA_TABLE_DISASSEMBLY
#define ACPI_SINGLE_THREADED #define ACPI_SINGLE_THREADED
#define ACPI_32BIT_PHYSICAL_ADDRESS
#endif #endif
/* acpi_exec configuration. Multithreaded with full AML debugger */ /* acpi_exec configuration. Multithreaded with full AML debugger */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment