diff options
| -rw-r--r-- | arch/x86/include/asm/cpufeature.h | 4 | ||||
| -rw-r--r-- | arch/x86/include/asm/smp.h | 9 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/addon_cpuid_features.c | 4 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/intel_cacheinfo.c | 250 | ||||
| -rw-r--r-- | arch/x86/lib/Makefile | 2 | ||||
| -rw-r--r-- | arch/x86/lib/cache-smp.c | 19 | ||||
| -rw-r--r-- | drivers/char/agp/intel-agp.c | 15 |
7 files changed, 197 insertions, 106 deletions
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 637e1ec963c3..0cd82d068613 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
| @@ -168,6 +168,10 @@ | |||
| 168 | #define X86_FEATURE_FLEXPRIORITY (8*32+ 2) /* Intel FlexPriority */ | 168 | #define X86_FEATURE_FLEXPRIORITY (8*32+ 2) /* Intel FlexPriority */ |
| 169 | #define X86_FEATURE_EPT (8*32+ 3) /* Intel Extended Page Table */ | 169 | #define X86_FEATURE_EPT (8*32+ 3) /* Intel Extended Page Table */ |
| 170 | #define X86_FEATURE_VPID (8*32+ 4) /* Intel Virtual Processor ID */ | 170 | #define X86_FEATURE_VPID (8*32+ 4) /* Intel Virtual Processor ID */ |
| 171 | #define X86_FEATURE_NPT (8*32+5) /* AMD Nested Page Table support */ | ||
| 172 | #define X86_FEATURE_LBRV (8*32+6) /* AMD LBR Virtualization support */ | ||
| 173 | #define X86_FEATURE_SVML (8*32+7) /* "svm_lock" AMD SVM locking MSR */ | ||
| 174 | #define X86_FEATURE_NRIPS (8*32+8) /* "nrip_save" AMD SVM next_rip save */ | ||
| 171 | 175 | ||
| 172 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) | 176 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) |
| 173 | 177 | ||
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 1e796782cd7b..4cfc90824068 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h | |||
| @@ -135,6 +135,8 @@ int native_cpu_disable(void); | |||
| 135 | void native_cpu_die(unsigned int cpu); | 135 | void native_cpu_die(unsigned int cpu); |
| 136 | void native_play_dead(void); | 136 | void native_play_dead(void); |
| 137 | void play_dead_common(void); | 137 | void play_dead_common(void); |
| 138 | void wbinvd_on_cpu(int cpu); | ||
| 139 | int wbinvd_on_all_cpus(void); | ||
| 138 | 140 | ||
| 139 | void native_send_call_func_ipi(const struct cpumask *mask); | 141 | void native_send_call_func_ipi(const struct cpumask *mask); |
| 140 | void native_send_call_func_single_ipi(int cpu); | 142 | void native_send_call_func_single_ipi(int cpu); |
| @@ -147,6 +149,13 @@ static inline int num_booting_cpus(void) | |||
| 147 | { | 149 | { |
| 148 | return cpumask_weight(cpu_callout_mask); | 150 | return cpumask_weight(cpu_callout_mask); |
| 149 | } | 151 | } |
| 152 | #else /* !CONFIG_SMP */ | ||
| 153 | #define wbinvd_on_cpu(cpu) wbinvd() | ||
| 154 | static inline int wbinvd_on_all_cpus(void) | ||
| 155 | { | ||
| 156 | wbinvd(); | ||
| 157 | return 0; | ||
| 158 | } | ||
| 150 | #endif /* CONFIG_SMP */ | 159 | #endif /* CONFIG_SMP */ |
| 151 | 160 | ||
| 152 | extern unsigned disabled_cpus __cpuinitdata; | 161 | extern unsigned disabled_cpus __cpuinitdata; |
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c index 468489b57aae..97ad79cdf688 100644 --- a/arch/x86/kernel/cpu/addon_cpuid_features.c +++ b/arch/x86/kernel/cpu/addon_cpuid_features.c | |||
| @@ -32,6 +32,10 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c) | |||
| 32 | static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { | 32 | static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { |
| 33 | { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 }, | 33 | { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 }, |
| 34 | { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006 }, | 34 | { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006 }, |
| 35 | { X86_FEATURE_NPT, CR_EDX, 0, 0x8000000a }, | ||
| 36 | { X86_FEATURE_LBRV, CR_EDX, 1, 0x8000000a }, | ||
| 37 | { X86_FEATURE_SVML, CR_EDX, 2, 0x8000000a }, | ||
| 38 | { X86_FEATURE_NRIPS, CR_EDX, 3, 0x8000000a }, | ||
| 35 | { 0, 0, 0, 0 } | 39 | { 0, 0, 0, 0 } |
| 36 | }; | 40 | }; |
| 37 | 41 | ||
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index c2b722d5a722..eddb1bdd1b8f 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <asm/processor.h> | 18 | #include <asm/processor.h> |
| 19 | #include <linux/smp.h> | 19 | #include <linux/smp.h> |
| 20 | #include <asm/k8.h> | 20 | #include <asm/k8.h> |
| 21 | #include <asm/smp.h> | ||
| 21 | 22 | ||
| 22 | #define LVL_1_INST 1 | 23 | #define LVL_1_INST 1 |
| 23 | #define LVL_1_DATA 2 | 24 | #define LVL_1_DATA 2 |
| @@ -152,7 +153,8 @@ struct _cpuid4_info { | |||
| 152 | union _cpuid4_leaf_ebx ebx; | 153 | union _cpuid4_leaf_ebx ebx; |
| 153 | union _cpuid4_leaf_ecx ecx; | 154 | union _cpuid4_leaf_ecx ecx; |
| 154 | unsigned long size; | 155 | unsigned long size; |
| 155 | unsigned long can_disable; | 156 | bool can_disable; |
| 157 | unsigned int l3_indices; | ||
| 156 | DECLARE_BITMAP(shared_cpu_map, NR_CPUS); | 158 | DECLARE_BITMAP(shared_cpu_map, NR_CPUS); |
| 157 | }; | 159 | }; |
| 158 | 160 | ||
| @@ -162,7 +164,8 @@ struct _cpuid4_info_regs { | |||
| 162 | union _cpuid4_leaf_ebx ebx; | 164 | union _cpuid4_leaf_ebx ebx; |
| 163 | union _cpuid4_leaf_ecx ecx; | 165 | union _cpuid4_leaf_ecx ecx; |
| 164 | unsigned long size; | 166 | unsigned long size; |
| 165 | unsigned long can_disable; | 167 | bool can_disable; |
| 168 | unsigned int l3_indices; | ||
| 166 | }; | 169 | }; |
| 167 | 170 | ||
| 168 | unsigned short num_cache_leaves; | 171 | unsigned short num_cache_leaves; |
| @@ -292,6 +295,36 @@ amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax, | |||
| 292 | (ebx->split.ways_of_associativity + 1) - 1; | 295 | (ebx->split.ways_of_associativity + 1) - 1; |
| 293 | } | 296 | } |
| 294 | 297 | ||
| 298 | struct _cache_attr { | ||
| 299 | struct attribute attr; | ||
| 300 | ssize_t (*show)(struct _cpuid4_info *, char *); | ||
| 301 | ssize_t (*store)(struct _cpuid4_info *, const char *, size_t count); | ||
| 302 | }; | ||
| 303 | |||
| 304 | #ifdef CONFIG_CPU_SUP_AMD | ||
| 305 | static unsigned int __cpuinit amd_calc_l3_indices(void) | ||
| 306 | { | ||
| 307 | /* | ||
| 308 | * We're called over smp_call_function_single() and therefore | ||
| 309 | * are on the correct cpu. | ||
| 310 | */ | ||
| 311 | int cpu = smp_processor_id(); | ||
| 312 | int node = cpu_to_node(cpu); | ||
| 313 | struct pci_dev *dev = node_to_k8_nb_misc(node); | ||
| 314 | unsigned int sc0, sc1, sc2, sc3; | ||
| 315 | u32 val = 0; | ||
| 316 | |||
| 317 | pci_read_config_dword(dev, 0x1C4, &val); | ||
| 318 | |||
| 319 | /* calculate subcache sizes */ | ||
| 320 | sc0 = !(val & BIT(0)); | ||
| 321 | sc1 = !(val & BIT(4)); | ||
| 322 | sc2 = !(val & BIT(8)) + !(val & BIT(9)); | ||
| 323 | sc3 = !(val & BIT(12)) + !(val & BIT(13)); | ||
| 324 | |||
| 325 | return (max(max(max(sc0, sc1), sc2), sc3) << 10) - 1; | ||
| 326 | } | ||
| 327 | |||
| 295 | static void __cpuinit | 328 | static void __cpuinit |
| 296 | amd_check_l3_disable(int index, struct _cpuid4_info_regs *this_leaf) | 329 | amd_check_l3_disable(int index, struct _cpuid4_info_regs *this_leaf) |
| 297 | { | 330 | { |
| @@ -301,12 +334,103 @@ amd_check_l3_disable(int index, struct _cpuid4_info_regs *this_leaf) | |||
| 301 | if (boot_cpu_data.x86 == 0x11) | 334 | if (boot_cpu_data.x86 == 0x11) |
| 302 | return; | 335 | return; |
| 303 | 336 | ||
| 304 | /* see erratum #382 */ | 337 | /* see errata #382 and #388 */ |
| 305 | if ((boot_cpu_data.x86 == 0x10) && (boot_cpu_data.x86_model < 0x8)) | 338 | if ((boot_cpu_data.x86 == 0x10) && |
| 339 | ((boot_cpu_data.x86_model < 0x8) || | ||
| 340 | (boot_cpu_data.x86_mask < 0x1))) | ||
| 306 | return; | 341 | return; |
| 307 | 342 | ||
| 308 | this_leaf->can_disable = 1; | 343 | this_leaf->can_disable = true; |
| 344 | this_leaf->l3_indices = amd_calc_l3_indices(); | ||
| 345 | } | ||
| 346 | |||
| 347 | static ssize_t show_cache_disable(struct _cpuid4_info *this_leaf, char *buf, | ||
| 348 | unsigned int index) | ||
| 349 | { | ||
| 350 | int cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map)); | ||
| 351 | int node = amd_get_nb_id(cpu); | ||
| 352 | struct pci_dev *dev = node_to_k8_nb_misc(node); | ||
| 353 | unsigned int reg = 0; | ||
| 354 | |||
| 355 | if (!this_leaf->can_disable) | ||
| 356 | return -EINVAL; | ||
| 357 | |||
| 358 | if (!dev) | ||
| 359 | return -EINVAL; | ||
| 360 | |||
| 361 | pci_read_config_dword(dev, 0x1BC + index * 4, ®); | ||
| 362 | return sprintf(buf, "0x%08x\n", reg); | ||
| 363 | } | ||
| 364 | |||
| 365 | #define SHOW_CACHE_DISABLE(index) \ | ||
| 366 | static ssize_t \ | ||
| 367 | show_cache_disable_##index(struct _cpuid4_info *this_leaf, char *buf) \ | ||
| 368 | { \ | ||
| 369 | return show_cache_disable(this_leaf, buf, index); \ | ||
| 370 | } | ||
| 371 | SHOW_CACHE_DISABLE(0) | ||
| 372 | SHOW_CACHE_DISABLE(1) | ||
| 373 | |||
| 374 | static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf, | ||
| 375 | const char *buf, size_t count, unsigned int index) | ||
| 376 | { | ||
| 377 | int cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map)); | ||
| 378 | int node = amd_get_nb_id(cpu); | ||
| 379 | struct pci_dev *dev = node_to_k8_nb_misc(node); | ||
| 380 | unsigned long val = 0; | ||
| 381 | |||
| 382 | #define SUBCACHE_MASK (3UL << 20) | ||
| 383 | #define SUBCACHE_INDEX 0xfff | ||
| 384 | |||
| 385 | if (!this_leaf->can_disable) | ||
| 386 | return -EINVAL; | ||
| 387 | |||
| 388 | if (!capable(CAP_SYS_ADMIN)) | ||
| 389 | return -EPERM; | ||
| 390 | |||
| 391 | if (!dev) | ||
| 392 | return -EINVAL; | ||
| 393 | |||
| 394 | if (strict_strtoul(buf, 10, &val) < 0) | ||
| 395 | return -EINVAL; | ||
| 396 | |||
| 397 | /* do not allow writes outside of allowed bits */ | ||
| 398 | if ((val & ~(SUBCACHE_MASK | SUBCACHE_INDEX)) || | ||
| 399 | ((val & SUBCACHE_INDEX) > this_leaf->l3_indices)) | ||
| 400 | return -EINVAL; | ||
| 401 | |||
| 402 | val |= BIT(30); | ||
| 403 | pci_write_config_dword(dev, 0x1BC + index * 4, val); | ||
| 404 | /* | ||
| 405 | * We need to WBINVD on a core on the node containing the L3 cache which | ||
| 406 | * indices we disable therefore a simple wbinvd() is not sufficient. | ||
| 407 | */ | ||
| 408 | wbinvd_on_cpu(cpu); | ||
| 409 | pci_write_config_dword(dev, 0x1BC + index * 4, val | BIT(31)); | ||
| 410 | return count; | ||
| 411 | } | ||
| 412 | |||
| 413 | #define STORE_CACHE_DISABLE(index) \ | ||
| 414 | static ssize_t \ | ||
| 415 | store_cache_disable_##index(struct _cpuid4_info *this_leaf, \ | ||
| 416 | const char *buf, size_t count) \ | ||
| 417 | { \ | ||
| 418 | return store_cache_disable(this_leaf, buf, count, index); \ | ||
| 309 | } | 419 | } |
| 420 | STORE_CACHE_DISABLE(0) | ||
| 421 | STORE_CACHE_DISABLE(1) | ||
| 422 | |||
| 423 | static struct _cache_attr cache_disable_0 = __ATTR(cache_disable_0, 0644, | ||
| 424 | show_cache_disable_0, store_cache_disable_0); | ||
| 425 | static struct _cache_attr cache_disable_1 = __ATTR(cache_disable_1, 0644, | ||
| 426 | show_cache_disable_1, store_cache_disable_1); | ||
| 427 | |||
| 428 | #else /* CONFIG_CPU_SUP_AMD */ | ||
| 429 | static void __cpuinit | ||
| 430 | amd_check_l3_disable(int index, struct _cpuid4_info_regs *this_leaf) | ||
| 431 | { | ||
| 432 | }; | ||
| 433 | #endif /* CONFIG_CPU_SUP_AMD */ | ||
| 310 | 434 | ||
| 311 | static int | 435 | static int |
| 312 | __cpuinit cpuid4_cache_lookup_regs(int index, | 436 | __cpuinit cpuid4_cache_lookup_regs(int index, |
| @@ -713,82 +837,6 @@ static ssize_t show_type(struct _cpuid4_info *this_leaf, char *buf) | |||
| 713 | #define to_object(k) container_of(k, struct _index_kobject, kobj) | 837 | #define to_object(k) container_of(k, struct _index_kobject, kobj) |
| 714 | #define to_attr(a) container_of(a, struct _cache_attr, attr) | 838 | #define to_attr(a) container_of(a, struct _cache_attr, attr) |
| 715 | 839 | ||
| 716 | static ssize_t show_cache_disable(struct _cpuid4_info *this_leaf, char *buf, | ||
| 717 | unsigned int index) | ||
| 718 | { | ||
| 719 | int cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map)); | ||
| 720 | int node = cpu_to_node(cpu); | ||
| 721 | struct pci_dev *dev = node_to_k8_nb_misc(node); | ||
| 722 | unsigned int reg = 0; | ||
| 723 | |||
| 724 | if (!this_leaf->can_disable) | ||
| 725 | return -EINVAL; | ||
| 726 | |||
| 727 | if (!dev) | ||
| 728 | return -EINVAL; | ||
| 729 | |||
| 730 | pci_read_config_dword(dev, 0x1BC + index * 4, ®); | ||
| 731 | return sprintf(buf, "%x\n", reg); | ||
| 732 | } | ||
| 733 | |||
| 734 | #define SHOW_CACHE_DISABLE(index) \ | ||
| 735 | static ssize_t \ | ||
| 736 | show_cache_disable_##index(struct _cpuid4_info *this_leaf, char *buf) \ | ||
| 737 | { \ | ||
| 738 | return show_cache_disable(this_leaf, buf, index); \ | ||
| 739 | } | ||
| 740 | SHOW_CACHE_DISABLE(0) | ||
| 741 | SHOW_CACHE_DISABLE(1) | ||
| 742 | |||
| 743 | static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf, | ||
| 744 | const char *buf, size_t count, unsigned int index) | ||
| 745 | { | ||
| 746 | int cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map)); | ||
| 747 | int node = cpu_to_node(cpu); | ||
| 748 | struct pci_dev *dev = node_to_k8_nb_misc(node); | ||
| 749 | unsigned long val = 0; | ||
| 750 | unsigned int scrubber = 0; | ||
| 751 | |||
| 752 | if (!this_leaf->can_disable) | ||
| 753 | return -EINVAL; | ||
| 754 | |||
| 755 | if (!capable(CAP_SYS_ADMIN)) | ||
| 756 | return -EPERM; | ||
| 757 | |||
| 758 | if (!dev) | ||
| 759 | return -EINVAL; | ||
| 760 | |||
| 761 | if (strict_strtoul(buf, 10, &val) < 0) | ||
| 762 | return -EINVAL; | ||
| 763 | |||
| 764 | val |= 0xc0000000; | ||
| 765 | |||
| 766 | pci_read_config_dword(dev, 0x58, &scrubber); | ||
| 767 | scrubber &= ~0x1f000000; | ||
| 768 | pci_write_config_dword(dev, 0x58, scrubber); | ||
| 769 | |||
| 770 | pci_write_config_dword(dev, 0x1BC + index * 4, val & ~0x40000000); | ||
| 771 | wbinvd(); | ||
| 772 | pci_write_config_dword(dev, 0x1BC + index * 4, val); | ||
| 773 | return count; | ||
| 774 | } | ||
| 775 | |||
| 776 | #define STORE_CACHE_DISABLE(index) \ | ||
| 777 | static ssize_t \ | ||
| 778 | store_cache_disable_##index(struct _cpuid4_info *this_leaf, \ | ||
| 779 | const char *buf, size_t count) \ | ||
| 780 | { \ | ||
| 781 | return store_cache_disable(this_leaf, buf, count, index); \ | ||
| 782 | } | ||
| 783 | STORE_CACHE_DISABLE(0) | ||
| 784 | STORE_CACHE_DISABLE(1) | ||
| 785 | |||
| 786 | struct _cache_attr { | ||
| 787 | struct attribute attr; | ||
| 788 | ssize_t (*show)(struct _cpuid4_info *, char *); | ||
| 789 | ssize_t (*store)(struct _cpuid4_info *, const char *, size_t count); | ||
| 790 | }; | ||
| 791 | |||
| 792 | #define define_one_ro(_name) \ | 840 | #define define_one_ro(_name) \ |
| 793 | static struct _cache_attr _name = \ | 841 | static struct _cache_attr _name = \ |
| 794 | __ATTR(_name, 0444, show_##_name, NULL) | 842 | __ATTR(_name, 0444, show_##_name, NULL) |
| @@ -803,23 +851,28 @@ define_one_ro(size); | |||
| 803 | define_one_ro(shared_cpu_map); | 851 | define_one_ro(shared_cpu_map); |
| 804 | define_one_ro(shared_cpu_list); | 852 | define_one_ro(shared_cpu_list); |
| 805 | 853 | ||
| 806 | static struct _cache_attr cache_disable_0 = __ATTR(cache_disable_0, 0644, | 854 | #define DEFAULT_SYSFS_CACHE_ATTRS \ |
| 807 | show_cache_disable_0, store_cache_disable_0); | 855 | &type.attr, \ |
| 808 | static struct _cache_attr cache_disable_1 = __ATTR(cache_disable_1, 0644, | 856 | &level.attr, \ |
| 809 | show_cache_disable_1, store_cache_disable_1); | 857 | &coherency_line_size.attr, \ |
| 858 | &physical_line_partition.attr, \ | ||
| 859 | &ways_of_associativity.attr, \ | ||
| 860 | &number_of_sets.attr, \ | ||
| 861 | &size.attr, \ | ||
| 862 | &shared_cpu_map.attr, \ | ||
| 863 | &shared_cpu_list.attr | ||
| 810 | 864 | ||
| 811 | static struct attribute *default_attrs[] = { | 865 | static struct attribute *default_attrs[] = { |
| 812 | &type.attr, | 866 | DEFAULT_SYSFS_CACHE_ATTRS, |
| 813 | &level.attr, | 867 | NULL |
| 814 | &coherency_line_size.attr, | 868 | }; |
| 815 | &physical_line_partition.attr, | 869 | |
| 816 | &ways_of_associativity.attr, | 870 | static struct attribute *default_l3_attrs[] = { |
| 817 | &number_of_sets.attr, | 871 | DEFAULT_SYSFS_CACHE_ATTRS, |
| 818 | &size.attr, | 872 | #ifdef CONFIG_CPU_SUP_AMD |
| 819 | &shared_cpu_map.attr, | ||
| 820 | &shared_cpu_list.attr, | ||
| 821 | &cache_disable_0.attr, | 873 | &cache_disable_0.attr, |
| 822 | &cache_disable_1.attr, | 874 | &cache_disable_1.attr, |
| 875 | #endif | ||
| 823 | NULL | 876 | NULL |
| 824 | }; | 877 | }; |
| 825 | 878 | ||
| @@ -910,6 +963,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) | |||
| 910 | unsigned int cpu = sys_dev->id; | 963 | unsigned int cpu = sys_dev->id; |
| 911 | unsigned long i, j; | 964 | unsigned long i, j; |
| 912 | struct _index_kobject *this_object; | 965 | struct _index_kobject *this_object; |
| 966 | struct _cpuid4_info *this_leaf; | ||
| 913 | int retval; | 967 | int retval; |
| 914 | 968 | ||
| 915 | retval = cpuid4_cache_sysfs_init(cpu); | 969 | retval = cpuid4_cache_sysfs_init(cpu); |
| @@ -928,6 +982,14 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) | |||
| 928 | this_object = INDEX_KOBJECT_PTR(cpu, i); | 982 | this_object = INDEX_KOBJECT_PTR(cpu, i); |
| 929 | this_object->cpu = cpu; | 983 | this_object->cpu = cpu; |
| 930 | this_object->index = i; | 984 | this_object->index = i; |
| 985 | |||
| 986 | this_leaf = CPUID4_INFO_IDX(cpu, i); | ||
| 987 | |||
| 988 | if (this_leaf->can_disable) | ||
| 989 | ktype_cache.default_attrs = default_l3_attrs; | ||
| 990 | else | ||
| 991 | ktype_cache.default_attrs = default_attrs; | ||
| 992 | |||
| 931 | retval = kobject_init_and_add(&(this_object->kobj), | 993 | retval = kobject_init_and_add(&(this_object->kobj), |
| 932 | &ktype_cache, | 994 | &ktype_cache, |
| 933 | per_cpu(ici_cache_kobject, cpu), | 995 | per_cpu(ici_cache_kobject, cpu), |
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index cffd754f3039..d85e0e438b58 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile | |||
| @@ -14,7 +14,7 @@ $(obj)/inat.o: $(obj)/inat-tables.c | |||
| 14 | 14 | ||
| 15 | clean-files := inat-tables.c | 15 | clean-files := inat-tables.c |
| 16 | 16 | ||
| 17 | obj-$(CONFIG_SMP) += msr-smp.o | 17 | obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o |
| 18 | 18 | ||
| 19 | lib-y := delay.o | 19 | lib-y := delay.o |
| 20 | lib-y += thunk_$(BITS).o | 20 | lib-y += thunk_$(BITS).o |
diff --git a/arch/x86/lib/cache-smp.c b/arch/x86/lib/cache-smp.c new file mode 100644 index 000000000000..a3c668875038 --- /dev/null +++ b/arch/x86/lib/cache-smp.c | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #include <linux/smp.h> | ||
| 2 | #include <linux/module.h> | ||
| 3 | |||
| 4 | static void __wbinvd(void *dummy) | ||
| 5 | { | ||
| 6 | wbinvd(); | ||
| 7 | } | ||
| 8 | |||
| 9 | void wbinvd_on_cpu(int cpu) | ||
| 10 | { | ||
| 11 | smp_call_function_single(cpu, __wbinvd, NULL, 1); | ||
| 12 | } | ||
| 13 | EXPORT_SYMBOL(wbinvd_on_cpu); | ||
| 14 | |||
| 15 | int wbinvd_on_all_cpus(void) | ||
| 16 | { | ||
| 17 | return on_each_cpu(__wbinvd, NULL, 1); | ||
| 18 | } | ||
| 19 | EXPORT_SYMBOL(wbinvd_on_all_cpus); | ||
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 3999a5f25f38..8a713f1e9653 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
| 9 | #include <linux/pagemap.h> | 9 | #include <linux/pagemap.h> |
| 10 | #include <linux/agp_backend.h> | 10 | #include <linux/agp_backend.h> |
| 11 | #include <asm/smp.h> | ||
| 11 | #include "agp.h" | 12 | #include "agp.h" |
| 12 | 13 | ||
| 13 | /* | 14 | /* |
| @@ -815,12 +816,6 @@ static void intel_i830_setup_flush(void) | |||
| 815 | intel_i830_fini_flush(); | 816 | intel_i830_fini_flush(); |
| 816 | } | 817 | } |
| 817 | 818 | ||
| 818 | static void | ||
| 819 | do_wbinvd(void *null) | ||
| 820 | { | ||
| 821 | wbinvd(); | ||
| 822 | } | ||
| 823 | |||
| 824 | /* The chipset_flush interface needs to get data that has already been | 819 | /* The chipset_flush interface needs to get data that has already been |
| 825 | * flushed out of the CPU all the way out to main memory, because the GPU | 820 | * flushed out of the CPU all the way out to main memory, because the GPU |
| 826 | * doesn't snoop those buffers. | 821 | * doesn't snoop those buffers. |
| @@ -837,12 +832,10 @@ static void intel_i830_chipset_flush(struct agp_bridge_data *bridge) | |||
| 837 | 832 | ||
| 838 | memset(pg, 0, 1024); | 833 | memset(pg, 0, 1024); |
| 839 | 834 | ||
| 840 | if (cpu_has_clflush) { | 835 | if (cpu_has_clflush) |
| 841 | clflush_cache_range(pg, 1024); | 836 | clflush_cache_range(pg, 1024); |
| 842 | } else { | 837 | else if (wbinvd_on_all_cpus() != 0) |
| 843 | if (on_each_cpu(do_wbinvd, NULL, 1) != 0) | 838 | printk(KERN_ERR "Timed out waiting for cache flush.\n"); |
| 844 | printk(KERN_ERR "Timed out waiting for cache flush.\n"); | ||
| 845 | } | ||
| 846 | } | 839 | } |
| 847 | 840 | ||
| 848 | /* The intel i830 automatically initializes the agp aperture during POST. | 841 | /* The intel i830 automatically initializes the agp aperture during POST. |
