[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210609055232.4501-2-nava.manne@xilinx.com>
Date: Wed, 9 Jun 2021 11:22:29 +0530
From: Nava kishore Manne <nava.manne@...inx.com>
To: <robh+dt@...nel.org>, <michal.simek@...inx.com>, <mdf@...nel.org>,
<trix@...hat.com>, <nava.manne@...inx.com>, <arnd@...db.de>,
<rajan.vaja@...inx.com>, <gregkh@...uxfoundation.org>,
<amit.sunil.dhamne@...inx.com>, <tejas.patel@...inx.com>,
<zou_wei@...wei.com>, <lakshmi.sai.krishna.potthuri@...inx.com>,
<ravi.patel@...inx.com>, <iwamatsu@...auri.org>,
<wendy.liang@...inx.com>, <devicetree@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linux-fpga@...r.kernel.org>,
<git@...inx.com>, <chinnikishore369@...il.com>
Subject: [RFC v2 1/4] drivers: firmware: Add user encrypted key load API support
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@...inx.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
Powered by blists - more mailing lists