Add Error **errp for xen_pt_setup_vga()
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> Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
This commit is contained in:
parent
376ba75f88
commit
5226bb59f7
|
@ -808,8 +808,11 @@ static int xen_pt_initfn(PCIDevice *d)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xen_pt_setup_vga(s, &s->real_device) < 0) {
|
xen_pt_setup_vga(s, &s->real_device, &err);
|
||||||
XEN_PT_ERR(d, "Setup VGA BIOS of passthrough GFX failed!\n");
|
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);
|
xen_host_pci_device_put(&s->real_device);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,5 +330,6 @@ static inline bool is_igd_vga_passthrough(XenHostPCIDevice *dev)
|
||||||
}
|
}
|
||||||
int xen_pt_register_vga_regions(XenHostPCIDevice *dev);
|
int xen_pt_register_vga_regions(XenHostPCIDevice *dev);
|
||||||
int xen_pt_unregister_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 */
|
#endif /* !XEN_PT_H */
|
||||||
|
|
|
@ -161,7 +161,8 @@ struct pci_data {
|
||||||
uint16_t reserved;
|
uint16_t reserved;
|
||||||
} __attribute__((packed));
|
} __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;
|
unsigned char *bios = NULL;
|
||||||
struct rom_header *rom;
|
struct rom_header *rom;
|
||||||
|
@ -172,13 +173,14 @@ int xen_pt_setup_vga(XenPCIPassthroughState *s, XenHostPCIDevice *dev)
|
||||||
struct pci_data *pd = NULL;
|
struct pci_data *pd = NULL;
|
||||||
|
|
||||||
if (!is_igd_vga_passthrough(dev)) {
|
if (!is_igd_vga_passthrough(dev)) {
|
||||||
return -1;
|
error_setg(errp, "Need to enable igd-passthrough");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bios = get_vgabios(s, &bios_size, dev);
|
bios = get_vgabios(s, &bios_size, dev);
|
||||||
if (!bios) {
|
if (!bios) {
|
||||||
XEN_PT_ERR(&s->dev, "VGA: Can't getting VBIOS!\n");
|
error_setg(errp, "VGA: Can't get VBIOS");
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Currently we fixed this address as a primary. */
|
/* 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. */
|
/* Currently we fixed this address as a primary for legacy BIOS. */
|
||||||
cpu_physical_memory_rw(0xc0000, bios, bios_size, 1);
|
cpu_physical_memory_rw(0xc0000, bios, bios_size, 1);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t igd_read_opregion(XenPCIPassthroughState *s)
|
uint32_t igd_read_opregion(XenPCIPassthroughState *s)
|
||||||
|
|
Loading…
Reference in a new issue