From: Greg Kurz <groug@kaod.org>
To: Daniel Henrique Barboza <danielhb413@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH 1/1] spapr.c: set a 'kvm-type' default value instead of relying on NULL
Date: Thu, 10 Dec 2020 14:49:31 +0100 [thread overview]
Message-ID: <20201210144931.7127eb17@bahia.lan> (raw)
In-Reply-To: <c1bae366-135d-f240-ff03-2abc8967c908@gmail.com>
On Thu, 10 Dec 2020 10:10:21 -0300
Daniel Henrique Barboza <danielhb413@gmail.com> wrote:
>
>
> On 12/10/20 9:47 AM, Greg Kurz wrote:
> > On Thu, 10 Dec 2020 13:34:59 +0100
> > Paolo Bonzini <pbonzini@redhat.com> wrote:
> >
> >> To sum up everything:
> >>
> >
> > LGTM
>
> I just sent a v2 with a bit more done (e.g. added ignore case compare
> for 'auto'). Feel free to use that version or this one amended by this
> diff from Paolo.
>
The "bit more done" in your v2 is very important as it prevents
spapr_kvm_type() to exit(1) if "auto" is explicitly passed on
the command line. So I think we should go ahead with yours.
>
> Thanks,
>
>
> DHB
>
> >
> >> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> >> index 2d5aeeb45a..61f0963916 100644
> >> --- a/hw/ppc/spapr.c
> >> +++ b/hw/ppc/spapr.c
> >> @@ -3028,11 +3028,11 @@ static int spapr_kvm_type(MachineState *machine,
> >> const char *vm_type)
> >> return 0;
> >> }
> >>
> >> - if (!strcmp(vm_type, "HV")) {
> >> + if (!g_ascii_strcasecmp(vm_type, "hv")) {
> >> return 1;
> >> }
> >>
> >> - if (!strcmp(vm_type, "PR")) {
> >> + if (!g_ascii_strcasecmp(vm_type, "pr")) {
> >> return 2;
> >> }
> >>
> >> @@ -3132,16 +3132,6 @@ static char *spapr_get_kvm_type(Object *obj,
> >> Error **errp)
> >> {
> >> SpaprMachineState *spapr = SPAPR_MACHINE(obj);
> >>
> >> - /*
> >> - * In case the user didn't set 'kvm-type', return DEFAULT_KVM_TYPE
> >> - * instead of NULL. This allows us to be more predictable with what
> >> - * is expected to happen in spapr_kvm_type(), since we can stop relying
> >> - * on receiving a 'NULL' parameter as a valid input there.
> >> - */
> >> - if (!spapr->kvm_type) {
> >> - return g_strdup(DEFAULT_KVM_TYPE);
> >> - }
> >> -
> >> return g_strdup(spapr->kvm_type);
> >> }
> >>
> >> @@ -3294,11 +3284,13 @@ static void spapr_instance_init(Object *obj)
> >>
> >> spapr->htab_fd = -1;
> >> spapr->use_hotplug_event_source = true;
> >> +
> >> + spapr->kvm_type = g_strdup(DEFAULT_KVM_TYPE);
> >> object_property_add_str(obj, "kvm-type",
> >> spapr_get_kvm_type, spapr_set_kvm_type);
> >> object_property_set_description(obj, "kvm-type",
> >> - "Specifies the KVM virtualization
> >> mode (HV, PR)."
> >> - " If not specified, defaults to any
> >> available KVM"
> >> + "Specifies the KVM virtualization
> >> mode (hv, pr, auto)."
> >> + " auto is the default and allows
> >> any available KVM"
> >> " module loaded in the host. In
> >> case both kvm_hv"
> >> " and kvm_pr are loaded, kvm_hv
> >> takes precedence.");
> >>
> >
prev parent reply other threads:[~2020-12-10 14:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-08 13:45 [PATCH 1/1] spapr.c: set a 'kvm-type' default value instead of relying on NULL Daniel Henrique Barboza
2020-12-08 14:33 ` Greg Kurz
2020-12-08 15:32 ` Daniel Henrique Barboza
2020-12-10 3:37 ` David Gibson
2020-12-10 12:34 ` Paolo Bonzini
2020-12-10 12:47 ` Greg Kurz
2020-12-10 13:10 ` Daniel Henrique Barboza
2020-12-10 13:49 ` Greg Kurz [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=20201210144931.7127eb17@bahia.lan \
--to=groug@kaod.org \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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 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.