From patchwork Wed May 11 11:18:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xianting Tian X-Patchwork-Id: 12846048 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 CAE00C433F5 for ; Wed, 11 May 2022 11:19:39 +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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=6MJrW2wXrTZs7qFun7NZnutabeBxGk8iaOVk7Uz+ThE=; b=C65e6rffWFu+ce jgsAOJzLA/ItS0gjtC0EC7FljnqldTo4wUpJi1ZcejTO7GPTcEhZK06/G69I4yCqWy9MHYkAYlX6V GWQUQM7wzjosOt7lp1jbYxjmT1jM7lAu8UmpvY6SGLZ3mFz7WVQUGE37J+l8cuL2150IMZAcTIfgL EeGPJsQdK3McrCwuxSBneEhqpXhdzkJQx11qOA/HqvsUMQWTa+LnIiCcZqOZ5HXFH1cRxREDXf4pW Fbk+T9OwtbujtOyTbpMDJ7rNE2ahVgIc8FrT+zQHdfWfl4f/ZLMzpImTXJ+n7/rWQP9zyMT1UTzms 9ZPeHUhuFT4UU0nS0TZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nokNM-006Twi-DR; Wed, 11 May 2022 11:19:28 +0000 Received: from out199-10.us.a.mail.aliyun.com ([47.90.199.10]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nokNJ-006Tvl-Gn for linux-riscv@lists.infradead.org; Wed, 11 May 2022 11:19:27 +0000 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R881e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=alimailimapcm10staff010182156082; MF=xianting.tian@linux.alibaba.com; NM=1; PH=DS; RN=17; SR=0; TI=SMTPD_---0VCw.72d_1652267933; Received: from localhost(mailfrom:xianting.tian@linux.alibaba.com fp:SMTPD_---0VCw.72d_1652267933) by smtp.aliyun-inc.com(127.0.0.1); Wed, 11 May 2022 19:18:54 +0800 From: Xianting Tian To: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, akpm@linux-foundation.org, anup@brainfault.org, wangkefeng.wang@huawei.com, rppt@kernel.org, alex@ghiti.fr, twd2.me@gmail.com, david@redhat.com, seanjc@google.com, petr.pavlu@suse.com, atishp@rivosinc.com Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Xianting Tian , Nick Kossifidis Subject: [PATCH] RISC-V: Remove IORESOURCE_BUSY flag for no-map reserved memory Date: Wed, 11 May 2022 19:18:51 +0800 Message-Id: <20220511111851.559684-1-xianting.tian@linux.alibaba.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220511_041925_860684_8CC7FB72 X-CRM114-Status: UNSURE ( 8.54 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Commit 00ab027a3b82 ("RISC-V: Add kernel image sections to the resource tree") added IORESOURCE_BUSY flag for no-map reserved memory, this casued devm_ioremap_resource() failed for the no-map reserved memory in subsequent operations of related driver, so remove the IORESOURCE_BUSY flag. The code to reproduce the issue, dts: mem0: memory@a0000000 { reg = <0x0 0xa0000000 0 0x1000000>; no-map; }; &test { status = "okay"; memory-region = <&mem0>; }; code: np = of_parse_phandle(pdev->dev.of_node, "memory-region", 0); ret = of_address_to_resource(np, 0, &r); base = devm_ioremap_resource(&pdev->dev, &r); // base = -EBUSY Fixes: 00ab027a3b82 ("RISC-V: Add kernel image sections to the resource tree") Reported-by: Huaming Jiang Reviewed-by: Guo Ren CC: Nick Kossifidis Signed-off-by: Xianting Tian --- arch/riscv/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 834eb652a7b9..71f2966b1474 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -214,7 +214,7 @@ static void __init init_resources(void) if (unlikely(memblock_is_nomap(region))) { res->name = "Reserved"; - res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; + res->flags = IORESOURCE_MEM; } else { res->name = "System RAM"; res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;