[Skiboot] [PATCH 3/4] hdata: Initialize SPIRA-H structure

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Sat Feb 13 02:38:08 AEDT 2016


Previous patch reduced reserved space in spira structure. Its safe to
reduce the memory for spira section from 2K to 1K. Create separate
memory section with 1K size for SPIRA-H.

Also initialize SPIRA-H. FSP makes use of this information to pass various
boot time data (like SPIRA-S, etc) to host.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 hdata/spira.c     | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 include/mem-map.h |  5 ++++-
 skiboot.lds.S     |  5 +++++
 3 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/hdata/spira.c b/hdata/spira.c
index d0b0ce8..e747c1d 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -147,6 +147,52 @@ __section(".spira.data") struct spira spira = {
 	},
 };
 
+/* The Hypervisor SPIRA-H Structure */
+__section(".spirah.data") struct spirah spirah = {
+	.hdr = HDIF_SIMPLE_HDR(SPIRAH_HDIF_SIG, SPIRAH_VERSION, struct spirah),
+	.ntuples_ptr = HDIF_IDATA_PTR(offsetof(struct spirah, ntuples),
+				      sizeof(struct spirah_ntuples)),
+	.ntuples = {
+		.array_hdr = {
+			.offset		= CPU_TO_BE32(HDIF_ARRAY_OFFSET),
+			.ecnt		= CPU_TO_BE32(SPIRAH_NTUPLES_COUNT),
+			.esize
+				= CPU_TO_BE32(sizeof(struct spira_ntuple)),
+			.eactsz		= CPU_TO_BE32(0x18),
+		},
+		/* Host Data Areas */
+		.hs_data_area = {
+			.addr		= CPU_TO_BE64(SPIRA_HEAP_BASE),
+			.alloc_cnt	= CPU_TO_BE16(1),
+			.alloc_len	= CPU_TO_BE32(SPIRA_HEAP_SIZE),
+		},
+		/* We only populate some n-tuples */
+		.proc_init = {
+			.addr		= CPU_TO_BE64(PROCIN_OFF),
+			.alloc_cnt	= CPU_TO_BE16(1),
+			.act_cnt	= CPU_TO_BE16(1),
+			.alloc_len
+			= CPU_TO_BE32(sizeof(struct proc_init_data)),
+		},
+#if !defined(TEST)
+		.cpu_ctrl = {
+			.addr		= CPU_TO_BE64((unsigned long)&cpu_ctl_init_data),
+			.alloc_cnt	= CPU_TO_BE16(1),
+			.act_cnt	= CPU_TO_BE16(1),
+			.alloc_len	=
+					CPU_TO_BE32(sizeof(cpu_ctl_init_data)),
+		},
+#endif
+		.mdump_src = {
+			.addr		= CPU_TO_BE64(MDST_TABLE_OFF),
+			.alloc_cnt	= CPU_TO_BE16(ARRAY_SIZE(init_mdst_table)),
+			.act_cnt	= CPU_TO_BE16(ARRAY_SIZE(init_mdst_table)),
+			.alloc_len	=
+				CPU_TO_BE32(sizeof(init_mdst_table)),
+		},
+	},
+};
+
 /* Overridden for testing. */
 #ifndef spira_check_ptr
 bool spira_check_ptr(const void *ptr, const char *file, unsigned int line)
diff --git a/include/mem-map.h b/include/mem-map.h
index 1258d87..2bcaf07 100644
--- a/include/mem-map.h
+++ b/include/mem-map.h
@@ -33,8 +33,11 @@
  * give it 64k before placing the SPIRA and related data.
  */
 #define SPIRA_OFF		0x00010000
+#define SPIRAH_OFF		0x00010400
 
-/* SPIRA is 2k, then follow with for proc_init_data (aka PROCIN).
+/* Actual SPIRA size is lesser than 1K (presently 0x340 bytes).
+ * Use 1K for legacy SPIRA and 1K for SPIRA-H.
+ * Then follow with for proc_init_data (aka PROCIN).
  * These need to be at fixed addresses in case we're ever little
  * endian: linker can't endian reverse a pointer for us.  Text, data
  * et. al. follows this.
diff --git a/skiboot.lds.S b/skiboot.lds.S
index 5c8bbbd..7d3d0cf 100644
--- a/skiboot.lds.S
+++ b/skiboot.lds.S
@@ -31,6 +31,11 @@ SECTIONS
 		KEEP(*(.spira.data))
 	}
 
+	. = SPIRAH_OFF;
+	.spirah : {
+		KEEP(*(.spirah.data))
+	}
+
 	. = PROCIN_OFF;
 	.procin.data : {
 		KEEP(*(.procin.data))
-- 
2.1.0



More information about the Skiboot mailing list