aboutsummaryrefslogtreecommitdiff
path: root/hdata/memory.c
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2017-05-24 16:00:53 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-05-26 15:55:23 +1000
commitdaa269a6f12a12684e4735c18f99aacf78f6757b (patch)
tree934347df6e5020ecb5339552106b56bec8286f81 /hdata/memory.c
parent36ec8dd69028adaa1ad2dc5d6a84bba229032adf (diff)
downloadskiboot-daa269a6f12a12684e4735c18f99aacf78f6757b.zip
skiboot-daa269a6f12a12684e4735c18f99aacf78f6757b.tar.gz
skiboot-daa269a6f12a12684e4735c18f99aacf78f6757b.tar.bz2
hdata: Reserve Trace Areas
When hostboot is configured to setup in memory tracing it will reserve some memory for use by the hardware tracing facility. We need to mark these areas as off limits to the operating system and firmware. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata/memory.c')
-rw-r--r--hdata/memory.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/hdata/memory.c b/hdata/memory.c
index 46ad4f7..686c93e 100644
--- a/hdata/memory.c
+++ b/hdata/memory.c
@@ -474,6 +474,51 @@ static void get_hb_reserved_mem(struct HDIF_common_hdr *ms_vpd)
}
}
+static void parse_trace_reservations(struct HDIF_common_hdr *ms_vpd)
+{
+ unsigned int size;
+ int count, i;
+
+ /*
+ * The trace arrays are only setup when hostboot is explicitly
+ * configured to enable them. We need to check and gracefully handle
+ * when they're not present.
+ */
+
+ if (!HDIF_get_idata(ms_vpd, MSVPD_IDATA_TRACE_AREAS, &size) || !size) {
+ prlog(PR_DEBUG, "MS VPD: No trace areas found.");
+ return;
+ }
+
+ count = HDIF_get_iarray_size(ms_vpd, MSVPD_IDATA_TRACE_AREAS);
+ if (count <= 0) {
+ prlog(PR_DEBUG, "MS VPD: No trace areas found.");
+ return;
+ }
+
+ prlog(PR_INFO, "MS VPD: Found %d trace areas\n", count);
+
+ for (i = 0; i < count; i++) {
+ const struct msvpd_trace *trace_area;
+ u64 start, end;
+
+ trace_area = HDIF_get_iarray_item(ms_vpd,
+ MSVPD_IDATA_TRACE_AREAS, i, &size);
+
+ if (!trace_area)
+ return; /* shouldn't happen */
+
+ start = be64_to_cpu(trace_area->start) & ~HRMOR_BIT;
+ end = be64_to_cpu(trace_area->end) & ~HRMOR_BIT;
+
+ prlog(PR_INFO,
+ "MSVPD: Trace area: 0x%.16"PRIx64"-0x%.16"PRIx64"\n",
+ start, end);
+
+ mem_reserve_hwbuf("trace-area", start, end - start);
+ }
+}
+
static bool __memory_parse(struct dt_node *root)
{
struct HDIF_common_hdr *ms_vpd;
@@ -524,6 +569,8 @@ static bool __memory_parse(struct dt_node *root)
get_hb_reserved_mem(ms_vpd);
+ parse_trace_reservations(ms_vpd);
+
prlog(PR_INFO, "MS VPD: Total MB of RAM: 0x%llx\n",
(long long)be64_to_cpu(tcms->total_in_mb));