Re: [RFC PATCH v2 0/3] KVM: allow mapping of compound tail pages for IO or PFNMAP mapping

From: Yan Zhao
Date: Tue Feb 20 2024 - 03:51:31 EST


On Mon, Feb 12, 2024 at 07:07:25PM -0800, Sean Christopherson wrote:
> On Wed, Jan 03, 2024, Yan Zhao wrote:
> > This is a v2 for previous series [1] to allow mapping for compound tail
> > pages for IO or PFNMAP mapping.
> >
> > Compared to v1, this version provides selftest to check functionality in
> > KVM to map memslots for MMIO BARs (VMAs with flag VM_IO | VM_PFNMAP), as
> > requested by Sean in [1].
>
> Doh. So I didn't intend for you to have to create a mock device just to be able
> to run a selftest. I assumed it would be easy-ish to utilize an existing generic
> device. I take it that's not the case?

The selftest requires a vma with flag (VM_IO | VM_PFNMAP) with non-reserved
pages as backend.

Without a mock device, I don't find a easy way to let the selftest take
effect.
So, I borrowed the way in "tools/testing/selftests/mm/hmm-tests.c" which
uses a mock driver in "lib/test_hmm.c".