[RFC PATCH 07/19] accel/hvf: Re-use QOM allocated state

Philippe Mathieu-Daudé posted 19 patches 5 months, 1 week ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Cameron Esfahani <dirty@apple.com>, Roman Bolshakov <rbolshakov@ddn.com>, Phil Dennis-Jordan <phil@philjordan.eu>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>, Stefano Stabellini <sstabellini@kernel.org>, Anthony PERARD <anthony@xenproject.org>, Paul Durrant <paul@xen.org>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>, Peter Maydell <peter.maydell@linaro.org>, Reinoud Zandijk <reinoud@netbsd.org>, Sunil Muthuswamy <sunilmut@microsoft.com>
There is a newer version of this series
[RFC PATCH 07/19] accel/hvf: Re-use QOM allocated state
Posted by Philippe Mathieu-Daudé 5 months, 1 week ago
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 accel/hvf/hvf-accel-ops.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
index 808ecea3816..f4a983d1328 100644
--- a/accel/hvf/hvf-accel-ops.c
+++ b/accel/hvf/hvf-accel-ops.c
@@ -319,7 +319,7 @@ static int hvf_accel_init(MachineState *ms, AccelState *as)
 {
     int x;
     hv_return_t ret;
-    HVFState *s;
+    HVFState *s = HVF_STATE(as);
     int pa_range = 36;
     MachineClass *mc = MACHINE_GET_CLASS(ms);
 
@@ -333,8 +333,6 @@ static int hvf_accel_init(MachineState *ms, AccelState *as)
     ret = hvf_arch_vm_create(ms, (uint32_t)pa_range);
     assert_hvf_ok(ret);
 
-    s = g_new0(HVFState, 1);
-
     s->num_slots = ARRAY_SIZE(s->slots);
     for (x = 0; x < s->num_slots; ++x) {
         s->slots[x].size = 0;
-- 
2.49.0


Re: [RFC PATCH 07/19] accel/hvf: Re-use QOM allocated state
Posted by Richard Henderson 5 months, 1 week ago
On 6/6/25 17:44, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   accel/hvf/hvf-accel-ops.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
> index 808ecea3816..f4a983d1328 100644
> --- a/accel/hvf/hvf-accel-ops.c
> +++ b/accel/hvf/hvf-accel-ops.c
> @@ -319,7 +319,7 @@ static int hvf_accel_init(MachineState *ms, AccelState *as)
>   {
>       int x;
>       hv_return_t ret;
> -    HVFState *s;
> +    HVFState *s = HVF_STATE(as);
>       int pa_range = 36;
>       MachineClass *mc = MACHINE_GET_CLASS(ms);
>   
> @@ -333,8 +333,6 @@ static int hvf_accel_init(MachineState *ms, AccelState *as)
>       ret = hvf_arch_vm_create(ms, (uint32_t)pa_range);
>       assert_hvf_ok(ret);
>   
> -    s = g_new0(HVFState, 1);
> -
>       s->num_slots = ARRAY_SIZE(s->slots);
>       for (x = 0; x < s->num_slots; ++x) {
>           s->slots[x].size = 0;

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~