Re: [PATCH 2/4] x86/mce/AMD: Fix logic to obtain block address

From: Aravind Gopalakrishnan
Date: Thu Feb 18 2016 - 10:38:43 EST


On 2/16/2016 3:45 PM, Aravind Gopalakrishnan wrote:
In upcoming processors, the BLKPTR field is no longer used
to indicate the MSR number of the additional register.
Insted, it simply indicates the prescence of additional MSRs.

Fixing the logic here to gather MSR address from
MSR_AMD64_SMCA_MCx_MISC() for newer processors
and we fall back to existing logic for older processors.

Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@xxxxxxx>
---

Caught couple of issues-


+ /* Fall back to method we used for older processors */
+ switch (block) {
+ case 0:
+ addr = MSR_IA32_MCx_MISC(bank);
+ break;
+ case 1:
+ offset = ((low & MASK_BLKPTR_LO) >> 21);
+ if (offset)
+ addr = MCG_XBLK_ADDR + offset;
+ break;
+ default:
+ addr = current_addr++;
+ }
+


This needs to be addr = ++current_addr;


+ address = get_block_address(address, high, low,
+ bank, block);

The 'high' and 'low' variables need to be swapped.
Missed this during a rebase to latest tip, Apologies..


+ address = get_block_address(address, high, low,
+ bank, block);

and here..

+ address = get_block_address(address, high, low, bank, ++block);
+

and here..

+ if (!address)
+ return 0;


Apologies, these didn't show up on initial testing locally..

Fixed these on local branch and it seems to work fine.
I'll send it out as a V2 (Shall wait for further comments/reviews before I do that).

Thanks,
-Aravind.