Skip to contentSkip to conversation

hw/riscv/virt: Restrict ACLINT to TCG

PATCH Applied Philippe Mathieu-Daudé 3 participants 8 messages Jun 29, 2023 – Jul 3, 2023 RISC-V

lore
Share & tools
lore
#0 lore raw

cover hw/riscv/virt: Restrict ACLINT to TCG

Do not assume !KVM == TCG, restrict ACLINT to TCG.

Philippe Mathieu-Daudé (2):
hw/riscv/virt: Fix 'controller' typo
hw/riscv/virt: Restrict ACLINT to TCG

 docs/system/riscv/virt.rst |  1 +
 hw/riscv/virt.c            | 20 +++++++++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)
Signature · 1 line
2.38.1
#1 lore raw

PATCH 1/2 hw/riscv/virt: Fix 'controller' typo

---
 hw/riscv/virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/riscv/virt.c +1 -1
index ed4c27487e..68ccd0bde1 100644
@@ -1692,7 +1692,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
                                   virt_set_aia);
     object_class_property_set_description(oc, "aia",
                                           "Set type of AIA interrupt "
-                                          "conttoller. Valid values are "
+                                          "controller. Valid values are "
                                           "none, aplic, and aplic-imsic.");
 
     object_class_property_add_str(oc, "aia-guests",
Signature · 1 line
2.38.1
#2 lore raw

Re: [PATCH 1/2] hw/riscv/virt: Fix 'controller' typo

Phil,

I've fixed this typo a few weeks ago. qemu-trivial picked it up.

Thanks,

Daniel

Quoted 18 lines · Philippe Mathieu-Daudé
---
  hw/riscv/virt.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/riscv/virt.c +1 -1
index ed4c27487e..68ccd0bde1 100644
@@ -1692,7 +1692,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
                                    virt_set_aia);
      object_class_property_set_description(oc, "aia",
                                            "Set type of AIA interrupt "
-                                          "conttoller. Valid values are "
+                                          "controller. Valid values are "
                                            "none, aplic, and aplic-imsic.");
 
      object_class_property_add_str(oc, "aia-guests",
#3 lore raw

Re: [PATCH 1/2] hw/riscv/virt: Fix 'controller' typo

Quoted 3 lines · Daniel Henrique Barboza

Phil,

I've fixed this typo a few weeks ago. qemu-trivial picked it up.

Ah great, thanks :)

Quoted 25 lines

Thanks,

Daniel

Quoted 20 lines · Philippe Mathieu-Daudé

---
  hw/riscv/virt.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
hw/riscv/virt.c +0 -0
index ed4c27487e..68ccd0bde1 100644
@@ -1692,7 +1692,7 @@ static void virt_machine_class_init(ObjectClass 
 *oc, void *data)
                                     virt_set_aia);
       object_class_property_set_description(oc, "aia",

                                            "Set type of AIA interrupt " -                                          "conttoller. Valid values are "
+                                          "controller. Valid values are "
                                            "none, aplic, and aplic-imsic."); object_class_property_add_str(oc, "aia-guests",

#4 lore raw

PATCH 2/2 hw/riscv/virt: Restrict ACLINT to TCG

In reply to Philippe Mathieu-Daudé

The Advanced Core Local Interruptor (ACLINT) device can only be used with TCG. Check for TCG enabled instead of KVM being not. Only add the property when TCG is used.

---
 docs/system/riscv/virt.rst |  1 +
 hw/riscv/virt.c            | 18 ++++++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)
docs/system/riscv/virt.rst +1 -0
index b33f45e5b3..f9a2eac544 100644
@@ -93,6 +93,7 @@ The following machine-specific options are supported:
 
   When this option is "on", ACLINT devices will be emulated instead of
   SiFive CLINT. When not specified, this option is assumed to be "off".
+  This option is restricted to the TCG accelerator.
 
 - aia=[none|aplic|aplic-imsic]
 
hw/riscv/virt.c +10 -8
index 68ccd0bde1..cdb88a1529 100644
@@ -44,6 +44,7 @@
 #include "chardev/char.h"
 #include "sysemu/device_tree.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/tcg.h"
 #include "sysemu/kvm.h"
 #include "sysemu/tpm.h"
 #include "hw/pci/pci.h"
@@ -776,7 +777,7 @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap,
 
         g_free(clust_name);
 
-        if (!kvm_enabled()) {
+        if (tcg_enabled()) {
             if (s->have_aclint) {
                 create_fdt_socket_aclint(s, memmap, socket,
                     &intc_phandles[phandle_pos]);
@@ -1370,7 +1371,7 @@ static void virt_machine_init(MachineState *machine)
                                 hart_count, &error_abort);
         sysbus_realize(SYS_BUS_DEVICE(&s->soc[i]), &error_fatal);
 
-        if (!kvm_enabled()) {
+        if (tcg_enabled()) {
             if (s->have_aclint) {
                 if (s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC) {
                     /* Per-socket ACLINT MTIMER */
@@ -1682,12 +1683,13 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
     machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
 #endif
 
-    object_class_property_add_bool(oc, "aclint", virt_get_aclint,
-                                   virt_set_aclint);
-    object_class_property_set_description(oc, "aclint",
-                                          "Set on/off to enable/disable "
-                                          "emulating ACLINT devices");
-
+    if (tcg_enabled()) {
+        object_class_property_add_bool(oc, "aclint", virt_get_aclint,
+                                       virt_set_aclint);
+        object_class_property_set_description(oc, "aclint",
+                                              "Set on/off to enable/disable "
+                                              "emulating ACLINT devices");
+    }
     object_class_property_add_str(oc, "aia", virt_get_aia,
                                   virt_set_aia);
     object_class_property_set_description(oc, "aia",
Signature · 1 line
2.38.1
Reviewed-by on v1 2/2
#5 lore raw
Quoted 6 lines · Philippe Mathieu-Daudé

The Advanced Core Local Interruptor (ACLINT) device can only be used with TCG. Check for TCG enabled instead of KVM being not. Only add the property when TCG is used.

---

Quoted 66 lines
  docs/system/riscv/virt.rst |  1 +
  hw/riscv/virt.c            | 18 ++++++++++--------
  2 files changed, 11 insertions(+), 8 deletions(-)
docs/system/riscv/virt.rst +1 -0
index b33f45e5b3..f9a2eac544 100644
@@ -93,6 +93,7 @@ The following machine-specific options are supported:
 
    When this option is "on", ACLINT devices will be emulated instead of
    SiFive CLINT. When not specified, this option is assumed to be "off".
+  This option is restricted to the TCG accelerator.
 
  - aia=[none|aplic|aplic-imsic]
 
hw/riscv/virt.c +10 -8
index 68ccd0bde1..cdb88a1529 100644
@@ -44,6 +44,7 @@
  #include "chardev/char.h"
  #include "sysemu/device_tree.h"
  #include "sysemu/sysemu.h"
+#include "sysemu/tcg.h"
  #include "sysemu/kvm.h"
  #include "sysemu/tpm.h"
  #include "hw/pci/pci.h"
@@ -776,7 +777,7 @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap,
 
          g_free(clust_name);
 
-        if (!kvm_enabled()) {
+        if (tcg_enabled()) {
              if (s->have_aclint) {
                  create_fdt_socket_aclint(s, memmap, socket,
                      &intc_phandles[phandle_pos]);
@@ -1370,7 +1371,7 @@ static void virt_machine_init(MachineState *machine)
                                  hart_count, &error_abort);
          sysbus_realize(SYS_BUS_DEVICE(&s->soc[i]), &error_fatal);
 
-        if (!kvm_enabled()) {
+        if (tcg_enabled()) {
              if (s->have_aclint) {
                  if (s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC) {
                      /* Per-socket ACLINT MTIMER */
@@ -1682,12 +1683,13 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
      machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
  #endif
 
-    object_class_property_add_bool(oc, "aclint", virt_get_aclint,
-                                   virt_set_aclint);
-    object_class_property_set_description(oc, "aclint",
-                                          "Set on/off to enable/disable "
-                                          "emulating ACLINT devices");
-
+    if (tcg_enabled()) {
+        object_class_property_add_bool(oc, "aclint", virt_get_aclint,
+                                       virt_set_aclint);
+        object_class_property_set_description(oc, "aclint",
+                                              "Set on/off to enable/disable "
+                                              "emulating ACLINT devices");
+    }
      object_class_property_add_str(oc, "aia", virt_get_aia,
                                    virt_set_aia);
      object_class_property_set_description(oc, "aia",
Reviewed-by on v1 2/2
#6 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé

The Advanced Core Local Interruptor (ACLINT) device can only be used with TCG. Check for TCG enabled instead of KVM being not. Only add the property when TCG is used.

Alistair

Quoted 71 lines
---
 docs/system/riscv/virt.rst |  1 +
 hw/riscv/virt.c            | 18 ++++++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)
docs/system/riscv/virt.rst +1 -0
index b33f45e5b3..f9a2eac544 100644
@@ -93,6 +93,7 @@ The following machine-specific options are supported:
 
   When this option is "on", ACLINT devices will be emulated instead of
   SiFive CLINT. When not specified, this option is assumed to be "off".
+  This option is restricted to the TCG accelerator.
 
 - aia=[none|aplic|aplic-imsic]
 
hw/riscv/virt.c +10 -9
index 68ccd0bde1..cdb88a1529 100644
@@ -44,6 +44,7 @@
 #include "chardev/char.h"
 #include "sysemu/device_tree.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/tcg.h"
 #include "sysemu/kvm.h"
 #include "sysemu/tpm.h"
 #include "hw/pci/pci.h"
@@ -776,7 +777,7 @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap,
 
         g_free(clust_name);
 
-        if (!kvm_enabled()) {
+        if (tcg_enabled()) {
             if (s->have_aclint) {
                 create_fdt_socket_aclint(s, memmap, socket,
                     &intc_phandles[phandle_pos]);
@@ -1370,7 +1371,7 @@ static void virt_machine_init(MachineState *machine)
                                 hart_count, &error_abort);
         sysbus_realize(SYS_BUS_DEVICE(&s->soc[i]), &error_fatal);
 
-        if (!kvm_enabled()) {
+        if (tcg_enabled()) {
             if (s->have_aclint) {
                 if (s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC) {
                     /* Per-socket ACLINT MTIMER */
@@ -1682,12 +1683,13 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
     machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
 #endif
 
-    object_class_property_add_bool(oc, "aclint", virt_get_aclint,
-                                   virt_set_aclint);
-    object_class_property_set_description(oc, "aclint",
-                                          "Set on/off to enable/disable "
-                                          "emulating ACLINT devices");
-
+    if (tcg_enabled()) {
+        object_class_property_add_bool(oc, "aclint", virt_get_aclint,
+                                       virt_set_aclint);
+        object_class_property_set_description(oc, "aclint",
+                                              "Set on/off to enable/disable "
+                                              "emulating ACLINT devices");
+    }
     object_class_property_add_str(oc, "aia", virt_get_aia,
                                   virt_set_aia);
     object_class_property_set_description(oc, "aia",
--

2.38.1

#7 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé

The Advanced Core Local Interruptor (ACLINT) device can only be used with TCG. Check for TCG enabled instead of KVM being not. Only add the property when TCG is used.

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 71 lines
---
 docs/system/riscv/virt.rst |  1 +
 hw/riscv/virt.c            | 18 ++++++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)
docs/system/riscv/virt.rst +1 -0
index b33f45e5b3..f9a2eac544 100644
@@ -93,6 +93,7 @@ The following machine-specific options are supported:
 
   When this option is "on", ACLINT devices will be emulated instead of
   SiFive CLINT. When not specified, this option is assumed to be "off".
+  This option is restricted to the TCG accelerator.
 
 - aia=[none|aplic|aplic-imsic]
 
hw/riscv/virt.c +10 -9
index 68ccd0bde1..cdb88a1529 100644
@@ -44,6 +44,7 @@
 #include "chardev/char.h"
 #include "sysemu/device_tree.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/tcg.h"
 #include "sysemu/kvm.h"
 #include "sysemu/tpm.h"
 #include "hw/pci/pci.h"
@@ -776,7 +777,7 @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap,
 
         g_free(clust_name);
 
-        if (!kvm_enabled()) {
+        if (tcg_enabled()) {
             if (s->have_aclint) {
                 create_fdt_socket_aclint(s, memmap, socket,
                     &intc_phandles[phandle_pos]);
@@ -1370,7 +1371,7 @@ static void virt_machine_init(MachineState *machine)
                                 hart_count, &error_abort);
         sysbus_realize(SYS_BUS_DEVICE(&s->soc[i]), &error_fatal);
 
-        if (!kvm_enabled()) {
+        if (tcg_enabled()) {
             if (s->have_aclint) {
                 if (s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC) {
                     /* Per-socket ACLINT MTIMER */
@@ -1682,12 +1683,13 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
     machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
 #endif
 
-    object_class_property_add_bool(oc, "aclint", virt_get_aclint,
-                                   virt_set_aclint);
-    object_class_property_set_description(oc, "aclint",
-                                          "Set on/off to enable/disable "
-                                          "emulating ACLINT devices");
-
+    if (tcg_enabled()) {
+        object_class_property_add_bool(oc, "aclint", virt_get_aclint,
+                                       virt_set_aclint);
+        object_class_property_set_description(oc, "aclint",
+                                              "Set on/off to enable/disable "
+                                              "emulating ACLINT devices");
+    }
     object_class_property_add_str(oc, "aia", virt_get_aia,
                                   virt_set_aia);
     object_class_property_set_description(oc, "aia",
--

2.38.1