(* add pcis *)
List.iter (fun (devid, devs) ->
let bind = ref false in
+ let dev_msitranslate = ref None in
++ let dev_power_mgmt = ref None in
let devs = List.map (fun dev ->
bind := !bind || dev.pci_bind;
+ maybe (fun x -> dev_msitranslate := Some x) dev.pci_msitranslate;
++ maybe (fun x -> dev_power_mgmt := Some x) dev.pci_power_mgmt;
(dev.pci_domain, dev.pci_bus, dev.pci_slot, dev.pci_func)
) devs in
if !bind then
Device.PCI.bind devs;
- Device.PCI.add ~xc ~xs ~hvm:cfg.hvm ~msitranslate:cfg.pci_msitranslate
- ~pci_power_mgmt:cfg.pci_power_mgmt devs domid devid
+ (* if the device has defined a msitranslate value, use it,
- otherwise use the global one *)
++ otherwise use the global one. same for power_mgmt *)
+ let msitranslate =
+ match !dev_msitranslate with
+ | None -> cfg.global_pci_msitranslate
+ | Some i -> i
+ in
- Device.PCI.add ~xc ~xs ~hvm:cfg.hvm ~msitranslate devs domid devid
++ let pci_power_mgmt =
++ match !dev_power_mgmt with
++ | None -> cfg.global_pci_power_mgmt
++ | Some i -> i
++ in
++ Device.PCI.add ~xc ~xs ~hvm:cfg.hvm ~msitranslate ~pci_power_mgmt devs domid devid
) cfg.pcis;
(* add device model *)
vpt_align: int option;
extra_local_watches: string list;
extra_vm_watches: string list;
- pci_msitranslate: int;
- pci_power_mgmt: int;
+ global_pci_msitranslate: int;
++ global_pci_power_mgmt: int;
sound: string option;
inject_sci: int;
}
| "vpt-align" -> string_of_int_option cfg.vpt_align
| "power-management" -> string_of_int cfg.power_management
| "oem-features" -> string_of_int cfg.oem_features
- | "pci-msitranslate" -> string_of_int cfg.pci_msitranslate
- | "pci-power-management" -> string_of_int cfg.pci_power_mgmt
+ | "pci-msitranslate" -> string_of_int cfg.global_pci_msitranslate
++ | "pci-power-management" -> string_of_int cfg.global_pci_power_mgmt
| "inject-sci" -> string_of_int cfg.inject_sci
| _ -> raise (Unknown_field field)
| "vpt-align" -> { cfg with vpt_align = int_option_of_string value }
| "power-management" -> { cfg with power_management = int_of_string value }
| "oem-features" -> { cfg with oem_features = int_of_string value }
- | "pci-msitranslate" -> { cfg with pci_msitranslate = int_of_string value }
- | "pci-power-management" -> { cfg with pci_power_mgmt = int_of_string value }
+ | "pci-msitranslate" -> { cfg with global_pci_msitranslate = int_of_string value }
++ | "pci-power-management" -> { cfg with global_pci_power_mgmt = int_of_string value }
| "inject-sci" -> { cfg with inject_sci = int_of_string value }
| _ -> raise (Unknown_field field)
snapshot_mode = !snapshot_mode;
extra_local_watches = List.rev !extra_local_watches;
extra_vm_watches = List.rev !extra_vm_watches;
- pci_msitranslate = !pci_msitranslate;
- pci_power_mgmt = !pci_power_mgmt;
+ global_pci_msitranslate = !pci_msitranslate;
++ global_pci_power_mgmt = !pci_power_mgmt;
sound = !sound;
inject_sci = !inject_sci;
}