From patchwork Tue Jun 5 20:46:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongjiu Geng X-Patchwork-Id: 10448215 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1F2B460234 for ; Tue, 5 Jun 2018 13:05:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D4602922B for ; Tue, 5 Jun 2018 13:05:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01F5A2925D; Tue, 5 Jun 2018 13:05:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 70B3A2922B for ; Tue, 5 Jun 2018 13:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mo2gXdRwU4hwBu0tBhUXxJXBY8EdejVWVpJCrAM7mWI=; b=XfUiDVJoXUceyK aG9Np1I8K3sC14ryyyMFT31PiwMwiH7GCOcQQCF0PMvMOUs2pJeM9zN5w6k92Gt5MmL6x2vr1VTQf RD0cBi5pKQ+NMx7eVv8ZSzcO5OjO5kq351N9csGrr5mXOdTkC+zD44F6SFsPUkfOmuJ/5lmuA8lA2 u5Fu5P6Cqvjf6jV7DKyhgDsk3TtbS3XiyziKwBnATZobozcgAaxgHN4TW35QmGOPYr6gICRGLCI1N umECxgxw4RYO63CGuPdXmtWyD19P9c447Eank+YxkUG8oTVGCAbsFtIX63w8hScVcEaa8GIfLDd7S HrLirPJWOeyMg0vzrmUA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQBeR-0003MX-3u; Tue, 05 Jun 2018 13:05:27 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQBeO-0003D0-HO for linux-arm-kernel@bombadil.infradead.org; Tue, 05 Jun 2018 13:05:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hiXyzN773iAVd8pA+ohemdsumfr7yc9JkyAI3FhfsXg=; b=PdSeAPOC/yI4F45mULBnT1XuM zyBSy+BnJXqiSx0BgU19M2vDZHRrNwQUtBYk8meycfUV/BDdp5qACEyN1MQnblj3IvkwadSsxYC4u If1ZEpYTiEHG+FLZZnjAtHPYDvtVbjNush8ac1lYTBWbImkHbYHUEnWSay5Uysnu2wTGkpsAeFUi9 RRHPQUN66fSjyQ/buyzOlOTZMXlhKSowv5Ly1RI1M2KJGuMActHu7FpDltTpNDmzczT//Ao0Ijzyg USh/oTrdJypd+qSlCjqvqsoNHwKfHm6Tm2NAenwyuseypLY9FO6D+AkISwRVlfgD90L/nuZBX99SY P3iZmfHQA==; Received: from [45.249.212.35] (helo=huawei.com) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQBHC-0004o6-Kp for linux-arm-kernel@lists.infradead.org; Tue, 05 Jun 2018 12:41:27 +0000 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id D8296ACEAFED2; Tue, 5 Jun 2018 20:41:03 +0800 (CST) Received: from localhost.localdomain (10.143.28.90) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.382.0; Tue, 5 Jun 2018 20:40:59 +0800 From: Dongjiu Geng To: , , , , , , , , , , , , , Subject: [PATCH v3 1/2] arm64: KVM: export the capability to set guest SError syndrome Date: Wed, 6 Jun 2018 04:46:21 +0800 Message-ID: <1528231582-19370-2-git-send-email-gengdongjiu@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1528231582-19370-1-git-send-email-gengdongjiu@huawei.com> References: <1528231582-19370-1-git-send-email-gengdongjiu@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.143.28.90] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180605_084126_956152_52E67E8A X-CRM114-Status: GOOD ( 11.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 758bf40..fdac969 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -4603,3 +4603,14 @@ Architectures: s390 This capability indicates that kvm will implement the interfaces to handle reset, migration and nested KVM for branch prediction blocking. The stfle facility 82 should not be provided to the guest without this capability. + +8.14 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 3256b92..38c8a64 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: r = 1; diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index b02c41e..e88f976 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -948,6 +948,7 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_S390_BPB 152 #define KVM_CAP_GET_MSR_FEATURES 153 #define KVM_CAP_HYPERV_EVENTFD 154 +#define KVM_CAP_ARM_INJECT_SERROR_ESR 155 #ifdef KVM_CAP_IRQ_ROUTING