Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp467811pxv; Wed, 30 Jun 2021 09:36:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycZT/smX4/zg+t5GFoCBK3BbvKIlA3XavH4EpOCIfBW3uCS46svguBr1NlVe8HpAms2n7v X-Received: by 2002:a05:6638:3048:: with SMTP id u8mr9482382jak.91.1625071017385; Wed, 30 Jun 2021 09:36:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625071017; cv=none; d=google.com; s=arc-20160816; b=XfJSUuyqYu6psaBPkPhvadN6K3DkvY0KfcRWtLnVFPJJw9cSlZzbmVj2e8dZPGHXMa Q1oMMGwlrleDNpMGXWayzEUUk2p3ltUWy1d01NzBosCvLnPb5Z2oWdpdTQ3rS9lyoEmW cgdxQr1DIrU5CyH/lS7KaLwxNwjMpVZoHcNJ/cQaj5KsekDZIfMejZGxgNz1rtciKw6E moIwAV9LnUTm9EcGjE5Pr0qMC90cNZidRJ9Hv6zS/OIPNfmWL/jqp4rXzu1vJjmn5ZgQ gExzuBQj9/38q6REX0pMxwFtNj4s2Cjm0537pYokeEX+5tTeyRVFI5ypao1zPzC7Zt// B59Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Gt4onubAx7G0CxXKHtUNgeuC3ZM/JmcMvLDBhaGnhv8=; b=Q29sT0YZefzCOOIXIf0qAocKL40mQRvAP7LHL0El44x4d9/phiUDGtbFYh3BgL/biv 80AFg1GvYniPczN6BWu+wKPb7J8il/p9t1nGvt9bj63EaD1xwo2kYNH19T+fOvwZvcuy M8MEjqxw4CHLO5DLNnwXoF/rjvvlDcza7w0xKUTkbQUvcFjEoNfWzwidHDrUkfMAmScU EgDo/hjmbF0jQdWyiE1GRTcQ1g3D+soaUcIjwNU6l007RIkMWPQibkzsa8OCmYQTnOWi 4u7ua94eHNjs8RywqvS9xiAkYd4PPno6AF3vELQhZvD9osQL/0pZIGJU/woYs20973ym BCfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ZPAlH+fu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w17si22236445iot.47.2021.06.30.09.36.44; Wed, 30 Jun 2021 09:36:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ZPAlH+fu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231536AbhF3Qil (ORCPT + 99 others); Wed, 30 Jun 2021 12:38:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbhF3Qik (ORCPT ); Wed, 30 Jun 2021 12:38:40 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99CE9C0617A8 for ; Wed, 30 Jun 2021 09:36:10 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id v7so2855434pgl.2 for ; Wed, 30 Jun 2021 09:36:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Gt4onubAx7G0CxXKHtUNgeuC3ZM/JmcMvLDBhaGnhv8=; b=ZPAlH+fu2F6ViOv2Y8BvrXaPW0CjFSxdpHtwCe0QsweafEjigEOOFhw98t62muaNvz HnRYgSnlRZoeh2HkTND9X2eetqyP+hWu/t4bXFYmV5S0c4GznZJAh1MTXn7NbfAgPGh/ gFAYTlHvWM+9lsZQ4swAGLrEkOebnyws7iR4heQivOc4dQ6BX7WPccm7wbTn/nAF6rJf JxwEPni4ZrOz6eCIJLCNGr2ZyGMfW5/7wsIjdlGPCm0I1OML6n/+OsMnteCAvqo5jZX8 7bixvJRq7/OifEaVuC6MEr4zuI1s8ZJYoUdyKDMluQcFOQIZfJ+haM14IG+NJdFmJRTQ Bfqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Gt4onubAx7G0CxXKHtUNgeuC3ZM/JmcMvLDBhaGnhv8=; b=BCh8GEkCOXdeOPdk7kpY7FUza8ulLJ+cQN6z7joaJtpbZlRQOiOv5cSqv2w2KxZM6G QO+2loDiIJLZ5ryz9D5U3/PpgEru8jvjrp2MvNi+pg3JVmXgSmX2se7UiId43Xoxb9oy VpCP3tvF29LjH+gpeJpCim11klV96ZB+AImkwrawKSEwy9BjqhfhxtHKyIUX5eR/bvlz b4Hnvx4O5/y3ZkjInuqE0MBPumgX82qJYO7pn7Sdg90RRiEcDHwKHoZQzb8bzVDpzr4O igoFwau/gO3g5LtmA9jn8nylN470+FLcQMh12wUQmI8gXeYLZMPE8X+awWoqGO9eErus 2fYw== X-Gm-Message-State: AOAM533PYP8CmOYeiXYDrBq1gt0gzDczuNSN2ESF1kZTYp/OM+WRrJBN uwpz5WcrtzB5f7pAI14u4DcC0g== X-Received: by 2002:a63:405:: with SMTP id 5mr4358178pge.132.1625070969980; Wed, 30 Jun 2021 09:36:09 -0700 (PDT) Received: from google.com (254.80.82.34.bc.googleusercontent.com. [34.82.80.254]) by smtp.gmail.com with ESMTPSA id w6sm40994pgh.56.2021.06.30.09.36.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 09:36:09 -0700 (PDT) Date: Wed, 30 Jun 2021 16:36:05 +0000 From: David Matlack To: David Edmondson Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Thomas Gleixner , Borislav Petkov , Vitaly Kuznetsov , Joerg Roedel , Ingo Molnar , Sean Christopherson , Wanpeng Li , Jim Mattson , "H. Peter Anvin" , Paolo Bonzini , x86@kernel.org Subject: Re: [PATCH 1/2] KVM: x86: Add kvm_x86_ops.get_exit_reason Message-ID: References: <20210628173152.2062988-1-david.edmondson@oracle.com> <20210628173152.2062988-2-david.edmondson@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210628173152.2062988-2-david.edmondson@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 28, 2021 at 06:31:51PM +0100, David Edmondson wrote: > For later use. Please add more context to the commit message. > > Signed-off-by: David Edmondson > --- > arch/x86/include/asm/kvm-x86-ops.h | 1 + > arch/x86/include/asm/kvm_host.h | 1 + > arch/x86/kvm/svm/svm.c | 6 ++++++ > arch/x86/kvm/vmx/vmx.c | 6 ++++++ > 4 files changed, 14 insertions(+) > > diff --git a/arch/x86/include/asm/kvm-x86-ops.h b/arch/x86/include/asm/kvm-x86-ops.h > index a12a4987154e..afb0917497c1 100644 > --- a/arch/x86/include/asm/kvm-x86-ops.h > +++ b/arch/x86/include/asm/kvm-x86-ops.h > @@ -85,6 +85,7 @@ KVM_X86_OP_NULL(sync_pir_to_irr) > KVM_X86_OP(set_tss_addr) > KVM_X86_OP(set_identity_map_addr) > KVM_X86_OP(get_mt_mask) > +KVM_X86_OP(get_exit_reason) > KVM_X86_OP(load_mmu_pgd) > KVM_X86_OP_NULL(has_wbinvd_exit) > KVM_X86_OP(get_l2_tsc_offset) > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index 974cbfb1eefe..0ee580c68839 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -1365,6 +1365,7 @@ struct kvm_x86_ops { > int (*set_tss_addr)(struct kvm *kvm, unsigned int addr); > int (*set_identity_map_addr)(struct kvm *kvm, u64 ident_addr); > u64 (*get_mt_mask)(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio); > + u64 (*get_exit_reason)(struct kvm_vcpu *vcpu); > > void (*load_mmu_pgd)(struct kvm_vcpu *vcpu, hpa_t root_hpa, > int root_level); > diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c > index 616b9679ddcc..408c854b4ac9 100644 > --- a/arch/x86/kvm/svm/svm.c > +++ b/arch/x86/kvm/svm/svm.c > @@ -4009,6 +4009,11 @@ static u64 svm_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) > return 0; > } > > +static u64 svm_get_exit_reason(struct kvm_vcpu *vcpu) > +{ > + return to_svm(vcpu)->vmcb->control.exit_code; > +} > + > static void svm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) > { > struct vcpu_svm *svm = to_svm(vcpu); > @@ -4573,6 +4578,7 @@ static struct kvm_x86_ops svm_x86_ops __initdata = { > .set_tss_addr = svm_set_tss_addr, > .set_identity_map_addr = svm_set_identity_map_addr, > .get_mt_mask = svm_get_mt_mask, > + .get_exit_reason = svm_get_exit_reason, > > .get_exit_info = svm_get_exit_info, > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 927a552393b9..a19b006c287a 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -6997,6 +6997,11 @@ static u64 vmx_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) > return (cache << VMX_EPT_MT_EPTE_SHIFT) | ipat; > } > > +static u64 vmx_get_exit_reason(struct kvm_vcpu *vcpu) > +{ > + return to_vmx(vcpu)->exit_reason.basic; Why not the full exit reason? > +} > + > static void vmcs_set_secondary_exec_control(struct vcpu_vmx *vmx) > { > /* > @@ -7613,6 +7618,7 @@ static struct kvm_x86_ops vmx_x86_ops __initdata = { > .set_tss_addr = vmx_set_tss_addr, > .set_identity_map_addr = vmx_set_identity_map_addr, > .get_mt_mask = vmx_get_mt_mask, > + .get_exit_reason = vmx_get_exit_reason, > > .get_exit_info = vmx_get_exit_info, > > -- > 2.30.2 >