Received: by 10.213.65.68 with SMTP id h4csp231674imn; Fri, 16 Mar 2018 01:00:01 -0700 (PDT) X-Google-Smtp-Source: AG47ELuaLVOskioEgTiUEWV12Tw2sSpvDxLaH3OFHAdaHzK5r2WUKiPZJdSr4pVGJnwVxTNVBYrl X-Received: by 2002:a17:902:9349:: with SMTP id g9-v6mr1062400plp.319.1521187201549; Fri, 16 Mar 2018 01:00:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521187201; cv=none; d=google.com; s=arc-20160816; b=NbTcpNwwHwCie8bVD5ZWY1/vgR2opOq6zinr9PRO5vPkfWn58kX+uGbN9lcdw6HjW9 OauNY6MOXBYr8Q/nnPunFbw6TrhBZZIsGF7Usvri5pqINQwREefnvMo7Et46+gYU3ioJ ecb0bbfYvnxbYJ3H2wWBtmG5ibaCpapYtnNukrtN73Jl2nRLg+0TxHWLV+1XfcDSnfwH 4euy2t7a7KOIjphE5STFF0Gmw7Q0KqwhlrKwVKeBThyKRM0JLntPSegp4Qj6A/D3u/Tp ZZ7YtsSVErIPMYnecrAqlqYtkxRze/8wDzhGJV0sK2f8AUgc2r/MRIOMcjyW2YIWt9b5 0eJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=cXuXKdEB82HgFkqfrxPqEnc0aublrumNHaxNhmkw6kw=; b=oYnnl9ND9zPUAKIh5BqQsMR6x0BW+XKPJXo7X/lRTzJhU8CoKdA48SRXxsMvukgR9G 5JByJrh4Vf7fbde22UBwfJSVSY/Eaf6xjvMe1+dadKlyWWIcQjv79iDQgmRPw2XRCDgu s1T8HJpoqbFafS6ZzMQHvgskzDqJBug4CZHN5QMaRFhYOgWZMQzLKJHFlp7TuEeDEDzu 4zjf8n9RAaal4qBa/ONEMxV8LO9PRO5PXJQ6futm6NCc8EdzcnBJ0amdm1NSM5noHNfc BU+2bYoAyEd8CPI9UA3DpKsFlFCj6aKOwPQKQ4B8YGr7OirfaA/bNmolvNhvvBTJSBzA 3RfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o69si383231pfi.322.2018.03.16.00.59.47; Fri, 16 Mar 2018 01:00:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753006AbeCPH6i (ORCPT + 99 others); Fri, 16 Mar 2018 03:58:38 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:55627 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750814AbeCPH6g (ORCPT ); Fri, 16 Mar 2018 03:58:36 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 9882BC04E604C; Fri, 16 Mar 2018 15:58:32 +0800 (CST) Received: from [127.0.0.1] (10.142.68.147) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.361.1; Fri, 16 Mar 2018 15:58:26 +0800 Subject: Re: [PATCH v10 1/5] arm64: KVM: Prepare set virtual SEI syndrome value To: James Morse CC: , , , , , , , , , , , , , , , , References: <1520093380-42577-1-git-send-email-gengdongjiu@huawei.com> <1520093380-42577-2-git-send-email-gengdongjiu@huawei.com> <5AAAD9A1.6090107@arm.com> From: gengdongjiu Message-ID: <076069fe-0017-7cb4-8316-4d4d58f9f06b@huawei.com> Date: Fri, 16 Mar 2018 15:58:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <5AAAD9A1.6090107@arm.com> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.142.68.147] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi James, Thank you very much for this mail and your time to review this patch. Appreciate that. I will check it and reply. On 2018/3/16 4:37, James Morse wrote: > Hi Dongjiu Geng, > > On 03/03/18 16:09, Dongjiu Geng wrote: >> Export one API to specify virtual SEI syndrome value >> for guest, and add a helper to get the VSESR_EL2 value. > > This patch adds two helpers that nothing calls... its not big, please merge it > with the patch that uses these. > > >> diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h >> index 413dc82..3294885 100644 >> --- a/arch/arm64/include/asm/kvm_emulate.h >> +++ b/arch/arm64/include/asm/kvm_emulate.h >> @@ -71,6 +71,11 @@ static inline void vcpu_set_hcr(struct kvm_vcpu *vcpu, unsigned long hcr) >> vcpu->arch.hcr_el2 = hcr; >> } >> >> +static inline unsigned long vcpu_get_vsesr(struct kvm_vcpu *vcpu) >> +{ >> + return vcpu->arch.vsesr_el2; >> +} >> + >> static inline void vcpu_set_vsesr(struct kvm_vcpu *vcpu, u64 vsesr) >> { >> vcpu->arch.vsesr_el2 = vsesr; >> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h >> index a73f63a..3dc49b7 100644 >> --- a/arch/arm64/include/asm/kvm_host.h >> +++ b/arch/arm64/include/asm/kvm_host.h >> @@ -354,6 +354,8 @@ void handle_exit_early(struct kvm_vcpu *vcpu, struct kvm_run *run, >> int kvm_perf_init(void); >> int kvm_perf_teardown(void); >> >> +void kvm_set_sei_esr(struct kvm_vcpu *vcpu, u64 syndrome); >> + >> struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr); >> >> static inline void __cpu_init_hyp_mode(phys_addr_t pgd_ptr, >> diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c >> index 60666a0..78ecb28 100644 >> --- a/arch/arm64/kvm/inject_fault.c >> +++ b/arch/arm64/kvm/inject_fault.c >> @@ -186,3 +186,8 @@ void kvm_inject_vabt(struct kvm_vcpu *vcpu) >> { >> pend_guest_serror(vcpu, ESR_ELx_ISV); >> } >> + >> +void kvm_set_sei_esr(struct kvm_vcpu *vcpu, u64 syndrome) >> +{ >> + pend_guest_serror(vcpu, syndrome & ESR_ELx_ISS_MASK); > > If you move the ISS_MASK into pend_guest_serror(), you wouldn't need this at all. > > It would be better if any validation were in the user-space helpers so we can > check user-space hasn't put something funny in the top bits. > >> +} >> > > > Thanks, > > James > > . >