From 1e973575493db7b15d6cd36613034e3ea17ca900 Mon Sep 17 00:00:00 2001 From: Dan Crowell Date: Wed, 10 Jan 2018 11:07:59 -0600 Subject: Expand Hostboot to 64MB We hit out-of-memory errors while trying to boot a Opal system due to the large amount of memory used by the PM procedures and the pinning of memory in secure mode. Also did some other rearranging of the pinned memory sections to get some space back. Change-Id: I61f219d7f32871a39b236d963bae893a6ef0ce0e CQ: SW413191 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/51724 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Matt Derksen Reviewed-by: Martin Gloff Reviewed-by: Daniel M. Crowell --- src/build/debug/Hostboot/Dump.pm | 10 +++++++- src/build/debug/fsp-memdump.sh | 23 ++++++++++++++++-- src/build/debug/simics-debug-framework.py | 6 ++--- src/include/kernel/basesegment.H | 6 ++--- src/include/kernel/memstate.H | 8 ++++--- src/include/kernel/vmmmgr.H | 4 ++-- src/include/usr/vmmconst.h | 28 +++++++++++----------- src/kernel/basesegment.C | 20 ++++++++-------- src/kernel/syscall.C | 4 ++-- src/lib/syscall_mm.C | 4 ++-- .../istep14/call_proc_exit_cache_contained.C | 8 +++---- 11 files changed, 75 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/build/debug/Hostboot/Dump.pm b/src/build/debug/Hostboot/Dump.pm index cf1b684a7..bc3dca7b8 100755 --- a/src/build/debug/Hostboot/Dump.pm +++ b/src/build/debug/Hostboot/Dump.pm @@ -6,7 +6,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2012,2017 +# Contributors Listed Below - COPYRIGHT 2012,2018 # [+] International Business Machines Corp. # # @@ -37,6 +37,7 @@ use constant MEMSTATE_HALF_CACHE => 0x4; use constant MEMSTATE_REDUCED_CACHE => 0x8; use constant MEMSTATE_FULL_CACHE => 0xa; use constant MEMSTATE_MS_48MEG => 0x30; +use constant MEMSTATE_MS_64MEG => 0x40; use constant _KB => 1024; use constant _MB => 1024 * 1024; @@ -75,6 +76,10 @@ our %memory_maps = ( # Add next 38MB after we expand to memory. [ 10 * _MB, 38 * _MB ] + MEMSTATE_MS_64MEG() => + # Add next 54MB after we expand to memory. + [ 10 * _MB, 54 * _MB + ] ); # Map the current state to the combined states available. @@ -91,6 +96,9 @@ our %memory_states = ( MEMSTATE_MS_48MEG() => [ MEMSTATE_NO_MEM, MEMSTATE_HALF_CACHE, MEMSTATE_REDUCED_CACHE, MEMSTATE_FULL_CACHE, MEMSTATE_MS_48MEG ] + MEMSTATE_MS_64MEG() => [ MEMSTATE_NO_MEM, + MEMSTATE_HALF_CACHE, MEMSTATE_REDUCED_CACHE, + MEMSTATE_FULL_CACHE, MEMSTATE_MS_64MEG ] ); sub main diff --git a/src/build/debug/fsp-memdump.sh b/src/build/debug/fsp-memdump.sh index e4418a286..ef1b096ed 100755 --- a/src/build/debug/fsp-memdump.sh +++ b/src/build/debug/fsp-memdump.sh @@ -6,7 +6,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2013,2017 +# Contributors Listed Below - COPYRIGHT 2013,2018 # [+] International Business Machines Corp. # # @@ -85,7 +85,7 @@ discover() limit_memory() { case ${STATE} in - 30) + 40) STATE=08 ;; *) @@ -188,6 +188,25 @@ do dump 49283072 1048576 STATE=0A ;; + 40) + dump 50331648 1048576 + dump 51380224 1048576 + dump 52428800 1048576 + dump 53477376 1048576 + dump 54525952 1048576 + dump 55574528 1048576 + dump 56623104 1048576 + dump 57671680 1048576 + dump 58720256 1048576 + dump 59768832 1048576 + dump 60817408 1048576 + dump 61865984 1048576 + dump 62914560 1048576 + dump 63963136 1048576 + dump 65011712 1048576 + dump 66060288 1048576 + STATE=30 + ;; discover) # Call discover function to determine state. discover ;; diff --git a/src/build/debug/simics-debug-framework.py b/src/build/debug/simics-debug-framework.py index 081ab4dc9..93a84ad89 100644 --- a/src/build/debug/simics-debug-framework.py +++ b/src/build/debug/simics-debug-framework.py @@ -6,7 +6,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2011,2017 +# Contributors Listed Below - COPYRIGHT 2011,2018 # [+] Google Inc. # [+] International Business Machines Corp. # @@ -632,10 +632,10 @@ def magic_instruction_callback(user_arg, cpu, arg): # 0=base, 1=name, 4=size 5=mirrored target, 6=priority #print ">> %d:%s" % (entry[0], entry[1]) #check if base == hrmor, or if memory space encompasses the - #entire base memory which is: hrmor + 0x3000000 (48 MB) + #entire base memory which is: hrmor + 0x4000000 (64 MB) if ((entry[0] == hb_hrmor) or ((entry[0] < hb_hrmor) and - (entry[0] + entry[4] >= hb_hrmor + 0x3000000) or + (entry[0] + entry[4] >= hb_hrmor + 0x4000000) or (entry[0] == 134217728) or (entry[0] == 136314880))): #0x8000000 or 0x8200000 target = entry[5] diff --git a/src/include/kernel/basesegment.H b/src/include/kernel/basesegment.H index 7629473f0..7902d0e9f 100644 --- a/src/include/kernel/basesegment.H +++ b/src/include/kernel/basesegment.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* Contributors Listed Below - COPYRIGHT 2011,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -136,7 +136,7 @@ class BaseSegment : public Segment /** * @brief Allocates a block of virtual memory that extends the VMM - * space up to 48MEG of Mainstore. + * into Mainstore (up to VMM_MEMORY_SIZE). */ static int mmExtend(void); @@ -206,7 +206,7 @@ class BaseSegment : public Segment /** * @brief Allocates a block of virtual memory that extends the VMM - * space up to 48MEG of Mainstore. + * into Mainstore (up to VMM_MEMORY_SIZE). */ int _mmExtend(void); diff --git a/src/include/kernel/memstate.H b/src/include/kernel/memstate.H index a01fdcc32..fb42ed31f 100644 --- a/src/include/kernel/memstate.H +++ b/src/include/kernel/memstate.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2017 */ +/* Contributors Listed Below - COPYRIGHT 2013,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -29,6 +29,8 @@ #ifndef __KERNEL_MEMSTATE_H #define __KERNEL_MEMSTATE_H +#include + namespace KernelMemState { // hb_Mem_Location struct values are defined below. @@ -45,7 +47,7 @@ namespace KernelMemState - - 4 = Hostboot is using half a cache - - 8 = Hostboot is using reduced cache - - 10 = Hostboot is using the full cache - - - 48 = Hostboot is using 48 MB of mainstore*/ + - - XX = Hostboot is using XX MB of mainstore*/ enum MemLocation @@ -62,7 +64,7 @@ namespace KernelMemState HALF_CACHE = 0x00000004, REDUCED_CACHE = 0x00000008, FULL_CACHE = 0x0000000A, - MS_48MEG = 0x00000030, + FULL_MEM = (VMM_MEMORY_SIZE/MEGABYTE), }; struct mem_location diff --git a/src/include/kernel/vmmmgr.H b/src/include/kernel/vmmmgr.H index 11d8199e8..6f211a0eb 100644 --- a/src/include/kernel/vmmmgr.H +++ b/src/include/kernel/vmmmgr.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2010,2017 */ +/* Contributors Listed Below - COPYRIGHT 2010,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -192,7 +192,7 @@ class VmmManager /** * @brief Allocates a block of virtual memory that extends the VMM - * space up to 48MEG of Mainstore. + * snto Mainstore (up to VMM_MEMORY_SIZE). */ static int mmExtend( void); diff --git a/src/include/usr/vmmconst.h b/src/include/usr/vmmconst.h index 32be069d6..5da954974 100644 --- a/src/include/usr/vmmconst.h +++ b/src/include/usr/vmmconst.h @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* Contributors Listed Below - COPYRIGHT 2011,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -71,7 +71,7 @@ #define VMM_ADDR_EXTEND_BLOCK (VMM_ADDR_BASE_BLOCK + VMM_BASE_BLOCK_SIZE) /** Maximize size of Base Segment Memory after expansion */ -#define VMM_MEMORY_SIZE (48*MEGABYTE) +#define VMM_MEMORY_SIZE (64*MEGABYTE) /** Base Segment Extended Memory Block Size */ #define VMM_EXTEND_BLOCK_SIZE (VMM_MEMORY_SIZE-VMM_BASE_BLOCK_SIZE) @@ -141,13 +141,13 @@ enum BlockPriority #define SLBE_b 12 /** Hostboot reserved memory */ -#define VMM_HRMOR_OFFSET 128*MEGABYTE -#define VMM_HB_RSV_MEM_SIZE 256*MEGABYTE +#define VMM_HRMOR_OFFSET (128*MEGABYTE) +#define VMM_HB_RSV_MEM_SIZE (256*MEGABYTE) /** Hardwired offsets from HRMOR to HOMER images in real mem */ /** HOMER starts immediately after our HB memory */ -/** + = 176 MB */ -/** HOMER is 4 MB per proc, 8 procs = 32MB */ +/** + = 192 MB */ +/** HOMER is 4 MB per proc, 4 procs = 16MB */ /** Each HOMER must start on a 4MB offset to meet OCC requirements */ #define VMM_HOMER_REGION_START_OFFSET (VMM_MEMORY_SIZE) #define VMM_HOMER_INSTANCE_SIZE_IN_MB (4) @@ -160,7 +160,6 @@ enum BlockPriority /** Physical Memory for OCC common space - 8MB total */ /** OCC Common must be on an 8MB offset */ -/** Start = End of Homer, currently 208MB */ #define VMM_OCC_COMMON_START_OFFSET VMM_HOMER_REGION_END_OFFSET #define VMM_OCC_COMMON_SIZE_IN_MB 8 #define VMM_OCC_COMMON_SIZE \ @@ -178,15 +177,9 @@ enum BlockPriority #define VMM_ATTR_DATA_SIZE (1*MEGABYTE) /** End of Attr Area = 217MB */ -/** Chunk of physical memory used for Dump Source Table */ -#define DUMP_TEST_MEMORY_ADDR \ - (VMM_ATTR_DATA_START_OFFSET + VMM_ATTR_DATA_SIZE) /* currently 217MB */ -#define DUMP_TEST_MEMORY_SIZE (4*MEGABYTE) -/** End of Dump Source Table = 221MB */ - /** Memory for hostboot data Table of Contents */ #define VMM_HB_DATA_TOC_START_OFFSET \ - (DUMP_TEST_MEMORY_ADDR + DUMP_TEST_MEMORY_SIZE) /* currently 221MB */ + (VMM_ATTR_DATA_START_OFFSET + VMM_ATTR_DATA_SIZE) /* currently 217MB */ /** Variable Attribute overrides and Attributes memory here **/ @@ -218,6 +211,13 @@ enum BlockPriority /** Block size used in remove pages test */ #define VMM_SIZE_RMVPAGE_TEST (8 * PAGESIZE) +/** Chunk of physical memory used for Dump Source Table */ +#define DUMP_TEST_MEMORY_ADDR (256*MEGABYTE) +#define DUMP_TEST_MEMORY_SIZE (4*MEGABYTE) +/** End of Dump Test Area = 260MB */ + + + /** * Physical Memory Constants */ diff --git a/src/kernel/basesegment.C b/src/kernel/basesegment.C index 2de6973e0..2574c8d6a 100644 --- a/src/kernel/basesegment.C +++ b/src/kernel/basesegment.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* Contributors Listed Below - COPYRIGHT 2011,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -236,16 +236,16 @@ int BaseSegment::mmExtend(void) /** * Allocates a block of virtual memory of the given size - * to extend the VMM to 48MEG in size in mainstore + * to extend the VMM into Mainstore (up to VMM_MEMORY_SIZE) */ int BaseSegment::_mmExtend(void) { - // The base address of the extended memory is 8Mg.. The first x pages is - // for the SPTE.. The remaining pages from 8MG + SPTE to 48MEG is added to - // the HEAP.. + // The base address of the extended memory is the cache size.. The first x + // pages is for the SPTE.. The remaining pages from the end of cache + SPTE + // up to VMM_MEMORY_SIZE of mainstore is added to the HEAP. - uint64_t l_vaddr = VMM_ADDR_EXTEND_BLOCK; // 8MEG - uint64_t l_size = VMM_EXTEND_BLOCK_SIZE; // 48MEG - 8MB (base block) + uint64_t l_vaddr = VMM_ADDR_EXTEND_BLOCK; // Cache size + uint64_t l_size = VMM_EXTEND_BLOCK_SIZE; // VMM - 8MB (base block) // Call to allocate a block passing in the requested address of where the // SPTEs should be created @@ -283,14 +283,14 @@ int BaseSegment::_mmExtend(void) PageManager::addMemory(l_vaddr + (spte_pages*PAGESIZE), l_size/PAGESIZE - spte_pages); - // Update the physical Memory size to now be 48MEG. by adding the extended - // block size to the physical mem size. + // Update the physical Memory size to now include some mainstore by adding + // the extended block size to the physical mem size. iv_physMemSize += VMM_EXTEND_BLOCK_SIZE; // Call to set the Hostboot MemSize and location needed for DUMP. KernelMemState::setMemScratchReg(KernelMemState::MEM_CONTAINED_MS, - KernelMemState::MS_48MEG); + KernelMemState::FULL_MEM); return 0; } diff --git a/src/kernel/syscall.C b/src/kernel/syscall.C index c50bae001..d4df30733 100644 --- a/src/kernel/syscall.C +++ b/src/kernel/syscall.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2010,2017 */ +/* Contributors Listed Below - COPYRIGHT 2010,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -924,7 +924,7 @@ namespace Systemcalls * * Depending on the syscall parameter, we will either switch from 4MB * to a cache-contained mode (either full 10MB or reduced 8MB) or will - * expand into 48MB of space using real system memory. + * expand into VMM_MEMORY_SIZE of space using real system memory. * @param[in] t: The task used to extend Memory */ diff --git a/src/lib/syscall_mm.C b/src/lib/syscall_mm.C index 102075e40..fee402325 100644 --- a/src/lib/syscall_mm.C +++ b/src/lib/syscall_mm.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* Contributors Listed Below - COPYRIGHT 2011,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -95,7 +95,7 @@ uint64_t mm_virt_to_phys( void* i_vaddr ) } /** - * System call to extend Memory to 48Meg. + * System call to extend Memory to VMM_MEMORY_SIZE.. */ int mm_extend(MM_EXTEND_SIZE i_size) { diff --git a/src/usr/isteps/istep14/call_proc_exit_cache_contained.C b/src/usr/isteps/istep14/call_proc_exit_cache_contained.C index aa20dd2d2..94d133519 100644 --- a/src/usr/isteps/istep14/call_proc_exit_cache_contained.C +++ b/src/usr/isteps/istep14/call_proc_exit_cache_contained.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2017 */ +/* Contributors Listed Below - COPYRIGHT 2015,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -74,7 +74,7 @@ void* call_proc_exit_cache_contained (void *io_pArgs) // figure out what targets we need // customize any other inputs // set up loops to go through all targets (if parallel, spin off a task) - // extend the memory space from 8MEG to 48Meg + // extend the memory space from cache out to VMM_MEMORY_SIZE of mainstore //if mirrored then check that there is going to be memory at that location. //For sapphire with mirrored location flipped and at zero, @@ -326,7 +326,7 @@ void* call_proc_exit_cache_contained (void *io_pArgs) } } - // Call the function to extend VMM to 48MEG + // Call the function to extend VMM to mainstore int rc = mm_extend(); if (rc!=0) @@ -338,7 +338,7 @@ void* call_proc_exit_cache_contained (void *io_pArgs) * @userdata1 rc from mm_extend * @userdata2 * - * @devdesc Failure extending memory to 48MEG after + * @devdesc Failure extending memory to after * exiting cache contained mode. */ l_errl = new ERRORLOG::ErrlEntry -- cgit v1.2.1