From nobody Tue Oct 28 14:38:23 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513543914898620.6632946612941; Sun, 17 Dec 2017 12:51:54 -0800 (PST) Received: from localhost ([::1]:55447 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQfuK-0002bH-Kh for importer@patchew.org; Sun, 17 Dec 2017 15:51:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQfsG-0001Ev-2D for qemu-devel@nongnu.org; Sun, 17 Dec 2017 15:49:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQfsF-0005Zw-4t for qemu-devel@nongnu.org; Sun, 17 Dec 2017 15:49:28 -0500 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:41740) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQfsE-0005ZR-Pi; Sun, 17 Dec 2017 15:49:27 -0500 Received: by mail-qt0-x243.google.com with SMTP id i40so17852597qti.8; Sun, 17 Dec 2017 12:49:26 -0800 (PST) Received: from x1.local ([181.91.222.165]) by smtp.gmail.com with ESMTPSA id b186sm7296778qka.19.2017.12.17.12.49.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Dec 2017 12:49:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XVqz6/DEj/tyQp5Lf+oHLUovkmNFkVFks5E1qhgQrM0=; b=rdPOJQ3DEBeQzmXu3sImg92ZJBFq7X3li/NSVJdv+Bw+KJ+nQ94Fz5dexDLHDZcA6Z BSBN/hg54OU0zQhNb+D8XkqjpAT437Uj4rFdWqjlx8GCiYDcAicSRB6oA/Lkw581XkVW 5jBq3P9pH4pZMyoeb7FyDmD3iU6vN1k88boOfshDrDnorS97mbIF5cyjbdmx7eCZJ3za FTV7ZRoS/pr7avVSwoa1uYmz/OjnYTdymELuIFHRXASMdRgECVDOghhTXoqDtzCT4TiO vxwrjhBn4JK0Sn5MR+8L1u/vmTQ7RjcooTk7BPcbsyVh0om5NxrI1AzoZDEu9LVGM/Rx vhTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=XVqz6/DEj/tyQp5Lf+oHLUovkmNFkVFks5E1qhgQrM0=; b=SU6C895ZqHZiqsEQk8RskCSUUr/LXxJecdeINu7zFDZjEr0pJQZLBZgrfOEmyjaMKu ndneZpwhD6N/eVT4d2oCMmfPV12vUPJtg6clT3QfM2Dcr4bdMXiqeJFAvj7ETKJFiA7p JMFq0Qhr5/tchf3c55cehy64n8Q3IpObUYRjUQ8fqdO5q1rey+Zld2UBbGXPzKH4pkoZ u1ZmdXTHO+r2REryNuqZmHQkOXjCebJ7EptDwGW2S6gmNk4FCQoSOvtpSu/KOUqmvx0Z Cj0Gs5h4/IiYNZ8d4CjFx6sa3qy28VW6Yy8SmUZwROeq7Di6JJSBAGjH8aUUJ+nRDUbc BFTQ== X-Gm-Message-State: AKGB3mLUBj5Dugw2YOVS9zy8HBq2hEtP3w9/fY0R++3abe4Q2sw62SR1 6/dg3B2vuvZ1+i0qAzZ6/+U= X-Google-Smtp-Source: ACJfBoui9pU4P0wYM7lThEV0iTRtefvSKj5TbaDEAWZzHFa0aa+6BQgzwyjzwmUbIrrzfPLeYqGP3A== X-Received: by 10.200.57.133 with SMTP id v5mr32703796qte.30.1513543766068; Sun, 17 Dec 2017 12:49:26 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: "Michael S. Tsirkin" , Marcel Apfelbaum , Eduardo Habkost , Keith Busch Date: Sun, 17 Dec 2017 17:49:09 -0300 Message-Id: <20171217204912.12420-2-f4bug@amsat.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171217204912.12420-1-f4bug@amsat.org> References: <20171217204912.12420-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::243 Subject: [Qemu-devel] [PATCH 1/4] hw/block/nvme: QOM'ify PCI NVME X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/block/nvme.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 441e21ed1f..9c5f898da0 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -920,9 +920,9 @@ static const MemoryRegionOps nvme_cmb_ops =3D { }, }; =20 -static int nvme_init(PCIDevice *pci_dev) +static void nvme_realize(PCIDevice *pci, Error **errp) { - NvmeCtrl *n =3D NVME(pci_dev); + NvmeCtrl *n =3D NVME(pci); NvmeIdCtrl *id =3D &n->id_ctrl; =20 int i; @@ -931,30 +931,33 @@ static int nvme_init(PCIDevice *pci_dev) Error *local_err =3D NULL; =20 if (!n->conf.blk) { - return -1; + error_setg(errp, "Block device missing"); + return; } =20 bs_size =3D blk_getlength(n->conf.blk); if (bs_size < 0) { - return -1; + error_setg_errno(errp, -bs_size, "Could not get length of device"); + return; } =20 blkconf_serial(&n->conf, &n->serial); if (!n->serial) { - return -1; + error_setg(errp, "Could not get device serial number"); + return; } blkconf_blocksizes(&n->conf); blkconf_apply_backend_options(&n->conf, blk_is_read_only(n->conf.blk), false, &local_err); if (local_err) { - error_report_err(local_err); - return -1; + error_propagate(errp, local_err); + return; } =20 - pci_conf =3D pci_dev->config; + pci_conf =3D pci->config; pci_conf[PCI_INTERRUPT_PIN] =3D 1; - pci_config_set_prog_interface(pci_dev->config, 0x2); - pci_config_set_class(pci_dev->config, PCI_CLASS_STORAGE_EXPRESS); + pci_config_set_prog_interface(pci->config, 0x2); + pci_config_set_class(pci->config, PCI_CLASS_STORAGE_EXPRESS); pcie_endpoint_cap_init(&n->parent_obj, 0x80); =20 n->num_namespaces =3D 1; @@ -1046,12 +1049,11 @@ static int nvme_init(PCIDevice *pci_dev) cpu_to_le64(n->ns_size >> id_ns->lbaf[NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas)].ds); } - return 0; } =20 -static void nvme_exit(PCIDevice *pci_dev) +static void nvme_exit(PCIDevice *pci) { - NvmeCtrl *n =3D NVME(pci_dev); + NvmeCtrl *n =3D NVME(pci); =20 nvme_clear_ctrl(n); g_free(n->namespaces); @@ -1061,7 +1063,7 @@ static void nvme_exit(PCIDevice *pci_dev) memory_region_unref(&n->ctrl_mem); } =20 - msix_uninit_exclusive_bar(pci_dev); + msix_uninit_exclusive_bar(pci); } =20 static Property nvme_props[] =3D { @@ -1081,7 +1083,7 @@ static void nvme_class_init(ObjectClass *oc, void *da= ta) DeviceClass *dc =3D DEVICE_CLASS(oc); PCIDeviceClass *pc =3D PCI_DEVICE_CLASS(oc); =20 - pc->init =3D nvme_init; + pc->realize =3D nvme_realize; pc->exit =3D nvme_exit; pc->class_id =3D PCI_CLASS_STORAGE_EXPRESS; pc->vendor_id =3D PCI_VENDOR_ID_INTEL; --=20 2.15.1 From nobody Tue Oct 28 14:38:23 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513543914638850.4163269586135; Sun, 17 Dec 2017 12:51:54 -0800 (PST) Received: from localhost ([::1]:55450 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQfuY-0002lb-FH for importer@patchew.org; Sun, 17 Dec 2017 15:51:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQfsK-0001HN-HS for qemu-devel@nongnu.org; Sun, 17 Dec 2017 15:49:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQfsJ-0005cR-HT for qemu-devel@nongnu.org; Sun, 17 Dec 2017 15:49:32 -0500 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:38391) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQfsJ-0005cC-C9; Sun, 17 Dec 2017 15:49:31 -0500 Received: by mail-qk0-x242.google.com with SMTP id z203so16162822qkb.5; Sun, 17 Dec 2017 12:49:31 -0800 (PST) Received: from x1.local ([181.91.222.165]) by smtp.gmail.com with ESMTPSA id b186sm7296778qka.19.2017.12.17.12.49.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Dec 2017 12:49:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MKUomvPn9cyvbRzAUY14krEkmJhcLtCcuk7xUtIQsTQ=; b=EBt1N1GkmzSihZAgfoml3u8tQagUBFf3gNYUY50mll1DvIjpi8wnBicGOewJRI71+B eMYoIRBJeALnfAUXPCWtsyprGNddb+1oftSthZw6hTKExxWe6POw2uErfemoE6H2fm7a sCwig1RW7gbvU1fHgL2rY3BBLJxcz8XXOctTQMpEsiv2glS1pZ1daXuQf/ggSpzjRVcH 9rZLDgoyEqHb1rq3n4FII1lRxdiJXysR7/W3J5bgEVRZ56pE16pQpQ6NMNL+AXG5cQaw b+g5Q88WsNtxKmuqtBgaV/DhCoMu6ndr26O03Brtz1SR2od3OxnN13MNI+OUZYzs2k2Y p3hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=MKUomvPn9cyvbRzAUY14krEkmJhcLtCcuk7xUtIQsTQ=; b=PXJKevVIWi7zBYe0v041/O/3FnM7rR5kp+x30x0Py9LHPc7rMafrsdXTGvu34+FM4+ /d1khVu2NSgtBS/+Qnst64xuzcRBJPx2Z6clc2vxRt6rtZF6XpLGCTZUCn0BeBkdg7PA XWSDCCQXQFd3huI0NsalQrG6XPNqrqzztxxEbAh/tAT0LYeoJbr6Th2tKo12fwCYQS/d RRCZs8Xabb52YEhM6b0v4bEUqMAsKE9gIbv3APSfC/vNPsQ2ICDNxPwUaMZgPMtG8Ktg PuySF6HpPTROAsrd096mU37g/M2uR17ZahA1NgW/kjsyfuCe2V2QuF9ApDb9y5Y2FDv0 ZsFA== X-Gm-Message-State: AKGB3mISeG7Zsxb30xaUNnCUbwUwP0ndqP2NdJrmZT1cY/T1fUrRMqu5 Xwc4GFkcl+se/Wd5bdltrIs= X-Google-Smtp-Source: ACJfBov4WbAztyWj+oD9dE8vm02avO7S6SsDpRkfUSQQgSR3HhQXV2L4R+MtYl2PpYzBeMEr12aEew== X-Received: by 10.55.101.9 with SMTP id z9mr31531993qkb.206.1513543770714; Sun, 17 Dec 2017 12:49:30 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: "Michael S. Tsirkin" , Marcel Apfelbaum , Eduardo Habkost , =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Sun, 17 Dec 2017 17:49:10 -0300 Message-Id: <20171217204912.12420-3-f4bug@amsat.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171217204912.12420-1-f4bug@amsat.org> References: <20171217204912.12420-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::242 Subject: [Qemu-devel] [PATCH 2/4] hw/pci-host/piix: QOM'ify the IGD Passthrough host bridge X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/piix.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index a684a7cca9..0153f32a32 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -804,7 +804,7 @@ static const IGDHostInfo igd_host_bridge_infos[] =3D { {0xa8, 4}, /* SNB: base of GTT stolen memory */ }; =20 -static int host_pci_config_read(int pos, int len, uint32_t *val) +static void host_pci_config_read(int pos, int len, uint32_t *val, Error **= errp) { char path[PATH_MAX]; int config_fd; @@ -812,19 +812,19 @@ static int host_pci_config_read(int pos, int len, uin= t32_t *val) /* Access real host bridge. */ int rc =3D snprintf(path, size, "/sys/bus/pci/devices/%04x:%02x:%02x.%= d/%s", 0, 0, 0, 0, "config"); - int ret =3D 0; =20 if (rc >=3D size || rc < 0) { - return -ENODEV; + error_setg(&error_abort, "Invalid PCI device"); } =20 config_fd =3D open(path, O_RDWR); if (config_fd < 0) { - return -ENODEV; + error_setg_errno(errp, errno, "Failed to open: %s", path); + return; } =20 if (lseek(config_fd, pos, SEEK_SET) !=3D pos) { - ret =3D -errno; + error_setg_errno(errp, errno, "Failed to seek: %s", path); goto out; } =20 @@ -832,32 +832,31 @@ static int host_pci_config_read(int pos, int len, uin= t32_t *val) rc =3D read(config_fd, (uint8_t *)val, len); } while (rc < 0 && (errno =3D=3D EINTR || errno =3D=3D EAGAIN)); if (rc !=3D len) { - ret =3D -errno; + error_setg_errno(errp, errno, "Failed to read: %s", path); } =20 out: close(config_fd); - return ret; } =20 -static int igd_pt_i440fx_initfn(struct PCIDevice *pci_dev) +static void igd_pt_i440fx_realize(PCIDevice *pci, Error **errp) { uint32_t val =3D 0; - int rc, i, num; + int i, num; int pos, len; + Error *local_err =3D NULL; =20 num =3D ARRAY_SIZE(igd_host_bridge_infos); for (i =3D 0; i < num; i++) { pos =3D igd_host_bridge_infos[i].offset; len =3D igd_host_bridge_infos[i].len; - rc =3D host_pci_config_read(pos, len, &val); - if (rc) { - return -ENODEV; + host_pci_config_read(pos, len, &val, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; } - pci_default_write_config(pci_dev, pos, val, len); + pci_default_write_config(pci, pos, val, len); } - - return 0; } =20 static void igd_passthrough_i440fx_class_init(ObjectClass *klass, void *da= ta) @@ -865,7 +864,7 @@ static void igd_passthrough_i440fx_class_init(ObjectCla= ss *klass, void *data) DeviceClass *dc =3D DEVICE_CLASS(klass); PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); =20 - k->init =3D igd_pt_i440fx_initfn; + k->realize =3D igd_pt_i440fx_realize; dc->desc =3D "IGD Passthrough Host bridge"; } =20 --=20 2.15.1 From nobody Tue Oct 28 14:38:23 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513544013741106.14401970389372; Sun, 17 Dec 2017 12:53:33 -0800 (PST) Received: from localhost ([::1]:55459 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQfwC-0004Su-Pv for importer@patchew.org; Sun, 17 Dec 2017 15:53:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQfsO-0001Kd-GN for qemu-devel@nongnu.org; Sun, 17 Dec 2017 15:49:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQfsN-0005fV-Iu for qemu-devel@nongnu.org; Sun, 17 Dec 2017 15:49:36 -0500 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:37127) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQfsN-0005f8-Ec for qemu-devel@nongnu.org; Sun, 17 Dec 2017 15:49:35 -0500 Received: by mail-qk0-x243.google.com with SMTP id p13so93458qke.4 for ; Sun, 17 Dec 2017 12:49:35 -0800 (PST) Received: from x1.local ([181.91.222.165]) by smtp.gmail.com with ESMTPSA id b186sm7296778qka.19.2017.12.17.12.49.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Dec 2017 12:49:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hkIoFvIdsuxw3mzueJmt0vDlWhDhqSytopcRGdCz2DM=; b=UMtELN5wkFRcMvT3rTZnhn9qNXlgA9ZkizUeELwQmgZag3Kb0KM6c2TZ/bftkHLyCE t0qAu9QW8CAePIsG25n96gvCQIiwy1ymxxwdyBVBsGJJ9KWsQ2TXzQMQhqm/0OP/MPhR sMSH2ODNIWturH9zh2vccfS/zj75rjJrtcpK7mOyMs3c/wUqRAJgLD1qT1259IDHijzI 4pqFEvp7J5muqwa7t2lP1bBX9P/bkmqDU1ZHPS57RLfmvKLT47krbnGxPreOV7RotTxk uVSsU/P5ygQqMMI64PJH3P4gyOrxSHK3Z48tvqo7FfXttvydrhWERvigB8aHX6Cysy8a vnBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=hkIoFvIdsuxw3mzueJmt0vDlWhDhqSytopcRGdCz2DM=; b=JE6f28YsXuHHyZEh+SGcnbXKg1A4R98rn9j2VLSiYZCI3SB45hJJ4Vkwp1+Ies6yAm apIz3nlcnAzZsKtDImqRERy8MnDy49KhTBRiMYPS33ABbxFj0r/VwpVdSOawv3+SkLbY nh9bFkciaKECE8JC/XmkhzSM0WZ1E6VqUu0N+ZG8KKGKlYCVNR4qsXUpX4GZ+scFbe1d yI/370yd7chNZJdYDtC16xdpEzPFOWqZMiFFJvn17vE47mRIZIDm+eyyNm+CklTaboZi 2v7cJLsB+CLcuGmVqCWLc0Ugg0/GDrMzCyfloy9Q9BQwtpM/rNwBgHHpLssobaAbYJEo WtFg== X-Gm-Message-State: AKGB3mJyoBMtG18CMkdDdLcNBTHTl4rvBfLPmtVQuiRrrzPIBFqAOsZN fY3DUZcDwi8vZtuB6bQsmBg= X-Google-Smtp-Source: ACJfBoubIE+2nwiLQskqIv2JQuR/4d2sSF/LYHkMIYePDj6GyPP0C2ZhJ4zAMfX3ZXzixDDwf7iUhw== X-Received: by 10.233.237.71 with SMTP id c68mr33505811qkg.69.1513543774855; Sun, 17 Dec 2017 12:49:34 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: "Michael S. Tsirkin" , Marcel Apfelbaum , Eduardo Habkost , Paul Burton , Yongbok Kim , "Edgar E . Iglesias" , Alistair Francis Date: Sun, 17 Dec 2017 17:49:11 -0300 Message-Id: <20171217204912.12420-4-f4bug@amsat.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171217204912.12420-1-f4bug@amsat.org> References: <20171217204912.12420-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::243 Subject: [Qemu-devel] [PATCH 3/4] hw/pci-host/xilinx: QOM'ify the AXI-PCIe host bridge X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: James Hogan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/xilinx-pcie.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/hw/pci-host/xilinx-pcie.c b/hw/pci-host/xilinx-pcie.c index 7659253090..756db39fd5 100644 --- a/hw/pci-host/xilinx-pcie.c +++ b/hw/pci-host/xilinx-pcie.c @@ -267,24 +267,23 @@ static void xilinx_pcie_root_config_write(PCIDevice *= d, uint32_t address, } } =20 -static int xilinx_pcie_root_init(PCIDevice *dev) +static void xilinx_pcie_root_realize(PCIDevice *pci, Error **errp) { - BusState *bus =3D qdev_get_parent_bus(DEVICE(dev)); + DeviceState *dev =3D DEVICE(pci); + BusState *bus =3D qdev_get_parent_bus(dev); XilinxPCIEHost *s =3D XILINX_PCIE_HOST(bus->parent); =20 - pci_set_word(dev->config + PCI_COMMAND, + pci_set_word(pci->config + PCI_COMMAND, PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); - pci_set_word(dev->config + PCI_MEMORY_BASE, s->mmio_base >> 16); - pci_set_word(dev->config + PCI_MEMORY_LIMIT, + pci_set_word(pci->config + PCI_MEMORY_BASE, s->mmio_base >> 16); + pci_set_word(pci->config + PCI_MEMORY_LIMIT, ((s->mmio_base + s->mmio_size - 1) >> 16) & 0xfff0); =20 - pci_bridge_initfn(dev, TYPE_PCI_BUS); + pci_bridge_initfn(pci, TYPE_PCI_BUS); =20 - if (pcie_endpoint_cap_v1_init(dev, 0x80) < 0) { + if (pcie_endpoint_cap_v1_init(pci, 0x80) < 0) { hw_error("Failed to initialize PCIe capability"); } - - return 0; } =20 static void xilinx_pcie_root_class_init(ObjectClass *klass, void *data) @@ -300,7 +299,7 @@ static void xilinx_pcie_root_class_init(ObjectClass *kl= ass, void *data) k->class_id =3D PCI_CLASS_BRIDGE_HOST; k->is_express =3D true; k->is_bridge =3D true; - k->init =3D xilinx_pcie_root_init; + k->realize =3D xilinx_pcie_root_realize; k->exit =3D pci_bridge_exitfn; dc->reset =3D pci_bridge_reset; k->config_read =3D xilinx_pcie_root_config_read; --=20 2.15.1 From nobody Tue Oct 28 14:38:23 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513543914616987.007577639675; Sun, 17 Dec 2017 12:51:54 -0800 (PST) Received: from localhost ([::1]:55449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQfuU-0002jb-J7 for importer@patchew.org; Sun, 17 Dec 2017 15:51:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQfsR-0001O3-Lj for qemu-devel@nongnu.org; Sun, 17 Dec 2017 15:49:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQfsQ-0005hl-MU for qemu-devel@nongnu.org; Sun, 17 Dec 2017 15:49:39 -0500 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:41741) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQfsQ-0005hJ-H2 for qemu-devel@nongnu.org; Sun, 17 Dec 2017 15:49:38 -0500 Received: by mail-qt0-x243.google.com with SMTP id i40so17852922qti.8 for ; Sun, 17 Dec 2017 12:49:38 -0800 (PST) Received: from x1.local ([181.91.222.165]) by smtp.gmail.com with ESMTPSA id b186sm7296778qka.19.2017.12.17.12.49.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Dec 2017 12:49:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=t15Hyid1hiv2RfashwqcoLeayLGfVWN2GK/e405rynw=; b=liw+X3Vpvekr4weoMjcGMonMZkwiB+2k+pkyQahBpJja49G6BeAyY3H33uB+XNXvOs nfMOtFvadDVHbhNEvlfeJsVHRs2hrNcKMX21eFkyP3XCE9u5PRHY9j1RducpQxS94xC8 AP9t/KnD72RJu3y0CLr/6ZCADifT/6g+Lx87AJ66hoPTurrlQ4ozzOOwOlSpuQ9Zirfs F5ebLG9Q0NYtSqTK6GdtF2kWLdsQfEVI2uyK8ynQa5M8eUZyJt07g72332vcpMgesfYZ yO3kJL/lew1fkNzHroL4cELp5nrvG5kKXcY0LUaUoCga2lwPvMQr8YSGPNwIM7dICbbz z1bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=t15Hyid1hiv2RfashwqcoLeayLGfVWN2GK/e405rynw=; b=VeyY9fXPxszkGfCFKYethVoBejuMfGqkMQi9SQEnHFfPdeDw8Vt2s6np+7d9w0aHGH +IIxiIktFA9CPWaE3mSacGoo+ZLDTvp4GMrufTMLlhdqjOitjwroC0+Ee5WCtmF9WHoj ieZmSYdjmcEbg8YTN6LuHlVHQs1CD5PPISlpwhzrNjO/d9EFWu8MeHgsfn5ND9Jqz+M2 wDuJAuJfWWp1/UuCaRCpNV2yRBpeOVQxO7GJx5EJbx4AJII6Zyzw7+TQT3Z40t7LGEDq 923YgWb1CgThDjIAuRW66vhMY0vf942KOoAgMmBNA3mEwSEHOqOqGNRXYq+LQ+UAfPTL B0iQ== X-Gm-Message-State: AKGB3mJZlb5e2foyOHDhmtU38BR6yHg49N2d+QpcMBk+go4o0pFEtlME zUciyTacb5EypXauD7Px7aI= X-Google-Smtp-Source: ACJfBovB73tUZD/WwPU+0qXA73WZD+6q5C2Ikwvwpei9UHux6IJLEj79KkmLyxU/TbuPcADTdU7c4w== X-Received: by 10.237.36.119 with SMTP id s52mr32165579qtc.199.1513543778017; Sun, 17 Dec 2017 12:49:38 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: "Michael S. Tsirkin" , Marcel Apfelbaum , Eduardo Habkost Date: Sun, 17 Dec 2017 17:49:12 -0300 Message-Id: <20171217204912.12420-5-f4bug@amsat.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171217204912.12420-1-f4bug@amsat.org> References: <20171217204912.12420-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::243 Subject: [Qemu-devel] [PATCH 4/4] hw/pci: remove obsolete PCIDevice->init() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 All PCI devices are now QOM'ified. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Marcel Apfelbaum --- include/hw/pci/pci.h | 1 - hw/pci/pci.c | 14 -------------- 2 files changed, 15 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 8d02a0a383..0f1ed64c2f 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -217,7 +217,6 @@ typedef struct PCIDeviceClass { DeviceClass parent_class; =20 void (*realize)(PCIDevice *dev, Error **errp); - int (*init)(PCIDevice *dev);/* TODO convert to realize() and remove */ PCIUnregisterFunc *exit; PCIConfigReadFunc *config_read; PCIConfigWriteFunc *config_write; diff --git a/hw/pci/pci.c b/hw/pci/pci.c index b2d139bd9a..cd25ab6f6b 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2054,18 +2054,6 @@ static void pci_qdev_realize(DeviceState *qdev, Erro= r **errp) } } =20 -static void pci_default_realize(PCIDevice *dev, Error **errp) -{ - PCIDeviceClass *pc =3D PCI_DEVICE_GET_CLASS(dev); - - if (pc->init) { - if (pc->init(dev) < 0) { - error_setg(errp, "Device initialization failed"); - return; - } - } -} - PCIDevice *pci_create_multifunction(PCIBus *bus, int devfn, bool multifunc= tion, const char *name) { @@ -2538,13 +2526,11 @@ MemoryRegion *pci_address_space_io(PCIDevice *dev) static void pci_device_class_init(ObjectClass *klass, void *data) { DeviceClass *k =3D DEVICE_CLASS(klass); - PCIDeviceClass *pc =3D PCI_DEVICE_CLASS(klass); =20 k->realize =3D pci_qdev_realize; k->unrealize =3D pci_qdev_unrealize; k->bus_type =3D TYPE_PCI_BUS; k->props =3D pci_props; - pc->realize =3D pci_default_realize; } =20 static void pci_device_class_base_init(ObjectClass *klass, void *data) --=20 2.15.1