qemu-riscv
[Top][All Lists]
Advanced

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

Re: [PATCH 2/8] hw/riscv/virt.c: reduce virt_use_kvm_aia() usage


From: Alistair Francis
Subject: Re: [PATCH 2/8] hw/riscv/virt.c: reduce virt_use_kvm_aia() usage
Date: Mon, 18 Nov 2024 11:31:48 +1000

On Fri, Oct 11, 2024 at 5:04 AM Daniel Henrique Barboza
<dbarboza@ventanamicro.com> wrote:
>
> In create_fdt_sockets() we have the following pattern:
>
>     if (kvm_enabled() && virt_use_kvm_aia(s)) {
>         (... do stuff ...)
>     } else {
>         (... do other stuff ...)
>     }
>     if (kvm_enabled() && virt_use_kvm_aia(s)) {
>         (... do more stuff ...)
>     } else {
>         (... do more other stuff)
>     }
>
> Do everything in a single if/else clause to reduce the usage of
> virt_use_kvm_aia() helper and to make the code a bit less repetitive.
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>

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

Alistair

> ---
>  hw/riscv/virt.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index ee3129f3b3..b5bdbb34e0 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -780,6 +780,10 @@ static void create_fdt_sockets(RISCVVirtState *s, const 
> MemMapEntry *memmap,
>                                  msi_m_phandle, msi_s_phandle, phandle,
>                                  &intc_phandles[0], xplic_phandles,
>                                  ms->smp.cpus);
> +
> +        *irq_mmio_phandle = xplic_phandles[0];
> +        *irq_virtio_phandle = xplic_phandles[0];
> +        *irq_pcie_phandle = xplic_phandles[0];
>      } else {
>          phandle_pos = ms->smp.cpus;
>          for (socket = (socket_count - 1); socket >= 0; socket--) {
> @@ -797,13 +801,7 @@ static void create_fdt_sockets(RISCVVirtState *s, const 
> MemMapEntry *memmap,
>                                          s->soc[socket].num_harts);
>              }
>          }
> -    }
>
> -    if (kvm_enabled() && virt_use_kvm_aia(s)) {
> -        *irq_mmio_phandle = xplic_phandles[0];
> -        *irq_virtio_phandle = xplic_phandles[0];
> -        *irq_pcie_phandle = xplic_phandles[0];
> -    } else {
>          for (socket = 0; socket < socket_count; socket++) {
>              if (socket == 0) {
>                  *irq_mmio_phandle = xplic_phandles[socket];
> --
> 2.45.2
>
>



reply via email to

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