x86/DMI: fix table mapping when one lives above 1Mb
authorJan Beulich <jbeulich@suse.com>
Tue, 24 Nov 2020 10:26:34 +0000 (11:26 +0100)
committerHans van Kranenburg <hans@knorrie.org>
Fri, 4 Nov 2022 19:25:46 +0000 (19:25 +0000)
commit47db8b77c7dcdaeb7f9d275db3f6480ed1862c8e
treed278020fb4fbb25076b75bc703217c538deb1b12
parentfadd71d1e02d2e14c6eae3b5e8a6627a19b4b89c
x86/DMI: fix table mapping when one lives above 1Mb

Use of __acpi_map_table() is kind of an abuse here, and doesn't work
anymore for the majority of cases if any of the tables lives outside the
low first Mb. Keep this (ab)use only prior to reaching SYS_STATE_boot,
primarily to avoid needing to audit whether any of the calls here can
happen this early in the first place; quite likely this isn't necessary
at all - at least dmi_scan_machine() gets called late enough.

For the "normal" case, call __vmap() directly, despite effectively
duplicating acpi_os_map_memory(). There's one difference though: We
shouldn't need to establish UC- mappings, WP or r/o WB mappings ought to
be fine, as the tables are going to live in either RAM or ROM. Short of
having PAGE_HYPERVISOR_WP and wanting to map the tables r/o anyway, use
the latter of the two options. The r/o mapping implies some
constification of code elsewhere in the file. For code touched anyway
also switch to void (where possible) or uint8_t.

Fixes: 1c4aa69ca1e1 ("xen/acpi: Rework acpi_os_map_memory() and acpi_os_unmap_memory()")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
(cherry picked from commit f390941a92f102ebbbbce1b54be206a602187fd7)

Gbp-Pq: Name 0042-x86-DMI-fix-table-mapping-when-one-lives-above-1Mb.patch
xen/arch/x86/dmi_scan.c