From: kernel test robot <lkp@intel.com>
To: Sascha Hauer <s.hauer@pengutronix.de>,
linux-rockchip@lists.infradead.org
Cc: oe-kbuild-all@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
Heiko Stuebner <heiko@sntech.de>,
Chanwoo Choi <chanwoo@kernel.org>,
Kyungmin Park <kyungmin.park@samsung.com>,
MyungJoo Ham <myungjoo.ham@samsung.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
kernel@pengutronix.de,
Michael Riesch <michael.riesch@wolfvision.net>,
Robin Murphy <robin.murphy@arm.com>,
Vincent Legoll <vincent.legoll@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzk@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
devicetree@vger.kernel.org,
Sebastian Reichel <sebastian.reichel@collabora.com>,
Sascha Hauer <s.hauer@pengutronix.de>
Subject: Re: [PATCH v8 16/26] PM / devfreq: rockchip-dfi: Add perf support
Date: Wed, 18 Oct 2023 15:58:04 +0800 [thread overview]
Message-ID: <202310181557.GIXGL21M-lkp@intel.com> (raw)
In-Reply-To: <20231018061714.3553817-17-s.hauer@pengutronix.de>
Hi Sascha,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.6-rc6]
[cannot apply to next-20231018]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sascha-Hauer/PM-devfreq-rockchip-dfi-Make-pmu-regmap-mandatory/20231018-142228
base: linus/master
patch link: https://lore.kernel.org/r/20231018061714.3553817-17-s.hauer%40pengutronix.de
patch subject: [PATCH v8 16/26] PM / devfreq: rockchip-dfi: Add perf support
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20231018/202310181557.GIXGL21M-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231018/202310181557.GIXGL21M-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310181557.GIXGL21M-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/devfreq/event/rockchip-dfi.c:203:13: warning: 'rockchip_ddr_perf_counters_add' defined but not used [-Wunused-function]
203 | static void rockchip_ddr_perf_counters_add(struct rockchip_dfi *dfi,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
>> drivers/devfreq/event/rockchip-dfi.c:79: warning: Function parameter or member 'write_access' not described in 'dmc_count_channel'
vim +/rockchip_ddr_perf_counters_add +203 drivers/devfreq/event/rockchip-dfi.c
66
67 /**
68 * struct dmc_count_channel - structure to hold counter values from the DDR controller
69 * @access: Number of read and write accesses
70 * @clock_cycles: DDR clock cycles
71 * @read_access: number of read accesses
72 * @write_acccess: number of write accesses
73 */
74 struct dmc_count_channel {
75 u64 access;
76 u64 clock_cycles;
77 u64 read_access;
78 u64 write_access;
> 79 };
80
81 struct dmc_count {
82 struct dmc_count_channel c[DMC_MAX_CHANNELS];
83 };
84
85 /*
86 * The dfi controller can monitor DDR load. It has an upper and lower threshold
87 * for the operating points. Whenever the usage leaves these bounds an event is
88 * generated to indicate the DDR frequency should be changed.
89 */
90 struct rockchip_dfi {
91 struct devfreq_event_dev *edev;
92 struct devfreq_event_desc desc;
93 struct dmc_count last_event_count;
94
95 struct dmc_count last_perf_count;
96 struct dmc_count total_count;
97 seqlock_t count_seqlock; /* protects last_perf_count and total_count */
98
99 struct device *dev;
100 void __iomem *regs;
101 struct regmap *regmap_pmu;
102 struct clk *clk;
103 int usecount;
104 struct mutex mutex;
105 u32 ddr_type;
106 unsigned int channel_mask;
107 unsigned int max_channels;
108 enum cpuhp_state cpuhp_state;
109 struct hlist_node node;
110 struct pmu pmu;
111 struct hrtimer timer;
112 unsigned int cpu;
113 int active_events;
114 int burst_len;
115 int buswidth[DMC_MAX_CHANNELS];
116 };
117
118 static int rockchip_dfi_enable(struct rockchip_dfi *dfi)
119 {
120 void __iomem *dfi_regs = dfi->regs;
121 int ret = 0;
122
123 mutex_lock(&dfi->mutex);
124
125 dfi->usecount++;
126 if (dfi->usecount > 1)
127 goto out;
128
129 ret = clk_prepare_enable(dfi->clk);
130 if (ret) {
131 dev_err(&dfi->edev->dev, "failed to enable dfi clk: %d\n", ret);
132 goto out;
133 }
134
135 /* clear DDRMON_CTRL setting */
136 writel_relaxed(HIWORD_UPDATE(0, DDRMON_CTRL_TIMER_CNT_EN | DDRMON_CTRL_SOFTWARE_EN |
137 DDRMON_CTRL_HARDWARE_EN), dfi_regs + DDRMON_CTRL);
138
139 /* set ddr type to dfi */
140 switch (dfi->ddr_type) {
141 case ROCKCHIP_DDRTYPE_LPDDR2:
142 case ROCKCHIP_DDRTYPE_LPDDR3:
143 writel_relaxed(HIWORD_UPDATE(DDRMON_CTRL_LPDDR23, DDRMON_CTRL_DDR_TYPE_MASK),
144 dfi_regs + DDRMON_CTRL);
145 break;
146 case ROCKCHIP_DDRTYPE_LPDDR4:
147 case ROCKCHIP_DDRTYPE_LPDDR4X:
148 writel_relaxed(HIWORD_UPDATE(DDRMON_CTRL_LPDDR4, DDRMON_CTRL_DDR_TYPE_MASK),
149 dfi_regs + DDRMON_CTRL);
150 break;
151 default:
152 break;
153 }
154
155 /* enable count, use software mode */
156 writel_relaxed(HIWORD_UPDATE(DDRMON_CTRL_SOFTWARE_EN, DDRMON_CTRL_SOFTWARE_EN),
157 dfi_regs + DDRMON_CTRL);
158 out:
159 mutex_unlock(&dfi->mutex);
160
161 return ret;
162 }
163
164 static void rockchip_dfi_disable(struct rockchip_dfi *dfi)
165 {
166 void __iomem *dfi_regs = dfi->regs;
167
168 mutex_lock(&dfi->mutex);
169
170 dfi->usecount--;
171
172 WARN_ON_ONCE(dfi->usecount < 0);
173
174 if (dfi->usecount > 0)
175 goto out;
176
177 writel_relaxed(HIWORD_UPDATE(0, DDRMON_CTRL_SOFTWARE_EN),
178 dfi_regs + DDRMON_CTRL);
179 clk_disable_unprepare(dfi->clk);
180 out:
181 mutex_unlock(&dfi->mutex);
182 }
183
184 static void rockchip_dfi_read_counters(struct rockchip_dfi *dfi, struct dmc_count *res)
185 {
186 u32 i;
187 void __iomem *dfi_regs = dfi->regs;
188
189 for (i = 0; i < dfi->max_channels; i++) {
190 if (!(dfi->channel_mask & BIT(i)))
191 continue;
192 res->c[i].read_access = readl_relaxed(dfi_regs +
193 DDRMON_CH0_RD_NUM + i * 20);
194 res->c[i].write_access = readl_relaxed(dfi_regs +
195 DDRMON_CH0_WR_NUM + i * 20);
196 res->c[i].access = readl_relaxed(dfi_regs +
197 DDRMON_CH0_DFI_ACCESS_NUM + i * 20);
198 res->c[i].clock_cycles = readl_relaxed(dfi_regs +
199 DDRMON_CH0_COUNT_NUM + i * 20);
200 }
201 }
202
> 203 static void rockchip_ddr_perf_counters_add(struct rockchip_dfi *dfi,
204 const struct dmc_count *now,
205 struct dmc_count *res)
206 {
207 const struct dmc_count *last = &dfi->last_perf_count;
208 int i;
209
210 for (i = 0; i < dfi->max_channels; i++) {
211 res->c[i].read_access = dfi->total_count.c[i].read_access +
212 (u32)(now->c[i].read_access - last->c[i].read_access);
213 res->c[i].write_access = dfi->total_count.c[i].write_access +
214 (u32)(now->c[i].write_access - last->c[i].write_access);
215 res->c[i].access = dfi->total_count.c[i].access +
216 (u32)(now->c[i].access - last->c[i].access);
217 res->c[i].clock_cycles = dfi->total_count.c[i].clock_cycles +
218 (u32)(now->c[i].clock_cycles - last->c[i].clock_cycles);
219 }
220 }
221
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Sascha Hauer <s.hauer@pengutronix.de>,
linux-rockchip@lists.infradead.org
Cc: oe-kbuild-all@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
Heiko Stuebner <heiko@sntech.de>,
Chanwoo Choi <chanwoo@kernel.org>,
Kyungmin Park <kyungmin.park@samsung.com>,
MyungJoo Ham <myungjoo.ham@samsung.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
kernel@pengutronix.de,
Michael Riesch <michael.riesch@wolfvision.net>,
Robin Murphy <robin.murphy@arm.com>,
Vincent Legoll <vincent.legoll@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzk@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
devicetree@vger.kernel.org,
Sebastian Reichel <sebastian.reichel@collabora.com>,
Sascha Hauer <s.hauer@pengutronix.de>
Subject: Re: [PATCH v8 16/26] PM / devfreq: rockchip-dfi: Add perf support
Date: Wed, 18 Oct 2023 15:58:04 +0800 [thread overview]
Message-ID: <202310181557.GIXGL21M-lkp@intel.com> (raw)
In-Reply-To: <20231018061714.3553817-17-s.hauer@pengutronix.de>
Hi Sascha,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.6-rc6]
[cannot apply to next-20231018]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sascha-Hauer/PM-devfreq-rockchip-dfi-Make-pmu-regmap-mandatory/20231018-142228
base: linus/master
patch link: https://lore.kernel.org/r/20231018061714.3553817-17-s.hauer%40pengutronix.de
patch subject: [PATCH v8 16/26] PM / devfreq: rockchip-dfi: Add perf support
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20231018/202310181557.GIXGL21M-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231018/202310181557.GIXGL21M-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310181557.GIXGL21M-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/devfreq/event/rockchip-dfi.c:203:13: warning: 'rockchip_ddr_perf_counters_add' defined but not used [-Wunused-function]
203 | static void rockchip_ddr_perf_counters_add(struct rockchip_dfi *dfi,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
>> drivers/devfreq/event/rockchip-dfi.c:79: warning: Function parameter or member 'write_access' not described in 'dmc_count_channel'
vim +/rockchip_ddr_perf_counters_add +203 drivers/devfreq/event/rockchip-dfi.c
66
67 /**
68 * struct dmc_count_channel - structure to hold counter values from the DDR controller
69 * @access: Number of read and write accesses
70 * @clock_cycles: DDR clock cycles
71 * @read_access: number of read accesses
72 * @write_acccess: number of write accesses
73 */
74 struct dmc_count_channel {
75 u64 access;
76 u64 clock_cycles;
77 u64 read_access;
78 u64 write_access;
> 79 };
80
81 struct dmc_count {
82 struct dmc_count_channel c[DMC_MAX_CHANNELS];
83 };
84
85 /*
86 * The dfi controller can monitor DDR load. It has an upper and lower threshold
87 * for the operating points. Whenever the usage leaves these bounds an event is
88 * generated to indicate the DDR frequency should be changed.
89 */
90 struct rockchip_dfi {
91 struct devfreq_event_dev *edev;
92 struct devfreq_event_desc desc;
93 struct dmc_count last_event_count;
94
95 struct dmc_count last_perf_count;
96 struct dmc_count total_count;
97 seqlock_t count_seqlock; /* protects last_perf_count and total_count */
98
99 struct device *dev;
100 void __iomem *regs;
101 struct regmap *regmap_pmu;
102 struct clk *clk;
103 int usecount;
104 struct mutex mutex;
105 u32 ddr_type;
106 unsigned int channel_mask;
107 unsigned int max_channels;
108 enum cpuhp_state cpuhp_state;
109 struct hlist_node node;
110 struct pmu pmu;
111 struct hrtimer timer;
112 unsigned int cpu;
113 int active_events;
114 int burst_len;
115 int buswidth[DMC_MAX_CHANNELS];
116 };
117
118 static int rockchip_dfi_enable(struct rockchip_dfi *dfi)
119 {
120 void __iomem *dfi_regs = dfi->regs;
121 int ret = 0;
122
123 mutex_lock(&dfi->mutex);
124
125 dfi->usecount++;
126 if (dfi->usecount > 1)
127 goto out;
128
129 ret = clk_prepare_enable(dfi->clk);
130 if (ret) {
131 dev_err(&dfi->edev->dev, "failed to enable dfi clk: %d\n", ret);
132 goto out;
133 }
134
135 /* clear DDRMON_CTRL setting */
136 writel_relaxed(HIWORD_UPDATE(0, DDRMON_CTRL_TIMER_CNT_EN | DDRMON_CTRL_SOFTWARE_EN |
137 DDRMON_CTRL_HARDWARE_EN), dfi_regs + DDRMON_CTRL);
138
139 /* set ddr type to dfi */
140 switch (dfi->ddr_type) {
141 case ROCKCHIP_DDRTYPE_LPDDR2:
142 case ROCKCHIP_DDRTYPE_LPDDR3:
143 writel_relaxed(HIWORD_UPDATE(DDRMON_CTRL_LPDDR23, DDRMON_CTRL_DDR_TYPE_MASK),
144 dfi_regs + DDRMON_CTRL);
145 break;
146 case ROCKCHIP_DDRTYPE_LPDDR4:
147 case ROCKCHIP_DDRTYPE_LPDDR4X:
148 writel_relaxed(HIWORD_UPDATE(DDRMON_CTRL_LPDDR4, DDRMON_CTRL_DDR_TYPE_MASK),
149 dfi_regs + DDRMON_CTRL);
150 break;
151 default:
152 break;
153 }
154
155 /* enable count, use software mode */
156 writel_relaxed(HIWORD_UPDATE(DDRMON_CTRL_SOFTWARE_EN, DDRMON_CTRL_SOFTWARE_EN),
157 dfi_regs + DDRMON_CTRL);
158 out:
159 mutex_unlock(&dfi->mutex);
160
161 return ret;
162 }
163
164 static void rockchip_dfi_disable(struct rockchip_dfi *dfi)
165 {
166 void __iomem *dfi_regs = dfi->regs;
167
168 mutex_lock(&dfi->mutex);
169
170 dfi->usecount--;
171
172 WARN_ON_ONCE(dfi->usecount < 0);
173
174 if (dfi->usecount > 0)
175 goto out;
176
177 writel_relaxed(HIWORD_UPDATE(0, DDRMON_CTRL_SOFTWARE_EN),
178 dfi_regs + DDRMON_CTRL);
179 clk_disable_unprepare(dfi->clk);
180 out:
181 mutex_unlock(&dfi->mutex);
182 }
183
184 static void rockchip_dfi_read_counters(struct rockchip_dfi *dfi, struct dmc_count *res)
185 {
186 u32 i;
187 void __iomem *dfi_regs = dfi->regs;
188
189 for (i = 0; i < dfi->max_channels; i++) {
190 if (!(dfi->channel_mask & BIT(i)))
191 continue;
192 res->c[i].read_access = readl_relaxed(dfi_regs +
193 DDRMON_CH0_RD_NUM + i * 20);
194 res->c[i].write_access = readl_relaxed(dfi_regs +
195 DDRMON_CH0_WR_NUM + i * 20);
196 res->c[i].access = readl_relaxed(dfi_regs +
197 DDRMON_CH0_DFI_ACCESS_NUM + i * 20);
198 res->c[i].clock_cycles = readl_relaxed(dfi_regs +
199 DDRMON_CH0_COUNT_NUM + i * 20);
200 }
201 }
202
> 203 static void rockchip_ddr_perf_counters_add(struct rockchip_dfi *dfi,
204 const struct dmc_count *now,
205 struct dmc_count *res)
206 {
207 const struct dmc_count *last = &dfi->last_perf_count;
208 int i;
209
210 for (i = 0; i < dfi->max_channels; i++) {
211 res->c[i].read_access = dfi->total_count.c[i].read_access +
212 (u32)(now->c[i].read_access - last->c[i].read_access);
213 res->c[i].write_access = dfi->total_count.c[i].write_access +
214 (u32)(now->c[i].write_access - last->c[i].write_access);
215 res->c[i].access = dfi->total_count.c[i].access +
216 (u32)(now->c[i].access - last->c[i].access);
217 res->c[i].clock_cycles = dfi->total_count.c[i].clock_cycles +
218 (u32)(now->c[i].clock_cycles - last->c[i].clock_cycles);
219 }
220 }
221
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Sascha Hauer <s.hauer@pengutronix.de>,
linux-rockchip@lists.infradead.org
Cc: oe-kbuild-all@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
Heiko Stuebner <heiko@sntech.de>,
Chanwoo Choi <chanwoo@kernel.org>,
Kyungmin Park <kyungmin.park@samsung.com>,
MyungJoo Ham <myungjoo.ham@samsung.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
kernel@pengutronix.de,
Michael Riesch <michael.riesch@wolfvision.net>,
Robin Murphy <robin.murphy@arm.com>,
Vincent Legoll <vincent.legoll@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzk@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
devicetree@vger.kernel.org,
Sebastian Reichel <sebastian.reichel@collabora.com>,
Sascha Hauer <s.hauer@pengutronix.de>
Subject: Re: [PATCH v8 16/26] PM / devfreq: rockchip-dfi: Add perf support
Date: Wed, 18 Oct 2023 15:58:04 +0800 [thread overview]
Message-ID: <202310181557.GIXGL21M-lkp@intel.com> (raw)
In-Reply-To: <20231018061714.3553817-17-s.hauer@pengutronix.de>
Hi Sascha,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.6-rc6]
[cannot apply to next-20231018]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sascha-Hauer/PM-devfreq-rockchip-dfi-Make-pmu-regmap-mandatory/20231018-142228
base: linus/master
patch link: https://lore.kernel.org/r/20231018061714.3553817-17-s.hauer%40pengutronix.de
patch subject: [PATCH v8 16/26] PM / devfreq: rockchip-dfi: Add perf support
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20231018/202310181557.GIXGL21M-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231018/202310181557.GIXGL21M-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310181557.GIXGL21M-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/devfreq/event/rockchip-dfi.c:203:13: warning: 'rockchip_ddr_perf_counters_add' defined but not used [-Wunused-function]
203 | static void rockchip_ddr_perf_counters_add(struct rockchip_dfi *dfi,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
>> drivers/devfreq/event/rockchip-dfi.c:79: warning: Function parameter or member 'write_access' not described in 'dmc_count_channel'
vim +/rockchip_ddr_perf_counters_add +203 drivers/devfreq/event/rockchip-dfi.c
66
67 /**
68 * struct dmc_count_channel - structure to hold counter values from the DDR controller
69 * @access: Number of read and write accesses
70 * @clock_cycles: DDR clock cycles
71 * @read_access: number of read accesses
72 * @write_acccess: number of write accesses
73 */
74 struct dmc_count_channel {
75 u64 access;
76 u64 clock_cycles;
77 u64 read_access;
78 u64 write_access;
> 79 };
80
81 struct dmc_count {
82 struct dmc_count_channel c[DMC_MAX_CHANNELS];
83 };
84
85 /*
86 * The dfi controller can monitor DDR load. It has an upper and lower threshold
87 * for the operating points. Whenever the usage leaves these bounds an event is
88 * generated to indicate the DDR frequency should be changed.
89 */
90 struct rockchip_dfi {
91 struct devfreq_event_dev *edev;
92 struct devfreq_event_desc desc;
93 struct dmc_count last_event_count;
94
95 struct dmc_count last_perf_count;
96 struct dmc_count total_count;
97 seqlock_t count_seqlock; /* protects last_perf_count and total_count */
98
99 struct device *dev;
100 void __iomem *regs;
101 struct regmap *regmap_pmu;
102 struct clk *clk;
103 int usecount;
104 struct mutex mutex;
105 u32 ddr_type;
106 unsigned int channel_mask;
107 unsigned int max_channels;
108 enum cpuhp_state cpuhp_state;
109 struct hlist_node node;
110 struct pmu pmu;
111 struct hrtimer timer;
112 unsigned int cpu;
113 int active_events;
114 int burst_len;
115 int buswidth[DMC_MAX_CHANNELS];
116 };
117
118 static int rockchip_dfi_enable(struct rockchip_dfi *dfi)
119 {
120 void __iomem *dfi_regs = dfi->regs;
121 int ret = 0;
122
123 mutex_lock(&dfi->mutex);
124
125 dfi->usecount++;
126 if (dfi->usecount > 1)
127 goto out;
128
129 ret = clk_prepare_enable(dfi->clk);
130 if (ret) {
131 dev_err(&dfi->edev->dev, "failed to enable dfi clk: %d\n", ret);
132 goto out;
133 }
134
135 /* clear DDRMON_CTRL setting */
136 writel_relaxed(HIWORD_UPDATE(0, DDRMON_CTRL_TIMER_CNT_EN | DDRMON_CTRL_SOFTWARE_EN |
137 DDRMON_CTRL_HARDWARE_EN), dfi_regs + DDRMON_CTRL);
138
139 /* set ddr type to dfi */
140 switch (dfi->ddr_type) {
141 case ROCKCHIP_DDRTYPE_LPDDR2:
142 case ROCKCHIP_DDRTYPE_LPDDR3:
143 writel_relaxed(HIWORD_UPDATE(DDRMON_CTRL_LPDDR23, DDRMON_CTRL_DDR_TYPE_MASK),
144 dfi_regs + DDRMON_CTRL);
145 break;
146 case ROCKCHIP_DDRTYPE_LPDDR4:
147 case ROCKCHIP_DDRTYPE_LPDDR4X:
148 writel_relaxed(HIWORD_UPDATE(DDRMON_CTRL_LPDDR4, DDRMON_CTRL_DDR_TYPE_MASK),
149 dfi_regs + DDRMON_CTRL);
150 break;
151 default:
152 break;
153 }
154
155 /* enable count, use software mode */
156 writel_relaxed(HIWORD_UPDATE(DDRMON_CTRL_SOFTWARE_EN, DDRMON_CTRL_SOFTWARE_EN),
157 dfi_regs + DDRMON_CTRL);
158 out:
159 mutex_unlock(&dfi->mutex);
160
161 return ret;
162 }
163
164 static void rockchip_dfi_disable(struct rockchip_dfi *dfi)
165 {
166 void __iomem *dfi_regs = dfi->regs;
167
168 mutex_lock(&dfi->mutex);
169
170 dfi->usecount--;
171
172 WARN_ON_ONCE(dfi->usecount < 0);
173
174 if (dfi->usecount > 0)
175 goto out;
176
177 writel_relaxed(HIWORD_UPDATE(0, DDRMON_CTRL_SOFTWARE_EN),
178 dfi_regs + DDRMON_CTRL);
179 clk_disable_unprepare(dfi->clk);
180 out:
181 mutex_unlock(&dfi->mutex);
182 }
183
184 static void rockchip_dfi_read_counters(struct rockchip_dfi *dfi, struct dmc_count *res)
185 {
186 u32 i;
187 void __iomem *dfi_regs = dfi->regs;
188
189 for (i = 0; i < dfi->max_channels; i++) {
190 if (!(dfi->channel_mask & BIT(i)))
191 continue;
192 res->c[i].read_access = readl_relaxed(dfi_regs +
193 DDRMON_CH0_RD_NUM + i * 20);
194 res->c[i].write_access = readl_relaxed(dfi_regs +
195 DDRMON_CH0_WR_NUM + i * 20);
196 res->c[i].access = readl_relaxed(dfi_regs +
197 DDRMON_CH0_DFI_ACCESS_NUM + i * 20);
198 res->c[i].clock_cycles = readl_relaxed(dfi_regs +
199 DDRMON_CH0_COUNT_NUM + i * 20);
200 }
201 }
202
> 203 static void rockchip_ddr_perf_counters_add(struct rockchip_dfi *dfi,
204 const struct dmc_count *now,
205 struct dmc_count *res)
206 {
207 const struct dmc_count *last = &dfi->last_perf_count;
208 int i;
209
210 for (i = 0; i < dfi->max_channels; i++) {
211 res->c[i].read_access = dfi->total_count.c[i].read_access +
212 (u32)(now->c[i].read_access - last->c[i].read_access);
213 res->c[i].write_access = dfi->total_count.c[i].write_access +
214 (u32)(now->c[i].write_access - last->c[i].write_access);
215 res->c[i].access = dfi->total_count.c[i].access +
216 (u32)(now->c[i].access - last->c[i].access);
217 res->c[i].clock_cycles = dfi->total_count.c[i].clock_cycles +
218 (u32)(now->c[i].clock_cycles - last->c[i].clock_cycles);
219 }
220 }
221
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-10-18 7:58 UTC|newest]
Thread overview: 215+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 6:16 [PATCH v8 00/26] Add perf support to the rockchip-dfi driver Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 6:16 ` [PATCH v8 01/26] PM / devfreq: rockchip-dfi: Make pmu regmap mandatory Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 14:51 ` Chanwoo Choi
2023-10-18 14:51 ` Chanwoo Choi
2023-10-18 14:51 ` Chanwoo Choi
2023-10-18 6:16 ` [PATCH v8 02/26] PM / devfreq: rockchip-dfi: Embed desc into private data struct Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 14:51 ` Chanwoo Choi
2023-10-18 14:51 ` Chanwoo Choi
2023-10-18 14:51 ` Chanwoo Choi
2023-10-18 6:16 ` [PATCH v8 03/26] PM / devfreq: rockchip-dfi: use consistent name for " Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 14:58 ` Chanwoo Choi
2023-10-18 14:58 ` Chanwoo Choi
2023-10-18 14:58 ` Chanwoo Choi
2023-10-18 6:16 ` [PATCH v8 04/26] PM / devfreq: rockchip-dfi: Add SoC specific init function Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 14:58 ` Chanwoo Choi
2023-10-18 14:58 ` Chanwoo Choi
2023-10-18 14:58 ` Chanwoo Choi
2023-10-18 6:16 ` [PATCH v8 05/26] PM / devfreq: rockchip-dfi: dfi store raw values in counter struct Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 15:05 ` Chanwoo Choi
2023-10-18 15:05 ` Chanwoo Choi
2023-10-18 15:05 ` Chanwoo Choi
2023-10-18 6:16 ` [PATCH v8 06/26] PM / devfreq: rockchip-dfi: Use free running counter Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-19 11:34 ` 최찬우/Tizen Platform Lab(SR)/삼성전자
2023-10-19 11:34 ` 최찬우/Tizen Platform Lab(SR)/삼성전자
2023-10-19 11:34 ` 최찬우/Tizen Platform Lab(SR)/삼성전자
2023-10-18 6:16 ` [PATCH v8 07/26] PM / devfreq: rockchip-dfi: introduce channel mask Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 15:05 ` Chanwoo Choi
2023-10-18 15:05 ` Chanwoo Choi
2023-10-18 15:05 ` Chanwoo Choi
2023-10-19 11:37 ` Chanwoo Choi
2023-10-19 11:37 ` Chanwoo Choi
2023-10-19 11:37 ` Chanwoo Choi
2023-10-18 6:16 ` [PATCH v8 08/26] PM / devfreq: rk3399_dmc,dfi: generalize DDRTYPE defines Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 7:08 ` [PATCH v8 08/26] PM / devfreq: rk3399_dmc, dfi: " Sascha Hauer
2023-10-18 7:08 ` Sascha Hauer
2023-10-18 7:08 ` Sascha Hauer
2023-10-18 20:01 ` [PATCH v8 08/26] PM / devfreq: rk3399_dmc,dfi: " Heiko Stübner
2023-10-18 20:01 ` Heiko Stübner
2023-10-18 20:01 ` Heiko Stübner
2023-10-19 11:43 ` Chanwoo Choi
2023-10-19 11:43 ` Chanwoo Choi
2023-10-19 11:43 ` Chanwoo Choi
2023-10-18 6:16 ` [PATCH v8 09/26] PM / devfreq: rockchip-dfi: Clean up DDR type register defines Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-19 11:44 ` Chanwoo Choi
2023-10-19 11:44 ` Chanwoo Choi
2023-10-19 11:44 ` Chanwoo Choi
2023-10-18 6:16 ` [PATCH v8 10/26] PM / devfreq: rockchip-dfi: Add RK3568 support Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 15:05 ` Chanwoo Choi
2023-10-18 15:05 ` Chanwoo Choi
2023-10-18 15:05 ` Chanwoo Choi
2023-10-18 20:02 ` Heiko Stübner
2023-10-18 20:02 ` Heiko Stübner
2023-10-18 20:02 ` Heiko Stübner
2023-10-19 11:46 ` Chanwoo Choi
2023-10-19 11:46 ` Chanwoo Choi
2023-10-19 11:46 ` Chanwoo Choi
2023-10-18 6:16 ` [PATCH v8 11/26] PM / devfreq: rockchip-dfi: Handle LPDDR2 correctly Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 6:16 ` Sascha Hauer
2023-10-18 15:06 ` Chanwoo Choi
2023-10-18 15:06 ` Chanwoo Choi
2023-10-18 15:06 ` Chanwoo Choi
2023-10-19 11:51 ` Chanwoo Choi
2023-10-19 11:51 ` Chanwoo Choi
2023-10-19 11:51 ` Chanwoo Choi
2023-10-18 6:17 ` [PATCH v8 12/26] PM / devfreq: rockchip-dfi: Handle LPDDR4X Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 20:02 ` Heiko Stübner
2023-10-18 20:02 ` Heiko Stübner
2023-10-18 20:02 ` Heiko Stübner
2023-10-19 11:52 ` Chanwoo Choi
2023-10-19 11:52 ` Chanwoo Choi
2023-10-19 11:52 ` Chanwoo Choi
2023-10-18 6:17 ` [PATCH v8 13/26] PM / devfreq: rockchip-dfi: Pass private data struct to internal functions Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-19 11:55 ` Chanwoo Choi
2023-10-19 11:55 ` Chanwoo Choi
2023-10-19 11:55 ` Chanwoo Choi
2023-10-18 6:17 ` [PATCH v8 14/26] PM / devfreq: rockchip-dfi: Prepare for multiple users Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-19 11:58 ` Chanwoo Choi
2023-10-19 11:58 ` Chanwoo Choi
2023-10-19 11:58 ` Chanwoo Choi
2023-10-18 6:17 ` [PATCH v8 15/26] PM / devfreq: rockchip-dfi: give variable a better name Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-19 11:59 ` Chanwoo Choi
2023-10-19 11:59 ` Chanwoo Choi
2023-10-19 11:59 ` Chanwoo Choi
2023-10-18 6:17 ` [PATCH v8 16/26] PM / devfreq: rockchip-dfi: Add perf support Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 7:58 ` kernel test robot [this message]
2023-10-18 7:58 ` kernel test robot
2023-10-18 7:58 ` kernel test robot
2023-10-18 15:11 ` Chanwoo Choi
2023-10-18 15:11 ` Chanwoo Choi
2023-10-18 15:11 ` Chanwoo Choi
2023-10-19 6:52 ` Sascha Hauer
2023-10-19 6:52 ` Sascha Hauer
2023-10-19 6:52 ` Sascha Hauer
2023-10-18 20:03 ` Heiko Stübner
2023-10-18 20:03 ` Heiko Stübner
2023-10-18 20:03 ` Heiko Stübner
2023-10-19 6:48 ` [PATCH] " Sascha Hauer
2023-10-19 6:48 ` Sascha Hauer
2023-10-19 6:48 ` Sascha Hauer
2023-10-19 9:00 ` kernel test robot
2023-10-19 9:00 ` kernel test robot
2023-10-19 12:16 ` Chanwoo Choi
2023-10-19 12:16 ` Chanwoo Choi
2023-10-19 12:16 ` Chanwoo Choi
2023-10-18 6:17 ` [PATCH v8 17/26] PM / devfreq: rockchip-dfi: make register stride SoC specific Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 15:11 ` Chanwoo Choi
2023-10-18 15:11 ` Chanwoo Choi
2023-10-18 15:11 ` Chanwoo Choi
2023-10-19 12:17 ` Chanwoo Choi
2023-10-19 12:17 ` Chanwoo Choi
2023-10-19 12:17 ` Chanwoo Choi
2023-10-18 6:17 ` [PATCH v8 18/26] PM / devfreq: rockchip-dfi: account for multiple DDRMON_CTRL registers Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 15:11 ` Chanwoo Choi
2023-10-18 15:11 ` Chanwoo Choi
2023-10-18 15:11 ` Chanwoo Choi
2023-10-19 12:18 ` Chanwoo Choi
2023-10-19 12:18 ` Chanwoo Choi
2023-10-19 12:18 ` Chanwoo Choi
2023-10-18 6:17 ` [PATCH v8 19/26] PM / devfreq: rockchip-dfi: add support for RK3588 Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 15:12 ` Chanwoo Choi
2023-10-18 15:12 ` Chanwoo Choi
2023-10-18 15:12 ` Chanwoo Choi
2023-10-19 12:21 ` Chanwoo Choi
2023-10-19 12:21 ` Chanwoo Choi
2023-10-19 12:21 ` Chanwoo Choi
2023-10-19 12:34 ` Chanwoo Choi
2023-10-19 12:34 ` Chanwoo Choi
2023-10-19 12:34 ` Chanwoo Choi
2023-10-18 20:03 ` Heiko Stübner
2023-10-18 20:03 ` Heiko Stübner
2023-10-18 20:03 ` Heiko Stübner
2023-10-18 6:17 ` [PATCH v8 20/26] dt-bindings: devfreq: event: convert Rockchip DFI binding to yaml Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-19 12:24 ` Chanwoo Choi
2023-10-19 12:24 ` Chanwoo Choi
2023-10-19 12:24 ` Chanwoo Choi
2023-10-18 6:17 ` [PATCH v8 21/26] dt-bindings: devfreq: event: rockchip,dfi: Add rk3568 support Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-19 12:27 ` Chanwoo Choi
2023-10-19 12:27 ` Chanwoo Choi
2023-10-19 12:27 ` Chanwoo Choi
2023-10-18 6:17 ` [PATCH v8 22/26] dt-bindings: devfreq: event: rockchip,dfi: Add rk3588 support Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-19 12:27 ` Chanwoo Choi
2023-10-19 12:27 ` Chanwoo Choi
2023-10-19 12:27 ` Chanwoo Choi
2023-10-18 6:17 ` [PATCH v8 23/26] dt-bindings: soc: rockchip: grf: add rockchip,rk3588-pmugrf Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` [PATCH v8 24/26] arm64: dts: rockchip: rk3399: Enable DFI Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` [PATCH v8 25/26] arm64: dts: rockchip: rk356x: Add DFI Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` [PATCH v8 26/26] arm64: dts: rockchip: rk3588s: " Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-10-18 6:17 ` Sascha Hauer
2023-11-23 9:38 ` Jagan Teki
2023-11-23 9:38 ` Jagan Teki
2023-11-23 9:38 ` Jagan Teki
2023-10-18 15:21 ` [PATCH v8 00/26] Add perf support to the rockchip-dfi driver Chanwoo Choi
2023-10-18 15:21 ` Chanwoo Choi
2023-10-18 15:21 ` Chanwoo Choi
2023-10-18 20:06 ` Heiko Stübner
2023-10-18 20:06 ` Heiko Stübner
2023-10-18 20:06 ` Heiko Stübner
2023-10-19 8:54 ` (subset) " Heiko Stuebner
2023-10-19 8:54 ` Heiko Stuebner
2023-10-19 8:54 ` Heiko Stuebner
2023-10-19 14:05 ` Heiko Stuebner
2023-10-19 14:05 ` Heiko Stuebner
2023-10-19 14:05 ` Heiko Stuebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202310181557.GIXGL21M-lkp@intel.com \
--to=lkp@intel.com \
--cc=chanwoo@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=kernel@pengutronix.de \
--cc=krzk@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=michael.riesch@wolfvision.net \
--cc=myungjoo.ham@samsung.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=robh+dt@kernel.org \
--cc=robin.murphy@arm.com \
--cc=s.hauer@pengutronix.de \
--cc=sebastian.reichel@collabora.com \
--cc=vincent.legoll@gmail.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.