mbox series

[00/23] KVM: PPC: BOok3S HV: Support for nested HPT guests

Message ID 20190826062109.7573-1-sjitindarsingh@gmail.com
Headers show
Series KVM: PPC: BOok3S HV: Support for nested HPT guests | expand

Message

Suraj Jitindar Singh Aug. 26, 2019, 6:20 a.m. UTC
This patch series adds support for running a nested kvm guest which uses the hpt
(hash page table) mmu type.

Patch series based on v5.3-rc6.

The first 8 patches in this series enable a radix guest (L1) running under a
radix hypervisor (L0) to act as a guest hypervisor for it's own nested (L2)
guest where the nested guest is using hash page table translation. This mainly
involved ensuring that the guest hypervisor uses the new run_single_vcpu()
entry path and ensuring that the appropriate functions which are normally
called in the real mode entry path in book3s_hv_rmhandlers.S are called on the
new virtual mode entry path when a hpt guest is being run.

The remainder of the patches enable a (L0) hypervisor to perform hash page
table translation for a nested (L2) hpt guest which is running under one of
it's radix (L1) it's which is acting as a guest hypervisor. This primarily
required changes to the nested guest entry patch to ensure that a shadow hpt
would be allocated for the nested hpt guest, that the slb was context switched
and that the real mode entry path in book3s_hv_rmhandlers.S could be used to
enter/exit a nested hpt guest.

It was also necessary to be able to create translations by inserting ptes into
the shadow page table which provided the combination of the translation from L2
virtual address to L1 guest physical address and the translation from L1 guest
physical address to L0 host real address. Additionally invalidations of these
translations need to be handled at both levels, by L1 via the H_TLB_INVALIDATE
hcall to invalidate a L2 virtual address to L1 guest physical address
translation, and by L0 when paging out a L1 guest page which had been
subsequently mapped through to L2 thus invalidating the L1 guest physical
address to L0 host real address translation.

Still lacking support for:
Passthrough of emulated mmio devices to nested hpt guests since the current
method of reading nested guest memory relies on using quadrants which are only
available when using radix translation.

Paul Mackerras (1):
  KVM: PPC: Book3S HV: Use __gfn_to_pfn_memslot in HPT page fault
    handler

Suraj Jitindar Singh (22):
  KVM: PPC: Book3S HV: Increment mmu_notifier_seq when modifying radix
    pte rc bits
  KVM: PPC: Book3S HV: Nested: Don't allow hash guests to run nested
    guests
  KVM: PPC: Book3S HV: Handle making H_ENTER_NESTED hcall in a separate
    function
  KVM: PPC: Book3S HV: Enable calling kvmppc_hpte_hv_fault in virtual
    mode
  KVM: PPC: Book3S HV: Allow hpt manipulation hcalls to be called in
    virtual mode
  KVM: PPC: Book3S HV: Make kvmppc_invalidate_hpte() take lpid not a kvm
    struct
  KVM: PPC: Book3S HV: Nested: Allow pseries hypervisor to run hpt
    nested guest
  KVM: PPC: Book3S HV: Nested: Improve comments and naming of nest rmap
    functions
  KVM: PPC: Book3S HV: Nested: Increase gpa field in nest rmap to 46
    bits
  KVM: PPC: Book3S HV: Nested: Remove single nest rmap entries
  KVM: PPC: Book3S HV: Nested: add kvmhv_remove_all_nested_rmap_lpid()
  KVM: PPC: Book3S HV: Nested: Infrastructure for nested hpt guest setup
  KVM: PPC: Book3S HV: Nested: Context switch slb for nested hpt guest
  KVM: PPC: Book3S HV: Store lpcr and hdec_exp in the vcpu struct
  KVM: PPC: Book3S HV: Nested: Make kvmppc_run_vcpu() entry path nested
    capable
  KVM: PPC: Book3S HV: Nested: Rename kvmhv_xlate_addr_nested_radix
  KVM: PPC: Book3S HV: Separate out hashing from
    kvmppc_hv_find_lock_hpte()
  KVM: PPC: Book3S HV: Nested: Implement nested hpt mmu translation
  KVM: PPC: Book3S HV: Nested: Handle tlbie hcall for nested hpt guest
  KVM: PPC: Book3S HV: Nested: Implement nest rmap invalidations for hpt
    guests
  KVM: PPC: Book3S HV: Nested: Enable nested hpt guests
  KVM: PPC: Book3S HV: Add nested hpt pte information to debugfs

 arch/powerpc/include/asm/book3s/64/mmu-hash.h |   15 +
 arch/powerpc/include/asm/book3s/64/mmu.h      |    9 +
 arch/powerpc/include/asm/hvcall.h             |   36 -
 arch/powerpc/include/asm/kvm_asm.h            |    5 +
 arch/powerpc/include/asm/kvm_book3s.h         |   30 +-
 arch/powerpc/include/asm/kvm_book3s_64.h      |   87 +-
 arch/powerpc/include/asm/kvm_host.h           |   57 +
 arch/powerpc/include/asm/kvm_ppc.h            |    5 +-
 arch/powerpc/kernel/asm-offsets.c             |    5 +
 arch/powerpc/kvm/book3s.c                     |    1 +
 arch/powerpc/kvm/book3s_64_mmu_hv.c           |  136 ++-
 arch/powerpc/kvm/book3s_64_mmu_radix.c        |  167 +--
 arch/powerpc/kvm/book3s_hv.c                  |  327 ++++--
 arch/powerpc/kvm/book3s_hv_builtin.c          |   33 +-
 arch/powerpc/kvm/book3s_hv_interrupts.S       |   25 +-
 arch/powerpc/kvm/book3s_hv_nested.c           | 1381 ++++++++++++++++++++++---
 arch/powerpc/kvm/book3s_hv_rm_mmu.c           |  298 ++++--
 arch/powerpc/kvm/book3s_hv_rmhandlers.S       |  126 ++-
 arch/powerpc/kvm/book3s_xive.h                |   15 +
 arch/powerpc/kvm/powerpc.c                    |    3 +-
 20 files changed, 2136 insertions(+), 625 deletions(-)