Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 53890
b: refs/heads/master
c: 2b1f627
h: refs/heads/master
v: v3
  • Loading branch information
Bernhard Kaindl authored and Andi Kleen committed May 2, 2007
1 parent b5bce2f commit 24fd36a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2b3b4835c94226681c496de9446d456dcf42ed08
refs/heads/master: 2b1f6278d77c1f2f669346fc2bb48012b5e9495a
11 changes: 11 additions & 0 deletions trunk/arch/i386/kernel/cpu/mtrr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,17 @@ void mtrr_ap_init(void)
local_irq_restore(flags);
}

/**
* Save current fixed-range MTRR state of the BSP
*/
void mtrr_save_state(void)
{
if (smp_processor_id() == 0)
mtrr_save_fixed_ranges(NULL);
else
smp_call_function_single(0, mtrr_save_fixed_ranges, NULL, 1, 1);
}

static int __init mtrr_init_finialize(void)
{
if (!mtrr_if)
Expand Down
7 changes: 7 additions & 0 deletions trunk/arch/i386/kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include <mach_wakecpu.h>
#include <smpboot_hooks.h>
#include <asm/vmi.h>
#include <asm/mtrr.h>

/* Set if we find a B stepping CPU */
static int __devinitdata smp_b_stepping;
Expand Down Expand Up @@ -814,6 +815,12 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
unsigned long start_eip;
unsigned short nmi_high = 0, nmi_low = 0;

/*
* Save current MTRR state in case it was changed since early boot
* (e.g. by the ACPI SMI) to initialize new CPUs with MTRRs in sync:
*/
mtrr_save_state();

/*
* We can't use kernel_thread since we must avoid to
* reschedule the child.
Expand Down
6 changes: 6 additions & 0 deletions trunk/arch/x86_64/kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,12 @@ int __cpuinit __cpu_up(unsigned int cpu)
return -ENOSYS;
}

/*
* Save current MTRR state in case it was changed since early boot
* (e.g. by the ACPI SMI) to initialize new CPUs with MTRRs in sync:
*/
mtrr_save_state();

per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
/* Boot it! */
err = do_boot_cpu(cpu, apicid);
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/asm-i386/mtrr.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct mtrr_gentry
/* The following functions are for use by other drivers */
# ifdef CONFIG_MTRR
extern void mtrr_save_fixed_ranges(void *);
extern void mtrr_save_state(void);
extern int mtrr_add (unsigned long base, unsigned long size,
unsigned int type, char increment);
extern int mtrr_add_page (unsigned long base, unsigned long size,
Expand All @@ -81,6 +82,7 @@ extern void mtrr_ap_init(void);
extern void mtrr_bp_init(void);
# else
#define mtrr_save_fixed_ranges(arg) do {} while (0)
#define mtrr_save_state() do {} while (0)
static __inline__ int mtrr_add (unsigned long base, unsigned long size,
unsigned int type, char increment)
{
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/asm-x86_64/mtrr.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ struct mtrr_gentry32
extern void mtrr_ap_init(void);
extern void mtrr_bp_init(void);
extern void mtrr_save_fixed_ranges(void *);
extern void mtrr_save_state(void);
#else
#define mtrr_ap_init() do {} while (0)
#define mtrr_bp_init() do {} while (0)
#define mtrr_save_fixed_ranges(arg) do {} while (0)
#define mtrr_save_state() do {} while (0)
#endif

#endif /* __KERNEL__ */
Expand Down

0 comments on commit 24fd36a

Please sign in to comment.