From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMzXl-0002xR-Cx for qemu-devel@nongnu.org; Sat, 23 Jan 2016 09:52:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMzXh-00032F-AU for qemu-devel@nongnu.org; Sat, 23 Jan 2016 09:52:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59194) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMzXh-00032B-4q for qemu-devel@nongnu.org; Sat, 23 Jan 2016 09:51:57 -0500 Date: Sat, 23 Jan 2016 12:51:52 -0200 From: Eduardo Habkost Message-ID: <20160123145152.GC4218@thinpad.lan.raisama.net> References: <1451994098-6972-1-git-send-email-kraxel@redhat.com> <1451994098-6972-5-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1451994098-6972-5-git-send-email-kraxel@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 04/11] igd: switch TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE to realize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: igvt-g@ml01.01.org, xen-devel@lists.xensource.com, Stefano Stabellini , qemu-devel@nongnu.org, Cao jin , vfio-users@redhat.com On Tue, Jan 05, 2016 at 12:41:31PM +0100, Gerd Hoffmann wrote: > Signed-off-by: Gerd Hoffmann > --- > hw/pci-host/igd.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/hw/pci-host/igd.c b/hw/pci-host/igd.c > index ef0273b..d1eeafb 100644 > --- a/hw/pci-host/igd.c > +++ b/hw/pci-host/igd.c > @@ -53,7 +53,7 @@ out: > return ret; > } > > -static int igd_pt_i440fx_initfn(struct PCIDevice *pci_dev) > +static void igd_pt_i440fx_realize(PCIDevice *pci_dev, Error **errp) > { > uint32_t val = 0; > int rc, i, num; > @@ -65,12 +65,11 @@ static int igd_pt_i440fx_initfn(struct PCIDevice *pci_dev) > len = igd_host_bridge_infos[i].len; > rc = host_pci_config_read(pos, len, val); > if (rc) { > - return -ENODEV; > + error_setg(errp, "failed to read host config"); > + return; > } > pci_default_write_config(pci_dev, pos, val, len); > } > - > - return 0; > } > > static void igd_passthrough_i440fx_class_init(ObjectClass *klass, void *data) > @@ -78,7 +77,7 @@ static void igd_passthrough_i440fx_class_init(ObjectClass *klass, void *data) > DeviceClass *dc = DEVICE_CLASS(klass); > PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); > > - k->init = igd_pt_i440fx_initfn; > + k->realize = igd_pt_i440fx_realize; I am trying to understand how this have ever worked before: * PCIDeviceClass::init is called by pci_default_realize() (default value for PCIDeviceClass::realize) * i440fx_class_init() overrides PCIDeviceClass::realize to i440fx_realize() So, when exactly was igd_pt_i440fx_realize() being called, before this series? I don't have a Xen host to be able to test it using xenfv, and if I test "-machine pc,igd-passthrough=on" after applying patch 01/11, I don't see igd_pt_i440fx_initfn() being called at all. -- Eduardo From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eduardo Habkost Subject: Re: [PATCH v3 04/11] igd: switch TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE to realize Date: Sat, 23 Jan 2016 12:51:52 -0200 Message-ID: <20160123145152.GC4218@thinpad.lan.raisama.net> References: <1451994098-6972-1-git-send-email-kraxel@redhat.com> <1451994098-6972-5-git-send-email-kraxel@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1451994098-6972-5-git-send-email-kraxel@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org To: Gerd Hoffmann Cc: igvt-g@ml01.01.org, xen-devel@lists.xensource.com, Stefano Stabellini , qemu-devel@nongnu.org, Cao jin , vfio-users@redhat.com List-Id: xen-devel@lists.xenproject.org On Tue, Jan 05, 2016 at 12:41:31PM +0100, Gerd Hoffmann wrote: > Signed-off-by: Gerd Hoffmann > --- > hw/pci-host/igd.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/hw/pci-host/igd.c b/hw/pci-host/igd.c > index ef0273b..d1eeafb 100644 > --- a/hw/pci-host/igd.c > +++ b/hw/pci-host/igd.c > @@ -53,7 +53,7 @@ out: > return ret; > } > > -static int igd_pt_i440fx_initfn(struct PCIDevice *pci_dev) > +static void igd_pt_i440fx_realize(PCIDevice *pci_dev, Error **errp) > { > uint32_t val = 0; > int rc, i, num; > @@ -65,12 +65,11 @@ static int igd_pt_i440fx_initfn(struct PCIDevice *pci_dev) > len = igd_host_bridge_infos[i].len; > rc = host_pci_config_read(pos, len, val); > if (rc) { > - return -ENODEV; > + error_setg(errp, "failed to read host config"); > + return; > } > pci_default_write_config(pci_dev, pos, val, len); > } > - > - return 0; > } > > static void igd_passthrough_i440fx_class_init(ObjectClass *klass, void *data) > @@ -78,7 +77,7 @@ static void igd_passthrough_i440fx_class_init(ObjectClass *klass, void *data) > DeviceClass *dc = DEVICE_CLASS(klass); > PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); > > - k->init = igd_pt_i440fx_initfn; > + k->realize = igd_pt_i440fx_realize; I am trying to understand how this have ever worked before: * PCIDeviceClass::init is called by pci_default_realize() (default value for PCIDeviceClass::realize) * i440fx_class_init() overrides PCIDeviceClass::realize to i440fx_realize() So, when exactly was igd_pt_i440fx_realize() being called, before this series? I don't have a Xen host to be able to test it using xenfv, and if I test "-machine pc,igd-passthrough=on" after applying patch 01/11, I don't see igd_pt_i440fx_initfn() being called at all. -- Eduardo