Received: by 2002:ac0:b7d5:0:0:0:0:0 with SMTP id v21csp48073ime; Thu, 28 Jul 2022 16:34:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tj5HqJ3AHuLBbSoZ1SWIkzQw+Y4jHZ+31NaPChTzLZw6zwdML6QE9aOLERS8WWhTa/Zd7R X-Received: by 2002:a05:6402:524e:b0:43c:4a02:8043 with SMTP id t14-20020a056402524e00b0043c4a028043mr1191110edd.65.1659051253804; Thu, 28 Jul 2022 16:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659051253; cv=none; d=google.com; s=arc-20160816; b=N6gvFCgopXR9wwViqJaeDzAViUb0KwjuzfnXYOEGv//vwpzY3p7crd4RP3PcZ65BUt FYnY8yo8FgZP3fWap8H3mOp9pg5+KSWh5kQXaj2JQH6JSSDdnOIK4Cnw8EwgYYA89LEx 8hyEUwzbj17L2FpbSHayfD+aYTc6EPJ8mZLeXY+vMHnPASk9R2mm0uGmIrUww4iy4im3 1ArQoOnZtw/Fp1RcWcyC+NrZiAK2mtprhYxS1Zr2QGHCYMtiGI7c/mnKAC4uG/BA0Lm2 9SQoEMkgKXsYd31zwrRCXDBHrIj5VFn2/xhfBEuGvD/whC6hBQaqAoxo0LOoluH670+f lJ2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=invBG5xMXzjEltsK545VLHu8MZxeoZu1uoiZNi97Phk=; b=gXFoyJlkLNzmOrl15v1GexTfK1U5AoIgeX52wwLgkZ6Qex2tLmdFqJyOK/dOq0aLb3 qV16HWFuOvOl1n2md1iW8Dt2kM/Z9gvOTQc1oY7oke4c2ryMW+mogMVJqvlsNACEczQD nicjeEjTaghZ4qGHhrRYaX9EAYFJdzFf+K35o6jtYDyPGq+nzWkzU/HVfVhK/bpyM8Gf S5TC8b/CwiekJtcGbuV4+LkMiC2G5dS9RQtOk3RTeM90h8+Tmp3FQyI1n87IT3PFPHTx k7bYuzNYe69DmzEUrh989gZbMCiJtkJ6M8QDovAXWSE/bzMey58V/cpuVjAFpPXyOM+N JNlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bPVO6Qac; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r16-20020a170906c29000b006feb0e0856dsi1526676ejz.653.2022.07.28.16.33.47; Thu, 28 Jul 2022 16:34:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bPVO6Qac; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233161AbiG1XGH (ORCPT + 99 others); Thu, 28 Jul 2022 19:06:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbiG1XGF (ORCPT ); Thu, 28 Jul 2022 19:06:05 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDECE51A2C for ; Thu, 28 Jul 2022 16:06:01 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id w205so3151725pfc.8 for ; Thu, 28 Jul 2022 16:06:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=invBG5xMXzjEltsK545VLHu8MZxeoZu1uoiZNi97Phk=; b=bPVO6QacKDugDyEDOSaJ3JZwlv385SFV20Ltpu9KZf5M/nCWeCrgUHTks4ehn2nglI qpDRdW/WkPcDEUwMst3Kq/kGg6yf9lMRRi9YVN/u65q9eNILxTqzdKUTvD1y6+lqqBnd kf2pucKesim8mkcRciv6zS5mlAC7WpSlePmUo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=invBG5xMXzjEltsK545VLHu8MZxeoZu1uoiZNi97Phk=; b=o419UDxUR/PoOguCKZEjwcSVbw1Akn3DAtzDueUV0mYH810yjtE+LR7B5BE9xB8C/i Mq91DJlutnq/nn4DvwFO3q2uWryBE6FRn7axIxk1FIttXbD3VwIdvXjq358K6ByFLFOS kqJ4SWGwOd+Z2+RWdPMY5ZOo5hafhMdAtgKIOhc/ljB7JI9MHFQimpEQ5avIh/GATw7p PIR4AO9cCUAw4vugd+qYEYc6ItkTRH0iP8aMq4k5GkSfR6lkbFSl0TLM9/rLGz0D0hw9 pjgPZDn4qEUlFUSm/ax0qGBCokSGu3ir27zkiMCNeC22C9GVHYL8SLcbgBzqDKby4wUW BnhA== X-Gm-Message-State: AJIora8/OZzb9eiTFe/XVhDEug09rnjVcVGt7+rBtz5a0Zpbm3uAMMm6 q+ljq3Pl48ug6Xv6DacPCuZt0Q== X-Received: by 2002:a05:6a00:240e:b0:52c:81cf:8df2 with SMTP id z14-20020a056a00240e00b0052c81cf8df2mr750238pfh.40.1659049561155; Thu, 28 Jul 2022 16:06:01 -0700 (PDT) Received: from dlunevwfh.roam.corp.google.com (n122-107-196-14.sbr2.nsw.optusnet.com.au. [122.107.196.14]) by smtp.gmail.com with ESMTPSA id h14-20020a170902680e00b0016d2d2c7df1sm1824656plk.188.2022.07.28.16.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 16:06:00 -0700 (PDT) From: Daniil Lunev To: Adrian Hunter , Bart Van Assche , Greg Kroah-Hartman Cc: Daniil Lunev , Alim Akhtar , Avri Altman , Bean Huo , Daejun Park , "James E.J. Bottomley" , "Martin K. Petersen" , Mauro Carvalho Chehab , Sohaib Mohamed , Stanley Chu , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Subject: [PATCH v2] ufs: core: print capabilities in controller's sysfs node Date: Fri, 29 Jul 2022 09:05:50 +1000 Message-Id: <20220729090521.v2.1.Id612b86fd30936dfd4c456b3341547c15cecf321@changeid> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allows userspace to check supported by the controller/device functionality, e.g. write booster. Signed-off-by: Daniil Lunev --- Changes in v2: * Add documentation entry for the new sysfs node. Documentation/ABI/testing/sysfs-driver-ufs | 9 +++++++++ drivers/ufs/core/ufs-sysfs.c | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs index 6b248abb1bd71..97e42e4763eaf 100644 --- a/Documentation/ABI/testing/sysfs-driver-ufs +++ b/Documentation/ABI/testing/sysfs-driver-ufs @@ -1591,6 +1591,15 @@ Description: This entry shows the status of HPB. The file is read only. +What: /sys/bus/platform/drivers/ufshcd/*/caps +What: /sys/bus/platform/devices/*.ufs/caps +Date: July 2022 +Contact: Daniil Lunev +Description: Read-only attribute. Enabled capabilities of the UFS driver. The + enabled capabilities are determined by what is supported by the + host controller and the UFS device. + Format: 0x%08llx + What: /sys/class/scsi_device/*/device/hpb_param_sysfs/activation_thld Date: February 2021 Contact: Avri Altman diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c index 0a088b47d5570..b0c294c367519 100644 --- a/drivers/ufs/core/ufs-sysfs.c +++ b/drivers/ufs/core/ufs-sysfs.c @@ -254,6 +254,14 @@ static ssize_t wb_on_store(struct device *dev, struct device_attribute *attr, return res < 0 ? res : count; } +static ssize_t caps_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct ufs_hba *hba = dev_get_drvdata(dev); + + return sysfs_emit(buf, "0x%08llx\n", hba->caps); +} + static DEVICE_ATTR_RW(rpm_lvl); static DEVICE_ATTR_RO(rpm_target_dev_state); static DEVICE_ATTR_RO(rpm_target_link_state); @@ -262,6 +270,7 @@ static DEVICE_ATTR_RO(spm_target_dev_state); static DEVICE_ATTR_RO(spm_target_link_state); static DEVICE_ATTR_RW(auto_hibern8); static DEVICE_ATTR_RW(wb_on); +static DEVICE_ATTR_RO(caps); static struct attribute *ufs_sysfs_ufshcd_attrs[] = { &dev_attr_rpm_lvl.attr, @@ -272,6 +281,7 @@ static struct attribute *ufs_sysfs_ufshcd_attrs[] = { &dev_attr_spm_target_link_state.attr, &dev_attr_auto_hibern8.attr, &dev_attr_wb_on.attr, + &dev_attr_caps.attr, NULL }; -- 2.31.0