Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4837806yba; Mon, 13 May 2019 00:03:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzypvpJJo7HA3OAK7E7xZZ3GtEbTw//pbweUpATa3Ev71MVyBiCDwRq6XsjiDB3fX6BxQ2l X-Received: by 2002:a63:1460:: with SMTP id 32mr29215013pgu.319.1557731009910; Mon, 13 May 2019 00:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557731009; cv=none; d=google.com; s=arc-20160816; b=rcQUr0vPeD8iywcMwF2pNmVLG563A6H1cUJbEKjYys46bjyXjMgBZB+qXcMIAYeExr i7Ik5iNpql7pOEamZm8QsNSfZ5WXnQopz2mYPozfN9Hv5HTCKhp++jsV/R+O2SogNmaR pLbQypV/gJLDqI4VslS0EtouP111/OeRzPD9iuM24V+jJErKFSPNZyTngtR0i6RrLZNf lo9M10LW//T6LD2OXrhfTrmeQrzqpMvLg+PyAVowox+VWnDuB8xStkt78Ovd6bfquWtz 2YmkB4sy9EILcVYV4VzDyQArcnDeb9L5azUZU1hWsoXzx01pBcuIBQK8yVF/GfQgjRdv oJ5g== 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=tC1EcGDONQfJssdfPrB7UqAiRRdH0cknYWhr9TwPViY=; b=DTgycXsaMKMwppM8vKX2JR/x9oCnsAcAO/IuvN3OryA2yJ4fKGZYguxpSvHZeQQ6h0 wQgDfvAsIujG5HmonJN/uXZy6OL4GcA7Vn4QStGuBMRZc1clMh4bPdrD2oDiM5y1M8/9 Uxa3U2lkhDQWe+PPdY4rTdGbYFyCS2veR15ONJv0lkub9tjrGW0uLq1JS4JIxG7aTR+9 oMOozHVEB3h4kmu02zwtqh9/dDd3sTR+mTkYz7j3B6BLIqVHwTyscXl8dJ+M/CoiaAD2 RwdYjHXZ21P4/m3LCJAi7dNawWASoaN5sd7I89/ejTShDychcJq3imQpIrudqwfTE2aT og3A== 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 ba1si14735659plb.93.2019.05.13.00.02.46; Mon, 13 May 2019 00:03:29 -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 S1727287AbfEMGcM (ORCPT + 99 others); Mon, 13 May 2019 02:32:12 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7630 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725920AbfEMGcL (ORCPT ); Mon, 13 May 2019 02:32:11 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 4339F9940403AE8FA378; Mon, 13 May 2019 14:32:09 +0800 (CST) Received: from ros.huawei.com (10.143.28.118) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Mon, 13 May 2019 14:32:00 +0800 From: Dongjiu Geng To: , , , , , , , , , , , , CC: , Subject: [RFC PATCH V2] kvm: arm64: export memory error recovery capability to user space Date: Sun, 12 May 2019 23:28:37 -0700 Message-ID: <1557728917-49079-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 --- v1->v2: 1. check whether host support memory failure instead of RAS capability https://patchwork.kernel.org/patch/10730827/ v1: 1. User space needs to check this capability of host 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 | 3 +++ include/uapi/linux/kvm.h | 1 + 3 files changed, 13 insertions(+) diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index cd209f7..822a57b 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 host which +supports the error recovery. When user space do recovery, such as QEMU, it will +check whether host and guest all 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..b6e3986 100644 --- a/arch/arm64/kvm/reset.c +++ b/arch/arm64/kvm/reset.c @@ -84,6 +84,9 @@ int kvm_arch_vm_ioctl_check_extension(struct kvm *kvm, long ext) case KVM_CAP_ARM_INJECT_SERROR_ESR: r = cpus_have_const_cap(ARM64_HAS_RAS_EXTN); break; + case KVM_CAP_ARM_MEMORY_ERROR_RECOVERY: + r= IS_ENABLED(CONFIG_MEMORY_FAILURE); + break; case KVM_CAP_SET_GUEST_DEBUG: case KVM_CAP_VCPU_ATTRIBUTES: r = 1; 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