Received: by 10.223.176.5 with SMTP id f5csp833419wra; Tue, 6 Feb 2018 08:07:34 -0800 (PST) X-Google-Smtp-Source: AH8x225r+fw3szpqK8do0D4W65LHmYU4wjyl6svZ9rv9Ey+FoXv4JJCPdyQ8f7WtcY3mx7NbE5Fq X-Received: by 2002:a17:902:7b8f:: with SMTP id w15-v6mr2926066pll.219.1517933254500; Tue, 06 Feb 2018 08:07:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517933254; cv=none; d=google.com; s=arc-20160816; b=jZ5xP2e/WYu7Zh5yeOQdcUggGEGg03+haHoHxUAJSVIh1F4C6SJz+db+6G9JNiMFB8 uea7y/3c5VLoYxa/v+MJfR0rYWr6/sreG5UX0e+XeEteGKGOAYqD4F6ha5/O1PYE2YRn 1tk1CfKxBqMCuvfs8hhuqBR1uJAYG1/55RRL8FWTvA3pm1Tbv5k08FxfVYQ87uuTteox 92Wh14DHkBzs1rbiV6slyjbFNyJJCHcbEpgZ9J2Dd7BdwqhuLHHOcxeTEjGoBhI3hPR9 s99mAvtnSAS8SwC2DIZ5hYXTiXdM7n3h5U0IhSwavWGwi5UqtEdwwk3jkk+GQcaqsQCR xVkw== 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=Km4K9Gv7ml9GwiVaCQ82xHsTUTwr3uZXrQ9f6NpReiE=; b=aldkZGoWOz71SyaOc9SAgSboKhLhWdiTrYI0se1qeS6gGuXsKt3k3GMEwVsShBNzKq jDndMqc0ZpI+Btky/nK3xjOA57oVvuUfxxSdSxpGxdJI78QdCu0R11hhYXKGGPBfn2J1 tBbBcBDICgOahWQ6a6huyUv8Ce6gHx4qEDLsuQjnVeMyg1j1S/FFhbatyWRKdK+2t756 +q07L8jpbgn0MFEKzB50BUKTEIgrMNxE0HG4Pwq819vexIughdZNEC46w/kk8PeEVejp Tjr8cFKXWZR/RxswTyTxmhw7J52UpPke3kU/ZX/ayhJO9YaUoh8k8kAUOKmiNiIiNtRe Cpsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=V+fGJtar; 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 e70si5122101pgc.127.2018.02.06.08.07.19; Tue, 06 Feb 2018 08:07:34 -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=V+fGJtar; 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 S1752528AbeBFQGg (ORCPT + 99 others); Tue, 6 Feb 2018 11:06:36 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:23892 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752185AbeBFQGb (ORCPT ); Tue, 6 Feb 2018 11:06:31 -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=1517933191; x=1549469191; h=from:to:cc:subject:date:message-id; bh=jz5i8bNGn+qLJrEWsxgGMJaCi7ZivHuoJ4xugbgEZ30=; b=V+fGJtarItrenafhnI894AVg2F/I1PQofomMXpFDPIycDohqtKtWC07f 35ojI3jBHHaKb6ikau+dooUFCcr6brAP0GKx0VLgVB/UoYhP0hqSfyqsC xAJYbfBQe7ADhElukWRVcBvY5bZWbE9NMLlJLhsDEmgw5pTYOq2F+tQS8 +0qIGXIFcHIjiESxANyJyBq1zm27HD69kZKgnLRVQK2C4KzqGknCTuYkO dnxAWaeMKzIW/Yqag9fkXlPsyjxVOTWHIU/2U1jVlYg/dCzUlOhC/Eq5A IJWbpwb61oYfA2zmYUcivIknUNJT6eBaGr5q2/PURfANcAL2d7stpubBx w==; X-IronPort-AV: E=Sophos;i="5.46,469,1511798400"; d="scan'208";a="71267279" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Feb 2018 00:06:31 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 06 Feb 2018 08:01:21 -0800 Received: from ilb000042.sdcorp.global.sandisk.com ([10.0.231.79]) by uls-op-cesaip02.wdc.com with ESMTP; 06 Feb 2018 08:06:30 -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 v5 00/11] ufs: sysfs: read-only access to device Date: Tue, 6 Feb 2018 18:06:12 +0200 Message-Id: <1517933183-30892-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: 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 | 737 ++++++++++++++++++++++++++ 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, 1755 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