Skip to content

Commit 6fb8b5f

Browse files
muralimk-amdbp3tk0v
authored andcommitted
EDAC/amd64: Split init_csrows() into dct/umc functions
Call them from their respective setup_mci_misc_attrs() paths. Also, drop the check for an "empty" device, i.e. one without memory. This is redundant and already done in instance_has_memory() earlier in the init path. No functional change is intended. [ Yazen: rebased/reworked patch and reworded commit message. ] Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com> Co-developed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com> Signed-off-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com> Co-developed-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20230127170419.1824692-21-yazen.ghannam@amd.com
1 parent f6a4b4a commit 6fb8b5f

1 file changed

Lines changed: 7 additions & 16 deletions

File tree

drivers/edac/amd64_edac.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3250,13 +3250,12 @@ static u32 umc_get_csrow_nr_pages(struct amd64_pvt *pvt, u8 dct, int csrow_nr_or
32503250
return nr_pages;
32513251
}
32523252

3253-
static int init_csrows_df(struct mem_ctl_info *mci)
3253+
static void umc_init_csrows(struct mem_ctl_info *mci)
32543254
{
32553255
struct amd64_pvt *pvt = mci->pvt_info;
32563256
enum edac_type edac_mode = EDAC_NONE;
32573257
enum dev_type dev_type = DEV_UNKNOWN;
32583258
struct dimm_info *dimm;
3259-
int empty = 1;
32603259
u8 umc, cs;
32613260

32623261
if (mci->edac_ctl_cap & EDAC_FLAG_S16ECD16ED) {
@@ -3277,7 +3276,6 @@ static int init_csrows_df(struct mem_ctl_info *mci)
32773276
if (!csrow_enabled(cs, umc, pvt))
32783277
continue;
32793278

3280-
empty = 0;
32813279
dimm = mci->csrows[cs]->channels[umc]->dimm;
32823280

32833281
edac_dbg(1, "MC node: %d, csrow: %d\n",
@@ -3290,27 +3288,22 @@ static int init_csrows_df(struct mem_ctl_info *mci)
32903288
dimm->grain = 64;
32913289
}
32923290
}
3293-
3294-
return empty;
32953291
}
32963292

32973293
/*
32983294
* Initialize the array of csrow attribute instances, based on the values
32993295
* from pci config hardware registers.
33003296
*/
3301-
static int init_csrows(struct mem_ctl_info *mci)
3297+
static void dct_init_csrows(struct mem_ctl_info *mci)
33023298
{
33033299
struct amd64_pvt *pvt = mci->pvt_info;
33043300
enum edac_type edac_mode = EDAC_NONE;
33053301
struct csrow_info *csrow;
33063302
struct dimm_info *dimm;
3307-
int i, j, empty = 1;
33083303
int nr_pages = 0;
3304+
int i, j;
33093305
u32 val;
33103306

3311-
if (pvt->umc)
3312-
return init_csrows_df(mci);
3313-
33143307
amd64_read_pci_cfg(pvt->F3, NBCFG, &val);
33153308

33163309
pvt->nbcfg = val;
@@ -3333,7 +3326,6 @@ static int init_csrows(struct mem_ctl_info *mci)
33333326
continue;
33343327

33353328
csrow = mci->csrows[i];
3336-
empty = 0;
33373329

33383330
edac_dbg(1, "MC node: %d, csrow: %d\n",
33393331
pvt->mc_node_id, i);
@@ -3367,8 +3359,6 @@ static int init_csrows(struct mem_ctl_info *mci)
33673359
dimm->grain = 64;
33683360
}
33693361
}
3370-
3371-
return empty;
33723362
}
33733363

33743364
/* get all cores on this DCT */
@@ -3642,6 +3632,8 @@ static void dct_setup_mci_misc_attrs(struct mem_ctl_info *mci)
36423632
/* memory scrubber interface */
36433633
mci->set_sdram_scrub_rate = set_scrub_rate;
36443634
mci->get_sdram_scrub_rate = get_scrub_rate;
3635+
3636+
dct_init_csrows(mci);
36453637
}
36463638

36473639
static void umc_setup_mci_misc_attrs(struct mem_ctl_info *mci)
@@ -3658,6 +3650,8 @@ static void umc_setup_mci_misc_attrs(struct mem_ctl_info *mci)
36583650
mci->ctl_name = pvt->ctl_name;
36593651
mci->dev_name = pci_name(pvt->F3);
36603652
mci->ctl_page_to_phys = NULL;
3653+
3654+
umc_init_csrows(mci);
36613655
}
36623656

36633657
static int dct_hw_info_get(struct amd64_pvt *pvt)
@@ -3873,9 +3867,6 @@ static int init_one_instance(struct amd64_pvt *pvt)
38733867

38743868
pvt->ops->setup_mci_misc_attrs(mci);
38753869

3876-
if (init_csrows(mci))
3877-
mci->edac_cap = EDAC_FLAG_NONE;
3878-
38793870
ret = -ENODEV;
38803871
if (edac_mc_add_mc_with_groups(mci, amd64_edac_attr_groups)) {
38813872
edac_dbg(1, "failed edac_mc_add_mc()\n");

0 commit comments

Comments
 (0)