ANDROID: virt: gunyah: Fix ADDRSPACE_VMMIO_CONFIGURE hypercall handling

The ADDRSPACE_VMMIO_CONFIGURE hypercall might be implemented but does
not allow the guest to nominate VMMIO regions. The current
implementation bails out only if the hypercall is not implemented.
If the firmware implements the hypercall but returns an insufficient
permission error, it could cause ioremap() to fail on the guest.
Fix this by checking against GUNYAH_ERROR_CSPACE_INSUF_RIGHTS error
code.

Bug: 427643547
Change-Id: I79faf8db580dca12a46d29f870b73a2af5e4cde6
Signed-off-by: Mukesh Pilaniya <quic_mpilaniy@quicinc.com>
This commit is contained in:
Mukesh Pilaniya
2025-06-24 15:55:41 +05:30
committed by Treehugger Robot
parent 153a0a38e9
commit 68f4f0b069

View File

@@ -33,7 +33,8 @@ static int gunyah_mmio_guard_ioremap_hook(phys_addr_t phys, size_t size, pgprot_
ret = gunyah_hypercall_addrspc_configure_vmmio_range(our_addrspace_capid,
phys, size, GUNYAH_ADDRSPACE_VMMIO_CONFIGURE_OP_ADD_RANGE);
if (ret == GUNYAH_ERROR_UNIMPLEMENTED || ret == GUNYAH_ERROR_BUSY)
if (ret == GUNYAH_ERROR_UNIMPLEMENTED || ret == GUNYAH_ERROR_BUSY
|| ret == GUNYAH_ERROR_CSPACE_INSUF_RIGHTS)
/* Gunyah would have configured VMMIO via DT */
ret = GUNYAH_ERROR_OK;