x86/cpu changes for v2.6.35
Subsystems (5)
Linus,
Please pull the latest x86-cleanups-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-cleanups-for-linus
Thanks,
Ingo
------------------>
Jan Beulich (2):
x86-64: Don't export init_level4_pgt
x86: Clean up arch/x86/Kconfig*arch/x86/Kconfig | 49 +++++++++++-------------------------- arch/x86/Kconfig.debug | 2 - arch/x86/include/asm/boot.h | 2 +- arch/x86/kernel/x8664_ksyms_64.c | 1 - 4 files changed, 16 insertions(+), 38 deletions(-)
arch/x86/Kconfig +15 -34
@@ -197,20 +197,17 @@ config HAVE_INTEL_TXT # Use the generic interrupt handling code in kernel/irq/: config GENERIC_HARDIRQS - bool - default y + def_bool y config GENERIC_HARDIRQS_NO__DO_IRQ def_bool y config GENERIC_IRQ_PROBE - bool - default y + def_bool y config GENERIC_PENDING_IRQ - bool + def_bool y depends on GENERIC_HARDIRQS && SMP - default y config USE_GENERIC_SMP_HELPERS def_bool y
@@ -225,14 +222,12 @@ config X86_64_SMP depends on X86_64 && SMP config X86_HT - bool + def_bool y depends on SMP - default y config X86_TRAMPOLINE - bool + def_bool y depends on SMP || (64BIT && ACPI_SLEEP) - default y config X86_32_LAZY_GS def_bool y
@@ -447,7 +442,7 @@ config X86_NUMAQ firmware with - send email to <[email protected]>. config X86_SUPPORTS_MEMORY_FAILURE - bool + def_bool y # MCE code calls memory_failure(): depends on X86_MCE # On 32-bit this adds too big of NODES_SHIFT and we run out of page flags:
@@ -455,7 +450,6 @@ config X86_SUPPORTS_MEMORY_FAILURE # On 32-bit SPARSEMEM adds too big of SECTIONS_WIDTH: depends on X86_64 || !SPARSEMEM select ARCH_SUPPORTS_MEMORY_FAILURE - default y config X86_VISWS bool "SGI 320/540 (Visual Workstation)"
@@ -570,7 +564,6 @@ config PARAVIRT_SPINLOCKS config PARAVIRT_CLOCK bool - default n endif
@@ -749,7 +742,6 @@ config MAXSMP bool "Configure Maximum number of SMP Processors and NUMA Nodes" depends on X86_64 && SMP && DEBUG_KERNEL && EXPERIMENTAL select CPUMASK_OFFSTACK - default n ---help--- Configure maximum number of CPUS and NUMA Nodes for this architecture. If unsure, say N.
@@ -829,7 +821,6 @@ config X86_VISWS_APIC config X86_REROUTE_FOR_BROKEN_BOOT_IRQS bool "Reroute for broken boot IRQs" - default n depends on X86_IO_APIC ---help--- This option enables a workaround that fixes a source of
@@ -876,9 +867,8 @@ config X86_MCE_AMD the DRAM Error Threshold. config X86_ANCIENT_MCE - def_bool n + bool "Support for old Pentium 5 / WinChip machine checks" depends on X86_32 && X86_MCE - prompt "Support for old Pentium 5 / WinChip machine checks" ---help--- Include support for machine check handling on old Pentium 5 or WinChip systems. These typically need to be enabled explicitely on the command
@@ -886,8 +876,7 @@ config X86_ANCIENT_MCE config X86_MCE_THRESHOLD depends on X86_MCE_AMD || X86_MCE_INTEL - bool - default y + def_bool y config X86_MCE_INJECT depends on X86_MCE
@@ -1026,8 +1015,8 @@ config X86_CPUID choice prompt "High Memory Support" - default HIGHMEM4G if !X86_NUMAQ default HIGHMEM64G if X86_NUMAQ + default HIGHMEM4G depends on X86_32 config NOHIGHMEM
@@ -1285,7 +1274,7 @@ source "mm/Kconfig" config HIGHPTE bool "Allocate 3rd-level pagetables from highmem" - depends on X86_32 && (HIGHMEM4G || HIGHMEM64G) + depends on HIGHMEM ---help--- The VM uses one page table entry for each page of physical memory. For systems with a lot of RAM, this can be wasteful of precious
@@ -1369,8 +1358,7 @@ config MATH_EMULATION kernel, it won't hurt. config MTRR - bool - default y + def_bool y prompt "MTRR (Memory Type Range Register) support" if EMBEDDED ---help--- On Intel P6 family processors (Pentium Pro, Pentium II and later)
@@ -1436,8 +1424,7 @@ config MTRR_SANITIZER_SPARE_REG_NR_DEFAULT mtrr_spare_reg_nr=N on the kernel command line. config X86_PAT - bool - default y + def_bool y prompt "x86 PAT support" if EMBEDDED depends on MTRR ---help---
@@ -1605,8 +1592,7 @@ config X86_NEED_RELOCS depends on X86_32 && RELOCATABLE config PHYSICAL_ALIGN - hex - prompt "Alignment value to which kernel should be aligned" if X86_32 + hex "Alignment value to which kernel should be aligned" if X86_32 default "0x1000000" range 0x2000 0x1000000 ---help---
@@ -1653,7 +1639,6 @@ config COMPAT_VDSO config CMDLINE_BOOL bool "Built-in kernel command line" - default n ---help--- Allow for specifying boot arguments to the kernel at build time. On some systems (e.g. embedded ones), it is
@@ -1687,7 +1672,6 @@ config CMDLINE config CMDLINE_OVERRIDE bool "Built-in command line overrides boot loader arguments" - default n depends on CMDLINE_BOOL ---help--- Set this option to 'Y' to have the kernel ignore the boot loader
@@ -1723,8 +1707,7 @@ source "drivers/acpi/Kconfig" source "drivers/sfi/Kconfig" config X86_APM_BOOT - bool - default y + def_bool y depends on APM || APM_MODULE menuconfig APM
@@ -1953,8 +1936,7 @@ config DMAR_DEFAULT_ON experimental. config DMAR_BROKEN_GFX_WA - def_bool n - prompt "Workaround broken graphics drivers (going away soon)" + bool "Workaround broken graphics drivers (going away soon)" depends on DMAR && BROKEN ---help--- Current Graphics drivers tend to use physical address
@@ -2052,7 +2034,6 @@ config SCx200HR_TIMER config OLPC bool "One Laptop Per Child support" select GPIOLIB - default n ---help--- Add support for detecting the unique features of the OLPC XO hardware.
arch/x86/Kconfig.debug +0 -2
@@ -45,7 +45,6 @@ config EARLY_PRINTK config EARLY_PRINTK_DBGP bool "Early printk via EHCI debug port" - default n depends on EARLY_PRINTK && PCI ---help--- Write kernel log output directly into the EHCI debug port.
@@ -76,7 +75,6 @@ config DEBUG_PER_CPU_MAPS bool "Debug access to per_cpu maps" depends on DEBUG_KERNEL depends on SMP - default n ---help--- Say Y to verify that the per_cpu map being accessed has been setup. Adds a fair amount of code to kernel memory
arch/x86/include/asm/boot.h +1 -1
@@ -24,7 +24,7 @@#define MIN_KERNEL_ALIGN (_AC(1, UL) << MIN_KERNEL_ALIGN_LG2)#if (CONFIG_PHYSICAL_ALIGN & (CONFIG_PHYSICAL_ALIGN -1 )) || \ - (CONFIG_PHYSICAL_ALIGN < (_AC (1 ,UL ) <<MIN_KERNEL_ALIGN_LG2 )) + (CONFIG_PHYSICAL_ALIGN <MIN_KERNEL_ALIGN )#error "Invalid value for CONFIG_PHYSICAL_ALIGN"#endif
arch/x86/kernel/x8664_ksyms_64.c +0 -1
@@ -54,7 +54,6 @@ EXPORT_SYMBOL(memcpy);EXPORT_SYMBOL (__memcpy);EXPORT_SYMBOL (empty_zero_page); -EXPORT_SYMBOL (init_level4_pgt);#ifndef CONFIG_PARAVIRT EXPORT_SYMBOL (native_load_gs_index);#endif
Quoted 3 lines · Ingo Molnar
Linus,
Please pull the latest x86-cleanups-for-linus git tree from:
Correction, the above URI is still the previous pull request - the one for x86-cleanups-for-linus is:
Please pull the latest x86-cpu-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-cpu-for-linus
out-of-topic modifications in x86-cpu-for-linus:
------------------------------------------------drivers/cpufreq/cpufreq.c # 6dad2a2: cpufreq: Unify sysfs attribute de
drivers/cpufreq/cpufreq_conservative.c# 6dad2a2: cpufreq: Unify sysfs attribute de drivers/cpufreq/cpufreq_ondemand.c # 6dad2a2: cpufreq: Unify sysfs attribute dedrivers/misc/vmware_balloon.c # a10a569: Modify the VMware balloon driverinclude/linux/cpufreq.h # 6dad2a2: cpufreq: Unify sysfs attribute de
Thanks,
Ingo
------------------>
Borislav Petkov (9):
x86, cpu: Add AMD core boosting feature flag to /proc/cpuinfo
powernow-k8: Add core performance boost support
x86: Unify APERF/MPERF support
cpufreq: Unify sysfs attribute definition macros x86, cacheinfo: Unify AMD L3 cache index disable checking x86, cacheinfo: Reorganize AMD L3 cache structure x86, cacheinfo: Make L3 cache info per node
x86, cacheinfo: Disable index in all four subcaches x86, k8: Fix build error when K8_NB is disabled
Frank Arnold (1):
x86, cacheinfo: Turn off L3 cache index disable feature in virtualized environments
Greg Kroah-Hartman (1):
x86, HyperV: fix up the license to mshyperv.c
H. Peter Anvin (5):
x86, cpu: Make APERF/MPERF a normal table-driven flag
x86: Clean up the hypervisor layer
x86, hypervisor: Export the x86_hyper* symbols Modify the VMware balloon driver for the new x86_hyper API x86, hypervisor: add missing <linux/module.h>
Ky Srinivasan (1):
x86: Detect running on a Microsoft HyperV system
Mark Langsdorf (2):
x86, cpufreq: Add APERF/MPERF support for AMD processors
powernow-k8: Fix frequency reporting
arch/x86/include/asm/cpufeature.h | 1 + arch/x86/include/asm/hyperv.h | 11 ++- arch/x86/include/asm/hypervisor.h | 27 ++++- arch/x86/include/asm/k8.h | 5 + arch/x86/include/asm/mshyperv.h | 14 ++ arch/x86/include/asm/processor.h | 4 - arch/x86/include/asm/vmware.h | 27 ---- arch/x86/kernel/cpu/Makefile | 2 +- arch/x86/kernel/cpu/addon_cpuid_features.c | 14 ++- arch/x86/kernel/cpu/cpufreq/Makefile | 4 +- arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 44 +------- arch/x86/kernel/cpu/cpufreq/mperf.c | 51 ++++++++ arch/x86/kernel/cpu/cpufreq/mperf.h | 9 ++ arch/x86/kernel/cpu/cpufreq/powernow-k8.c | 172 +++++++++++++++++++++++++-- arch/x86/kernel/cpu/cpufreq/powernow-k8.h | 2 - arch/x86/kernel/cpu/hypervisor.c | 52 ++++++--- arch/x86/kernel/cpu/intel.c | 6 - arch/x86/kernel/cpu/intel_cacheinfo.c | 181 ++++++++++++++++++++-------- arch/x86/kernel/cpu/mshyperv.c | 55 +++++++++ arch/x86/kernel/cpu/vmware.c | 38 ++++--- drivers/cpufreq/cpufreq.c | 40 ++---- drivers/cpufreq/cpufreq_conservative.c | 48 +++----- drivers/cpufreq/cpufreq_ondemand.c | 40 ++----- drivers/misc/vmware_balloon.c | 4 +- include/linux/cpufreq.h | 30 +++++ 25 files changed, 601 insertions(+), 280 deletions(-) create mode 100644 arch/x86/include/asm/mshyperv.h delete mode 100644 arch/x86/include/asm/vmware.h create mode 100644 arch/x86/kernel/cpu/cpufreq/mperf.c create mode 100644 arch/x86/kernel/cpu/cpufreq/mperf.h create mode 100644 arch/x86/kernel/cpu/mshyperv.c
arch/x86/include/asm/cpufeature.h +1 -0
@@ -161,6 +161,7 @@*/ #define X86_FEATURE_IDA (7*32+ 0)/* Intel Dynamic Acceleration */ #define X86_FEATURE_ARAT (7*32+ 1)/* Always Running APIC Timer */ +#define X86_FEATURE_CPB (7*32+ 2)/* AMD Core Performance Boost */ /* Virtualization flags: Linux defined */ #define X86_FEATURE_TPR_SHADOW (8*32+ 0)/* Intel TPR Shadow */
arch/x86/include/asm/hyperv.h +9 -2
@@ -1,5 +1,5 @@ -#ifndef _ASM_X86_KVM_HYPERV_H -#define _ASM_X86_KVM_HYPERV_H +#ifndef _ASM_X86_HYPERV_H +#define _ASM_X86_HYPERV_H#include <linux/types.h>
@@ -14,6 +14,10 @@#define HYPERV_CPUID_ENLIGHTMENT_INFO 0x40000004#define HYPERV_CPUID_IMPLEMENT_LIMITS 0x40000005 +#define HYPERV_HYPERVISOR_PRESENT_BIT 0x80000000 +#define HYPERV_CPUID_MIN 0x40000005 +#define HYPERV_CPUID_MAX 0x4000ffff +/* * Feature identification. EAX indicates which features are available * to the partition based upon the current partition privileges.
@@ -129,6 +133,9 @@/* MSR used to provide vcpu index */ #define HV_X64_MSR_VP_INDEX 0x40000002 +/* MSR used to read the per-partition time reference counter */ +#define HV_X64_MSR_TIME_REF_COUNT 0x40000020 +/* Define the virtual APIC registers */ #define HV_X64_MSR_EOI 0x40000070#define HV_X64_MSR_ICR 0x40000071
arch/x86/include/asm/hypervisor.h +25 -2
@@ -17,10 +17,33 @@* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ -#ifndef ASM_X86__HYPERVISOR_H -#define ASM_X86__HYPERVISOR_H +#ifndef _ASM_X86_HYPERVISOR_H +#define _ASM_X86_HYPERVISOR_Hextern void init_hypervisor (struct cpuinfo_x86 *c);extern void init_hypervisor_platform (void ); +/* +* x86 hypervisor information +*/ +struct hypervisor_x86 { +/* Hypervisor name */ +const char *name; + +/* Detection routine */ +bool (*detect)(void ); + +/* Adjust CPU feature bits (run once per CPU) */ +void (*set_cpu_features)(struct cpuinfo_x86 *); + +/* Platform setup (run once per boot) */ +void (*init_platform)(void ); +}; + +extern const struct hypervisor_x86 *x86_hyper; + +/* Recognized hypervisors */ +extern const struct hypervisor_x86 x86_hyper_vmware; +extern const struct hypervisor_x86 x86_hyper_ms_hyperv; +#endif
arch/x86/include/asm/k8.h +5 -0
@@ -16,11 +16,16 @@ extern int k8_numa_init(unsigned long start_pfn, unsigned long end_pfn);extern int k8_scan_nodes (void );#ifdef CONFIG_K8_NB +extern int num_k8_northbridges; +static inline struct pci_dev *node_to_k8_nb_misc (int node) {return (node < num_k8_northbridges) ? k8_northbridges[node] :NULL ; } +#else +#define num_k8_northbridges 0 +static inline struct pci_dev *node_to_k8_nb_misc (int node) {return NULL ;
arch/x86/include/asm/mshyperv.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef _ASM_X86_MSHYPER_H +#define _ASM_X86_MSHYPER_H + +#include <linux/types.h> +#include <asm/hyperv.h> + +struct ms_hyperv_info { +u32 features; +u32 hints; +}; + +extern struct ms_hyperv_info ms_hyperv; + +#endif
arch/x86/include/asm/processor.h +0 -4
@@ -113,7 +113,6 @@ struct cpuinfo_x86 {/* Index into per_cpu list: */ u16 cpu_index;#endif -unsigned int x86_hyper_vendor; } __attribute__((__aligned__(SMP_CACHE_BYTES)));#define X86_VENDOR_INTEL 0
@@ -127,9 +126,6 @@ struct cpuinfo_x86 {#define X86_VENDOR_UNKNOWN 0xff -#define X86_HYPER_VENDOR_NONE 0 -#define X86_HYPER_VENDOR_VMWARE 1 -/* * capabilities of CPUs */
arch/x86/include/asm/vmware.h deleted +0 -27
@@ -1,27 +0,0 @@ -/* -* Copyright (C) 2008, VMware, Inc. -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or -* NON INFRINGEMENT. See the GNU General Public License for more -* details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -* -*/ -#ifndef ASM_X86__VMWARE_H -#define ASM_X86__VMWARE_H - -extern void vmware_platform_setup (void ); -extern int vmware_platform (void ); -extern void vmware_set_feature_bits (struct cpuinfo_x86 *c); - -#endif
arch/x86/kernel/cpu/Makefile +1 -1
@@ -14,7 +14,7 @@ CFLAGS_common.o := $(nostackp) obj-y := intel_cacheinfo.o addon_cpuid_features.o obj-y += proc.o capflags.o powerflags.o common.o -obj-y += vmware.o hypervisor.o sched.o +obj-y += vmware.o hypervisor.o sched.o mshyperv.o obj-$(CONFIG_X86_32) += bugs.o cmpxchg.o obj-$(CONFIG_X86_64) += bugs_64.o
arch/x86/kernel/cpu/addon_cpuid_features.c +8 -6
@@ -30,12 +30,14 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)const struct cpuid_bit *cb;static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { - {X86_FEATURE_IDA ,CR_EAX ,1 ,0x00000006 }, - {X86_FEATURE_ARAT ,CR_EAX ,2 ,0x00000006 }, - {X86_FEATURE_NPT ,CR_EDX ,0 ,0x8000000a }, - {X86_FEATURE_LBRV ,CR_EDX ,1 ,0x8000000a }, - {X86_FEATURE_SVML ,CR_EDX ,2 ,0x8000000a }, - {X86_FEATURE_NRIPS ,CR_EDX ,3 ,0x8000000a }, + {X86_FEATURE_IDA ,CR_EAX ,1 ,0x00000006 }, + {X86_FEATURE_ARAT ,CR_EAX ,2 ,0x00000006 }, + {X86_FEATURE_APERFMPERF ,CR_ECX ,0 ,0x00000006 }, + {X86_FEATURE_CPB ,CR_EDX ,9 ,0x80000007 }, + {X86_FEATURE_NPT ,CR_EDX ,0 ,0x8000000a }, + {X86_FEATURE_LBRV ,CR_EDX ,1 ,0x8000000a }, + {X86_FEATURE_SVML ,CR_EDX ,2 ,0x8000000a }, + {X86_FEATURE_NRIPS ,CR_EDX ,3 ,0x8000000a }, {0 ,0 ,0 ,0 } };
arch/x86/kernel/cpu/cpufreq/Makefile +2 -2
@@ -2,8 +2,8 @@ # K8 systems. ACPI is preferred to all other hardware-specific drivers. # speedstep-* is preferred over p4-clockmod. -obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o -obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o +obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o mperf.o +obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o mperf.o obj-$(CONFIG_X86_PCC_CPUFREQ) += pcc-cpufreq.o obj-$(CONFIG_X86_POWERNOW_K6) += powernow-k6.o obj-$(CONFIG_X86_POWERNOW_K7) += powernow-k7.o
arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +2 -42
68 lines not on this page · raw message
arch/x86/kernel/cpu/cpufreq/mperf.c new file +51 -0
51 lines not on this page · raw message
arch/x86/kernel/cpu/cpufreq/mperf.h new file +9 -0
@@ -0,0 +1,9 @@ +/* +* (c) 2010 Advanced Micro Devices, Inc. +* Your use of this code is subject to the terms and conditions of the +* GNU general public license version 2. See "COPYING" or +* http://www.gnu.org/licenses/gpl.html +*/ + +unsigned int cpufreq_get_measured_perf (struct cpufreq_policy *policy, +unsigned int cpu);
arch/x86/kernel/cpu/cpufreq/powernow-k8.c +161 -11
237 lines not on this page · raw message
arch/x86/kernel/cpu/cpufreq/powernow-k8.h +0 -2
@@ -5,7 +5,6 @@* http://www.gnu.org/licenses/gpl.html */ -enum pstate {HW_PSTATE_INVALID =0xff ,HW_PSTATE_0 =0 ,
@@ -55,7 +54,6 @@ struct powernow_k8_data {struct cpumask *available_cores; }; -/* processor's cpuid instruction support */ #define CPUID_PROCESSOR_SIGNATURE 1/* function 1 */ #define CPUID_XFAM 0x0ff00000/* extended family */
arch/x86/kernel/cpu/hypervisor.c +35 -17
72 lines not on this page · raw message
arch/x86/kernel/cpu/intel.c +0 -6
@@ -373,12 +373,6 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)set_cpu_cap (c,X86_FEATURE_ARCH_PERFMON ); } -if (c->cpuid_level >6 ) { -unsigned ecx =cpuid_ecx (6 ); -if (ecx &0x01 ) -set_cpu_cap (c,X86_FEATURE_APERFMPERF ); - } -if (cpu_has_xmm2)set_cpu_cap (c,X86_FEATURE_LFENCE_RDTSC );if (cpu_has_ds) {
arch/x86/kernel/cpu/intel_cacheinfo.c +128 -53
283 lines not on this page · raw message
arch/x86/kernel/cpu/mshyperv.c new file +55 -0
55 lines not on this page · raw message
arch/x86/kernel/cpu/vmware.c +21 -17
@@ -24,8 +24,8 @@#include <linux/dmi.h> #include <linux/module.h> #include <asm/div64.h> -#include <asm/vmware.h> #include <asm/x86_init.h> +#include <asm/hypervisor.h> #define CPUID_VMWARE_INFO_LEAF 0x40000000#define VMWARE_HYPERVISOR_MAGIC 0x564D5868
@@ -65,7 +65,7 @@ static unsigned long vmware_get_tsc_khz(void)return tsc_hz; } -void __init vmware_platform_setup (void ) +static void __init vmware_platform_setup (void ) {uint32_t eax, ebx, ecx, edx;
@@ -83,26 +83,22 @@ void __init vmware_platform_setup(void)* serial key should be enough, as this will always have a VMware * specific string when running under VMware hypervisor. */ -int vmware_platform (void ) +static bool __init vmware_platform (void ) {if (cpu_has_hypervisor) { -unsigned int eax, ebx, ecx, edx; -char hyper_vendor_id[13 ]; - -cpuid (CPUID_VMWARE_INFO_LEAF , &eax, &ebx, &ecx, &edx); -memcpy (hyper_vendor_id +0 , &ebx,4 ); -memcpy (hyper_vendor_id +4 , &ecx,4 ); -memcpy (hyper_vendor_id +8 , &edx,4 ); - hyper_vendor_id[12 ] ='\0' ; -if (!strcmp (hyper_vendor_id,"VMwareVMware" )) -return 1 ; +unsigned int eax; +unsigned int hyper_vendor_id[3 ]; + +cpuid (CPUID_VMWARE_INFO_LEAF , &eax, &hyper_vendor_id[0 ], + &hyper_vendor_id[1 ], &hyper_vendor_id[2 ]); +if (!memcmp (hyper_vendor_id,"VMwareVMware" ,12 )) +return true; }else if (dmi_available &&dmi_name_in_serial ("VMware" ) &&__vmware_platform ()) -return 1 ; +return true; -return 0 ; +return false; } -EXPORT_SYMBOL (vmware_platform);/* * VMware hypervisor takes care of exporting a reliable TSC to the guest.
@@ -116,8 +112,16 @@ EXPORT_SYMBOL(vmware_platform);* so that the kernel could just trust the hypervisor with providing a * reliable virtual TSC that is suitable for timekeeping. */ -void __cpuinit vmware_set_feature_bits (struct cpuinfo_x86 *c) +static void __cpuinit vmware_set_cpu_features (struct cpuinfo_x86 *c) {set_cpu_cap (c,X86_FEATURE_CONSTANT_TSC );set_cpu_cap (c,X86_FEATURE_TSC_RELIABLE ); } + +const __refconst struct hypervisor_x86 x86_hyper_vmware = { + .name ="VMware" , + .detect = vmware_platform, + .set_cpu_features = vmware_set_cpu_features, + .init_platform = vmware_platform_setup, +}; +EXPORT_SYMBOL (x86_hyper_vmware);
drivers/cpufreq/cpufreq.c +14 -26
@@ -662,32 +662,20 @@ static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf)return sprintf (buf,"%u\n" , policy->cpuinfo.max_freq); } -#define define_one_ro (_name) \ -static struct freq_attr _name = \ -__ATTR(_name, 0444, show_##_name, NULL) - -#define define_one_ro0400 (_name) \ -static struct freq_attr _name = \ -__ATTR(_name, 0400, show_##_name, NULL) - -#define define_one_rw (_name) \ -static struct freq_attr _name = \ -__ATTR(_name, 0644, show_##_name, store_##_name) - -define_one_ro0400 (cpuinfo_cur_freq); -define_one_ro (cpuinfo_min_freq); -define_one_ro (cpuinfo_max_freq); -define_one_ro (cpuinfo_transition_latency); -define_one_ro (scaling_available_governors); -define_one_ro (scaling_driver); -define_one_ro (scaling_cur_freq); -define_one_ro (bios_limit); -define_one_ro (related_cpus); -define_one_ro (affected_cpus); -define_one_rw (scaling_min_freq); -define_one_rw (scaling_max_freq); -define_one_rw (scaling_governor); -define_one_rw (scaling_setspeed); +cpufreq_freq_attr_ro_perm (cpuinfo_cur_freq,0400 ); +cpufreq_freq_attr_ro (cpuinfo_min_freq); +cpufreq_freq_attr_ro (cpuinfo_max_freq); +cpufreq_freq_attr_ro (cpuinfo_transition_latency); +cpufreq_freq_attr_ro (scaling_available_governors); +cpufreq_freq_attr_ro (scaling_driver); +cpufreq_freq_attr_ro (scaling_cur_freq); +cpufreq_freq_attr_ro (bios_limit); +cpufreq_freq_attr_ro (related_cpus); +cpufreq_freq_attr_ro (affected_cpus); +cpufreq_freq_attr_rw (scaling_min_freq); +cpufreq_freq_attr_rw (scaling_max_freq); +cpufreq_freq_attr_rw (scaling_governor); +cpufreq_freq_attr_rw (scaling_setspeed);static struct attribute *default_attrs[] = { &cpuinfo_min_freq.attr,
drivers/cpufreq/cpufreq_conservative.c +16 -32
72 lines not on this page · raw message
drivers/cpufreq/cpufreq_ondemand.c +12 -28
@@ -234,12 +234,8 @@ static ssize_t show_sampling_rate_min(struct kobject *kobj,return sprintf (buf,"%u\n" , min_sampling_rate); } -#define define_one_ro (_name) \ -static struct global_attr _name = \ -__ATTR(_name, 0444, show_##_name, NULL) - -define_one_ro (sampling_rate_max); -define_one_ro (sampling_rate_min); +define_one_global_ro (sampling_rate_max); +define_one_global_ro (sampling_rate_min);/* cpufreq_ondemand Governor Tunables */ #define show_one (file_name, object) \
@@ -274,12 +270,8 @@ show_one_old(powersave_bias);show_one_old (sampling_rate_min);show_one_old (sampling_rate_max); -#define define_one_ro_old (object, _name) \ -static struct freq_attr object = \ -__ATTR(_name, 0444, show_##_name##_old, NULL) - -define_one_ro_old (sampling_rate_min_old, sampling_rate_min); -define_one_ro_old (sampling_rate_max_old, sampling_rate_max); +cpufreq_freq_attr_ro_old (sampling_rate_min); +cpufreq_freq_attr_ro_old (sampling_rate_max);/*** delete after deprecation time ***/
@@ -376,14 +368,10 @@ static ssize_t store_powersave_bias(struct kobject *a, struct attribute *b,return count; } -#define define_one_rw (_name) \ -static struct global_attr _name = \ -__ATTR(_name, 0644, show_##_name, store_##_name) - -define_one_rw (sampling_rate); -define_one_rw (up_threshold); -define_one_rw (ignore_nice_load); -define_one_rw (powersave_bias); +define_one_global_rw (sampling_rate); +define_one_global_rw (up_threshold); +define_one_global_rw (ignore_nice_load); +define_one_global_rw (powersave_bias);static struct attribute *dbs_attributes[] = { &sampling_rate_max.attr,
@@ -415,14 +403,10 @@ write_one_old(up_threshold);write_one_old (ignore_nice_load);write_one_old (powersave_bias); -#define define_one_rw_old (object, _name) \ -static struct freq_attr object = \ -__ATTR(_name, 0644, show_##_name##_old, store_##_name##_old) - -define_one_rw_old (sampling_rate_old, sampling_rate); -define_one_rw_old (up_threshold_old, up_threshold); -define_one_rw_old (ignore_nice_load_old, ignore_nice_load); -define_one_rw_old (powersave_bias_old, powersave_bias); +cpufreq_freq_attr_rw_old (sampling_rate); +cpufreq_freq_attr_rw_old (up_threshold); +cpufreq_freq_attr_rw_old (ignore_nice_load); +cpufreq_freq_attr_rw_old (powersave_bias);static struct attribute *dbs_attributes_old[] = { &sampling_rate_max_old.attr,
drivers/misc/vmware_balloon.c +2 -2
@@ -41,7 +41,7 @@#include <linux/workqueue.h> #include <linux/debugfs.h> #include <linux/seq_file.h> -#include <asm/vmware.h> +#include <asm/hypervisor.h> MODULE_AUTHOR ("VMware, Inc." );MODULE_DESCRIPTION ("VMware Memory Control (Balloon) Driver" );
@@ -767,7 +767,7 @@ static int __init vmballoon_init(void)* Check if we are running on VMware's hypervisor and bail out * if we are not. */ -if (!vmware_platform ()) +if (x86_hyper != &x86_hyper_vmware)return -ENODEV ; vmballoon_wq =create_freezeable_workqueue ("vmmemctl" );
include/linux/cpufreq.h +30 -0
@@ -278,6 +278,27 @@ struct freq_attr {ssize_t (*store)(struct cpufreq_policy *,const char *,size_t count); }; +#define cpufreq_freq_attr_ro (_name) \ +static struct freq_attr _name = \ +__ATTR(_name, 0444, show_##_name, NULL) + +#define cpufreq_freq_attr_ro_perm (_name, _perm) \ +static struct freq_attr _name = \ +__ATTR(_name, _perm, show_##_name, NULL) + +#define cpufreq_freq_attr_ro_old (_name) \ +static struct freq_attr _name##_old = \ +__ATTR(_name, 0444, show_##_name##_old, NULL) + +#define cpufreq_freq_attr_rw (_name) \ +static struct freq_attr _name = \ +__ATTR(_name, 0644, show_##_name, store_##_name) + +#define cpufreq_freq_attr_rw_old (_name) \ +static struct freq_attr _name##_old = \ +__ATTR(_name, 0644, show_##_name##_old, store_##_name##_old) + +struct global_attr {struct attribute attr; ssize_t (*show)(struct kobject *kobj,
@@ -286,6 +307,15 @@ struct global_attr { const char *c, size_t count); }; +#define define_one_global_ro (_name) \ +static struct global_attr _name = \ +__ATTR(_name, 0444, show_##_name, NULL) + +#define define_one_global_rw (_name) \ +static struct global_attr _name = \ +__ATTR(_name, 0644, show_##_name, store_##_name) + +/********************************************************************* * CPUFREQ 2.6. INTERFACE * *********************************************************************/
Borislav Petkov
maintainerFrom: Ingo Molnar <[email protected]>
Date: Tue, May 18, 2010 at 12:54:26AM +0200
Hi Ingo,
Quoted 1 line · Ingo Molnar
[..]
Quoted 1 line
x86, k8: Fix build error when
K8_NBis disabled
[..]
Quoted 1 line
x86, cacheinfo: Turn off L3 cache index disable feature in virtualized environments
[..]
Quoted 1 line
powernow-k8: Fix frequency reporting
those three are already in Linus' tree since they were urgent fixes and had to be sent ASAP. Now I don't know whether git will skip them when merging or will cause unneeded merge conflicts (a small superficial test I did here caused merge conflicts) ... anyways, just a heads-up.
Signature · 2 lines
Regards/Gruss,
Boris.Quoted 13 lines · Borislav Petkov
From: Ingo Molnar <[email protected]>
Date: Tue, May 18, 2010 at 12:54:26AM +0200Hi Ingo,
Quoted 1 line · Ingo Molnar
[..]
Quoted 1 line
x86, k8: Fix build error when
K8_NBis disabled[..]
Quoted 8 lines
Quoted 1 line
x86, cacheinfo: Turn off L3 cache index disable feature in virtualized environments
[..]
Quoted 1 line
powernow-k8: Fix frequency reporting
those three are already in Linus' tree since they were urgent fixes and had to be sent ASAP. [...]
Yeah, hpa mentioned it last week in his pull request that those fixes were picked out of the stream of pending development commits.
Quoted 4 lines
[...] Now I don't know whether git will skip them when merging or will cause unneeded merge conflicts (a small superficial test I did here caused merge conflicts) ... anyways, just a heads-up.
In this particular case there will be a conflict in arch/x86/kernel/cpu/intel_cacheinfo.c when Linus pulls, and the correct resolution is to pick the version from x86/cpu.
Thanks for mentioning this!
Ingo
Hello,
Quoted 93 lines · Ingo Molnar
Quoted 3 lines · Ingo Molnar
Linus,
Please pull the latest x86-cleanups-for-linus git tree from:
Correction, the above URI is still the previous pull request - the one for x86-cleanups-for-linus is:
Please pull the latest x86-cpu-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.gitx86-cpu-for-linusarch/x86/kernel/cpu/intel_cacheinfo.c +26
-18@@ -148,13 +148,19 @@ union _cpuid4_leaf_ecx { u32 full; }; +struct amd_l3_cache { + struct pci_dev *dev; + bool can_disable; + unsigned indices; + u8 subcaches[4]; +}; + struct _cpuid4_info { union _cpuid4_leaf_eax eax; union _cpuid4_leaf_ebx ebx; union _cpuid4_leaf_ecx ecx; unsigned long size; - bool can_disable; - unsigned int l3_indices; + struct amd_l3_cache *l3; DECLARE_BITMAP(shared_cpu_map, NR_CPUS); };@@ -164,8 +170,7 @@ struct _cpuid4_info_regs { union _cpuid4_leaf_ebx ebx; union _cpuid4_leaf_ecx ecx; unsigned long size; - bool can_disable; - unsigned int l3_indices; + struct amd_l3_cache *l3; }; unsigned short num_cache_leaves;@@ -302,87 +307,163 @@ struct _cache_attr { }; #ifdef CONFIG_CPU_SUP_AMD -static unsigned int __cpuinit amd_calc_l3_indices (void ) + +/* +* L3 cache descriptors +*/ +static struct amd_l3_cache **__cpuinitdata l3_caches; + +static void __cpuinit amd_calc_l3_indices (struct amd_l3_cache *l3) { - /* - * We're called over smp_call_function_single() and therefore - * are on the correct cpu. - */ - int cpu = smp_processor_id(); - int node = cpu_to_node(cpu); - struct pci_dev *dev = node_to_k8_nb_misc(node); unsigned int sc0, sc1, sc2, sc3; u32 val = 0; - pci_read_config_dword(dev, 0x1C4, &val); + pci_read_config_dword(l3->dev, 0x1C4, &val); /* calculate subcache sizes */ - sc0 = !(val & BIT(0)); - sc1 = !(val & BIT(4)); - sc2 = !(val & BIT(8)) + !(val & BIT(9)); - sc3 = !(val & BIT(12)) + !(val & BIT(13)); + l3->subcaches[0] = sc0 = !(val & BIT(0)); + l3->subcaches[1] = sc1 = !(val & BIT(4)); + l3->subcaches[2] = sc2 = !(val & BIT(8)) + !(val & BIT(9)); + l3->subcaches[3] = sc3 = !(val & BIT(12)) + !(val & BIT(13)); - return (max(max(max(sc0, sc1), sc2), sc3) << 10) - 1; + l3->indices = (max(max(max(sc0, sc1), sc2), sc3) << 10) - 1; +} + +static struct amd_l3_cache *__cpuinit amd_init_l3_cache (int node) +{
arch/x86/kernel/cpu/intel_cacheinfo.c struct _cache_attr { · line 343
Quoted 10 lines
arch/x86/kernel/cpu/intel_cacheinfo.c +10
-0+ struct amd_l3_cache *l3; + struct pci_dev *dev = node_to_k8_nb_misc(node); + + l3 = kzalloc(sizeof(struct amd_l3_cache), GFP_ATOMIC); + if (!l3) { + printk(KERN_WARNING "Error allocating L3 struct\n"); + return NULL; + } + + l3->dev = dev;
This is still Buggy. You are not checking whether dev is NULL or not. If dev is NULL you should return.
Thanks,
--
Jaswinder Singh.
Hello,
Quoted 90 lines · Jaswinder Singh Rajput
Hello,
Quoted 87 lines · Ingo Molnar
Quoted 3 lines · Ingo Molnar
Linus,
Please pull the latest x86-cleanups-for-linus git tree from:
Correction, the above URI is still the previous pull request - the one for x86-cleanups-for-linus is:
Please pull the latest x86-cpu-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.gitx86-cpu-for-linusarch/x86/kernel/cpu/intel_cacheinfo.c +21
-17@@ -148,13 +148,19 @@ union _cpuid4_leaf_ecx { u32 full; }; +struct amd_l3_cache { + struct pci_dev *dev; + bool can_disable; + unsigned indices; + u8 subcaches[4]; +}; + struct _cpuid4_info { union _cpuid4_leaf_eax eax; union _cpuid4_leaf_ebx ebx; union _cpuid4_leaf_ecx ecx; unsigned long size; - bool can_disable; - unsigned int l3_indices; + struct amd_l3_cache *l3; DECLARE_BITMAP(shared_cpu_map, NR_CPUS); };@@ -164,8 +170,7 @@ struct _cpuid4_info_regs { union _cpuid4_leaf_ebx ebx; union _cpuid4_leaf_ecx ecx; unsigned long size; - bool can_disable; - unsigned int l3_indices; + struct amd_l3_cache *l3; }; unsigned short num_cache_leaves;@@ -302,87 +307,163 @@ struct _cache_attr { }; #ifdef CONFIG_CPU_SUP_AMD -static unsigned int __cpuinit amd_calc_l3_indices (void ) + +/* +* L3 cache descriptors +*/ +static struct amd_l3_cache **__cpuinitdata l3_caches; + +static void __cpuinit amd_calc_l3_indices (struct amd_l3_cache *l3) { - /* - * We're called over smp_call_function_single() and therefore - * are on the correct cpu. - */ - int cpu = smp_processor_id(); - int node = cpu_to_node(cpu); - struct pci_dev *dev = node_to_k8_nb_misc(node); unsigned int sc0, sc1, sc2, sc3; u32 val = 0; - pci_read_config_dword(dev, 0x1C4, &val); + pci_read_config_dword(l3->dev, 0x1C4, &val); /* calculate subcache sizes */ - sc0 = !(val & BIT(0)); - sc1 = !(val & BIT(4)); - sc2 = !(val & BIT(8)) + !(val & BIT(9)); - sc3 = !(val & BIT(12)) + !(val & BIT(13)); + l3->subcaches[0] = sc0 = !(val & BIT(0)); + l3->subcaches[1] = sc1 = !(val & BIT(4)); + l3->subcaches[2] = sc2 = !(val & BIT(8)) + !(val & BIT(9)); + l3->subcaches[3] = sc3 = !(val & BIT(12)) + !(val & BIT(13));
Quoted 13 lines
arch/x86/kernel/cpu/intel_cacheinfo.c struct _cache_attr { · line 340
Quoted 13 lines
arch/x86/kernel/cpu/intel_cacheinfo.c +12
-1- return (max(max(max(sc0, sc1), sc2), sc3) << 10) - 1; + l3->indices = (max(max(max(sc0, sc1), sc2), sc3) << 10) - 1; +} + +static struct amd_l3_cache *__cpuinit amd_init_l3_cache (int node) +{ + struct amd_l3_cache *l3; + struct pci_dev *dev = node_to_k8_nb_misc(node); + + l3 = kzalloc(sizeof(struct amd_l3_cache), GFP_ATOMIC); + if (!l3) { + printk(KERN_WARNING "Error allocating L3 struct\n"); + return NULL;
'return NULL' is also wrong. It should be only return.
I have already send some test patch to fix these issues, it seems no one has time to review it.
Thanks,
--
Jaswinder Singh.
Quoted 11 lines
arch/x86/kernel/cpu/intel_cacheinfo.c struct _cache_attr { · line 343
Quoted 3 lines
arch/x86/kernel/cpu/intel_cacheinfo.c +3
-0+ } + + l3->dev = dev;This is still Buggy. You are not checking whether dev is NULL or not. If dev is NULL you should return.
Thanks,
--
Jaswinder Singh.