Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4073026imm; Mon, 11 Jun 2018 06:37:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJWxBJMj3q83S9hi+zuvBICqoJlqqngyERbsUq1+nM9P40n4Gwtem1QHMJZepEpAxUjXTBJ X-Received: by 2002:a17:902:1703:: with SMTP id i3-v6mr18442671pli.263.1528724248529; Mon, 11 Jun 2018 06:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528724248; cv=none; d=google.com; s=arc-20160816; b=xeJaW0qMd+j2JD2rf4c0OqGByfJ7AJEaK7SaMYCS89LGLcxkw8tzILHu4QyUCWqSrI XKXu5APOqHjMBVGx81oVTGEEmORFh/4pW3Xey+Q7tArsU5HWqr1X6lbaubT3mEVaQwjR sHQOocjPutuBqx+XjVm+fQJ5DJyNBU/e75UYEeBTAdJE1NA9sv+reeuGf9qLI9FRZm60 rWL5eHGxUL/+jVr2YTRg5PA8a93c/zLBkoHkkfGj6aab5nztqniLAsTiszuc53+mBvBC LCXyKxVU1xZEo4onCDrR2yR1VkNHyLf9nLuLqaaR8r6dAgGVjWAGEru8uZES0nHu/zuY YCtg== 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=E3dpJeyFnyVKSPAAu9kOihjeEehz+IgLwjIEC5Xyyuc=; b=UI9NBDiejyJqQ1IrPUfw1Vad9v8ev4gvHXYQOwlPAnlXZUE6P3mkF5O20JUOtm91Dy 61uwXTO3bthsx4gR826NcKBocYoOIdpnuBSEvFd8rTrUUdvX4+RMmsE/PBlabQktQjEC JH9KrDut2fEB/HS9YCgyuPIZGWFDHwAINWxPYuJjLtauGfAPRLRHGNPZ9h0hK2ewYJ13 59jlekJeCuzir7XmKgksEH9ij0INAGzvWY6b9aC5V4E+t318aXp/xC2Kwpzb7QWSdTWB lK/kedOq24jwcIY86vxMWhVaXi1xYOrt9FzyQx/+8l7GWYWPwrtdywfbeHVoU7RCphEG 00Dg== 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 h126-v6si22681193pfg.126.2018.06.11.06.37.13; Mon, 11 Jun 2018 06:37:28 -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 S933329AbeFKNgt (ORCPT + 99 others); Mon, 11 Jun 2018 09:36:49 -0400 Received: from foss.arm.com ([217.140.101.70]:51680 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754238AbeFKNgq (ORCPT ); Mon, 11 Jun 2018 09:36:46 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D22141596; Mon, 11 Jun 2018 06:36:45 -0700 (PDT) Received: from [10.1.206.34] (melchizedek.cambridge.arm.com [10.1.206.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BF6B53F318; Mon, 11 Jun 2018 06:36:43 -0700 (PDT) Subject: Re: [PATCH RESEND v4 2/2] arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS To: Marc Zyngier , Dongjiu Geng Cc: rkrcmar@redhat.com, corbet@lwn.net, christoffer.dall@arm.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org 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: James Morse Message-ID: Date: Mon, 11 Jun 2018 14:36:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <86zi04875t.wl-marc.zyngier@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, James