Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2645280rda; Wed, 25 Oct 2023 08:28:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFr152PnEATZ7P/lrn/66wq1Kb6Vk5ORNVaNl+tmL5Cq7/CTsq421hQxJ5yZ5+gXrgMNYeQ X-Received: by 2002:a05:6902:503:b0:d86:57cc:aa74 with SMTP id x3-20020a056902050300b00d8657ccaa74mr15939902ybs.35.1698247696822; Wed, 25 Oct 2023 08:28:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698247696; cv=none; d=google.com; s=arc-20160816; b=FEFblulYccq/DcC5ynd2mKJ739kPD2n8iV+zhTE35k1mRS6eij6mkdfU3y/uS0SfCe 6ABuMG4uuxYOKMYHzQvlbwLU93cFVrDJTg1eQY6bIQc6JRIqVEbt62TX7wptFuVMx7ZG TXqWQiVDScCtG3klKm8V0o/2wswcU6VGdXN5A064NLIeimp6xUjv+qbcksGX6CvwSy6v huv/r8WwAdKDixWR8L/hx/H+Bi/Y8b/R3z8ybVKbr5ywQyou3Znf5p5xzGkzxTZZoCMQ mIjHU0JkA/HG9TjXOAea4LnwFh96KOtQG3zSuW1PBiXOoqFev0Jn5QlSuTKSInWb/OyG hdEw== 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 :dkim-signature; bh=zqD6rb2tTmtUtsVcS+14ITbP+ypHyeHf/VOd6YqX3no=; fh=WR6Fy7kGCroNKSS5jHjX5LaQseGeTC3TD3lkK7gcJQQ=; b=MQ5TQ69bECQVJYVwodDZAUxrFB7Y+KtGc5j/egy5KKGi0vFpRBfUezD8YMzhNqjZeq N4q1T7nxy4XdPF0d1hPYiDBIzZ/0AwgWgsspuc9y2QS/YX3sV5j0oXlRZXiF/BfecOIG sONMVW6TgJSJfrAH4mT/mtkuK/opbMa55WFTWw2Cd71aoEfR0GGugms//VU8I6vRKLSP LR2H3HI8f+kJ04dFaL3LvF73TdMKefeucm6FCbT0sxY/pA2xiON9BvfgPwC2q24+B4n+ zVM3tcAcsQ3J+873e23elKr7tZlM8/1c+PlQIVC0h3kJHBdzHozpWGr4jkZd1WB1I6F1 WARg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VRJz1l+d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id x13-20020a25accd000000b00da066698618si2950464ybd.363.2023.10.25.08.28.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 08:28:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VRJz1l+d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id C93D3812E369; Wed, 25 Oct 2023 08:27:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344879AbjJYP1U (ORCPT + 99 others); Wed, 25 Oct 2023 11:27:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344754AbjJYP0l (ORCPT ); Wed, 25 Oct 2023 11:26:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 704CD19B for ; Wed, 25 Oct 2023 08:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698247471; 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=zqD6rb2tTmtUtsVcS+14ITbP+ypHyeHf/VOd6YqX3no=; b=VRJz1l+d4N3IEGVXWRoLIhcYf2e7XTiCaJ2ALvL0oktHoPxaDmAiNlGYoG5DOOm2ejx2nH b5wh/+m/Eds6fwBxAoi2hTlugdjFTkYq5GX57TZHklD/Iwrde1nY7lVRd4mbjASXKl19TX d0++a5D/Vu/j3+K+hPGH5XuaLiCmMbM= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-680-sfxVx0yjMU-5UY1hY9g-9g-1; Wed, 25 Oct 2023 11:24:13 -0400 X-MC-Unique: sfxVx0yjMU-5UY1hY9g-9g-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BD72B280017F; Wed, 25 Oct 2023 15:24:12 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.226.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id D09272166B26; Wed, 25 Oct 2023 15:24:11 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Maxim Levitsky Cc: linux-kernel@vger.kernel.org Subject: [PATCH 04/14] KVM: x86: hyper-v: Introduce kvm_hv_synic_auto_eoi_set() Date: Wed, 25 Oct 2023 17:23:56 +0200 Message-ID: <20231025152406.1879274-5-vkuznets@redhat.com> In-Reply-To: <20231025152406.1879274-1-vkuznets@redhat.com> References: <20231025152406.1879274-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 25 Oct 2023 08:27:59 -0700 (PDT) As a preparation to making Hyper-V emulation optional, create a dedicated kvm_hv_synic_auto_eoi_set() helper to avoid extra ifdefs in lapic.c No functional change intended. Reviewed-by: Maxim Levitsky Signed-off-by: Vitaly Kuznetsov --- arch/x86/kvm/hyperv.h | 5 +++++ arch/x86/kvm/lapic.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/hyperv.h b/arch/x86/kvm/hyperv.h index f83b8db72b11..1897a219981d 100644 --- a/arch/x86/kvm/hyperv.h +++ b/arch/x86/kvm/hyperv.h @@ -105,6 +105,11 @@ int kvm_hv_synic_set_irq(struct kvm *kvm, u32 vcpu_id, u32 sint); void kvm_hv_synic_send_eoi(struct kvm_vcpu *vcpu, int vector); int kvm_hv_activate_synic(struct kvm_vcpu *vcpu, bool dont_zero_synic_pages); +static inline bool kvm_hv_synic_auto_eoi_set(struct kvm_vcpu *vcpu, int vector) +{ + return to_hv_vcpu(vcpu) && test_bit(vector, to_hv_synic(vcpu)->auto_eoi_bitmap); +} + void kvm_hv_vcpu_uninit(struct kvm_vcpu *vcpu); bool kvm_hv_assist_page_enabled(struct kvm_vcpu *vcpu); diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 245b20973cae..f7abc1008cad 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2905,7 +2905,7 @@ int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu) */ apic_clear_irr(vector, apic); - if (to_hv_vcpu(vcpu) && test_bit(vector, to_hv_synic(vcpu)->auto_eoi_bitmap)) { + if (kvm_hv_synic_auto_eoi_set(vcpu, vector)) { /* * For auto-EOI interrupts, there might be another pending * interrupt above PPR, so check whether to raise another -- 2.41.0