Skip to content
Snippets Groups Projects
Verified Commit f2747c65 authored by Michal Hrusecky's avatar Michal Hrusecky :mouse:
Browse files

MOX: Fix patchset so kernel will build again

parent 445cbe3f
No related branches found
No related tags found
No related merge requests found
From aa0ff9824aacb4c7be15bb4b881a9c50ba749308 Mon Sep 17 00:00:00 2001
From ff51e9ff50bd4b30243b1da60d1e207a12ef15a5 Mon Sep 17 00:00:00 2001
From: Michal Hrusecky <Michal@Hrusecky.net>
Date: Wed, 7 Mar 2018 17:10:32 +0100
Subject: [PATCH] mvebu: Basic MoX support
Subject: [PATCH 2/4] mvebu: Basic MoX support
 
Adding basic support for CZ.NICs MoX board.
 
......@@ -70,15 +70,11 @@ Signed-off-by: Michal Hrusecky <Michal@Hrusecky.net>
...9-crypto-inside-secure-EIP97-support.patch | 841 ++
...cure-make-function-safexcel_try_push.patch | 38 +
...cure-do-not-overwrite-the-threshold-.patch | 40 +
...cure-fix-the-extra-cache-computation.patch | 31 +
...secure-fix-the-cache_len-computation.patch | 33 +
...cure-do-not-process-request-if-no-co.patch | 41 +
...cure-fix-the-invalidation-step-durin.patch | 64 +
...cure-keep-the-requests-push-pop-sync.patch | 136 +
...cure-unmap-the-result-in-the-hash-se.patch | 42 +
...cure-move-hash-result-dma-mapping-to.patch | 115 +
...cure-move-cache-result-dma-mapping-t.patch | 152 +
...cure-wait-for-the-request-to-complet.patch | 34 +
...cure-fix-missing-unlock-on-error-in-.patch | 36 +
...-secure-improve-clock-initialization.patch | 48 +
...cure-fix-clock-resource-by-adding-a-.patch | 146 +
......@@ -97,7 +93,7 @@ Signed-off-by: Michal Hrusecky <Michal@Hrusecky.net>
...-t-guess-support-from-connector-type.patch | 57 +
...rt-for-1000Base-PX-and-1000Base-BX10.patch | 60 +
.../0088-mox-new-prototype-changes.patch | 11463 ++++++++++++++++
90 files changed, 18393 insertions(+), 280 deletions(-)
86 files changed, 18231 insertions(+), 280 deletions(-)
rename target/linux/mvebu/patches-4.14/{402-sfp-display-SFP-module-information.patch => 0001-sfp-display-SFP-module-information.patch} (94%)
rename target/linux/mvebu/patches-4.14/{300-mvneta-tx-queue-workaround.patch => 0002-net-mvneta-tx-queue-workaround.patch} (64%)
rename target/linux/mvebu/patches-4.14/{403-net-mvneta-convert-to-phylink.patch => 0003-net-mvneta-convert-to-phylink.patch} (91%)
......@@ -159,15 +155,11 @@ Signed-off-by: Michal Hrusecky <Michal@Hrusecky.net>
create mode 100644 target/linux/mvebu/patches-4.14/0059-crypto-inside-secure-EIP97-support.patch
create mode 100644 target/linux/mvebu/patches-4.14/0060-crypto-inside-secure-make-function-safexcel_try_push.patch
create mode 100644 target/linux/mvebu/patches-4.14/0061-crypto-inside-secure-do-not-overwrite-the-threshold-.patch
create mode 100644 target/linux/mvebu/patches-4.14/0062-crypto-inside-secure-fix-the-extra-cache-computation.patch
create mode 100644 target/linux/mvebu/patches-4.14/0063-crypto-inside-secure-fix-the-cache_len-computation.patch
create mode 100644 target/linux/mvebu/patches-4.14/0064-crypto-inside-secure-do-not-process-request-if-no-co.patch
create mode 100644 target/linux/mvebu/patches-4.14/0065-crypto-inside-secure-fix-the-invalidation-step-durin.patch
create mode 100644 target/linux/mvebu/patches-4.14/0066-crypto-inside-secure-keep-the-requests-push-pop-sync.patch
create mode 100644 target/linux/mvebu/patches-4.14/0067-crypto-inside-secure-unmap-the-result-in-the-hash-se.patch
create mode 100644 target/linux/mvebu/patches-4.14/0068-crypto-inside-secure-move-hash-result-dma-mapping-to.patch
create mode 100644 target/linux/mvebu/patches-4.14/0069-crypto-inside-secure-move-cache-result-dma-mapping-t.patch
create mode 100644 target/linux/mvebu/patches-4.14/0070-crypto-inside-secure-wait-for-the-request-to-complet.patch
create mode 100644 target/linux/mvebu/patches-4.14/0071-crypto-inside-secure-fix-missing-unlock-on-error-in-.patch
create mode 100644 target/linux/mvebu/patches-4.14/0072-crypto-inside-secure-improve-clock-initialization.patch
create mode 100644 target/linux/mvebu/patches-4.14/0073-crypto-inside-secure-fix-clock-resource-by-adding-a-.patch
......@@ -208,7 +200,7 @@ index 067781b..1baae85 100644
CONFIG_GPIO_PCA953X=y
CONFIG_GPIO_PCA953X_IRQ=y
diff --git a/target/linux/mvebu/image/cortex-a53.mk b/target/linux/mvebu/image/cortex-a53.mk
index 89c3363..4898bd1 100644
index 89c3363..2095a5c 100644
--- a/target/linux/mvebu/image/cortex-a53.mk
+++ b/target/linux/mvebu/image/cortex-a53.mk
@@ -13,6 +13,17 @@ define Device/globalscale-espressobin
......@@ -6886,82 +6878,6 @@ index 0000000..9a84901
+--
+2.17.0
+
diff --git a/target/linux/mvebu/patches-4.14/0062-crypto-inside-secure-fix-the-extra-cache-computation.patch b/target/linux/mvebu/patches-4.14/0062-crypto-inside-secure-fix-the-extra-cache-computation.patch
new file mode 100644
index 0000000..912bf03
--- /dev/null
+++ b/target/linux/mvebu/patches-4.14/0062-crypto-inside-secure-fix-the-extra-cache-computation.patch
@@ -0,0 +1,31 @@
+From 37f48e252747e56e2d8bf55f866ca3c9c89b8f6c Mon Sep 17 00:00:00 2001
+From: Antoine Tenart <antoine.tenart@bootlin.com>
+Date: Tue, 13 Feb 2018 09:26:52 +0100
+Subject: [PATCH 62/88] crypto: inside-secure - fix the extra cache computation
+
+This patch fixes the extra cache computation when the queued data is a
+multiple of a block size. This fixes the hash support in some cases.
+
+Fixes: 809778e02cd4 ("crypto: inside-secure - fix hash when length is a multiple of a block")
+Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+---
+ drivers/crypto/inside-secure/safexcel_hash.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c
+index 33462daa6e1c..56802ef15ba3 100644
+--- a/drivers/crypto/inside-secure/safexcel_hash.c
++++ b/drivers/crypto/inside-secure/safexcel_hash.c
+@@ -198,7 +198,7 @@ static int safexcel_ahash_send_req(struct crypto_async_request *async, int ring,
+ /* If this is not the last request and the queued data
+ * is a multiple of a block, cache the last one for now.
+ */
+- extra = queued - crypto_ahash_blocksize(ahash);
++ extra = crypto_ahash_blocksize(ahash);
+
+ if (extra) {
+ sg_pcopy_to_buffer(areq->src, sg_nents(areq->src),
+--
+2.17.0
+
diff --git a/target/linux/mvebu/patches-4.14/0063-crypto-inside-secure-fix-the-cache_len-computation.patch b/target/linux/mvebu/patches-4.14/0063-crypto-inside-secure-fix-the-cache_len-computation.patch
new file mode 100644
index 0000000..dac5045
--- /dev/null
+++ b/target/linux/mvebu/patches-4.14/0063-crypto-inside-secure-fix-the-cache_len-computation.patch
@@ -0,0 +1,33 @@
+From 9b430aef020aebcf36ff7e8e03faf25fb5ffd874 Mon Sep 17 00:00:00 2001
+From: Antoine Tenart <antoine.tenart@bootlin.com>
+Date: Tue, 13 Feb 2018 09:26:53 +0100
+Subject: [PATCH 63/88] crypto: inside-secure - fix the cache_len computation
+
+This patch fixes the cache length computation as cache_len could end up
+being a negative value. The check between the queued size and the
+block size is updated to reflect the caching mechanism which can cache
+up to a full block size (included!).
+
+Fixes: 809778e02cd4 ("crypto: inside-secure - fix hash when length is a multiple of a block")
+Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+---
+ drivers/crypto/inside-secure/safexcel_hash.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c
+index 56802ef15ba3..1a74fc779305 100644
+--- a/drivers/crypto/inside-secure/safexcel_hash.c
++++ b/drivers/crypto/inside-secure/safexcel_hash.c
+@@ -184,7 +184,7 @@ static int safexcel_ahash_send_req(struct crypto_async_request *async, int ring,
+ int i, queued, len, cache_len, extra, n_cdesc = 0, ret = 0;
+
+ queued = len = req->len - req->processed;
+- if (queued < crypto_ahash_blocksize(ahash))
++ if (queued <= crypto_ahash_blocksize(ahash))
+ cache_len = queued;
+ else
+ cache_len = queued - areq->nbytes;
+--
+2.17.0
+
diff --git a/target/linux/mvebu/patches-4.14/0064-crypto-inside-secure-do-not-process-request-if-no-co.patch b/target/linux/mvebu/patches-4.14/0064-crypto-inside-secure-do-not-process-request-if-no-co.patch
new file mode 100644
index 0000000..1a05ef2
......@@ -7009,76 +6925,6 @@ index 0000000..1a05ef2
+--
+2.17.0
+
diff --git a/target/linux/mvebu/patches-4.14/0065-crypto-inside-secure-fix-the-invalidation-step-durin.patch b/target/linux/mvebu/patches-4.14/0065-crypto-inside-secure-fix-the-invalidation-step-durin.patch
new file mode 100644
index 0000000..0156986
--- /dev/null
+++ b/target/linux/mvebu/patches-4.14/0065-crypto-inside-secure-fix-the-invalidation-step-durin.patch
@@ -0,0 +1,64 @@
+From b1c9dcde8821ed486e78d795146b78b6dba5fea8 Mon Sep 17 00:00:00 2001
+From: Antoine Tenart <antoine.tenart@bootlin.com>
+Date: Tue, 13 Feb 2018 09:26:55 +0100
+Subject: [PATCH 65/88] crypto: inside-secure - fix the invalidation step
+ during cra_exit
+
+When exiting a transformation, the cra_exit() helper is called in each
+driver providing one. The Inside Secure SafeXcel driver has one, which
+is responsible of freeing some areas and of sending one invalidation
+request to the crypto engine, to invalidate the context that was used
+during the transformation.
+
+We could see in some setups (when lots of transformations were being
+used with a short lifetime, and hence lots of cra_exit() calls) NULL
+pointer dereferences and other weird issues. All these issues were
+coming from accessing the tfm context.
+
+The issue is the invalidation request completion is checked using a
+wait_for_completion_interruptible() call in both the cipher and hash
+cra_exit() helpers. In some cases this was interrupted while the
+invalidation request wasn't processed yet. And then cra_exit() returned,
+and its caller was freeing the tfm instance. Only then the request was
+being handled by the SafeXcel driver, which lead to the said issues.
+
+This patch fixes this by using wait_for_completion() calls in these
+specific cases.
+
+Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
+Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+---
+ drivers/crypto/inside-secure/safexcel_cipher.c | 2 +-
+ drivers/crypto/inside-secure/safexcel_hash.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/crypto/inside-secure/safexcel_cipher.c b/drivers/crypto/inside-secure/safexcel_cipher.c
+index 63a8768ed2ae..17a7725a6f6d 100644
+--- a/drivers/crypto/inside-secure/safexcel_cipher.c
++++ b/drivers/crypto/inside-secure/safexcel_cipher.c
+@@ -456,7 +456,7 @@ static int safexcel_cipher_exit_inv(struct crypto_tfm *tfm)
+ queue_work(priv->ring[ring].workqueue,
+ &priv->ring[ring].work_data.work);
+
+- wait_for_completion_interruptible(&result.completion);
++ wait_for_completion(&result.completion);
+
+ if (result.error) {
+ dev_warn(priv->dev,
+diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c
+index 1a74fc779305..791b0931ec6b 100644
+--- a/drivers/crypto/inside-secure/safexcel_hash.c
++++ b/drivers/crypto/inside-secure/safexcel_hash.c
+@@ -493,7 +493,7 @@ static int safexcel_ahash_exit_inv(struct crypto_tfm *tfm)
+ queue_work(priv->ring[ring].workqueue,
+ &priv->ring[ring].work_data.work);
+
+- wait_for_completion_interruptible(&result.completion);
++ wait_for_completion(&result.completion);
+
+ if (result.error) {
+ dev_warn(priv->dev, "hash: completion error (%d)\n",
+--
+2.17.0
+
diff --git a/target/linux/mvebu/patches-4.14/0066-crypto-inside-secure-keep-the-requests-push-pop-sync.patch b/target/linux/mvebu/patches-4.14/0066-crypto-inside-secure-keep-the-requests-push-pop-sync.patch
new file mode 100644
index 0000000..ceb3419
......@@ -7548,46 +7394,6 @@ index 0000000..87507dd
+--
+2.17.0
+
diff --git a/target/linux/mvebu/patches-4.14/0070-crypto-inside-secure-wait-for-the-request-to-complet.patch b/target/linux/mvebu/patches-4.14/0070-crypto-inside-secure-wait-for-the-request-to-complet.patch
new file mode 100644
index 0000000..3d0e939
--- /dev/null
+++ b/target/linux/mvebu/patches-4.14/0070-crypto-inside-secure-wait-for-the-request-to-complet.patch
@@ -0,0 +1,34 @@
+From 904a6185f41d09959a50a3b544edcc94382b0ae2 Mon Sep 17 00:00:00 2001
+From: Antoine Tenart <antoine.tenart@bootlin.com>
+Date: Mon, 26 Feb 2018 14:45:12 +0100
+Subject: [PATCH 70/88] crypto: inside-secure - wait for the request to
+ complete if in the backlog
+
+This patch updates the safexcel_hmac_init_pad() function to also wait
+for completion when the digest return code is -EBUSY, as it would mean
+the request is in the backlog to be processed later.
+
+Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
+Suggested-by: Ofer Heifetz <oferh@marvell.com>
+Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+---
+ drivers/crypto/inside-secure/safexcel_hash.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c
+index cd4596d6f692..9703a4063cfc 100644
+--- a/drivers/crypto/inside-secure/safexcel_hash.c
++++ b/drivers/crypto/inside-secure/safexcel_hash.c
+@@ -832,7 +832,7 @@ static int safexcel_hmac_init_pad(struct ahash_request *areq,
+ init_completion(&result.completion);
+
+ ret = crypto_ahash_digest(areq);
+- if (ret == -EINPROGRESS) {
++ if (ret == -EINPROGRESS || ret == -EBUSY) {
+ wait_for_completion_interruptible(&result.completion);
+ ret = result.error;
+ }
+--
+2.17.0
+
diff --git a/target/linux/mvebu/patches-4.14/0071-crypto-inside-secure-fix-missing-unlock-on-error-in-.patch b/target/linux/mvebu/patches-4.14/0071-crypto-inside-secure-fix-missing-unlock-on-error-in-.patch
new file mode 100644
index 0000000..cae6eb3
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment