#2460 closed defect (duplicate)

arm-gic.h - GIC_ID_TO_TWO_BITS_REG_OFFSET(id) incorrectly defined

Reported by: Adit Owned by:
Priority: normal Milestone: 4.11.3
Component: arch/arm Version: 4.11
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

This bug pertains to the ARM Generic Interrupt Controller (GIC) register utility functions in

c/src/lib/libbsp/arm/shared/include/arm-gic.h

The following routines all use the macro GIC_ID_TO_TWO_BITS_REG_OFFSET(id):

gic_id_get_handling_mode
gic_id_set_handling_mode
gic_id_get_trigger_mode
gic_id_set_trigger_mode

These routines set the GIC_ICFGRn set of registers. These registers have 2-bit bit fields. Let's take the trigger mode routines as an example of the bug, but it applies to the handling mode as well. The GIC specification from ARM states that for a particular interrupt ID m the register n and bit field F is found by:

n = m DIV 16
F = m MOD 16

And the bit location in register n is defined as [2F+1:2F]. However, the macro GIC_ID_TO_TWO_BITS_REG_OFFSET(id) and the routines that use it, set bits [F+1:F].

I have tested this by using the set_trigger_mode routine to set an interrupt to be edge triggered, but the correct bit does not get set, and the interrupt still behaves in a level triggered fashion. When I adjust the macro to have a << 1 it works correctly.

If someone can verify my logic at least, then I can submit a tested patch.

Attachments (1)

Change History (7)

comment:1 Changed on 11/10/15 at 07:16:01 by Sebastian Huber

Yes, please send a patch to devel@… and add "Close #2460." to the commit message.

Version 0, edited on 11/10/15 at 07:16:01 by Sebastian Huber (next)

comment:2 Changed on 01/26/17 at 07:16:00 by Sebastian Huber

Milestone: 4.11.14.11.2

comment:3 Changed on 03/23/17 at 01:04:45 by Chris Johns

Milestone: 4.11.24.11.3

The 4.11.2 milestone is closing.

comment:4 Changed on 02/05/18 at 04:40:23 by Chris Johns

Milestone: 4.11.3Indefinite

Requires funding.

comment:5 Changed on 02/05/18 at 07:48:15 by Sebastian Huber

Milestone: Indefinite4.11.3
Resolution: duplicate
Status: newclosed

Duplicate of #3002.

comment:6 Changed on 02/05/18 at 07:59:59 by Sebastian Huber

Component: bspsarch/arm
Note: See TracTickets for help on using tickets.