From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752095AbdJGL4I (ORCPT ); Sat, 7 Oct 2017 07:56:08 -0400 Received: from esa1.dell-outbound.iphmx.com ([68.232.153.90]:50261 "EHLO esa1.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751027AbdJGL4G (ORCPT ); Sat, 7 Oct 2017 07:56:06 -0400 From: X-LoopCount0: from 10.166.132.189 X-IronPort-AV: E=Sophos;i="5.42,489,1500958800"; d="scan'208";a="70512273" X-DLP: DLP_GlobalPCIDSS To: CC: , , , , , , , , , Subject: RE: [PATCH v5 08/14] platform/x86: dell-smbios: Add a sysfs interface for SMBIOS tokens Thread-Topic: [PATCH v5 08/14] platform/x86: dell-smbios: Add a sysfs interface for SMBIOS tokens Thread-Index: AQHTPykrZ/ZCApH00EOSqwSkq7JxCKLYR7OA////YcA= Date: Sat, 7 Oct 2017 11:56:04 +0000 Message-ID: <8ad76b287f8a4f9aa13e7c809cc7b998@ausx13mpc120.AMER.DELL.COM> References: <20171007065421.GA20756@kroah.com> In-Reply-To: <20171007065421.GA20756@kroah.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.143.242.75] Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v97BuIqN020226 > -----Original Message----- > From: Greg KH [mailto:greg@kroah.com] > Sent: Saturday, October 7, 2017 1:54 AM > To: Limonciello, Mario > Cc: dvhart@infradead.org; Andy Shevchenko ; > LKML ; platform-driver-x86@vger.kernel.org; > Andy Lutomirski ; quasisec@google.com; > pali.rohar@gmail.com; rjw@rjwysocki.net; mjg59@google.com; hch@lst.de > Subject: Re: [PATCH v5 08/14] platform/x86: dell-smbios: Add a sysfs interface for > SMBIOS tokens > > On Fri, Oct 06, 2017 at 11:59:52PM -0500, Mario Limonciello wrote: > > Currently userspace tools can access system tokens via the dcdbas > > kernel module and a SMI call that will cause the platform to execute > > SMM code. > > > > With a goal in mind of deprecating the dcdbas kernel module a different > > method for accessing these tokens from userspace needs to be created. > > > > This is intentionally marked to only be readable as root as it can > > contain sensitive information about the platform's configuration. > > > > MAINTAINERS was missing for this driver. Add myself and Pali to > > maintainers list for it. > > > > Signed-off-by: Mario Limonciello > > --- > > .../ABI/testing/sysfs-platform-dell-smbios | 16 ++++++ > > MAINTAINERS | 7 +++ > > drivers/platform/x86/dell-smbios.c | 64 ++++++++++++++++++++++ > > 3 files changed, 87 insertions(+) > > create mode 100644 Documentation/ABI/testing/sysfs-platform-dell-smbios > > > > diff --git a/Documentation/ABI/testing/sysfs-platform-dell-smbios > b/Documentation/ABI/testing/sysfs-platform-dell-smbios > > new file mode 100644 > > index 000000000000..d97f4bd5bd91 > > --- /dev/null > > +++ b/Documentation/ABI/testing/sysfs-platform-dell-smbios > > @@ -0,0 +1,16 @@ > > +What: /sys/devices/platform//tokens > > +Date: November 2017 > > +KernelVersion: 4.15 > > +Contact: "Mario Limonciello" > > +Description: > > + A read-only description of Dell platform tokens > > + available on the machine. > > + > > + The tokens will be displayed in the following > > + machine readable format with each token on a > > + new line: > > + > > + ID Location value > > + > > + For example token: > > + 5 5 3 > > That's more than "one value per file" which is what sysfs requires, so > this isn't acceptable, sorry. What's more acceptable to you to relay this information? Binary sysfs attribute and export the structure format in a uapi? or a collection of sysfs files? Eg: tokens/$x/id tokens/$x/location tokens/$s/value I'm guessing the latter is the better way to go. > > > +static ssize_t tokens_show(struct device *dev, > > + struct device_attribute *attr, char *buf) > > +{ > > + size_t off = 0; > > + int to_print; > > + int i; > > + > > + to_print = min(da_num_tokens, (int)(PAGE_SIZE - 1) / 15); > > + for (i = 0; i < to_print; i++) { > > + off += scnprintf(buf+off, PAGE_SIZE-off, "%04x\t%04x\t%04x\n", > > + da_tokens[i].tokenID, da_tokens[i].location, > > + da_tokens[i].value); > > Huge hint, if you are checking for the max size of the buffer for sysfs, > something is really wrong, and you need to redo your design. > > thanks, > > greg k-h