From patchwork Wed Oct 10 05:55:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Mackerras X-Patchwork-Id: 10633957 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AAA66112B for ; Wed, 10 Oct 2018 05:55:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BF4C29AD0 for ; Wed, 10 Oct 2018 05:55:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A19029AD4; Wed, 10 Oct 2018 05:55:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4CEA29AD0 for ; Wed, 10 Oct 2018 05:55:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726752AbeJJNQZ (ORCPT ); Wed, 10 Oct 2018 09:16:25 -0400 Received: from ozlabs.org ([203.11.71.1]:38649 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726153AbeJJNQZ (ORCPT ); Wed, 10 Oct 2018 09:16:25 -0400 Received: by ozlabs.org (Postfix, from userid 1003) id 42VNcj712Bz9s8r; Wed, 10 Oct 2018 16:55:49 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1539150949; bh=R1rU+ZO/TKLUlI3dPV4+CQY6kC/ld/FlZhZ4mW90x78=; h=Date:From:To:Cc:Subject:From; b=KSahC4aC8yPncTRIltuO4VlvNVz5rHGtfoyaLM5iC+NZl3RWxSQMZuFAuk7KXxo96 cW5uiXAHG86KkacuUOPvLJHH8wv4ukdXOtYUmRrs3HXYGAgOEyWCUOefkJ7CrCGXl0 6g24viFdq1e6BulxQmfCrSAwwsd1lgFeLCGMfWeWo7bvE3YgUiZcM8wlejUxWUFLEf sEiZ4UYDZRUAhyTj0Vx0cEg4Yqiu1S7In7CJwNuD14jQT/nYJpS2pTdvtkrmoEO/bQ 6mCyzV+frVoEjK4M/WLf/D/qJ/8YPzS8+/IO2tD7GTqfZ8b7W1I7pXkx6iYZL7cYCM FLKItxYwMenxQ== Date: Wed, 10 Oct 2018 16:55:43 +1100 From: Paul Mackerras To: Paolo Bonzini , Radim =?utf-8?b?S3LEjW3DocWZ?= , kvm@vger.kernel.org Cc: kvm-ppc@vger.kernel.org, David Gibson Subject: [GIT PULL] Please pull my kvm-ppc-next-4.20-1 tag Message-ID: <20181010055543.GA31486@fergus> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Paolo or Radim, Please do a pull from my kvm-ppc-next-4.20-1 tag to get a PPC KVM update for 4.20. There is one big new feature here, which is nested virtualization support for radix guests on POWER9, plus a few other fixes and improvements. A lot of the commits here are also going to be merged in the powerpc tree via the topic/ppc-kvm branch, in order to reduce conflicts between the powerpc tree and the kvm tree. Stephen Rothwell noted that there is a conflict between my kvm-ppc-next tree and the kvm-arm tree, in that we have both allocated the next free capability number (160). It would be nice to get a stable allocation for the new capability that I need (one which reports/enables nested virtualization support for the HV KVM module) so that the necessary QEMU patches can be submitted. Thanks, Paul. The following changes since commit dd5bd0a65ff6f22a32b35ca3fa1bcf7a6bc7104f: Merge tag 'kvm-s390-next-4.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD (2018-10-04 17:12:45 +0200) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc tags/kvm-ppc-next-4.20-1 for you to fetch changes up to 901f8c3f6feb0225c14b3bc6237850fb921d2f2d: KVM: PPC: Book3S HV: Add NO_HASH flag to GET_SMMU_INFO ioctl result (2018-10-09 16:14:54 +1100) ---------------------------------------------------------------- PPC KVM update for 4.20. The major new feature here is nested HV KVM support. This allows the HV KVM module to load inside a radix guest on POWER9 and run radix guests underneath it. These nested guests can run in supervisor mode and don't require any additional instructions to be emulated, unlike with PR KVM, and so performance is much better than with PR KVM, and is very close to the performance of a non-nested guest. A nested hypervisor (a guest with nested guests) can be migrated to another host and will bring all its nested guests along with it. A nested guest can also itself run guests, and so on down to any desired depth of nesting. Apart from that there are a series of updates for IOMMU handling from Alexey Kardashevskiy, a "one VM per core" mode for HV KVM for security-paranoid applications, and a small fix for PR KVM. ---------------------------------------------------------------- Alexey Kardashevskiy (5): KVM: PPC: Validate all tces before updating tables KVM: PPC: Inform the userspace about TCE update failures KVM: PPC: Validate TCEs against preregistered memory page sizes KVM: PPC: Propagate errors to the guest when failed instead of ignoring KVM: PPC: Remove redundand permission bits removal Cameron Kaiser (1): KVM: PPC: Book3S PR: Exiting split hack mode needs to fixup both PC and LR Michael Ellerman (1): Merge branch 'kvm-ppc-fixes' of paulus/powerpc into topic/ppc-kvm Paul Mackerras (26): KVM: PPC: Book3S HV: Provide mode where all vCPUs on a core must be the same VM powerpc: Turn off CPU_FTR_P9_TM_HV_ASSIST in non-hypervisor mode KVM: PPC: Book3S: Simplify external interrupt handling KVM: PPC: Book3S HV: Remove left-over code in XICS-on-XIVE emulation KVM: PPC: Book3S HV: Move interrupt delivery on guest entry to C code KVM: PPC: Book3S HV: Extract PMU save/restore operations as C-callable functions KVM: PPC: Book3S HV: Simplify real-mode interrupt handling KVM: PPC: Book3S: Rework TM save/restore code and make it C-callable KVM: PPC: Book3S HV: Call kvmppc_handle_exit_hv() with vcore unlocked KVM: PPC: Book3S HV: Streamlined guest entry/exit path on P9 for radix guests KVM: PPC: Book3S HV: Handle hypervisor instruction faults better KVM: PPC: Book3S HV: Add a debugfs file to dump radix mappings KVM: PPC: Use ccr field in pt_regs struct embedded in vcpu struct KVM: PPC: Book3S HV: Use kvmppc_unmap_pte() in kvm_unmap_radix() KVM: PPC: Book3S HV: Framework and hcall stubs for nested virtualization KVM: PPC: Book3S HV: Nested guest entry via hypercall KVM: PPC: Book3S HV: Use XICS hypercalls when running as a nested hypervisor KVM: PPC: Book3S HV: Handle hypercalls correctly when nested KVM: PPC: Book3S HV: Use hypercalls for TLB invalidation when nested KVM: PPC: Book3S HV: Don't access HFSCR, LPIDR or LPCR when running nested KVM: PPC: Book3S HV: Add one-reg interface to virtual PTCR register KVM: PPC: Book3S HV: Allow HV module to load without hypervisor mode KVM: PPC: Book3S HV: Add nested shadow page tables to debugfs Merge remote-tracking branch 'remotes/powerpc/topic/ppc-kvm' into kvm-ppc-next KVM: PPC: Book3S HV: Add a VM capability to enable nested virtualization KVM: PPC: Book3S HV: Add NO_HASH flag to GET_SMMU_INFO ioctl result Suraj Jitindar Singh (9): KVM: PPC: Book3S HV: Clear partition table entry on vm teardown KVM: PPC: Book3S HV: Make kvmppc_mmu_radix_xlate process/partition table agnostic KVM: PPC: Book3S HV: Refactor radix page fault handler KVM: PPC: Book3S HV: Handle page fault for a nested guest KVM: PPC: Book3S HV: Introduce rmap to track nested guest mappings KVM: PPC: Book3S HV: Implement H_TLB_INVALIDATE hcall KVM: PPC: Book3S HV: Invalidate TLB when nested vcpu moves physical cpu KVM: PPC: Book3S HV: Sanitise hv_regs on nested guest entry KVM: PPC: Book3S HV: Handle differing endianness for H_ENTER_NESTED Documentation/virtual/kvm/api.txt | 19 + arch/powerpc/include/asm/asm-prototypes.h | 21 + arch/powerpc/include/asm/book3s/64/mmu-hash.h | 12 + .../powerpc/include/asm/book3s/64/tlbflush-radix.h | 1 + arch/powerpc/include/asm/hvcall.h | 41 + arch/powerpc/include/asm/kvm_asm.h | 4 +- arch/powerpc/include/asm/kvm_book3s.h | 45 +- arch/powerpc/include/asm/kvm_book3s_64.h | 118 +- arch/powerpc/include/asm/kvm_book3s_asm.h | 3 + arch/powerpc/include/asm/kvm_booke.h | 4 +- arch/powerpc/include/asm/kvm_host.h | 16 +- arch/powerpc/include/asm/kvm_ppc.h | 8 +- arch/powerpc/include/asm/ppc-opcode.h | 1 + arch/powerpc/include/asm/reg.h | 2 + arch/powerpc/include/uapi/asm/kvm.h | 1 + arch/powerpc/kernel/asm-offsets.c | 5 +- arch/powerpc/kernel/cpu_setup_power.S | 4 +- arch/powerpc/kvm/Makefile | 3 +- arch/powerpc/kvm/book3s.c | 46 +- arch/powerpc/kvm/book3s_64_mmu_hv.c | 7 +- arch/powerpc/kvm/book3s_64_mmu_radix.c | 718 ++++++++--- arch/powerpc/kvm/book3s_64_vio.c | 89 +- arch/powerpc/kvm/book3s_64_vio_hv.c | 81 +- arch/powerpc/kvm/book3s_emulate.c | 13 +- arch/powerpc/kvm/book3s_hv.c | 864 ++++++++++++- arch/powerpc/kvm/book3s_hv_builtin.c | 92 +- arch/powerpc/kvm/book3s_hv_interrupts.S | 95 +- arch/powerpc/kvm/book3s_hv_nested.c | 1291 ++++++++++++++++++++ arch/powerpc/kvm/book3s_hv_ras.c | 10 + arch/powerpc/kvm/book3s_hv_rm_xics.c | 13 +- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 823 +++++++------ arch/powerpc/kvm/book3s_hv_tm.c | 6 +- arch/powerpc/kvm/book3s_hv_tm_builtin.c | 5 +- arch/powerpc/kvm/book3s_pr.c | 5 +- arch/powerpc/kvm/book3s_xics.c | 14 +- arch/powerpc/kvm/book3s_xive.c | 63 + arch/powerpc/kvm/book3s_xive_template.c | 8 - arch/powerpc/kvm/bookehv_interrupts.S | 8 +- arch/powerpc/kvm/emulate_loadstore.c | 1 - arch/powerpc/kvm/powerpc.c | 15 +- arch/powerpc/kvm/tm.S | 250 ++-- arch/powerpc/kvm/trace_book3s.h | 1 - arch/powerpc/mm/tlb-radix.c | 9 + include/uapi/linux/kvm.h | 2 + tools/perf/arch/powerpc/util/book3s_hv_exits.h | 1 - 45 files changed, 3933 insertions(+), 905 deletions(-) create mode 100644 arch/powerpc/kvm/book3s_hv_nested.c