coreboot-kgpe-d16/src/include
Rob Barnes b11f9f7e16 timer: Switch mono_time to uint64_t
A 32-bit long storing microseconds will rollover every ~1.19 hours.
This can cause stopwatch to misbehave, causing unexpected failures.

If the current field in stopwatch is near 2^31, the expires field may
rollover when initialized. If this occurs, stopwatch_expired() will
instantly return true.

If current and expires fields are near 2^31, the current field could
rollover before being checked. In this case, stopwatch_expired() will
not return true for over an hour. Also stopwatch_duration_usecs() will
return a large negative duration.

This issue has only been observed in SMM since it never takes more
than 35 minutes to boot.

Switching to uint64_t mitigates this issue since it will not rollover
for over 500K+ years. The raw TSC would rollover sooner than this,
~200 years, depending on the tick frequency.

BUG=b:237082996
BRANCH=All
TEST=Boot Nipperkin

Change-Id: I4c24894718f093ac7cd1e434410bc64e6436869a
Signed-off-by: Rob Barnes <robbarnes@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65403
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Van Patten <timvp@google.com>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
2022-08-13 17:20:11 +00:00
..
acpi include/acpi: Add macros & definitions for resources types and flags 2022-07-16 23:21:03 +00:00
boot include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
console include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
cpu include: Add SPDX identifiers to files missing them 2022-08-11 17:53:11 +00:00
device Fix Alder Lake and Raptor Lake Device ID's 2022-08-12 17:12:12 +00:00
efi include/efi: Add EFI Status code definitions 2022-03-25 19:26:28 +00:00
mipi commonlib/bsd: Remove cb_err_t 2022-03-09 02:18:21 +00:00
pc80 include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
smp include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
superio
sys include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
adainit.h
asan.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
assert.h
b64_decode.h
base3.h
boardid.h
boot_device.h
bootblock_common.h
bootmem.h
bootmode.h mb/google,samsung: Drop init_bootmode_straps() 2022-04-09 02:50:01 +00:00
bootsplash.h
bootstate.h
cbfs.h commonlib/bsd: Remove cb_err_t 2022-03-09 02:18:21 +00:00
cbfs_glue.h
cbmem.h CBMEM: Change declarations for initialization hooks 2022-05-20 07:15:39 +00:00
cper.h include/bcd: move bcd code to commonlib/bsd/include 2021-08-23 14:08:47 +00:00
crc_byte.h
ctype.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
delay.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
device_tree.h
dimm_info_util.h arch/x86: Refactor the SMBIOS type 17 write function 2021-11-11 09:10:10 +00:00
dp_aux.h google/trogdor: Add backlight support for Parade ps8640 2021-11-02 08:17:21 +00:00
edid.h
elog.h elog: move MAX_EVENT_SIZE to commonlib/bsd/include 2021-09-10 22:53:19 +00:00
endian.h
espi.h include/espi.h: Switch to types.h 2022-03-27 15:13:31 +00:00
fallback.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
fit.h
fmap.h
framebuffer_info.h src: Remove unused <stdbool> 2022-01-19 15:15:50 +00:00
fw_config.h
gpio.h
halt.h
imd.h
imd_private.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
input-event-codes.h
inttypes.h
ip_checksum.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
kconfig.h
lib.h lib: Add __fls() (Find Last Set) 2021-12-13 02:57:07 +00:00
limits.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
list.h lib/list: Add list_append 2021-11-03 08:29:16 +00:00
main_decl.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
memlayout.h
memory_info.h include/memory_info.h: Increase DIMM_INFO_TOTAL to 32 2022-05-12 18:35:12 +00:00
memrange.h
metadata_hash.h
mrc_cache.h
nhlt.h
option.h
post.h
program_loading.h lib/program_loaders.c: Mark run_ramstage with __noreturn 2022-07-14 23:10:17 +00:00
ramdetect.h
random.h
reg_script.h
region_file.h
reset.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
rmodule.h
romstage_common.h arch/x86: Add a common romstage entry 2022-06-07 12:54:39 +00:00
romstage_handoff.h
rtc.h
rules.h Replace some ENV_ROMSTAGE with ENV_RAMINIT 2022-06-07 12:53:19 +00:00
sar.h wifi: Update deny list entry size to uint16_t 2021-09-09 15:01:35 +00:00
sdram_mode.h
smbios.h include/smbios.h: Update misc_slot_type and smbios_onboard_device_type 2022-06-20 10:50:41 +00:00
smmstore.h payloads/tianocore: Rename TianoCore to edk2 2022-08-13 16:35:18 +00:00
spd.h include/spd.h: Fix DDR4_SPD_72B_SO_{R,U}DIMM values 2022-03-28 14:14:27 +00:00
spd_bin.h
spd_cache.h
spi-generic.h drivers/spi/spi-generic: document SPI_CNTRLR_DEDUCT_CMD_LEN better 2021-12-15 22:39:21 +00:00
spi_bitbang.h
spi_flash.h
spi_sdcard.h
stage_cache.h
stdarg.h
stdbool.h
stddef.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
stdint.h
stdio.h
stdlib.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
string.h commonlib/bsd/helpers: Remove redundancy with libpayload defines 2022-03-30 21:21:47 +00:00
swab.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
symbols.h ELOG: Refactor watchdog_tombstone 2022-04-06 23:42:56 +00:00
thread.h rules.h: Use more consistent naming 2022-05-16 21:52:22 +00:00
timer.h timer: Switch mono_time to uint64_t 2022-08-13 17:20:11 +00:00
timestamp.h timestamp: Allow timestamp_add to accept a negative number 2022-01-21 22:42:19 +00:00
types.h include/types.h: #include <limits.h> 2021-12-26 09:59:12 +00:00
uuid.h
vbe.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
version.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
watchdog.h include: Add SPDX-License-Identifiers to files missing them 2022-08-01 13:59:11 +00:00
wrdd.h