Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1311617yba; Thu, 4 Apr 2019 08:19:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpHXM0BsuHWKErPjDxAZ/JpClilJhFPMbF/FFbwuxFmes58ox4D0gSz4UAnrPaFqRtNMXn X-Received: by 2002:a63:6fc1:: with SMTP id k184mr6296482pgc.239.1554391189943; Thu, 04 Apr 2019 08:19:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554391189; cv=none; d=google.com; s=arc-20160816; b=Hh4UBtLxvmAnWoUKvhcseFls3egPEXQcuvgSjJGs7VZiB2OUr6glSaJivIlPSQw7GU YL0TDXle8MAyKi7dtAPWfM0BgjVFNQTvKvNUMjKWrj7WOI1mQI67cUvyYEv8P7defqt8 kY6jyazb5czsjJCwa6VM1GFLtDk44Di9Xz5rf2BkxQ0U9Ai8igELxETOgcuX003loJcS alS4VWeBn+Pwa++rHqryBl7t1KDRBroC2JInx/FGeqyvWCHXysVOvBpyXSNHoTc4clrc LZBSJIQHQnu7aeOtlpBGNhodloCTA4cnM4HqGmkb5nkqtA7MhJ0vze5yPEZsrnMlEllg nq4Q== 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=RvtuaMLYoj/3edc/UxA6SW5/TR4h4jcoeq2Gp0azghk=; b=RYTR938LTQpn+k7/hvTiHL5h3zorwVTNCmGLe0ADOYJBaGA1KypMkO3MItwM2EBar0 nMpZmcG2rhXLFBVYreRmpVAPNeJk+OSUacrw89p4zr/Tf9PZikDJTzGbzNCxex9vC0ZN k0pPzIhdyh7Qe3ZHWAs2x57vuLafGobAa79gfpXq1ExZ4JnazBxtOoKc6K4pY+E/x1zB 10/G1PnBbqAu1V9taP28Y0C3xsAtx8We7/bg1fLJ59b757mChbO93tT8DwUVCOjWYaLn TXe4LhVEi5m64whgC6Jy1/h0th9O0jkTAgqOnGp4o6b3wT5MPRok7q/VC09A1Y3d9pEP xMlg== 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 ch17si9999958plb.337.2019.04.04.08.19.33; Thu, 04 Apr 2019 08:19:49 -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 S1728670AbfDDPSr (ORCPT + 99 others); Thu, 4 Apr 2019 11:18:47 -0400 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:8500 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726694AbfDDPSq (ORCPT ); Thu, 4 Apr 2019 11:18:46 -0400 X-IronPort-AV: E=Sophos;i="5.60,308,1549954800"; d="scan'208";a="29661063" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Apr 2019 08:18:46 -0700 Received: from soft-dev3.microsemi.net (10.10.76.4) by chn-sv-exch02.mchp-main.com (10.10.76.38) with Microsoft SMTP Server id 14.3.352.0; Thu, 4 Apr 2019 08:18:45 -0700 From: Horatiu Vultur To: , , , , CC: Horatiu Vultur Subject: [PATCH] arch: mips: Fix initrd_start and initrd_end when read from DT Date: Thu, 4 Apr 2019 17:18:20 +0200 Message-ID: <1554391100-10060-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..b232784 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 = __pa(initrd_start); + initrd_end = __pa(initrd_end); + } + if (initrd_start < PAGE_OFFSET) { pr_err("initrd start < PAGE_OFFSET\n"); goto disable; -- 2.7.4