Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4878798imm; Mon, 14 May 2018 15:01:24 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpzAgyyiNPi6sBWhZbCis8ltPg3Zoew316FIXIgOTUQ0BgqyMhN/i+eRjX8tYhEXjvXZIIW X-Received: by 2002:a17:902:2f43:: with SMTP id s61-v6mr11245460plb.99.1526335284729; Mon, 14 May 2018 15:01:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526335284; cv=none; d=google.com; s=arc-20160816; b=weOAqWAWsP7DSSh3sF7HlHTwvNlrVHj8nxCJ/qsnZsPiXfKCt6bVPGRQ0VmTSfpcNr VhsfcvZk5oW5TB1fPptQ32UEouKy6tnzVHo1YAMjrh+rxn3pp6nc3rp0dttRHHqoX5hP bHwulC6P5eg5ZlpCWAK6/z60g2oq2LwyoYFZUZA7X4WflS+eG9OuKq28l8nIjhJF/3tx uV0/8aVF3NQYO3f91dVCAAe3B2wQf0cH+9kWFaCttaSk+ANNJcEDveqA6MLip1VtmYTu UyITgXaV8G2qht0pKiTrozWdkjD/2jqmiw4LHcjOdUj1CPs/cAuVexZrZtf27uDSy5qb rx4w== 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:arc-authentication-results; bh=eq2A7qdR310uXcMPnlIfVNK4u80HN/9elldZ93Fb5fg=; b=NENOIspJwJr/Q4rt4htrihRO01IsvQfbsnvzHwTCf6pfFzlq48abQ18FTDGAs2gxKQ Zc6kCIHsuUcUhaJCSOCiOM5TjCMgI+gYxlGvxYGfb+K+RIpBYQsGQJVQV9MHRsFJTYZk k4d76qNSLeUMbbzucRNFgipAFn2a0vQ5x5AjeDjyinJU86tv+AyKRYjyZ8CsZmDwrQR6 Q/Zz62tUMoHW8i6ZqlpEbpQYBUwoCOuhNDybTVIVlvrSt1gtPRQ60DSWx68W/ZRd11nB s7g/SzEJvj6Ii0eLooMRmPzF5qH+PuW20gKp257Loz2SF6rXKZTw02OPbiNqwuOFmuqd tR9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=auJfYPVp; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a7-v6si8392273pgv.47.2018.05.14.15.01.09; Mon, 14 May 2018 15:01:24 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=auJfYPVp; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752495AbeENV5L (ORCPT + 99 others); Mon, 14 May 2018 17:57:11 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:41336 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752090AbeENV5H (ORCPT ); Mon, 14 May 2018 17:57:07 -0400 Received: by mail-qt0-f195.google.com with SMTP id g13-v6so18242723qth.8; Mon, 14 May 2018 14:57:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=eq2A7qdR310uXcMPnlIfVNK4u80HN/9elldZ93Fb5fg=; b=auJfYPVpYtN4jUIEng41fP4Jaj7g1LBukX9L2aTwkcsRta5Jlyt27tgKU75Ik/m7zo 4ZQ+zvdppGHlEU1wNzwiwLJJVsJbZBzFqStr5WesIdVf4K30oAVoTOg4CpActM0mbpMn 0o6BM6vUbfPZecllyElgtdkKNEeZ71EMqCRBpezYaXDVm88D+Dpq0LnqyM8VGqCVDKdC r7J+ILES0qexRla9jUSmsgzZzoYl7vnD2GE7K034i/roxRg9ZIXdPaN+X8TK1cuPjdqA ANaj3AsboupB1CJP1ptYXu2VL3O44rub2QJG1l79hC791H/9FjPQITgLiw/wnH6vPthP gvVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=eq2A7qdR310uXcMPnlIfVNK4u80HN/9elldZ93Fb5fg=; b=ok+jhzLhMyrPI2eUge0ZsnH0OdWsUVmmek+H+R6Xwc4iAk37XMLytEmPXgNaxOpO// mSEgNwL/RecifzOpNximgjfXFdrA7kvEhGdl3H7T//1cepay0dkOlxreYHbtaW9gCz1j xuETnkQtvMQjVI15sbMW+GFNRokDYSH/QAcbdyHAGVYUytl2g4lqL0yaAd0RH5VXLivK +pTOrorhwJ5gA90tatWLzHxD7Y7cFXdfOUeMPpIRzkZ5g09am3PuLUObMi+X3j2mKUNf RIoHRLRQeRyxVOQTjRrx2HLpenb9Hz6hl2KjIv3rw9tB4u64oTlngZ7e3zkcMRaEGk93 jKAg== X-Gm-Message-State: ALKqPwet2J6yQsj3M6z4KhTrVV5gLk9THElxlLrdh4TEGTLV0Rb9JzIC ATpdLV7bTWO6+eFtbFc2shyqhARGA4o= X-Received: by 2002:aed:2c43:: with SMTP id f61-v6mr10762070qtd.105.1526335026721; Mon, 14 May 2018 14:57:06 -0700 (PDT) Received: from glados.lan ([2601:18d:4600:e68c:feaa:14ff:fe71:bf72]) by smtp.gmail.com with ESMTPSA id e5-v6sm7385834qkf.35.2018.05.14.14.57.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 May 2018 14:57:06 -0700 (PDT) From: Thomas Hebb To: linux-kernel@vger.kernel.org Cc: Thomas Hebb , Jisheng Zhang , Sebastian Hesselbarth , Rob Herring , Mark Rutland , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Synaptics Berlin SoC support), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS) Subject: [PATCH] ARM: dts: chromecast: override bad bootloader memory info Date: Mon, 14 May 2018 17:56:45 -0400 Message-Id: <20180514215645.17592-2-tommyhebb@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On the Chromecast, the bootloader provides us with an ATAG_MEM of start=0x01000000 and size=0x3eff8000. This is clearly incorrect, as the range given encompasses nearly a GiB but the Chromecast only has 512MiB of RAM! Additionally, this causes the kernel to be decompressed at 0x00008000, below the claimed beginning of RAM, and so the boot fails. Since the existing ATAG parsing code runs before the kernel is even decompressed and irrevocably patches the device tree, don't even try to bypass it. Instead, use the "linux,usable-memory" property instead of the "reg" property to define the real range. The ATAG code only overwrites reg, but linux,usable-memory is checked first in the OF driver, so the fact that reg gets changed makes no difference. Signed-off-by: Thomas Hebb --- arch/arm/boot/dts/berlin2cd-google-chromecast.dts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/berlin2cd-google-chromecast.dts b/arch/arm/boot/dts/berlin2cd-google-chromecast.dts index 20f31cdeaf38..54221f55bfa2 100644 --- a/arch/arm/boot/dts/berlin2cd-google-chromecast.dts +++ b/arch/arm/boot/dts/berlin2cd-google-chromecast.dts @@ -52,7 +52,17 @@ memory@0 { device_type = "memory"; - reg = <0x00000000 0x20000000>; /* 512 MB */ + + /* + * We're using "linux,usable-memory" instead of "reg" here + * because the (signed and encrypted) bootloader that shipped + * with this device provides an incorrect memory range in + * ATAG_MEM. Linux helpfully overrides the "reg" property with + * data from the ATAG, so we can't specify the proper range + * normally. Fortunately, this alternate property is checked + * first by the OF driver, so we can (ab)use it instead. + */ + linux,usable-memory = <0x00000000 0x20000000>; /* 512 MB */ }; leds { -- 2.17.0