mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jolly Shah <jolly.shah@xilinx.com>
To: ard.biesheuvel@linaro.org, mingo@kernel.org,
	gregkh@linuxfoundation.org, matt@codeblueprint.co.uk,
	sudeep.holla@arm.com, hkallweit1@gmail.com,
	keescook@chromium.org, dmitry.torokhov@gmail.com,
	michal.simek@xilinx.com
Cc: rajanv@xilinx.com, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Rajan Vaja <rajan.vaja@xilinx.com>,
	Jolly Shah <jolly.shah@xilinx.com>
Subject: [PATCH v5 19/25] firmware: xilinx: Remove eemi ops for aes engine
Date: Fri, 24 Apr 2020 13:58:01 -0700	[thread overview]
Message-ID: <1587761887-4279-20-git-send-email-jolly.shah@xilinx.com> (raw)
In-Reply-To: <1587761887-4279-1-git-send-email-jolly.shah@xilinx.com>

From: Rajan Vaja <rajan.vaja@xilinx.com>

Use direct function call for aes engine instead of using eemi ops.

Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
Signed-off-by: Jolly Shah <jolly.shah@xilinx.com>
---
 drivers/crypto/xilinx/zynqmp-aes-gcm.c | 12 +-----------
 drivers/firmware/xilinx/zynqmp.c       |  4 ++--
 include/linux/firmware/xlnx-zynqmp.h   |  6 +++++-
 3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/crypto/xilinx/zynqmp-aes-gcm.c b/drivers/crypto/xilinx/zynqmp-aes-gcm.c
index 09f7f46..d0a0daf 100644
--- a/drivers/crypto/xilinx/zynqmp-aes-gcm.c
+++ b/drivers/crypto/xilinx/zynqmp-aes-gcm.c
@@ -46,7 +46,6 @@ struct zynqmp_aead_drv_ctx {
 	} alg;
 	struct device *dev;
 	struct crypto_engine *engine;
-	const struct zynqmp_eemi_ops *eemi_ops;
 };
 
 struct zynqmp_aead_hw_req {
@@ -92,9 +91,6 @@ static int zynqmp_aes_aead_cipher(struct aead_request *req)
 
 	drv_ctx = container_of(alg, struct zynqmp_aead_drv_ctx, alg.aead);
 
-	if (!drv_ctx->eemi_ops->aes)
-		return -ENOTSUPP;
-
 	if (tfm_ctx->keysrc == ZYNQMP_AES_KUP_KEY)
 		dma_size = req->cryptlen + ZYNQMP_AES_KEY_SIZE
 			   + GCM_AES_IV_SIZE;
@@ -136,7 +132,7 @@ static int zynqmp_aes_aead_cipher(struct aead_request *req)
 		hwreq->key = 0;
 	}
 
-	drv_ctx->eemi_ops->aes(dma_addr_hw_req, &status);
+	zynqmp_pm_aes_engine(dma_addr_hw_req, &status);
 
 	if (status) {
 		switch (status) {
@@ -388,12 +384,6 @@ static int zynqmp_aes_aead_probe(struct platform_device *pdev)
 	else
 		return -ENODEV;
 
-	aes_drv_ctx.eemi_ops = zynqmp_pm_get_eemi_ops();
-	if (IS_ERR(aes_drv_ctx.eemi_ops)) {
-		dev_err(dev, "Failed to get ZynqMP EEMI interface\n");
-		return PTR_ERR(aes_drv_ctx.eemi_ops);
-	}
-
 	err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(ZYNQMP_DMA_BIT_MASK));
 	if (err < 0) {
 		dev_err(dev, "No usable DMA configuration\n");
diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index 0c5c8bc..e6e7b63 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -795,7 +795,7 @@ EXPORT_SYMBOL_GPL(zynqmp_pm_set_requirement);
  *
  * Return:	Returns status, either success or error code.
  */
-static int zynqmp_pm_aes_engine(const u64 address, u32 *out)
+int zynqmp_pm_aes_engine(const u64 address, u32 *out)
 {
 	u32 ret_payload[PAYLOAD_ARG_CNT];
 	int ret;
@@ -810,11 +810,11 @@ static int zynqmp_pm_aes_engine(const u64 address, u32 *out)
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(zynqmp_pm_aes_engine);
 
 static const struct zynqmp_eemi_ops eemi_ops = {
 	.fpga_load = zynqmp_pm_fpga_load,
 	.fpga_get_status = zynqmp_pm_fpga_get_status,
-	.aes = zynqmp_pm_aes_engine,
 };
 
 /**
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
index 5927f6f..11d7aef 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -296,7 +296,6 @@ struct zynqmp_pm_query_data {
 struct zynqmp_eemi_ops {
 	int (*fpga_load)(const u64 address, const u32 size, const u32 flags);
 	int (*fpga_get_status)(u32 *value);
-	int (*aes)(const u64 address, u32 *out);
 };
 
 int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 arg0, u32 arg1,
@@ -333,6 +332,7 @@ int zynqmp_pm_release_node(const u32 node);
 int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities,
 			      const u32 qos,
 			      const enum zynqmp_pm_request_ack ack);
+int zynqmp_pm_aes_engine(const u64 address, u32 *out);
 #else
 static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void)
 {
@@ -446,6 +446,10 @@ static inline int zynqmp_pm_set_requirement(const u32 node,
 {
 	return -ENODEV;
 }
+static inline int zynqmp_pm_aes_engine(const u64 address, u32 *out)
+{
+	return -ENODEV;
+}
 #endif
 
 #endif /* __FIRMWARE_ZYNQMP_H__ */
-- 
2.7.4


  parent reply	other threads:[~2020-04-24 20:59 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 20:57 [PATCH v5 00/25] firmware: xilinx: Add xilinx specific sysfs interface Jolly Shah
2020-04-24 20:57 ` [PATCH v5 01/25] firmware: xilinx: Remove eemi ops for get_api_version Jolly Shah
2020-04-24 20:57 ` [PATCH v5 02/25] firmware: xilinx: Remove eemi ops for get_chipid Jolly Shah
2020-04-24 20:57 ` [PATCH v5 03/25] firmware: xilinx: Remove eemi ops for query_data Jolly Shah
2020-04-24 20:57 ` [PATCH v5 04/25] firmware: xilinx: Remove eemi ops for clock_enable Jolly Shah
2020-04-24 20:57 ` [PATCH v5 05/25] firmware: xilinx: Remove eemi ops for clock_disable Jolly Shah
2020-04-24 20:57 ` [PATCH v5 06/25] firmware: xilinx: Remove eemi ops for clock_getstate Jolly Shah
2020-04-24 20:57 ` [PATCH v5 07/25] firmware: xilinx: Remove eemi ops for clock_setdivider Jolly Shah
2020-04-24 20:57 ` [PATCH v5 08/25] firmware: xilinx: Remove eemi ops for clock_getdivider Jolly Shah
2020-04-24 20:57 ` [PATCH v5 09/25] firmware: xilinx: Remove eemi ops for clock set/get rate Jolly Shah
2020-04-24 20:57 ` [PATCH v5 10/25] firmware: xilinx: Remove eemi ops for clock set/get parent Jolly Shah
2020-04-24 20:57 ` [PATCH v5 11/25] firmware: xilinx: Use APIs instead of IOCTLs Jolly Shah
2020-04-24 20:57 ` [PATCH v5 12/25] firmware: xilinx: Remove eemi ops for reset_assert Jolly Shah
2020-04-24 20:57 ` [PATCH v5 13/25] firmware: xilinx: Remove eemi ops for reset_get_status Jolly Shah
2020-04-24 20:57 ` [PATCH v5 14/25] firmware: xilinx: Remove eemi ops for init_finalize Jolly Shah
2020-04-24 20:57 ` [PATCH v5 15/25] firmware: xilinx: Remove eemi ops for set_suspend_mode Jolly Shah
2020-04-24 20:57 ` [PATCH v5 16/25] firmware: xilinx: Remove eemi ops for request_node Jolly Shah
2020-04-24 20:57 ` [PATCH v5 17/25] firmware: xilinx: Remove eemi ops for release_node Jolly Shah
2020-04-24 20:58 ` [PATCH v5 18/25] firmware: xilinx: Remove eemi ops for set_requirement Jolly Shah
2020-04-24 20:58 ` Jolly Shah [this message]
2020-04-24 20:58 ` [PATCH v5 20/25] firmware: xilinx: Remove eemi ops for fpga related APIs Jolly Shah
2020-04-24 20:58 ` [PATCH v5 21/25] firmware: xilinx: Add APIs to read/write GGS/PGGS registers Jolly Shah
2020-04-24 20:58 ` [PATCH v5 22/25] firmware: xilinx: Add sysfs interface Jolly Shah
2020-04-24 20:58 ` [PATCH v5 23/25] firmware: xilinx: Add system shutdown API interface Jolly Shah
2020-04-24 20:58 ` [PATCH v5 24/25] firmware: xilinx: Add sysfs to set shutdown scope Jolly Shah
2020-04-24 20:58 ` [PATCH v5 25/25] firmware: xilinx: Add sysfs and API to set boot health status Jolly Shah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1587761887-4279-20-git-send-email-jolly.shah@xilinx.com \
    --to=jolly.shah@xilinx.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hkallweit1@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=michal.simek@xilinx.com \
    --cc=mingo@kernel.org \
    --cc=rajan.vaja@xilinx.com \
    --cc=rajanv@xilinx.com \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®