Date: Fri, 17 Jan 2014 09:27:21 -0600 From: Nathan Whitehorn <nwhitehorn@freebsd.org> To: Julien Grall <julien.grall@linaro.org>, Warner Losh <imp@bsdimp.com> 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 Subject: Re: [RFC] Add support for Xen ARM guest on FreeBSD Message-ID: <52D94BD9.5020209@freebsd.org> In-Reply-To: <52D933F2.8000101@linaro.org> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52D94BD9.5020209>