From c4e7bcba07ccefc7f8094172def49a7e2a2cedcc Mon Sep 17 00:00:00 2001 From: Dean Sanner Date: Mon, 17 Jun 2019 07:14:35 -0500 Subject: [PATCH] Compile Hostboot with -Os Hostboot currently spends a significant percentage of time loading data from PNOR across a relatively slow LPC bus. This commit enables compilation of Hostboot with -Os, optimized for space to reduce the amount of data required to be transferred across the LPC bus Rough measurements show a ~30% size reduction of the hostboot image and a ~10% reduction (improvement) in boot time Change-Id: Ib73863019595a24cc7d10e924bc5c92cd64af1ed Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/84436 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: William G Hoffa --- src/build/linker/linker.C | 16 ++++++++++++++++ src/build/mkrules/cflags.env.mk | 2 +- src/makefile | 3 ++- src/usr/errl/runtime/test/test_runtimeDeconfig.H | 12 ++++++------ src/usr/isteps/istep16/call_mss_scrub.C | 2 +- src/usr/isteps/tod/runtime/rt_todintf.C | 2 +- 6 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/build/linker/linker.C b/src/build/linker/linker.C index e5e53ad8a4b..ba498d8a907 100644 --- a/src/build/linker/linker.C +++ b/src/build/linker/linker.C @@ -123,6 +123,7 @@ struct Object string name; //!< full path name of file bfd* image; //!< bfd image of object Section text; //!< text section of binary + Section sfpr; //!< sfpr section of binary Section rodata; //!< rodata section of binary Section data; //!< data section of binary map symbols; //!< symbol map @@ -594,6 +595,11 @@ bool Object::read_object(const char* i_file) { s = &this->text; } + else if (string(".sfpr") == + bfd_get_section_name(image, image_section)) + { + s = &this->sfpr; + } else if (string(".rodata") == bfd_get_section_name(image, image_section)) { @@ -648,6 +654,16 @@ bool Object::write_object() cout << strerror(error) << endl; } + // Output sfpr section. + fseek(iv_output, offset + sfpr.vma_offset, SEEK_SET); + if ((0 != sfpr.size) && + (sfpr.size != fwrite(sfpr.data, 1, sfpr.size, iv_output))) + { + int error = errno; + cout << "Error writing to output for sfpr." << endl; + cout << strerror(error) << endl; + } + // Output RODATA section. fseek(iv_output, offset + rodata.vma_offset, SEEK_SET); if ((0 != rodata.size) && diff --git a/src/build/mkrules/cflags.env.mk b/src/build/mkrules/cflags.env.mk index 04ff6fedd37..e1d36c190b1 100644 --- a/src/build/mkrules/cflags.env.mk +++ b/src/build/mkrules/cflags.env.mk @@ -28,7 +28,7 @@ # Description: # Configuration of the compiler, linker, etc. flags. -OPT_LEVEL ?= -O3 +OPT_LEVEL ?= -Os ifdef MODULE COMMONFLAGS += -fPIC -Bsymbolic -Bsymbolic-functions diff --git a/src/makefile b/src/makefile index bd80d63bfb4..f8343555b4d 100644 --- a/src/makefile +++ b/src/makefile @@ -237,7 +237,8 @@ TESTCASE_MODULES += testscan TESTCASE_MODULES += testsecureboot TESTCASE_MODULES += testfsiscom TESTCASE_MODULES += testlpc -TESTCASE_MODULES += $(if $(CONFIG_HTMGT),testhtmgt) +#TODO: RTC 213102 to properly add & execute HTMGT test +#TESTCASE_MODULES += $(if $(CONFIG_HTMGT),testhtmgt) TESTCASE_MODULES += testinitservice TESTCASE_MODULES += testfsi TESTCASE_MODULES += testibscom diff --git a/src/usr/errl/runtime/test/test_runtimeDeconfig.H b/src/usr/errl/runtime/test/test_runtimeDeconfig.H index a9ba1ecbdc9..0cf1a0a520b 100644 --- a/src/usr/errl/runtime/test/test_runtimeDeconfig.H +++ b/src/usr/errl/runtime/test/test_runtimeDeconfig.H @@ -51,8 +51,8 @@ class deconfigureTargetAtRuntimeTest : public CxxTest::TestSuite // pass in a null target pointer TARGETING::Target * l_target = nullptr; - errlHndl_t l_errl = - HWAS::theDeconfigGard().deconfigureTargetAtRuntime( + errlHndl_t l_errl = nullptr; + l_errl = HWAS::theDeconfigGard().deconfigureTargetAtRuntime( l_target, HWAS::DeconfigGard::FULLY_AT_RUNTIME, l_errl); @@ -118,8 +118,8 @@ class deconfigureTargetAtRuntimeTest : public CxxTest::TestSuite l_target = l_cores.at(0); - errlHndl_t l_errl = - HWAS::theDeconfigGard().deconfigureTargetAtRuntime( + errlHndl_t l_errl = nullptr; + l_errl = HWAS::theDeconfigGard().deconfigureTargetAtRuntime( l_target, HWAS::DeconfigGard::SPEC_DECONFIG, l_errl); @@ -179,8 +179,8 @@ class deconfigureTargetAtRuntimeTest : public CxxTest::TestSuite TARGETING::Target * l_target = l_proc.at(0); - errlHndl_t l_errl = - HWAS::theDeconfigGard().deconfigureTargetAtRuntime( + errlHndl_t l_errl = nullptr; + l_errl = HWAS::theDeconfigGard().deconfigureTargetAtRuntime( l_target, HWAS::DeconfigGard::FULLY_AT_RUNTIME, l_errl); diff --git a/src/usr/isteps/istep16/call_mss_scrub.C b/src/usr/isteps/istep16/call_mss_scrub.C index 750a85c0186..0d4db2acde7 100644 --- a/src/usr/isteps/istep16/call_mss_scrub.C +++ b/src/usr/isteps/istep16/call_mss_scrub.C @@ -73,7 +73,7 @@ void* call_mss_scrub (void *io_pArgs) // Determine which target type runs the maintenance commands. TARGETING::MODEL masterProcModel = masterProc->getAttr(); - TARGETING::TYPE maintTrgtType; + TARGETING::TYPE maintTrgtType = TYPE_MBA; switch ( masterProcModel ) { case MODEL_CUMULUS: maintTrgtType = TYPE_MBA; break; diff --git a/src/usr/isteps/tod/runtime/rt_todintf.C b/src/usr/isteps/tod/runtime/rt_todintf.C index cc0bdb7cfb1..e5c537cd3b9 100644 --- a/src/usr/isteps/tod/runtime/rt_todintf.C +++ b/src/usr/isteps/tod/runtime/rt_todintf.C @@ -31,7 +31,7 @@ #include // g_hostInterfaces #include // firmware_request_helper #include // TOD_RT_TOPOLOGY_RESET_BACKUP, etc -#include // errlCommit +#include using namespace ERRORLOG;