Re: [Qemu-devel] [PATCH 5/5] xen-pvdevice: convert to realize()

2015-12-21 Thread Cao jin

Hi

On 12/22/2015 09:24 AM, Cao jin wrote:



On 12/21/2015 11:15 PM, Stefano Stabellini wrote:

On Fri, 18 Dec 2015, Cao jin wrote:

[...]


This doesn't even compile: you are missing a ';'

Please at least build test patches.



Yup...sorry for the silly mistake...but weird, I did build and didn`t
got error...



I test with:
$ readelf -s qemu-system-x86_64 | grep xen_pv_*
got nothing, which make me realized that I don`t have xen support on my 
computer... maybe that`s why I didn`t got compile error





[...]

--
Yours Sincerely,

Cao Jin





Re: [Qemu-devel] [PATCH 5/5] xen-pvdevice: convert to realize()

2015-12-21 Thread Cao jin



On 12/21/2015 11:15 PM, Stefano Stabellini wrote:

On Fri, 18 Dec 2015, Cao jin wrote:

Signed-off-by: Cao jin 
---
  hw/i386/xen/xen_pvdevice.c | 12 ++--
  1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c
index c218947..a6c93d0 100644
--- a/hw/i386/xen/xen_pvdevice.c
+++ b/hw/i386/xen/xen_pvdevice.c
@@ -69,14 +69,16 @@ static const MemoryRegionOps xen_pv_mmio_ops = {
  .endianness = DEVICE_LITTLE_ENDIAN,
  };

-static int xen_pv_init(PCIDevice *pci_dev)
+static void xen_pv_realize(PCIDevice *pci_dev, Error **errp)
  {
  XenPVDevice *d = XEN_PV_DEVICE(pci_dev);
  uint8_t *pci_conf;

  /* device-id property must always be supplied */
-if (d->device_id == 0x)
-   return -1;
+if (d->device_id == 0x) {
+error_setg(errp, "Device ID invalid, it must always be supplied")


This doesn't even compile: you are missing a ';'

Please at least build test patches.



Yup...sorry for the silly mistake...but weird, I did build and didn`t 
got error...





+   return;


I realize that there was a tab before there, but please use spaces for
indentation.



surprised that I didn`t recognized the tab...V2 is coming soon.




+}

  pci_conf = pci_dev->config;

@@ -97,8 +99,6 @@ static int xen_pv_init(PCIDevice *pci_dev)

  pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH,
   >mmio);
-
-return 0;
  }

  static Property xen_pv_props[] = {
@@ -114,7 +114,7 @@ static void xen_pv_class_init(ObjectClass *klass, void 
*data)
  DeviceClass *dc = DEVICE_CLASS(klass);
  PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);

-k->init = xen_pv_init;
+k->realize = xen_pv_realize;
  k->class_id = PCI_CLASS_SYSTEM_OTHER;
  dc->desc = "Xen PV Device";
  dc->props = xen_pv_props;
--
2.1.0







.



--
Yours Sincerely,

Cao Jin





Re: [Qemu-devel] [PATCH 5/5] xen-pvdevice: convert to realize()

2015-12-21 Thread Stefano Stabellini
On Mon, 21 Dec 2015, Cao jin wrote:
> On 12/19/2015 02:00 AM, Paolo Bonzini wrote:
> > CCing Stefano, who is the maintainer.
> > 
> 
> "Stefano" isn`t in the list when I use scripts/get_maintainer.pl...

Thanks Cao. I have just sent a patch to update the MAINTAINERS file.

http://marc.info/?l=qemu-devel=145070996302064=2



> > 
> > On 18/12/2015 12:03, Cao jin wrote:
> > > Signed-off-by: Cao jin 
> > > ---
> > >   hw/i386/xen/xen_pvdevice.c | 12 ++--
> > >   1 file changed, 6 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c
> > > index c218947..a6c93d0 100644
> > > --- a/hw/i386/xen/xen_pvdevice.c
> > > +++ b/hw/i386/xen/xen_pvdevice.c
> > > @@ -69,14 +69,16 @@ static const MemoryRegionOps xen_pv_mmio_ops = {
> > >   .endianness = DEVICE_LITTLE_ENDIAN,
> > >   };
> > > 
> > > -static int xen_pv_init(PCIDevice *pci_dev)
> > > +static void xen_pv_realize(PCIDevice *pci_dev, Error **errp)
> > >   {
> > >   XenPVDevice *d = XEN_PV_DEVICE(pci_dev);
> > >   uint8_t *pci_conf;
> > > 
> > >   /* device-id property must always be supplied */
> > > -if (d->device_id == 0x)
> > > - return -1;
> > > +if (d->device_id == 0x) {
> > > +error_setg(errp, "Device ID invalid, it must always be supplied")
> > > + return;
> > > +}
> > > 
> > >   pci_conf = pci_dev->config;
> > > 
> > > @@ -97,8 +99,6 @@ static int xen_pv_init(PCIDevice *pci_dev)
> > > 
> > >   pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH,
> > >>mmio);
> > > -
> > > -return 0;
> > >   }
> > > 
> > >   static Property xen_pv_props[] = {
> > > @@ -114,7 +114,7 @@ static void xen_pv_class_init(ObjectClass *klass, void
> > > *data)
> > >   DeviceClass *dc = DEVICE_CLASS(klass);
> > >   PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
> > > 
> > > -k->init = xen_pv_init;
> > > +k->realize = xen_pv_realize;
> > >   k->class_id = PCI_CLASS_SYSTEM_OTHER;
> > >   dc->desc = "Xen PV Device";
> > >   dc->props = xen_pv_props;
> > > 
> > 
> > 
> > .
> > 
> 
> -- 
> Yours Sincerely,
> 
> Cao Jin
> 
> 
> 



Re: [Qemu-devel] [PATCH 5/5] xen-pvdevice: convert to realize()

2015-12-21 Thread Stefano Stabellini
On Fri, 18 Dec 2015, Cao jin wrote:
> Signed-off-by: Cao jin 
> ---
>  hw/i386/xen/xen_pvdevice.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c
> index c218947..a6c93d0 100644
> --- a/hw/i386/xen/xen_pvdevice.c
> +++ b/hw/i386/xen/xen_pvdevice.c
> @@ -69,14 +69,16 @@ static const MemoryRegionOps xen_pv_mmio_ops = {
>  .endianness = DEVICE_LITTLE_ENDIAN,
>  };
>  
> -static int xen_pv_init(PCIDevice *pci_dev)
> +static void xen_pv_realize(PCIDevice *pci_dev, Error **errp)
>  {
>  XenPVDevice *d = XEN_PV_DEVICE(pci_dev);
>  uint8_t *pci_conf;
>  
>  /* device-id property must always be supplied */
> -if (d->device_id == 0x)
> - return -1;
> +if (d->device_id == 0x) {
> +error_setg(errp, "Device ID invalid, it must always be supplied")

This doesn't even compile: you are missing a ';'

Please at least build test patches.


> + return;

I realize that there was a tab before there, but please use spaces for
indentation.


> +}
>  
>  pci_conf = pci_dev->config;
>  
> @@ -97,8 +99,6 @@ static int xen_pv_init(PCIDevice *pci_dev)
>  
>  pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH,
>   >mmio);
> -
> -return 0;
>  }
>  
>  static Property xen_pv_props[] = {
> @@ -114,7 +114,7 @@ static void xen_pv_class_init(ObjectClass *klass, void 
> *data)
>  DeviceClass *dc = DEVICE_CLASS(klass);
>  PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
>  
> -k->init = xen_pv_init;
> +k->realize = xen_pv_realize;
>  k->class_id = PCI_CLASS_SYSTEM_OTHER;
>  dc->desc = "Xen PV Device";
>  dc->props = xen_pv_props;
> -- 
> 2.1.0
> 
> 
> 
> 



Re: [Qemu-devel] [PATCH 5/5] xen-pvdevice: convert to realize()

2015-12-20 Thread Cao jin



On 12/19/2015 02:00 AM, Paolo Bonzini wrote:

CCing Stefano, who is the maintainer.



"Stefano" isn`t in the list when I use scripts/get_maintainer.pl...


Paolo

On 18/12/2015 12:03, Cao jin wrote:

Signed-off-by: Cao jin 
---
  hw/i386/xen/xen_pvdevice.c | 12 ++--
  1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c
index c218947..a6c93d0 100644
--- a/hw/i386/xen/xen_pvdevice.c
+++ b/hw/i386/xen/xen_pvdevice.c
@@ -69,14 +69,16 @@ static const MemoryRegionOps xen_pv_mmio_ops = {
  .endianness = DEVICE_LITTLE_ENDIAN,
  };

-static int xen_pv_init(PCIDevice *pci_dev)
+static void xen_pv_realize(PCIDevice *pci_dev, Error **errp)
  {
  XenPVDevice *d = XEN_PV_DEVICE(pci_dev);
  uint8_t *pci_conf;

  /* device-id property must always be supplied */
-if (d->device_id == 0x)
-   return -1;
+if (d->device_id == 0x) {
+error_setg(errp, "Device ID invalid, it must always be supplied")
+   return;
+}

  pci_conf = pci_dev->config;

@@ -97,8 +99,6 @@ static int xen_pv_init(PCIDevice *pci_dev)

  pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH,
   >mmio);
-
-return 0;
  }

  static Property xen_pv_props[] = {
@@ -114,7 +114,7 @@ static void xen_pv_class_init(ObjectClass *klass, void 
*data)
  DeviceClass *dc = DEVICE_CLASS(klass);
  PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);

-k->init = xen_pv_init;
+k->realize = xen_pv_realize;
  k->class_id = PCI_CLASS_SYSTEM_OTHER;
  dc->desc = "Xen PV Device";
  dc->props = xen_pv_props;




.



--
Yours Sincerely,

Cao Jin





[Qemu-devel] [PATCH 5/5] xen-pvdevice: convert to realize()

2015-12-18 Thread Cao jin
Signed-off-by: Cao jin 
---
 hw/i386/xen/xen_pvdevice.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c
index c218947..a6c93d0 100644
--- a/hw/i386/xen/xen_pvdevice.c
+++ b/hw/i386/xen/xen_pvdevice.c
@@ -69,14 +69,16 @@ static const MemoryRegionOps xen_pv_mmio_ops = {
 .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
-static int xen_pv_init(PCIDevice *pci_dev)
+static void xen_pv_realize(PCIDevice *pci_dev, Error **errp)
 {
 XenPVDevice *d = XEN_PV_DEVICE(pci_dev);
 uint8_t *pci_conf;
 
 /* device-id property must always be supplied */
-if (d->device_id == 0x)
-   return -1;
+if (d->device_id == 0x) {
+error_setg(errp, "Device ID invalid, it must always be supplied")
+   return;
+}
 
 pci_conf = pci_dev->config;
 
@@ -97,8 +99,6 @@ static int xen_pv_init(PCIDevice *pci_dev)
 
 pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH,
  >mmio);
-
-return 0;
 }
 
 static Property xen_pv_props[] = {
@@ -114,7 +114,7 @@ static void xen_pv_class_init(ObjectClass *klass, void 
*data)
 DeviceClass *dc = DEVICE_CLASS(klass);
 PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
-k->init = xen_pv_init;
+k->realize = xen_pv_realize;
 k->class_id = PCI_CLASS_SYSTEM_OTHER;
 dc->desc = "Xen PV Device";
 dc->props = xen_pv_props;
-- 
2.1.0






Re: [Qemu-devel] [PATCH 5/5] xen-pvdevice: convert to realize()

2015-12-18 Thread Paolo Bonzini
CCing Stefano, who is the maintainer.

Paolo

On 18/12/2015 12:03, Cao jin wrote:
> Signed-off-by: Cao jin 
> ---
>  hw/i386/xen/xen_pvdevice.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c
> index c218947..a6c93d0 100644
> --- a/hw/i386/xen/xen_pvdevice.c
> +++ b/hw/i386/xen/xen_pvdevice.c
> @@ -69,14 +69,16 @@ static const MemoryRegionOps xen_pv_mmio_ops = {
>  .endianness = DEVICE_LITTLE_ENDIAN,
>  };
>  
> -static int xen_pv_init(PCIDevice *pci_dev)
> +static void xen_pv_realize(PCIDevice *pci_dev, Error **errp)
>  {
>  XenPVDevice *d = XEN_PV_DEVICE(pci_dev);
>  uint8_t *pci_conf;
>  
>  /* device-id property must always be supplied */
> -if (d->device_id == 0x)
> - return -1;
> +if (d->device_id == 0x) {
> +error_setg(errp, "Device ID invalid, it must always be supplied")
> + return;
> +}
>  
>  pci_conf = pci_dev->config;
>  
> @@ -97,8 +99,6 @@ static int xen_pv_init(PCIDevice *pci_dev)
>  
>  pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH,
>   >mmio);
> -
> -return 0;
>  }
>  
>  static Property xen_pv_props[] = {
> @@ -114,7 +114,7 @@ static void xen_pv_class_init(ObjectClass *klass, void 
> *data)
>  DeviceClass *dc = DEVICE_CLASS(klass);
>  PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
>  
> -k->init = xen_pv_init;
> +k->realize = xen_pv_realize;
>  k->class_id = PCI_CLASS_SYSTEM_OTHER;
>  dc->desc = "Xen PV Device";
>  dc->props = xen_pv_props;
>