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: 9695085 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 5BFE960245 for ; Sun, 23 Apr 2017 17:16:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47BEB26530 for ; Sun, 23 Apr 2017 17:16:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BB35267EC; Sun, 23 Apr 2017 17:16:10 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID 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 C057F26530 for ; Sun, 23 Apr 2017 17:16:09 +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=+4RkVZQVYjNwGnmILeNIWYcS63c9F9lEtUNsdsCpcU4=; b=oljUHUn6vo9Qt2Njo58M8adqk5 qiSr4OX/xsKv1RMaRaluB/XigqSTw69eIkCY9AnEuCf2i6nDQRDTjbqS+VAXjKka6HrgXNt3JBbyM Lcrtxuwxi4I4tBiKfs8KpzYo2PitL3/xDcQFYKodZkJFZy/XDJ/lEgyx2eEE9pdIvxkAdZf+JJe73 6Og8vUbwUtxD79KUeJgQKfI2d7iH/gDHO8NRoCcnnl9NMJxKoAVfuXLnxTMWWOu1BLY9MPmllmqtu GzC8S3bFFQ/TeGZRqR+YGDbcCbckpsafDemdLEalJ8Cgq0E5IvEgPn5MLy9o9iyUuFgD8ZzbXC/0k wfYhX+rw==; 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 1d2L7I-0004kR-Jt; Sun, 23 Apr 2017 17:16:08 +0000 Received: from mail-wm0-f42.google.com ([74.125.82.42]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d2L1q-0005mn-2u for linux-arm-kernel@lists.infradead.org; Sun, 23 Apr 2017 17:10:32 +0000 Received: by mail-wm0-f42.google.com with SMTP id i137so1939319wmf.0 for ; Sun, 23 Apr 2017 10:10:14 -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=DHSvhPMsK5+k2y/OwaOIhtmWEaxRrB3NH2vcPbVzfPP1fS9XtyDILQ/lywni03JcFJ K9uYmbgpMpLAk9PTZWm34fVvSJr4fimVynGQeVeA0IY1gBS6DIR8WBIlWjRS5W04zEMf 7oMjc9PP1zc9ByjVG0H8YniiI6K694lqVfLdNeg3lb3ZupHgP8okq5sylob214KTvlOB h8DBsr5aRq9s86Ri8lSX8dvopg8CujLWx/YqUAC3/RF1y7znQ9QsSO1/OHGuzCZnWrvV 9zp+HL0sstVti1GpsESGOe9Wfr3nlZrC1MjTNA1d/+c2PNqicKiGva0lAvf7BKNk9byf zGQA== X-Gm-Message-State: AN3rC/7ZntI+gvv+RgvWDWWIIV5t7HRhQhPiazc8ZRCe0xYtaRsyvogI 7mRSHh6fi+swOEJO 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?= 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170423_101030_321146_F199322D X-CRM114-Status: GOOD ( 11.59 ) 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 , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.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 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)