mbox series

[0/4] crypto: qat - enable configuration for 4xxx

Message ID 20220517141002.32385-1-giovanni.cabiddu@intel.com
Headers show
Series crypto: qat - enable configuration for 4xxx | expand

Message

Giovanni Cabiddu May 17, 2022, 2:09 p.m. UTC
qat_4xxx devices can be configured to allow either crypto or compression
operations. By default, devices are configured statically according
to following rule:
  - odd numbered devices assigned to compression services
  - even numbered devices assigned to crypto services

This set exposes two attributes in sysfs that allow to report and change
the state and the configuration of a QAT 4xxx device.
The first, /sys/bus/pci/devices/<BDF>/qat/state, allows to bring a
device down in order to change the configuration, and bring it up again.
The second, /sys/bus/pci/devices/<BDF>/qat/cfg_services, allows to
inspect the current configuration of a device (i.e. crypto or
compression) and change it.

Giovanni Cabiddu (4):
  crypto: qat - expose device state through sysfs for 4xxx
  crypto: qat - change behaviour of adf_cfg_add_key_value_param()
  crypto: qat - relocate and rename adf_sriov_prepare_restart()
  crypto: qat - expose device config through sysfs for 4xxx

 Documentation/ABI/testing/sysfs-driver-qat    |  58 ++++++
 .../crypto/qat/qat_4xxx/adf_4xxx_hw_data.c    |   1 +
 .../crypto/qat/qat_4xxx/adf_4xxx_hw_data.h    |   1 +
 drivers/crypto/qat/qat_4xxx/adf_drv.c         |   6 +-
 drivers/crypto/qat/qat_common/Makefile        |   1 +
 .../crypto/qat/qat_common/adf_accel_devices.h |   1 +
 drivers/crypto/qat/qat_common/adf_cfg.c       |  41 +++-
 .../crypto/qat/qat_common/adf_common_drv.h    |   3 +
 drivers/crypto/qat/qat_common/adf_init.c      |  26 +++
 drivers/crypto/qat/qat_common/adf_sriov.c     |  28 +--
 drivers/crypto/qat/qat_common/adf_sysfs.c     | 191 ++++++++++++++++++
 11 files changed, 328 insertions(+), 29 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-qat
 create mode 100644 drivers/crypto/qat/qat_common/adf_sysfs.c

Comments

Vladis Dronov June 2, 2022, 1:21 p.m. UTC | #1
Hi, Giovanni, all,

I've read through the patchset and it looks good to me. I would have made
the following two minor (really minor) changes.

Add a missing "in" to the patch message:

@@ [PATCH 1/4] crypto: qat - expose device state through sysfs for 4xxx
-allow the change of states even if the device is the down state.
+allow the change of states even if the device is in the down state.

Probably add an indication that cfg_services has been really changed to
the sysfs-driver-qat doc for clarity:

@@ [PATCH 4/4] crypto: qat - expose device config through sysfs for 4xxx
diff --git a/Documentation/ABI/testing/sysfs-driver-qat
b/Documentation/ABI/testing/sysfs-driver-qat
 +                       # echo dc > /sys/bus/pci/devices/<BDF>/qat/cfg_services
 +                       # echo up > /sys/bus/pci/devices/<BDF>/qat/state
++                       # cat /sys/bus/pci/devices/<BDF>/qat/cfg_services
++                       dc

Anyway, please feel free to use:

Reviewed-by: Vladis Dronov <vdronov@redhat.com>

Best regards,
Vladis Dronov | Red Hat, Inc. | The Core Kernel | Senior Software Engineer

On Tue, May 17, 2022 at 4:10 PM Giovanni Cabiddu
<giovanni.cabiddu@intel.com> wrote:
>
> qat_4xxx devices can be configured to allow either crypto or compression
> operations. By default, devices are configured statically according
> to following rule:
>   - odd numbered devices assigned to compression services
>   - even numbered devices assigned to crypto services
>
> This set exposes two attributes in sysfs that allow to report and change
> the state and the configuration of a QAT 4xxx device.
> The first, /sys/bus/pci/devices/<BDF>/qat/state, allows to bring a
> device down in order to change the configuration, and bring it up again.
> The second, /sys/bus/pci/devices/<BDF>/qat/cfg_services, allows to
> inspect the current configuration of a device (i.e. crypto or
> compression) and change it.
>
> Giovanni Cabiddu (4):
>   crypto: qat - expose device state through sysfs for 4xxx
>   crypto: qat - change behaviour of adf_cfg_add_key_value_param()
>   crypto: qat - relocate and rename adf_sriov_prepare_restart()
>   crypto: qat - expose device config through sysfs for 4xxx
>
>  Documentation/ABI/testing/sysfs-driver-qat    |  58 ++++++
>  .../crypto/qat/qat_4xxx/adf_4xxx_hw_data.c    |   1 +
>  .../crypto/qat/qat_4xxx/adf_4xxx_hw_data.h    |   1 +
>  drivers/crypto/qat/qat_4xxx/adf_drv.c         |   6 +-
>  drivers/crypto/qat/qat_common/Makefile        |   1 +
>  .../crypto/qat/qat_common/adf_accel_devices.h |   1 +
>  drivers/crypto/qat/qat_common/adf_cfg.c       |  41 +++-
>  .../crypto/qat/qat_common/adf_common_drv.h    |   3 +
>  drivers/crypto/qat/qat_common/adf_init.c      |  26 +++
>  drivers/crypto/qat/qat_common/adf_sriov.c     |  28 +--
>  drivers/crypto/qat/qat_common/adf_sysfs.c     | 191 ++++++++++++++++++
>  11 files changed, 328 insertions(+), 29 deletions(-)
>  create mode 100644 Documentation/ABI/testing/sysfs-driver-qat
>  create mode 100644 drivers/crypto/qat/qat_common/adf_sysfs.c
>
> --
> 2.36.1
>
Giovanni Cabiddu June 2, 2022, 2:07 p.m. UTC | #2
On Thu, Jun 02, 2022 at 03:21:57PM +0200, Vlad Dronov wrote:
> Hi, Giovanni, all,
> 
> I've read through the patchset and it looks good to me. I would have made
> the following two minor (really minor) changes.
> 
> Add a missing "in" to the patch message:
> 
> @@ [PATCH 1/4] crypto: qat - expose device state through sysfs for 4xxx
> -allow the change of states even if the device is the down state.
> +allow the change of states even if the device is in the down state.
> 
> Probably add an indication that cfg_services has been really changed to
> the sysfs-driver-qat doc for clarity:
> 
> @@ [PATCH 4/4] crypto: qat - expose device config through sysfs for 4xxx
> diff --git a/Documentation/ABI/testing/sysfs-driver-qat
> b/Documentation/ABI/testing/sysfs-driver-qat
>  +                       # echo dc > /sys/bus/pci/devices/<BDF>/qat/cfg_services
>  +                       # echo up > /sys/bus/pci/devices/<BDF>/qat/state
> ++                       # cat /sys/bus/pci/devices/<BDF>/qat/cfg_services
> ++                       dc
> 
> Anyway, please feel free to use:
> 
> Reviewed-by: Vladis Dronov <vdronov@redhat.com>
Thanks Vladis!
I'm going to rework and re-send.
Also I'm going to update the KernelVersion attribute in the
documentation as this patch didn't make kernel 5.19.