2013-03-08 20:47:00 +01:00
|
|
|
>From 5aeda96eafd230af55343e7ef835e081ded484aa Mon Sep 17 00:00:00 2001
|
|
|
|
From: Chunyan Liu <cyliu@suse.com>
|
|
|
|
Date: Fri, 25 Jan 2013 17:37:14 +0800
|
|
|
|
Subject: [PATCH] support managed pci devices in xen driver
|
|
|
|
|
|
|
|
---
|
|
|
|
src/xenxs/xen_sxpr.c | 22 ++++++++--------------
|
|
|
|
src/xenxs/xen_xm.c | 28 +++++++++++++++++++++++++++-
|
|
|
|
2 files changed, 35 insertions(+), 15 deletions(-)
|
|
|
|
|
2013-12-06 19:39:18 +01:00
|
|
|
Index: libvirt-1.2.0/src/xenxs/xen_sxpr.c
|
2013-03-08 20:47:00 +01:00
|
|
|
===================================================================
|
2013-12-06 19:39:18 +01:00
|
|
|
--- libvirt-1.2.0.orig/src/xenxs/xen_sxpr.c
|
|
|
|
+++ libvirt-1.2.0/src/xenxs/xen_sxpr.c
|
- Update to libvirt 1.1.4
- Add support for AArch64 architecture
- Various improvements on test code and test driver
- Don't link virt-login-shell against libvirt.so
- Close all non-stdio FDs in virt-login-shell
- Only allow 'stderr' log output when running setuid
- Fix perms for virConnectDomainXML{To,From}Native
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Drop upstream patches: e7f400a1-CVE-2013-4296.patch,
2dba0323-CVE-2013-4297.patch, db7a5688-CVE-2013-4311.patch,
e65667c0-CVE-2013-4311.patch, 922b7fda-CVE-2013-4311.patch,
e4697b92-CVE-2013-4311.patch, 8294aa0c-CVE-2013-4399.patch,
484cc321-fix-spice-migration.patch,
79552754-libvirtd-chardev-crash.patch,
57687fd6-CVE-2013-4401.patch, ae53e5d1-CVE-2013-4400.patch,
8c3586ea-CVE-2013-4400.patch, b7fcc799a-CVE-2013-4400.patch,
3e2f27e1-CVE-2013-4400.patch, 5a0ea4b7-CVE-2013-4400.patch,
843bdb2f-CVE-2013-4400.patch,
bd773e74-lxc-terminate-machine.patch,
e350826c-python-fix-fd-passing.patch
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=329
2013-11-20 21:02:26 +01:00
|
|
|
@@ -996,6 +996,7 @@ xenParseSxprPCI(virDomainDefPtr def,
|
2013-03-08 20:47:00 +01:00
|
|
|
int busID;
|
|
|
|
int slotID;
|
|
|
|
int funcID;
|
2013-05-02 21:17:46 +02:00
|
|
|
+ bool managed;
|
2013-03-08 20:47:00 +01:00
|
|
|
|
|
|
|
node = cur->u.s.car;
|
|
|
|
if (!sexpr_lookup(node, "dev"))
|
- Update to libvirt 1.1.4
- Add support for AArch64 architecture
- Various improvements on test code and test driver
- Don't link virt-login-shell against libvirt.so
- Close all non-stdio FDs in virt-login-shell
- Only allow 'stderr' log output when running setuid
- Fix perms for virConnectDomainXML{To,From}Native
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Drop upstream patches: e7f400a1-CVE-2013-4296.patch,
2dba0323-CVE-2013-4297.patch, db7a5688-CVE-2013-4311.patch,
e65667c0-CVE-2013-4311.patch, 922b7fda-CVE-2013-4311.patch,
e4697b92-CVE-2013-4311.patch, 8294aa0c-CVE-2013-4399.patch,
484cc321-fix-spice-migration.patch,
79552754-libvirtd-chardev-crash.patch,
57687fd6-CVE-2013-4401.patch, ae53e5d1-CVE-2013-4400.patch,
8c3586ea-CVE-2013-4400.patch, b7fcc799a-CVE-2013-4400.patch,
3e2f27e1-CVE-2013-4400.patch, 5a0ea4b7-CVE-2013-4400.patch,
843bdb2f-CVE-2013-4400.patch,
bd773e74-lxc-terminate-machine.patch,
e350826c-python-fix-fd-passing.patch
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=329
2013-11-20 21:02:26 +01:00
|
|
|
@@ -1043,11 +1044,13 @@ xenParseSxprPCI(virDomainDefPtr def,
|
2013-03-08 20:47:00 +01:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ managed = sexpr_int(node, "dev/opts/managed");
|
|
|
|
+
|
|
|
|
if (!(dev = virDomainHostdevDefAlloc()))
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
dev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
|
2013-05-02 21:17:46 +02:00
|
|
|
- dev->managed = false;
|
|
|
|
+ dev->managed = managed ? true : false;
|
2013-03-08 20:47:00 +01:00
|
|
|
dev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
|
2013-05-02 21:17:46 +02:00
|
|
|
dev->source.subsys.u.pci.addr.domain = domainID;
|
|
|
|
dev->source.subsys.u.pci.addr.bus = busID;
|
- Update to libvirt 1.1.4
- Add support for AArch64 architecture
- Various improvements on test code and test driver
- Don't link virt-login-shell against libvirt.so
- Close all non-stdio FDs in virt-login-shell
- Only allow 'stderr' log output when running setuid
- Fix perms for virConnectDomainXML{To,From}Native
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Drop upstream patches: e7f400a1-CVE-2013-4296.patch,
2dba0323-CVE-2013-4297.patch, db7a5688-CVE-2013-4311.patch,
e65667c0-CVE-2013-4311.patch, 922b7fda-CVE-2013-4311.patch,
e4697b92-CVE-2013-4311.patch, 8294aa0c-CVE-2013-4399.patch,
484cc321-fix-spice-migration.patch,
79552754-libvirtd-chardev-crash.patch,
57687fd6-CVE-2013-4401.patch, ae53e5d1-CVE-2013-4400.patch,
8c3586ea-CVE-2013-4400.patch, b7fcc799a-CVE-2013-4400.patch,
3e2f27e1-CVE-2013-4400.patch, 5a0ea4b7-CVE-2013-4400.patch,
843bdb2f-CVE-2013-4400.patch,
bd773e74-lxc-terminate-machine.patch,
e350826c-python-fix-fd-passing.patch
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=329
2013-11-20 21:02:26 +01:00
|
|
|
@@ -1991,11 +1994,15 @@ static void
|
2013-03-08 20:47:00 +01:00
|
|
|
xenFormatSxprPCI(virDomainHostdevDefPtr def,
|
|
|
|
virBufferPtr buf)
|
|
|
|
{
|
|
|
|
- virBufferAsprintf(buf, "(dev (domain 0x%04x)(bus 0x%02x)(slot 0x%02x)(func 0x%x))",
|
|
|
|
+ virBufferAsprintf(buf, "(dev (domain 0x%04x)(bus 0x%02x)(slot 0x%02x)(func 0x%x)",
|
2013-05-02 21:17:46 +02:00
|
|
|
def->source.subsys.u.pci.addr.domain,
|
|
|
|
def->source.subsys.u.pci.addr.bus,
|
|
|
|
def->source.subsys.u.pci.addr.slot,
|
|
|
|
def->source.subsys.u.pci.addr.function);
|
|
|
|
+
|
2013-03-08 20:47:00 +01:00
|
|
|
+ if (def->managed)
|
|
|
|
+ virBufferAddLit(buf, "(opts (managed 1))");
|
|
|
|
+ virBufferAddLit(buf, ")");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
- Update to libvirt 1.1.4
- Add support for AArch64 architecture
- Various improvements on test code and test driver
- Don't link virt-login-shell against libvirt.so
- Close all non-stdio FDs in virt-login-shell
- Only allow 'stderr' log output when running setuid
- Fix perms for virConnectDomainXML{To,From}Native
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Drop upstream patches: e7f400a1-CVE-2013-4296.patch,
2dba0323-CVE-2013-4297.patch, db7a5688-CVE-2013-4311.patch,
e65667c0-CVE-2013-4311.patch, 922b7fda-CVE-2013-4311.patch,
e4697b92-CVE-2013-4311.patch, 8294aa0c-CVE-2013-4399.patch,
484cc321-fix-spice-migration.patch,
79552754-libvirtd-chardev-crash.patch,
57687fd6-CVE-2013-4401.patch, ae53e5d1-CVE-2013-4400.patch,
8c3586ea-CVE-2013-4400.patch, b7fcc799a-CVE-2013-4400.patch,
3e2f27e1-CVE-2013-4400.patch, 5a0ea4b7-CVE-2013-4400.patch,
843bdb2f-CVE-2013-4400.patch,
bd773e74-lxc-terminate-machine.patch,
e350826c-python-fix-fd-passing.patch
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=329
2013-11-20 21:02:26 +01:00
|
|
|
@@ -2014,12 +2021,6 @@ xenFormatSxprOnePCI(virDomainHostdevDefP
|
2013-03-08 20:47:00 +01:00
|
|
|
virBufferPtr buf,
|
|
|
|
int detach)
|
|
|
|
{
|
|
|
|
- if (def->managed) {
|
|
|
|
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
|
- _("managed PCI devices not supported with XenD"));
|
|
|
|
- return -1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
virBufferAddLit(buf, "(pci ");
|
|
|
|
xenFormatSxprPCI(def, buf);
|
|
|
|
if (detach)
|
- Update to libvirt 1.1.4
- Add support for AArch64 architecture
- Various improvements on test code and test driver
- Don't link virt-login-shell against libvirt.so
- Close all non-stdio FDs in virt-login-shell
- Only allow 'stderr' log output when running setuid
- Fix perms for virConnectDomainXML{To,From}Native
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Drop upstream patches: e7f400a1-CVE-2013-4296.patch,
2dba0323-CVE-2013-4297.patch, db7a5688-CVE-2013-4311.patch,
e65667c0-CVE-2013-4311.patch, 922b7fda-CVE-2013-4311.patch,
e4697b92-CVE-2013-4311.patch, 8294aa0c-CVE-2013-4399.patch,
484cc321-fix-spice-migration.patch,
79552754-libvirtd-chardev-crash.patch,
57687fd6-CVE-2013-4401.patch, ae53e5d1-CVE-2013-4400.patch,
8c3586ea-CVE-2013-4400.patch, b7fcc799a-CVE-2013-4400.patch,
3e2f27e1-CVE-2013-4400.patch, 5a0ea4b7-CVE-2013-4400.patch,
843bdb2f-CVE-2013-4400.patch,
bd773e74-lxc-terminate-machine.patch,
e350826c-python-fix-fd-passing.patch
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=329
2013-11-20 21:02:26 +01:00
|
|
|
@@ -2074,12 +2075,6 @@ xenFormatSxprAllPCI(virDomainDefPtr def,
|
2013-06-05 00:48:46 +02:00
|
|
|
for (i = 0; i < def->nhostdevs; i++) {
|
2013-03-08 20:47:00 +01:00
|
|
|
if (def->hostdevs[i]->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
|
|
|
def->hostdevs[i]->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
|
|
|
|
- if (def->hostdevs[i]->managed) {
|
|
|
|
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
|
- _("managed PCI devices not supported with XenD"));
|
|
|
|
- return -1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
xenFormatSxprPCI(def->hostdevs[i], buf);
|
|
|
|
}
|
|
|
|
}
|
2013-12-06 19:39:18 +01:00
|
|
|
Index: libvirt-1.2.0/src/xenxs/xen_xm.c
|
2013-03-08 20:47:00 +01:00
|
|
|
===================================================================
|
2013-12-06 19:39:18 +01:00
|
|
|
--- libvirt-1.2.0.orig/src/xenxs/xen_xm.c
|
|
|
|
+++ libvirt-1.2.0/src/xenxs/xen_xm.c
|
2013-07-30 22:33:47 +02:00
|
|
|
@@ -802,6 +802,8 @@ xenParseXM(virConfPtr conf, int xendConf
|
2013-03-08 20:47:00 +01:00
|
|
|
int busID;
|
|
|
|
int slotID;
|
|
|
|
int funcID;
|
|
|
|
+ char *opt;
|
2013-05-02 21:17:46 +02:00
|
|
|
+ int managed = 0;
|
2013-03-08 20:47:00 +01:00
|
|
|
|
|
|
|
domain[0] = bus[0] = slot[0] = func[0] = '\0';
|
|
|
|
|
2013-07-30 22:33:47 +02:00
|
|
|
@@ -811,6 +813,11 @@ xenParseXM(virConfPtr conf, int xendConf
|
2013-03-08 20:47:00 +01:00
|
|
|
/* pci=['0000:00:1b.0','0000:00:13.0'] */
|
|
|
|
if (!(key = list->str))
|
|
|
|
goto skippci;
|
|
|
|
+
|
|
|
|
+ opt = strchr(key, ',');
|
|
|
|
+ if (opt)
|
|
|
|
+ opt++;
|
|
|
|
+
|
|
|
|
if (!(nextkey = strchr(key, ':')))
|
|
|
|
goto skippci;
|
|
|
|
|
2013-07-30 22:33:47 +02:00
|
|
|
@@ -859,10 +866,30 @@ xenParseXM(virConfPtr conf, int xendConf
|
2013-03-08 20:47:00 +01:00
|
|
|
if (virStrToLong_i(func, NULL, 16, &funcID) < 0)
|
|
|
|
goto skippci;
|
|
|
|
|
|
|
|
+ if (opt) {
|
|
|
|
+ char opt_managed[2];
|
|
|
|
+ char *data;
|
|
|
|
+
|
|
|
|
+ opt_managed[0] = '\0';
|
|
|
|
+ data = strchr(opt, '=');
|
|
|
|
+ data++;
|
|
|
|
+
|
|
|
|
+ if (STRPREFIX(opt, "managed=")) {
|
|
|
|
+ if (virStrncpy(opt_managed, data, 1, sizeof(opt_managed)) == NULL) {
|
|
|
|
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
|
+ _("managed option %s too big for destination"),
|
|
|
|
+ data);
|
|
|
|
+ goto skippci;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (virStrToLong_i(opt_managed, NULL, 10, &managed) < 0)
|
|
|
|
+ goto skippci;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (!(hostdev = virDomainHostdevDefAlloc()))
|
|
|
|
goto cleanup;
|
|
|
|
|
2013-05-02 21:17:46 +02:00
|
|
|
- hostdev->managed = false;
|
|
|
|
+ hostdev->managed = managed ? true : false;
|
2013-03-08 20:47:00 +01:00
|
|
|
hostdev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
|
2013-05-02 21:17:46 +02:00
|
|
|
hostdev->source.subsys.u.pci.addr.domain = domainID;
|
|
|
|
hostdev->source.subsys.u.pci.addr.bus = busID;
|