From patchwork Mon Jun 24 15:09:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 167612 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4347918ilk; Mon, 24 Jun 2019 08:09:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWjMq8m6YvutGeO88zKQAYnYVb4Y6GZPnhGTM7ZGzPZIBgm4S4wpogUhj2YaF5KV2xZN+X X-Received: by 2002:a65:5c0a:: with SMTP id u10mr34233526pgr.412.1561388987060; Mon, 24 Jun 2019 08:09:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561388987; cv=none; d=google.com; s=arc-20160816; b=OKcFsMaGNOZf5uIWYk08rDVL3hPzNr4gmEyn2gp59utMVv79kuMzIiwOjp6f4OYsiX IYdWCgvBJyD8XvZEJncLZrwihTOMGHaXvyfNFSeLrlA3cnAderyIMIk1Xdz5q7htvVcO xyqeBNQHGOMiRgj1qsHXWYj0lUNXmF39/sOqidxj8R4yjp9AN6GG8k36CZZ9MceN7Vp+ xzt0vDNcBklvyN1jNq01Ku+3USIqTmpneLPbVle3nr6VJJPJqGldQ2elfAF9R/r2Xn/c gWRV+amR+Ch/KbZgDmkuM1QUF6WnzTp+Os8LrigohKiLrthrXeanApFQY05XO7LMA1aE rDnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=uM9KgsvD2e9WjIvDSEv9d7g7JoMCbdcjIlzib1u3/tg=; b=lFTA7UgDjVB8XuMPGx2FwfsKPd7R6uMkfzA011k8VDtbUdgC2M2Wl11jQo2wexNGA5 jl+Xs7e8MxfnCbuJcfiXnUlowAfDv6sGHdATcMqdNb8Q7RszkfH8xIeMMTZAZLFuh0Z0 rJ576noSoA4jP1g0y2HTgSEeUVJdP/lU7qZIS5oDkyYR9ryU+/fwrPbp9Mg3h8E8sAgf MMbuRh56Tf0eGn3hwa3hSrkEwAgnqA8MUudrOM49mxWf+B97ci1ub/+dT2rdojWx+iTR 5Mnotpkq3E6y5nBbo5/7VRvvOo+oql5yK2PwOMsKkfkyc8L5u3WdPQr+7bX/VnOQ2/kf s1NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=a6B7hSr9; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector2-marvell-onmicrosoft-com header.b=ZtDEvpKF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d21si10399469pgd.544.2019.06.24.08.09.46; Mon, 24 Jun 2019 08:09:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=a6B7hSr9; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector2-marvell-onmicrosoft-com header.b=ZtDEvpKF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730797AbfFXPJo (ORCPT + 30 others); Mon, 24 Jun 2019 11:09:44 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:36412 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730682AbfFXPJl (ORCPT ); Mon, 24 Jun 2019 11:09:41 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5OF8Eai025899; Mon, 24 Jun 2019 08:09:35 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=uM9KgsvD2e9WjIvDSEv9d7g7JoMCbdcjIlzib1u3/tg=; b=a6B7hSr9kwxH2RaO4IifGadswW8IF9+5p0m2R9llDJeWCWY4JJ3yHuOmjAZJRz0sNUsE nN4r+DMf4BAWq8J4UQ8MLzKu1I1DoJyHaVR211Z7Ch54A2QScAjywF7OfMbrMHmjtSGz I+d8WKB91tvvM57gg8fhXY2wJMHeRlqCd8uQ3coECTySF9eTEFnijv4MEUcZY5/TyYje 58wmwqOHSLDv0kM/HHxexMuKn/QHof8jId2QAes4CZBg8N3h9jc0lNJn233B9RFQlmAn aIrrdhQaxBTTg2GXp9hLyuHdvqY9arNq6j/2vAl3dT21VBzlEzak0RHFjFukz9TEkB4Q eA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2t9kujf7tw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2019 08:09:34 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 24 Jun 2019 08:09:33 -0700 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (104.47.42.59) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Mon, 24 Jun 2019 08:09:32 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uM9KgsvD2e9WjIvDSEv9d7g7JoMCbdcjIlzib1u3/tg=; b=ZtDEvpKF5ycbnE3xJg3qOT5YmypfRrD78JlrTMPMx+xQk8YKglkvZOqhx79Whp3nKzDc0wWpJ7lkLZlhtZ/gAg8Xlx4z/aG6vFSqT/3r0E8ZKsmRPhz0Izht9UfdI5uP0/DkJTDby/8kACZHIt8xrAuN8PwLswX6FIK0RLyVFrc= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.238.217) by MN2PR18MB3197.namprd18.prod.outlook.com (10.255.236.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.13; Mon, 24 Jun 2019 15:09:32 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::d3:794c:1b94:cf3]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::d3:794c:1b94:cf3%4]) with mapi id 15.20.2008.014; Mon, 24 Jun 2019 15:09:32 +0000 From: Robert Richter To: Borislav Petkov , James Morse , "Mauro Carvalho Chehab" CC: "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Robert Richter Subject: [PATCH v2 18/24] EDAC, ghes: Fill sysfs with the DMI DIMM label information Thread-Topic: [PATCH v2 18/24] EDAC, ghes: Fill sysfs with the DMI DIMM label information Thread-Index: AQHVKp7TlohNjeevI0uW0dYjj5ZrXQ== Date: Mon, 24 Jun 2019 15:09:31 +0000 Message-ID: <20190624150758.6695-19-rrichter@marvell.com> References: <20190624150758.6695-1-rrichter@marvell.com> In-Reply-To: <20190624150758.6695-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1P190CA0035.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:52::24) To MN2PR18MB3408.namprd18.prod.outlook.com (2603:10b6:208:16c::25) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [92.254.182.202] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 70fd5ff4-65f3-4488-93d6-08d6f8b5f5b1 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:MN2PR18MB3197; x-ms-traffictypediagnostic: MN2PR18MB3197: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:669; x-forefront-prvs: 007814487B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(39860400002)(366004)(136003)(396003)(346002)(376002)(199004)(189003)(36756003)(110136005)(107886003)(54906003)(81156014)(81166006)(68736007)(8676002)(25786009)(5660300002)(8936002)(305945005)(7736002)(4326008)(1076003)(186003)(6116002)(14454004)(476003)(486006)(2616005)(11346002)(256004)(446003)(3846002)(50226002)(26005)(2906002)(52116002)(76176011)(71200400001)(71190400001)(99286004)(386003)(6506007)(102836004)(478600001)(316002)(86362001)(6512007)(66066001)(53936002)(6486002)(73956011)(66946007)(66476007)(66556008)(64756008)(66446008)(6436002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB3197; H:MN2PR18MB3408.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: GLgd4KeZOz4EJsKY8Wtg8ExkWyqQIeNFvBPb9BreJgIu5tzRCs5o5NL34Pn1/3LAy8EzNTM193EGeH/aXOXwDH39f9UGMKbZ1dz60QCc9q8wPmnlzvTIX3KfXgZtR1q6kWZiEF3x74xoW3ziEO+b8+IMRL2dleUIOzw8qn+1d8aiXWqSFPUKFnN4ozN7K9fBsnlLGf2qaicVK8cGPiitH7o0LDKrpxlyJQHBVj2Z9EAvb3QvoMC9nT9uinTN0jXF++PFi7IJ7I6ofMuuzurYZBU1jPEHoA5j6FeeBd2IutmGerX7ePIBlzxPOdgXBNpfe1h1ERJvISuSadd03uaOEd0R7YvIrYYn3pN2VwkBpicyFjTgoc1UZLjvOZfXAzrzo1deD07kVXB9XAj+q22Q5UGOkFrbjzSyZkpMgn4pFFc= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 70fd5ff4-65f3-4488-93d6-08d6f8b5f5b1 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jun 2019 15:09:31.9725 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: rrichter@marvell.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3197 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-24_10:, , signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch extracts the DIMM label from the DMI table and puts this information into sysfs. E.g. on a ThunderX2 system we found this now: # grep . /sys/devices/system/edac/mc/mc*/dimm*/dimm_label /sys/devices/system/edac/mc/mc0/dimm0/dimm_label:N0 DIMM_A0 /sys/devices/system/edac/mc/mc0/dimm1/dimm_label:N0 DIMM_B0 /sys/devices/system/edac/mc/mc0/dimm2/dimm_label:N0 DIMM_C0 /sys/devices/system/edac/mc/mc0/dimm3/dimm_label:N0 DIMM_D0 /sys/devices/system/edac/mc/mc0/dimm4/dimm_label:N0 DIMM_E0 /sys/devices/system/edac/mc/mc0/dimm5/dimm_label:N0 DIMM_F0 /sys/devices/system/edac/mc/mc0/dimm6/dimm_label:N0 DIMM_G0 /sys/devices/system/edac/mc/mc0/dimm7/dimm_label:N0 DIMM_H0 /sys/devices/system/edac/mc/mc1/dimm0/dimm_label:N1 DIMM_I0 /sys/devices/system/edac/mc/mc1/dimm1/dimm_label:N1 DIMM_J0 /sys/devices/system/edac/mc/mc1/dimm2/dimm_label:N1 DIMM_K0 /sys/devices/system/edac/mc/mc1/dimm3/dimm_label:N1 DIMM_L0 /sys/devices/system/edac/mc/mc1/dimm4/dimm_label:N1 DIMM_M0 /sys/devices/system/edac/mc/mc1/dimm5/dimm_label:N1 DIMM_N0 /sys/devices/system/edac/mc/mc1/dimm6/dimm_label:N1 DIMM_O0 /sys/devices/system/edac/mc/mc1/dimm7/dimm_label:N1 DIMM_P0 Signed-off-by: Robert Richter --- drivers/edac/ghes_edac.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index 63de11654649..9c3495f7365b 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -265,10 +265,6 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) dimm->dtype = DEV_UNKNOWN; dimm->grain = 128; /* Likely, worse case */ - /* - * FIXME: It shouldn't be hard to also fill the DIMM labels - */ - if (dimm->nr_pages) { edac_dbg(1, "DIMM%i: %s size = %d MB%s\n", mi->idx, edac_mem_types[dimm->mtype], @@ -302,6 +298,7 @@ static int mem_info_setup(void) { struct ghes_dimm_info *dimm; bool enable_numa = true; + const char *bank, *device; int num = 0; int idx = 0; int ret; @@ -317,13 +314,27 @@ static int mem_info_setup(void) dmi_walk(ghes_edac_set_nid, NULL); for_each_dimm(dimm) { + bank = device = NULL; + dmi_memdev_name(dimm->dimm_info.smbios_handle, + &bank, &device); + if (bank && device) { + snprintf(dimm->dimm_info.label, + sizeof(dimm->dimm_info.label), + "%s %s", bank, device); + } else { + *dimm->dimm_info.label = '\0'; + } + if (dimm->numa_node == NUMA_NO_NODE) enable_numa = false; else mem_info.dimms_per_node[dimm->numa_node]++; - edac_dbg(1, "DIMM%i: Found mem range [%pa-%pa] on node %d\n", - dimm->idx, &dimm->start, &dimm->end, dimm->numa_node); + edac_dbg(1, "DIMM%i: Found mem range [%pa-%pa] on node %d, handle: 0x%.4x%s%s\n", + dimm->idx, &dimm->start, &dimm->end, dimm->numa_node, + dimm->dimm_info.smbios_handle, + *dimm->dimm_info.label ? ", label: " : "", + dimm->dimm_info.label); } if (enable_numa) @@ -381,6 +392,9 @@ static void mem_info_prepare_mci(struct mem_ctl_info *mci) mci_dimm->dtype = dmi_dimm->dtype; mci_dimm->grain = dmi_dimm->grain; mci_dimm->smbios_handle = dmi_dimm->smbios_handle; + + if (*dmi_dimm->label) + strcpy(mci_dimm->label, dmi_dimm->label); } if (index != mci->tot_dimms)