From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.19 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796556538; b=Us+zepFKTJ8dtHYXKC9oSb/q22AMpiQvpzOIqMLK+o9Ah2SFB+n66zjsODFIpor1k/SE xJZtxJx+GgYrbhwrEewl6gXrc7cTZpcnJoLnisdzJtYJshYb+Cc52t3y7SCkEdY3QEEYn cM17bkrtyXUe4tv5EbFIUinGxwA+4TyRf0kgVRzPM1aeC/LyjaOeODLgUz+kac36Ic/nm TrXTFsd2M/Jdza7pCXU09CMK543t0vBP2fktt6z5BInZEyx1zFqgHfypRCVR35M0kBDuq 2IRzHK1u8He2KZdg0qWj2ylqzVLl0g7uS2UpUQn7I2+3ApLCOtuCB/4poCfnms2qiXg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796556538; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:Date:From:To: Cc:Subject:Message-ID:User-Agent; bh=gfIE8cZjV9cvAZ0gCLXPgeKQHOaZATE5N+0vTfC3fp0=; b=D8YelK/JmIidBrEDsedViv8slm/q7lHkgK1fWMKD6EESnxJf3YyMAOo/DA/EHrjRi+RW BOyRBparWETcPV29KB1WhOl015if3F2gMyytGbUB4CYDdsFBHCyw8ulf3BSYPY12y3HOu 2I+Pi+UT7avmXT00AD6brEGJgBsa5m5Q3zEKzDsu3+B4ihH7/7YIAv4kTUmuWz8mUyhqg 7mp67KLXlsUvIO++YSlH71KKyUr30VhSY2XZ/HPJhhUr6cLirovUHOuTks9usNeIE1ZW1 egSB3N1ich6poXPdeo1GIs5DS+x10joLNMA3N7YUfMw+VY8ZgxpefZ+igJoIBWBq4Wg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=AtN2ema8; arc=none smtp.remote-ip=192.198.163.19 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFEEA606A334 for ; Sun, 6 Dec 2026 11:28:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CFEEA606A334 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=AtN2ema8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796556537; x=1828092537; h=date:from:to:cc:subject:message-id; bh=gfIE8cZjV9cvAZ0gCLXPgeKQHOaZATE5N+0vTfC3fp0=; b=AtN2ema807HDwUZL5MTZplDvGKE/6VdzuJQlCRHqMothp9dFT/NeYXyM wJsXO8azHDKRN0qXxw/mu8isjNSxZHYC7rfTJVe/c6qa2M8mLGJ5t+HWo /V+hsCrwPf5gRrnV7yPcnQpA3+xir+ZYEY+aeu3w7Oz9hD/8UfBwdDhUp pkLYH9srkOeX5uOi7YM0tZ48oGUF4DTrojc73DfeKx7UWxiMyarQjAoCB 2yqiRDWJaJLJww9qga80TQOXyh/Osp+9zWLzK0G14/pSR0KBAosGw/Rwm 1O+kHb3eqCE/fSa1j/xyD4AjsmSROLbVRp2FeWWro30XLuDBGhQ7DSugb Q==; X-CSE-ConnectionGUID: yUaR7Xe+TSatgqbiat5R1Q== X-CSE-MsgGUID: vzmbzh1KT3i6pBDz+yJSeQ== X-IronPort-AV: E=McAfee;i="6800,10657,11988"; a="5498711" X-IronPort-AV: E=Sophos;i="6.29,81,1794902400"; d="scan'208";a="5498711" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2026 03:28:56 -0800 X-CSE-ConnectionGUID: hn+VOCx/SRuH+7001QKlIg== X-CSE-MsgGUID: 2b2DvszgSYu9d7VeCjtcSw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,81,1794902400"; d="scan'208";a="14804115" Received: from igk-lkp-server01.igk.intel.com (HELO 146cf1e082f1) ([10.211.93.152]) by fmviesa006.fm.intel.com with ESMTP; 06 Dec 2026 03:28:55 -0800 Received: from kbuild by 146cf1e082f1 with local (Exim 4.98.2) (envelope-from ) id 1xaAQH-000000004wj-0to8; Sun, 06 Dec 2026 11:28:53 +0000 Date: Sun, 06 Dec 2026 12:28:09 +0100 From: kernel test robot To: Jason Gunthorpe Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Joerg Roedel , Tomasz Jeznach Subject: drivers/iommu/riscv/iommu.c:164:29: sparse: sparse: incorrect type in assignment (different address spaces) Message-ID: <20261204213420.lxpla6QX-lkp@intel.com> User-Agent: s-nail v14.9.25 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Hi Jason, First bad commit (maybe != root cause): tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 5dff0c81e94cd72d52bdfbb6044462c1be10f8d0 commit: 7cd0c655f02f08a5de851059ac8360e5d10fae62 iommu/riscv: Allow RISC_VIOMMU to COMPILE_TEST date: 9 months ago config: powerpc64-randconfig-r2308-20261203 (https://download.01.org/0day-ci/archive/20261204/20261204213420.lxpla6QX-lkp@intel.com/config) compiler: powerpc64-linux-gcc (GCC) 11.5.0 sparse: v0.6.5-rc1-94-g0d159c10 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261204/20261204213420.lxpla6QX-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 | Fixes: 7cd0c655f02f ("iommu/riscv: Allow RISC_VIOMMU to COMPILE_TEST") | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/20261204213420.lxpla6QX-lkp@intel.com/ sparse warnings: (new ones prefixed by >>) >> drivers/iommu/riscv/iommu.c:164:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *base @@ got void [noderef] __iomem * @@ drivers/iommu/riscv/iommu.c:164:29: sparse: expected void *base drivers/iommu/riscv/iommu.c:164:29: sparse: got void [noderef] __iomem * >> drivers/iommu/riscv/iommu.c:700:41: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected unsigned long long [usertype] *ddt_root @@ got void [noderef] __iomem * @@ drivers/iommu/riscv/iommu.c:700:41: sparse: expected unsigned long long [usertype] *ddt_root drivers/iommu/riscv/iommu.c:700:41: sparse: got void [noderef] __iomem * drivers/iommu/riscv/iommu.c:859:16: sparse: sparse: Initializer entry defined twice drivers/iommu/riscv/iommu.c:859:16: sparse: also defined here drivers/iommu/riscv/iommu.c:1184:18: sparse: sparse: Initializer entry defined twice drivers/iommu/riscv/iommu.c:1184:18: sparse: also defined here drivers/iommu/riscv/iommu.c:1293:16: sparse: sparse: Initializer entry defined twice drivers/iommu/riscv/iommu.c:1293:16: sparse: also defined here vim +164 drivers/iommu/riscv/iommu.c 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 123 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 124 /* 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 125 * Discover queue ring buffer hardware configuration, allocate in-memory 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 126 * ring buffer or use fixed I/O memory location, configure queue base register. 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 127 * Must be called before hardware queue is enabled. 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 128 * 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 129 * @queue - data structure, configured with RISCV_IOMMU_QUEUE_INIT() 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 130 * @entry_size - queue single element size in bytes. 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 131 */ 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 132 static int riscv_iommu_queue_alloc(struct riscv_iommu_device *iommu, 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 133 struct riscv_iommu_queue *queue, 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 134 size_t entry_size) 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 135 { 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 136 unsigned int logsz; 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 137 u64 qb, rb; 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 138 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 139 /* 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 140 * Use WARL base register property to discover maximum allowed 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 141 * number of entries and optional fixed IO address for queue location. 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 142 */ 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 143 riscv_iommu_writeq(iommu, queue->qbr, RISCV_IOMMU_QUEUE_LOG2SZ_FIELD); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 144 qb = riscv_iommu_readq(iommu, queue->qbr); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 145 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 146 /* 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 147 * Calculate and verify hardware supported queue length, as reported 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 148 * by the field LOG2SZ, where max queue length is equal to 2^(LOG2SZ + 1). 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 149 * Update queue size based on hardware supported value. 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 150 */ 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 151 logsz = ilog2(queue->mask); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 152 if (logsz > FIELD_GET(RISCV_IOMMU_QUEUE_LOG2SZ_FIELD, qb)) 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 153 logsz = FIELD_GET(RISCV_IOMMU_QUEUE_LOG2SZ_FIELD, qb); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 154 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 155 /* 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 156 * Use WARL base register property to discover an optional fixed IO 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 157 * address for queue ring buffer location. Otherwise allocate contiguous 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 158 * system memory. 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 159 */ 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 160 if (FIELD_GET(RISCV_IOMMU_PPN_FIELD, qb)) { 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 161 const size_t queue_size = entry_size << (logsz + 1); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 162 7cd0c655f02f08a Jason Gunthorpe 2026-02-27 163 queue->phys = PFN_PHYS(FIELD_GET(RISCV_IOMMU_PPN_FIELD, qb)); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 @164 queue->base = devm_ioremap(iommu->dev, queue->phys, queue_size); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 165 } else { 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 166 do { 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 167 const size_t queue_size = entry_size << (logsz + 1); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 168 9dda3f01ddf056e Jason Gunthorpe 2025-04-08 169 queue->base = riscv_iommu_get_pages( 9dda3f01ddf056e Jason Gunthorpe 2025-04-08 170 iommu, max(queue_size, SZ_4K)); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 171 queue->phys = __pa(queue->base); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 172 } while (!queue->base && logsz-- > 0); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 173 } 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 174 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 175 if (!queue->base) 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 176 return -ENOMEM; 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 177 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 178 qb = phys_to_ppn(queue->phys) | 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 179 FIELD_PREP(RISCV_IOMMU_QUEUE_LOG2SZ_FIELD, logsz); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 180 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 181 /* Update base register and read back to verify hw accepted our write */ 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 182 riscv_iommu_writeq(iommu, queue->qbr, qb); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 183 rb = riscv_iommu_readq(iommu, queue->qbr); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 184 if (rb != qb) { 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 185 dev_err(iommu->dev, "queue #%u allocation failed\n", queue->qid); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 186 return -ENODEV; 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 187 } 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 188 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 189 /* Update actual queue mask */ 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 190 queue->mask = (2U << logsz) - 1; 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 191 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 192 dev_dbg(iommu->dev, "queue #%u allocated 2^%u entries", 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 193 queue->qid, logsz + 1); 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 194 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 195 return 0; 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 196 } 856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 197 :::::: The code at line 164 was first introduced by commit :::::: 856c0cfe5c5f6a2cc8d995872eb67bff9c68c57c iommu/riscv: Command and fault queue support :::::: TO: Tomasz Jeznach :::::: CC: Joerg Roedel -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki