Received: by 10.223.176.5 with SMTP id f5csp2935803wra; Thu, 1 Feb 2018 08:16:38 -0800 (PST) X-Google-Smtp-Source: AH8x226mg1ebFOcFrs6EeLO/eSxNCiXggNJbP8i2D1nfnr+QKdFZmlIAGykqG9LcKyujqF2qtJDU X-Received: by 10.98.248.75 with SMTP id c11mr37542602pfm.54.1517501798800; Thu, 01 Feb 2018 08:16:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517501798; cv=none; d=google.com; s=arc-20160816; b=q4YLNGE3GdM7iDAmUcLdNuKBKHN/cRP6Vf3zL9774t+ja/Iwf17f+X+dxqLEm9XoGG qeLehR86YU5SED7VfjzbLm2ygx23h9v2Jg3cNcw9X8wd7NVSUhKmvPwFb6SgMWUdmq/s 1AO4+tMoBOBp/zUltnbjp5TPgglC7nKP4eeDloTEKosPWFUal20z+ph1+JYAhW4fAUIe 7Mg4TAyjofckRj5YYzbyUDM8/VyKx8UglTscUofznlUSLYZI7BAG9CtbXnHz8GI4F0Ew w0C/co0NK6OAOe9ytmPmbXKWICk1Q8ELogmsXDF5NVcl51TAJn8r1tniqTqR8e/RNsPf wZsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=xRW5gGwItk4SNEqHKFARH7+DKantBossizblcweHpmc=; b=EPiFxcknHiOhMIltmdck0mKMGHhOFNRXibdz+1YCE7SVSUeXZ+IOfPMRHj1/vh+B8M NqjCtGOL9l5YAsPQT9Or4laymztiF6BLnVPu6myRMPxHiyK7iXuh8F4eSkG/8P09IQPa zi4Tt76H++EUJq3l1HVMja89czS9UxaNxFpNJVigej4UTPvZayg51vXssobp3lCwny3Z KYEJupr1/CbyuX7pjmjzH7Pp2fRyZ+/8m3DMk9dtfJe8cLb9sfbT8vUf708oyWbmx+Dy 6NZZ5bFmeF75YV5S1eKu32C8R+7W+9PnwrYL9u9JR4zERbT4unjNBxkyXdj1sTWxcQfi J3tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=PfrUz9iA; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64-v6si2115048pld.465.2018.02.01.08.16.23; Thu, 01 Feb 2018 08:16:38 -0800 (PST) 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=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=PfrUz9iA; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752582AbeBAQPw (ORCPT + 99 others); Thu, 1 Feb 2018 11:15:52 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:47147 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751547AbeBAQPu (ORCPT ); Thu, 1 Feb 2018 11:15:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1517501751; x=1549037751; h=from:to:cc:subject:date:message-id; bh=IS94Jx9yApX191HC/6uL7SVxLYAtIf/MvyiaRf5V06A=; b=PfrUz9iAZ3OIlklbinJ7im8TtkulaWgo2Z1ykEHQogCyS/DuaZycnja5 LeUUtvOXys0LPC8QDRbRKClvtbrF0M+mJHzvwVgWm/aa0C0kcXuTa95m+ KKfWhdiAz2VDHdLV9tKlL4AJ6ItkRR2ttN6m7EBaMAmvzdFtgu8n6yZ0V kmnEq7+VFDyDALR6aK+pkzPPA6KQxJJhr4ZtK7FQeuXMkIL4K87e+m7pN pDhmv6Mk77EWmeGbX6jbNxzE/+B6UgnrZzl47QO4SufX+rCccILyuxExF wKFa6KXSL5d/XjoIcQNrzw9lZYTdelKbpzOV0/9yaY9uIs3L20GAgn9pg A==; X-IronPort-AV: E=Sophos;i="5.46,444,1511798400"; d="scan'208";a="70915255" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 02 Feb 2018 00:15:51 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 01 Feb 2018 08:10:52 -0800 Received: from ilb000042.sdcorp.global.sandisk.com ([10.0.231.79]) by uls-op-cesaip02.wdc.com with ESMTP; 01 Feb 2018 08:15:47 -0800 From: Stanislav Nijnikov To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, jaegeuk@kernel.org Cc: alex.lemberg@wdc.com, Stanislav Nijnikov Subject: [PATCH v4 00/10] ufs: sysfs: read-only access to device descriptors, attributes and flags Date: Thu, 1 Feb 2018 18:15:36 +0200 Message-Id: <1517501746-19075-1-git-send-email-stanislav.nijnikov@wdc.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch introduces sysfs entries that will provide read-only access to device management data that could be received with UFS query requests. User-space applications will be able to read UFS device descriptors, flags and attributes. This will allow to get full UFS device configuration and its status. The descriptors are provided as set of files representing its parameters. The flags are using "true"/"false" representation of their value. The attributes are shown as hexadecimal value. The descriptors, attributes and flags are placed in separate subfolders under the UFS device sysfs entry (/sys/bus/platform/drivers/ufshcd/*/). The string descriptor subfolder contains five string descriptors defined by UFS specification 2.1. The LUN specific descriptor and attribute are placed under corresponding SCSI device sysfs entries (/sys/class/scsi_device/*/device/). In addition the patch presents an additional field in the scsi_host_template structure - struct attribute_group **sdev_group. This field allows to define groups of attributes. It will provide an ability to use binary attributes in addition to device attributes and to group them under subfolders if necessary. Changelog: v3 -> v4 Additional patch the introduces default attributes group for the existing ufs sysfs entries (rpm_lvl and spm_lvl) The ufs_sysfs_read_desc_param function calls to ufshcd_read_desc_param insted of ufshcd_query_descriptor_retry to avoid code duplication. The code was updated to remove the checkpatch error "ERROR: Macros with complex values should be enclosed in parentheses" Added "_" to macros parameters to remove "#undef DEVICE_CLASS" The legal information was updated to satisfy the SPDX requirements The date in Documentation/ABI/testing/sysfs-driver-ufs was updated. v2 -> v3 The Makefile is updated to make ufs-sysfs.c part of the ufshcd module. The unnecessary EXPORT_SYMBOL were removed Added a legal info header to the new files The date in Documentation/ABI/testing/sysfs-driver-ufs was updated. v1 -> v2 Provided additional description for the changes Stanislav Nijnikov (10): ufs: sysfs: attribute group for existing sysfs entries. ufs: sysfs: device descriptor ufs: sysfs: interconnect descriptor ufs: sysfs: geometry descriptor ufs: sysfs: health descriptor ufs: sysfs: power descriptor ufs: sysfs: string descriptors ufs: sysfs: unit descriptor ufs: sysfs: flags ufs: sysfs: attributes Documentation/ABI/testing/sysfs-driver-ufs | 804 +++++++++++++++++++++++++++++ drivers/scsi/scsi_sysfs.c | 14 + drivers/scsi/ufs/Makefile | 3 +- drivers/scsi/ufs/ufs-sysfs.c | 757 +++++++++++++++++++++++++++ drivers/scsi/ufs/ufs-sysfs.h | 25 + drivers/scsi/ufs/ufs.h | 115 ++++- drivers/scsi/ufs/ufshcd.c | 218 ++------ drivers/scsi/ufs/ufshcd.h | 34 ++ include/scsi/scsi_host.h | 6 + 9 files changed, 1785 insertions(+), 191 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-driver-ufs create mode 100644 drivers/scsi/ufs/ufs-sysfs.c create mode 100644 drivers/scsi/ufs/ufs-sysfs.h -- 2.7.4