[libvirt] [PATCH] qemu: Implement a stub cpuArchDriver.baseline() handler for aarch64

Cole Robinson crobinso at redhat.com
Tue Feb 11 22:38:48 UTC 2014


On 02/11/2014 10:51 AM, Oleg Strikov wrote:
> Openstack Nova calls virConnectBaselineCPU() during initialization
> of the instance to get a full list of CPU features.
> This patch adds a stub to aarch64-specific code to handle
> this request (no actual work is done). That's enough to have
> this stub with limited functionality because qemu/kvm backend
> supports only 'host-passthrough' cpu mode on aarch64.
> 

Sounds reasonable. ACK and pushed.

Thanks,
Cole

> Signed-off-by: Oleg Strikov <oleg.strikov at canonical.com>
> ---
>  src/cpu/cpu_aarch64.c |   25 ++++++++++++++++++++++++-
>  1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/src/cpu/cpu_aarch64.c b/src/cpu/cpu_aarch64.c
> index f674bff..3c3e749 100644
> --- a/src/cpu/cpu_aarch64.c
> +++ b/src/cpu/cpu_aarch64.c
> @@ -85,6 +85,29 @@ AArch64GuestData(virCPUDefPtr host ATTRIBUTE_UNUSED,
>      return VIR_CPU_COMPARE_IDENTICAL;
>  }
>  
> +static virCPUDefPtr
> +AArch64Baseline(virCPUDefPtr *cpus,
> +                unsigned int ncpus ATTRIBUTE_UNUSED,
> +                const char **models ATTRIBUTE_UNUSED,
> +                unsigned int nmodels ATTRIBUTE_UNUSED,
> +                unsigned int flags)
> +{
> +    virCPUDefPtr cpu = NULL;
> +
> +    virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, NULL);
> +
> +    if (VIR_ALLOC(cpu) < 0 ||
> +        VIR_STRDUP(cpu->model, cpus[0]->model) < 0) {
> +        virCPUDefFree(cpu);
> +        return NULL;
> +    }
> +
> +    cpu->type = VIR_CPU_TYPE_GUEST;
> +    cpu->match = VIR_CPU_MATCH_EXACT;
> +
> +    return cpu;
> +}
> +
>  struct cpuArchDriver cpuDriverAARCH64 = {
>      .name = "aarch64",
>      .arch = archs,
> @@ -95,7 +118,7 @@ struct cpuArchDriver cpuDriverAARCH64 = {
>      .free = AArch64DataFree,
>      .nodeData = AArch64NodeData,
>      .guestData = AArch64GuestData,
> -    .baseline = NULL,
> +    .baseline = AArch64Baseline,
>      .update = AArch64Update,
>      .hasFeature = NULL,
>  };
> 




More information about the libvir-list mailing list