crypto: qat - fix warm reboot
Subsystems (3)
Giovanni Cabiddu
maintainercover crypto: qat - fix warm reboot
This series of patches addresses the warm reboot problem that affects all QAT devices. When a reset is performed using kexec, QAT devices fail to recover due to improper shutdown.
This implement the shutdown() handler, which integrates with the reboot notifier list to ensure proper device shutdown during reboots.
Each patch in this series targets a specific device driver which has a different commit id, therefore a different Fixes tag.
Giovanni Cabiddu (8):
crypto: qat - add shutdown handler to qat_4xxx
crypto: qat - add shutdown handler to qat_420xx
crypto: qat - remove redundant prototypes in qat_dh895xcc
crypto: qat - add shutdown handler to qat_dh895xcc
crypto: qat - remove redundant prototypes in qat_c62x
crypto: qat - add shutdown handler to qat_c62x
crypto: qat - remove redundant prototypes in qat_c3xxx
crypto: qat - add shutdown handler to qat_c3xxx
drivers/crypto/intel/qat/qat_420xx/adf_drv.c | 8 ++++ drivers/crypto/intel/qat/qat_4xxx/adf_drv.c | 8 ++++ drivers/crypto/intel/qat/qat_c3xxx/adf_drv.c | 41 +++++++++++-------- drivers/crypto/intel/qat/qat_c62x/adf_drv.c | 41 +++++++++++-------- .../crypto/intel/qat/qat_dh895xcc/adf_drv.c | 41 +++++++++++-------- 5 files changed, 85 insertions(+), 54 deletions(-)
Signature · 1 line
2.48.1
Giovanni Cabiddu
maintainerPATCH 1/8 crypto: qat - add shutdown handler to qat_4xxx
During a warm reset via kexec, the system bypasses the driver removal sequence, meaning that the remove() callback is not invoked. If a QAT device is not shutdown properly, the device driver will fail to load in a newly rebooted kernel.
This might result in output like the following after the kexec reboot:
4xxx 0000:01:00.0: Failed to power up the device
4xxx 0000:01:00.0: Failed to initialize device
4xxx 0000:01:00.0: Resetting device qat_dev0
4xxx 0000:01:00.0: probe with driver 4xxx failed with error -14Implement the shutdown() handler that hooks into the reboot notifier list. This brings down the QAT device and ensures it is shut down properly.
--- drivers/crypto/intel/qat/qat_4xxx/adf_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/crypto/intel/qat/qat_4xxx/adf_drv.c +8 -0
@@ -188,11 +188,19 @@ static void adf_remove(struct pci_dev *pdev)adf_cleanup_accel (accel_dev); } +static void adf_shutdown (struct pci_dev *pdev) +{ +struct adf_accel_dev *accel_dev =adf_devmgr_pci_to_accel_dev (pdev); + +adf_dev_down (accel_dev); +} +static struct pci_driver adf_driver = { .id_table = adf_pci_tbl, .name =ADF_4XXX_DEVICE_NAME , .probe = adf_probe, .remove = adf_remove, + .shutdown = adf_shutdown, .sriov_configure = adf_sriov_configure, .err_handler = &adf_err_handler, };
Signature · 1 line
2.48.1
Giovanni Cabiddu
maintainerPATCH 2/8 crypto: qat - add shutdown handler to qat_420xx
In reply to Giovanni CabidduDuring a warm reset via kexec, the system bypasses the driver removal sequence, meaning that the remove() callback is not invoked. If a QAT device is not shutdown properly, the device driver will fail to load in a newly rebooted kernel.
This might result in output like the following after the kexec reboot:
420xx 0000:01:00.0: Failed to power up the device
420xx 0000:01:00.0: Failed to initialize device
420xx 0000:01:00.0: Resetting device qat_dev0
420xx 0000:01:00.0: probe with driver 420xx failed with error -14Implement the shutdown() handler that hooks into the reboot notifier list. This brings down the QAT device and ensures it is shut down properly.
--- drivers/crypto/intel/qat/qat_420xx/adf_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/crypto/intel/qat/qat_420xx/adf_drv.c +8 -0
@@ -186,11 +186,19 @@ static void adf_remove(struct pci_dev *pdev)adf_cleanup_accel (accel_dev); } +static void adf_shutdown (struct pci_dev *pdev) +{ +struct adf_accel_dev *accel_dev =adf_devmgr_pci_to_accel_dev (pdev); + +adf_dev_down (accel_dev); +} +static struct pci_driver adf_driver = { .id_table = adf_pci_tbl, .name =ADF_420XX_DEVICE_NAME , .probe = adf_probe, .remove = adf_remove, + .shutdown = adf_shutdown, .sriov_configure = adf_sriov_configure, .err_handler = &adf_err_handler, };
Signature · 1 line
2.48.1
Giovanni Cabiddu
maintainerPATCH 3/8 crypto: qat - remove redundant prototypes in qat_dh895xcc
In reply to Giovanni CabidduMove the definition of the adf_driver structure and remove the redundant prototypes for the functions adf_probe() and adf_remove() in the qat_dh895xxcc driver.
Also move the pci_device_id table close to where it is used and drop the inner comma as it is not required.
This does not introduce any functional change.
--- .../crypto/intel/qat/qat_dh895xcc/adf_drv.c | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-)
drivers/crypto/intel/qat/qat_dh895xcc/adf_drv.c +15 -18
@@ -19,24 +19,6 @@#include <adf_dbgfs.h> #include "adf_dh895xcc_hw_data.h" -static const struct pci_device_id adf_pci_tbl[] = { - {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_QAT_DH895XCC ), }, - { } -}; -MODULE_DEVICE_TABLE (pci, adf_pci_tbl); - -static int adf_probe (struct pci_dev *dev,const struct pci_device_id *ent); -static void adf_remove (struct pci_dev *dev); - -static struct pci_driver adf_driver = { - .id_table = adf_pci_tbl, - .name =ADF_DH895XCC_DEVICE_NAME , - .probe = adf_probe, - .remove = adf_remove, - .sriov_configure = adf_sriov_configure, - .err_handler = &adf_err_handler, -}; -static void adf_cleanup_pci_dev (struct adf_accel_dev *accel_dev) {pci_release_regions (accel_dev->accel_pci_dev.pci_dev);
@@ -227,6 +209,21 @@ static void adf_remove(struct pci_dev *pdev)kfree (accel_dev); } +static const struct pci_device_id adf_pci_tbl[] = { + {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_QAT_DH895XCC ) }, + { } +}; +MODULE_DEVICE_TABLE (pci, adf_pci_tbl); + +static struct pci_driver adf_driver = { + .id_table = adf_pci_tbl, + .name =ADF_DH895XCC_DEVICE_NAME , + .probe = adf_probe, + .remove = adf_remove, + .sriov_configure = adf_sriov_configure, + .err_handler = &adf_err_handler, +}; +static int __init adfdrv_init (void ) {request_module ("intel_qat" );
Signature · 1 line
2.48.1
Giovanni Cabiddu
maintainerPATCH 4/8 crypto: qat - add shutdown handler to qat_dh895xcc
In reply to Giovanni CabidduDuring a warm reset via kexec, the system bypasses the driver removal sequence, meaning that the remove() callback is not invoked. If a QAT device is not shutdown properly, the device driver will fail to load in a newly rebooted kernel.
This might result in output like the following after the kexec reboot:
QAT: AE0 is inactive!!
QAT: failed to get device out of reset
dh895xcc 0000:3f:00.0: qat_hal_clr_reset error
dh895xcc 0000:3f:00.0: Failed to init the AEs
dh895xcc 0000:3f:00.0: Failed to initialise Acceleration Engine
dh895xcc 0000:3f:00.0: Resetting device qat_dev0
dh895xcc 0000:3f:00.0: probe with driver dh895xcc failed with error -14Implement the shutdown() handler that hooks into the reboot notifier list. This brings down the QAT device and ensures it is shut down properly.
--- drivers/crypto/intel/qat/qat_dh895xcc/adf_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/crypto/intel/qat/qat_dh895xcc/adf_drv.c +8 -0
@@ -209,6 +209,13 @@ static void adf_remove(struct pci_dev *pdev)kfree (accel_dev); } +static void adf_shutdown (struct pci_dev *pdev) +{ +struct adf_accel_dev *accel_dev =adf_devmgr_pci_to_accel_dev (pdev); + +adf_dev_down (accel_dev); +} +static const struct pci_device_id adf_pci_tbl[] = { {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_QAT_DH895XCC ) }, { }
@@ -220,6 +227,7 @@ static struct pci_driver adf_driver = { .name = ADF_DH895XCC_DEVICE_NAME, .probe = adf_probe, .remove = adf_remove, + .shutdown = adf_shutdown, .sriov_configure = adf_sriov_configure, .err_handler = &adf_err_handler, };
Signature · 1 line
2.48.1
Giovanni Cabiddu
maintainerPATCH 5/8 crypto: qat - remove redundant prototypes in qat_c62x
In reply to Giovanni CabidduMove the definition of the adf_driver structure and remove the redundant prototypes for the functions adf_probe() and adf_remove() in the qat_c62x driver.
Also move the pci_device_id table close to where it is used and drop the inner comma as it is not required.
This does not introduce any functional change.
--- drivers/crypto/intel/qat/qat_c62x/adf_drv.c | 33 ++++++++++----------- 1 file changed, 15 insertions(+), 18 deletions(-)
drivers/crypto/intel/qat/qat_c62x/adf_drv.c +15 -18
@@ -19,24 +19,6 @@#include <adf_dbgfs.h> #include "adf_c62x_hw_data.h" -static const struct pci_device_id adf_pci_tbl[] = { - {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_QAT_C62X ), }, - { } -}; -MODULE_DEVICE_TABLE (pci, adf_pci_tbl); - -static int adf_probe (struct pci_dev *dev,const struct pci_device_id *ent); -static void adf_remove (struct pci_dev *dev); - -static struct pci_driver adf_driver = { - .id_table = adf_pci_tbl, - .name =ADF_C62X_DEVICE_NAME , - .probe = adf_probe, - .remove = adf_remove, - .sriov_configure = adf_sriov_configure, - .err_handler = &adf_err_handler, -}; -static void adf_cleanup_pci_dev (struct adf_accel_dev *accel_dev) {pci_release_regions (accel_dev->accel_pci_dev.pci_dev);
@@ -227,6 +209,21 @@ static void adf_remove(struct pci_dev *pdev)kfree (accel_dev); } +static const struct pci_device_id adf_pci_tbl[] = { + {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_QAT_C62X ) }, + { } +}; +MODULE_DEVICE_TABLE (pci, adf_pci_tbl); + +static struct pci_driver adf_driver = { + .id_table = adf_pci_tbl, + .name =ADF_C62X_DEVICE_NAME , + .probe = adf_probe, + .remove = adf_remove, + .sriov_configure = adf_sriov_configure, + .err_handler = &adf_err_handler, +}; +static int __init adfdrv_init (void ) {request_module ("intel_qat" );
Signature · 1 line
2.48.1
Giovanni Cabiddu
maintainerPATCH 6/8 crypto: qat - add shutdown handler to qat_c62x
In reply to Giovanni CabidduDuring a warm reset via kexec, the system bypasses the driver removal sequence, meaning that the remove() callback is not invoked. If a QAT device is not shutdown properly, the device driver will fail to load in a newly rebooted kernel.
This might result in output like the following after the kexec reboot:
QAT: AE0 is inactive!!
QAT: failed to get device out of reset
c6xx 0000:3f:00.0: qat_hal_clr_reset error
c6xx 0000:3f:00.0: Failed to init the AEs
c6xx 0000:3f:00.0: Failed to initialise Acceleration Engine
c6xx 0000:3f:00.0: Resetting device qat_dev0
c6xx 0000:3f:00.0: probe with driver c6xx failed with error -14Implement the shutdown() handler that hooks into the reboot notifier list. This brings down the QAT device and ensures it is shut down properly.
--- drivers/crypto/intel/qat/qat_c62x/adf_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/crypto/intel/qat/qat_c62x/adf_drv.c +8 -0
@@ -209,6 +209,13 @@ static void adf_remove(struct pci_dev *pdev)kfree (accel_dev); } +static void adf_shutdown (struct pci_dev *pdev) +{ +struct adf_accel_dev *accel_dev =adf_devmgr_pci_to_accel_dev (pdev); + +adf_dev_down (accel_dev); +} +static const struct pci_device_id adf_pci_tbl[] = { {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_QAT_C62X ) }, { }
@@ -220,6 +227,7 @@ static struct pci_driver adf_driver = { .name = ADF_C62X_DEVICE_NAME, .probe = adf_probe, .remove = adf_remove, + .shutdown = adf_shutdown, .sriov_configure = adf_sriov_configure, .err_handler = &adf_err_handler, };
Signature · 1 line
2.48.1
Giovanni Cabiddu
maintainerPATCH 7/8 crypto: qat - remove redundant prototypes in qat_c3xxx
In reply to Giovanni CabidduMove the definition of the adf_driver structure and remove the redundant prototypes for the functions adf_probe() and adf_remove() in the qat_c3xxx driver.
Also move the pci_device_id table close to where it is used and drop the inner comma as it is not required.
This does not introduce any functional change.
--- drivers/crypto/intel/qat/qat_c3xxx/adf_drv.c | 33 +++++++++----------- 1 file changed, 15 insertions(+), 18 deletions(-)
drivers/crypto/intel/qat/qat_c3xxx/adf_drv.c +15 -18
@@ -19,24 +19,6 @@#include <adf_dbgfs.h> #include "adf_c3xxx_hw_data.h" -static const struct pci_device_id adf_pci_tbl[] = { - {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_QAT_C3XXX ), }, - { } -}; -MODULE_DEVICE_TABLE (pci, adf_pci_tbl); - -static int adf_probe (struct pci_dev *dev,const struct pci_device_id *ent); -static void adf_remove (struct pci_dev *dev); - -static struct pci_driver adf_driver = { - .id_table = adf_pci_tbl, - .name =ADF_C3XXX_DEVICE_NAME , - .probe = adf_probe, - .remove = adf_remove, - .sriov_configure = adf_sriov_configure, - .err_handler = &adf_err_handler, -}; -static void adf_cleanup_pci_dev (struct adf_accel_dev *accel_dev) {pci_release_regions (accel_dev->accel_pci_dev.pci_dev);
@@ -227,6 +209,21 @@ static void adf_remove(struct pci_dev *pdev)kfree (accel_dev); } +static const struct pci_device_id adf_pci_tbl[] = { + {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_QAT_C3XXX ) }, + { } +}; +MODULE_DEVICE_TABLE (pci, adf_pci_tbl); + +static struct pci_driver adf_driver = { + .id_table = adf_pci_tbl, + .name =ADF_C3XXX_DEVICE_NAME , + .probe = adf_probe, + .remove = adf_remove, + .sriov_configure = adf_sriov_configure, + .err_handler = &adf_err_handler, +}; +static int __init adfdrv_init (void ) {request_module ("intel_qat" );
Signature · 1 line
2.48.1
Giovanni Cabiddu
maintainerPATCH 8/8 crypto: qat - add shutdown handler to qat_c3xxx
In reply to Giovanni CabidduDuring a warm reset via kexec, the system bypasses the driver removal sequence, meaning that the remove() callback is not invoked. If a QAT device is not shutdown properly, the device driver will fail to load in a newly rebooted kernel.
This might result in output like the following after the kexec reboot:
QAT: AE0 is inactive!!
QAT: failed to get device out of reset
c3xxx 0000:3f:00.0: qat_hal_clr_reset error
c3xxx 0000:3f:00.0: Failed to init the AEs
c3xxx 0000:3f:00.0: Failed to initialise Acceleration Engine
c3xxx 0000:3f:00.0: Resetting device qat_dev0
c3xxx 0000:3f:00.0: probe with driver c3xxx failed with error -14Implement the shutdown() handler that hooks into the reboot notifier list. This brings down the QAT device and ensures it is shut down properly.
--- drivers/crypto/intel/qat/qat_c3xxx/adf_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/crypto/intel/qat/qat_c3xxx/adf_drv.c +8 -0
@@ -209,6 +209,13 @@ static void adf_remove(struct pci_dev *pdev)kfree (accel_dev); } +static void adf_shutdown (struct pci_dev *pdev) +{ +struct adf_accel_dev *accel_dev =adf_devmgr_pci_to_accel_dev (pdev); + +adf_dev_down (accel_dev); +} +static const struct pci_device_id adf_pci_tbl[] = { {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_QAT_C3XXX ) }, { }
@@ -220,6 +227,7 @@ static struct pci_driver adf_driver = { .name = ADF_C3XXX_DEVICE_NAME, .probe = adf_probe, .remove = adf_remove, + .shutdown = adf_shutdown, .sriov_configure = adf_sriov_configure, .err_handler = &adf_err_handler, };
Signature · 1 line
2.48.1
Herbert Xu
maintainerQuoted 3 lines · Giovanni Cabiddu
This series of patches addresses the warm reboot problem that affects all QAT devices. When a reset is performed using kexec, QAT devices fail to recover due to improper shutdown.
Thanks for the quick fixes Giovanni!
As this is not a new regression, I think they should go through the usual release cycle.
Just one comment on a possible improvement though, while it's good to shut down the device properly, the initialisation side should also do as much as is possible to reset a device that is in an unknown state.
This is because the previous kernel might have had a hard crash, in which case there is no chance for the correct shutdown sequence to be carried out.
Of course it's not always physically possible to reset something that is in an unknown state, but we should design the driver to be as resilient as possible.
Cheers,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Cabiddu, Giovanni
maintainerHi Herbert,
Quoted 9 lines · Herbert Xu
Quoted 3 lines · Giovanni Cabiddu
This series of patches addresses the warm reboot problem that affects all QAT devices. When a reset is performed using kexec, QAT devices fail to recover due to improper shutdown.
Thanks for the quick fixes Giovanni!
As this is not a new regression, I think they should go through the usual release cycle.
Sure, that's fine.
Quoted 6 lines
Just one comment on a possible improvement though, while it's good to shut down the device properly, the initialisation side should also do as much as is possible to reset a device that is in an unknown state.
Quoted 7 lines
This is because the previous kernel might have had a hard crash, in which case there is no chance for the correct shutdown sequence to be carried out.
Of course it's not always physically possible to reset something that is in an unknown state, but we should design the driver to be as resilient as possible.
Thanks for the feedback.
I considered adding a reset in the probe, but it would slow down the load time for each user.
One option might be to attempt to bring up the device, and if that fails, reset the device and retry the startup process.
We can look into that.
Regards,
Signature · 1 line
Giovanni
Herbert Xu
maintainerQuoted 20 lines · Giovanni Cabiddu
This series of patches addresses the warm reboot problem that affects all QAT devices. When a reset is performed using kexec, QAT devices fail to recover due to improper shutdown.
This implement the
shutdown()handler, which integrates with the reboot notifier list to ensure proper device shutdown during reboots.Each patch in this series targets a specific device driver which has a different commit id, therefore a different
Fixestag.Giovanni Cabiddu (8):
crypto: qat - add shutdown handler toqat_4xxx
crypto: qat - add shutdown handler toqat_420xx
crypto: qat - remove redundant prototypes inqat_dh895xcc
crypto: qat - add shutdown handler toqat_dh895xcc
crypto: qat - remove redundant prototypes inqat_c62x
crypto: qat - add shutdown handler toqat_c62x
crypto: qat - remove redundant prototypes inqat_c3xxx
crypto: qat - add shutdown handler toqat_c3xxx
Quoted 9 lines
drivers/crypto/intel/qat/qat_420xx/adf_drv.c | 8 ++++ drivers/crypto/intel/qat/qat_4xxx/adf_drv.c | 8 ++++ drivers/crypto/intel/qat/qat_c3xxx/adf_drv.c | 41 +++++++++++-------- drivers/crypto/intel/qat/qat_c62x/adf_drv.c | 41 +++++++++++-------- .../crypto/intel/qat/qat_dh895xcc/adf_drv.c | 41 +++++++++++-------- 5 files changed, 85 insertions(+), 54 deletions(-)Signature · 1 line
2.48.1
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt