From: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
To: Marcel Apfelbaum <marcel@redhat.com>, qemu-devel@nongnu.org
Cc: scottwood@freescale.com, pbonzini@redhat.com, agraf@suse.de,
mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH V2] machine: query kernel-irqchip machine property rather than qemu opts
Date: Tue, 10 Mar 2015 19:01:41 +0200 [thread overview]
Message-ID: <54FF2375.80406@gmail.com> (raw)
In-Reply-To: <1426006794-22605-1-git-send-email-marcel@redhat.com>
On 03/10/2015 06:59 PM, Marcel Apfelbaum wrote:
> Fixes a QEMU crash when passing kernel_irqchip parameter in command line.
Rebased on Michael S. Tsirkin branch on his request.
Thanks,
Marcel
>
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> ---
> hw/ppc/e500.c | 15 +++++----------
> hw/ppc/spapr.c | 15 ++++++---------
> kvm-all.c | 6 +++---
> 3 files changed, 14 insertions(+), 22 deletions(-)
>
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index d51fb60..c10e1b5 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -734,8 +734,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;
> @@ -745,17 +745,12 @@ 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);
> Error *err = NULL;
>
> - if (irqchip_allowed) {
> + if (machine_kernel_irqchip_allowed(machine)) {
> dev = ppce500_init_mpic_kvm(params, irqs, &err);
> }
> - if (irqchip_required && !dev) {
> + if (machine_kernel_irqchip_required(machine) && !dev) {
> error_report("kernel_irqchip requested but unavailable: %s",
> error_get_pretty(err));
> exit(1);
> @@ -879,7 +874,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 4aa979f..0487f52 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -127,22 +127,18 @@ 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);
> Error *err = NULL;
>
> - if (irqchip_allowed) {
> + if (machine_kernel_irqchip_allowed(machine)) {
> icp = try_create_xics(TYPE_KVM_XICS, nr_servers, nr_irqs, &err);
> }
> - if (irqchip_required && !icp) {
> + if (machine_kernel_irqchip_required(machine) && !icp) {
> error_report("kernel_irqchip requested but unavailable: %s",
> error_get_pretty(err));
> }
> @@ -1455,7 +1451,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 708978d..cbedc25 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;
> }
>
prev parent reply other threads:[~2015-03-10 17:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-10 16:59 [Qemu-devel] [PATCH V2] machine: query kernel-irqchip machine property rather than qemu opts Marcel Apfelbaum
2015-03-10 17:01 ` Marcel Apfelbaum [this message]
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=54FF2375.80406@gmail.com \
--to=marcel.apfelbaum@gmail.com \
--cc=agraf@suse.de \
--cc=marcel@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--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.