Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp529184rdg; Thu, 12 Oct 2023 12:37:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEizqRgXIsIa+ieV8dxNqKDOA20nbI6TzTGOpluEofNe8l9WVv1bK88ZRkgaOCO11FrWF0s X-Received: by 2002:a05:6a21:3d88:b0:171:a3e8:8c05 with SMTP id bj8-20020a056a213d8800b00171a3e88c05mr8471005pzc.53.1697139468148; Thu, 12 Oct 2023 12:37:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697139468; cv=none; d=google.com; s=arc-20160816; b=ylcI4lPqTKDmYdx68GoKr5U7ECo5WtzNkGDfubPSLrds+H4uMkTKl4omKyguS8Ere6 2dOBLRHVBxLv0159Hz4Xgm2K5/4Ez+84LdlRL4/4r3CtJaeOAnMXpYe1zVVAgMuGfCpT lFtnWHtf8nPZ6Xb93WGqla9vDrzTk9ICUZKpiG0iqXyXR+x3aARsyTYko5CENv6h4rk8 T7ZGDoSz+uALOguqIiHmYo41iWwBic6Q7WjKcBxt+TazEXd7Nigic3+RXk56VxrgJnW3 DD3Buf2fxzzOI3CjaCKewZ9DFVQpq/oQWzciHqrf363tAfXW1kRckKQ5DHmNzooP66BJ NE0g== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=f40ECg2BWJ+FRhYEW/MQ1+sUR8MJ/9jI0RjlSlj5qW8=; fh=8uL9JJN3YZ3ojD+ZnbKCwt85fTkx6Q1DA7CRQFLnl3A=; b=X8sinfLvTEeZ9ksLABbjRAVTlN0VDYykhfvkg62C0vZoOybhsnhYXPBE89o/0lE0cE /2tZzG32T0kQDmsr54OU1jAITQOmStnQCtrGsA/2st3YaoDagTqSf208ktNGjFkiBqQu YTzOKc8w2WFlWEWkez8IyeFaidwVLZYS16ryGVp/hnggkZKgcTnYYc8dYDlsiX4FO6Y3 5rqEnGth8AefAYMDuDr4GICAzs/2keL2//7hpGOX0eLjtc/UXtpmQ1Q+qChhbl0HrRZ6 dg25WmIUdDN1fjvupWZWS0UyS58Y/aRfMfYAVgPEj5EOgxUSdY6rnT0Juz7RHte8yrtb TQnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VrxCpF+d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id a11-20020a170902ee8b00b001c9ebe878d7si605301pld.109.2023.10.12.12.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 12:37:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VrxCpF+d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id BD664806D82C; Thu, 12 Oct 2023 12:37:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442138AbjJLTh0 (ORCPT + 99 others); Thu, 12 Oct 2023 15:37:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442210AbjJLThY (ORCPT ); Thu, 12 Oct 2023 15:37:24 -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 7F61BDE for ; Thu, 12 Oct 2023 12:36:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697139400; 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=f40ECg2BWJ+FRhYEW/MQ1+sUR8MJ/9jI0RjlSlj5qW8=; b=VrxCpF+dSapDX5I6M5VIZO1u8HLI9JTMSZIKRhI4Ak/sfM5fIqiaT4JBwVU/DSvbzN02BW dQ4Jc3cCFArVpu8w1/luydBJcUGQeMXeD5X90+/Wxazod7xl1Dbx+ItnjKi4rVZwYIC5yK BnrlE7AHPPLNuehFBSrrPz4Fxng0jX0= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-115-NoxM5TxxPoON-WGIKfb0CA-1; Thu, 12 Oct 2023 15:36:38 -0400 X-MC-Unique: NoxM5TxxPoON-WGIKfb0CA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-40647c6f71dso10302335e9.2 for ; Thu, 12 Oct 2023 12:36:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697139398; x=1697744198; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=f40ECg2BWJ+FRhYEW/MQ1+sUR8MJ/9jI0RjlSlj5qW8=; b=AI9+PfXdfcVw3mfhDDPQ1mPbSr3bFljypIw3CNFZypgqRd9FP3h9gCCYJ4j+h5MYrB rWHYqLo51iYueMy6OBZ95xL+QQ63P2St1yMvS5nKBe30uCsCjesbp7SiEx3eKwL/mE64 kCcw+PSMNUDu3Knc7PwM4g+N68sz2PeAovIHvYqxs3tGurpQrIFMbnYxzEbqPR0MuUfz 9Ie4lwOZ/mjQGcJUxNaPD9Pl1I7ui8by3Dcu2Y6H3feuYvvILYTb3gkafdL/83Q1NjJ7 DOSsO6utHKNIKSufWU3+6m6FD+Xlxdem9AhC47B06h0DIWsF7XT8UC/iJVhEWXIx6xVr PVFQ== X-Gm-Message-State: AOJu0Yw90BGEYSjWdq37mmND1Ie8pPV8suwQStv/0SHg8/m6KurEFP4Q fjzFWhSYPBxQuAsFzTKstN/mfTeWOa1OBEr3U7jV17WWXCM3Klu38VvltWSgpz6ptqc45XisjzQ 6cEKxiBl2ofhM8/s4s3SMv+4U X-Received: by 2002:a1c:7917:0:b0:3fb:feb0:6f40 with SMTP id l23-20020a1c7917000000b003fbfeb06f40mr23240699wme.11.1697139397888; Thu, 12 Oct 2023 12:36:37 -0700 (PDT) X-Received: by 2002:a1c:7917:0:b0:3fb:feb0:6f40 with SMTP id l23-20020a1c7917000000b003fbfeb06f40mr23240687wme.11.1697139397633; Thu, 12 Oct 2023 12:36:37 -0700 (PDT) Received: from starship ([89.237.100.246]) by smtp.gmail.com with ESMTPSA id 8-20020a05600c248800b0040472ad9a3dsm628108wms.14.2023.10.12.12.36.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 12:36:37 -0700 (PDT) Message-ID: Subject: Re: [PATCH RFC 04/11] KVM: x86: hyper-v: Introduce kvm_hv_synic_auto_eoi_set() From: Maxim Levitsky To: Vitaly Kuznetsov , kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: linux-kernel@vger.kernel.org Date: Thu, 12 Oct 2023 22:36:35 +0300 In-Reply-To: <20231010160300.1136799-5-vkuznets@redhat.com> References: <20231010160300.1136799-1-vkuznets@redhat.com> <20231010160300.1136799-5-vkuznets@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 morse.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 (morse.vger.email [0.0.0.0]); Thu, 12 Oct 2023 12:37:44 -0700 (PDT) У вт, 2023-10-10 у 18:02 +0200, Vitaly Kuznetsov пише: > 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 Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky