diff --git a/arch/arm64/gunyah/gunyah_hypercall.c b/arch/arm64/gunyah/gunyah_hypercall.c index 3c2672d683ae..0556226f55a5 100644 --- a/arch/arm64/gunyah/gunyah_hypercall.c +++ b/arch/arm64/gunyah/gunyah_hypercall.c @@ -45,6 +45,7 @@ EXPORT_SYMBOL_GPL(arch_is_gunyah_guest); #define GUNYAH_HYPERCALL_ADDRSPACE_UNMAP GUNYAH_HYPERCALL(0x802C) #define GUNYAH_HYPERCALL_MEMEXTENT_DONATE GUNYAH_HYPERCALL(0x8061) #define GUNYAH_HYPERCALL_VCPU_RUN GUNYAH_HYPERCALL(0x8065) +#define GUNYAH_HYPERCALL_ADDRSPACE_FIND_INFO_AREA GUNYAH_HYPERCALL(0x806a) /* clang-format on */ /** @@ -275,5 +276,28 @@ gunyah_hypercall_vcpu_run(u64 capid, unsigned long *resume_data, } EXPORT_SYMBOL_GPL(gunyah_hypercall_vcpu_run); +/** + * gunyah_hypercall_addrspace_find_info_area() - Find the IPA and size of the info area + * @ipa: Filled with the IPA of the info area + * @size: Filled with the size of the info area + * + * See also: + * https://github.com/quic/gunyah-hypervisor/blob/develop/docs/api/gunyah_api.md#address-space-management + */ +enum gunyah_error +gunyah_hypercall_addrspace_find_info_area(unsigned long *ipa, unsigned long *size) +{ + struct arm_smccc_res res; + + arm_smccc_1_1_hvc(GUNYAH_HYPERCALL_ADDRSPACE_FIND_INFO_AREA, 0, &res); + if (res.a0 == GUNYAH_ERROR_OK) { + *ipa = res.a1; + *size = res.a2; + } + + return res.a0; +} +EXPORT_SYMBOL_GPL(gunyah_hypercall_addrspace_find_info_area); + MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Gunyah Hypervisor Hypercalls"); diff --git a/include/linux/gunyah.h b/include/linux/gunyah.h index dbd5b0251b49..cc16803536e4 100644 --- a/include/linux/gunyah.h +++ b/include/linux/gunyah.h @@ -480,4 +480,7 @@ enum gunyah_error gunyah_hypercall_vcpu_run(u64 capid, unsigned long *resume_data, struct gunyah_hypercall_vcpu_run_resp *resp); +enum gunyah_error +gunyah_hypercall_addrspace_find_info_area(unsigned long *ipa, unsigned long *size); + #endif