On 10.06.2024 16:58, Jan Beulich wrote:
> mfn_valid() is RAM-focused; it will often return false for MMIO. Yet
> access to actual MMIO space should not generally be restricted to UC
> only; especially video frame buffer accesses are unduly affected by such
> a restriction. Permit PAT use for directly assigned MMIO as long as the
> domain is known to have been granted some level of cache control.
>
> Signed-off-by: Jan Beulich <[email protected]>
> ---
> Considering that we've just declared PVH Dom0 "supported", this may well
> qualify for 4.19. The issue was specifically very noticable there.
Actually - meant to Cc Oleksii for this, and then forgot.
Jan
> The conditional may be more complex than really necessary, but it's in
> line with what we do elsewhere. And imo better continue to be a little
> too restrictive, than moving to too lax.
>
> --- a/xen/arch/x86/mm/p2m-ept.c
> +++ b/xen/arch/x86/mm/p2m-ept.c
> @@ -503,7 +503,8 @@ int epte_get_entry_emt(struct domain *d,
>
> if ( !mfn_valid(mfn) )
> {
> - *ipat = true;
> + *ipat = type != p2m_mmio_direct ||
> + (!is_iommu_enabled(d) && !cache_flush_permitted(d));
> return X86_MT_UC;
> }
>