diff options
Diffstat (limited to 'arch/x86/include')
-rw-r--r-- | arch/x86/include/asm/amd_iommu_types.h | 61 | ||||
-rw-r--r-- | arch/x86/include/asm/es7000/apic.h | 32 | ||||
-rw-r--r-- | arch/x86/include/asm/es7000/mpparse.h | 3 | ||||
-rw-r--r-- | arch/x86/include/asm/genapic_32.h | 8 | ||||
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/lguest.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/mach-default/mach_mpparse.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/mach-generic/mach_mpparse.h | 5 | ||||
-rw-r--r-- | arch/x86/include/asm/mach-generic/mach_mpspec.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/mpspec_def.h | 102 | ||||
-rw-r--r-- | arch/x86/include/asm/numaq/apic.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/numaq/mpparse.h | 3 | ||||
-rw-r--r-- | arch/x86/include/asm/pci.h | 10 | ||||
-rw-r--r-- | arch/x86/include/asm/setup.h | 14 | ||||
-rw-r--r-- | arch/x86/include/asm/summit/apic.h | 42 | ||||
-rw-r--r-- | arch/x86/include/asm/summit/mpparse.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/topology.h | 36 |
17 files changed, 160 insertions, 174 deletions
diff --git a/arch/x86/include/asm/amd_iommu_types.h b/arch/x86/include/asm/amd_iommu_types.h index ac302a2fa339..95c8cd9d22b5 100644 --- a/arch/x86/include/asm/amd_iommu_types.h +++ b/arch/x86/include/asm/amd_iommu_types.h | |||
@@ -190,16 +190,23 @@ | |||
190 | /* FIXME: move this macro to <linux/pci.h> */ | 190 | /* FIXME: move this macro to <linux/pci.h> */ |
191 | #define PCI_BUS(x) (((x) >> 8) & 0xff) | 191 | #define PCI_BUS(x) (((x) >> 8) & 0xff) |
192 | 192 | ||
193 | /* Protection domain flags */ | ||
194 | #define PD_DMA_OPS_MASK (1UL << 0) /* domain used for dma_ops */ | ||
195 | #define PD_DEFAULT_MASK (1UL << 1) /* domain is a default dma_ops | ||
196 | domain for an IOMMU */ | ||
197 | |||
193 | /* | 198 | /* |
194 | * This structure contains generic data for IOMMU protection domains | 199 | * This structure contains generic data for IOMMU protection domains |
195 | * independent of their use. | 200 | * independent of their use. |
196 | */ | 201 | */ |
197 | struct protection_domain { | 202 | struct protection_domain { |
198 | spinlock_t lock; /* mostly used to lock the page table*/ | 203 | spinlock_t lock; /* mostly used to lock the page table*/ |
199 | u16 id; /* the domain id written to the device table */ | 204 | u16 id; /* the domain id written to the device table */ |
200 | int mode; /* paging mode (0-6 levels) */ | 205 | int mode; /* paging mode (0-6 levels) */ |
201 | u64 *pt_root; /* page table root pointer */ | 206 | u64 *pt_root; /* page table root pointer */ |
202 | void *priv; /* private data */ | 207 | unsigned long flags; /* flags to find out type of domain */ |
208 | unsigned dev_cnt; /* devices assigned to this domain */ | ||
209 | void *priv; /* private data */ | ||
203 | }; | 210 | }; |
204 | 211 | ||
205 | /* | 212 | /* |
@@ -295,7 +302,7 @@ struct amd_iommu { | |||
295 | bool int_enabled; | 302 | bool int_enabled; |
296 | 303 | ||
297 | /* if one, we need to send a completion wait command */ | 304 | /* if one, we need to send a completion wait command */ |
298 | int need_sync; | 305 | bool need_sync; |
299 | 306 | ||
300 | /* default dma_ops domain for that IOMMU */ | 307 | /* default dma_ops domain for that IOMMU */ |
301 | struct dma_ops_domain *default_dom; | 308 | struct dma_ops_domain *default_dom; |
@@ -374,7 +381,7 @@ extern struct protection_domain **amd_iommu_pd_table; | |||
374 | extern unsigned long *amd_iommu_pd_alloc_bitmap; | 381 | extern unsigned long *amd_iommu_pd_alloc_bitmap; |
375 | 382 | ||
376 | /* will be 1 if device isolation is enabled */ | 383 | /* will be 1 if device isolation is enabled */ |
377 | extern int amd_iommu_isolate; | 384 | extern bool amd_iommu_isolate; |
378 | 385 | ||
379 | /* | 386 | /* |
380 | * If true, the addresses will be flushed on unmap time, not when | 387 | * If true, the addresses will be flushed on unmap time, not when |
@@ -382,18 +389,6 @@ extern int amd_iommu_isolate; | |||
382 | */ | 389 | */ |
383 | extern bool amd_iommu_unmap_flush; | 390 | extern bool amd_iommu_unmap_flush; |
384 | 391 | ||
385 | /* takes a PCI device id and prints it out in a readable form */ | ||
386 | static inline void print_devid(u16 devid, int nl) | ||
387 | { | ||
388 | int bus = devid >> 8; | ||
389 | int dev = devid >> 3 & 0x1f; | ||
390 | int fn = devid & 0x07; | ||
391 | |||
392 | printk("%02x:%02x.%x", bus, dev, fn); | ||
393 | if (nl) | ||
394 | printk("\n"); | ||
395 | } | ||
396 | |||
397 | /* takes bus and device/function and returns the device id | 392 | /* takes bus and device/function and returns the device id |
398 | * FIXME: should that be in generic PCI code? */ | 393 | * FIXME: should that be in generic PCI code? */ |
399 | static inline u16 calc_devid(u8 bus, u8 devfn) | 394 | static inline u16 calc_devid(u8 bus, u8 devfn) |
@@ -401,4 +396,32 @@ static inline u16 calc_devid(u8 bus, u8 devfn) | |||
401 | return (((u16)bus) << 8) | devfn; | 396 | return (((u16)bus) << 8) | devfn; |
402 | } | 397 | } |
403 | 398 | ||
399 | #ifdef CONFIG_AMD_IOMMU_STATS | ||
400 | |||
401 | struct __iommu_counter { | ||
402 | char *name; | ||
403 | struct dentry *dent; | ||
404 | u64 value; | ||
405 | }; | ||
406 | |||
407 | #define DECLARE_STATS_COUNTER(nm) \ | ||
408 | static struct __iommu_counter nm = { \ | ||
409 | .name = #nm, \ | ||
410 | } | ||
411 | |||
412 | #define INC_STATS_COUNTER(name) name.value += 1 | ||
413 | #define ADD_STATS_COUNTER(name, x) name.value += (x) | ||
414 | #define SUB_STATS_COUNTER(name, x) name.value -= (x) | ||
415 | |||
416 | #else /* CONFIG_AMD_IOMMU_STATS */ | ||
417 | |||
418 | #define DECLARE_STATS_COUNTER(name) | ||
419 | #define INC_STATS_COUNTER(name) | ||
420 | #define ADD_STATS_COUNTER(name, x) | ||
421 | #define SUB_STATS_COUNTER(name, x) | ||
422 | |||
423 | static inline void amd_iommu_stats_init(void) { } | ||
424 | |||
425 | #endif /* CONFIG_AMD_IOMMU_STATS */ | ||
426 | |||
404 | #endif /* _ASM_X86_AMD_IOMMU_TYPES_H */ | 427 | #endif /* _ASM_X86_AMD_IOMMU_TYPES_H */ |
diff --git a/arch/x86/include/asm/es7000/apic.h b/arch/x86/include/asm/es7000/apic.h index 51ac1230294e..bc53d5ef1386 100644 --- a/arch/x86/include/asm/es7000/apic.h +++ b/arch/x86/include/asm/es7000/apic.h | |||
@@ -157,7 +157,7 @@ cpu_mask_to_apicid_cluster(const struct cpumask *cpumask) | |||
157 | 157 | ||
158 | num_bits_set = cpumask_weight(cpumask); | 158 | num_bits_set = cpumask_weight(cpumask); |
159 | /* Return id to all */ | 159 | /* Return id to all */ |
160 | if (num_bits_set == NR_CPUS) | 160 | if (num_bits_set == nr_cpu_ids) |
161 | return 0xFF; | 161 | return 0xFF; |
162 | /* | 162 | /* |
163 | * The cpus in the mask must all be on the apic cluster. If are not | 163 | * The cpus in the mask must all be on the apic cluster. If are not |
@@ -190,7 +190,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
190 | 190 | ||
191 | num_bits_set = cpus_weight(*cpumask); | 191 | num_bits_set = cpus_weight(*cpumask); |
192 | /* Return id to all */ | 192 | /* Return id to all */ |
193 | if (num_bits_set == NR_CPUS) | 193 | if (num_bits_set == nr_cpu_ids) |
194 | return cpu_to_logical_apicid(0); | 194 | return cpu_to_logical_apicid(0); |
195 | /* | 195 | /* |
196 | * The cpus in the mask must all be on the apic cluster. If are not | 196 | * The cpus in the mask must all be on the apic cluster. If are not |
@@ -218,9 +218,6 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
218 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, | 218 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, |
219 | const struct cpumask *andmask) | 219 | const struct cpumask *andmask) |
220 | { | 220 | { |
221 | int num_bits_set; | ||
222 | int cpus_found = 0; | ||
223 | int cpu; | ||
224 | int apicid = cpu_to_logical_apicid(0); | 221 | int apicid = cpu_to_logical_apicid(0); |
225 | cpumask_var_t cpumask; | 222 | cpumask_var_t cpumask; |
226 | 223 | ||
@@ -229,31 +226,8 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, | |||
229 | 226 | ||
230 | cpumask_and(cpumask, inmask, andmask); | 227 | cpumask_and(cpumask, inmask, andmask); |
231 | cpumask_and(cpumask, cpumask, cpu_online_mask); | 228 | cpumask_and(cpumask, cpumask, cpu_online_mask); |
229 | apicid = cpu_mask_to_apicid(cpumask); | ||
232 | 230 | ||
233 | num_bits_set = cpumask_weight(cpumask); | ||
234 | /* Return id to all */ | ||
235 | if (num_bits_set == NR_CPUS) | ||
236 | goto exit; | ||
237 | /* | ||
238 | * The cpus in the mask must all be on the apic cluster. If are not | ||
239 | * on the same apicid cluster return default value of TARGET_CPUS. | ||
240 | */ | ||
241 | cpu = cpumask_first(cpumask); | ||
242 | apicid = cpu_to_logical_apicid(cpu); | ||
243 | while (cpus_found < num_bits_set) { | ||
244 | if (cpumask_test_cpu(cpu, cpumask)) { | ||
245 | int new_apicid = cpu_to_logical_apicid(cpu); | ||
246 | if (apicid_cluster(apicid) != | ||
247 | apicid_cluster(new_apicid)){ | ||
248 | printk ("%s: Not a valid mask!\n", __func__); | ||
249 | return cpu_to_logical_apicid(0); | ||
250 | } | ||
251 | apicid = new_apicid; | ||
252 | cpus_found++; | ||
253 | } | ||
254 | cpu++; | ||
255 | } | ||
256 | exit: | ||
257 | free_cpumask_var(cpumask); | 231 | free_cpumask_var(cpumask); |
258 | return apicid; | 232 | return apicid; |
259 | } | 233 | } |
diff --git a/arch/x86/include/asm/es7000/mpparse.h b/arch/x86/include/asm/es7000/mpparse.h index ed5a3caae141..c1629b090ec2 100644 --- a/arch/x86/include/asm/es7000/mpparse.h +++ b/arch/x86/include/asm/es7000/mpparse.h | |||
@@ -10,8 +10,7 @@ extern void setup_unisys(void); | |||
10 | 10 | ||
11 | #ifndef CONFIG_X86_GENERICARCH | 11 | #ifndef CONFIG_X86_GENERICARCH |
12 | extern int acpi_madt_oem_check(char *oem_id, char *oem_table_id); | 12 | extern int acpi_madt_oem_check(char *oem_id, char *oem_table_id); |
13 | extern int mps_oem_check(struct mp_config_table *mpc, char *oem, | 13 | extern int mps_oem_check(struct mpc_table *mpc, char *oem, char *productid); |
14 | char *productid); | ||
15 | #endif | 14 | #endif |
16 | 15 | ||
17 | #ifdef CONFIG_ACPI | 16 | #ifdef CONFIG_ACPI |
diff --git a/arch/x86/include/asm/genapic_32.h b/arch/x86/include/asm/genapic_32.h index 746f37a7963a..2c05b737ee22 100644 --- a/arch/x86/include/asm/genapic_32.h +++ b/arch/x86/include/asm/genapic_32.h | |||
@@ -15,9 +15,9 @@ | |||
15 | * Copyright 2003 Andi Kleen, SuSE Labs. | 15 | * Copyright 2003 Andi Kleen, SuSE Labs. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | struct mpc_config_bus; | 18 | struct mpc_bus; |
19 | struct mp_config_table; | 19 | struct mpc_table; |
20 | struct mpc_config_processor; | 20 | struct mpc_cpu; |
21 | 21 | ||
22 | struct genapic { | 22 | struct genapic { |
23 | char *name; | 23 | char *name; |
@@ -51,7 +51,7 @@ struct genapic { | |||
51 | /* When one of the next two hooks returns 1 the genapic | 51 | /* When one of the next two hooks returns 1 the genapic |
52 | is switched to this. Essentially they are additional probe | 52 | is switched to this. Essentially they are additional probe |
53 | functions. */ | 53 | functions. */ |
54 | int (*mps_oem_check)(struct mp_config_table *mpc, char *oem, | 54 | int (*mps_oem_check)(struct mpc_table *mpc, char *oem, |
55 | char *productid); | 55 | char *productid); |
56 | int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); | 56 | int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); |
57 | 57 | ||
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 97215a458e5f..730843d1d2fb 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -360,7 +360,7 @@ struct kvm_arch{ | |||
360 | struct list_head active_mmu_pages; | 360 | struct list_head active_mmu_pages; |
361 | struct list_head assigned_dev_head; | 361 | struct list_head assigned_dev_head; |
362 | struct list_head oos_global_pages; | 362 | struct list_head oos_global_pages; |
363 | struct dmar_domain *intel_iommu_domain; | 363 | struct iommu_domain *iommu_domain; |
364 | struct kvm_pic *vpic; | 364 | struct kvm_pic *vpic; |
365 | struct kvm_ioapic *vioapic; | 365 | struct kvm_ioapic *vioapic; |
366 | struct kvm_pit *vpit; | 366 | struct kvm_pit *vpit; |
diff --git a/arch/x86/include/asm/lguest.h b/arch/x86/include/asm/lguest.h index d28a507cef39..1caf57628b9c 100644 --- a/arch/x86/include/asm/lguest.h +++ b/arch/x86/include/asm/lguest.h | |||
@@ -15,7 +15,7 @@ | |||
15 | #define SHARED_SWITCHER_PAGES \ | 15 | #define SHARED_SWITCHER_PAGES \ |
16 | DIV_ROUND_UP(end_switcher_text - start_switcher_text, PAGE_SIZE) | 16 | DIV_ROUND_UP(end_switcher_text - start_switcher_text, PAGE_SIZE) |
17 | /* Pages for switcher itself, then two pages per cpu */ | 17 | /* Pages for switcher itself, then two pages per cpu */ |
18 | #define TOTAL_SWITCHER_PAGES (SHARED_SWITCHER_PAGES + 2 * NR_CPUS) | 18 | #define TOTAL_SWITCHER_PAGES (SHARED_SWITCHER_PAGES + 2 * nr_cpu_ids) |
19 | 19 | ||
20 | /* We map at -4M for ease of mapping into the guest (one PTE page). */ | 20 | /* We map at -4M for ease of mapping into the guest (one PTE page). */ |
21 | #define SWITCHER_ADDR 0xFFC00000 | 21 | #define SWITCHER_ADDR 0xFFC00000 |
diff --git a/arch/x86/include/asm/mach-default/mach_mpparse.h b/arch/x86/include/asm/mach-default/mach_mpparse.h index 8c1ea21238a7..c70a263d68cd 100644 --- a/arch/x86/include/asm/mach-default/mach_mpparse.h +++ b/arch/x86/include/asm/mach-default/mach_mpparse.h | |||
@@ -1,8 +1,8 @@ | |||
1 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_MPPARSE_H | 1 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_MPPARSE_H |
2 | #define _ASM_X86_MACH_DEFAULT_MACH_MPPARSE_H | 2 | #define _ASM_X86_MACH_DEFAULT_MACH_MPPARSE_H |
3 | 3 | ||
4 | static inline int mps_oem_check(struct mp_config_table *mpc, char *oem, | 4 | static inline int |
5 | char *productid) | 5 | mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) |
6 | { | 6 | { |
7 | return 0; | 7 | return 0; |
8 | } | 8 | } |
diff --git a/arch/x86/include/asm/mach-generic/mach_mpparse.h b/arch/x86/include/asm/mach-generic/mach_mpparse.h index 048f1d468535..9444ab8dca94 100644 --- a/arch/x86/include/asm/mach-generic/mach_mpparse.h +++ b/arch/x86/include/asm/mach-generic/mach_mpparse.h | |||
@@ -2,9 +2,8 @@ | |||
2 | #define _ASM_X86_MACH_GENERIC_MACH_MPPARSE_H | 2 | #define _ASM_X86_MACH_GENERIC_MACH_MPPARSE_H |
3 | 3 | ||
4 | 4 | ||
5 | extern int mps_oem_check(struct mp_config_table *mpc, char *oem, | 5 | extern int mps_oem_check(struct mpc_table *, char *, char *); |
6 | char *productid); | ||
7 | 6 | ||
8 | extern int acpi_madt_oem_check(char *oem_id, char *oem_table_id); | 7 | extern int acpi_madt_oem_check(char *, char *); |
9 | 8 | ||
10 | #endif /* _ASM_X86_MACH_GENERIC_MACH_MPPARSE_H */ | 9 | #endif /* _ASM_X86_MACH_GENERIC_MACH_MPPARSE_H */ |
diff --git a/arch/x86/include/asm/mach-generic/mach_mpspec.h b/arch/x86/include/asm/mach-generic/mach_mpspec.h index bbab5ccfd4fe..3bc407226578 100644 --- a/arch/x86/include/asm/mach-generic/mach_mpspec.h +++ b/arch/x86/include/asm/mach-generic/mach_mpspec.h | |||
@@ -7,6 +7,6 @@ | |||
7 | /* Maximum 256 PCI busses, plus 1 ISA bus in each of 4 cabinets. */ | 7 | /* Maximum 256 PCI busses, plus 1 ISA bus in each of 4 cabinets. */ |
8 | #define MAX_MP_BUSSES 260 | 8 | #define MAX_MP_BUSSES 260 |
9 | 9 | ||
10 | extern void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem, | 10 | extern void numaq_mps_oem_check(struct mpc_table *, char *, char *); |
11 | char *productid); | 11 | |
12 | #endif /* _ASM_X86_MACH_GENERIC_MACH_MPSPEC_H */ | 12 | #endif /* _ASM_X86_MACH_GENERIC_MACH_MPSPEC_H */ |
diff --git a/arch/x86/include/asm/mpspec_def.h b/arch/x86/include/asm/mpspec_def.h index e3ace7d1d35d..59568bc4767f 100644 --- a/arch/x86/include/asm/mpspec_def.h +++ b/arch/x86/include/asm/mpspec_def.h | |||
@@ -39,17 +39,17 @@ struct intel_mp_floating { | |||
39 | 39 | ||
40 | #define MPC_SIGNATURE "PCMP" | 40 | #define MPC_SIGNATURE "PCMP" |
41 | 41 | ||
42 | struct mp_config_table { | 42 | struct mpc_table { |
43 | char mpc_signature[4]; | 43 | char signature[4]; |
44 | unsigned short mpc_length; /* Size of table */ | 44 | unsigned short length; /* Size of table */ |
45 | char mpc_spec; /* 0x01 */ | 45 | char spec; /* 0x01 */ |
46 | char mpc_checksum; | 46 | char checksum; |
47 | char mpc_oem[8]; | 47 | char oem[8]; |
48 | char mpc_productid[12]; | 48 | char productid[12]; |
49 | unsigned int mpc_oemptr; /* 0 if not present */ | 49 | unsigned int oemptr; /* 0 if not present */ |
50 | unsigned short mpc_oemsize; /* 0 if not present */ | 50 | unsigned short oemsize; /* 0 if not present */ |
51 | unsigned short mpc_oemcount; | 51 | unsigned short oemcount; |
52 | unsigned int mpc_lapic; /* APIC address */ | 52 | unsigned int lapic; /* APIC address */ |
53 | unsigned int reserved; | 53 | unsigned int reserved; |
54 | }; | 54 | }; |
55 | 55 | ||
@@ -70,20 +70,20 @@ struct mp_config_table { | |||
70 | #define CPU_MODEL_MASK 0x00F0 | 70 | #define CPU_MODEL_MASK 0x00F0 |
71 | #define CPU_FAMILY_MASK 0x0F00 | 71 | #define CPU_FAMILY_MASK 0x0F00 |
72 | 72 | ||
73 | struct mpc_config_processor { | 73 | struct mpc_cpu { |
74 | unsigned char mpc_type; | 74 | unsigned char type; |
75 | unsigned char mpc_apicid; /* Local APIC number */ | 75 | unsigned char apicid; /* Local APIC number */ |
76 | unsigned char mpc_apicver; /* Its versions */ | 76 | unsigned char apicver; /* Its versions */ |
77 | unsigned char mpc_cpuflag; | 77 | unsigned char cpuflag; |
78 | unsigned int mpc_cpufeature; | 78 | unsigned int cpufeature; |
79 | unsigned int mpc_featureflag; /* CPUID feature value */ | 79 | unsigned int featureflag; /* CPUID feature value */ |
80 | unsigned int mpc_reserved[2]; | 80 | unsigned int reserved[2]; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | struct mpc_config_bus { | 83 | struct mpc_bus { |
84 | unsigned char mpc_type; | 84 | unsigned char type; |
85 | unsigned char mpc_busid; | 85 | unsigned char busid; |
86 | unsigned char mpc_bustype[6]; | 86 | unsigned char bustype[6]; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | /* List of Bus Type string values, Intel MP Spec. */ | 89 | /* List of Bus Type string values, Intel MP Spec. */ |
@@ -108,22 +108,22 @@ struct mpc_config_bus { | |||
108 | 108 | ||
109 | #define MPC_APIC_USABLE 0x01 | 109 | #define MPC_APIC_USABLE 0x01 |
110 | 110 | ||
111 | struct mpc_config_ioapic { | 111 | struct mpc_ioapic { |
112 | unsigned char mpc_type; | 112 | unsigned char type; |
113 | unsigned char mpc_apicid; | 113 | unsigned char apicid; |
114 | unsigned char mpc_apicver; | 114 | unsigned char apicver; |
115 | unsigned char mpc_flags; | 115 | unsigned char flags; |
116 | unsigned int mpc_apicaddr; | 116 | unsigned int apicaddr; |
117 | }; | 117 | }; |
118 | 118 | ||
119 | struct mpc_config_intsrc { | 119 | struct mpc_intsrc { |
120 | unsigned char mpc_type; | 120 | unsigned char type; |
121 | unsigned char mpc_irqtype; | 121 | unsigned char irqtype; |
122 | unsigned short mpc_irqflag; | 122 | unsigned short irqflag; |
123 | unsigned char mpc_srcbus; | 123 | unsigned char srcbus; |
124 | unsigned char mpc_srcbusirq; | 124 | unsigned char srcbusirq; |
125 | unsigned char mpc_dstapic; | 125 | unsigned char dstapic; |
126 | unsigned char mpc_dstirq; | 126 | unsigned char dstirq; |
127 | }; | 127 | }; |
128 | 128 | ||
129 | enum mp_irq_source_types { | 129 | enum mp_irq_source_types { |
@@ -139,24 +139,24 @@ enum mp_irq_source_types { | |||
139 | 139 | ||
140 | #define MP_APIC_ALL 0xFF | 140 | #define MP_APIC_ALL 0xFF |
141 | 141 | ||
142 | struct mpc_config_lintsrc { | 142 | struct mpc_lintsrc { |
143 | unsigned char mpc_type; | 143 | unsigned char type; |
144 | unsigned char mpc_irqtype; | 144 | unsigned char irqtype; |
145 | unsigned short mpc_irqflag; | 145 | unsigned short irqflag; |
146 | unsigned char mpc_srcbusid; | 146 | unsigned char srcbusid; |
147 | unsigned char mpc_srcbusirq; | 147 | unsigned char srcbusirq; |
148 | unsigned char mpc_destapic; | 148 | unsigned char destapic; |
149 | unsigned char mpc_destapiclint; | 149 | unsigned char destapiclint; |
150 | }; | 150 | }; |
151 | 151 | ||
152 | #define MPC_OEM_SIGNATURE "_OEM" | 152 | #define MPC_OEM_SIGNATURE "_OEM" |
153 | 153 | ||
154 | struct mp_config_oemtable { | 154 | struct mpc_oemtable { |
155 | char oem_signature[4]; | 155 | char signature[4]; |
156 | unsigned short oem_length; /* Size of table */ | 156 | unsigned short length; /* Size of table */ |
157 | char oem_rev; /* 0x01 */ | 157 | char rev; /* 0x01 */ |
158 | char oem_checksum; | 158 | char checksum; |
159 | char mpc_oem[8]; | 159 | char mpc[8]; |
160 | }; | 160 | }; |
161 | 161 | ||
162 | /* | 162 | /* |
diff --git a/arch/x86/include/asm/numaq/apic.h b/arch/x86/include/asm/numaq/apic.h index c80f00d29965..bf37bc49bd8e 100644 --- a/arch/x86/include/asm/numaq/apic.h +++ b/arch/x86/include/asm/numaq/apic.h | |||
@@ -63,8 +63,8 @@ static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map) | |||
63 | extern u8 cpu_2_logical_apicid[]; | 63 | extern u8 cpu_2_logical_apicid[]; |
64 | static inline int cpu_to_logical_apicid(int cpu) | 64 | static inline int cpu_to_logical_apicid(int cpu) |
65 | { | 65 | { |
66 | if (cpu >= NR_CPUS) | 66 | if (cpu >= nr_cpu_ids) |
67 | return BAD_APICID; | 67 | return BAD_APICID; |
68 | return (int)cpu_2_logical_apicid[cpu]; | 68 | return (int)cpu_2_logical_apicid[cpu]; |
69 | } | 69 | } |
70 | 70 | ||
diff --git a/arch/x86/include/asm/numaq/mpparse.h b/arch/x86/include/asm/numaq/mpparse.h index 252292e077b6..a2eeefcd1cc7 100644 --- a/arch/x86/include/asm/numaq/mpparse.h +++ b/arch/x86/include/asm/numaq/mpparse.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef __ASM_NUMAQ_MPPARSE_H | 1 | #ifndef __ASM_NUMAQ_MPPARSE_H |
2 | #define __ASM_NUMAQ_MPPARSE_H | 2 | #define __ASM_NUMAQ_MPPARSE_H |
3 | 3 | ||
4 | extern void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem, | 4 | extern void numaq_mps_oem_check(struct mpc_table *, char *, char *); |
5 | char *productid); | ||
6 | 5 | ||
7 | #endif /* __ASM_NUMAQ_MPPARSE_H */ | 6 | #endif /* __ASM_NUMAQ_MPPARSE_H */ |
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index 66834c41c049..a977de23cb4d 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h | |||
@@ -102,9 +102,9 @@ extern void pci_iommu_alloc(void); | |||
102 | 102 | ||
103 | #ifdef CONFIG_NUMA | 103 | #ifdef CONFIG_NUMA |
104 | /* Returns the node based on pci bus */ | 104 | /* Returns the node based on pci bus */ |
105 | static inline int __pcibus_to_node(struct pci_bus *bus) | 105 | static inline int __pcibus_to_node(const struct pci_bus *bus) |
106 | { | 106 | { |
107 | struct pci_sysdata *sd = bus->sysdata; | 107 | const struct pci_sysdata *sd = bus->sysdata; |
108 | 108 | ||
109 | return sd->node; | 109 | return sd->node; |
110 | } | 110 | } |
@@ -113,6 +113,12 @@ static inline cpumask_t __pcibus_to_cpumask(struct pci_bus *bus) | |||
113 | { | 113 | { |
114 | return node_to_cpumask(__pcibus_to_node(bus)); | 114 | return node_to_cpumask(__pcibus_to_node(bus)); |
115 | } | 115 | } |
116 | |||
117 | static inline const struct cpumask * | ||
118 | cpumask_of_pcibus(const struct pci_bus *bus) | ||
119 | { | ||
120 | return cpumask_of_node(__pcibus_to_node(bus)); | ||
121 | } | ||
116 | #endif | 122 | #endif |
117 | 123 | ||
118 | #endif /* _ASM_X86_PCI_H */ | 124 | #endif /* _ASM_X86_PCI_H */ |
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h index 4fcd53fd5f43..ebe858cdc8a3 100644 --- a/arch/x86/include/asm/setup.h +++ b/arch/x86/include/asm/setup.h | |||
@@ -25,9 +25,9 @@ extern int wakeup_secondary_cpu_via_init(int apicid, unsigned long start_eip); | |||
25 | /* | 25 | /* |
26 | * Any setup quirks to be performed? | 26 | * Any setup quirks to be performed? |
27 | */ | 27 | */ |
28 | struct mpc_config_processor; | 28 | struct mpc_cpu; |
29 | struct mpc_config_bus; | 29 | struct mpc_bus; |
30 | struct mp_config_oemtable; | 30 | struct mpc_oemtable; |
31 | struct x86_quirks { | 31 | struct x86_quirks { |
32 | int (*arch_pre_time_init)(void); | 32 | int (*arch_pre_time_init)(void); |
33 | int (*arch_time_init)(void); | 33 | int (*arch_time_init)(void); |
@@ -39,10 +39,10 @@ struct x86_quirks { | |||
39 | int (*mach_find_smp_config)(unsigned int reserve); | 39 | int (*mach_find_smp_config)(unsigned int reserve); |
40 | 40 | ||
41 | int *mpc_record; | 41 | int *mpc_record; |
42 | int (*mpc_apic_id)(struct mpc_config_processor *m); | 42 | int (*mpc_apic_id)(struct mpc_cpu *m); |
43 | void (*mpc_oem_bus_info)(struct mpc_config_bus *m, char *name); | 43 | void (*mpc_oem_bus_info)(struct mpc_bus *m, char *name); |
44 | void (*mpc_oem_pci_bus)(struct mpc_config_bus *m); | 44 | void (*mpc_oem_pci_bus)(struct mpc_bus *m); |
45 | void (*smp_read_mpc_oem)(struct mp_config_oemtable *oemtable, | 45 | void (*smp_read_mpc_oem)(struct mpc_oemtable *oemtable, |
46 | unsigned short oemsize); | 46 | unsigned short oemsize); |
47 | int (*setup_ioapic_ids)(void); | 47 | int (*setup_ioapic_ids)(void); |
48 | int (*update_genapic)(void); | 48 | int (*update_genapic)(void); |
diff --git a/arch/x86/include/asm/summit/apic.h b/arch/x86/include/asm/summit/apic.h index 99327d1be49f..4bb5fb34f030 100644 --- a/arch/x86/include/asm/summit/apic.h +++ b/arch/x86/include/asm/summit/apic.h | |||
@@ -52,7 +52,7 @@ static inline void init_apic_ldr(void) | |||
52 | int i; | 52 | int i; |
53 | 53 | ||
54 | /* Create logical APIC IDs by counting CPUs already in cluster. */ | 54 | /* Create logical APIC IDs by counting CPUs already in cluster. */ |
55 | for (count = 0, i = NR_CPUS; --i >= 0; ) { | 55 | for (count = 0, i = nr_cpu_ids; --i >= 0; ) { |
56 | lid = cpu_2_logical_apicid[i]; | 56 | lid = cpu_2_logical_apicid[i]; |
57 | if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster) | 57 | if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster) |
58 | ++count; | 58 | ++count; |
@@ -97,8 +97,8 @@ static inline int apicid_to_node(int logical_apicid) | |||
97 | static inline int cpu_to_logical_apicid(int cpu) | 97 | static inline int cpu_to_logical_apicid(int cpu) |
98 | { | 98 | { |
99 | #ifdef CONFIG_SMP | 99 | #ifdef CONFIG_SMP |
100 | if (cpu >= NR_CPUS) | 100 | if (cpu >= nr_cpu_ids) |
101 | return BAD_APICID; | 101 | return BAD_APICID; |
102 | return (int)cpu_2_logical_apicid[cpu]; | 102 | return (int)cpu_2_logical_apicid[cpu]; |
103 | #else | 103 | #else |
104 | return logical_smp_processor_id(); | 104 | return logical_smp_processor_id(); |
@@ -107,7 +107,7 @@ static inline int cpu_to_logical_apicid(int cpu) | |||
107 | 107 | ||
108 | static inline int cpu_present_to_apicid(int mps_cpu) | 108 | static inline int cpu_present_to_apicid(int mps_cpu) |
109 | { | 109 | { |
110 | if (mps_cpu < NR_CPUS) | 110 | if (mps_cpu < nr_cpu_ids) |
111 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); | 111 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); |
112 | else | 112 | else |
113 | return BAD_APICID; | 113 | return BAD_APICID; |
@@ -146,7 +146,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
146 | 146 | ||
147 | num_bits_set = cpus_weight(*cpumask); | 147 | num_bits_set = cpus_weight(*cpumask); |
148 | /* Return id to all */ | 148 | /* Return id to all */ |
149 | if (num_bits_set == NR_CPUS) | 149 | if (num_bits_set >= nr_cpu_ids) |
150 | return (int) 0xFF; | 150 | return (int) 0xFF; |
151 | /* | 151 | /* |
152 | * The cpus in the mask must all be on the apic cluster. If are not | 152 | * The cpus in the mask must all be on the apic cluster. If are not |
@@ -173,42 +173,16 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
173 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, | 173 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, |
174 | const struct cpumask *andmask) | 174 | const struct cpumask *andmask) |
175 | { | 175 | { |
176 | int num_bits_set; | 176 | int apicid = cpu_to_logical_apicid(0); |
177 | int cpus_found = 0; | ||
178 | int cpu; | ||
179 | int apicid = 0xFF; | ||
180 | cpumask_var_t cpumask; | 177 | cpumask_var_t cpumask; |
181 | 178 | ||
182 | if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC)) | 179 | if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC)) |
183 | return (int) 0xFF; | 180 | return apicid; |
184 | 181 | ||
185 | cpumask_and(cpumask, inmask, andmask); | 182 | cpumask_and(cpumask, inmask, andmask); |
186 | cpumask_and(cpumask, cpumask, cpu_online_mask); | 183 | cpumask_and(cpumask, cpumask, cpu_online_mask); |
184 | apicid = cpu_mask_to_apicid(cpumask); | ||
187 | 185 | ||
188 | num_bits_set = cpumask_weight(cpumask); | ||
189 | /* Return id to all */ | ||
190 | if (num_bits_set == nr_cpu_ids) | ||
191 | goto exit; | ||
192 | /* | ||
193 | * The cpus in the mask must all be on the apic cluster. If are not | ||
194 | * on the same apicid cluster return default value of TARGET_CPUS. | ||
195 | */ | ||
196 | cpu = cpumask_first(cpumask); | ||
197 | apicid = cpu_to_logical_apicid(cpu); | ||
198 | while (cpus_found < num_bits_set) { | ||
199 | if (cpumask_test_cpu(cpu, cpumask)) { | ||
200 | int new_apicid = cpu_to_logical_apicid(cpu); | ||
201 | if (apicid_cluster(apicid) != | ||
202 | apicid_cluster(new_apicid)){ | ||
203 | printk ("%s: Not a valid mask!\n", __func__); | ||
204 | return 0xFF; | ||
205 | } | ||
206 | apicid = apicid | new_apicid; | ||
207 | cpus_found++; | ||
208 | } | ||
209 | cpu++; | ||
210 | } | ||
211 | exit: | ||
212 | free_cpumask_var(cpumask); | 186 | free_cpumask_var(cpumask); |
213 | return apicid; | 187 | return apicid; |
214 | } | 188 | } |
diff --git a/arch/x86/include/asm/summit/mpparse.h b/arch/x86/include/asm/summit/mpparse.h index 013ce6fab2d5..380e86c02363 100644 --- a/arch/x86/include/asm/summit/mpparse.h +++ b/arch/x86/include/asm/summit/mpparse.h | |||
@@ -11,7 +11,7 @@ extern void setup_summit(void); | |||
11 | #define setup_summit() {} | 11 | #define setup_summit() {} |
12 | #endif | 12 | #endif |
13 | 13 | ||
14 | static inline int mps_oem_check(struct mp_config_table *mpc, char *oem, | 14 | static inline int mps_oem_check(struct mpc_table *mpc, char *oem, |
15 | char *productid) | 15 | char *productid) |
16 | { | 16 | { |
17 | if (!strncmp(oem, "IBM ENSW", 8) && | 17 | if (!strncmp(oem, "IBM ENSW", 8) && |
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 79e31e9dcdda..4e2f2e0aab27 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h | |||
@@ -61,13 +61,19 @@ static inline int cpu_to_node(int cpu) | |||
61 | * | 61 | * |
62 | * Side note: this function creates the returned cpumask on the stack | 62 | * Side note: this function creates the returned cpumask on the stack |
63 | * so with a high NR_CPUS count, excessive stack space is used. The | 63 | * so with a high NR_CPUS count, excessive stack space is used. The |
64 | * node_to_cpumask_ptr function should be used whenever possible. | 64 | * cpumask_of_node function should be used whenever possible. |
65 | */ | 65 | */ |
66 | static inline cpumask_t node_to_cpumask(int node) | 66 | static inline cpumask_t node_to_cpumask(int node) |
67 | { | 67 | { |
68 | return node_to_cpumask_map[node]; | 68 | return node_to_cpumask_map[node]; |
69 | } | 69 | } |
70 | 70 | ||
71 | /* Returns a bitmask of CPUs on Node 'node'. */ | ||
72 | static inline const struct cpumask *cpumask_of_node(int node) | ||
73 | { | ||
74 | return &node_to_cpumask_map[node]; | ||
75 | } | ||
76 | |||
71 | #else /* CONFIG_X86_64 */ | 77 | #else /* CONFIG_X86_64 */ |
72 | 78 | ||
73 | /* Mappings between node number and cpus on that node. */ | 79 | /* Mappings between node number and cpus on that node. */ |
@@ -82,7 +88,7 @@ DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); | |||
82 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | 88 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS |
83 | extern int cpu_to_node(int cpu); | 89 | extern int cpu_to_node(int cpu); |
84 | extern int early_cpu_to_node(int cpu); | 90 | extern int early_cpu_to_node(int cpu); |
85 | extern const cpumask_t *_node_to_cpumask_ptr(int node); | 91 | extern const cpumask_t *cpumask_of_node(int node); |
86 | extern cpumask_t node_to_cpumask(int node); | 92 | extern cpumask_t node_to_cpumask(int node); |
87 | 93 | ||
88 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ | 94 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
@@ -103,7 +109,7 @@ static inline int early_cpu_to_node(int cpu) | |||
103 | } | 109 | } |
104 | 110 | ||
105 | /* Returns a pointer to the cpumask of CPUs on Node 'node'. */ | 111 | /* Returns a pointer to the cpumask of CPUs on Node 'node'. */ |
106 | static inline const cpumask_t *_node_to_cpumask_ptr(int node) | 112 | static inline const cpumask_t *cpumask_of_node(int node) |
107 | { | 113 | { |
108 | return &node_to_cpumask_map[node]; | 114 | return &node_to_cpumask_map[node]; |
109 | } | 115 | } |
@@ -116,12 +122,15 @@ static inline cpumask_t node_to_cpumask(int node) | |||
116 | 122 | ||
117 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ | 123 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
118 | 124 | ||
119 | /* Replace default node_to_cpumask_ptr with optimized version */ | 125 | /* |
126 | * Replace default node_to_cpumask_ptr with optimized version | ||
127 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" | ||
128 | */ | ||
120 | #define node_to_cpumask_ptr(v, node) \ | 129 | #define node_to_cpumask_ptr(v, node) \ |
121 | const cpumask_t *v = _node_to_cpumask_ptr(node) | 130 | const cpumask_t *v = cpumask_of_node(node) |
122 | 131 | ||
123 | #define node_to_cpumask_ptr_next(v, node) \ | 132 | #define node_to_cpumask_ptr_next(v, node) \ |
124 | v = _node_to_cpumask_ptr(node) | 133 | v = cpumask_of_node(node) |
125 | 134 | ||
126 | #endif /* CONFIG_X86_64 */ | 135 | #endif /* CONFIG_X86_64 */ |
127 | 136 | ||
@@ -187,7 +196,7 @@ extern int __node_distance(int, int); | |||
187 | #define cpu_to_node(cpu) 0 | 196 | #define cpu_to_node(cpu) 0 |
188 | #define early_cpu_to_node(cpu) 0 | 197 | #define early_cpu_to_node(cpu) 0 |
189 | 198 | ||
190 | static inline const cpumask_t *_node_to_cpumask_ptr(int node) | 199 | static inline const cpumask_t *cpumask_of_node(int node) |
191 | { | 200 | { |
192 | return &cpu_online_map; | 201 | return &cpu_online_map; |
193 | } | 202 | } |
@@ -200,12 +209,15 @@ static inline int node_to_first_cpu(int node) | |||
200 | return first_cpu(cpu_online_map); | 209 | return first_cpu(cpu_online_map); |
201 | } | 210 | } |
202 | 211 | ||
203 | /* Replace default node_to_cpumask_ptr with optimized version */ | 212 | /* |
213 | * Replace default node_to_cpumask_ptr with optimized version | ||
214 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" | ||
215 | */ | ||
204 | #define node_to_cpumask_ptr(v, node) \ | 216 | #define node_to_cpumask_ptr(v, node) \ |
205 | const cpumask_t *v = _node_to_cpumask_ptr(node) | 217 | const cpumask_t *v = cpumask_of_node(node) |
206 | 218 | ||
207 | #define node_to_cpumask_ptr_next(v, node) \ | 219 | #define node_to_cpumask_ptr_next(v, node) \ |
208 | v = _node_to_cpumask_ptr(node) | 220 | v = cpumask_of_node(node) |
209 | #endif | 221 | #endif |
210 | 222 | ||
211 | #include <asm-generic/topology.h> | 223 | #include <asm-generic/topology.h> |
@@ -214,12 +226,12 @@ static inline int node_to_first_cpu(int node) | |||
214 | /* Returns the number of the first CPU on Node 'node'. */ | 226 | /* Returns the number of the first CPU on Node 'node'. */ |
215 | static inline int node_to_first_cpu(int node) | 227 | static inline int node_to_first_cpu(int node) |
216 | { | 228 | { |
217 | node_to_cpumask_ptr(mask, node); | 229 | return cpumask_first(cpumask_of_node(node)); |
218 | return first_cpu(*mask); | ||
219 | } | 230 | } |
220 | #endif | 231 | #endif |
221 | 232 | ||
222 | extern cpumask_t cpu_coregroup_map(int cpu); | 233 | extern cpumask_t cpu_coregroup_map(int cpu); |
234 | extern const struct cpumask *cpu_coregroup_mask(int cpu); | ||
223 | 235 | ||
224 | #ifdef ENABLE_TOPO_DEFINES | 236 | #ifdef ENABLE_TOPO_DEFINES |
225 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) | 237 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) |