Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp620771imu; Thu, 13 Dec 2018 01:18:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/VuIMXW5ET5L2RBOMUn0qETx9GYd0Uzz2g3q5uMmrAYfZE8htsGRNtziq0q34fq4pWzi1K8 X-Received: by 2002:a63:b94c:: with SMTP id v12mr21108313pgo.221.1544692698248; Thu, 13 Dec 2018 01:18:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544692698; cv=none; d=google.com; s=arc-20160816; b=LL7ZDpwmw0bg2f0f8FnAP4Um1WRxfhGbPcjylKzd7h7G0UkTOWqrxN4TUz0/ZWV1Cb ez7vvqAd8wBBq73YHPpFJpScUm0yyozjErsdiV0tDepaJFKZd9yPzwjnOC06fPB/UQ9+ ccDuWkAokmpwZJTIoR8PPn4G/dZETY+Eu0QeXwOPy7bK6WbuApSPbxs9yHcFDsgaS1Jr ocBaqVAekW058HgQmGty4DPj9f8SWnHQD3sA7vjedrNOEHgFoYUgAQdxoB1hpfzIGStF KELvJoQ8EySa4drI7FfxNf/b/vNv6GgFeQ3CskN+lFfkJKmSwonKHcKSP2GrsoHHZ4Zu /JwA== 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:cc :to:from; bh=yS7vcqrco507nHb4xzNCsayEfPboE9ZFvPpSzL6nZk8=; b=Pb44lGDr+5+nPltZUEK7Bu915PjklUmFQb3Rr/KezjYcwZoWi8iG+U/Hra9hBxfrc8 FnLx0c/f6MiqGu0y23ypRx48/ac6NV7KPHP1Ayb9mDDFzoejqGUgJfBi+lHZuP7c+uRZ jh6wt/qoV+BVDbdE7TS7IaWbmp43JE6MxxcUImQlpZVJZtMCrnS/AykZaSglta7t8NdI 1p1LcZsQjgif5B/K3jho71zzfyo+aH9jq8MQ9Lq1yKECYGbFLQ2ZWIoZe9hbqOhSGWDO O8p4f02cbZDWCN1KfVz/pgKTxn075nZim0uu0+2zQM8SAWOJUjlj8FeRb0VYOC8uuann gXiQ== 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 186si1000807pgi.424.2018.12.13.01.18.03; Thu, 13 Dec 2018 01:18:18 -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 S1727768AbeLMJRR (ORCPT + 99 others); Thu, 13 Dec 2018 04:17:17 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:49753 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726578AbeLMJRR (ORCPT ); Thu, 13 Dec 2018 04:17:17 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 7A2F4B3F2E01E; Thu, 13 Dec 2018 17:17:12 +0800 (CST) Received: from ros.huawei.com (10.143.28.118) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.408.0; Thu, 13 Dec 2018 17:17:04 +0800 From: Dongjiu Geng To: , , , , , , , , , CC: Dongjiu Geng , Peter Maydell Subject: [PATCH RFC] kvm: arm64: export memory error recovery capability to user space Date: Thu, 13 Dec 2018 01:15:31 -0800 Message-ID: <1544692531-9122-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