On 13.12.2022 23:26, Demi Marie Obenour wrote:
> --- a/xen/arch/x86/include/asm/x86-defns.h
> +++ b/xen/arch/x86/include/asm/x86-defns.h
> @@ -153,4 +153,17 @@
>       (1u << X86_EXC_AC) | (1u << X86_EXC_CP) |                      \
>       (1u << X86_EXC_VC) | (1u << X86_EXC_SX))
>  
> +/* Memory types */
> +#define X86_MT_UC  _AC(0x00, ULL) /* uncachable */
> +#define X86_MT_WC  _AC(0x01, ULL) /* write-combined */
> +#define X86_MT_WT  _AC(0x04, ULL) /* write-through */
> +#define X86_MT_WP  _AC(0x05, ULL) /* write-protect */
> +#define X86_MT_WB  _AC(0x06, ULL) /* write-back */
> +#define X86_MT_UCM _AC(0x07, ULL) /* UC- */

I'm guessing that you use ULL here to simplify arithmetic when constructing
PAT MSR values, but did you also check that this doesn't lead to compilers
needlessly doing calculations in 64 bits when 32-bit (or yet more narrow)
operation would suffice?

> +#define X86_NUM_MT _AC(0x08, ULL)

This pretty certainly doesn't need ULL, and no use of _AC() at all.

> +/* Reserved memory types (cannot be used) */
> +#define X86_MT_RESERVED_1 _AC(0x02, ULL)
> +#define X86_MT_RESERVED_2 _AC(0x03, ULL)

I think it would be better if the left hand numbers matched the right hand
ones here.

Jan

Reply via email to