From patchwork Sun Apr 23 17:08:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9694985 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 4A3FD60245 for ; Sun, 23 Apr 2017 17:11:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3373726530 for ; Sun, 23 Apr 2017 17:11:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2856B265B9; Sun, 23 Apr 2017 17:11:58 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C459A26530 for ; Sun, 23 Apr 2017 17:11:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162717AbdDWRLz (ORCPT ); Sun, 23 Apr 2017 13:11:55 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:33991 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162709AbdDWRKT (ORCPT ); Sun, 23 Apr 2017 13:10:19 -0400 Received: by mail-wm0-f41.google.com with SMTP id r190so4711858wme.1 for ; Sun, 23 Apr 2017 10:10:18 -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=qhhC1Lq4wTpYyYJtH61pZ+F4FDS0nlBCJxvqeHYTzR4=; b=Xd1GSuG1CjGdih680XPCM3cf34ChNx8fEtstbh1pfj0jWqEhYkqGgMhnsPhswYRbQo 5AOUiLufeOZA7ToOyNmrX0IYUvfNjW/l40Jue+lPx4dPbw+BoFUu5CX0nTYz7PxrMezx MDy1oONvG7KQq0mDKXAuZ5V73IasoMBS03sBg= 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=qhhC1Lq4wTpYyYJtH61pZ+F4FDS0nlBCJxvqeHYTzR4=; b=IoLZQhdugobxbly4SnS0/nbHQffS1P7k0X+/aa1sceZExWn7iWUD2ymHtCkXLcmBZR QFDfHdpgy3TNqD0MzL3GSvMvZp4DlGViedEXNf/RsaQDVb/aO8Mf4giQKhfnIcQfyjKb WpceNYJj+Eg/1JpygSG3EyHOpAma6tNuPblKgJaOulI8YBlV3gaFZdgGauZm+NOtf/25 E9gE0m7csqMyMDKckqr5LSXY7cMtWkscvLFHhrpBlauBDwb/WJNNla6YiQ7JyixCs+5N 4TA1nkT74wznhYcLOsi7nYtOxG3XirEB7djtcgjK4Imp2JhVSPQpzDNAQ3hRgsm6/vSR zOOA== X-Gm-Message-State: AN3rC/63h3y+HFSHUIirImgFLZGhpAW00xrdg0eiDiBKjhfiCJMdpXTk 8ILZY+69kq+58own5hMhrA== X-Received: by 10.80.164.91 with SMTP id v27mr125266edb.139.1492967412292; Sun, 23 Apr 2017 10:10:12 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id 58sm2803521edz.2.2017.04.23.10.10.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Apr 2017 10:10:11 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Christoffer Dall Subject: [PULL 39/79] arm64: hyp-stub: Define a return value for failed stub calls Date: Sun, 23 Apr 2017 19:08:49 +0200 Message-Id: <20170423170929.27334-40-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170423170929.27334-1-cdall@linaro.org> References: <20170423170929.27334-1-cdall@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marc Zyngier Define a standard return value to be returned when a hyp stub call fails, and make KVM use it for ARM_EXCEPTION_HYP_GONE (instead of using a KVM-specific value). Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- arch/arm64/include/asm/kvm_asm.h | 2 +- arch/arm64/include/asm/virt.h | 3 +++ arch/arm64/kernel/hyp-stub.S | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h index 49f99cd..b7e4ef5 100644 --- a/arch/arm64/include/asm/kvm_asm.h +++ b/arch/arm64/include/asm/kvm_asm.h @@ -28,7 +28,7 @@ #define ARM_EXCEPTION_EL1_SERROR 1 #define ARM_EXCEPTION_TRAP 2 /* The hyp-stub will return this for any kvm_call_hyp() call */ -#define ARM_EXCEPTION_HYP_GONE 3 +#define ARM_EXCEPTION_HYP_GONE HVC_STUB_ERR #define KVM_ARM64_DEBUG_DIRTY_SHIFT 0 #define KVM_ARM64_DEBUG_DIRTY (1 << KVM_ARM64_DEBUG_DIRTY_SHIFT) diff --git a/arch/arm64/include/asm/virt.h b/arch/arm64/include/asm/virt.h index 439f6b5..1466d14 100644 --- a/arch/arm64/include/asm/virt.h +++ b/arch/arm64/include/asm/virt.h @@ -39,6 +39,9 @@ */ #define HVC_SOFT_RESTART 2 +/* Error returned when an invalid stub number is passed into x0 */ +#define HVC_STUB_ERR 0xbadca11 + #define BOOT_CPU_MODE_EL1 (0xe11) #define BOOT_CPU_MODE_EL2 (0xe12) diff --git a/arch/arm64/kernel/hyp-stub.S b/arch/arm64/kernel/hyp-stub.S index 193dfb2..f53e8b8 100644 --- a/arch/arm64/kernel/hyp-stub.S +++ b/arch/arm64/kernel/hyp-stub.S @@ -74,7 +74,7 @@ el1_sync: br x4 // no return /* Someone called kvm_call_hyp() against the hyp-stub... */ -3: mov x0, #ARM_EXCEPTION_HYP_GONE +3: ldr x0, =HVC_STUB_ERR 9: eret ENDPROC(el1_sync)