Unverified Commit 90502d51 authored by Palmer Dabbelt's avatar Palmer Dabbelt
Browse files

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: default avatarPalmer Dabbelt <palmer@rivosinc.com>
parents ac9a7868 cc9e654a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
	acpi=		[HW,ACPI,X86,ARM64]
	acpi=		[HW,ACPI,X86,ARM64,RISCV64]
			Advanced Configuration and Power Interface
			Format: { force | on | off | strict | noirq | rsdt |
				  copy_dsdt }
			force -- enable ACPI if default was off
			on -- enable ACPI but allow fallback to DT [arm64]
			on -- enable ACPI but allow fallback to DT [arm64,riscv64]
			off -- disable ACPI if default was on
			noirq -- do not use ACPI for IRQ routing
			strict -- Be less tolerant of platforms that are not
				strictly ACPI specification compliant.
			rsdt -- prefer RSDT over (default) XSDT
			copy_dsdt -- copy DSDT to memory
			For ARM64, ONLY "acpi=off", "acpi=on" or "acpi=force"
			are available
			For ARM64 and RISCV64, ONLY "acpi=off", "acpi=on" or
			"acpi=force" are available

			See also Documentation/power/runtime_pm.rst, pci=noacpi

+7 −0
Original line number Diff line number Diff line
@@ -412,6 +412,13 @@ L: platform-driver-x86@vger.kernel.org
S:	Maintained
F:	drivers/platform/x86/serial-multi-instantiate.c
ACPI FOR RISC-V (ACPI/riscv)
M:	Sunil V L <sunilvl@ventanamicro.com>
L:	linux-acpi@vger.kernel.org
L:	linux-riscv@lists.infradead.org
S:	Maintained
F:	drivers/acpi/riscv/
ACPI PCC(Platform Communication Channel) MAILBOX DRIVER
M:	Sudeep Holla <sudeep.holla@arm.com>
L:	linux-acpi@vger.kernel.org
+5 −0
Original line number Diff line number Diff line
@@ -12,6 +12,8 @@ config 32BIT

config RISCV
	def_bool y
	select ACPI_GENERIC_GSI if ACPI
	select ACPI_REDUCED_HARDWARE_ONLY if ACPI
	select ARCH_DMA_DEFAULT_COHERENT
	select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
	select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
@@ -707,6 +709,7 @@ config EFI
	depends on OF && !XIP_KERNEL
	depends on MMU
	default y
	select ARCH_SUPPORTS_ACPI if 64BIT
	select EFI_GENERIC_STUB
	select EFI_PARAMS_FROM_FDT
	select EFI_RUNTIME_WRAPPERS
@@ -816,3 +819,5 @@ source "drivers/cpufreq/Kconfig"
endmenu # "CPU Power Management"

source "arch/riscv/kvm/Kconfig"

source "drivers/acpi/Kconfig"
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ CONFIG_PM=y
CONFIG_CPU_IDLE=y
CONFIG_VIRTUALIZATION=y
CONFIG_KVM=m
CONFIG_ACPI=y
CONFIG_JUMP_LABEL=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
+11 −0
Original line number Diff line number Diff line
/* 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 */
Loading