From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt2w5-0007V4-W9 for qemu-devel@nongnu.org; Thu, 02 Feb 2012 15:07:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rt2vz-0003vU-RO for qemu-devel@nongnu.org; Thu, 02 Feb 2012 15:07:13 -0500 Received: from mail-pz0-f45.google.com ([209.85.210.45]:42120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt2vz-0003vN-Jk for qemu-devel@nongnu.org; Thu, 02 Feb 2012 15:07:07 -0500 Received: by dadp14 with SMTP id p14so2696114dad.4 for ; Thu, 02 Feb 2012 12:07:06 -0800 (PST) Message-ID: <4F2AECE6.1060602@codemonkey.ws> Date: Thu, 02 Feb 2012 14:07:02 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1328201142-26145-1-git-send-email-pbonzini@redhat.com> <1328201142-26145-11-git-send-email-pbonzini@redhat.com> In-Reply-To: <1328201142-26145-11-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 10/16] qdev: make the non-legacy pci address property accept an integer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On 02/02/2012 10:45 AM, Paolo Bonzini wrote: > PCI addresses are set with qdev_prop_uint32. Thus we make the QOM > property accept a device and function encoded in an 8-bit integer, > instead of the magic dd.f hex string. > > Signed-off-by: Paolo Bonzini Isn't this a compatibility breaker? Won't this break libvirt's usage of -device addr=0.2 ? Regards, Anthony Liguori > --- > hw/qdev-properties.c | 25 +++++++------------------ > 1 files changed, 7 insertions(+), 18 deletions(-) > > diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c > index 4fb5cf8..e4bcc6d 100644 > --- a/hw/qdev-properties.c > +++ b/hw/qdev-properties.c > @@ -950,30 +950,19 @@ static int print_pci_devfn(DeviceState *dev, Property *prop, char *dest, size_t > } > } > > -static void get_pci_devfn(Object *obj, Visitor *v, void *opaque, > - const char *name, Error **errp) > -{ > - DeviceState *dev = DEVICE(obj); > - Property *prop = opaque; > - uint32_t *ptr = qdev_get_prop_ptr(dev, prop); > - char buffer[32]; > - char *p = buffer; > - > - buffer[0] = 0; > - if (*ptr != -1) { > - snprintf(buffer, sizeof(buffer), "%02x.%x", *ptr>> 3, *ptr& 7); > - } > - visit_type_str(v,&p, name, errp); > -} > - > PropertyInfo qdev_prop_pci_devfn = { > .name = "pci-devfn", > .type = PROP_TYPE_UINT32, > .size = sizeof(uint32_t), > .parse = parse_pci_devfn, > .print = print_pci_devfn, > - .get = get_pci_devfn, > - .set = set_generic, > + .get = get_int32, > + .set = set_int32, > + /* FIXME: this should be -1...255, but the address is stored > + * into an uint32_t rather than int32_t. > + */ > + .min = 0, > + .max = 0xFFFFFFFFULL, > }; > > /* --- public helpers --- */