summary refs log tree commit diff
path: root/x86_64/src/cpuid.rs
Commit message (Collapse)AuthorAge
* x86_64: add tsc_deadline_timer supportZhuocheng Ding2019-12-13
| | | | | | | | | | | | | | | Support TSC deadline mode of LAPIC timer, this can potentially increase the precision of guest timer. BUG=None TEST=launch linux guest and run `lscpu`, tsc_deadline_timer is present in the output. Change-Id: I7adc87827a51ba8d1866ebee201759f2769ba664 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1951429 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Zhuocheng Ding <zhuocheng.ding@intel.corp-partner.google.com>
* Setup vcpu's MTRRXiong Zhang2019-11-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | When vfio pass-through is enabled, guest will be very slow. The root casue is gfn is uncachable in EPT. From the comments in kernel vmx_get_mt_mask(vcpu, gfn, is_mmio) function, EPT memory type with VT-d, VT-d without snooping control feature: can't guarantee the result, try to trust guest through kvm_mtrr_get_guest_memory_type(vcpu, gfn). But crosvm doesn't set mtrr, so host kernel will set uncachable for all gfn in ept. This patch set the default cache type as WB, and set mmio cache type as UC, so the guest ram is WB. BUG=chromium:992270 TEST=crosvm --vfio /sys/devices/pci0000:00/0000:00:02.0, pass through host igd into linux guest, the guest runs smoothly and guest desktop could be shown on physical local display. Change-Id: I151aae7835910cfbc9e38464ee901e5da281de1e Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1813458 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* clippy: Iterate without calling .iter()David Tolnay2019-04-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | See: https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop https://rust-lang.github.io/rust-clippy/master/index.html#explicit_into_iter_loop Before: for element in slice.iter() {...} After: for element in slice {...} TEST=grep -r '\.iter() {' TEST=grep -r '\.iter_mut() {' TEST=grep -r '\.into_iter() {' TEST=cargo check --all-features TEST=local kokoro Change-Id: I27f0df7cfa1064b2c8b162cba263513926a433a9 Reviewed-on: https://chromium-review.googlesource.com/1568525 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* edition: Eliminate blocks superseded by NLLDavid Tolnay2019-04-17
| | | | | | | | | | | | | | | | | | | | Before the new borrow checker in the 2018 edition, we sometimes used to have to manually insert curly braced blocks to limit the scope of borrows. These are no longer needed. Details in: https://doc.rust-lang.org/edition-guide/rust-2018/ownership-and-lifetimes/non-lexical-lifetimes.html TEST=cargo check --all-features TEST=local kokoro Change-Id: I59f9f98dcc03c8790c53e080a527ad9b68c8d6f3 Reviewed-on: https://chromium-review.googlesource.com/1568075 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* error: Consistently use Display instead of error description()David Tolnay2019-03-02
| | | | | | | | | | | | | | | | The description method is deprecated and its signature forces less helpful error messages than what Display can provide. BUG=none TEST=cargo check --all-features TEST=cargo check --target aarch64-unknown-linux-gnu Change-Id: I27fc99d59d0ef457c5273dc53e4c563ef439c2c0 Reviewed-on: https://chromium-review.googlesource.com/1497735 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* lint: Resolve the easier clippy lintsDavid Tolnay2018-12-03
| | | | | | | | | | | | | | | | | | | | Hopefully the changes are self-explanatory and uncontroversial. This eliminates much of the noise from `cargo clippy` and, for my purposes, gives me a reasonable way to use it as a tool when writing and reviewing code. Here is the Clippy invocation I was using: cargo +nightly clippy -- -W clippy::correctness -A renamed_and_removed_lints -Aclippy::{blacklisted_name,borrowed_box,cast_lossless,cast_ptr_alignment,enum_variant_names,identity_op,if_same_then_else,mut_from_ref,needless_pass_by_value,new_without_default,new_without_default_derive,or_fun_call,ptr_arg,should_implement_trait,single_match,too_many_arguments,trivially_copy_pass_by_ref,unreadable_literal,unsafe_vector_initialization,useless_transmute} TEST=cargo check --features wl-dmabuf,gpu,usb-emulation TEST=boot linux Change-Id: I55eb1b4a72beb2f762480e3333a921909314a0a2 Reviewed-on: https://chromium-review.googlesource.com/1356911 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* cargo fmt all source codeZach Reizner2018-10-09
| | | | | | | | | | | | | | Now that cargo fmt has landed, run it over everything at once to bring rust source to the standard formatting. TEST=cargo test BUG=None Change-Id: Ic95a48725e5a40dcbd33ba6d5aef2bd01e91865b Reviewed-on: https://chromium-review.googlesource.com/1259287 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* x86_64: fill cache info in cpuid, stop spoofing CPU vendor idSlava Malyugin2018-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | The fix passes through cache-related CPU entries 2, 4, 0x80000005 and 0x80000006 similar to how QEMU does it. Note passing this cpuid info itself is not sufficient unless CPU vendor is something Linux kernel recognizes. Therefore, I am removing cute spoofing of the vendor id, allowing host value to pass through. I believe it is generally a bad idea to spoof vendor id as lots of kernel and user space code gets confused and may take unoptimized paths. The corollary is that removing the spoofing may have unintended consequences correctness- and performance-wise. I would appreciate recommendation on additional testing. BUG=chromium:859678 TEST=lscpu in Guest, 'cargo test' Change-Id: I6963b00d9eecf49fb4578bcc75ad744c3099f045 Reviewed-on: https://chromium-review.googlesource.com/1125529 Commit-Ready: Slava Malyugin <slavamn@chromium.org> Tested-by: Slava Malyugin <slavamn@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* x86_64: use project name in cpuid vendorMike Frysinger2018-03-22
| | | | | | | | | | | | | The official name is "crosvm", not "CrOSVM". BUG=None TEST=None Change-Id: I21f200d8224c9a8fee53011a63ff4ad165128904 Reviewed-on: https://chromium-review.googlesource.com/976941 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org>
* x86_64: improve documentation for cpuid vendorMike Frysinger2018-03-21
| | | | | | | | | | | | BUG=None TEST=None Change-Id: Id274c361d10be00d5d7279765a2e90ad5ecb4112 Reviewed-on: https://chromium-review.googlesource.com/974314 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* x86_64: implement error trait for sub-modules in x86_64 crateSonny Rao2018-02-27
| | | | | | | | | | | | | | | | | Implement the std::error::Error Trait for Error types within the x86_64 crate. We will make use of these implementations later on when we are using the architecture Trait to pass architecture-specific errors up with meaningful descriptions. BUG=chromium:797868 TEST=./build_test passes on all architectures TEST=crosvm runs on caroline Change-Id: I7a30db69437990608e3a0f5e6e3a200ef6c2d0c3 Reviewed-on: https://chromium-review.googlesource.com/932976 Commit-Ready: Sonny Rao <sonnyrao@chromium.org> Tested-by: Sonny Rao <sonnyrao@chromium.org> Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
* kvm: do not pass max number of cpuid entries in get_supported_cpuid()Dmitry Torokhov2018-02-27
| | | | | | | | | | | | | | It does not make sense to have users of the API limit number of cpuid entries retrieved. Just have KVM select reasonable upper limit and return the true number. TEST=cargo test --features plugin; cargo test -p kvm BUG=chromium:800626 Change-Id: I8ab7e8d901bc408d17c23bfe798d89f921488673 Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/933242 Reviewed-by: Zach Reizner <zachr@chromium.org>
* x86_64: Remove extra closure args and double-derefsDylan Reid2017-05-29
| | | | | | | | | | | | | A few places were passing a reference to a reference, which just gets compiled out anyways. Some other places where passing `|e| ErrorName(e)` as a closure when just `ErrorName` would be more succinct. Change-Id: Ic097a81b956ef82b29fc1a15196c245bee61c251 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/510782 Reviewed-by: Zach Reizner <zachr@chromium.org>
* x86_64: Add x86_64 setup codeDylan Reid2017-05-12
Change-Id: Ibdf83f8efcc92bf1f45ed9a5f95117fd9ae3ad5a Reviewed-on: https://chromium-review.googlesource.com/483868 Commit-Ready: Dylan Reid <dgreid@chromium.org> Tested-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>