Re: [PATCH v2 16/20] vfio/cxl: Register regions with VFIO layer
From: Jason Gunthorpe
Date: Mon Apr 06 2026 - 18:11:01 EST
On Sat, Apr 04, 2026 at 12:36:53PM -0700, Dan Williams wrote:
> Then I assume it matters that memremap() sometimes silently falls back
> to the direct map. The "VFIO owns" expectation needs to guard against
> some helpful platform firmware mapping accelerator memory as System RAM.
I don't think how memremap works under the covers matters to vfio, it
takes in a phys_addr_t an gives back a KVA that is cachable kernel
memory.
We just have to be mindful to not allow mismatched attributes on
virtual aliases.
> At a minimum having VFIO fail to map in that case helps with the
> argument I have been making that "no, EFI_CONVENTIONAL_MEMORY type +
> EFI_SPECIFIC_PURPOSE flag" is not suitable for accelerators with private
> CXL memory. Those want to be enforcing "EFI_RESERVED".
Certainly it should fail the request region if something else is using
it, so if those EFI flags plug it into the mm and it is plugged when
VFIO starts then it should stop.
The direct map isn't really "plugged into the mm" but it does raise
the mismatched attributed issue.
Jason