Skip to content

Commit

Permalink
OPAL/MPIPL: Processor Dump Area Table interfaces
Browse files Browse the repository at this point in the history
This patch adds support to collect processor architected register data.

SBE <--> Hostboot :
-------------------
  During first boot, hostboot reserves memory to copy architected register
  data by SBE and sends address to each SBE (see commit 9f49d11). During
  MPIPL SBE collects architected register data and copies to reserved
  memory.

Hostboot <--> Hypervisor :
--------------------------
  HDAT/SPIRAH has new ntuple (Processor Dump Area) to pass various
  architected register data. During IPL/runtime hypervisor reserves memory
  for architected register data and updates SPIRAH.

  During MPIPL (istep 14.8), hostboot converts SBE formated architected
  registers data to HDAT format and copies to hypervisor reserved memory.
  It uses NACA/SPIRAH pointers to get hypervisor reserved memory details.

  Hostboot has to update SPIRAH ntuple after loading new LID to memory.
  Hence this patch introdues below new attributes:
    - PDA_CAPTURED_THREAD_REG_ARRAY_ADDR
    - PDA_CAPTURED_THREAD_REG_ARRAY_SIZE
    - PDA_THREAD_REG_ENTRY_SIZE
    - PDA_THREAD_REG_STATE_ENTRY_FORMAT

Change-Id: Idc7489e8cf6fc68fe80f028ba6deb97aa72486bf
CC: Sampa Misra <sampmisr@in.ibm.com>
CC: Daniel M. Crowell <dcrowell@us.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/61627
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
Raja Das authored and dcrowell77 committed Mar 21, 2019
1 parent d09e67a commit b8f4e50
Show file tree
Hide file tree
Showing 13 changed files with 667 additions and 25 deletions.
113 changes: 110 additions & 3 deletions src/include/usr/dump/dumpif.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2012,2018 */
/* Contributors Listed Below - COPYRIGHT 2012,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -25,6 +25,8 @@
#ifndef __DUMPIF_H
#define __DUMPIF_H

#include <hdat/hdat.H>

/** @file dumpif.H
* @brief Provides the external interfaces for dump.
* - copy dump data from src to destination
Expand All @@ -34,7 +36,6 @@
namespace DUMP
{


/**
* @brief DUMP Message Types
*/
Expand Down Expand Up @@ -85,7 +86,7 @@ namespace DUMP
#define DUMP_TEST_TABLE_SIZE (DUMP_TEST_SRC_MEM_SIZE + \
DUMP_TEST_DST_MEM_SIZE + DUMP_TEST_RESULTS_MEM_SIZE)


#define DUMP_TEST_TABLE_END (DUMP_TEST_TABLE_START + DUMP_TEST_TABLE_SIZE)

// In addition to the dump table locations we have scratch data area that is
Expand Down Expand Up @@ -118,6 +119,112 @@ namespace DUMP
} PACKED;


// Processor Dump Area table format
struct procDumpAreaEntry
{
uint32_t threadRegSize; // Architected reg data size per thread
uint8_t threadRegVersion; // Data format version
uint8_t reserved1[11]; // Reserved
uint64_t dstArrayAddr; // Hypervisor passed destination addresss
uint8_t reserved2[4]; // Reserved
uint32_t dstArraySize; // Hypervisor passed destination size
uint64_t capArrayAddr; // Actual destination address (filled by HB)
uint8_t reserved3[4]; // Reserved
uint32_t capArraySize; // Actual destination size (filled by HB)
} PACKED;

// Host formatted architected register data content (as per HDAT spec)
struct hostArchRegDataHdr
{
uint32_t pir;
uint8_t coreState;
uint8_t reserved[3];
HDAT::hdatHDIFDataArray_t iv_regArrayHdr;
} PACKED;

#define DUMP_ARCH_REG_TYPE_GPR 0x01
#define DUMP_ARCH_REG_TYPE_SPR 0x02

// Architected register data content entries
struct hostArchRegDataEntry
{
uint32_t regType;
uint32_t regNum;
uint64_t regVal;
} PACKED;

// Structure version used to share SPR/GPR register data between
// SBE and HB
#define REG_DUMP_SBE_HB_STRUCT_VER 0x1

// Structure version used to share SPR/GPR register data between
// HB and OPAL
#define REG_DUMP_HDAT_STRUCT_VER 0x1

/* Processor architected dump header. This header is per processor*/
struct sbeArchRegDumpProcHdr_t
{
uint8_t ownerId; /* FSP or SBE */
uint8_t version; /* Interface version number*/
uint16_t core_cnt; /* Actual number of core whose register data will be obtained */
uint16_t thread_cnt; /* Total number of thread whose register data will be obtained */
uint16_t reg_cnt; /* Max number of registers per thread */
} PACKED; //8Bytes

// SBE formatted architected registers data
// (Common structure between SBE and Hostboot)
struct sbeArchRegDumpThreadHdr_t
{
uint32_t pir; // PIR value of thread corresponding to register
uint32_t coreState:8; // State of core in which this thread is present
uint32_t reserved:24;
} PACKED;

/**
* @brief Defines the structure for storing the SPR/GPR register data
*
* @var isRegDataValid :'1'- Variable regVal will contain valid register
* '0'- Variable regVal will contain fapiRC value
*
* @var isLastReg :'1' - Data is collected for the last SPR/GPR register
* '0' - otherwise.
*
* @var isFfdcPresent :'1' - Failing FAPI FFDC is shared
* '0' - Failing FFDC is not present
*
* @var reserved0 :Reserved for future use and padding
*
* @var regType :Indicates type of register(SPR/GPR)
*
* @var reserved1 :Reserved for future use and padding
*
* @var regNum :Address of the SPR/GPR register
*
* @var regVal :if isRegDataValid is '0' - Valid Register value
* isRegDataValid is '!=0'- fapiRC value.
*/
struct sbeArchRegDumpEntries_t
{
uint64_t isRegDataValid:1;
uint64_t isLastReg:1;
uint64_t isFfdcPresent:1;
uint64_t reseverd0:5;
uint64_t regType:8;
uint64_t reserved1:16;
uint64_t regNum:32;
uint64_t regVal;
} PACKED;

/**
* @brief This function copies the architected register data content
* from SBE reserved memory to hypervisor allocated memory
*
* @param[in] void
*
* @return errlHndl_t
*/
errlHndl_t copyArchitectedRegs(void);

/**
* @brief This function is a wrapper function that calls
* getHostDataPtrs to get the MDDT, MDST, MDRT pointers
Expand Down
34 changes: 21 additions & 13 deletions src/include/usr/dump/dumpreasoncodes.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* COPYRIGHT International Business Machines Corp. 2012,2014 */
/* Contributors Listed Below - COPYRIGHT 2012,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
Expand All @@ -32,22 +34,28 @@ namespace DUMP
DUMP_COLLECT_INVALID = 0x00,
DUMP_COLLECT = 0x01,
DUMP_SEND_MBOX_MSG = 0x02,
DUMP_ARCH_REGS = 0x03,
};

enum dumpReasonCode
{
DUMP_INVALID_ADDR = DUMP_COMP_ID | 0x01,
DUMP_NO_HDAT_ADDR = DUMP_COMP_ID | 0x02,
DUMP_CANNOT_MAP = DUMP_COMP_ID | 0x03,
DUMP_CANNOT_UNMAP_SRC = DUMP_COMP_ID | 0x04,
DUMP_CANNOT_UNMAP_DEST = DUMP_COMP_ID | 0x05,
DUMP_CANNOT_UNMAP_RESULTS = DUMP_COMP_ID | 0x06,
DUMP_MDRT_INSUFFICIENT_SPACE = DUMP_COMP_ID | 0x07,
DUMP_MDST_INSUFFICIENT_SPACE = DUMP_COMP_ID | 0x08,
DUMP_MDDT_INSUFFICIENT_SPACE = DUMP_COMP_ID | 0x09,
DUMP_MDDT_INSUFFICIENT_ENTRIES = DUMP_COMP_ID | 0x0A,
DUMP_MDST_INVALID_TABLE_SIZE = DUMP_COMP_ID | 0x0B,
DUMP_MDDT_INVALID_TABLE_SIZE = DUMP_COMP_ID | 0x0C,
DUMP_INVALID_ADDR = DUMP_COMP_ID | 0x01,
DUMP_NO_HDAT_ADDR = DUMP_COMP_ID | 0x02,
DUMP_CANNOT_MAP = DUMP_COMP_ID | 0x03,
DUMP_CANNOT_UNMAP_SRC = DUMP_COMP_ID | 0x04,
DUMP_CANNOT_UNMAP_DEST = DUMP_COMP_ID | 0x05,
DUMP_CANNOT_UNMAP_RESULTS = DUMP_COMP_ID | 0x06,
DUMP_MDRT_INSUFFICIENT_SPACE = DUMP_COMP_ID | 0x07,
DUMP_MDST_INSUFFICIENT_SPACE = DUMP_COMP_ID | 0x08,
DUMP_MDDT_INSUFFICIENT_SPACE = DUMP_COMP_ID | 0x09,
DUMP_MDDT_INSUFFICIENT_ENTRIES = DUMP_COMP_ID | 0x0A,
DUMP_MDST_INVALID_TABLE_SIZE = DUMP_COMP_ID | 0x0B,
DUMP_MDDT_INVALID_TABLE_SIZE = DUMP_COMP_ID | 0x0C,
DUMP_PDAT_INVALID_ADDR = DUMP_COMP_ID | 0x0D,
DUMP_PDAT_CANNOT_UNMAP_SRC_ADDR = DUMP_COMP_ID | 0x0E,
DUMP_PDAT_CANNOT_UNMAP_DST_ADDR = DUMP_COMP_ID | 0x0F,
DUMP_PDAT_INSUFFICIENT_SPACE = DUMP_COMP_ID | 0x10,
DUMP_PDAT_VERSION_MISMATCH = DUMP_COMP_ID | 0x11,
};
};

Expand Down
20 changes: 19 additions & 1 deletion src/include/usr/runtime/runtime.H
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ enum SectionId
HRMOR_STASH, //< Pointer to address in reserved memory
// where PHYP can write HRMOR
CPU_CTRL, // Spira-H CPU controls area
LAST_SECTION = CPU_CTRL //< Placeholder for arrays
PROC_DUMP_AREA_TBL, //< Processor dump area table
LAST_SECTION = PROC_DUMP_AREA_TBL //< Placeholder for arrays
};

/**
Expand Down Expand Up @@ -305,6 +306,23 @@ void saveActualCount( SectionId i_id,
*/
errlHndl_t writeActualCount( SectionId i_id );

/**
* @brief Write actual architected register detail to HDAT/SPIRAH
*
* @param[in] i_section Chunk of data to update
* @param[in] threadRegSize Architected reg data size per thread
* @param[in] threadRegVersion Data format version
* @param[in] capArrayAddr Actual destination address
* @param[in] capArraySize Actual destiantion size
*
* @return errlHndl_t NULL on success
*/
errlHndl_t updateHostProcDumpActual( SectionId i_section,
uint32_t threadRegSize,
uint8_t threadRegVersion,
uint64_t capArrayAddr,
uint32_t capArraySize);

/**
* @brief Use relocated payload base address
*
Expand Down
6 changes: 5 additions & 1 deletion src/include/usr/vmmconst.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@ enum BlockPriority
#define VMM_ALL_HOMER_OCC_MEMORY_SIZE \
(VMM_OCC_COMMON_SIZE + VMM_HOMER_REGION_SIZE)

/** Memory for Architected state (max 4 procs - 256KB Each) **/
/**
* Memory for Architected state (max 4 procs - 256KB Each)
* XXX MPIPL depends on memory reservation layout. Any change in the
* reservation order impact MPIPL (see copyArchitectedRegs()).
*/
#define VMM_ARCH_REG_DATA_START_OFFSET VMM_OCC_COMMON_END_OFFSET
#define VMM_ARCH_REG_DATA_PER_PROC_SIZE_IN_KB 256
#define VMM_ARCH_REG_DATA_PER_PROC_SIZE \
Expand Down

0 comments on commit b8f4e50

Please sign in to comment.