Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp747483imm; Fri, 8 Jun 2018 04:44:48 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIapeMDF38lRFzb6IAqrLA+awgxIC5mEbOGn+6g5iX8BX2ZQrK0KR5zL8qsk8sneEpv2+2o X-Received: by 2002:a62:1e02:: with SMTP id e2-v6mr5724459pfe.212.1528458288650; Fri, 08 Jun 2018 04:44:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528458288; cv=none; d=google.com; s=arc-20160816; b=VxHyCQCz3z6cq79upM2UO6J5HfuJlNu/936adnU/AWXMSun7r4UMPblumqm13st8LY R6lfyzSHO3Y4hG4Ifasuu4tAY0Spt0a5t26bNWhqg+9C3D0T3vQjaXnbUFLXEHsP9wDy oOwYj40e7/zHNmIk3cAhtQipVhFinuDfSBtcFHKAg4Vu9zQPY+n6CyAerkHJQpYk1fRl GQ2kgkT2yz2qUIVZXJU8saC7AvXN99O+tB0pfSKCLKbAVseJ8b6luqF2d+Q+JAsnExu1 F7lzbvRhiayb7H/LUznqA8hBa7XfFeIzBVlM7585tJMwuRxhajSWKTQR19TG4cCHgGZz BoIA== 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:to:from:arc-authentication-results; bh=hiXyzN773iAVd8pA+ohemdsumfr7yc9JkyAI3FhfsXg=; b=Mno5+KxM3DoigD3zzHoXG46nuiFnEQUc7kXvFcMAjOvw2nKN4emQiHiYuckTBbmerm Vm+T4GbuAGcisYS3ovajRUrxJhzLEpBVUeCyGKda90UGutLQMSijHfCYJs0uM4hNAWtZ dBNDyI4PCFuwBo4+wq0I/JR4SO+iXLKeXi/ZcIhjWL0HoOOH4OtHJhstSSFjssqojNdk tUmVcPtgjH37D3j0dNeVpzuOhwk3wXar7HwPPfS17wM4xU9d3cVVaMXh5VJ/3C3yVEOL zd6Y9epf5HA+c5BL3QOfwVenytG/q7tyjNc98YLeKYR7mmMJbfe5Ob763D0RETyAdX1w hoxQ== 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 c26-v6si17263549pge.596.2018.06.08.04.44.34; Fri, 08 Jun 2018 04:44:48 -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 S1752628AbeFHLnn (ORCPT + 99 others); Fri, 8 Jun 2018 07:43:43 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8655 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751466AbeFHLnl (ORCPT ); Fri, 8 Jun 2018 07:43:41 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 67B809AFA0F50; Fri, 8 Jun 2018 19:43:26 +0800 (CST) Received: from localhost.localdomain (10.143.28.90) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.382.0; Fri, 8 Jun 2018 19:43:18 +0800 From: Dongjiu Geng To: , , , , , , , , , , , , , Subject: [PATCH RESEND v4 1/2] arm64: KVM: export the capability to set guest SError syndrome Date: Sat, 9 Jun 2018 03:48:39 +0800 Message-ID: <1528487320-2873-2-git-send-email-gengdongjiu@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1528487320-2873-1-git-send-email-gengdongjiu@huawei.com> References: <1528487320-2873-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 --- 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 -- 2.7.4