Message ID | 20240716201302.2939894-5-adrian.larumbe@collabora.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Support fdinfo runtime and memory stats on Panthor | expand |
On 16/07/2024 21:11, Adrián Larumbe wrote: > This commit introduces a DRM device sysfs attribute that lets UM control > the job accounting status in the device. The knob variable had been brought > in as part of a previous commit, but now we're able to fix it manually. > > Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com> Reviewed-by: Steven Price <steven.price@arm.com> Although we should probably copy/paste Documentation/ABI/testing/sysfs-driver-panfrost-profiling - or at least mention somewhere that the same knob is available for panthor. Steve > --- > drivers/gpu/drm/panthor/panthor_drv.c | 36 +++++++++++++++++++++++++++ > 1 file changed, 36 insertions(+) > > diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c > index 6a0c1a06a709..a2876310856f 100644 > --- a/drivers/gpu/drm/panthor/panthor_drv.c > +++ b/drivers/gpu/drm/panthor/panthor_drv.c > @@ -1448,6 +1448,41 @@ static void panthor_remove(struct platform_device *pdev) > panthor_device_unplug(ptdev); > } > > +static ssize_t profiling_show(struct device *dev, > + struct device_attribute *attr, > + char *buf) > +{ > + struct panthor_device *ptdev = dev_get_drvdata(dev); > + > + return sysfs_emit(buf, "%d\n", ptdev->profile_mode); > +} > + > +static ssize_t profiling_store(struct device *dev, > + struct device_attribute *attr, > + const char *buf, size_t len) > +{ > + struct panthor_device *ptdev = dev_get_drvdata(dev); > + bool value; > + int err; > + > + err = kstrtobool(buf, &value); > + if (err) > + return err; > + > + ptdev->profile_mode = value; > + > + return len; > +} > + > +static DEVICE_ATTR_RW(profiling); > + > +static struct attribute *panthor_attrs[] = { > + &dev_attr_profiling.attr, > + NULL, > +}; > + > +ATTRIBUTE_GROUPS(panthor); > + > static const struct of_device_id dt_match[] = { > { .compatible = "rockchip,rk3588-mali" }, > { .compatible = "arm,mali-valhall-csf" }, > @@ -1467,6 +1502,7 @@ static struct platform_driver panthor_driver = { > .name = "panthor", > .pm = pm_ptr(&panthor_pm_ops), > .of_match_table = dt_match, > + .dev_groups = panthor_groups, > }, > }; >
diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c index 6a0c1a06a709..a2876310856f 100644 --- a/drivers/gpu/drm/panthor/panthor_drv.c +++ b/drivers/gpu/drm/panthor/panthor_drv.c @@ -1448,6 +1448,41 @@ static void panthor_remove(struct platform_device *pdev) panthor_device_unplug(ptdev); } +static ssize_t profiling_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct panthor_device *ptdev = dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d\n", ptdev->profile_mode); +} + +static ssize_t profiling_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct panthor_device *ptdev = dev_get_drvdata(dev); + bool value; + int err; + + err = kstrtobool(buf, &value); + if (err) + return err; + + ptdev->profile_mode = value; + + return len; +} + +static DEVICE_ATTR_RW(profiling); + +static struct attribute *panthor_attrs[] = { + &dev_attr_profiling.attr, + NULL, +}; + +ATTRIBUTE_GROUPS(panthor); + static const struct of_device_id dt_match[] = { { .compatible = "rockchip,rk3588-mali" }, { .compatible = "arm,mali-valhall-csf" }, @@ -1467,6 +1502,7 @@ static struct platform_driver panthor_driver = { .name = "panthor", .pm = pm_ptr(&panthor_pm_ops), .of_match_table = dt_match, + .dev_groups = panthor_groups, }, };
This commit introduces a DRM device sysfs attribute that lets UM control the job accounting status in the device. The knob variable had been brought in as part of a previous commit, but now we're able to fix it manually. Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com> --- drivers/gpu/drm/panthor/panthor_drv.c | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)