Skip to content

Commit 2960f37

Browse files
vlsunilpalmer-dabbelt
authored andcommitted
RISC-V: cacheflush: Initialize CBO variables on ACPI systems
Initialize the CBO variables on ACPI based systems using information in RHCT. Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Samuel Holland <samuel.holland@sifive.com> Link: https://lore.kernel.org/r/20231018124007.1306159-5-sunilvl@ventanamicro.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 9ca8756 commit 2960f37

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

arch/riscv/mm/cacheflush.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
* Copyright (C) 2017 SiFive
44
*/
55

6+
#include <linux/acpi.h>
67
#include <linux/of.h>
8+
#include <asm/acpi.h>
79
#include <asm/cacheflush.h>
810

911
#ifdef CONFIG_SMP
@@ -124,13 +126,24 @@ void __init riscv_init_cbo_blocksizes(void)
124126
unsigned long cbom_hartid, cboz_hartid;
125127
u32 cbom_block_size = 0, cboz_block_size = 0;
126128
struct device_node *node;
129+
struct acpi_table_header *rhct;
130+
acpi_status status;
131+
132+
if (acpi_disabled) {
133+
for_each_of_cpu_node(node) {
134+
/* set block-size for cbom and/or cboz extension if available */
135+
cbo_get_block_size(node, "riscv,cbom-block-size",
136+
&cbom_block_size, &cbom_hartid);
137+
cbo_get_block_size(node, "riscv,cboz-block-size",
138+
&cboz_block_size, &cboz_hartid);
139+
}
140+
} else {
141+
status = acpi_get_table(ACPI_SIG_RHCT, 0, &rhct);
142+
if (ACPI_FAILURE(status))
143+
return;
127144

128-
for_each_of_cpu_node(node) {
129-
/* set block-size for cbom and/or cboz extension if available */
130-
cbo_get_block_size(node, "riscv,cbom-block-size",
131-
&cbom_block_size, &cbom_hartid);
132-
cbo_get_block_size(node, "riscv,cboz-block-size",
133-
&cboz_block_size, &cboz_hartid);
145+
acpi_get_cbo_block_size(rhct, &cbom_block_size, &cboz_block_size, NULL);
146+
acpi_put_table((struct acpi_table_header *)rhct);
134147
}
135148

136149
if (cbom_block_size)

0 commit comments

Comments
 (0)