Skip to contentSkip to conversation

iaa_crypto bugfix and maintainer change

PATCH In review Zanussi, Tom 2 participants 4 messages Sep 27, 2024 – Oct 5, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover iaa_crypto bugfix and maintainer change

Hi Herbert,

The first patch here fixes a bug seen on some systems with broken IAA hardware; it doesn't fix the hardware issue itself but exposes an issue with trusting the hardware to either send a completion or trigger a timeout - if neither happens, it shouldn't spin endlessly.

The second patch hands over iaa_crypto maintainership, since I'll be retiring from Intel and won't have access to IAA hardware myself.

Thanks,

Tom

Tom Zanussi (2):
crypto: iaa - Remove potential infinite loop in check_completion()
MAINTAINERS: Make Kristen Accardi the IAA crypto driver maintainer

 MAINTAINERS                                |  2 +-
 drivers/crypto/intel/iaa/iaa_crypto_main.c | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
Signature · 1 line
2.38.1
#1 lore raw

PATCH 1/2 crypto: iaa - Remove potential infinite loop in check_completion()

For iaa_crypto operations, it's assumed that if an operation doesn't make progress, the IAA watchdog timer will kick in and set the completion status bit to failure and the reason to completion timeout.

Some systems may have broken hardware that doesn't even do that, which can result in an infinite status-checking loop. Add a check for that in the loop, and disable the driver if it occurs.

---
 drivers/crypto/intel/iaa/iaa_crypto_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/crypto/intel/iaa/iaa_crypto_main.c +10 -0
index 237f87000070..8fced88d3d06 100644
@@ -945,12 +945,22 @@ static inline int check_completion(struct device *dev,
 				   bool only_once)
 {
 	char *op_str = compress ? "compress" : "decompress";
+	int status_checks = 0;
 	int ret = 0;
 
 	while (!comp->status) {
 		if (only_once)
 			return -EAGAIN;
 		cpu_relax();
+		if (status_checks++ >= IAA_COMPLETION_TIMEOUT) {
+			/* Something is wrong with the hw, disable it. */
+			dev_err(dev, "%s completion timed out - "
+				"assuming broken hw, iaa_crypto now DISABLED\n",
+				op_str);
+			iaa_crypto_enabled = false;
+			ret = -ETIMEDOUT;
+			goto out;
+		}
 	}
 
 	if (comp->status != IAX_COMP_SUCCESS) {
Signature · 1 line
2.38.1
#2 lore raw

PATCH 2/2 MAINTAINERS: Make Kristen Accardi the IAA crypto driver maintainer

In reply to Zanussi, Tom

Since I'll be retiring from Intel and will no longer have access to hardware, Kristen Accardi will be taking over as the iaa_crypto maintainer.

---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
MAINTAINERS +1 -1
index a0b4c1210e92..b89c21ff2bc8 100644
@@ -11300,7 +11300,7 @@ Q:	https://patchwork.kernel.org/project/linux-dmaengine/list/
 F:	drivers/dma/ioat*
 
 INTEL IAA CRYPTO DRIVER
-M:	Tom Zanussi <[email protected]>
+M:	Kristen Accardi <[email protected]>
 L:	[email protected]
 S:	Supported
 F:	Documentation/driver-api/crypto/iaa/iaa-crypto.rst
Signature · 1 line
2.38.1
maintainer
#3 lore raw
In reply to Zanussi, Tom
Quoted 14 lines · Tom

Hi Herbert,

The first patch here fixes a bug seen on some systems with broken IAA hardware; it doesn't fix the hardware issue itself but exposes an issue with trusting the hardware to either send a completion or trigger a timeout - if neither happens, it shouldn't spin endlessly.

The second patch hands over iaa_crypto maintainership, since I'll be retiring from Intel and won't have access to IAA hardware myself.

Thanks,

Tom

Quoted 10 lines

Tom Zanussi (2):
crypto: iaa - Remove potential infinite loop in check_completion()
MAINTAINERS: Make Kristen Accardi the IAA crypto driver maintainer

 MAINTAINERS                                |  2 +-
 drivers/crypto/intel/iaa/iaa_crypto_main.c | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
Signature · 1 line
2.38.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