On 06.12.2022 12:32, Andrew Cooper wrote: > On 06/12/2022 04:33, Demi Marie Obenour wrote: >> --- a/xen/arch/x86/include/asm/processor.h >> +++ b/xen/arch/x86/include/asm/processor.h >> @@ -92,13 +92,33 @@ >> X86_EFLAGS_NT|X86_EFLAGS_DF|X86_EFLAGS_IF| \ >> X86_EFLAGS_TF) >> >> +/* Individual entries in IA32_CR_PAT */ >> +#define MSR_PAT_UC _AC(0x00, ULL) >> +#define MSR_PAT_WC _AC(0x01, ULL) >> +#define MSR_PAT_RESERVED_1 _AC(0x02, ULL) >> +#define MSR_PAT_RESERVED_2 _AC(0x03, ULL) >> +#define MSR_PAT_WT _AC(0x04, ULL) >> +#define MSR_PAT_WP _AC(0x05, ULL) >> +#define MSR_PAT_WB _AC(0x06, ULL) >> +#define MSR_PAT_UCM _AC(0x07, ULL) > > This isn't really correct. Constants for MSRs typically live in > msr-index.h, but these are architectural x86 memory types. > > These ought be > > #define X86_MT_$X ... (skipping the two reserved values) > > in x86-defns.h, and the PAT_TYPE_*, MTRR_TYPE_* and EPT_EMT_* constants > want removing. > > There are two minor restrictions (EPT can't have UCM, MTRR can't have > WC), but they are all operating in terms of architectural memory type > values, and the code ought to reflect this.
The unavailability of UCM is common to MTRR and EPT's EMT. WC, at the same time, is a valid type to use in both. Which makes sense - EMT after all merely is replacing what otherwise is expressed by MTRRs. Jan