Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1890889imu; Fri, 14 Dec 2018 02:19:29 -0800 (PST) X-Google-Smtp-Source: AFSGD/WT/bOfNrM87aLGO55mayOaW+Uon1UG6zpNb78o+ZCfqm08MInSAKOOcOznBxTQ36SK0EZF X-Received: by 2002:a17:902:e290:: with SMTP id cf16mr2367082plb.81.1544782769864; Fri, 14 Dec 2018 02:19:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544782769; cv=none; d=google.com; s=arc-20160816; b=1EozF21iYET6vblrL+Ce7I7UX73lGy4g+Jw08g1VPJdr4l+lEx+EQQN7e+1oefzYYS hLFifyEqOxnXEesxw0uMi8lQKWrHi79DVzj1nt7lNCsWoZw2TEncm/+uJrk25vJsfK50 9cWRtIR2DbRSbxQxZXWGsJ2AQ7zzZVS9wBAB3Zv3fFzCoypAoTWFrEj1dsdNNikb0WhS BMeufxg+lNPxK7MHnHJwwGzbBo0QU9SAidulsFPInG2XuNTOmq0szUS9ZS3Yskb63h/W ONYPPuY4nraMWrnpCss0DrhxVJcL9H++6t5AnFG2wjSbq4uQMqP7Wrcf8cRxzFuepw2r KmJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:to :from; bh=yS7vcqrco507nHb4xzNCsayEfPboE9ZFvPpSzL6nZk8=; b=GSDsvDz4XEf09xf83WHVGqF30DHJn7iE2GoK6Ny9GX2OMUXhLKXGlu5hzA/vCLwRM0 q3bSFGh7QFSKP6GgwmWn+bxBK8Vta5ToJIyMlb0O7RTHLqAuti0/pZDFHDlkyPviReaP 3khrGgxWzLHTNw+NqpvZJqZQ4ujbqDP9MOMNUd3e4UWy4ZapdgVjLAyT2Sn1v+kFvMco N2bAuKzEzsjn3WpWALsHQpLSo3cf3ozsdbpy2o6XZOcA/NGbiGk/ruyeLPQCeV3+YTY5 2gnButhGuzu8xfDU5hhvNMtTUF6yNf09ylExFcOHEPd62Y+K8rO7+eakaOOp+PS5TQuE VZfQ== 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 z18si3604167pgk.367.2018.12.14.02.19.14; Fri, 14 Dec 2018 02:19:29 -0800 (PST) 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 S1729444AbeLNKRR (ORCPT + 99 others); Fri, 14 Dec 2018 05:17:17 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:16567 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728829AbeLNKRQ (ORCPT ); Fri, 14 Dec 2018 05:17:16 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B09C8A91BF2DF; Fri, 14 Dec 2018 18:17:12 +0800 (CST) Received: from ros.huawei.com (10.143.28.118) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.408.0; Fri, 14 Dec 2018 18:17:10 +0800 From: Dongjiu Geng To: , , , , , , , , , , Subject: [RFC RESEND PATCH] kvm: arm64: export memory error recovery capability to user space Date: Fri, 14 Dec 2018 02:15:37 -0800 Message-ID: <1544782537-13377-1-git-send-email-gengdongjiu@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.143.28.118] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When user space do memory recovery, it will check whether KVM and guest support the error recovery, only when both of them support, user space will do the error recovery. This patch exports this capability of KVM to user space. Cc: Peter Maydell Signed-off-by: Dongjiu Geng --- User space needs to check this capability of KVM is suggested by Peter[1], this patch as RFC tag because user space patches are still under review, so this kernel patch is firstly sent out for review. [1]: https://patchwork.codeaurora.org/patch/652261/ --- Documentation/virtual/kvm/api.txt | 9 +++++++++ arch/arm64/kvm/reset.c | 1 + include/uapi/linux/kvm.h | 1 + 3 files changed, 11 insertions(+) diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index cd209f7..241e2e2 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -4895,3 +4895,12 @@ Architectures: x86 This capability indicates that KVM supports paravirtualized Hyper-V IPI send hypercalls: HvCallSendSyntheticClusterIpi, HvCallSendSyntheticClusterIpiEx. + +8.21 KVM_CAP_ARM_MEMORY_ERROR_RECOVERY + +Architectures: arm, arm64 + +This capability indicates that guest memory error can be detected by the KVM which +supports the error recovery. When user space do recovery, such as QEMU, it will +check whether KVM and guest support memory error recovery, only when both of them +support, user space will do the error recovery. diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c index b72a3dd..90d1d9a 100644 --- a/arch/arm64/kvm/reset.c +++ b/arch/arm64/kvm/reset.c @@ -82,6 +82,7 @@ int kvm_arch_vm_ioctl_check_extension(struct kvm *kvm, long ext) r = kvm_arm_support_pmu_v3(); break; case KVM_CAP_ARM_INJECT_SERROR_ESR: + case KVM_CAP_ARM_MEMORY_ERROR_RECOVERY: r = cpus_have_const_cap(ARM64_HAS_RAS_EXTN); break; case KVM_CAP_SET_GUEST_DEBUG: diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 2b7a652..3b19580 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -975,6 +975,7 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_HYPERV_ENLIGHTENED_VMCS 163 #define KVM_CAP_EXCEPTION_PAYLOAD 164 #define KVM_CAP_ARM_VM_IPA_SIZE 165 +#define KVM_CAP_ARM_MEMORY_ERROR_RECOVERY 166 #ifdef KVM_CAP_IRQ_ROUTING -- 2.7.4