From patchwork Fri Feb 12 14:36:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 1439865 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=eu1nPWap; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dcbgm1W9Xz9sS8 for ; Sat, 13 Feb 2021 01:37:40 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=qCrPcwRrHYUY0h3owZz6Or7a16xunHAfFmr5dyTQWMM=; b=eu1nPWapVF5CvuQvvyj1eKhMbz ear2M0HRWgbzC+EGwzuXrCNxKFzlGHj9a34ORSEnUQnvZNPLIRsy1pmXGSZLD9hOKk/JtkSFvUbbe 0kZz81N0PRxUfGcgtACv/ntXSSKKWn/H1OHXK1vWlYNw+WQS+rscMzpOtbuboA0VcBGyGBXU6w69j 3z/7KS0sNSWhASEMT5mG1fRozDUSVlcqrrBunghEeCNMj8Q/LMc/le8+LLy8NyerJYjWrKFvFC6eB WEhojF/g2fZ8cqdYyOaeB+UCPx4pU1fGs4EqlgW51nxThs04tSnvlkgDPQYq03rL5KTrJ2MKmR/tm Um+QtbCw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAZZP-0004SG-TO; Fri, 12 Feb 2021 14:37:19 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAZZN-0004Rc-0Q for linux-arm-kernel@lists.infradead.org; Fri, 12 Feb 2021 14:37:18 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0E7CB64DD9; Fri, 12 Feb 2021 14:37:15 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1lAZZJ-00DqME-4c; Fri, 12 Feb 2021 14:37:13 +0000 From: Marc Zyngier To: Paolo Bonzini Subject: [GIT PULL] KVM/arm64 updates for 5.12 Date: Fri, 12 Feb 2021 14:36:57 +0000 Message-Id: <20210212143657.3312035-1-maz@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: pbonzini@redhat.com, alexandru.elisei@arm.com, ascull@google.com, ardb@kernel.org, dbrazdil@google.com, eric.auger@redhat.com, qperret@google.com, will@kernel.org, wangyanan55@huawei.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210212_093717_200565_92F3FECC X-CRM114-Status: GOOD ( 20.77 ) X-Spam-Score: -5.0 (-----) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-5.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [198.145.29.99 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, kernel-team@android.com, kvm@vger.kernel.org, Quentin Perret , Will Deacon , Suzuki K Poulose , kvmarm@lists.cs.columbia.edu, Yanan Wang , Eric Auger , James Morse , Andrew Scull , David Brazdil , Alexandru Elisei , Ard Biesheuvel , Julien Thierry Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org Hi Paolo, Here's the initial set of KVM/arm64 updates for 5.11. The most notable change this time is David's work to finally build the nVHE EL2 object as a relocatable object. This makes the code a lot cleaner, more reliable (we don't have to assume things about code generation), and allows... function pointers, with any ugly hack! Progress, at last, and a huge thank you to David! We also gained support for the new TRNG standard hypercall, and a nice optimisation for concurrent translation faults targeting the same page. The rest is a small batch of fixes and other cleanups. Note that there is another bunch of changes indirectly affecting KVM/arm64 that are routed via the arm64 tree, as we turn upside down the way we boot Linux on a VHE system. It's all good fun. This pull request also comes with strings attached: - the kvmarm-fixes-5.11-2 tag in order to avoid ugly conflicts, which explains a sense of déjà-vu in the short-log below - the arm64/for-next/misc branch because of dependencies Please pull, M. The following changes since commit 19c329f6808995b142b3966301f217c831e7cf31: Linux 5.11-rc4 (2021-01-17 16:37:05 -0800) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git tags/kvmarm-5.12 for you to fetch changes up to c93199e93e1232b7220482dffa05b7a32a195fe8: Merge branch 'kvm-arm64/pmu-debug-fixes-5.11' into kvmarm-master/next (2021-02-12 14:08:41 +0000) ---------------------------------------------------------------- KVM/arm64 updates for Linux 5.12 - Make the nVHE EL2 object relocatable, resulting in much more maintainable code - Handle concurrent translation faults hitting the same page in a more elegant way - Support for the standard TRNG hypervisor call - A bunch of small PMU/Debug fixes - Allow the disabling of symbol export from assembly code - Simplification of the early init hypercall handling ---------------------------------------------------------------- Alexandru Elisei (2): KVM: arm64: Use the reg_to_encoding() macro instead of sys_reg() KVM: arm64: Correct spelling of DBGDIDR register Andrew Scull (1): KVM: arm64: Simplify __kvm_hyp_init HVC detection Ard Biesheuvel (2): firmware: smccc: Add SMCCC TRNG function call IDs KVM: arm64: Implement the TRNG hypervisor call David Brazdil (9): KVM: arm64: Allow PSCI SYSTEM_OFF/RESET to return KVM: arm64: Rename .idmap.text in hyp linker script KVM: arm64: Set up .hyp.rodata ELF section KVM: arm64: Add symbol at the beginning of each hyp section KVM: arm64: Generate hyp relocation data KVM: arm64: Apply hyp relocations at runtime KVM: arm64: Fix constant-pool users in hyp KVM: arm64: Remove patching of fn pointers in hyp KVM: arm64: Remove hyp_symbol_addr Marc Zyngier (20): KVM: arm64: Hide PMU registers from userspace when not available KVM: arm64: Simplify handling of absent PMU system registers arm64: Drop workaround for broken 'S' constraint with GCC 4.9 KVM: arm64: Filter out v8.1+ events on v8.0 HW KVM: Forbid the use of tagged userspace addresses for memslots Merge branch 'arm64/for-next/misc' into kvm-arm64/hyp-reloc KVM: arm64: Make gen-hyprel endianness agnostic KVM: arm64: Fix missing RES1 in emulation of DBGBIDR KVM: arm64: Fix AArch32 PMUv3 capping KVM: arm64: Add handling of AArch32 PCMEID{2,3} PMUv3 registers KVM: arm64: Refactor filtering of ID registers KVM: arm64: Limit the debug architecture to ARMv8.0 KVM: arm64: Upgrade PMU support to ARMv8.4 KVM: arm64: Use symbolic names for the PMU versions Merge tag 'kvmarm-fixes-5.11-2' into kvmarm-master/next Merge branch 'kvm-arm64/misc-5.12' into kvmarm-master/next Merge branch 'kvm-arm64/concurrent-translation-fault' into kvmarm-master/next Merge branch 'kvm-arm64/hyp-reloc' into kvmarm-master/next Merge branch 'kvm-arm64/rng-5.12' into kvmarm-master/next Merge branch 'kvm-arm64/pmu-debug-fixes-5.11' into kvmarm-master/next Quentin Perret (2): asm-generic: export: Stub EXPORT_SYMBOL with __DISABLE_EXPORTS KVM: arm64: Stub EXPORT_SYMBOL for nVHE EL2 code Steven Price (1): KVM: arm64: Compute TPIDR_EL2 ignoring MTE tag Yanan Wang (3): KVM: arm64: Adjust partial code of hyp stage-1 map and guest stage-2 map KVM: arm64: Filter out the case of only changing permissions from stage-2 map path KVM: arm64: Mark the page dirty only if the fault is handled successfully Documentation/virt/kvm/api.rst | 3 + arch/arm64/include/asm/hyp_image.h | 29 +- arch/arm64/include/asm/kvm_asm.h | 26 -- arch/arm64/include/asm/kvm_host.h | 2 + arch/arm64/include/asm/kvm_mmu.h | 61 ++--- arch/arm64/include/asm/kvm_pgtable.h | 5 + arch/arm64/include/asm/sections.h | 3 +- arch/arm64/include/asm/sysreg.h | 3 + arch/arm64/kernel/image-vars.h | 1 - arch/arm64/kernel/smp.c | 4 +- arch/arm64/kernel/vmlinux.lds.S | 18 +- arch/arm64/kvm/Makefile | 2 +- arch/arm64/kvm/arm.c | 10 +- arch/arm64/kvm/hyp/include/hyp/switch.h | 4 +- arch/arm64/kvm/hyp/nvhe/.gitignore | 2 + arch/arm64/kvm/hyp/nvhe/Makefile | 33 ++- arch/arm64/kvm/hyp/nvhe/gen-hyprel.c | 438 +++++++++++++++++++++++++++++++ arch/arm64/kvm/hyp/nvhe/host.S | 29 +- arch/arm64/kvm/hyp/nvhe/hyp-init.S | 19 +- arch/arm64/kvm/hyp/nvhe/hyp-main.c | 11 +- arch/arm64/kvm/hyp/nvhe/hyp-smp.c | 4 +- arch/arm64/kvm/hyp/nvhe/hyp.lds.S | 9 +- arch/arm64/kvm/hyp/nvhe/psci-relay.c | 37 ++- arch/arm64/kvm/hyp/pgtable.c | 83 +++--- arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c | 2 +- arch/arm64/kvm/hypercalls.c | 6 + arch/arm64/kvm/mmu.c | 13 +- arch/arm64/kvm/pmu-emul.c | 24 +- arch/arm64/kvm/sys_regs.c | 178 ++++++++----- arch/arm64/kvm/trng.c | 85 ++++++ arch/arm64/kvm/va_layout.c | 34 ++- include/asm-generic/export.h | 2 +- include/linux/arm-smccc.h | 31 +++ virt/kvm/kvm_main.c | 1 + 34 files changed, 934 insertions(+), 278 deletions(-) create mode 100644 arch/arm64/kvm/hyp/nvhe/gen-hyprel.c create mode 100644 arch/arm64/kvm/trng.c