From: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
To: Borislav Petkov <bp@alien8.de>
Cc: <dougthompson@xmission.com>, <m.chehab@samsung.com>,
<linux-edac@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] edac, amd64_edac: Modify usage of amd64_read_dct_pci_cfg()
Date: Tue, 26 Aug 2014 12:35:57 -0500 [thread overview]
Message-ID: <53FCC57D.2030601@amd.com> (raw)
In-Reply-To: <20140825054339.GA13911@nazgul.tnic>
On 8/25/2014 12:43 AM, Borislav Petkov wrote:
> On Thu, Aug 21, 2014 at 05:19:46PM -0500, Aravind Gopalakrishnan wrote:
>> @@ -767,17 +750,25 @@ static void read_dct_base_mask(struct amd64_pvt *pvt)
>> int reg1 = DCSB1 + (cs * 4);
>> u32 *base0 = &pvt->csels[0].csbases[cs];
>> u32 *base1 = &pvt->csels[1].csbases[cs];
>> + u8 dct = 0;
>>
>> - if (!amd64_read_dct_pci_cfg(pvt, reg0, base0))
>> + if (!amd64_read_dct_pci_cfg(pvt, dct, reg0, base0))
>> edac_dbg(0, " DCSB0[%d]=0x%08x reg: F2x%x\n",
>> cs, *base0, reg0);
>>
>> - if (pvt->fam == 0xf || dct_ganging_enabled(pvt))
>> + if (pvt->fam == 0xf) {
>> continue;
>> -
>> - if (!amd64_read_dct_pci_cfg(pvt, reg1, base1))
>> - edac_dbg(0, " DCSB1[%d]=0x%08x reg: F2x%x\n",
>> - cs, *base1, reg1);
>> + } else if (pvt->fam == 0x10 && !dct_ganging_enabled(pvt)) {
>> + if (!amd64_read_pci_cfg(pvt->F2, reg1, base1))
>> + edac_dbg(0, " DCSB1[%d]=0x%08x reg: F2x%x\n",
>> + cs, *base1, reg1);
>> + } else {
>> + dct = ((pvt->fam == 0x15)
>> + && (pvt->model == 0x30)) ? 3 : 1;
>> + if (!amd64_read_dct_pci_cfg(pvt, dct, reg0, base1))
>> + edac_dbg(0, " DCSB1[%d]=0x%08x reg: F2x%x\n",
>> + cs, *base1, reg0);
>> + }
>> }
>>
>> for_each_chip_select_mask(cs, 0, pvt) {
>> @@ -785,17 +776,25 @@ static void read_dct_base_mask(struct amd64_pvt *pvt)
>> int reg1 = DCSM1 + (cs * 4);
>> u32 *mask0 = &pvt->csels[0].csmasks[cs];
>> u32 *mask1 = &pvt->csels[1].csmasks[cs];
>> + u8 dct = 0;
>>
>> - if (!amd64_read_dct_pci_cfg(pvt, reg0, mask0))
>> + if (!amd64_read_dct_pci_cfg(pvt, dct, reg0, mask0))
>> edac_dbg(0, " DCSM0[%d]=0x%08x reg: F2x%x\n",
>> cs, *mask0, reg0);
>>
>> - if (pvt->fam == 0xf || dct_ganging_enabled(pvt))
>> + if (pvt->fam == 0xf) {
>> continue;
>> -
>> - if (!amd64_read_dct_pci_cfg(pvt, reg1, mask1))
>> - edac_dbg(0, " DCSM1[%d]=0x%08x reg: F2x%x\n",
>> - cs, *mask1, reg1);
>> + } else if (pvt->fam == 0x10 && !dct_ganging_enabled(pvt)) {
>> + if (!amd64_read_pci_cfg(pvt->F2, reg1, mask1))
>> + edac_dbg(0, " DCSM1[%d]=0x%08x reg: F2x%x\n",
>> + cs, *mask1, reg1);
>> + } else {
>> + dct = ((pvt->fam == 0x15)
>> + && (pvt->model == 0x30)) ? 3 : 1;
>> + if (!amd64_read_dct_pci_cfg(pvt, dct, reg0, mask1))
>> + edac_dbg(0, " DCSM1[%d]=0x%08x reg: F2x%x\n",
>> + cs, *mask1, reg0);
>> + }
> This is almost unreadable now with all the family checks everywhere.
> You need to hide all that per-family logic into the function and have a
> single
>
> amd_read_pci_cfg_dct(pvt, dct, ...)
>
> which contains all that logic. Calling code doesn't need to care about
> details like on which family it is running, etc, etc.
>
Ok, I have addressed this issue and the use of 'boot_cpu_data' that you
mentioned on separate reply.
Sending it out as V2.
Thanks,
-Aravind.
prev parent reply other threads:[~2014-08-26 17:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-21 22:19 [PATCH] edac, amd64_edac: Modify usage of amd64_read_dct_pci_cfg() Aravind Gopalakrishnan
2014-08-25 5:43 ` Borislav Petkov
2014-08-25 7:49 ` Borislav Petkov
2014-08-26 17:35 ` Aravind Gopalakrishnan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53FCC57D.2030601@amd.com \
--to=aravind.gopalakrishnan@amd.com \
--cc=bp@alien8.de \
--cc=dougthompson@xmission.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.chehab@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox