From owner-freebsd-arm@FreeBSD.ORG Fri Jan 17 15:27:30 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 C00A894C; Fri, 17 Jan 2014 15:27:30 +0000 (UTC) Received: from smtpauth4.wiscmail.wisc.edu (wmauth4.doit.wisc.edu [144.92.197.145]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8879B1E00; Fri, 17 Jan 2014 15:27:30 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth4.wiscmail.wisc.edu by smtpauth4.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) id <0MZJ00200X9S0G00@smtpauth4.wiscmail.wisc.edu>; Fri, 17 Jan 2014 09:27:23 -0600 (CST) X-Spam-PmxInfo: Server=avs-4, Version=6.0.3.2322014, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2014.1.17.151815, SenderIP=0.0.0.0 X-Spam-Report: AuthenticatedSender=yes, SenderIP=0.0.0.0 Received: from comporellon.tachypleus.net (adsl-76-208-68-77.dsl.mdsnwi.sbcglobal.net [76.208.68.77]) by smtpauth4.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) with ESMTPSA id <0MZJ00D54XLLZ510@smtpauth4.wiscmail.wisc.edu>; Fri, 17 Jan 2014 09:27:23 -0600 (CST) Message-id: <52D94BD9.5020209@freebsd.org> Date: Fri, 17 Jan 2014 09:27:21 -0600 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.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> <52D933F2.8000101@linaro.org> In-reply-to: <52D933F2.8000101@linaro.org> 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: Fri, 17 Jan 2014 15:27:30 -0000 On 01/17/14 07:45, Julien Grall wrote: > > > On 01/17/2014 03:04 AM, Nathan Whitehorn wrote: >> On 01/16/14 18:36, Julien Grall wrote: >> >> The specification is actually a little unclear on this point, but >> FreeBSD follows the same rules as Linux in any case. Most, if not all, >> FreeBSD code should check any ancestor at this point as well. In >> particular fdt_intr_to_rl does this. What it *doesn't* do is allow >> #interrupt-cells to be larger than 2. I'll fix this this weekend. > > Thanks, for working on this part. > > Another things to take into account: the first cell doesn't always > contain the interrupt. > With the Linux binding (#interrupt-cells == 3) > - cell 1: 1 or 0 (PPI vs SPI) > - cell 2: relative IRQ number to the start of PPI/SPI > - cell 3: cpu mask + interrupt flags (edge/level...) > ` Yep. This will require a little API redesign, but shouldn't be that bad. >>>> On the subject of simple-bus, they usually aren't necessary. For >>>> example, all hypervisor devices on IBM hardware live under /vdevice, >>>> which is attached to the device tree root. They don't use MMIO, so >>>> simple-bus doesn't really make sense. How does Xen communicate with >>>> the >>>> OS in these devices? >>>> -Nathan >>> >>> 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 noticed at least one issue (which is not related to my problem): > - When the OFW nexus translate IRQ (with #interrupt-cells > 1), the > rid will be equal to 0, 0 + #interrupt-cells, ... So the number will > be discontinued. Rather than on simple-bus for the same device, the > rid will be 0, 1, 2... Interesting. I'll investigate. > For my issue, I will look at it again this week-end. > > BTW when I look to the FDT (sys/dev/fdt_common.c) and the ofw > (sys/dev/ofw_nexus.c) code, I have notice that lots of code are > duplicated. > > It would be nice to have common helper to avoid duplicate code and > issue for the future :). > I'm in the middle of cleaning all this up (which is how I'm on the hook for breaking your case!). Most of fdt_common.c is not long for this world. -Nathan