From: Richard Henderson <richard.henderson@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH 6/7] target/i386: implement RDPID in TCG
Date: Mon, 19 Jun 2023 09:40:21 +0200 [thread overview]
Message-ID: <e137adbf-f1cd-2d2a-a45b-359bacb32c75@linaro.org> (raw)
In-Reply-To: <20230618215114.107337-7-pbonzini@redhat.com>
On 6/18/23 23:51, Paolo Bonzini wrote:
> 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).
> For BSD, just return 0.
>
> RDTSCP is reimplemented as RDTSC + RDPID ECX; the differences in terms
> of serializability are not relevant to QEMU.
>
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
> linux-user/i386/target_cpu.h | 8 ++++++++
> linux-user/x86_64/target_cpu.h | 1 +
> target/i386/cpu.c | 10 +++++++++-
> target/i386/helper.h | 2 +-
> target/i386/tcg/misc_helper.c | 21 +++++++++++++++------
> target/i386/tcg/translate.c | 15 +++++++++++++--
> 6 files changed, 47 insertions(+), 10 deletions(-)
>
> diff --git a/linux-user/i386/target_cpu.h b/linux-user/i386/target_cpu.h
> index 52caf788cc3..3539f790222 100644
> --- a/linux-user/i386/target_cpu.h
> +++ b/linux-user/i386/target_cpu.h
> @@ -54,4 +54,12 @@ static inline abi_ulong get_sp_from_cpustate(CPUX86State *state)
> {
> return state->regs[R_ESP];
> }
> +
> +static inline uint32_t get_cpunode(void)
> +{
> + unsigned cpu, node;
> + getcpu(&cpu, &node);
> + return (node << 12) | (cpu & 0xfff);
> +}
> +
What is our minimum glibc version? This requires 2.29.
Also, not especially fond of the placement. target/ including linux-user/ header isn't
nice. Might as well just place these 3 lines in misc_helper.c to begin.
r~
next prev parent reply other threads:[~2023-06-19 7:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-18 21:51 [PATCH 0/7] target/i386: add a few simple features Paolo Bonzini
2023-06-18 21:51 ` [PATCH 1/7] target/i386: fix INVD vmexit Paolo Bonzini
2023-06-19 7:17 ` Richard Henderson
2023-06-18 21:51 ` [PATCH 2/7] target/i386: TCG supports 3DNow! prefetch(w) Paolo Bonzini
2023-06-19 7:19 ` Richard Henderson
2023-06-18 21:51 ` [PATCH 3/7] target/i386: TCG supports RDSEED Paolo Bonzini
2023-06-19 7:23 ` Richard Henderson
2023-06-18 21:51 ` [PATCH 4/7] target/i386: TCG supports 32-bit SYSCALL Paolo Bonzini
2023-06-19 7:28 ` Richard Henderson
2023-06-19 13:49 ` Paolo Bonzini
2023-06-18 21:51 ` [PATCH 5/7] target/i386: TCG supports XSAVEERPTR Paolo Bonzini
2023-06-19 7:53 ` Richard Henderson
2023-06-18 21:51 ` [PATCH 6/7] target/i386: implement RDPID in TCG Paolo Bonzini
2023-06-19 7:40 ` Richard Henderson [this message]
2023-06-20 14:38 ` Paolo Bonzini
2023-06-18 21:51 ` [PATCH 7/7] target/i386: implement WBNOINVD " Paolo Bonzini
2023-06-19 7:53 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e137adbf-f1cd-2d2a-a45b-359bacb32c75@linaro.org \
--to=richard.henderson@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).