refactor(smc_fuzz): performance enhancement

Add the ability to return integer rather than string from fuzzer
function. This will improve performance especially for larger fuzz
based testing. This will work in tandem with the changes to the CI where
the script flows provide additional support for the change. Modifications
to the device tree files have been made to prevent name clashes with
the function names.

Change-Id: I95aaf23c95943f944d5837e2a8440514aafd6dde
Signed-off-by: mardyk01 <mark.dykes@arm.com>
diff --git a/smc_fuzz/src/fifo3d.c b/smc_fuzz/src/fifo3d.c
index 119b26c..0b99907 100644
--- a/smc_fuzz/src/fifo3d.c
+++ b/smc_fuzz/src/fifo3d.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2024, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -27,7 +27,7 @@
 #endif
 
 /*
- * Push function name string into raw data structure
+ * Push function name string into the data structure from device tree file
  */
 void push_3dfifo_fname(struct fifo3d *f3d, char *fname)
 {
@@ -36,7 +36,7 @@
 }
 
 /*
- * Push bias value into raw data structure
+ * Push bias value into data structure from device tree file
  */
 void push_3dfifo_bias(struct fifo3d *f3d, int bias)
 {
@@ -44,14 +44,36 @@
 }
 
 /*
+ * Push function id value into data structure from device tree file
+ */
+void push_3dfifo_fid(struct fifo3d *f3d, int id)
+{
+	f3d->fidfifo[f3d->col - 1][f3d->row[f3d->col - 1] - 1] = id;
+}
+
+
+/*
  * Create new column and/or row for raw data structure for newly
- * found node from device tree
+ * found node from device tree.  The fifo has four elements that reflect
+ * values obtained from the device tree for each node read.  This preserves
+ * the hierarchy found in that file so it can be utilized in construction of
+ * the smc nodes structure for final use in randomly calling the SMC functions.
+ * This is essentially a bias tree in final form.
  */
 void push_3dfifo_col(struct fifo3d *f3d, char *entry, struct memmod *mmod)
 {
+
+/*
+ * four elements required:
+ * 1. node name as a string
+ * 2. function name as a string
+ * 3. bias value as an integer
+ * 4. id value as an integer
+ */
 	char ***tnnfifo;
 	char ***tfnamefifo;
 	int **tbiasfifo;
+	int **tfidfifo;
 
 	if (f3d->col == f3d->curr_col) {
 		f3d->col++;
@@ -76,15 +98,17 @@
 		f3d->row[f3d->col - 1] = 1;
 
 		/*
-		 * Create new raw data memory
+		 * Start node creation for reading of device tree file
 		 */
 		tnnfifo = GENMALLOC(f3d->col * sizeof(char **));
 		tfnamefifo = GENMALLOC(f3d->col * sizeof(char **));
 		tbiasfifo = GENMALLOC((f3d->col) * sizeof(int *));
+		tfidfifo = GENMALLOC((f3d->col) * sizeof(int *));
 		for (unsigned int i = 0U; (int)i < f3d->col; i++) {
 			tnnfifo[i] = GENMALLOC(f3d->row[i] * sizeof(char *));
 			tfnamefifo[i] = GENMALLOC(f3d->row[i] * sizeof(char *));
 			tbiasfifo[i] = GENMALLOC((f3d->row[i]) * sizeof(int));
+			tfidfifo[i] = GENMALLOC((f3d->row[i]) * sizeof(int));
 			for (unsigned int j = 0U; (int)j < f3d->row[i]; j++) {
 				tnnfifo[i][j] = GENMALLOC(1 * sizeof(char[MAX_NAME_CHARS]));
 				tfnamefifo[i][j] =
@@ -95,6 +119,7 @@
 					strlcpy(tfnamefifo[i][j],
 						f3d->fnamefifo[i][j], MAX_NAME_CHARS);
 					tbiasfifo[i][j] = f3d->biasfifo[i][j];
+					tfidfifo[i][j] = f3d->fidfifo[i][j];
 				}
 			}
 		}
@@ -107,6 +132,7 @@
 		strlcpy(tfnamefifo[f3d->col - 1][f3d->row[f3d->col - 1] - 1],
 			"none", MAX_NAME_CHARS);
 		tbiasfifo[f3d->col - 1][f3d->row[f3d->col - 1] - 1] = 0;
+		tfidfifo[f3d->col - 1][f3d->row[f3d->col - 1] - 1] = 0;
 
 		/*
 		 * Free the old raw data structres
@@ -119,11 +145,13 @@
 			GENFREE(f3d->nnfifo[i]);
 			GENFREE(f3d->fnamefifo[i]);
 			GENFREE(f3d->biasfifo[i]);
+			GENFREE(f3d->fidfifo[i]);
 		}
 		if (f3d->col > 1) {
 			GENFREE(f3d->nnfifo);
 			GENFREE(f3d->fnamefifo);
 			GENFREE(f3d->biasfifo);
+			GENFREE(f3d->fidfifo);
 		}
 
 		/*
@@ -132,6 +160,7 @@
 		f3d->nnfifo = tnnfifo;
 		f3d->fnamefifo = tfnamefifo;
 		f3d->biasfifo = tbiasfifo;
+		f3d->fidfifo = tfidfifo;
 	}
 	if (f3d->col != f3d->curr_col) {
 		/*
@@ -141,15 +170,17 @@
 		f3d->row[f3d->col - 1]++;
 
 		/*
-		 * Create new raw data memory
+		 * Create new node form device tree file
 		 */
 		tnnfifo = GENMALLOC(f3d->col * sizeof(char **));
 		tfnamefifo = GENMALLOC(f3d->col * sizeof(char **));
 		tbiasfifo = GENMALLOC((f3d->col) * sizeof(int *));
+		tfidfifo = GENMALLOC((f3d->col) * sizeof(int *));
 		for (unsigned int i = 0U; (int)i < f3d->col; i++) {
 			tnnfifo[i] = GENMALLOC(f3d->row[i] * sizeof(char *));
 			tfnamefifo[i] = GENMALLOC(f3d->row[i] * sizeof(char *));
 			tbiasfifo[i] = GENMALLOC((f3d->row[i]) * sizeof(int));
+			tfidfifo[i] = GENMALLOC((f3d->row[i]) * sizeof(int));
 			for (unsigned int j = 0U; (int)j < f3d->row[i]; j++) {
 				tnnfifo[i][j] = GENMALLOC(1 * sizeof(char[MAX_NAME_CHARS]));
 				tfnamefifo[i][j] =
@@ -160,6 +191,7 @@
 					strlcpy(tfnamefifo[i][j],
 						f3d->fnamefifo[i][j], MAX_NAME_CHARS);
 					tbiasfifo[i][j] = f3d->biasfifo[i][j];
+					tfidfifo[i][j] = f3d->fidfifo[i][j];
 				}
 			}
 		}
@@ -172,6 +204,7 @@
 		strlcpy(tfnamefifo[f3d->col - 1][f3d->row[f3d->col - 1] - 1],
 			"none", MAX_NAME_CHARS);
 		tbiasfifo[f3d->col - 1][f3d->row[f3d->col - 1] - 1] = 0;
+		tfidfifo[f3d->col - 1][f3d->row[f3d->col - 1] - 1] = 0;
 
 		/*
 		 * Free the old raw data structres
@@ -187,10 +220,12 @@
 			GENFREE(f3d->nnfifo[i]);
 			GENFREE(f3d->fnamefifo[i]);
 			GENFREE(f3d->biasfifo[i]);
+			GENFREE(f3d->fidfifo[i]);
 		}
 		GENFREE(f3d->nnfifo);
 		GENFREE(f3d->fnamefifo);
 		GENFREE(f3d->biasfifo);
+		GENFREE(f3d->fidfifo);
 
 		/*
 		 * Point to new data
@@ -198,5 +233,6 @@
 		f3d->nnfifo = tnnfifo;
 		f3d->fnamefifo = tfnamefifo;
 		f3d->biasfifo = tbiasfifo;
+		f3d->fidfifo = tfidfifo;
 	}
 }