From: Igor Mammedov <imammedo@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Jiri Denemark" <jdenemar@redhat.com>,
qemu-devel@nongnu.org, "Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH v4] target-i386: Register QOM properties for feature flags
Date: Tue, 14 Apr 2015 16:19:43 +0200 [thread overview]
Message-ID: <20150414161943.355c36d1@nial.brq.redhat.com> (raw)
In-Reply-To: <20150414140839.GA3466@thinpad.lan.raisama.net>
On Tue, 14 Apr 2015 11:08:39 -0300
Eduardo Habkost <ehabkost@redhat.com> wrote:
[...]
> > > +/* Register a boolean feature-bits property.
> > > + * If mask has multiple bits, all must be set for the property to return true.
> > > + * The same property name can be registered multiple times to make it affect
> > > + * multiple bits in the same FeatureWord.
> > > + */
> > > +static void x86_cpu_register_feature_prop(X86CPU *cpu,
> > > + const char *prop_name,
> > > + FeatureWord w,
> > > + uint32_t mask)
> > isn't used as mask by caller, s/mask/bit/ ???
>
> There will be an use case for mask containing multiple bits, later. My
> plan is to remove the duplicate "kvmclock" alias from kvm_feature_name,
> and call this manually:
>
> x86_cpu_register_feature_prop(cpu, "kvmclock", FEAT_KVM,
> (1 << KVM_FEATURE_CLOCKSOURCE) |
> (1 << KVM_FEATURE_CLOCKSOURCE2));
make it mask when it starts to be used as such
>
> I didn't do that yet because I need the existing
> x86_cpu_parse_featurestr() code to keep working until it is converted to
> use object_property_set().
>
[...]
> > > + op = object_property_find(OBJECT(cpu), prop_name, NULL);
> > > + if (op) {
> > > + fp = op->opaque;
> > > + assert(fp->word == w);
> > > + fp->mask |= mask;
>
> ^^^ This is the block of code that will be removed once I add the manual
> "kvmclock" registration call I mentioned above.
>
> > > + } else {
> > > + fp = g_new0(FeatureProperty, 1);
> > > + fp->word = w;
> > > + fp->mask = mask;
> > > + object_property_add(OBJECT(cpu), prop_name, "bool",
> > > + x86_cpu_get_feature_prop,
> > > + x86_cpu_set_feature_prop,
> > > + x86_cpu_release_feature_prop, fp, &error_abort);
> > > + }
> > > +}
> > > +
> > > +static void x86_cpu_register_feature_bit_props(X86CPU *cpu,
> > this adds 1 property and possibly aliases, _props() is confusing here.
>
> Alias properties are still properties like any other, aren't they? The
> function is still responsible for registering multiple properties. Is
> the "_props()" suffix really that confusing?
technically aliases are properties but from user pov it's the same property
just with another name.
>
>
> > I'd rename it to x86_cpu_add_feature_bit_prop() and inline
> > above x86_cpu_register_feature_prop() since it's not going to be reused
>
> I prefer to keep the single-property function separated, as it may
> become a generic bitmap property registration function inside generic
> QOM code later. With your feature_word_ptr suggestion, it would be even
> more generic and non-x86-specific.
>
> (To be honest, I would prefer to keep the single-property function
> registration code clearly separated even if it was never going to be
> reused anywhere. 20-line functions are already too long for my taste.)
ok
[...]
prev parent reply other threads:[~2015-04-14 14:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-10 20:02 [Qemu-devel] [PATCH v4] target-i386: Register QOM properties for feature flags Eduardo Habkost
2015-04-14 11:49 ` Igor Mammedov
2015-04-14 14:08 ` Eduardo Habkost
2015-04-14 14:19 ` Igor Mammedov [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=20150414161943.355c36d1@nial.brq.redhat.com \
--to=imammedo@redhat.com \
--cc=afaerber@suse.de \
--cc=ehabkost@redhat.com \
--cc=jdenemar@redhat.com \
--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).