Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1885178pxv; Fri, 2 Jul 2021 15:08:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN8YcjHJxluI67K9m6ffhFQaWOTNvp6TU4l4ny44RbjMW8hIG/PnWrv25ZDkVr8vWJVrjc X-Received: by 2002:a17:906:85d9:: with SMTP id i25mr1845444ejy.491.1625263717171; Fri, 02 Jul 2021 15:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625263717; cv=none; d=google.com; s=arc-20160816; b=cEmD2S+clP5MZ2DgZVHq/2kILJHmDH1ZkPWvVc76ybM4D+nB59OZjlI3NgC9/B6zh9 Rj4DR0OOYauhvsoAu7jhaT68dDRxSuX/4jhrav1xJX/ZbQy/yA6o9zTCYMa38iI9ohn9 ExPcM2OWQ+L5ny/59sOBW4lk+x42PGUXYtAC45L2v/Vq/AaYGBTuxR6ITsHirlnIA8c9 qsFcBi+mbWXafbQyyI03rd7/gfBR/XaGvmJjra+muapd1wb9GWakKx/36H9tui5eSj4u KdrobAjArUHiloJVwDYwIP0OPapGO1sPGPI3yJRpwnSn4rqBaqYfwndGXq37cwLs4xn1 T60Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=dEWWtlfUHxkpBiyViF9FGb9GW/hp/cjNYyNAwNjXq30=; b=ibD4wdkVYnIL9UBzY7mE0pDAa+mO3ZtclEQhdU8URXlPf0FXOSo48dM9bYblSiNVDM M6S0VicaPXjrJJX/pRvIiNsgV7tHaHxzM2dU9XEoGK6KL3EHFxOpcWQtf/ceMJC56iTj IvCcAqzALuOMZxvwkF0wVvAwl+yxFKh0R9pLRw9Sera/ftRHTPgEQcIAo2KB5WHeGNXX K/8TYQbqTg+i6EPMQ4/eQ9kw/VL/XtN3z2DCLcJYPFQO155nweQiiTIdmMjn7DsmlbGs brkvpIzc9x3EeszNju1Xw+B+12onhsB1bXTrm2SukmkoJXoSzaewetYGuy4LSyFn74EF HM+Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id js21si4940475ejc.229.2021.07.02.15.08.14; Fri, 02 Jul 2021 15:08:37 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233780AbhGBWJB (ORCPT + 99 others); Fri, 2 Jul 2021 18:09:01 -0400 Received: from mga17.intel.com ([192.55.52.151]:15270 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233228AbhGBWIC (ORCPT ); Fri, 2 Jul 2021 18:08:02 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10033"; a="189168370" X-IronPort-AV: E=Sophos;i="5.83,320,1616482800"; d="scan'208";a="189168370" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2021 15:05:29 -0700 X-IronPort-AV: E=Sophos;i="5.83,320,1616482800"; d="scan'208";a="642814839" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2021 15:05:28 -0700 From: isaku.yamahata@intel.com To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Paolo Bonzini , 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@intel.com, isaku.yamahata@gmail.com, Sean Christopherson Subject: [RFC PATCH v2 49/69] KVM: VMX: Modify NMI and INTR handlers to take intr_info as param Date: Fri, 2 Jul 2021 15:04:55 -0700 Message-Id: <19efa94306ba82e433602af45d122265fa39b0c4.1625186503.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)); } /* -- 2.25.1