Skip to content

Commit

Permalink
Merge "fix(runtime): incorrect bit manipulation for vmid." into integ…
Browse files Browse the repository at this point in the history
…ration
  • Loading branch information
soby-mathew authored and TrustedFirmware Code Review committed Jan 4, 2023
2 parents e2eea7c + f427d8a commit 18687a2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion runtime/core/vmid.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ bool vmid_reserve(unsigned int vmid)
unsigned int vmid_count;

/* Number of supported VMID values */
vmid_count = is_feat_vmid16_present() ? VMID16_COUNT : VMID8_COUNT;
vmid_count = is_feat_vmid16_present() ? VMID16_COUNT : VMID8_COUNT;

/*
* The input from NS as part of RMI_REALM_CREATE is 'short int' type,
* so this check will not fail on systems with FEAT_VMID16 implemented.
Expand All @@ -42,6 +43,7 @@ bool vmid_reserve(unsigned int vmid)
}

offset = vmid / BITS_PER_UL;
vmid %= BITS_PER_UL;

return !atomic_bit_set_acquire_release_64(&vmids[offset], vmid);
}
Expand All @@ -60,6 +62,7 @@ void vmid_free(unsigned int vmid)
/* Check the number of supported VMID values */
assert(vmid < vmid_count);
offset = vmid / BITS_PER_UL;
vmid %= BITS_PER_UL;

atomic_bit_clear_release_64(&vmids[offset], vmid);
}

0 comments on commit 18687a2

Please sign in to comment.