summary refs log tree commit diff
path: root/x86_64
diff options
context:
space:
mode:
authorZhuocheng Ding <zhuocheng.ding@intel.corp-partner.google.com>2019-12-02 15:50:10 +0800
committerCommit Bot <commit-bot@chromium.org>2019-12-10 05:08:11 +0000
commit7434c0002022541f34a929d9a8e3bfaaf4dfc2d9 (patch)
tree7940edf9b5ce136b845a01b254e9fe5519778e0b /x86_64
parent0e8c11e3548e48fb5e59f8006dad0d76c549fb35 (diff)
downloadcrosvm-7434c0002022541f34a929d9a8e3bfaaf4dfc2d9.tar
crosvm-7434c0002022541f34a929d9a8e3bfaaf4dfc2d9.tar.gz
crosvm-7434c0002022541f34a929d9a8e3bfaaf4dfc2d9.tar.bz2
crosvm-7434c0002022541f34a929d9a8e3bfaaf4dfc2d9.tar.lz
crosvm-7434c0002022541f34a929d9a8e3bfaaf4dfc2d9.tar.xz
crosvm-7434c0002022541f34a929d9a8e3bfaaf4dfc2d9.tar.zst
crosvm-7434c0002022541f34a929d9a8e3bfaaf4dfc2d9.zip
crosvm: PIT: use full address and avoid conflict
The PIT implementation has the assumption that addresses are I/O port
numbers, so we should use full address mode. i8042 is also changed to
full address mode to avoid the conflict on port 0x61.

BUG=chromium:908689
TEST=None

Change-Id: Ibbb851e3a46ac7fc71576990a1618196de92e33c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1945794
Commit-Queue: Zhuocheng Ding <zhuocheng.ding@intel.corp-partner.google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'x86_64')
-rw-r--r--x86_64/src/lib.rs20
1 files changed, 8 insertions, 12 deletions
diff --git a/x86_64/src/lib.rs b/x86_64/src/lib.rs
index 172a504..bb5b675 100644
--- a/x86_64/src/lib.rs
+++ b/x86_64/src/lib.rs
@@ -653,18 +653,12 @@ impl X8664arch {
                 false,
             )
             .unwrap();
-        io_bus
-            .insert(
-                Arc::new(Mutex::new(devices::I8042Device::new(
-                    exit_evt.try_clone().map_err(Error::CloneEventFd)?,
-                ))),
-                0x061,
-                0x4,
-                false,
-            )
-            .unwrap();
 
         let nul_device = Arc::new(Mutex::new(NoDevice));
+        let i8042 = Arc::new(Mutex::new(devices::I8042Device::new(
+            exit_evt.try_clone().map_err(Error::CloneEventFd)?,
+        )));
+
         if split_irqchip {
             let pit_evt = EventFd::new().map_err(Error::CreateEventFd)?;
             let pit = Arc::new(Mutex::new(
@@ -674,14 +668,16 @@ impl X8664arch {
                 )
                 .map_err(Error::CreatePitDevice)?,
             ));
-            // Reserve from 0x40 to 0x61 (the speaker).
-            io_bus.insert(pit.clone(), 0x040, 0x22, false).unwrap();
+            io_bus.insert(pit.clone(), 0x040, 0x8, true).unwrap();
+            io_bus.insert(pit.clone(), 0x061, 0x1, true).unwrap();
+            io_bus.insert(i8042, 0x062, 0x3, true).unwrap();
             vm.register_irqfd(&pit_evt, 0)
                 .map_err(Error::RegisterIrqfd)?;
         } else {
             io_bus
                 .insert(nul_device.clone(), 0x040, 0x8, false)
                 .unwrap(); // ignore pit
+            io_bus.insert(i8042, 0x061, 0x4, true).unwrap();
         }
 
         io_bus