-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge patch series "Add basic ACPI support for RISC-V"
Sunil V L <sunilvl@ventanamicro.com> says: This patch series enables the basic ACPI infrastructure for RISC-V. Supporting external interrupt controllers is in progress and hence it is tested using poll based HVC SBI console and RAM disk. The first patch in this series is one of the patch from Jisheng's series [1] which is not merged yet. This patch is required to support ACPI since efi_init() which gets called before sbi_init() can enable static branches and hits a panic. Below are two ECRs approved by ASWG. RINTC - https://drive.google.com/file/d/1R6k4MshhN3WTT-hwqAquu5nX6xSEqK2l/view RHCT - https://drive.google.com/file/d/1nP3nFiH4jkPMp6COOxP6123DCZKR-tia/view Testing: 1) Build latest Qemu 2) Build EDK2 as per instructions in https://github.com/vlsunil/riscv-uefi-edk2-docs/wiki/RISC-V-Qemu-Virt-support 3) Build Linux after enabling SBI HVC and SBI earlycon CONFIG_RISCV_SBI_V01=y CONFIG_SERIAL_EARLYCON_RISCV_SBI=y CONFIG_HVC_RISCV_SBI=y 4) Build buildroot. Run with below command. qemu-system-riscv64 -nographic \ -drive file=Build/RiscVVirtQemu/RELEASE_GCC5/FV/RISCV_VIRT.fd,if=pflash,format=raw,unit=1 \ -machine virt -smp 16 -m 2G \ -kernel arch/riscv/boot/Image \ -initrd buildroot/output/images/rootfs.cpio \ -append "root=/dev/ram ro console=hvc0 earlycon=sbi" * b4-shazam-merge: RISC-V: Enable ACPI in defconfig RISC-V: time.c: Add ACPI support for time_init() clocksource/timer-riscv: Add ACPI support clocksource/timer-riscv: Refactor riscv_timer_init_dt() irqchip/riscv-intc: Add ACPI support RISC-V: cpu: Enable cpuinfo for ACPI systems RISC-V: cpufeature: Add ACPI support in riscv_fill_hwcap() RISC-V: only iterate over possible CPUs in ISA string parser RISC-V: smpboot: Add ACPI support in setup_smp() RISC-V: smpboot: Create wrapper setup_smp() drivers/acpi: RISC-V: Add RHCT related code RISC-V: ACPI: Cache and retrieve the RINTC structure RISC-V: Add ACPI initialization in setup_arch() ACPI: processor_core: RISC-V: Enable mapping processor to the hartid RISC-V: Add support to build the ACPI core ACPI: OSL: Make should_use_kmap() 0 for RISC-V ACPI: tables: Print RINTC information when MADT is parsed crypto: hisilicon/qm: Fix to enable build with RISC-V clang platform/surface: Disable for RISC-V riscv: move sbi_init() earlier before jump_label_init() Link: https://lore.kernel.org/r/20230515054928.2079268-1-sunilvl@ventanamicro.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
- Loading branch information
Showing
24 changed files
with
772 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
/* | ||
* RISC-V specific ACPICA environments and implementation | ||
*/ | ||
|
||
#ifndef _ASM_ACENV_H | ||
#define _ASM_ACENV_H | ||
|
||
/* This header is required unconditionally by the ACPI core */ | ||
|
||
#endif /* _ASM_ACENV_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* 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> | ||
* | ||
* Copyright (C) 2021-2023, Ventana Micro Systems Inc. | ||
* Author: Sunil V L <sunilvl@ventanamicro.com> | ||
*/ | ||
|
||
#ifndef _ASM_ACPI_H | ||
#define _ASM_ACPI_H | ||
|
||
/* Basic configuration for ACPI */ | ||
#ifdef CONFIG_ACPI | ||
|
||
typedef u64 phys_cpuid_t; | ||
#define PHYS_CPUID_INVALID INVALID_HARTID | ||
|
||
/* ACPI table mapping after acpi_permanent_mmap is set */ | ||
void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); | ||
#define acpi_os_ioremap acpi_os_ioremap | ||
|
||
#define acpi_strict 1 /* No out-of-spec workarounds on RISC-V */ | ||
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 whether this cpu was already mapped (mapping from CPU hardware | ||
* ID to CPU logical ID) or not. | ||
*/ | ||
#define cpu_physical_id(cpu) cpuid_to_hartid_map(cpu) | ||
|
||
/* | ||
* Since MADT must provide at least one RINTC structure, the | ||
* CPU will be always available in MADT on RISC-V. | ||
*/ | ||
static inline bool acpi_has_cpu_in_madt(void) | ||
{ | ||
return true; | ||
} | ||
|
||
static inline void arch_fix_phys_package_id(int num, u32 slot) { } | ||
|
||
void acpi_init_rintc_map(void); | ||
struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu); | ||
u32 get_acpi_id_for_cpu(int cpu); | ||
int acpi_get_riscv_isa(struct acpi_table_header *table, | ||
unsigned int cpu, const char **isa); | ||
|
||
static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; } | ||
#else | ||
static inline void acpi_init_rintc_map(void) { } | ||
static inline struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu) | ||
{ | ||
return NULL; | ||
} | ||
|
||
static inline int acpi_get_riscv_isa(struct acpi_table_header *table, | ||
unsigned int cpu, const char **isa) | ||
{ | ||
return -EINVAL; | ||
} | ||
|
||
#endif /* CONFIG_ACPI */ | ||
|
||
#endif /*_ASM_ACPI_H*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
|
||
#ifndef _ASM_CPU_H | ||
#define _ASM_CPU_H | ||
|
||
/* This header is required unconditionally by the ACPI core */ | ||
|
||
#endif /* _ASM_CPU_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.