Skip to content

Commit fa4f3b6

Browse files
committed
Xen 4.1: now toolstack has to call (de)assign_device instead of qemu
Fix CA-51980, and possibly CA-53479 as well. Signed-off-by: Zheng Li <[email protected]>
1 parent 9f73c1a commit fa4f3b6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

ocaml/xenops/device.ml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,11 +1202,14 @@ let plug ~xc ~xs (domain, bus, dev, func) domid =
12021202
let pci = to_string (domain, bus, dev, func) in
12031203
signal_device_model ~xc ~xs domid "pci-ins" pci;
12041204

1205-
match wait_device_model ~xc ~xs domid with
1205+
let () = match wait_device_model ~xc ~xs domid with
12061206
| "pci-inserted" ->
12071207
(* success *)
12081208
xs.Xs.write (device_model_pci_device_path xs 0 domid ^ "/dev-" ^ (string_of_int next_idx)) pci;
1209-
| x -> failwith (Printf.sprintf "Waiting for state=pci-inserted; got state=%s" x)
1209+
| x ->
1210+
failwith
1211+
(Printf.sprintf "Waiting for state=pci-inserted; got state=%s" x) in
1212+
Xc.domain_assign_device xc domid (domain, bus, dev, func)
12101213

12111214
let unplug ~xc ~xs (domain, bus, dev, func) domid =
12121215
let current = list ~xc ~xs domid in
@@ -1215,11 +1218,14 @@ let unplug ~xc ~xs (domain, bus, dev, func) domid =
12151218
let idx = fst (List.find (fun x -> snd x = (domain, bus, dev, func)) current) in
12161219
signal_device_model ~xc ~xs domid "pci-rem" pci;
12171220

1218-
match wait_device_model ~xc ~xs domid with
1221+
let () = match wait_device_model ~xc ~xs domid with
12191222
| "pci-removed" ->
12201223
(* success *)
12211224
xs.Xs.rm (device_model_pci_device_path xs 0 domid ^ "/dev-" ^ (string_of_int idx))
1222-
| x -> failwith (Printf.sprintf "Waiting for state=pci-removed; got state=%s" x)
1225+
| x ->
1226+
failwith (Printf.sprintf "Waiting for state=pci-removed; got state=%s" x)
1227+
in
1228+
Xc.domain_deassign_device xc domid (domain, bus, dev, func)
12231229

12241230
end
12251231

0 commit comments

Comments
 (0)