Skip to content

Commit

Permalink
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/li…
Browse files Browse the repository at this point in the history
…nux/kernel/git/tip/linux-2.6-tip

* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: Print the hypervisor returned tsc_khz during boot
  x86: Correct segment permission flags in 64-bit linker script
  x86: cpuinit-annotate SMP boot trampolines properly
  x86: Increase timeout for EHCI debug port reset completion in early printk
  x86: Fix uaccess_32.h typo
  x86: Trivial whitespace cleanups
  x86, apic: Fix missed handling of discrete apics
  x86/i386: Remove duplicated #include
  x86, mtrr: Convert loop to a while based construct, avoid naked semicolon
  Revert 'x86: Fix system crash when loading with "reservetop" parameter'
  x86, mce: Fix compile warning in case of CONFIG_SMP=n
  x86, apic: Use logical flat on intel with <= 8 logical cpus
  x86: SGI UV: Map MMIO-High memory range
  x86: SGI UV: Add volatile semantics to macros that access chipset registers
  x86: SGI UV: Fix IPI macros
  x86: apic: Convert BUG() to BUG_ON()
  x86: Remove final bits of CONFIG_X86_OLD_MCE
  • Loading branch information
torvalds committed Sep 21, 2009
2 parents 58e75a0 + 6399c08 commit b3727c2
Show file tree
Hide file tree
Showing 20 changed files with 98 additions and 79 deletions.
13 changes: 13 additions & 0 deletions arch/x86/include/asm/apic.h
Expand Up @@ -65,6 +65,19 @@ static inline void default_inquire_remote_apic(int apicid)
__inquire_remote_apic(apicid);
}

/*
* With 82489DX we can't rely on apic feature bit
* retrieved via cpuid but still have to deal with
* such an apic chip so we assume that SMP configuration
* is found from MP table (64bit case uses ACPI mostly
* which set smp presence flag as well so we are safe
* to use this helper too).
*/
static inline bool apic_from_smp_config(void)
{
return smp_found_config && !disable_apic;
}

/*
* Basic functions accessing APICs.
*/
Expand Down
1 change: 0 additions & 1 deletion arch/x86/include/asm/string_32.h
Expand Up @@ -65,7 +65,6 @@ static __always_inline void *__constant_memcpy(void *to, const void *from,
case 4:
*(int *)to = *(int *)from;
return to;

case 3:
*(short *)to = *(short *)from;
*((char *)to + 2) = *((char *)from + 2);
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/include/asm/uaccess_32.h
Expand Up @@ -33,7 +33,7 @@ unsigned long __must_check __copy_from_user_ll_nocache_nozero
* Copy data from kernel space to user space. Caller must check
* the specified block with access_ok() before calling this function.
* The caller should also make sure he pins the user space address
* so that the we don't result in page fault and sleep.
* so that we don't result in page fault and sleep.
*
* Here we special-case 1, 2 and 4-byte copy_*_user invocations. On a fault
* we return the initial request size (1, 2 or 4), as copy_*_user should do.
Expand Down
19 changes: 10 additions & 9 deletions arch/x86/include/asm/uv/uv_hub.h
Expand Up @@ -15,6 +15,7 @@
#include <linux/numa.h>
#include <linux/percpu.h>
#include <linux/timer.h>
#include <linux/io.h>
#include <asm/types.h>
#include <asm/percpu.h>
#include <asm/uv/uv_mmrs.h>
Expand Down Expand Up @@ -258,13 +259,13 @@ static inline unsigned long *uv_global_mmr32_address(int pnode,
static inline void uv_write_global_mmr32(int pnode, unsigned long offset,
unsigned long val)
{
*uv_global_mmr32_address(pnode, offset) = val;
writeq(val, uv_global_mmr32_address(pnode, offset));
}

static inline unsigned long uv_read_global_mmr32(int pnode,
unsigned long offset)
{
return *uv_global_mmr32_address(pnode, offset);
return readq(uv_global_mmr32_address(pnode, offset));
}

/*
Expand All @@ -281,13 +282,13 @@ static inline unsigned long *uv_global_mmr64_address(int pnode,
static inline void uv_write_global_mmr64(int pnode, unsigned long offset,
unsigned long val)
{
*uv_global_mmr64_address(pnode, offset) = val;
writeq(val, uv_global_mmr64_address(pnode, offset));
}

static inline unsigned long uv_read_global_mmr64(int pnode,
unsigned long offset)
{
return *uv_global_mmr64_address(pnode, offset);
return readq(uv_global_mmr64_address(pnode, offset));
}

/*
Expand All @@ -301,22 +302,22 @@ static inline unsigned long *uv_local_mmr_address(unsigned long offset)

static inline unsigned long uv_read_local_mmr(unsigned long offset)
{
return *uv_local_mmr_address(offset);
return readq(uv_local_mmr_address(offset));
}

static inline void uv_write_local_mmr(unsigned long offset, unsigned long val)
{
*uv_local_mmr_address(offset) = val;
writeq(val, uv_local_mmr_address(offset));
}

static inline unsigned char uv_read_local_mmr8(unsigned long offset)
{
return *((unsigned char *)uv_local_mmr_address(offset));
return readb(uv_local_mmr_address(offset));
}

static inline void uv_write_local_mmr8(unsigned long offset, unsigned char val)
{
*((unsigned char *)uv_local_mmr_address(offset)) = val;
writeb(val, uv_local_mmr_address(offset));
}

/*
Expand Down Expand Up @@ -422,7 +423,7 @@ static inline void uv_hub_send_ipi(int pnode, int apicid, int vector)
unsigned long val;

val = (1UL << UVH_IPI_INT_SEND_SHFT) |
((apicid & 0x3f) << UVH_IPI_INT_APIC_ID_SHFT) |
((apicid) << UVH_IPI_INT_APIC_ID_SHFT) |
(vector << UVH_IPI_INT_VECTOR_SHFT);
uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
}
Expand Down
31 changes: 10 additions & 21 deletions arch/x86/kernel/apic/apic.c
Expand Up @@ -62,7 +62,7 @@ unsigned int boot_cpu_physical_apicid = -1U;
/*
* The highest APIC ID seen during enumeration.
*
* This determines the messaging protocol we can use: if all APIC IDs
* On AMD, this determines the messaging protocol we can use: if all APIC IDs
* are in the 0 ... 7 range, then we can use logical addressing which
* has some performance advantages (better broadcasting).
*
Expand Down Expand Up @@ -979,7 +979,7 @@ void lapic_shutdown(void)
{
unsigned long flags;

if (!cpu_has_apic)
if (!cpu_has_apic && !apic_from_smp_config())
return;

local_irq_save(flags);
Expand Down Expand Up @@ -1197,8 +1197,7 @@ void __cpuinit setup_local_APIC(void)
* Double-check whether this APIC is really registered.
* This is meaningless in clustered apic mode, so we skip it.
*/
if (!apic->apic_id_registered())
BUG();
BUG_ON(!apic->apic_id_registered());

/*
* Intel recommends to set DFR, LDR and TPR before enabling
Expand Down Expand Up @@ -1917,24 +1916,14 @@ void __cpuinit generic_processor_info(int apicid, int version)
max_physical_apicid = apicid;

#ifdef CONFIG_X86_32
/*
* Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
* but we need to work other dependencies like SMP_SUSPEND etc
* before this can be done without some confusion.
* if (CPU_HOTPLUG_ENABLED || num_processors > 8)
* - Ashok Raj <ashok.raj@intel.com>
*/
if (max_physical_apicid >= 8) {
switch (boot_cpu_data.x86_vendor) {
case X86_VENDOR_INTEL:
if (!APIC_XAPIC(version)) {
def_to_bigsmp = 0;
break;
}
/* If P4 and above fall through */
case X86_VENDOR_AMD:
switch (boot_cpu_data.x86_vendor) {
case X86_VENDOR_INTEL:
if (num_processors > 8)
def_to_bigsmp = 1;
break;
case X86_VENDOR_AMD:
if (max_physical_apicid >= 8)
def_to_bigsmp = 1;
}
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions arch/x86/kernel/apic/io_apic.c
Expand Up @@ -1874,7 +1874,7 @@ __apicdebuginit(int) print_all_ICs(void)
print_PIC();

/* don't print out if apic is not there */
if (!cpu_has_apic || disable_apic)
if (!cpu_has_apic && !apic_from_smp_config())
return 0;

print_all_local_APICs();
Expand Down Expand Up @@ -1999,7 +1999,7 @@ void disable_IO_APIC(void)
/*
* Use virtual wire A mode when interrupt remapping is enabled.
*/
if (cpu_has_apic)
if (cpu_has_apic || apic_from_smp_config())
disconnect_bsp_APIC(!intr_remapping_enabled &&
ioapic_i8259.pin != -1);
}
Expand Down
15 changes: 11 additions & 4 deletions arch/x86/kernel/apic/probe_64.c
Expand Up @@ -64,16 +64,23 @@ void __init default_setup_apic_routing(void)
apic = &apic_x2apic_phys;
else
apic = &apic_x2apic_cluster;
printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
}
#endif

if (apic == &apic_flat) {
if (max_physical_apicid >= 8)
apic = &apic_physflat;
printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
switch (boot_cpu_data.x86_vendor) {
case X86_VENDOR_INTEL:
if (num_processors > 8)
apic = &apic_physflat;
break;
case X86_VENDOR_AMD:
if (max_physical_apicid >= 8)
apic = &apic_physflat;
}
}

printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);

if (is_vsmp_box()) {
/* need to update phys_pkg_id */
apic->phys_pkg_id = apicid_phys_pkg_id;
Expand Down
11 changes: 11 additions & 0 deletions arch/x86/kernel/apic/x2apic_uv_x.c
Expand Up @@ -389,6 +389,16 @@ static __init void map_gru_high(int max_pnode)
map_high("GRU", gru.s.base, shift, max_pnode, map_wb);
}

static __init void map_mmr_high(int max_pnode)
{
union uvh_rh_gam_mmr_overlay_config_mmr_u mmr;
int shift = UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR_BASE_SHFT;

mmr.v = uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR);
if (mmr.s.enable)
map_high("MMR", mmr.s.base, shift, max_pnode, map_uc);
}

static __init void map_mmioh_high(int max_pnode)
{
union uvh_rh_gam_mmioh_overlay_config_mmr_u mmioh;
Expand Down Expand Up @@ -643,6 +653,7 @@ void __init uv_system_init(void)
}

map_gru_high(max_pnode);
map_mmr_high(max_pnode);
map_mmioh_high(max_pnode);

uv_cpu_init();
Expand Down
3 changes: 2 additions & 1 deletion arch/x86/kernel/cpu/mcheck/mce_amd.c
Expand Up @@ -489,8 +489,9 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
int i, err = 0;
struct threshold_bank *b = NULL;
char name[32];
#ifdef CONFIG_SMP
struct cpuinfo_x86 *c = &cpu_data(cpu);

#endif

sprintf(name, "threshold_bank%i", bank);

Expand Down
12 changes: 6 additions & 6 deletions arch/x86/kernel/cpu/mtrr/if.c
Expand Up @@ -126,23 +126,23 @@ mtrr_write(struct file *file, const char __user *buf, size_t len, loff_t * ppos)
return -EINVAL;

base = simple_strtoull(line + 5, &ptr, 0);
for (; isspace(*ptr); ++ptr)
;
while (isspace(*ptr))
ptr++;

if (strncmp(ptr, "size=", 5))
return -EINVAL;

size = simple_strtoull(ptr + 5, &ptr, 0);
if ((base & 0xfff) || (size & 0xfff))
return -EINVAL;
for (; isspace(*ptr); ++ptr)
;
while (isspace(*ptr))
ptr++;

if (strncmp(ptr, "type=", 5))
return -EINVAL;
ptr += 5;
for (; isspace(*ptr); ++ptr)
;
while (isspace(*ptr))
ptr++;

for (i = 0; i < MTRR_NUM_TYPES; ++i) {
if (strcmp(ptr, mtrr_strings[i]))
Expand Down
6 changes: 6 additions & 0 deletions arch/x86/kernel/cpu/vmware.c
Expand Up @@ -58,6 +58,9 @@ static unsigned long vmware_get_tsc_khz(void)
tsc_hz = eax | (((uint64_t)ebx) << 32);
do_div(tsc_hz, 1000);
BUG_ON(tsc_hz >> 32);
printk(KERN_INFO "TSC freq read from hypervisor : %lu.%03lu MHz\n",
(unsigned long) tsc_hz / 1000,
(unsigned long) tsc_hz % 1000);
return tsc_hz;
}

Expand All @@ -69,6 +72,9 @@ void __init vmware_platform_setup(void)

if (ebx != UINT_MAX)
x86_platform.calibrate_tsc = vmware_get_tsc_khz;
else
printk(KERN_WARNING
"Failed to get TSC freq from the hypervisor\n");
}

/*
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/early_printk.c
Expand Up @@ -624,7 +624,7 @@ static int __init ehci_setup(void)
return -1;
}

loop = 10;
loop = 100000;
/* Reset the EHCI controller */
cmd = readl(&ehci_regs->command);
cmd |= CMD_RESET;
Expand Down
30 changes: 15 additions & 15 deletions arch/x86/kernel/setup.c
Expand Up @@ -697,21 +697,6 @@ void __init setup_arch(char **cmdline_p)
printk(KERN_INFO "Command line: %s\n", boot_command_line);
#endif

strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line;

#ifdef CONFIG_X86_64
/*
* Must call this twice: Once just to detect whether hardware doesn't
* support NX (so that the early EHCI debug console setup can safely
* call set_fixmap(), and then again after parsing early parameters to
* honor the respective command line option.
*/
check_efer();
#endif

parse_early_param();

/* VMI may relocate the fixmap; do this before touching ioremap area */
vmi_init();

Expand Down Expand Up @@ -794,6 +779,21 @@ void __init setup_arch(char **cmdline_p)
#endif
#endif

strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line;

#ifdef CONFIG_X86_64
/*
* Must call this twice: Once just to detect whether hardware doesn't
* support NX (so that the early EHCI debug console setup can safely
* call set_fixmap(), and then again after parsing early parameters to
* honor the respective command line option.
*/
check_efer();
#endif

parse_early_param();

#ifdef CONFIG_X86_64
check_efer();
#endif
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/kernel/trampoline.c
Expand Up @@ -4,7 +4,7 @@
#include <asm/e820.h>

/* ready for x86_64 and x86 */
unsigned char *trampoline_base = __va(TRAMPOLINE_BASE);
unsigned char *__cpuinitdata trampoline_base = __va(TRAMPOLINE_BASE);

void __init reserve_trampoline_memory(void)
{
Expand All @@ -26,7 +26,7 @@ void __init reserve_trampoline_memory(void)
* bootstrap into the page concerned. The caller
* has made sure it's suitably aligned.
*/
unsigned long setup_trampoline(void)
unsigned long __cpuinit setup_trampoline(void)
{
memcpy(trampoline_base, trampoline_data, TRAMPOLINE_SIZE);
return virt_to_phys(trampoline_base);
Expand Down
8 changes: 2 additions & 6 deletions arch/x86/kernel/trampoline_32.S
Expand Up @@ -28,16 +28,12 @@
*/

#include <linux/linkage.h>
#include <linux/init.h>
#include <asm/segment.h>
#include <asm/page_types.h>

/* We can free up trampoline after bootup if cpu hotplug is not supported. */
#ifndef CONFIG_HOTPLUG_CPU
.section ".cpuinit.data","aw",@progbits
#else
.section .rodata,"a",@progbits
#endif

__CPUINITRODATA
.code16

ENTRY(trampoline_data)
Expand Down

0 comments on commit b3727c2

Please sign in to comment.