Skip to content

Commit 35f1dbd

Browse files
authored
Merge d9f43a3 into 1a68634
2 parents 1a68634 + d9f43a3 commit 35f1dbd

21 files changed

+107
-11
lines changed

ocaml/idl/datamodel_common.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ open Datamodel_roles
1010
to leave a gap for potential hotfixes needing to increment the schema version.*)
1111
let schema_major_vsn = 5
1212

13-
let schema_minor_vsn = 789
13+
let schema_minor_vsn = 790
1414

1515
(* Historical schema versions just in case this is useful later *)
1616
let rio_schema_major_vsn = 5

ocaml/idl/datamodel_vm.ml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,6 +2137,20 @@ let set_has_vendor_device =
21372137
]
21382138
~allowed_roles:_R_VM_ADMIN ~doc_tags:[Windows] ()
21392139

2140+
let set_xen_platform_pci_bar_uc =
2141+
call ~name:"set_xen_platform_pci_bar_uc" ~lifecycle:[]
2142+
~doc:
2143+
"Controls whether, when the VM starts in HVM mode, the Xen PCI MMIO used \
2144+
by grant tables is mapped as Uncached (UC, the default) or WriteBack \
2145+
(WB, the workaround). WB mapping could improve performance of devices \
2146+
using grant tables. This is useful on AMD platform only."
2147+
~params:
2148+
[
2149+
(Ref _vm, "self", "The VM on which to set this flag")
2150+
; (Bool, "value", "False to enable WB MMIO bar.")
2151+
]
2152+
~allowed_roles:_R_VM_ADMIN ()
2153+
21402154
let import =
21412155
call ~name:"import"
21422156
~lifecycle:[(Published, rel_dundee, "Import an XVA from a URI")]
@@ -2560,6 +2574,7 @@ let t =
25602574
; call_plugin
25612575
; call_host_plugin
25622576
; set_has_vendor_device
2577+
; set_xen_platform_pci_bar_uc
25632578
; import
25642579
; set_actions_after_crash
25652580
; set_domain_type
@@ -3097,6 +3112,19 @@ let t =
30973112
"When an HVM guest starts, this controls the presence of the \
30983113
emulated C000 PCI device which triggers Windows Update to fetch \
30993114
or update PV drivers."
3115+
; field ~qualifier:StaticRO
3116+
~lifecycle:
3117+
[
3118+
( Published
3119+
, rel_ely
3120+
, "Controls whether, when the VM starts in HVM mode, the MMIO \
3121+
is mapped as UC or WB."
3122+
)
3123+
]
3124+
~default_value:(Some (VBool true)) ~ty:Bool
3125+
"xen_platform_pci_bar_uc"
3126+
"Controls whether, when the VM starts in HVM mode, the MMIO is \
3127+
mapped as UC or WB."
31003128
; field ~qualifier:DynamicRO ~ty:Bool
31013129
~lifecycle:[(Published, rel_ely, "")]
31023130
~default_value:(Some (VBool false)) "requires_reboot"

ocaml/idl/schematest.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ let hash x = Digest.string x |> Digest.to_hex
33
(* BEWARE: if this changes, check that schema has been bumped accordingly in
44
ocaml/idl/datamodel_common.ml, usually schema_minor_vsn *)
55

6-
let last_known_schema_hash = "4cd835e2557dd7b5cbda6c681730c447"
6+
let last_known_schema_hash = "d6e73da8c4cd30220ac9e359d2631a60"
77

88
let current_schema_hash : string =
99
let open Datamodel_types in

ocaml/tests/common/test_common.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ let make_vm ~__context ?(name_label = "name_label")
148148
?(hardware_platform_version = 0L) ?has_vendor_device:_
149149
?(has_vendor_device = false) ?(reference_label = "") ?(domain_type = `hvm)
150150
?(nVRAM = []) ?(last_booted_record = "") ?(last_boot_CPU_flags = [])
151-
?(power_state = `Halted) () =
151+
?(power_state = `Halted) ?(xen_platform_pci_bar_uc = true) () =
152152
Xapi_vm.create ~__context ~name_label ~name_description ~user_version
153153
~is_a_template ~affinity ~memory_target ~memory_static_max
154154
~memory_dynamic_max ~memory_dynamic_min ~memory_static_min ~vCPUs_params
@@ -162,7 +162,7 @@ let make_vm ~__context ?(name_label = "name_label")
162162
~shutdown_delay ~order ~suspend_SR ~suspend_VDI ~snapshot_schedule
163163
~is_vmss_snapshot ~version ~generation_id ~hardware_platform_version
164164
~has_vendor_device ~reference_label ~domain_type ~last_booted_record
165-
~last_boot_CPU_flags ~power_state
165+
~last_boot_CPU_flags ~power_state ~xen_platform_pci_bar_uc
166166

167167
let make_host ~__context ?(uuid = make_uuid ()) ?(name_label = "host")
168168
?(name_description = "description") ?(hostname = "localhost")

ocaml/xapi-cli-server/cli_operations.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2859,7 +2859,8 @@ let vm_create printer rpc session_id params =
28592859
~snapshot_schedule:Ref.null ~is_vmss_snapshot:false ~appliance:Ref.null
28602860
~start_delay:0L ~shutdown_delay:0L ~order:0L ~suspend_SR:Ref.null
28612861
~suspend_VDI:Ref.null ~version:0L ~generation_id:""
2862-
~hardware_platform_version:0L ~has_vendor_device:false ~reference_label:""
2862+
~hardware_platform_version:0L ~has_vendor_device:false
2863+
~xen_platform_pci_bar_uc:true ~reference_label:""
28632864
~domain_type:`unspecified ~nVRAM:[] ~last_booted_record:""
28642865
~last_boot_CPU_flags:[] ~power_state:`Halted
28652866
in

ocaml/xapi-cli-server/records.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2659,6 +2659,13 @@ let vm_record rpc session_id vm =
26592659
~value:(safe_bool_of_string "has-vendor-device" x)
26602660
)
26612661
()
2662+
; make_field ~name:"xen-platform-pci-bar-uc"
2663+
~get:(fun () -> string_of_bool (x ()).API.vM_xen_platform_pci_bar_uc)
2664+
~set:(fun x ->
2665+
Client.VM.set_xen_platform_pci_bar_uc ~rpc ~session_id ~self:vm
2666+
~value:(safe_bool_of_string "xen-platform-pci-bar-uc" x)
2667+
)
2668+
()
26622669
; make_field ~name:"requires-reboot"
26632670
~get:(fun () -> string_of_bool (x ()).API.vM_requires_reboot)
26642671
()

ocaml/xapi-idl/xen/xenops_types.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ module Vm = struct
171171
; pci_msitranslate: bool
172172
; pci_power_mgmt: bool
173173
; has_vendor_device: bool [@default false]
174+
; xen_platform_pci_bar_uc: bool [@default true]
174175
; generation_id: string option
175176
}
176177
[@@deriving rpcty, sexp]

ocaml/xapi/create_misc.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ and create_domain_zero_record ~__context ~domain_zero_ref (host_info : host_info
290290
~snapshot_schedule:Ref.null ~is_vmss_snapshot:false ~appliance:Ref.null
291291
~start_delay:0L ~shutdown_delay:0L ~order:0L ~suspend_SR:Ref.null
292292
~version:0L ~generation_id:"" ~hardware_platform_version:0L
293-
~has_vendor_device:false ~requires_reboot:false ~reference_label:""
293+
~has_vendor_device:false ~xen_platform_pci_bar_uc:true
294+
~requires_reboot:false ~reference_label:""
294295
~domain_type:Xapi_globs.domain_zero_domain_type ~nVRAM:[]
295296
~pending_guidances:[] ~recommended_guidances:[]
296297
~pending_guidances_recommended:[] ~pending_guidances_full:[] ;

ocaml/xapi/import.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,12 @@ module VM : HandlerTools = struct
622622
else
623623
{vm_record with API.vM_has_vendor_device= false}
624624
in
625+
let vm_record =
626+
if vm_has_field ~x ~name:"xen_platform_pci_bar_uc" then
627+
vm_record
628+
else
629+
{vm_record with API.vM_xen_platform_pci_bar_uc= true}
630+
in
625631
let vm_record =
626632
{
627633
vm_record with

ocaml/xapi/message_forwarding.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,6 +2054,11 @@ functor
20542054
(vm_uuid ~__context self) value ;
20552055
Local.VM.set_has_vendor_device ~__context ~self ~value
20562056

2057+
let set_xen_platform_pci_bar_uc ~__context ~self ~value =
2058+
info "VM.set_xen_platform_pci_bar_uc: VM = '%s' to %b"
2059+
(vm_uuid ~__context self) value ;
2060+
Local.VM.set_xen_platform_pci_bar_uc ~__context ~self ~value
2061+
20572062
let set_xenstore_data ~__context ~self ~value =
20582063
info "VM.set_xenstore_data: VM = '%s'" (vm_uuid ~__context self) ;
20592064
Db.VM.set_xenstore_data ~__context ~self ~value ;

0 commit comments

Comments
 (0)