From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70EC7C61D85 for ; Tue, 21 Nov 2023 04:21:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D9F336B036E; Mon, 20 Nov 2023 23:21:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D4F776B0377; Mon, 20 Nov 2023 23:21:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF05B6B037E; Mon, 20 Nov 2023 23:21:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A74946B036E for ; Mon, 20 Nov 2023 23:21:08 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7A8561CB518 for ; Tue, 21 Nov 2023 04:21:08 +0000 (UTC) X-FDA: 81480661416.02.2C529CD Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by imf04.hostedemail.com (Postfix) with ESMTP id 0880540011 for ; Tue, 21 Nov 2023 04:21:03 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=lN26qvME; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf04.hostedemail.com: domain of lkp@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=lkp@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700540465; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=cABHRwYosbDCZfSeiuurkQYwoaDwEF5H4D+9fpiEWZU=; b=sD7l3vTd0JaR80xNMJnnXmIgrWop4PusU1AgaCn0XdIBx0DkWWqbf3UDIzUBtfIeruCVWY MnENzcF6iZHq3OT1mWJ5ZRKO/1XwyhHWwscSRsD40IdJZGWaVJee1R5d7/NIGQWwj2nupu dX6PDTfneo6hlG39sZ0olS6nEVYsh3k= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=lN26qvME; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf04.hostedemail.com: domain of lkp@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=lkp@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700540465; a=rsa-sha256; cv=none; b=I1B5tr97IEWFNgxgwRsNei4hYstrvmPQrpWhaBLer/82wG6Y50vRkPBSAjgfxAtMq2NGP2 EdZ42svdI6lQhpXnOgsHa3SqiS1mD2GvnjTtsdRK82NxmmAW6wY4xH1rPhGDMq1idJYJ+P D8PDPYf6b6thRfrlaO5FlLQUDs8ampI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700540464; x=1732076464; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=HeOnsAotLtBAwdDsWn9Pxx0cziA4oaRFyuEBXtVa+Ow=; b=lN26qvMEQvdeNCM6Jqq7x72wtp6KpjyWdxUUolFJoc+9p/71To61xqqb 76fqOEQtztYspmg2y8gDVUVgRYMtdZLpYwkROz1GP6Xy58fo9VY3w+Ka2 3D3y+w+sBtsuL4IWT8n990S7BAaGCel8sFrlQB7poCPwX6QHa5j8ABIlN CPCnyM1F4nqKK7cvn60yo6QwADDOVyzogS/mPT2cYU0fHd7PBvKA0X3wd DM/D8VKrSdvPzHCd06g9gWS8E1xJSgKDjAL/AMYpzwpzg4zZzlhJU+Wje VGa7qBYuPHP76gkFwuRX4VsbbgrlzwXH/MmiAfDv8H1EEcBPDZCl887df w==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="395690891" X-IronPort-AV: E=Sophos;i="6.04,215,1695711600"; d="scan'208";a="395690891" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 20:21:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,215,1695711600"; d="scan'208";a="14376311" Received: from lkp-server02.sh.intel.com (HELO b8de5498638e) ([10.239.97.151]) by orviesa001.jf.intel.com with ESMTP; 20 Nov 2023 20:20:31 -0800 Received: from kbuild by b8de5498638e with local (Exim 4.96) (envelope-from ) id 1r5IFQ-0007Hu-2N; Tue, 21 Nov 2023 04:20:28 +0000 Date: Tue, 21 Nov 2023 12:20:11 +0800 From: kernel test robot To: Philipp Stanner , Bjorn Helgaas , Arnd Bergmann , Andrew Morton , Randy Dunlap , Jason Gunthorpe , Eric Auger , Kent Overstreet , Niklas Schnelle , NeilBrown , John Sanpe , Dave Jiang , Yury Norov , Kees Cook , "Masami Hiramatsu (Google)" , David Gow , Herbert Xu , Thomas Gleixner , "wuqiang.matt" , Jason Baron , Ben Dooks , Danilo Krummrich Cc: oe-kbuild-all@lists.linux.dev, Linux Memory Management List , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH 1/4] lib: move pci_iomap.c to drivers/pci/ Message-ID: <202311211216.KqPYvOCI-lkp@intel.com> References: <20231120215945.52027-3-pstanner@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231120215945.52027-3-pstanner@redhat.com> X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 0880540011 X-Stat-Signature: brpqkkdexg9o6cruwyw1ohr1kt93cqko X-HE-Tag: 1700540463-203749 X-HE-Meta: U2FsdGVkX1/TT1/e8zJ+yjB+8sl7gih4MhqZkBiOKVwR+nV7cyvu1hotfhsaDyF+so6dv/JsJmGqBCgmTcbj9vjhxsFQssFmsbyd+RWw2NQ/AJVdh/Q2tgLAlM/mR6pQTd6f7Rvp31hgxzEAMLFwygXyEeu3WApkOxkiVniudtYZcwAye6bNI4oKc9o36QSpPsWjIvtQDQrXVzTzua6BfCyl+F16mWC2ZwnVIIeI1rqY9q/l9FA26Ixy/nHgGS7vuqgdu0hBAV7kBG7euOwaIwIeXcmO8a03fPYtt/RwZH0XvhSCTvScAVF25Tc549MJQ4sisr8oqeREq+slJmcbBdua0jw4fX8uJCXDLoGJDza5vQ0EDZCoqN30teFuag4K8t+ZomsDjgymMU4aOgykpIZW1RrD4vTt7/cxg84dOzB+4MDZgaUKD7Q13h21Xc1oPqJ+ARqXJp1PsskFKCkGkXrOHdf62ipwlLkobVFrZUKhTpRma6PjAeeEz08uG8xVJo5sJHZ16e2VfbxdYOtFdCcPSECELgPI83Cupc3tHJjdrmF4T6ViinjY+DT+EPet9DcEsZZgAEDeKY5Cn3r2mEJZwE+D4zHQuP8N9DXeWkWaiCzLPY+FYLRipKJPWerajE8VlKBFfbCYt8L+IFBE/RnY7lkn48H35n3lFIpK01wWI1mPLYs4JKIHS9QAiiqC6znhtLEK8Z03k82wZf7VrHUapGSomM1eDXRFjaW2Vma6uWFhnmX4w79akk0Fz7Z9BZcc7OfrnRRYYBq2hJe/UF7YauKv22LquK26uWNijdt4sNsaPje917GXrvq80jKywC5n94QotmeEn15M2IX+ho0WjOQLLvhrZtHtUO4xYXzUca9H+DIObA80OxCf3xSrxp9Ufj/x7drRJVmdgW0+yBMWZ36v+YkeJfDXV2xnZdxRYLe4OXrWX+UTqOXGC/y+V39W18/bVbICgpOQTIy OCOQUKDH QrfLqDChCbzJIVhloUJDsluQsOyqk5lxviUymErBXRIbhk1rsO0lyOSSgMiXpqohcpdP6EUDADykbAlXnHs3SDHdwl216ht6rCRjZyj/FoyxWUw93X39zYhLgYssOYeon+whoeh4Og8+iSRjehEAMJsgstv5Uhalo4aSZ2AVIRqpXkrw8KDEEi3mZnk19VYtx+9OyEPRU5FSeVnczXfPeT+Caaqti1QhwGbJEFHpudbkFvvsMzc1EqAna5FJNA/lXqOQQSS+mLohZmljE6/Yn3EtTjTAiYqgxMUL4SCqhn8hP0anU7QytUkV4VW55lia+wZR3lXLeBjdL1c0wcWVyAE3mN25TK4NijetPIvCYBDztxpgLNWl/W/QVs25AFetQxKND3Cs5bGmcaSIuyJ/VA24pLGOwBTUe3rmjbXUE4+vuPNf4clXTCO47CAnBE4g67OS6bC32QZzEvQ7mmEE0Y8TnNB0gGPvxlMqAOiWN9dOrregJKcO6eJEiQWARP5NOtFcY X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi Philipp, kernel test robot noticed the following build errors: [auto build test ERROR on pci/next] [also build test ERROR on pci/for-linus linus/master v6.7-rc2 next-20231120] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Philipp-Stanner/lib-move-pci_iomap-c-to-drivers-pci/20231121-060258 base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next patch link: https://lore.kernel.org/r/20231120215945.52027-3-pstanner%40redhat.com patch subject: [PATCH 1/4] lib: move pci_iomap.c to drivers/pci/ config: openrisc-allnoconfig (https://download.01.org/0day-ci/archive/20231121/202311211216.KqPYvOCI-lkp@intel.com/config) compiler: or1k-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231121/202311211216.KqPYvOCI-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 | Closes: https://lore.kernel.org/oe-kbuild-all/202311211216.KqPYvOCI-lkp@intel.com/ All error/warnings (new ones prefixed by >>): >> drivers/pci/iomap.c:27:15: error: redefinition of 'pci_iomap_range' 27 | void __iomem *pci_iomap_range(struct pci_dev *dev, | ^~~~~~~~~~~~~~~ In file included from include/asm-generic/io.h:20, from arch/openrisc/include/asm/io.h:37, from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from ./arch/openrisc/include/generated/asm/hardirq.h:1, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/pci.h:38, from drivers/pci/iomap.c:7: include/asm-generic/pci_iomap.h:44:29: note: previous definition of 'pci_iomap_range' with type 'void *(struct pci_dev *, int, long unsigned int, long unsigned int)' 44 | static inline void __iomem *pci_iomap_range(struct pci_dev *dev, int bar, | ^~~~~~~~~~~~~~~ drivers/pci/iomap.c: In function 'pci_iomap_range': >> drivers/pci/iomap.c:43:24: error: implicit declaration of function '__pci_ioport_map'; did you mean 'devm_ioport_map'? [-Werror=implicit-function-declaration] 43 | return __pci_ioport_map(dev, start, len); | ^~~~~~~~~~~~~~~~ | devm_ioport_map >> drivers/pci/iomap.c:43:24: warning: returning 'int' from a function with return type 'void *' makes pointer from integer without a cast [-Wint-conversion] 43 | return __pci_ioport_map(dev, start, len); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/pci/iomap.c: At top level: >> drivers/pci/iomap.c:67:15: error: redefinition of 'pci_iomap_wc_range' 67 | void __iomem *pci_iomap_wc_range(struct pci_dev *dev, | ^~~~~~~~~~~~~~~~~~ include/asm-generic/pci_iomap.h:50:29: note: previous definition of 'pci_iomap_wc_range' with type 'void *(struct pci_dev *, int, long unsigned int, long unsigned int)' 50 | static inline void __iomem *pci_iomap_wc_range(struct pci_dev *dev, int bar, | ^~~~~~~~~~~~~~~~~~ >> drivers/pci/iomap.c:110:15: error: redefinition of 'pci_iomap' 110 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | ^~~~~~~~~ include/asm-generic/pci_iomap.h:35:29: note: previous definition of 'pci_iomap' with type 'void *(struct pci_dev *, int, long unsigned int)' 35 | static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) | ^~~~~~~~~ >> drivers/pci/iomap.c:131:15: error: redefinition of 'pci_iomap_wc' 131 | void __iomem *pci_iomap_wc(struct pci_dev *dev, int bar, unsigned long maxlen) | ^~~~~~~~~~~~ include/asm-generic/pci_iomap.h:40:29: note: previous definition of 'pci_iomap_wc' with type 'void *(struct pci_dev *, int, long unsigned int)' 40 | static inline void __iomem *pci_iomap_wc(struct pci_dev *dev, int bar, unsigned long max) | ^~~~~~~~~~~~ >> drivers/pci/iomap.c:164:6: error: redefinition of 'pci_iounmap' 164 | void pci_iounmap(struct pci_dev *dev, void __iomem *p) | ^~~~~~~~~~~ include/asm-generic/pci_iomap.h:56:20: note: previous definition of 'pci_iounmap' with type 'void(struct pci_dev *, void *)' 56 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) | ^~~~~~~~~~~ cc1: some warnings being treated as errors Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for GENERIC_PCI_IOMAP Depends on [n]: PCI [=n] Selected by [y]: - OPENRISC [=y] vim +/pci_iomap_range +27 drivers/pci/iomap.c 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 11 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 12 /** eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 13 * pci_iomap_range - create a virtual mapping cookie for a PCI BAR 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 14 * @dev: PCI device that owns the BAR 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 15 * @bar: BAR number eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 16 * @offset: map memory at the given offset in BAR eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 17 * @maxlen: max length of the memory to map 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 18 * 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 19 * Using this function you will get a __iomem address to your device BAR. 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 20 * You can access it using ioread*() and iowrite*(). These functions hide 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 21 * the details if this is a MMIO or PIO address space and will just do what 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 22 * you expect from them in the correct way. 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 23 * 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 24 * @maxlen specifies the maximum length to map. If you want to get access to eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 25 * the complete BAR from offset to the end, pass %0 here. 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 26 * */ eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 @27 void __iomem *pci_iomap_range(struct pci_dev *dev, eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 28 int bar, eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 29 unsigned long offset, eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 30 unsigned long maxlen) 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 31 { 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 32 resource_size_t start = pci_resource_start(dev, bar); 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 33 resource_size_t len = pci_resource_len(dev, bar); 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 34 unsigned long flags = pci_resource_flags(dev, bar); 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 35 eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 36 if (len <= offset || !start) 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 37 return NULL; eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 38 len -= offset; eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 39 start += offset; 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 40 if (maxlen && len > maxlen) 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 41 len = maxlen; 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 42 if (flags & IORESOURCE_IO) b923650b84068b lib/pci_iomap.c Michael S. Tsirkin 2012-01-30 @43 return __pci_ioport_map(dev, start, len); 92b19ff50e8f24 lib/pci_iomap.c Dan Williams 2015-08-10 44 if (flags & IORESOURCE_MEM) 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 45 return ioremap(start, len); 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 46 /* What? */ 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 47 return NULL; 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 48 } eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 49 EXPORT_SYMBOL(pci_iomap_range); 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 50 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 51 /** 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 52 * pci_iomap_wc_range - create a virtual WC mapping cookie for a PCI BAR 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 53 * @dev: PCI device that owns the BAR 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 54 * @bar: BAR number 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 55 * @offset: map memory at the given offset in BAR 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 56 * @maxlen: max length of the memory to map 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 57 * 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 58 * Using this function you will get a __iomem address to your device BAR. 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 59 * You can access it using ioread*() and iowrite*(). These functions hide 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 60 * the details if this is a MMIO or PIO address space and will just do what 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 61 * you expect from them in the correct way. When possible write combining 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 62 * is used. 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 63 * 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 64 * @maxlen specifies the maximum length to map. If you want to get access to 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 65 * the complete BAR from offset to the end, pass %0 here. 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 66 * */ 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 @67 void __iomem *pci_iomap_wc_range(struct pci_dev *dev, 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 68 int bar, 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 69 unsigned long offset, 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 70 unsigned long maxlen) 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 71 { 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 72 resource_size_t start = pci_resource_start(dev, bar); 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 73 resource_size_t len = pci_resource_len(dev, bar); 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 74 unsigned long flags = pci_resource_flags(dev, bar); 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 75 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 76 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 77 if (flags & IORESOURCE_IO) 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 78 return NULL; 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 79 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 80 if (len <= offset || !start) 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 81 return NULL; 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 82 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 83 len -= offset; 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 84 start += offset; 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 85 if (maxlen && len > maxlen) 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 86 len = maxlen; 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 87 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 88 if (flags & IORESOURCE_MEM) 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 89 return ioremap_wc(start, len); 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 90 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 91 /* What? */ 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 92 return NULL; 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 93 } 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 94 EXPORT_SYMBOL_GPL(pci_iomap_wc_range); 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 95 eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 96 /** eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 97 * pci_iomap - create a virtual mapping cookie for a PCI BAR eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 98 * @dev: PCI device that owns the BAR eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 99 * @bar: BAR number eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 100 * @maxlen: length of the memory to map eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 101 * eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 102 * Using this function you will get a __iomem address to your device BAR. eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 103 * You can access it using ioread*() and iowrite*(). These functions hide eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 104 * the details if this is a MMIO or PIO address space and will just do what eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 105 * you expect from them in the correct way. eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 106 * eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 107 * @maxlen specifies the maximum length to map. If you want to get access to eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 108 * the complete BAR without checking for its length first, pass %0 here. eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 109 * */ eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 @110 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 111 { eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 112 return pci_iomap_range(dev, bar, 0, maxlen); eb29d8d2aad706 lib/pci_iomap.c Michael S. Tsirkin 2013-05-29 113 } 66eab4df288aae lib/pci_iomap.c Michael S. Tsirkin 2011-11-24 114 EXPORT_SYMBOL(pci_iomap); 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 115 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 116 /** 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 117 * pci_iomap_wc - create a virtual WC mapping cookie for a PCI BAR 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 118 * @dev: PCI device that owns the BAR 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 119 * @bar: BAR number 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 120 * @maxlen: length of the memory to map 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 121 * 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 122 * Using this function you will get a __iomem address to your device BAR. 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 123 * You can access it using ioread*() and iowrite*(). These functions hide 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 124 * the details if this is a MMIO or PIO address space and will just do what 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 125 * you expect from them in the correct way. When possible write combining 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 126 * is used. 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 127 * 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 128 * @maxlen specifies the maximum length to map. If you want to get access to 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 129 * the complete BAR without checking for its length first, pass %0 here. 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 130 * */ 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 @131 void __iomem *pci_iomap_wc(struct pci_dev *dev, int bar, unsigned long maxlen) 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 132 { 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 133 return pci_iomap_wc_range(dev, bar, 0, maxlen); 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 134 } 1b3d4200c1e00a lib/pci_iomap.c Luis R. Rodriguez 2015-08-24 135 EXPORT_SYMBOL_GPL(pci_iomap_wc); 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 136 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 137 /* 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 138 * pci_iounmap() somewhat illogically comes from lib/iomap.c for the 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 139 * CONFIG_GENERIC_IOMAP case, because that's the code that knows about 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 140 * the different IOMAP ranges. 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 141 * 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 142 * But if the architecture does not use the generic iomap code, and if 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 143 * it has _not_ defined it's own private pci_iounmap function, we define 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 144 * it here. 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 145 * 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 146 * NOTE! This default implementation assumes that if the architecture 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 147 * support ioport mapping (HAS_IOPORT_MAP), the ioport mapping will 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 148 * be fixed to the range [ PCI_IOBASE, PCI_IOBASE+IO_SPACE_LIMIT [, 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 149 * and does not need unmapping with 'ioport_unmap()'. 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 150 * 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 151 * If you have different rules for your architecture, you need to 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 152 * implement your own pci_iounmap() that knows the rules for where 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 153 * and how IO vs MEM get mapped. 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 154 * 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 155 * This code is odd, and the ARCH_HAS/ARCH_WANTS #define logic comes 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 156 * from legacy header file behavior. In particular, 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 157 * it would seem to make sense to do the iounmap(p) for the non-IO-space 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 158 * case here regardless, but that's not what the old header file code 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 159 * did. Probably incorrectly, but this is meant to be bug-for-bug 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 160 * compatible. 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 161 */ 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 162 #if defined(ARCH_WANTS_GENERIC_PCI_IOUNMAP) 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 163 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 @164 void pci_iounmap(struct pci_dev *dev, void __iomem *p) 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 165 { 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 166 #ifdef ARCH_HAS_GENERIC_IOPORT_MAP 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 167 uintptr_t start = (uintptr_t) PCI_IOBASE; 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 168 uintptr_t addr = (uintptr_t) p; 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 169 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 170 if (addr >= start && addr < start + IO_SPACE_LIMIT) 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 171 return; 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 172 iounmap(p); 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 173 #endif 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 174 } 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 175 EXPORT_SYMBOL(pci_iounmap); 316e8d79a0959c lib/pci_iomap.c Linus Torvalds 2021-09-19 176 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki