From patchwork Tue Dec 5 22:24:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Luck X-Patchwork-Id: 10093997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 76D706056E for ; Tue, 5 Dec 2017 22:25:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 667A8287A9 for ; Tue, 5 Dec 2017 22:25:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 581C828BAD; Tue, 5 Dec 2017 22:25:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0141A287A9 for ; Tue, 5 Dec 2017 22:25:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752794AbdLEWYc (ORCPT ); Tue, 5 Dec 2017 17:24:32 -0500 Received: from mga03.intel.com ([134.134.136.65]:8032 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752742AbdLEWYb (ORCPT ); Tue, 5 Dec 2017 17:24:31 -0500 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Dec 2017 14:24:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,365,1508828400"; d="scan'208";a="181681924" Received: from agluck-desk.sc.intel.com (HELO agluck-desk) ([10.3.52.160]) by orsmga005.jf.intel.com with ESMTP; 05 Dec 2017 14:24:29 -0800 Date: Tue, 5 Dec 2017 14:24:29 -0800 From: "Luck, Tony" To: Borislav Petkov Cc: linux-edac@vger.kernel.org, Dan Williams , Jean Delvare , Len Brown , linux-acpi@vger.kernel.org, linux-nvdimm@lists.01.org, Lv Zheng , Mauro Carvalho Chehab , "Rafael J. Wysocki" , Qiuxu Zhuo , Aristeu Rozanski Subject: Re: [RFC PATCH 4/4] EDAC, skx_edac: Detect non-volatile DIMMs Message-ID: <20171205222429.cxrnnqfdtl6mrflu@agluck-desk> References: <20171205105451.ob23asixm726hysb@pd.tnic> <20171205200336.tbx7oypjuca3g6vn@agluck-desk> <20171205214441.pfxusrz5lpew5kre@pd.tnic> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20171205214441.pfxusrz5lpew5kre@pd.tnic> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Dec 05, 2017 at 10:44:41PM +0100, Borislav Petkov wrote: > On Tue, Dec 05, 2017 at 12:03:37PM -0800, Luck, Tony wrote: > > I could. But what happens when someone ends up on a system with > > an edac driver configured without ACPI_NFIT that does have NVDIMMs? > > Same thing when you land on a system with a kernel where the driver for > a piece of hw is not enabled. I mean, this won't be an issue on distros > as there *everything* is enabled but for tailored configs, where people > want skx_edac but don't need the nvdimm part. > > > I can make a stub version of nfit_get_smbios_id() that returns some > > error code ... and have the EDAC driver report size==0. > > > > Would that be OK? > > Sure, thanks! So this is what that would look like (on top of existing patches, but would be folded into them for next version): --- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig index 5c0c4a358f67..7f0bc4cd5086 100644 --- a/drivers/edac/Kconfig +++ b/drivers/edac/Kconfig @@ -233,10 +233,11 @@ config EDAC_SKX tristate "Intel Skylake server Integrated MC" depends on PCI && X86_64 && X86_MCE_INTEL && PCI_MMCONFIG select DMI - select ACPI_NFIT help Support for error detection and correction the Intel - Skylake server Integrated Memory Controllers. + Skylake server Integrated Memory Controllers. If your + has non-volatile DIMMs you should also manually select + CONFIG_ACPI_NFIT config EDAC_PND2 tristate "Intel Pondicherry2" diff --git a/drivers/edac/skx_edac.c b/drivers/edac/skx_edac.c index f42e382f82b1..8374deb83246 100644 --- a/drivers/edac/skx_edac.c +++ b/drivers/edac/skx_edac.c @@ -387,12 +387,16 @@ static int get_nvdimm_info(struct dimm_info *dimm, struct skx_imc *imc, int smbios_handle; u32 dev_handle; u16 flags; - u64 size; + u64 size = 0; dev_handle = ACPI_NFIT_BUILD_DEVICE_HANDLE(dimmno, chan, imc->lmc, imc->src_id, 0); smbios_handle = nfit_get_smbios_id(dev_handle, &flags); + if (smbios_handle == -EOPNOTSUPP) { + pr_warn_once("skx_edac: can't find size of NVDIMM\n"); + goto unknown_size; + } if (smbios_handle < 0) { skx_printk(KERN_ERR, "Can't find handle for NVDIMM ADR=%x\n", dev_handle); return 0; @@ -410,6 +414,7 @@ static int get_nvdimm_info(struct dimm_info *dimm, struct skx_imc *imc, return 0; } +unknown_size: edac_dbg(0, "mc#%d: channel %d, dimm %d, %lld Mb (%lld pages)\n", imc->mc, chan, dimmno, size >> 20, size >> PAGE_SHIFT); diff --git a/include/acpi/nfit.h b/include/acpi/nfit.h index 1eee1e32e72e..f58e9eee6e6a 100644 --- a/include/acpi/nfit.h +++ b/include/acpi/nfit.h @@ -14,6 +14,13 @@ #ifndef __ACPI_NFIT_H #define __ACPI_NFIT_H +#if defined(CONFIG_ACPI_NFIT) || defined(CONFIG_ACPI_NFIT_MODULE) int nfit_get_smbios_id(u32 device_handle, u16 *flags); +#else +static inline int nfit_get_smbios_id(u32 device_handle, u16 *flags) +{ + return -EOPNOTSUPP; +} +#endif #endif /* __ACPI_NFIT_H */