Add compiler fence before mbox write
This commit is contained in:
parent
1e8735c1f6
commit
db5948075e
|
@ -4,6 +4,7 @@ use crate::{
|
||||||
println,
|
println,
|
||||||
};
|
};
|
||||||
use core::ops::Deref;
|
use core::ops::Deref;
|
||||||
|
use core::sync::atomic::{compiler_fence, Ordering};
|
||||||
use register::mmio::*;
|
use register::mmio::*;
|
||||||
|
|
||||||
// Public interface to the mailbox
|
// Public interface to the mailbox
|
||||||
|
@ -194,6 +195,11 @@ fn write(regs: &RegisterBlock, buf_ptr: u32, channel: u32) -> Result<()> {
|
||||||
|
|
||||||
println!("Mailbox::write {:x}/{:x}", buf_ptr, channel);
|
println!("Mailbox::write {:x}/{:x}", buf_ptr, channel);
|
||||||
|
|
||||||
|
// Insert a compiler fence that ensures that all stores to the
|
||||||
|
// mbox buffer are finished before the GPU is signaled (which is
|
||||||
|
// done by a store operation as well).
|
||||||
|
compiler_fence(Ordering::Release);
|
||||||
|
|
||||||
while regs.STATUS.is_set(STATUS::FULL) {
|
while regs.STATUS.is_set(STATUS::FULL) {
|
||||||
count += 1;
|
count += 1;
|
||||||
if count > (1 << 25) {
|
if count > (1 << 25) {
|
||||||
|
|
Loading…
Reference in New Issue