gpu: host1x-emu: Add host1x_syncpt_get_shim_info

Implement host1x_syncpt_get_shim_info function for
host1x-emu driver and add it to the dynamic dispatch
mechanism in host1x-fence.

This function provides clients with the physical address
of syncpoint aperture, stride and number of
syncpoints, which is needed by various client drivers
like ISP, VI, PVA, GPU etc

Jira HOSTX-5971

Change-Id: I50e60222a035228c981dfa993cb0088e1d15dad2
Signed-off-by: Mainak Sen <msen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3323327
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Raghavendra Vishnu Kumar <rvk@nvidia.com>
Reviewed-by: Amitabh Dutta <amitabhd@nvidia.com>
This commit is contained in:
Mainak Sen
2025-03-20 13:54:06 +00:00
committed by Jon Hunter
parent 4a4300f0e8
commit 261488ef83
7 changed files with 55 additions and 2 deletions

View File

@@ -61,6 +61,7 @@ struct host1x_interface_ops host1x_emu_api = {
.host1x_syncpt_id = HOST1X_EMU_EXPORT_SYMBOL_NAME(host1x_syncpt_id),
.host1x_syncpt_wait_ts = HOST1X_EMU_EXPORT_SYMBOL_NAME(host1x_syncpt_wait_ts),
.host1x_syncpt_wait = HOST1X_EMU_EXPORT_SYMBOL_NAME(host1x_syncpt_wait),
.host1x_syncpt_get_shim_info = HOST1X_EMU_EXPORT_SYMBOL_NAME(host1x_syncpt_get_shim_info),
//nvhost.h Interface
.host1x_writel = HOST1X_EMU_EXPORT_SYMBOL_NAME(host1x_writel),

View File

@@ -82,4 +82,9 @@ HOST1X_EMU_EXPORT_DECL(int, host1x_fence_get_node(struct dma_fence *fence));
HOST1X_EMU_EXPORT_DECL(void, host1x_fence_cancel(struct dma_fence *fence));
HOST1X_EMU_EXPORT_DECL(int, host1x_syncpt_get_shim_info(struct host1x *host,
phys_addr_t *base,
u32 *stride,
u32 *num_syncpts));
#endif

View File

@@ -485,6 +485,30 @@ HOST1X_EMU_EXPORT_DECL(int, host1x_syncpt_wait_ts(struct host1x_syncpt *sp,
}
HOST1X_EMU_EXPORT_SYMBOL(host1x_syncpt_wait_ts);
/**
* @brief Get the physical address of the syncpoint aperture, stride and number of syncpoints
*
* @param host: host1x instance
* @param base: physical address of syncpoint aperture
* @param stride: stride between syncpoints
* @param num_syncpts: number of syncpoints
*
* @return 0 if successful
*/
HOST1X_EMU_EXPORT_DECL(int, host1x_syncpt_get_shim_info(struct host1x *host,
phys_addr_t *base, u32 *stride, u32 *num_syncpts))
{
if (!host || !base || !stride || !num_syncpts)
return -EINVAL;
*base = host->syncpt_phy_apt;
*stride = host->syncpt_page_size;
*num_syncpts = host->syncpt_count;
return 0;
}
HOST1X_EMU_EXPORT_SYMBOL(host1x_syncpt_get_shim_info);
/**
* @brief Wait for a syncpoint to reach a given threshold value
*

View File

@@ -29,6 +29,7 @@ static bool host1x_wrapper_init_default_interface(void)
host1x_api_table.host1x_syncpt_id = host1x_syncpt_id;
host1x_api_table.host1x_syncpt_wait_ts = host1x_syncpt_wait_ts;
host1x_api_table.host1x_syncpt_wait = host1x_syncpt_wait;
host1x_api_table.host1x_syncpt_get_shim_info = host1x_syncpt_get_shim_info;
// Interface for nvhost.h
host1x_api_table.host1x_writel = host1x_writel;
host1x_api_table.nvhost_get_default_device = nvhost_get_default_device;
@@ -191,10 +192,24 @@ EXPORT_SYMBOL(wrap_host1x_syncpt_wait_ts);
int wrap_host1x_syncpt_wait(struct host1x_syncpt *sp,
u32 thresh, long timeout, u32 *value)
{
if (host1x_api_table.host1x_syncpt_wait != NULL)
return host1x_api_table.host1x_syncpt_wait(sp, thresh, timeout, value);
return -ENOSYS;
}
EXPORT_SYMBOL(wrap_host1x_syncpt_wait);
/**
* Wrapper function for host1x_syncpt_get_shim_info
*/
int wrap_host1x_syncpt_get_shim_info(struct host1x *host,
phys_addr_t *base, u32 *stride, u32 *num_syncpts)
{
return host1x_api_table.host1x_syncpt_get_shim_info(host, base, stride, num_syncpts);
return -ENOSYS;
}
EXPORT_SYMBOL(wrap_host1x_syncpt_get_shim_info);
// nvhost.c
void wrap_host1x_writel(struct platform_device *pdev, u32 r, u32 v)
{

View File

@@ -27,6 +27,7 @@
#define host1x_syncpt_wait_ts wrap_host1x_syncpt_wait_ts
#define host1x_syncpt_wait wrap_host1x_syncpt_wait
#define host1x_fence_get_node wrap_host1x_fence_get_node
#define host1x_syncpt_get_shim_info wrap_host1x_syncpt_get_shim_info
//nvhost.h
#define host1x_writel wrap_host1x_writel

View File

@@ -78,6 +78,11 @@ int wrap_host1x_syncpt_wait_ts(struct host1x_syncpt *sp,
int wrap_host1x_syncpt_wait(struct host1x_syncpt *sp,
u32 thresh, long timeout, u32 *value);
int wrap_host1x_syncpt_get_shim_info(struct host1x *host,
phys_addr_t *base,
u32 *stride,
u32 *num_syncpts);
int wrap_host1x_fence_get_node(struct dma_fence *fence);
//nvhost.h

View File

@@ -37,6 +37,8 @@ void (*host1x_syncpt_put)(struct host1x_syncpt *sp);
u32 (*host1x_syncpt_id)(struct host1x_syncpt *sp);
int (*host1x_syncpt_wait_ts)(struct host1x_syncpt *sp, u32 thresh, long timeout, u32 *value, ktime_t *ts);
int (*host1x_syncpt_wait)(struct host1x_syncpt *sp, u32 thresh, long timeout,u32 *value);
int (*host1x_syncpt_get_shim_info)(struct host1x *host, phys_addr_t *base,
u32 *stride, u32 *num_syncpts);
//nvhost.h Interface
void (*host1x_writel)(struct platform_device *pdev, u32 r, u32 v);