Skip to content

Commit daa269a

Browse files
oohalstewartsmith
authored andcommitted
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>
1 parent 36ec8dd commit daa269a

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

hdata/memory.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,51 @@ static void get_hb_reserved_mem(struct HDIF_common_hdr *ms_vpd)
474474
}
475475
}
476476

477+
static void parse_trace_reservations(struct HDIF_common_hdr *ms_vpd)
478+
{
479+
unsigned int size;
480+
int count, i;
481+
482+
/*
483+
* The trace arrays are only setup when hostboot is explicitly
484+
* configured to enable them. We need to check and gracefully handle
485+
* when they're not present.
486+
*/
487+
488+
if (!HDIF_get_idata(ms_vpd, MSVPD_IDATA_TRACE_AREAS, &size) || !size) {
489+
prlog(PR_DEBUG, "MS VPD: No trace areas found.");
490+
return;
491+
}
492+
493+
count = HDIF_get_iarray_size(ms_vpd, MSVPD_IDATA_TRACE_AREAS);
494+
if (count <= 0) {
495+
prlog(PR_DEBUG, "MS VPD: No trace areas found.");
496+
return;
497+
}
498+
499+
prlog(PR_INFO, "MS VPD: Found %d trace areas\n", count);
500+
501+
for (i = 0; i < count; i++) {
502+
const struct msvpd_trace *trace_area;
503+
u64 start, end;
504+
505+
trace_area = HDIF_get_iarray_item(ms_vpd,
506+
MSVPD_IDATA_TRACE_AREAS, i, &size);
507+
508+
if (!trace_area)
509+
return; /* shouldn't happen */
510+
511+
start = be64_to_cpu(trace_area->start) & ~HRMOR_BIT;
512+
end = be64_to_cpu(trace_area->end) & ~HRMOR_BIT;
513+
514+
prlog(PR_INFO,
515+
"MSVPD: Trace area: 0x%.16"PRIx64"-0x%.16"PRIx64"\n",
516+
start, end);
517+
518+
mem_reserve_hwbuf("trace-area", start, end - start);
519+
}
520+
}
521+
477522
static bool __memory_parse(struct dt_node *root)
478523
{
479524
struct HDIF_common_hdr *ms_vpd;
@@ -524,6 +569,8 @@ static bool __memory_parse(struct dt_node *root)
524569

525570
get_hb_reserved_mem(ms_vpd);
526571

572+
parse_trace_reservations(ms_vpd);
573+
527574
prlog(PR_INFO, "MS VPD: Total MB of RAM: 0x%llx\n",
528575
(long long)be64_to_cpu(tcms->total_in_mb));
529576

hdata/spira.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,11 @@ struct msvpd_pmover_bsr_synchro {
513513
} __packed;
514514

515515
/* Idata index 3: Memory Trace Array */
516+
#define MSVPD_IDATA_TRACE_AREAS 3
517+
struct msvpd_trace {
518+
__be64 start, end;
519+
char reserved[16];
520+
};
516521

517522
/* Idata index 4: UE Address Array */
518523

hdata/test/stubs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ STUB(op_display);
9999
STUB(fsp_preload_lid);
100100
STUB(fsp_wait_lid_loaded);
101101
STUB(fsp_adjust_lid_side);
102+
STUB(backtrace);
102103

103104
/* Add HW specific stubs here */
104105
static void noop_function(void) {}

0 commit comments

Comments
 (0)