From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-23.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3299AC11F69 for ; Wed, 30 Jun 2021 16:36:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A86A6143A for ; Wed, 30 Jun 2021 16:36:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231938AbhF3Qim (ORCPT ); Wed, 30 Jun 2021 12:38:42 -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-Google-Smtp-Source: ABdhPJwecKj6H+NjwX8y5MJL/bw/FA4OiEOx9nTQk7FQWdW/jMHXnCOUS1I2DRrStXozT9jHEMvF7g== 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 >