Xen 2016/08/12, fixed commit message

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJXrl4dAAoJEIlPj0hw4a6QUC0P/0e3gYgyZLJlZMgJGZDRrVkx
 8fuX6C0kj7hluV6Oy2eCPa4QFMyRIiEBPmVXj+gM9lTvuJhrPxxzVItRMncbgXd/
 gXd5t6WaY2PVy8AlbDIwHViS+e9l8UDDVjaVP4Fm4VRQh/VfasmcLLRt24fQq5Al
 e95GB2caPCcj20cum3LH4oGLGhVvfN7LGEhq71lt7kt/reqjkqf3UmtcaKWCzIZG
 6d7gaZ3hKPBYmTbajJR72MOzngqhVjiECTlXRpweOxcdFmrvF4Htem16sHxOUi4+
 Nc7mB7e2bWxsHr7ae+xFVOKV3fU7x9QTQR4D/5nZ3pzReEHLuYLFH1iVx7XJo+0Z
 ICY+HdBm5UANmyj5HmOv9UEyy+VnPsh0+TxnTtaah9+z8Zejcb3RKRP9OPvMKo9E
 lH34ZBYRWD+m+dJRLWYHK/DWxs+Iv0bRgl9V0ILwOglagXrbuVRktDCE0howcQGt
 rSJuhbOug17uY2B2BC1GclTCvdU0dvle0X//wJen/KZK6k85RV4kJdPmNiGE7k+Z
 o2cxoK/VIsBzn3tOn/184XtI8GzhSrN5bDzdE8e5rfZxG1/gj9nMFGq8jIkF9Eb4
 OqJZgHkQg4NJnPCO3GDHMzJ7twfzx5eDSo0ZXt/rY6/Rq1Yexp+4vUcHPOYMAvmT
 y/3stsJ8P6weNCMBUej2
 =ucIE
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20160812-tag-2' into staging

Xen 2016/08/12, fixed commit message

# gpg: Signature made Sat 13 Aug 2016 00:39:09 BST
# gpg:                using RSA key 0x894F8F4870E1AE90
# gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"
# Primary key fingerprint: D04E 33AB A51F 67BA 07D3  0AEA 894F 8F48 70E1 AE90

* remotes/sstabellini/tags/xen-20160812-tag-2:
  xen: handle inbound migration of VMs without ioreq server pages
  Xen: fix converity warning of xen_pt_config_init()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2016-08-15 19:04:51 +01:00
commit e5bfef86fe
4 changed files with 94 additions and 43 deletions

View File

@ -2049,9 +2049,8 @@ void xen_pt_config_init(XenPCIPassthroughState *s, Error **errp)
for (j = 0; regs->size != 0; j++, regs++) {
xen_pt_config_reg_init(s, reg_grp_entry, regs, &err);
if (err) {
error_append_hint(&err, "Failed to initialize %d/%zu"
" reg 0x%x in grp_type = 0x%x (%d/%zu)",
j, ARRAY_SIZE(xen_pt_emu_reg_grps[i].emu_regs),
error_append_hint(&err, "Failed to init register %d"
" offsets 0x%x in grp_type = 0x%x (%d/%zu)", j,
regs->offset, xen_pt_emu_reg_grps[i].grp_type,
i, ARRAY_SIZE(xen_pt_emu_reg_grps));
error_propagate(errp, err);

View File

@ -107,6 +107,44 @@ static inline int xen_get_vmport_regs_pfn(xc_interface *xc, domid_t dom,
#endif
static inline int xen_get_default_ioreq_server_info(xc_interface *xc,
domid_t dom,
xen_pfn_t *ioreq_pfn,
xen_pfn_t *bufioreq_pfn,
evtchn_port_t
*bufioreq_evtchn)
{
unsigned long param;
int rc;
rc = xc_get_hvm_param(xc, dom, HVM_PARAM_IOREQ_PFN, &param);
if (rc < 0) {
fprintf(stderr, "failed to get HVM_PARAM_IOREQ_PFN\n");
return -1;
}
*ioreq_pfn = param;
rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_PFN, &param);
if (rc < 0) {
fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_PFN\n");
return -1;
}
*bufioreq_pfn = param;
rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_EVTCHN,
&param);
if (rc < 0) {
fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n");
return -1;
}
*bufioreq_evtchn = param;
return 0;
}
/* Xen before 4.5 */
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 450
@ -154,10 +192,9 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom,
{
}
static inline int xen_create_ioreq_server(xc_interface *xc, domid_t dom,
ioservid_t *ioservid)
static inline void xen_create_ioreq_server(xc_interface *xc, domid_t dom,
ioservid_t *ioservid)
{
return 0;
}
static inline void xen_destroy_ioreq_server(xc_interface *xc, domid_t dom,
@ -171,35 +208,8 @@ static inline int xen_get_ioreq_server_info(xc_interface *xc, domid_t dom,
xen_pfn_t *bufioreq_pfn,
evtchn_port_t *bufioreq_evtchn)
{
unsigned long param;
int rc;
rc = xc_get_hvm_param(xc, dom, HVM_PARAM_IOREQ_PFN, &param);
if (rc < 0) {
fprintf(stderr, "failed to get HVM_PARAM_IOREQ_PFN\n");
return -1;
}
*ioreq_pfn = param;
rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_PFN, &param);
if (rc < 0) {
fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_PFN\n");
return -1;
}
*bufioreq_pfn = param;
rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_EVTCHN,
&param);
if (rc < 0) {
fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n");
return -1;
}
*bufioreq_evtchn = param;
return 0;
return xen_get_default_ioreq_server_info(xc, dom, ioreq_pfn, bufioreq_pfn,
bufioreq_evtchn);
}
static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom,
@ -212,6 +222,8 @@ static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom,
/* Xen 4.5 */
#else
static bool use_default_ioreq_server;
static inline void xen_map_memory_section(xc_interface *xc, domid_t dom,
ioservid_t ioservid,
MemoryRegionSection *section)
@ -220,6 +232,10 @@ static inline void xen_map_memory_section(xc_interface *xc, domid_t dom,
ram_addr_t size = int128_get64(section->size);
hwaddr end_addr = start_addr + size - 1;
if (use_default_ioreq_server) {
return;
}
trace_xen_map_mmio_range(ioservid, start_addr, end_addr);
xc_hvm_map_io_range_to_ioreq_server(xc, dom, ioservid, 1,
start_addr, end_addr);
@ -233,6 +249,11 @@ static inline void xen_unmap_memory_section(xc_interface *xc, domid_t dom,
ram_addr_t size = int128_get64(section->size);
hwaddr end_addr = start_addr + size - 1;
if (use_default_ioreq_server) {
return;
}
trace_xen_unmap_mmio_range(ioservid, start_addr, end_addr);
xc_hvm_unmap_io_range_from_ioreq_server(xc, dom, ioservid, 1,
start_addr, end_addr);
@ -246,6 +267,11 @@ static inline void xen_map_io_section(xc_interface *xc, domid_t dom,
ram_addr_t size = int128_get64(section->size);
hwaddr end_addr = start_addr + size - 1;
if (use_default_ioreq_server) {
return;
}
trace_xen_map_portio_range(ioservid, start_addr, end_addr);
xc_hvm_map_io_range_to_ioreq_server(xc, dom, ioservid, 0,
start_addr, end_addr);
@ -259,6 +285,10 @@ static inline void xen_unmap_io_section(xc_interface *xc, domid_t dom,
ram_addr_t size = int128_get64(section->size);
hwaddr end_addr = start_addr + size - 1;
if (use_default_ioreq_server) {
return;
}
trace_xen_unmap_portio_range(ioservid, start_addr, end_addr);
xc_hvm_unmap_io_range_from_ioreq_server(xc, dom, ioservid, 0,
start_addr, end_addr);
@ -268,6 +298,10 @@ static inline void xen_map_pcidev(xc_interface *xc, domid_t dom,
ioservid_t ioservid,
PCIDevice *pci_dev)
{
if (use_default_ioreq_server) {
return;
}
trace_xen_map_pcidev(ioservid, pci_bus_num(pci_dev->bus),
PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn));
xc_hvm_map_pcidev_to_ioreq_server(xc, dom, ioservid,
@ -280,6 +314,10 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom,
ioservid_t ioservid,
PCIDevice *pci_dev)
{
if (use_default_ioreq_server) {
return;
}
trace_xen_unmap_pcidev(ioservid, pci_bus_num(pci_dev->bus),
PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn));
xc_hvm_unmap_pcidev_from_ioreq_server(xc, dom, ioservid,
@ -288,22 +326,29 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom,
PCI_FUNC(pci_dev->devfn));
}
static inline int xen_create_ioreq_server(xc_interface *xc, domid_t dom,
ioservid_t *ioservid)
static inline void xen_create_ioreq_server(xc_interface *xc, domid_t dom,
ioservid_t *ioservid)
{
int rc = xc_hvm_create_ioreq_server(xc, dom, HVM_IOREQSRV_BUFIOREQ_ATOMIC,
ioservid);
if (rc == 0) {
trace_xen_ioreq_server_create(*ioservid);
return;
}
return rc;
*ioservid = 0;
use_default_ioreq_server = true;
trace_xen_default_ioreq_server();
}
static inline void xen_destroy_ioreq_server(xc_interface *xc, domid_t dom,
ioservid_t ioservid)
{
if (use_default_ioreq_server) {
return;
}
trace_xen_ioreq_server_destroy(ioservid);
xc_hvm_destroy_ioreq_server(xc, dom, ioservid);
}
@ -314,6 +359,12 @@ static inline int xen_get_ioreq_server_info(xc_interface *xc, domid_t dom,
xen_pfn_t *bufioreq_pfn,
evtchn_port_t *bufioreq_evtchn)
{
if (use_default_ioreq_server) {
return xen_get_default_ioreq_server_info(xc, dom, ioreq_pfn,
bufioreq_pfn,
bufioreq_evtchn);
}
return xc_hvm_get_ioreq_server_info(xc, dom, ioservid,
ioreq_pfn, bufioreq_pfn,
bufioreq_evtchn);
@ -323,6 +374,10 @@ static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom,
ioservid_t ioservid,
bool enable)
{
if (use_default_ioreq_server) {
return 0;
}
trace_xen_ioreq_server_state(ioservid, enable);
return xc_hvm_set_ioreq_server_state(xc, dom, ioservid, enable);
}

View File

@ -60,6 +60,7 @@ spice_vmc_event(int event) "spice vmc event %d"
# xen-hvm.c
xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: %#lx, size %#lx"
xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_dirty) "%#"PRIx64" size %#lx, log_dirty %i"
xen_default_ioreq_server(void) ""
xen_ioreq_server_create(uint32_t id) "id: %u"
xen_ioreq_server_destroy(uint32_t id) "id: %u"
xen_ioreq_server_state(uint32_t id, bool enable) "id: %u: enable: %i"

View File

@ -1203,11 +1203,7 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
goto err;
}
rc = xen_create_ioreq_server(xen_xc, xen_domid, &state->ioservid);
if (rc < 0) {
perror("xen: ioreq server create");
goto err;
}
xen_create_ioreq_server(xen_xc, xen_domid, &state->ioservid);
state->exit.notify = xen_exit_notifier;
qemu_add_exit_notifier(&state->exit);