Re: [PATCH v8 01/10] x86/cpu: KVM: Add common defines for architectural memory types (PAT, MTRRs, etc.)

From: Thomas Gleixner
Date: Thu Aug 15 2024 - 11:35:06 EST


On Wed, Jun 05 2024 at 16:19, Sean Christopherson wrote:

> Add defines for the architectural memory types that can be shoved into
> various MSRs and registers, e.g. MTRRs, PAT, VMX capabilities MSRs, EPTPs,
> etc. While most MSRs/registers support only a subset of all memory types,
> the values themselves are architectural and identical across all users.
>
> Leave the goofy MTRR_TYPE_* definitions as-is since they are in a uapi
> header, but add compile-time assertions to connect the dots (and sanity
> check that the msr-index.h values didn't get fat-fingered).
>
> Keep the VMX_EPTP_MT_* defines so that it's slightly more obvious that the
> EPTP holds a single memory type in 3 of its 64 bits; those bits just
> happen to be 2:0, i.e. don't need to be shifted.
>
> Opportunistically use X86_MEMTYPE_WB instead of an open coded '6' in
> setup_vmcs_config().
>
> No functional change intended.
>
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>

Reviewed-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>