Re: [RFCv2 14/16] KVM: Handle protected memory in __kvm_map_gfn()/__kvm_unmap_gfn()

From: Kirill A. Shutemov
Date: Thu Oct 22 2020 - 08:07:58 EST


On Thu, Oct 22, 2020 at 05:26:47AM +0200, Halil Pasic wrote:
> On Tue, 20 Oct 2020 09:18:57 +0300
> "Kirill A. Shutemov" <kirill@xxxxxxxxxxxxx> wrote:
>
> > We cannot access protected pages directly. Use ioremap() to
> > create a temporary mapping of the page. The mapping is destroyed
> > on __kvm_unmap_gfn().
> >
> > The new interface gfn_to_pfn_memslot_protected() is used to detect if
> > the page is protected.
> >
> > ioremap_cache_force() is a hack to bypass IORES_MAP_SYSTEM_RAM check in
> > the x86 ioremap code. We need a better solution.
> >
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> > ---
> > arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 +-
> > arch/powerpc/kvm/book3s_64_mmu_radix.c | 2 +-
> > arch/x86/include/asm/io.h | 2 +
> > arch/x86/include/asm/pgtable_types.h | 1 +
> > arch/x86/kvm/mmu/mmu.c | 6 ++-
> > arch/x86/mm/ioremap.c | 16 ++++++--
> > include/linux/kvm_host.h | 3 +-
> > include/linux/kvm_types.h | 1 +
> > virt/kvm/kvm_main.c | 52 +++++++++++++++++++-------
> > 9 files changed, 63 insertions(+), 22 deletions(-)
> >
>
> You declare ioremap_cache_force() arch/x86/include/asm/io.h in and
> define it in arch/x86/mm/ioremap.c which is architecture specific code,
> but use it in __kvm_map_gfn() in virt/kvm/kvm_main.c which is common
> code.
>
> Thus your series breaks the build for the s390 architecture. Have you
> tried to (cross) compile for s390?

Obviously not. I've got reports already from 0day and going to fix it.

Thanks.

--
Kirill A. Shutemov