Re: [RFC PATCH 08/12] vfio/pci: Create host unaccessible dma-buf for private device
From: Xu Yilun
Date: Wed Jan 08 2025 - 23:59:18 EST
On Wed, Jan 08, 2025 at 09:30:26AM -0400, Jason Gunthorpe wrote:
> On Tue, Jan 07, 2025 at 10:27:15PM +0800, Xu Yilun wrote:
> > Add a flag for ioctl(VFIO_DEVICE_BIND_IOMMUFD) to mark a device as
> > for private assignment. For these private assigned devices, disallow
> > host accessing their MMIO resources.
>
> Why? Shouldn't the VMM simply not call mmap? Why does the kernel have
> to enforce this?
MM.. maybe I should not say 'host', instead 'userspace'.
I think the kernel part VMM (KVM) has the responsibility to enforce the
correct behavior of the userspace part VMM (QEMU). QEMU has no way to
touch private memory/MMIO intentionally or accidently. IIUC that's one
of the initiative guest_memfd is introduced for private memory. Private
MMIO follows.
Thanks,
Yilun
>
> Jason