From 653be265a437be2e8dd48e192a20879bc7455a19 Mon Sep 17 00:00:00 2001 From: Ingrid Gallardo Date: Wed, 24 Nov 2021 16:10:27 -0800 Subject: [PATCH] soc: qcom: sync: export qcom speculative fence interface This change adds an interface to check if a given speculative fence is bound. If fence is not bound, it will wait for the speculative fence ioctl to bind the fence, or else timeout. Change-Id: Iee014ad282c9b53d8785f0f9341ae28a9c616969 Signed-off-by: Ingrid Gallardo --- include/linux/soc/qcom/qcom_sync_file.h | 39 +++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 include/linux/soc/qcom/qcom_sync_file.h diff --git a/include/linux/soc/qcom/qcom_sync_file.h b/include/linux/soc/qcom/qcom_sync_file.h new file mode 100644 index 000000000000..9f9b19f801b1 --- /dev/null +++ b/include/linux/soc/qcom/qcom_sync_file.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + */ + +#ifndef _LINUX_QCOM_SPEC_SYNC_H +#define _LINUX_QCOM_SPEC_SYNC_H + +#include + +#define SPEC_FENCE_FLAG_FENCE_ARRAY 16 /* fence-array is speculative */ +#define SPEC_FENCE_FLAG_FENCE_ARRAY_BOUND 17 /* fence-array is bound */ + +#if IS_ENABLED(CONFIG_QCOM_SPEC_SYNC) + +/** + * spec_sync_wait_bind_array() - Waits until the fence-array passed as parameter is bound. + * @fence_array: fence-array to wait-on until it is populated. + * @timeout_ms: timeout to wait. + * + * This function will wait until the fence-array passed as paremeter is bound; i.e. all the + * dma-fences that conform the fence-array are populated by the spec-fence driver bind ioctl. + * Once this function returns success, all the fences in the array should be valid. + * + * Return: 0 on success or negative errno (-EINVAL) + */ +int spec_sync_wait_bind_array(struct dma_fence_array *fence_array, u32 timeout_ms); + +#else + +static inline int spec_sync_wait_bind_array(struct dma_fence_array *fence_array, u32 timeout_ms) +{ + return -EINVAL; +} + +#endif /* CONFIG_QCOM_SPEC_SYNC */ + +#endif /* _LINUX_QCOM_SPEC_SYNC_H */