Skip to content

mb/emulation/qemu-q35: don't select CONFIG_UNKNOWN_TSC_RATE#903

Open
SergiiDmytruk wants to merge 1 commit into
dasharofrom
fix-qemu-timer-frequency
Open

mb/emulation/qemu-q35: don't select CONFIG_UNKNOWN_TSC_RATE#903
SergiiDmytruk wants to merge 1 commit into
dasharofrom
fix-qemu-timer-frequency

Conversation

@SergiiDmytruk
Copy link
Copy Markdown
Member

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 the frequency on their own.


Dasharo/edk2@0beada2 fixed parsing of TIMESTAMP table, resulting in division by zero when starting QEMU. Addressing it in coreboot, similarly to the fix for APUs in #887. This fixes CI failures like https://github.com/Dasharo/coreboot/actions/runs/26337084146/job/77532919152#step:11:13.

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 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 <sergii.dmytruk@3mdeb.com>
/* Mimics implementation of acpi_fill_fadt() in southbridge/intel/i82801ix/fadt.c. */
u16 pmbase = pci_read_config16(PCI_DEV(0, 0x1f, 0), 0x40) & 0xfffe;
u16 pm_tmr_blk = pmbase + PM1_TMR;
return inl(pm_tmr_blk);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SergiiDmytruk this returns the current tick, not the frequency. Am I right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right, not sure how I confused it for frequency which is actually hard-coded (as used by AcpiTimerLib selected for QEMU). Should it be simply returned here or better to make EDK handle 0 in some sensible way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants