qemu-riscv
[Top][All Lists]
Advanced

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

Re: [PATCH 1/8] hw/intc/riscv_aplic: rename is_kvm_aia()


From: Alistair Francis
Subject: Re: [PATCH 1/8] hw/intc/riscv_aplic: rename is_kvm_aia()
Date: Mon, 18 Nov 2024 11:31:03 +1000

On Fri, Oct 11, 2024 at 5:05 AM Daniel Henrique Barboza
<dbarboza@ventanamicro.com> wrote:
>
> The helper is_kvm_aia() is checking not only for AIA, but for
> aplic-imsic (i.e. "aia=aplic-imsic" in 'virt' RISC-V machine) with an
> in-kernel chip present.
>
> Rename it to be a bit clear what the helper is doing since we'll add
> more AIA helpers in the next patches.
>
> Make the helper public because the 'virt' machine will use it as well.
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>

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

Alistair

> ---
>  hw/intc/riscv_aplic.c         | 8 ++++----
>  include/hw/intc/riscv_aplic.h | 1 +
>  2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c
> index 4a262c82f0..20de8c63a2 100644
> --- a/hw/intc/riscv_aplic.c
> +++ b/hw/intc/riscv_aplic.c
> @@ -154,7 +154,7 @@
>   * KVM AIA only supports APLIC MSI, fallback to QEMU emulation if we want to 
> use
>   * APLIC Wired.
>   */
> -static bool is_kvm_aia(bool msimode)
> +bool riscv_is_kvm_aia_aplic_imsic(bool msimode)
>  {
>      return kvm_irqchip_in_kernel() && msimode;
>  }
> @@ -853,7 +853,7 @@ static void riscv_aplic_realize(DeviceState *dev, Error 
> **errp)
>      uint32_t i;
>      RISCVAPLICState *aplic = RISCV_APLIC(dev);
>
> -    if (!is_kvm_aia(aplic->msimode)) {
> +    if (!riscv_is_kvm_aia_aplic_imsic(aplic->msimode)) {
>          aplic->bitfield_words = (aplic->num_irqs + 31) >> 5;
>          aplic->sourcecfg = g_new0(uint32_t, aplic->num_irqs);
>          aplic->state = g_new0(uint32_t, aplic->num_irqs);
> @@ -877,7 +877,7 @@ static void riscv_aplic_realize(DeviceState *dev, Error 
> **errp)
>       * have IRQ lines delegated by their parent APLIC.
>       */
>      if (!aplic->parent) {
> -        if (kvm_enabled() && is_kvm_aia(aplic->msimode)) {
> +        if (kvm_enabled() && riscv_is_kvm_aia_aplic_imsic(aplic->msimode)) {
>              qdev_init_gpio_in(dev, riscv_kvm_aplic_request, aplic->num_irqs);
>          } else {
>              qdev_init_gpio_in(dev, riscv_aplic_request, aplic->num_irqs);
> @@ -1021,7 +1021,7 @@ DeviceState *riscv_aplic_create(hwaddr addr, hwaddr 
> size,
>
>      sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
>
> -    if (!is_kvm_aia(msimode)) {
> +    if (!riscv_is_kvm_aia_aplic_imsic(msimode)) {
>          sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, addr);
>      }
>
> diff --git a/include/hw/intc/riscv_aplic.h b/include/hw/intc/riscv_aplic.h
> index de8532fbc3..fd0e6427d9 100644
> --- a/include/hw/intc/riscv_aplic.h
> +++ b/include/hw/intc/riscv_aplic.h
> @@ -71,6 +71,7 @@ struct RISCVAPLICState {
>  };
>
>  void riscv_aplic_add_child(DeviceState *parent, DeviceState *child);
> +bool riscv_is_kvm_aia_aplic_imsic(bool msimode);
>
>  DeviceState *riscv_aplic_create(hwaddr addr, hwaddr size,
>      uint32_t hartid_base, uint32_t num_harts, uint32_t num_sources,
> --
> 2.45.2
>
>



reply via email to

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