Received: by 10.223.185.116 with SMTP id b49csp1948929wrg; Thu, 15 Feb 2018 04:19:15 -0800 (PST) X-Google-Smtp-Source: AH8x225eOvNtJKuMbKk5Zi1adjNP6v7pBV9v8nDxqsn+iyw0I+OY7I8RmrAN9d84UbXeISIKPFfj X-Received: by 2002:a17:902:c6b:: with SMTP id 98-v6mr2310626pls.267.1518697155803; Thu, 15 Feb 2018 04:19:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518697155; cv=none; d=google.com; s=arc-20160816; b=CSsWukRDiQUJ4n/JIe2BM4mcPpUMrv7kE0nrTQOhi91QqIUwaoLA4qsgJmwKbRHtFu iGzn+Qn6q1I7TjsgZMU3vM8OG5gvw1A1hJD5wlNxwxKJ1eLhWflSPqz6End9cHvZclEX 2OWVxab/ttTKWicGkEWFSUc430LURto6qTTTLBVrmBgMOE+uRP+dd4XHRa4JcdgIULNq xPEvcvAbdEybnR2sne9YdNfLuC2uF3u97U9ZeFN9wfKFExLowSf2CDe4h0s0utck8LfO UYi0iQBFjsY6IKaJcnfwTbtpkcuG6RjYfjc3xeZFSEzncjCkuptujRMbR2VP7/Y2CQUl 3Nyg== 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=TLew3l0+/QYHuVXeYm3h16VFxykfmMHaB6EI8SomkV8=; b=a9/0tExT8oW1tlrOHHor4VxSOQkOprkNYbyHZGOxfoafUmsOyTeb/GjxDimvpmR5Ut ASLSaxwQJzVNv3Bzp4QJ0w8+BsMuXq8GmPa8FLBzjY3ZyuO6phDIkU2OnAjwe+kVAkdi 5NL9Jx1nTXyammG2N8b2pG++kyzFIqavcjNeA4al+IGVd7CFvV0WtNCOM8PTOOT73u9c oi9aAU4oeUcdNEQ0uTuPV5pEY9sRMzorwnWCJDkyuoKLDRDMe9T23bAIR8W1MLhi5qKB fhT96AjFZc0WrlAb3duCT8VO3mbiInMpmC2ekBJ/RQwc/b8z4522qLmzWN6MRNl37n02 L6qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=IvCL/NZv; 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 h63si2299458pgc.497.2018.02.15.04.19.01; Thu, 15 Feb 2018 04:19:15 -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=IvCL/NZv; 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 S967945AbeBOMOT (ORCPT + 99 others); Thu, 15 Feb 2018 07:14:19 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:18741 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967889AbeBOMOR (ORCPT ); Thu, 15 Feb 2018 07:14:17 -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=1518696858; x=1550232858; h=from:to:cc:subject:date:message-id; bh=kvGcF58cYfrIM0zcHWhworWjruLpbfVdp1Ls4XE5ikg=; b=IvCL/NZviwlluEeMVg+AB/+nnAvvxM/SWfO9/3OP8fSGXRKxmd2mwEaz eHlYR3X6NTCieUqAUzq5RaHkQVhl8T5K0MwP1mpZG30Kw+FmnXFdcUmNx YGZmYxJP3waMLyTdeiHVv+/IbldWnUcvPVOVhPdieogmwjMPVtLzp8WRE DU+xs6hg+QZE6rMe7Rkj3KzjrY1p0tCEvM3HBRieIybUj+DkLuBNF+hmT Zg3FiMmjG9lPUNU8B/kSGVX40H9Ic1EAy/SUG4FubDZZD3lLSAyADRKfa isRmdCj8sX9TwrDC1oi3EYWt2WVHNKfg8zfx8gB6XpOQvnMbCGTrqjxRf g==; X-IronPort-AV: E=Sophos;i="5.46,517,1511798400"; d="scan'208";a="71975437" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 15 Feb 2018 20:14:17 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 15 Feb 2018 04:08:18 -0800 Received: from ilb000042.sdcorp.global.sandisk.com ([10.0.231.79]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Feb 2018 04:14:14 -0800 From: Stanislav Nijnikov To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, jaegeuk@kernel.org, Bart.VanAssche@wdc.com Cc: alex.lemberg@wdc.com, Stanislav Nijnikov Subject: [PATCH v6 00/11] ufs: sysfs: read-only access to device Date: Thu, 15 Feb 2018 14:14:00 +0200 Message-Id: <1518696851-6730-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: v5 -> v6 The sysfs_remove_groups call is moved inside of the sdev->is_visible if case Identation of the changes in the drivers/scsi/scsi_sysfs.c file is fixed The SPDX license id is changed from "GPL-2.0-only" to "GPL-2.0" v4 -> v5 Added "scsi: " to clarify the patch naming The scsi: ufs: sysfs: unit descriptor was split to two patches "scsi: host template attribute groups" and "scsi: ufs: sysfs: unit descriptor" The "const" modificator was added to the sdev_groups member type and all corresponding data structures. The type conversions in the relative calls of sysfs_create_groups/sysfs_remove_groups were cleared. The ufs_desc_param_size enumeration was replaced with numeric constants The UFS_LUN_ATTRIBUTE macro was removed The be*_to_cpu function calls were replaced with corresponding get_unaligned_be* calls The legal information was cut leaving only the SPDX line and the copyright information v3 -> v4 Additional patch that 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 (11): scsi: ufs: sysfs: attribute group for existing sysfs entries. scsi: ufs: sysfs: device descriptor scsi: ufs: sysfs: interconnect descriptor scsi: ufs: sysfs: geometry descriptor scsi: ufs: sysfs: health descriptor scsi: ufs: sysfs: power descriptor scsi: ufs: sysfs: string descriptors scsi: host template attribute groups scsi: ufs: sysfs: unit descriptor scsi: ufs: sysfs: flags scsi: ufs: sysfs: attributes Documentation/ABI/testing/sysfs-driver-ufs | 804 +++++++++++++++++++++++++++++ drivers/scsi/scsi_sysfs.c | 12 + drivers/scsi/ufs/Makefile | 3 +- drivers/scsi/ufs/ufs-sysfs.c | 739 ++++++++++++++++++++++++++ drivers/scsi/ufs/ufs-sysfs.h | 17 + 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, 1757 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