From patchwork Mon Jun 24 15:09:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 167616 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4348214ilk; Mon, 24 Jun 2019 08:10:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLyeCukU7FbTsja3jWpa+K3UbIGDclPA2KdqTEOB1gucq5KWJUFtf45ccwZIqgkIcqQikD X-Received: by 2002:a17:902:ac88:: with SMTP id h8mr71148951plr.12.1561389001601; Mon, 24 Jun 2019 08:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561389001; cv=none; d=google.com; s=arc-20160816; b=VVRr3Uhuintswme+3HZwvm9WHqTOn+e+ExDdsnpJ0wRoLwvT2EH6wtrP5iJgxmHywT NVxAHxsgM04IbjuO4LWLJQ94Eh7KBrWLJ7Z6mHKIHJPRa9GXQSiJqrenbW9yH7Ks72x4 E8S23AdM1VWnA9Yzuaexu5O38U+CkF/I5TUYbmT5EmVhO+cgmHyFU77k1EmZKpr2S787 0NqyzL5jWJz7wCL1Bg2MbIHfuHW2iqLvz8agrsjSv7e8E/2v4oR9VegmpEr+vDVCJWSt HM/4U3efxIKuy6AYTfeMpaFbJ8v0rvoW+Aen+mbK19QTOubDO+8gfBtR7NfVb8C2zxAg pgbg== 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=Tx8UpEyPpXRqn/yZZOFXfPjItqJVXdo1VdCwoLR5kA4=; b=M1pp6SBdJcjpw9Q8SqD86swaTvb0qmnYmpX2Sq4xDxmzOUHVnqC6AYPPaH75Qtut9Q URvmrY+2Ivqt1iKT9q5qCDMCJztrGE1+f9gr/PRFOtgYDZZ9MyvthhkXHDfK5du2qI6g mZEmrAjZkdP4LmxCPneubAWETIxmC3PIZ9QYrzfJq9JK6ZIoj2+bJBgWqn/r1xpQ8Hf3 fgK3d6e8hL1tRwRBhrrLWpQ7Wvfh5kXX7aR4AY3DOpZjA7Yq+gAdBnWMgwzh73PteXw2 WIZcOFbGOw79VTUDgdXg5VL3RiVVZUEmJVcQzpMDuzUD0Ldp+AjPoiHU6O9mX4Kz3k5V XgVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=UZpk3s4H; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector2-marvell-onmicrosoft-com header.b=GReAI3vu; 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 o5si10466177pjp.77.2019.06.24.08.10.01; Mon, 24 Jun 2019 08:10:01 -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=UZpk3s4H; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector2-marvell-onmicrosoft-com header.b=GReAI3vu; 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 S1730928AbfFXPJ7 (ORCPT + 30 others); Mon, 24 Jun 2019 11:09:59 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:39476 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730834AbfFXPJx (ORCPT ); Mon, 24 Jun 2019 11:09:53 -0400 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5OF0721018628; Mon, 24 Jun 2019 08:09:46 -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=Tx8UpEyPpXRqn/yZZOFXfPjItqJVXdo1VdCwoLR5kA4=; b=UZpk3s4H5QWSy98Vz3/ZvpIB09ZvoCSSpJTZ7mIhKGq3h6nzilK36C161QhMupDk8zNE 6jqfkscYfhq9R8WUV+y7vm001EO3pohmjS3vnJqywF3hFagtzeSAelqUPFwcu/CLe0ec oPhDIpeics8E0FM5hdcMNgIcF6sfEZ12tRkQZxJSDN2e/zs2IZItlbvKQEL4P2aY2uZQ NjwD+Xq+QfZ5nslQU8i9fbytF0lQROqqAa94guQD7N8ZSLAUON0gun/xXnfMC8m1Hg9I Nd5j/KGaHwGRqvNpPFj60NuIE+E1BLWLjHgoQmF/c0SgFZB9hsdepy/BpvjIeAlEPDH7 fQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2tarxr9tck-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2019 08:09:46 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 24 Jun 2019 08:09:45 -0700 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (104.47.42.56) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Mon, 24 Jun 2019 08:09:45 -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=Tx8UpEyPpXRqn/yZZOFXfPjItqJVXdo1VdCwoLR5kA4=; b=GReAI3vuAlTMqio6qmTN8hLSMp7c8IJkRkf//tv+PvNqak53CU/iYP1CV8u1C9iFIG99Tg8DxJnmH47ZVCZV17Rd+jgIjGl2ExkiGxfhJHsw1Ch2nEy3dV0wSK2FSkG2KttGZhSqiU8vWRpakAs4iX9xIxz+bSGAXbXrulwQy64= 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:44 +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:44 +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 24/24] EDAC, ghes: Disable legacy API for ARM64 Thread-Topic: [PATCH v2 24/24] EDAC, ghes: Disable legacy API for ARM64 Thread-Index: AQHVKp7btZJqTl0650643IuYJMBHSA== Date: Mon, 24 Jun 2019 15:09:44 +0000 Message-ID: <20190624150758.6695-25-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: 82481c05-4725-4ff2-696f-08d6f8b5fd3a 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:8273; x-forefront-prvs: 007814487B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(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)(14444005)(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); 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: bm0o3OMJXooSrdPgF9EIJzSVWSAn4XfYUMc6CaLwWgSEIhO+zBxExVEKX1s+AUysyHuX8ei+a2ttgfFnW3VyGmWXNqe+fe9Cc8EDh5zMK+0HrIR2JC6x66F9SMzY6/GhEj9YC/zyXAGha1O7C/PfJpt6VcS+6CoYEVUa2uoU4pfvfWh7TU/BcQ3GkdpRzdCO4LCfELVfiKKtTms2KijAYKPsBH5aBMUVcCsrOqnJoegqgTFxlgIZNg+E177ra4kecneDRt2DZWHX1KbrmCyYGPFhWat8I6tjEFa8GfBGjE+G5K7ZoqAt4W/FlDQShQm8SHGZpdIaGq5VPFbxxrJy1UlYv3LgQcX4HauSVxEf1exKslH//00d2BWGD6OpahBgK46IPvh5Q0ZcBzlSrXzx/NXbEmHhFOgqJJgvNqiCLt4= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 82481c05-4725-4ff2-696f-08d6f8b5fd3a X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jun 2019 15:09:44.6513 (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 James Morse: "I'm all for removing/warning-its-broken it when ghes_edac is in use." Let's just disable legacy API for the ghes driver on arm64. Though, I don't agree with it as there still could be some userland tools that use this interface that cannot be used any longer after a transition from x86 to arm64. I leave that decision up to James. Signed-off-by: Robert Richter --- drivers/edac/edac_mc.c | 34 +++++++++++++++++++++++++++------- drivers/edac/edac_mc.h | 7 +++++++ drivers/edac/ghes_edac.c | 4 +++- 3 files changed, 37 insertions(+), 8 deletions(-) -- 2.20.1 diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 9383a1179b83..d7a120d7e304 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -276,16 +276,11 @@ void *edac_align_ptr(void **p, unsigned size, int n_elems) return (void *)(((unsigned long)ptr) + align - r); } -static void _edac_mc_free(struct mem_ctl_info *mci) +static void _edac_mc_free_legacy(struct mem_ctl_info *mci) { - int i, chn, row; + int chn, row; struct csrow_info *csr; - if (mci->dimms) { - for (i = 0; i < mci->tot_dimms; i++) - kfree(mci->dimms[i]); - kfree(mci->dimms); - } if (mci->csrows) { for (row = 0; row < mci->nr_csrows; row++) { csr = mci->csrows[row]; @@ -300,9 +295,34 @@ static void _edac_mc_free(struct mem_ctl_info *mci) } kfree(mci->csrows); } +} + +static void _edac_mc_free(struct mem_ctl_info *mci) +{ + int i; + + if (mci->dimms) { + for (i = 0; i < mci->tot_dimms; i++) + kfree(mci->dimms[i]); + kfree(mci->dimms); + } + + _edac_mc_free_legacy(mci); + kfree(mci); } +void edac_mc_disable_legacy_api(struct mem_ctl_info *mci) +{ +#ifdef CONFIG_EDAC_LEGACY_SYSFS + _edac_mc_free_legacy(mci); + mci->nr_csrows = 0; + mci->num_cschannel = 0; + mci->csrows = NULL; +#endif +} +EXPORT_SYMBOL_GPL(edac_mc_disable_legacy_api); + struct mem_ctl_info *__edac_mc_alloc(unsigned mc_num, unsigned dimm_num, unsigned n_layers, diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h index e8215847f853..d1bacc5f47f5 100644 --- a/drivers/edac/edac_mc.h +++ b/drivers/edac/edac_mc.h @@ -270,6 +270,13 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, const char *msg, const char *other_detail); +/** + * edac_mc_disable_legacy_api() - Disable legacy sysfs API + * + * @mci: a struct mem_ctl_info pointer + */ +void edac_mc_disable_legacy_api(struct mem_ctl_info *mci); + /* * edac misc APIs */ diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index 714623204232..804e48773f66 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -780,7 +780,9 @@ ghes_edac_register_one(int nid, struct ghes *ghes, struct device *parent) mci->dev_name = dev_name(dev); mem_info_prepare_mci(mci); - +#ifdef CONFIG_ARM64 + edac_mc_disable_legacy_api(mci); +#endif rc = edac_mc_add_mc(mci); if (rc < 0) { pr_err("Can't register at EDAC core (%d)\n", rc);