All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cao jin <caoj.fnst@cn.fujitsu.com>
To: qemu-devel@nongnu.org
Cc: stefano.stabellini@eu.citrix.com
Subject: [Qemu-devel] [PATCH v6 4/6] Add Error **errp for xen_pt_setup_vga()
Date: Sun, 17 Jan 2016 20:13:13 +0800	[thread overview]
Message-ID: <1453032795-12690-5-git-send-email-caoj.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1453032795-12690-1-git-send-email-caoj.fnst@cn.fujitsu.com>

To catch the error message. Also modify the caller

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 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)
-- 
2.1.0

  parent reply	other threads:[~2016-01-17 12:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-17 12:13 [Qemu-devel] [PATCH v6 0/6] Xen PCI passthru: Convert to realize() Cao jin
2016-01-17 12:13 ` [Qemu-devel] [PATCH v6 1/6] Change xen_host_pci_sysfs_path() to return void Cao jin
2016-01-18 20:30   ` Eric Blake
2016-01-17 12:13 ` [Qemu-devel] [PATCH v6 2/6] Xen: use qemu_strtoul instead of strtol Cao jin
2016-01-20  0:09   ` Eric Blake
2016-01-17 12:13 ` [Qemu-devel] [PATCH v6 3/6] Add Error **errp for xen_host_pci_device_get() Cao jin
2016-01-21 16:23   ` Eric Blake
2016-01-17 12:13 ` Cao jin [this message]
2016-01-17 12:13 ` [Qemu-devel] [PATCH v6 5/6] Add Error **errp for xen_pt_config_init() Cao jin
2016-01-17 12:13 ` [Qemu-devel] [PATCH v6 6/6] Xen PCI passthru: convert to realize() Cao jin
2016-01-19  1:38 ` [Qemu-devel] [PATCH v6 0/6] Xen PCI passthru: Convert " Cao jin
2016-01-19  7:22   ` Markus Armbruster
2016-01-21 13:26 ` Cao jin
2016-01-21 15:41   ` Stefano Stabellini
2016-01-21 16:24     ` Eric Blake
2016-01-21 16:39       ` Stefano Stabellini
2016-01-22  6:00     ` Cao jin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1453032795-12690-5-git-send-email-caoj.fnst@cn.fujitsu.com \
    --to=caoj.fnst@cn.fujitsu.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.