Commit 936a07eb authored by Mostafa Saleh's avatar Mostafa Saleh
Browse files

ANDROID: KVM: arm64: Decouple domains from iommu



Current EL2 IOMMU implementation considers that domains belongs to an
IOMMU, which deviates from the Linux definition which allows a domain
to be attached to multiple IOMMUs.

To have the same behviour at EL2, this requires modifications in the
HVC interface to remove IOMMU arg for domain only operations(map,
unmap, free_domain, iova_to_phys).

This patch  does half of the work only, where most interfaces and
structs are decoupled, but still a domain belongs to one IOMMU, this
is handled in the next patches.
Also alloc_domain still depends on IOMMU, this done in a separate
patch.

All operations should be the same as before, with the change that
the IOMMU is not passed in the arg, but retrieved from the domain(
this handled in next patches).
This changes the function to lock the IOMMU after getting the domain,
this could race with the host alloc domain(for same domain ID) where
IOMMU would be NULL causing a crash, this is considered a host bug
(free a domain that hasn't completed allocation yet), however this
is dealt with next when domain are completely decoupled from IOMMUs.

One big change in this patch, is that now domains are not per-iommu
but a one common array at EL2 with max value of (1 << 16) which should
be more than enough, and as we only allocate the root of the domain
and the others are lazily allocated, no memory is wasted.

Bug: 277989609
Bug: 278749606
Change-Id: Ie9507a715d273030835efb6d4cd8a90cf5c58d42
Signed-off-by: default avatarMostafa Saleh <smostafa@google.com>
parent e73b69a9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment