All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
To: Marcel Apfelbaum <marcel@redhat.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com,
	james.hogan@imgtec.com, mst@redhat.com, jan.kiszka@siemens.com,
	agraf@suse.de, scottwood@freescale.com, borntraeger@de.ibm.com,
	cornelia.huck@de.ibm.com, pbonzini@redhat.com,
	leon.alrae@imgtec.com, aurelien@aurel32.net
Subject: Re: [Qemu-devel] [PATCH 3/8] machine: query kernel-irqchip machine property rather than qemu opts
Date: Wed, 11 Mar 2015 16:41:25 +0200	[thread overview]
Message-ID: <55005415.1030500@gmail.com> (raw)
In-Reply-To: <1423064635-19045-4-git-send-email-marcel@redhat.com>

On 02/04/2015 05:43 PM, Marcel Apfelbaum wrote:
> Fixes a QEMU crash when passing kernel_irqchip parameter in command line.
Please amend commit message:

Running
     x86_64-softmmu/qemu-system-x86_64 -machine pc,kernel_irqchip=on -enable-kvm
leads to crash:
     qemu-system-x86_64: qemu/util/qemu-option.c:387: qemu_opt_get_bool_helper: Assertion `opt->desc && opt->desc->type == QEMU_OPT_BOOL' failed.
     Aborted (core dumped)

This happens because the commit e79d5a6 ("machine: remove qemu_machine_opts global list")
removed the global option descriptions and moved them to MachineState's QOM properties.

Fix this by querying machine properties through designated wrappers.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
>
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> ---
>   hw/ppc/e500.c  | 16 +++++-----------
>   hw/ppc/spapr.c | 16 ++++++----------
>   kvm-all.c      |  6 +++---
>   3 files changed, 14 insertions(+), 24 deletions(-)
>
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index 7e17d18..641cab9 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -731,8 +731,8 @@ static DeviceState *ppce500_init_mpic_kvm(PPCE500Params *params,
>       return dev;
>   }
>
> -static qemu_irq *ppce500_init_mpic(PPCE500Params *params, MemoryRegion *ccsr,
> -                                   qemu_irq **irqs)
> +static qemu_irq *ppce500_init_mpic(MachineState *machine, PPCE500Params *params,
> +                                   MemoryRegion *ccsr, qemu_irq **irqs)
>   {
>       qemu_irq *mpic;
>       DeviceState *dev = NULL;
> @@ -742,17 +742,11 @@ static qemu_irq *ppce500_init_mpic(PPCE500Params *params, MemoryRegion *ccsr,
>       mpic = g_new0(qemu_irq, 256);
>
>       if (kvm_enabled()) {
> -        QemuOpts *machine_opts = qemu_get_machine_opts();
> -        bool irqchip_allowed = qemu_opt_get_bool(machine_opts,
> -                                                "kernel_irqchip", true);
> -        bool irqchip_required = qemu_opt_get_bool(machine_opts,
> -                                                  "kernel_irqchip", false);
> -
> -        if (irqchip_allowed) {
> +        if (machine_kernel_irqchip_allowed(machine)) {
>               dev = ppce500_init_mpic_kvm(params, irqs);
>           }
>
> -        if (irqchip_required && !dev) {
> +        if (machine_kernel_irqchip_required(machine) && !dev) {
>               fprintf(stderr, "%s: irqchip requested but unavailable\n",
>                       __func__);
>               abort();
> @@ -876,7 +870,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
>       memory_region_add_subregion(address_space_mem, params->ccsrbar_base,
>                                   ccsr_addr_space);
>
> -    mpic = ppce500_init_mpic(params, ccsr_addr_space, irqs);
> +    mpic = ppce500_init_mpic(machine, params, ccsr_addr_space, irqs);
>
>       /* Serial */
>       if (serial_hds[0]) {
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index b560459..f4b6adb 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -123,21 +123,16 @@ static XICSState *try_create_xics(const char *type, int nr_servers,
>       return XICS_COMMON(dev);
>   }
>
> -static XICSState *xics_system_init(int nr_servers, int nr_irqs)
> +static XICSState *xics_system_init(MachineState *machine,
> +                                   int nr_servers, int nr_irqs)
>   {
>       XICSState *icp = NULL;
> -
>       if (kvm_enabled()) {
> -        QemuOpts *machine_opts = qemu_get_machine_opts();
> -        bool irqchip_allowed = qemu_opt_get_bool(machine_opts,
> -                                                "kernel_irqchip", true);
> -        bool irqchip_required = qemu_opt_get_bool(machine_opts,
> -                                                  "kernel_irqchip", false);
> -        if (irqchip_allowed) {
> +        if (machine_kernel_irqchip_allowed(machine)) {
>               icp = try_create_xics(TYPE_KVM_XICS, nr_servers, nr_irqs);
>           }
>
> -        if (irqchip_required && !icp) {
> +        if (machine_kernel_irqchip_required(machine) && !icp) {
>               perror("Failed to create in-kernel XICS\n");
>               abort();
>           }
> @@ -1420,7 +1415,8 @@ static void ppc_spapr_init(MachineState *machine)
>       }
>
>       /* Set up Interrupt Controller before we create the VCPUs */
> -    spapr->icp = xics_system_init(smp_cpus * kvmppc_smt_threads() / smp_threads,
> +    spapr->icp = xics_system_init(machine,
> +                                  smp_cpus * kvmppc_smt_threads() / smp_threads,
>                                     XICS_IRQS);
>
>       /* init CPUs */
> diff --git a/kvm-all.c b/kvm-all.c
> index 2f21a4e..cdb90c5 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1360,11 +1360,11 @@ int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq)
>              false);
>   }
>
> -static int kvm_irqchip_create(KVMState *s)
> +static int kvm_irqchip_create(MachineState *machine, KVMState *s)
>   {
>       int ret;
>
> -    if (!qemu_opt_get_bool(qemu_get_machine_opts(), "kernel_irqchip", true) ||
> +    if (!machine_kernel_irqchip_allowed(machine) ||
>           (!kvm_check_extension(s, KVM_CAP_IRQCHIP) &&
>            (kvm_vm_enable_cap(s, KVM_CAP_S390_IRQCHIP, 0) < 0))) {
>           return 0;
> @@ -1603,7 +1603,7 @@ static int kvm_init(MachineState *ms)
>           goto err;
>       }
>
> -    ret = kvm_irqchip_create(s);
> +    ret = kvm_irqchip_create(ms, s);
>       if (ret < 0) {
>           goto err;
>       }
>

  reply	other threads:[~2015-03-11 14:41 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04 15:43 [Qemu-devel] [PATCH 0/8] machine: query machine properties rather than qemu opts Marcel Apfelbaum
2015-02-04 15:43 ` [Qemu-devel] [PATCH 1/8] machine: query iommu machine property " Marcel Apfelbaum
2015-02-04 16:47   ` Markus Armbruster
2015-02-04 19:30     ` Marcel Apfelbaum
2015-02-05  8:18       ` Markus Armbruster
2015-03-11 14:43   ` Marcel Apfelbaum
2015-02-04 15:43 ` [Qemu-devel] [PATCH 2/8] hw/machine: kernel-irqchip property support for allowed/required Marcel Apfelbaum
2015-02-04 15:43 ` [Qemu-devel] [PATCH 3/8] machine: query kernel-irqchip machine property rather than qemu opts Marcel Apfelbaum
2015-03-11 14:41   ` Marcel Apfelbaum [this message]
2015-02-04 15:43 ` [Qemu-devel] [PATCH 4/8] kvm: add machine state to kvm_arch_init Marcel Apfelbaum
2015-02-04 15:43 ` [Qemu-devel] [PATCH 5/8] machine: query kvm-shadow-mem machine property rather than qemu opts Marcel Apfelbaum
2015-03-11 14:37   ` Marcel Apfelbaum
2015-02-04 15:43 ` [Qemu-devel] [PATCH 6/8] machine: query phandle-start " Marcel Apfelbaum
2015-03-11 14:32   ` Marcel Apfelbaum
2015-03-11 14:34     ` Marcel Apfelbaum
2015-03-11 14:39     ` Michael S. Tsirkin
2015-03-11 14:48       ` Marcel Apfelbaum
2015-02-04 15:43 ` [Qemu-devel] [PATCH 7/8] machine: query dump-guest-core " Marcel Apfelbaum
2015-03-10 17:50   ` Andreas Färber
2015-03-10 21:24     ` Michael S. Tsirkin
2015-03-10 21:36       ` Andreas Färber
2015-03-11  7:34         ` Markus Armbruster
2015-03-11  8:45           ` Michael S. Tsirkin
2015-03-11  9:42             ` Marcel Apfelbaum
2015-03-11  8:56         ` Michael S. Tsirkin
2015-03-11 11:06           ` Andreas Färber
2015-03-11 13:04             ` Marcel Apfelbaum
2015-03-11 14:22             ` Michael S. Tsirkin
2015-03-11 15:08           ` Markus Armbruster
2015-03-11  9:44         ` Marcel Apfelbaum
2015-03-11 14:25   ` Marcel Apfelbaum
2015-02-04 15:43 ` [Qemu-devel] [PATCH 8/8] machine: query mem-merge " Marcel Apfelbaum
2015-03-10 15:11   ` Michael S. Tsirkin
2015-03-10 16:22     ` Marcel Apfelbaum
2015-02-04 16:00 ` [Qemu-devel] [PATCH 0/8] machine: query machine properties " Paolo Bonzini
2015-02-04 19:45 ` Christian Borntraeger
2015-02-04 21:35   ` Marcel Apfelbaum
2015-02-04 22:10     ` Christian Borntraeger
2015-02-25 11:55 ` Marcel Apfelbaum
2015-03-04 15:37   ` Marcel Apfelbaum

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=55005415.1030500@gmail.com \
    --to=marcel.apfelbaum@gmail.com \
    --cc=agraf@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=james.hogan@imgtec.com \
    --cc=jan.kiszka@siemens.com \
    --cc=leon.alrae@imgtec.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=scottwood@freescale.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.