ANDROID: KVM: arm64: iommu: Add owner to domains

Add an owner to each domain either host or a VM which is set at alloc
time, and all other IOMMU operations would be allowed only from the
domain owner.
The new vm member is protected by kvm_iommu_domain_lock while
set/cleared in alloc/free, and the check is done only after the domain
refcount is elevated to avoid racing with alloc.

Bug: 357781595
Bug: 348382247
Bug: 236685427
Change-Id: Ie23379d958922368ec3be2127ba90393709a77bb
Signed-off-by: Mostafa Saleh <smostafa@google.com>
This commit is contained in:
Mostafa Saleh
2024-07-02 13:30:35 +00:00
committed by Carlos Llamas
parent 8a9430e18b
commit 540b4b9ce3
2 changed files with 29 additions and 2 deletions
+1
View File
@@ -21,6 +21,7 @@ struct kvm_hyp_iommu_domain {
atomic_t refs;
pkvm_handle_t domain_id;
void *priv;
void *vm;
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
};