Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1170062ybl; Wed, 4 Dec 2019 18:41:56 -0800 (PST) X-Google-Smtp-Source: APXvYqwusE3zNKXuf7aHMn3xs2QmQeo5QB6zsi6VPCF4MUcFjw/0rIFWMlhCC5dzARXNpKczQHDO X-Received: by 2002:a05:6830:10c6:: with SMTP id z6mr5356557oto.203.1575513716222; Wed, 04 Dec 2019 18:41:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575513716; cv=none; d=google.com; s=arc-20160816; b=lcAPMfMheAaQvXe47JoopQfjQCtpmhRPOFFawv6oWnPOkLpcW6lqEnkQVitO7Fr3s0 9477x73J1ppJ9Hwrr3Jb8SiqFQ2d33YrqntO2erd3eFDWPcchs2Of3pn+x77lCeoh28h DcBPWWVmr1l0SmfJdk96bVMjWgs/xp+F0/llpA5ithuMYtVAJvMgJHnuIqtziXBtoiA8 dUMIlzFyjk9G2XVLMQhCSSVbmiiSwqP+EESqjk0KU9rcsxAyM0c8p0SjFrOqgfomikaH 9Uk3YcHe8ybhMAZrXDHNvHb+cK3CtUAvWiGMTQ1jfjuGEciePWt6X4w4spnX1fgtiXS2 Q3IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=X+lqgHIiRLBY7DQHCQbM7VobhB8S+PBBkbBvINIo7h4=; b=hseiQeS1/wY59XWY1jhEQ/CJqA9Zu0Zk/b0wIN+jsqMk80rSlxpYurJGLLczHwM/pp wKrNl04+wbQgyQ85y3PUd1PcZ6uj2SnYLSRxgI+nPFHPWyZSrWSnZ62L5wP2NJZtru0F OqxzQvRn+2GyIbLegTQ43MgCT10rC5SX53aRC+2xi7XnILAOUUOu9Yt5x8Y5CudC70f7 oBYtvKN0vsFJxqX+/gXikq78aFDNlIPxwq6086EASa22ao8rGqaoU/q87BCBMDlmKJhT ZbjSxR6li9Ne5hkqSaVgBp4/H3OHyuIHznTE/a6OSkMPHG0ZFLyCH5R+BIrB9+vycYt2 N4wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=uCiGWSZS; 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 l125si4362748oih.223.2019.12.04.18.41.43; Wed, 04 Dec 2019 18:41:56 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=uCiGWSZS; 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 S1728711AbfLEClF (ORCPT + 99 others); Wed, 4 Dec 2019 21:41:05 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:38944 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728121AbfLEClF (ORCPT ); Wed, 4 Dec 2019 21:41:05 -0500 Received: by mail-pl1-f195.google.com with SMTP id o9so575665plk.6 for ; Wed, 04 Dec 2019 18:41:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=X+lqgHIiRLBY7DQHCQbM7VobhB8S+PBBkbBvINIo7h4=; b=uCiGWSZSL2YSHomU4B+jTR89AljcueykPHFPG9k/9p0HQdJGXdOrTdJ9b0hzyLqz5W o8lRCYsSFVDNREt4sAEH/McuWNVCE73GLLwCbCoa41jnHZH7efgqOr1RKrLVerDeCH1T VNx2BX2nGCgJRX8wBCcah6N4x68SQKvKt91rkF+V8QI+E/n4bv3EGB9MDdGZGoh6qf4N hOkcbtg4UaFOlgn9RVLsCnK/VhIxFRcmeE5Kqf88DbW0UwUZMOhdle5NyE5+TOq35RYS 5nfXdIh8qOnxiuWzJ2JdXmMPbazRnZWyyYQ/BKkW+REnqlLYXz9wASKTMwsTcRMdkqGJ tg+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=X+lqgHIiRLBY7DQHCQbM7VobhB8S+PBBkbBvINIo7h4=; b=MiZA0imC7vvL3d5AoWViYQXYfBDiWYR/ox7ETC/mxXiLGqYNfqNeoZUPHNvPGavsii Ox2HC9oOzXP7yRE8r0nNfIb1xgQ8/N8UTghSqOapW0r6E4qBJVm1SErH+GIcXj7jZ7xt l6mGwDt0mSAo1JES7+/7/3J92tCeLjtVOL8+tQcvO4DYqLW21t+aN/DQXzSh8ehBrKus /K6QqFZ2gtzMaDnB2r4p33Ib9e4hh9BioMpdFhWg9/RC2h5XX3wbWumW1YEeQRzpiNDY /pnwKe+NRmveml+gtAnR0YJ/yhI5muv/miFCEvK4igv4HgjIfSBdg6Ny5kAhDavH/dm7 H6tA== X-Gm-Message-State: APjAAAVY8La5LOQCX7XVRYT2bxkchhrpKGaQ8JTiZQa1h6hCgE8GkIBp iTFKdMHVlOL5mFeVqTrd6BQ= X-Received: by 2002:a17:90a:e291:: with SMTP id d17mr6993893pjz.116.1575513664637; Wed, 04 Dec 2019 18:41:04 -0800 (PST) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id t65sm9635566pfd.178.2019.12.04.18.41.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Dec 2019 18:41:03 -0800 (PST) From: Guenter Roeck To: Ley Foon Tan Cc: nios2-dev@lists.rocketboards.org, linux-kernel@vger.kernel.org, Guenter Roeck , Christoph Hellwig Subject: [PATCH] nios2: Fix ioremap Date: Wed, 4 Dec 2019 18:41:00 -0800 Message-Id: <20191205024100.1066-1-linux@roeck-us.net> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 5ace77e0b41a ("nios2: remove __ioremap") removed the following code, with the argument that cacheflag is always 0 and the expression would therefore always be false. if (IS_MAPPABLE_UNCACHEABLE(phys_addr) && IS_MAPPABLE_UNCACHEABLE(last_addr) && !(cacheflag & _PAGE_CACHED)) return (void __iomem *)(CONFIG_NIOS2_IO_REGION_BASE + phys_addr); This did not take the "!" in the expression into account. Result is that nios2 images no longer boot. Restoring the removed code fixes the problem. Fixes: 5ace77e0b41a ("nios2: remove __ioremap") Cc: Christoph Hellwig Signed-off-by: Guenter Roeck --- arch/nios2/mm/ioremap.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/nios2/mm/ioremap.c b/arch/nios2/mm/ioremap.c index b56af759dcdf..819bdfcc2e71 100644 --- a/arch/nios2/mm/ioremap.c +++ b/arch/nios2/mm/ioremap.c @@ -138,6 +138,14 @@ void __iomem *ioremap(unsigned long phys_addr, unsigned long size) return NULL; } + /* + * Map uncached objects in the low part of address space to + * CONFIG_NIOS2_IO_REGION_BASE + */ + if (IS_MAPPABLE_UNCACHEABLE(phys_addr) && + IS_MAPPABLE_UNCACHEABLE(last_addr)) + return (void __iomem *)(CONFIG_NIOS2_IO_REGION_BASE + phys_addr); + /* Mappings have to be page-aligned */ offset = phys_addr & ~PAGE_MASK; phys_addr &= PAGE_MASK; -- 2.17.1