Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp88159rwb; Fri, 19 Aug 2022 17:35:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR54APjlB0U4/6FEfT/KudHhTLW/2F44bEmTGSuIKdkqempoL6Ty3sSlbGDtTz24cteoyg6z X-Received: by 2002:a05:6402:248d:b0:437:dd4c:e70e with SMTP id q13-20020a056402248d00b00437dd4ce70emr7593227eda.75.1660955722539; Fri, 19 Aug 2022 17:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660955722; cv=none; d=google.com; s=arc-20160816; b=d21Z3bO4j+/X6PcUW5aGXJyx2a6GOQ1AYG8Z3LArvfsOro/xip69iCHepwidN8WJld +JO/hd7w7LOhAbd3sX1I0OO0FvLykOumtBV/eZGNBpgkBBZSytAeNO/P+gvitJnaHA8o v797kyXkEc0DgoW67Ns9DC3ZvNqe3yRkKfQalZSHMmMQAMhg5qtCZS4SWxlbrtrPIkFt y7xzkXBR0X8En8bWUPsrXsL+3wY78XPoAti63WOK+L5lA+9bzfbUqx0l02Z1GdJFb0o8 l3JO/PGQ1Zc1YlZ/ZUccBH3aw3UieQ0OhSYq0ISqkTqd38J2ok60CK9NEbBr0tGx+iP3 INRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CaolBDp29uFoy9EJOCmc+prflA1CqUFRD61xKQq994g=; b=I1ckMgjTyl1tKPrFN7ZScAMVJ0WAe2grgY+mGSivfLK3FbuTgjAJAQXs7f6tCwteYz AlncLt07sF6ZJb4VGfDbrRfR/hleQVJAVU4pIxgZE/XdbEQOM/SzzwHcrn9PumCSJBPZ xQ6RqfAKLk8M6sLsvdl4WGUYr0HK38sojiEazd7jFl93ph6v17Vu/9M4EOwm+aOPgQsI Vxl8hMxDC/R0HZ1aKv4VXqesiS4WdlwGMI6Xkr/QRaj7dmKrPpJhRVNskFC7r7FKL7mg 9/9rjVXU6EiuSRZ0xhm37TwuxbWk8TWuVBPj5PVtwLD1jobWB7TKKWARE4iOphycJiti r3dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JKyWbh8x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m22-20020a17090679d600b00732fd03ab1fsi3719557ejo.492.2022.08.19.17.34.57; Fri, 19 Aug 2022 17:35:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JKyWbh8x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245060AbiHTAcM (ORCPT + 99 others); Fri, 19 Aug 2022 20:32:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243223AbiHTAcF (ORCPT ); Fri, 19 Aug 2022 20:32:05 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6611DDDABC for ; Fri, 19 Aug 2022 17:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660955523; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CaolBDp29uFoy9EJOCmc+prflA1CqUFRD61xKQq994g=; b=JKyWbh8xCFKJhGbBTL7fBTrUkThtcMdzrZ04CAQ5nbNoDFXSUHgJxr+JEeB8VgmsxMEiTM DiUqTXNYNqlb+sRUx47NNW5E9dt9QHAPU1yTbFut3FCGVpiG2LmFa3EvSlbYGNaMZmZBML csNHVUDoMLSxXCs9z8UugjaKl4x67MI= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-255-y1mA8qUWOsm_-jR1x5dxEQ-1; Fri, 19 Aug 2022 20:31:58 -0400 X-MC-Unique: y1mA8qUWOsm_-jR1x5dxEQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B7EB73C025D0; Sat, 20 Aug 2022 00:31:57 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-17.pek2.redhat.com [10.72.12.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 96CC440D2827; Sat, 20 Aug 2022 00:31:52 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, hch@infradead.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, linux-arm-kernel@lists.infradead.org, Baoquan He , Brian Cain , linux-hexagon@vger.kernel.org Subject: [PATCH v2 05/11] hexagon: mm: Convert to GENERIC_IOREMAP Date: Sat, 20 Aug 2022 08:31:19 +0800 Message-Id: <20220820003125.353570-6-bhe@redhat.com> In-Reply-To: <20220820003125.353570-1-bhe@redhat.com> References: <20220820003125.353570-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With it, the old ioremap() and iounmap() can be perfectly removed since they are duplicated with the standard functions. Signed-off-by: Baoquan He Cc: Brian Cain Cc: linux-hexagon@vger.kernel.org --- arch/hexagon/Kconfig | 1 + arch/hexagon/include/asm/io.h | 9 +++++-- arch/hexagon/mm/ioremap.c | 44 ----------------------------------- 3 files changed, 8 insertions(+), 46 deletions(-) delete mode 100644 arch/hexagon/mm/ioremap.c diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig index 54eadf265178..17afffde1a7f 100644 --- a/arch/hexagon/Kconfig +++ b/arch/hexagon/Kconfig @@ -25,6 +25,7 @@ config HEXAGON select NEED_SG_DMA_LENGTH select NO_IOPORT_MAP select GENERIC_IOMAP + select GENERIC_IOREMAP select GENERIC_SMP_IDLE_THREAD select STACKTRACE_SUPPORT select GENERIC_CLOCKEVENTS_BROADCAST diff --git a/arch/hexagon/include/asm/io.h b/arch/hexagon/include/asm/io.h index c33241425a5c..e2d3091ec9d6 100644 --- a/arch/hexagon/include/asm/io.h +++ b/arch/hexagon/include/asm/io.h @@ -170,8 +170,13 @@ static inline void writel(u32 data, volatile void __iomem *addr) #define writew_relaxed __raw_writew #define writel_relaxed __raw_writel -void __iomem *ioremap(unsigned long phys_addr, unsigned long size); -#define ioremap_uc(X, Y) ioremap((X), (Y)) +/* + * I/O memory mapping functions. + */ +#define _PAGE_IOREMAP (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \ + (__HEXAGON_C_DEV << 6)) + +#define ioremap_uc(addr, size) ioremap((addr), (size)) #define __raw_writel writel diff --git a/arch/hexagon/mm/ioremap.c b/arch/hexagon/mm/ioremap.c deleted file mode 100644 index 255c5b1ee1a7..000000000000 --- a/arch/hexagon/mm/ioremap.c +++ /dev/null @@ -1,44 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * I/O remap functions for Hexagon - * - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. - */ - -#include -#include -#include - -void __iomem *ioremap(unsigned long phys_addr, unsigned long size) -{ - unsigned long last_addr, addr; - unsigned long offset = phys_addr & ~PAGE_MASK; - struct vm_struct *area; - - pgprot_t prot = __pgprot(_PAGE_PRESENT|_PAGE_READ|_PAGE_WRITE - |(__HEXAGON_C_DEV << 6)); - - last_addr = phys_addr + size - 1; - - /* Wrapping not allowed */ - if (!size || (last_addr < phys_addr)) - return NULL; - - /* Rounds up to next page size, including whole-page offset */ - size = PAGE_ALIGN(offset + size); - - area = get_vm_area(size, VM_IOREMAP); - addr = (unsigned long)area->addr; - - if (ioremap_page_range(addr, addr+size, phys_addr, prot)) { - vunmap((void *)addr); - return NULL; - } - - return (void __iomem *) (offset + addr); -} - -void iounmap(const volatile void __iomem *addr) -{ - vunmap((void *) ((unsigned long) addr & PAGE_MASK)); -} -- 2.34.1