amd64_edac: assign DRAM chip select base and mask in a family-specific way
Quoted 57 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
Subject: Re: [PATCH 09/21]amd64_edac: assign DRAM chip select base and mask in a family-specific way
To: "Borislav Petkov" <[email protected]>
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Date: Monday, May 4, 2009, 3:59 PM
Borislav Petkov escreveu:Quoted 1 line
+ for (cs = 0; cs <
CHIPSELECT_COUNT; cs++) {Quoted 1 line
+ reg =
K8_DCSB0+ (cs * 4);
Quoted 1 line
+ err =
pci_read_config_dword(pvt->dram_f2_ctl, reg,
Quoted 1 line
+
&pvt->dcsb0[cs]);Quoted 2 lines
+ if (err != 0)
+debugf0("%s() Reading K8_DCSB0[%d]
failed\n",Quoted 1 line
+
__func__, cs);Quoted 2 lines
+
+ debugf0("DCSB0[%d]=0x%08x reg: F2x%x\n",
Quoted 1 line
+
cs, pvt->dcsb0[cs], reg);
Quoted 1 line
Hmm... I suspect that there's a missing else before the
debugf0(). If you got an error while reading it, you shouldn't be showing the results.Quoted 2 lines
+
+ /* If DCT areNOT ganged, then read in DCT1's base */
Quoted 1 line
+ if
(boot_cpu_data.x86 >=
0x10&&
!dct_ganging_enabled(pvt)) {Quoted 1 line
+
reg =
F10_DCSB1+ (cs * 4);Quoted 1 line
+
err =
pci_read_config_dword(pvt->dram_f2_ctl, reg,Quoted 1 line
+
&pvt->dcsb1[cs]);Quoted 1 line
+
if (err != 0)
Quoted 1 line
+
debugf0("%s() Reading
F10_DCSB1[%d] failed\n",Quoted 1 line
+
__func__, cs);Quoted 1 line
+
debugf0(" DCSB1[%d]=0x%08x reg:
F2x%x\n",
Quoted 9 lines
Quoted 1 line
+
cs, pvt->dcsb1[cs],
reg);Quoted 1 line
The same issue here: if you got an error while reading it, you shouldn't be showing the results.
Cheers,
Mauro.
An 'else' could be inserted, but it is only under DEBUG state for development purposes.
BACKGROUND: The error checking of the pci config space read was added during the time when the kernel couldn't read the extended 4k config space via the AMD IOConfig port access function (12 bits of offset) not via MMCONFIG.
doug t
Em Tue, 5 May 2009 12:28:01 -0700 (PDT)
Doug Thompson <[email protected]> escreveu:
Quoted 63 lines
Quoted 60 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
Subject: Re: [PATCH 09/21]amd64_edac: assign DRAM chip select base and mask in a family-specific way
To: "Borislav Petkov" <[email protected]>
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Date: Monday, May 4, 2009, 3:59 PM
Borislav Petkov escreveu:Quoted 1 line
+ for (cs = 0; cs <
CHIPSELECT_COUNT; cs++) {Quoted 1 line
+ reg =
K8_DCSB0+ (cs * 4);
Quoted 1 line
+ err =
pci_read_config_dword(pvt->dram_f2_ctl, reg,
Quoted 1 line
+
&pvt->dcsb0[cs]);Quoted 2 lines
+ if (err != 0)
+debugf0("%s() Reading K8_DCSB0[%d]
failed\n",Quoted 1 line
+
__func__, cs);Quoted 2 lines
+
+ debugf0("DCSB0[%d]=0x%08x reg: F2x%x\n",
Quoted 1 line
+
cs, pvt->dcsb0[cs], reg);
Quoted 1 line
Hmm... I suspect that there's a missing else before the
debugf0(). If you got an error while reading it, you shouldn't be showing the results.Quoted 2 lines
+
+ /* If DCT areNOT ganged, then read in DCT1's base */
Quoted 1 line
+ if
(boot_cpu_data.x86 >=
0x10&&
!dct_ganging_enabled(pvt)) {Quoted 1 line
+
reg =
F10_DCSB1+ (cs * 4);Quoted 1 line
+
err =
pci_read_config_dword(pvt->dram_f2_ctl, reg,Quoted 1 line
+
&pvt->dcsb1[cs]);Quoted 1 line
+
if (err != 0)
Quoted 1 line
+
debugf0("%s() Reading
F10_DCSB1[%d] failed\n",Quoted 1 line
+
__func__, cs);Quoted 1 line
+
debugf0(" DCSB1[%d]=0x%08x reg:
F2x%x\n",Quoted 1 line
+
cs, pvt->dcsb1[cs],
reg);
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
The same issue here: if you got an error while reading it, you shouldn't be showing the results.
Cheers,
Mauro.An 'else' could be inserted, but it is only under DEBUG state for development purposes.
Yet, it seems worthy to have it.
Quoted 2 lines
BACKGROUND: The error checking of the pci config space read was added during the time when the kernel couldn't read the extended 4k config space via the AMD IOConfig port access function (12 bits of offset) not via MMCONFIG.
As this is unlikely to happen, I would also replace the:
if (err != 0)
by:
if (unlikely(err))
in order to optimize the tests a little bit, avoiding the risk of cache flushes due to the branches.
Cheers,
Mauro