Skip to content

Commit

Permalink
Merge commit #2 from hxsyzl/pelt
Browse files Browse the repository at this point in the history
Add pelt branch modifications
  • Loading branch information
hxsyzl authored Feb 10, 2025
2 parents 8557df6 + ecc0a24 commit 070406b
Show file tree
Hide file tree
Showing 45 changed files with 2,037 additions and 1,859 deletions.
9 changes: 9 additions & 0 deletions drivers/base/arch_topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/string.h>
#include <linux/sched/topology.h>
#include <linux/sched/energy.h>
#include <linux/sched/sysctl.h>
#include <linux/cpuset.h>

DEFINE_PER_CPU(unsigned long, freq_scale) = SCHED_CAPACITY_SCALE;
Expand Down Expand Up @@ -76,6 +77,9 @@ static ssize_t cpu_capacity_show(struct device *dev,
{
struct cpu *cpu = container_of(dev, struct cpu, dev);

if (is_sched_lib_based_app(current->pid))
return scnprintf(buf, PAGE_SIZE, "%lu\n", SCHED_CAPACITY_SCALE);

return sprintf(buf, "%lu\n", topology_get_cpu_scale(NULL, cpu->dev.id));
}

Expand Down Expand Up @@ -184,20 +188,25 @@ int detect_share_cap_flag(void)
if (cpumask_equal(cpu_cpu_mask(cpu),
policy->related_cpus)) {
share_cap_level = share_cap_die;
cpufreq_cpu_put(policy);
continue;
}

if (cpumask_equal(topology_core_cpumask(cpu),
policy->related_cpus)) {
share_cap_level = share_cap_core;
cpufreq_cpu_put(policy);
continue;
}

if (cpumask_equal(topology_sibling_cpumask(cpu),
policy->related_cpus)) {
share_cap_level = share_cap_thread;
cpufreq_cpu_put(policy);
continue;
}

cpufreq_cpu_put(policy);
}

if (share_cap != share_cap_level) {
Expand Down
8 changes: 4 additions & 4 deletions drivers/block/zram/zram_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ static ssize_t read_block_state(struct file *file, char __user *buf,
zram_test_flag(zram, index, ZRAM_IDLE) ? 'i' : '.',
zram_test_flag(zram, index, ZRAM_DEDUPED) ? 'd' : '.');

if (count < copied) {
if (count <= copied) {
zram_slot_unlock(zram, index);
break;
}
Expand Down Expand Up @@ -1847,7 +1847,7 @@ static void __zram_make_request(struct zram *zram, struct bio *bio)
*/
static blk_qc_t zram_make_request(struct request_queue *queue, struct bio *bio)
{
struct zram *zram = queue->queuedata;
struct zram *zram = bio->bi_disk->private_data;

if (!valid_io_request(zram, bio->bi_iter.bi_sector,
bio->bi_iter.bi_size)) {
Expand Down Expand Up @@ -1952,12 +1952,13 @@ static void zram_reset_device(struct zram *zram)
set_capacity(zram->disk, 0);
part_stat_set_all(&zram->disk->part0, 0);

up_write(&zram->init_lock);
/* I/O operation under all of CPU are done so let's free */
zram_meta_free(zram, disksize);
memset(&zram->stats, 0, sizeof(zram->stats));
zcomp_destroy(comp);
reset_bdev(zram);

up_write(&zram->init_lock);
}

static ssize_t disksize_store(struct device *dev,
Expand Down Expand Up @@ -2175,7 +2176,6 @@ static int zram_add(void)
zram->disk->first_minor = device_id;
zram->disk->fops = &zram_devops;
zram->disk->queue = queue;
zram->disk->queue->queuedata = zram;
zram->disk->private_data = zram;
snprintf(zram->disk->disk_name, 16, "zram%d", device_id);

Expand Down
2 changes: 1 addition & 1 deletion drivers/char/rdbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct rdbg_device {

int registers[32] = {0};
static struct rdbg_device g_rdbg_instance = {
{ {0} },
{},
NULL,
0,
SMP2P_NUM_PROCS,
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/qcom/clk-cpu-osm.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ static int osm_cpufreq_cpu_init(struct cpufreq_policy *policy)
if (!osm_dt_find_freq(of_table, of_len, table[i].frequency))
table[i].frequency = CPUFREQ_ENTRY_INVALID;

if (core_count == SINGLE_CORE_COUNT)
if (core_count == SINGLE_CORE_COUNT || table[i].frequency < 576000)
table[i].frequency = CPUFREQ_ENTRY_INVALID;

/* Two of the same frequencies means end of table */
Expand Down
3 changes: 0 additions & 3 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,6 @@ static ssize_t store_##file_name \
int ret, temp; \
struct cpufreq_policy new_policy; \
\
if (&policy->object == &policy->min) \
return count; \
\
memcpy(&new_policy, policy, sizeof(*policy)); \
new_policy.min = policy->user_policy.min; \
new_policy.max = policy->user_policy.max; \
Expand Down
3 changes: 1 addition & 2 deletions drivers/gpu/drm/msm/dsi-staging/dsi_clk.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,7 @@ int dsi_display_link_clk_force_update(void *handle);
*
* return: error code in case of failure or 0 for success.
*/
int dsi_display_clk_ctrl(void *handle,
enum dsi_clk_type clk_type, enum dsi_clk_state clk_state);
int dsi_display_clk_ctrl(void *handle, u32 clk_type, u32 clk_state);

/**
* dsi_clk_set_link_frequencies() - set frequencies for link clks
Expand Down
3 changes: 1 addition & 2 deletions drivers/gpu/drm/msm/dsi-staging/dsi_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -5067,8 +5067,7 @@ static int dsi_display_link_clk_force_update_ctrl(void *handle)
return rc;
}

int dsi_display_clk_ctrl(void *handle,
enum dsi_clk_type clk_type, enum dsi_clk_state clk_state)
int dsi_display_clk_ctrl(void *handle, u32 clk_type, u32 clk_state)
{
int rc = 0;

Expand Down
1 change: 0 additions & 1 deletion drivers/gpu/msm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ msm_adreno-y += \
adreno_perfcounter.o

msm_adreno-$(CONFIG_QCOM_KGSL_IOMMU) += adreno_iommu.o
msm_adreno-$(CONFIG_DEBUG_FS) += adreno_debugfs.o adreno_profile.o
msm_adreno-$(CONFIG_COMPAT) += adreno_compat.o

msm_kgsl_core-objs = $(msm_kgsl_core-y)
Expand Down
73 changes: 25 additions & 48 deletions drivers/gpu/msm/adreno.h
Original file line number Diff line number Diff line change
Expand Up @@ -1220,13 +1220,12 @@ u32 adreno_get_ucode_version(const u32 *data);
#define ADRENO_TARGET(_name, _id) \
static inline int adreno_is_##_name(struct adreno_device *adreno_dev) \
{ \
return (ADRENO_GPUREV(adreno_dev) == (_id)); \
return 0; \
}

static inline int adreno_is_a3xx(struct adreno_device *adreno_dev)
{
return ((ADRENO_GPUREV(adreno_dev) >= 300) &&
(ADRENO_GPUREV(adreno_dev) < 400));
return 0;
}

ADRENO_TARGET(a304, ADRENO_REV_A304)
Expand All @@ -1241,28 +1240,24 @@ ADRENO_TARGET(a330, ADRENO_REV_A330)

static inline int adreno_is_a330v2(struct adreno_device *adreno_dev)
{
return ((ADRENO_GPUREV(adreno_dev) == ADRENO_REV_A330) &&
(ADRENO_CHIPID_PATCH(adreno_dev->chipid) > 0));
return 0;
}

static inline int adreno_is_a330v21(struct adreno_device *adreno_dev)
{
return ((ADRENO_GPUREV(adreno_dev) == ADRENO_REV_A330) &&
(ADRENO_CHIPID_PATCH(adreno_dev->chipid) > 0xF));
return 0;
}

static inline int adreno_is_a4xx(struct adreno_device *adreno_dev)
{
return ADRENO_GPUREV(adreno_dev) >= 400 &&
ADRENO_GPUREV(adreno_dev) < 500;
return 0;
}

ADRENO_TARGET(a405, ADRENO_REV_A405);

static inline int adreno_is_a405v2(struct adreno_device *adreno_dev)
{
return (ADRENO_GPUREV(adreno_dev) == ADRENO_REV_A405) &&
(ADRENO_CHIPID_PATCH(adreno_dev->chipid) == 0x10);
return 0;
}

ADRENO_TARGET(a418, ADRENO_REV_A418)
Expand All @@ -1271,14 +1266,12 @@ ADRENO_TARGET(a430, ADRENO_REV_A430)

static inline int adreno_is_a430v2(struct adreno_device *adreno_dev)
{
return ((ADRENO_GPUREV(adreno_dev) == ADRENO_REV_A430) &&
(ADRENO_CHIPID_PATCH(adreno_dev->chipid) == 1));
return 0;
}

static inline int adreno_is_a5xx(struct adreno_device *adreno_dev)
{
return ADRENO_GPUREV(adreno_dev) >= 500 &&
ADRENO_GPUREV(adreno_dev) < 600;
return 0;
}

ADRENO_TARGET(a504, ADRENO_REV_A504)
Expand All @@ -1292,51 +1285,48 @@ ADRENO_TARGET(a540, ADRENO_REV_A540)

static inline int adreno_is_a530v1(struct adreno_device *adreno_dev)
{
return (ADRENO_GPUREV(adreno_dev) == ADRENO_REV_A530) &&
(ADRENO_CHIPID_PATCH(adreno_dev->chipid) == 0);
return 0;
}

static inline int adreno_is_a530v2(struct adreno_device *adreno_dev)
{
return (ADRENO_GPUREV(adreno_dev) == ADRENO_REV_A530) &&
(ADRENO_CHIPID_PATCH(adreno_dev->chipid) == 1);
return 0;
}

static inline int adreno_is_a530v3(struct adreno_device *adreno_dev)
{
return (ADRENO_GPUREV(adreno_dev) == ADRENO_REV_A530) &&
(ADRENO_CHIPID_PATCH(adreno_dev->chipid) == 2);
return 0;
}

static inline int adreno_is_a504_to_a506(struct adreno_device *adreno_dev)
{
return ADRENO_GPUREV(adreno_dev) >= 504 &&
ADRENO_GPUREV(adreno_dev) <= 506;
return 0;
}

static inline int adreno_is_a540v1(struct adreno_device *adreno_dev)
{
return (ADRENO_GPUREV(adreno_dev) == ADRENO_REV_A540) &&
(ADRENO_CHIPID_PATCH(adreno_dev->chipid) == 0);
return 0;
}

static inline int adreno_is_a540v2(struct adreno_device *adreno_dev)
{
return (ADRENO_GPUREV(adreno_dev) == ADRENO_REV_A540) &&
(ADRENO_CHIPID_PATCH(adreno_dev->chipid) == 1);
return 0;
}

static inline int adreno_is_a6xx(struct adreno_device *adreno_dev)
{
return ADRENO_GPUREV(adreno_dev) >= 600 &&
ADRENO_GPUREV(adreno_dev) < 700;
return 1;
}

static inline int adreno_is_a640(struct adreno_device *adreno_dev)
{
return 1;
}

ADRENO_TARGET(a610, ADRENO_REV_A610)
ADRENO_TARGET(a612, ADRENO_REV_A612)
ADRENO_TARGET(a618, ADRENO_REV_A618)
ADRENO_TARGET(a630, ADRENO_REV_A630)
ADRENO_TARGET(a640, ADRENO_REV_A640)
ADRENO_TARGET(a680, ADRENO_REV_A680)

/*
Expand All @@ -1345,22 +1335,17 @@ ADRENO_TARGET(a680, ADRENO_REV_A680)
*/
static inline int adreno_is_a615_family(struct adreno_device *adreno_dev)
{
unsigned int rev = ADRENO_GPUREV(adreno_dev);

return (rev == ADRENO_REV_A615 || rev == ADRENO_REV_A616 ||
rev == ADRENO_REV_A618);
return 0;
}

static inline int adreno_is_a630v1(struct adreno_device *adreno_dev)
{
return (ADRENO_GPUREV(adreno_dev) == ADRENO_REV_A630) &&
(ADRENO_CHIPID_PATCH(adreno_dev->chipid) == 0);
return 0;
}

static inline int adreno_is_a630v2(struct adreno_device *adreno_dev)
{
return (ADRENO_GPUREV(adreno_dev) == ADRENO_REV_A630) &&
(ADRENO_CHIPID_PATCH(adreno_dev->chipid) == 1);
return 0;
}

static inline int adreno_is_a640v1(struct adreno_device *adreno_dev)
Expand All @@ -1377,14 +1362,12 @@ static inline int adreno_is_a640v2(struct adreno_device *adreno_dev)

static inline int adreno_is_a680v1(struct adreno_device *adreno_dev)
{
return (ADRENO_GPUREV(adreno_dev) == ADRENO_REV_A680) &&
(ADRENO_CHIPID_PATCH(adreno_dev->chipid) == 0);
return 0;
}

static inline int adreno_is_a680v2(struct adreno_device *adreno_dev)
{
return (ADRENO_GPUREV(adreno_dev) == ADRENO_REV_A680) &&
(ADRENO_CHIPID_PATCH(adreno_dev->chipid) == 1);
return 0;
}

/*
Expand Down Expand Up @@ -1691,16 +1674,10 @@ static inline void adreno_set_protected_registers(
*index = *index + 1;
}

#ifdef CONFIG_DEBUG_FS
void adreno_debugfs_init(struct adreno_device *adreno_dev);
void adreno_context_debugfs_init(struct adreno_device *adreno_dev,
struct adreno_context *ctx);
#else
static inline void adreno_debugfs_init(struct adreno_device *adreno_dev) { }
static inline void adreno_context_debugfs_init(struct adreno_device *device,
struct adreno_context *context)
{ }
#endif

/**
* adreno_compare_pm4_version() - Compare the PM4 microcode version
Expand Down
11 changes: 0 additions & 11 deletions drivers/gpu/msm/adreno_profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@ struct adreno_profile {
#define ADRENO_PROFILE_LOG_BUF_SIZE_DWORDS (ADRENO_PROFILE_LOG_BUF_SIZE / \
sizeof(unsigned int))

#ifdef CONFIG_DEBUG_FS
void adreno_profile_init(struct adreno_device *adreno_dev);
void adreno_profile_close(struct adreno_device *adreno_dev);
int adreno_profile_process_results(struct adreno_device *adreno_dev);
void adreno_profile_preib_processing(struct adreno_device *adreno_dev,
struct adreno_context *drawctxt, unsigned int *cmd_flags,
unsigned int **rbptr);
void adreno_profile_postib_processing(struct adreno_device *adreno_dev,
unsigned int *cmd_flags, unsigned int **rbptr);
#else
static inline void adreno_profile_init(struct adreno_device *adreno_dev) { }
static inline void adreno_profile_close(struct adreno_device *adreno_dev) { }
static inline int adreno_profile_process_results(
Expand All @@ -88,7 +78,6 @@ static inline void adreno_profile_preib_processing(
static inline void adreno_profile_postib_processing(
struct adreno_device *adreno_dev,
unsigned int *cmd_flags, unsigned int **rbptr) { }
#endif

static inline bool adreno_profile_enabled(struct adreno_profile *profile)
{
Expand Down
5 changes: 0 additions & 5 deletions drivers/gpu/msm/kgsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -4949,9 +4949,6 @@ int kgsl_device_platform_probe(struct kgsl_device *device)
if (status)
return status;

/* Initialize logging first, so that failures below actually print. */
kgsl_device_debugfs_init(device);

/* Disable the sparse ioctl invocation as they are not used */
device->flags &= ~KGSL_FLAG_SPARSE;

Expand Down Expand Up @@ -5094,7 +5091,6 @@ int kgsl_device_platform_probe(struct kgsl_device *device)
error_pwrctrl_close:
kgsl_pwrctrl_close(device);
error:
kgsl_device_debugfs_close(device);
_unregister_device(device);
return status;
}
Expand Down Expand Up @@ -5123,7 +5119,6 @@ void kgsl_device_platform_remove(struct kgsl_device *device)

kgsl_pwrctrl_close(device);

kgsl_device_debugfs_close(device);
_unregister_device(device);
}
EXPORT_SYMBOL(kgsl_device_platform_remove);
Expand Down
Loading

0 comments on commit 070406b

Please sign in to comment.