From patchwork Thu Oct 6 16:07:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 9365119 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AE65A6075E for ; Thu, 6 Oct 2016 16:25:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A03D729186 for ; Thu, 6 Oct 2016 16:25:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 942BB29188; Thu, 6 Oct 2016 16:25:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3B4B529186 for ; Thu, 6 Oct 2016 16:25:02 +0000 (UTC) Received: from localhost ([::1]:57741 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsBTh-0006WP-Bh for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Oct 2016 12:25:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsBDH-0000SG-HJ for qemu-devel@nongnu.org; Thu, 06 Oct 2016 12:08:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsBDF-0007DP-8Z for qemu-devel@nongnu.org; Thu, 06 Oct 2016 12:08:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41994) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsBDE-0007Cr-WA for qemu-devel@nongnu.org; Thu, 06 Oct 2016 12:08:01 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 72443C01C724; Thu, 6 Oct 2016 16:08:00 +0000 (UTC) Received: from localhost.redhat.com (vpn1-4-62.ams2.redhat.com [10.36.4.62]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u96G7iwW018457; Thu, 6 Oct 2016 12:07:58 -0400 From: Eric Auger To: eric.auger@redhat.com, eric.auger.pro@gmail.com, qemu-devel@nongnu.org, alex.williamson@redhat.com, armbru@redhat.com Date: Thu, 6 Oct 2016 16:07:28 +0000 Message-Id: <1475770058-20409-8-git-send-email-eric.auger@redhat.com> In-Reply-To: <1475770058-20409-1-git-send-email-eric.auger@redhat.com> References: <1475770058-20409-1-git-send-email-eric.auger@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 06 Oct 2016 16:08:00 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 07/17] vfio/pci: Pass an error object to vfio_pci_igd_opregion_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: david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Pass an error object to prepare for migration to VFIO-PCI realize. In vfio_probe_igd_bar4_quirk, simply report the error. Signed-off-by: Eric Auger Reviewed-by: Markus Armbruster --- v4 -> v5: - fix indentation at vfio_pci_igd_opregion_init declaration --- hw/vfio/pci-quirks.c | 10 +++++----- hw/vfio/pci.c | 3 +-- hw/vfio/pci.h | 3 ++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 806ea5d..2cbda08 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -1056,7 +1056,7 @@ typedef struct VFIOIGDQuirk { * of the IGD device. */ int vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev, - struct vfio_region_info *info) + struct vfio_region_info *info, Error **errp) { int ret; @@ -1064,7 +1064,7 @@ int vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev, ret = pread(vdev->vbasedev.fd, vdev->igd_opregion, info->size, info->offset); if (ret != info->size) { - error_report("vfio: Error reading IGD OpRegion"); + error_setg(errp, "failed to read IGD OpRegion"); g_free(vdev->igd_opregion); vdev->igd_opregion = NULL; return -EINVAL; @@ -1489,10 +1489,10 @@ static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr) } /* Setup OpRegion access */ - ret = vfio_pci_igd_opregion_init(vdev, opregion); + ret = vfio_pci_igd_opregion_init(vdev, opregion, &err); if (ret) { - error_report("IGD device %s failed to setup OpRegion, " - "legacy mode disabled", vdev->vbasedev.name); + error_append_hint(&err, "IGD legacy mode disabled\n"); + error_reportf_err(err, ERR_PREFIX, vdev->vbasedev.name); goto out; } diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index e2cf6ac..3d84126 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2721,10 +2721,9 @@ static int vfio_initfn(PCIDevice *pdev) goto out_teardown; } - ret = vfio_pci_igd_opregion_init(vdev, opregion); + ret = vfio_pci_igd_opregion_init(vdev, opregion, &err); g_free(opregion); if (ret) { - error_setg_errno(&err, -ret, "IGD OpRegion initialization failed"); goto out_teardown; } } diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h index 87a62f9..a8366bb 100644 --- a/hw/vfio/pci.h +++ b/hw/vfio/pci.h @@ -164,6 +164,7 @@ void vfio_setup_resetfn_quirk(VFIOPCIDevice *vdev); int vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp); int vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev, - struct vfio_region_info *info); + struct vfio_region_info *info, + Error **errp); #endif /* HW_VFIO_VFIO_PCI_H */