From patchwork Thu Jun 23 01:49:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Zhongjin X-Patchwork-Id: 12891681 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 240E7C433EF for ; Thu, 23 Jun 2022 02:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=p1shGKDg6HsQs/7BtgfFoKKHdpA0GfEMJgniQBWzNdo=; b=BvcWgowGg3103X xDUtxh3ObIHX1BkqEoFv5W3lsNElxT1YeSi1n+qDH+d+hbY7LWWI8vznU+9a1BvZR3bn22IG7Osje 2GDbL6CHWVRTjkw3b5WuyRu0Ic61i9pOsqKsXSJzcLOoV5FFdVPw35AwlafQoMevNxy3kOZBCK1Id BREZiVzG7FRDvuqWfQNdG7fbXV7uiNmWwAzPXrDwCJuadrgiejdq1IxS1nso0C+40lu5CSpSBEDga jBTL40ekkneGWNzhptD6C2m4Pkxv7xCxiblcB3K5D/NYY6JFsO6Ms1gSiw/SQG4RFh7c20/berBUf vB2YiNXHxZaqWqbpsHXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4CBT-00CpSo-Nj; Thu, 23 Jun 2022 02:03:05 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4C0x-00CkDS-0c for linux-arm-kernel@bombadil.infradead.org; Thu, 23 Jun 2022 01:52:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=f+tU1IgCCfJtuhBYom4cF+3TtqAlAUXDsw8ObtgkoZ0=; b=t72hL4WAISsjz5HqGiMdugYFb1 /EoLH3ckItVth68HYdpe7ArfUmRwcmxzk8NPOFsyP+Cmwv6oBoaq6Jje5Ycqx6myAmtAKxc+Aq/1N a4zYtRzBEuYCik8R+XpmzpAuvAqwAItne7p8Ia/lg5b4BM6MTs7M7rk/8U5b1qVtlrgIs0fMm+G5Z ChUiytsCcs15SRl3IaaHconuU6jC7RDvMskjn0Wqz/6OaJf+BadSI0B9tGORi4idrQF34jm11YJ2+ CZ2CbTZqD6f4DIZKHsfCJC3J8CUSOVRY3i1UYCK3+DSQsodHcerwzgOzk74acavbsknNoVbhTCI3U rYcRCSKw==; Received: from szxga08-in.huawei.com ([45.249.212.255]) by casper.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4C0p-007V4u-VY for linux-arm-kernel@lists.infradead.org; Thu, 23 Jun 2022 01:52:09 +0000 Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4LT38k20bzz1KC8s; Thu, 23 Jun 2022 09:49:42 +0800 (CST) Received: from dggpemm500013.china.huawei.com (7.185.36.172) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 23 Jun 2022 09:51:50 +0800 Received: from ubuntu1804.huawei.com (10.67.175.36) by dggpemm500013.china.huawei.com (7.185.36.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 23 Jun 2022 09:51:49 +0800 From: Chen Zhongjin To: , , , , , CC: , , , , , , , , , , , , , , Subject: [PATCH v6 21/33] arm64: kvm: Annotate unwind_hint for hyp entry Date: Thu, 23 Jun 2022 09:49:05 +0800 Message-ID: <20220623014917.199563-22-chenzhongjin@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220623014917.199563-1-chenzhongjin@huawei.com> References: <20220623014917.199563-1-chenzhongjin@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.175.36] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500013.china.huawei.com (7.185.36.172) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220623_025205_073620_1AFEBD13 X-CRM114-Status: UNSURE ( 7.02 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Symbol __guest_enter and kvm_hyp_vector saved x0, x1 on stack. Symbol __guest_exit and __guest_exit_panic is reached when resuming EL2 execution, and the previous stack pointer gets restored. Add adequate unwind hints. Signed-off-by: Julien Thierry Signed-off-by: Chen Zhongjin --- arch/arm64/kvm/hyp/entry.S | 5 +++++ arch/arm64/kvm/hyp/hyp-entry.S | 3 +++ 2 files changed, 8 insertions(+) diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S index 045d4481c820..81e30d56bf28 100644 --- a/arch/arm64/kvm/hyp/entry.S +++ b/arch/arm64/kvm/hyp/entry.S @@ -15,6 +15,7 @@ #include #include #include +#include .text @@ -22,6 +23,7 @@ * u64 __guest_enter(struct kvm_vcpu *vcpu); */ SYM_CODE_START(__guest_enter) + UNWIND_HINT_FUNC // x0: vcpu // x1-x17: clobbered by macros // x29: guest context @@ -88,6 +90,7 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL) // vcpu x0-x1 on the stack // If the hyp context is loaded, go straight to hyp_panic + UNWIND_HINT_FUNC get_loaded_vcpu x0, x1 cbnz x0, 1f b hyp_panic @@ -110,6 +113,7 @@ SYM_INNER_LABEL(__guest_exit, SYM_L_GLOBAL) // x1: vcpu // x2-x29,lr: vcpu regs // vcpu x0-x1 on the stack + UNWIND_HINT_FUNC sp_offset=16 add x1, x1, #VCPU_CONTEXT @@ -199,6 +203,7 @@ abort_guest_exit_end: msr daifset, #4 // Mask aborts ret + UNWIND_HINT_FUNC _kvm_extable abort_guest_exit_start, 9997f _kvm_extable abort_guest_exit_end, 9997f 9997: diff --git a/arch/arm64/kvm/hyp/hyp-entry.S b/arch/arm64/kvm/hyp/hyp-entry.S index 4a65262a4f3a..d72143c59707 100644 --- a/arch/arm64/kvm/hyp/hyp-entry.S +++ b/arch/arm64/kvm/hyp/hyp-entry.S @@ -151,6 +151,7 @@ SYM_CODE_END(\label) .macro valid_vect target .align 7 + UNWIND_HINT_FUNC 661: esb stp x0, x1, [sp, #-16]! @@ -162,6 +163,7 @@ check_preamble_length 661b, 662b .macro invalid_vect target .align 7 + UNWIND_HINT_FUNC 661: nop stp x0, x1, [sp, #-16]! @@ -209,6 +211,7 @@ SYM_CODE_END(__kvm_hyp_vector) .macro hyp_ventry indirect, spectrev2 .align 7 1: esb + UNWIND_HINT_FUNC .if \spectrev2 != 0 spectrev2_smccc_wa1_smc .else