Commit graph

14 commits

Author SHA1 Message Date
Chirantan Ekbote
5c4ad02dd4 crosvm_plugin: Remove underscores in variable name
Remove the double underscore in front of `__has_extension` in crosvm.h.
Double underscores in identifiers are reserved for the compiler's
internal use and as it so happens, `__has_extension` is a macro that
clang defines for code to determine whether the compiler supports a
given feature.

We shouldn't be using double underscores in any of the variable names in
this header file but for now just fix the problematic one so that the
code can actually compile under clang.

BUG=b:80150167
TEST=Compile one of the test plugins with clang

Change-Id: Ibb59e72c968a7f245bd6cc693da99f9263eedf33
Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1341100
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2018-11-20 18:27:40 -08:00
Dmitry Torokhov
caa2e5a4ac plugin: do not fail crosvm_vcpu_get_msrs() if we failed to fetch some
KVM_GET_MSRS may return less MSRs that were requested; do not fail but
instead let callers to know how many were fetched.

BUG=None
TEST=cargo test --features plugin

Change-Id: Ie14a3d38b66bfe34f5279543bea9c6c78423527e
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1192232
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2018-08-31 05:22:52 -07:00
Dmitry Torokhov
658357638c plugin: allow retrieving list of supported MSRs
Add crossvm plugin API to allow fetching list of supported MSRs.

BUG=b:111083877
TEST=cargo test -p kvm; cargo test --features=plugin

Change-Id: I178c7bc33d606bef10422faac6bb9afb3fe0a014
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1152229
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-07-31 16:37:06 -07:00
Slava Malyugin
d1e391b8d4 plugin: allow retrieving and setting VCPU events
Add crosvm plugin API to allow fetching and setting VCPU events.

BUG=b:110056268
TEST=cargo test --features plugin -p kvm

Change-Id: Id66230f180f4bdb95bd1850ed050e439083701cc
Reviewed-on: https://chromium-review.googlesource.com/1128045
Commit-Ready: Slava Malyugin <slavamn@chromium.org>
Tested-by: Slava Malyugin <slavamn@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-07-11 18:48:50 -07:00
Dmitry Torokhov
bb65801679 plugin: allow retrieving and setting XCR VCPU states
Add crossvm plugin API to allow fetching and setting XCRs for VCPU.

BUG=b:79692549
TEST=cargo test -p kvm

Change-Id: I2a988279c08051a8d8865efc1e60f9692fa26272
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1062646
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-05-18 20:08:21 -07:00
Dmitry Torokhov
3e40b51a62 plugin: allow retrieving and setting VM and VCPU states
This change allows plugin to retrieve and set various VM and VCPU states:
interrupt controller, PIT, LAPIC and MP state.

BUG=b:76083711
TEST=cargo test -p kvm

Change-Id: Ie32a67b0cd4a1f0a19ccd826a6e1c9dc25670f95
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/986511
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-03-30 00:07:07 -07:00
Stephen Barber
a10b2d20a8 plugin: add crosvm_net_get_config
BUG=none
TEST=sudo cargo test --features plugin

Change-Id: Ib38fad250295d73529dff0451345b4274a261073
Reviewed-on: https://chromium-review.googlesource.com/911943
Commit-Ready: Stephen Barber <smbarber@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-03-08 00:37:50 -08:00
Dmitry Torokhov
9786573e07 allow plugin to query KVM for supported/emulated CPUIDs
This plumbs calls to KVM_GET_SUPPORTED_CPUID and KVM_GET_EMULATED_CPUID
to be available to plugins.

TEST=cargo test --features plugin; cargo test -p kvm
BUG=chromium:800626

Change-Id: I98879599b5f970c6c2720772658689a505d8abe1
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/938674
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-02-28 21:30:20 -08:00
Zach Reizner
dadb7625ea allow plugin to query for KVM extensions
The guest may need to check for KVM extensions before blindly using
them.

TEST=cargo test --features plugin; cargo test -p kvm; ./build_test
BUG=chromium:800626

Change-Id: If87b928753cd71adeabac4fc7732c3fce7265834
Reviewed-on: https://chromium-review.googlesource.com/906008
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2018-02-12 22:42:40 -08:00
Zach Reizner
7ca9f771e7 add plugin support for configuring CPUID
The guest expects to be able to read the CPUID, so the plugin process
needs to specify what the CPUID for each VCPU will have.

TEST=cargo test --features plugin; ./build_test
BUG=chromium:800626

Change-Id: I9258540ab2501126c3d8cadbd09b7fc01d19f7a9
Reviewed-on: https://chromium-review.googlesource.com/906006
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2018-02-12 22:42:38 -08:00
Zach Reizner
ce8961d1fc allow non-dirty log memory regions from the plugin process
Dirty logging is not necessary for every memory region, so the plugin
process should be able to specific exactly which regions it would like
dirty logging enabled for.

TEST=cargo test --features plugin
BUG=chromium:800626

Change-Id: I28b8285357e7de1c8c3a1392bdfdb4853ec5a654
Reviewed-on: https://chromium-review.googlesource.com/900294
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2018-02-12 22:42:37 -08:00
Zach Reizner
7a4d7b1f50 add plugin support for model specific registers
The MSRs are useful for booting a full operating system that requires
them.

TEST=cargo test --features plugin; cargo test -p kvm; ./build_test
BUG=chromium:800626

Change-Id: I817fbf3e6868c85b373808bd48e568b5b2b458eb
Reviewed-on: https://chromium-review.googlesource.com/897412
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-02-12 22:42:36 -08:00
Zach Reizner
53528e33ed add support for accessing debug registers in the plugin process
The debug registers are useful to access for the plugin process in some
cases.

TEST=cargo test --features plugin; cargo test -p kvm; ./build_test
BUG=chromium:800626

Change-Id: I8f3f6c31c6989061a43cef948cf5b4e64bd52d30
Reviewed-on: https://chromium-review.googlesource.com/896945
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-02-12 22:42:35 -08:00
Zach Reizner
7cc4ac3a17 add crosvm plugin C header file
This header file defines the C API used to interface with crosvm as a
plugin process.

TEST=None
BUG=chromium:800626

Change-Id: Ie06b833e25dab8f31f64d8bc8b4b521b61d1ca04
Reviewed-on: https://chromium-review.googlesource.com/764267
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2018-01-26 01:19:56 -08:00