Skip to contentSkip to conversation

common: fitimage support for arbitrary fpga type

PATCH Superseded Dalon Westergreen 4 participants 17 messages Feb 19, 2017 – Feb 20, 2017

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover common: fitimage support for arbitrary fpga type

The intent of these patches is to modify existing fitimage support for fpga configuration to allow configuration of any fpga type supported by the fpga_load command. Note though, that fitimage support for fpga configuration only allows for configuration of the fpga of devnum 0.

Dalon Westergreen (2):
common: image: update boot_get_fpga to support arbitrary fpga image
common: bootm: add support for arbitrary fgpa configuration

 common/bootm.c |  2 +-
 common/image.c | 37 ++++++++++++++++++++++---------------
 2 files changed, 23 insertions(+), 16 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 common: image: update boot_get_fpga to support arbitrary fpga image

The implementation of boot_get_fpga only supported one fpga family. This modification allows for any of the fpga devices supported by fpga_load to be used.

---
 common/image.c | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)
common/image.c +22 -15
index 0f88984..792d371 100644
@@ -1306,7 +1306,7 @@ int boot_get_setup(bootm_headers_t *images, uint8_t arch,
 }
 
 #if IMAGE_ENABLE_FIT
-#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
+#if defined(CONFIG_FPGA)
 int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
 		  uint8_t arch, const ulong *ld_start, ulong * const ld_len)
 {
@@ -1318,7 +1318,8 @@ int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
 	int err;
 	int devnum = 0; /* TODO support multi fpga platforms */
 	const fpga_desc * const desc = fpga_get_desc(devnum);
-	xilinx_desc *desc_xilinx = desc->devdesc;
+	xilinx_desc *desc_xilinx;
+	bitstream_type bstype;
 
 	/* Check to see if the images struct has a FIT configuration */
 	if (!genimg_has_config(images)) {
@@ -1365,22 +1366,28 @@ int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
 			return fit_img_result;
 		}
 
-		if (img_len >= desc_xilinx->size) {
+		switch (desc->devtype) {
+		case fpga_xilinx:
+			desc_xilinx = desc->devdesc;
+			if (img_len >= desc_xilinx->size) {
+				name = "full";
+				bstype = BIT_FULL;
+			} else {
+				name = "partial";
+				bstype = BIT_PARTIAL;
+			}
+			break;
+		default:
 			name = "full";
-			err = fpga_loadbitstream(devnum, (char *)img_data,
-						 img_len, BIT_FULL);
-			if (err)
-				err = fpga_load(devnum, (const void *)img_data,
-						img_len, BIT_FULL);
-		} else {
-			name = "partial";
-			err = fpga_loadbitstream(devnum, (char *)img_data,
-						 img_len, BIT_PARTIAL);
-			if (err)
-				err = fpga_load(devnum, (const void *)img_data,
-						img_len, BIT_PARTIAL);
+			bstype = BIT_FULL;
 		}
 
+		err = fpga_loadbitstream(devnum, (char *)img_data,
+					 img_len, bstype);
+		if (err)
+			err = fpga_load(devnum, (const void *)img_data,
+					img_len, bstype);
+
 		if (err)
 			return err;
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/2 common: image: update boot_get_fpga to support arbitrary fpga image

Quoted 5 lines · Dalon Westergreen

The implementation of boot_get_fpga only supported one fpga family. This modification allows for any of the fpga devices supported by fpga_load to be used.

+CC Xilinx friends :)

Quoted 28 lines
---
 common/image.c | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)
common/image.c +3 -2
index 0f88984..792d371 100644
@@ -1306,7 +1306,7 @@ int boot_get_setup(bootm_headers_t *images, uint8_t arch,
 }
 
 #if IMAGE_ENABLE_FIT
-#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
+#if defined(CONFIG_FPGA)
 int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
 		  uint8_t arch, const ulong *ld_start, ulong * const ld_len)
 {
@@ -1318,7 +1318,8 @@ int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
 	int err;
 	int devnum = 0; /* TODO support multi fpga platforms */
 	const fpga_desc * const desc = fpga_get_desc(devnum);
-	xilinx_desc *desc_xilinx = desc->devdesc;
+	xilinx_desc *desc_xilinx;
+	bitstream_type bstype;
 
 	/* Check to see if the images struct has a FIT configuration */
 	if (!genimg_has_config(images)) {

common/image.c int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images, · line 1369

Quoted 5 lines
common/image.c +1 -1
@@ -1365,22 +1366,28 @@ int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
 			return fit_img_result;
 		}
 
-		if (img_len >= desc_xilinx->size) {
+		switch (desc->devtype) {

Do we need the switch statement at all ? We can have full configuration as a default mode of operation and have something like

if (xilinx) {
if (partial reconfiguration) {
do_special_setup();
}
}

But even better would be to move this platform-dependent stuff into drivers/fpga/ or somewhere there. This is common code, so it shouldn't be here in the first place.

Quoted 37 lines
common/image.c +18 -12
+		case fpga_xilinx:
+			desc_xilinx = desc->devdesc;
+			if (img_len >= desc_xilinx->size) {
+				name = "full";
+				bstype = BIT_FULL;
+			} else {
+				name = "partial";
+				bstype = BIT_PARTIAL;
+			}
+			break;
+		default:
 			name = "full";
-			err = fpga_loadbitstream(devnum, (char *)img_data,
-						 img_len, BIT_FULL);
-			if (err)
-				err = fpga_load(devnum, (const void *)img_data,
-						img_len, BIT_FULL);
-		} else {
-			name = "partial";
-			err = fpga_loadbitstream(devnum, (char *)img_data,
-						 img_len, BIT_PARTIAL);
-			if (err)
-				err = fpga_load(devnum, (const void *)img_data,
-						img_len, BIT_PARTIAL);
+			bstype = BIT_FULL;
 		}
 
+		err = fpga_loadbitstream(devnum, (char *)img_data,
+					 img_len, bstype);
+		if (err)
+			err = fpga_load(devnum, (const void *)img_data,
+					img_len, bstype);
+
 		if (err)
 			return err;
 
Signature · 2 lines
Best regards,
Marek Vasut
#3 lore raw

PATCH 1/2 common: image: update boot_get_fpga to support arbitrary fpga image

Quoted 52 lines · Marek Vasut
Quoted 6 lines · Dalon Westergreen

The implementation of boot_get_fpga only supported one fpga family. This modification allows for any of the fpga devices supported by fpga_load to be used.

+CC Xilinx friends :)

Quoted 36 lines

---
?common/image.c | 37 ++++++++++++++++++++++--------------- ?1 file changed, 22 insertions(+), 15 deletions(-)

common/image.c +0 -0
index 0f88984..792d371 100644
@@ -1306,7 +1306,7 @@ int boot_get_setup(bootm_headers_t *images, uint8_t
 arch,
 ?}

?
?#if IMAGE_ENABLE_FIT

common/image.c +1 -1
-#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
+#if defined(CONFIG_FPGA)

?int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
? ??uint8_t arch, const ulong *ld_start, ulong * const
ld_len)
?{

common/image.c +0 -0
@@ -1318,7 +1318,8 @@ int boot_get_fpga(int argc, char * const argv[],
 bootm_headers_t *images,
 ?	int err;

? int devnum = 0; /* TODO support multi fpga platforms */
? const fpga_desc * const desc = fpga_get_desc(devnum);

common/image.c +2 -1
-	xilinx_desc *desc_xilinx = desc->devdesc;
+	xilinx_desc *desc_xilinx;
+	bitstream_type bstype;

?
? /* Check to see if the images struct has a FIT configuration */
? if (!genimg_has_config(images)) {

common/image.c +0 -0
@@ -1365,22 +1366,28 @@ int boot_get_fpga(int argc, char * const argv[],
 bootm_headers_t *images,
 ?			return fit_img_result;
 ?		}

?

common/image.c int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images, · line 1369

Quoted 2 lines
common/image.c +1 -1
-		if (img_len >= desc_xilinx->size) {
+		switch (desc->devtype) {

Do we need the switch statement at all ? We can have full configuration as a default mode of operation and have something like

Quoted 5 lines

if (xilinx) {
?if (partial reconfiguration) {
? do_special_setup();
?}
}

I only did the switch stuff b/c i envisioned a need for partial image support for socfpga. ?That said, i would suggest, as you mention, moving this to platform specific code and perhaps an indication of the image type in the fitimage.

Quoted 4 lines

But even better would be to move this platform-dependent stuff into drivers/fpga/ or somewhere there. This is common code, so it shouldn't be here in the first place.

My preference would be to only call fpga_load and have the platform specific stuff figure out what they want to do. My next comment would be that perhaps it is best to add an fpgap type or some such in the fitimage to specify the image is a partial image rather than looking at the image size?

Also a consideration is that there should be a means of specifying the fpga devnum somehow in the fitimage? ?it is plausible that a system could have multiple fpgas, no?

--dalon

Quoted 42 lines
Quoted 40 lines
common/image.c +11 -0
+		case fpga_xilinx:
+			desc_xilinx = desc->devdesc;
+			if (img_len >= desc_xilinx->size) {
+				name = "full";
+				bstype = BIT_FULL;
+			} else {
+				name = "partial";
+				bstype = BIT_PARTIAL;
+			}
+			break;
+		default:

? name = "full";

common/image.c +0 -4
-			err = fpga_loadbitstream(devnum, (char *)img_data,
-						?img_len, BIT_FULL);
-			if (err)
-				err = fpga_load(devnum, (const void

*)img_data,

common/image.c +0 -7
-						img_len, BIT_FULL);
-		} else {
-			name = "partial";
-			err = fpga_loadbitstream(devnum, (char *)img_data,
-						?img_len, BIT_PARTIAL);
-			if (err)
-				err = fpga_load(devnum, (const void

*)img_data,

common/image.c +1 -1
-						img_len, BIT_PARTIAL);
+			bstype = BIT_FULL;

? }
?

common/image.c +6 -0
+		err = fpga_loadbitstream(devnum, (char *)img_data,
+					?img_len, bstype);
+		if (err)
+			err = fpga_load(devnum, (const void *)img_data,
+					img_len, bstype);
+

? if (err)
? return err;
?

#4 lore raw

PATCH 1/2 common: image: update boot_get_fpga to support arbitrary fpga image

Quoted 53 lines · Dalon Westergreen
Quoted 52 lines · Marek Vasut
Quoted 6 lines · Dalon Westergreen

The implementation of boot_get_fpga only supported one fpga family. This modification allows for any of the fpga devices supported by fpga_load to be used.

+CC Xilinx friends :)

Quoted 32 lines
---
 common/image.c | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)
common/image.c +1 -1
index 0f88984..792d371 100644
@@ -1306,7 +1306,7 @@ int boot_get_setup(bootm_headers_t *images, uint8_t
 arch,
 }
 
 #if IMAGE_ENABLE_FIT
-#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
+#if defined(CONFIG_FPGA)
 int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
 		  uint8_t arch, const ulong *ld_start, ulong * const

ld_len)
{

common/image.c +2 -1
@@ -1318,7 +1318,8 @@ int boot_get_fpga(int argc, char * const argv[],
 bootm_headers_t *images,
 	int err;
 	int devnum = 0; /* TODO support multi fpga platforms */
 	const fpga_desc * const desc = fpga_get_desc(devnum);
-	xilinx_desc *desc_xilinx = desc->devdesc;
+	xilinx_desc *desc_xilinx;
+	bitstream_type bstype;
 
 	/* Check to see if the images struct has a FIT configuration */
common/image.c +0 -0
 	if (!genimg_has_config(images)) {

common/image.c int boot_get_fpga(int argc, char * const argv[], · line 1370

Quoted 6 lines
common/image.c +1 -1
@@ -1365,22 +1366,28 @@ int boot_get_fpga(int argc, char * const argv[],
 bootm_headers_t *images,
 			return fit_img_result;
 		}
 
-		if (img_len >= desc_xilinx->size) {
+		switch (desc->devtype) {

Do we need the switch statement at all ? We can have full configuration as a default mode of operation and have something like

Quoted 8 lines
Quoted 5 lines

if (xilinx) {
if (partial reconfiguration) {
do_special_setup();
}
}

I only did the switch stuff b/c i envisioned a need for partial image support for socfpga.

That'd be seriously cool :)

Quoted 3 lines

That said, i would suggest, as you mention, moving
this to platform specific code and perhaps an indication of the image type in the fitimage.

driver-specific code . It doesn't need to know the imagetype, just that the blob that you passed in is a partial-reconfiguration blob. I never really worked with P/R though, do you need some other metadata for that or is it contained in that P/R bitstream blob already ?

Quoted 6 lines
Quoted 4 lines

But even better would be to move this platform-dependent stuff into drivers/fpga/ or somewhere there. This is common code, so it shouldn't be here in the first place.

My preference would be to only call fpga_load and have the platform

s/platform/driver/

Quoted 1 line

specific stuff figure out what they want to do.

Agreed

Quoted 4 lines

My next comment would be
that perhaps it is best to add an fpgap type or some such in the fitimage to specify the image is a partial image rather than looking at the image size?

Hmmmm, see my question above. If the driver cannot discern it from the blob, maybe a DT-alike property would work. ie. the image entry would also have a "xlnx,partial-reconfiguration" property or somesuch .

Quoted 3 lines

Also a consideration is that there should be a means of specifying the fpga devnum somehow in the fitimage? it is plausible that a system could have multiple fpgas, no?

Hmmmm, yeeeeees, system with multiple FPGAs, I like that :-) Probably a similar DT prop in the fitimage indicating where this bitstream goes would do, like loadaddress for kernel, it'd be FPGA devid for bitstream.

Quoted 44 lines

--dalon

Quoted 42 lines
Quoted 40 lines
common/image.c +18 -12
+		case fpga_xilinx:
+			desc_xilinx = desc->devdesc;
+			if (img_len >= desc_xilinx->size) {
+				name = "full";
+				bstype = BIT_FULL;
+			} else {
+				name = "partial";
+				bstype = BIT_PARTIAL;
+			}
+			break;
+		default:
 			name = "full";
-			err = fpga_loadbitstream(devnum, (char *)img_data,
-						 img_len, BIT_FULL);
-			if (err)
-				err = fpga_load(devnum, (const void
 *)img_data,
-						img_len, BIT_FULL);
-		} else {
-			name = "partial";
-			err = fpga_loadbitstream(devnum, (char *)img_data,
-						 img_len, BIT_PARTIAL);
-			if (err)
-				err = fpga_load(devnum, (const void
 *)img_data,
-						img_len, BIT_PARTIAL);
+			bstype = BIT_FULL;
 		}
 
+		err = fpga_loadbitstream(devnum, (char *)img_data,
+					 img_len, bstype);
+		if (err)
+			err = fpga_load(devnum, (const void *)img_data,
+					img_len, bstype);
+
common/image.c +0 -0
 		if (err)
 			return err;
Signature · 2 lines
Best regards,
Marek Vasut
#5 lore raw

PATCH 1/2 common: image: update boot_get_fpga to support arbitrary fpga image

Quoted 72 lines · Marek Vasut
Quoted 59 lines · Dalon Westergreen
Quoted 57 lines · Marek Vasut
Quoted 7 lines · Dalon Westergreen

The implementation of boot_get_fpga only supported one fpga family. This modification allows for any of the fpga devices supported by fpga_load to be used.

+CC Xilinx friends :)

Quoted 39 lines

---
?common/image.c | 37 ++++++++++++++++++++++--------------- ?1 file changed, 22 insertions(+), 15 deletions(-)

common/image.c +0 -0
index 0f88984..792d371 100644
@@ -1306,7 +1306,7 @@ int boot_get_setup(bootm_headers_t *images,

uint8_t
arch,
?}
?
?#if IMAGE_ENABLE_FIT

common/image.c +1 -1
-#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
+#if defined(CONFIG_FPGA)

?int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
? ??uint8_t arch, const ulong *ld_start, ulong * const
ld_len)
?{

common/image.c +0 -0
@@ -1318,7 +1318,8 @@ int boot_get_fpga(int argc, char * const argv[],
 bootm_headers_t *images,
 ?	int err;

? int devnum = 0; /* TODO support multi fpga platforms */
? const fpga_desc * const desc = fpga_get_desc(devnum);

common/image.c +2 -1
-	xilinx_desc *desc_xilinx = desc->devdesc;
+	xilinx_desc *desc_xilinx;
+	bitstream_type bstype;

?
? /* Check to see if the images struct has a FIT configuration */
? if (!genimg_has_config(images)) {

common/image.c +0 -0
@@ -1365,22 +1366,28 @@ int boot_get_fpga(int argc, char * const argv[],
 bootm_headers_t *images,
 ?			return fit_img_result;
 ?		}

?

common/image.c int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images, · line 1369

Quoted 2 lines
common/image.c +1 -1
-		if (img_len >= desc_xilinx->size) {
+		switch (desc->devtype) {

Do we need the switch statement at all ? We can have full configuration as a default mode of operation and have something like

Quoted 8 lines
Quoted 5 lines

if (xilinx) {
?if (partial reconfiguration) {
? do_special_setup();
?}
}

I only did the switch stuff b/c i envisioned a need for partial image support for socfpga.

That'd be seriously cool :)

Quoted 1 line
Quoted 8 lines
Quoted 3 lines

That said, i would suggest, as you mention, moving
this to platform specific code and perhaps an indication of the image type in the fitimage.

driver-specific code . It doesn't need to know the imagetype, just that the blob that you passed in is a partial-reconfiguration blob. I never really worked with P/R though, do you need some other metadata for that or is it contained in that P/R bitstream blob already ?

as far as i understand it, it is all in the blob. ?All that is needed is knowing whether the blob is a full or partial image. ?X seems to just use the image size to determine this, but that means having a table of all devices and their respective full image size. ?seems simpler to just specify the image type is partial or not in the fitimage.

Quoted 17 lines
Quoted 8 lines
Quoted 6 lines

But even better would be to move this platform-dependent stuff into drivers/fpga/ or somewhere there. This is common code, so it shouldn't be here in the first place.

My preference would be to only call fpga_load and have the platform

s/platform/driver/

Quoted 2 lines

specific stuff figure out what they want to do.

Agreed

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

My next comment would be
that perhaps it is best to add an fpgap type or some such in the fitimage to specify the image is a partial image rather than looking at the image size?

Hmmmm, see my question above. If the driver cannot discern it from the blob, maybe a DT-alike property would work. ie. the image entry would also have a "xlnx,partial-reconfiguration" property or somesuch .

I dont think the property need be fpga vendor specific.?

--dalon

Quoted 60 lines
Quoted 4 lines

Also a consideration is that there should be a means of specifying the fpga devnum somehow in the fitimage???it is plausible that a system could have multiple fpgas, no?

Hmmmm, yeeeeees, system with multiple FPGAs, I like that :-) Probably a similar DT prop in the fitimage indicating where this bitstream goes would do, like loadaddress for kernel, it'd be FPGA devid for bitstream.

Quoted 49 lines

--dalon

Quoted 46 lines
Quoted 44 lines
common/image.c +11 -0
+		case fpga_xilinx:
+			desc_xilinx = desc->devdesc;
+			if (img_len >= desc_xilinx->size) {
+				name = "full";
+				bstype = BIT_FULL;
+			} else {
+				name = "partial";
+				bstype = BIT_PARTIAL;
+			}
+			break;
+		default:

? name = "full";

common/image.c +0 -1
-			err = fpga_loadbitstream(devnum, (char

*)img_data,

common/image.c +0 -3
-						?img_len, BIT_FULL);
-			if (err)
-				err = fpga_load(devnum, (const void

*)img_data,

common/image.c +0 -4
-						img_len, BIT_FULL);
-		} else {
-			name = "partial";
-			err = fpga_loadbitstream(devnum, (char

*)img_data,

common/image.c +0 -3
-						?img_len, BIT_PARTIAL);
-			if (err)
-				err = fpga_load(devnum, (const void

*)img_data,

common/image.c +1 -1
-						img_len, BIT_PARTIAL);
+			bstype = BIT_FULL;

? }
?

common/image.c +6 -0
+		err = fpga_loadbitstream(devnum, (char *)img_data,
+					?img_len, bstype);
+		if (err)
+			err = fpga_load(devnum, (const void *)img_data,
+					img_len, bstype);
+

? if (err)
? return err;
?

#6 lore raw

PATCH 1/2 common: image: update boot_get_fpga to support arbitrary fpga image

Quoted 82 lines · Dalon Westergreen
Quoted 72 lines · Marek Vasut
Quoted 59 lines · Dalon Westergreen
Quoted 57 lines · Marek Vasut
Quoted 7 lines · Dalon Westergreen

The implementation of boot_get_fpga only supported one fpga family. This modification allows for any of the fpga devices supported by fpga_load to be used.

+CC Xilinx friends :)

Quoted 35 lines

---
 common/image.c | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)
common/image.c +0 -0
index 0f88984..792d371 100644
@@ -1306,7 +1306,7 @@ int boot_get_setup(bootm_headers_t *images,

uint8_t
arch,
}

#if IMAGE_ENABLE_FIT

common/image.c +1 -1
-#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
+#if defined(CONFIG_FPGA)
 int boot_get_fpga(int argc, char * const argv[], bootm_headers_t

*images,
uint8_t arch, const ulong *ld_start, ulong * const
ld_len)
{

common/image.c +2 -1
@@ -1318,7 +1318,8 @@ int boot_get_fpga(int argc, char * const argv[],
 bootm_headers_t *images,
 	int err;
 	int devnum = 0; /* TODO support multi fpga platforms */
 	const fpga_desc * const desc = fpga_get_desc(devnum);
-	xilinx_desc *desc_xilinx = desc->devdesc;
+	xilinx_desc *desc_xilinx;
+	bitstream_type bstype;
 
 	/* Check to see if the images struct has a FIT configuration */
common/image.c +0 -0
 	if (!genimg_has_config(images)) {

common/image.c int boot_get_fpga(int argc, char * const argv[], · line 1370

Quoted 6 lines
common/image.c +1 -1
@@ -1365,22 +1366,28 @@ int boot_get_fpga(int argc, char * const argv[],
 bootm_headers_t *images,
 			return fit_img_result;
 		}
 
-		if (img_len >= desc_xilinx->size) {
+		switch (desc->devtype) {

Do we need the switch statement at all ? We can have full configuration as a default mode of operation and have something like

Quoted 8 lines
Quoted 5 lines

if (xilinx) {
if (partial reconfiguration) {
do_special_setup();
}
}

I only did the switch stuff b/c i envisioned a need for partial image support for socfpga.

That'd be seriously cool :)

Quoted 1 line
Quoted 8 lines
Quoted 3 lines

That said, i would suggest, as you mention, moving
this to platform specific code and perhaps an indication of the image type in the fitimage.

driver-specific code . It doesn't need to know the imagetype, just that the blob that you passed in is a partial-reconfiguration blob. I never really worked with P/R though, do you need some other metadata for that or is it contained in that P/R bitstream blob already ?

Quoted 5 lines

as far as i understand it, it is all in the blob. All that is needed is knowing whether the blob is a full or partial image. X seems to just use the image size to determine this, but that means having a table of all devices and their respective full image size. seems simpler to just specify the image type is partial or not in the fitimage.

Can't you extract that info from the RBF though ? But then again, extending the fitImage format for this would be fine IMO.

btw is spelling the X in it's entirety somehow forbidden in A ? :-)

Quoted 22 lines
Quoted 22 lines
Quoted 8 lines
Quoted 6 lines

But even better would be to move this platform-dependent stuff into drivers/fpga/ or somewhere there. This is common code, so it shouldn't be here in the first place.

My preference would be to only call fpga_load and have the platform

s/platform/driver/

Quoted 2 lines

specific stuff figure out what they want to do.

Agreed

Quoted 5 lines

My next comment would be
that perhaps it is best to add an fpgap type or some such in the fitimage to specify the image is a partial image rather than looking at the image size?

Quoted 5 lines
Quoted 3 lines

Hmmmm, see my question above. If the driver cannot discern it from the blob, maybe a DT-alike property would work. ie. the image entry would also have a "xlnx,partial-reconfiguration" property or somesuch .

I dont think the property need be fpga vendor specific.

Indeed.

[...]

Signature · 2 lines
Best regards,
Marek Vasut
#7 lore raw

PATCH 1/2 common: image: update boot_get_fpga to support arbitrary fpga image

Quoted 104 lines · Marek Vasut
Quoted 95 lines · Dalon Westergreen
Quoted 88 lines · Marek Vasut
Quoted 68 lines · Dalon Westergreen
Quoted 65 lines · Marek Vasut
Quoted 8 lines · Dalon Westergreen

The implementation of boot_get_fpga only supported one fpga family. This modification allows for any of the fpga devices supported by fpga_load to be used.

+CC Xilinx friends :)

Quoted 44 lines

---
?common/image.c | 37 ++++++++++++++++++++++--------------- ?1 file changed, 22 insertions(+), 15 deletions(-)

common/image.c +0 -0
index 0f88984..792d371 100644
@@ -1306,7 +1306,7 @@ int boot_get_setup(bootm_headers_t *images,

uint8_t
arch,
?}
?
?#if IMAGE_ENABLE_FIT

common/image.c +1 -1
-#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
+#if defined(CONFIG_FPGA)

?int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
? ??uint8_t arch, const ulong *ld_start, ulong *
const
ld_len)
?{

common/image.c +0 -0
@@ -1318,7 +1318,8 @@ int boot_get_fpga(int argc, char * const
 argv[],
 bootm_headers_t *images,
 ?	int err;

? int devnum = 0; /* TODO support multi fpga platforms */
? const fpga_desc * const desc = fpga_get_desc(devnum);

common/image.c +2 -1
-	xilinx_desc *desc_xilinx = desc->devdesc;
+	xilinx_desc *desc_xilinx;
+	bitstream_type bstype;

?
? /* Check to see if the images struct has a FIT
configuration */
? if (!genimg_has_config(images)) {

common/image.c +0 -0
@@ -1365,22 +1366,28 @@ int boot_get_fpga(int argc, char * const
 argv[],
 bootm_headers_t *images,
 ?			return fit_img_result;
 ?		}

?

common/image.c int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images, · line 1369

Quoted 2 lines
common/image.c +1 -1
-		if (img_len >= desc_xilinx->size) {
+		switch (desc->devtype) {

Do we need the switch statement at all ? We can have full configuration
as a default mode of operation and have something like

Quoted 8 lines
Quoted 5 lines

if (xilinx) {
?if (partial reconfiguration) {
? do_special_setup();
?}
}

I only did the switch stuff b/c i envisioned a need for partial image support for socfpga.

That'd be seriously cool :)

Quoted 6 lines

That said, i would suggest, as you mention, moving
this to platform specific code and perhaps an indication of the image type
in the fitimage.

Quoted 4 lines

driver-specific code . It doesn't need to know the imagetype, just that the blob that you passed in is a partial-reconfiguration blob. I never really worked with P/R though, do you need some other metadata for that or is it contained in that P/R bitstream blob already ?

Quoted 7 lines

as far as i understand it, it is all in the blob.??All that is needed is knowing
whether the blob is a full or partial image.??X seems to just use the image size
to determine this, but that means having a table of all devices and their respective full image size.??seems simpler to just specify the image type is partial or not in the fitimage.

Quoted 4 lines

Can't you extract that info from the RBF though ? But then again, extending the fitImage format for this would be fine IMO.

btw is spelling the X in it's entirety somehow forbidden in A ? :-)

Ah, but you forget, we are now I... :)

Quoted 39 lines
Quoted 29 lines
Quoted 29 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

But even better would be to move this platform-dependent stuff into drivers/fpga/ or somewhere there. This is common code, so it shouldn't be here in the first place.

My preference would be to only call fpga_load and have the platform

s/platform/driver/

Quoted 3 lines

specific stuff figure out what they want to do.

Agreed

Quoted 7 lines

My next comment would be
that perhaps it is best to add an fpgap type or some such in the fitimage
to specify the image is a partial image rather than looking at the image size?

Quoted 5 lines
Quoted 3 lines

Hmmmm, see my question above. If the driver cannot discern it from the blob, maybe a DT-alike property would work. ie. the image entry would also have a "xlnx,partial-reconfiguration" property or somesuch .

I dont think the property need be fpga vendor specific.?

Indeed.

[...]

#8 lore raw

PATCH 1/2 common: image: update boot_get_fpga to support arbitrary fpga image

Quoted 105 lines · Dalon Westergreen
Quoted 104 lines · Marek Vasut
Quoted 102 lines · Dalon Westergreen
Quoted 88 lines · Marek Vasut
Quoted 68 lines · Dalon Westergreen
Quoted 65 lines · Marek Vasut
Quoted 8 lines · Dalon Westergreen

The implementation of boot_get_fpga only supported one fpga family. This modification allows for any of the fpga devices supported by fpga_load to be used.

+CC Xilinx friends :)

Quoted 39 lines


---
 common/image.c | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)
common/image.c +0 -0
index 0f88984..792d371 100644
@@ -1306,7 +1306,7 @@ int boot_get_setup(bootm_headers_t *images,

uint8_t
arch,
}

#if IMAGE_ENABLE_FIT

common/image.c +1 -1
-#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
+#if defined(CONFIG_FPGA)
 int boot_get_fpga(int argc, char * const argv[], bootm_headers_t

*images,
uint8_t arch, const ulong *ld_start, ulong *
const
ld_len)
{

common/image.c +2 -1
@@ -1318,7 +1318,8 @@ int boot_get_fpga(int argc, char * const
 argv[],
 bootm_headers_t *images,
 	int err;
 	int devnum = 0; /* TODO support multi fpga platforms */
 	const fpga_desc * const desc = fpga_get_desc(devnum);
-	xilinx_desc *desc_xilinx = desc->devdesc;
+	xilinx_desc *desc_xilinx;
+	bitstream_type bstype;
 

/* Check to see if the images struct has a FIT
configuration */

common/image.c +0 -0
 	if (!genimg_has_config(images)) {

common/image.c int boot_get_fpga(int argc, char * const · line 1371

Quoted 7 lines
common/image.c +1 -1
@@ -1365,22 +1366,28 @@ int boot_get_fpga(int argc, char * const
 argv[],
 bootm_headers_t *images,
 			return fit_img_result;
 		}
 
-		if (img_len >= desc_xilinx->size) {
+		switch (desc->devtype) {

Do we need the switch statement at all ? We can have full configuration
as a default mode of operation and have something like

Quoted 8 lines
Quoted 5 lines

if (xilinx) {
if (partial reconfiguration) {
do_special_setup();
}
}

I only did the switch stuff b/c i envisioned a need for partial image support for socfpga.

That'd be seriously cool :)

Quoted 6 lines

That said, i would suggest, as you mention, moving
this to platform specific code and perhaps an indication of the image type
in the fitimage.

Quoted 4 lines

driver-specific code . It doesn't need to know the imagetype, just that the blob that you passed in is a partial-reconfiguration blob. I never really worked with P/R though, do you need some other metadata for that or is it contained in that P/R bitstream blob already ?

as far as i understand it, it is all in the blob. All that is needed is knowing
whether the blob is a full or partial image. X seems to just use the image size
to determine this, but that means having a table of all devices and their respective full image size. seems simpler to just specify the image type is partial or not in the fitimage.

Quoted 6 lines
Quoted 4 lines

Can't you extract that info from the RBF though ? But then again, extending the fitImage format for this would be fine IMO.

btw is spelling the X in it's entirety somehow forbidden in A ? :-)

Ah, but you forget, we are now I... :)

So it's now A+I ... ? [1] ? :-)
[1] http://jisho.org/search/%E6%84%9B

Looking forward to V2 of this , we seem to have some good stuff coming up.

Signature · 2 lines
Best regards,
Marek Vasut
#9 lore raw

PATCH 1/2 common: image: update boot_get_fpga to support arbitrary fpga image

Quoted 109 lines · Marek Vasut
Quoted 108 lines · Dalon Westergreen
Quoted 107 lines · Marek Vasut
Quoted 95 lines · Dalon Westergreen
Quoted 88 lines · Marek Vasut
Quoted 68 lines · Dalon Westergreen
Quoted 65 lines · Marek Vasut
Quoted 8 lines · Dalon Westergreen

The implementation of boot_get_fpga only supported one fpga family. This modification allows for any of the fpga devices supported by fpga_load to be used.

+CC Xilinx friends :)

Quoted 39 lines


---
 common/image.c | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)
common/image.c +0 -0
index 0f88984..792d371 100644
@@ -1306,7 +1306,7 @@ int boot_get_setup(bootm_headers_t *images,

uint8_t
arch,
}

#if IMAGE_ENABLE_FIT

common/image.c +1 -1
-#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
+#if defined(CONFIG_FPGA)
 int boot_get_fpga(int argc, char * const argv[], bootm_headers_t

*images,
uint8_t arch, const ulong *ld_start, ulong *
const
ld_len)
{

common/image.c +2 -1
@@ -1318,7 +1318,8 @@ int boot_get_fpga(int argc, char * const
 argv[],
 bootm_headers_t *images,
 	int err;
 	int devnum = 0; /* TODO support multi fpga platforms */
 	const fpga_desc * const desc = fpga_get_desc(devnum);
-	xilinx_desc *desc_xilinx = desc->devdesc;
+	xilinx_desc *desc_xilinx;
+	bitstream_type bstype;
 

/* Check to see if the images struct has a FIT
configuration */

common/image.c +0 -0
 	if (!genimg_has_config(images)) {

common/image.c int boot_get_fpga(int argc, char * const · line 1371

Quoted 7 lines
common/image.c +1 -1
@@ -1365,22 +1366,28 @@ int boot_get_fpga(int argc, char * const
 argv[],
 bootm_headers_t *images,
 			return fit_img_result;
 		}
 
-		if (img_len >= desc_xilinx->size) {
+		switch (desc->devtype) {

Do we need the switch statement at all ? We can have full configuration
as a default mode of operation and have something like

Quoted 8 lines
Quoted 5 lines

if (xilinx) {
if (partial reconfiguration) {
do_special_setup();
}
}

I only did the switch stuff b/c i envisioned a need for partial image support for socfpga.

That'd be seriously cool :)

Quoted 6 lines

That said, i would suggest, as you mention, moving
this to platform specific code and perhaps an indication of the image type
in the fitimage.

Quoted 4 lines

driver-specific code . It doesn't need to know the imagetype, just that the blob that you passed in is a partial-reconfiguration blob. I never really worked with P/R though, do you need some other metadata for that or is it contained in that P/R bitstream blob already ?

Quoted 7 lines

as far as i understand it, it is all in the blob. All that is needed is knowing
whether the blob is a full or partial image. X seems to just use the image size
to determine this, but that means having a table of all devices and their respective full image size. seems simpler to just specify the image type is partial or not in the fitimage.

Can't you extract that info from the RBF though ? But then again, extending the fitImage format for this would be fine IMO.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

btw is spelling the X in it's entirety somehow forbidden in A ? :-)

Ah, but you forget, we are now I... :)

So it's now A+I ... ? [1] ? :-)
[1] http://jisho.org/search/%E6%84%9B

Looking forward to V2 of this , we seem to have some good stuff coming up.

I can only have some thoughts about it but if you work for I you should use that I email. The same in A case and I do something for X that's why I use X email.

Thanks,
Michal

#10 lore raw

PATCH 1/2 common: image: update boot_get_fpga to support arbitrary fpga image

Quoted 140 lines · Michal Simek
Quoted 139 lines · Marek Vasut
Quoted 136 lines · Dalon Westergreen
Quoted 128 lines · Marek Vasut
Quoted 114 lines · Dalon Westergreen
Quoted 103 lines · Marek Vasut
Quoted 85 lines · Dalon Westergreen
Quoted 75 lines · Marek Vasut
Quoted 11 lines · Dalon Westergreen

The implementation of boot_get_fpga only supported one fpga family.
This modification allows for any of the fpga devices supported by
fpga_load to be used.

+CC Xilinx friends :)

Quoted 50 lines

---
?common/image.c | 37 ++++++++++++++++++++++--------------- ?1 file changed, 22 insertions(+), 15 deletions(-)

common/image.c +0 -0
index 0f88984..792d371 100644
@@ -1306,7 +1306,7 @@ int boot_get_setup(bootm_headers_t
 *images,

uint8_t
arch,
?}
?
?#if IMAGE_ENABLE_FIT

common/image.c +1 -1
-#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
+#if defined(CONFIG_FPGA)

?int boot_get_fpga(int argc, char * const argv[],
bootm_headers_t
*images,
? ??uint8_t arch, const ulong *ld_start, ulong
*
const
ld_len)
?{

common/image.c +0 -0
@@ -1318,7 +1318,8 @@ int boot_get_fpga(int argc, char * const
 argv[],
 bootm_headers_t *images,
 ?	int err;

? int devnum = 0; /* TODO support multi fpga platforms
*/
? const fpga_desc * const desc = fpga_get_desc(devnum);

common/image.c +2 -1
-	xilinx_desc *desc_xilinx = desc->devdesc;
+	xilinx_desc *desc_xilinx;
+	bitstream_type bstype;

?
? /* Check to see if the images struct has a FIT
configuration */
? if (!genimg_has_config(images)) {

common/image.c +0 -0
@@ -1365,22 +1366,28 @@ int boot_get_fpga(int argc, char *

const
argv[],
bootm_headers_t *images,
? return fit_img_result;
? }
?

common/image.c

Quoted 2 lines
common/image.c +1 -1
-		if (img_len >= desc_xilinx->size) {
+		switch (desc->devtype) {

Do we need the switch statement at all ? We can have full configuration
as a default mode of operation and have something like

Quoted 5 lines

if (xilinx) {
?if (partial reconfiguration) {
? do_special_setup();
?}
}

Quoted 3 lines

I only did the switch stuff b/c i envisioned a need for partial image
support for socfpga.

That'd be seriously cool :)

Quoted 8 lines

That said, i would suggest, as you mention, moving this to platform specific code and perhaps an indication of the image
type
in the fitimage.

Quoted 7 lines

driver-specific code . It doesn't need to know the imagetype, just that
the blob that you passed in is a partial-reconfiguration blob. I never
really worked with P/R though, do you need some other metadata for that
or is it contained in that P/R bitstream blob already ?

Quoted 11 lines

as far as i understand it, it is all in the blob.??All that is needed is
knowing
whether the blob is a full or partial image.??X seems to just use the image
size
to determine this, but that means having a table of all devices and their
respective full image size.??seems simpler to just specify the image type is
partial or not in the fitimage.

Quoted 4 lines

Can't you extract that info from the RBF though ? But then again, extending the fitImage format for this would be fine IMO.

btw is spelling the X in it's entirety somehow forbidden in A ? :-)

Ah, but you forget, we are now I... :)

Quoted 8 lines
Quoted 4 lines

So it's now A+I ... ? [1] ? :-)
[1] http://jisho.org/search/%E6%84%9B

Looking forward to V2 of this , we seem to have some good stuff coming up.

I can only have some thoughts about it but if you work for I you should use that I email. The same in A case and I do something for X that's why I use X email.

Thanks for the feedback, although i work for intel, i am doing this purely for interest. ?As such, and since working on uboot is absolutely not in my job function, i am required to use a personal email.

--dalon

Quoted 3 lines

Thanks,
Michal

#11 lore raw

PATCH 1/2 common: image: update boot_get_fpga to support arbitrary fpga image

In reply to Dalon Westergreen
Quoted 82 lines · Dalon Westergreen
Quoted 72 lines · Marek Vasut
Quoted 59 lines · Dalon Westergreen
Quoted 57 lines · Marek Vasut
Quoted 7 lines · Dalon Westergreen

The implementation of boot_get_fpga only supported one fpga family. This modification allows for any of the fpga devices supported by fpga_load to be used.

+CC Xilinx friends :)

Quoted 35 lines

---
 common/image.c | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)
common/image.c +0 -0
index 0f88984..792d371 100644
@@ -1306,7 +1306,7 @@ int boot_get_setup(bootm_headers_t *images,

uint8_t
arch,
}

#if IMAGE_ENABLE_FIT

common/image.c +1 -1
-#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
+#if defined(CONFIG_FPGA)
 int boot_get_fpga(int argc, char * const argv[], bootm_headers_t

*images,
uint8_t arch, const ulong *ld_start, ulong * const
ld_len)
{

common/image.c +2 -1
@@ -1318,7 +1318,8 @@ int boot_get_fpga(int argc, char * const argv[],
 bootm_headers_t *images,
 	int err;
 	int devnum = 0; /* TODO support multi fpga platforms */
 	const fpga_desc * const desc = fpga_get_desc(devnum);
-	xilinx_desc *desc_xilinx = desc->devdesc;
+	xilinx_desc *desc_xilinx;
+	bitstream_type bstype;
 
 	/* Check to see if the images struct has a FIT configuration */
common/image.c +0 -0
 	if (!genimg_has_config(images)) {

common/image.c int boot_get_fpga(int argc, char * const argv[], · line 1370

Quoted 6 lines
common/image.c +1 -1
@@ -1365,22 +1366,28 @@ int boot_get_fpga(int argc, char * const argv[],
 bootm_headers_t *images,
 			return fit_img_result;
 		}
 
-		if (img_len >= desc_xilinx->size) {
+		switch (desc->devtype) {

Do we need the switch statement at all ? We can have full configuration as a default mode of operation and have something like

Quoted 8 lines
Quoted 5 lines

if (xilinx) {
if (partial reconfiguration) {
do_special_setup();
}
}

I only did the switch stuff b/c i envisioned a need for partial image support for socfpga.

That'd be seriously cool :)

Quoted 1 line
Quoted 8 lines
Quoted 3 lines

That said, i would suggest, as you mention, moving
this to platform specific code and perhaps an indication of the image type in the fitimage.

driver-specific code . It doesn't need to know the imagetype, just that the blob that you passed in is a partial-reconfiguration blob. I never really worked with P/R though, do you need some other metadata for that or is it contained in that P/R bitstream blob already ?

Quoted 5 lines

as far as i understand it, it is all in the blob. All that is needed is knowing whether the blob is a full or partial image. X seems to just use the image size to determine this, but that means having a table of all devices and their respective full image size. seems simpler to just specify the image type is partial or not in the fitimage.

We did that for zynq when we did that for the first time. But not for zynqmp. Zynq is maybe still using it but it shouldn't now. It is not 100% reliable way. Definitely having DT property is the best option because you can add sort of "nop" which extend bitstream size and does nothing which breaks that checking.

For full u-boot there is loadb, loadbp, load and loadp to distinguish it.

Thanks,
Michal

Thanks,
Michal

#12 lore raw

PATCH 1/2 common: image: update boot_get_fpga to support arbitrary fpga image

Quoted 104 lines · Michal Simek
Quoted 95 lines · Dalon Westergreen
Quoted 88 lines · Marek Vasut
Quoted 68 lines · Dalon Westergreen
Quoted 65 lines · Marek Vasut
Quoted 8 lines · Dalon Westergreen

The implementation of boot_get_fpga only supported one fpga family. This modification allows for any of the fpga devices supported by fpga_load to be used.

+CC Xilinx friends :)

Quoted 44 lines

---
?common/image.c | 37 ++++++++++++++++++++++--------------- ?1 file changed, 22 insertions(+), 15 deletions(-)

common/image.c +0 -0
index 0f88984..792d371 100644
@@ -1306,7 +1306,7 @@ int boot_get_setup(bootm_headers_t *images,

uint8_t
arch,
?}
?
?#if IMAGE_ENABLE_FIT

common/image.c +1 -1
-#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
+#if defined(CONFIG_FPGA)

?int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
? ??uint8_t arch, const ulong *ld_start, ulong *
const
ld_len)
?{

common/image.c +0 -0
@@ -1318,7 +1318,8 @@ int boot_get_fpga(int argc, char * const
 argv[],
 bootm_headers_t *images,
 ?	int err;

? int devnum = 0; /* TODO support multi fpga platforms */
? const fpga_desc * const desc = fpga_get_desc(devnum);

common/image.c +2 -1
-	xilinx_desc *desc_xilinx = desc->devdesc;
+	xilinx_desc *desc_xilinx;
+	bitstream_type bstype;

?
? /* Check to see if the images struct has a FIT
configuration */
? if (!genimg_has_config(images)) {

common/image.c +0 -0
@@ -1365,22 +1366,28 @@ int boot_get_fpga(int argc, char * const
 argv[],
 bootm_headers_t *images,
 ?			return fit_img_result;
 ?		}

?

common/image.c int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images, · line 1369

Quoted 2 lines
common/image.c +1 -1
-		if (img_len >= desc_xilinx->size) {
+		switch (desc->devtype) {

Do we need the switch statement at all ? We can have full configuration
as a default mode of operation and have something like

Quoted 8 lines
Quoted 5 lines

if (xilinx) {
?if (partial reconfiguration) {
? do_special_setup();
?}
}

I only did the switch stuff b/c i envisioned a need for partial image support for socfpga.

That'd be seriously cool :)

Quoted 6 lines

That said, i would suggest, as you mention, moving
this to platform specific code and perhaps an indication of the image type
in the fitimage.

Quoted 4 lines

driver-specific code . It doesn't need to know the imagetype, just that the blob that you passed in is a partial-reconfiguration blob. I never really worked with P/R though, do you need some other metadata for that or is it contained in that P/R bitstream blob already ?

Quoted 7 lines

as far as i understand it, it is all in the blob.??All that is needed is knowing
whether the blob is a full or partial image.??X seems to just use the image size
to determine this, but that means having a table of all devices and their respective full image size.??seems simpler to just specify the image type is partial or not in the fitimage.

Quoted 7 lines

We did that for zynq when we did that for the first time. But not for zynqmp. Zynq is maybe still using it but it shouldn't now. It is not 100% reliable way. Definitely having DT property is the best option because you can add sort of "nop" which extend bitstream size and does nothing which breaks that checking.

For full u-boot there is loadb, loadbp, load and loadp to distinguish it.

That brings up an interesting point, right now the?fpga_loadbitstream doesn't follow the same method as fpga_load for allowing multiple FPGA types to be supported simultaneously. ?Would it not be prudent to move in that direction? I believe only xilinx implements this right now.

--dalon

Quoted 6 lines

Thanks,
Michal

Thanks,
Michal

#13 lore raw

PATCH 1/2 common: image: update boot_get_fpga to support arbitrary fpga image

Quoted 111 lines · Dalon Westergreen
Quoted 110 lines · Michal Simek
Quoted 95 lines · Dalon Westergreen
Quoted 88 lines · Marek Vasut
Quoted 68 lines · Dalon Westergreen
Quoted 65 lines · Marek Vasut
Quoted 8 lines · Dalon Westergreen

The implementation of boot_get_fpga only supported one fpga family. This modification allows for any of the fpga devices supported by fpga_load to be used.

+CC Xilinx friends :)

Quoted 39 lines


---
 common/image.c | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)
common/image.c +0 -0
index 0f88984..792d371 100644
@@ -1306,7 +1306,7 @@ int boot_get_setup(bootm_headers_t *images,

uint8_t
arch,
}

#if IMAGE_ENABLE_FIT

common/image.c +1 -1
-#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
+#if defined(CONFIG_FPGA)
 int boot_get_fpga(int argc, char * const argv[], bootm_headers_t

*images,
uint8_t arch, const ulong *ld_start, ulong *
const
ld_len)
{

common/image.c +2 -1
@@ -1318,7 +1318,8 @@ int boot_get_fpga(int argc, char * const
 argv[],
 bootm_headers_t *images,
 	int err;
 	int devnum = 0; /* TODO support multi fpga platforms */
 	const fpga_desc * const desc = fpga_get_desc(devnum);
-	xilinx_desc *desc_xilinx = desc->devdesc;
+	xilinx_desc *desc_xilinx;
+	bitstream_type bstype;
 

/* Check to see if the images struct has a FIT
configuration */

common/image.c +0 -0
 	if (!genimg_has_config(images)) {

common/image.c int boot_get_fpga(int argc, char * const · line 1371

Quoted 7 lines
common/image.c +1 -1
@@ -1365,22 +1366,28 @@ int boot_get_fpga(int argc, char * const
 argv[],
 bootm_headers_t *images,
 			return fit_img_result;
 		}
 
-		if (img_len >= desc_xilinx->size) {
+		switch (desc->devtype) {

Do we need the switch statement at all ? We can have full configuration
as a default mode of operation and have something like

Quoted 8 lines
Quoted 5 lines

if (xilinx) {
if (partial reconfiguration) {
do_special_setup();
}
}

I only did the switch stuff b/c i envisioned a need for partial image support for socfpga.

That'd be seriously cool :)

Quoted 6 lines

That said, i would suggest, as you mention, moving
this to platform specific code and perhaps an indication of the image type
in the fitimage.

Quoted 4 lines

driver-specific code . It doesn't need to know the imagetype, just that the blob that you passed in is a partial-reconfiguration blob. I never really worked with P/R though, do you need some other metadata for that or is it contained in that P/R bitstream blob already ?

Quoted 7 lines

as far as i understand it, it is all in the blob. All that is needed is knowing
whether the blob is a full or partial image. X seems to just use the image size
to determine this, but that means having a table of all devices and their respective full image size. seems simpler to just specify the image type is partial or not in the fitimage.

We did that for zynq when we did that for the first time. But not for zynqmp. Zynq is maybe still using it but it shouldn't now. It is not 100% reliable way. Definitely having DT property is the best option because you can add sort of "nop" which extend bitstream size and does nothing which breaks that checking.

Quoted 6 lines
Quoted 1 line

For full u-boot there is loadb, loadbp, load and loadp to distinguish it.

That brings up an interesting point, right now the fpga_loadbitstream doesn't follow the same method as fpga_load for allowing multiple FPGA types to be supported simultaneously. Would it not be prudent to move in that direction? I believe only xilinx implements this right now.

loadbitstream is there for a long time which is in general just header bitstream header parser written in pretty bad way.
Right now we are adding support for encrypted and authenticated images and for that we are adding fpga loads command where you specify by flag if you want to pass encrypted or authenticated image and keys.

There is also loadmk which should be improved a lot exactly by what you are trying to do. It means we should wrap bitstreams with flags which says what it is inside.
On the other hand having separate commands it is easy for testing.

Definitely I am open to improve this subsystem to make it more flexible.

Thanks,
Michal

#14 lore raw

PATCH 1/2 common: image: update boot_get_fpga to support arbitrary fpga image

Hi all,

Quoted 1 line · Michal Simek

Definitely I am open to improve this subsystem to make it more flexible.

Over at linux-fpga ([1]) we're currently discussing the idea of coming up with a header
format (vendor neutral) that we stitch onto the fpga image to allow the fpga-mgr to derive certain features of the image from the image itself (i.e. is the image encrypted,
compressed, ...).

We're trying to come up with an extensible format that would allow us to add stuff like
encryption keys etc.

Cheers,

Moritz

[1] https://patchwork.kernel.org/patch/9574399/

#15 lore raw

PATCH 1/2 common: image: update boot_get_fpga to support arbitrary fpga image

Quoted 4 lines · Moritz Fischer

Hi all,

On Mon, Feb 20, 2017 at 6:59 AM, Michal Simek <[email protected]> wrote:

Quoted 8 lines
Quoted 1 line

Definitely I am open to improve this subsystem to make it more flexible.

Over at linux-fpga ([1]) we're currently discussing the idea of coming up with a header
format (vendor neutral) that we stitch onto the fpga image to allow the fpga-mgr to derive certain features of the image from the image itself (i.e. is the image encrypted,
compressed, ...).

Can you CC me on that discussion ? I think it'd be for the best to use DT for the header format, it's documented and vendor-neutral already.

Quoted 3 lines

We're trying to come up with an extensible format that would allow us to add stuff like
encryption keys etc.

Nothing like a NIH format :)

Quoted 7 lines

Cheers,

Moritz

[1] https://patchwork.kernel.org/patch/9574399/

Signature · 2 lines
Best regards,
Marek Vasut
#16 lore raw

PATCH 2/2 common: bootm: add support for arbitrary fgpa configuration

In reply to Dalon Westergreen

This adds support for fpga configuration data in fitimages for any fpga device supported by fpga_load. At this point fitimages only support configuration of fpga images for fpga devnum 0.

---
 common/bootm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/bootm.c +1 -1
index b2c0912..4a4b47c 100644
@@ -248,7 +248,7 @@ int bootm_find_images(int flag, int argc, char * const argv[])
 #endif
 
 #if IMAGE_ENABLE_FIT
-#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
+#if defined(CONFIG_FPGA)
 	/* find bitstreams */
 	ret = boot_get_fpga(argc, argv, &images, IH_ARCH_DEFAULT,
 			    NULL, NULL);
Signature · 1 line
2.7.4