diff options
| author | Christian Geddes <crgeddes@us.ibm.com> | 2018-05-03 16:35:08 -0500 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-06-02 16:10:29 -0400 |
| commit | 17d1f78337ea7f5bfbb0ee727e63495dd7bb437b (patch) | |
| tree | 539d51896e9e422751e5acb1a705fb46aaf7578d /src/include/usr | |
| parent | 1d21270b627aaef8b43aff215fa626ff0d36347d (diff) | |
| download | talos-hostboot-17d1f78337ea7f5bfbb0ee727e63495dd7bb437b.tar.gz talos-hostboot-17d1f78337ea7f5bfbb0ee727e63495dd7bb437b.zip | |
Refactor re-init of targeting data during MPIPL/HBRT startup
There are a couple of things we have to do to targets/attrs when we
either transition from Hostboot->HBRT or from HBRT->Hostboot during
an MPIPL. These include resetting all of the mutex attrs so they
are in the unlocked state and updating the pointer which PEER_TARGET
stores as a value to reflect the change in the memory mapping. For
both of these tasks we need to loop through all of the targets.This
refactor allows both these tasks to be done in the same loop.
Change-Id: I23614bba11b2c9eabb97a7ddc7a53937f83dc131
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/58316
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Benjamin J. Weisenbeck <bweisenb@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include/usr')
| -rw-r--r-- | src/include/usr/targeting/attrrp.H | 44 | ||||
| -rw-r--r-- | src/include/usr/targeting/common/target.H | 2 | ||||
| -rw-r--r-- | src/include/usr/targeting/common/targetservice.H | 64 | ||||
| -rw-r--r-- | src/include/usr/targeting/common/targreasoncodes.H | 1 |
4 files changed, 102 insertions, 9 deletions
diff --git a/src/include/usr/targeting/attrrp.H b/src/include/usr/targeting/attrrp.H index 0c6f1aa8d..bc9425007 100644 --- a/src/include/usr/targeting/attrrp.H +++ b/src/include/usr/targeting/attrrp.H @@ -49,6 +49,10 @@ namespace TARGETING // Forward declaration of attribute section parsed information structure. struct AttrRP_Section; +// These constexprs are used by editPagePermissions function +constexpr uint32_t DEFAULT_PERMISSIONS = 0xFFFFFFFF; +constexpr uint8_t ALL_SECTION_TYPES = 0xFF; + #ifdef __HOSTBOOT_RUNTIME /** * @brief Structure used to store Node specific information @@ -264,6 +268,46 @@ class AttrRP static void init(errlHndl_t& io_taskRetErrl, bool i_isMpipl = false); #ifndef __HOSTBOOT_RUNTIME + + /** + * @brief Modifies the memory R/W permissions on VMM pages for a + * given type of AttrRP_Section. Valid types can be found + * in the generated file pnorheader.H. Valid permissions + * can be found in src/include/sys/mm.h . It was chosen to + * not use the enums to avoid needing to include the headers + * all over. + * + * @param[in] i_type The type of AttrRP_Section we want to apply the permission + * edits to. Valid options for the attrrp types are: + * SECTION_TYPE_PNOR_RO = 0x00 + * SECTION_TYPE_PNOR_RW = 0x01 + * SECTION_TYPE_HEAP_PNOR_INIT = 0x02 + * SECTION_TYPE_HEAP_ZERO_INIT = 0x03 + * SECTION_TYPE_HB_HEAP_ZERO_INIT = 0x0A + * ALL_SECTION_TYPES = 0xFF + * + * @param[in] i_permission The R/W permissions the user desires to apply to a + * given section. Note that values can be OR'ed + * together. Valid options are : + * READ_ONLY = 0x00000001 + * WRITABLE = 0x00000002 + * EXECUTABLE = 0x00000004 + * WRITE_TRACKED = 0x00000008 + * ALLOCATE_FROM_ZERO = 0x00000010 + * NO_ALLOCATE_FROM_ZERO = 0x00000020 + * NO_ACCESS = 0x00000040 + * BYPASS_HRMOR = 0x00000080 + * GUARDED = 0x00000100 + * DEFAULT_PERMISSIONS = 0xFFFFFFFF + * + * @note If the value 0xFF is passed in for i_type then all types will + * get permissions updated to i_permission. + * If the value 0xFFFF is passed in for i_permission then the sections + * will have their R/W permissions set up to the default values given + * in PNOR + */ + errlHndl_t editPagePermissions(uint8_t i_type, uint32_t i_permission); + /** * @brief Copies all present attribute sections to memory. * diff --git a/src/include/usr/targeting/common/target.H b/src/include/usr/targeting/common/target.H index ab22a62bb..f462581de 100644 --- a/src/include/usr/targeting/common/target.H +++ b/src/include/usr/targeting/common/target.H @@ -61,7 +61,6 @@ namespace ERRORLOG } namespace RT_TARG { - void adjustTargeting4Runtime(); ERRORLOG::ErrlEntry* saveRestoreAttrs(void *i_rsvdMemPtr, void *io_lidStructPtr, uint8_t i_instance); @@ -811,7 +810,6 @@ class Target friend class AttributeTank; #ifdef __HOSTBOOT_RUNTIME - friend void RT_TARG::adjustTargeting4Runtime(); friend ERRORLOG::ErrlEntry* RT_TARG::saveRestoreAttrs(void *, void *, uint8_t); diff --git a/src/include/usr/targeting/common/targetservice.H b/src/include/usr/targeting/common/targetservice.H index 860a5564b..37bf6216e 100644 --- a/src/include/usr/targeting/common/targetservice.H +++ b/src/include/usr/targeting/common/targetservice.H @@ -563,6 +563,33 @@ class TargetService void dump() const; #ifndef __HOSTBOOT_RUNTIME + + /** + * @brief This func changes the readOnly section of the targeting data + * to be writeable, allowing hostboot to update attributes that + * are read-only. After attributes are updated the user should + * toggle back to making the section readOnly + * + * This top level interface calls the lower level attribute resource + * provider interface to modify R/W permissions on the VMM pages it has + * mapped for each of the different sections of the targeting data. This + * function specifically provides a way to toggle the ability to write to + * the readOnly pages of the targeting data. + * + * @param[in] i_allowWrites If TRUE will change R/W permissions of readOnly + * targeting data to be writable + * If FALSE will change R/W permissions of readOnly + * targeting data to be readOnly + * + * @pre AttrRp must be initialized + * + * @post R/W permissions of the readOnly section of the targeting data will + * be modified depending on boolean parameter. + * + * @return Error handle holding any errors accrued during execution + */ + errlHndl_t modifyReadOnlyPagePermissions(bool i_allowWrites); + /** * @brief Updates the targeting/attribute section data with the * specified vector parameters. @@ -790,23 +817,46 @@ class TargetService AttrRP *i_attrRP, ATTRIBUTE_ID* &o_pAttrId, AbstractPointer<void>* &o_ppAttrAddr); + /** + * @brief Update the address that PEER_TARGET points to for a given target + * + * @par Detailed Description: + * The PEER_TARGET attribute is a pointer to a target's peer. The location + * of the target changes when we transition from Hostboot<->HBRT. After + * transitioning to runtime, or if we perform an MPIPL this function needs + * to be run on all targets in order to insure any target with a PEER_TARGET + * attribute gets the PEER_TARGET's pointer looked up again and set to the + * new value. + * + * @param[in] i_pTarget pointer to target to update PEER_TARGET attr for + * + * @pre TargetService must be initialized. + * + * @post If the target passed in has a PEER_TARGET , its value will be updated + * + * @return TRUE if target was updated , FALSE if PEER_TARGET was not updated + */ + bool updatePeerTarget( const Target* i_pTarget); + #ifdef __HOSTBOOT_MODULE /** - * @brief Reset all hostboot mutex attributes + * @brief Reset all hostboot mutex attributes on a given target * * @par Detailed Description: - * Iterates through all targets and check each of their attributes to - * see if they are of type hbmutex. If we find a mutex attribute we will - * run mutex_init on it to reset it. + * Take in target and check each of its attributes to see if they are + * of type hbmutex. If we find a mutex attribute we will run mutex_init + * on it to reset it. + * + * @param[in] i_pTarget pointer to target to reset mutex attrs on * * @pre TargetService must be initialized. * AttrRp must be initialized * - * @post All hb mutex attributes on all targets have been reset + * @post All hb mutex attributes on given target have been reset * - * @return void + * @return number of mutex attributes reset */ - void resetMutexAttributes(); + uint32_t resetMutexAttributes( const Target* i_pTarget); #endif private: diff --git a/src/include/usr/targeting/common/targreasoncodes.H b/src/include/usr/targeting/common/targreasoncodes.H index 411d686cb..ddff835be 100644 --- a/src/include/usr/targeting/common/targreasoncodes.H +++ b/src/include/usr/targeting/common/targreasoncodes.H @@ -50,6 +50,7 @@ enum TargetingModuleId TARG_APPLY_ATTR_OVER = 0x0A, TARG_HANDLE_ENUM_CHECK_FAILURE = 0x0B, TARG_HANDLE_RANGE_CHECK_FAILURE = 0x0C, + TARG_EDIT_PAGE_PERMISSIONS = 0x0D, }; enum TargetingReasonCode |

