Skip to content

Commit a7f5aaf

Browse files
committed
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/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: fix build warnings in real mode code x86, calgary: fix section mismatch warning - get_tce_space_from_tar x86: silence section mismatch warning - get_local_pda x86, percpu: silence section mismatch warnings related to EARLY_PER_CPU variables x86: fix i486 suspend to disk CR4 oops x86: mpparse.c: fix section mismatch warning x86: mmconf: fix section mismatch warning x86: fix MP_processor_info section mismatch warning x86, tsc: fix section mismatch warning x86: correct register constraints for 64-bit atomic operations
2 parents bba5952 + 1b72691 commit a7f5aaf

File tree

14 files changed

+45
-31
lines changed

14 files changed

+45
-31
lines changed

arch/x86/boot/boot.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
/* Useful macros */
3131
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
3232

33+
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
34+
3335
extern struct setup_header hdr;
3436
extern struct boot_params boot_params;
3537

arch/x86/boot/memory.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
*/
1414

1515
#include "boot.h"
16-
#include <linux/kernel.h>
1716

1817
#define SMAP 0x534d4150 /* ASCII "SMAP" */
1918

arch/x86/kernel/acpi/sleep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ int acpi_save_state_mem(void)
8686
#endif /* !CONFIG_64BIT */
8787

8888
header->pmode_cr0 = read_cr0();
89-
header->pmode_cr4 = read_cr4();
89+
header->pmode_cr4 = read_cr4_safe();
9090
header->realmode_flags = acpi_realmode_flags;
9191
header->real_magic = 0x12345678;
9292

arch/x86/kernel/efi_32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void efi_call_phys_prelog(void)
5353
* directory. If I have PAE, I just need to duplicate one entry in
5454
* page directory.
5555
*/
56-
cr4 = read_cr4();
56+
cr4 = read_cr4_safe();
5757

5858
if (cr4 & X86_CR4_PAE) {
5959
efi_bak_pg_dir_pointer[0].pgd =
@@ -91,7 +91,7 @@ void efi_call_phys_epilog(void)
9191
gdt_descr.size = GDT_SIZE - 1;
9292
load_gdt(&gdt_descr);
9393

94-
cr4 = read_cr4();
94+
cr4 = read_cr4_safe();
9595

9696
if (cr4 & X86_CR4_PAE) {
9797
swapper_pg_dir[pgd_index(0)].pgd =

arch/x86/kernel/mmconf-fam10h_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ static struct dmi_system_id __devinitdata mmconf_dmi_table[] = {
238238
{}
239239
};
240240

241-
void __init check_enable_amd_mmconf_dmi(void)
241+
void __cpuinit check_enable_amd_mmconf_dmi(void)
242242
{
243243
dmi_check_system(mmconf_dmi_table);
244244
}

arch/x86/kernel/mpparse.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static int __init mpf_checksum(unsigned char *mp, int len)
4949
return sum & 0xFF;
5050
}
5151

52-
static void __cpuinit MP_processor_info(struct mpc_config_processor *m)
52+
static void __init MP_processor_info(struct mpc_config_processor *m)
5353
{
5454
int apicid;
5555
char *bootup_cpu = "";
@@ -484,7 +484,7 @@ static void __init construct_default_ioirq_mptable(int mpc_default_type)
484484
}
485485

486486

487-
static void construct_ioapic_table(int mpc_default_type)
487+
static void __init construct_ioapic_table(int mpc_default_type)
488488
{
489489
struct mpc_config_ioapic ioapic;
490490
struct mpc_config_bus bus;
@@ -529,7 +529,7 @@ static void construct_ioapic_table(int mpc_default_type)
529529
construct_default_ioirq_mptable(mpc_default_type);
530530
}
531531
#else
532-
static inline void construct_ioapic_table(int mpc_default_type) { }
532+
static inline void __init construct_ioapic_table(int mpc_default_type) { }
533533
#endif
534534

535535
static inline void __init construct_default_ISA_mptable(int mpc_default_type)

arch/x86/kernel/pci-calgary_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ static void calgary_init_bitmap_from_tce_table(struct iommu_table *tbl)
13501350
* Function for kdump case. Get the tce tables from first kernel
13511351
* by reading the contents of the base adress register of calgary iommu
13521352
*/
1353-
static void get_tce_space_from_tar(void)
1353+
static void __init get_tce_space_from_tar(void)
13541354
{
13551355
int bus;
13561356
void __iomem *target;

arch/x86/kernel/smpboot.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,14 @@ static void __cpuinit do_fork_idle(struct work_struct *work)
756756
}
757757

758758
#ifdef CONFIG_X86_64
759+
760+
/* __ref because it's safe to call free_bootmem when after_bootmem == 0. */
761+
static void __ref free_bootmem_pda(struct x8664_pda *oldpda)
762+
{
763+
if (!after_bootmem)
764+
free_bootmem((unsigned long)oldpda, sizeof(*oldpda));
765+
}
766+
759767
/*
760768
* Allocate node local memory for the AP pda.
761769
*
@@ -784,8 +792,7 @@ int __cpuinit get_local_pda(int cpu)
784792

785793
if (oldpda) {
786794
memcpy(newpda, oldpda, size);
787-
if (!after_bootmem)
788-
free_bootmem((unsigned long)oldpda, size);
795+
free_bootmem_pda(oldpda);
789796
}
790797

791798
newpda->in_bootmem = 0;

arch/x86/kernel/tsc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ __setup("notsc", notsc_setup);
104104
/*
105105
* Read TSC and the reference counters. Take care of SMI disturbance
106106
*/
107-
static u64 __init tsc_read_refs(u64 *pm, u64 *hpet)
107+
static u64 tsc_read_refs(u64 *pm, u64 *hpet)
108108
{
109109
u64 t1, t2;
110110
int i;

arch/x86/power/cpu_32.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static void __save_processor_state(struct saved_context *ctxt)
4545
ctxt->cr0 = read_cr0();
4646
ctxt->cr2 = read_cr2();
4747
ctxt->cr3 = read_cr3();
48-
ctxt->cr4 = read_cr4();
48+
ctxt->cr4 = read_cr4_safe();
4949
}
5050

5151
/* Needed by apm.c */
@@ -98,7 +98,9 @@ static void __restore_processor_state(struct saved_context *ctxt)
9898
/*
9999
* control registers
100100
*/
101-
write_cr4(ctxt->cr4);
101+
/* cr4 was introduced in the Pentium CPU */
102+
if (ctxt->cr4)
103+
write_cr4(ctxt->cr4);
102104
write_cr3(ctxt->cr3);
103105
write_cr2(ctxt->cr2);
104106
write_cr0(ctxt->cr0);

arch/x86/power/hibernate_asm_32.S

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ ENTRY(swsusp_arch_suspend)
2828
ret
2929

3030
ENTRY(restore_image)
31-
movl resume_pg_dir, %ecx
32-
subl $__PAGE_OFFSET, %ecx
33-
movl %ecx, %cr3
31+
movl resume_pg_dir, %eax
32+
subl $__PAGE_OFFSET, %eax
33+
movl %eax, %cr3
3434

3535
movl restore_pblist, %edx
3636
.p2align 4,,7
@@ -52,17 +52,21 @@ copy_loop:
5252

5353
done:
5454
/* go back to the original page tables */
55-
movl $swapper_pg_dir, %ecx
56-
subl $__PAGE_OFFSET, %ecx
57-
movl %ecx, %cr3
55+
movl $swapper_pg_dir, %eax
56+
subl $__PAGE_OFFSET, %eax
57+
movl %eax, %cr3
5858
/* Flush TLB, including "global" things (vmalloc) */
59-
movl mmu_cr4_features, %eax
60-
movl %eax, %edx
59+
movl mmu_cr4_features, %ecx
60+
jecxz 1f # cr4 Pentium and higher, skip if zero
61+
movl %ecx, %edx
6162
andl $~(1<<7), %edx; # PGE
6263
movl %edx, %cr4; # turn off PGE
63-
movl %cr3, %ecx; # flush TLB
64-
movl %ecx, %cr3
65-
movl %eax, %cr4; # turn PGE back on
64+
1:
65+
movl %cr3, %eax; # flush TLB
66+
movl %eax, %cr3
67+
jecxz 1f # cr4 Pentium and higher, skip if zero
68+
movl %ecx, %cr4; # turn PGE back on
69+
1:
6670

6771
movl saved_context_esp, %esp
6872
movl saved_context_ebp, %ebp

include/asm-x86/atomic_64.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static inline void atomic64_add(long i, atomic64_t *v)
228228
{
229229
asm volatile(LOCK_PREFIX "addq %1,%0"
230230
: "=m" (v->counter)
231-
: "ir" (i), "m" (v->counter));
231+
: "er" (i), "m" (v->counter));
232232
}
233233

234234
/**
@@ -242,7 +242,7 @@ static inline void atomic64_sub(long i, atomic64_t *v)
242242
{
243243
asm volatile(LOCK_PREFIX "subq %1,%0"
244244
: "=m" (v->counter)
245-
: "ir" (i), "m" (v->counter));
245+
: "er" (i), "m" (v->counter));
246246
}
247247

248248
/**
@@ -260,7 +260,7 @@ static inline int atomic64_sub_and_test(long i, atomic64_t *v)
260260

261261
asm volatile(LOCK_PREFIX "subq %2,%0; sete %1"
262262
: "=m" (v->counter), "=qm" (c)
263-
: "ir" (i), "m" (v->counter) : "memory");
263+
: "er" (i), "m" (v->counter) : "memory");
264264
return c;
265265
}
266266

@@ -341,7 +341,7 @@ static inline int atomic64_add_negative(long i, atomic64_t *v)
341341

342342
asm volatile(LOCK_PREFIX "addq %2,%0; sets %1"
343343
: "=m" (v->counter), "=qm" (c)
344-
: "ir" (i), "m" (v->counter) : "memory");
344+
: "er" (i), "m" (v->counter) : "memory");
345345
return c;
346346
}
347347

include/asm-x86/mmconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#ifdef CONFIG_PCI_MMCONFIG
55
extern void __cpuinit fam10h_check_enable_mmcfg(void);
6-
extern void __init check_enable_amd_mmconf_dmi(void);
6+
extern void __cpuinit check_enable_amd_mmconf_dmi(void);
77
#else
88
static inline void fam10h_check_enable_mmcfg(void) { }
99
static inline void check_enable_amd_mmconf_dmi(void) { }

include/asm-x86/percpu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ do { \
182182
DEFINE_PER_CPU(_type, _name) = _initvalue; \
183183
__typeof__(_type) _name##_early_map[NR_CPUS] __initdata = \
184184
{ [0 ... NR_CPUS-1] = _initvalue }; \
185-
__typeof__(_type) *_name##_early_ptr = _name##_early_map
185+
__typeof__(_type) *_name##_early_ptr __refdata = _name##_early_map
186186

187187
#define EXPORT_EARLY_PER_CPU_SYMBOL(_name) \
188188
EXPORT_PER_CPU_SYMBOL(_name)

0 commit comments

Comments
 (0)