arm_gic: Improve handling of GICD_ICFGR
cover arm_gic: Improve handling of GICD_ICFGR
The following patches address the behavior of the GICD_ICFGR register in the ARM GIC.
Changes to previous version:
- Setting of model mode only for old GIC revisions
- Less invasive change for PPI settings
Adam Lackorzynski (3):
arm_gic: Fix read of GICD_ICFGR
arm_gic: GICD_ICFGR: Write model only for pre v1 GICs
arm_gic: Do not force PPIs to edge-triggered mode
hw/intc/arm_gic.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
Signature · 1 line
2.1.0.rc1
PATCH 1/3 arm_gic: Fix read of GICD_ICFGR
The GICD_ICFGR register covers 4 interrupts per byte.
--- hw/intc/arm_gic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/arm_gic.c +1 -1
@@ -372,7 +372,7 @@ static uint32_t gic_dist_readb(void *opaque, hwaddr offset) } }else if (offset <0xf00 ) {/* Interrupt Configuration. */ - irq = (offset -0xc00 ) *2 +GIC_BASE_IRQ ; + irq = (offset -0xc00 ) *4 +GIC_BASE_IRQ ;if (irq >= s->num_irq) goto bad_reg; res =0 ;
Signature · 1 line
2.1.0.rc1
PATCH 2/3 arm_gic: GICD_ICFGR: Write model only for pre v1 GICs
In reply to Adam LackorzynskiSetting the model is only available in pre-v1 GIC models.
--- hw/intc/arm_gic.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
hw/intc/arm_gic.c +6 -4
@@ -561,10 +561,12 @@ static void gic_dist_writeb(void *opaque, hwaddr offset,if (irq <GIC_INTERNAL ) value |=0xaa ;for (i =0 ; i <4 ; i++) { -if (value & (1 << (i *2 ))) { -GIC_SET_MODEL (irq + i); - }else { -GIC_CLEAR_MODEL (irq + i); +if (s->revision ==REV_11MPCORE || s->revision ==REV_NVIC ) { +if (value & (1 << (i *2 ))) { +GIC_SET_MODEL (irq + i); + }else { +GIC_CLEAR_MODEL (irq + i); + } }if (value & (2 << (i *2 ))) {GIC_SET_EDGE_TRIGGER (irq + i);
Signature · 1 line
2.1.0.rc1
Re: [Qemu-devel] [PATCH 2/3] arm_gic: GICD_ICFGR: Write model only for pre v1 GICs
Quoted 29 lines · Adam Lackorzynski
Setting the model is only available in pre-v1 GIC models.
--- hw/intc/arm_gic.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)hw/intc/arm_gic.c +6
-4@@ -561,10 +561,12 @@ static void gic_dist_writeb(void *opaque, hwaddr offset,if (irq <GIC_INTERNAL ) value |=0xaa ;for (i =0 ; i <4 ; i++) { -if (value & (1 << (i *2 ))) { -GIC_SET_MODEL (irq + i); - }else { -GIC_CLEAR_MODEL (irq + i); +if (s->revision ==REV_11MPCORE || s->revision ==REV_NVIC ) { +if (value & (1 << (i *2 ))) { +GIC_SET_MODEL (irq + i); + }else { +GIC_CLEAR_MODEL (irq + i); + } }if (value & (2 << (i *2 ))) {GIC_SET_EDGE_TRIGGER (irq + i);Signature · 1 line
2.1.0.rc1
looks good,
PATCH 3/3 arm_gic: Do not force PPIs to edge-triggered mode
In reply to Adam LackorzynskiOnly SGIs must be WI, done by forcing them to their default (edge-triggered).
--- hw/intc/arm_gic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/arm_gic.c +1 -1
@@ -558,7 +558,7 @@ static void gic_dist_writeb(void *opaque, hwaddr offset, irq = (offset -0xc00 ) *4 +GIC_BASE_IRQ ;if (irq >= s->num_irq) goto bad_reg; -if (irq <GIC_INTERNAL ) +if (irq <GIC_NR_SGIS ) value |=0xaa ;for (i =0 ; i <4 ; i++) {if (s->revision ==REV_11MPCORE || s->revision ==REV_NVIC ) {
Signature · 1 line
2.1.0.rc1
Re: [Qemu-devel] [PATCH 3/3] arm_gic: Do not force PPIs to edge-triggered mode
Quoted 24 lines · Adam Lackorzynski
Only SGIs must be WI, done by forcing them to their default (edge-triggered).
Signed-off-by Adam Lackorzynski <[email protected]>--- hw/intc/arm_gic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/intc/arm_gic.c +1
-1@@ -558,7 +558,7 @@ static void gic_dist_writeb(void *opaque, hwaddr offset, irq = (offset -0xc00 ) *4 +GIC_BASE_IRQ ;if (irq >= s->num_irq) goto bad_reg; -if (irq <GIC_INTERNAL ) +if (irq <GIC_NR_SGIS ) value |=0xaa ;for (i =0 ; i <4 ; i++) {if (s->revision ==REV_11MPCORE || s->revision ==REV_NVIC ) {Signature · 1 line
2.1.0.rc1
where do we ensure that the SGIs are actually configured as edge-triggered when creating the gic?
-Christoffer
Re: [Qemu-devel] [PATCH 3/3] arm_gic: Do not force PPIs to edge-triggered mode
Quoted 20 lines · Christoffer Dall
Quoted 19 lines · Adam Lackorzynski
Only SGIs must be WI, done by forcing them to their default (edge-triggered).
Signed-off-by Adam Lackorzynski <[email protected]>--- hw/intc/arm_gic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/intc/arm_gic.c +1
-1@@ -558,7 +558,7 @@ static void gic_dist_writeb(void *opaque, hwaddr offset, irq = (offset -0xc00 ) *4 +GIC_BASE_IRQ ;if (irq >= s->num_irq) goto bad_reg; -if (irq <GIC_INTERNAL ) +if (irq <GIC_NR_SGIS ) value |=0xaa ;
Quoted 8 lines
Quoted 5 lines
hw/intc/arm_gic.c +0
-0for (i =0 ; i <4 ; i++) {if (s->revision ==REV_11MPCORE || s->revision ==REV_NVIC ) {Signature · 1 line
2.1.0.rc1where do we ensure that the SGIs are actually configured as edge-triggered when creating the gic?
It's setup in arm_gic_common_reset() in arm_gic_common.c. (Looks like I should add another change to use GIC_NR_SGIS there too.)
Adam
Signature · 2 lines
Adam [email protected] Lackorzynski http://os.inf.tu-dresden.de/~adam/
Christoffer Dall
Acked-byRe: [Qemu-devel] [PATCH 3/3] arm_gic: Do not force PPIs to edge-triggered mode
Quoted 30 lines · Adam Lackorzynski
Quoted 20 lines · Christoffer Dall
Quoted 19 lines · Adam Lackorzynski
Only SGIs must be WI, done by forcing them to their default (edge-triggered).
Signed-off-by Adam Lackorzynski <[email protected]>--- hw/intc/arm_gic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/intc/arm_gic.c +1
-1@@ -558,7 +558,7 @@ static void gic_dist_writeb(void *opaque, hwaddr offset, irq = (offset -0xc00 ) *4 +GIC_BASE_IRQ ;if (irq >= s->num_irq) goto bad_reg; -if (irq <GIC_INTERNAL ) +if (irq <GIC_NR_SGIS ) value |=0xaa ;Quoted 8 lines
Quoted 5 lines
hw/intc/arm_gic.c +0
-0for (i =0 ; i <4 ; i++) {if (s->revision ==REV_11MPCORE || s->revision ==REV_NVIC ) {Signature · 1 line
2.1.0.rc1where do we ensure that the SGIs are actually configured as edge-triggered when creating the gic?
Quoted 3 lines
It's setup in
arm_gic_common_reset()inarm_gic_common.c. (Looks like I should add another change to useGIC_NR_SGISthere too.)
That would be good, for this patch:
Thanks!