All of lore.kernel.org
 help / color / mirror / Atom feed
* Xen on ARM GIC setup
@ 2013-06-04 19:42 Sander Bogaert
  2013-06-04 21:21 ` Julien Grall
  0 siblings, 1 reply; 5+ messages in thread
From: Sander Bogaert @ 2013-06-04 19:42 UTC (permalink / raw)
  To: xen-devel@lists.xen.org

Hi,

I was going over this part of the gic setup code ( gic.c:gic_dist_init ):

    type = GICD[GICD_TYPER];
    gic.lines = 32 * (type & GICD_TYPE_LINES);
    ....
    /* Disable all global interrupts */
    for ( i = 32; i < gic.lines; i += 32 )
        GICD[GICD_ICENABLER + i / 32] = (uint32_t)~0ul;

The ARM GIC manual says about the ITLinesNumber bits of the TYPE register:

Indicates the maximum number of interrupts that the GIC supports. If
ITLinesNumber=N, the
maximum number of interrupts is 32(N+1). The interrupt ID range is
from 0 to (number of IDs – 1). For example:
0b00011
Up to 128 interrupt lines, interrupt IDs 0-127.

Shouldn't it be gic.lines = 32 * ((type & GICD_TYPE_LINES)+1); ? I
might be wrong but it seems like this way we are missing the last
register in those loops?

Regards,
Sander

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Xen on ARM GIC setup
  2013-06-04 19:42 Xen on ARM GIC setup Sander Bogaert
@ 2013-06-04 21:21 ` Julien Grall
  2013-06-04 21:23   ` Julien Grall
  0 siblings, 1 reply; 5+ messages in thread
From: Julien Grall @ 2013-06-04 21:21 UTC (permalink / raw)
  To: xen-devel

On 06/04/2013 08:42 PM, Sander Bogaert wrote:

> Hi,

Hi,

> I was going over this part of the gic setup code ( gic.c:gic_dist_init ):
> 
>     type = GICD[GICD_TYPER];
>     gic.lines = 32 * (type & GICD_TYPE_LINES);
>     ....
>     /* Disable all global interrupts */
>     for ( i = 32; i < gic.lines; i += 32 )
>         GICD[GICD_ICENABLER + i / 32] = (uint32_t)~0ul;

It seems you have an old tree :). A commit (2f2a3e31) was pushed at the
end of april to fix this issue.

Cheers,

-- 
Julien

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Xen on ARM GIC setup
  2013-06-04 21:21 ` Julien Grall
@ 2013-06-04 21:23   ` Julien Grall
  2013-06-05  8:29     ` Sander Bogaert
  0 siblings, 1 reply; 5+ messages in thread
From: Julien Grall @ 2013-06-04 21:23 UTC (permalink / raw)
  To: Sander Bogaert; +Cc: xen-devel

I forgot to cc Sander.

On 06/04/2013 10:21 PM, Julien Grall wrote:

> On 06/04/2013 08:42 PM, Sander Bogaert wrote:
> 
>> Hi,
> 
> Hi,
> 
>> I was going over this part of the gic setup code ( gic.c:gic_dist_init ):
>>
>>     type = GICD[GICD_TYPER];
>>     gic.lines = 32 * (type & GICD_TYPE_LINES);
>>     ....
>>     /* Disable all global interrupts */
>>     for ( i = 32; i < gic.lines; i += 32 )
>>         GICD[GICD_ICENABLER + i / 32] = (uint32_t)~0ul;
> 
> It seems you have an old tree :). A commit (2f2a3e31) was pushed at the
> end of april to fix this issue.
> 
> Cheers,
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Xen on ARM GIC setup
  2013-06-04 21:23   ` Julien Grall
@ 2013-06-05  8:29     ` Sander Bogaert
  2013-06-05  8:46       ` Ian Campbell
  0 siblings, 1 reply; 5+ messages in thread
From: Sander Bogaert @ 2013-06-05  8:29 UTC (permalink / raw)
  To: Julien Grall; +Cc: xen-devel

On 4 June 2013 23:23, Julien Grall <julien.grall@citrix.com> wrote:
> I forgot to cc Sander.
>
> On 06/04/2013 10:21 PM, Julien Grall wrote:
>
>> On 06/04/2013 08:42 PM, Sander Bogaert wrote:
>>
>>> Hi,
>>
>> Hi,
>>
>>> I was going over this part of the gic setup code ( gic.c:gic_dist_init ):
>>>
>>>     type = GICD[GICD_TYPER];
>>>     gic.lines = 32 * (type & GICD_TYPE_LINES);
>>>     ....
>>>     /* Disable all global interrupts */
>>>     for ( i = 32; i < gic.lines; i += 32 )
>>>         GICD[GICD_ICENABLER + i / 32] = (uint32_t)~0ul;
>>
>> It seems you have an old tree :). A commit (2f2a3e31) was pushed at the
>> end of april to fix this issue.

Ok I see :) Having different trees because of the other issue I mailed
about and I was looking in the wrong one. But now that I'm at it
anyway, same part of the code:

    /* Default all global IRQs to level, active low */
    for ( i = 32; i < gic.lines; i += 16 )
        GICD[GICD_ICFGR + i / 16] = 0x0;

    /* Route all global IRQs to this CPU */
    for ( i = 32; i < gic.lines; i += 4 )
        GICD[GICD_ICFGR + i / 4] = cpumask;

Shouldn't that second loop use the GICD_ITARGETSR register? Just
aksing :-) Seems strange to set the same field with different values
right after eachother also the += 4 loop doesn't make sense for it
since it's two bit each interrupt line. It would make sense for
ITARGETSR.

>>
>> Cheers,
>>
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Xen on ARM GIC setup
  2013-06-05  8:29     ` Sander Bogaert
@ 2013-06-05  8:46       ` Ian Campbell
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Campbell @ 2013-06-05  8:46 UTC (permalink / raw)
  To: Sander Bogaert; +Cc: Julien Grall, xen-devel

On Wed, 2013-06-05 at 10:29 +0200, Sander Bogaert wrote:
> On 4 June 2013 23:23, Julien Grall <julien.grall@citrix.com> wrote:
> > I forgot to cc Sander.
> >
> > On 06/04/2013 10:21 PM, Julien Grall wrote:
> >
> >> On 06/04/2013 08:42 PM, Sander Bogaert wrote:
> >>
> >>> Hi,
> >>
> >> Hi,
> >>
> >>> I was going over this part of the gic setup code ( gic.c:gic_dist_init ):
> >>>
> >>>     type = GICD[GICD_TYPER];
> >>>     gic.lines = 32 * (type & GICD_TYPE_LINES);
> >>>     ....
> >>>     /* Disable all global interrupts */
> >>>     for ( i = 32; i < gic.lines; i += 32 )
> >>>         GICD[GICD_ICENABLER + i / 32] = (uint32_t)~0ul;
> >>
> >> It seems you have an old tree :). A commit (2f2a3e31) was pushed at the
> >> end of april to fix this issue.
> 
> Ok I see :) Having different trees because of the other issue I mailed
> about and I was looking in the wrong one. But now that I'm at it
> anyway, same part of the code:
> 
>     /* Default all global IRQs to level, active low */
>     for ( i = 32; i < gic.lines; i += 16 )
>         GICD[GICD_ICFGR + i / 16] = 0x0;
> 
>     /* Route all global IRQs to this CPU */
>     for ( i = 32; i < gic.lines; i += 4 )
>         GICD[GICD_ICFGR + i / 4] = cpumask;
> 
> Shouldn't that second loop use the GICD_ITARGETSR register? Just
> aksing :-) Seems strange to set the same field with different values
> right after eachother also the += 4 loop doesn't make sense for it
> since it's two bit each interrupt line. It would make sense for
> ITARGETSR.

Yeah, that looks like a bug...

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-06-05  8:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-04 19:42 Xen on ARM GIC setup Sander Bogaert
2013-06-04 21:21 ` Julien Grall
2013-06-04 21:23   ` Julien Grall
2013-06-05  8:29     ` Sander Bogaert
2013-06-05  8:46       ` Ian Campbell

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.