From owner-freebsd-ppc@freebsd.org Wed Dec 16 01:55:05 2015 Return-Path: Delivered-To: freebsd-ppc@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FA7DA49A66; Wed, 16 Dec 2015 01:55:05 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "alchemy.franken.de", Issuer "alchemy.franken.de" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E2FFC1EB0; Wed, 16 Dec 2015 01:55:04 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.15.2/8.15.2/ALCHEMY.FRANKEN.DE) with ESMTPS id tBG1t1o1070496 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Dec 2015 02:55:02 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.15.2/8.15.2/Submit) id tBG1t01h070495; Wed, 16 Dec 2015 02:55:00 +0100 (CET) (envelope-from marius) Date: Wed, 16 Dec 2015 02:55:00 +0100 From: Marius Strobl To: Andrew Turner Cc: freebsd-sparc64@FreeBSD.org, freebsd-ppc@FreeBSD.org Subject: Re: Testing an Open Firmware interrupt-map patch Message-ID: <20151216015500.GA70379@alchemy.franken.de> References: <20151214134625.79283652@zapp> <20151214234710.GA32903@alchemy.franken.de> <20151215002830.2531673d@zapp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151215002830.2531673d@zapp> User-Agent: Mutt/1.5.23 (2014-03-12) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (alchemy.franken.de [0.0.0.0]); Wed, 16 Dec 2015 02:55:02 +0100 (CET) X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2015 01:55:05 -0000 On Tue, Dec 15, 2015 at 12:28:30AM +0000, Andrew Turner wrote: > On Tue, 15 Dec 2015 00:47:10 +0100 > Marius Strobl wrote: > > > On Mon, Dec 14, 2015 at 01:46:25PM +0000, Andrew Turner wrote: > > > Hello, > > > > > > I'm looking for testers for a patch to update how we parse the > > > interrupt-map property to follow the ePAPR spec. This property is > > > commonly used with PCIe controllers. > > > > > > The current code doesn't take the parent address size property. When > > > this is non-zero we need to also read these values. This is needed > > > on an arm64 board I have as the interrupt parent has memory-mapped > > > children so needs this to be set. > > > > > > I have a patch at [1] to add this, however would like it if this > > > could be tested on other platforms using this code to check it > > > doesn't break these platforms before I commit it. > > > > + "#address-cells", &paddrsz, sizeof(paddrsz)) == > > -1) > > + paddrsz = 0; /* default */ > > > > According to IEEE 1275-1994 (page 110) the default in case of a > > "#address-cells" property is 2 (see also ofw_bus_setup_iinfo()), > > with the latter also being known as the correct default value > > for sparc64 machines. > > However both Linux and NetBSD have similar code, both assume a missing > interrupt-parent #address-size property the correct value is 0. According to ePAPR v1.1, the default in case of missing "#address-cells" properties also is 2 (page 24). However, it also says that the open-pic node/parent interrupt domain has an "#address-cells" value of 0 (page 36). So the above snippet appears more like a workaround for broken device trees as far as ePAPR is concerned, at least the comment "default" is misleading in that regard. > > In any case, this will have quite an impact on the offset > > calculation on sparc64 machines for e. g. EBusses beneath PCI > > busses (which use 3 address cells there) and, thus, most likely > > will cause havoc. Maybe the parent unit address should be only > > taken into account on platforms using interrupt parents? > > It would seem there is a difference between the encoding on Sparc64 and > ePAPR. Using the the parent #address-size may lead to incorrect parsing > on Sparc64, as such I will disable it there. > Yes, as the name suggests, ePAPR is a specification for the Power Architecture. Originally, ofw_bus_search_intrmap() also was sparc64 MD code until nwhitehorn@ in r186128 brought it over to the truly MI sys/dev/ofw/ofw_bus_subr.c I had started. Actually, as for the parent unit address in the interrupt map table ePAPR v1.1 specifically refers to the interrupt parent (page 34). So in order to avoid an #if !defined(__sparc64__) in MI code it seems best to do what I suggested above and to apply paddrsz only on the platforms that actually use interrupt parents. Alternatively, please at least invert it to an #if defined(OFW_EPAPR) and define OFW_EPAPR in sys//include/ofw_machdep.h as applicable. Marius