From mboxrd@z Thu Jan 1 00:00:00 1970 From: gengdongjiu Subject: Re: [PATCH v14 5/9] target-arm: kvm64: inject synchronous External Abort Date: Sat, 13 Jan 2018 16:27:33 +0800 Message-ID: References: <1514440458-10515-1-git-send-email-gengdongjiu@huawei.com> <1514440458-10515-6-git-send-email-gengdongjiu@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov , Shannon Zhao , Marcelo Tosatti , "Richard Henderson" , Eduardo Habkost , "James Morse" , Christoffer Dall , Marc Zyngier , kvm-devel , "QEMU Developers" , qemu-arm , Huangshaoyu , "Zhengqiang (turing)" , Xu Wei To: Peter Maydell Return-path: Received: from szxga06-in.huawei.com ([45.249.212.32]:47312 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754647AbeAMI2D (ORCPT ); Sat, 13 Jan 2018 03:28:03 -0500 In-Reply-To: Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: Hi Peter, On 2018/1/13 13:24, gengdongjiu wrote: >>> + >>> + /* For the AArch64, instruction length is 32-bit */ >>> + esr |= ARM_EL_IL; >>> + env->exception.syndrome = esr; >>> + >>> + cc->do_interrupt(c); >>> + >>> + /* set ESR_EL1 */ >>> + ret = kvm_arm_cpreg_value(cpu, offsetof(CPUARMState, cp15.esr_el[1])); >> Breakpoint injection doesn't need to do this. Neither should this code. > As my above explanation, in the KVM mode, it needs to set the ESR_ELx in extra method. > the cc->do_interrupt(c) does not set ESR_ELx. so I use kvm_arm_cpreg_value() > to set it. whether you have better method to set the ESR_Elx except for my method? Thanks. If QEMU changes the KVM's registers, it needs to call write_list_to_kvmstate() to write the cpu->cpreg_values[] list to KVM through KVM_SET_ONE_REG IOCTL[1]. In Qemu, now it should not have software path to change the cpu->cpreg_values[] list except write_cpustate_to_list(). Here I can also call write_cpustate_to_list() instead of kvm_arm_cpreg_value() to change cpu->cpreg_values[] list, but the write_cpustate_to_list() will write all the coprocessor state to the cpu->cpreg_values[] list, we can not sure all the coprocessor states are right, so here I only change corresponding index value in this list using kvm_arm_cpreg_value(). Breakpoint injection that you mentioned should not change KVM register or not in the KVM mode. [1]: kvm_arch_put_registers() -> write_list_to_kvmstate() -> write cpu->cpreg_values[] to the kernel KVM through KVM_SET_ONE_REG > > >>> + if (ret) { >>> + fprintf(stderr, "<%s> failed to set esr_el1\n", __func__); >>> + abort(); >>> + } >>> +} >>> + >>> #define AARCH64_CORE_REG(x) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | \ >>> KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(x)) >>> >>> -- >>> 1.8.3.1