Commit graph

756 commits

Author SHA1 Message Date
Dylan Reid
cb5573ba19 sys_util: net: Make clippy clean
Use from instead of as.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Change-Id: I02342bd352cd98417011ceb5a79ba5bde5551a07
Reviewed-on: https://chromium-review.googlesource.com/1510071
Tested-by: kokoro <noreply+kokoro@google.com>
2019-03-26 21:45:35 -07:00
Gurchetan Singh
5aaa63f508 devices: gpu: use render optimized buffers
Using non-linear buffer seems to be safe based on the apps I've
tested. This is similiar to the ARC++ use case, which also doesn't
explicitly send modifiers to Chrome.

BUG=chromium:945033
TEST=clear_clear goes from 980 mpixels --> 6797.90 mpixels
     on Nami

Change-Id: I2dcb78366c2d2d83d64bb23f6da1f07c8747819c
Reviewed-on: https://chromium-review.googlesource.com/1538463
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Riley <davidriley@chromium.org>
Reviewed-by: Chia-I Wu <olv@google.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2019-03-26 17:27:02 -07:00
Dylan Reid
348df2dbf7 sys_util: shm: Make clippy clean
clippy wants a default impl for `MemfdSeals`

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Change-Id: I3202037f7b82d7d4e63154a349c505fd7707bb9a
Reviewed-on: https://chromium-review.googlesource.com/1510070
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2019-03-26 17:26:58 -07:00
Dylan Reid
31c79375da sys_util: write_zeros: Make clippy clean
favor `if let` over `match` for destructing a single value.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Change-Id: I0c09d7ffc380e84d7413d6fed338d65a60563a8f
Reviewed-on: https://chromium-review.googlesource.com/1510069
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2019-03-26 17:26:57 -07:00
Dylan Reid
6a6a36022b sys_util: poll: Make clippy clean
u64 casts switched to from, add a Default impl.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Change-Id: I17757a081d41df465c74c7a6b410159b4023c70e
Reviewed-on: https://chromium-review.googlesource.com/1510068
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2019-03-25 21:51:16 -07:00
Dylan Reid
979c696ba6 fuzz: Add block device fuzzer
Add the block device fuzzer that interprets the fuzz data input as
follows:
starting index 8 bytes
command location 8 bytes
command 16 bytes
descriptors circular buffer 16 bytes * 3

Change-Id: I25b58e149bfb9a479fab7955c0ca25c67c590bf6
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/900202
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2019-03-25 21:51:15 -07:00
Dylan Reid
39028af02f fuzz: Add qcow fuzzing
Fuzz using the data as a qcow image with an offset and value to write to
the image.

Change-Id: Iff8f2971ba716c93d978e33338ad62b5d487c115
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/871132
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2019-03-25 21:51:14 -07:00
Daniel Verkamp
fcd4e847f3 crosvm: avoid deprecated trim_left_matches
As of Rust 1.33.0, use of trim_left_matches warns that it is
deprecated and should be replaced with trim_start_matches.

BUG=None
TEST=build_test

Change-Id: I42bd5dba10aeffcd076882d28cb02551c50ff614
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1534963
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-25 17:43:56 -07:00
Zach Reizner
99d4a18b5d require protobuf version match that of top-level Cargo.toml
When compiling unit tests in the pre-cq, the Cargo.lock file is deleted.
Testing a sub-crate without a lock file will cause the protobuf
dependency to resolve to the latest version of protobuf, which varies
based on whatever other cros-rust.eclass based ebuilds have been run
beforehand. This change fixes that source of flake.

BUG=None
TEST=pre-cq

Change-Id: Ief951391c08b0f0cc9ff035437824d89860455e2
Reviewed-on: https://chromium-review.googlesource.com/1534962
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2019-03-25 17:43:51 -07:00
Dylan Reid
3a42190cc4 fuzz: update to use new cros fuzzing
There is now infrastructure for running fuzzers in cros, use it.

Change-Id: I53ec9e195b7062fdcc38b5186c1f3194031037f3
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1521667
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2019-03-25 17:43:51 -07:00
Daniel Prilik
db4721d870 crosvm: add memfd for GuestMemory
Building off CL:1290293

Instead of having a seperate GuestMemoryManager, this adds SharedMemory
as a Arc'd member of GuestMemory. This is nice since it removes the need
to plumb the Manager struct throughout the codebase.

BUG=chromium:936567
TEST=cargo test -p sys_util

Change-Id: I6fa5d73f7e0db495c2803a040479818445660345
Reviewed-on: https://chromium-review.googlesource.com/1493013
Commit-Ready: Daniel Prilik <prilik@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-25 17:43:50 -07:00
David Riley
33e8ef061d devices: gpu: allow sysinfo syscall
BUG=chromium:940826
TEST=run unigine valley benchmark 1920x1080

Change-Id: If7b5d97a4284de88e52b3fd3e8f162dd484934e1
Reviewed-on: https://chromium-review.googlesource.com/1517102
Commit-Ready: David Riley <davidriley@chromium.org>
Tested-by: David Riley <davidriley@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-21 08:07:41 -07:00
Dylan Reid
190406937d sys_util: errno: Make clippy clean
Fix one warning about unnecessary ref.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Change-Id: I4a01d9762866d8eb7ed661e6c06fe3722d008ec4
Reviewed-on: https://chromium-review.googlesource.com/1510067
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2019-03-21 08:07:32 -07:00
Chris Morin
7abdbfe201 sys_util: don't use hostname in syslog message header
The putting the hostname in the syslog header of messages sent to
/dev/log isn't widely supported. It isn't understood by rsyslogd by
default, and it isn't understood by journald. Remove it as it provides
no value to us.

BUG=None
TEST=Ensure journal properly parses the header from crosvm log messages

Change-Id: I9bba78925f048f7d2ce6320b00b9fa52f070ce51
Reviewed-on: https://chromium-review.googlesource.com/1525139
Commit-Ready: Christopher Morin <cmtm@google.com>
Tested-by: Christopher Morin <cmtm@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-20 23:55:09 -07:00
Daniel Verkamp
f1a01f6e63 arch: handle register_device_capabilities errors
Check for failures of the PciDevice register_device_capabilities
function.  This fixes a build warning about ignoring a Result.

BUG=None
TEST=Boot Crostini on nami; cargo build without warnings

Change-Id: I48458a3a19a99a471d4c91c9761d35dc8dd2ef20
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1526329
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Prilik <prilik@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2019-03-20 19:51:31 -07:00
Daniel Verkamp
26d15fae1e usb_util: silence unused code warning
The RawFd import is only used when sandboxed-libusb is set, so put it
behind a cfg check.

BUG=None
TEST=cargo build passes without warnings

Change-Id: Iaae6131dabff2205f86dac2bf3a4e7ad08e66eac
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1531093
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jingkui Wang <jkwang@google.com>
2019-03-20 19:51:18 -07:00
Dylan Reid
a83356452c sys_util: timerfd: fix clippy lints
Use X::from() instead of as X.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Change-Id: Iefd412a4846d7f9bede57b68807e09cb43a5c579
Reviewed-on: https://chromium-review.googlesource.com/1510066
Tested-by: kokoro <noreply+kokoro@google.com>
2019-03-20 08:52:59 -07:00
Miriam Zimmerman
63e3a83a37 Move split_irqchip_common to devices/.
Previously, code in devices/ couldn't use split_irqchip_common, since
x86_64/ already has a dependency on devices/.

TEST=Built.
BUG=chromium:908689

Change-Id: I481514ae6bbd68e47feecc6f364ca8f4fd798e67
Reviewed-on: https://chromium-review.googlesource.com/1526762
Commit-Ready: Miriam Zimmerman <mutexlox@chromium.org>
Tested-by: Miriam Zimmerman <mutexlox@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Tolnay <dtolnay@chromium.org>
2019-03-20 08:52:41 -07:00
Zach Reizner
7e622edd00 usb: remove unused/abused fd argument from EventHandler::on_event
None of instances of EventHandler::on_event actually used the fd. The
PollfdChangeHandler::remove_poll_fd callback fabricated a potentially
valid fd (0), which went undetected because nobody used it.
Additionally, using RawFds almost always requires unsafe and should be
avoided.

CQ-DEPEND=CL:1522214
BUG=chromium:831850
TEST=cargo test

Change-Id: I095edbcad317e4832b1fb29fd08d602fbde4fd5d
Reviewed-on: https://chromium-review.googlesource.com/1525135
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: Jingkui Wang <jkwang@google.com>
Reviewed-by: Jingkui Wang <jkwang@google.com>
2019-03-18 07:05:10 -07:00
Zach Reizner
a6b9ca3388 usb: remove unused usb-emulation feature flag
This cleans up some feature flag plumping for libusb sandboxing as well.

BUG=chromium:831850
TEST=cargo test
CQ-DEPEND=CL:1512762

Change-Id: Ic70784db204ddced94498944b021bcb7dd708bb1
Reviewed-on: https://chromium-review.googlesource.com/1522214
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Jingkui Wang <jkwang@google.com>
Reviewed-by: Jingkui Wang <jkwang@google.com>
2019-03-17 21:33:08 -07:00
Jingkui Wang
100e6e48ad implement xhci and add it to pci bus
Implement xhci controller, setup seccomp filters and add xhci to pci
bus.

CQ-DEPEND=CL:1512761
BUG=chromium:831850
TEST=local build
Change-Id: I5c05452ece66e99d3a670e259e095fca616e835d
Reviewed-on: https://chromium-review.googlesource.com/1512762
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Jingkui Wang <jkwang@google.com>
Reviewed-by: Jingkui Wang <jkwang@google.com>
2019-03-17 21:33:08 -07:00
David Tolnay
c324429b46 bitfield: Support BitFieldSpecifier for enums
Previously, the getter and setter functions generated for a bitfield
struct by #[bitfield] all operated on primitive types like bool, u8, u16
etc.

This CL adds support for getters and setters defined in terms of
user-defined enums.

We make an enum bitfield-compatible by adding #[bitfield]. The number of
variants must be a power of 2.

    #[bitfield]
    enum TwoBits {
        Zero = 0b00,
        One = 0b01,
        Two = 0b10,
        Three = 0b11,
    }

And then it may be used to specify a field in a bitfield struct.

    #[bitfield]
    struct Struct {
        prefix: BitField1,
        two_bits: TwoBits,
        suffix: BitField5,
    }

The generated getters and setters for this struct would have the
following signatures:

    impl Struct {
        fn get_prefix(&self) -> u8;
        fn set_prefix(&mut self, val: u8);

        fn get_two_bits(&self) -> TwoBits;
        fn set_two_bits(&mut self, val: TwoBits);

        fn get_suffix(&self) -> u8;
        fn set_suffix(&mut self, val: u8);
    }

TEST=`cargo test` the bit_field and bit_field_derive crates
TEST=`cargo check` crosvm

Change-Id: Ibc8923e2877fda6ae8da5767731edcb68721a434
Reviewed-on: https://chromium-review.googlesource.com/1519686
Commit-Ready: David Tolnay <dtolnay@chromium.org>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Tolnay <dtolnay@chromium.org>
2019-03-17 14:38:45 -07:00
David Tolnay
fba396e42f edition: Update sync crate to 2018 edition
Separated out of CL:1513058 to make it possible to land parts
individually while the affected crate has no other significant CLs
pending. This avoids repeatedly introducing non-textual conflicts with
new code that adds `use` statements.

TEST=cargo check
TEST=cargo check --all-features
TEST=cargo check --target aarch64-unknown-linux-gnu

Change-Id: Ief399ac868710c3a2d864f98c0ad9215e8917ed6
Reviewed-on: https://chromium-review.googlesource.com/1520067
Commit-Ready: David Tolnay <dtolnay@chromium.org>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Tolnay <dtolnay@chromium.org>
2019-03-17 14:38:44 -07:00
Lepton Wu
20333e41ae Don't drop capabilities when sandbox is disabled.
BUG=b:128465119
TEST=manual - Run ARCVM

Change-Id: Ib6d43a74a98d4f29498ad62168d0efbd4c77fc83
Reviewed-on: https://chromium-review.googlesource.com/1524370
Commit-Ready: Lepton Wu <lepton@chromium.org>
Tested-by: Lepton Wu <lepton@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Lepton Wu <lepton@chromium.org>
2019-03-16 20:31:35 -07:00
Dylan Reid
fbbcf7ad14 qcow_utils: Add tests
Add basic tests that qcow_utils compiles.

Change-Id: I433dc7cb55d42997ba060f9bd989ca3b5c8b0045
Reviewed-on: https://chromium-review.googlesource.com/895189
Commit-Ready: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2019-03-16 18:05:03 -07:00
Jingkui Wang
7a2592a2cb kokoro: Update kokoro docker file to manually select features
And we are not selecting sandboxed libusb

BUG=chromium:831850
TEST=cargo test

Change-Id: Ie205a410575dfc1f40515dcb2607bf62e2ccd771
Reviewed-on: https://chromium-review.googlesource.com/1377620
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-16 15:25:29 -07:00
Jingkui Wang
257d004b0c usb: add host backend
Host backend implement backend device. It will attach a read device to
xhci controller.

Also squashed from ce6b35, author: zachr@.

CQ-DEPEND=CL:1510820
BUG=chromium:831850
TEST=local build

Change-Id: Idcf2d7d6aca92de9859b7c38d1bf1d98032eae91
Reviewed-on: https://chromium-review.googlesource.com/1512761
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-16 15:25:23 -07:00
Jingkui Wang
874f2e83ed usb: Add device slot, command ring and transfer ring
Device can be assigned to slot. Command ring handles usb commands,
transfer ring handles usb transfers.

CQ-DEPEND=CL:1510819
BUG=chromium:831850
TEST=cargo test

Change-Id: Ib0836ee518d1c7a3e902630c7ea04e29b9496c80
Reviewed-on: https://chromium-review.googlesource.com/1510820
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-16 15:25:23 -07:00
Jingkui Wang
bbd77ff220 usb: add usb hub, transfer and usb backend interface
Those are bridges between xhci and backend.

CQ-DEPEND=CL:1510818
BUG=chromium:831850
TEST=cargo test

Change-Id: I04feab449d48b0c908aeebfda08d1869239cbe6f
Reviewed-on: https://chromium-review.googlesource.com/1510819
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-16 15:25:22 -07:00
Jingkui Wang
0a5bf14261 usb: add ring buffer and ring buffer controller
for ring buffer, guest kernel is producer and crosvm is consumer

CQ-DEPEND=1510817
BUG=chromium:831850
TEST=cargo test

Change-Id: Ib62d2b42de1a77ff71ca0e2a0066feacc56dddc1
Reviewed-on: https://chromium-review.googlesource.com/1510818
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-16 15:25:22 -07:00
Miriam Zimmerman
c698769b42 Add IOAPIC device skeleton.
This CL adds some necessary constants and types, as well as a few
skeleton function declarations, for an IOAPIC device.

I'm sending this CL first in the interest of minimizing CL size and
making future CLs easier to review.

TEST=Built
BUG=chromium:908689

Change-Id: Ib8ae37e0092c31d7cb8073070f9592baed236323
Reviewed-on: https://chromium-review.googlesource.com/1520809
Commit-Ready: David Tolnay <dtolnay@chromium.org>
Tested-by: Miriam Zimmerman <mutexlox@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Tolnay <dtolnay@chromium.org>
2019-03-16 01:53:44 -07:00
David Tolnay
c249a9fb84 usb: Verify usb_debug args even when not logging
Implementing this macro by ignoring the args and expanding to nothing
makes it possible to pass invalid args like `usb_debug!("{}")`. Use `if
false` instead to ensure that the args are valid formatter args.

As part of this, fix a call to a non-existent function inside one of the
usb_debug invocations.

TEST=cargo check devices

Change-Id: Id82dad7b021060dce7b4d3b828bbd21aaa6ef410
Reviewed-on: https://chromium-review.googlesource.com/1518730
Commit-Ready: David Tolnay <dtolnay@chromium.org>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jingkui Wang <jkwang@google.com>
2019-03-16 01:53:41 -07:00
Lepton Wu
608938818b Start render node host service in crosvm
BUG=b:118408510
TEST=manual - build crosvm with/without crosvm-gpu-forward USE flag and run arcvm.

Change-Id: Ibb85d52dc679aa8524b29d86148ca28d82d8fe98
Reviewed-on: https://chromium-review.googlesource.com/1347330
Commit-Ready: Lepton Wu <lepton@chromium.org>
Tested-by: Lepton Wu <lepton@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-14 20:53:53 -07:00
Jianxun Zhang
1bc4a06801 run serial test even when parallel test fails
The serial test won't run when parallel group fails
because of the short-circuiting effect of logical
operators.

Assuming the tool was not designed to fail the whole
test prematurely, this change ensures both test groups
executed every time.

BUG=None
TEST=build_test and observe the test cases in serial
group (io_jail and sys_util) are executed when the
parallel group fails.

Change-Id: I86e57069490c58dfed48960d87ea35c2403450b7
Signed-off-by: Jianxun Zhang <jianxun.zhang@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/1488611
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-14 20:53:53 -07:00
Lepton Wu
9105e9fbe5 Remove "multiprocess" argument.
Both "multiprocess" and "disable-sandbox" control the same config
and actually they have same final effects. So just remove "multiprocess"
argument and also rename "multiprocess" to "sandbox" to make it more
clear.

BUG=None
TEST=`cros_run_unit_tests --board=eve --packages=crosvm`

Change-Id: I313d110af48b43231b1426332b63868cb0218490
Reviewed-on: https://chromium-review.googlesource.com/1524375
Commit-Ready: Lepton Wu <lepton@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-14 20:53:52 -07:00
Zach Reizner
4725a399f7 seccomp: tpm: remove fseek syscall from policy
There is no such syscall as fseek as far as I can tell. There is lseek,
which would be how fseek is implemented in libc, and it is already
included in the policy.

BUG=chromium:936633
TEST=parse_seccomp_policy seccomp/x86_64/tpm_device.policy

Change-Id: Ifb891395d7447d8b81cb1b17af18c49e5d5fc96f
Reviewed-on: https://chromium-review.googlesource.com/1518490
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2019-03-14 20:53:40 -07:00
Chirantan Ekbote
e00faed85c register_space: Only run panic test when debug assertions are on
The regs_reg_overlap() test is a panic test but the function that it is
testing only uses debug_asserts so the test will fail if debug
assertions are disabled.  Only run the test when debug assertions are
enabled.

BUG=chromium:940668
TEST=`FEATURES=test USE=-cros-debug emerge-nami crosvm`

Change-Id: Ie722cb49908ae4c4a9ecc5f248a6ec25fbcc05c9
Reviewed-on: https://chromium-review.googlesource.com/1518729
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2019-03-13 21:05:14 -07:00
David Tolnay
2727413c10 edition: Update assertions crate to 2018 edition
Separated out of CL:1513058 to make it possible to land parts
individually while the affected crate has no other significant CLs
pending. This avoids repeatedly introducing non-textual conflicts with
new code that adds `use` statements.

TEST=cargo check
TEST=cargo check --all-features
TEST=cargo check --target aarch64-unknown-linux-gnu

Change-Id: I99843b923094e4df7a139f22a30eb19527d11d98
Reviewed-on: https://chromium-review.googlesource.com/1519689
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Tolnay <dtolnay@chromium.org>
2019-03-13 21:05:03 -07:00
David Tolnay
fe3ef7d998 edition: Update absolute paths to 2018 style
This is an easy step toward adopting 2018 edition eventually, and will
make any future CL that sets `edition = "2018"` this much smaller.

The module system changes in Rust 2018 are described here:

https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html

Generated by running:

    cargo fix --edition --all

in each workspace, followed by bin/fmt.

TEST=cargo check
TEST=cargo check --all-features
TEST=cargo check --target aarch64-unknown-linux-gnu

Change-Id: I000ab5e69d69aa222c272fae899464bbaf65f6d8
Reviewed-on: https://chromium-review.googlesource.com/1513054
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Tolnay <dtolnay@chromium.org>
2019-03-13 21:05:03 -07:00
Jingkui Wang
fa13275942 add scatter gather buffer
scatter gather buffer is a buffer with segments.

CQ-DEPEND=CL:1510816
BUG=chromium:831850
TEST=cargo test

Change-Id: Iea54d5b3d6f9194113f6237eb14aafab71ca2ff9
Reviewed-on: https://chromium-review.googlesource.com/1510817
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Jingkui Wang <jkwang@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-13 21:04:58 -07:00
Jingkui Wang
115fe4e233 usb: add interrupter and resample handler for xhci
Interrupter owns event ring and send interrupt. Resample handler will
reassert interrupt when resample happens.

CQ-DEPEND=CL:1510815
BUG=chromium:831850
TEST=local build

Change-Id: If2c4349e50d0ab275f29dfa48b0860c86f0c8ea3
Reviewed-on: https://chromium-review.googlesource.com/1510816
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Jingkui Wang <jkwang@google.com>
2019-03-13 21:04:58 -07:00
Jingkui Wang
e9f5cae48f allow dead code for usb modules
This will remove warning messages for dead code.

TEST=run crosvm locally
BUG=chromium:831850
CQ-DEPEND=CL:1510814
Change-Id: Ia5c8768647737e3091e1a0b5e435d3c25bbbe383
Reviewed-on: https://chromium-review.googlesource.com/1510815
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Jingkui Wang <jkwang@google.com>
2019-03-13 21:04:58 -07:00
Jingkui Wang
199d622703 devices: compile usb module and update current code
This patch did the following:
    start compile usb module
    fix register macro
    update error handling
    reformat code
    update xhci reg setup to support usb3 and usb2

BUG=chromium:831850
TEST=local build
CQ-DEPEND=CL:1510813
Change-Id: I851cf02d01ae6e988b2628552cf57c1f43aa86c8
Reviewed-on: https://chromium-review.googlesource.com/1510814
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Jingkui Wang <jkwang@google.com>
2019-03-13 21:04:58 -07:00
Jingkui Wang
280ff78675 Add usb log macro
Usb implementation will use usb_debug to log verbose debug logs. It will
be turned off by default.

BUG=chromium:831850
TEST=local build

Change-Id: Ieaa22e57e624841a5f78a6a1a1874351bbd77a86
Reviewed-on: https://chromium-review.googlesource.com/1510813
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-13 21:04:57 -07:00
Jingkui Wang
415ee63e04 add utils for device implementations
event_loop: event loop based on poll context.

async_job_queue: queue a job, it will be invoked on event loop. This
could be used to invoke a function without holding any locks.

BUG=chromium:831850
TEST=local build

Change-Id: Iab61ac43221bf5d635a0138073d7f88401e5ab07
Reviewed-on: https://chromium-review.googlesource.com/1509852
Commit-Ready: Jingkui Wang <jkwang@google.com>
Tested-by: Jingkui Wang <jkwang@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-13 21:04:57 -07:00
Miriam Zimmerman
ea75bd164a Add common types and constants for split IRQ chip.
These will come in handy for reducing code duplication and simplifying
PIC/IOAPIC/PIT/interrupt routing code.

TEST=Built
BUG=chromium:908689

Change-Id: I696e9f51231a8e39640f1fd0af055b48048bc134
Reviewed-on: https://chromium-review.googlesource.com/1518557
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Miriam Zimmerman <mutexlox@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Tolnay <dtolnay@chromium.org>
2019-03-13 10:38:57 -07:00
Lepton Wu
28716ea430 gpu_renderer: Enable DRM_FORMAT_RGB565 format.
Some games under arcvm tried to create gbu buffer in this format.

BUG=b:128019372
TEST=manual - Run Asphalt 8 in ARCVM.

Change-Id: I12e67981b4a0b50574ff57cd6bfe94c042feedac
Reviewed-on: https://chromium-review.googlesource.com/1518731
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Lepton Wu <lepton@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-13 10:38:47 -07:00
Gabriel
cdae1067c3 kokoro: Fix docker build step in simulator script
The old command no longer works as of CL:1419397 because the pkgconfig
path in COPY needs to be interpreted relative to the Dockerfile path.
The kokoro/README.md instructions were updated in CL:1431356 but the
simulator script was not.

Patch received via email from Gabriel <g2p.code@gmail.com>.
0e6bb00b90

TEST=run kokoro simulator

Change-Id: I09d556cab9a4c1942098e0796e39e221f365c3af
Reviewed-on: https://chromium-review.googlesource.com/1513497
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2019-03-12 18:54:16 -07:00
Dylan Reid
8d7f4ac63c sys_util: guest_address: take self by value in methods
clippy says that it is more efficient. Since self is a u64 in this case,
it is correct.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Change-Id: Id7674db500a01640f650b239374fe9f83e2bc595
Reviewed-on: https://chromium-review.googlesource.com/1510065
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2019-03-12 18:54:14 -07:00
Lepton Wu
39133a0fd5 linux: clean up: Sort enum in alphabet order.
BUG=None
TEST=None

Change-Id: I11295f778f4d9dc919a41f5cccd85e9608d33358
Reviewed-on: https://chromium-review.googlesource.com/1492612
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Lepton Wu <lepton@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2019-03-12 18:54:12 -07:00