From: kernel test robot <lkp@intel.com>
To: Janne Grunau <j@jannau.net>
Cc: oe-kbuild-all@lists.linux.dev, Hector Martin <marcan@marcan.st>
Subject: [asahilinux:bits/020-dart 4/20] drivers/iommu/apple-dart.c:851:54: warning: left shift count >= width of type
Date: Tue, 25 Aug 2026 13:33:44 +0800 [thread overview]
Message-ID: <202608251306.uDBzdkWI-lkp@intel.com> (raw)
tree: https://github.com/AsahiLinux/linux bits/020-dart
head: 45b2aa771c5241177bad6c3f1777bb34871aa5ef
commit: 679ee8da9f5f0497de57348d1c60a8a856f411b2 [4/20] iommu: apple-dart: Support specifying the DMA aperture in the DT
config: i386-buildonly-randconfig-006-20260825 (https://download.01.org/0day-ci/archive/20260825/202608251306.uDBzdkWI-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260825/202608251306.uDBzdkWI-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/202608251306.uDBzdkWI-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/iommu/apple-dart.c: In function 'apple_dart_of_xlate':
>> drivers/iommu/apple-dart.c:851:54: warning: left shift count >= width of type [-Wshift-count-overflow]
851 | dma_min = ((dma_addr_t)args->args[1] << 32) | args->args[2];
| ^~
drivers/iommu/apple-dart.c:852:62: warning: left shift count >= width of type [-Wshift-count-overflow]
852 | dma_addr_t size = ((dma_addr_t)args->args[3] << 32) | args->args[4];
| ^~
vim +851 drivers/iommu/apple-dart.c
831
832 static int apple_dart_of_xlate(struct device *dev,
833 const struct of_phandle_args *args)
834 {
835 struct apple_dart_master_cfg *cfg = dev_iommu_priv_get(dev);
836 struct platform_device *iommu_pdev = of_find_device_by_node(args->np);
837 struct apple_dart *dart = platform_get_drvdata(iommu_pdev);
838 struct apple_dart *cfg_dart;
839 dma_addr_t dma_max = DMA_BIT_MASK(dart->ias);
840 dma_addr_t dma_min = 0;
841 int i, sid;
842
843 put_device(&iommu_pdev->dev);
844
845 if (args->args_count != 1 && args->args_count != 5)
846 return -EINVAL;
847
848 sid = args->args[0];
849
850 if (args->args_count == 5) {
> 851 dma_min = ((dma_addr_t)args->args[1] << 32) | args->args[2];
852 dma_addr_t size = ((dma_addr_t)args->args[3] << 32) | args->args[4];
853 if (!(IS_ALIGNED(dma_min, dart->pgsize) || !IS_ALIGNED(size, dart->pgsize))) {
854 dev_err(dev, "Unaligned DMA window %pad..%pad for page size 0x%x\n",
855 &dma_min, &size, dart->pgsize);
856 return -EINVAL;
857 }
858 dma_max = dma_min + size - 1;
859 /*
860 * Ensure that the DMA window does not exceed the dart's ias.
861 */
862 if ((dma_min ^ dma_max) & ~DMA_BIT_MASK(dart->ias)) {
863 dev_err(dev, "Invalid DMA window for ias=%d\n",
864 dart->ias);
865 return -EINVAL;
866 }
867 }
868
869 if (!cfg) {
870 cfg = kzalloc_obj(*cfg);
871 if (!cfg)
872 return -ENOMEM;
873 /* Will be ANDed with DART capabilities */
874 cfg->supports_bypass = true;
875 /* Will be merged with other DARTs to the to fully overlapping range. */
876 cfg->dma_min = dma_min;
877 cfg->dma_max = dma_max;
878 } else {
879 if (dma_min >= cfg->dma_max || cfg->dma_min >= dma_max) {
880 dev_err(dev, "non-overlapping DMA windows: %pad..%pad, "
881 "%pad..%pad\n", &dma_min, &dma_max,
882 &cfg->dma_min, &cfg->dma_max);
883 return -EINVAL;
884 }
885 cfg->dma_min = max(dma_min, cfg->dma_min);
886 cfg->dma_max = min(dma_max, cfg->dma_max);
887 }
888 dev_iommu_priv_set(dev, cfg);
889
890 cfg_dart = cfg->stream_maps[0].dart;
891 if (cfg_dart) {
892 if (cfg_dart->pgsize != dart->pgsize)
893 return -EINVAL;
894 if (cfg_dart->ias != dart->ias)
895 return -EINVAL;
896 }
897
898 cfg->supports_bypass &= dart->supports_bypass;
899
900 for (i = 0; i < MAX_DARTS_PER_DEVICE; ++i) {
901 if (cfg->stream_maps[i].dart == dart) {
902 set_bit(sid, cfg->stream_maps[i].sidmap);
903 return 0;
904 }
905 }
906 for (i = 0; i < MAX_DARTS_PER_DEVICE; ++i) {
907 if (!cfg->stream_maps[i].dart) {
908 cfg->stream_maps[i].dart = dart;
909 set_bit(sid, cfg->stream_maps[i].sidmap);
910 return 0;
911 }
912 }
913
914 return -EINVAL;
915 }
916
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-08-25 5:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202608251306.uDBzdkWI-lkp@intel.com \
--to=lkp@intel.com \
--cc=j@jannau.net \
--cc=marcan@marcan.st \
--cc=oe-kbuild-all@lists.linux.dev \
/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.