From patchwork Wed Apr 23 13:10:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Likely X-Patchwork-Id: 28880 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7E30820534 for ; Wed, 23 Apr 2014 13:11:13 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id i4sf5404196oah.8 for ; Wed, 23 Apr 2014 06:11:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:sender:from:subject:to :cc:in-reply-to:references:date:message-id:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=oRuEB1kNeYloaKzMPP50UFLJrgW7dsFlp8z24vmeP+c=; b=VLnYhb3gZUBa3yPzL9twMXCro2BJRH9J5/1I5wZ4rWY7XtMNqA8NOx8gNVLX/Pr8ai zC7gDnQWyZy7CBj79LsRXapw+tER92aldwQqDo3yRRpnoX+EJR2OXp5fudTmkts1+qeg 8OqAoDLQP6t8LOqIqaYlPo2Po0Mam3uKQxc3mJkJu7FUeVPpiDnXaa2c6GnGnijYcKDM JJPEShM0YO9YopXzAy36vIR8uD/LZ3heXF8+e9SMu9ufljIqin5Vb8EUx70NtKRL4eb5 7OIWtH3/QPUfhp7DnZdPGke+KoYlmTGwWm9jsCZix5ASiSsmriO9r7SMLcWkSD6DE0JA FSKQ== X-Gm-Message-State: ALoCoQloqFIgqLeCvKa2bOrvHYMQwVrDA3VsRtovVIFpk1X8N2nGQ2x/PHHzq56f819+m02WE+t2 X-Received: by 10.50.43.228 with SMTP id z4mr1184511igl.0.1398258672741; Wed, 23 Apr 2014 06:11:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.21.213 with SMTP id 79ls583610qgl.35.gmail; Wed, 23 Apr 2014 06:11:12 -0700 (PDT) X-Received: by 10.52.128.231 with SMTP id nr7mr35054989vdb.17.1398258672596; Wed, 23 Apr 2014 06:11:12 -0700 (PDT) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id tm8si158054vdc.62.2014.04.23.06.11.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Apr 2014 06:11:12 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id jw12so1067496veb.41 for ; Wed, 23 Apr 2014 06:11:12 -0700 (PDT) X-Received: by 10.58.216.163 with SMTP id or3mr25732vec.80.1398258672411; Wed, 23 Apr 2014 06:11:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp102787vcb; Wed, 23 Apr 2014 06:11:11 -0700 (PDT) X-Received: by 10.14.115.195 with SMTP id e43mr17822015eeh.76.1398258671290; Wed, 23 Apr 2014 06:11:11 -0700 (PDT) Received: from mail-ee0-f51.google.com (mail-ee0-f51.google.com [74.125.83.51]) by mx.google.com with ESMTPS id d5si3167908eei.58.2014.04.23.06.11.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Apr 2014 06:11:10 -0700 (PDT) Received-SPF: none (google.com: glikely@secretlab.ca does not designate permitted sender hosts) client-ip=74.125.83.51; Received: by mail-ee0-f51.google.com with SMTP id c13so764287eek.24 for ; Wed, 23 Apr 2014 06:11:10 -0700 (PDT) X-Received: by 10.14.47.12 with SMTP id s12mr3282730eeb.116.1398258670482; Wed, 23 Apr 2014 06:11:10 -0700 (PDT) Received: from trevor.secretlab.ca (host31-50-108-136.range31-50.btcentralplus.com. [31.50.108.136]) by mx.google.com with ESMTPSA id y7sm6211796eev.5.2014.04.23.06.11.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Apr 2014 06:11:09 -0700 (PDT) Sender: Grant Likely Received: by trevor.secretlab.ca (Postfix, from userid 1000) id D94B6C408D2; Wed, 23 Apr 2014 15:10:58 +0200 (CEST) From: Grant Likely Subject: Re: [PATCH 3/3] of: Handle memory@0 node on PPC32 only To: Mark Rutland Cc: Leif Lindholm , Geert Uytterhoeven , "linux-kernel@vger.kernel.org" , "patches@linaro.org" , "linuxppc-dev@lists.ozlabs.org" , "devicetree@vger.kernel.org" , Rob Herring , Lee Jones In-Reply-To: <20140423104528.GD30036@e106331-lin.cambridge.arm.com> References: <1397756521-29387-1-git-send-email-leif.lindholm@linaro.org> <1397756521-29387-4-git-send-email-leif.lindholm@linaro.org> <20140418125924.GF5904@bivouac.eciton.net> <20140422133515.E7A0BC40754@trevor.secretlab.ca> <20140423104528.GD30036@e106331-lin.cambridge.arm.com> Date: Wed, 23 Apr 2014 14:10:58 +0100 Message-Id: <20140423131058.D94B6C408D2@trevor.secretlab.ca> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: grant.likely@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Wed, 23 Apr 2014 11:45:28 +0100, Mark Rutland wrote: > On Tue, Apr 22, 2014 at 02:35:15PM +0100, Grant Likely wrote: > > On Fri, 18 Apr 2014 13:59:24 +0100, Leif Lindholm wrote: > > > Hi Geert, > > > > > > On Fri, Apr 18, 2014 at 10:04:15AM +0200, Geert Uytterhoeven wrote: > > > > On Thu, Apr 17, 2014 at 7:42 PM, Leif Lindholm wrote: > > > > > In order to deal with an firmware bug on a specific ppc32 platform > > > > > (longtrail), early_init_dt_scan_memory() looks for a node called > > > > > memory@0 on all platforms. Restrict this quirk to ppc32 kernels only. > > > > > > > > This breaks backwards compatibilty with old DTSes (at least on ARM/MIPS, > > > > where you added the missing property in patches 1 and 2 of the series)? > > > > > > As Rob said in response to 0/3, the MIPSs would likely not be affected, > > > since they embed the DT. > > > > > > > For the Longtrail, I don't care much anymore, as mine died in 2004. > > > > AFAIK, there have never been many users anyway. > > > > > > There are still a few mentions of it under arch/powerpc/, so I wouldn't > > > want to be the one to kill it off... > > > > > > How about the below v2 3/3 to address the ARM platform? > > > > The problem with this approach is that selecting one board that needs it > > automatically makes it active for all boards. It would need to be > > something more like the following: > > > > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c > > index 399e242e1a42..55d65b2b4c74 100644 > > --- a/drivers/of/fdt.c > > +++ b/drivers/of/fdt.c > > @@ -887,12 +887,10 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, > > > > /* We are scanning "memory" nodes only */ > > if (type == NULL) { > > - /* > > - * The longtrail doesn't have a device_type on the > > - * /memory node, so look for the node called /memory@0. > > - */ > > if (depth != 1 || strcmp(uname, "memory@0") != 0) > > return 0; > > + if (!of_flat_dt_match(dt_root, memory_quirk_list)) > > + return 0; > > } else if (strcmp(type, "memory") != 0) > > return 0; > > > > With a list of compatible properties for affected boards. > > That looks sane to me. > > Does anyone have a LongTrail DT to hand, and if so does the root have a > compatible string? From grepping through the kernel I could only find a > model string ("IBM,LongTrail"). Actually, on LongTrail this can be removed from the common code entirely. It has real open firmware and PowerPC already has the infrastructure for fixing up the device tree. Here's a draft patch that I've compile tested, but nothing else. g. diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 078145acf7fb..18b2c3fee98f 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -2587,9 +2587,18 @@ static void __init fixup_device_tree_chrp(void) phandle ph; u32 prop[6]; u32 rloc = 0x01006000; /* IO space; PCI device = 12 */ - char *name; + char *name, strprop[16]; int rc; + /* Deal with missing device_type in LongTrail memory node */ + name = "/memory@0"; + ph = call_prom("finddevice", 1, 1, ADDR(name)); + rc = prom_getprop(ph, "device_type", strprop, sizeof(strprop)); + if (rc == PROM_ERROR || strcmp(strprop, "memory") != 0) { + prom_printf("Fixing up missing device_type on /memory@0 node...\n"); + prom_setprop(ph, name, "device_type", "memory", sizeof("memory")); + } + name = "/pci@80000000/isa@c"; ph = call_prom("finddevice", 1, 1, ADDR(name)); if (!PHANDLE_VALID(ph)) { diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 7a2ef7bb8022..7cda0d279cbe 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -886,14 +886,7 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, unsigned long l; /* We are scanning "memory" nodes only */ - if (type == NULL) { - /* - * The longtrail doesn't have a device_type on the - * /memory node, so look for the node called /memory@0. - */ - if (depth != 1 || strcmp(uname, "memory@0") != 0) - return 0; - } else if (strcmp(type, "memory") != 0) + if (!type || strcmp(type, "memory") != 0) return 0; reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);