From patchwork Wed May 29 08:44:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 165338 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp9580196ili; Wed, 29 May 2019 01:45:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4ms+718QWPat2QdIFppHszl3DUiYC4CAvJKbJOe+eES2PYxLUwkrTni33dBifQhbawyUN X-Received: by 2002:a17:90a:33c3:: with SMTP id n61mr10397977pjb.7.1559119499993; Wed, 29 May 2019 01:44:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559119499; cv=none; d=google.com; s=arc-20160816; b=AGXmEmdwk1ORPzSEtHPbzbM6fEe2gze4FlddPbfB+kJPqkNdKJFdS1IYc9GSqIva9k ZrVcDgkR7ZKntvuFGB+zHXcEBmWy7sHhpwxEyuGuL/OtBK3tJnYqlC+XDmlNwdKKNne2 iw6sxYge1XzQAVhQxqji+n7KDi20dIL6SNHoWbGqAzT/mjWCFBt4qdeC+2Ld5XJ6/76+ wKa/gxZFB2SXZtqAl+dOeiUv5ip2Z40i027l1jTV1XqdsIR0815Q/vPBHCJfzR+O3p0y belocMxHA7RqgBlSiAnZ8xFyWXO6VvOSWhE/5d6l7k04HoS1EZqA7TI9IavzFYLOfz6S juCg== 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=0uSevHM08KKRz2QHhXRbwahsPgL6zTaQutoBy4FaRGk=; b=yyf59Y49uoh2KGwPN6maCJOnm9kua2wbIdygt4LLUC+gvGFLgB8TW4L+Mcgw4rfOeY SbTf0dTkykz02WsmM/GosJqR1UtBV3YHAkw+u3aHISHVYxhpOSHD5UQnLIV+0kikvlwm e198/w5GbwfubdhDmOvyALfzD2chwtjLYQUmyYLFI3lNMKpO73hhZ10ZOG5ulrffZ2jp oXxxiCn9A8u/I6lQCiZ4tz8JDg/F+v6ZEHwUC4NCDwrI8qsUwTouACrsLosVIkmIpDme cnW4SS/6NiXFvV1GZsCKb1gj+pKlWXocqHxyd/udUfrwVZmb5GVEEHZVFymdWnmxR7Ax PnXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=t2RpN4Q4; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector2-marvell-onmicrosoft-com header.b=DUPPnmu8; 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 n7si24246780pgq.459.2019.05.29.01.44.59; Wed, 29 May 2019 01:44:59 -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=t2RpN4Q4; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector2-marvell-onmicrosoft-com header.b=DUPPnmu8; 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 S1726941AbfE2Io6 (ORCPT + 30 others); Wed, 29 May 2019 04:44:58 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:49680 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726909AbfE2Io4 (ORCPT ); Wed, 29 May 2019 04:44:56 -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 x4T8do5J017769; Wed, 29 May 2019 01:44:48 -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=0uSevHM08KKRz2QHhXRbwahsPgL6zTaQutoBy4FaRGk=; b=t2RpN4Q4u4Da7C1LZt6wq57U37rO8OplP04e2v8femVSajutG/mlEndrmkRT7ONrmHMo rBvzSnyJL1E8yz4QC1yNPZy/O8wke/C5iaL8c6FGDHjTKxE3qI2ZMuxIhU6wyJS7Do5X hf517c9/TuO3Hu90KBF286O52/6cR/xm9vC0byGCCvqStLfL0WGi4MUpQAtkNIxlX3pR esSAPmf/v0sKz40ZDlhWABv4BC8iTlJ0gD4ugZHm5THyWof5w8ss5bkTzsUE18RTyQi8 7974xFN72QhQWn9SajuORnPO9cx/kP+kdxXOYPZMgrGoBy6fRgSNQPCdRgqpg7xPPHMP hg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2sskp88p76-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 29 May 2019 01:44:48 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 29 May 2019 01:44:46 -0700 Received: from NAM03-CO1-obe.outbound.protection.outlook.com (104.47.40.50) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 29 May 2019 01:44:46 -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=0uSevHM08KKRz2QHhXRbwahsPgL6zTaQutoBy4FaRGk=; b=DUPPnmu8eVnkqclupFmEikig6iNpJbdruJUEb38x/yue1K9VPLVz38hrWIhF+bkJRwBqGjrUaNkGCto/xxfFb20SdHjdg6NpnpoUFckCjcsojSE7NA9NICaD8zwF/+qV+q0+XE05I4lLDGIq7jDxfjCLSbhFdtqvEAaOMuP74U0= Received: from MN2PR18MB3408.namprd18.prod.outlook.com (10.255.238.217) by MN2PR18MB3437.namprd18.prod.outlook.com (10.255.239.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1922.20; Wed, 29 May 2019 08:44:41 +0000 Received: from MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::7c9a:f3bf:fe2e:fe4a]) by MN2PR18MB3408.namprd18.prod.outlook.com ([fe80::7c9a:f3bf:fe2e:fe4a%4]) with mapi id 15.20.1922.021; Wed, 29 May 2019 08:44:41 +0000 From: Robert Richter To: Borislav Petkov , Tony Luck , "James Morse" , Mauro Carvalho Chehab CC: "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Robert Richter Subject: [PATCH 17/21] EDAC, ghes: Fill sysfs with the DMI DIMM label information Thread-Topic: [PATCH 17/21] EDAC, ghes: Fill sysfs with the DMI DIMM label information Thread-Index: AQHVFfrBkFN+vkv8Z0OsrMgAzX4Eeg== Date: Wed, 29 May 2019 08:44:41 +0000 Message-ID: <20190529084344.28562-18-rrichter@marvell.com> References: <20190529084344.28562-1-rrichter@marvell.com> In-Reply-To: <20190529084344.28562-1-rrichter@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6PR01CA0046.eurprd01.prod.exchangelabs.com (2603:10a6:20b:e0::23) 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: [78.54.13.57] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 48a9e888-9069-4936-2955-08d6e411e3da x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:MN2PR18MB3437; x-ms-traffictypediagnostic: MN2PR18MB3437: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:669; x-forefront-prvs: 0052308DC6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(396003)(376002)(39860400002)(136003)(189003)(199004)(8936002)(4326008)(53936002)(50226002)(110136005)(107886003)(68736007)(36756003)(5660300002)(54906003)(11346002)(26005)(186003)(52116002)(2906002)(2616005)(476003)(446003)(6506007)(14454004)(66476007)(25786009)(478600001)(386003)(86362001)(486006)(81166006)(81156014)(8676002)(305945005)(316002)(7736002)(256004)(99286004)(76176011)(6512007)(6436002)(73956011)(64756008)(66446008)(66556008)(66066001)(3846002)(66946007)(1076003)(6486002)(102836004)(71190400001)(71200400001)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB3437; H:MN2PR18MB3408.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: JmgWDWbuvM2khGszzYRFLSmj20Nza8DqHVJwxFNUxCa9y4pJxKU+h7ne+4ggNEGbK3Iu8pDNoLlcJVoDXnrvpM4ClT4Kk/gL954JkRzU4nkDpxTFGkFDg61hD7pKFRvY7kju80qc6AZg1yKNBqd/gD+Uv26TQPWX3Wsb9WkkZpbuP9sKVJYnNi+2IpjJ1Oh01eZRdQtepdFtktoh8Ffrm/1TcqY0bh3IiZFAkN+KNivKuL99VZsCNjbs4tzrnq5g6r1X+2qxKSmFjMGnXp4lpqG0EeCZb8bfbQEiS5m0B3Ep4RrwWVqbo9OP40zsvzh/r7BRikMvLc2G5i60EdxKlcz2BRX6NPSzXgcU/1x0v7kpD7ZT5Mz3slSyUliscI7Bj6OCzYzZXQ6YcvuhNg9wlj58+h4X14IjQSI7aASz+hk= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 48a9e888-9069-4936-2955-08d6e411e3da X-MS-Exchange-CrossTenant-originalarrivaltime: 29 May 2019 08:44:41.1568 (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: MN2PR18MB3437 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-05-29_05:, , 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 e5fa977bcfd9..b8878ff498d1 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -254,10 +254,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], @@ -293,6 +289,7 @@ static int mem_info_setup(void) { struct ghes_dimm_info *dimm; bool enable_numa = true; + const char *bank, *device; int idx = 0; memset(&mem_info, 0, sizeof(mem_info)); @@ -312,6 +309,17 @@ 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 { @@ -320,8 +328,11 @@ static int mem_info_setup(void) mem_info.num_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); } mem_info.enable_numa = enable_numa; @@ -387,6 +398,9 @@ static void mci_add_dimm_info(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)