qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/1] hw/riscv/virt.c: check for 'ssaia' with KVM AIA


From: Daniel Henrique Barboza
Subject: [PATCH 1/1] hw/riscv/virt.c: check for 'ssaia' with KVM AIA
Date: Fri, 16 Jun 2023 14:21:41 -0300

KVM AIA relies on ext_ssaia support present in the host. At this moment
we're not checking. A KVM guest is doomed to hung if we use any 'aia'
option, aside from 'aia=none', and KVM does not support 'ssaia'.

Add a check for it. The placement is intentional: we need to check
before riscv_imsic_realize(), where the TCG logic can force
cpu->cfg.ext_ssaia to be 'true' and overwrite what KVM set before.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
---
 hw/riscv/virt.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index f025a0fcaf..c192059186 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -1409,6 +1409,18 @@ static void virt_machine_init(MachineState *machine)
                     RISCV_ACLINT_DEFAULT_MTIMECMP, RISCV_ACLINT_DEFAULT_MTIME,
                     RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ, true);
             }
+        } else {
+            /*
+             * With KVM enabled, check if the user wants to use AIA
+             * and we have the proper support for it.
+             */
+            RISCVCPU *cpu = &s->soc[i].harts[0];
+
+            if (s->aia_type != VIRT_AIA_TYPE_NONE && !cpu->cfg.ext_ssaia) {
+                error_report("Unable to set AIA: host does not "
+                             "have extension 'ssaia' enabled");
+                exit(1);
+            }
         }
 
         /* Per-socket interrupt controller */
-- 
2.40.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]