@@ -467,36 +467,55 @@ module Intel = struct
467467 List. nth device.Pci.Pci_dev. size 2
468468 |> Int64. of_nativeint
469469 in
470- List. map
470+ let rec collect acc = function
471+ | [] -> acc
472+ | Some v :: tail -> collect (v :: acc) tail
473+ | None :: tail -> collect acc tail
474+ in
475+ whitelist
476+ |> List. map
471477 Identifier. (fun conf ->
472478 let vgpus_per_pgpu =
473479 bar_size /// 1024L /// 1024L
474480 /// conf.identifier.low_gm_sz
475481 --- 1L
476482 in
477- let vgpu_size = Constants. pgpu_default_size /// vgpus_per_pgpu in
478- {
479- vendor_name;
480- model_name = conf.model_name;
481- framebuffer_size = conf.framebufferlength;
482- max_heads = conf.num_heads;
483- max_resolution_x = conf.max_x;
484- max_resolution_y = conf.max_y;
485- size = vgpu_size;
486- internal_config = [
487- Xapi_globs. vgt_low_gm_sz, Int64. to_string conf.identifier.low_gm_sz;
488- Xapi_globs. vgt_high_gm_sz, Int64. to_string conf.identifier.high_gm_sz;
489- Xapi_globs. vgt_fence_sz, Int64. to_string conf.identifier.fence_sz;
490- ] @ (
491- match conf.identifier.monitor_config_file with
483+ if vgpus_per_pgpu < = 0L then
484+ begin
485+ warn " Not enough memory for Intel VGPUs. \
486+ If you intend to use them, increase the GPU \
487+ BAR size in the BIOS settings." ;
488+ None
489+ end
490+ else
491+ let vgpu_size =
492+ Constants. pgpu_default_size /// vgpus_per_pgpu
493+ in
494+ let internal_config = let open Xapi_globs in
495+ List. concat [
496+ [ vgt_low_gm_sz, Int64. to_string conf.identifier.low_gm_sz
497+ ; vgt_high_gm_sz, Int64. to_string conf.identifier.high_gm_sz
498+ ; vgt_fence_sz, Int64. to_string conf.identifier.fence_sz
499+ ]
500+ ; match conf.identifier.monitor_config_file with
492501 | Some monitor_config_file ->
493- [Xapi_globs. vgt_monitor_config_file, monitor_config_file]
502+ [vgt_monitor_config_file, monitor_config_file]
494503 | None -> []
495- );
496- identifier = GVT_g conf.identifier;
497- experimental = conf.experimental;
498- })
499- whitelist
504+ ]
505+ in
506+ Some {
507+ vendor_name;
508+ model_name = conf.model_name;
509+ framebuffer_size = conf.framebufferlength;
510+ max_heads = conf.num_heads;
511+ max_resolution_x = conf.max_x;
512+ max_resolution_y = conf.max_y;
513+ size = vgpu_size;
514+ internal_config = internal_config;
515+ identifier = GVT_g conf.identifier;
516+ experimental = conf.experimental;
517+ })
518+ |> collect []
500519
501520 let find_or_create_supported_types ~__context ~pci
502521 ~is_system_display_device
0 commit comments