From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B85E0C432C0 for ; Mon, 2 Dec 2019 17:47:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9513F20665 for ; Mon, 2 Dec 2019 17:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727792AbfLBRrn (ORCPT ); Mon, 2 Dec 2019 12:47:43 -0500 Received: from mga09.intel.com ([134.134.136.24]:12673 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727618AbfLBRrn (ORCPT ); Mon, 2 Dec 2019 12:47:43 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Dec 2019 09:47:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,270,1571727600"; d="scan'208";a="218414545" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.41]) by fmsmga001.fm.intel.com with ESMTP; 02 Dec 2019 09:47:41 -0800 Date: Mon, 2 Dec 2019 09:47:41 -0800 From: Sean Christopherson To: Vitaly Kuznetsov Cc: Peter Xu , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Nitesh Narayan Lal , Paolo Bonzini Subject: Re: [PATCH v2 1/3] KVM: X86: Some cleanups in ioapic.h/lapic.h Message-ID: <20191202174741.GC4063@linux.intel.com> References: <20191129163234.18902-1-peterx@redhat.com> <20191129163234.18902-2-peterx@redhat.com> <87k17fcc14.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k17fcc14.fsf@vitty.brq.redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 02, 2019 at 10:27:51AM +0100, Vitaly Kuznetsov wrote: > Peter Xu writes: > > > Both kvm_apic_match_dest() and kvm_irq_delivery_to_apic() should > > probably suite more to lapic.h comparing to ioapic.h, moving. Please use imperative mode, state *why* the prototypes belong in lapic.h, and don't hedge, e.g.: kvm_apic_match_dest() is defined in lapic.c, move its declaration from ioapic.h to lapic.h. Ditto for the subject: KVM: x86: Clean up function declarations in ioapic.h > > kvm_apic_match_dest() is defined twice, once in each of the header. s/defined/declared > > Removing the one defined in ioapic.h. Again: Remove a redundant declaration of kvm_apic_match_dest() from ioapic.h, it is declared and defined in lapic.{h,c}. > kvm_apic_match_dest()'s implementation lives in lapic.c so moving the > declaration to lapic.h makes perfect sense. kvm_irq_delivery_to_apic()'s > body is, however, in irq_comm.c and declarations for it are usually > found in asm/kvm_host.h. I'm not sure but maybe it would make sense to > move kvm_irq_delivery_to_apic()'s body to lapic.c too. asm/kvm_host.h is generally used only for exported functions, internal-only functions for irq_comm.c are declared in arch/x86/kvm/irq.h. > (Personally, I'd also greatly appreciate if functions working with lapic > exclusively would have 'lapic' instead of 'apic' in their names. But > this is unrelated to the patch.) > > > Signed-off-by: Peter Xu > > --- > > arch/x86/kvm/ioapic.h | 6 ------ > > arch/x86/kvm/lapic.h | 5 ++++- > > 2 files changed, 4 insertions(+), 7 deletions(-) > > > > diff --git a/arch/x86/kvm/ioapic.h b/arch/x86/kvm/ioapic.h > > index ea1a4e0297da..2fb2e3c80724 100644 > > --- a/arch/x86/kvm/ioapic.h > > +++ b/arch/x86/kvm/ioapic.h > > @@ -116,9 +116,6 @@ static inline int ioapic_in_kernel(struct kvm *kvm) > > } > > > > void kvm_rtc_eoi_tracking_restore_one(struct kvm_vcpu *vcpu); > > -bool kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source, > > - int short_hand, unsigned int dest, int dest_mode); > > -int kvm_apic_compare_prio(struct kvm_vcpu *vcpu1, struct kvm_vcpu *vcpu2); > > void kvm_ioapic_update_eoi(struct kvm_vcpu *vcpu, int vector, > > int trigger_mode); > > int kvm_ioapic_init(struct kvm *kvm); > > @@ -126,9 +123,6 @@ void kvm_ioapic_destroy(struct kvm *kvm); > > int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int irq_source_id, > > int level, bool line_status); > > void kvm_ioapic_clear_all(struct kvm_ioapic *ioapic, int irq_source_id); > > -int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src, > > - struct kvm_lapic_irq *irq, > > - struct dest_map *dest_map); > > void kvm_get_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state); > > void kvm_set_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state); > > void kvm_ioapic_scan_entry(struct kvm_vcpu *vcpu, > > diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h > > index 39925afdfcdc..19b36196e2ff 100644 > > --- a/arch/x86/kvm/lapic.h > > +++ b/arch/x86/kvm/lapic.h > > @@ -83,7 +83,10 @@ int kvm_lapic_reg_read(struct kvm_lapic *apic, u32 offset, int len, > > void *data); > > bool kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source, > > int short_hand, unsigned int dest, int dest_mode); > > - > > +int kvm_apic_compare_prio(struct kvm_vcpu *vcpu1, struct kvm_vcpu *vcpu2); > > +int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src, > > + struct kvm_lapic_irq *irq, > > + struct dest_map *dest_map); > > bool __kvm_apic_update_irr(u32 *pir, void *regs, int *max_irr); > > bool kvm_apic_update_irr(struct kvm_vcpu *vcpu, u32 *pir, int *max_irr); > > void kvm_apic_update_ppr(struct kvm_vcpu *vcpu); > > -- > Vitaly >