Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp244702rdg; Tue, 10 Oct 2023 09:04:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNQ/GGLoksXPsBuuHYCpXNdhco9jv9ZTgtwsV6rJ/oxkdwk7IL2CqcuodH0Rm+ANtQ9o/B X-Received: by 2002:a05:6a21:185:b0:14d:7130:7bb3 with SMTP id le5-20020a056a21018500b0014d71307bb3mr22768755pzb.13.1696953857952; Tue, 10 Oct 2023 09:04:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696953857; cv=none; d=google.com; s=arc-20160816; b=UOwWt45y638p6SOBMhYO7VGsDVL8qREe51vj0OcNiUUxJFlYoPlVyO2Bon36AqJdun u+3uhZ3D6/FIaDdMNNAFvwWsWUA4ZdQlngQH9nOW/aJganSHEKbB8vBO3eCzbxLZXK97 7Ufm7x1ZDcnCffCTKp11g8u59ZNMHy6LV9CXqlo88ggPlnD7nSuQFIg3smyiQHGQT2Ce hXkC9dS7+vJ8+2ERGPqdWdW+e2SdfmYgglTPouqWdHnbBgVa7RPBED3jLdN8BWWcxiOi e4Gx7QD4yTkWoz0jGZOSiKKC/uVisbsWeYyn2vF6LC+2WPVRon07nXS9bg2qd6rPuSjY kOYA== 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=9qx5BLxprJ9jnMFhNtuJ0kZnM19kHvbmqh9HXGAM2ZM=; fh=SJRVlyvhIPEM+1ZkklEUy6ba01ZQIQ4PgkK8h+im/FM=; b=Dwgh9I15qzW9jfjMFjTFUOxxceHBhsXnMKu0KGYUeCIM0axgKA8xo13C+gfWEy9gKc AzcqiDKkrACL5EXyPm0IrR8bBBrY8rqDjnLAC7e3vEMy79zd9xGGwVkZM9rUUd8/ZlUS gk2ns3bJZdSUWg9rPgrtYGq8a8+6urlwu4itWPubq3yQCLKC523s5EFbRtxd5s+PUWKt sTFnXynLQQ1cOqmS5tGb2HST+cW4KlqMMLJV2umJ6ggH6ZE5cYL/KWuy4fSm4RsFCJ9D oJR4D+TAXGBSbqSwF9aZGfiYmkvjMWX9rWpSEhIu4pPMdJe28J9YDxgIcWc7O/zrv64X NCLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XzP8YMl4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id i69-20020a636d48000000b00584af407e80si12303884pgc.293.2023.10.10.09.04.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 09:04:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XzP8YMl4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id AB67780D44D6; Tue, 10 Oct 2023 09:04:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233736AbjJJQEK (ORCPT + 99 others); Tue, 10 Oct 2023 12:04:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233756AbjJJQED (ORCPT ); Tue, 10 Oct 2023 12:04:03 -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 BF582C6 for ; Tue, 10 Oct 2023 09:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696953790; 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=9qx5BLxprJ9jnMFhNtuJ0kZnM19kHvbmqh9HXGAM2ZM=; b=XzP8YMl4+7bLKZWz7nG6RWBkKhU3VrIPCRwuFZTmuQQeRgMPq/LWuMRiO24+G/NYnRuM7V j0wHOnpOeXyt3pPf330WLRzHJ7bZFIOsHXUgyiC17GRX3btRmudsoDm6LWo1mdLmcoUGqo WdfnOTAzFeAi07v9JGqPkKLQibgFwHY= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-450-umvDNFYKNRW-phazcWWpzw-1; Tue, 10 Oct 2023 12:03:06 -0400 X-MC-Unique: umvDNFYKNRW-phazcWWpzw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 67C871C1171A; Tue, 10 Oct 2023 16:03:06 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.226.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 97E351B99; Tue, 10 Oct 2023 16:03:05 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: linux-kernel@vger.kernel.org Subject: [PATCH RFC 04/11] KVM: x86: hyper-v: Introduce kvm_hv_synic_auto_eoi_set() Date: Tue, 10 Oct 2023 18:02:53 +0200 Message-ID: <20231010160300.1136799-5-vkuznets@redhat.com> In-Reply-To: <20231010160300.1136799-1-vkuznets@redhat.com> References: <20231010160300.1136799-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.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 09:04:16 -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. 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 dcd60b39e794..0e80c1fdf899 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2899,7 +2899,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