Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751253AbeAPIRr (ORCPT + 1 other); Tue, 16 Jan 2018 03:17:47 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:17232 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750818AbeAPIRq (ORCPT ); Tue, 16 Jan 2018 03:17:46 -0500 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="35358965" Subject: Re: [PATCH] x86/jailhouse: fix building without X86_X2APIC To: Arnd Bergmann CC: Jan Kiszka , Thomas Gleixner , the arch/x86 maintainers , , Ingo Molnar , "H. Peter Anvin" , Juergen Gross , Linux Kernel Mailing List References: <20180115202335.1645883-1-arnd@arndb.de> <4284ee79-a87c-a47d-7e96-682bdd8754e1@cn.fujitsu.com> From: Dou Liyang Message-ID: <86917190-5499-3fb8-7b5c-736dc2daeca5@cn.fujitsu.com> Date: Tue, 16 Jan 2018 16:17:42 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: 772C648AE82D.AA511 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi Arnd, [...] >> 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 My purpose of that is hiding the variables in X2APIC=n case. > those two variables, maybe make them 'static' and remove the extern > declarations? > Yes, that's what I really want, But due to the simple "x2apic_phys= 1" operation, doing that may be too fat, I guess. >> 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. > Another way we can choice is wrap the code with "CONFIG_X86_X2APIC". Thanks, dou --------------------------------8<------------------------------------ diff --git a/arch/x86/kernel/jailhouse.c b/arch/x86/kernel/jailhouse.c index d6d5976a9b51..d4aee43c8912 100644 --- a/arch/x86/kernel/jailhouse.c +++ b/arch/x86/kernel/jailhouse.c @@ -65,6 +65,7 @@ static void __init jailhouse_get_smp_config(unsigned int early) }; unsigned int cpu; +#ifdef CONFIG_X86_X2APIC if (x2apic_enabled()) { /* * We do not have access to IR inside Jailhouse non-root cells. @@ -79,6 +80,7 @@ static void __init jailhouse_get_smp_config(unsigned int early) */ default_acpi_madt_oem_check("", ""); } +#endif register_lapic_address(0xfee00000); > Arnd > > >