Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750925AbeAPHVX (ORCPT + 1 other); Tue, 16 Jan 2018 02:21:23 -0500 Received: from mail-ot0-f195.google.com ([74.125.82.195]:42592 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750764AbeAPHVW (ORCPT ); Tue, 16 Jan 2018 02:21:22 -0500 X-Google-Smtp-Source: ACJfBovUC2Jo7uiOvMWVaMWvzZmzFI5eZyW+H/aC9MUOXOptHAS6c8C94gsy4Jx24KPfJWaRigfgVtxA+MqbkhxPl+k= MIME-Version: 1.0 In-Reply-To: <4284ee79-a87c-a47d-7e96-682bdd8754e1@cn.fujitsu.com> References: <20180115202335.1645883-1-arnd@arndb.de> <4284ee79-a87c-a47d-7e96-682bdd8754e1@cn.fujitsu.com> From: Arnd Bergmann Date: Tue, 16 Jan 2018 08:21:20 +0100 X-Google-Sender-Auth: IoAi6WqnZG86hcydNvaIo20DdzU Message-ID: Subject: Re: [PATCH] x86/jailhouse: fix building without X86_X2APIC To: Dou Liyang Cc: Jan Kiszka , Thomas Gleixner , "the arch/x86 maintainers" , jailhouse-dev@googlegroups.com, Ingo Molnar , "H. Peter Anvin" , Juergen Gross , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Tue, Jan 16, 2018 at 3:34 AM, Dou Liyang wrote: > At 01/16/2018 09:25 AM, Dou Liyang wrote: >>> diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h >>> index 98722773391d..0317d635d9ba 100644 >>> --- a/arch/x86/include/asm/apic.h >>> +++ b/arch/x86/include/asm/apic.h >>> @@ -188,6 +188,8 @@ static inline void lapic_assign_system_vectors(void) >>> { } >>> static inline void lapic_assign_legacy_vector(unsigned int i, bool r) { >>> } >>> #endif /* !CONFIG_X86_LOCAL_APIC */ >>> +extern int x2apic_mode; >>> +extern int x2apic_phys; >> >> We can't do that, adding a macro for the X2APIC=n case is enough >> > I am sorry when I looked into your code in tip tree. I found this > measure is not true. please try the the following v2 patch. > > The reason I don't want to expose the x2apic_mode and x2apic_phys is > that they may be misused in X2APIC=n case. So I create an interface to > wrap it. do you think so? ;-) I'm not sure I follow what the intention of that is. If you want to hide those two variables, maybe make them 'static' and remove the extern declarations? > diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h > index 98722773391d..ac25ac2e49af 100644 > --- a/arch/x86/include/asm/apic.h > +++ b/arch/x86/include/asm/apic.h > @@ -251,6 +251,11 @@ static inline u64 native_x2apic_icr_read(void) > > extern int x2apic_mode; > extern int x2apic_phys; > +static inline void apic_set_x2apic_phys(void) > +{ > + x2apic_phys = 1; > +} > + > extern void __init check_x2apic(void); > extern void x2apic_setup(void); > static inline int x2apic_enabled(void) > @@ -265,7 +270,10 @@ static inline void x2apic_setup(void) { } > static inline int x2apic_enabled(void) { return 0; } > > #define x2apic_mode (0) > -#define x2apic_supported() (0) > +#define x2apic_phys (0) > +#define x2apic_supported() (0) > + > +static inline void apic_set_x2apic_phys(void){} > #endif /* !CONFIG_X86_X2APIC */ > > struct irq_data; I see nothing wrong it with this, but also don't see anything it does that improves the interface. Arnd