Jinank Jain
8914ce9da8
build: Bump mshv-ioctls from 10d0c52 to ef01a5a
...
With this bump there was a change in one of the externally exposed
variable. Thus, the use of that variable in CLH must be adjusted
accordingly.
Signed-off-by: Jinank Jain <jinankjain@microsoft.com >
2022-12-20 10:10:34 +00:00
Wei Liu
d272113d0c
hypervisor: mshv: modify two safety comments
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-11-18 12:50:01 +00:00
Wei Liu
2e2ce47271
hypervisor: do not get and set MSR_IA32_TSC for MSHV
...
Setting that MSR causes the reference TSC page to be disabled.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-11-15 10:19:57 +00:00
Bo Chen
a9ec0f33c0
misc: Fix clippy issues
...
Signed-off-by: Bo Chen <chen.bo@intel.com >
2022-11-02 09:41:43 +01:00
Wei Liu
bec47ebcc9
hypervisor: simplify LapicState
...
Both KVM and MSHV share the same layout. We can drop one level of
indirection.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-28 08:52:28 +01:00
Rob Bradford
b1a87cb698
hypervisor: mshv: Remove more #[allow(dead_code)] and unused code
...
Signed-off-by: Rob Bradford <robert.bradford@intel.com >
2022-07-25 10:09:46 +01:00
Wei Liu
aa66526ea0
hypervisor: add a function to check availability
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-22 12:50:12 +01:00
Wei Liu
c3ce5aa5b1
hypervisor: adjust new function return type
...
Make them return wrapped trait object directly.
No functional change.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-22 12:50:12 +01:00
Wei Liu
9fc3379e8d
hypervisor: add a function to return hypervisor type
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-22 12:50:12 +01:00
Wei Liu
a96a5d7816
hypervisor, vmm: use new vfio-ioctls
...
Use the new vfio-ioctls APIs. Drop Cloud Hypervisor's Device trait
since it is no longer needed.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-21 23:37:53 +01:00
Wei Liu
eca6609dbb
hypervisor: mshv: create_device returns DeviceFd directly
...
This aligns with KVM's code. No functional change.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-21 23:37:53 +01:00
Wei Liu
422bf89d4d
hypervisor: drop create_device from Vm trait
...
This then avoids the need for creating a generic DeviceFd type in the
hypervisor crate.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-21 23:37:53 +01:00
Wei Liu
b5270e0b45
hypervisor: allow downcasting to hypervisor VM types
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-21 23:37:53 +01:00
Wei Liu
f21fc1dcb6
hypervisor: x86: provide a generic MsrEntry structure
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-20 10:13:41 +01:00
Wei Liu
4d2cc3778f
hypervisor: move away from MsrEntries type
...
It is a flexible array. Switch to vector and slice instead.
No functional change intended.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-20 10:13:41 +01:00
Wei Liu
563919fc4a
hypervisor: x86: drop get_msr_list from hypervisor trait
...
It is not needed by code outside of the hypervisor crate.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-19 09:38:38 +01:00
Wei Liu
05e5106b9b
hypervisor x86: provide a generic LapicState structure
...
This requires making get/set_lapic_reg part of the type.
For the moment we cannot provide a default variant for the new type,
because picking one will be wrong for the other hypervisor, so I just
drop the test cases that requires LapicState::default().
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-19 09:38:38 +01:00
Wei Liu
d461daa7fa
hypervisor: x86: drop get/set VcpuEvents from vcpu trait
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-19 09:38:38 +01:00
Wei Liu
58dbf07453
hypervisor: x86: drop get/set Xcrs from Vcpu trait
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-19 09:38:38 +01:00
Wei Liu
c8d9a43072
hypervisor: x86: drop get/set Xsave from Vcpu trait
...
They are only needed internally within the hypervisor crate.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-19 09:38:38 +01:00
Wei Liu
6a8c0fc887
hypervisor: provide a generic FpuState structure
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-18 22:15:30 +01:00
Wei Liu
08135fa085
hypervisor: provide a generic CpudIdEntry structure
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-18 22:15:30 +01:00
Wei Liu
45fbf840db
hypervisor, vmm: move away from CpuId type
...
CpuId is an alias type for the flexible array structure type over
CpuIdEntry. The type itself and the type of the element in the array
portion are tied to the underlying hypervisor.
Switch to using CpuIdEntry slice or vector directly. The construction of
CpuId type is left to hypervisors.
This allows us to decouple CpuIdEntry from hypervisors more easily.
No functional change intended.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-18 22:15:30 +01:00
Wei Liu
edf6dda705
hypervisor: mshv: drop get_suspend_regs
...
It is not used (yet).
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-18 11:02:51 +01:00
Wei Liu
f1ab86fecb
hypervisor: x86: provide a generic SpecialRegisters structure
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-15 10:21:43 +01:00
Wei Liu
d2b194c4f1
hypervisor: x86: provide a generic DescriptorTable structure
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-15 10:21:43 +01:00
Wei Liu
75797827d5
hypervisor: x86: provide a generic SegmentRegister structure
...
And drop SegmentRegisterOps since it is no longer required.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-15 10:21:43 +01:00
Wei Liu
8b7781e267
hypervisor: x86: provide a generic StandardRegisters structure
...
We only need to do this for x86 since MSHV does not have aarch64 support
yet. This reduces unnecessary code churn.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-15 10:21:43 +01:00
Wei Liu
d20f647b32
hypervisor: provide a generic IrqRoutingEntry structure
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-15 10:21:43 +01:00
Wei Liu
4201bf4011
hypervisor: provide a generic ClockData structure
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-14 22:09:04 +01:00
Wei Liu
beb4f86b82
hypervisor, vmm: drop VmState and code
...
VmState was introduced to hold hypervisor specific VM state. KVM does
not need it and MSHV does not really use it yet.
Just drop the code. It can be easily revived once there is a need.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-14 22:09:04 +01:00
Wei Liu
72d552e5e1
hypervisor: provide a generic CpuState structure
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-14 22:09:04 +01:00
Wei Liu
f9f0a60dcf
hypervisor: provide a generic IoEventAddress structure
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-14 22:09:04 +01:00
Wei Liu
9810ed4496
hypervisor: provide a generic MpState structure
...
It is however only used for KVM right now because MSHV does not need it
yet.
Nonetheless a stub MSHV constructor should be there and get/set
functions should be implemented for MSHV.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-14 22:09:04 +01:00
Wei Liu
02866fccb0
hypervisor: drop unused IrqRouting struct from MSHV
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-14 22:09:04 +01:00
Wei Liu
4a1eab11b4
hypervisor: do not export VcpuExit
...
It is not used anywhere outside of the hypervisor crate.
Signed-off-by: Dev Rajput <t-devrajput@microsoft.com >
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-14 16:37:47 +01:00
Wei Liu
47b5581c50
hypervisor: drop a level of indirection for MSHV's DeviceFd
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-14 08:09:50 +01:00
Wei Liu
ddad5f3510
hypervisor: allow downcasting to KVM / MSHV device fd
...
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-14 08:09:50 +01:00
Wei Liu
e1cf889dbd
hypervisor: use UserMemoryRegion in the Vm trait
...
Signed-off-by: Dev Rajput <t-devrajput@microsoft.com >
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-14 07:55:48 +01:00
Wei Liu
5894b5370c
hypervisor: transform between UserMemoryRegion and hypervisor structs
...
Signed-off-by: Dev Rajput <t-devrajput@microsoft.com >
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-14 07:55:48 +01:00
Wei Liu
84bbaf06d1
hypervisor: turn boot_msr_entries into a trait method
...
This allows dispatching to either KVM or MSHV automatically.
No functional change.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-07-08 16:49:58 +01:00
Jinank Jain
ada85f68f6
hypervisor: mshv: Override hypervisor R/W behavior for unknown MSR
...
By default Microsoft Hypervisor send a GP to the guest if it tries
read/write an unimplemented MSR from the hypervisor prospective. Instead
change this behavior to ignore read/write operations for unimplemented
MSRs
Signed-off-by: Jinank Jain <jinankjain@microsoft.com >
2022-06-09 20:53:58 +01:00
Maksym Pavlenko
3a0429c998
cargo: Clean up serde dependencies
...
There is no need to include serde_derive separately,
as it can be specified as serde feature instead.
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com >
2022-05-18 08:21:19 +02:00
Rob Bradford
4ff0686d37
hypervisor: mshv: Move CpuIdEntry alias into x86_64 module
...
This is consistent with kvm and correctly reflects the architectural
dependency.
Signed-off-by: Rob Bradford <robert.bradford@intel.com >
2022-05-13 15:39:22 +02:00
Rob Bradford
3ffc105f83
hypervisor, vm-device: Relocate InterruptSourceConfig
...
Move this enum from vm-device to hypervisor crate so that hypervisor
crate does not gain an extra dependency.
Signed-off-by: Rob Bradford <robert.bradford@intel.com >
2022-05-11 11:19:14 +01:00
Rob Bradford
3f9e8d676a
hypervisor: Move creation of irq routing struct to hypervisor crate
...
This removes the requirement to leak as many datastructures from the
hypervisor crate into the vmm crate.
Signed-off-by: Rob Bradford <robert.bradford@intel.com >
2022-05-11 11:19:14 +01:00
Rob Bradford
387d56879b
vmm, hypervisor: Clean up nomenclature around offloading VM operations
...
The trait and functionality is about operations on the VM rather than
the VMM so should be named appropriately. This clashed with with
existing struct for the concrete implementation that was renamed
appropriately.
Signed-off-by: Rob Bradford <robert.bradford@intel.com >
2022-05-10 13:10:01 +01:00
Wei Liu
0c4b28488c
hypervisor: mshv: fix a comment
...
It should have said MSHV in the comment.
Signed-off-by: Wei Liu <liuwe@microsoft.com >
2022-03-20 11:37:13 +00:00
Akira Moroo
7c6bdf8804
hypervisor: Remove mshv specific type from translate_gva
...
`translate_gva` returns mshv-specific type `hv_translate_gva_result`.
This return type is not a problem since this function is implemented
only for mshv, but we need to remove the type as the same function will
be implemented for KVM in PR #3575 . This commit replaces the
mshv-specific type with `u32`.
Signed-off-by: Akira Moroo <retrage01@gmail.com >
2022-02-23 11:16:09 +00:00
Rob Bradford
0a97b76c52
hypervisor: mshv: Fix beta clippy issue
...
error: this boolean expression can be simplified
--> hypervisor/src/mshv/mod.rs:348:25
|
348 | !(unsafe { access_info.__bindgen_anon_1.string_op() } == 1),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unsafe { access_info.__bindgen_anon_1.string_op() } != 1`
|
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
error: this boolean expression can be simplified
--> hypervisor/src/mshv/mod.rs:352:25
|
352 | !(unsafe { access_info.__bindgen_anon_1.rep_prefix() } == 1),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unsafe { access_info.__bindgen_anon_1.rep_prefix() } != 1`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
Signed-off-by: Rob Bradford <robert.bradford@intel.com >
2022-01-14 14:33:18 +00:00