From: kernel test robot <lkp@intel.com>
To: Zhang Rui <rui.zhang@intel.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: drivers/powercap/intel_rapl_tpmi.c:141:41: sparse: sparse: incorrect type in initializer (different address spaces)
Date: Mon, 3 Jul 2023 14:41:44 +0800 [thread overview]
Message-ID: <202307031405.dy3druuy-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a901a3568fd26ca9c4a82d8bc5ed5b3ed844d451
commit: 9eef7f9da928c54149199e7b3215b82c2d595ccd powercap: intel_rapl: Introduce RAPL TPMI interface driver
date: 6 weeks ago
config: x86_64-randconfig-x062-20230703 (https://download.01.org/0day-ci/archive/20230703/202307031405.dy3druuy-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230703/202307031405.dy3druuy-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/202307031405.dy3druuy-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/powercap/intel_rapl_tpmi.c:141:41: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned long long [usertype] *tpmi_rapl_regs @@ got void [noderef] __iomem * @@
drivers/powercap/intel_rapl_tpmi.c:141:41: sparse: expected unsigned long long [usertype] *tpmi_rapl_regs
drivers/powercap/intel_rapl_tpmi.c:141:41: sparse: got void [noderef] __iomem *
vim +141 drivers/powercap/intel_rapl_tpmi.c
132
133 static int parse_one_domain(struct tpmi_rapl_package *trp, u32 offset)
134 {
135 u8 tpmi_domain_version;
136 enum rapl_domain_type domain_type;
137 enum tpmi_rapl_domain_type tpmi_domain_type;
138 enum tpmi_rapl_register reg_index;
139 enum rapl_domain_reg_id reg_id;
140 int tpmi_domain_size, tpmi_domain_flags;
> 141 u64 *tpmi_rapl_regs = trp->base + offset;
142 u64 tpmi_domain_header = readq((void __iomem *)tpmi_rapl_regs);
143
144 /* Domain Parent bits are ignored for now */
145 tpmi_domain_version = tpmi_domain_header & 0xff;
146 tpmi_domain_type = tpmi_domain_header >> 8 & 0xff;
147 tpmi_domain_size = tpmi_domain_header >> 16 & 0xff;
148 tpmi_domain_flags = tpmi_domain_header >> 32 & 0xffff;
149
150 if (tpmi_domain_version != TPMI_RAPL_VERSION) {
151 pr_warn(FW_BUG "Unsupported version:%d\n", tpmi_domain_version);
152 return -ENODEV;
153 }
154
155 /* Domain size: in unit of 128 Bytes */
156 if (tpmi_domain_size != 1) {
157 pr_warn(FW_BUG "Invalid Domain size %d\n", tpmi_domain_size);
158 return -EINVAL;
159 }
160
161 /* Unit register and Energy Status register are mandatory for each domain */
162 if (!(tpmi_domain_flags & BIT(TPMI_RAPL_REG_UNIT)) ||
163 !(tpmi_domain_flags & BIT(TPMI_RAPL_REG_ENERGY_STATUS))) {
164 pr_warn(FW_BUG "Invalid Domain flag 0x%x\n", tpmi_domain_flags);
165 return -EINVAL;
166 }
167
168 switch (tpmi_domain_type) {
169 case TPMI_RAPL_DOMAIN_PACKAGE:
170 domain_type = RAPL_DOMAIN_PACKAGE;
171 break;
172 case TPMI_RAPL_DOMAIN_SYSTEM:
173 domain_type = RAPL_DOMAIN_PLATFORM;
174 break;
175 case TPMI_RAPL_DOMAIN_MEMORY:
176 domain_type = RAPL_DOMAIN_DRAM;
177 break;
178 default:
179 pr_warn(FW_BUG "Unsupported Domain type %d\n", tpmi_domain_type);
180 return -EINVAL;
181 }
182
183 if (trp->priv.regs[domain_type][RAPL_DOMAIN_REG_UNIT]) {
184 pr_warn(FW_BUG "Duplicate Domain type %d\n", tpmi_domain_type);
185 return -EINVAL;
186 }
187
188 reg_index = TPMI_RAPL_REG_HEADER;
189 while (++reg_index != TPMI_RAPL_REG_MAX) {
190 if (!(tpmi_domain_flags & BIT(reg_index)))
191 continue;
192
193 switch (reg_index) {
194 case TPMI_RAPL_REG_UNIT:
195 reg_id = RAPL_DOMAIN_REG_UNIT;
196 break;
197 case TPMI_RAPL_REG_PL1:
198 reg_id = RAPL_DOMAIN_REG_LIMIT;
199 trp->priv.limits[domain_type] |= BIT(POWER_LIMIT1);
200 break;
201 case TPMI_RAPL_REG_PL2:
202 reg_id = RAPL_DOMAIN_REG_PL2;
203 trp->priv.limits[domain_type] |= BIT(POWER_LIMIT2);
204 break;
205 case TPMI_RAPL_REG_PL4:
206 reg_id = RAPL_DOMAIN_REG_PL4;
207 trp->priv.limits[domain_type] |= BIT(POWER_LIMIT4);
208 break;
209 case TPMI_RAPL_REG_ENERGY_STATUS:
210 reg_id = RAPL_DOMAIN_REG_STATUS;
211 break;
212 case TPMI_RAPL_REG_PERF_STATUS:
213 reg_id = RAPL_DOMAIN_REG_PERF;
214 break;
215 case TPMI_RAPL_REG_POWER_INFO:
216 reg_id = RAPL_DOMAIN_REG_INFO;
217 break;
218 default:
219 continue;
220 }
221 trp->priv.regs[domain_type][reg_id] = (u64)&tpmi_rapl_regs[reg_index];
222 }
223
224 return 0;
225 }
226
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2023-07-03 6:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-03 6:41 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-07-19 6:50 drivers/powercap/intel_rapl_tpmi.c:141:41: sparse: sparse: incorrect type in initializer (different address spaces) kernel test robot
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=202307031405.dy3druuy-lkp@intel.com \
--to=lkp@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=rjw@rjwysocki.net \
--cc=rui.zhang@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox