From patchwork Thu Oct 12 10:41:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10001651 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3DCED60325 for ; Thu, 12 Oct 2017 10:52:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FF2728D6C for ; Thu, 12 Oct 2017 10:52:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2476728D6E; Thu, 12 Oct 2017 10:52:31 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D3A8828D6C for ; Thu, 12 Oct 2017 10:52:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To: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:List-Owner; bh=v3gaRz/Vdlw4GIGQF1UgzieHLlzdLH1RARu72iJJmHE=; b=VOUVD4GXw1DJuxbZpDJOqBPEQB QwODYVhPXVwAIAPvswW4MGhxLgxqpHnYyGEESJDgoO3yJQ/HTPx5YiEsd6h684mPYdNxCwnOai5d4 ndzEobObJLpiJVlA8wJYB37MZlkf96yJdT+4aqII60DhaFuFlA3FYuPFPuGixf1e3WB2o6+E2l154 FOrF0bO0vE8m+VIAnUKgYq0kQQwHczPgEDJwuwuPLWIsbQfY/Veq1qo5L61j5ZyIHDQpceEeAICPi Ztakp5/CFlCMCVteDB7h4Ytdi7VBm06bbss7ZOSICSJiC/RErTSDgwCMLixvhXRAXU23ULTPFoLlM qDOcWc/Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e2b6G-00025y-6X; Thu, 12 Oct 2017 10:52:24 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e2ay0-0000JA-Ob for linux-arm-kernel@bombadil.infradead.org; Thu, 12 Oct 2017 10:43:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=zL6GRDh5mEV/boku0sB15mOQF0+RcsDTRswhmNfIeoU=; b=if9KnLSHqkCkUN7ui31Ukq9C9 gKHaukP/Ti/m2qQ+M5+NT4vLPpcTA2sZEhEPcc8JkdaoA9QXB7krlyYL5vagtr5sBQQ9iPqsQvnId 9aO5+FpJyemuaTsWcA175fcIyDnCfehjiLhYCcJ+rIcOmCu4ChQjVkB9hJ/UF7T8kNW3cqa8SEZjk /a8KwExl0rvve6tTP39MmPpt34ZUhZHxtYsaQLZQ96eFTgWZUGriQDGGD71iLZxFJk32BjM0H5Jjn yHhBKTlxiLPiNr1p6pYHW/V7hAMsmd8qP0ikV3pWm38LKXw5B0D7nj7bnTV7VJC/oS2gOWkHGVhXD deddxYOZA==; Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e2awl-0005KV-Uu for linux-arm-kernel@lists.infradead.org; Thu, 12 Oct 2017 10:42:38 +0000 Received: by mail-wm0-x229.google.com with SMTP id i124so11858982wmf.3 for ; Thu, 12 Oct 2017 03:42:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zL6GRDh5mEV/boku0sB15mOQF0+RcsDTRswhmNfIeoU=; b=kn5i3H/H2VeHPs8mNmiDkre1supw7B8ZMx1M04WSb2uqaXJ6LIFHTSG62B1NUHorda MjGNH915sTZzEjN72V7KbNcspmCCHQcBd6SVFIrLJYkY2P7uK/eBrsKVMRjVuRbipV9L WIwUCL8PA0JwvuONPyWumc/fWncLrWekP06Uk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zL6GRDh5mEV/boku0sB15mOQF0+RcsDTRswhmNfIeoU=; b=en5vwlLDbtpZWTXi1z01yuGUJw51vJKvLcW6HEE0hpCf0TpApBvG369wrOmRDj+R9Y EpaFjnl/swzAuedUd8gqIT08JLe09vFUVlDqvBnef0AhL49livm1iJVzYkp7TeGjJTkx XrMq10FjQvTx+B9wHxsTcH79EYeIYXkt6SIBDb3i5ooVwue6gEwXjsZG+1RbZ229I1rh LcSuZNc+gQ6MxWkzdI6xrSpruoQt9iGbhaykukQZse+Fq1oyxrCS8Q+Oecm/44jsB5nV wwy5QYMywheUaDFEnlCJukl5FlcN0NxN4o0FZt3ivRZgEjDmJDQoLzWmpshNYCLxYkrz 4n8g== X-Gm-Message-State: AMCzsaX66hniEY04VykcaMPpxQ78/Inq+V59ov8DuoGkV141GTkqwWPl iof4NQStAT/aPWJu1IASBz/Wmg== X-Google-Smtp-Source: AOwi7QAQtpsbKRWg1vQ4AnfZd1ayDJW9ECGr3vIeJOxSkHyL9ur5XJiFhVzN3EScX/ZZPTUkqyQlMQ== X-Received: by 10.80.177.178 with SMTP id m47mr2449115edd.181.1507804934744; Thu, 12 Oct 2017 03:42:14 -0700 (PDT) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id g49sm4798603edc.31.2017.10.12.03.42.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Oct 2017 03:42:13 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH 24/37] KVM: arm64: Prepare to handle traps on deferred EL0 sysregs Date: Thu, 12 Oct 2017 12:41:28 +0200 Message-Id: <20171012104141.26902-25-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20171012104141.26902-1-christoffer.dall@linaro.org> References: <20171012104141.26902-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171012_114236_003179_2FDB0D3B X-CRM114-Status: GOOD ( 11.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Christoffer Dall , Shih-Wei Li , kvm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We can trap access to ACTLR_EL1 which we can later defer to only save/restore during vcpu_load and vcpu_put, so let's read the value directly from the CPU when necessary. Signed-off-by: Christoffer Dall --- arch/arm64/kvm/sys_regs_generic_v8.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/sys_regs_generic_v8.c b/arch/arm64/kvm/sys_regs_generic_v8.c index 969ade1..348f227 100644 --- a/arch/arm64/kvm/sys_regs_generic_v8.c +++ b/arch/arm64/kvm/sys_regs_generic_v8.c @@ -38,7 +38,10 @@ static bool access_actlr(struct kvm_vcpu *vcpu, if (p->is_write) return ignore_write(vcpu, p); - p->regval = vcpu_sys_reg(vcpu, ACTLR_EL1); + if (vcpu->arch.sysregs_loaded_on_cpu) + read_sysreg(actlr_el1); + else + p->regval = vcpu_sys_reg(vcpu, ACTLR_EL1); return true; }