On Mon, Sep 11, 2023 at 11:16:30AM +0900, David Stevens wrote: > From: David Stevens <stevensd@xxxxxxxxxxxx> > > This patch series adds support for mapping VM_IO and VM_PFNMAP memory > that is backed by struct pages that aren't currently being refcounted > (e.g. tail pages of non-compound higher order allocations) into the > guest. > > Our use case is virtio-gpu blob resources [1], which directly map host > graphics buffers into the guest as "vram" for the virtio-gpu device. > This feature currently does not work on systems using the amdgpu driver, > as that driver allocates non-compound higher order pages via > ttm_pool_alloc_page. > > First, this series replaces the __gfn_to_pfn_memslot API with a more > extensible __kvm_faultin_pfn API. The updated API rearranges > __gfn_to_pfn_memslot's args into a struct and where possible packs the > bool arguments into a FOLL_ flags argument. The refactoring changes do > not change any behavior. Instead of adding hacks to kvm you really should fix the driver / TTM to not do weird memory allocations.