From: Haren Myneni <haren@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, linux-crypto@vger.kernel.org,
mpe@ellerman.id.au, herbert@gondor.apana.org.au,
npiggin@gmail.com
Cc: haren@linux.ibm.com
Subject: [PATCH 16/16] crypto/nx: sysfs interface to export NX capabilities
Date: Sat, 10 Apr 2021 17:45:34 -0700 [thread overview]
Message-ID: <4413800e55c1cace3aca3fa51951d6e9063b0557.camel@linux.ibm.com> (raw)
In-Reply-To: <b4631127bd025d9585246606c350ec88dbe1e99a.camel@linux.ibm.com>
Changes to export the following NXGZIP capabilities through sysfs:
/sys/devices/vio/ibm,compression-v1/NxGzCaps:
min_compress_len /*Recommended minimum compress length in bytes*/
min_decompress_len /*Recommended minimum decompress length in bytes*/
req_max_processed_len /* Maximum number of bytes processed in one
request */
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
---
drivers/crypto/nx/nx-common-pseries.c | 43 +++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/drivers/crypto/nx/nx-common-pseries.c b/drivers/crypto/nx/nx-common-pseries.c
index 49224870d05e..cc258d2c6475 100644
--- a/drivers/crypto/nx/nx-common-pseries.c
+++ b/drivers/crypto/nx/nx-common-pseries.c
@@ -962,6 +962,36 @@ static struct attribute_group nx842_attribute_group = {
.attrs = nx842_sysfs_entries,
};
+#define nxct_capab_read(_name) \
+static ssize_t nxct_##_name##_show(struct device *dev, \
+ struct device_attribute *attr, char *buf) \
+{ \
+ return sprintf(buf, "%lld\n", nx_ct_capab._name); \
+}
+
+#define NXCT_ATTR_RO(_name) \
+ nxct_capab_read(_name); \
+ static struct device_attribute dev_attr_##_name = __ATTR(_name, \
+ 0444, \
+ nxct_##_name##_show, \
+ NULL);
+
+NXCT_ATTR_RO(req_max_processed_len);
+NXCT_ATTR_RO(min_compress_len);
+NXCT_ATTR_RO(min_decompress_len);
+
+static struct attribute *nxct_capab_sysfs_entries[] = {
+ &dev_attr_req_max_processed_len.attr,
+ &dev_attr_min_compress_len.attr,
+ &dev_attr_min_decompress_len.attr,
+ NULL,
+};
+
+static struct attribute_group nxct_capab_attr_group = {
+ .name = nx_ct_capab.name,
+ .attrs = nxct_capab_sysfs_entries,
+};
+
static struct nx842_driver nx842_pseries_driver = {
.name = KBUILD_MODNAME,
.owner = THIS_MODULE,
@@ -1051,6 +1081,16 @@ static int nx842_probe(struct vio_dev *viodev,
goto error;
}
+ if (capab_feat) {
+ if (sysfs_create_group(&viodev->dev.kobj,
+ &nxct_capab_attr_group)) {
+ dev_err(&viodev->dev,
+ "Could not create sysfs NX capability entries\n");
+ ret = -1;
+ goto error;
+ }
+ }
+
return 0;
error_unlock:
@@ -1070,6 +1110,9 @@ static void nx842_remove(struct vio_dev *viodev)
pr_info("Removing IBM Power 842 compression device\n");
sysfs_remove_group(&viodev->dev.kobj, &nx842_attribute_group);
+ if (capab_feat)
+ sysfs_remove_group(&viodev->dev.kobj, &nxct_capab_attr_group);
+
crypto_unregister_alg(&nx842_pseries_alg);
spin_lock_irqsave(&devdata_mutex, flags);
--
2.18.2
next prev parent reply other threads:[~2021-04-11 0:46 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-11 0:27 [PATCH 00/16] Enable VAS and NX-GZIP support on powerVM Haren Myneni
2021-04-11 0:29 ` [PATCH 01/16] powerpc/powernv/vas: Rename register/unregister functions Haren Myneni
2021-04-11 0:31 ` [PATCH 02/16] powerpc/vas: Make VAS API powerpc platform independent Haren Myneni
2021-04-11 8:49 ` Christophe Leroy
2021-04-12 0:29 ` Haren Myneni
2021-04-13 12:59 ` Michael Ellerman
2021-04-11 0:32 ` [PATCH 03/16] powerpc/vas: Create take/drop task reference functions Haren Myneni
2021-04-11 0:33 ` [PATCH 04/16] powerpc/vas: Move update_csb/dump_crb to platform independent Haren Myneni
2021-04-11 0:34 ` [PATCH 05/16] powerpc/vas: Define and use common vas_window struct Haren Myneni
2021-04-11 0:35 ` [PATCH 06/16] powerpc/pseries/vas: Define VAS/NXGZIP HCALLs and structs Haren Myneni
2021-04-11 0:35 ` [PATCH 07/16] powerpc/vas: Define QoS credit flag to allocate window Haren Myneni
2021-04-11 0:36 ` [PATCH 08/16] powerpc/pseries/VAS: Implement allocate/modify/deallocate HCALLS Haren Myneni
2021-04-11 0:38 ` [PATCH 09/16] powerpc/pseries/vas: Implement to get all capabilities Haren Myneni
2021-04-11 0:39 ` [PATCH 10/16] powerpc/pseries/vas: Integrate API with open/close windows Haren Myneni
2021-04-11 0:40 ` [PATCH 11/16] powerpc/pseries/vas: Setup IRQ and fault handling Haren Myneni
2021-04-11 0:41 ` [PATCH 12/16] powerpc/pseries/vas: sysfs interface to export capabilities Haren Myneni
2021-04-11 0:41 ` [PATCH 13/16] crypto/nx: Rename nx-842-pseries file name to nx-common-pseries Haren Myneni
2021-04-11 0:43 ` [PATCH 14/16] crypto/nx: Register and unregister VAS interface Haren Myneni
2021-04-11 7:48 ` kernel test robot
2021-04-11 0:44 ` [PATCH 15/16] crypto/nx: Get NX capabilities for GZIP coprocessor type Haren Myneni
2021-04-11 7:48 ` kernel test robot
2021-04-11 0:45 ` Haren Myneni [this message]
2021-04-11 8:07 ` [PATCH 00/16] Enable VAS and NX-GZIP support on powerVM Christophe Leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4413800e55c1cace3aca3fa51951d6e9063b0557.camel@linux.ibm.com \
--to=haren@linux.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).