Skip to content

Commit

Permalink
CP-45741 VCS support, adjust args for qemu, demu
Browse files Browse the repository at this point in the history
Part of CP-44317, CP-44320 suporting NVidia VCS. Adjust args when we are
running a VCS (compute) vGPU when starting qemu and demu:

* don't pass -vgpu to qemu
* pass --noconsole to demu

Remove a redundant match in cmdline_of_disp.

Signed-off-by: Christian Lindig <[email protected]>
  • Loading branch information
lindig authored Nov 1, 2023
1 parent c34eb6a commit e64f953
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
6 changes: 4 additions & 2 deletions ocaml/xenopsd/xc/device.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2091,9 +2091,11 @@ module Dm_Common = struct
let cmdline_of_disp ?domid info =
let vga_type_opts x =
let open Xenops_interface.Vgpu in
(* We can match on the implementation details to detect the VCS
case. Don't pass -vgpu for a compute vGPU. *)
match x with
| Vgpu [{implementation= Nvidia _; _}] ->
["-vgpu"]
| Vgpu ({implementation= Nvidia {vclass= Some "Compute"; _}; _} :: _) ->
[] (* don't pass flags for VCS (compute) vGPU *)
| Vgpu ({implementation= Nvidia _; _} :: _) ->
["-vgpu"]
| Vgpu [{implementation= GVT_g gvt_g; _}] ->
Expand Down
20 changes: 19 additions & 1 deletion ocaml/xenopsd/xc/service.ml
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,16 @@ module Vgpu = struct
let pid_location = Pid.Xenstore pid_path
end)

(** An NVidia Virtual Compute Service vGPU has a class attribute
"Compute". Recognise this here *)
let is_compute_vgpu vgpu =
let open Xenops_interface.Vgpu in
match vgpu with
| {implementation= Nvidia {vclass= Some "Compute"; _}; _} ->
true
| _ ->
false

let vgpu_args_of_nvidia domid vcpus vgpus restore =
let open Xenops_interface.Vgpu in
let virtual_pci_address_compare vgpu1 vgpu2 =
Expand Down Expand Up @@ -504,7 +514,15 @@ module Vgpu = struct
@ device_args
in
let fd_arg = if restore then ["--resume"] else [] in
List.concat [base_args; fd_arg]
(* support for NVidia VCS (compute) vGPUs *)
let no_console =
match List.for_all is_compute_vgpu vgpus with
| true ->
["--noconsole"]
| false ->
[]
in
List.concat [base_args; no_console; fd_arg]

let state_path domid = Printf.sprintf "/local/domain/%d/vgpu/state" domid

Expand Down

0 comments on commit e64f953

Please sign in to comment.