From: Nava kishore Manne <hidden> Date: 2021-06-09 05:53:10
This patch adds user-key encrypted FPGA Image loading support
to the framework.
Signed-off-by: Nava kishore Manne <redacted>
---
Changes for v2:
-Both DT properties ie; encrypted-key-name and encrypted-user-key-fpga-config
are targeted to use for the same use cases but ideally encrypted-key-name
is enough to serve the purpose so updated the code to remove the unwanted
encrypted-user-key-fpga-config property dependency as suggested by Rob
drivers/fpga/fpga-mgr.c | 15 +++++++++++++++
drivers/fpga/of-fpga-region.c | 11 +++++++++++
include/linux/fpga/fpga-mgr.h | 7 +++++++
3 files changed, 33 insertions(+)
From: Nava kishore Manne <hidden> Date: 2021-06-09 05:53:13
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 <redacted>
---
Changes for v2:
-None.
drivers/firmware/xilinx/zynqmp.c | 17 +++++++++++++++++
include/linux/firmware/xlnx-zynqmp.h | 7 +++++++
2 files changed, 24 insertions(+)
From: Nava kishore Manne <hidden> Date: 2021-06-09 05:53:19
This patch Adds ‘encrypted-key-name’ property to
support user-key encrypted bitstream loading
use case.
Signed-off-by: Nava kishore Manne <redacted>
---
Changes for v2:
-Both DT properties ie; encrypted-key-name and encrypted-user-key-fpga-config
are targeted to use for the same use cases but ideally encrypted-key-name
is enough to serve the purpose so updated the file to remove the unwanted
encrypted-user-key-fpga-config property as suggested by Rob.
Documentation/devicetree/bindings/fpga/fpga-region.txt | 3 +++
1 file changed, 3 insertions(+)
@@ -177,6 +177,9 @@ Optional properties: it indicates that the FPGA has already been programmed with this image. If this property is in an overlay targeting a FPGA region, it is a request to program the FPGA with that image.+- encrypted-key-name : should contain the name of an encrypted key file located+ on the firmware search path. It will be used to decrypt the FPGA image+ file with user-key. - fpga-bridges : should contain a list of phandles to FPGA Bridges that must be controlled during FPGA programming along with the parent FPGA bridge. This property is optional if the FPGA Manager handles the bridges.
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
@@ -33,6 +35,8 @@ static int zynqmp_fpga_ops_write_init(struct fpga_manager *mgr,priv=mgr->priv;priv->flags=info->flags;+priv->key_buf=info->enc_key_buf;+priv->key_size=info->enc_key_buf_size;return0;}
@@ -41,9 +45,9 @@ static int zynqmp_fpga_ops_write(struct fpga_manager *mgr,constchar*buf,size_tsize){structzynqmp_fpga_priv*priv;-dma_addr_tdma_addr;+dma_addr_tdma_addr,key_addr;u32eemi_flags=0;-char*kbuf;+char*kbuf,*key_kbuf;intret;priv=mgr->priv;
@@ -54,13 +58,29 @@ static int zynqmp_fpga_ops_write(struct fpga_manager *mgr,memcpy(kbuf,buf,size);+if(priv->flags&FPGA_MGR_ENCRYPTED_USER_KEY_BITSTREAM){+eemi_flags|=XILINX_ZYNQMP_PM_FPGA_ENC_USER_KEY;+key_kbuf=dma_alloc_coherent(priv->dev,size,&key_addr,+GFP_KERNEL);+if(!key_kbuf)+return-ENOMEM;+memcpy(key_kbuf,priv->key_buf,priv->key_size);+}+wmb();/* ensure all writes are done before initiate FW call */if(priv->flags&FPGA_MGR_PARTIAL_RECONFIG)eemi_flags|=XILINX_ZYNQMP_PM_FPGA_PARTIAL;+if(priv->flags&FPGA_MGR_ENCRYPTED_USER_KEY_BITSTREAM)+ret=zynqmp_pm_fpga_enc_key_load(key_addr,priv->key_size);+ret=zynqmp_pm_fpga_load(dma_addr,size,eemi_flags);+if(priv->flags&FPGA_MGR_ENCRYPTED_USER_KEY_BITSTREAM)+dma_free_coherent(priv->dev,priv->key_size,+key_kbuf,key_addr);+dma_free_coherent(priv->dev,size,kbuf,dma_addr);returnret;
On Wed, Jun 09, 2021 at 11:22:29AM +0530, Nava kishore Manne wrote:
This patch adds user encrypted key load API to support
User key encrypted images loading use cases from Linux.
What is "user key encrypted images"? Do we need more documentation here
for what this is and how to use it?
And why is "User" capitalized?
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On Wed, Jun 09, 2021 at 11:22:28AM +0530, Nava kishore Manne wrote:
This patch series adds supports user-key encrypted FPGA Image loading using
FPGA Manager framework.
Why is this series "RFC"? Do you not think it is good enough to be
merged?
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On Wed, Jun 09, 2021 at 11:22:30AM +0530, Nava kishore Manne wrote:
quoted hunk
This patch Adds ‘encrypted-key-name’ property to
support user-key encrypted bitstream loading
use case.
Signed-off-by: Nava kishore Manne <redacted>
---
Changes for v2:
-Both DT properties ie; encrypted-key-name and encrypted-user-key-fpga-config
are targeted to use for the same use cases but ideally encrypted-key-name
is enough to serve the purpose so updated the file to remove the unwanted
encrypted-user-key-fpga-config property as suggested by Rob.
Documentation/devicetree/bindings/fpga/fpga-region.txt | 3 +++
1 file changed, 3 insertions(+)
@@ -177,6 +177,9 @@ Optional properties: it indicates that the FPGA has already been programmed with this image. If this property is in an overlay targeting a FPGA region, it is a request to program the FPGA with that image.+- encrypted-key-name : should contain the name of an encrypted key file located+ on the firmware search path. It will be used to decrypt the FPGA image+ file with user-key.
What is the format this "user-key" is in? Where is the documentation
for how to use this type of thing?
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Nava kishore Manne <hidden> Date: 2021-07-09 08:33:58
Hi Greg,
Thanks for providing the review comments.
Please find my response inline.
-----Original Message-----
From: Greg KH <gregkh@linuxfoundation.org>
Sent: Wednesday, June 9, 2021 3:25 PM
To: Nava kishore Manne <redacted>
Cc: robh+dt@kernel.org; Michal Simek <redacted>;
mdf@kernel.org; trix@redhat.com; arnd@arndb.de; Rajan Vaja
[off-list ref]; Amit Sunil Dhamne [off-list ref];
Tejas Patel [off-list ref]; zou_wei@huawei.com; Sai Krishna
Potthuri [off-list ref]; Ravi Patel [off-list ref];
iwamatsu@nigauri.org; Jiaying Liang [off-list ref];
devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
kernel@vger.kernel.org; linux-fpga@vger.kernel.org; git [off-list ref];
chinnikishore369@gmail.com
Subject: Re: [RFC v2 0/4]Fpga: adds support to load the user-key encrypted
FPGA Image loading
On Wed, Jun 09, 2021 at 11:22:28AM +0530, Nava kishore Manne wrote:
quoted
This patch series adds supports user-key encrypted FPGA Image loading
using FPGA Manager framework.
Why is this series "RFC"? Do you not think it is good enough to be merged?
As it's a new feature to the fpga manager subsystem. So i have posted it as RFC to get the inputs.
Regards,
Navakishore.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Nava kishore Manne <hidden> Date: 2021-07-09 08:49:04
Hi Greg,
Thanks for providing the review comments.
Please find my response inline.
-----Original Message-----
From: Greg KH <gregkh@linuxfoundation.org>
Sent: Wednesday, June 9, 2021 3:26 PM
To: Nava kishore Manne <redacted>
Cc: robh+dt@kernel.org; Michal Simek <redacted>;
mdf@kernel.org; trix@redhat.com; arnd@arndb.de; Rajan Vaja
[off-list ref]; Amit Sunil Dhamne [off-list ref];
Tejas Patel [off-list ref]; zou_wei@huawei.com; Sai Krishna
Potthuri [off-list ref]; Ravi Patel [off-list ref];
iwamatsu@nigauri.org; Jiaying Liang [off-list ref];
devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
kernel@vger.kernel.org; linux-fpga@vger.kernel.org; git [off-list ref];
chinnikishore369@gmail.com
Subject: Re: [RFC v2 2/4] fpga: Add new property to support user-key
encrypted bitstream loading
On Wed, Jun 09, 2021 at 11:22:30AM +0530, Nava kishore Manne wrote:
quoted
This patch Adds ‘encrypted-key-name’ property to support user-key
encrypted bitstream loading use case.
Signed-off-by: Nava kishore Manne <redacted>
---
Changes for v2:
-Both DT properties ie; encrypted-key-name and encrypted-user-
key-fpga-config
quoted
are targeted to use for the same use cases but ideally encrypted-
key-name
quoted
is enough to serve the purpose so updated the file to remove the
unwanted
quoted
encrypted-user-key-fpga-config property as suggested by Rob.
Documentation/devicetree/bindings/fpga/fpga-region.txt | 3 +++
1 file changed, 3 insertions(+)
@@ -177,6 +177,9 @@ Optional properties: it indicates that the FPGA has already been programmed with this
image.
quoted
If this property is in an overlay targeting a FPGA region, it is a
request to program the FPGA with that image.
+- encrypted-key-name : should contain the name of an encrypted key file
located
quoted
+ on the firmware search path. It will be used to decrypt the FPGA
image
quoted
+ file with user-key.
What is the format this "user-key" is in? Where is the documentation for
how to use this type of thing?
Will fix user key format issues in v3.
Will update this binding doc with user key encrypted bitstream loading use case info.
Use case info:
Reconfiguration with encrypted image using AES key
In this case, the FPGA Manager will decrypt the configuration data and
placed it into the programmable logic. To decrypt the configuration data
it uses AES key provided by the user.
DT Overlay contains:
/dts-v1/;
/plugin/;
&fpga_region0 {
#address-cells = <1>;
#size-cells = <1>;
firmware-name = "versal-gpio.bin";
encrypted-key-name = “Aes-key.nky”
gpio1: gpio@40000000 {
compatible = "xlnx,xps-gpio-1.00.a";
reg = <0x40000000 0x10000>;
gpio-controller;
#gpio-cells = <0x2>;
xlnx,gpio-width= <0x6>;
};
};
Regards,
Navakishore.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On Fri, Jul 09, 2021 at 08:41:35AM +0000, Nava kishore Manne wrote:
Hi Greg,
Thanks for providing the review comments.
Please find my response inline.
quoted
-----Original Message-----
From: Greg KH <gregkh@linuxfoundation.org>
Sent: Wednesday, June 9, 2021 3:25 PM
To: Nava kishore Manne <redacted>
Cc: robh+dt@kernel.org; Michal Simek <redacted>;
mdf@kernel.org; trix@redhat.com; arnd@arndb.de; Rajan Vaja
[off-list ref]; Amit Sunil Dhamne [off-list ref];
Tejas Patel [off-list ref]; zou_wei@huawei.com; Sai Krishna
Potthuri [off-list ref]; Ravi Patel [off-list ref];
iwamatsu@nigauri.org; Jiaying Liang [off-list ref];
devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
kernel@vger.kernel.org; linux-fpga@vger.kernel.org; git [off-list ref];
chinnikishore369@gmail.com
Subject: Re: [RFC v2 1/4] drivers: firmware: Add user encrypted key load API
support
On Wed, Jun 09, 2021 at 11:22:29AM +0530, Nava kishore Manne wrote:
quoted
This patch adds user encrypted key load API to support User key
encrypted images loading use cases from Linux.
What is "user key encrypted images"? Do we need more documentation
here for what this is and how to use it?
Xilinx bitstream writer, using AES, encrypts the bitstream. This feature allows user to encrypt bitstream using 256-bit AES encryption in cipher block chaining (CBC) mode.
User can supply a 128-bit Initial Vector and 256-bit key(user key).
Please provide the needed information in the changelog comment.