ANDROID: KVM: arm64: Don't update IOMMUs for share/unshare
Share/unshare initiated by host doesn't change memory permission, and as currently pKVM doesn't support device assignment, there is no need to update the IOMMU unnecessarily as it waste cycles. Once device assignment is enabled, this assumption will not be valid as guests have access to DMA. Bug: 291843613 Change-Id: I28c69ec8f721711d5b59fa2784386fa61654fe5a Signed-off-by: Mostafa Saleh <smostafa@google.com>
This commit is contained in:
parent
20ecb229c5
commit
a68bd01493
@ -1048,9 +1048,20 @@ static int __host_check_page_state_range(u64 addr, u64 size,
|
||||
static int __host_set_page_state_range(u64 addr, u64 size,
|
||||
enum pkvm_page_state state)
|
||||
{
|
||||
bool update_iommu = true;
|
||||
enum kvm_pgtable_prot prot = pkvm_mkstate(PKVM_HOST_MEM_PROT, state);
|
||||
|
||||
return host_stage2_idmap_locked(addr, size, prot, true);
|
||||
/*
|
||||
* Sharing and unsharing host pages shouldn't change the IOMMU page tables,
|
||||
* so avoid extra page tables walks for the IOMMU.
|
||||
* HOWEVER THIS WILL NOT WORK WHEN DEVICE ASSIGNMENT IS SUPPORTED AS THE GUEST
|
||||
* MIGHT HAVE ACCESS TO DMA.
|
||||
* but as Android-14 doesn't support device assignment this should be fine.
|
||||
*/
|
||||
if ((state == PKVM_PAGE_OWNED) || (state == PKVM_PAGE_SHARED_OWNED))
|
||||
update_iommu = false;
|
||||
|
||||
return host_stage2_idmap_locked(addr, size, prot, update_iommu);
|
||||
}
|
||||
|
||||
static int host_request_owned_transition(u64 *completer_addr,
|
||||
|
Loading…
Reference in New Issue
Block a user