From patchwork Wed Nov 1 19:14:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongjiu Geng X-Patchwork-Id: 10036243 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 7CC296032D for ; Wed, 1 Nov 2017 11:10:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8271E2843B for ; Wed, 1 Nov 2017 11:10:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7722028B6D; Wed, 1 Nov 2017 11:10:52 +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=-2.3 required=2.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, 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 019252843B for ; Wed, 1 Nov 2017 11:10:52 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=70n9O3B+NuHDLgU/jaIK98OVBaTt2tmrRwKShYTgsRc=; b=GZvKHYbbtpQ+Ox vX/xh/kigWIOsfQAaN4FzFSxxxrY1TvuIq3yA4Z0cn8crRAeZj6Vk/M+dO1fYWWq/nmiSgH+nFmYR 8zPYqvB4UemJgpLj8VxhE02zDYNGsVkaZRSaueuNDfJcfqafONrgiDA4bZGCv3Eq1E3JbL/8GaZNB AEtJlZLZlfosM0HftW3L/SRIZPaiENcux1NsT/L5v0oFS6xTpuCxjiRaaFJ7UZDrSBHmPNqX0xBer 6mRHFowWFOrLqCt7+GNI5Ye1QMBSa76ae+l5CFDtfhhAaX87TMdsvQ2vW7XBo3J3DY04wfEQQibBU WCuJmwns3ysv5PHkz7BA==; 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 1e9qv0-0000Pu-15; Wed, 01 Nov 2017 11:10:46 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e9quG-0006zJ-KN for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2017 11:10:06 +0000 Received: from 172.30.72.59 (EHLO DGGEMS405-HUB.china.huawei.com) ([172.30.72.59]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DKC78228; Wed, 01 Nov 2017 19:09:16 +0800 (CST) Received: from localhost.localdomain (10.143.28.90) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.361.1; Wed, 1 Nov 2017 19:08:59 +0800 From: Dongjiu Geng To: , , , , , , , , , , , , , , Subject: [PATCH v1 3/3] KVM: arm64: add ESB in exception handler entry and exit. Date: Thu, 2 Nov 2017 03:14:57 +0800 Message-ID: <1509563697-6359-4-git-send-email-gengdongjiu@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509563697-6359-1-git-send-email-gengdongjiu@huawei.com> References: <1509563697-6359-1-git-send-email-gengdongjiu@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.143.28.90] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.59F9AB5D.0035, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: a3cd88a192f2d09ada2178fcb9119a01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171101_041001_214902_C98EE358 X-CRM114-Status: UNSURE ( 9.96 ) X-CRM114-Notice: Please train this message. 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: , 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 Some hardware platform can support RAS Extension instead of support IESB, so software need to insert Synchronization Barrier operations at exception handler entry and exit. In the __guest_exit(), it added a ESB instruction, but can not cover the path which is not guest exit. For example, if EL1 host call HVC instruction enter to hypervisor, it will not call __guest_exit(). In the kvm_arm_vhe_guest_enter(), it synchronised any host RAS errors for VHE mode, but it can not handle the non-VHE mode. For example, if EL1 host is pending a SError, the error can be propagated to guest without error synchronization operation. Only add the ESB in the important exception handler path to reduce the impact on performance. Signed-off-by: Dongjiu Geng --- arch/arm64/kvm/hyp/entry.S | 2 ++ arch/arm64/kvm/hyp/hyp-entry.S | 1 + 2 files changed, 3 insertions(+) diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S index 96caa53..fce6806 100644 --- a/arch/arm64/kvm/hyp/entry.S +++ b/arch/arm64/kvm/hyp/entry.S @@ -84,6 +84,8 @@ ENTRY(__guest_enter) // Restore guest reg x18 ldr x18, [x18, #CPU_XREG_OFFSET(18)] + // synchronize host pending asynchronous error + error_synchronize // Do not touch any register after this! eret ENDPROC(__guest_enter) diff --git a/arch/arm64/kvm/hyp/hyp-entry.S b/arch/arm64/kvm/hyp/hyp-entry.S index 5170ce1..ac85029 100644 --- a/arch/arm64/kvm/hyp/hyp-entry.S +++ b/arch/arm64/kvm/hyp/hyp-entry.S @@ -54,6 +54,7 @@ ENTRY(__vhe_hyp_call) ENDPROC(__vhe_hyp_call) el1_sync: // Guest trapped into EL2 + error_synchronize stp x0, x1, [sp, #-16]! alternative_if_not ARM64_HAS_VIRT_HOST_EXTN