Note: This takes care of global Dx power management for devices passed-through to a vm. Per device
Dx option will also be added.
)
) resources
-let add_noexn ~xc ~xs ~hvm ~msitranslate pcidevs domid devid =
+let add_noexn ~xc ~xs ~hvm ~msitranslate ~pci_power_mgmt pcidevs domid devid =
let pcidevs = List.map (fun (domain, bus, slot, func) ->
let (irq, resources, driver) = get_from_system domain bus slot func in
{ domain = domain; bus = bus; slot = slot; func = func;
"num_devs", string_of_int (List.length xsdevs);
"state", string_of_int (Xenbus.int_of Xenbus.Initialising);
"msitranslate", string_of_int (msitranslate);
+ "pci_power_mgmt", string_of_int (pci_power_mgmt);
] and frontendlist = [
"backend-id", "0";
"state", string_of_int (Xenbus.int_of Xenbus.Initialising);
Generic.add_device ~xs device (xsdevs @ backendlist) frontendlist;
()
-let add ~xc ~xs ~hvm ~msitranslate pcidevs domid devid =
- try add_noexn ~xc ~xs ~hvm ~msitranslate pcidevs domid devid
+let add ~xc ~xs ~hvm ~msitranslate ~pci_power_mgmt pcidevs domid devid =
+ try add_noexn ~xc ~xs ~hvm ~msitranslate ~pci_power_mgmt pcidevs domid devid
with exn ->
raise (Cannot_add (pcidevs, exn))
exception Cannot_use_pci_with_no_pciback of t list
val add : xc:Xc.handle -> xs:Xs.xsh -> hvm:bool -> msitranslate:int
- -> dev list -> Xc.domid -> int -> unit
+ -> pci_power_mgmt:int -> dev list -> Xc.domid -> int -> unit
val release : xc:Xc.handle -> xs:Xs.xsh -> hvm:bool
-> dev list -> Xc.domid -> int -> unit
val reset : xs:Xs.xsh -> device -> unit
) devs in
if !bind then
Device.PCI.bind devs;
- Device.PCI.add ~xc ~xs ~hvm:cfg.hvm ~msitranslate:cfg.pci_msitranslate devs domid devid
+ Device.PCI.add ~xc ~xs ~hvm:cfg.hvm ~msitranslate:cfg.pci_msitranslate
+ ~pci_power_mgmt:cfg.pci_power_mgmt devs domid devid
) cfg.pcis;
(* add device model *)
extra_local_watches: string list;
extra_vm_watches: string list;
pci_msitranslate: int;
+ pci_power_mgmt: int;
sound: string option;
inject_sci: int;
}
| "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
| "inject-sci" -> string_of_int cfg.inject_sci
| _ -> raise (Unknown_field field)
| "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 }
| "inject-sci" -> { cfg with inject_sci = int_of_string value }
| _ -> raise (Unknown_field field)
and snapshot_mode = ref NoSnapshot
and extra_local_watches = ref []
and extra_vm_watches = ref []
- and pci_msitranslate = ref 0
+ and pci_msitranslate = ref 0
+ and pci_power_mgmt = ref 0
and sound = ref None
and inject_sci = ref 0
in
("extra-local-watch", Config.String set_local_watch);
("extra-vm-watch", Config.String set_vm_watch);
("pci-msitranslate", Config.Set_int pci_msitranslate);
+ ("pci-power-management", Config.Set_int pci_power_mgmt);
("sound", Config.String (fun s -> sound := Some s));
("inject-sci", Config.Set_int inject_sci);
] in
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;
sound = !sound;
inject_sci = !inject_sci;
}
let pcidevs = List.map (fun d ->
Scanf.sscanf d "%04x:%02x:%02x.%1x" (fun a b c d -> (a, b, c, d))
) (String.split ',' pci) in
- Device.PCI.add ~xc ~xs ~hvm ~msitranslate:0 pcidevs domid devid;
+ Device.PCI.add ~xc ~xs ~hvm ~msitranslate:0 ~pci_power_mgmt:0 pcidevs domid devid;
()
let del_pci ~xc ~xs ~hvm ~domid ~devid ~pci =
timer-mode = int -- specify the timer mode used.
timeoffset = string -- specify the time offset (i.e. timezone) used.
pci-msitranslate = int -- specify whether or not to use MSI-INTx translation for guest.
+pci-power-management = int -- specify whether or not to enable Dx power management for
+ passthrough devices.
inject-sci = int -- specify whether or not to inject SCIs like lid close, power button press to guest.
Default is to not inject SCIs.