linux-fpga.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nava kishore Manne <nava.manne@xilinx.com>
To: <robh+dt@kernel.org>, <michal.simek@xilinx.com>, <mdf@kernel.org>,
	<trix@redhat.com>, <nava.manne@xilinx.com>, <arnd@arndb.de>,
	<rajan.vaja@xilinx.com>, <gregkh@linuxfoundation.org>,
	<amit.sunil.dhamne@xilinx.com>, <tejas.patel@xilinx.com>,
	<zou_wei@huawei.com>, <lakshmi.sai.krishna.potthuri@xilinx.com>,
	<ravi.patel@xilinx.com>, <iwamatsu@nigauri.org>,
	<wendy.liang@xilinx.com>, <devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-fpga@vger.kernel.org>,
	<git@xilinx.com>, <chinnikishore369@gmail.com>
Subject: [RFC v2 1/4] drivers: firmware: Add user encrypted key load API support
Date: Wed, 9 Jun 2021 11:22:29 +0530	[thread overview]
Message-ID: <20210609055232.4501-2-nava.manne@xilinx.com> (raw)
In-Reply-To: <20210609055232.4501-1-nava.manne@xilinx.com>

This patch adds user encrypted key load API to support
User key encrypted images loading use cases from Linux.

Signed-off-by: Nava kishore Manne <nava.manne@xilinx.com>
---
Changes for v2:
		-None.

 drivers/firmware/xilinx/zynqmp.c     | 17 +++++++++++++++++
 include/linux/firmware/xlnx-zynqmp.h |  7 +++++++
 2 files changed, 24 insertions(+)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index 15b138326ecc..2fa5687a75f8 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -787,6 +787,23 @@ int zynqmp_pm_fpga_load(const u64 address, const u32 size, const u32 flags)
 }
 EXPORT_SYMBOL_GPL(zynqmp_pm_fpga_load);
 
+/**
+ * zynqmp_pm_fpga_key_load - Perform to load the bitstream encrypted key
+ * @address:    Address to write
+ * @size:       encrypted key size
+ *
+ * This function provides access to pmufw. To transfer
+ * the required encrypted key.
+ *
+ * Return: Returns status, either success or error+reason
+ */
+int zynqmp_pm_fpga_enc_key_load(const u64 address, const u32 size)
+{
+	return zynqmp_pm_invoke_fn(PM_ENC_KEY_LOAD, lower_32_bits(address),
+				   upper_32_bits(address), size, 0, NULL);
+}
+EXPORT_SYMBOL_GPL(zynqmp_pm_fpga_enc_key_load);
+
 /**
  * zynqmp_pm_fpga_get_status - Read value from PCAP status register
  * @value: Value to read
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
index 9d1a5c175065..7aa9ad40ff53 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -91,6 +91,7 @@ enum pm_api_id {
 	PM_CLOCK_GETPARENT = 44,
 	PM_SECURE_AES = 47,
 	PM_FEATURE_CHECK = 63,
+	PM_ENC_KEY_LOAD = 64,
 };
 
 /* PMU-FW return status codes */
@@ -411,6 +412,7 @@ int zynqmp_pm_pinctrl_get_config(const u32 pin, const u32 param,
 				 u32 *value);
 int zynqmp_pm_pinctrl_set_config(const u32 pin, const u32 param,
 				 u32 value);
+int zynqmp_pm_fpga_enc_key_load(const u64 address, const u32 size);
 #else
 static inline int zynqmp_pm_get_api_version(u32 *version)
 {
@@ -622,6 +624,11 @@ static inline int zynqmp_pm_pinctrl_set_config(const u32 pin, const u32 param,
 {
 	return -ENODEV;
 }
+
+static inline int zynqmp_pm_fpga_enc_key_load(const u64 address, const u32 size)
+{
+	return -ENODEV;
+}
 #endif
 
 #endif /* __FIRMWARE_ZYNQMP_H__ */
-- 
2.17.1


  reply	other threads:[~2021-06-09  5:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09  5:52 [RFC v2 0/4]Fpga: adds support to load the user-key encrypted FPGA Image loading Nava kishore Manne
2021-06-09  5:52 ` Nava kishore Manne [this message]
2021-06-09  9:55   ` [RFC v2 1/4] drivers: firmware: Add user encrypted key load API support Greg KH
2021-07-09  8:41     ` Nava kishore Manne
2021-07-09  9:49       ` Greg KH
2021-06-09  5:52 ` [RFC v2 2/4] fpga: Add new property to support user-key encrypted bitstream loading Nava kishore Manne
2021-06-09  9:56   ` Greg KH
2021-07-09  8:48     ` Nava kishore Manne
2021-06-09  5:52 ` [RFC v2 3/4] drivers: fpga: Add user-key encrypted FPGA Image loading support Nava kishore Manne
2021-06-09  5:52 ` [RFC v2 4/4] fpga: zynqmp: " Nava kishore Manne
2021-06-09  9:55 ` [RFC v2 0/4]Fpga: adds support to load the user-key encrypted FPGA Image loading Greg KH
2021-07-09  8:33   ` Nava kishore Manne

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=20210609055232.4501-2-nava.manne@xilinx.com \
    --to=nava.manne@xilinx.com \
    --cc=amit.sunil.dhamne@xilinx.com \
    --cc=arnd@arndb.de \
    --cc=chinnikishore369@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=git@xilinx.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=iwamatsu@nigauri.org \
    --cc=lakshmi.sai.krishna.potthuri@xilinx.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdf@kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=rajan.vaja@xilinx.com \
    --cc=ravi.patel@xilinx.com \
    --cc=robh+dt@kernel.org \
    --cc=tejas.patel@xilinx.com \
    --cc=trix@redhat.com \
    --cc=wendy.liang@xilinx.com \
    --cc=zou_wei@huawei.com \
    --subject='Re: [RFC v2 1/4] drivers: firmware: Add user encrypted key load API support' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).