Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751670AbdIMIOG (ORCPT ); Wed, 13 Sep 2017 04:14:06 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6046 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751472AbdIMIOB (ORCPT ); Wed, 13 Sep 2017 04:14:01 -0400 Subject: Re: [PATCH v6 5/7] arm64: kvm: route synchronous external abort exceptions to el2 To: James Morse References: <1503916701-13516-1-git-send-email-gengdongjiu@huawei.com> <1503916701-13516-6-git-send-email-gengdongjiu@huawei.com> <59B17449.6010201@arm.com> CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , From: gengdongjiu Message-ID: <761bca49-7257-75a6-f6a9-e8e5e2af9ad0@huawei.com> Date: Wed, 13 Sep 2017 16:12:10 +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: <59B17449.6010201@arm.com> 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.0A0B0205.59B8E86C.014A,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: 84d5f6dc99219ed2b5888504766dd513 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1883 Lines: 59 On 2017/9/8 0:31, James Morse wrote: > Hi Dongjiu Geng, > > On 28/08/17 11:38, Dongjiu Geng wrote: >> ARMv8.2 adds a new bit HCR_EL2.TEA which controls to >> route synchronous external aborts to EL2, and adds a >> trap control bit HCR_EL2.TERR which controls to >> trap all Non-secure EL1&0 error record accesses to EL2. >> >> This patch enables the two bits for the guest OS. >> when an synchronous abort is generated in the guest OS, > >> it will trap to EL3 firmware, EL3 firmware will check the >> HCR_EL2.TEA value to decide to jump to hypervisor or host >> OS. > > (This is what you are using this for, the patch has nothing to do with EL3.) No, EL3 will check the HCR_EL2.TEA to decide to jump to hypervisor or host kernel. > > >> Enabling HCR_EL2.TERR makes error record access >> from guest trap to EL2. > > > KVM already handles external aborts from lower exception levels, no more work > needs doing for TEA. when SCR_EL3.EA is set, TEA will not workable, El3 only check its value to decide to hypervisor or EL1 host kernel. > > What happens when a guest access the RAS-Error-Record registers? it will trap to EL2 kvm > > Before we can set HCR_EL2.TERR I think we need to add some minimal emulation for > the registers it traps. Most of them should be RAZ/WI, so it should be > straightforward. (I think KVMs default is to emulate an undef for unknown traps). if KVM default handling is to emulate an undef for unknown traps, how about we use its default way? because no one access the ERR RAS register in the guest . > > Eventually we will want to back this with a page of memory that lets > Qemu/kvmtool configure what the guest can see. (i.e. the emulated machine's > errors for kernel-first handling.) I think emulate it to an undef for unknown traps can be enough, no one access the ERR register in the guest. > > > Thanks, > > James > > . >