From owner-freebsd-arm@FreeBSD.ORG Sun Jan 19 01:30:55 2014 Return-Path: Delivered-To: freebsd-arm@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 00FF57D4; Sun, 19 Jan 2014 01:30:54 +0000 (UTC) Received: from smtpauth3.wiscmail.wisc.edu (wmauth3.doit.wisc.edu [144.92.197.226]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BDBD511DD; Sun, 19 Jan 2014 01:30:54 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from avs-daemon.smtpauth3.wiscmail.wisc.edu by smtpauth3.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) id <0MZM00D00JNT7T00@smtpauth3.wiscmail.wisc.edu>; Sat, 18 Jan 2014 19:30:47 -0600 (CST) X-Spam-PmxInfo: Server=avs-3, Version=6.0.3.2322014, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2014.1.19.11815, SenderIP=0.0.0.0 X-Spam-Report: AuthenticatedSender=yes, SenderIP=0.0.0.0 Received: from wanderer.tachypleus.net (adsl-76-208-68-77.dsl.mdsnwi.sbcglobal.net [76.208.68.77]) by smtpauth3.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) with ESMTPSA id <0MZM009AQK77M510@smtpauth3.wiscmail.wisc.edu>; Sat, 18 Jan 2014 19:30:46 -0600 (CST) Message-id: <52DB2AC3.5000206@freebsd.org> Date: Sat, 18 Jan 2014 19:30:43 -0600 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 To: Julien Grall , Warner Losh Subject: Re: [RFC] Add support for Xen ARM guest on FreeBSD References: <1389733267-20822-1-git-send-email-julien.grall@linaro.org> <24851B79-7EC7-4E3A-94DB-4B9B86FDFFFC@bsdimp.com> <52D6B62A.9000208@linaro.org> <52D73C4E.2080306@freebsd.org> <52D87B15.5090208@linaro.org> <52D89DC9.7050303@freebsd.org> <52DB1138.6010804@linaro.org> In-reply-to: <52DB1138.6010804@linaro.org> X-Enigmail-Version: 1.6 Cc: ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, xen-devel@lists.xen.org, freebsd-xen@freebsd.org, freebsd-arm@FreeBSD.org, gibbs@freebsd.org, roger.pau@citrix.com X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jan 2014 01:30:55 -0000 On 01/18/14 17:41, Julien Grall wrote: > > Hello Nathan, > > On 01/17/2014 03:04 AM, Nathan Whitehorn wrote: >> On 01/16/14 18:36, Julien Grall wrote: >>> >>> >>> On 01/16/2014 01:56 AM, Nathan Whitehorn wrote: >>> As I understand, only the simple bus code (see simplebus_attach) is >>> translating the interrupts in the device on a resource. >>> So if you have a node directly attached to the root node with >>> interrupts and MMIO, the driver won't be able to retrieve and >>> translate the interrupts via bus_alloc_resources. > >> Why not? nexus on ARM, MIPS, PowerPC, and sparc64 can do this. > > I have digged into the code to find the reason of my issue. FreeBSD is > receiving a VM fault when the driver (xen-dt) is trying to setup the IRQ. > > This is because the GIC is not yet initialized but FreeBSD asks to > unmask the IRQ (sys/arm/arm/gic.c:306). > > With this problem, all device nodes that are before the GIC in the > device tree can't have interrupts. For instance this simple device > will segfault on FreeBSD: > > / { > > mybus { > compatible = "simple-bus"; > > mynode { > interrupt-parent = &gic; > interrupts = <...>; > }; > > gic: gic@xxxx { > interrupt-controller; > } > }; > }; > > The node "mynode" will have to move after the GIC to be able to work > correctly. > Ah, that sounds like a bug in the interrupt handling code. The PPC code is designed to handle this problem by deferring interrupt setup, as well as a number of other latent issues, and I think would make a good match for ARM as well. I made an experimental branch to port it to MIPS (the code is almost entirely machine-independent) but am waiting for testing. A general solution to this problem has to involve deferred setup. -Nathan