Loading drivers/gpu/msm/adreno.c +2 −0 Original line number Diff line number Diff line Loading @@ -1552,6 +1552,8 @@ int adreno_device_probe(struct platform_device *pdev, adreno_debugfs_init(adreno_dev); adreno_profile_init(adreno_dev); adreno_dev->perfcounter = false; adreno_sysfs_init(adreno_dev); kgsl_pwrscale_init(device, pdev, CONFIG_QCOM_ADRENO_DEFAULT_GOVERNOR); Loading drivers/gpu/msm/adreno.h +6 −0 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2008-2021, The Linux Foundation. All rights reserved. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef __ADRENO_H #define __ADRENO_H Loading Loading @@ -576,6 +577,11 @@ struct adreno_device { const void *cp_init_cmds; /** @irq_mask: The current interrupt mask for the GPU device */ u32 irq_mask; /* * @perfcounter: Flag to clear perfcounters across contexts and * controls perfcounter ioctl read */ bool perfcounter; }; /** Loading drivers/gpu/msm/adreno_compat.c +9 −0 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include "adreno.h" Loading Loading @@ -158,6 +159,14 @@ static long adreno_ioctl_perfcounter_read_compat( struct kgsl_perfcounter_read_compat *read32 = data; struct kgsl_perfcounter_read read; /* * When performance counter zapping is enabled, the counters are cleared * across context switches. Reading the counters when they are zapped is * not permitted. */ if (!adreno_dev->perfcounter) return -EPERM; read.reads = (struct kgsl_perfcounter_read_group __user *) (uintptr_t)read32->reads; read.count = read32->count; Loading drivers/gpu/msm/adreno_ioctl.c +9 −0 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2002,2007-2021, The Linux Foundation. All rights reserved. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/slab.h> Loading Loading @@ -133,6 +134,14 @@ static long adreno_ioctl_perfcounter_read(struct kgsl_device_private *dev_priv, struct adreno_device *adreno_dev = ADRENO_DEVICE(dev_priv->device); struct kgsl_perfcounter_read *read = data; /* * When performance counter zapping is enabled, the counters are cleared * across context switches. Reading the counters when they are zapped is * not permitted. */ if (!adreno_dev->perfcounter) return -EPERM; return (long) adreno_perfcounter_read_group(adreno_dev, read->reads, read->count); } Loading drivers/gpu/msm/adreno_sysfs.c +24 −1 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/sysfs.h> Loading Loading @@ -188,6 +189,19 @@ static int _bcl_store(struct adreno_device *adreno_dev, bool val) val); } static bool _perfcounter_show(struct adreno_device *adreno_dev) { return adreno_dev->perfcounter; } static int _perfcounter_store(struct adreno_device *adreno_dev, bool val) { if (adreno_dev->perfcounter == val) return 0; return adreno_power_cycle_bool(adreno_dev, &adreno_dev->perfcounter, val); } ssize_t adreno_sysfs_store_u32(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { Loading Loading @@ -266,6 +280,7 @@ static ADRENO_SYSFS_BOOL(ifpc); static ADRENO_SYSFS_RO_U32(ifpc_count); static ADRENO_SYSFS_BOOL(acd); static ADRENO_SYSFS_BOOL(bcl); static ADRENO_SYSFS_BOOL(perfcounter); static const struct attribute *_attr_list[] = { Loading @@ -285,6 +300,7 @@ static const struct attribute *_attr_list[] = { &adreno_attr_ifpc_count.attr.attr, &adreno_attr_acd.attr.attr, &adreno_attr_bcl.attr.attr, &adreno_attr_perfcounter.attr.attr, NULL, }; Loading @@ -311,7 +327,14 @@ void adreno_sysfs_close(struct adreno_device *adreno_dev) int adreno_sysfs_init(struct adreno_device *adreno_dev) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); int ret; return sysfs_create_files(&device->dev->kobj, _attr_list); ret = sysfs_create_files(&device->dev->kobj, _attr_list); /* Notify userspace */ if (!ret) kobject_uevent(&device->dev->kobj, KOBJ_ADD); return ret; } Loading
drivers/gpu/msm/adreno.c +2 −0 Original line number Diff line number Diff line Loading @@ -1552,6 +1552,8 @@ int adreno_device_probe(struct platform_device *pdev, adreno_debugfs_init(adreno_dev); adreno_profile_init(adreno_dev); adreno_dev->perfcounter = false; adreno_sysfs_init(adreno_dev); kgsl_pwrscale_init(device, pdev, CONFIG_QCOM_ADRENO_DEFAULT_GOVERNOR); Loading
drivers/gpu/msm/adreno.h +6 −0 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2008-2021, The Linux Foundation. All rights reserved. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef __ADRENO_H #define __ADRENO_H Loading Loading @@ -576,6 +577,11 @@ struct adreno_device { const void *cp_init_cmds; /** @irq_mask: The current interrupt mask for the GPU device */ u32 irq_mask; /* * @perfcounter: Flag to clear perfcounters across contexts and * controls perfcounter ioctl read */ bool perfcounter; }; /** Loading
drivers/gpu/msm/adreno_compat.c +9 −0 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include "adreno.h" Loading Loading @@ -158,6 +159,14 @@ static long adreno_ioctl_perfcounter_read_compat( struct kgsl_perfcounter_read_compat *read32 = data; struct kgsl_perfcounter_read read; /* * When performance counter zapping is enabled, the counters are cleared * across context switches. Reading the counters when they are zapped is * not permitted. */ if (!adreno_dev->perfcounter) return -EPERM; read.reads = (struct kgsl_perfcounter_read_group __user *) (uintptr_t)read32->reads; read.count = read32->count; Loading
drivers/gpu/msm/adreno_ioctl.c +9 −0 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2002,2007-2021, The Linux Foundation. All rights reserved. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/slab.h> Loading Loading @@ -133,6 +134,14 @@ static long adreno_ioctl_perfcounter_read(struct kgsl_device_private *dev_priv, struct adreno_device *adreno_dev = ADRENO_DEVICE(dev_priv->device); struct kgsl_perfcounter_read *read = data; /* * When performance counter zapping is enabled, the counters are cleared * across context switches. Reading the counters when they are zapped is * not permitted. */ if (!adreno_dev->perfcounter) return -EPERM; return (long) adreno_perfcounter_read_group(adreno_dev, read->reads, read->count); } Loading
drivers/gpu/msm/adreno_sysfs.c +24 −1 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/sysfs.h> Loading Loading @@ -188,6 +189,19 @@ static int _bcl_store(struct adreno_device *adreno_dev, bool val) val); } static bool _perfcounter_show(struct adreno_device *adreno_dev) { return adreno_dev->perfcounter; } static int _perfcounter_store(struct adreno_device *adreno_dev, bool val) { if (adreno_dev->perfcounter == val) return 0; return adreno_power_cycle_bool(adreno_dev, &adreno_dev->perfcounter, val); } ssize_t adreno_sysfs_store_u32(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { Loading Loading @@ -266,6 +280,7 @@ static ADRENO_SYSFS_BOOL(ifpc); static ADRENO_SYSFS_RO_U32(ifpc_count); static ADRENO_SYSFS_BOOL(acd); static ADRENO_SYSFS_BOOL(bcl); static ADRENO_SYSFS_BOOL(perfcounter); static const struct attribute *_attr_list[] = { Loading @@ -285,6 +300,7 @@ static const struct attribute *_attr_list[] = { &adreno_attr_ifpc_count.attr.attr, &adreno_attr_acd.attr.attr, &adreno_attr_bcl.attr.attr, &adreno_attr_perfcounter.attr.attr, NULL, }; Loading @@ -311,7 +327,14 @@ void adreno_sysfs_close(struct adreno_device *adreno_dev) int adreno_sysfs_init(struct adreno_device *adreno_dev) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); int ret; return sysfs_create_files(&device->dev->kobj, _attr_list); ret = sysfs_create_files(&device->dev->kobj, _attr_list); /* Notify userspace */ if (!ret) kobject_uevent(&device->dev->kobj, KOBJ_ADD); return ret; }