From mboxrd@z Thu Jan 1 00:00:00 1970 From: gengdongjiu Subject: Re: [PATCH V13 10/10] arm/arm64: KVM: add guest SEA support Date: Tue, 28 Mar 2017 17:53:38 +0800 Message-ID: <5c7f6092-9358-08ac-5341-2364637c2008@huawei.com> References: <1490136425-4324-1-git-send-email-tbaicar@codeaurora.org> <1490136425-4324-11-git-send-email-tbaicar@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Return-path: Received: from szxga01-in.huawei.com ([45.249.212.187]:4801 "EHLO dggrg01-dlp.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753702AbdC1Jzi (ORCPT ); Tue, 28 Mar 2017 05:55:38 -0400 In-Reply-To: <1490136425-4324-11-git-send-email-tbaicar@codeaurora.org> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: Tyler Baicar , christoffer.dall@linaro.org, marc.zyngier@arm.com, pbonzini@redhat.com, rkrcmar@redhat.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, rjw@rjwysocki.net, lenb@kernel.org, matt@codeblueprint.co.uk, robert.moore@intel.com, lv.zheng@intel.com, nkaje@codeaurora.org, zjzhang@codeaurora.org, mark.rutland@arm.com, james.morse@arm.com, akpm@linux-foundation.org, eun.taik.lee@samsung.com, sandeepa.s.prabhu@gmail.com, labbott@redhat.com, shijie.huang@arm.com, rruigrok@codeaurora.org, paul.gortmaker@windriver.com, tn@semihalf.com, fu.wei@linaro.org, rostedt@goodmis.org, bristot@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vg Hi, On 2017/3/22 6:47, Tyler Baicar wrote: > + fault_ipa = kvm_vcpu_get_fault_ipa(vcpu); > + > + /* The host kernel will handle the synchronous external abort. There > + * is no need to pass the error into the guest. > + */ > + if (is_abort_synchronous(fault_status)) > + sea_status = handle_guest_sea((unsigned long)fault_ipa, > + kvm_vcpu_get_hsr(vcpu)); > > is_iabt = kvm_vcpu_trap_is_iabt(vcpu); > - if (unlikely(!is_iabt && kvm_vcpu_dabt_isextabt(vcpu))) { > + if (unlikely(!is_iabt && kvm_vcpu_dabt_isextabt(vcpu)) && sea_status) { > kvm_inject_vabt(vcpu); > return 1; > } After the host kernel correctly handle the synchronous external abort, the sea_status will return 0, so the code logical will be continue go-no, whether it is better directly return after correctly handle the SEA? such as below. if (unlikely(!is_iabt && kvm_vcpu_dabt_isextabt(vcpu)) && sea_status) { kvm_inject_vabt(vcpu); return 1; } else return 1; > > - fault_ipa = kvm_vcpu_get_fault_ipa(vcpu); > - > trace_kvm_guest_fault(*vcpu_pc(vcpu), kvm_vcpu_get_hsr(vcpu), > kvm_vcpu_get_hfar(vcpu), fault_ipa); > > - /* Check the stage-2 fault is trans. fault or write fault */ > - fault_status = kvm_vcpu_trap_get_fault_type(vcpu); > if (fault_status != FSC_FAULT && fault_status != FSC_PERM && From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754503AbdC1Jzl (ORCPT ); Tue, 28 Mar 2017 05:55:41 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:4801 "EHLO dggrg01-dlp.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753702AbdC1Jzi (ORCPT ); Tue, 28 Mar 2017 05:55:38 -0400 Subject: Re: [PATCH V13 10/10] arm/arm64: KVM: add guest SEA support To: Tyler Baicar , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , References: <1490136425-4324-1-git-send-email-tbaicar@codeaurora.org> <1490136425-4324-11-git-send-email-tbaicar@codeaurora.org> From: gengdongjiu Message-ID: <5c7f6092-9358-08ac-5341-2364637c2008@huawei.com> Date: Tue, 28 Mar 2017 17:53:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <1490136425-4324-11-git-send-email-tbaicar@codeaurora.org> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.142.68.147] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.58DA32B5.0093,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: e207387621d1546cb64533a4a618be7f Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2017/3/22 6:47, Tyler Baicar wrote: > + fault_ipa = kvm_vcpu_get_fault_ipa(vcpu); > + > + /* The host kernel will handle the synchronous external abort. There > + * is no need to pass the error into the guest. > + */ > + if (is_abort_synchronous(fault_status)) > + sea_status = handle_guest_sea((unsigned long)fault_ipa, > + kvm_vcpu_get_hsr(vcpu)); > > is_iabt = kvm_vcpu_trap_is_iabt(vcpu); > - if (unlikely(!is_iabt && kvm_vcpu_dabt_isextabt(vcpu))) { > + if (unlikely(!is_iabt && kvm_vcpu_dabt_isextabt(vcpu)) && sea_status) { > kvm_inject_vabt(vcpu); > return 1; > } After the host kernel correctly handle the synchronous external abort, the sea_status will return 0, so the code logical will be continue go-no, whether it is better directly return after correctly handle the SEA? such as below. if (unlikely(!is_iabt && kvm_vcpu_dabt_isextabt(vcpu)) && sea_status) { kvm_inject_vabt(vcpu); return 1; } else return 1; > > - fault_ipa = kvm_vcpu_get_fault_ipa(vcpu); > - > trace_kvm_guest_fault(*vcpu_pc(vcpu), kvm_vcpu_get_hsr(vcpu), > kvm_vcpu_get_hfar(vcpu), fault_ipa); > > - /* Check the stage-2 fault is trans. fault or write fault */ > - fault_status = kvm_vcpu_trap_get_fault_type(vcpu); > if (fault_status != FSC_FAULT && fault_status != FSC_PERM && From mboxrd@z Thu Jan 1 00:00:00 1970 From: gengdongjiu Subject: Re: [PATCH V13 10/10] arm/arm64: KVM: add guest SEA support Date: Tue, 28 Mar 2017 17:53:38 +0800 Message-ID: <5c7f6092-9358-08ac-5341-2364637c2008@huawei.com> References: <1490136425-4324-1-git-send-email-tbaicar@codeaurora.org> <1490136425-4324-11-git-send-email-tbaicar@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit To: Tyler Baicar , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , In-Reply-To: <1490136425-4324-11-git-send-email-tbaicar@codeaurora.org> Sender: linux-acpi-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Hi, On 2017/3/22 6:47, Tyler Baicar wrote: > + fault_ipa = kvm_vcpu_get_fault_ipa(vcpu); > + > + /* The host kernel will handle the synchronous external abort. There > + * is no need to pass the error into the guest. > + */ > + if (is_abort_synchronous(fault_status)) > + sea_status = handle_guest_sea((unsigned long)fault_ipa, > + kvm_vcpu_get_hsr(vcpu)); > > is_iabt = kvm_vcpu_trap_is_iabt(vcpu); > - if (unlikely(!is_iabt && kvm_vcpu_dabt_isextabt(vcpu))) { > + if (unlikely(!is_iabt && kvm_vcpu_dabt_isextabt(vcpu)) && sea_status) { > kvm_inject_vabt(vcpu); > return 1; > } After the host kernel correctly handle the synchronous external abort, the sea_status will return 0, so the code logical will be continue go-no, whether it is better directly return after correctly handle the SEA? such as below. if (unlikely(!is_iabt && kvm_vcpu_dabt_isextabt(vcpu)) && sea_status) { kvm_inject_vabt(vcpu); return 1; } else return 1; > > - fault_ipa = kvm_vcpu_get_fault_ipa(vcpu); > - > trace_kvm_guest_fault(*vcpu_pc(vcpu), kvm_vcpu_get_hsr(vcpu), > kvm_vcpu_get_hfar(vcpu), fault_ipa); > > - /* Check the stage-2 fault is trans. fault or write fault */ > - fault_status = kvm_vcpu_trap_get_fault_type(vcpu); > if (fault_status != FSC_FAULT && fault_status != FSC_PERM && From mboxrd@z Thu Jan 1 00:00:00 1970 From: gengdongjiu@huawei.com (gengdongjiu) Date: Tue, 28 Mar 2017 17:53:38 +0800 Subject: [PATCH V13 10/10] arm/arm64: KVM: add guest SEA support In-Reply-To: <1490136425-4324-11-git-send-email-tbaicar@codeaurora.org> References: <1490136425-4324-1-git-send-email-tbaicar@codeaurora.org> <1490136425-4324-11-git-send-email-tbaicar@codeaurora.org> Message-ID: <5c7f6092-9358-08ac-5341-2364637c2008@huawei.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi, On 2017/3/22 6:47, Tyler Baicar wrote: > + fault_ipa = kvm_vcpu_get_fault_ipa(vcpu); > + > + /* The host kernel will handle the synchronous external abort. There > + * is no need to pass the error into the guest. > + */ > + if (is_abort_synchronous(fault_status)) > + sea_status = handle_guest_sea((unsigned long)fault_ipa, > + kvm_vcpu_get_hsr(vcpu)); > > is_iabt = kvm_vcpu_trap_is_iabt(vcpu); > - if (unlikely(!is_iabt && kvm_vcpu_dabt_isextabt(vcpu))) { > + if (unlikely(!is_iabt && kvm_vcpu_dabt_isextabt(vcpu)) && sea_status) { > kvm_inject_vabt(vcpu); > return 1; > } After the host kernel correctly handle the synchronous external abort, the sea_status will return 0, so the code logical will be continue go-no, whether it is better directly return after correctly handle the SEA? such as below. if (unlikely(!is_iabt && kvm_vcpu_dabt_isextabt(vcpu)) && sea_status) { kvm_inject_vabt(vcpu); return 1; } else return 1; > > - fault_ipa = kvm_vcpu_get_fault_ipa(vcpu); > - > trace_kvm_guest_fault(*vcpu_pc(vcpu), kvm_vcpu_get_hsr(vcpu), > kvm_vcpu_get_hfar(vcpu), fault_ipa); > > - /* Check the stage-2 fault is trans. fault or write fault */ > - fault_status = kvm_vcpu_trap_get_fault_type(vcpu); > if (fault_status != FSC_FAULT && fault_status != FSC_PERM &&