On 15/12/2022 11:57 pm, Demi Marie Obenour wrote:
> diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> index
> 78b1972e4170cacccc9c37c6e64e76e66a7da87f..802073a01c5cf4dc3cf1d58d28ea4d4e9e8149c7
> 100644
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -959,15 +959,22 @@ get_page_from_l1e(
> flip = _PAGE_RW;
> }
>
> - switch ( l1f & PAGE_CACHE_ATTRS )
> + /* Force cacheable memtypes to UC */
> + switch ( pte_flags_to_cacheability(l1f) )
> {
> - case 0: /* WB */
> - flip |= _PAGE_PWT | _PAGE_PCD;
> + case X86_MT_UC:
> + case X86_MT_UCM:
> + case X86_MT_WC:
> + /* not cached */
> break;
> - case _PAGE_PWT: /* WT */
> - case _PAGE_PWT | _PAGE_PAT: /* WP */
> - flip |= _PAGE_PCD | (l1f & _PAGE_PAT);
> + case X86_MT_WB:
> + case X86_MT_WT:
> + case X86_MT_WP:
> + /* cacheable, force to UC */
> + flip |= (l1f & PAGE_CACHE_ATTRS) ^ _PAGE_UC;
> break;
> + default:
> + BUG();
This is guest reachable.
But the more I think about it, the more I'm not sure this logic is
appropriate to begin with. I think it needs deleting for the same
reasons as the directmap cacheability logic needed deleting in XSA-402.
~Andrew