Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5442372imm; Tue, 12 Jun 2018 07:56:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJVEzGCh45qhLdrEQSR8TN2WlBDkS97cQB4fkl5Z/KHlCqPIEpNlgWNSrD0ZErAamAs9OKT X-Received: by 2002:a17:902:3124:: with SMTP id w33-v6mr764322plb.235.1528815407084; Tue, 12 Jun 2018 07:56:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528815407; cv=none; d=google.com; s=arc-20160816; b=llwViiEux8OC94JPYQFQwmFGbdANaXYn+OjgQztHs3WjF84MEV+etkRvU7cqBPAS4C wXAjLo0Qz0Hz0o7IE364Y0Kxh3h3CO5zlHYK7JWQqiUhMqhH4XwnAj8hGbzshdXeS3eX HUbKc7E5L3NfJi3pQ7M4DgPRYB7FVyp6BQ/gQOvM/Xld/QkaejEOgRZANxDpmdODcuHi av+shFYPPlicYp81AGAKrdRP0Ql+OZwIJIrC9iVmo6Ajof/16tk5gaUEUlKxhryYP/4d GSOaaMz0FUcJChUmSh5lZY2Cx611v49Tu8if2r/mg6XfoFupZ0OJA24RJi/xVIuJKAHq fBvA== 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=dvsYYgGecRIvh0dEi2NILU0yAtnEpNHmll58Ke/un/0=; b=mcGN91FTC2mslrkSlmOvf5bOZrDXrFT/yV9PsnJrgUhAMfpAyBcmW+sDbm8A9sNMAE Cd7BKnQd7XOsTeAAsywI/8K0B6jVrXpiFQuINSR1zZ9UVs43x5fAgpfCaxHtxyO0ZDpc OmqVddijDSX3Bhxg1YUrmqQ0GWVNprNBpLLaWQPtejKLVVU27d5WuPYXs8lFvE8rgGiq Mr1VKksBbiyZS51lkdChtcDeKa0dgJTnqYVCGVE0tHHbzMRnCkFKcwWujCkTyOI6gzKK 4uyBlGzm3ZGR4LeNQwh4/AhuGvg+8KQMO+dtiJNxgbbxtUeJjfp24250+nJvj0jsvQSO jv3A== 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 g7-v6si286364plt.149.2018.06.12.07.56.32; Tue, 12 Jun 2018 07:56:47 -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 S933952AbeFLO4L (ORCPT + 99 others); Tue, 12 Jun 2018 10:56:11 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8666 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933338AbeFLO4K (ORCPT ); Tue, 12 Jun 2018 10:56:10 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id DC261DDC87C21; Tue, 12 Jun 2018 22:55:51 +0800 (CST) Received: from [127.0.0.1] (10.142.68.147) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.382.0; Tue, 12 Jun 2018 22:55:51 +0800 Subject: Re: [PATCH RESEND v4 2/2] arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS To: James Morse , Marc Zyngier CC: , , , , , , , , , , References: <1528487320-2873-1-git-send-email-gengdongjiu@huawei.com> <1528487320-2873-3-git-send-email-gengdongjiu@huawei.com> <86zi04875t.wl-marc.zyngier@arm.com> From: gengdongjiu Message-ID: <0c604169-573c-126c-7715-d75bf2a1c319@huawei.com> Date: Tue, 12 Jun 2018 22:53:20 +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: Content-Type: text/plain; charset="utf-8" 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 On 2018/6/11 21:36, James Morse wrote: > Hi Dongjiu Geng, > > On 09/06/18 13:40, Marc Zyngier wrote: >> On Fri, 08 Jun 2018 20:48:40 +0100, Dongjiu Geng wrote: >>> For the migrating VMs, user space may need to know the exception >>> state. For example, in the machine A, KVM make an SError pending, >>> when migrate to B, KVM also needs to pend an SError. >>> >>> This new IOCTL exports user-invisible states related to SError. >>> Together with appropriate user space changes, user space can get/set >>> the SError exception state to do migrate/snapshot/suspend. > >>> diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h >>> index 04b3256..df4faee 100644 >>> --- a/arch/arm64/include/uapi/asm/kvm.h >>> +++ b/arch/arm64/include/uapi/asm/kvm.h >>> @@ -153,6 +154,18 @@ struct kvm_sync_regs { >>> struct kvm_arch_memory_slot { >>> }; >>> >>> +/* for KVM_GET/SET_VCPU_EVENTS */ >>> +struct kvm_vcpu_events { >>> + struct { >>> + __u8 serror_pending; >>> + __u8 serror_has_esr; >>> + /* Align it to 8 bytes */ >>> + __u8 pad[6]; >>> + __u64 serror_esr; >>> + } exception; >>> + __u32 reserved[12]; >>> +}; > >>> diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c >>> index 56a0260..4426915 100644 >>> --- a/arch/arm64/kvm/guest.c >>> +++ b/arch/arm64/kvm/guest.c > >>> +int kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu, >>> + struct kvm_vcpu_events *events) >>> +{ >>> + bool serror_pending = events->exception.serror_pending; >>> + bool has_esr = events->exception.serror_has_esr; >>> + >>> + if (serror_pending && has_esr) { >>> + if (!cpus_have_const_cap(ARM64_HAS_RAS_EXTN)) >>> + return -EINVAL; >>> + >>> + kvm_set_sei_esr(vcpu, events->exception.serror_esr); >>> + } else if (serror_pending) { >>> + kvm_inject_vabt(vcpu); >>> + } >>> + >>> + return 0; >> >> There was an earlier request to check that all the padding is set to >> zero. I still think this makes sense. > > I agree, not just the exception.padding[], but reserved[] too. Ok, thanks for the reminder again. > > > Thanks, > > James > > . >