Commit fb8ce055 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Better fix for ia32 subarch circular dependencies

From: john stultz <johnstul@us.ibm.com>

This is a rework of John's recent change which resolved a circular include
dependency: a function in mach_apic.h requires hard_smp_processor_id() and
hard_smp_processor_id() requires macros from mach_apic.h

So this patch (against bk-current) reverts the previous, and fixes the same
circular dependency in a much cleaner way, by moving a piece of the circular
chain into its own .h file, rather then removing hard_smp_processor_id() and
accessing the apic by hand.
parent cd388069
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/mach-bigsmp/mach_apic.h> #include <asm/mach-bigsmp/mach_apic.h>
#include <asm/mach-bigsmp/mach_apicdef.h>
#include <asm/mach-bigsmp/mach_ipi.h> #include <asm/mach-bigsmp/mach_ipi.h>
#include <asm/mach-default/mach_mpparse.h> #include <asm/mach-default/mach_mpparse.h>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/mach-default/mach_apic.h> #include <asm/mach-default/mach_apic.h>
#include <asm/mach-default/mach_apicdef.h>
#include <asm/mach-default/mach_ipi.h> #include <asm/mach-default/mach_ipi.h>
#include <asm/mach-default/mach_mpparse.h> #include <asm/mach-default/mach_mpparse.h>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/mach-summit/mach_apic.h> #include <asm/mach-summit/mach_apic.h>
#include <asm/mach-summit/mach_apicdef.h>
#include <asm/mach-summit/mach_ipi.h> #include <asm/mach-summit/mach_ipi.h>
#include <asm/mach-summit/mach_mpparse.h> #include <asm/mach-summit/mach_mpparse.h>
......
#ifndef __ASM_MACH_APIC_H #ifndef __ASM_MACH_APIC_H
#define __ASM_MACH_APIC_H #define __ASM_MACH_APIC_H
#include <asm/smp.h>
#define SEQUENTIAL_APICID #define SEQUENTIAL_APICID
#ifdef SEQUENTIAL_APICID #ifdef SEQUENTIAL_APICID
...@@ -40,18 +41,10 @@ static inline unsigned long check_apicid_present(int bit) ...@@ -40,18 +41,10 @@ static inline unsigned long check_apicid_present(int bit)
#define apicid_cluster(apicid) (apicid & 0xF0) #define apicid_cluster(apicid) (apicid & 0xF0)
static inline unsigned get_apic_id(unsigned long x)
{
return (((x)>>24)&0x0F);
}
#define GET_APIC_ID(x) get_apic_id(x)
static inline unsigned long calculate_ldr(unsigned long old) static inline unsigned long calculate_ldr(unsigned long old)
{ {
unsigned long id; unsigned long id;
id = xapic_phys_to_log_apicid( id = xapic_phys_to_log_apicid(hard_smp_processor_id());
GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)));
return ((old & ~APIC_LDR_MASK) | SET_APIC_LOGICAL_ID(id)); return ((old & ~APIC_LDR_MASK) | SET_APIC_LOGICAL_ID(id));
} }
...@@ -135,8 +128,6 @@ static inline int check_phys_apicid_present(int boot_cpu_physical_apicid) ...@@ -135,8 +128,6 @@ static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
return (1); return (1);
} }
#define APIC_ID_MASK (0x0F<<24)
static inline unsigned int cpu_mask_to_apicid (unsigned long cpumask) static inline unsigned int cpu_mask_to_apicid (unsigned long cpumask)
{ {
int num_bits_set; int num_bits_set;
......
#ifndef __ASM_MACH_APICDEF_H
#define __ASM_MACH_APICDEF_H
#define APIC_ID_MASK (0x0F<<24)
static inline unsigned get_apic_id(unsigned long x)
{
return (((x)>>24)&0x0F);
}
#define GET_APIC_ID(x) get_apic_id(x)
#endif
#ifndef __ASM_MACH_APIC_H #ifndef __ASM_MACH_APIC_H
#define __ASM_MACH_APIC_H #define __ASM_MACH_APIC_H
#include <mach_apicdef.h>
#define APIC_DFR_VALUE (APIC_DFR_FLAT) #define APIC_DFR_VALUE (APIC_DFR_FLAT)
static inline unsigned long target_cpus(void) static inline unsigned long target_cpus(void)
...@@ -105,15 +107,6 @@ static inline int check_phys_apicid_present(int boot_cpu_physical_apicid) ...@@ -105,15 +107,6 @@ static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
return test_bit(boot_cpu_physical_apicid, &phys_cpu_present_map); return test_bit(boot_cpu_physical_apicid, &phys_cpu_present_map);
} }
#define APIC_ID_MASK (0xF<<24)
static inline unsigned get_apic_id(unsigned long x)
{
return (((x)>>24)&0xF);
}
#define GET_APIC_ID(x) get_apic_id(x)
static inline int apic_id_registered(void) static inline int apic_id_registered(void)
{ {
return (test_bit(GET_APIC_ID(apic_read(APIC_ID)), return (test_bit(GET_APIC_ID(apic_read(APIC_ID)),
......
#ifndef __ASM_MACH_APICDEF_H
#define __ASM_MACH_APICDEF_H
#define APIC_ID_MASK (0xF<<24)
static inline unsigned get_apic_id(unsigned long x)
{
return (((x)>>24)&0xF);
}
#define GET_APIC_ID(x) get_apic_id(x)
#endif
...@@ -107,15 +107,6 @@ static inline int check_phys_apicid_present(int boot_cpu_physical_apicid) ...@@ -107,15 +107,6 @@ static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
return (1); return (1);
} }
#define APIC_ID_MASK (0xF<<24)
static inline unsigned get_apic_id(unsigned long x)
{
return (((x)>>24)&0x0F);
}
#define GET_APIC_ID(x) get_apic_id(x)
static inline unsigned int cpu_mask_to_apicid (unsigned long cpumask) static inline unsigned int cpu_mask_to_apicid (unsigned long cpumask)
{ {
int num_bits_set; int num_bits_set;
......
#ifndef __ASM_MACH_APICDEF_H
#define __ASM_MACH_APICDEF_H
#define APIC_ID_MASK (0xF<<24)
static inline unsigned get_apic_id(unsigned long x)
{
return (((x)>>24)&0x0F);
}
#define GET_APIC_ID(x) get_apic_id(x)
#endif
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define __ASM_MACH_APIC_H #define __ASM_MACH_APIC_H
#include <linux/config.h> #include <linux/config.h>
#include <asm/smp.h>
#ifdef CONFIG_X86_GENERICARCH #ifdef CONFIG_X86_GENERICARCH
#define x86_summit 1 /* must be an constant expressiona for generic arch */ #define x86_summit 1 /* must be an constant expressiona for generic arch */
...@@ -48,20 +49,12 @@ static inline unsigned long check_apicid_present(int bit) ...@@ -48,20 +49,12 @@ static inline unsigned long check_apicid_present(int bit)
extern u8 bios_cpu_apicid[]; extern u8 bios_cpu_apicid[];
static inline unsigned get_apic_id(unsigned long x)
{
return (((x)>>24)&0xFF);
}
#define GET_APIC_ID(x) get_apic_id(x)
static inline void init_apic_ldr(void) static inline void init_apic_ldr(void)
{ {
unsigned long val, id; unsigned long val, id;
if (x86_summit) if (x86_summit)
id = xapic_phys_to_log_apicid( id = xapic_phys_to_log_apicid(hard_smp_processor_id());
GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID)));
else else
id = 1UL << smp_processor_id(); id = 1UL << smp_processor_id();
apic_write_around(APIC_DFR, APIC_DFR_VALUE); apic_write_around(APIC_DFR, APIC_DFR_VALUE);
...@@ -143,8 +136,6 @@ static inline int check_phys_apicid_present(int boot_cpu_physical_apicid) ...@@ -143,8 +136,6 @@ static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
return test_bit(boot_cpu_physical_apicid, &phys_cpu_present_map); return test_bit(boot_cpu_physical_apicid, &phys_cpu_present_map);
} }
#define APIC_ID_MASK (0xFF<<24)
static inline unsigned int cpu_mask_to_apicid (unsigned long cpumask) static inline unsigned int cpu_mask_to_apicid (unsigned long cpumask)
{ {
int num_bits_set; int num_bits_set;
......
#ifndef __ASM_MACH_APICDEF_H
#define __ASM_MACH_APICDEF_H
#define APIC_ID_MASK (0xFF<<24)
static inline unsigned get_apic_id(unsigned long x)
{
return (((x)>>24)&0xFF);
}
#define GET_APIC_ID(x) get_apic_id(x)
#endif
...@@ -19,14 +19,6 @@ ...@@ -19,14 +19,6 @@
#define check_apicid_used(bitmap, apicid) (bitmap & (1 << apicid)) #define check_apicid_used(bitmap, apicid) (bitmap & (1 << apicid))
#define check_apicid_present(bit) (phys_cpu_present_map & (1 << bit)) #define check_apicid_present(bit) (phys_cpu_present_map & (1 << bit))
#define APIC_ID_MASK (0xF<<24)
static inline unsigned get_apic_id(unsigned long x)
{
return (((x)>>24)&0xF);
}
#define GET_APIC_ID(x) get_apic_id(x)
static inline int apic_id_registered(void) static inline int apic_id_registered(void)
{ {
return (test_bit(GET_APIC_ID(apic_read(APIC_ID)), return (test_bit(GET_APIC_ID(apic_read(APIC_ID)),
......
#ifndef __ASM_MACH_APICDEF_H
#define __ASM_MACH_APICDEF_H
#define APIC_ID_MASK (0xF<<24)
static inline unsigned get_apic_id(unsigned long x)
{
return (((x)>>24)&0xF);
}
#define GET_APIC_ID(x) get_apic_id(x)
#endif
...@@ -91,7 +91,7 @@ extern inline int any_online_cpu(unsigned int mask) ...@@ -91,7 +91,7 @@ extern inline int any_online_cpu(unsigned int mask)
#ifdef APIC_DEFINITION #ifdef APIC_DEFINITION
extern int hard_smp_processor_id(void); extern int hard_smp_processor_id(void);
#else #else
#include <mach_apic.h> #include <mach_apicdef.h>
static inline int hard_smp_processor_id(void) static inline int hard_smp_processor_id(void)
{ {
/* we don't want to mark this access volatile - bad code generation */ /* we don't want to mark this access volatile - bad code generation */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment