From patchwork Wed Jan 6 02:39:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cao jin X-Patchwork-Id: 563678 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7DEA61402DE for ; Wed, 6 Jan 2016 13:37:16 +1100 (AEDT) Received: from localhost ([::1]:52284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGdyM-0002qH-Cj for incoming@patchwork.ozlabs.org; Tue, 05 Jan 2016 21:37:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGdxo-0001iq-42 for qemu-devel@nongnu.org; Tue, 05 Jan 2016 21:36:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGdxk-0006yq-31 for qemu-devel@nongnu.org; Tue, 05 Jan 2016 21:36:40 -0500 Received: from [59.151.112.132] (port=28971 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGdxj-0006xf-Nk for qemu-devel@nongnu.org; Tue, 05 Jan 2016 21:36:36 -0500 X-IronPort-AV: E=Sophos;i="5.20,346,1444665600"; d="scan'208";a="2263016" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 06 Jan 2016 10:36:31 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 3EFBD41890FA; Wed, 6 Jan 2016 10:36:14 +0800 (CST) Received: from G08FNSTD140223.g08.fujitsu.local (10.167.226.69) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Wed, 6 Jan 2016 10:36:14 +0800 From: Cao jin To: Date: Wed, 6 Jan 2016 10:39:09 +0800 Message-ID: <1452047951-17429-3-git-send-email-caoj.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1452047951-17429-1-git-send-email-caoj.fnst@cn.fujitsu.com> References: <1452047951-17429-1-git-send-email-caoj.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.69] X-yoursite-MailScanner-ID: 3EFBD41890FA.AC7B7 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: caoj.fnst@cn.fujitsu.com X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Cc: stefano.stabellini@eu.citrix.com Subject: [Qemu-devel] [PATCH v3 2/4] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org To catch the error msg. Also modify the caller Signed-off-by: Cao jin Reviewed-by: Stefano Stabellini --- hw/xen/xen_pt.c | 5 ++++- hw/xen/xen_pt.h | 3 ++- hw/xen/xen_pt_graphics.c | 11 ++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 1bd4109..fbce55c 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -807,7 +807,10 @@ static int xen_pt_initfn(PCIDevice *d) return -1; } - if (xen_pt_setup_vga(s, &s->real_device) < 0) { + xen_pt_setup_vga(s, &s->real_device, &local_err); + if (local_err) { + error_append_hint(&local_err, "Setup VGA BIOS of passthrough" + " GFX failed!"); XEN_PT_ERR(d, "Setup VGA BIOS of passthrough GFX failed!\n"); 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 c545280..dc74d3e 100644 --- a/hw/xen/xen_pt.h +++ b/hw/xen/xen_pt.h @@ -328,5 +328,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..a0a7e9c 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 getting 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)