Skip to content

Commit

Permalink
[temporal/rmi]:VMMapMemory - set gic its cbaser address shared
Browse files Browse the repository at this point in the history
Set NS bit for a specific ipa to share the page
between normal world(kvm) and realm (kernel).
This is a temporary solution until we design how to share memory between them.
  • Loading branch information
bokdeuk-jeong committed Jul 4, 2022
1 parent 9db9ced commit cf24cfa
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion rmm/armv9a/src/rmi/realm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,14 @@ pub fn set_event_handler(mainloop: &mut Mainloop<rmi::Receiver>) {
flags |= helper::bits_in_reg(RawPTE::ATTR, pte::attribute::NORMAL)
}

let flags = helper::bits_in_reg(RawPTE::ATTR, pte::attribute::NORMAL)
let mut flags = helper::bits_in_reg(RawPTE::ATTR, pte::attribute::NORMAL)
| helper::bits_in_reg(RawPTE::S2AP, pte::permission::RW);

// TODO: shared between NS and Linux Ream for GITS_CBASER
if guest >= 0x40C2_0000 && guest < 0x40C3_0000 {
flags |= helper::bits_in_reg(RawPTE::NS, 0b1);
}

realm::registry::get(vm)
.ok_or("Not exist VM")?
.lock()
Expand All @@ -149,6 +154,11 @@ pub fn set_event_handler(mainloop: &mut Mainloop<rmi::Receiver>) {
flags as usize,
);

// TODO: shared between NS and Linux Ream for GITS_CBASER
if guest >= 0x40C2_0000 && guest < 0x40C3_0000 {
return Ok(());
}

let cmd = usize::from(smc::Code::MarkRealm);
let mut arg = [phys, 0, 0, 0];
let mut remain = size;
Expand Down

0 comments on commit cf24cfa

Please sign in to comment.