[libvirt PATCH 36/39] cpu_x86: Add support for stepping part of CPU signature

Ján Tomko jtomko at redhat.com
Tue Apr 7 15:36:18 UTC 2020


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;
>+    }
>+
>+    return x86MakeSignature(sig->family, sig->model, stepping);
> }
>
>

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200407/9986ac0e/attachment-0001.sig>


More information about the libvir-list mailing list