RISC-V: ACPI improvements
Subsystems (3)
Sunil V L
maintainerv4 cover RISC-V: ACPI improvements
This series is a set of patches which were originally part of RFC v1 series
[1] to add ACPI support in RISC-V interrupt controllers. Since these patches are independent of the interrupt controllers, creating this new series which helps to merge instead of waiting for big series.
This set of patches primarily adds support below ECR [2] which is approved by the ASWG and adds below features.
- Get CBO block sizes from RHCT on ACPI based systems.
Additionally, the series contains a patch to improve acpi_os_ioremap().
[1] - https://lore.kernel.org/lkml/[email protected]/
[2] - https://drive.google.com/file/d/1sKbOa8m1UZw1JkquZYe3F1zQBN1xXsaf/view?usp=sharing
Changes since v3:
1) Added new patch to update return value of acpi_get_rhct() as suggested by Drew.
2) Formatting fixes as suggested by Drew.
3) Updated tags.
Changes since v2:
1) Modified acpi_get_cbo_block_size() not to take cpu parameter but follow same pattern as DT (Feedback from Samuel and Drew)
2) Dropped timer patch from the series since it is already applied.
3) Selected ARCH_KEEP_MEMBLOCK only if ACPI (Feedback from Alex).
4) Added RB tags received so far except RHCT patch which has changed quite significantly from previous version.
Changes since RFC v1:
1) Separated the patches from interrupt controller support series.
2) Addressed feedback from Andy and Drew.
3) Rebased to Palmer's for-next tree.
4) Added RB tags received on RFC v1.
Sunil V L (4):
RISC-V: ACPI: Enhance acpi_os_ioremap with MMIO remapping
RISC-V: ACPI: Update the return value of acpi_get_rhct()
RISC-V: ACPI: RHCT: Add function to get CBO block sizes
RISC-V: cacheflush: Initialize CBO variables on ACPI systems
arch/riscv/Kconfig | 1 + arch/riscv/include/asm/acpi.h | 6 +++ arch/riscv/kernel/acpi.c | 87 +++++++++++++++++++++++++++++++- arch/riscv/mm/cacheflush.c | 25 +++++++--- drivers/acpi/riscv/rhct.c | 93 +++++++++++++++++++++++++++++++++-- 5 files changed, 201 insertions(+), 11 deletions(-)
Signature · 1 line
2.39.2
Sunil V L
maintainerPATCH v4 1/4 RISC-V: ACPI: Enhance acpi_os_ioremap with MMIO remapping
Enhance the acpi_os_ioremap() to support opregions in MMIO space. Also, have strict checks using EFI memory map to allow remapping the RAM similar to arm64.
--- arch/riscv/Kconfig | 1 + arch/riscv/kernel/acpi.c | 87 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 86 insertions(+), 2 deletions(-)
arch/riscv/Kconfig +1 -0
@@ -39,6 +39,7 @@ config RISCV select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_UBSAN_SANITIZE_ALL select ARCH_HAS_VDSO_DATA + select ARCH_KEEP_MEMBLOCK if ACPI select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT select ARCH_STACKWALK
arch/riscv/kernel/acpi.c +85 -2
101 lines not on this page · raw message
Signature · 1 line
2.39.2
Sunil V L
maintainerPATCH v4 2/4 RISC-V: ACPI: Update the return value of acpi_get_rhct()
In reply to Sunil V Lacpi_get_rhct() currently returns pointer to acpi_table_header structure. But since this is specific to RHCT, return pointer to acpi_table_rhct structure itself.
--- drivers/acpi/riscv/rhct.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/riscv/rhct.c +3 -3
@@ -9,7 +9,7 @@#include <linux/acpi.h> -static struct acpi_table_header *acpi_get_rhct (void ) +static struct acpi_table_rhct *acpi_get_rhct (void ) {static struct acpi_table_header *rhct;acpi_status status;
@@ -26,7 +26,7 @@ static struct acpi_table_header *acpi_get_rhct(void) } } -return rhct; +return (struct acpi_table_rhct *)rhct; }/*
@@ -48,7 +48,7 @@ int acpi_get_riscv_isa(struct acpi_table_header *table, unsigned int cpu, constBUG_ON (acpi_disabled);if (!table) { - rhct = (struct acpi_table_rhct *)acpi_get_rhct (); + rhct =acpi_get_rhct ();if (!rhct)return -ENOENT ; }else {
Signature · 1 line
2.39.2
Sunil V L
maintainerPATCH v4 3/4 RISC-V: ACPI: RHCT: Add function to get CBO block sizes
In reply to Sunil V LCache Block Operation (CBO) related block size in ACPI is provided by RHCT. Add support to read the CMO node in RHCT to get this information.
--- arch/riscv/include/asm/acpi.h | 6 +++ drivers/acpi/riscv/rhct.c | 87 +++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+)
arch/riscv/include/asm/acpi.h +6 -0
@@ -66,6 +66,8 @@ 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 ; } +void acpi_get_cbo_block_size (struct acpi_table_header *table,u32 *cbom_size, +u32 *cboz_size,u32 *cbop_size);#else static inline void acpi_init_rintc_map (void ) { }static inline struct acpi_madt_rintc *acpi_cpu_get_madt_rintc (int cpu)
@@ -79,6 +81,10 @@ static inline int acpi_get_riscv_isa(struct acpi_table_header *table,return -EINVAL ; } +static inline void acpi_get_cbo_block_size (struct acpi_table_header *table, +u32 *cbom_size,u32 *cboz_size, +u32 *cbop_size) { } +#endif /* CONFIG_ACPI */ #endif /*_ASM_ACPI_H*/
drivers/acpi/riscv/rhct.c +87 -0
96 lines not on this page · raw message
Signature · 1 line
2.39.2
Sunil V L
maintainerPATCH v4 4/4 RISC-V: cacheflush: Initialize CBO variables on ACPI systems
In reply to Sunil V LInitialize the CBO variables on ACPI based systems using information in RHCT.
--- arch/riscv/mm/cacheflush.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
arch/riscv/mm/cacheflush.c +19 -6
@@ -3,7 +3,9 @@* Copyright (C) 2017 SiFive */ +#include <linux/acpi.h> #include <linux/of.h> +#include <asm/acpi.h> #include <asm/cacheflush.h> #ifdef CONFIG_SMP
@@ -124,13 +126,24 @@ void __init riscv_init_cbo_blocksizes(void)unsigned long cbom_hartid, cboz_hartid;u32 cbom_block_size =0 , cboz_block_size =0 ;struct device_node *node; +struct acpi_table_header *rhct; +acpi_status status; + +if (acpi_disabled) { +for_each_of_cpu_node (node) { +/* set block-size for cbom and/or cboz extension if available */ +cbo_get_block_size (node,"riscv,cbom-block-size" , + &cbom_block_size, &cbom_hartid); +cbo_get_block_size (node,"riscv,cboz-block-size" , + &cboz_block_size, &cboz_hartid); + } + }else { + status =acpi_get_table (ACPI_SIG_RHCT ,0 , &rhct); +if (ACPI_FAILURE (status)) +return ; -for_each_of_cpu_node (node) { -/* set block-size for cbom and/or cboz extension if available */ -cbo_get_block_size (node,"riscv,cbom-block-size" , - &cbom_block_size, &cbom_hartid); -cbo_get_block_size (node,"riscv,cboz-block-size" , - &cboz_block_size, &cboz_hartid); +acpi_get_cbo_block_size (rhct, &cbom_block_size, &cboz_block_size,NULL ); +acpi_put_table ((struct acpi_table_header *)rhct); }if (cbom_block_size)
Signature · 1 line
2.39.2
Re: [PATCH v4 -next 2/4] RISC-V: ACPI: Update the return value of acpi_get_rhct()
In reply to Sunil V LQuoted 44 lines · Sunil V L
acpi_get_rhct()currently returns pointer toacpi_table_headerstructure. But since this is specific to RHCT, return pointer toacpi_table_rhctstructure itself.Suggested-by Andrew Jones <[email protected]>Signed-off-by Sunil V L <[email protected]>--- drivers/acpi/riscv/rhct.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/acpi/riscv/rhct.c +3
-3@@ -9,7 +9,7 @@#include <linux/acpi.h> -static struct acpi_table_header *acpi_get_rhct (void ) +static struct acpi_table_rhct *acpi_get_rhct (void ) {static struct acpi_table_header *rhct;acpi_status status;@@ -26,7 +26,7 @@ static struct acpi_table_header *acpi_get_rhct(void) } } -return rhct; +return (struct acpi_table_rhct *)rhct; }/* @@ -48,7 +48,7 @@ int acpi_get_riscv_isa(struct acpi_table_header *table, unsigned int cpu, constBUG_ON (acpi_disabled);if (!table) { - rhct = (struct acpi_table_rhct *)acpi_get_rhct (); + rhct =acpi_get_rhct ();if (!rhct)return -ENOENT ; }else {Signature · 1 line
2.39.2
This series was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:
Hello:
This series was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:
Quoted 9 lines · On Wed, 18 Oct 2023 18:10:03 +0530 you wrote:
This series is a set of patches which were originally part of RFC v1 series
[1] to add ACPI support in RISC-V interrupt controllers. Since these patches are independent of the interrupt controllers, creating this new series which helps to merge instead of waiting for big series.This set of patches primarily adds support below ECR [2] which is approved by the ASWG and adds below features.
[...]
Here is the summary with links:
- [v4,-next,1/4] RISC-V: ACPI: Enhance acpi_os_ioremap with MMIO remapping
https://git.kernel.org/riscv/c/e8065df5b0c4 - [v4,-next,2/4] RISC-V: ACPI: Update the return value of acpi_get_rhct() https://git.kernel.org/riscv/c/a06835227280 - [v4,-next,3/4] RISC-V: ACPI: RHCT: Add function to get CBO block sizes https://git.kernel.org/riscv/c/9ca87564190c - [v4,-next,4/4] RISC-V: cacheflush: Initialize CBO variables on ACPI systems https://git.kernel.org/riscv/c/2960f371f165
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html