Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3035746yba; Tue, 16 Apr 2019 03:21:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4dRuM39fG+s4ruExOqqsmsq3RModA176I1W+wFullOHCQAWvHE9A6DVpnnzCt44/Bxf6m X-Received: by 2002:a17:902:e9:: with SMTP id a96mr61907603pla.176.1555410060579; Tue, 16 Apr 2019 03:21:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555410060; cv=none; d=google.com; s=arc-20160816; b=zioo+CI7H0rL6Yk6KbwushiAoMvHdZuQp/p91AQLdILTzFoO8gjdlbfxFZSS1BfzPe WGJk/Lcgg63xaHECO6W5FekzS3QzRpSSoAkqjsJFWJbTwoiekv3X2MWKLKHOhnP3CI/w 7kT4kFXhuGHOwcKUAmi1rvW4DUXlTqfQzO32VG5HeX3RmHfXGCINHtrjgqd16a4w6Xhd uh87ow5iTnY4rKZK/VF4zKsU9bnhpNtc/PzDMMPDt51ghv9uVqiTkWecNf8fE+COV1ty LwKPMZOkBjB3mqRGbZaF2H8vCzpmaiC6pKpaQkz2dDGo/XmY91Bn/jYeINbbAC/lebPL 6lhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=i4rzbsFMuKnL5NbEmkXvbWCg7ttVnLL12anq+5/dEDU=; b=g9o/q7sdjtskwfIw/56YAuvy/ApCZpkJj0iVnqhvXElpXexezdS2z/h6sozcsUMJgd furOlNnphq0KVYV29c9wznNt/l1/G+DpjLPt4fkiSbVSHT5ziS8BffJjR4PLivHE0doQ bTODdwvxJTTWGltmxnvBVRrI/001cgcyXuS+RnMNRY5wK3bXe/dJF9MV1eE5gvPyHv7j 8IxWfwMv7YQLl5B0CFU/wyBgUqNsYtEaaPy0V89fVECJQC0H3ep+Gv/Gx2ktqQHyrZ3F ZKSHsQFpEfc7DsdfK9KyPAVLpJ1orpCok4hFg41DgjqR6E1FgL3Xb5XmWraThRFYRGHi Mc9Q== ARC-Authentication-Results: i=1; mx.google.com; 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 g3si45811809plp.369.2019.04.16.03.20.43; Tue, 16 Apr 2019 03:21:00 -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; 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 S1729021AbfDPKS2 (ORCPT + 99 others); Tue, 16 Apr 2019 06:18:28 -0400 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:62763 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726638AbfDPKS2 (ORCPT ); Tue, 16 Apr 2019 06:18:28 -0400 X-IronPort-AV: E=Sophos;i="5.60,357,1549954800"; d="scan'208";a="30394941" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 16 Apr 2019 03:18:27 -0700 Received: from soft-dev3.microsemi.net (10.10.76.4) by CHN-SV-EXCH01.mchp-main.com (10.10.76.37) with Microsoft SMTP Server id 14.3.352.0; Tue, 16 Apr 2019 03:18:26 -0700 From: Horatiu Vultur To: , , , , CC: Horatiu Vultur Subject: [Resend] arch: mips: Fix initrd_start and initrd_end when read from DT Date: Tue, 16 Apr 2019 12:18:20 +0200 Message-ID: <1555409900-31278-1-git-send-email-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the bootloader passes arguments to linux kernel through device tree, it passes the address of initrd_start and initrd_stop, which are in kseg0. But when linux kernel reads these addresses from device tree, it converts them to virtual addresses inside the function __early_init_dt_declare_initrd. At a later point then in the function init_initrd, it is checking for initrd_start to be lower than PAGE_OFFSET, which for a 32 CPU it is not, therefore it would disable the initrd by setting 0 to initrd_start and initrd_stop. The fix consists of checking if linux kernel received a device tree and not having enable extended virtual address and in that case convert them back to physical addresses that point in kseg0 as expected. Signed-off-by: Horatiu Vultur --- arch/mips/kernel/setup.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 8d1dc6c..774ee00 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -264,6 +264,17 @@ static unsigned long __init init_initrd(void) pr_err("initrd start must be page aligned\n"); goto disable; } + + /* + * In case the initrd_start and initrd_end are read from DT, + * then they are converted to virtual address, therefore convert + * them back to physical address. + */ + if (!IS_ENABLED(CONFIG_EVA) && fw_arg0 == -2) { + initrd_start = initrd_start - PAGE_OFFSET + PHYS_OFFSET; + initrd_end = initrd_end - PAGE_OFFSET + PHYS_OFFSET; + } + if (initrd_start < PAGE_OFFSET) { pr_err("initrd start < PAGE_OFFSET\n"); goto disable; -- 2.7.4