tree: https://gitee.com/openeuler/kernel.git OLK-5.10 head: 32bb7b0a7c87769858fbb9d60574b830383c28f7 commit: 6b9faa4dfe7e99b19081b54504efce5f57b7abe4 [29325/30000] powercap: intel_rapl: Introduce RAPL TPMI interface driver config: x86_64-randconfig-122-20240317 (https://download.01.org/0day-ci/archive/20240317/202403171427.1vH4xGrU-lkp@i...) compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240317/202403171427.1vH4xGrU-lkp@i...)
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/202403171427.1vH4xGrU-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