]> xenbits.xensource.com Git - xenclient/toolstack.git/commitdiff
Add pci-power-management option to enable Dx power management for pass-through devices.
authorKamala Narasimhan <kamala.narasimhan@citrix.com>
Mon, 29 Jun 2009 16:55:06 +0000 (12:55 -0400)
committerKamala Narasimhan <kamala.narasimhan@citrix.com>
Mon, 29 Jun 2009 16:55:06 +0000 (12:55 -0400)
Note: This takes care of global Dx power management for devices passed-through to a vm.  Per device
Dx option will also be added.

xenops/device.ml
xenops/device.mli
xenvm/vmact.ml
xenvm/vmconfig.ml
xenvm/xenops.ml
xenvm/xenvm.readme

index 5b7bc20b2dea1982c2e7d9a7ea6b27b6f9ca721b..9d0369cd6093a9834a0b5df7140c1d4953330860 100644 (file)
@@ -885,7 +885,7 @@ let grant_access_resources xc domid resources v =
                )
        ) 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;
@@ -922,6 +922,7 @@ let add_noexn ~xc ~xs ~hvm ~msitranslate pcidevs domid devid =
                "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);
@@ -929,8 +930,8 @@ let add_noexn ~xc ~xs ~hvm ~msitranslate pcidevs domid devid =
        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))
 
index da17c9703023f0123a3f540da8de12ccc31cb3f1..b083ad47e0d02756951f21b6fd025679d188ccca 100644 (file)
@@ -130,7 +130,7 @@ sig
        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
index c87ef3fb58c3c0236090387cbb34facba8384f46..24b6c23d1b3b28e7c8bb2b9aa375ef3b3daf3b77 100644 (file)
@@ -158,7 +158,8 @@ let add_devices xc xs domid state restore =
                ) 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 *)
index 43b36702972e49dd7d950988f88ef16e629c0228..e2ea52fe5204f2eb5fdad94066b158dd14b207e6 100644 (file)
@@ -111,6 +111,7 @@ type config = {
        extra_local_watches: string list;
        extra_vm_watches: string list;
        pci_msitranslate: int;
+        pci_power_mgmt: int;
        sound: string option;
        inject_sci: int;
 }
@@ -267,6 +268,7 @@ let get cfg field =
        | "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)
 
@@ -298,6 +300,7 @@ let set cfg field 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 }
        | "inject-sci" -> { cfg with inject_sci = int_of_string value } 
        | _           -> raise (Unknown_field field)
 
@@ -349,7 +352,8 @@ let of_file error_report file =
        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
@@ -502,6 +506,7 @@ let of_file error_report file =
                ("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
@@ -599,6 +604,7 @@ let of_file error_report file =
                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;
        }
index b59c7a4a6c1010701b5f446867893e4ee4f8cffb..e35410eacd1bb8865203cbae4d4945e25e13067a 100644 (file)
@@ -274,7 +274,7 @@ let add_pci ~xc ~xs ~hvm ~domid ~devid ~pci =
        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 =
index 759f3e5d1fcf663b38b236873728f49f83805a82..dac8d884921040ab6c9380b5f98959d7b4d082b3 100644 (file)
@@ -80,6 +80,8 @@ oem-features = int -- specify whether or not to pass through oem features.  Note
 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.