From: Marcel Apfelbaum <marcel.a@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: kvm@vger.kernel.org, "Alexander Graf" <agraf@suse.de>,
qemu-devel@nongnu.org,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH] machine: Add kvm-type property
Date: Sun, 01 Jun 2014 11:31:04 +0300 [thread overview]
Message-ID: <1401611464.2875.99.camel@localhost.localdomain> (raw)
In-Reply-To: <1401482467-31550-1-git-send-email-ehabkost@redhat.com>
On Fri, 2014-05-30 at 17:41 -0300, Eduardo Habkost wrote:
> The kvm-type machine option was left out when MachineState was
> introduced, preventing the kvm-type option from being used. Add the
> missing property.
Very interesting how did I miss that.
Thanks!
Marcel
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Andreas Färber <afaerber@suse.de>
> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> Cc: Alexander Graf <agraf@suse.de>
> Cc: Marcel Apfelbaum <marcel.a@redhat.com>
> ---
> Tested in a x86 machine only. Help would be welcome to test it on a PPC
> machine using -machine spapr and KVM.
>
> Before this patch:
>
> $ qemu-system-x86_64 -machine pc,kvm-type=hv,accel=kvm
> qemu-system-x86_64: Property '.kvm-type' not found
>
> (This means the option won't work even for sPAPR machines.)
>
> After applying this patch:
>
> $ qemu-system-x86_64 -machine pc,kvm-type=hv,accel=kvm
> Invalid argument kvm-type=hv
>
> (This means the x86 KVM init code is seeing (and rejecting) the option,
> and the sPAPR code can use it.)
>
> Note that qemu-system-x86_64 will segfault with the above command-line
> unless an additional fix (submitted today) is applied (kvm: Ensure
> negative return value on kvm_init() error handling path).
> ---
> hw/core/machine.c | 17 +++++++++++++++++
> include/hw/boards.h | 1 +
> 2 files changed, 18 insertions(+)
>
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index cbba679..ed47b3a 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -235,6 +235,21 @@ static void machine_set_firmware(Object *obj, const char *value, Error **errp)
> ms->firmware = g_strdup(value);
> }
>
> +static char *machine_get_kvm_type(Object *obj, Error **errp)
> +{
> + MachineState *ms = MACHINE(obj);
> +
> + return g_strdup(ms->kvm_type);
> +}
> +
> +static void machine_set_kvm_type(Object *obj, const char *value, Error **errp)
> +{
> + MachineState *ms = MACHINE(obj);
> +
> + g_free(ms->kvm_type);
> + ms->kvm_type = g_strdup(value);
> +}
> +
> static void machine_initfn(Object *obj)
> {
> object_property_add_str(obj, "accel",
> @@ -274,6 +289,8 @@ static void machine_initfn(Object *obj)
> object_property_add_bool(obj, "usb", machine_get_usb, machine_set_usb, NULL);
> object_property_add_str(obj, "firmware",
> machine_get_firmware, machine_set_firmware, NULL);
> + object_property_add_str(obj, "kvm-type",
> + machine_get_kvm_type, machine_set_kvm_type, NULL);
> }
>
> static void machine_finalize(Object *obj)
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index 2d2e2be..44956d6 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -111,6 +111,7 @@ struct MachineState {
> bool mem_merge;
> bool usb;
> char *firmware;
> + char *kvm_type;
>
> ram_addr_t ram_size;
> const char *boot_order;
next parent reply other threads:[~2014-06-01 8:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1401482467-31550-1-git-send-email-ehabkost@redhat.com>
2014-06-01 8:31 ` Marcel Apfelbaum [this message]
2014-06-02 8:56 ` [Qemu-devel] [PATCH] machine: Add kvm-type property Marcel Apfelbaum
2014-06-02 14:44 ` Eduardo Habkost
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=1401611464.2875.99.camel@localhost.localdomain \
--to=marcel.a@redhat.com \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=ehabkost@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).