Message ID | 20231010160300.1136799-6-vkuznets@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp309891vqb; Tue, 10 Oct 2023 09:04:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4Do3C4rMIo9eQGPxCsvHJkebExhKnBqF9SZt8t6qZoNo2Gjw9kGcFUBYRbE0UfOjU+7B3 X-Received: by 2002:a17:90a:c293:b0:263:f62b:3601 with SMTP id f19-20020a17090ac29300b00263f62b3601mr14727377pjt.10.1696953852963; Tue, 10 Oct 2023 09:04:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696953852; cv=none; d=google.com; s=arc-20160816; b=z2JKyQbV/5roR+2y7+xgwbJfYOIf9eSroWbo0AG8kd4vKYZXpOsAUNnIF1X0kJgQuS OJfa/9xDR395L2MLrZalca4qvAznuW4btfGZYIIwCZx5F/swQjWQgBcNokL5MU5jzzvq jmcLDKwlklsIkCvbqiPtPkKRVlPmLYtZRiWic+4INFgk2ZmjKczECtiTPN8IGI3LUaFq aao+hAsYXLu1x1Zk45Zv0FVNDg0JgIie4oqH8EVXNCEsPHASLllD+B808wmoh6YBkpzZ xrxKDTKhQpBcEtkSIIu4jZ80lmh2Z5hqbnB6ZGvtJAwfMZqKs52/z1RDacd2gC14cH6C c8ew== 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=rrOySeNH8h0gI5WPtiwjg/e20jUaoQX7gnyrS8T/iUs=; fh=SJRVlyvhIPEM+1ZkklEUy6ba01ZQIQ4PgkK8h+im/FM=; b=SsB6tHFdB0h6qPrk9sNMSpYdPQ9Uta8VHyjN4QEItDVBml6NjBhJQZXR5BMYlASNJf UjzQrtAisSX/6ZTemlTF3iJSEOd6XXXGcZ0ezJfLd6Y4ftyuaqgWh5zI6TJHIQJIbg2s jF67V+oqQSXv67owU3ceovZ1dIS5dqLEqtbbS2FjgPHePJtRKZSmkscE6vEV7YbYPWaG zfUzKgCINOHt3yCR8Xjx4a3T56wVz9pMEPq0Cqplyrqg+2Nvmrw5vpLIZc+nENOsjRRL 6IJvbCh63pyCf4cE6fQHyQCCGe6aiyxmacI0bXysw7an2Ga+UXTLq11MibjTvXQHEiwh K5uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=J2N9iOR4; 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id 15-20020a17090a0b8f00b0026b365096e5si13748661pjr.53.2023.10.10.09.04.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 09:04:12 -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=J2N9iOR4; 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 0D25D80267C9; Tue, 10 Oct 2023 09:04:11 -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 S233705AbjJJQEH (ORCPT <rfc822;rua109.linux@gmail.com> + 20 others); Tue, 10 Oct 2023 12:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233719AbjJJQEC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 10 Oct 2023 12:04:02 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AD56B9 for <linux-kernel@vger.kernel.org>; Tue, 10 Oct 2023 09:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696953789; 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=rrOySeNH8h0gI5WPtiwjg/e20jUaoQX7gnyrS8T/iUs=; b=J2N9iOR4G/XxzzSZYw/+HilYwZ5zzN8zhgZniyI41nNzYyPV2XGA8lYRMwG9I4hQOV5ens kceuWVEps19//EMoq3IobJI6C7HIzA+v/h0sv5HpLLWEKCWiO/M0EYnDT+Jr3leW9/8H8D QKAnoted2Az8KqYNLDuS4DQ1xyY662w= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-661-bhgQsoJ1MbeKxlCAD52sCw-1; Tue, 10 Oct 2023 12:03:07 -0400 X-MC-Unique: bhgQsoJ1MbeKxlCAD52sCw-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 6D7D21019C94; Tue, 10 Oct 2023 16:03:07 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.226.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CFBB158; Tue, 10 Oct 2023 16:03:06 +0000 (UTC) From: Vitaly Kuznetsov <vkuznets@redhat.com> To: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>, Sean Christopherson <seanjc@google.com> Cc: linux-kernel@vger.kernel.org Subject: [PATCH RFC 05/11] KVM: x86: hyper-v: Introduce kvm_hv_synic_has_vector() Date: Tue, 10 Oct 2023 18:02:54 +0200 Message-ID: <20231010160300.1136799-6-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_H4,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: <linux-kernel.vger.kernel.org> 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:11 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779385083609095351 X-GMAIL-MSGID: 1779385083609095351 |
Series |
KVM: x86: Make Hyper-V emulation optional (AKA introduce CONFIG_KVM_HYPERV)
|
|
Commit Message
Vitaly Kuznetsov
Oct. 10, 2023, 4:02 p.m. UTC
As a preparation to making Hyper-V emulation optional, create a dedicated
kvm_hv_synic_has_vector() helper to avoid extra ifdefs in lapic.c.
No functional change intended.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
arch/x86/kvm/hyperv.h | 5 +++++
arch/x86/kvm/lapic.c | 3 +--
2 files changed, 6 insertions(+), 2 deletions(-)
Comments
У вт, 2023-10-10 у 18:02 +0200, Vitaly Kuznetsov пише: > As a preparation to making Hyper-V emulation optional, create a dedicated > kvm_hv_synic_has_vector() helper to avoid extra ifdefs in lapic.c. > > No functional change intended. > > Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> > --- > arch/x86/kvm/hyperv.h | 5 +++++ > arch/x86/kvm/lapic.c | 3 +-- > 2 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/kvm/hyperv.h b/arch/x86/kvm/hyperv.h > index 1897a219981d..ddb1d0b019e6 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_has_vector(struct kvm_vcpu *vcpu, int vector) > +{ > + return to_hv_vcpu(vcpu) && test_bit(vector, to_hv_synic(vcpu)->vec_bitmap); > +} > + > 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); > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > index 0e80c1fdf899..37904c5d421b 100644 > --- a/arch/x86/kvm/lapic.c > +++ b/arch/x86/kvm/lapic.c > @@ -1475,8 +1475,7 @@ static int apic_set_eoi(struct kvm_lapic *apic) > apic_clear_isr(vector, apic); > apic_update_ppr(apic); > > - if (to_hv_vcpu(apic->vcpu) && > - test_bit(vector, to_hv_synic(apic->vcpu)->vec_bitmap)) > + if (kvm_hv_synic_has_vector(apic->vcpu, vector)) > kvm_hv_synic_send_eoi(apic->vcpu, vector); > > kvm_ioapic_send_eoi(apic, vector); Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com Best regards, Maxim Levitsky
diff --git a/arch/x86/kvm/hyperv.h b/arch/x86/kvm/hyperv.h index 1897a219981d..ddb1d0b019e6 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_has_vector(struct kvm_vcpu *vcpu, int vector) +{ + return to_hv_vcpu(vcpu) && test_bit(vector, to_hv_synic(vcpu)->vec_bitmap); +} + 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); diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 0e80c1fdf899..37904c5d421b 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -1475,8 +1475,7 @@ static int apic_set_eoi(struct kvm_lapic *apic) apic_clear_isr(vector, apic); apic_update_ppr(apic); - if (to_hv_vcpu(apic->vcpu) && - test_bit(vector, to_hv_synic(apic->vcpu)->vec_bitmap)) + if (kvm_hv_synic_has_vector(apic->vcpu, vector)) kvm_hv_synic_send_eoi(apic->vcpu, vector); kvm_ioapic_send_eoi(apic, vector);