Skip to content

realm/mm: Correct setting of RIPAS=EMPTY on ASSIGNED_EMPTY RTTEs #425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion rmm/src/realm/mm/rtt.rs
Original file line number Diff line number Diff line change
@@ -384,7 +384,7 @@ pub fn set_ripas(rd: &Rd, base: usize, top: usize, ripas: u8, flags: u64) -> Res
if ripas as u64 == invalid_ripas::EMPTY {
new_s2tte |= bits_in_reg(S2TTE::INVALID_RIPAS, invalid_ripas::EMPTY);

if s2tte.is_unassigned_empty() {
Comment on lines 384 to -387
Copy link
Collaborator

@nook1208 nook1208 Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if RTT_SET_RIPAS were to be run on ASSIGNED_EMPTY RTTEs with the requested RIPAS being EMPTY

I think this is not the case that you mention. The current code (AS-IS code) is from UNASSIGNED_EMPTY to UNASSIGNED_EMPTY which it means do nothing. Although that's not a problem, It looks good to use 'continue' in the
'else' condition like you did 👍

And it seems that the case which is from UNASSIGNED_RAM to UNASSIGNED_EMPTY was missing. It's nice to be added. Thank you !

if s2tte.is_unassigned_ram() {
new_s2tte |= bits_in_reg(S2TTE::INVALID_HIPAS, invalid_hipas::UNASSIGNED);
} else if s2tte.is_unassigned_destroyed() {
if flags & CHANGE_DESTROYED != 0 {
@@ -404,6 +404,9 @@ pub fn set_ripas(rd: &Rd, base: usize, top: usize, ripas: u8, flags: u64) -> Res
} else {
break;
}
} else {
addr += map_size;
continue; // do nothing
}
} else if ripas as u64 == invalid_ripas::RAM {
new_s2tte |= bits_in_reg(S2TTE::INVALID_RIPAS, invalid_ripas::RAM);