aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-03 21:33:15 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-03 21:33:15 -0500
commitd2bea739f8b41d620c235d81e00289d01169dc3c (patch)
tree1a56f84a34a9642e19cc01caa34d343691f34f3e /arch/x86/include
parent53528695ff6d8b77011bc818407c13e30914a946 (diff)
parent4faefda97bc1be6ca909ba0fd0927ea78f37f67e (diff)
Merge branch 'x86-apic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 apic changes from Ingo Molnar: "The main changes in this cycle were: - Numachip updates: new hardware support, fixes and cleanups. (Daniel J Blueman) - misc smaller cleanups and fixlets" * 'x86-apic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/io_apic: Make eoi_ioapic_pin() static x86/irq: Drop unlikely before IS_ERR_OR_NULL x86/x2apic: Make stub functions available even if !CONFIG_X86_LOCAL_APIC x86/apic: Deinline various functions x86/numachip: Fix timer build conflict x86/numachip: Introduce Numachip2 timer mechanisms x86/numachip: Add Numachip IPI optimisations x86/numachip: Add Numachip2 APIC support x86/numachip: Cleanup Numachip support
Diffstat (limited to 'arch/x86/include')
-rw-r--r--arch/x86/include/asm/apic.h110
-rw-r--r--arch/x86/include/asm/numachip/numachip.h1
-rw-r--r--arch/x86/include/asm/numachip/numachip_csr.h153
3 files changed, 98 insertions, 166 deletions
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index ebf6d5e5668c..a30316bf801a 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -115,6 +115,59 @@ static inline bool apic_is_x2apic_enabled(void)
115 return msr & X2APIC_ENABLE; 115 return msr & X2APIC_ENABLE;
116} 116}
117 117
118extern void enable_IR_x2apic(void);
119
120extern int get_physical_broadcast(void);
121
122extern int lapic_get_maxlvt(void);
123extern void clear_local_APIC(void);
124extern void disconnect_bsp_APIC(int virt_wire_setup);
125extern void disable_local_APIC(void);
126extern void lapic_shutdown(void);
127extern void sync_Arb_IDs(void);
128extern void init_bsp_APIC(void);
129extern void setup_local_APIC(void);
130extern void init_apic_mappings(void);
131void register_lapic_address(unsigned long address);
132extern void setup_boot_APIC_clock(void);
133extern void setup_secondary_APIC_clock(void);
134extern int APIC_init_uniprocessor(void);
135
136#ifdef CONFIG_X86_64
137static inline int apic_force_enable(unsigned long addr)
138{
139 return -1;
140}
141#else
142extern int apic_force_enable(unsigned long addr);
143#endif
144
145extern int apic_bsp_setup(bool upmode);
146extern void apic_ap_setup(void);
147
148/*
149 * On 32bit this is mach-xxx local
150 */
151#ifdef CONFIG_X86_64
152extern int apic_is_clustered_box(void);
153#else
154static inline int apic_is_clustered_box(void)
155{
156 return 0;
157}
158#endif
159
160extern int setup_APIC_eilvt(u8 lvt_off, u8 vector, u8 msg_type, u8 mask);
161
162#else /* !CONFIG_X86_LOCAL_APIC */
163static inline void lapic_shutdown(void) { }
164#define local_apic_timer_c2_ok 1
165static inline void init_apic_mappings(void) { }
166static inline void disable_local_APIC(void) { }
167# define setup_boot_APIC_clock x86_init_noop
168# define setup_secondary_APIC_clock x86_init_noop
169#endif /* !CONFIG_X86_LOCAL_APIC */
170
118#ifdef CONFIG_X86_X2APIC 171#ifdef CONFIG_X86_X2APIC
119/* 172/*
120 * Make previous memory operations globally visible before 173 * Make previous memory operations globally visible before
@@ -186,67 +239,14 @@ static inline int x2apic_enabled(void)
186} 239}
187 240
188#define x2apic_supported() (cpu_has_x2apic) 241#define x2apic_supported() (cpu_has_x2apic)
189#else 242#else /* !CONFIG_X86_X2APIC */
190static inline void check_x2apic(void) { } 243static inline void check_x2apic(void) { }
191static inline void x2apic_setup(void) { } 244static inline void x2apic_setup(void) { }
192static inline int x2apic_enabled(void) { return 0; } 245static inline int x2apic_enabled(void) { return 0; }
193 246
194#define x2apic_mode (0) 247#define x2apic_mode (0)
195#define x2apic_supported() (0) 248#define x2apic_supported() (0)
196#endif 249#endif /* !CONFIG_X86_X2APIC */
197
198extern void enable_IR_x2apic(void);
199
200extern int get_physical_broadcast(void);
201
202extern int lapic_get_maxlvt(void);
203extern void clear_local_APIC(void);
204extern void disconnect_bsp_APIC(int virt_wire_setup);
205extern void disable_local_APIC(void);
206extern void lapic_shutdown(void);
207extern void sync_Arb_IDs(void);
208extern void init_bsp_APIC(void);
209extern void setup_local_APIC(void);
210extern void init_apic_mappings(void);
211void register_lapic_address(unsigned long address);
212extern void setup_boot_APIC_clock(void);
213extern void setup_secondary_APIC_clock(void);
214extern int APIC_init_uniprocessor(void);
215
216#ifdef CONFIG_X86_64
217static inline int apic_force_enable(unsigned long addr)
218{
219 return -1;
220}
221#else
222extern int apic_force_enable(unsigned long addr);
223#endif
224
225extern int apic_bsp_setup(bool upmode);
226extern void apic_ap_setup(void);
227
228/*
229 * On 32bit this is mach-xxx local
230 */
231#ifdef CONFIG_X86_64
232extern int apic_is_clustered_box(void);
233#else
234static inline int apic_is_clustered_box(void)
235{
236 return 0;
237}
238#endif
239
240extern int setup_APIC_eilvt(u8 lvt_off, u8 vector, u8 msg_type, u8 mask);
241
242#else /* !CONFIG_X86_LOCAL_APIC */
243static inline void lapic_shutdown(void) { }
244#define local_apic_timer_c2_ok 1
245static inline void init_apic_mappings(void) { }
246static inline void disable_local_APIC(void) { }
247# define setup_boot_APIC_clock x86_init_noop
248# define setup_secondary_APIC_clock x86_init_noop
249#endif /* !CONFIG_X86_LOCAL_APIC */
250 250
251#ifdef CONFIG_X86_64 251#ifdef CONFIG_X86_64
252#define SET_APIC_ID(x) (apic->set_apic_id(x)) 252#define SET_APIC_ID(x) (apic->set_apic_id(x))
diff --git a/arch/x86/include/asm/numachip/numachip.h b/arch/x86/include/asm/numachip/numachip.h
index 1c6f7f6212c1..c64373a2d731 100644
--- a/arch/x86/include/asm/numachip/numachip.h
+++ b/arch/x86/include/asm/numachip/numachip.h
@@ -14,6 +14,7 @@
14#ifndef _ASM_X86_NUMACHIP_NUMACHIP_H 14#ifndef _ASM_X86_NUMACHIP_NUMACHIP_H
15#define _ASM_X86_NUMACHIP_NUMACHIP_H 15#define _ASM_X86_NUMACHIP_NUMACHIP_H
16 16
17extern u8 numachip_system;
17extern int __init pci_numachip_init(void); 18extern int __init pci_numachip_init(void);
18 19
19#endif /* _ASM_X86_NUMACHIP_NUMACHIP_H */ 20#endif /* _ASM_X86_NUMACHIP_NUMACHIP_H */
diff --git a/arch/x86/include/asm/numachip/numachip_csr.h b/arch/x86/include/asm/numachip/numachip_csr.h
index 660f843df928..29719eecdc2e 100644
--- a/arch/x86/include/asm/numachip/numachip_csr.h
+++ b/arch/x86/include/asm/numachip/numachip_csr.h
@@ -14,12 +14,8 @@
14#ifndef _ASM_X86_NUMACHIP_NUMACHIP_CSR_H 14#ifndef _ASM_X86_NUMACHIP_NUMACHIP_CSR_H
15#define _ASM_X86_NUMACHIP_NUMACHIP_CSR_H 15#define _ASM_X86_NUMACHIP_NUMACHIP_CSR_H
16 16
17#include <linux/numa.h> 17#include <linux/smp.h>
18#include <linux/percpu.h>
19#include <linux/io.h> 18#include <linux/io.h>
20#include <linux/swab.h>
21#include <asm/types.h>
22#include <asm/processor.h>
23 19
24#define CSR_NODE_SHIFT 16 20#define CSR_NODE_SHIFT 16
25#define CSR_NODE_BITS(p) (((unsigned long)(p)) << CSR_NODE_SHIFT) 21#define CSR_NODE_BITS(p) (((unsigned long)(p)) << CSR_NODE_SHIFT)
@@ -27,11 +23,8 @@
27 23
28/* 32K CSR space, b15 indicates geo/non-geo */ 24/* 32K CSR space, b15 indicates geo/non-geo */
29#define CSR_OFFSET_MASK 0x7fffUL 25#define CSR_OFFSET_MASK 0x7fffUL
30 26#define CSR_G0_NODE_IDS (0x008 + (0 << 12))
31/* Global CSR space covers all 4K possible nodes with 64K CSR space per node */ 27#define CSR_G3_EXT_IRQ_GEN (0x030 + (3 << 12))
32#define NUMACHIP_GCSR_BASE 0x3fff00000000ULL
33#define NUMACHIP_GCSR_LIM 0x3fff0fffffffULL
34#define NUMACHIP_GCSR_SIZE (NUMACHIP_GCSR_LIM - NUMACHIP_GCSR_BASE + 1)
35 28
36/* 29/*
37 * Local CSR space starts in global CSR space with "nodeid" = 0xfff0, however 30 * Local CSR space starts in global CSR space with "nodeid" = 0xfff0, however
@@ -41,12 +34,7 @@
41#define NUMACHIP_LCSR_BASE 0x3ffffe000000ULL 34#define NUMACHIP_LCSR_BASE 0x3ffffe000000ULL
42#define NUMACHIP_LCSR_LIM 0x3fffffffffffULL 35#define NUMACHIP_LCSR_LIM 0x3fffffffffffULL
43#define NUMACHIP_LCSR_SIZE (NUMACHIP_LCSR_LIM - NUMACHIP_LCSR_BASE + 1) 36#define NUMACHIP_LCSR_SIZE (NUMACHIP_LCSR_LIM - NUMACHIP_LCSR_BASE + 1)
44 37#define NUMACHIP_LAPIC_BITS 8
45static inline void *gcsr_address(int node, unsigned long offset)
46{
47 return __va(NUMACHIP_GCSR_BASE | (1UL << 15) |
48 CSR_NODE_BITS(node & CSR_NODE_MASK) | (offset & CSR_OFFSET_MASK));
49}
50 38
51static inline void *lcsr_address(unsigned long offset) 39static inline void *lcsr_address(unsigned long offset)
52{ 40{
@@ -54,114 +42,57 @@ static inline void *lcsr_address(unsigned long offset)
54 CSR_NODE_BITS(0xfff0) | (offset & CSR_OFFSET_MASK)); 42 CSR_NODE_BITS(0xfff0) | (offset & CSR_OFFSET_MASK));
55} 43}
56 44
57static inline unsigned int read_gcsr(int node, unsigned long offset) 45static inline unsigned int read_lcsr(unsigned long offset)
58{ 46{
59 return swab32(readl(gcsr_address(node, offset))); 47 return swab32(readl(lcsr_address(offset)));
60} 48}
61 49
62static inline void write_gcsr(int node, unsigned long offset, unsigned int val) 50static inline void write_lcsr(unsigned long offset, unsigned int val)
63{ 51{
64 writel(swab32(val), gcsr_address(node, offset)); 52 writel(swab32(val), lcsr_address(offset));
65} 53}
66 54
67static inline unsigned int read_lcsr(unsigned long offset) 55/*
56 * On NumaChip2, local CSR space is 16MB and starts at fixed offset below 4G
57 */
58
59#define NUMACHIP2_LCSR_BASE 0xf0000000UL
60#define NUMACHIP2_LCSR_SIZE 0x1000000UL
61#define NUMACHIP2_APIC_ICR 0x100000
62#define NUMACHIP2_TIMER_DEADLINE 0x200000
63#define NUMACHIP2_TIMER_INT 0x200008
64#define NUMACHIP2_TIMER_NOW 0x200018
65#define NUMACHIP2_TIMER_RESET 0x200020
66
67static inline void __iomem *numachip2_lcsr_address(unsigned long offset)
68{ 68{
69 return swab32(readl(lcsr_address(offset))); 69 return (void __iomem *)__va(NUMACHIP2_LCSR_BASE |
70 (offset & (NUMACHIP2_LCSR_SIZE - 1)));
70} 71}
71 72
72static inline void write_lcsr(unsigned long offset, unsigned int val) 73static inline u32 numachip2_read32_lcsr(unsigned long offset)
73{ 74{
74 writel(swab32(val), lcsr_address(offset)); 75 return readl(numachip2_lcsr_address(offset));
75} 76}
76 77
77/* ========================================================================= */ 78static inline u64 numachip2_read64_lcsr(unsigned long offset)
78/* CSR_G0_STATE_CLEAR */ 79{
79/* ========================================================================= */ 80 return readq(numachip2_lcsr_address(offset));
80 81}
81#define CSR_G0_STATE_CLEAR (0x000 + (0 << 12))
82union numachip_csr_g0_state_clear {
83 unsigned int v;
84 struct numachip_csr_g0_state_clear_s {
85 unsigned int _state:2;
86 unsigned int _rsvd_2_6:5;
87 unsigned int _lost:1;
88 unsigned int _rsvd_8_31:24;
89 } s;
90};
91
92/* ========================================================================= */
93/* CSR_G0_NODE_IDS */
94/* ========================================================================= */
95 82
96#define CSR_G0_NODE_IDS (0x008 + (0 << 12)) 83static inline void numachip2_write32_lcsr(unsigned long offset, u32 val)
97union numachip_csr_g0_node_ids { 84{
98 unsigned int v; 85 writel(val, numachip2_lcsr_address(offset));
99 struct numachip_csr_g0_node_ids_s { 86}
100 unsigned int _initialid:16;
101 unsigned int _nodeid:12;
102 unsigned int _rsvd_28_31:4;
103 } s;
104};
105
106/* ========================================================================= */
107/* CSR_G3_EXT_IRQ_GEN */
108/* ========================================================================= */
109 87
110#define CSR_G3_EXT_IRQ_GEN (0x030 + (3 << 12)) 88static inline void numachip2_write64_lcsr(unsigned long offset, u64 val)
111union numachip_csr_g3_ext_irq_gen { 89{
112 unsigned int v; 90 writeq(val, numachip2_lcsr_address(offset));
113 struct numachip_csr_g3_ext_irq_gen_s { 91}
114 unsigned int _vector:8;
115 unsigned int _msgtype:3;
116 unsigned int _index:5;
117 unsigned int _destination_apic_id:16;
118 } s;
119};
120
121/* ========================================================================= */
122/* CSR_G3_EXT_IRQ_STATUS */
123/* ========================================================================= */
124
125#define CSR_G3_EXT_IRQ_STATUS (0x034 + (3 << 12))
126union numachip_csr_g3_ext_irq_status {
127 unsigned int v;
128 struct numachip_csr_g3_ext_irq_status_s {
129 unsigned int _result:32;
130 } s;
131};
132
133/* ========================================================================= */
134/* CSR_G3_EXT_IRQ_DEST */
135/* ========================================================================= */
136
137#define CSR_G3_EXT_IRQ_DEST (0x038 + (3 << 12))
138union numachip_csr_g3_ext_irq_dest {
139 unsigned int v;
140 struct numachip_csr_g3_ext_irq_dest_s {
141 unsigned int _irq:8;
142 unsigned int _rsvd_8_31:24;
143 } s;
144};
145
146/* ========================================================================= */
147/* CSR_G3_NC_ATT_MAP_SELECT */
148/* ========================================================================= */
149
150#define CSR_G3_NC_ATT_MAP_SELECT (0x7fc + (3 << 12))
151union numachip_csr_g3_nc_att_map_select {
152 unsigned int v;
153 struct numachip_csr_g3_nc_att_map_select_s {
154 unsigned int _upper_address_bits:4;
155 unsigned int _select_ram:4;
156 unsigned int _rsvd_8_31:24;
157 } s;
158};
159
160/* ========================================================================= */
161/* CSR_G3_NC_ATT_MAP_SELECT_0-255 */
162/* ========================================================================= */
163
164#define CSR_G3_NC_ATT_MAP_SELECT_0 (0x800 + (3 << 12))
165 92
166#endif /* _ASM_X86_NUMACHIP_NUMACHIP_CSR_H */ 93static inline unsigned int numachip2_timer(void)
94{
95 return (smp_processor_id() % 48) << 6;
96}
167 97
98#endif /* _ASM_X86_NUMACHIP_NUMACHIP_CSR_H */