From owner-freebsd-xen@FreeBSD.ORG Sun Jan 19 02:44:57 2014 Return-Path: Delivered-To: freebsd-xen@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 15BF0256 for ; Sun, 19 Jan 2014 02:44:57 +0000 (UTC) Received: from mail-ig0-f173.google.com (mail-ig0-f173.google.com [209.85.213.173]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CE66F1611 for ; Sun, 19 Jan 2014 02:44:56 +0000 (UTC) Received: by mail-ig0-f173.google.com with SMTP id c10so5057003igq.0 for ; Sat, 18 Jan 2014 18:44:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=miznZQsfRtjA5VuYPXfaIynv5+4GL60bP9kdQW9VNR0=; b=hzev5L/G0J2j2WtsDK7JWZHrgO4eDPgdbHLz26gV6lDBHTK1e96tRaKXti5BARxLXm yVq+0HEr5a2+crc8lYdOMe9ClELtwiMKgweQV026pDfHeFQD9FX/dADBHTCWlMtzFeiN tKEQy8p/Vlu5TnO2H5Ec3um0K3coPcZnyzF1YqsFRuWc/A/9w8PCYmGh9/WwCos/RAFp Um8vR2euiGDzcMTiXR13Dm0reCtXsR3/dL0qMK+K0PMxS74JaCB2OdZcxRzLWrORe46t BJNj+6IO1ZCngtJFApQxrv0NOlb7TXWC77O237Tm9rWiUYDpBAC2DwddcsQKxVvTIplK FQdg== X-Gm-Message-State: ALoCoQmVBFHT4/26VB9DVdSJMbCJedhP/8Q4Saz1y9Iy5aPRCSocmmI6fzhDIvV173yn+VK+Pzil X-Received: by 10.42.122.146 with SMTP id n18mr124691icr.41.1390099490219; Sat, 18 Jan 2014 18:44:50 -0800 (PST) Received: from fusion-mac.bsdimp.com (50-78-194-198-static.hfc.comcastbusiness.net. [50.78.194.198]) by mx.google.com with ESMTPSA id gc2sm12532065igd.6.2014.01.18.18.44.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 18 Jan 2014 18:44:49 -0800 (PST) Sender: Warner Losh Subject: Re: [RFC] Add support for Xen ARM guest on FreeBSD Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <52DB1138.6010804@linaro.org> Date: Sat, 18 Jan 2014 19:44:09 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <3AE8EDE6-D931-4F93-9BF7-ABFB297B5B96@bsdimp.com> 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> To: Julien Grall X-Mailer: Apple Mail (2.1085) Cc: ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, xen-devel@lists.xen.org, freebsd-xen@freebsd.org, freebsd-arm@FreeBSD.org, Nathan Whitehorn , gibbs@freebsd.org X-BeenThere: freebsd-xen@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion of the freebsd port to xen - implementation and usage List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jan 2014 02:44:57 -0000 On Jan 18, 2014, at 4:41 PM, Julien Grall wrote: >=20 > Hello Nathan, >=20 > On 01/17/2014 03:04 AM, Nathan Whitehorn wrote: >> On 01/16/14 18:36, Julien Grall wrote: >>>=20 >>>=20 >>> 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. >=20 >> Why not? nexus on ARM, MIPS, PowerPC, and sparc64 can do this. >=20 > 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. >=20 > This is because the GIC is not yet initialized but FreeBSD asks to = unmask the IRQ (sys/arm/arm/gic.c:306). >=20 > 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: >=20 > / { >=20 > mybus { > compatible =3D "simple-bus"; >=20 > mynode { > interrupt-parent =3D &gic; > interrupts =3D <...>; > }; >=20 > gic: gic@xxxx { > interrupt-controller; > } > }; > }; >=20 > The node "mynode" will have to move after the GIC to be able to work = correctly. This stems from a difference in enumeration between FreeBSD and Linux. = FreeBSD enumerates the devices in DTB order, while Linux does a partial = ordering based on dependencies. Warner=