aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/mcheck
diff options
context:
space:
mode:
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>2013-03-14 17:10:40 -0400
committerBorislav Petkov <bp@suse.de>2013-03-22 06:25:01 -0400
commitc76e81643c83a84d53a466de49baf38d5779c5ad (patch)
treecba2505aabc4dc5ba51d3d7a174e5e8629dd824d /arch/x86/kernel/cpu/mcheck
parenta937536b868b8369b98967929045f1df54234323 (diff)
x86, MCE, AMD: Replace shared_bank array with is_shared_bank() helper
Use helper function instead of an array to report whether register bank is shared. Currently only bank 4 (northbridge) is shared. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Link: http://lkml.kernel.org/r/1363295441-1859-2-git-send-email-boris.ostrovsky@oracle.com Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'arch/x86/kernel/cpu/mcheck')
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 1ac581f38dfa..e3d81a8d646b 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -58,11 +58,6 @@ static const char * const th_names[] = {
58}; 58};
59 59
60static DEFINE_PER_CPU(struct threshold_bank * [NR_BANKS], threshold_banks); 60static DEFINE_PER_CPU(struct threshold_bank * [NR_BANKS], threshold_banks);
61
62static unsigned char shared_bank[NR_BANKS] = {
63 0, 0, 0, 0, 1
64};
65
66static DEFINE_PER_CPU(unsigned char, bank_map); /* see which banks are on */ 61static DEFINE_PER_CPU(unsigned char, bank_map); /* see which banks are on */
67 62
68static void amd_threshold_interrupt(void); 63static void amd_threshold_interrupt(void);
@@ -79,6 +74,12 @@ struct thresh_restart {
79 u16 old_limit; 74 u16 old_limit;
80}; 75};
81 76
77static inline bool is_shared_bank(int bank)
78{
79 /* Bank 4 is for northbridge reporting and is thus shared */
80 return (bank == 4);
81}
82
82static const char * const bank4_names(struct threshold_block *b) 83static const char * const bank4_names(struct threshold_block *b)
83{ 84{
84 switch (b->address) { 85 switch (b->address) {
@@ -575,7 +576,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
575 const char *name = th_names[bank]; 576 const char *name = th_names[bank];
576 int err = 0; 577 int err = 0;
577 578
578 if (shared_bank[bank]) { 579 if (is_shared_bank(bank)) {
579 nb = node_to_amd_nb(amd_get_nb_id(cpu)); 580 nb = node_to_amd_nb(amd_get_nb_id(cpu));
580 581
581 /* threshold descriptor already initialized on this node? */ 582 /* threshold descriptor already initialized on this node? */
@@ -609,7 +610,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
609 610
610 per_cpu(threshold_banks, cpu)[bank] = b; 611 per_cpu(threshold_banks, cpu)[bank] = b;
611 612
612 if (shared_bank[bank]) { 613 if (is_shared_bank(bank)) {
613 atomic_set(&b->cpus, 1); 614 atomic_set(&b->cpus, 1);
614 615
615 /* nb is already initialized, see above */ 616 /* nb is already initialized, see above */
@@ -691,7 +692,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
691 if (!b->blocks) 692 if (!b->blocks)
692 goto free_out; 693 goto free_out;
693 694
694 if (shared_bank[bank]) { 695 if (is_shared_bank(bank)) {
695 if (!atomic_dec_and_test(&b->cpus)) { 696 if (!atomic_dec_and_test(&b->cpus)) {
696 __threshold_remove_blocks(b); 697 __threshold_remove_blocks(b);
697 per_cpu(threshold_banks, cpu)[bank] = NULL; 698 per_cpu(threshold_banks, cpu)[bank] = NULL;