Skip to content

x86: add a way for a PD to query the TSC frequency #525

Description

@dreamliner787-9

On x86, the TSC is readable by userspace and you can easily derive its frequency by reading the relevant CPUID leafs. However, in some environments (e.g. virtualisation), those CPUID leafs won't always be enumerated and you won't be able to derive the TSC frequency in userspace.

However, the kernel measures the TSC frequency at boot with the PIT, then exposes it as a BootInfo entry. We should add a way to patch this information into certain PDs to make it easier to use the TSC as a fast and accurate clock source (e.g. for userspace timer drivers or VMMs).

It could look like this:

<system>
    <protection_domain name="timer_driver" priority="200" >
        <program_image path="timer.elf" />
        <setvar x86_tsc_freq_symbol="tsc_freq" />
    </protection_domain>
</system>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions