85a57cdc | 07-Oct-2024 |
Ahsan Atta <ahsan.atta@intel.com> |
crypto: qat - remove faulty arbiter config reset
[ Upstream commit 70199359902f1c7187dcb28a1be679a7081de7cc ]
Resetting the service arbiter config can cause potential issues related to response ord
crypto: qat - remove faulty arbiter config reset
[ Upstream commit 70199359902f1c7187dcb28a1be679a7081de7cc ]
Resetting the service arbiter config can cause potential issues related to response ordering and ring flow control check in the event of AER or device hang. This is because it results in changing the default response ring size from 32 bytes to 16 bytes. The service arbiter config reset also disables response ring flow control check. Thus, by removing this reset we can prevent the service arbiter from being configured inappropriately, which leads to undesired device behaviour in the event of errors.
Fixes: 7afa232e76ce ("crypto: qat - Intel(R) QAT DH895xcc accelerator") Signed-off-by: Ahsan Atta <ahsan.atta@intel.com> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
05c9a7a5 | 28-Sep-2024 |
Dan Carpenter <dan.carpenter@linaro.org> |
crypto: qat/qat_4xxx - fix off by one in uof_get_name()
[ Upstream commit 475b5098043eef6e72751aadeab687992a5b63d1 ]
The fw_objs[] array has "num_objs" elements so the > needs to be >= to prevent a
crypto: qat/qat_4xxx - fix off by one in uof_get_name()
[ Upstream commit 475b5098043eef6e72751aadeab687992a5b63d1 ]
The fw_objs[] array has "num_objs" elements so the > needs to be >= to prevent an out of bounds read.
Fixes: 10484c647af6 ("crypto: qat - refactor fw config logic for 4xxx") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Acked-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
7c5001d9 | 16-Feb-2024 |
Damian Muszynski <damian.muszynski@intel.com> |
crypto: qat - fix ring to service map for dcc in 4xxx
[ Upstream commit df018f82002a8b4dc407bc9a6f416b9241d14415 ]
If a device is configured for data compression chaining (dcc), half of the engines
crypto: qat - fix ring to service map for dcc in 4xxx
[ Upstream commit df018f82002a8b4dc407bc9a6f416b9241d14415 ]
If a device is configured for data compression chaining (dcc), half of the engines are loaded with the symmetric crypto image and the rest are loaded with the compression image. However, in such configuration all rings can handle compression requests.
Fix the ring to service mapping so that when a device is configured for dcc, the ring to service mapping reports that all rings in a bank can be used for compression.
Fixes: a238487f7965 ("crypto: qat - fix ring to service map for QAT GEN4") Signed-off-by: Damian Muszynski <damian.muszynski@intel.com> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
9ca3af17 | 15-Dec-2023 |
Jie Wang <jie.wang@intel.com> |
crypto: qat - relocate and rename get_service_enabled()
[ Upstream commit 4db87a5f9e3026d72e03bbdf1dac1dc5303e37f7 ]
Move the function get_service_enabled() from adf_4xxx_hw_data.c to adf_cfg_servi
crypto: qat - relocate and rename get_service_enabled()
[ Upstream commit 4db87a5f9e3026d72e03bbdf1dac1dc5303e37f7 ]
Move the function get_service_enabled() from adf_4xxx_hw_data.c to adf_cfg_services.c and rename it as adf_get_service_enabled(). This function is not specific to the 4xxx and will be used by other QAT drivers.
This does not introduce any functional change.
Signed-off-by: Jie Wang <jie.wang@intel.com> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Stable-dep-of: df018f82002a ("crypto: qat - fix ring to service map for dcc in 4xxx") Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
a3eb0109 | 20-Oct-2023 |
Giovanni Cabiddu <giovanni.cabiddu@intel.com> |
crypto: qat - move adf_cfg_services
[ Upstream commit 03c76e8e7a8d0d465838b8eaffcc07bdcc364f4d ]
The file adf_cfg_services.h cannot be included in header files since it instantiates the structure a
crypto: qat - move adf_cfg_services
[ Upstream commit 03c76e8e7a8d0d465838b8eaffcc07bdcc364f4d ]
The file adf_cfg_services.h cannot be included in header files since it instantiates the structure adf_cfg_services. Move that structure to its own file and export the symbol.
This does not introduce any functional change.
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Damian Muszynski <damian.muszynski@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Stable-dep-of: df018f82002a ("crypto: qat - fix ring to service map for dcc in 4xxx") Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
cffe00ff | 20-Oct-2023 |
Giovanni Cabiddu <giovanni.cabiddu@intel.com> |
crypto: qat - fix deadlock in backlog processing
[ Upstream commit 203b01001c4d741205b9c329acddc5193ed56fbd ]
If a request has the flag CRYPTO_TFM_REQ_MAY_BACKLOG set, the function qat_alg_send_mes
crypto: qat - fix deadlock in backlog processing
[ Upstream commit 203b01001c4d741205b9c329acddc5193ed56fbd ]
If a request has the flag CRYPTO_TFM_REQ_MAY_BACKLOG set, the function qat_alg_send_message_maybacklog(), enqueues it in a backlog list if either (1) there is already at least one request in the backlog list, or (2) the HW ring is nearly full or (3) the enqueue to the HW ring fails. If an interrupt occurs right before the lock in qat_alg_backlog_req() is taken and the backlog queue is being emptied, then there is no request in the HW queues that can trigger a subsequent interrupt that can clear the backlog queue. In addition subsequent requests are enqueued to the backlog list and not sent to the hardware.
Fix it by holding the lock while taking the decision if the request needs to be included in the backlog queue or not. This synchronizes the flow with the interrupt handler that drains the backlog queue.
For performance reasons, the logic has been changed to try to enqueue first without holding the lock.
Fixes: 386823839732 ("crypto: qat - add backlog mechanism") Reported-by: Mikulas Patocka <mpatocka@redhat.com> Closes: https://lore.kernel.org/all/af9581e2-58f9-cc19-428f-6f18f1f83d54@redhat.com/T/ Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
82e4aa18 | 20-Oct-2023 |
Giovanni Cabiddu <giovanni.cabiddu@intel.com> |
crypto: qat - fix ring to service map for QAT GEN4
[ Upstream commit a238487f7965d102794ed9f8aff0b667cd2ae886 ]
The 4xxx drivers hardcode the ring to service mapping. However, when additional confi
crypto: qat - fix ring to service map for QAT GEN4
[ Upstream commit a238487f7965d102794ed9f8aff0b667cd2ae886 ]
The 4xxx drivers hardcode the ring to service mapping. However, when additional configurations where added to the driver, the mappings were not updated. This implies that an incorrect mapping might be reported through pfvf for certain configurations.
Add an algorithm that computes the correct ring to service mapping based on the firmware loaded on the device.
Fixes: 0cec19c761e5 ("crypto: qat - add support for compression for 4xxx") Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Damian Muszynski <damian.muszynski@intel.com> Reviewed-by: Tero Kristo <tero.kristo@linux.intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
04985fb7 | 20-Oct-2023 |
Giovanni Cabiddu <giovanni.cabiddu@intel.com> |
crypto: qat - use masks for AE groups
[ Upstream commit f7df2329eec1729a606bba8ed1566a1b3c248bad ]
The adf_fw_config structures hardcode a bit mask that represents the acceleration engines (AEs) wh
crypto: qat - use masks for AE groups
[ Upstream commit f7df2329eec1729a606bba8ed1566a1b3c248bad ]
The adf_fw_config structures hardcode a bit mask that represents the acceleration engines (AEs) where a certain firmware image will have to be loaded to. Remove the hardcoded masks and replace them with defines.
This does not introduce any functional change.
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Damian Muszynski <damian.muszynski@intel.com> Reviewed-by: Tero Kristo <tero.kristo@linux.intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Stable-dep-of: a238487f7965 ("crypto: qat - fix ring to service map for QAT GEN4") Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
a7be12fb | 20-Oct-2023 |
Giovanni Cabiddu <giovanni.cabiddu@intel.com> |
crypto: qat - refactor fw config related functions
[ Upstream commit 2990d2edac6061c6f0f646a46e40957244be2268 ]
The logic that selects the correct adf_fw_config structure based on the configured se
crypto: qat - refactor fw config related functions
[ Upstream commit 2990d2edac6061c6f0f646a46e40957244be2268 ]
The logic that selects the correct adf_fw_config structure based on the configured service is replicated twice in the uof_get_name() and uof_get_ae_mask() functions. Refactor the code so that there is no replication.
This does not introduce any functional change.
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Damian Muszynski <damian.muszynski@intel.com> Reviewed-by: Tero Kristo <tero.kristo@linux.intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Stable-dep-of: a238487f7965 ("crypto: qat - fix ring to service map for QAT GEN4") Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
2e513f6b | 14-Sep-2023 |
Adam Guerin <adam.guerin@intel.com> |
crypto: qat - enable dc chaining service
[ Upstream commit 37b14f2dfa791fd485dbc536f8d1ffe8c6990290 ]
QAT GEN4 devices support chained compression operations. These allow, with a single request to
crypto: qat - enable dc chaining service
[ Upstream commit 37b14f2dfa791fd485dbc536f8d1ffe8c6990290 ]
QAT GEN4 devices support chained compression operations. These allow, with a single request to firmware, to hash then compress data.
Extend the configuration to enable such mode. The cfg_services operations in sysfs are extended to allow the string "dcc". When selected, the driver downloads to the device both the symmetric crypto and the compression firmware images and sends an admin message to firmware which enables `chained` operations. In addition, it sets the device's capabilities as the combination of compression and symmetric crypto capabilities, while excluding the ICP_ACCEL_CAPABILITIES_CRYPTO_SYMMETRIC bit to indicate that in this mode, symmetric crypto instances are not supported.
When "dcc" is enabled, the device will handle compression requests as if the "dc" configuration is loaded ("dcc" is a variation of "dc") and the driver will register the acomp algorithms.
As for the other extended configurations, "dcc" is only available for qat_4xxx devices and the chaining service will be only accessible from user space.
Signed-off-by: Adam Guerin <adam.guerin@intel.com> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Stable-dep-of: a238487f7965 ("crypto: qat - fix ring to service map for QAT GEN4") Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
55ec67f7 | 14-Sep-2023 |
Giovanni Cabiddu <giovanni.cabiddu@intel.com> |
crypto: qat - fix unregistration of compression algorithms
[ Upstream commit 11af152f784d9eca54e193140891ac52de36e9a9 ]
The function adf_dev_init(), through the subsystem qat_compression, populates
crypto: qat - fix unregistration of compression algorithms
[ Upstream commit 11af152f784d9eca54e193140891ac52de36e9a9 ]
The function adf_dev_init(), through the subsystem qat_compression, populates the list of list of compression instances accel_dev->compression_list. If the list of instances is not empty, the function adf_dev_start() will then call qat_compression_registers() register the compression algorithms into the crypto framework.
If any of the functions in adf_dev_start() fail, the caller of such function, in the error path calls adf_dev_down() which in turn call adf_dev_stop() and adf_dev_shutdown(), see for example the function state_store in adf_sriov.c. However, if the registration of compression algorithms is not done, adf_dev_stop() will try to unregister the algorithms regardless. This might cause the counter active_devs in qat_compression.c to get to a negative value.
Add a new state, ADF_STATUS_COMPRESSION_ALGS_REGISTERED, which tracks if the compression algorithms are registered into the crypto framework. Then use this to unregister the algorithms if such flag is set. This ensures that the compression algorithms are only unregistered if previously registered.
Fixes: 1198ae56c9a5 ("crypto: qat - expose deflate through acomp api for QAT GEN2") Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Adam Guerin <adam.guerin@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
fa43d81a | 14-Sep-2023 |
Giovanni Cabiddu <giovanni.cabiddu@intel.com> |
crypto: qat - fix unregistration of crypto algorithms
[ Upstream commit 9b2f33a1bfcda90b857431a764c9c8f9a412bbe5 ]
The function adf_dev_init(), through the subsystem qat_crypto, populates the list
crypto: qat - fix unregistration of crypto algorithms
[ Upstream commit 9b2f33a1bfcda90b857431a764c9c8f9a412bbe5 ]
The function adf_dev_init(), through the subsystem qat_crypto, populates the list of list of crypto instances accel_dev->crypto_list. If the list of instances is not empty, the function adf_dev_start() will then call qat_algs_registers() and qat_asym_algs_register() to register the crypto algorithms into the crypto framework.
If any of the functions in adf_dev_start() fail, the caller of such function, in the error path calls adf_dev_down() which in turn call adf_dev_stop() and adf_dev_shutdown(), see for example the function state_store in adf_sriov.c. However, if the registration of crypto algorithms is not done, adf_dev_stop() will try to unregister the algorithms regardless. This might cause the counter active_devs in qat_algs.c and qat_asym_algs.c to get to a negative value.
Add a new state, ADF_STATUS_CRYPTO_ALGS_REGISTERED, which tracks if the crypto algorithms are registered into the crypto framework. Then use this to unregister the algorithms if such flag is set. This ensures that the crypto algorithms are only unregistered if previously registered.
Fixes: d8cba25d2c68 ("crypto: qat - Intel(R) QAT driver framework") Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Adam Guerin <adam.guerin@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
a44d2b83 | 14-Sep-2023 |
Giovanni Cabiddu <giovanni.cabiddu@intel.com> |
crypto: qat - ignore subsequent state up commands
[ Upstream commit 9c20cb8b1847dedddec3d5163079290542bf00bf ]
If the device is already in the up state, a subsequent write of `up` to the sysfs attr
crypto: qat - ignore subsequent state up commands
[ Upstream commit 9c20cb8b1847dedddec3d5163079290542bf00bf ]
If the device is already in the up state, a subsequent write of `up` to the sysfs attribute /sys/bus/pci/devices/<BDF>/qat/state brings the device down. Fix this behaviour by ignoring subsequent `up` commands if the device is already in the up state.
Fixes: 1bdc85550a2b ("crypto: qat - fix concurrency issue when device state changes") Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Adam Guerin <adam.guerin@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|