forked from QubesOS/qubes-vmm-xen
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpatch-0003-libxl-don-t-try-to-manipulate-json-config-for-stubdo.patch
69 lines (57 loc) · 2.38 KB
/
patch-0003-libxl-don-t-try-to-manipulate-json-config-for-stubdo.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From f0d74dd1e66783375f6a04b40aab564abb4f268a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
Date: Mon, 17 Oct 2016 21:49:03 +0200
Subject: [PATCH] libxl: don't try to manipulate json config for stubdomain
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Invisible Things Lab
Cc: Marek Marczykowski-Górecki <[email protected]>
Stubdomain do not have it's own config file - its configuration is
derived from target domains. Do not try to manipulate it when attaching
PCI device.
This bug prevented starting HVM with stubdomain and PCI passthrough
device attached.
Signed-off-by: Marek Marczykowski-Górecki <[email protected]>
---
tools/libxl/libxl_pci.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 77d9d02..1087f1a 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -151,14 +151,18 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, uint32_t domid, libxl_d
GCNEW(device);
libxl__device_from_pcidev(gc, domid, pcidev, device);
- lock = libxl__lock_domain_userdata(gc, domid);
- if (!lock) {
- rc = ERROR_LOCK_FAIL;
- goto out;
- }
+ /* Stubdomain config is derived from its target domain, it doesn't have
+ its own file */
+ if (!libxl_is_stubdom(CTX, domid, NULL)) {
+ lock = libxl__lock_domain_userdata(gc, domid);
+ if (!lock) {
+ rc = ERROR_LOCK_FAIL;
+ goto out;
+ }
- rc = libxl__get_domain_configuration(gc, domid, &d_config);
- if (rc) goto out;
+ rc = libxl__get_domain_configuration(gc, domid, &d_config);
+ if (rc) goto out;
+ }
DEVICE_ADD(pci, pcidevs, domid, &pcidev_saved, COMPARE_PCI, &d_config);
@@ -169,8 +173,10 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, uint32_t domid, libxl_d
rc = libxl__xs_transaction_start(gc, &t);
if (rc) goto out;
- rc = libxl__set_domain_configuration(gc, domid, &d_config);
- if (rc) goto out;
+ if (lock) {
+ rc = libxl__set_domain_configuration(gc, domid, &d_config);
+ if (rc) goto out;
+ }
libxl__xs_writev(gc, t, be_path, libxl__xs_kvs_of_flexarray(gc, back));
--
2.7.4