From: Richard Henderson <richard.henderson@linaro.org>
To: quintela@redhat.com
Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org
Subject: Re: [PATCH 2/9] util: Add cpuinfo-i386.c
Date: Thu, 18 May 2023 05:45:27 -0700 [thread overview]
Message-ID: <57ba35be-88dc-9df4-8a34-0202e57e29d7@linaro.org> (raw)
In-Reply-To: <87wn16dlsl.fsf@secure.mitica>
On 5/18/23 02:35, Juan Quintela wrote:
> Richard Henderson <richard.henderson@linaro.org> wrote:
>> Add cpuinfo.h for i386 and x86_64, and the initialization
>> for that in util/. Populate that with a slightly altered
>> copy of the tcg host probing code. Other uses of cpuid.h
>> will be adjusted one patch at a time.
>>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>
> Reviewed-by: Juan Quintela <quintela@redhat.com>
>
> For what is worth my vote O:-)
>
>> +#define CPUINFO_ALWAYS (1u << 0) /* so cpuinfo is nonzero */
>> +#define CPUINFO_CMOV (1u << 1)
>> +#define CPUINFO_MOVBE (1u << 2)
>> +#define CPUINFO_LZCNT (1u << 3)
>> +#define CPUINFO_POPCNT (1u << 4)
>> +#define CPUINFO_BMI1 (1u << 5)
>> +#define CPUINFO_BMI2 (1u << 6)
>> +#define CPUINFO_SSE2 (1u << 7)
>> +#define CPUINFO_SSE4 (1u << 8)
>> +#define CPUINFO_AVX1 (1u << 9)
>> +#define CPUINFO_AVX2 (1u << 10)
>> +#define CPUINFO_AVX512F (1u << 11)
>> +#define CPUINFO_AVX512VL (1u << 12)
>> +#define CPUINFO_AVX512BW (1u << 13)
>> +#define CPUINFO_AVX512DQ (1u << 14)
>> +#define CPUINFO_AVX512VBMI2 (1u << 15)
>> +#define CPUINFO_ATOMIC_VMOVDQA (1u << 16)
>> +
>> +/* Initialized with a constructor. */
>> +extern unsigned cpuinfo;
>
> On one hand, it is weird having a flags variable that is only 32bit. I
> am so user to put 64 bit flags. Future proof, blah, blah, ...
>
> On the other hand, if tcg has survived for so long with only 16 bits, it
> is inside posibility that 32bits are more than enough.
Indeed. Nor is this an public abi that needs future-proofing -- in the event we need more
bits, we change it.
>> +/* Called both as constructor and (possibly) via other constructors. */
>> +unsigned __attribute__((constructor)) cpuinfo_init(void)
>> +{
>> + unsigned info = cpuinfo;
>> +
>> + if (info) {
>> + return info;
>> + }
>
> Have to look several times to this, because info "needed to be"" a
> static variable, right? O:-)
:-)
r~
next prev parent reply other threads:[~2023-05-18 12:45 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-18 4:40 [PATCH 0/9] Host-specific includes, begin cpuinfo.h Richard Henderson
2023-05-18 4:40 ` [PATCH 1/9] util: Introduce host-specific cpuinfo.h Richard Henderson
2023-05-18 9:30 ` Juan Quintela
2023-05-18 4:40 ` [PATCH 2/9] util: Add cpuinfo-i386.c Richard Henderson
2023-05-18 9:35 ` Juan Quintela
2023-05-18 12:45 ` Richard Henderson [this message]
2023-05-18 4:40 ` [PATCH 3/9] util: Add i386 CPUINFO_ATOMIC_VMOVDQU Richard Henderson
2023-05-18 15:52 ` Peter Maydell
2023-05-18 4:40 ` [PATCH 4/9] tcg/i386: Use cpuinfo.h Richard Henderson
2023-05-18 15:53 ` Peter Maydell
2023-05-18 4:40 ` [PATCH 5/9] util/bufferiszero: Use i386 cpuinfo.h Richard Henderson
2023-05-18 9:49 ` Juan Quintela
2023-05-18 12:48 ` Richard Henderson
2023-05-18 4:40 ` [PATCH 6/9] migration/xbzrle: Shuffle function order Richard Henderson
2023-05-18 9:19 ` Juan Quintela
2023-05-18 4:40 ` [PATCH 7/9] migration/xbzrle: Use i386 cacheinfo.h Richard Henderson
2023-05-18 9:44 ` Juan Quintela
2023-05-18 4:40 ` [PATCH 8/9] migration: Build migration_files once Richard Henderson
2023-05-18 9:20 ` Juan Quintela
2023-05-18 4:40 ` [PATCH 9/9] util: Add cpuinfo-aarch64.c Richard Henderson
2023-05-18 15:55 ` Peter Maydell
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=57ba35be-88dc-9df4-8a34-0202e57e29d7@linaro.org \
--to=richard.henderson@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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).