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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
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@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux