From patchwork Wed Oct 12 10:09:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13004931 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 A1CDDC4332F for ; Wed, 12 Oct 2022 10:10:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A706900003; Wed, 12 Oct 2022 06:10:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 357016B0074; Wed, 12 Oct 2022 06:10:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21EB5900003; Wed, 12 Oct 2022 06:10:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 126926B0073 for ; Wed, 12 Oct 2022 06:10:18 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B6E20A096F for ; Wed, 12 Oct 2022 10:10:17 +0000 (UTC) X-FDA: 80011877274.22.E16AC0E Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf12.hostedemail.com (Postfix) with ESMTP id 4EEB640015 for ; Wed, 12 Oct 2022 10:10:17 +0000 (UTC) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4MnT0w6ZHKz9sn8; Wed, 12 Oct 2022 12:10:08 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ydu5fOwW78u4; Wed, 12 Oct 2022 12:10:08 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4MnT0w5qSSz9sn3; Wed, 12 Oct 2022 12:10:08 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id AB7A98B77A; Wed, 12 Oct 2022 12:10:08 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id sQNVSoiAGiNq; Wed, 12 Oct 2022 12:10:08 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.127]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 012BB8B774; Wed, 12 Oct 2022 12:10:07 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 29CA9xNq1165804 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 12 Oct 2022 12:09:59 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 29CA9xw41165803; Wed, 12 Oct 2022 12:09:59 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Baoquan He Cc: Christophe Leroy , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, akpm@linux-foundation.org, hch@infradead.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, schnelle@linux.ibm.com, David.Laight@ACULAB.COM, shorne@gmail.com Subject: [RFC PATCH 7/8] mm/ioremap: Consider IOREMAP space in generic ioremap Date: Wed, 12 Oct 2022 12:09:43 +0200 Message-Id: <8c7ac4667c6a3cc48f98110117536f60d51ece4a.1665568707.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.37.1 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1665569382; l=1074; s=20211009; h=from:subject:message-id; bh=ELyr8PUsyD4mIfYsRSsdsfitAttTXEVDCquGDiFLN50=; b=MbLqqgcB49+PcaWOwavlBma2KxRl7NhNM0e3IhcyfyMIM6BgTnQF9m/+4m45QTF1wvkc4p+sMunj HT6K6uKVDVjjy4tF7tedmQcjX4nTnCt27/jozV0VB73DgHSpY0In X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665569417; a=rsa-sha256; cv=none; b=MVodUr5x3vDfs0YgRn6NJthjnkAD8b5xR47YIRQUx4bXb/MSQo01p8au+Cwnz8FT1gncHV GAy4t7bNjLTaOkrFIyekjAmpd3p7PD7EHLsuEGVGilp1hn55De6xvhoFYX7/L+71KkvCN2 +ixL9d0+Bbarr7OnlUV1ZCOFcholA2U= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf12.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665569417; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Uq3j8YEcOYPzQOW+GdFDcrVAvEw3YT3cNDb2ol15Wsg=; b=L2GFVm0/QrmNCqI8kpx3n+2xZYIIKSzmLfshRbMGqgh8njgv+J1MZzjTSHOyUIePvzB7M7 kMoblXz+KHr+ZDj7l532922UlXpuvSjOZY6oag61P4zuDmV2p7VIhXPtQ772mJVzFBo80h 48eERuRlPxuWgcNo99ss4+uXzx47i9Y= X-Stat-Signature: n91fkn4wfi8pqg7kgyqofr1hffis3ntc X-Rspamd-Queue-Id: 4EEB640015 Authentication-Results: imf12.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf12.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-Rspam-User: X-Rspamd-Server: rspam03 X-HE-Tag: 1665569417-491779 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: Some architecture have a dedicated space for IOREMAP mappings. If so, use it in generic_ioremap_pro(). Signed-off-by: Christophe Leroy --- mm/ioremap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/ioremap.c b/mm/ioremap.c index 9f34a8f90b58..a2be9cda975b 100644 --- a/mm/ioremap.c +++ b/mm/ioremap.c @@ -31,8 +31,13 @@ void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size, if (!ioremap_allowed(phys_addr, size, pgprot_val(prot))) return NULL; +#ifdef IOREMAP_START + area = __get_vm_area_caller(size, VM_IOREMAP, IOREMAP_START, + IOREMAP_END, __builtin_return_address(0)); +#else area = get_vm_area_caller(size, VM_IOREMAP, __builtin_return_address(0)); +#endif if (!area) return NULL; vaddr = (unsigned long)area->addr; @@ -62,7 +67,7 @@ void generic_iounmap(volatile void __iomem *addr) if (!iounmap_allowed(vaddr)) return; - if (is_vmalloc_addr(vaddr)) + if (is_ioremap_addr(vaddr)) vunmap(vaddr); }