Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1341152

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

From Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/4] x86/mce/AMD: Fix logic to obtain block address
Date 2016-02-24 00:00 +0100
Message-ID <r5u5Y-3KD-5@gated-at.bofh.it> (permalink)
References <r2VvH-530-5@gated-at.bofh.it> <r2VvI-530-25@gated-at.bofh.it> <r5kpY-5q1-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 2/23/16 6:39 AM, Borislav Petkov wrote:
> On Tue, Feb 16, 2016 at 03:45:09PM -0600, Aravind Gopalakrishnan wrote:
>>   
>>   /* 'SMCA': AMD64 Scalable MCA */
>> +#define MSR_AMD64_SMCA_MC0_MISC0	0xc0002003
>>   #define MSR_AMD64_SMCA_MC0_CONFIG	0xc0002004
>>   #define MSR_AMD64_SMCA_MC0_IPID		0xc0002005
>> +#define MSR_AMD64_SMCA_MC0_MISC1	0xc000200a
>> +#define MSR_AMD64_SMCA_MCx_MISC(x)	(MSR_AMD64_SMCA_MC0_MISC0 + 0x10*(x))
>>   #define MSR_AMD64_SMCA_MCx_CONFIG(x)	(MSR_AMD64_SMCA_MC0_CONFIG + 0x10*(x))
>>   #define MSR_AMD64_SMCA_MCx_IPID(x)	(MSR_AMD64_SMCA_MC0_IPID + 0x10*(x))
>> +#define MSR_AMD64_SMCA_MCx_MISCy(x, y)	((MSR_AMD64_SMCA_MC0_MISC1 + y) + (0x10*(x)))
> Are those MSRs going to be used in multiple files? If not, they should
> all go to mce.h.

I think MSR_AMD64_SMCA_MC0_MISC0 would be required in mce.c as well.
So might be better to retain it here.

MSR_AMD64_SMCA_MC0_MISC1 might be required only in mce_amd.c, So, I'll 
move it to mce.h

>
>>   
>>   
>> +static u32 get_block_address(u32 current_addr,
>> +			     u32 low,
>> +			     u32 high,
>> +			     unsigned int bank,
>> +			     unsigned int block)
> Use arg formatting like the rest of functions in the file please.

Will fix.

>> +			u32 smca_low, smca_high;
> s/smca_//

Will fix.

>
>> +
>> +			if (rdmsr_safe(MSR_AMD64_SMCA_MCx_CONFIG(bank),
>> +				       &smca_low, &smca_high) ||
>> +			    !(smca_low & MCI_CONFIG_MCAX))
>> +				goto nextaddr_out;
>> +
>> +			if (!rdmsr_safe(MSR_AMD64_SMCA_MCx_MISC(bank),
>> +					&smca_low, &smca_high) &&
>> +			    (smca_low & MASK_BLKPTR_LO))
>> +				addr = MSR_AMD64_SMCA_MCx_MISCy(bank,
>> +								block - 1);
> unnecessary line break.
>

Will fix it like so-
addr = MSR_AMD64_SMCA_MCx_MISCy(bank, block - 1);

(It comes up to 81 chars, but will ignore checkpatch in this case..)

Thanks,
-Aravind.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 2/4] x86/mce/AMD: Fix logic to obtain block address Borislav Petkov <bp@alien8.de> - 2016-02-23 13:40 +0100
  Re: [PATCH 2/4] x86/mce/AMD: Fix logic to obtain block address Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com> - 2016-02-24 00:00 +0100
    Re: [PATCH 2/4] x86/mce/AMD: Fix logic to obtain block address Borislav Petkov <bp@alien8.de> - 2016-02-24 12:40 +0100
      Re: [PATCH 2/4] x86/mce/AMD: Fix logic to obtain block address Boris Petkov <bp@alien8.de> - 2016-02-24 21:40 +0100

csiph-web