[PATCH V5 1/4] cpu: Introduce virCPUarmData and related struts

Jiri Denemark jdenemar at redhat.com
Fri May 15 09:51:23 UTC 2020


On Wed, May 13, 2020 at 18:48:30 +0800, Zhenyu Zheng wrote:
> Introduce virCPUarmData to virCPUData and related
> structs to cpu_arm.c for ARM cpus.
> 
> Signed-off-by: Zhenyu Zheng <zheng.zhenyu at outlook.com>
> ---
>  src/cpu/Makefile.inc.am |  1 +
>  src/cpu/cpu.h           |  2 ++
>  src/cpu/cpu_arm.c       | 80 ++++++++++++++++++++++++++++++++++++++++-
>  src/cpu/cpu_arm_data.h  | 32 +++++++++++++++++
>  4 files changed, 114 insertions(+), 1 deletion(-)
>  create mode 100644 src/cpu/cpu_arm_data.h
> 
...
> diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
> index ee5802198f..1bb0afb762 100644
> --- a/src/cpu/cpu_arm.c
> +++ b/src/cpu/cpu_arm.c
...
> @@ -201,7 +279,6 @@ virCPUarmUpdate(virCPUDefPtr guest,
>      return ret;
>  }
>  
> -
>  static virCPUDefPtr
>  virCPUarmBaseline(virCPUDefPtr *cpus,
>                    unsigned int ncpus G_GNUC_UNUSED,

Unrelated and undone in the patch 2.

> @@ -259,6 +336,7 @@ struct cpuArchDriver cpuDriverArm = {
>      .compare = virCPUarmCompare,
>      .decode = NULL,
>      .encode = NULL,
> +    .dataFree = virCPUarmDataFree,
>      .baseline = virCPUarmBaseline,
>      .update = virCPUarmUpdate,
>      .validateFeatures = virCPUarmValidateFeatures,
> diff --git a/src/cpu/cpu_arm_data.h b/src/cpu/cpu_arm_data.h
> new file mode 100644
> index 0000000000..9b931cb8aa
> --- /dev/null
> +++ b/src/cpu/cpu_arm_data.h
> @@ -0,0 +1,32 @@
> +/*
> + * cpu_arm_data.h: 64-bit arm CPU specific data
> + *
> + * Copyright (C) 2020 Huawei Technologies Co., Ltd.
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library;  If not, see
> + * <http://www.gnu.org/licenses/>.
> + *
> + */
> +
> +#pragma once
> +
> +#define VIR_CPU_ARM_DATA_INIT { 0 }
> +
> +typedef struct _virCPUarmData virCPUarmData;
> +struct _virCPUarmData {
> +    unsigned long vendor_id;
> +    unsigned long pvr;
> +    char **features;
> +    size_t nfeatures;

This is not necessary since features is NULL-terminated.

> +};

Jirka




More information about the libvir-list mailing list