Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1885359pxv; Fri, 2 Jul 2021 15:08:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjZR+M87mgaqdNDP3koTbWcQfd6p1C7fF8WhIG6S90GzFX2KDNLC1dp8+BhGwc10QWFKBF X-Received: by 2002:a17:907:c20:: with SMTP id ga32mr1908184ejc.7.1625263733966; Fri, 02 Jul 2021 15:08:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625263733; cv=none; d=google.com; s=arc-20160816; b=P0SEwO3vGSBdY+yqpzgV5Puytw4teHGunpU4h2XxVkW5Q+YuXCy1fYbSThM+B0Pg0A dyF5TqEBZxQFd74+OGgFXHxphEUJ3ITvSXZKNSyW19DmxiYYCXRuP/FhKMeejd0jkZ2J X8ddpbl5p0WJXUkb9N/Gg/noYe/4vSlS67hhFogtz7YAWyLpcIVt/bnSHf0lVkABov3q BQb+tQ3e1EG9HbqeljWdTcF+YiHt6ZPez939Gr3ADgyBB2iPbBbewh/z8in34H9eeatM 9yEYa5rK6jnSO2rLmnEsvfie//43EIbV0cuDbS4uv1cySqeeemLFqGKX60d8yNv4HtaD GlhA== 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=bEqxY5ef6jJFOEcu/++BUviKPD3m4WDfS3XVHt59DTc=; b=oBtPs6/Cfht8ngWiWsHu0tDIu6lcWXO8QkAA/UGWmUkyulXo3lE0pw2W43JRyd86Y8 aVo41AxRH63kMmnCGS/TuqMHxoX0HG6B/XROzKtU28kLOMquiBTbWrvHvHYBXaVkbpgS gZ7Nsgq5NnIePEzib+VSVHEzIVHmfdc73JHWwytfihm+31bDUr7gdreHVAdLEOhrubtl Wnqup5SgAwBxcuYIOX/2qqANC8/6cx20mGDYvptbhIrIVOV9VgTYNzngT++L2L6ku7DI pHfkeUnWijNvTDjul4f6kOOZfLS91q/b217FeoaD/UUtpNtULwo6Ih9TadHVbgnZIv+W T6/A== 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 d22si3611850edr.244.2021.07.02.15.08.31; Fri, 02 Jul 2021 15:08:53 -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 S234185AbhGBWJS (ORCPT + 99 others); Fri, 2 Jul 2021 18:09:18 -0400 Received: from mga12.intel.com ([192.55.52.136]:50197 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233172AbhGBWIA (ORCPT ); Fri, 2 Jul 2021 18:08:00 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10033"; a="188472749" X-IronPort-AV: E=Sophos;i="5.83,320,1616482800"; d="scan'208";a="188472749" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2021 15:05:26 -0700 X-IronPort-AV: E=Sophos;i="5.83,320,1616482800"; d="scan'208";a="642814795" 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:25 -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 37/69] KVM: x86: Check for pending APICv interrupt in kvm_vcpu_has_events() Date: Fri, 2 Jul 2021 15:04:43 -0700 Message-Id: <489df8a1b8fb43677c2c2c5347398ce985713577.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 Return true for kvm_vcpu_has_events() if the vCPU has a pending APICv interrupt to support TDX's usage of APICv. Unlike VMX, TDX doesn't have access to vmcs.GUEST_INTR_STATUS and so can't emulate posted interrupts, i.e. needs to generate a posted interrupt and more importantly can't manually move requested interrupts into the vIRR (which it also doesn't have access to). Signed-off-by: Sean Christopherson Signed-off-by: Isaku Yamahata --- arch/x86/kvm/x86.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f1d5e0a53640..92d5a6649a21 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -11341,7 +11341,9 @@ static inline bool kvm_vcpu_has_events(struct kvm_vcpu *vcpu) if (kvm_arch_interrupt_allowed(vcpu) && (kvm_cpu_has_interrupt(vcpu) || - kvm_guest_apic_has_interrupt(vcpu))) + kvm_guest_apic_has_interrupt(vcpu) || + (vcpu->arch.apicv_active && + kvm_x86_ops.dy_apicv_has_pending_interrupt(vcpu)))) return true; if (kvm_hv_has_stimer_pending(vcpu)) -- 2.25.1