Content-Type: multipart/mixed; boundary="===============4121017573105989242==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH] drm/lsdc: add drm driver support for loongson display controller Date: Mon, 31 Jan 2022 11:23:48 +0800 Message-ID: <202201311126.DzQNRNnI-lkp@intel.com> In-Reply-To: <20220130045804.10639-1-15330273260@189.cn> List-Id: --===============4121017573105989242== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Sui, Thank you for the patch! Yet something to improve: [auto build test ERROR on drm/drm-next] [also build test ERROR on v5.17-rc2 next-20220128] [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] url: https://github.com/0day-ci/linux/commits/Sui-Jingfeng/drm-lsdc-add-= drm-driver-support-for-loongson-display-controller/20220130-130855 base: git://anongit.freedesktop.org/drm/drm drm-next config: arc-randconfig-r043-20220130 (https://download.01.org/0day-ci/archi= ve/20220131/202201311126.DzQNRNnI-lkp(a)intel.com/config) compiler: arc-elf-gcc (GCC) 11.2.0 reproduce (this is a W=3D1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/= make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/3595361f14c6607486d8c94cf= 7f012f8c8b267c3 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Sui-Jingfeng/drm-lsdc-add-drm-driv= er-support-for-loongson-display-controller/20220130-130855 git checkout 3595361f14c6607486d8c94cf7f012f8c8b267c3 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dgcc-11.2.0 make.cross= O=3Dbuild_dir ARCH=3Darc SHELL=3D/bin/bash drivers/gpu/drm/lsdc/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All error/warnings (new ones prefixed by >>): In file included from include/linux/device.h:15, from include/linux/pci.h:37, from drivers/gpu/drm/lsdc/lsdc_drv.c:34: drivers/gpu/drm/lsdc/lsdc_drv.c: In function 'lsdc_vram_init': >> include/drm/drm_print.h:425:39: warning: format '%llx' expects argument = of type 'long long unsigned int', but argument 3 has type 'resource_size_t'= {aka 'unsigned int'} [-Wformat=3D] 425 | dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS_= _) | ^~~~~~~~ include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_pri= ntk_index_wrap' 110 | _p_func(dev, fmt, ##__VA_ARGS__); = \ | ^~~ include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt' 150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt= (fmt), ##__VA_ARGS__) | ^~~~~~~ include/drm/drm_print.h:425:9: note: in expansion of macro 'dev_info' 425 | dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS_= _) | ^~~~ include/drm/drm_print.h:429:9: note: in expansion of macro '__drm_printk' 429 | __drm_printk((drm), info,, fmt, ##__VA_ARGS__) | ^~~~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_drv.c:580:9: note: in expansion of macro 'drm_= info' 580 | drm_info(ddev, "vram start: 0x%llx, size: %lluMB\n", bas= e, size >> 20); | ^~~~~~~~ >> include/drm/drm_print.h:425:39: warning: format '%llu' expects argument = of type 'long long unsigned int', but argument 4 has type 'resource_size_t'= {aka 'unsigned int'} [-Wformat=3D] 425 | dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS_= _) | ^~~~~~~~ include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_pri= ntk_index_wrap' 110 | _p_func(dev, fmt, ##__VA_ARGS__); = \ | ^~~ include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt' 150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt= (fmt), ##__VA_ARGS__) | ^~~~~~~ include/drm/drm_print.h:425:9: note: in expansion of macro 'dev_info' 425 | dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS_= _) | ^~~~ include/drm/drm_print.h:429:9: note: in expansion of macro '__drm_printk' 429 | __drm_printk((drm), info,, fmt, ##__VA_ARGS__) | ^~~~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_drv.c:580:9: note: in expansion of macro 'drm_= info' 580 | drm_info(ddev, "vram start: 0x%llx, size: %lluMB\n", bas= e, size >> 20); | ^~~~~~~~ >> drivers/gpu/drm/lsdc/lsdc_drv.c:600:63: warning: cast from pointer to in= teger of different size [-Wpointer-to-int-cast] 600 | drm_info(ddev, "vram virtual addr: 0x%llx\n", (u= 64)ldev->vram); | ^ include/linux/dev_printk.h:110:37: note: in definition of macro 'dev_pri= ntk_index_wrap' 110 | _p_func(dev, fmt, ##__VA_ARGS__); = \ | ^~~~~~~~~~~ include/drm/drm_print.h:425:9: note: in expansion of macro 'dev_info' 425 | dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS_= _) | ^~~~ include/drm/drm_print.h:429:9: note: in expansion of macro '__drm_printk' 429 | __drm_printk((drm), info,, fmt, ##__VA_ARGS__) | ^~~~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_drv.c:600:17: note: in expansion of macro 'drm= _info' 600 | drm_info(ddev, "vram virtual addr: 0x%llx\n", (u= 64)ldev->vram); | ^~~~~~~~ -- >> drivers/gpu/drm/lsdc/lsdc_crtc.c:321:6: warning: no previous prototype f= or 'lsdc_enable_display' [-Wmissing-prototypes] 321 | void lsdc_enable_display(struct lsdc_device *ldev, unsigned int = index) | ^~~~~~~~~~~~~~~~~~~ -- >> drivers/gpu/drm/lsdc/lsdc_irq.c:9:13: warning: no previous prototype for= 'lsdc_irq_thread_cb' [-Wmissing-prototypes] 9 | irqreturn_t lsdc_irq_thread_cb(int irq, void *arg) | ^~~~~~~~~~~~~~~~~~ >> drivers/gpu/drm/lsdc/lsdc_irq.c:33:13: warning: no previous prototype fo= r 'lsdc_irq_handler_cb' [-Wmissing-prototypes] 33 | irqreturn_t lsdc_irq_handler_cb(int irq, void *arg) | ^~~~~~~~~~~~~~~~~~~ -- In file included from include/linux/device.h:15, from include/drm/drm_print.h:32, from drivers/gpu/drm/lsdc/lsdc_pll.c:30: drivers/gpu/drm/lsdc/lsdc_pll.c: In function 'lsdc_pixpll_setup': >> drivers/gpu/drm/lsdc/lsdc_pll.c:191:62: warning: cast from pointer to in= teger of different size [-Wpointer-to-int-cast] 191 | this->index, this->reg_base, this->reg_size, (u6= 4)this->mmio); | ^ include/linux/dev_printk.h:110:37: note: in definition of macro 'dev_pri= ntk_index_wrap' 110 | _p_func(dev, fmt, ##__VA_ARGS__); = \ | ^~~~~~~~~~~ include/drm/drm_print.h:425:9: note: in expansion of macro 'dev_info' 425 | dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS_= _) | ^~~~ include/drm/drm_print.h:429:9: note: in expansion of macro '__drm_printk' 429 | __drm_printk((drm), info,, fmt, ##__VA_ARGS__) | ^~~~~~~~~~~~ drivers/gpu/drm/lsdc/lsdc_pll.c:190:9: note: in expansion of macro 'drm_= info' 190 | drm_info(this->ddev, "PIXPLL%u REG[%x, %u] map to %llx\n= ", | ^~~~~~~~ drivers/gpu/drm/lsdc/lsdc_pll.c: In function 'ls2k1000_pixpll_param_upda= te': >> drivers/gpu/drm/lsdc/lsdc_pll.c:386:19: error: implicit declaration of f= unction 'readq'; did you mean 'readb'? [-Werror=3Dimplicit-function-declara= tion] 386 | u64 val =3D readq(reg); | ^~~~~ | readb >> drivers/gpu/drm/lsdc/lsdc_pll.c:393:9: error: implicit declaration of fu= nction 'writeq'; did you mean 'writeb'? [-Werror=3Dimplicit-function-declar= ation] 393 | writeq(val, reg); | ^~~~~~ | writeb >> drivers/gpu/drm/lsdc/lsdc_pll.c:395:31: warning: left shift count >=3D w= idth of type [-Wshift-count-overflow] 395 | val =3D (1L << 7) | (1L << 42) | (3L << 10); /* allow = L1 PLL locked */ | ^~ drivers/gpu/drm/lsdc/lsdc_pll.c:396:44: warning: left shift count >=3D w= idth of type [-Wshift-count-overflow] 396 | val |=3D (unsigned long)param->loopc << 32; /* set lo= opc */ | ^~ cc1: some warnings being treated as errors vim +386 drivers/gpu/drm/lsdc/lsdc_pll.c 184 = 185 = 186 static int lsdc_pixpll_setup(struct lsdc_pll * const this) 187 { 188 this->mmio =3D ioremap(this->reg_base, this->reg_size); 189 = 190 drm_info(this->ddev, "PIXPLL%u REG[%x, %u] map to %llx\n", > 191 this->index, this->reg_base, this->reg_size, (u64)this->mmio); 192 = 193 return 0; 194 } 195 = 196 = 197 /** 198 * lsdc_crtc_init 199 * 200 * @ddev: point to the drm_device structure 201 * @index: hardware crtc index 202 * 203 * Init CRTC 204 */ 205 = 206 /* 207 * Find a set of pll parameters (to generate pixel clock) from a sta= tic 208 * local table, which avoid to compute the pll parameter everytime a 209 * modeset is triggered. 210 * 211 * @clock: the desired pixel clock wanted to generate, the unit is k= Hz 212 * @pout: pointer to where hardware pll parameters(if found) to save 213 * 214 * Return true if a parameter is found, otherwise return false. 215 */ 216 static bool lsdc_pixpll_find(struct lsdc_pll * const this, 217 unsigned int clock, 218 struct lsdc_pll_core_values * const pout) 219 { 220 unsigned int num =3D ARRAY_SIZE(pll_param_table); 221 unsigned int i; 222 = 223 for (i =3D 0; i < num; i++) { 224 if (clock !=3D pll_param_table[i].clock) 225 continue; 226 = 227 pout->div_ref =3D pll_param_table[i].div_ref; 228 pout->loopc =3D pll_param_table[i].loopc; 229 pout->div_out =3D pll_param_table[i].div_out; 230 = 231 return true; 232 } 233 = 234 drm_dbg(this->ddev, "pixel clock %u: miss\n", clock); 235 = 236 return false; 237 } 238 = 239 /* 240 * Find a set of pll parameters which have minimal difference with d= esired 241 * clock frequency. It does that by computing the all of pll paramet= ers 242 * combines possible and compare the diff and find the minimal. 243 * 244 * clock_out =3D refclk / div_ref * loopc / div_out 245 * 246 * refclk is fixed as 100MHz in ls7a1000, ls2k1000 and ls2k0500 247 * 248 * @clk: the desired pixel clock wanted to generate, the unit is kHz 249 * @pout: pointer to where hardware pll parameters(if found) to save 250 * @verbose: print the pll parameter and the actual pixel clock. 251 * 252 * Return true if a parameter is found, otherwise return false. 253 */ 254 static bool lsdc_pixpll_compute(struct lsdc_pll * const this, 255 unsigned int clk, 256 bool verbose, 257 struct lsdc_pll_core_values * const pout) 258 { 259 unsigned int refclk =3D this->ref_clock; 260 const unsigned int tolerance =3D 1000; 261 unsigned int min =3D tolerance; 262 unsigned int div_out, loopc, div_ref; 263 = 264 if (lsdc_pixpll_find(this, clk, pout)) 265 return true; 266 = 267 for (div_out =3D 6; div_out < 64; div_out++) { 268 for (div_ref =3D 3; div_ref < 6; div_ref++) { 269 for (loopc =3D 6; loopc < 161; loopc++) { 270 int diff; 271 = 272 if (loopc < 12 * div_ref) 273 continue; 274 if (loopc > 32 * div_ref) 275 continue; 276 = 277 diff =3D clk * div_out - refclk * loopc / div_ref; 278 = 279 if (diff < 0) 280 diff =3D -diff; 281 = 282 if (diff < min) { 283 min =3D diff; 284 pout->div_ref =3D div_ref; 285 pout->div_out =3D div_out; 286 pout->loopc =3D loopc; 287 = 288 if (diff =3D=3D 0) 289 return true; 290 } 291 } 292 } 293 } 294 = 295 if (verbose) { 296 unsigned int clk_out; 297 = 298 clk_out =3D refclk / pout->div_ref * pout->loopc / pout->div_out; 299 = 300 drm_info(this->ddev, "pixpll%u\n", this->index); 301 = 302 drm_info(this->ddev, "div_ref=3D%u, loopc=3D%u, div_out=3D%u\n", 303 pout->div_ref, pout->loopc, pout->div_out); 304 = 305 drm_info(this->ddev, "desired clk=3D%u, actual out=3D%u, diff=3D%d= \n", 306 clk, clk_out, clk_out - clk); 307 } 308 = 309 return min < tolerance; 310 } 311 = 312 = 313 static int ls7a1000_pixpll_param_update(struct lsdc_pll * const this, 314 const struct lsdc_pll_core_values * const param) 315 { 316 u32 val; 317 unsigned int counter =3D 0; 318 void __iomem *reg =3D this->mmio; 319 bool locked; 320 = 321 = 322 /* clear sel_pll_out0 */ 323 val =3D readl(reg + 0x4); 324 val &=3D ~(1 << 8); 325 writel(val, reg + 0x4); 326 = 327 /* set pll_pd */ 328 val =3D readl(reg + 0x4); 329 val |=3D (1 << 13); 330 writel(val, reg + 0x4); 331 = 332 /* clear set_pll_param */ 333 val =3D readl(reg + 0x4); 334 val &=3D ~(1 << 11); 335 writel(val, reg + 0x4); 336 = 337 /* clear old value & config new value */ 338 val =3D readl(reg + 0x04); 339 val &=3D ~0x7F; 340 = 341 val |=3D param->div_ref; /* div_ref */ 342 writel(val, reg + 0x4); 343 = 344 val =3D readl(reg); 345 val &=3D ~(0x7f << 0); 346 val |=3D param->div_out; /* div_out */ 347 val &=3D ~(0x1ffUL << 21); 348 val |=3D param->loopc << 21; /* loopc */ 349 writel(val, reg); 350 = 351 /* set set_pll_param */ 352 val =3D readl(reg + 0x4); 353 val |=3D (1 << 11); 354 writel(val, reg + 0x4); 355 = 356 /* clear pll_pd */ 357 val =3D readl(reg + 0x4); 358 val &=3D ~(1 << 13); 359 writel(val, reg + 0x4); 360 = 361 /* wait pll lock */ 362 do { 363 val =3D readl(reg + 0x4); 364 locked =3D val & 0x80; 365 counter++; 366 } while (locked =3D=3D false); 367 = 368 drm_dbg_kms(this->ddev, "%u loop waited\n", counter); 369 = 370 /* set sel_pll_out0 */ 371 val =3D readl(reg + 0x4); 372 val |=3D (1UL << 8); 373 writel(val, reg + 0x4); 374 = 375 return 0; 376 } 377 = 378 = 379 /* 380 * the PIX PLL be software configurable when SYS_CLKSEL[1:0] is 10b 381 */ 382 static int ls2k1000_pixpll_param_update(struct lsdc_pll * const this, 383 const struct lsdc_pll_core_values * const param) 384 { 385 void __iomem *reg =3D this->mmio; > 386 u64 val =3D readq(reg); 387 bool locked; 388 unsigned int counter =3D 0; 389 = 390 val &=3D ~(1 << 0); /* Bypass the PLL, using refclk directly */ 391 val |=3D (1 << 19); /* powerdown the PLL */ 392 val &=3D ~(1 << 2); /* don't use the software configure param */ > 393 writeq(val, reg); 394 = > 395 val =3D (1L << 7) | (1L << 42) | (3L << 10); /* allow L1 PLL lock= ed */ 396 val |=3D (unsigned long)param->loopc << 32; /* set loopc */ 397 val |=3D (unsigned long)param->div_ref << 26; /* set div_ref */ 398 writeq(val, reg); 399 writeq(param->div_out, reg + 8); /* set div_out */ 400 = 401 val =3D readq(reg); 402 val |=3D (1 << 2); /* use the software configure param */ 403 val &=3D ~(1 << 19); /* powerup the PLL */ 404 writeq(val, reg); 405 = 406 /* wait pll setup and locked */ 407 do { 408 val =3D readl(reg); 409 locked =3D val & 0x10000; 410 counter++; 411 } while (locked =3D=3D false); 412 = 413 drm_dbg_kms(this->ddev, "%u loop waited\n", counter); 414 = 415 val =3D readq(reg); 416 val |=3D (1 << 0); /* switch to the software configured pll */ 417 writeq(val, reg); 418 = 419 return 0; 420 } 421 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org --===============4121017573105989242==--