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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE298ECAAD4 for ; Mon, 29 Aug 2022 06:43:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D42sPRx8B+DNrIQSM1lXlez7R/xtzDCNgZk/SCcHZ+c=; b=shL47uYU3b2LYk TuyppXFufifyLortwO6mYZR0W48C9iNy1g2cg4kAwPTasUrHTraXsE0GMuQatOTKOm9bwZuSOME9O kT2l1PYKgZAgH9ywAMArcz4WUNfrvox7kuuA5P5EkuNOAaXo4uL4L/1Uk40ohEQ+S3u/4CNGcEOq6 RlJi3/owZM0x4YxiGxiDcVla3EZsLtECsZmYWGGI3kEFbFIDqo2198KWvl+Pyrv1ruE+eQkNVn5sz 9h7uT933txUDUtpNOkkFB93qTjx30qvBTvuDMQV0GM0U1B5bCfhf542H+eTtOOV68yd6xnbJLiKzH dKHmdm6dN8KZl652sMIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSYTa-005NRH-6J; Mon, 29 Aug 2022 06:42:27 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSYTQ-005NMO-K4 for linux-arm-kernel@lists.infradead.org; Mon, 29 Aug 2022 06:42:24 +0000 Received: by mail-wm1-x32a.google.com with SMTP id z14-20020a7bc7ce000000b003a5db0388a8so5447695wmk.1 for ; Sun, 28 Aug 2022 23:42:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=EtBowJCOg4bZf/seKGBDDB2Td0pD664BFJhFwsUws4E=; b=JzFa8ZXk4k4FIgrpTmd8xr/Fml1Bxzh/zc8n8yDNQ17Q6WUGtq9uRFdTSBKUjCq9m6 yDAEDD+bk0PEElLYUsd9rMJFoxHs8f1Cn3bp3yf/3aEL3QjcS/18klbgYVzUUMxjvKXn My/ce7F8sjd43ihFxOsSYiM4nU+pi3OV8RWN1CtIKFPKNcX+/+5EO2vE6TKypHjSPFo+ ywACbvkaox9gdsnH9/A3QX/V5as1oVr4C8p7asP/Rm64lzk+LwxhWCcA3zLEiXdte8Ro Mouv6wn63AyYBNZwsTyg2Ar9Xh7KKdHKJtLbrljMLLS6meI25K0vI7+2BbzMrVM0dy3b mgGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=EtBowJCOg4bZf/seKGBDDB2Td0pD664BFJhFwsUws4E=; b=fkE9/Xni6/9wR51uSpdR3VPQY+18RSIcKQRzZfTSWxdW3iIomJJh6sRD+7wouyFtAe 0EIzcUe8FtchGhrOFtRTMyFXG6w8EBMJe54w93Ph34O2fFSur7wJgNou/uPjISBBUeit 0txES6gK5ALc+KP1+siGmGZiEc8Swe4B7YAHUQFocWUfeBl07AfsLpIyE1OnMd8yHF14 YcDQqOlRyclxQ2n9DOcOTh1qscdv6/gMpj3tlcFxZsLlfL/TAx8V61UjQ98unWtCudD+ hMFuu8jwmyhjCdmIWGpsuUGviBXGp1HDGUo91WW4iO29IWLypDfPYNWkLFs5lOM93hAR wkdg== X-Gm-Message-State: ACgBeo3wIK6zto6EH11Fe5UQicMW48U2lnuU8LTVc1kBf+kQhwXrnwPi 3T4B0rihj/yCY6fZQfUfG9s= X-Google-Smtp-Source: AA6agR7GZBXQq8tJ1YNGsHzfy52ilSO1EuETNVmd+tTqGDa3GcHyWp5N5vBiDdugcDtXotuoprlTXw== X-Received: by 2002:a05:600c:1c8d:b0:3a6:9d60:faf0 with SMTP id k13-20020a05600c1c8d00b003a69d60faf0mr6003665wms.82.1661755332985; Sun, 28 Aug 2022 23:42:12 -0700 (PDT) Received: from localhost ([2a03:b0c0:1:d0::dee:c001]) by smtp.gmail.com with ESMTPSA id j27-20020a05600c1c1b00b003a31fd05e0fsm11009235wms.2.2022.08.28.23.42.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Aug 2022 23:42:12 -0700 (PDT) Date: Mon, 29 Aug 2022 06:42:12 +0000 From: Stafford Horne To: Baoquan He Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, linux-arm-kernel@lists.infradead.org, Jonas Bonn , Stefan Kristiansson , openrisc@lists.librecores.org Subject: Re: [PATCH v2 07/11] openrisc: mm: Convert to GENERIC_IOREMAP Message-ID: References: <20220820003125.353570-1-bhe@redhat.com> <20220820003125.353570-8-bhe@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220828_234222_606590_AB0D0081 X-CRM114-Status: GOOD ( 25.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Aug 29, 2022 at 09:40:24AM +0800, Baoquan He wrote: > On 08/21/22 at 12:03am, Christoph Hellwig wrote: > > > + if (unlikely(!mem_init_done)) { > > > if ((fixmaps_used + (size >> PAGE_SHIFT)) > FIX_N_IOREMAPS) > > > + return IOMEM_ERR_PTR(ret); > > > v = fix_to_virt(FIX_IOREMAP_BEGIN + fixmaps_used); > > > fixmaps_used += (size >> PAGE_SHIFT); > > > > > > + if (ioremap_page_range(v, v + size, p, __pgprot(*prot_val))) { > > > fixmaps_used -= (size >> PAGE_SHIFT); > > > + return IOMEM_ERR_PTR(ret); > > > + } > > > + > > > + return (void __iomem *)(offset + (char *)v); > > > } > > > > This code needs to go away, and all very early boot uses of ioremap > > need to switch to use early_ioremap insted. > > Makes sense. On openrisc, the thing is I didn't find one place where > ioremap() is called in arch code. I can cut the early ioremap out and > wrap into a separate early_ioremap() function, however I don't know > where to put it. Not sure if I miss anything or openrisc doesn't really > need early ioremap. Hi, I don't know of any early_ioremap usage either in openrisc, maybe some drivers use it? However, we do not initialize any early_ioremap infrastructure in openrisc so that may cause issues if it is used. We can try to remove it all. I tested these below additional changes and they work, if you want to add them we can see if kbuild robots pick anything up. -Stafford diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c index bc41660e1fb0..ffe6d5e2b5fe 100644 --- a/arch/openrisc/mm/ioremap.c +++ b/arch/openrisc/mm/ioremap.c @@ -22,14 +22,10 @@ extern int mem_init_done; -static unsigned int fixmaps_used __initdata; - void __iomem * arch_ioremap(phys_addr_t *paddr, size_t size, unsigned long *prot_val) { - phys_addr_t p; - unsigned long v; - unsigned long offset, last_addr, addr = *paddr; + unsigned long last_addr, addr = *paddr; int ret = -EINVAL; /* Don't allow wraparound or zero size */ @@ -37,27 +33,6 @@ arch_ioremap(phys_addr_t *paddr, size_t size, unsigned long *prot_val) if (!size || last_addr < addr) return IOMEM_ERR_PTR(ret); - /* - * Mappings have to be page-aligned - */ - offset = addr & ~PAGE_MASK; - p = addr & PAGE_MASK; - size = PAGE_ALIGN(last_addr + 1) - p; - - if (unlikely(!mem_init_done)) { - if ((fixmaps_used + (size >> PAGE_SHIFT)) > FIX_N_IOREMAPS) - return IOMEM_ERR_PTR(ret); - v = fix_to_virt(FIX_IOREMAP_BEGIN + fixmaps_used); - fixmaps_used += (size >> PAGE_SHIFT); - - if (ioremap_page_range(v, v + size, p, __pgprot(*prot_val))) { - fixmaps_used -= (size >> PAGE_SHIFT); - return IOMEM_ERR_PTR(ret); - } - - return (void __iomem *)(offset + (char *)v); - } - return NULL; } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel