diff options
author | Christian Geddes <crgeddes@us.ibm.com> | 2019-03-20 17:41:45 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2019-03-26 16:57:44 -0500 |
commit | 1c5f03e47872183ec9c29f75a724b73279b4a3da (patch) | |
tree | 423e9751d07877ab626dcfb04761dbb927110ec8 /src | |
parent | 17930bb348b5e6aa0a93627b52b5f4e3556c5520 (diff) | |
download | talos-hostboot-1c5f03e47872183ec9c29f75a724b73279b4a3da.tar.gz talos-hostboot-1c5f03e47872183ec9c29f75a724b73279b4a3da.zip |
Fix bug that was scrambling traces in errorlogs during HBRT
There was a bug in how HB was interpreting the clock time that
PHYP returned in response to a get_clocktime request. The
nsec member of the struct returned was getting the first 32bits
filled in and Hostboot was expecting the value to be in the last
32bits. This change will shift the nsec value down 4 bytes if we
find the back half of the nsec value to be all 0's. I believe the reason
the wrong bits were filled in is because PHYP is returning a packed
struct whose 2nd member is a 32 bit value so it does not get filled in
correctly.
Change-Id: I71f1c2cb672b9979e0b6bdc8b1852544f230b885
CQ: SW448397
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/74823
Reviewed-by: Matt Derksen <mderkse1@us.ibm.com>
Reviewed-by: Corey V. Swenson <cswenson@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: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/runtime/rt_time.C | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/runtime/rt_time.C b/src/runtime/rt_time.C index e222a3718..66032586a 100644 --- a/src/runtime/rt_time.C +++ b/src/runtime/rt_time.C @@ -25,6 +25,8 @@ #include <sys/time.h> #include <runtime/interface.h> +#define BITS_32_TO_63_MASK 0x00000000FFFFFFFF + void nanosleep(uint64_t sec, uint64_t nsec) { if (g_hostInterfaces && g_hostInterfaces->nanosleep) @@ -36,9 +38,19 @@ void nanosleep(uint64_t sec, uint64_t nsec) int clock_gettime(clockid_t i_clkId, timespec_t* o_tp) { int l_rc = -1; + if (g_hostInterfaces && g_hostInterfaces->clock_gettime) { l_rc = g_hostInterfaces->clock_gettime(i_clkId, o_tp); + + // If the back-half (bits 32:63) are all 0's then the + // nanoseconds are stored in the first 32 bits of the tv_nsec + // member of the timespec_t struct. We must shift over so later + // hostboot code interprets this correctly + if( (o_tp->tv_nsec & BITS_32_TO_63_MASK) == 0x0) + { + o_tp->tv_nsec = o_tp->tv_nsec >> 32; + } } return l_rc; } |