Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp5013001ybb; Tue, 24 Mar 2020 09:20:45 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsSFgdaG+Zb+GfdchN4Yl4S6ZPFfVoNs7LCcPJgKchOurKEEOOP152ztkQJfNBsYVmPqdnk X-Received: by 2002:aca:4b56:: with SMTP id y83mr4097982oia.142.1585066845249; Tue, 24 Mar 2020 09:20:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585066845; cv=none; d=google.com; s=arc-20160816; b=Gmqxz0uO1eCb41t2zofMY0ke83rJB9aiGiIPw//F5IRruCiL/wFw4Na+lZYS5eBw5H RBGegX8kX1ELsBHoIMJKbw8KyESOjB9PBoMP4cKxLhDCto0H4rkLt3T/gGIYC3k8yOGd ZpSC+DVBqqPq1JPz6/R46RjUEI4W+pYF111APjKhUiVvgjmVMeZbq1se1Z9MeJpQ+GtO tL24AF0DS+25zkixaw6f5yovFdNXOOleXx75GL7mSyqSBoSrV5Qepk5BOht9CZwhA5sq 4AP5Vvmc6VMeKBP/gNVv/NiP3Bf0/OcoPDrAMFJSPl86RUSraBckRKD4Z3wHdAQg1ZY2 KAew== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=S0lIA/D9gWt+6MqKJrlRkinxSTiEVCtRIMKBgvJLedI=; b=W0D2E/jJ8awDNix9jJsERYZmVSJ1nbKX8y46xipM1R1mlFqEv9TVRuq7ob+L3m1yPK gbAqsbZm5hyTr1PBDDO/GomLyf3zVuai+0E2lNx58i3P/+AKcroEQWitPmWq3Ra7y48s 40EUArp7BNXCHsG8i8JYVvxkBbLwYM0KSK7UG+g8Kf48yGq2+Mlhv6gHUT7+xxNen0U7 fxbi1jxO0RuCez78/zlq6GhoQWAiF+l0JGp7zcMY5M6796ak0+VhpztAjRwpWQkpVJCA R8jDhzDkb7Q9mhXBLdBjnMYtwAgr9umM5GvxyDH/NNeuU0W9qKhdp+Mky/lY5DAiZ3FN c9fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="OciYbK/I"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a66si8841970otc.172.2020.03.24.09.20.31; Tue, 24 Mar 2020 09:20:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="OciYbK/I"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728792AbgCXQUA (ORCPT + 99 others); Tue, 24 Mar 2020 12:20:00 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:55510 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727444AbgCXQT7 (ORCPT ); Tue, 24 Mar 2020 12:19:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=S0lIA/D9gWt+6MqKJrlRkinxSTiEVCtRIMKBgvJLedI=; b=OciYbK/IlASgDILE7n0ioDsgqy 7AGIivU04MyeYUvwoS471vq7KpdJ/tp76SH/613gs2qaShr8lUBu4Tz+CnwjdRkw/MsVC4HK2TPrJ USeIHucirJuZlYcZQxItpL/a/clLG9oa9cDcQDOAFWZ9DudAg2MfnA8iFF9fTaQC+Ano5cH20bVzk tqmN/v8KfA9uvCpy2tjrvlJse0u+GyiAWpOCc1qLbk9iCiQUQSZOE+seob0uyVMyh4hxUrmWObjsy dV+uvzZEH4MLiwkGraD3Ww9b3B3vgLFIkuqC8iLZyfjkdcWrtxRKMKxhO8auI3K+6BVTWuwbuGq5w xKuqGBWQ==; Received: from [2001:4bb8:18c:2a9e:999c:283e:b14a:9189] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGmHW-0003Gq-Rs; Tue, 24 Mar 2020 16:19:59 +0000 From: Christoph Hellwig To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/6] MIPS: split out the 64-bit ioremap implementation Date: Tue, 24 Mar 2020 17:15:23 +0100 Message-Id: <20200324161525.754181-5-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324161525.754181-1-hch@lst.de> References: <20200324161525.754181-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Split out the mips64 ioremap implementation entirely, as it will never use page table based remapping. Signed-off-by: Christoph Hellwig --- arch/mips/include/asm/io.h | 65 ++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index 60513250f8f8..f007571e036d 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -153,6 +153,25 @@ static inline void *isa_bus_to_virt(unsigned long address) */ #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) +#ifdef CONFIG_64BIT +static inline void __iomem *ioremap_prot(phys_addr_t offset, + unsigned long size, unsigned long prot_val) +{ + unsigned long flags = prot_val & _CACHE_MASK; + u64 base = (flags == _CACHE_UNCACHED ? IO_BASE : UNCAC_BASE); + void __iomem *addr; + + addr = plat_ioremap(offset, size, flags); + if (!addr) + addr = (void __iomem *)(unsigned long)(base + offset); + return addr; +} + +static inline void iounmap(const volatile void __iomem *addr) +{ + plat_iounmap(addr); +} +#else /* CONFIG_64BIT */ extern void __iomem * __ioremap(phys_addr_t offset, phys_addr_t size, unsigned long flags); extern void __iounmap(const volatile void __iomem *addr); @@ -174,18 +193,8 @@ static inline void __iomem *ioremap_prot(phys_addr_t offset, #define __IS_LOW512(addr) (!((phys_addr_t)(addr) & (phys_addr_t) ~0x1fffffffULL)) - if (IS_ENABLED(CONFIG_64BIT)) { - u64 base = UNCAC_BASE; - - /* - * R10000 supports a 2 bit uncached attribute therefore - * UNCAC_BASE may not equal IO_BASE. - */ - if (flags == _CACHE_UNCACHED) - base = (u64) IO_BASE; - return (void __iomem *) (unsigned long) (base + offset); - } else if (__builtin_constant_p(offset) && - __builtin_constant_p(size) && __builtin_constant_p(flags)) { + if (__builtin_constant_p(offset) && + __builtin_constant_p(size) && __builtin_constant_p(flags)) { phys_addr_t phys_addr, last_addr; phys_addr = fixup_bigphys_addr(offset, size); @@ -210,6 +219,22 @@ static inline void __iomem *ioremap_prot(phys_addr_t offset, #undef __IS_LOW512 } +static inline void iounmap(const volatile void __iomem *addr) +{ + if (plat_iounmap(addr)) + return; + +#define __IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1) + + if (__builtin_constant_p(addr) && __IS_KSEG1(addr)) + return; + + __iounmap(addr); + +#undef __IS_KSEG1 +} +#endif /* !CONFIG_64BIT */ + /* * ioremap - map bus memory into CPU space * @offset: bus address of the memory @@ -264,22 +289,6 @@ static inline void __iomem *ioremap_prot(phys_addr_t offset, #define ioremap_wc(offset, size) \ ioremap_prot((offset), (size), boot_cpu_data.writecombine) -static inline void iounmap(const volatile void __iomem *addr) -{ - if (plat_iounmap(addr)) - return; - -#define __IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1) - - if (IS_ENABLED(CONFIG_64BIT) || - (__builtin_constant_p(addr) && __IS_KSEG1(addr))) - return; - - __iounmap(addr); - -#undef __IS_KSEG1 -} - #if defined(CONFIG_CPU_CAVIUM_OCTEON) || defined(CONFIG_CPU_LOONGSON64) #define war_io_reorder_wmb() wmb() #else -- 2.25.1