mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-12 05:24:12 +08:00
12064c1768
This reverts commit437b38c511
. The memory semantics added in commit437b38c511
causes SystemMemory Operation region, whose address range is not described in the EFI memory map to be mapped as NormalNC memory on arm64 platforms (through acpi_os_map_memory() in acpi_ex_system_memory_space_handler()). This triggers the following abort on an ARM64 Ampere eMAG machine, because presumably the physical address range area backing the Opregion does not support NormalNC memory attributes driven on the bus. Internal error: synchronous external abort: 96000410 [#1] SMP Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0+ #462 Hardware name: MiTAC RAPTOR EV-883832-X3-0001/RAPTOR, BIOS 0.14 02/22/2019 pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [...snip...] Call trace: acpi_ex_system_memory_space_handler+0x26c/0x2c8 acpi_ev_address_space_dispatch+0x228/0x2c4 acpi_ex_access_region+0x114/0x268 acpi_ex_field_datum_io+0x128/0x1b8 acpi_ex_extract_from_field+0x14c/0x2ac acpi_ex_read_data_from_field+0x190/0x1b8 acpi_ex_resolve_node_to_value+0x1ec/0x288 acpi_ex_resolve_to_value+0x250/0x274 acpi_ds_evaluate_name_path+0xac/0x124 acpi_ds_exec_end_op+0x90/0x410 acpi_ps_parse_loop+0x4ac/0x5d8 acpi_ps_parse_aml+0xe0/0x2c8 acpi_ps_execute_method+0x19c/0x1ac acpi_ns_evaluate+0x1f8/0x26c acpi_ns_init_one_device+0x104/0x140 acpi_ns_walk_namespace+0x158/0x1d0 acpi_ns_initialize_devices+0x194/0x218 acpi_initialize_objects+0x48/0x50 acpi_init+0xe0/0x498 If the Opregion address range is not present in the EFI memory map there is no way for us to determine the memory attributes to use to map it - defaulting to NormalNC does not work (and it is not correct on a memory region that may have read side-effects) and therefore commit437b38c511
should be reverted, which means reverting back to the original behavior whereby address ranges that are mapped using acpi_os_map_memory() default to the safe devicenGnRnE attributes on ARM64 if the mapped address range is not defined in the EFI memory map. Fixes:437b38c511
("ACPI: Add memory semantics to acpi_os_map_memory()") Signed-off-by: Jia He <justin.he@arm.com> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
158 lines
4.6 KiB
C
158 lines
4.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2013-2014, Linaro Ltd.
|
|
* Author: Al Stone <al.stone@linaro.org>
|
|
* Author: Graeme Gregory <graeme.gregory@linaro.org>
|
|
* Author: Hanjun Guo <hanjun.guo@linaro.org>
|
|
*/
|
|
|
|
#ifndef _ASM_ACPI_H
|
|
#define _ASM_ACPI_H
|
|
|
|
#include <linux/efi.h>
|
|
#include <linux/memblock.h>
|
|
#include <linux/psci.h>
|
|
#include <linux/stddef.h>
|
|
|
|
#include <asm/cputype.h>
|
|
#include <asm/io.h>
|
|
#include <asm/ptrace.h>
|
|
#include <asm/smp_plat.h>
|
|
#include <asm/tlbflush.h>
|
|
|
|
/* Macros for consistency checks of the GICC subtable of MADT */
|
|
|
|
/*
|
|
* MADT GICC minimum length refers to the MADT GICC structure table length as
|
|
* defined in the earliest ACPI version supported on arm64, ie ACPI 5.1.
|
|
*
|
|
* The efficiency_class member was added to the
|
|
* struct acpi_madt_generic_interrupt to represent the MADT GICC structure
|
|
* "Processor Power Efficiency Class" field, added in ACPI 6.0 whose offset
|
|
* is therefore used to delimit the MADT GICC structure minimum length
|
|
* appropriately.
|
|
*/
|
|
#define ACPI_MADT_GICC_MIN_LENGTH offsetof( \
|
|
struct acpi_madt_generic_interrupt, efficiency_class)
|
|
|
|
#define BAD_MADT_GICC_ENTRY(entry, end) \
|
|
(!(entry) || (entry)->header.length < ACPI_MADT_GICC_MIN_LENGTH || \
|
|
(unsigned long)(entry) + (entry)->header.length > (end))
|
|
|
|
#define ACPI_MADT_GICC_SPE (offsetof(struct acpi_madt_generic_interrupt, \
|
|
spe_interrupt) + sizeof(u16))
|
|
|
|
/* Basic configuration for ACPI */
|
|
#ifdef CONFIG_ACPI
|
|
pgprot_t __acpi_get_mem_attribute(phys_addr_t addr);
|
|
|
|
/* ACPI table mapping after acpi_permanent_mmap is set */
|
|
void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
|
|
#define acpi_os_ioremap acpi_os_ioremap
|
|
|
|
typedef u64 phys_cpuid_t;
|
|
#define PHYS_CPUID_INVALID INVALID_HWID
|
|
|
|
#define acpi_strict 1 /* No out-of-spec workarounds on ARM64 */
|
|
extern int acpi_disabled;
|
|
extern int acpi_noirq;
|
|
extern int acpi_pci_disabled;
|
|
|
|
static inline void disable_acpi(void)
|
|
{
|
|
acpi_disabled = 1;
|
|
acpi_pci_disabled = 1;
|
|
acpi_noirq = 1;
|
|
}
|
|
|
|
static inline void enable_acpi(void)
|
|
{
|
|
acpi_disabled = 0;
|
|
acpi_pci_disabled = 0;
|
|
acpi_noirq = 0;
|
|
}
|
|
|
|
/*
|
|
* The ACPI processor driver for ACPI core code needs this macro
|
|
* to find out this cpu was already mapped (mapping from CPU hardware
|
|
* ID to CPU logical ID) or not.
|
|
*/
|
|
#define cpu_physical_id(cpu) cpu_logical_map(cpu)
|
|
|
|
/*
|
|
* It's used from ACPI core in kdump to boot UP system with SMP kernel,
|
|
* with this check the ACPI core will not override the CPU index
|
|
* obtained from GICC with 0 and not print some error message as well.
|
|
* Since MADT must provide at least one GICC structure for GIC
|
|
* initialization, CPU will be always available in MADT on ARM64.
|
|
*/
|
|
static inline bool acpi_has_cpu_in_madt(void)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
struct acpi_madt_generic_interrupt *acpi_cpu_get_madt_gicc(int cpu);
|
|
static inline u32 get_acpi_id_for_cpu(unsigned int cpu)
|
|
{
|
|
return acpi_cpu_get_madt_gicc(cpu)->uid;
|
|
}
|
|
|
|
static inline void arch_fix_phys_package_id(int num, u32 slot) { }
|
|
void __init acpi_init_cpus(void);
|
|
int apei_claim_sea(struct pt_regs *regs);
|
|
#else
|
|
static inline void acpi_init_cpus(void) { }
|
|
static inline int apei_claim_sea(struct pt_regs *regs) { return -ENOENT; }
|
|
#endif /* CONFIG_ACPI */
|
|
|
|
#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL
|
|
bool acpi_parking_protocol_valid(int cpu);
|
|
void __init
|
|
acpi_set_mailbox_entry(int cpu, struct acpi_madt_generic_interrupt *processor);
|
|
#else
|
|
static inline bool acpi_parking_protocol_valid(int cpu) { return false; }
|
|
static inline void
|
|
acpi_set_mailbox_entry(int cpu, struct acpi_madt_generic_interrupt *processor)
|
|
{}
|
|
#endif
|
|
|
|
static inline const char *acpi_get_enable_method(int cpu)
|
|
{
|
|
if (acpi_psci_present())
|
|
return "psci";
|
|
|
|
if (acpi_parking_protocol_valid(cpu))
|
|
return "parking-protocol";
|
|
|
|
return NULL;
|
|
}
|
|
|
|
#ifdef CONFIG_ACPI_APEI
|
|
/*
|
|
* acpi_disable_cmcff is used in drivers/acpi/apei/hest.c for disabling
|
|
* IA-32 Architecture Corrected Machine Check (CMC) Firmware-First mode
|
|
* with a kernel command line parameter "acpi=nocmcoff". But we don't
|
|
* have this IA-32 specific feature on ARM64, this definition is only
|
|
* for compatibility.
|
|
*/
|
|
#define acpi_disable_cmcff 1
|
|
static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
|
|
{
|
|
return __acpi_get_mem_attribute(addr);
|
|
}
|
|
#endif /* CONFIG_ACPI_APEI */
|
|
|
|
#ifdef CONFIG_ACPI_NUMA
|
|
int arm64_acpi_numa_init(void);
|
|
int acpi_numa_get_nid(unsigned int cpu);
|
|
void acpi_map_cpus_to_nodes(void);
|
|
#else
|
|
static inline int arm64_acpi_numa_init(void) { return -ENOSYS; }
|
|
static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; }
|
|
static inline void acpi_map_cpus_to_nodes(void) { }
|
|
#endif /* CONFIG_ACPI_NUMA */
|
|
|
|
#define ACPI_TABLE_UPGRADE_MAX_PHYS MEMBLOCK_ALLOC_ACCESSIBLE
|
|
|
|
#endif /*_ASM_ACPI_H*/
|