qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-8.1 0/1] hw/riscv/virt.c: fix 'aclint' prop regression
@ 2023-08-11 16:02 Daniel Henrique Barboza
  2023-08-11 16:02 ` [PATCH for-8.1 1/1] hw/riscv/virt.c: change 'aclint' TCG check Daniel Henrique Barboza
  2023-08-11 18:12 ` [PATCH for-8.1 0/1] hw/riscv/virt.c: fix 'aclint' prop regression Alistair Francis
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Henrique Barboza @ 2023-08-11 16:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-riscv, alistair.francis, bmeng, liweiwei, zhiwei_liu, palmer,
	philmd, richard.henderson, Daniel Henrique Barboza

Richard, Alistair,

I came across this gitlab bug earlier today. The bug itself was opened
yesterday:

https://gitlab.com/qemu-project/qemu/-/issues/1823

And turns out that this is a regression in the 'aclint' option that was
introduced in 8.1.

I'm aware that we're already in rc3 and kind of late, but even so I
marked this patch as 8.1 to let you decide whether it's worth spinning
rc4 or not.

Daniel Henrique Barboza (1):
  hw/riscv/virt.c: change 'aclint' TCG check

 hw/riscv/virt.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

-- 
2.41.0



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH for-8.1 1/1] hw/riscv/virt.c: change 'aclint' TCG check
  2023-08-11 16:02 [PATCH for-8.1 0/1] hw/riscv/virt.c: fix 'aclint' prop regression Daniel Henrique Barboza
@ 2023-08-11 16:02 ` Daniel Henrique Barboza
  2023-08-11 17:31   ` Philippe Mathieu-Daudé
  2023-08-11 18:07   ` Alistair Francis
  2023-08-11 18:12 ` [PATCH for-8.1 0/1] hw/riscv/virt.c: fix 'aclint' prop regression Alistair Francis
  1 sibling, 2 replies; 5+ messages in thread
From: Daniel Henrique Barboza @ 2023-08-11 16:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-riscv, alistair.francis, bmeng, liweiwei, zhiwei_liu, palmer,
	philmd, richard.henderson, Daniel Henrique Barboza

The 'aclint' property is being conditioned with tcg acceleration in
virt_machine_class_init(). But acceleration code starts later than the
class init of the board, meaning that tcg_enabled() will be always be
false during class_init(), and the option is never being declared even
when declaring TCG accel:

$ ./build/qemu-system-riscv64 -M virt,accel=tcg,aclint=on
qemu-system-riscv64: Property 'virt-machine.aclint' not found

Fix it by moving the check from class_init() to machine_init(). Tune the
description to mention that the option is TCG only.

Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
Fixes: c0716c81b ("hw/riscv/virt: Restrict ACLINT to TCG")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1823
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
---
 hw/riscv/virt.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index d90286dc46..99c4e6314b 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -1350,6 +1350,11 @@ static void virt_machine_init(MachineState *machine)
         exit(1);
     }
 
+    if (!tcg_enabled() && s->have_aclint) {
+        error_report("'aclint' is only available with TCG acceleration");
+        exit(1);
+    }
+
     /* Initialize sockets */
     mmio_irqchip = virtio_irqchip = pcie_irqchip = NULL;
     for (i = 0; i < socket_count; i++) {
@@ -1683,13 +1688,14 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
     machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
 #endif
 
-    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_bool(oc, "aclint", virt_get_aclint,
+                                   virt_set_aclint);
+    object_class_property_set_description(oc, "aclint",
+                                          "(TCG only) 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.41.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH for-8.1 1/1] hw/riscv/virt.c: change 'aclint' TCG check
  2023-08-11 16:02 ` [PATCH for-8.1 1/1] hw/riscv/virt.c: change 'aclint' TCG check Daniel Henrique Barboza
@ 2023-08-11 17:31   ` Philippe Mathieu-Daudé
  2023-08-11 18:07   ` Alistair Francis
  1 sibling, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-08-11 17:31 UTC (permalink / raw)
  To: Daniel Henrique Barboza, qemu-devel
  Cc: qemu-riscv, alistair.francis, bmeng, liweiwei, zhiwei_liu, palmer,
	richard.henderson

On 11/8/23 18:02, Daniel Henrique Barboza wrote:
> The 'aclint' property is being conditioned with tcg acceleration in
> virt_machine_class_init(). But acceleration code starts later than the
> class init of the board, meaning that tcg_enabled() will be always be
> false during class_init(), and the option is never being declared even
> when declaring TCG accel:
> 
> $ ./build/qemu-system-riscv64 -M virt,accel=tcg,aclint=on
> qemu-system-riscv64: Property 'virt-machine.aclint' not found
> 
> Fix it by moving the check from class_init() to machine_init(). Tune the
> description to mention that the option is TCG only.
> 
> Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
> Fixes: c0716c81b ("hw/riscv/virt: Restrict ACLINT to TCG")
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1823
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> ---
>   hw/riscv/virt.c | 20 +++++++++++++-------
>   1 file changed, 13 insertions(+), 7 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH for-8.1 1/1] hw/riscv/virt.c: change 'aclint' TCG check
  2023-08-11 16:02 ` [PATCH for-8.1 1/1] hw/riscv/virt.c: change 'aclint' TCG check Daniel Henrique Barboza
  2023-08-11 17:31   ` Philippe Mathieu-Daudé
@ 2023-08-11 18:07   ` Alistair Francis
  1 sibling, 0 replies; 5+ messages in thread
From: Alistair Francis @ 2023-08-11 18:07 UTC (permalink / raw)
  To: Daniel Henrique Barboza
  Cc: qemu-devel, qemu-riscv, alistair.francis, bmeng, liweiwei,
	zhiwei_liu, palmer, philmd, richard.henderson

On Fri, Aug 11, 2023 at 12:03 PM Daniel Henrique Barboza
<dbarboza@ventanamicro.com> wrote:
>
> The 'aclint' property is being conditioned with tcg acceleration in
> virt_machine_class_init(). But acceleration code starts later than the
> class init of the board, meaning that tcg_enabled() will be always be
> false during class_init(), and the option is never being declared even
> when declaring TCG accel:
>
> $ ./build/qemu-system-riscv64 -M virt,accel=tcg,aclint=on
> qemu-system-riscv64: Property 'virt-machine.aclint' not found
>
> Fix it by moving the check from class_init() to machine_init(). Tune the
> description to mention that the option is TCG only.
>
> Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
> Fixes: c0716c81b ("hw/riscv/virt: Restrict ACLINT to TCG")
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1823
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/riscv/virt.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index d90286dc46..99c4e6314b 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -1350,6 +1350,11 @@ static void virt_machine_init(MachineState *machine)
>          exit(1);
>      }
>
> +    if (!tcg_enabled() && s->have_aclint) {
> +        error_report("'aclint' is only available with TCG acceleration");
> +        exit(1);
> +    }
> +
>      /* Initialize sockets */
>      mmio_irqchip = virtio_irqchip = pcie_irqchip = NULL;
>      for (i = 0; i < socket_count; i++) {
> @@ -1683,13 +1688,14 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
>      machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
>  #endif
>
> -    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_bool(oc, "aclint", virt_get_aclint,
> +                                   virt_set_aclint);
> +    object_class_property_set_description(oc, "aclint",
> +                                          "(TCG only) 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.41.0
>
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH for-8.1 0/1] hw/riscv/virt.c: fix 'aclint' prop regression
  2023-08-11 16:02 [PATCH for-8.1 0/1] hw/riscv/virt.c: fix 'aclint' prop regression Daniel Henrique Barboza
  2023-08-11 16:02 ` [PATCH for-8.1 1/1] hw/riscv/virt.c: change 'aclint' TCG check Daniel Henrique Barboza
@ 2023-08-11 18:12 ` Alistair Francis
  1 sibling, 0 replies; 5+ messages in thread
From: Alistair Francis @ 2023-08-11 18:12 UTC (permalink / raw)
  To: Daniel Henrique Barboza
  Cc: qemu-devel, qemu-riscv, alistair.francis, bmeng, liweiwei,
	zhiwei_liu, palmer, philmd, richard.henderson

On Fri, Aug 11, 2023 at 12:03 PM Daniel Henrique Barboza
<dbarboza@ventanamicro.com> wrote:
>
> Richard, Alistair,
>
> I came across this gitlab bug earlier today. The bug itself was opened
> yesterday:
>
> https://gitlab.com/qemu-project/qemu/-/issues/1823
>
> And turns out that this is a regression in the 'aclint' option that was
> introduced in 8.1.
>
> I'm aware that we're already in rc3 and kind of late, but even so I
> marked this patch as 8.1 to let you decide whether it's worth spinning
> rc4 or not.

Urgh! What a pain!

I'll fire off a PR now as this is worth fixing

Alistair

>
> Daniel Henrique Barboza (1):
>   hw/riscv/virt.c: change 'aclint' TCG check
>
>  hw/riscv/virt.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
>
> --
> 2.41.0
>
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-11 18:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-11 16:02 [PATCH for-8.1 0/1] hw/riscv/virt.c: fix 'aclint' prop regression Daniel Henrique Barboza
2023-08-11 16:02 ` [PATCH for-8.1 1/1] hw/riscv/virt.c: change 'aclint' TCG check Daniel Henrique Barboza
2023-08-11 17:31   ` Philippe Mathieu-Daudé
2023-08-11 18:07   ` Alistair Francis
2023-08-11 18:12 ` [PATCH for-8.1 0/1] hw/riscv/virt.c: fix 'aclint' prop regression Alistair Francis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).