[libvirt] [PATCH 1/5] s390: Cpu driver support for getModels, update and compare

Jiri Denemark jdenemar at redhat.com
Thu Nov 3 13:20:12 UTC 2016


On Wed, Nov 02, 2016 at 16:34:31 -0400, Jason J. Herne wrote:
> Implement getModels for s390. It returns an empty list. This means libvirt
> supports all models Qemu knows about.
> 
> Implement compare for s390. Required to test the guest against the host for
> guest cpu model runnability checking. We always return IDENTICAL to bypass
> Libvirt's checking. s390 will rely on Qemu to perform the runnability checking.
> 
> Implement update for s390. required to support use of cpu "host-model" mode.
> 
> Signed-off-by: Jason J. Herne <jjherne at linux.vnet.ibm.com>
> ---
>  src/cpu/cpu_s390.c | 31 +++++++++++++++++++++++++++++--
>  1 file changed, 29 insertions(+), 2 deletions(-)
> 
> diff --git a/src/cpu/cpu_s390.c b/src/cpu/cpu_s390.c
> index fb352a0..0f94084 100644
> --- a/src/cpu/cpu_s390.c
> +++ b/src/cpu/cpu_s390.c
> @@ -71,16 +71,43 @@ s390DataFree(virCPUDataPtr data)
>      VIR_FREE(data);
>  }
>  
> +static int
> +s390GetModels(char ***models ATTRIBUTE_UNUSED)
> +{
> +    return 0;
> +}

This is almost an equivalent of not defining the function at all. Except
that your code leaves models uninitialized. Keeping
cpuArchDriver.getModels == NULL will do a better job (see cpu.c):

    if (!driver->getModels) {
        if (models)
            *models = NULL;
        return 0;
    }

> +
> +static virCPUCompareResult
> +virCPUs390Compare(virCPUDefPtr host ATTRIBUTE_UNUSED,
> +                 virCPUDefPtr cpu ATTRIBUTE_UNUSED,
> +                 bool failMessages ATTRIBUTE_UNUSED)
> +{
> +    return VIR_CPU_COMPARE_IDENTICAL;
> +}
> +
> +static int
> +virCPUs390Update(virCPUDefPtr guest ATTRIBUTE_UNUSED,
> +                 const virCPUDef *host ATTRIBUTE_UNUSED)
> +{
> +    /*
> +     * - host-passthrough not yet supported

Why is it not supported?

> +     * - host-model needs no changes

It actually needs changes. The CPU definition with mode='host-model'
needs to be replaced with mode='custom' and model name and possibly
features need to be set too.

> +     * - custom mode ... ???

Custom mode would need to be changed only when match='minimum' is used.
If that's not supported with s390, we should report an error. Hmm, which
reminds me, we should probably report what matches are supported in
domain capabilities.

Jirka




More information about the libvir-list mailing list