All of lore.kernel.org
 help / color / mirror / Atom feed
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
Date: Thu, 16 Jan 2014 21:04:41 -0600	[thread overview]
Message-ID: <52D89DC9.7050303@freebsd.org> (raw)
In-Reply-To: <52D87B15.5090208@linaro.org>

On 01/16/14 18:36, Julien Grall wrote:
>
>
> On 01/16/2014 01:56 AM, Nathan Whitehorn wrote:
>>
>> Thanks for the CC. Could you explain what you mean by "grant-parent"
>> etc? "interrupt-parent" is a fundamental part of the way PAPR (and
>> ePAPR) work, so I'm very very hesitant to start guessing. I think things
>> have broken for you because some (a lot, actually) of OF code does not
>> expect #interrupt-cells to be more than 2. Some APIs might need
>> updating, which I'll try to take care of. Could you tell me what the
>> difference between SPI and PPI is, by the way?
>
> Sorry, I also made some typoes in my explanation so it was not clear.
>
> interrupt-parent is a property in a device node which links this node 
> to an interrupt controller (in our case the GIC controller).
>
> The way to handle it on Linux and the ePAR is different:
>    - ePAR (chapter 2.4) says:
> The physical wiring of an interrupt source to an interrupt controller 
> is represented in the device tree with the interrupt-parent property. 
> Nodes that represent interrupt-generating devices contain an
> interrupt-parent property which has a phandle value that points to the 
> device to which the device's interrupts are routed, typically an 
> interrupt controller. If an interrupt-generating device does not have
> an interrupt-parent property, its interrupt parent is assumed to be 
> its device tree parent.
> From my understanding, it's mandatory to have an interrupt-parent 
> property on each device node which is using interrupts. If it doesn't 
> exist it will assume that the parent is interrupt controller.
> If I'm mistaken, at least FreeBSD handle the interrupt-parent property 
> in this way.
>    - Linux implementation will look at to the node, if the property 
> doesn't exists, it will check if the ancestor has this property ...



> So the device tree below is valid on Linux, but not on FreeBSD:
>
> / {
>   interrupt-parent = &gic
>
>   gic: gic@10
>   {
>     ...
>   }
>
>   timer@1
>   {
>     interrupts = <...>
>   }
> }
>
> Most of shipped device tree use this trick.
>
> IanC: I was reading the linux binding documentation 
> (devicetree/booting-without-of.txt VII.2) and it seems that the 
> explanation differs from the implementation, right?
>
> For the #interrupt-cells property, the problem starts in 
> fdt_intr_to_rl (sys/dev/fdt/fdt_common.c:476). ofw_bus_map_intr is 
> called always with the first cells of the interrupt no matter the 
> number of cells specified by #interrupt-cells.

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.

>> 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.

> In the Xen device tree, we have an hypervisor node directly attach to 
> the root which contains both MMIO and interrupt used by Xen to 
> communicate with the guest.
>

OK. This should be fine, though simplebus would also work if you use MMIO.
-Nathan

  parent reply	other threads:[~2014-01-17  3:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1389733267-20822-1-git-send-email-julien.grall@linaro.org>
2014-01-15  1:26 ` [RFC] Add support for Xen ARM guest on FreeBSD Warner Losh
     [not found] ` <24851B79-7EC7-4E3A-94DB-4B9B86FDFFFC@bsdimp.com>
2014-01-15 16:24   ` Julien Grall
     [not found]   ` <52D6B62A.9000208@linaro.org>
2014-01-16  1:56     ` Nathan Whitehorn
2014-01-16 16:10     ` Ian Campbell
     [not found]     ` <52D73C4E.2080306@freebsd.org>
2014-01-16 12:56       ` Stefano Stabellini
2014-01-17  0:36       ` Julien Grall
     [not found]       ` <52D87B15.5090208@linaro.org>
2014-01-17  3:04         ` Nathan Whitehorn [this message]
2014-01-17 13:45           ` Julien Grall
     [not found]           ` <52D933F2.8000101@linaro.org>
2014-01-17 15:27             ` Nathan Whitehorn
2014-01-18 23:41           ` Julien Grall
     [not found]           ` <52DB1138.6010804@linaro.org>
2014-01-19  1:30             ` Nathan Whitehorn
2014-01-19  2:44             ` Warner Losh
     [not found]             ` <3AE8EDE6-D931-4F93-9BF7-ABFB297B5B96@bsdimp.com>
2014-01-19  3:01               ` Nathan Whitehorn
     [not found]               ` <52DB3FFD.2070503@freebsd.org>
2014-01-19  3:08                 ` Warner Losh
     [not found]                 ` <8C16C019-B9AF-417B-9B02-C016A202AAC7@bsdimp.com>
2014-01-19  3:23                   ` Nathan Whitehorn
2014-01-17  9:29         ` Ian Campbell
     [not found]         ` <1389950962.6697.33.camel@kazak.uk.xensource.com>
2014-01-17 13:49           ` Julien Grall
2014-01-19  0:49           ` Julien Grall
2014-01-14 21:01 Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52D89DC9.7050303@freebsd.org \
    --to=nwhitehorn@freebsd.org \
    --cc=freebsd-arm@FreeBSD.org \
    --cc=freebsd-xen@freebsd.org \
    --cc=gibbs@freebsd.org \
    --cc=ian.campbell@citrix.com \
    --cc=imp@bsdimp.com \
    --cc=julien.grall@linaro.org \
    --cc=roger.pau@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.