x86, apic: Merge two register_lapic_address()
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/5 x86, apic: Merge two register_lapic_address()
They are the same, move it to apic.c
--- arch/x86/include/asm/apic.h | 1 + arch/x86/kernel/acpi/boot.c | 16 ++-------------- arch/x86/kernel/apic/apic.c | 12 ++++++++++++ arch/x86/kernel/mpparse.c | 14 +------------- 4 files changed, 16 insertions(+), 27 deletions(-)
arch/x86/include/asm/apic.h +1 -0
@@ -234,6 +234,7 @@ extern void init_bsp_APIC(void);extern void setup_local_APIC (void );extern void end_local_APIC_setup (void );extern void init_apic_mappings (void ); +void register_lapic_address (unsigned long address);extern void setup_boot_APIC_clock (void );extern void setup_secondary_APIC_clock (void );extern int APIC_init_uniprocessor (void );
arch/x86/kernel/acpi/boot.c +2 -14
@@ -847,18 +847,6 @@ static int __init acpi_parse_fadt(struct* returns 0 on success, < 0 on error */ -static void __init acpi_register_lapic_address (unsigned long address) -{ - mp_lapic_addr = address; - -set_fixmap_nocache (FIX_APIC_BASE , address); -if (boot_cpu_physical_apicid ==-1U ) { - boot_cpu_physical_apicid =read_apic_id (); - apic_version[boot_cpu_physical_apicid] = -GET_APIC_VERSION (apic_read (APIC_LVR )); - } -} -static int __init early_acpi_parse_madt_lapic_addr_ovr (void ) {int count;
@@ -880,7 +868,7 @@ static int __init early_acpi_parse_madt_return count; } -acpi_register_lapic_address (acpi_lapic_addr); +register_lapic_address (acpi_lapic_addr);return count; }
@@ -907,7 +895,7 @@ static int __init acpi_parse_madt_lapic_return count; } -acpi_register_lapic_address (acpi_lapic_addr); +register_lapic_address (acpi_lapic_addr); count =acpi_table_parse_madt (ACPI_MADT_TYPE_LOCAL_SAPIC , acpi_parse_sapic,MAX_APICS );
arch/x86/kernel/apic/apic.c +12 -0
@@ -1697,6 +1697,18 @@ void __init init_apic_mappings(void) } } +void __init register_lapic_address (unsigned long address) +{ + mp_lapic_addr = address; + +set_fixmap_nocache (FIX_APIC_BASE , address); +if (boot_cpu_physical_apicid ==-1U ) { + boot_cpu_physical_apicid =read_apic_id (); + apic_version[boot_cpu_physical_apicid] = +GET_APIC_VERSION (apic_read (APIC_LVR )); + } +} +/* * This initializes the IO-APIC and APIC hardware if this is * a UP kernel.
arch/x86/kernel/mpparse.c +1 -13
@@ -275,18 +275,6 @@ static void __init smp_dump_mptable(struvoid __init default_smp_read_mpc_oem (struct mpc_table *mpc) { } -static void __init smp_register_lapic_address (unsigned long address) -{ - mp_lapic_addr = address; - -set_fixmap_nocache (FIX_APIC_BASE , address); -if (boot_cpu_physical_apicid ==-1U ) { - boot_cpu_physical_apicid =read_apic_id (); - apic_version[boot_cpu_physical_apicid] = -GET_APIC_VERSION (apic_read (APIC_LVR )); - } -} -static int __init smp_read_mpc (struct mpc_table *mpc,unsigned early) {char str[16 ];
@@ -310,7 +298,7 @@ static int __init smp_read_mpc(struct mp/* Initialize the lapic mapping */ if (!acpi_lapic) -smp_register_lapic_address (mpc->lapic); +register_lapic_address (mpc->lapic);if (mpc->oemptr) x86_init.mpparse.smp_read_mpc_oem (mpc);
[tip:x86/apic-cleanups] x86, apic: Unify identical register_lapic_address() functions
Commit-ID: c0104d38a740b25662c592c71f6907676510289c Gitweb: http://git.kernel.org/tip/c0104d38a740b25662c592c71f6907676510289c Author: Yinghai Lu <[email protected]> AuthorDate: Tue, 7 Dec 2010 00:55:17 -0800 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 9 Dec 2010 21:52:04 +0100
x86, apic: Unify identical register_lapic_address() functions
They are the same, move the common function to apic.c to allow further cleanups.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/apic.h | 1 + arch/x86/kernel/acpi/boot.c | 16 ++-------------- arch/x86/kernel/apic/apic.c | 12 ++++++++++++ arch/x86/kernel/mpparse.c | 14 +------------- 4 files changed, 16 insertions(+), 27 deletions(-)
arch/x86/include/asm/apic.h +1 -0
@@ -234,6 +234,7 @@ extern void init_bsp_APIC(void);extern void setup_local_APIC (void );extern void end_local_APIC_setup (void );extern void init_apic_mappings (void ); +void register_lapic_address (unsigned long address);extern void setup_boot_APIC_clock (void );extern void setup_secondary_APIC_clock (void );extern int APIC_init_uniprocessor (void );
arch/x86/kernel/acpi/boot.c +2 -14
@@ -847,18 +847,6 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)* returns 0 on success, < 0 on error */ -static void __init acpi_register_lapic_address (unsigned long address) -{ - mp_lapic_addr = address; - -set_fixmap_nocache (FIX_APIC_BASE , address); -if (boot_cpu_physical_apicid ==-1U ) { - boot_cpu_physical_apicid =read_apic_id (); - apic_version[boot_cpu_physical_apicid] = -GET_APIC_VERSION (apic_read (APIC_LVR )); - } -} -static int __init early_acpi_parse_madt_lapic_addr_ovr (void ) {int count;
@@ -880,7 +868,7 @@ static int __init early_acpi_parse_madt_lapic_addr_ovr(void)return count; } -acpi_register_lapic_address (acpi_lapic_addr); +register_lapic_address (acpi_lapic_addr);return count; }
@@ -907,7 +895,7 @@ static int __init acpi_parse_madt_lapic_entries(void)return count; } -acpi_register_lapic_address (acpi_lapic_addr); +register_lapic_address (acpi_lapic_addr); count =acpi_table_parse_madt (ACPI_MADT_TYPE_LOCAL_SAPIC , acpi_parse_sapic,MAX_APICS );
arch/x86/kernel/apic/apic.c +12 -0
@@ -1702,6 +1702,18 @@ void __init init_apic_mappings(void) } } +void __init register_lapic_address (unsigned long address) +{ + mp_lapic_addr = address; + +set_fixmap_nocache (FIX_APIC_BASE , address); +if (boot_cpu_physical_apicid ==-1U ) { + boot_cpu_physical_apicid =read_apic_id (); + apic_version[boot_cpu_physical_apicid] = +GET_APIC_VERSION (apic_read (APIC_LVR )); + } +} +/* * This initializes the IO-APIC and APIC hardware if this is * a UP kernel.
arch/x86/kernel/mpparse.c +1 -13
@@ -275,18 +275,6 @@ static void __init smp_dump_mptable(struct mpc_table *mpc, unsigned char *mpt)void __init default_smp_read_mpc_oem (struct mpc_table *mpc) { } -static void __init smp_register_lapic_address (unsigned long address) -{ - mp_lapic_addr = address; - -set_fixmap_nocache (FIX_APIC_BASE , address); -if (boot_cpu_physical_apicid ==-1U ) { - boot_cpu_physical_apicid =read_apic_id (); - apic_version[boot_cpu_physical_apicid] = -GET_APIC_VERSION (apic_read (APIC_LVR )); - } -} -static int __init smp_read_mpc (struct mpc_table *mpc,unsigned early) {char str[16 ];
@@ -310,7 +298,7 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)/* Initialize the lapic mapping */ if (!acpi_lapic) -smp_register_lapic_address (mpc->lapic); +register_lapic_address (mpc->lapic);if (mpc->oemptr) x86_init.mpparse.smp_read_mpc_oem (mpc);
PATCH 2/5 x86, apic: Remove early_init_lapic_mapping
In reply to a message not in the archiveIt is almost the same as smp_register_lapic_addr()
Just need to make smp_read_mpc() call smp_register_lapic_addr when early==1.
also add printing out in smp_register_lapic_address()
--- arch/x86/include/asm/apic.h | 1 - arch/x86/kernel/apic/apic.c | 24 ++---------------------- arch/x86/kernel/mpparse.c | 8 ++------ arch/x86/mm/amdtopology_64.c | 1 - 4 files changed, 4 insertions(+), 30 deletions(-)
arch/x86/mm/amdtopology_64.c +0 -1
@@ -66,7 +66,6 @@ static __init void early_get_boot_cpu_idif (smp_found_config)early_get_smp_config ();#endif -early_init_lapic_mapping (); }int __init amd_get_nodes (struct bootnode *physnodes)
arch/x86/kernel/apic/apic.c +2 -22
@@ -1625,28 +1625,6 @@ no_apic: }#endif -#ifdef CONFIG_X86_64 -void __init early_init_lapic_mapping (void ) -{ -/* -* If no local APIC can be found then go out -* : it means there is no mpatable and MADT -*/ -if (!smp_found_config) -return ; - -set_fixmap_nocache (FIX_APIC_BASE , mp_lapic_addr); -apic_printk (APIC_VERBOSE ,"mapped APIC to %16lx (%16lx)\n" , -APIC_BASE , mp_lapic_addr); - -/* -* Fetch the APIC ID of the BSP in case we have a -* default configuration (or the MP table is broken). -*/ - boot_cpu_physical_apicid =read_apic_id (); -} -#endif -/** * init_apic_mappings - initialize APIC mappings */
@@ -1702,6 +1680,8 @@ void __init register_lapic_address(unsig mp_lapic_addr = address;set_fixmap_nocache (FIX_APIC_BASE , address); +apic_printk (APIC_VERBOSE ,"mapped APIC to %16lx (%16lx)\n" , +APIC_BASE , mp_lapic_addr);if (boot_cpu_physical_apicid ==-1U ) { boot_cpu_physical_apicid =read_apic_id (); apic_version[boot_cpu_physical_apicid] =
arch/x86/kernel/mpparse.c +2 -6
@@ -289,17 +289,13 @@ static int __init smp_read_mpc(struct mp#ifdef CONFIG_X86_32 generic_mps_oem_check (mpc, oem, str);#endif -/* save the local APIC address, it might be non-default */ +/* Initialize the lapic mapping */ if (!acpi_lapic) - mp_lapic_addr = mpc->lapic; +register_lapic_address (mpc->lapic);if (early)return 1 ; -/* Initialize the lapic mapping */ -if (!acpi_lapic) -register_lapic_address (mpc->lapic); -if (mpc->oemptr) x86_init.mpparse.smp_read_mpc_oem (mpc);
arch/x86/include/asm/apic.h +0 -1
@@ -245,7 +245,6 @@ extern int apic_force_enable(void);* On 32bit this is mach-xxx local */ #ifdef CONFIG_X86_64 -extern void early_init_lapic_mapping (void );extern int apic_is_clustered_box (void );#else static inline int apic_is_clustered_box (void )
[tip:x86/apic-cleanups] x86, apic: Remove early_init_lapic_mapping()
Commit-ID: f1157141636848f52c5f74040bed0ba355cf59b7 Gitweb: http://git.kernel.org/tip/f1157141636848f52c5f74040bed0ba355cf59b7 Author: Yinghai Lu <[email protected]> AuthorDate: Tue, 7 Dec 2010 00:55:29 -0800 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 9 Dec 2010 21:52:04 +0100
x86, apic: Remove early_init_lapic_mapping()
It is almost the same as smp_register_lapic_addr(). We just need to let smp_read_mpc() call smp_register_lapic_addr() when early==1.
Add the apic_printk to smp_register_lapic_address()
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/apic.h | 1 - arch/x86/kernel/apic/apic.c | 24 ++---------------------- arch/x86/kernel/mpparse.c | 8 ++------ arch/x86/mm/amdtopology_64.c | 1 - 4 files changed, 4 insertions(+), 30 deletions(-)
arch/x86/include/asm/apic.h +0 -1
@@ -245,7 +245,6 @@ extern int apic_force_enable(void);* On 32bit this is mach-xxx local */ #ifdef CONFIG_X86_64 -extern void early_init_lapic_mapping (void );extern int apic_is_clustered_box (void );#else static inline int apic_is_clustered_box (void )
arch/x86/kernel/apic/apic.c +2 -22
@@ -1630,28 +1630,6 @@ no_apic: }#endif -#ifdef CONFIG_X86_64 -void __init early_init_lapic_mapping (void ) -{ -/* -* If no local APIC can be found then go out -* : it means there is no mpatable and MADT -*/ -if (!smp_found_config) -return ; - -set_fixmap_nocache (FIX_APIC_BASE , mp_lapic_addr); -apic_printk (APIC_VERBOSE ,"mapped APIC to %16lx (%16lx)\n" , -APIC_BASE , mp_lapic_addr); - -/* -* Fetch the APIC ID of the BSP in case we have a -* default configuration (or the MP table is broken). -*/ - boot_cpu_physical_apicid =read_apic_id (); -} -#endif -/** * init_apic_mappings - initialize APIC mappings */
@@ -1707,6 +1685,8 @@ void __init register_lapic_address(unsigned long address) mp_lapic_addr = address;set_fixmap_nocache (FIX_APIC_BASE , address); +apic_printk (APIC_VERBOSE ,"mapped APIC to %16lx (%16lx)\n" , +APIC_BASE , mp_lapic_addr);if (boot_cpu_physical_apicid ==-1U ) { boot_cpu_physical_apicid =read_apic_id (); apic_version[boot_cpu_physical_apicid] =
arch/x86/kernel/mpparse.c +2 -6
@@ -289,17 +289,13 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)#ifdef CONFIG_X86_32 generic_mps_oem_check (mpc, oem, str);#endif -/* save the local APIC address, it might be non-default */ +/* Initialize the lapic mapping */ if (!acpi_lapic) - mp_lapic_addr = mpc->lapic; +register_lapic_address (mpc->lapic);if (early)return 1 ; -/* Initialize the lapic mapping */ -if (!acpi_lapic) -register_lapic_address (mpc->lapic); -if (mpc->oemptr) x86_init.mpparse.smp_read_mpc_oem (mpc);
arch/x86/mm/amdtopology_64.c +0 -1
@@ -66,7 +66,6 @@ static __init void early_get_boot_cpu_id(void)if (smp_found_config)early_get_smp_config ();#endif -early_init_lapic_mapping (); }int __init amd_get_nodes (struct bootnode *physnodes)
PATCH 3/5 x86, apic: Use register_lapic_address in init_apic_mapping
In reply to a message not in the archiveSo if nothing is changed, don't print out anything
--- arch/x86/kernel/apic/apic.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/kernel/apic/apic.c +1 -4
@@ -1650,10 +1650,7 @@ void __init init_apic_mappings(void)* acpi_register_lapic_address() */ if (!acpi_lapic && !smp_found_config) -set_fixmap_nocache (FIX_APIC_BASE , apic_phys); - -apic_printk (APIC_VERBOSE ,"mapped APIC to %08lx (%08lx)\n" , -APIC_BASE , apic_phys); +register_lapic_address (apic_phys); }/*
[tip:x86/apic-cleanups] x86, apic: Use register_lapic_address() in init_apic_mapping()
Commit-ID: 326a2e6bae250b1172c0ae80f3b259d79e9cb56c Gitweb: http://git.kernel.org/tip/326a2e6bae250b1172c0ae80f3b259d79e9cb56c Author: Yinghai Lu <[email protected]> AuthorDate: Tue, 7 Dec 2010 00:55:38 -0800 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 9 Dec 2010 21:52:05 +0100
x86, apic: Use register_lapic_address() in init_apic_mapping()
Remove the printk as well, we don't want to print when nothing changed. We print in register_lapic_address() already.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/apic/apic.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
arch/x86/kernel/apic/apic.c +1 -4
@@ -1655,10 +1655,7 @@ void __init init_apic_mappings(void)* acpi_register_lapic_address() */ if (!acpi_lapic && !smp_found_config) -set_fixmap_nocache (FIX_APIC_BASE , apic_phys); - -apic_printk (APIC_VERBOSE ,"mapped APIC to %08lx (%08lx)\n" , -APIC_BASE , apic_phys); +register_lapic_address (apic_phys); }/*
PATCH 4/5 x86, sfi: Use register_lapic_address()
In reply to a message not in the archivekill mp_sfi_register_lapic_address, they are the same
--- arch/x86/platform/sfi/sfi.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
arch/x86/platform/sfi/sfi.c +1 -12
@@ -34,17 +34,6 @@#ifdef CONFIG_X86_LOCAL_APIC static unsigned long sfi_lapic_addr__initdata =APIC_DEFAULT_PHYS_BASE ; -static void __init mp_sfi_register_lapic_address (unsigned long address) -{ - mp_lapic_addr = address; - -set_fixmap_nocache (FIX_APIC_BASE , mp_lapic_addr); -if (boot_cpu_physical_apicid ==-1U ) - boot_cpu_physical_apicid =read_apic_id (); - -pr_info ("Boot CPU = %d\n" , boot_cpu_physical_apicid); -} -/* All CPUs enumerated by SFI must be present and enabled */ static void __cpuinit mp_sfi_register_lapic (u8 id) {
@@ -110,7 +99,7 @@ static int __init sfi_parse_ioapic(strucint __init sfi_platform_init (void ) {#ifdef CONFIG_X86_LOCAL_APIC -mp_sfi_register_lapic_address (sfi_lapic_addr); +register_lapic_address (sfi_lapic_addr);sfi_table_parse (SFI_SIG_CPUS ,NULL ,NULL , sfi_parse_cpus);#endif #ifdef CONFIG_X86_IO_APIC
[tip:x86/apic-cleanups] x86, sfi: Use register_lapic_address()
Commit-ID: 53301f36f316a6519c464b0ef2a155386c20be19 Gitweb: http://git.kernel.org/tip/53301f36f316a6519c464b0ef2a155386c20be19 Author: Yinghai Lu <[email protected]> AuthorDate: Tue, 7 Dec 2010 00:55:47 -0800 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 9 Dec 2010 21:52:05 +0100
x86, sfi: Use register_lapic_address()
register_lapic_address() and mp_sfi_register_lapic_address() are almost identical. Use the common function.
LKML-Reference: <[email protected]>
--- arch/x86/platform/sfi/sfi.c | 13 +------------ 1 files changed, 1 insertions(+), 12 deletions(-)
arch/x86/platform/sfi/sfi.c +1 -12
@@ -34,17 +34,6 @@#ifdef CONFIG_X86_LOCAL_APIC static unsigned long sfi_lapic_addr__initdata =APIC_DEFAULT_PHYS_BASE ; -static void __init mp_sfi_register_lapic_address (unsigned long address) -{ - mp_lapic_addr = address; - -set_fixmap_nocache (FIX_APIC_BASE , mp_lapic_addr); -if (boot_cpu_physical_apicid ==-1U ) - boot_cpu_physical_apicid =read_apic_id (); - -pr_info ("Boot CPU = %d\n" , boot_cpu_physical_apicid); -} -/* All CPUs enumerated by SFI must be present and enabled */ static void __cpuinit mp_sfi_register_lapic (u8 id) {
@@ -110,7 +99,7 @@ static int __init sfi_parse_ioapic(struct sfi_table_header *table)int __init sfi_platform_init (void ) {#ifdef CONFIG_X86_LOCAL_APIC -mp_sfi_register_lapic_address (sfi_lapic_addr); +register_lapic_address (sfi_lapic_addr);sfi_table_parse (SFI_SIG_CPUS ,NULL ,NULL , sfi_parse_cpus);#endif #ifdef CONFIG_X86_IO_APIC
PATCH 5/5 x86, x2apic: Don't map lapic addr for preenabled x2apic system
In reply to a message not in the archiveIf x2apic is reenabled, and used in kernel, We don't need to map that lapic address. That mapping will never be used.
So just skip that in register_lapic_address()
--- arch/x86/kernel/apic/apic.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/x86/kernel/apic/apic.c +5 -3
@@ -1676,9 +1676,11 @@ void __init register_lapic_address(unsig { mp_lapic_addr = address; -set_fixmap_nocache (FIX_APIC_BASE , address); -apic_printk (APIC_VERBOSE ,"mapped APIC to %16lx (%16lx)\n" , -APIC_BASE , mp_lapic_addr); +if (!x2apic_mode) { +set_fixmap_nocache (FIX_APIC_BASE , address); +apic_printk (APIC_VERBOSE ,"mapped APIC to %16lx (%16lx)\n" , +APIC_BASE , mp_lapic_addr); + }if (boot_cpu_physical_apicid ==-1U ) { boot_cpu_physical_apicid =read_apic_id (); apic_version[boot_cpu_physical_apicid] =
[tip:x86/apic-cleanups] x86, x2apic: Don't map lapic addr for preenabled x2apic systems
Commit-ID: 0450193bffed6e4b6160c4a5ccb0df158eba7d2a Gitweb: http://git.kernel.org/tip/0450193bffed6e4b6160c4a5ccb0df158eba7d2a Author: Yinghai Lu <[email protected]> AuthorDate: Tue, 7 Dec 2010 00:55:56 -0800 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 9 Dec 2010 21:52:05 +0100
x86, x2apic: Don't map lapic addr for preenabled x2apic systems
If x2apic is preenabled and used by the kernel, we don't need to map the lapic address. That mapping will never be used.
So just skip that in register_lapic_address()
LKML-Reference: <[email protected]>
--- arch/x86/kernel/apic/apic.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
arch/x86/kernel/apic/apic.c +5 -3
@@ -1681,9 +1681,11 @@ void __init register_lapic_address(unsigned long address) { mp_lapic_addr = address; -set_fixmap_nocache (FIX_APIC_BASE , address); -apic_printk (APIC_VERBOSE ,"mapped APIC to %16lx (%16lx)\n" , -APIC_BASE , mp_lapic_addr); +if (!x2apic_mode) { +set_fixmap_nocache (FIX_APIC_BASE , address); +apic_printk (APIC_VERBOSE ,"mapped APIC to %16lx (%16lx)\n" , +APIC_BASE , mp_lapic_addr); + }if (boot_cpu_physical_apicid ==-1U ) { boot_cpu_physical_apicid =read_apic_id (); apic_version[boot_cpu_physical_apicid] =