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=-18.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 CAEF4C07E96 for ; Tue, 6 Jul 2021 14:50:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4B82613BD for ; Tue, 6 Jul 2021 14:50:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232403AbhGFOww (ORCPT ); Tue, 6 Jul 2021 10:52:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:26562 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231509AbhGFOwp (ORCPT ); Tue, 6 Jul 2021 10:52:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625583005; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TdTS8kT288fhAyYKqmagb6J2AHHMMCxI0DtI3y4+rk0=; b=OOP+bky2RWCbVBKCKzIgm2jEm/dHR1Nt0x2FW5H1Ue/yEMFckNMDs8tGoCu8Ujz210k1BP MxdmXthX+OstqFWcRwBbStpnifUvSg7+jigwArp+PFAbCeMwJNxkuZfVBPJkSrYH1hjzcm BhbWdyt8YYDjbsqHf/oh0BjGLPKIP00= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-229-r0etMxAxOhGjghxbuh0DaQ-1; Tue, 06 Jul 2021 10:50:04 -0400 X-MC-Unique: r0etMxAxOhGjghxbuh0DaQ-1 Received: by mail-wm1-f72.google.com with SMTP id m5-20020a05600c3b05b029020c34fd31cfso1206640wms.4 for ; Tue, 06 Jul 2021 07:50:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=TdTS8kT288fhAyYKqmagb6J2AHHMMCxI0DtI3y4+rk0=; b=aR7XGRHEP5THVlt4SHp3g/h9sNR4ACFtpTNGAMOs++TPO1euYFVuhyfjarygQmSeIS hOOOAqND6Mtn3SwToElu8RNgA7N3Osdh/KygRTy8WiaLbU9rY8aGAjOFnwkeeVsU/HaH RXLokOWtI73CvRD/GEb3zgGzK3ErGHdl+hU+eSFfSnnjpW1+l3TqZkbMgJOj7fKMVHdq xJeklsNYjl3qZ/lVZBUwbV0qtODQxqLnGoGOGebGl6WE3MTPsuLThzE7kv7J761NT4W2 sULO99sdw3o+yFdBeG/tgoHxfuSmS6p2AIF9IBHuMqsvy6V9uth8P4/fN0ex1doSMTj9 +Y0g== X-Gm-Message-State: AOAM532FqxyTrHRsj9W7VFLrHyvLjWuiMO6Yo15kLKHp/nVdTZ4qWTNd 26EPr9VUDdp7S44xWPipB47w88bqKN5GswfB3JRalpkWOJGMnBz6ZuDiwNKdGd+eCDpwajBBFkz XR4kQr6FRWdNHsGKi7dJ+Bmde X-Received: by 2002:a05:600c:19d1:: with SMTP id u17mr20881430wmq.177.1625583003530; Tue, 06 Jul 2021 07:50:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcFU4w1Goi12UWvOnmDkmQSuExGESuRg8DpVmkjziNO9hSb2+42NzC5kTSrUCWvAby/xRO0w== X-Received: by 2002:a05:600c:19d1:: with SMTP id u17mr20881409wmq.177.1625583003387; Tue, 06 Jul 2021 07:50:03 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id o19sm3097448wmc.12.2021.07.06.07.50.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jul 2021 07:50:02 -0700 (PDT) Subject: Re: [RFC PATCH v2 49/69] KVM: VMX: Modify NMI and INTR handlers to take intr_info as param To: isaku.yamahata@intel.com, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , erdemaktas@google.com, Connor Kuehl , Sean Christopherson , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: isaku.yamahata@gmail.com, Sean Christopherson References: <19efa94306ba82e433602af45d122265fa39b0c4.1625186503.git.isaku.yamahata@intel.com> From: Paolo Bonzini Message-ID: Date: Tue, 6 Jul 2021 16:50:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <19efa94306ba82e433602af45d122265fa39b0c4.1625186503.git.isaku.yamahata@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/07/21 00:04, isaku.yamahata@intel.com wrote: > From: Sean Christopherson > > Pass intr_info to the NMI and INTR handlers instead of pulling it from > vcpu_vmx in preparation for sharing the bulk of the handlers with TDX. > > Signed-off-by: Sean Christopherson > Signed-off-by: Isaku Yamahata > --- > arch/x86/kvm/vmx/vmx.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 7ce15a2c3490..e08f85c93e55 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -6404,25 +6404,24 @@ static void handle_interrupt_nmi_irqoff(struct kvm_vcpu *vcpu, > kvm_after_interrupt(vcpu); > } > > -static void handle_exception_nmi_irqoff(struct vcpu_vmx *vmx) > +static void handle_exception_nmi_irqoff(struct kvm_vcpu *vcpu, u32 intr_info) > { > const unsigned long nmi_entry = (unsigned long)asm_exc_nmi_noist; > - u32 intr_info = vmx_get_intr_info(&vmx->vcpu); > > /* if exit due to PF check for async PF */ > if (is_page_fault(intr_info)) > - vmx->vcpu.arch.apf.host_apf_flags = kvm_read_and_reset_apf_flags(); > + vcpu->arch.apf.host_apf_flags = kvm_read_and_reset_apf_flags(); > /* Handle machine checks before interrupts are enabled */ > else if (is_machine_check(intr_info)) > kvm_machine_check(); > /* We need to handle NMIs before interrupts are enabled */ > else if (is_nmi(intr_info)) > - handle_interrupt_nmi_irqoff(&vmx->vcpu, nmi_entry); > + handle_interrupt_nmi_irqoff(vcpu, nmi_entry); > } > > -static void handle_external_interrupt_irqoff(struct kvm_vcpu *vcpu) > +static void handle_external_interrupt_irqoff(struct kvm_vcpu *vcpu, > + u32 intr_info) > { > - u32 intr_info = vmx_get_intr_info(vcpu); > unsigned int vector = intr_info & INTR_INFO_VECTOR_MASK; > gate_desc *desc = (gate_desc *)host_idt_base + vector; > > @@ -6438,9 +6437,9 @@ static void vmx_handle_exit_irqoff(struct kvm_vcpu *vcpu) > struct vcpu_vmx *vmx = to_vmx(vcpu); > > if (vmx->exit_reason.basic == EXIT_REASON_EXTERNAL_INTERRUPT) > - handle_external_interrupt_irqoff(vcpu); > + handle_external_interrupt_irqoff(vcpu, vmx_get_intr_info(vcpu)); > else if (vmx->exit_reason.basic == EXIT_REASON_EXCEPTION_NMI) > - handle_exception_nmi_irqoff(vmx); > + handle_exception_nmi_irqoff(vcpu, vmx_get_intr_info(vcpu)); > } > > /* > Reviewed-by: Paolo Bonzini