diff mbox series

x86/cpuid: Drop special_features[]

Message ID 20210607124141.24767-1-andrew.cooper3@citrix.com (mailing list archive)
State New, archived
Headers show
Series x86/cpuid: Drop special_features[] | expand

Commit Message

Andrew Cooper June 7, 2021, 12:41 p.m. UTC
While the ! annotation is useful to indicate that something special is
happening, an array of bits is not.  Drop it, to prevent mistakes.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>
---
 xen/arch/x86/cpuid.c        | 2 --
 xen/include/asm-x86/cpuid.h | 1 -
 xen/tools/gen-cpuid.py      | 3 ---
 3 files changed, 6 deletions(-)

Comments

Jan Beulich June 7, 2021, 12:56 p.m. UTC | #1
On 07.06.2021 14:41, Andrew Cooper wrote:
> While the ! annotation is useful to indicate that something special is
> happening, an array of bits is not.  Drop it, to prevent mistakes.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
Jan Beulich June 8, 2021, 6:18 a.m. UTC | #2
On 07.06.2021 14:41, Andrew Cooper wrote:
> While the ! annotation is useful to indicate that something special is
> happening, an array of bits is not.  Drop it, to prevent mistakes.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Wei Liu <wl@xen.org>
> ---
>  xen/arch/x86/cpuid.c        | 2 --
>  xen/include/asm-x86/cpuid.h | 1 -
>  xen/tools/gen-cpuid.py      | 3 ---
>  3 files changed, 6 deletions(-)

As osstest points out this didn't go quite far enough, or too far:
Either XC_FEATUREMASK_SPECIAL also needs dropping (including its uses
in libxenguest and xen-cpuid) or, considering exposing this
information via xen-cpuid isn't entirely without purpose, the script
part of the original change needs undoing or making conditional e.g.
upon __XEN__.

Jan
Andrew Cooper June 8, 2021, 8:46 a.m. UTC | #3
On 08/06/2021 07:18, Jan Beulich wrote:
> On 07.06.2021 14:41, Andrew Cooper wrote:
>> While the ! annotation is useful to indicate that something special is
>> happening, an array of bits is not.  Drop it, to prevent mistakes.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> ---
>> CC: Jan Beulich <JBeulich@suse.com>
>> CC: Roger Pau Monné <roger.pau@citrix.com>
>> CC: Wei Liu <wl@xen.org>
>> ---
>>  xen/arch/x86/cpuid.c        | 2 --
>>  xen/include/asm-x86/cpuid.h | 1 -
>>  xen/tools/gen-cpuid.py      | 3 ---
>>  3 files changed, 6 deletions(-)
> As osstest points out this didn't go quite far enough, or too far:
> Either XC_FEATUREMASK_SPECIAL also needs dropping (including its uses
> in libxenguest and xen-cpuid) or, considering exposing this
> information via xen-cpuid isn't entirely without purpose, the script
> part of the original change needs undoing or making conditional e.g.
> upon __XEN__.

Yes - Gitlab CI didn't spot, because there is a different breakage from
PV32 blocking things.

I think I'll reinstate the gen-cpuid.py hunks because having xen-cpuid
print out the bits when asked is helpful.

~Andrew
Jan Beulich June 8, 2021, 9:01 a.m. UTC | #4
On 08.06.2021 10:46, Andrew Cooper wrote:
> On 08/06/2021 07:18, Jan Beulich wrote:
>> On 07.06.2021 14:41, Andrew Cooper wrote:
>>> While the ! annotation is useful to indicate that something special is
>>> happening, an array of bits is not.  Drop it, to prevent mistakes.
>>>
>>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>>> ---
>>> CC: Jan Beulich <JBeulich@suse.com>
>>> CC: Roger Pau Monné <roger.pau@citrix.com>
>>> CC: Wei Liu <wl@xen.org>
>>> ---
>>>  xen/arch/x86/cpuid.c        | 2 --
>>>  xen/include/asm-x86/cpuid.h | 1 -
>>>  xen/tools/gen-cpuid.py      | 3 ---
>>>  3 files changed, 6 deletions(-)
>> As osstest points out this didn't go quite far enough, or too far:
>> Either XC_FEATUREMASK_SPECIAL also needs dropping (including its uses
>> in libxenguest and xen-cpuid) or, considering exposing this
>> information via xen-cpuid isn't entirely without purpose, the script
>> part of the original change needs undoing or making conditional e.g.
>> upon __XEN__.
> 
> Yes - Gitlab CI didn't spot, because there is a different breakage from
> PV32 blocking things.

Oh, what further problem do we have? What I can see there (picking a
random build log) is the failure from the change here ...

> I think I'll reinstate the gen-cpuid.py hunks because having xen-cpuid
> print out the bits when asked is helpful.

And maybe put the #define inside "#ifndef __XEN__" then?

Jan
diff mbox series

Patch

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 958caf35da..2079a30ae4 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -14,7 +14,6 @@ 
 #include <asm/xstate.h>
 
 const uint32_t known_features[] = INIT_KNOWN_FEATURES;
-const uint32_t special_features[] = INIT_SPECIAL_FEATURES;
 
 static const uint32_t __initconst pv_max_featuremask[] = INIT_PV_MAX_FEATURES;
 static const uint32_t hvm_shadow_max_featuremask[] = INIT_HVM_SHADOW_MAX_FEATURES;
@@ -1132,7 +1131,6 @@  void guest_cpuid(const struct vcpu *v, uint32_t leaf,
 static void __init __maybe_unused build_assertions(void)
 {
     BUILD_BUG_ON(ARRAY_SIZE(known_features) != FSCAPINTS);
-    BUILD_BUG_ON(ARRAY_SIZE(special_features) != FSCAPINTS);
     BUILD_BUG_ON(ARRAY_SIZE(pv_max_featuremask) != FSCAPINTS);
     BUILD_BUG_ON(ARRAY_SIZE(hvm_shadow_max_featuremask) != FSCAPINTS);
     BUILD_BUG_ON(ARRAY_SIZE(hvm_hap_max_featuremask) != FSCAPINTS);
diff --git a/xen/include/asm-x86/cpuid.h b/xen/include/asm-x86/cpuid.h
index 7baf6c9628..46904061d0 100644
--- a/xen/include/asm-x86/cpuid.h
+++ b/xen/include/asm-x86/cpuid.h
@@ -14,7 +14,6 @@ 
 #include <public/sysctl.h>
 
 extern const uint32_t known_features[FSCAPINTS];
-extern const uint32_t special_features[FSCAPINTS];
 
 void init_guest_cpuid(void);
 
diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index b953648b65..c6b5056a8d 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -362,8 +362,6 @@  def write_results(state):
 
 #define INIT_KNOWN_FEATURES { \\\n%s\n}
 
-#define INIT_SPECIAL_FEATURES { \\\n%s\n}
-
 #define INIT_PV_DEF_FEATURES { \\\n%s\n}
 
 #define INIT_PV_MAX_FEATURES { \\\n%s\n}
@@ -384,7 +382,6 @@  def write_results(state):
 """ % (state.nr_entries,
        next(featureset_to_uint32s(state.common_1d, 1)),
        format_uint32s(state, state.names.keys(), 4),
-       format_uint32s(state, state.raw['!'], 4),
        format_uint32s(state, state.pv_def, 4),
        format_uint32s(state, state.pv_max, 4),
        format_uint32s(state, state.hvm_shadow_def, 4),