diff options
author | Andreas Sandberg <andreas.sandberg@arm.com> | 2017-07-27 09:26:07 +0000 |
---|---|---|
committer | Andreas Sandberg <andreas.sandberg@arm.com> | 2017-08-01 16:20:24 +0000 |
commit | db85b8ff32c46796aa91fecb04ea1ae3411c077e (patch) | |
tree | 601211fa2486b21504883cc85f379edb1d9016b0 /src/arch/arm/kvm/armv8_cpu.cc | |
parent | 1935cec529ac2ae7d9b31f1e55f333a0769184b5 (diff) | |
download | gem5-db85b8ff32c46796aa91fecb04ea1ae3411c077e.tar.xz |
kvm, arm: Switch to the device EQ when accessing ISA devices
ISA devices typically run in the device event queue. Previously, we
assumed that devices would perform their own EQ migrations as
needed. This isn't ideal since it means we have different conventions
for IO devices and ISA devices. Switch to doing migrations in the KVM
CPU instead to make the behavior consistent.
Change-Id: I33b74480fb2126b0786dbdbfdcfa86083384250c
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/4288
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/arch/arm/kvm/armv8_cpu.cc')
-rw-r--r-- | src/arch/arm/kvm/armv8_cpu.cc | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/arch/arm/kvm/armv8_cpu.cc b/src/arch/arm/kvm/armv8_cpu.cc index db2b9c07a..209f49efa 100644 --- a/src/arch/arm/kvm/armv8_cpu.cc +++ b/src/arch/arm/kvm/armv8_cpu.cc @@ -260,7 +260,17 @@ ArmV8KvmCPU::updateKvmState() } for (const auto &ri : getSysRegMap()) { - const uint64_t value(tc->readMiscReg(ri.idx)); + uint64_t value; + if (ri.is_device) { + // This system register is backed by a device. This means + // we need to lock the device event queue. + EventQueue::ScopedMigration migrate(deviceEventQueue()); + + value = tc->readMiscReg(ri.idx); + } else { + value = tc->readMiscReg(ri.idx); + } + DPRINTF(KvmContext, " %s := 0x%x\n", ri.name, value); setOneReg(ri.kvm, value); } @@ -323,10 +333,15 @@ ArmV8KvmCPU::updateThreadContext() for (const auto &ri : getSysRegMap()) { const auto value(getOneRegU64(ri.kvm)); DPRINTF(KvmContext, " %s := 0x%x\n", ri.name, value); - if (ri.is_device) + if (ri.is_device) { + // This system register is backed by a device. This means + // we need to lock the device event queue. + EventQueue::ScopedMigration migrate(deviceEventQueue()); + tc->setMiscReg(ri.idx, value); - else + } else { tc->setMiscRegNoEffect(ri.idx, value); + } } PCState pc(getOneRegU64(INT_REG(regs.pc))); |