Received: by 10.213.65.68 with SMTP id h4csp750641imn; Sun, 18 Mar 2018 00:35:45 -0700 (PDT) X-Google-Smtp-Source: AG47ELsWffqTe9OI8T5MR7f9YKdXsKHP2IkaNmXMm+1xCnhwj3TzIaGQEjsCJIkfBhM0tUD+0sep X-Received: by 10.99.190.5 with SMTP id l5mr4346456pgf.25.1521358545241; Sun, 18 Mar 2018 00:35:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521358545; cv=none; d=google.com; s=arc-20160816; b=h7kZ1PDMT9qWpPe+wWffZw1Uk6nUsDCDVUBGmlTuDwzOdWhyW2z4zc/BMcNB3wCQCC Nx+LV2ttf319yODZVVL8yUBqwrz0VsyC4LYzGAPn2SLLzAgL+R6VV2BjZ1PpgTg1Xavp togUv64VWJvgsspK2zah8Nu04UbhLmPKj96W9sUjh1zpf6ILMu4GE3Vpl4yaNsPBj5z2 ytYK5AM2bLkz4g2IGMZlVqtY8O9ZjvFLbUnY53+3kfy7dy1tbq7RkL1bjsos8YxpJIrP FslIOQsz62tGNeN7+vAzxyJD94fX+n4nQcWc6bHWU/K0Poe4Zv53ly6akl+geSQlCePl zevQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from:arc-authentication-results; bh=xLMgbeRJ3nG+cR9RhurAFNyOaEF4B0zFC6g2XP4a13c=; b=KIT4RhBTzVOYstlVCs17sAdq2DCIzzF9ZYJxTJ8+AWNjYYmoVeKADT8t0VHxrtGnKv Cv6L+38p0/twfCYkQTWkqBskIiSANGDg+XhX2BSAbsnWf/fRZNqBcSMgLoc33SByP1J5 35xUWxeAdXitBUx2bzaKQ/3WZ+oWmX8jxDrn15seUd37F/QTG7jF8oYQkLEWih0bgObg ue+LrQinVxW0tq72idkg2jLEDl8+LTKDPcEEjqw+09E0tWl720deq+GyLjtxuofGlMg/ HgSOXjRZ2yQG/0XxFr1f88lkydNSpyN0+6lCuCGjhPGFh0b4cGMWh5T3YOTeCji9o8sy 4I1Q== 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 p10-v6si9466870plr.181.2018.03.18.00.35.30; Sun, 18 Mar 2018 00:35:45 -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 S1752312AbeCRHeY convert rfc822-to-8bit (ORCPT + 99 others); Sun, 18 Mar 2018 03:34:24 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:5517 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750943AbeCRHeU (ORCPT ); Sun, 18 Mar 2018 03:34:20 -0400 Received: from DGGEMA404-HUB.china.huawei.com (unknown [172.30.72.57]) by Forcepoint Email with ESMTP id 06DE3DCCCEA10; Sun, 18 Mar 2018 15:34:05 +0800 (CST) Received: from DGGEMA503-MBS.china.huawei.com ([169.254.2.193]) by DGGEMA404-HUB.china.huawei.com ([10.3.20.45]) with mapi id 14.03.0361.001; Sun, 18 Mar 2018 15:34:00 +0800 From: gengdongjiu To: James Morse CC: "rkrcmar@redhat.com" , "corbet@lwn.net" , "christoffer.dall@linaro.org" , "marc.zyngier@arm.com" , "linux@armlinux.org.uk" , "catalin.marinas@arm.com" , "rjw@rjwysocki.net" , "bp@alien8.de" , "lenb@kernel.org" , "kvm@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.cs.columbia.edu" , "linux-acpi@vger.kernel.org" , "devel@acpica.org" , "Huangshaoyu (Shawn)" , Wuquanming Subject: Re: [PATCH v10 2/5] arm64: KVM: export the capability to set guest SError syndrome Thread-Topic: [PATCH v10 2/5] arm64: KVM: export the capability to set guest SError syndrome Thread-Index: AdO+houoBcOVQjlkQROqtgWzJuDwZQ== Date: Sun, 18 Mar 2018 07:33:59 +0000 Message-ID: <0184EA26B2509940AA629AE1405DD7F201B6C27D@DGGEMA503-MBS.china.huawei.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.45.52.52] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi James, Thanks for your time to review and give comments. [...] > > + > > +8.14 KVM_CAP_ARM_SET_SERROR_ESR > > + > > +Architectures: arm, arm64 > > + > > +This capability indicates that userspace can specify syndrome value > > +reported to guest OS when guest takes a virtual SError interrupt exception. > > "when userspace triggers a virtual SError"... how? In the user space(QEMU), it will call kvm_arch_put_registers() or kvm_arch_get_registers() to set or get KVM registers through KVM_SET_ONE_REG/ KVM_GET_ONE_REG IOCTL, at the same time the two functions will separately call kvm_arm_vcpu_get_events() and kvm_arm_vcpu_set_events() to get/set vcpu events. If user space want to trigger a virtual SError with specified ESR, it only need to setup the kvm_vcpu_events struct(exception.serror_pending = 1; exception.serror_has_esr=1; serror_esr=xxxxx), then KVM will trigger this virtual SError. userspace can trigger it at any time, for example, for debug purpose. Or simulate a SError after recording a CPER for guest. But before triggering a virtual SError, it needs to know whether KVM has such capability, so KVM needs to export this capability to user space. If has this capability, User space will call kvm_arm_vcpu_set_events() to trigger a virtual SError. > > > > +If KVM has this capability, userspace can only specify the ISS field > > +for the ESR syndrome, can not specify the EC field which is not under control by KVM. > > Where do I put the ESR? > If you re-order this after the patch that adds the API, you can describe how this can be used. Ok, thank a lot for your suggestion. > > > Thanks, > > James > > > > > +If this virtual SError is taken to EL1 using AArch64, this value will > > +be reported into 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 > > > >