From 667da45e416e31934611ea7c1023e7898fc3707d Mon Sep 17 00:00:00 2001 From: Sergii Dmytruk Date: Sat, 23 May 2026 20:58:11 +0300 Subject: [PATCH] mb/emulation/qemu-q35: don't select CONFIG_UNKNOWN_TSC_RATE This option signifies missing implementation of tsc_freq_mhz() which results in tsc_freq_mhz() from src/arch/x86/timestamp.c returning zero. That zero in turn gets put into TIMESTAMP CBMEM table requiring payloads and user-space tools to figure out the frequency on their own. Implement tsc_freq_mhz() to query timer frequency in coreboot, so it gets reported downstream. Change-Id: I88d1206c13f15a9f20c07b65dcec42ec614f7e6a Upstream-Status: Pending Signed-off-by: Sergii Dmytruk --- src/cpu/qemu-x86/Kconfig | 1 - src/mainboard/emulation/qemu-q35/Makefile.mk | 2 ++ src/mainboard/emulation/qemu-q35/timer.c | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/mainboard/emulation/qemu-q35/timer.c diff --git a/src/cpu/qemu-x86/Kconfig b/src/cpu/qemu-x86/Kconfig index f564d70066..6a34687d3d 100644 --- a/src/cpu/qemu-x86/Kconfig +++ b/src/cpu/qemu-x86/Kconfig @@ -6,7 +6,6 @@ config CPU_QEMU_X86 select HAVE_X86_64_SUPPORT select UDELAY_TSC select TSC_MONOTONIC_TIMER - select UNKNOWN_TSC_RATE select NEED_SMALL_2MB_PAGE_TABLES # QEMU doesn't support 1GB pages select IDT_IN_EVERY_STAGE diff --git a/src/mainboard/emulation/qemu-q35/Makefile.mk b/src/mainboard/emulation/qemu-q35/Makefile.mk index c1619f5ede..1d3b39c475 100644 --- a/src/mainboard/emulation/qemu-q35/Makefile.mk +++ b/src/mainboard/emulation/qemu-q35/Makefile.mk @@ -18,9 +18,11 @@ ramstage-y += cpu.c all-y += ../qemu-i440fx/fw_cfg.c all-y += ../qemu-i440fx/bootmode.c +all-y += timer.c ramstage-$(CONFIG_CHROMEOS) += chromeos.c smm-y += ../qemu-i440fx/rom_media.c smm-y += memmap.c smm-y += smihandler.c +smm-y += timer.c diff --git a/src/mainboard/emulation/qemu-q35/timer.c b/src/mainboard/emulation/qemu-q35/timer.c new file mode 100644 index 0000000000..74a693e953 --- /dev/null +++ b/src/mainboard/emulation/qemu-q35/timer.c @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include + +unsigned long tsc_freq_mhz(void) +{ + /* ACPI's Power Management Timer frequency is fixed at 3.579545 MHz. */ + return 3579545 / 1000000; +}