From patchwork Tue Mar 8 14:27:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 8534831 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B4002C0553 for ; Tue, 8 Mar 2016 14:30:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E1415201BC for ; Tue, 8 Mar 2016 14:30:09 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 11FE320165 for ; Tue, 8 Mar 2016 14:30:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1adIbq-0002Y1-EM; Tue, 08 Mar 2016 14:27:38 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1adIbo-0002Ub-Hp for xen-devel@lists.xensource.com; Tue, 08 Mar 2016 14:27:36 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id 01/71-03306-751EED65; Tue, 08 Mar 2016 14:27:35 +0000 X-Env-Sender: kraxel@redhat.com X-Msg-Ref: server-10.tower-31.messagelabs.com!1457447252!27703336!1 X-Originating-IP: [209.132.183.28] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMjA5LjEzMi4xODMuMjggPT4gNTQwNjQ=\n X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15615 invoked from network); 8 Mar 2016 14:27:34 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by server-10.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 8 Mar 2016 14:27:34 -0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id D04FAC00FBA0; Tue, 8 Mar 2016 14:27:31 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u28ERUc9025768; Tue, 8 Mar 2016 09:27:30 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id BD78982759; Tue, 8 Mar 2016 15:27:29 +0100 (CET) From: Gerd Hoffmann To: kevin.tian@intel.com, Alex Williamson , Stefano Stabellini Date: Tue, 8 Mar 2016 15:27:23 +0100 Message-Id: <1457447247-4865-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1457447247-4865-1-git-send-email-kraxel@redhat.com> References: <1457447247-4865-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Cc: igvt-g@ml01.01.org, xen-devel@lists.xensource.com, Gerd Hoffmann , "open list:All patches CC here" Subject: [Xen-devel] [PATCH v4 4/8] igd: TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE: call parent realize X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Gerd Hoffmann --- hw/pci-host/igd.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/hw/pci-host/igd.c b/hw/pci-host/igd.c index 93b86ca..3654298 100644 --- a/hw/pci-host/igd.c +++ b/hw/pci-host/igd.c @@ -56,12 +56,32 @@ out: return ret; } +#define IGD_PT_I440FX_CLASS(class) \ + OBJECT_CLASS_CHECK(IGDPtI440fxClass, (class), \ + TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE) +#define IGD_PT_I440FX_GET_CLASS(obj) \ + OBJECT_GET_CLASS(IGDPtI440fxClass, (obj), \ + TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE) + +typedef struct IGDPtI440fxClass { + PCIDeviceClass parent_class; + void (*parent_realize)(PCIDevice *dev, Error **errp); +} IGDPtI440fxClass; + static void igd_pt_i440fx_realize(PCIDevice *pci_dev, Error **errp) { + IGDPtI440fxClass *k = IGD_PT_I440FX_GET_CLASS(pci_dev); + Error *err = NULL; uint32_t val = 0; int rc, i, num; int pos, len; + k->parent_realize(pci_dev, &err); + if (err != NULL) { + error_propagate(errp, err); + return; + } + num = ARRAY_SIZE(igd_host_bridge_infos); for (i = 0; i < num; i++) { pos = igd_host_bridge_infos[i].offset; @@ -77,17 +97,20 @@ static void igd_pt_i440fx_realize(PCIDevice *pci_dev, Error **errp) static void igd_passthrough_i440fx_class_init(ObjectClass *klass, void *data) { + IGDPtI440fxClass *k = IGD_PT_I440FX_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass); - PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass); - k->realize = igd_pt_i440fx_realize; - dc->desc = "IGD Passthrough Host bridge"; + k->parent_realize = pc->realize; + pc->realize = igd_pt_i440fx_realize; + dc->desc = "IGD Passthrough Host bridge (i440fx)"; } static const TypeInfo igd_passthrough_i440fx_info = { .name = TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE, .parent = TYPE_I440FX_PCI_DEVICE, .class_init = igd_passthrough_i440fx_class_init, + .class_size = sizeof(IGDPtI440fxClass), }; static void igd_register_types(void)