From patchwork Tue Nov 24 17:35:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 57268 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp2239708lbb; Tue, 24 Nov 2015 09:40:55 -0800 (PST) X-Received: by 10.66.118.168 with SMTP id kn8mr11857001pab.122.1448386855208; Tue, 24 Nov 2015 09:40:55 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id uo3si21359813pac.221.2015.11.24.09.40.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Nov 2015 09:40:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a1HYt-0007oX-MO; Tue, 24 Nov 2015 17:39:27 +0000 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a1HVK-0004x6-HF for linux-arm-kernel@lists.infradead.org; Tue, 24 Nov 2015 17:35:48 +0000 Received: by wmec201 with SMTP id c201so37093483wme.1 for ; Tue, 24 Nov 2015 09:35:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vauVBxWND8K2SEiYM49nlzOgRLac3Ti9Dro0+LR4PgY=; b=aoGXI3xNadJdU5IlgTMS9CoRZEpKNPgzbnxey7QTeL9UoyRVV9VlR1dFz+G1aGFcIS MWv56D1yCuKUKuxwsjA5FQKZ37NpmgdGWK2NFRRALcaN3yZ/rLAWXHyFqJgTrb/looHx GPQk1vhsESvU5QAyX4JR8uf9gCbiYnzPEfKbzVySdmHeL5sWFJ92SsYDFcfdxNHwVVxo SEswvRnfQQEx2RKKZewmm6DFSEeaUVj4AGMvo5RKizH1cHOhdHJKWT4RAxiYsR1nNMzA HVz/VR1nKoGPSzskNH7od/0cWjpKlCaV4KQL/+AhpCA6onjfiaQmjGqriKIkclNbarBB iX/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vauVBxWND8K2SEiYM49nlzOgRLac3Ti9Dro0+LR4PgY=; b=QCvfksl3EOFkPTmPX7K1NqxG9JgEWzaeWpQgIhDIIsxO6jTs82hYcVPoDZ0g7LIGV0 CjLVQcLcA8zXGJYZkl5owfOoKKMaEcpwZ4rtVieKXnSntafuAgntRZdaIu1T6aCVkOys uO5VAVw4GhEVHczVhehiJ6okOuIzAqQxGKSIoOQuz/Ep3nhS0lWo2Ke9lLxpdGjVfYrT kMw7MmEsVHhpVh5WHdEQd7hr3iObTTdIV327o1EHT/Xl6Z7OXR4UdQTvxstf6JKW9mkv iZ2Q3CDuaJGTcPN0Px7xIeGuZ7gMEOwS9QlXkb+F69AGp2moPFM/MKjiXyr5GJYGHhCO c9wg== X-Gm-Message-State: ALoCoQmsXKyKGh6G0UgVD+Ua1n1QhDtCHEZx7c7UAePCwY3xndOcaD0gEcVwYFFPp68bXAigaaRG X-Received: by 10.194.205.137 with SMTP id lg9mr36802428wjc.156.1448386524841; Tue, 24 Nov 2015 09:35:24 -0800 (PST) Received: from localhost.localdomain ([94.18.191.146]) by smtp.gmail.com with ESMTPSA id jo6sm19283805wjb.48.2015.11.24.09.35.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Nov 2015 09:35:24 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini Subject: [PULL 8/8] arm64: kvm: report original PAR_EL1 upon panic Date: Tue, 24 Nov 2015 18:35:36 +0100 Message-Id: <1448386536-30118-9-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.1.2.330.g565301e.dirty In-Reply-To: <1448386536-30118-1-git-send-email-christoffer.dall@linaro.org> References: <1448386536-30118-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151124_093546_833048_C3BA938C X-CRM114-Status: GOOD ( 13.03 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:234 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org From: Mark Rutland If we call __kvm_hyp_panic while a guest context is active, we call __restore_sysregs before acquiring the system register values for the panic, in the process throwing away the PAR_EL1 value at the point of the panic. This patch modifies __kvm_hyp_panic to stash the PAR_EL1 value prior to restoring host register values, enabling us to report the original values at the point of the panic. Acked-by: Marc Zyngier Signed-off-by: Mark Rutland Signed-off-by: Christoffer Dall --- arch/arm64/kvm/hyp.S | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.1.2.330.g565301e.dirty _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S index ce70817..86c2898 100644 --- a/arch/arm64/kvm/hyp.S +++ b/arch/arm64/kvm/hyp.S @@ -864,6 +864,10 @@ ENTRY(__kvm_flush_vm_context) ENDPROC(__kvm_flush_vm_context) __kvm_hyp_panic: + // Stash PAR_EL1 before corrupting it in __restore_sysregs + mrs x0, par_el1 + push x0, xzr + // Guess the context by looking at VTTBR: // If zero, then we're already a host. // Otherwise restore a minimal host context before panicing. @@ -898,7 +902,7 @@ __kvm_hyp_panic: mrs x3, esr_el2 mrs x4, far_el2 mrs x5, hpfar_el2 - mrs x6, par_el1 + pop x6, xzr // active context PAR_EL1 mrs x7, tpidr_el2 mov lr, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT |\