Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5030fcb

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-edac
Pull EDAC fixes from Mauro Carvalho Chehab: "Three edac fixes at the memory enumeration logic: - i3200_edac: Fixes a regression at the memory rank size, when the memorias are dual-rank; - i5000_edac: Fix a longstanding bug when calculating the memory size: before Kernel 3.6, the memory size were right only with one specific configuration; - sb_edac: Fixes a bug since the initial release of the driver: with 16GB DIMMs, there's an overflow at the memory size, causing the number of pages per dimm (an unsigned value) to have the highest bit equal to 1, effectively mangling the memory size. The third bug can potentially affect the error decoding logic as well." * git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-edac: sb_edac: Avoid overflow errors at memory size calculation i5000: Fix the memory size calculation with 2R memories i3200_edac: Fix memory rank size
2 parents fd51790 + deb09dd commit 5030fcb

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

drivers/edac/i3200_edac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ static int i3200_probe1(struct pci_dev *pdev, int dev_idx)
391391
for (j = 0; j < nr_channels; j++) {
392392
struct dimm_info *dimm = csrow->channels[j]->dimm;
393393

394-
dimm->nr_pages = nr_pages / nr_channels;
394+
dimm->nr_pages = nr_pages;
395395
dimm->grain = nr_pages << PAGE_SHIFT;
396396
dimm->mtype = MEM_DDR2;
397397
dimm->dtype = DEV_UNKNOWN;

drivers/edac/i5000_edac.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,10 @@ static void handle_channel(struct i5000_pvt *pvt, int slot, int channel,
10121012
/* add the number of COLUMN bits */
10131013
addrBits += MTR_DIMM_COLS_ADDR_BITS(mtr);
10141014

1015+
/* Dual-rank memories have twice the size */
1016+
if (dinfo->dual_rank)
1017+
addrBits++;
1018+
10151019
addrBits += 6; /* add 64 bits per DIMM */
10161020
addrBits -= 20; /* divide by 2^^20 */
10171021
addrBits -= 3; /* 8 bits per bytes */

drivers/edac/sb_edac.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,8 @@ static int get_dimm_config(struct mem_ctl_info *mci)
513513
{
514514
struct sbridge_pvt *pvt = mci->pvt_info;
515515
struct dimm_info *dimm;
516-
int i, j, banks, ranks, rows, cols, size, npages;
516+
unsigned i, j, banks, ranks, rows, cols, npages;
517+
u64 size;
517518
u32 reg;
518519
enum edac_type mode;
519520
enum mem_type mtype;
@@ -585,10 +586,10 @@ static int get_dimm_config(struct mem_ctl_info *mci)
585586
cols = numcol(mtr);
586587

587588
/* DDR3 has 8 I/O banks */
588-
size = (rows * cols * banks * ranks) >> (20 - 3);
589+
size = ((u64)rows * cols * banks * ranks) >> (20 - 3);
589590
npages = MiB_TO_PAGES(size);
590591

591-
edac_dbg(0, "mc#%d: channel %d, dimm %d, %d Mb (%d pages) bank: %d, rank: %d, row: %#x, col: %#x\n",
592+
edac_dbg(0, "mc#%d: channel %d, dimm %d, %Ld Mb (%d pages) bank: %d, rank: %d, row: %#x, col: %#x\n",
592593
pvt->sbridge_dev->mc, i, j,
593594
size, npages,
594595
banks, ranks, rows, cols);

0 commit comments

Comments
 (0)