register_space: fix u64 write callback

u64 register callback will only be invoked when the write is done.

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

Change-Id: Id0be69535898fdcc4ba24d3151df7a5107a2725b
Reviewed-on: https://chromium-review.googlesource.com/1509515
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Jingkui Wang <jkwang@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
This commit is contained in:
Jingkui Wang 2019-03-07 12:23:42 -08:00 committed by chrome-bot
parent 9fc96ec8fb
commit 886ed246b3

View file

@ -267,6 +267,14 @@ impl<T: RegisterValue> RegisterInterface for Register<T> {
);
}
}
// A single u64 register is done by write to lower 32 bit and then higher 32 bit. Callback
// should only be invoked when higher is written.
if my_range.to != overlap.to {
self.lock().value = reg_value;
return;
}
// Taking the callback out of register when executing it. This prevent dead lock if
// callback want to read current register value.
// Note that the only source of callback comes from mmio writing, which is synchronized.