Re: [PATCH] conf: cpu: Add

2022-06-14 Thread Daniel P . Berrangé
On Sat, Jun 11, 2022 at 12:46:26PM -0400, Cole Robinson wrote:
> Internally we already collect x86 host family + model + stepping
> numeric values. This exposed them in capabilities CPU output.
> Example:
> 
> $ sudo virsh capabilities | grep -A1 -B1 signature
>   
>   
>   
> 
> Users need to know these values to calculate an expected.
> SEV-ES/SEV-SNP launch measurement.

More specifically, the VMSA register dumps contain a field that
encodes the family+model+stepping. So given a generic machine
portable VMSA blob, we need to be able to update it with the
family+model+stepping of the specific host executing a VM to
get a machine specific VMSA blob. This is then used in the
launjch measurement validation.


With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [PATCH] conf: cpu: Add

2022-06-14 Thread Jiri Denemark
On Sat, Jun 11, 2022 at 12:46:26 -0400, Cole Robinson wrote:
> Internally we already collect x86 host family + model + stepping
> numeric values. This exposed them in capabilities CPU output.
> Example:
> 
> $ sudo virsh capabilities | grep -A1 -B1 signature
>   
>   
>   
> 
> Users need to know these values to calculate an expected.
> SEV-ES/SEV-SNP launch measurement.
> 
> Signed-off-by: Cole Robinson 
> ---
>  src/conf/cpu_conf.c   | 36 +++
>  src/conf/cpu_conf.h   |  3 ++
>  src/conf/schemas/cputypes.rng | 13 +++
>  src/cpu/cpu_x86.c |  3 ++
>  .../x86_64-cpuid-A10-5800K-host.xml   |  1 +
>  .../x86_64-cpuid-Atom-D510-host.xml   |  1 +
>  .../x86_64-cpuid-Atom-N450-host.xml   |  1 +
>  .../x86_64-cpuid-Atom-P5362-host.xml  |  1 +
>  .../x86_64-cpuid-Cooperlake-host.xml  |  1 +
>  .../x86_64-cpuid-Core-i5-2500-host.xml|  1 +
>  .../x86_64-cpuid-Core-i5-2540M-host.xml   |  1 +
>  .../x86_64-cpuid-Core-i5-4670T-host.xml   |  1 +
>  .../x86_64-cpuid-Core-i5-650-host.xml |  1 +
>  .../x86_64-cpuid-Core-i5-6600-host.xml|  1 +
>  .../x86_64-cpuid-Core-i7-2600-host.xml|  1 +
>  ...86_64-cpuid-Core-i7-2600-xsaveopt-host.xml |  1 +
>  .../x86_64-cpuid-Core-i7-3520M-host.xml   |  1 +
>  .../x86_64-cpuid-Core-i7-3740QM-host.xml  |  1 +
>  .../x86_64-cpuid-Core-i7-3770-host.xml|  1 +
>  .../x86_64-cpuid-Core-i7-4510U-host.xml   |  1 +
>  .../x86_64-cpuid-Core-i7-4600U-host.xml   |  1 +
>  .../x86_64-cpuid-Core-i7-5600U-arat-host.xml  |  1 +
>  .../x86_64-cpuid-Core-i7-5600U-host.xml   |  1 +
>  .../x86_64-cpuid-Core-i7-5600U-ibrs-host.xml  |  1 +
>  .../x86_64-cpuid-Core-i7-7600U-host.xml   |  1 +
>  .../x86_64-cpuid-Core-i7-7700-host.xml|  1 +
>  .../x86_64-cpuid-Core-i7-8550U-host.xml   |  1 +
>  .../x86_64-cpuid-Core-i7-8700-host.xml|  1 +
>  .../x86_64-cpuid-Core2-E6850-host.xml |  1 +
>  .../x86_64-cpuid-Core2-Q9500-host.xml |  1 +
>  .../x86_64-cpuid-EPYC-7601-32-Core-host.xml   |  1 +
>  ...6_64-cpuid-EPYC-7601-32-Core-ibpb-host.xml |  1 +
>  .../cputestdata/x86_64-cpuid-FX-8150-host.xml |  1 +
>  .../x86_64-cpuid-Opteron-1352-host.xml|  1 +
>  .../x86_64-cpuid-Opteron-2350-host.xml|  1 +
>  .../x86_64-cpuid-Opteron-6234-host.xml|  1 +
>  .../x86_64-cpuid-Opteron-6282-host.xml|  1 +
>  .../x86_64-cpuid-Pentium-P6100-host.xml   |  1 +
>  .../x86_64-cpuid-Phenom-B95-host.xml  |  1 +
>  ...64-cpuid-Ryzen-7-1800X-Eight-Core-host.xml |  1 +
>  .../x86_64-cpuid-Xeon-5110-host.xml   |  1 +
>  .../x86_64-cpuid-Xeon-E3-1225-v5-host.xml |  1 +
>  .../x86_64-cpuid-Xeon-E3-1245-v5-host.xml |  1 +
>  .../x86_64-cpuid-Xeon-E5-2609-v3-host.xml |  1 +
>  .../x86_64-cpuid-Xeon-E5-2623-v4-host.xml |  1 +
>  .../x86_64-cpuid-Xeon-E5-2630-v3-host.xml |  1 +
>  .../x86_64-cpuid-Xeon-E5-2630-v4-host.xml |  1 +
>  .../x86_64-cpuid-Xeon-E5-2650-host.xml|  1 +
>  .../x86_64-cpuid-Xeon-E5-2650-v3-host.xml |  1 +
>  .../x86_64-cpuid-Xeon-E5-2650-v4-host.xml |  1 +
>  .../x86_64-cpuid-Xeon-E7-4820-host.xml|  1 +
>  .../x86_64-cpuid-Xeon-E7-4830-host.xml|  1 +
>  .../x86_64-cpuid-Xeon-E7-8890-v3-host.xml |  1 +
>  .../x86_64-cpuid-Xeon-E7540-host.xml  |  1 +
>  .../x86_64-cpuid-Xeon-Gold-5115-host.xml  |  1 +
>  .../x86_64-cpuid-Xeon-Gold-6130-host.xml  |  1 +
>  .../x86_64-cpuid-Xeon-Gold-6148-host.xml  |  1 +
>  .../x86_64-cpuid-Xeon-Platinum-8268-host.xml  |  1 +
>  .../x86_64-cpuid-Xeon-Platinum-9242-host.xml  |  1 +
>  .../x86_64-cpuid-Xeon-W3520-host.xml  |  1 +
>  .../x86_64-cpuid-Xeon-X5460-host.xml  |  1 +
>  61 files changed, 112 insertions(+)
> 
> diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
> index 2d447da7c3..1a09e27dca 100644
> --- a/src/conf/cpu_conf.c
> +++ b/src/conf/cpu_conf.c
> @@ -159,6 +159,9 @@ virCPUDefCopyModelFilter(virCPUDef *dst,
>  dst->vendor = g_strdup(src->vendor);
>  dst->vendor_id = g_strdup(src->vendor_id);
>  dst->microcodeVersion = src->microcodeVersion;
> +dst->sigFamily = src->sigFamily;
> +dst->sigModel = src->sigModel;
> +dst->sigStepping = src->sigStepping;
>  dst->nfeatures_max = src->nfeatures;
>  dst->nfeatures = 0;
>  
> @@ -210,6 +213,9 @@ virCPUDefStealModel(virCPUDef *dst,
>  dst->model = g_steal_pointer(>model);
>  dst->features = g_steal_pointer(>features);
>  dst->microcodeVersion = src->microcodeVersion;
> +dst->sigFamily = src->sigFamily;
> +dst->sigModel = src->sigModel;
> +dst->sigStepping = src->sigStepping;
>  dst->nfeatures_max = src->nfeatures_max;
>  src->nfeatures_max = 0;
>  dst->nfeatures = src->nfeatures;

The CPU signature is introduced only for reporting the host CPU
capability and 

[PATCH] conf: cpu: Add

2022-06-11 Thread Cole Robinson
Internally we already collect x86 host family + model + stepping
numeric values. This exposed them in capabilities CPU output.
Example:

$ sudo virsh capabilities | grep -A1 -B1 signature
  
  
  

Users need to know these values to calculate an expected.
SEV-ES/SEV-SNP launch measurement.

Signed-off-by: Cole Robinson 
---
 src/conf/cpu_conf.c   | 36 +++
 src/conf/cpu_conf.h   |  3 ++
 src/conf/schemas/cputypes.rng | 13 +++
 src/cpu/cpu_x86.c |  3 ++
 .../x86_64-cpuid-A10-5800K-host.xml   |  1 +
 .../x86_64-cpuid-Atom-D510-host.xml   |  1 +
 .../x86_64-cpuid-Atom-N450-host.xml   |  1 +
 .../x86_64-cpuid-Atom-P5362-host.xml  |  1 +
 .../x86_64-cpuid-Cooperlake-host.xml  |  1 +
 .../x86_64-cpuid-Core-i5-2500-host.xml|  1 +
 .../x86_64-cpuid-Core-i5-2540M-host.xml   |  1 +
 .../x86_64-cpuid-Core-i5-4670T-host.xml   |  1 +
 .../x86_64-cpuid-Core-i5-650-host.xml |  1 +
 .../x86_64-cpuid-Core-i5-6600-host.xml|  1 +
 .../x86_64-cpuid-Core-i7-2600-host.xml|  1 +
 ...86_64-cpuid-Core-i7-2600-xsaveopt-host.xml |  1 +
 .../x86_64-cpuid-Core-i7-3520M-host.xml   |  1 +
 .../x86_64-cpuid-Core-i7-3740QM-host.xml  |  1 +
 .../x86_64-cpuid-Core-i7-3770-host.xml|  1 +
 .../x86_64-cpuid-Core-i7-4510U-host.xml   |  1 +
 .../x86_64-cpuid-Core-i7-4600U-host.xml   |  1 +
 .../x86_64-cpuid-Core-i7-5600U-arat-host.xml  |  1 +
 .../x86_64-cpuid-Core-i7-5600U-host.xml   |  1 +
 .../x86_64-cpuid-Core-i7-5600U-ibrs-host.xml  |  1 +
 .../x86_64-cpuid-Core-i7-7600U-host.xml   |  1 +
 .../x86_64-cpuid-Core-i7-7700-host.xml|  1 +
 .../x86_64-cpuid-Core-i7-8550U-host.xml   |  1 +
 .../x86_64-cpuid-Core-i7-8700-host.xml|  1 +
 .../x86_64-cpuid-Core2-E6850-host.xml |  1 +
 .../x86_64-cpuid-Core2-Q9500-host.xml |  1 +
 .../x86_64-cpuid-EPYC-7601-32-Core-host.xml   |  1 +
 ...6_64-cpuid-EPYC-7601-32-Core-ibpb-host.xml |  1 +
 .../cputestdata/x86_64-cpuid-FX-8150-host.xml |  1 +
 .../x86_64-cpuid-Opteron-1352-host.xml|  1 +
 .../x86_64-cpuid-Opteron-2350-host.xml|  1 +
 .../x86_64-cpuid-Opteron-6234-host.xml|  1 +
 .../x86_64-cpuid-Opteron-6282-host.xml|  1 +
 .../x86_64-cpuid-Pentium-P6100-host.xml   |  1 +
 .../x86_64-cpuid-Phenom-B95-host.xml  |  1 +
 ...64-cpuid-Ryzen-7-1800X-Eight-Core-host.xml |  1 +
 .../x86_64-cpuid-Xeon-5110-host.xml   |  1 +
 .../x86_64-cpuid-Xeon-E3-1225-v5-host.xml |  1 +
 .../x86_64-cpuid-Xeon-E3-1245-v5-host.xml |  1 +
 .../x86_64-cpuid-Xeon-E5-2609-v3-host.xml |  1 +
 .../x86_64-cpuid-Xeon-E5-2623-v4-host.xml |  1 +
 .../x86_64-cpuid-Xeon-E5-2630-v3-host.xml |  1 +
 .../x86_64-cpuid-Xeon-E5-2630-v4-host.xml |  1 +
 .../x86_64-cpuid-Xeon-E5-2650-host.xml|  1 +
 .../x86_64-cpuid-Xeon-E5-2650-v3-host.xml |  1 +
 .../x86_64-cpuid-Xeon-E5-2650-v4-host.xml |  1 +
 .../x86_64-cpuid-Xeon-E7-4820-host.xml|  1 +
 .../x86_64-cpuid-Xeon-E7-4830-host.xml|  1 +
 .../x86_64-cpuid-Xeon-E7-8890-v3-host.xml |  1 +
 .../x86_64-cpuid-Xeon-E7540-host.xml  |  1 +
 .../x86_64-cpuid-Xeon-Gold-5115-host.xml  |  1 +
 .../x86_64-cpuid-Xeon-Gold-6130-host.xml  |  1 +
 .../x86_64-cpuid-Xeon-Gold-6148-host.xml  |  1 +
 .../x86_64-cpuid-Xeon-Platinum-8268-host.xml  |  1 +
 .../x86_64-cpuid-Xeon-Platinum-9242-host.xml  |  1 +
 .../x86_64-cpuid-Xeon-W3520-host.xml  |  1 +
 .../x86_64-cpuid-Xeon-X5460-host.xml  |  1 +
 61 files changed, 112 insertions(+)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 2d447da7c3..1a09e27dca 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -159,6 +159,9 @@ virCPUDefCopyModelFilter(virCPUDef *dst,
 dst->vendor = g_strdup(src->vendor);
 dst->vendor_id = g_strdup(src->vendor_id);
 dst->microcodeVersion = src->microcodeVersion;
+dst->sigFamily = src->sigFamily;
+dst->sigModel = src->sigModel;
+dst->sigStepping = src->sigStepping;
 dst->nfeatures_max = src->nfeatures;
 dst->nfeatures = 0;
 
@@ -210,6 +213,9 @@ virCPUDefStealModel(virCPUDef *dst,
 dst->model = g_steal_pointer(>model);
 dst->features = g_steal_pointer(>features);
 dst->microcodeVersion = src->microcodeVersion;
+dst->sigFamily = src->sigFamily;
+dst->sigModel = src->sigModel;
+dst->sigStepping = src->sigStepping;
 dst->nfeatures_max = src->nfeatures_max;
 src->nfeatures_max = 0;
 dst->nfeatures = src->nfeatures;
@@ -421,6 +427,7 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
 if (def->type == VIR_CPU_TYPE_HOST) {
 g_autofree char *arch = virXPathString("string(./arch[1])", ctxt);
 xmlNodePtr counter_node = NULL;
+xmlNodePtr signature_node = NULL;
 
 if (!arch) {
 virReportError(VIR_ERR_XML_ERROR, "%s",