[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1612192919-4069-5-git-send-email-richard.gong@linux.intel.com>
Date: Mon, 1 Feb 2021 09:21:57 -0600
From: richard.gong@...ux.intel.com
To: mdf@...nel.org, trix@...hat.com, gregkh@...uxfoundation.org,
linux-fpga@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Richard Gong <richard.gong@...el.com>
Subject: [PATCHv4 4/6] fpga: of-fpga-region: add authenticate-fpga-config property
From: Richard Gong <richard.gong@...el.com>
Add authenticate-fpga-config property to support FPGA bitstream
authentication, which makes sure a signed bitstream has valid signatures.
Signed-off-by: Richard Gong <richard.gong@...el.com>
---
v4: add additional checks to make sure *only* authenticate
v3: no change
v2: changed in alphabetical order
---
drivers/fpga/of-fpga-region.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/drivers/fpga/of-fpga-region.c b/drivers/fpga/of-fpga-region.c
index e405309..5074479 100644
--- a/drivers/fpga/of-fpga-region.c
+++ b/drivers/fpga/of-fpga-region.c
@@ -218,15 +218,25 @@ static struct fpga_image_info *of_fpga_region_parse_ov(
info->overlay = overlay;
- /* Read FPGA region properties from the overlay */
- if (of_property_read_bool(overlay, "partial-fpga-config"))
- info->flags |= FPGA_MGR_PARTIAL_RECONFIG;
+ /*
+ * Read FPGA region properties from the overlay.
+ *
+ * First check the integrity of the bitstream. If the
+ * authentication is passed, the user can perform other
+ * operations.
+ */
+ if (of_property_read_bool(overlay, "authenticate-fpga-config")) {
+ info->flags |= FPGA_MGR_BITSTREAM_AUTHENTICATE;
+ } else {
+ if (of_property_read_bool(overlay, "partial-fpga-config"))
+ info->flags |= FPGA_MGR_PARTIAL_RECONFIG;
- if (of_property_read_bool(overlay, "external-fpga-config"))
- info->flags |= FPGA_MGR_EXTERNAL_CONFIG;
+ if (of_property_read_bool(overlay, "external-fpga-config"))
+ info->flags |= FPGA_MGR_EXTERNAL_CONFIG;
- if (of_property_read_bool(overlay, "encrypted-fpga-config"))
- info->flags |= FPGA_MGR_ENCRYPTED_BITSTREAM;
+ if (of_property_read_bool(overlay, "encrypted-fpga-config"))
+ info->flags |= FPGA_MGR_ENCRYPTED_BITSTREAM;
+ }
if (!of_property_read_string(overlay, "firmware-name",
&firmware_name)) {
--
2.7.4
Powered by blists - more mailing lists