Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp587035pxa; Wed, 19 Aug 2020 09:23:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqGPqQyM1d2m4K6l8svUD4AHSek9hhHJY8ELRsZsP9DyvYVGR9YKBAjACnYAaLGodfsLzI X-Received: by 2002:a17:906:37c3:: with SMTP id o3mr27367194ejc.54.1597854237709; Wed, 19 Aug 2020 09:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597854237; cv=none; d=google.com; s=arc-20160816; b=c/I3B3iKHlt3WSuKAIYQahUK/HiONftNecHcjziyIjBF1gRx6O/Dp9nUkndcliH3bD rw3Iei7Q43yaWyG5DBYUszpeFJZP7hDBJnkceXFalxnnn2zPn9+WORmgAtND+a3IR7Vn 68dpRKPMgePQxJiC/t6ECyr2cvDbbXnxBA/AF6Ozxx3hMQ2vJyYgGZRQQnlQHvcMepAz Bm0WwXc7BI3kfZRnFVv0D2ZBSjyAt3eKIMowMSo+E/ZtvpzX1zXHyctL25k6Su5h/Syb hLaw77GmtS8hJRJYeqtpu53pfpHHoHkAbgabL4K17EPUzljTPSZ9PL1f+YjoTRRoO0Yh GQjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=SIEBDEqt+TndDR3Oy+gr+t//mT7+V83M7R6Yny4slA4=; b=wftR0nSpyOPnOoviODu4vroqwuLxntC7MgBIAATBtjqVkVGGUVPQYcKyHW+zGEHrMn cSfR7p5FQ8fVX1Wufo2vgyW3OHXhlMz0ObIEJdJDyzYChATBTnoFxU7/2NkXYjlx5Sgl +fnv9LGc42K7XixiEiSVipH9i4PYaGEYEnIbgbzGU1Pm0PG0gKgIRNZONmXsjxkdBdr9 MEW/kK28y8XZ9faXY7JPEgMxHdIadESg+6CP9liHVD3QDFi6Bn2GboSg3NLZGsNjnBkG 1Obo0ReMncGKNuJ9bVF6Jq3vJHV5Lvq0hQ+SWYePx+dz+2CeAEGEoswNom9y1j6C2poV tuDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="ampZ/g+q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b7si19425923edz.404.2020.08.19.09.23.33; Wed, 19 Aug 2020 09:23:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="ampZ/g+q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726703AbgHSQWs (ORCPT + 99 others); Wed, 19 Aug 2020 12:22:48 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:58076 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726731AbgHSQWl (ORCPT ); Wed, 19 Aug 2020 12:22:41 -0400 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07JGJYrj024027; Wed, 19 Aug 2020 09:22:33 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=SIEBDEqt+TndDR3Oy+gr+t//mT7+V83M7R6Yny4slA4=; b=ampZ/g+qX8BWqKuw717DyS1h/uNtYLJD3LkVfbrgZGh/q+ktw3FYLizulrfI02VqFYCY hp1uKwNhOmsG6JcfYhQzfsZfZDHg5jdMiFiOPLAde5PwGHG2vqklEkdv6+k2ki/aQFkt pFHa3gSnyxZLSIjzJcW+dIiryo1NMYvzzt7pL1DgISMFdi4CicrFZiPKPsXdr/hPr7Jb MIudtlYxyV612XKcKlIHkrvksR2eS5wSS3QjWkG8qwuvDsCJa4/k84YPJNHWXGPNCX9S cfEYz6SH0WL0y0BxwTsh3Ze1Y3Dsqgy1EqW1yiNeq11LmLKzcWL9AJVpwgFGrbvOX9zL 9Q== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 3304fhrw4g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 19 Aug 2020 09:22:32 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 09:22:32 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 09:22:31 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 19 Aug 2020 09:22:31 -0700 Received: from hyd1584.caveonetworks.com (unknown [10.29.37.82]) by maili.marvell.com (Postfix) with ESMTP id D39773F703F; Wed, 19 Aug 2020 09:22:28 -0700 (PDT) From: George Cherian To: , , CC: , , George Cherian Subject: [PATCH] PCI: Add pci_iounmap Date: Wed, 19 Aug 2020 21:52:08 +0530 Message-ID: <20200819162208.1965707-1-george.cherian@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-08-19_09:2020-08-19,2020-08-19 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case if any architecture selects CONFIG_GENERIC_PCI_IOMAP and not CONFIG_GENERIC_IOMAP, then the pci_iounmap function is reduced to a NULL function. Due to this the managed release variants or even the explicit pci_iounmap calls doesn't really remove the mappings. This issue is seen on an arm64 based system. arm64 by default selects only CONFIG_GENERIC_PCI_IOMAP and not CONFIG_GENERIC_IOMAP from this 'commit cb61f6769b88 ("ARM64: use GENERIC_PCI_IOMAP")' Simple bind/unbind test of any pci driver using pcim_iomap/pci_iomap, would lead to the following error message after long hour tests "allocation failed: out of vmalloc space - use vmalloc= to increase size." Signed-off-by: George Cherian --- include/asm-generic/io.h | 4 ++++ lib/pci_iomap.c | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index dabf8cb7203b..5986b37226b7 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -915,12 +915,16 @@ static inline void iowrite64_rep(volatile void __iomem *addr, struct pci_dev; extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); +#ifdef CONFIG_GENERIC_PCI_IOMAP +extern void pci_iounmap(struct pci_dev *dev, void __iomem *p); +#else #ifndef pci_iounmap #define pci_iounmap pci_iounmap static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) { } #endif +#endif /* CONFIG_GENERIC_PCI_IOMAP */ #endif /* CONFIG_GENERIC_IOMAP */ /* diff --git a/lib/pci_iomap.c b/lib/pci_iomap.c index 2d3eb1cb73b8..36128af05e1c 100644 --- a/lib/pci_iomap.c +++ b/lib/pci_iomap.c @@ -134,4 +134,13 @@ void __iomem *pci_iomap_wc(struct pci_dev *dev, int bar, unsigned long maxlen) return pci_iomap_wc_range(dev, bar, 0, maxlen); } EXPORT_SYMBOL_GPL(pci_iomap_wc); + +#ifndef CONFIG_GENERIC_IOMAP +#define pci_iounmap pci_iounmap +void pci_iounmap(struct pci_dev *dev, void __iomem *addr) +{ + iounmap(addr); +} +EXPORT_SYMBOL(pci_iounmap); +#endif #endif /* CONFIG_PCI */ -- 2.25.1