summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
index 7e0183ca..bec18328 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
@@ -520,6 +520,43 @@ static ssize_t force_idle_read(struct device *device,
520static DEVICE_ATTR(force_idle, ROOTRW, force_idle_read, force_idle_store); 520static DEVICE_ATTR(force_idle, ROOTRW, force_idle_read, force_idle_store);
521#endif 521#endif
522 522
523static ssize_t tpc_fs_mask_store(struct device *device,
524 struct device_attribute *attr, const char *buf, size_t count)
525{
526 struct platform_device *ndev = to_platform_device(device);
527 struct gk20a *g = get_gk20a(ndev);
528 unsigned long val = 0;
529
530 if (kstrtoul(buf, 10, &val) < 0)
531 return -EINVAL;
532
533 if (val)
534 g->gr.gpc_tpc_mask[0] = val;
535
536 return count;
537}
538
539static ssize_t tpc_fs_mask_read(struct device *device,
540 struct device_attribute *attr, char *buf)
541{
542 struct platform_device *ndev = to_platform_device(device);
543 struct gk20a *g = get_gk20a(ndev);
544 struct gr_gk20a *gr = &g->gr;
545 u32 gpc_index;
546 u32 tpc_fs_mask = 0;
547
548 for (gpc_index = 0; gpc_index < gr->gpc_count; gpc_index++) {
549 if (g->ops.gr.get_gpc_tpc_mask)
550 tpc_fs_mask |=
551 g->ops.gr.get_gpc_tpc_mask(g, gpc_index) <<
552 (gr->max_tpc_per_gpc_count * gpc_index);
553 }
554
555 return sprintf(buf, "0x%x\n", tpc_fs_mask);
556}
557
558static DEVICE_ATTR(tpc_fs_mask, S_IRWXUGO, tpc_fs_mask_read, tpc_fs_mask_store);
559
523void gk20a_remove_sysfs(struct device *dev) 560void gk20a_remove_sysfs(struct device *dev)
524{ 561{
525 struct gk20a *g = get_gk20a(to_platform_device(dev)); 562 struct gk20a *g = get_gk20a(to_platform_device(dev));
@@ -540,6 +577,7 @@ void gk20a_remove_sysfs(struct device *dev)
540 device_remove_file(dev, &dev_attr_aelpg_param); 577 device_remove_file(dev, &dev_attr_aelpg_param);
541 device_remove_file(dev, &dev_attr_aelpg_enable); 578 device_remove_file(dev, &dev_attr_aelpg_enable);
542 device_remove_file(dev, &dev_attr_allow_all); 579 device_remove_file(dev, &dev_attr_allow_all);
580 device_remove_file(dev, &dev_attr_tpc_fs_mask);
543 581
544 if (g->host1x_dev && (dev->parent != &g->host1x_dev->dev)) 582 if (g->host1x_dev && (dev->parent != &g->host1x_dev->dev))
545 sysfs_remove_link(&dev->kobj, dev_name(dev)); 583 sysfs_remove_link(&dev->kobj, dev_name(dev));
@@ -566,6 +604,7 @@ void gk20a_create_sysfs(struct platform_device *dev)
566 error |= device_create_file(&dev->dev, &dev_attr_aelpg_param); 604 error |= device_create_file(&dev->dev, &dev_attr_aelpg_param);
567 error |= device_create_file(&dev->dev, &dev_attr_aelpg_enable); 605 error |= device_create_file(&dev->dev, &dev_attr_aelpg_enable);
568 error |= device_create_file(&dev->dev, &dev_attr_allow_all); 606 error |= device_create_file(&dev->dev, &dev_attr_allow_all);
607 error |= device_create_file(&dev->dev, &dev_attr_tpc_fs_mask);
569 608
570 if (g->host1x_dev && (dev->dev.parent != &g->host1x_dev->dev)) 609 if (g->host1x_dev && (dev->dev.parent != &g->host1x_dev->dev))
571 error |= sysfs_create_link(&g->host1x_dev->dev.kobj, 610 error |= sysfs_create_link(&g->host1x_dev->dev.kobj,