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
Subject: [V2 PATCH 16/16] crypto/nx: Add sysfs interface to export NX capabilities
Date: Tue, 13 Apr 2021 01:30:47 -0700 [thread overview]
Message-ID: <7f37374884abdab3e6079b1cc0ad0736c0db97ae.camel@linux.ibm.com> (raw)
In-Reply-To: <68aa9f2860f9acffa41469d3858883c938634722.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
prev parent reply other threads:[~2021-04-13 8:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-13 8:16 [V2 PATCH 00/16] Enable VAS and NX-GZIP support on powerVM Haren Myneni
2021-04-13 8:19 ` [V2 PATCH 01/16] powerpc/powernv/vas: Rename register/unregister functions Haren Myneni
2021-04-13 8:19 ` [V2 PATCH 02/16] powerpc/vas: Make VAS API powerpc platform independent Haren Myneni
2021-04-13 8:20 ` [V2 PATCH 03/16] powerpc/vas: Create take/drop task reference functions Haren Myneni
2021-04-13 8:22 ` [V2 PATCH 04/16] powerpc/vas: Move update_csb and dump_crb to platform independent Haren Myneni
2021-04-13 8:23 ` [V2 PATCH 05/16] powerpc/vas: Define and use common vas_window struct Haren Myneni
2021-04-13 8:23 ` [V2 PATCH 06/16] powerpc/pseries/vas: Define VAS/NXGZIP HCALLs and structs Haren Myneni
2021-04-13 8:24 ` [V2 PATCH 07/16] powerpc/vas: Define QoS credit flag to allocate window Haren Myneni
2021-04-13 8:24 ` [V2 PATCH 08/16] powerpc/pseries/VAS: Implement allocate/modify/deallocate HCALLS Haren Myneni
2021-04-13 8:25 ` [V2 PATCH 09/16] powerpc/pseries/vas: Implement to get all capabilities Haren Myneni
2021-04-13 8:26 ` [V2 PATCH 10/16] powerpc/pseries/vas: Integrate API with open/close windows Haren Myneni
2021-04-13 8:26 ` [V2 PATCH 11/16] powerpc/pseries/vas: Setup IRQ and fault handling Haren Myneni
2021-04-13 8:28 ` [V2 PATCH 12/16] powerpc/pseries/vas: sysfs interface to export capabilities Haren Myneni
2021-04-13 8:28 ` [V2 PATCH 13/16] crypto/nx: Rename nx-842-pseries file name to nx-common-pseries Haren Myneni
2021-04-13 8:29 ` [V2 PATCH 14/16] crypto/nx: Register and unregister VAS interface Haren Myneni
2021-04-13 8:30 ` [V2 PATCH 15/16] crypto/nx: Get NX capabilities for GZIP coprocessor type Haren Myneni
2021-04-13 8:30 ` Haren Myneni [this message]
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=7f37374884abdab3e6079b1cc0ad0736c0db97ae.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).