[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 08/25] x86/cpuid: Introduce named feature bitfields
On 09/01/17 16:31, Jan Beulich wrote: >>>> On 09.01.17 at 12:03, <andrew.cooper3@xxxxxxxxxx> wrote: >> --- a/xen/include/asm-x86/cpuid.h >> +++ b/xen/include/asm-x86/cpuid.h >> @@ -92,6 +92,10 @@ struct cpuid_policy >> * Everything else should be considered inaccurate, and not necesserily >> 0. >> */ >> >> +#define DECL_BITFIELD(word) _DECL_BITFIELD(FEATURESET_ ## word) >> +#define _DECL_BITFIELD(x) __DECL_BITFIELD(x) >> +#define __DECL_BITFIELD(x) NAMED_BITFIELD_ ## x > If this was a C file, I'd be fine with this naming choice, but in a header > I think it would be better to reduce the chance of name space issues > and use CPUID_BITFIELD_ ## x instead here (and - obviously - in the > script). Ok. > >> @@ -291,6 +292,28 @@ def crunch_numbers(state): >> for k, v in state.deep_deps.iteritems(): >> state.deep_deps[k] = featureset_to_uint32s(v, nr_entries) >> >> + # Calculate the bitfield name declarations >> + for word in xrange(nr_entries): >> + >> + names = [] >> + for bit in xrange(32): >> + >> + name = state.names.get(word * 32 + bit, "") >> + >> + # Prepend an underscore if the name starts with a digit. >> + if name and name[0] in "0123456789": >> + name = "_" + name >> + >> + # Don't generate names for the duplicate features, or ones >> + # fast-forwarded from other state >> + if (name.startswith("E1D_") or >> + name in ("APIC", "OSXSAVE", "OSPKE")): >> + name = "" >> + >> + names.append(name.lower()) >> + >> + state.bitfields.append("bool " + ":1, ".join(names) + ":1") > It's probably my rudimentary Python knowledge that makes me > confused by the two :1 here. I trust the result is what it needs > to be. "separator".join(array) is implode(array, "separator") in other languages. The final entry in the array still needs a bitfield suffix to be correct C. > So with the naming aspect addressed > Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> Thanks. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |