Skip to content
Snippets Groups Projects
  • Paolo Bonzini's avatar
    6750485b
    target/i386: implement RDPID in TCG · 6750485b
    Paolo Bonzini authored
    
    RDPID corresponds to a RDMSR(TSC_AUX); however, it is unprivileged
    so for user-mode emulation we must provide the value that the kernel
    places in the MSR.  For Linux, it is a combination of the current CPU
    and the current NUMA node, both of which can be retrieved with getcpu(2).
    Also try sched_getcpu(), which might be there on the BSDs.  If there is
    no portable way to retrieve the current CPU id from userspace, return 0.
    
    RDTSCP is reimplemented as RDTSC + RDPID ECX; the differences in terms
    of serializability are not relevant to QEMU.
    
    Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    6750485b
    History
    target/i386: implement RDPID in TCG
    Paolo Bonzini authored
    
    RDPID corresponds to a RDMSR(TSC_AUX); however, it is unprivileged
    so for user-mode emulation we must provide the value that the kernel
    places in the MSR.  For Linux, it is a combination of the current CPU
    and the current NUMA node, both of which can be retrieved with getcpu(2).
    Also try sched_getcpu(), which might be there on the BSDs.  If there is
    no portable way to retrieve the current CPU id from userspace, return 0.
    
    RDTSCP is reimplemented as RDTSC + RDPID ECX; the differences in terms
    of serializability are not relevant to QEMU.
    
    Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>