Commit 4b737d78 authored by Chen Yucong's avatar Chen Yucong Committed by Borislav Petkov

x86, MCE, AMD: Use macros to compute bank MSRs

Avoid open coded calculations for bank MSRs by hiding the index
of higher bank MSRs in well-defined macros.

No semantic changes.
Signed-off-by: default avatarChen Yucong <slaoub@gmail.com>
Link: http://lkml.kernel.org/r/1411438561-24319-1-git-send-email-slaoub@gmail.comSigned-off-by: default avatarBorislav Petkov <bp@suse.de>
parent 6dc52cbe
...@@ -217,7 +217,7 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c) ...@@ -217,7 +217,7 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
for (bank = 0; bank < mca_cfg.banks; ++bank) { for (bank = 0; bank < mca_cfg.banks; ++bank) {
for (block = 0; block < NR_BLOCKS; ++block) { for (block = 0; block < NR_BLOCKS; ++block) {
if (block == 0) if (block == 0)
address = MSR_IA32_MC0_MISC + bank * 4; address = MSR_IA32_MCx_MISC(bank);
else if (block == 1) { else if (block == 1) {
address = (low & MASK_BLKPTR_LO) >> 21; address = (low & MASK_BLKPTR_LO) >> 21;
if (!address) if (!address)
...@@ -281,7 +281,7 @@ static void amd_threshold_interrupt(void) ...@@ -281,7 +281,7 @@ static void amd_threshold_interrupt(void)
continue; continue;
for (block = 0; block < NR_BLOCKS; ++block) { for (block = 0; block < NR_BLOCKS; ++block) {
if (block == 0) { if (block == 0) {
address = MSR_IA32_MC0_MISC + bank * 4; address = MSR_IA32_MCx_MISC(bank);
} else if (block == 1) { } else if (block == 1) {
address = (low & MASK_BLKPTR_LO) >> 21; address = (low & MASK_BLKPTR_LO) >> 21;
if (!address) if (!address)
...@@ -314,8 +314,7 @@ static void amd_threshold_interrupt(void) ...@@ -314,8 +314,7 @@ static void amd_threshold_interrupt(void)
if (high & MASK_OVERFLOW_HI) { if (high & MASK_OVERFLOW_HI) {
rdmsrl(address, m.misc); rdmsrl(address, m.misc);
rdmsrl(MSR_IA32_MC0_STATUS + bank * 4, rdmsrl(MSR_IA32_MCx_STATUS(bank), m.status);
m.status);
m.bank = K8_MCE_THRESHOLD_BASE m.bank = K8_MCE_THRESHOLD_BASE
+ bank * NR_BLOCKS + bank * NR_BLOCKS
+ block; + block;
...@@ -617,8 +616,7 @@ static int threshold_create_bank(unsigned int cpu, unsigned int bank) ...@@ -617,8 +616,7 @@ static int threshold_create_bank(unsigned int cpu, unsigned int bank)
} }
} }
err = allocate_threshold_blocks(cpu, bank, 0, err = allocate_threshold_blocks(cpu, bank, 0, MSR_IA32_MCx_MISC(bank));
MSR_IA32_MC0_MISC + bank * 4);
if (!err) if (!err)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment