Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4730785pxv; Tue, 6 Jul 2021 07:52:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCksEi0jtnX3pbcHLOsdtQkLW6vjz8iXRm7i46FIgNMU99QD7k7skxv22kBxSZ2TLKIFhZ X-Received: by 2002:aa7:d48f:: with SMTP id b15mr23449836edr.7.1625583164262; Tue, 06 Jul 2021 07:52:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625583164; cv=none; d=google.com; s=arc-20160816; b=uWwTiu7DYPECMva+uj0kMMbYjwxZ5mXjNlvj2eSIdI77y07A7o0z9ViSWZpoeu7uK/ yPf0HhvsqGmzF/a2Rr3pO7KKrbgCGVpqCYlEwA1eAlT2MGMv6uW8pY7drQ4wyP8MdN7C 3qOri0NmGZ7Mir8RORqX/cMo6JjLGS+bBHLD4gDq2XwHt4C7zjZS9GsGJ+2/1a9VC3tu RIc0Gt48CnLDMsrE0VgpBqS1vIIHS1ds0eTjaGRF39DAk1J/rA9wuWSVXyapC4BTADkB 5ILQ71FagK56wPd9Ykw6p53PnjftIHI0zQOjeqGwP2XZcAKUoqE+4XUXu80n0Yp4z3NR gX1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=TdTS8kT288fhAyYKqmagb6J2AHHMMCxI0DtI3y4+rk0=; b=K2DZeEuab5Acv5weEofhTdA1P0NFd5WRl0UoPs23zDeQdu9B3T3vrtm7QelxYsoJhu /U2HX9L6W4cvQCbkm8Mnk72Fftq2bsyC9ROPzg3y+OHU/6LKl6L3Oh/3C19AdPzIhN7Q AGlf1I+QLwqaqo+SsaepHyafV6eVlFceXwDVNLSDYIsg9f+Fj/0PsREx/sGdru4d2ATH 4RyTR3YJ2qrt6WUxr30u9hFjV3ZH5hP8NFRwlsNM2x3ig7BteiWNWfNzZRBe60SYDS7q t2Ljpo/uRfWaHnmviS4yBJiaaaSwwaNmkt8FQ9XuZ2x3yRKw06Kx2WzckF44yenjKOZs trKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OOP+bky2; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e9si13474826edv.146.2021.07.06.07.52.21; Tue, 06 Jul 2021 07:52:44 -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=@redhat.com header.s=mimecast20190719 header.b=OOP+bky2; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231460AbhGFOwv (ORCPT + 99 others); Tue, 6 Jul 2021 10:52:51 -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-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