From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v2 08/15] xen/arm: use device api to detect GIC version Date: Thu, 10 Apr 2014 10:05:28 +0100 Message-ID: <1397120728.9862.44.camel@kazak.uk.xensource.com> References: <1396612593-443-1-git-send-email-vijay.kilari@gmail.com> <1396612593-443-9-git-send-email-vijay.kilari@gmail.com> <533EBC9F.1080504@linaro.org> <534559F8.9060409@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <534559F8.9060409@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: Vijay Kilari , Stefano Stabellini , Prasun Kapoor , Vijaya Kumar K , xen-devel@lists.xen.org, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Wed, 2014-04-09 at 15:32 +0100, Julien Grall wrote: > On 04/09/2014 03:28 PM, Vijay Kilari wrote: > >>> + > >>> + dt_for_each_device_node(dt_host, node) > >>> + { > >>> + rc = device_init(node, DEVICE_GIC, NULL); > >>> + if ( !rc ) > >>> + num_gics++; > >> > >> Xen only supports a single GIC for now. You have to initialized the > >> correct one (see dt_find_interrupt_controller). > > > > dt_find_interrupt_controller expects compatibility string as below to fetch > > the gic node which can be passed to device_init(). > > > > static const struct dt_device_match gic_ids[] __initconst = > > { > > DT_MATCH_GIC, > > { /* sentinel */ }, > > }; > > > > In such case, generic driver has to pass compatibility strings of both > > GIC v3 & GIC v2 to find the node in dt. Is this ok? > > > > Other way is to break when num_gics = 1 when it finds the first gic node. > > Why can't you modify dt_find_interrupt_controller? Or even better, take > the code from it and use it directly in your function... The patch here looks like a pretty natural use of the DT device API to me, I think all that is needed is for gicv2_init to call dt_get_parent(np) and skip any non-root gic with a warning message and return error. Something should also check for the "interrupt-controller" property, either the inner or outer init function. Ian.