From patchwork Mon Oct 26 09:51:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 11856241 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57415C388F9 for ; Mon, 26 Oct 2020 09:53:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EF3102087C for ; Mon, 26 Oct 2020 09:53:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jMNV0/Ow"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="WD43U8rq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF3102087C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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=3bFA4ojyh1EZWPDLzSlxBmh0qusTq6VYyKkhLvJ858c=; b=jMNV0/Ow34Wa9IkoblbGgd8V9L /nRIQXWnkGujwnfR4viKeQq5NjzlZlQqnArIWgOtQGYCC1JDKxfKsfis1ewhgHpibR+HIi8Fv4vMK En4HJMNxq6ov9+eD0cNoxvPNvdB5cs4ZQ6TpFU5LEVMdecHeXqTfttOH6rQcolgSEh9ndgPFnn5Zk JjTWsOUJDS2b52Rx3PsO8C6mGCDatUjKahXOwXPOZjhXisQ3mP56LFG9bgQM8bng7j0Gmabkkbhkc eJSMU5mSFil9e/fMvdCKPIfkZDWRFeyk9Dln9691ENPPXWrbh/dyRuwu5IXacNPhoEBucORllvddF I15SMwqg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kWzA8-0002ra-Qm; Mon, 26 Oct 2020 09:51:36 +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 1kWzA5-0002pE-52 for linux-arm-kernel@lists.infradead.org; Mon, 26 Oct 2020 09:51:34 +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 612A020704; Mon, 26 Oct 2020 09:51:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603705891; bh=/871FOVPW0E/2Dr2XjwHcJP0LUAoYcByZt/uNRRFF80=; h=From:To:Cc:Subject:Date:From; b=WD43U8rqPf0syvCAvMG/IcVDofcUUOS/TFk/pC+UizH/0Db318ZDt6vTVU2Rcgkv4 RlXt5wfgwCzqZ/XR+pQ9VcsifQtS4beZLAqrCNp3Z0rYfOSU4iZlofTv3hbplAoCyg aEXqP4KK1OlZD/ToX3ZQIuATp44SZNTLU4S1npGQ= 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 1kWzA1-004HZn-7b; Mon, 26 Oct 2020 09:51:29 +0000 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH 0/8] KVM: arm64: Host EL2 entry improvements Date: Mon, 26 Oct 2020 09:51:08 +0000 Message-Id: <20201026095116.72051-1-maz@kernel.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, ascull@google.com, will@kernel.org, qperret@google.com, 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-20201026_055133_292860_2AA253E6 X-CRM114-Status: GOOD ( 14.92 ) 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: Quentin Perret , kernel-team@android.com, Suzuki K Poulose , James Morse , Andrew Scull , Will Deacon , Julien Thierry Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This small series reworks various bits of the host EL2 entry after Andrew's extensive rework to move from direct function calls to a SMCCC implementation. The first 3 patches are plain bug fixes, and candidates for immediate merge into 5.10. The following 2 patches allow the use of direct function pointers at EL2, something that we can't do at the moment (other than PC-relative addressing). This requires a helper to translate pointers at runtime, but the result is neat enough. This allows the rewrite of the host HVC handling in a more maintainable way. A similar patch removes the direct use of kimage_voffset, which we won't be able to trust for much longer. The last two patches are just cleanups and optimisations. Patches on top of 5.10-rc1. Marc Zyngier (8): KVM: arm64: Don't corrupt tpidr_el2 on failed HVC call KVM: arm64: Remove leftover kern_hyp_va() in nVHE TLB invalidation KVM: arm64: Drop useless PAN setting on host EL1 to EL2 transition KVM: arm64: Add kimg_hyp_va() helper KVM: arm64: Turn host HVC handling into a dispatch table KVM: arm64: Patch kimage_voffset instead of loading the EL1 value KVM: arm64: Simplify __kvm_enable_ssbs() KVM: arm64: Avoid repetitive stack access on host EL1 to EL2 exception arch/arm64/include/asm/kvm_asm.h | 2 - arch/arm64/include/asm/kvm_mmu.h | 16 ++ arch/arm64/include/asm/sysreg.h | 1 + arch/arm64/kernel/image-vars.h | 5 +- arch/arm64/kvm/hyp/nvhe/host.S | 14 +- arch/arm64/kvm/hyp/nvhe/hyp-init.S | 23 ++- arch/arm64/kvm/hyp/nvhe/hyp-main.c | 231 +++++++++++++++++----------- arch/arm64/kvm/hyp/nvhe/sysreg-sr.c | 11 -- arch/arm64/kvm/hyp/nvhe/tlb.c | 1 - arch/arm64/kvm/va_layout.c | 56 +++++++ 10 files changed, 236 insertions(+), 124 deletions(-)