[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210232036.RbrbfpQZ-lkp@intel.com>
Date: Sun, 23 Oct 2022 20:45:35 +0800
From: kernel test robot <lkp@...el.com>
To: Janne Grunau <j@...nau.net>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org
Subject: [asahilinux:gpu/rust-wip 1705/2025]
drivers/iommu/io-pgtable-dart.c:367:5: warning: no previous prototype for
function 'io_pgtable_dart_setup_locked'
tree: https://github.com/AsahiLinux/linux gpu/rust-wip
head: 723f96051316cedeab48d9c03f26eadf5b2d0180
commit: 357bc2a2f5ca967e1f617a6cf6ca7defd80a57c0 [1705/2025] iommu: apple-dart: Install IOMMU_RESV_TRANSLATED mappings
config: arm64-randconfig-r026-20221023
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/AsahiLinux/linux/commit/357bc2a2f5ca967e1f617a6cf6ca7defd80a57c0
git remote add asahilinux https://github.com/AsahiLinux/linux
git fetch --no-tags asahilinux gpu/rust-wip
git checkout 357bc2a2f5ca967e1f617a6cf6ca7defd80a57c0
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/iommu/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> drivers/iommu/io-pgtable-dart.c:367:5: warning: no previous prototype for function 'io_pgtable_dart_setup_locked' [-Wmissing-prototypes]
int io_pgtable_dart_setup_locked(struct io_pgtable_ops *ops)
^
drivers/iommu/io-pgtable-dart.c:367:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int io_pgtable_dart_setup_locked(struct io_pgtable_ops *ops)
^
static
>> drivers/iommu/io-pgtable-dart.c:457:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
data->pgd[0] = __dart_alloc_pages(DART_GRANULE(data), GFP_KERNEL);
^
drivers/iommu/io-pgtable-dart.c:454:6: note: previous statement is here
if (cfg->apple_dart_cfg.n_ttbrs > 1)
^
2 warnings generated.
vim +/io_pgtable_dart_setup_locked +367 drivers/iommu/io-pgtable-dart.c
366
> 367 int io_pgtable_dart_setup_locked(struct io_pgtable_ops *ops)
368 {
369 void *l1tbl;
370 struct dart_io_pgtable *data = io_pgtable_ops_to_data(ops);
371 struct io_pgtable_cfg *cfg = &data->iop.cfg;
372 size_t size;
373
374 if (!(cfg->quirks & IO_PGTABLE_QUIRK_APPLE_LOCKED))
375 return 0;
376
377 size = cfg->pgsize_bitmap;
378 l1tbl = devm_memremap(cfg->iommu_dev, cfg->apple_dart_cfg.ttbr[0], size,
379 MEMREMAP_WB);
380 if (!l1tbl)
381 return -ENOMEM;
382
383 for (int entry = 0; entry < DART_PTES_PER_TABLE(data); entry++)
384 ((dart_iopte *)l1tbl)[entry] = ((dart_iopte *)data->pgd[0])[entry];
385
386 free_pages((unsigned long)data->pgd[0], get_order(DART_GRANULE(data)));
387 data->pgd[0] = l1tbl;
388
389 return 0;
390 }
391 EXPORT_SYMBOL(io_pgtable_dart_setup_locked);
392
393 static struct dart_io_pgtable *
394 dart_alloc_pgtable(struct io_pgtable_cfg *cfg)
395 {
396 struct dart_io_pgtable *data;
397 int tbl_bits, bits_per_level, va_bits, pg_shift;
398
399 pg_shift = __ffs(cfg->pgsize_bitmap);
400 bits_per_level = pg_shift - ilog2(sizeof(dart_iopte));
401
402 va_bits = cfg->ias - pg_shift;
403
404 tbl_bits = max_t(int, 0, va_bits - (bits_per_level * DART_LEVELS));
405 if ((1 << tbl_bits) > DART_MAX_TABLES)
406 return NULL;
407
408 data = kzalloc(sizeof(*data), GFP_KERNEL);
409 if (!data)
410 return NULL;
411
412 data->tbl_bits = tbl_bits;
413 data->bits_per_level = bits_per_level;
414
415 data->iop.ops = (struct io_pgtable_ops) {
416 .map_pages = dart_map_pages,
417 .unmap_pages = dart_unmap_pages,
418 .iova_to_phys = dart_iova_to_phys,
419 };
420
421 return data;
422 }
423
424 static struct io_pgtable *
425 apple_dart_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie)
426 {
427 struct dart_io_pgtable *data;
428 int i;
429
430 if (!cfg->coherent_walk)
431 return NULL;
432
433 if (cfg->oas != 36 && cfg->oas != 42)
434 return NULL;
435
436 if (cfg->ias > cfg->oas)
437 return NULL;
438
439 if (!(cfg->pgsize_bitmap == SZ_4K || cfg->pgsize_bitmap == SZ_16K))
440 return NULL;
441
442 data = dart_alloc_pgtable(cfg);
443 if (!data)
444 return NULL;
445
446 cfg->apple_dart_cfg.n_ttbrs = 1 << data->tbl_bits;
447
448 /* Locked DARTs can not modify the TTBR registers. Allocate first a shadow
449 * page table so locked DARTs (disp0, dcp, dcpext*) can map their reserved
450 * memory regions. They will be later in io_pgtable_dart_setup_locked()
451 * copied to the locked L1 table.
452 */
453 if (cfg->quirks & IO_PGTABLE_QUIRK_APPLE_LOCKED) {
454 if (cfg->apple_dart_cfg.n_ttbrs > 1)
455 goto out_free_data;
456
> 457 data->pgd[0] = __dart_alloc_pages(DART_GRANULE(data), GFP_KERNEL);
458 if (!data->pgd[0])
459 goto out_free_data;
460
461 return &data->iop;
462 }
463
464 for (i = 0; i < cfg->apple_dart_cfg.n_ttbrs; ++i) {
465 data->pgd[i] = __dart_alloc_pages(DART_GRANULE(data), GFP_KERNEL);
466 if (!data->pgd[i])
467 goto out_free_pages;
468 cfg->apple_dart_cfg.ttbr[i] = virt_to_phys(data->pgd[i]);
469 }
470
471 return &data->iop;
472
473 out_free_pages:
474 while (--i >= 0)
475 free_pages((unsigned long)data->pgd[i],
476 get_order(DART_GRANULE(data)));
477 out_free_data:
478 kfree(data);
479 return NULL;
480 }
481
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (173856 bytes)
Powered by blists - more mailing lists