mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: remove gfxp_wfi_timeout_count/unit fields from gr.ctx_vars struct
gfxp_wfi_timeout_count/unit fields were stored in gr_gk20a.ctx_vars struct so that any user could configure them through sysfs nodes But the sysfs nodes are legacy and not being actively used by anyone. Hence delete the sysfs nodes to configure these fields. Since the gfxp timeout unit/count can now be statically programmed, make following changes - remove g->ops.gr.init_gfxp_wfi_timeout_count() hal - remove g->ops.gr.get_max_gfxp_wfi_timeout_count() hal - update g->ops.gr.init.preemption_state() hals to configure the values using macros instead of caller passing the values - update g->ops.gr.init.gfxp_wfi_timeout() hals to configure the values using macros instead of caller passing the values Finally, we don't need to store gfxp_wfi_timeout_count/unit fields anymore, hence delete them from gr_gk20a.ctx_vars Jira NVGPU-3112 Change-Id: Idbe5ab3053228dd177aca253545aac36d38ca8ad Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2100219 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
77140c1a84
commit
d0907087c1
@@ -985,103 +985,6 @@ static ssize_t max_timeslice_us_store(struct device *dev,
|
||||
static DEVICE_ATTR(max_timeslice_us, ROOTRW, max_timeslice_us_read,
|
||||
max_timeslice_us_store);
|
||||
|
||||
static ssize_t gfxp_wfi_timeout_count_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
struct gk20a *g = get_gk20a(dev);
|
||||
struct nvgpu_gr *gr = g->gr;
|
||||
unsigned long val = 0;
|
||||
int err = -1;
|
||||
|
||||
if (kstrtoul(buf, 10, &val) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (g->ops.gr.get_max_gfxp_wfi_timeout_count) {
|
||||
if (val >= g->ops.gr.get_max_gfxp_wfi_timeout_count(g))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
gr->gfxp_wfi_timeout_count = val;
|
||||
|
||||
if (g->ops.gr.init.preemption_state && g->power_on) {
|
||||
err = gk20a_busy(g);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = nvgpu_pg_elpg_protected_call(g,
|
||||
g->ops.gr.init.preemption_state(g,
|
||||
gr->gfxp_wfi_timeout_count,
|
||||
gr->gfxp_wfi_timeout_unit_usec));
|
||||
|
||||
gk20a_idle(g);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t gfxp_wfi_timeout_unit_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
struct gk20a *g = get_gk20a(dev);
|
||||
struct nvgpu_gr *gr = g->gr;
|
||||
int err = -1;
|
||||
|
||||
if (count > 0 && buf[0] == 's')
|
||||
/* sysclk */
|
||||
gr->gfxp_wfi_timeout_unit_usec = false;
|
||||
else
|
||||
/* usec */
|
||||
gr->gfxp_wfi_timeout_unit_usec = true;
|
||||
|
||||
if (g->ops.gr.init.preemption_state && g->power_on) {
|
||||
err = gk20a_busy(g);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = nvgpu_pg_elpg_protected_call(g,
|
||||
g->ops.gr.init.preemption_state(g,
|
||||
gr->gfxp_wfi_timeout_count,
|
||||
gr->gfxp_wfi_timeout_unit_usec));
|
||||
|
||||
gk20a_idle(g);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t gfxp_wfi_timeout_count_read(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct gk20a *g = get_gk20a(dev);
|
||||
struct nvgpu_gr *gr = g->gr;
|
||||
u32 val = gr->gfxp_wfi_timeout_count;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", val);
|
||||
}
|
||||
|
||||
static ssize_t gfxp_wfi_timeout_unit_read(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct gk20a *g = get_gk20a(dev);
|
||||
struct nvgpu_gr *gr = g->gr;
|
||||
|
||||
if (gr->gfxp_wfi_timeout_unit_usec)
|
||||
return snprintf(buf, PAGE_SIZE, "usec\n");
|
||||
else
|
||||
return snprintf(buf, PAGE_SIZE, "sysclk\n");
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(gfxp_wfi_timeout_count, (S_IRWXU|S_IRGRP|S_IROTH),
|
||||
gfxp_wfi_timeout_count_read, gfxp_wfi_timeout_count_store);
|
||||
|
||||
static DEVICE_ATTR(gfxp_wfi_timeout_unit, (S_IRWXU|S_IRGRP|S_IROTH),
|
||||
gfxp_wfi_timeout_unit_read, gfxp_wfi_timeout_unit_store);
|
||||
|
||||
static ssize_t comptag_mem_deduct_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
@@ -1152,8 +1055,6 @@ void nvgpu_remove_sysfs(struct device *dev)
|
||||
nvgpu_nvhost_remove_symlink(get_gk20a(dev));
|
||||
#endif
|
||||
|
||||
device_remove_file(dev, &dev_attr_gfxp_wfi_timeout_count);
|
||||
device_remove_file(dev, &dev_attr_gfxp_wfi_timeout_unit);
|
||||
device_remove_file(dev, &dev_attr_gpu_powered_on);
|
||||
|
||||
device_remove_file(dev, &dev_attr_comptag_mem_deduct);
|
||||
@@ -1205,8 +1106,6 @@ int nvgpu_create_sysfs(struct device *dev)
|
||||
error |= nvgpu_nvhost_create_symlink(g);
|
||||
#endif
|
||||
|
||||
error |= device_create_file(dev, &dev_attr_gfxp_wfi_timeout_count);
|
||||
error |= device_create_file(dev, &dev_attr_gfxp_wfi_timeout_unit);
|
||||
error |= device_create_file(dev, &dev_attr_gpu_powered_on);
|
||||
|
||||
error |= device_create_file(dev, &dev_attr_comptag_mem_deduct);
|
||||
|
||||
Reference in New Issue
Block a user