All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Auger <eric.auger@linaro.org>
To: Pavel Fedin <p.fedin@samsung.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Shlomo Pongratz <shlomopongratz@gmail.com>,
	Christoffer Dall <christoffer.dall@linaro.org>,
	Shlomo Pongratz <shlomo.pongratz@huawei.com>
Subject: Re: [Qemu-devel] [PATCH v3 3/5] Introduce irqchip type specification for KVM
Date: Thu, 09 Jul 2015 18:07:22 +0200	[thread overview]
Message-ID: <559E9C3A.7040706@linaro.org> (raw)
In-Reply-To: <007472ace2e223adb752c3f9ba8b78eb19135e94.1436276959.git.p.fedin@samsung.com>

Hi Pavel,
On 07/07/2015 03:54 PM, Pavel Fedin wrote:
> This patch introduces kernel_irqchip_type member in Machine class, which
> it passed to kvm_arch_irqchip_create. It allows machine models to specify
s/it/is
> correct GIC type during KVM capability verification. The variable is
> defined as int in order to be architecture-agnostic for potential future
> uses by other architectures.
> 
> Just in case, the default value is set for absolutely all board models
> which include GIC in some form. I am not sure whether all these models can
> use KVM acceleration, but it definitely would not hurt.
To me this is misleading to set the interrupt control type to a wrong
value, if it is confirmed. A reader can get the impression this GIC
model is used by the virtual machine whereas it is not.

Besides we discussed this together before and you know I think we can
manage without this patch file by using kvm_create_device in trial mode
for v2 and v3 - but we did not agree on this -. Let's see what do the
other reviewers say ;-)
> 
> Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
> ---
>  hw/arm/exynos4_boards.c | 1 +
>  hw/arm/realview.c       | 1 +
>  hw/arm/vexpress.c       | 1 +
>  hw/arm/virt.c           | 3 +++
>  include/hw/boards.h     | 1 +
>  include/sysemu/kvm.h    | 3 ++-
>  kvm-all.c               | 6 ++++--
>  stubs/kvm.c             | 2 +-
>  target-arm/kvm.c        | 8 ++++++--
>  9 files changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c
> index d644db1..d4136bc 100644
> --- a/hw/arm/exynos4_boards.c
> +++ b/hw/arm/exynos4_boards.c
> @@ -104,6 +104,7 @@ static Exynos4210State *exynos4_boards_init_common(MachineState *machine,
>                  exynos4_machines[board_type].max_cpus);
>      }
>  
> +    machine->kernel_irqchip_type = KVM_DEV_TYPE_ARM_VGIC_V2;
>      exynos4_board_binfo.ram_size = exynos4_board_ram_size[board_type];
>      exynos4_board_binfo.board_id = exynos4_board_id[board_type];
>      exynos4_board_binfo.smp_bootreg_addr =
> diff --git a/hw/arm/realview.c b/hw/arm/realview.c
> index ef2788d..f670d9f 100644
> --- a/hw/arm/realview.c
> +++ b/hw/arm/realview.c
> @@ -74,6 +74,7 @@ static void realview_init(MachineState *machine,
>      ram_addr_t ram_size = machine->ram_size;
>      hwaddr periphbase = 0;
>  
> +    machine->kernel_irqchip_type = KVM_DEV_TYPE_ARM_VGIC_V2;
>      switch (board_type) {
>      case BOARD_EB:
>          break;
> diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
> index da21788..0675a00 100644
> --- a/hw/arm/vexpress.c
> +++ b/hw/arm/vexpress.c
> @@ -556,6 +556,7 @@ static void vexpress_common_init(MachineState *machine)
>      const hwaddr *map = daughterboard->motherboard_map;
>      int i;
>  
> +    machine->kernel_irqchip_type = KVM_DEV_TYPE_ARM_VGIC_V2;
>      daughterboard->init(vms, machine->ram_size, machine->cpu_model, pic);
>  
>      /*
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 4846892..2e7d858 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -945,6 +945,9 @@ static void virt_instance_init(Object *obj)
>                                      "Set on/off to enable/disable the ARM "
>                                      "Security Extensions (TrustZone)",
>                                      NULL);
> +
> +    /* Default GIC type is v2 */
> +    vms->parent.kernel_irqchip_type = KVM_DEV_TYPE_ARM_VGIC_V2;
>  }
>  
>  static void virt_class_init(ObjectClass *oc, void *data)
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index 6379901..6e42cf2 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -126,6 +126,7 @@ struct MachineState {
>      char *accel;
>      bool kernel_irqchip_allowed;
>      bool kernel_irqchip_required;
> +    int kernel_irqchip_type;
>      int kvm_shadow_mem;
>      char *dtb;
>      char *dumpdtb;
> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> index 983e99e..8f4d485 100644
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -434,6 +434,7 @@ void kvm_init_irq_routing(KVMState *s);
>  /**
>   * kvm_arch_irqchip_create:
>   * @KVMState: The KVMState pointer
> + * @type: irqchip type, architecture-specific
>   *
>   * Allow architectures to create an in-kernel irq chip themselves.
>   *
> @@ -441,7 +442,7 @@ void kvm_init_irq_routing(KVMState *s);
>   *            0: irq chip was not created
>   *          > 0: irq chip was created
>   */
> -int kvm_arch_irqchip_create(KVMState *s);
> +int kvm_arch_irqchip_create(KVMState *s, int type);
>  
>  /**
>   * kvm_set_one_reg - set a register value in KVM via KVM_SET_ONE_REG ioctl
> diff --git a/kvm-all.c b/kvm-all.c
> index 06e06f2..c103aad 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1395,8 +1395,10 @@ static void kvm_irqchip_create(MachineState *machine, KVMState *s)
>  
>      /* First probe and see if there's a arch-specific hook to create the
>       * in-kernel irqchip for us */
> -    ret = kvm_arch_irqchip_create(s);
> -    if (ret == 0) {
> +    ret = kvm_arch_irqchip_create(s, machine->kernel_irqchip_type);
> +    if (ret < 0) {
> +        return ret;
this fails to compile, kvm_irqchip_create being a function returning a void

Best Regards

Eric
> +    } else if (ret == 0) {
>          ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP);
>      }
>      if (ret < 0) {
> diff --git a/stubs/kvm.c b/stubs/kvm.c
> index e7c60b6..a8505ff 100644
> --- a/stubs/kvm.c
> +++ b/stubs/kvm.c
> @@ -1,7 +1,7 @@
>  #include "qemu-common.h"
>  #include "sysemu/kvm.h"
>  
> -int kvm_arch_irqchip_create(KVMState *s)
> +int kvm_arch_irqchip_create(KVMState *s, int type)
>  {
>      return 0;
>  }
> diff --git a/target-arm/kvm.c b/target-arm/kvm.c
> index 548bfd7..fa1073f 100644
> --- a/target-arm/kvm.c
> +++ b/target-arm/kvm.c
> @@ -579,7 +579,7 @@ void kvm_arch_init_irq_routing(KVMState *s)
>  {
>  }
>  
> -int kvm_arch_irqchip_create(KVMState *s)
> +int kvm_arch_irqchip_create(KVMState *s, int type)
>  {
>      int ret;
>  
> @@ -587,11 +587,15 @@ int kvm_arch_irqchip_create(KVMState *s)
>       * let the device do this when it initializes itself, otherwise we
>       * fall back to the old API */
>  
> -    ret = kvm_create_device(s, KVM_DEV_TYPE_ARM_VGIC_V2, true);
> +    ret = kvm_create_device(s, type, true);
>      if (ret == 0) {
>          return 1;
>      }
>  
> +    /* Fallback will create VGIC v2 */
> +    if (type != KVM_DEV_TYPE_ARM_VGIC_V2) {
> +        return ret;
> +    }
>      return 0;
>  }
>  
> 

  reply	other threads:[~2015-07-09 16:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07 13:54 [Qemu-devel] [PATCH v3 0/5] vGICv3 support Pavel Fedin
2015-07-07 13:54 ` [Qemu-devel] [PATCH v3 1/5] Implement GIC-500 base class Pavel Fedin
2015-07-07 13:54 ` [Qemu-devel] [PATCH v3 2/5] Extract some reusable vGIC code Pavel Fedin
2015-07-09 16:55   ` Eric Auger
2015-07-14  7:00     ` Pavel Fedin
2015-07-07 13:54 ` [Qemu-devel] [PATCH v3 3/5] Introduce irqchip type specification for KVM Pavel Fedin
2015-07-09 16:07   ` Eric Auger [this message]
2015-07-13  6:23     ` Pavel Fedin
2015-07-07 13:54 ` [Qemu-devel] [PATCH v3 4/5] Initial implementation of vGICv3 Pavel Fedin
2015-07-07 13:54 ` [Qemu-devel] [PATCH v3 5/5] Add gicversion option to virt machine Pavel Fedin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=559E9C3A.7040706@linaro.org \
    --to=eric.auger@linaro.org \
    --cc=christoffer.dall@linaro.org \
    --cc=p.fedin@samsung.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shlomo.pongratz@huawei.com \
    --cc=shlomopongratz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.