[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]