All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH v4 09/25] iommu: Allow an IDENTITY domain as the default_domain in ARM32
Date: Sat, 17 Jun 2023 14:28:08 +0800	[thread overview]
Message-ID: <202306171458.LfWLILeK-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <9-v4-874277bde66e+1a9f6-iommu_all_defdom_jgg@nvidia.com>
References: <9-v4-874277bde66e+1a9f6-iommu_all_defdom_jgg@nvidia.com>
TO: Jason Gunthorpe <jgg@nvidia.com>

Hi Jason,

kernel test robot noticed the following build warnings:

[auto build test WARNING on fe420865bd74f5917ff0d8d38a46fbbbe5dd1ea6]

url:    https://github.com/intel-lab-lkp/linux/commits/Jason-Gunthorpe/iommu-Add-iommu_ops-identity_domain/20230617-032631
base:   fe420865bd74f5917ff0d8d38a46fbbbe5dd1ea6
patch link:    https://lore.kernel.org/r/9-v4-874277bde66e%2B1a9f6-iommu_all_defdom_jgg%40nvidia.com
patch subject: [PATCH v4 09/25] iommu: Allow an IDENTITY domain as the default_domain in ARM32
:::::: branch date: 11 hours ago
:::::: commit date: 11 hours ago
config: arm-randconfig-m031-20230611 (https://download.01.org/0day-ci/archive/20230617/202306171458.LfWLILeK-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230617/202306171458.LfWLILeK-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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202306171458.LfWLILeK-lkp@intel.com/

smatch warnings:
drivers/iommu/iommu.c:1800 iommu_get_default_domain_type() error: potentially dereferencing uninitialized 'gdev'.

vim +/gdev +1800 drivers/iommu/iommu.c

d72e31c9374627 Alex Williamson 2012-05-30  1746  
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1747  /* A target_type of 0 will select the best domain type and cannot fail */
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1748  static int iommu_get_default_domain_type(struct iommu_group *group,
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1749  					 int target_type)
deac0b3bed26bb Joerg Roedel    2020-04-29  1750  {
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1751  	const struct iommu_ops *ops = dev_iommu_ops(
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1752  		list_first_entry(&group->devices, struct group_device, list)
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1753  			->dev);
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1754  	int best_type = target_type;
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1755  	struct group_device *gdev;
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1756  	struct device *last_dev;
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1757  	int type;
deac0b3bed26bb Joerg Roedel    2020-04-29  1758  
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1759  	lockdep_assert_held(&group->mutex);
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1760  
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1761  	/*
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1762  	 * ARM32 drivers supporting CONFIG_ARM_DMA_USE_IOMMU can declare an
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1763  	 * identity_domain and it will automatically become their default
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1764  	 * domain. Later on ARM_DMA_USE_IOMMU will install its UNMANAGED domain.
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1765  	 * Override the selection to IDENTITY if we are sure the driver supports
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1766  	 * it.
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1767  	 */
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1768  	if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) && ops->identity_domain) {
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1769  		type = IOMMU_DOMAIN_IDENTITY;
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1770  		if (best_type && type && best_type != type)
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1771  			goto err;
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1772  		best_type = target_type = IOMMU_DOMAIN_IDENTITY;
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1773  	}
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1774  
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1775  	for_each_group_device(group, gdev) {
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1776  		type = best_type;
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1777  		if (ops->def_domain_type) {
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1778  			type = ops->def_domain_type(gdev->dev);
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1779  			if (best_type && type && best_type != type) {
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1780  				/* Stick with the last driver override we saw */
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1781  				best_type = type;
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1782  				goto err;
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1783  			}
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1784  		}
deac0b3bed26bb Joerg Roedel    2020-04-29  1785  
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1786  		/* No ARM32 using systems will set untrusted, it cannot work. */
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1787  		if (dev_is_pci(gdev->dev) && to_pci_dev(gdev->dev)->untrusted &&
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1788  		    !WARN_ON(IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU))) {
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1789  			type = IOMMU_DOMAIN_DMA;
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1790  			if (best_type && type && best_type != type)
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1791  				goto err;
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1792  		}
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1793  		best_type = type;
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1794  		last_dev = gdev->dev;
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1795  	}
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1796  	return best_type;
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1797  
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1798  err:
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1799  	if (target_type) {
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11 @1800  		dev_err_ratelimited(
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1801  			gdev->dev,
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1802  			"Device cannot be in %s domain - it is forcing %s\n",
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1803  			iommu_domain_type_str(target_type),
ddaf433cac2995 Jason Gunthorpe 2023-06-16  1804  			iommu_domain_type_str(type));
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1805  		return -1;
deac0b3bed26bb Joerg Roedel    2020-04-29  1806  	}
deac0b3bed26bb Joerg Roedel    2020-04-29  1807  
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1808  	dev_warn(
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1809  		gdev->dev,
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1810  		"Device needs domain type %s, but device %s in the same iommu group requires type %s - using default\n",
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1811  		iommu_domain_type_str(type), dev_name(last_dev),
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1812  		iommu_domain_type_str(best_type));
03c9e7d1dd3c99 Jason Gunthorpe 2023-06-16  1813  	return best_type;
8b4eb75ee50e6f Jason Gunthorpe 2023-05-11  1814  }
deac0b3bed26bb Joerg Roedel    2020-04-29  1815  

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

             reply	other threads:[~2023-06-17  6:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-17  6:28 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-06-16 19:02 [PATCH v4 00/25] iommu: Make default_domain's mandatory Jason Gunthorpe
2023-06-16 19:02 ` [PATCH v4 09/25] iommu: Allow an IDENTITY domain as the default_domain in ARM32 Jason Gunthorpe
2023-06-16 19:02   ` Jason Gunthorpe
2023-06-16 19:02   ` Jason Gunthorpe
2023-06-16 19:02   ` Jason Gunthorpe
2023-06-17 11:38   ` Dan Carpenter
2023-06-19 18:48     ` Jason Gunthorpe

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=202306171458.LfWLILeK-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@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.