From mboxrd@z Thu Jan 1 00:00:00 1970 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 65989C00A89 for ; Mon, 2 Nov 2020 16:43:14 +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 1A2B422268 for ; Mon, 2 Nov 2020 16:43:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iNXBuSNU"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="Qj/OZTxA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A2B422268 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=dKAjwSm0KmuMJ3d2xrwwzj0IptIh8IEe4XiOK7R86D4=; b=iNXBuSNUJMcyUHZuwJFSQ+9wgl ZKoK1x41ZkxXr2K/jTDiG0CVGCMcr8HzQp0yRzUoEgD/iLYXtVoLn9DgzYoHmBOJDfY1zgNTZmrBV FybunTjE/4Z/On9dQDYGa6wQtW5j13tL+DucXxbDyDyl9bRjJcExWkq5sWJbVPDHVyQNeQpQIO8tw mcO6qu/p8XbKb8qnFthDA+eNI/B9tNdD2qW/BKPO9EikVIGESXXP6wsTfhNK/dBf4o+SKqkBvvEx1 vkjWwZLyJJnS7CrlM9iJZs4ne5qiJPvWds0tv/rmbZMaN92JoI+KRmbP7VjedpNAGs2y0BwJfY7wO 2be0LTVQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZctU-0004kw-4S; Mon, 02 Nov 2020 16:41:20 +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 1kZctH-0004fa-Gb for linux-arm-kernel@lists.infradead.org; Mon, 02 Nov 2020 16:41:13 +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 17E3922268; Mon, 2 Nov 2020 16:41:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604335266; bh=AKPTmBGR7HuRbCkpQNhVUn0IRnXZ4Ipp9VnCLd/kbeU=; h=From:To:Cc:Subject:Date:From; b=Qj/OZTxAc30QiBiKK/EZhveb4AH0QEhPqr4AgVDoped/9mrL2fy4eoZIP9V1JWlJ0 tD6uttPP/+96AoGx9aIKoD1voLp09oBoeBYbnSOiCW1j3xcJegIFOu90YQS6292v/t 4Po2VAKF5dYsR7qgf1nOF1j3Mxdql6uEMpcHp4DM= 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 1kZctD-006jJf-VL; Mon, 02 Nov 2020 16:41:04 +0000 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH v2 00/11] KVM: arm64: Move PC/ELR/SPSR/PSTATE updatess to EL2 Date: Mon, 2 Nov 2020 16:40:34 +0000 Message-Id: <20201102164045.264512-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, mark.rutland@arm.com, qperret@google.com, dbrazdil@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-20201102_114107_730892_9A767CAB X-CRM114-Status: GOOD ( 17.19 ) 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: Mark Rutland , Suzuki K Poulose , kernel-team@android.com, Quentin Perret , James Morse , Andrew Scull , David Brazdil , Will Deacon , Julien Thierry Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org As we progress towards being able to keep the guest state private to the nVHE hypervisor, this series aims at moving anything that touches the registers involved into an exception to EL2. The general idea is that any update to these registers is driven by a set of flags passed from EL1 to EL2, and EL2 will deal with the register update itself, removing the need for EL1 to see the guest state. It also results in a bunch of cleanup, mostly in the 32bit department (negative diffstat, yay!). Of course, none of that has any real effect on security yet. It is only once we start having a private VCPU structure at EL2 that we can enforce the isolation. Similarly, there is no policy enforcement, and a malicious EL1 can still inject exceptions at random points. It can also give bogus ESR values to the guest. Baby steps. M. * From v1 [1] - Fix __kvm_skip_instr() unexpected recursion - Fix HVC fixup updating the in-memory state instead of the guest's - Dropped facilities for IRQ/FIQ/SError exception injection - Simplified VHE/nVHE differences in exception injection - Moved AArch32 exception injection over to AArch64 sysregs - Use compat_lr_* instead of hardcoded registers - Schpelling fyxes [1] https://lore.kernel.org/r/20201026133450.73304-1-maz@kernel.org Marc Zyngier (11): KVM: arm64: Don't adjust PC on SError during SMC trap KVM: arm64: Move kvm_vcpu_trap_il_is32bit into kvm_skip_instr32() KVM: arm64: Make kvm_skip_instr() and co private to HYP KVM: arm64: Move PC rollback on SError to HYP KVM: arm64: Move VHE direct sysreg accessors into kvm_host.h KVM: arm64: Add basic hooks for injecting exceptions from EL2 KVM: arm64: Inject AArch64 exceptions from HYP KVM: arm64: Inject AArch32 exceptions from HYP KVM: arm64: Remove SPSR manipulation primitives KVM: arm64: Consolidate exception injection KVM: arm64: Get rid of the AArch32 register mapping code arch/arm64/include/asm/kvm_emulate.h | 70 +---- arch/arm64/include/asm/kvm_host.h | 118 +++++++- arch/arm64/kvm/Makefile | 4 +- arch/arm64/kvm/aarch32.c | 232 --------------- arch/arm64/kvm/guest.c | 28 +- arch/arm64/kvm/handle_exit.c | 23 +- arch/arm64/kvm/hyp/aarch32.c | 4 +- arch/arm64/kvm/hyp/exception.c | 331 +++++++++++++++++++++ arch/arm64/kvm/hyp/include/hyp/adjust_pc.h | 62 ++++ arch/arm64/kvm/hyp/include/hyp/switch.h | 17 ++ arch/arm64/kvm/hyp/nvhe/Makefile | 2 +- arch/arm64/kvm/hyp/nvhe/switch.c | 3 + arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c | 2 + arch/arm64/kvm/hyp/vgic-v3-sr.c | 2 + arch/arm64/kvm/hyp/vhe/Makefile | 2 +- arch/arm64/kvm/hyp/vhe/switch.c | 3 + arch/arm64/kvm/inject_fault.c | 189 +++++------- arch/arm64/kvm/mmio.c | 2 +- arch/arm64/kvm/mmu.c | 2 +- arch/arm64/kvm/regmap.c | 224 -------------- arch/arm64/kvm/sys_regs.c | 83 +----- 21 files changed, 666 insertions(+), 737 deletions(-) delete mode 100644 arch/arm64/kvm/aarch32.c create mode 100644 arch/arm64/kvm/hyp/exception.c create mode 100644 arch/arm64/kvm/hyp/include/hyp/adjust_pc.h delete mode 100644 arch/arm64/kvm/regmap.c -- 2.28.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel