ANDROID: KVM: iommu: Allow IOMMU mapping in carveouts
Some carveouts might be no-map for the CPU, but can be used from devices. Allow IOMMU to map those buffers. Bug: 409547022 Bug: 357781595 Change-Id: Ie0e34442e59dc753afcb4357c85211aefe7d7b39 Signed-off-by: Mostafa Saleh <smostafa@google.com>
This commit is contained in:
@@ -1898,8 +1898,16 @@ static int __pkvm_use_dma_locked(phys_addr_t phys_addr, size_t size,
|
||||
} else {
|
||||
/* For VMs, we know if we reach this point the VM has access to the page. */
|
||||
if (!hyp_vcpu) {
|
||||
ret = ___host_check_page_state_range(phys_addr, size,
|
||||
PKVM_PAGE_OWNED, reg, false);
|
||||
for (i = 0; i < nr_pages; i++) {
|
||||
enum pkvm_page_state state;
|
||||
phys_addr_t this_addr = phys_addr + i * PAGE_SIZE;
|
||||
|
||||
state = hyp_phys_to_page(this_addr)->host_state;
|
||||
if (state != PKVM_PAGE_OWNED) {
|
||||
ret = -EPERM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user