From patchwork Thu Jan 21 17:01:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 8083481 Return-Path: X-Original-To: patchwork-qemu-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 9FC77BEEE5 for ; Thu, 21 Jan 2016 17:06:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EBF0F204A7 for ; Thu, 21 Jan 2016 17:06:37 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 33EF2200FE for ; Thu, 21 Jan 2016 17:06:37 +0000 (UTC) Received: from localhost ([::1]:48968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMIgu-00045v-Hf for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 Jan 2016 12:06:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMIdS-0005c9-WE for qemu-devel@nongnu.org; Thu, 21 Jan 2016 12:03:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMIdP-0001yo-QL for qemu-devel@nongnu.org; Thu, 21 Jan 2016 12:03:02 -0500 Received: from smtp02.citrix.com ([66.165.176.63]:36862) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMIdP-0001yA-L6 for qemu-devel@nongnu.org; Thu, 21 Jan 2016 12:02:59 -0500 X-IronPort-AV: E=Sophos;i="5.22,326,1449532800"; d="scan'208";a="333120490" From: Stefano Stabellini To: Date: Thu, 21 Jan 2016 17:01:28 +0000 Message-ID: <1453395690-32660-9-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Cc: Cao jin , xen-devel@lists.xensource.com, qemu-devel@nongnu.org, Stefano Stabellini Subject: [Qemu-devel] [PULL 09/11] Add Error **errp for xen_pt_setup_vga() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 From: Cao jin To catch the error message. Also modify the caller Signed-off-by: Cao jin Reviewed-by: Eric Blake Reviewed-by: Stefano Stabellini --- hw/xen/xen_pt.c | 7 +++++-- hw/xen/xen_pt.h | 3 ++- hw/xen/xen_pt_graphics.c | 11 ++++++----- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 53b5bca..07bfcec 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -808,8 +808,11 @@ static int xen_pt_initfn(PCIDevice *d) return -1; } - if (xen_pt_setup_vga(s, &s->real_device) < 0) { - XEN_PT_ERR(d, "Setup VGA BIOS of passthrough GFX failed!\n"); + xen_pt_setup_vga(s, &s->real_device, &err); + if (err) { + error_append_hint(&err, "Setup VGA BIOS of passthrough" + " GFX failed"); + error_report_err(err); xen_host_pci_device_put(&s->real_device); return -1; } diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h index 3749711..26f74f8 100644 --- a/hw/xen/xen_pt.h +++ b/hw/xen/xen_pt.h @@ -330,5 +330,6 @@ static inline bool is_igd_vga_passthrough(XenHostPCIDevice *dev) } int xen_pt_register_vga_regions(XenHostPCIDevice *dev); int xen_pt_unregister_vga_regions(XenHostPCIDevice *dev); -int xen_pt_setup_vga(XenPCIPassthroughState *s, XenHostPCIDevice *dev); +void xen_pt_setup_vga(XenPCIPassthroughState *s, XenHostPCIDevice *dev, + Error **errp); #endif /* !XEN_PT_H */ diff --git a/hw/xen/xen_pt_graphics.c b/hw/xen/xen_pt_graphics.c index df6069b..e7a7c7e 100644 --- a/hw/xen/xen_pt_graphics.c +++ b/hw/xen/xen_pt_graphics.c @@ -161,7 +161,8 @@ struct pci_data { uint16_t reserved; } __attribute__((packed)); -int xen_pt_setup_vga(XenPCIPassthroughState *s, XenHostPCIDevice *dev) +void xen_pt_setup_vga(XenPCIPassthroughState *s, XenHostPCIDevice *dev, + Error **errp) { unsigned char *bios = NULL; struct rom_header *rom; @@ -172,13 +173,14 @@ int xen_pt_setup_vga(XenPCIPassthroughState *s, XenHostPCIDevice *dev) struct pci_data *pd = NULL; if (!is_igd_vga_passthrough(dev)) { - return -1; + error_setg(errp, "Need to enable igd-passthrough"); + return; } bios = get_vgabios(s, &bios_size, dev); if (!bios) { - XEN_PT_ERR(&s->dev, "VGA: Can't getting VBIOS!\n"); - return -1; + error_setg(errp, "VGA: Can't get VBIOS"); + return; } /* Currently we fixed this address as a primary. */ @@ -203,7 +205,6 @@ int xen_pt_setup_vga(XenPCIPassthroughState *s, XenHostPCIDevice *dev) /* Currently we fixed this address as a primary for legacy BIOS. */ cpu_physical_memory_rw(0xc0000, bios, bios_size, 1); - return 0; } uint32_t igd_read_opregion(XenPCIPassthroughState *s)