soc: qcom: rpmh: Add fast-path interface

Add fast-path interface for making a lock-less RPMH request. The
interface provides APIs that can be called from a interrupt/scheduler
context. The _init_ call shall be used to initialize the dedicated TCS
with {addr, data} and subsequent calls shall _update_ the data and
trigger the request immediately.

Only active state requests shall be sent through these interfaces.
Requests to remove the vote during sleep and re-apply the vote during
wake must use the regular rpmh_write/_async variants APIs (locking).

Change-Id: I2505fc487ddca1a32185b116c0d8680818dfd2b8
Signed-off-by: Lina Iyer <ilina@codeaurora.org>
Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>
This commit is contained in:
Lina Iyer 2020-10-05 11:39:15 -06:00 committed by Maulik Shah
parent ad5eb0a49a
commit 106bcadd4a
2 changed files with 92 additions and 1 deletions

View File

@ -621,3 +621,80 @@ int rpmh_mode_solver_set(const struct device *dev, bool enable)
return ret;
}
EXPORT_SYMBOL(rpmh_mode_solver_set);
/**
* RPMH Fast Path mode
*
* - Fast path mode is a lock-less request transmission to AOSS.
* - Requests may be sent from interrupt/scheduler context.
* - Dedicated fast-path TCS must be available in the RSC.
* - Error returned, when dedicated TCS is not available.
* - Only one client is expected to call RPMH fast path.
* - Serialization of requests is a responsibility of the client.
* - Only active state requests may be made through this mode.
* - Sleep/Wake requests for the nodes must be made through
* the standard RPMH APIs (locking modes).
* - Fast path requests are not cached and sent immediately.
* - Fast path requests are all blocking requests.
* - Fast path requests do not use AMC completion interrupts,
* therefore will not receive a tx_done callback.
*/
/**
* rpmh_init_fast_path: Initialize TCS request in fast-path TCS
*
* @dev: The device making the request
* @cmd: The {addr, data} to be initialized with.
* @n: The number of @cmd
*
* Return:
* * 0 - Success
* * Error code - Otherwise
*/
int rpmh_init_fast_path(const struct device *dev,
struct tcs_cmd *cmd, int n)
{
struct rpmh_ctrlr *ctrlr = get_rpmh_ctrlr(dev);
struct tcs_request req;
if (rpmh_standalone)
return 0;
req.cmds = cmd;
req.num_cmds = n;
req.wait_for_compl = 0;
return rpmh_rsc_init_fast_path(ctrlr_to_drv(ctrlr), &req);
}
EXPORT_SYMBOL(rpmh_init_fast_path);
/**
* rpmh_update_fast_path: Initialize TCS request in fast-path TCS
*
* @dev: The device making the request
* @cmd: The data to be updated.
* @n: The number of @cmd
* @update_mask: The elements in @cmd that only need to be updated
*
* Return:
* * 0 - Success
* * Error code - Otherwise
*/
int rpmh_update_fast_path(const struct device *dev,
struct tcs_cmd *cmd, int n, u32 update_mask)
{
struct rpmh_ctrlr *ctrlr = get_rpmh_ctrlr(dev);
struct tcs_request req;
if (rpmh_standalone)
return 0;
req.cmds = cmd;
req.num_cmds = n;
req.wait_for_compl = 0;
return rpmh_rsc_update_fast_path(ctrlr_to_drv(ctrlr), &req,
update_mask);
}
EXPORT_SYMBOL(rpmh_update_fast_path);

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
*/
#ifndef __SOC_QCOM_RPMH_H__
@ -26,6 +26,11 @@ int rpmh_write_sleep_and_wake(const struct device *dev);
void rpmh_invalidate(const struct device *dev);
int rpmh_init_fast_path(const struct device *dev,
struct tcs_cmd *cmd, int n);
int rpmh_update_fast_path(const struct device *dev,
struct tcs_cmd *cmd, int n, u32 update_mask);
#else
static inline int rpmh_write(const struct device *dev, enum rpmh_state state,
@ -52,6 +57,15 @@ static inline void rpmh_invalidate(const struct device *dev)
{
}
static inline int rpmh_init_fast_path(const struct device *dev,
struct tcs_cmd *msg, int n)
{ return -ENODEV; }
static inline int rpmh_update_fast_path(const struct device *dev,
struct tcs_cmd *msg, int n,
u32 update_mask)
{ return -ENODEV; }
#endif /* CONFIG_QCOM_RPMH */
#endif /* __SOC_QCOM_RPMH_H__ */