aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnup Patel <apatel@ventanamicro.com>2023-11-28 20:26:21 +0530
committerWill Deacon <will@kernel.org>2024-02-09 15:45:21 +0000
commit7887b3989ac22f362b755fa96f9e8318f4dc020e (patch)
treedafb4258d9fa89bad053023dcc0e8beaa9aa5efa
parentfcb076756ab2dae13684e89d3fc9ce551c3e2d38 (diff)
downloadkvmtool-7887b3989ac22f362b755fa96f9e8318f4dc020e.tar.gz
riscv: Make CPU_ISA_MAX_LEN depend upon isa_info_arr array size
Currently, the CPU_ISA_MAX_LEN is a fixed value so we will easily run out of space when all possible ISA extensions supported by KVM RISC-V are available. Instead of above, let us make CPU_ISA_MAX_LEN depend upon the isa_info_arr[] array size so that CPU_ISA_MAX_LEN automatically adapts to growing number of ISA extensions. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Link: https://lore.kernel.org/r/20231128145628.413414-4-apatel@ventanamicro.com Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r--riscv/fdt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/riscv/fdt.c b/riscv/fdt.c
index b45f7312..230d1f8e 100644
--- a/riscv/fdt.c
+++ b/riscv/fdt.c
@@ -44,7 +44,6 @@ static void dump_fdt(const char *dtb_file, void *fdt)
}
#define CPU_NAME_MAX_LEN 15
-#define CPU_ISA_MAX_LEN 128
static void generate_cpu_nodes(void *fdt, struct kvm *kvm)
{
int cpu, pos, i, index, valid_isa_len;
@@ -60,6 +59,7 @@ static void generate_cpu_nodes(void *fdt, struct kvm *kvm)
for (cpu = 0; cpu < kvm->nrcpus; ++cpu) {
char cpu_name[CPU_NAME_MAX_LEN];
+#define CPU_ISA_MAX_LEN (ARRAY_SIZE(isa_info_arr) * 16)
char cpu_isa[CPU_ISA_MAX_LEN];
struct kvm_cpu *vcpu = kvm->cpus[cpu];
struct kvm_one_reg reg;