Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp309imm; Mon, 2 Jul 2018 06:42:06 -0700 (PDT) X-Google-Smtp-Source: AAOMgpehAenE4rxor6cUPtRlnx7zQS0V61kFnEUQEqM1eVZ1HBjJA0dq/lnzgHAXI2RvtDbcMX3x X-Received: by 2002:a63:5fc1:: with SMTP id t184-v6mr21077703pgb.183.1530538926414; Mon, 02 Jul 2018 06:42:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530538926; cv=none; d=google.com; s=arc-20160816; b=u257316sf1sVciyW1Y7VQM4AbgeBXmW3bj2ViDmlPkRKIPQ/6JIeiQ1aqO5B+in9rF qFHESbRxcL6n7+6emfRNEfyz/pJat4nLu08ytUPWQDyve5U5M2DCEr293zoGsc81OQdv Jq512uxQWOi0WAHt6qrzdayX7MieKHdqHClrlglmC1MLwEyFf52iiSmouSrMPtrch4Jo 0xl/yAEbo9ZquyK7gH1gdMX9OXTbWadu143Mh6vs5lZtSVFndrswTLeMlO8RzD8zp0YK lfq2JbTX2ryE4DB8nyD+H/JhDoCiAVh9CxqHOwfEUdPmAr9bktnR41Uo3NS7rOCXsvg5 +QRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=dq+cmdS3zeThF/rJ6GhN3x6sfNZ0WHp9GCHB0QKv7IU=; b=rQie4ATyTdTSciyvA5oWeAWNvt2uJ2QkqxOqxLeNkuYUNrC6lCvPTb7e2ppMoJSD3B gg1zj8XNbkBWI7g9i+CcaoL9pEae5WDJstA0RZDmYsEDxCJammi/JxGG22hIq610onWZ IATtzI1Ru6fDF0HgHTVsvqcnjPTiKMF1k15HXWbVL68IpjAEAHbmN3h6MB+b0xyDNAhr c1GdVwj1Erdo0mn3PDpdZ4o1jJqHOLLiJDq9nN5T4kf1Mua1AKsP2Nqo3ta2mgKmlvQX SyHHSiZrgDfSYjrF4tMCu4iEopTNmfe/OgOHGZvOIq/805W5LadFAmfdi/u0iqF8lDIL VNiA== 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 t10-v6si983598pfk.228.2018.07.02.06.41.49; Mon, 02 Jul 2018 06:42:06 -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 S1752553AbeGBNkz (ORCPT + 99 others); Mon, 2 Jul 2018 09:40:55 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:9152 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752567AbeGBNku (ORCPT ); Mon, 2 Jul 2018 09:40:50 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 10816715F93C8; Mon, 2 Jul 2018 21:40:30 +0800 (CST) Received: from localhost.localdomain (10.143.28.91) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.382.0; Mon, 2 Jul 2018 21:40:23 +0800 From: Dongjiu Geng To: , , , , , , , , , , CC: , Subject: [PATCH v6 2/2] arm64: KVM: export the capability to set guest SError syndrome Date: Mon, 2 Jul 2018 21:40:15 +0800 Message-ID: <1530538815-3847-3-git-send-email-gengdongjiu@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530538815-3847-1-git-send-email-gengdongjiu@huawei.com> References: <1530538815-3847-1-git-send-email-gengdongjiu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.143.28.91] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For the arm64 RAS Extension, user space can inject a virtual-SError with specified ESR. So user space needs to know whether KVM support to inject such SError, this interface adds this query for this capability. KVM will check whether system support RAS Extension, if supported, KVM returns true to user space, otherwise returns false. Signed-off-by: Dongjiu Geng Reviewed-by: James Morse --- change since v5: 1. Rebase this patch to v4.18-rc3 --- Documentation/virtual/kvm/api.txt | 11 +++++++++++ arch/arm64/kvm/reset.c | 3 +++ include/uapi/linux/kvm.h | 1 + 3 files changed, 15 insertions(+) diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index e3940f8..480fa64 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -4643,3 +4643,14 @@ This capability indicates that KVM supports paravirtualized Hyper-V TLB Flush hypercalls: HvFlushVirtualAddressSpace, HvFlushVirtualAddressSpaceEx, HvFlushVirtualAddressList, HvFlushVirtualAddressListEx. + +8.19 KVM_CAP_ARM_SET_SERROR_ESR + +Architectures: arm, arm64 + +This capability indicates that userspace can specify the syndrome value reported +to the guest OS when guest takes a virtual SError interrupt exception. +If KVM has this capability, userspace can only specify the ISS field for the ESR +syndrome, it can not specify the EC field which is not under control by KVM. +If this virtual SError is taken to EL1 using AArch64, this value will be reported +in ISS filed of ESR_EL1. diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c index a3db01a..067c6ba 100644 --- a/arch/arm64/kvm/reset.c +++ b/arch/arm64/kvm/reset.c @@ -77,6 +77,9 @@ int kvm_arch_dev_ioctl_check_extension(struct kvm *kvm, long ext) case KVM_CAP_ARM_PMU_V3: r = kvm_arm_support_pmu_v3(); break; + case KVM_CAP_ARM_INJECT_SERROR_ESR: + r = cpus_have_const_cap(ARM64_HAS_RAS_EXTN); + break; case KVM_CAP_SET_GUEST_DEBUG: case KVM_CAP_VCPU_ATTRIBUTES: case KVM_CAP_VCPU_EVENTS: diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index b6270a3..a7d9bc4 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -949,6 +949,7 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_GET_MSR_FEATURES 153 #define KVM_CAP_HYPERV_EVENTFD 154 #define KVM_CAP_HYPERV_TLBFLUSH 155 +#define KVM_CAP_ARM_INJECT_SERROR_ESR 156 #ifdef KVM_CAP_IRQ_ROUTING -- 2.7.4