* [PATCH for-4.19] x86/cpu-policy: Adjust CPUID_MAX_SERIALISED_LEAVES to placate MISRA
@ 2023-10-10 9:57 Andrew Cooper
2023-10-11 12:50 ` Nicola Vetrini
2023-10-16 14:25 ` Jan Beulich
0 siblings, 2 replies; 3+ messages in thread
From: Andrew Cooper @ 2023-10-10 9:57 UTC (permalink / raw)
To: Xen-devel
Cc: Andrew Cooper, Nicola Vetrini, Jan Beulich, Roger Pau Monné,
Wei Liu
MISRA doesn't like !!CONST being used in place of a 1 (Rule 10.1). Update the
expression to just be a plain 1, which still matches the description.
No functional change.
Reported-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
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>
CC: Nicola Vetrini <nicola.vetrini@bugseng.com>
After considering the comment several times, I've decided to leave it as is.
It's slightly awkward grammar but it's ok.
---
xen/include/xen/lib/x86/cpu-policy.h | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/xen/include/xen/lib/x86/cpu-policy.h b/xen/include/xen/lib/x86/cpu-policy.h
index bab3eecda6c1..d5e447e9dc06 100644
--- a/xen/include/xen/lib/x86/cpu-policy.h
+++ b/xen/include/xen/lib/x86/cpu-policy.h
@@ -100,13 +100,14 @@ const char *x86_cpuid_vendor_to_str(unsigned int vendor);
* interaction with the toolstack. (Sum of all leaves in each union, less the
* entries in basic which sub-unions hang off of.)
*/
-#define CPUID_MAX_SERIALISED_LEAVES \
- (CPUID_GUEST_NR_BASIC + \
- CPUID_GUEST_NR_FEAT - !!CPUID_GUEST_NR_FEAT + \
- CPUID_GUEST_NR_CACHE - !!CPUID_GUEST_NR_CACHE + \
- CPUID_GUEST_NR_TOPO - !!CPUID_GUEST_NR_TOPO + \
- CPUID_GUEST_NR_XSTATE - !!CPUID_GUEST_NR_XSTATE + \
- CPUID_GUEST_NR_EXTD + 2 /* hv_limit and hv2_limit */ )
+#define CPUID_MAX_SERIALISED_LEAVES \
+ (CPUID_GUEST_NR_BASIC + \
+ CPUID_GUEST_NR_FEAT - 1 + \
+ CPUID_GUEST_NR_CACHE - 1 + \
+ CPUID_GUEST_NR_TOPO - 1 + \
+ CPUID_GUEST_NR_XSTATE - 1 + \
+ CPUID_GUEST_NR_EXTD + \
+ 2 /* hv_limit and hv2_limit */ )
/* Maximum number of MSRs written when serialising a cpu_policy. */
#define MSR_MAX_SERIALISED_ENTRIES 2
base-commit: c035151902689aa5a3765aeb16fa52755917b9ca
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH for-4.19] x86/cpu-policy: Adjust CPUID_MAX_SERIALISED_LEAVES to placate MISRA
2023-10-10 9:57 [PATCH for-4.19] x86/cpu-policy: Adjust CPUID_MAX_SERIALISED_LEAVES to placate MISRA Andrew Cooper
@ 2023-10-11 12:50 ` Nicola Vetrini
2023-10-16 14:25 ` Jan Beulich
1 sibling, 0 replies; 3+ messages in thread
From: Nicola Vetrini @ 2023-10-11 12:50 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Xen-devel, Jan Beulich, Roger Pau Monné, Wei Liu
On 10/10/2023 11:57, Andrew Cooper wrote:
> MISRA doesn't like !!CONST being used in place of a 1 (Rule 10.1).
> Update the
> expression to just be a plain 1, which still matches the description.
>
> No functional change.
>
> Reported-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
> 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>
> CC: Nicola Vetrini <nicola.vetrini@bugseng.com>
>
> After considering the comment several times, I've decided to leave it
> as is.
> It's slightly awkward grammar but it's ok.
> ---
> xen/include/xen/lib/x86/cpu-policy.h | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/xen/include/xen/lib/x86/cpu-policy.h
> b/xen/include/xen/lib/x86/cpu-policy.h
> index bab3eecda6c1..d5e447e9dc06 100644
> --- a/xen/include/xen/lib/x86/cpu-policy.h
> +++ b/xen/include/xen/lib/x86/cpu-policy.h
> @@ -100,13 +100,14 @@ const char *x86_cpuid_vendor_to_str(unsigned int
> vendor);
> * interaction with the toolstack. (Sum of all leaves in each union,
> less the
> * entries in basic which sub-unions hang off of.)
> */
> -#define CPUID_MAX_SERIALISED_LEAVES \
> - (CPUID_GUEST_NR_BASIC + \
> - CPUID_GUEST_NR_FEAT - !!CPUID_GUEST_NR_FEAT + \
> - CPUID_GUEST_NR_CACHE - !!CPUID_GUEST_NR_CACHE + \
> - CPUID_GUEST_NR_TOPO - !!CPUID_GUEST_NR_TOPO + \
> - CPUID_GUEST_NR_XSTATE - !!CPUID_GUEST_NR_XSTATE + \
> - CPUID_GUEST_NR_EXTD + 2 /* hv_limit and hv2_limit */ )
> +#define CPUID_MAX_SERIALISED_LEAVES \
> + (CPUID_GUEST_NR_BASIC + \
> + CPUID_GUEST_NR_FEAT - 1 + \
> + CPUID_GUEST_NR_CACHE - 1 + \
> + CPUID_GUEST_NR_TOPO - 1 + \
> + CPUID_GUEST_NR_XSTATE - 1 + \
> + CPUID_GUEST_NR_EXTD + \
> + 2 /* hv_limit and hv2_limit */ )
>
> /* Maximum number of MSRs written when serialising a cpu_policy. */
> #define MSR_MAX_SERIALISED_ENTRIES 2
>
> base-commit: c035151902689aa5a3765aeb16fa52755917b9ca
Looks good to me.
--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH for-4.19] x86/cpu-policy: Adjust CPUID_MAX_SERIALISED_LEAVES to placate MISRA
2023-10-10 9:57 [PATCH for-4.19] x86/cpu-policy: Adjust CPUID_MAX_SERIALISED_LEAVES to placate MISRA Andrew Cooper
2023-10-11 12:50 ` Nicola Vetrini
@ 2023-10-16 14:25 ` Jan Beulich
1 sibling, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2023-10-16 14:25 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Nicola Vetrini, Roger Pau Monné, Wei Liu, Xen-devel
On 10.10.2023 11:57, Andrew Cooper wrote:
> MISRA doesn't like !!CONST being used in place of a 1 (Rule 10.1). Update the
> expression to just be a plain 1, which still matches the description.
>
> No functional change.
>
> Reported-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-16 14:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-10 9:57 [PATCH for-4.19] x86/cpu-policy: Adjust CPUID_MAX_SERIALISED_LEAVES to placate MISRA Andrew Cooper
2023-10-11 12:50 ` Nicola Vetrini
2023-10-16 14:25 ` Jan Beulich
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.