[libvirt PATCH 36/39] cpu_x86: Add support for stepping part of CPU signature
Jiri Denemark
jdenemar at redhat.com
Wed Apr 8 15:50:35 UTC 2020
On Tue, Apr 07, 2020 at 17:36:18 +0200, Ján Tomko wrote:
> On a Friday in 2020, Jiri Denemark wrote:
> >CPU models defined in the cpu_map can use signature/@stepping attribute
> >to match a limited set of stepping numbers. The value is a bitmap for
> >bits 0..15 each corresponding to a single stepping value. For example,
> >stepping='4-6,9' will match 4, 5, 6, and 9. Omitting the attribute is
> >equivalent to stepping='0-15'.
> >
> >Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> >---
> > src/cpu/cpu_x86.c | 60 +++++++++++++++++++++++++++++++++++++++--------
> > 1 file changed, 50 insertions(+), 10 deletions(-)
> >
> >diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
> >index 51c98efca9..bd224a9d0d 100644
> >--- a/src/cpu/cpu_x86.c
> >+++ b/src/cpu/cpu_x86.c
> >@@ -125,6 +125,7 @@ typedef struct _virCPUx86Signature virCPUx86Signature;
> > struct _virCPUx86Signature {
> > unsigned int family;
> > unsigned int model;
> >+ virBitmapPtr stepping;
> > };
> >
> > typedef struct _virCPUx86Signatures virCPUx86Signatures;
> >@@ -732,7 +733,17 @@ x86MakeSignature(unsigned int family,
> > static uint32_t
> > virCPUx86SignatureToCPUID(virCPUx86Signature *sig)
> > {
> >- return x86MakeSignature(sig->family, sig->model, 0);
> >+ unsigned int stepping = 0;
> >+
> >+ if (sig->stepping) {
> >+ ssize_t fisrtBit;
>
> first?
>
> >+
> >+ fisrtBit = virBitmapNextSetBit(sig->stepping, -1);
> >+ if (fisrtBit >= 0)
> >+ stepping = fisrtBit;
> >+ }
As you can see I really use completion a lot :-)
> >+
> >+ return x86MakeSignature(sig->family, sig->model, stepping);
> > }
>
> Reviewed-by: Ján Tomko <jtomko at redhat.com>
Thanks for the review.
Jirka
More information about the libvir-list
mailing list