Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp557235imm; Tue, 15 May 2018 05:54:47 -0700 (PDT) X-Google-Smtp-Source: AB8JxZraQvE+kkh7F3NS7K7tQB8JHaRgwOBx5r1T9EAZy3gbu2DKHfuGu/Ue1wgX/xBBZhOSgOrS X-Received: by 2002:a62:4916:: with SMTP id w22-v6mr15015557pfa.63.1526388887088; Tue, 15 May 2018 05:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526388887; cv=none; d=google.com; s=arc-20160816; b=c+93uhgeIWSq5IazOGW+iwR+f3BcOwEc63964uQmIKdfZRjhcLZdZw/PoFxR3/jtse MxtFQPSRzScWKsdkpjIzD2Bmu9do+iQm6C7AnoxC7n42v2kzvPXD9H/Q8S7PnajBEfEM 49cTX9TTekbIJqd6mJzafag+ZwZ+Q1dGhHZI2D1k163Im6HhEbkHWsmw7RbqsyVWxvfY p0UNWrEbdUQQyDVwQ0XEUSgkaiO+oZPUEzU1QLVu4zWfRM33wWhayP0HeHGzuFW+DF37 RV34//g4+rjl7ukBbt5SSIhNk0rwUjcj32vKC5FDUTacjTp1F+B2Kx0SersbrX2HnBXU 8A8A== 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=459fE1+uw92yFN5Tv3y2LBHuI6gAo/f6y2osucv1MSI=; b=wxglUwTtgpc7R+8V8fJ90dPLBSmGEsqV18JObkHbmP2VTSx5TCQXK1GNC2hcy8m+bI wv5c1HpTpuHivIA5NvpdthOqJ7eSLsOXxKKpnJB+dRa/pv+BinkYqI8RIyY76E+j52IV pBlHXVTAD79p3oxEfQ4P0g+wgc1Vy9sYf2ZWhzbY8Uu+iPlYFTI5zT0MdzvAVPKcMG8G xZ2ufODdNCRtmswS4GNU2eAfY4zqk+nKZ+wADaVYui1CVs5vmbaVgm4PprLNCdlzafZ5 zsI2pmCG2auPL7sP3A9F7eg8I/YZlEPCWlsOxJ/FOSaNn4wd4XFQOUOJKBqqfyZdkY1Q MIXA== 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 1-v6si2390723pld.450.2018.05.15.05.54.33; Tue, 15 May 2018 05:54:47 -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 S1753403AbeEOMxs (ORCPT + 99 others); Tue, 15 May 2018 08:53:48 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7251 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752102AbeEOMwv (ORCPT ); Tue, 15 May 2018 08:52:51 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 04049E019D6B5; Tue, 15 May 2018 20:52:35 +0800 (CST) Received: from localhost.localdomain (10.143.28.90) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.382.0; Tue, 15 May 2018 20:52:26 +0800 From: Dongjiu Geng To: , , , , , , , , , , , , , , , , CC: , , Subject: [PATCH v12 1/4] arm64: KVM: export the capability to set guest SError syndrome Date: Wed, 16 May 2018 04:58:04 +0800 Message-ID: <1526417887-25843-2-git-send-email-gengdongjiu@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1526417887-25843-1-git-send-email-gengdongjiu@huawei.com> References: <1526417887-25843-1-git-send-email-gengdongjiu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.143.28.90] 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 from V11: 1. Change the commit message 2. Update the Documentation/virtual/kvm/api.tx --- 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 fc3ae95..66494a5 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -4415,3 +4415,14 @@ Parameters: none This capability indicates if the flic device will be able to get/set the AIS states for migration via the KVM_DEV_FLIC_AISM_ALL attribute and allows to discover this without having to create a flic device. + +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 8fb90a0..3587b33 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -934,6 +934,7 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_S390_AIS_MIGRATION 150 #define KVM_CAP_PPC_GET_CPU_CHAR 151 #define KVM_CAP_S390_BPB 152 +#define KVM_CAP_ARM_INJECT_SERROR_ESR 153 #ifdef KVM_CAP_IRQ_ROUTING -- 1.9.1