Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Samuel Holland <samuel@sholland.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Emil Renner Berthing <emil.renner.berthing@canonical.com>
Subject: [esmil:d1-6.11.y 46/47] drivers/iommu/iommu.c:1739:17: error: static assertion failed due to requirement '!(1 && 1)': !(IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) && IS_ENABLED(CONFIG_IOMMU_DMA))
Date: Fri, 27 Sep 2024 11:44:46 +0800	[thread overview]
Message-ID: <202409271127.PcxwlMWk-lkp@intel.com> (raw)

tree:   https://github.com/esmil/linux d1-6.11.y
head:   d99b769766ff1b1ced32d8d279d28e581e02fa9d
commit: 52b502637f663a122417fde5416982e137148c64 [46/47] iommu/sun50i: Ensure the IOMMU can be used for DMA
config: arm-randconfig-004-20240927 (https://download.01.org/0day-ci/archive/20240927/202409271127.PcxwlMWk-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 7773243d9916f98ba0ffce0c3a960e4aa9f03e81)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240927/202409271127.PcxwlMWk-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/202409271127.PcxwlMWk-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/iommu/iommu.c:9:
   In file included from include/linux/amba/bus.h:19:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:21:
   In file included from include/linux/mm.h:2232:
   include/linux/vmstat.h:517:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     517 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> drivers/iommu/iommu.c:1739:17: error: static assertion failed due to requirement '!(1 && 1)': !(IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) && IS_ENABLED(CONFIG_IOMMU_DMA))
    1739 |                 static_assert(!(IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) &&
         |                 ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1740 |                                 IS_ENABLED(CONFIG_IOMMU_DMA)));
         |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
      77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
         |                                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   1 warning and 1 error generated.


vim +1739 drivers/iommu/iommu.c

59ddce4418da48 Jason Gunthorpe 2023-09-13  1718  
59ddce4418da48 Jason Gunthorpe 2023-09-13  1719  /*
59ddce4418da48 Jason Gunthorpe 2023-09-13  1720   * A target_type of 0 will select the best domain type. 0 can be returned in
59ddce4418da48 Jason Gunthorpe 2023-09-13  1721   * this case meaning the global default should be used.
59ddce4418da48 Jason Gunthorpe 2023-09-13  1722   */
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1723  static int iommu_get_default_domain_type(struct iommu_group *group,
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1724  					 int target_type)
deac0b3bed26bb Joerg Roedel    2020-04-29  1725  {
59ddce4418da48 Jason Gunthorpe 2023-09-13  1726  	struct device *untrusted = NULL;
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1727  	struct group_device *gdev;
59ddce4418da48 Jason Gunthorpe 2023-09-13  1728  	int driver_type = 0;
deac0b3bed26bb Joerg Roedel    2020-04-29  1729  
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1730  	lockdep_assert_held(&group->mutex);
deac0b3bed26bb Joerg Roedel    2020-04-29  1731  
e98befd010bd56 Jason Gunthorpe 2023-09-13  1732  	/*
e98befd010bd56 Jason Gunthorpe 2023-09-13  1733  	 * ARM32 drivers supporting CONFIG_ARM_DMA_USE_IOMMU can declare an
e98befd010bd56 Jason Gunthorpe 2023-09-13  1734  	 * identity_domain and it will automatically become their default
e98befd010bd56 Jason Gunthorpe 2023-09-13  1735  	 * domain. Later on ARM_DMA_USE_IOMMU will install its UNMANAGED domain.
98ac73f99bc44f Jason Gunthorpe 2023-09-13  1736  	 * Override the selection to IDENTITY.
e98befd010bd56 Jason Gunthorpe 2023-09-13  1737  	 */
98ac73f99bc44f Jason Gunthorpe 2023-09-13  1738  	if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) {
98ac73f99bc44f Jason Gunthorpe 2023-09-13 @1739  		static_assert(!(IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) &&
98ac73f99bc44f Jason Gunthorpe 2023-09-13  1740  				IS_ENABLED(CONFIG_IOMMU_DMA)));
e98befd010bd56 Jason Gunthorpe 2023-09-13  1741  		driver_type = IOMMU_DOMAIN_IDENTITY;
98ac73f99bc44f Jason Gunthorpe 2023-09-13  1742  	}
e98befd010bd56 Jason Gunthorpe 2023-09-13  1743  
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1744  	for_each_group_device(group, gdev) {
59ddce4418da48 Jason Gunthorpe 2023-09-13  1745  		driver_type = iommu_get_def_domain_type(group, gdev->dev,
59ddce4418da48 Jason Gunthorpe 2023-09-13  1746  							driver_type);
deac0b3bed26bb Joerg Roedel    2020-04-29  1747  
e98befd010bd56 Jason Gunthorpe 2023-09-13  1748  		if (dev_is_pci(gdev->dev) && to_pci_dev(gdev->dev)->untrusted) {
e98befd010bd56 Jason Gunthorpe 2023-09-13  1749  			/*
e98befd010bd56 Jason Gunthorpe 2023-09-13  1750  			 * No ARM32 using systems will set untrusted, it cannot
e98befd010bd56 Jason Gunthorpe 2023-09-13  1751  			 * work.
e98befd010bd56 Jason Gunthorpe 2023-09-13  1752  			 */
e98befd010bd56 Jason Gunthorpe 2023-09-13  1753  			if (WARN_ON(IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)))
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1754  				return -1;
59ddce4418da48 Jason Gunthorpe 2023-09-13  1755  			untrusted = gdev->dev;
59ddce4418da48 Jason Gunthorpe 2023-09-13  1756  		}
deac0b3bed26bb Joerg Roedel    2020-04-29  1757  	}
deac0b3bed26bb Joerg Roedel    2020-04-29  1758  
0f6a90436a5771 Jason Gunthorpe 2023-10-03  1759  	/*
0f6a90436a5771 Jason Gunthorpe 2023-10-03  1760  	 * If the common dma ops are not selected in kconfig then we cannot use
0f6a90436a5771 Jason Gunthorpe 2023-10-03  1761  	 * IOMMU_DOMAIN_DMA at all. Force IDENTITY if nothing else has been
0f6a90436a5771 Jason Gunthorpe 2023-10-03  1762  	 * selected.
0f6a90436a5771 Jason Gunthorpe 2023-10-03  1763  	 */
0f6a90436a5771 Jason Gunthorpe 2023-10-03  1764  	if (!IS_ENABLED(CONFIG_IOMMU_DMA)) {
0f6a90436a5771 Jason Gunthorpe 2023-10-03  1765  		if (WARN_ON(driver_type == IOMMU_DOMAIN_DMA))
0f6a90436a5771 Jason Gunthorpe 2023-10-03  1766  			return -1;
0f6a90436a5771 Jason Gunthorpe 2023-10-03  1767  		if (!driver_type)
0f6a90436a5771 Jason Gunthorpe 2023-10-03  1768  			driver_type = IOMMU_DOMAIN_IDENTITY;
deac0b3bed26bb Joerg Roedel    2020-04-29  1769  	}
0f6a90436a5771 Jason Gunthorpe 2023-10-03  1770  
59ddce4418da48 Jason Gunthorpe 2023-09-13  1771  	if (untrusted) {
59ddce4418da48 Jason Gunthorpe 2023-09-13  1772  		if (driver_type && driver_type != IOMMU_DOMAIN_DMA) {
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1773  			dev_err_ratelimited(
59ddce4418da48 Jason Gunthorpe 2023-09-13  1774  				untrusted,
59ddce4418da48 Jason Gunthorpe 2023-09-13  1775  				"Device is not trusted, but driver is overriding group %u to %s, refusing to probe.\n",
59ddce4418da48 Jason Gunthorpe 2023-09-13  1776  				group->id, iommu_domain_type_str(driver_type));
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1777  			return -1;
deac0b3bed26bb Joerg Roedel    2020-04-29  1778  		}
59ddce4418da48 Jason Gunthorpe 2023-09-13  1779  		driver_type = IOMMU_DOMAIN_DMA;
deac0b3bed26bb Joerg Roedel    2020-04-29  1780  	}
59ddce4418da48 Jason Gunthorpe 2023-09-13  1781  
59ddce4418da48 Jason Gunthorpe 2023-09-13  1782  	if (target_type) {
59ddce4418da48 Jason Gunthorpe 2023-09-13  1783  		if (driver_type && target_type != driver_type)
59ddce4418da48 Jason Gunthorpe 2023-09-13  1784  			return -1;
59ddce4418da48 Jason Gunthorpe 2023-09-13  1785  		return target_type;
deac0b3bed26bb Joerg Roedel    2020-04-29  1786  	}
59ddce4418da48 Jason Gunthorpe 2023-09-13  1787  	return driver_type;
deac0b3bed26bb Joerg Roedel    2020-04-29  1788  }
deac0b3bed26bb Joerg Roedel    2020-04-29  1789  

:::::: The code at line 1739 was first introduced by commit
:::::: 98ac73f99bc44fba8a14252ffb0bad02459f7008 iommu: Require a default_domain for all iommu drivers

:::::: TO: Jason Gunthorpe <jgg@nvidia.com>
:::::: CC: Joerg Roedel <jroedel@suse.de>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2024-09-27  3:44 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=202409271127.PcxwlMWk-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=emil.renner.berthing@canonical.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=samuel@sholland.org \
    /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