[libvirt] [PATCH v2 2/3] Implement CPU model driver for PowerPC

Michal Privoznik mprivozn at redhat.com
Wed Oct 17 08:21:02 UTC 2012


Oh, I've just hit 'Send' without noticing ....

On 15.10.2012 11:07, Li Zhang wrote:
> Currently, the CPU model driver is not implemented for PowerPC.
> Host's CPU information is needed to exposed to guests' XML file some
> time.
> 
> This patch is to implement the callback functions of CPU model driver.
> 
> Signed-off-by: Li Zhang <zhlcindy at linux.vnet.ibm.com>
> ---
>  po/POTFILES.in        |    1 +
>  src/cpu/cpu_map.xml   |   14 ++
>  src/cpu/cpu_powerpc.c |  587 +++++++++++++++++++++++++++++++++++++++++++++++--
>  3 files changed, 586 insertions(+), 16 deletions(-)
> 

> +
> +static uint32_t ppc_mfpvr(void)
> +{
> +    uint32_t pvr;
> +    asm ("mfpvr %0"
> +        : "=r"(pvr));

... there is no such instruction on Intel processors. So I've made this
function and ...

> +    return pvr;
> +}
> +
> +static void
> +PowerPCDataFree(union cpuData *data)
> +{
> +    if (data == NULL)
> +        return;
> +
> +    VIR_FREE(data);
> +}
> +
>  static union cpuData *
>  PowerPCNodeData(void)
>  {
> @@ -42,40 +552,85 @@ PowerPCNodeData(void)
>          return NULL;
>      }
>  
> +    data->ppc.pvr = ppc_mfpvr();
> +

... this assignment conditional; just wrapped it with:
#if defined(__powerpc__) || defined(__powerpc64__)

Michal




More information about the libvir-list mailing list