[libvirt] [PATCH 7/8] cpu: Remove hardcoded list of PowerPC models

Eric Blake eblake at redhat.com
Sat Dec 22 05:03:12 UTC 2012


On 12/20/2012 05:01 PM, Jiri Denemark wrote:
> The cpu_map.xml file is there to separate CPU model definitions from the
> code. Having the only interesting data for PowerPC models only in the
> source code. This patch moves this data to the XML file and removes the
> hardcoded list completely.
> ---
>  src/cpu/cpu_map.xml   |   5 ++
>  src/cpu/cpu_powerpc.c | 161 ++++++++++++++++++--------------------------------
>  2 files changed, 63 insertions(+), 103 deletions(-)
> 
> diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
> index ba8c17d..6d51283 100644
> --- a/src/cpu/cpu_map.xml
> +++ b/src/cpu/cpu_map.xml
> @@ -591,12 +591,17 @@
>      <!-- IBM-based CPU models -->
>      <model name='POWER7'>
>        <vendor name='IBM'/>
> +      <pvr value='0x003f0200'/>
>      </model>

Do we have an RNG schema for cpu_map.xml?  Should we?

> @@ -260,26 +209,29 @@ ppcModelLoad(xmlXPathContextPtr ctxt,
>          }
>      }
>  
> -    if (map->models == NULL)
> +    if (!virXPathBoolean("boolean(./pvr)", ctxt) ||

Is this call to virXPathBoolean necessary?  If the element doesn't exist,

> +        virXPathULongHex("string(./pvr/@value)", ctxt, &pvr) < 0) {

then isn't this call to virXPathULongHex guaranteed to fail, without
wasting time on the first query?

> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("Missing or invalid PVR value in CPU model %s"),
> +                       model->name);
> +        goto ignore;
> +    }
> +    model->data.pvr = pvr;
> +
> +    if (map->models == NULL) {
>          map->models = model;
> -    else {

Nice cleanup of style violation along the way.

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121221/1ce298d3/attachment-0001.sig>


More information about the libvir-list mailing list