|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v3 09/12] x86: Derive XEN_MSR_PAT from its individual entries
On 15.12.2022 00:11, Demi Marie Obenour wrote:
> --- a/xen/arch/x86/include/asm/processor.h
> +++ b/xen/arch/x86/include/asm/processor.h
> @@ -96,7 +96,15 @@
> * Host IA32_CR_PAT value to cover all memory types. This is not the default
> * MSR_PAT value, and is an ABI with PV guests.
> */
> -#define XEN_MSR_PAT _AC(0x050100070406, ULL)
> +#define XEN_MSR_PAT (X86_MT_WB << 0x00 | \
> + X86_MT_WT << 0x08 | \
> + X86_MT_UCM << 0x10 | \
> + X86_MT_UC << 0x18 | \
> + X86_MT_WC << 0x20 | \
> + X86_MT_WP << 0x28 | \
> + X86_MT_UC << 0x30 | \
> + X86_MT_UC << 0x38 | \
This wants properly parenthesizing (the shifts against the ors), and
at least the last four constants also look to need casting to uint64_t;
in fact I'm surprised that ...
> + 0)
(interposed: I don't think this really does any good.)
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -6355,6 +6355,12 @@ unsigned long get_upper_mfn_bound(void)
> return min(max_mfn, 1UL << (paddr_bits - PAGE_SHIFT)) - 1;
> }
>
> +static void __init __maybe_unused build_assertions(void)
> +{
> + BUILD_BUG_ON(XEN_MSR_PAT != 0x050100070406ULL &&
> + "wrong XEN_MSR_PAT breaks PV guests");
... this didn't trigger for you. (We also don't normally add such
constructs with a string literal to BUILD_BUG_ON() expressions, not
the least because compilers may take issue with such. I'd like to
suggest to convert this to a comment instead.)
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |