mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-25 02:32:08 +03:00
host1x_emu: Fix NvHost Interface and IOCTL
1. The nvhost interface like syncpoint offset/aperture were taking "pdev" of Host1x device, but emulated syncpoint driver implementd the interface with "pdev" of clinet device. This was done to align all other interface input parameter. This patch revert the above alignment of intput parameter change. 2. This patch modify SyncpointWait IOCTL handler to return timestamp of signal observed by KMD to UMD Bug 4895937 Change-Id: I61ba02992963ba272e5c2514ffe8c24fff510c3a Signed-off-by: amitabhd <amitabhd@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3226744 GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: Santosh BS <santoshb@nvidia.com> Reviewed-by: Raghavendra Vishnu Kumar <rvk@nvidia.com>
This commit is contained in:
@@ -218,19 +218,27 @@ static int host1x_ioctl_syncpoint_wait(
|
||||
struct host1x_emu_ctrl_syncpt_wait_args *args)
|
||||
|
||||
{
|
||||
signed long timeout_jiffies;
|
||||
struct host1x_syncpt *sp;
|
||||
struct host1x *host = ctx->host;
|
||||
signed long timeout_jiffies;
|
||||
struct host1x_syncpt *sp;
|
||||
struct host1x *host = ctx->host;
|
||||
ktime_t ts;
|
||||
int err;
|
||||
|
||||
sp = HOST1X_EMU_EXPORT_CALL(host1x_syncpt_get_by_id_noref(host, args->id));
|
||||
if (!sp)
|
||||
return -EINVAL;
|
||||
timeout_jiffies = timeout_abs_to_jiffies(args->timeout_ns);
|
||||
sp = HOST1X_EMU_EXPORT_CALL(host1x_syncpt_get_by_id_noref(host, args->id));
|
||||
if (!sp)
|
||||
return -EINVAL;
|
||||
|
||||
return HOST1X_EMU_EXPORT_CALL(host1x_syncpt_wait(sp,
|
||||
args->threshold,
|
||||
timeout_jiffies,
|
||||
&args->value));
|
||||
timeout_jiffies = timeout_abs_to_jiffies(args->timeout_ns);
|
||||
err = HOST1X_EMU_EXPORT_CALL(host1x_syncpt_wait_ts(sp,
|
||||
args->threshold,
|
||||
timeout_jiffies,
|
||||
&args->value,
|
||||
&ts));
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
args->timestamp = ktime_to_ns(ts);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long host1x_ctrlctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
|
||||
@@ -392,16 +392,25 @@ HOST1X_EMU_EXPORT_SYMBOL(nvhost_syncpt_incr_max_ext);
|
||||
HOST1X_EMU_EXPORT_DECL(u32, nvhost_syncpt_unit_interface_get_byte_offset_ext(struct platform_device *pdev,
|
||||
u32 syncpt_id))
|
||||
{
|
||||
struct nvhost_device_data *pdata = platform_get_drvdata(pdev);
|
||||
struct platform_device *host1x_pdev;
|
||||
struct host1x *host1x;
|
||||
|
||||
if (WARN_ON(!pdata))
|
||||
return 0;
|
||||
if (syncpt_id >= pdata->host1x->syncpt_count) {
|
||||
pr_info("Invalid syncpoint ID!\n");
|
||||
return 0;
|
||||
}
|
||||
host1x_pdev = HOST1X_EMU_EXPORT_CALL(nvhost_get_default_device());
|
||||
if (WARN_ON(!host1x_pdev))
|
||||
return 0;
|
||||
|
||||
return syncpt_id * pdata->host1x->syncpt_page_size;
|
||||
host1x = platform_get_drvdata(host1x_pdev);
|
||||
if (!host1x) {
|
||||
pr_info("No platform data for host1x!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (syncpt_id >= host1x->syncpt_count) {
|
||||
pr_info("Invalid syncpoint ID!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return syncpt_id * host1x->syncpt_page_size;
|
||||
}
|
||||
HOST1X_EMU_EXPORT_SYMBOL(nvhost_syncpt_unit_interface_get_byte_offset_ext);
|
||||
|
||||
@@ -431,11 +440,22 @@ HOST1X_EMU_EXPORT_SYMBOL(nvhost_syncpt_unit_interface_get_byte_offset);
|
||||
HOST1X_EMU_EXPORT_DECL(int, nvhost_syncpt_unit_interface_get_aperture(struct platform_device *pdev,
|
||||
u64 *base, size_t *size))
|
||||
{
|
||||
struct nvhost_device_data *pdata = platform_get_drvdata(pdev);
|
||||
struct platform_device *host1x_pdev;
|
||||
struct host1x *host1x;
|
||||
|
||||
*base = pdata->host1x->syncpt_phy_apt;
|
||||
*size = pdata->host1x->syncpt_page_size * pdata->host1x->syncpt_count;
|
||||
return 0;
|
||||
host1x_pdev = HOST1X_EMU_EXPORT_CALL(nvhost_get_default_device());
|
||||
if (WARN_ON(!host1x_pdev))
|
||||
return 0;
|
||||
|
||||
host1x = platform_get_drvdata(host1x_pdev);
|
||||
if (!host1x) {
|
||||
pr_info("No platform data for host1x!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
*base = host1x->syncpt_phy_apt;
|
||||
*size = host1x->syncpt_page_size * host1x->syncpt_count;
|
||||
return 0;
|
||||
}
|
||||
HOST1X_EMU_EXPORT_SYMBOL(nvhost_syncpt_unit_interface_get_aperture);
|
||||
|
||||
|
||||
@@ -313,20 +313,21 @@ HOST1X_EMU_EXPORT_DECL(struct host1x_syncpt*, host1x_syncpt_alloc(struct host1x
|
||||
* TODO: Optimize syncpoint allocation, serial allocation
|
||||
* dosen't effectively utilize per pool polling thread.
|
||||
*/
|
||||
for (i = host->syncpt_base; i < host->syncpt_end; i++, sp++) {
|
||||
/* FIXME: WAR to allocate syncpoint from index 1, As at client level synpt-id 0 is invalid*/
|
||||
for (i = host->syncpt_base + 1; i < host->syncpt_end; i++, sp++) {
|
||||
|
||||
/* Do pool verification if pool selected */
|
||||
if ((pool != NULL) && (sp->pool != pool))
|
||||
continue;
|
||||
/* Do pool verification if pool selected */
|
||||
if ((pool != NULL) && (sp->pool != pool))
|
||||
continue;
|
||||
|
||||
/* Skip if pool is read only pool */
|
||||
if (sp->pool == &host->pools[host->ro_pool_id])
|
||||
continue;
|
||||
/* Skip if pool is read only pool */
|
||||
if (sp->pool == &host->pools[host->ro_pool_id])
|
||||
continue;
|
||||
|
||||
if (kref_read(&sp->ref) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (kref_read(&sp->ref) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= host->syncpt_end) {
|
||||
goto unlock;
|
||||
|
||||
Reference in New Issue
Block a user