From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754527AbdKALKZ (ORCPT ); Wed, 1 Nov 2017 07:10:25 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:9930 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754490AbdKALKU (ORCPT ); Wed, 1 Nov 2017 07:10:20 -0400 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 Content-Type: text/plain 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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 1.9.1