Message ID | 20171207170630.592-26-christoffer.dall@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org> 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 35BF060325 for <patchwork-linux-arm@patchwork.kernel.org>; Thu, 7 Dec 2017 17:17:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BA1128464 for <patchwork-linux-arm@patchwork.kernel.org>; Thu, 7 Dec 2017 17:17:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 107F8284DA; Thu, 7 Dec 2017 17:17:14 +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 528C828464 for <patchwork-linux-arm@patchwork.kernel.org>; Thu, 7 Dec 2017 17:17:13 +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=lTrBd3E6Hi/1Nr2Ze9qiaWULzBObR95qGEUPNlHWG1Y=; b=PWC79eLxbzkFb1GcgQvsZFfNpv Mjr1L4LMOcRs694F38q1lWPF41LSiMxs/VYgZSBEcJHzHFhGdcggnhhdTXUOwj8OxdUlQaWdjVfJH jhVTHm00Ykfr5E/nwRkl2W+0JDAsCmIVKQPMzGe0YAIFJF9/rnhwzJHAWRhvmx3TfIarE0EVU1R7Z Paq00/CCubqU+Ezmj3wjm7Mhp3lLWyQCkzXVgWCTTO82aqkjQHa8gJM+9oARsklmW3SPVhF5mlwvL G4S0HTquaOZ//Dpvc1nOCU+LZGhodriQwebEp0O+2FC3hkLFAPgCk4AOb5scy8vZqT8srU6gdKRyr 5lQ3FYXg==; 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 1eMznB-0005oP-Ih; Thu, 07 Dec 2017 17:17:01 +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 1eMzfJ-0004ae-R2 for linux-arm-kernel@bombadil.infradead.org; Thu, 07 Dec 2017 17:08:54 +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=S1CmG/V+7UBBdyrXpVuminT0axGPzfYrPCFPQCQ+Ckk=; b=teXuh92Qc6VAtlfY8v6xzcWxD Oq9n/xwgYqgJ8QUOECAAnHwaUp+m5f605TFJVy9my8RqwuJ0a4MubFPxPa0yvVUjlImi1gFn3ndEi YiSUezyYssUrcDEDufFEqA5ZjFnEYsoHzk7G7/GfQS7V8llE12Xupq8YdPEWbZedlClPcH7vjTtxL dj5qLs/vLsQ13oOxUKwsBeADGr86eWrxwu+v4mpzCSV3QlmXAOQMQZs6Eq3MpNWpgG8ls46WWlH1q iNDRIcmPVbO4oLAmblRAoCpJzP9kH6aipdThYV2u2OxJK8yANu5EwxD8Nbod6aRGeOEPJmZvpfBhX yuvilC89A==; Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eMze9-0001xj-Fi for linux-arm-kernel@lists.infradead.org; Thu, 07 Dec 2017 17:07:43 +0000 Received: by mail-wm0-x241.google.com with SMTP id n138so14265988wmg.2 for <linux-arm-kernel@lists.infradead.org>; Thu, 07 Dec 2017 09:07:21 -0800 (PST) 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=S1CmG/V+7UBBdyrXpVuminT0axGPzfYrPCFPQCQ+Ckk=; b=Sp/ED1CR9fZLwKUpdTqseay27XkHvT0jrFGeibVstXSNblY8wjQo78TFsrVxzEFZsS 3O03wngGrsnZK1gEd6qKA5jeZh9JjHxSNWtJUSL4DRlESJO/3sufe+J6DDqHnztzmcNf v+epiIt6iTHil0otFtGiB+j2U7J3jO+yBjlDA= 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=S1CmG/V+7UBBdyrXpVuminT0axGPzfYrPCFPQCQ+Ckk=; b=HMQcXBfZPfOZQ0f/iFrOy/m4ooNfk80GHhrE/WFxw7vyHmi5vpiTBPy0sd76ORjgPT eWLJry1las/oF4dp/SUA/UEu3FvLO/f0GVh++zPVR7ZqhibQVpEhHBiV5TJ4YIWQi9Ez gV30FryBtKGKyVBRH+UOxZrj/cvL8o9x+gqG+OgJ/e7NQg/y7WBUmL/0apDkzvLZQHQZ U5YP9kKPSc7g4LlxmETnWJ6RRb1fSWM6nFE/Filqc27agXWxUE1KAwyGDMO/OdFyh3Mb 1dKk6+/FMyKr/tlSGitUH1cs675eCJ529kr5BdUecqvtZMZSFXc1AyOQouN+C4uAcsye Mbeg== X-Gm-Message-State: AKGB3mKV/7Ik9lLDHJFYcS4185BPkn6th2Yx2fAil+BtMsURopu8itz5 IvMUCtX9lfeIsZoqFdIsjjc0SjMWiWg= X-Google-Smtp-Source: AGs4zMbnqfiO0bLp51wlRrRC+SJo1VJaf3pG2BfovMoDUXxNYMWinrREfOceO8aojOn24pgrotux1w== X-Received: by 10.80.154.67 with SMTP id o61mr11911752edb.291.1512666440304; Thu, 07 Dec 2017 09:07:20 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id a16sm2868270edd.19.2017.12.07.09.07.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Dec 2017 09:07:19 -0800 (PST) From: Christoffer Dall <christoffer.dall@linaro.org> To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 25/36] KVM: arm64: Prepare to handle traps on deferred AArch32 sysregs Date: Thu, 7 Dec 2017 18:06:19 +0100 Message-Id: <20171207170630.592-26-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171207170630.592-1-christoffer.dall@linaro.org> References: <20171207170630.592-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171207_170741_544196_B63BE484 X-CRM114-Status: GOOD ( 12.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Cc: Marc Zyngier <marc.zyngier@arm.com>, Andrew Jones <drjones@redhat.com>, Christoffer Dall <christoffer.dall@linaro.org>, Shih-Wei Li <shihwei@cs.columbia.edu>, kvm@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h index 3f765b9de94d..e7234f823cba 100644 --- a/arch/arm64/include/asm/kvm_emulate.h +++ b/arch/arm64/include/asm/kvm_emulate.h @@ -91,9 +91,16 @@ static inline bool vcpu_mode_is_32bit(const struct kvm_vcpu *vcpu) /* Set the SPSR for the current mode */ static inline void vcpu_set_spsr(struct kvm_vcpu *vcpu, u64 val) { - if (vcpu_mode_is_32bit(vcpu)) + if (vcpu_mode_is_32bit(vcpu)) { + if (vcpu->arch.sysregs_loaded_on_cpu) + __sysreg32_save_state(vcpu); + *vcpu_spsr32(vcpu) = val; + if (vcpu->arch.sysregs_loaded_on_cpu) + __sysreg32_restore_state(vcpu); + } + if (vcpu->arch.sysregs_loaded_on_cpu) write_sysreg_el1(val, spsr); else
Handle accesses to any AArch32 EL1 system registers where we can defer saving and restoring them to vcpu_load and vcpu_put, and which are stored in special EL2 registers only used support 32-bit guests. Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org> --- arch/arm64/include/asm/kvm_emulate.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)