Re: [PATCH v3 2/2] kvm: arm64: set io memory s2 pte as normalnc for vfio pci devices

From: Jason Gunthorpe
Date: Tue Jan 02 2024 - 12:09:51 EST


On Thu, Dec 21, 2023 at 01:19:18PM +0000, Catalin Marinas wrote:

> If we really want to avoid any aliases (though I think we are spending
> too many cycles on something that's not a real issue), the only way is
> to have fd-based mappings in KVM so that there's no VMM alias. After
> that we need to choose between (2) and (3) since the VMM may no longer
> be able to probe the device and figure out which ranges need what
> attributes.

If we use a FD then KVM will be invoking some API on the FD to get the
physical memory addreses and we can have that API also return
information on the allowed memory types.

> > Kinda stinks to make the VMM aware of the device, but IMO it is a
> > fundamental limitation of the way we back memslots right now.
>
> As I mentioned above, the limitation may be more complex if the
> intra-BAR attributes are not something readily available in the device
> documentation. Maybe Jason or Ankit can shed some light here: are those
> intra-BAR ranges configurable by the (guest) driver or they are already
> pre-configured by firmware and the driver only needs to probe them?

Configured by the guest on the fly, on a page by page basis.

There is no way for the VMM to pre-predict what memory type the VM
will need. The VM must be in control of this.

Jason