GICv3: Clean up + enable support on GICv4
cover GICv3: Clean up + enable support on GICv4
Hi all,
This small patch series allow Xen to run on platform reporting GICv4 in the GIC*_PIDR2.
Sincerely yours,
Julien Grall (2):
xen/arm: gic-v3: Clean-up the GIC*_PIDR2_* definitions xen/arm: gic-v3: Allow Xen to run on hardware reporting GICv4
xen/arch/arm/gic-v3.c | 8 ++++---- xen/include/asm-arm/gic_v3_defs.h | 13 +++++-------- 2 files changed, 9 insertions(+), 12 deletions(-)
Signature · 1 line
2.1.4
PATCH 1/2 xen/arm: gic-v3: Clean-up the GIC*_PIDR2_* definitions
GICR_PIDR2 and GICD_PIDR2 use the same register layout. Rather than define twice, one of which is an alias to the other, introduce GIC_PIDR2_* defines.
Also:
* Use the same prefix for the mask and the value
* Integrate the shift in the value to avoid shifting in the code
* Use GICv* to match the value name in the spec
* Move them in a proper place
--- xen/arch/arm/gic-v3.c | 8 ++++---- xen/include/asm-arm/gic_v3_defs.h | 12 ++++-------- 2 files changed, 8 insertions(+), 12 deletions(-)
xen/arch/arm/gic-v3.c +4 -4
@@ -639,8 +639,8 @@ static int __init gicv3_populate_rdist(void) {void __iomem *ptr = gicv3.rdist_regions[i].map_base; - reg =readl_relaxed (ptr +GICR_PIDR2 ) &GICR_PIDR2_ARCH_REV_MASK ; -if ( (reg >>GICR_PIDR2_ARCH_REV_SHIFT ) !=GICR_PIDR2_ARCH_GICV3 ) + reg =readl_relaxed (ptr +GICR_PIDR2 ) &GIC_PIDR2_ARCH_MASK ; +if ( reg != GIC_PIDR2_ARCH_GICv3 ) { dprintk(XENLOG_ERR, "GICv3: No redistributor present @%"PRIpaddr"\n",
@@ -1193,8 +1193,8 @@ static int __init gicv3_init(void)if ( !gicv3.map_dbase )panic ("GICv3: Failed to ioremap for GIC distributor\n" ); - reg =readl_relaxed (GICD +GICD_PIDR2 ) &GICD_PIDR2_ARCH_REV_MASK ; -if ( ((reg >>GICD_PIDR2_ARCH_REV_SHIFT ) !=GICD_PIDR2_ARCH_GICV3 ) ) + reg =readl_relaxed (GICD +GICD_PIDR2 ) &GIC_PIDR2_ARCH_MASK ; +if ( reg != GIC_PIDR2_ARCH_GICv3 )panic ("GICv3: no distributor detected\n" ); if ( !dt_property_read_u32(node, "#redistributor-regions",
xen/include/asm-arm/gic_v3_defs.h +4 -8
@@ -40,6 +40,10 @@#define GICD_PIDR5 (0xFFD4)#define GICD_PIDR7 (0xFFDC) +/* Common between GICD_PIDR2 and GICR_PIDR2 */ +#define GIC_PIDR2_ARCH_MASK (0xf0) +#define GIC_PIDR2_ARCH_GICv3 (0x30) +#define GICC_SRE_EL2_SRE (1UL << 0)#define GICC_SRE_EL2_DFB (1UL << 1)#define GICC_SRE_EL2_DIB (1UL << 2)
@@ -59,14 +63,6 @@#define GICR_WAKER_ProcessorSleep (1U << 1)#define GICR_WAKER_ChildrenAsleep (1U << 2) -#define GICD_PIDR2_ARCH_REV_MASK (0xf0) -#define GICD_PIDR2_ARCH_REV_SHIFT (0x4) -#define GICD_PIDR2_ARCH_GICV3 (0x3) - -#define GICR_PIDR2_ARCH_REV_MASK GICD_PIDR2_ARCH_REV_MASK -#define GICR_PIDR2_ARCH_REV_SHIFT GICD_PIDR2_ARCH_REV_SHIFT -#define GICR_PIDR2_ARCH_GICV3 GICD_PIDR2_ARCH_GICV3 -#define GICR_SYNCR_NOT_BUSY 1/* * Implementation defined value JEP106?
Signature · 1 line
2.1.4
Re: [PATCH 1/2] xen/arm: gic-v3: Clean-up the GIC*_PIDR2_* definitions
Quoted 5 lines · Julien Grall
GICR_PIDR2andGICD_PIDR2use the same register layout. Rather than define twice, one of which is an alias to the other, introduce GIC_PIDR2_*
defines.
Quoted 7 lines
Also:
* Use the same prefix for the mask and the value
* Integrate the shift in the value to avoid shifting in the code
* Use GICv* to match the value name in the spec
* Move them in a proper placeSigned-off-by Julien Grall <[email protected]>
PATCH 2/2 xen/arm: gic-v3: Allow Xen to run on hardware reporting GICv4
In reply to Julien GrallIt seems that there is some hardware which report start to report GICv4 in the GIC*_PIDR2 register.
As GICv4 is a superset of GICv3, it should just work on Xen.
--- xen/arch/arm/gic-v3.c | 4 ++-- xen/include/asm-arm/gic_v3_defs.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
xen/arch/arm/gic-v3.c +2 -2
@@ -640,7 +640,7 @@ static int __init gicv3_populate_rdist(void)void __iomem *ptr = gicv3.rdist_regions[i].map_base; reg =readl_relaxed (ptr +GICR_PIDR2 ) &GIC_PIDR2_ARCH_MASK ; -if ( reg != GIC_PIDR2_ARCH_GICv3 ) +if ( reg != GIC_PIDR2_ARCH_GICv3 && reg != GIC_PIDR2_ARCH_GICv4 ) { dprintk(XENLOG_ERR, "GICv3: No redistributor present @%"PRIpaddr"\n",
@@ -1194,7 +1194,7 @@ static int __init gicv3_init(void)panic ("GICv3: Failed to ioremap for GIC distributor\n" ); reg =readl_relaxed (GICD +GICD_PIDR2 ) &GIC_PIDR2_ARCH_MASK ; -if ( reg != GIC_PIDR2_ARCH_GICv3 ) +if ( reg != GIC_PIDR2_ARCH_GICv3 && reg != GIC_PIDR2_ARCH_GICv4 )panic ("GICv3: no distributor detected\n" ); if ( !dt_property_read_u32(node, "#redistributor-regions",
xen/include/asm-arm/gic_v3_defs.h +1 -0
@@ -43,6 +43,7 @@/* Common between GICD_PIDR2 and GICR_PIDR2 */ #define GIC_PIDR2_ARCH_MASK (0xf0)#define GIC_PIDR2_ARCH_GICv3 (0x30) +#define GIC_PIDR2_ARCH_GICv4 (0x40)#define GICC_SRE_EL2_SRE (1UL << 0)#define GICC_SRE_EL2_DFB (1UL << 1)
Signature · 1 line
2.1.4
Re: [PATCH 2/2] xen/arm: gic-v3: Allow Xen to run on hardware reporting GICv4
Quoted 1 line · Julien Grall
It seems that there is some hardware which report start to report GICv4
s/report start to reports/reports/ ?
Also, this is an odd way to express it, what you mean is that some hardware is now shipping with GICv4. Unless you are trying to imply that they are claiming to be GICv4 without actually being so?
(If we agree on some wording I can modify this text on commit, subject to the discussion below).
Quoted 16 lines
in the GIC*_PIDR2 register.
As GICv4 is a superset of GICv3, it should just work on Xen.
Reported-by Andre Przywara <[email protected]>Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/gic-v3.c | 4 ++-- xen/include/asm-arm/gic_v3_defs.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)xen/arch/arm/gic-v3.c +0
-0
xen/arch/arm/gic-v3.c static int __init gicv3_populate_rdist(void) · line 643
Quoted 5 lines
xen/arch/arm/gic-v3.c +1
-1@@ -640,7 +640,7 @@ static int __init gicv3_populate_rdist(void)void __iomem *ptr = gicv3.rdist_regions[i].map_base; reg =readl_relaxed (ptr +GICR_PIDR2 ) &GIC_PIDR2_ARCH_MASK ; -if ( reg != GIC_PIDR2_ARCH_GICv3 ) +if ( reg != GIC_PIDR2_ARCH_GICv3 && reg != GIC_PIDR2_ARCH_GICv4 )
Once we have GICv5, 6, etc this is going to get unwieldy, shall we switch to a switch now?
xen/arch/arm/gic-v3.c static int __init gicv3_populate_rdist(void) · line 646
Quoted 3 lines
xen/arch/arm/gic-v3.c +0
-0{ dprintk(XENLOG_ERR, "GICv3: No redistributor present @%"PRIpaddr"\n",
I wonder if GICv3 ought to become GICv%d, on the other hand this is really the GICv3 driver driving a v4 in v3 "mode", so maybe v3 is the best logging.
Re: [PATCH 2/2] xen/arm: gic-v3: Allow Xen to run on hardware reporting GICv4
Hi,
Quoted 30 lines · Ian Campbell
Quoted 1 line · Julien Grall
It seems that there is some hardware which report start to report GICv4
s/report start to reports/reports/ ?
Also, this is an odd way to express it, what you mean is that some hardware is now shipping with GICv4. Unless you are trying to imply that they are claiming to be GICv4 without actually being so?
(If we agree on some wording I can modify this text on commit, subject to the discussion below).
Quoted 18 lines
in the GIC*_PIDR2 register.
As GICv4 is a superset of GICv3, it should just work on Xen.
Reported-by Andre Przywara <[email protected]>Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/gic-v3.c | 4 ++-- xen/include/asm-arm/gic_v3_defs.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)xen/arch/arm/gic-v3.c +0
-0@@ -640,7 +640,7 @@ static int __init gicv3_populate_rdist(void)void __iomem *ptr = gicv3.rdist_regions[i].map_base;
Quoted 6 lines
xen/arch/arm/gic-v3.c static int __init gicv3_populate_rdist(void) · line 643
Quoted 3 lines
xen/arch/arm/gic-v3.c +1
-1reg =readl_relaxed (ptr +GICR_PIDR2 ) &GIC_PIDR2_ARCH_MASK ; -if ( reg != GIC_PIDR2_ARCH_GICv3 ) +if ( reg != GIC_PIDR2_ARCH_GICv3 && reg != GIC_PIDR2_ARCH_GICv4 )Once we have GICv5, 6, etc this is going to get unwieldy, shall we switch to a switch now?
The current GICv3 documentation is actually subtitled:
"GIC architecture version 3.0 and version 4.0", so I'd view them both together. We can care about GICv >4 once this appears, but for now I'd just stick with that simple if extension.
I just stumbled upon this because the Linux driver compares against v3 and v4 with a very similar statement (and-ed compares in if).
Quoted 8 lines
xen/arch/arm/gic-v3.c static int __init gicv3_populate_rdist(void) · line 646
Quoted 4 lines
xen/arch/arm/gic-v3.c +0
-0{ dprintk(XENLOG_ERR, "GICv3: No redistributor present @%"PRIpaddr"\n",I wonder if GICv3 ought to become GICv%d, on the other hand this is really the GICv3 driver driving a v4 in v3 "mode", so maybe v3 is the best logging.
I'd keep v3 as well, as this part is really a GICv3 property. Maybe we should quote the spec in the commit message:
"Because GICv4 is an extension of GICv3, all references to GICv3 in this manual apply equally to GICv4."
Cheers,
Andre.
Re: [PATCH 2/2] xen/arm: gic-v3: Allow Xen to run on hardware reporting GICv4
In reply to Ian CampbellQuoted 4 lines · Ian Campbell
Quoted 1 line · Julien Grall
It seems that there is some hardware which report start to report GICv4
s/report start to reports/reports/ ?
Yes, reports.
Quoted 3 lines
Also, this is an odd way to express it, what you mean is that some hardware is now shipping with GICv4. Unless you are trying to imply that they are claiming to be GICv4 without actually being so?
GICv4 is an extension of GICv3 and should support any GICv3 feature.
It's not like GICv2 vs GICv3 where the GICv2 part is an optional feature in the GICv3.
Quoted 2 lines
(If we agree on some wording I can modify this text on commit, subject to the discussion below).
What about:
"The GICv4 is an extension of GICv3 (see 1.1 in ARM IHI 0069A) which means that the GICv3 driver can run normally on a GICv4 hardware.
Though, the GICv4-only feature won't be used."
Quoted 18 lines
Quoted 18 lines
in the GIC*_PIDR2 register.
As GICv4 is a superset of GICv3, it should just work on Xen.
Reported-by Andre Przywara <[email protected]>Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/gic-v3.c | 4 ++-- xen/include/asm-arm/gic_v3_defs.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)xen/arch/arm/gic-v3.c +0
-0@@ -640,7 +640,7 @@ static int __init gicv3_populate_rdist(void)void __iomem *ptr = gicv3.rdist_regions[i].map_base;
Quoted 6 lines
xen/arch/arm/gic-v3.c static int __init gicv3_populate_rdist(void) · line 643
Quoted 3 lines
xen/arch/arm/gic-v3.c +1
-1reg =readl_relaxed (ptr +GICR_PIDR2 ) &GIC_PIDR2_ARCH_MASK ; -if ( reg != GIC_PIDR2_ARCH_GICv3 ) +if ( reg != GIC_PIDR2_ARCH_GICv3 && reg != GIC_PIDR2_ARCH_GICv4 )Once we have GICv5, 6, etc this is going to get unwieldy, shall we switch to a switch now?
We don't have a spec for GICv5 and v6 right now. I would wait to see if the driver can be re-used before doing a such change.
Quoted 7 lines
xen/arch/arm/gic-v3.c static int __init gicv3_populate_rdist(void) · line 646
Quoted 3 lines
xen/arch/arm/gic-v3.c +0
-0{ dprintk(XENLOG_ERR, "GICv3: No redistributor present @%"PRIpaddr"\n",I wonder if GICv3 ought to become GICv%d, on the other hand this is really the GICv3 driver driving a v4 in v3 "mode", so maybe v3 is the best logging.
We are logging the driver name and not the version. I'd like to keep like that because it's simple and easy to grep.
Regards,
Signature · 1 line
Julien Grall
Re: [PATCH 2/2] xen/arm: gic-v3: Allow Xen to run on hardware reporting GICv4
Quoted 6 lines · Julien Grall
What about:
"The GICv4 is an extension of GICv3 (see 1.1 in ARM IHI 0069A) which means that the GICv3 driver can run normally on a GICv4 hardware.
Though, the GICv4-only feature won't be used."
I've a few grammatical quibbles, plus I think s/reporting/supporting/ in the title.
So how about:
Subject: xen/arm: gic-v3: Allow Xen to run on hardware supporting GICv4
GICv4 is an extension of GICv3 (see 1.1 in ARM IHI 0069A) which means that the GICv3 driver can run normally on GICv4 hardware.
The GICv4-only features currently won't be used.
S-o-b: etc
Re: [PATCH 2/2] xen/arm: gic-v3: Allow Xen to run on hardware reporting GICv4
Quoted 13 lines · Ian Campbell
Quoted 6 lines · Julien Grall
What about:
"The GICv4 is an extension of GICv3 (see 1.1 in ARM IHI 0069A) which means that the GICv3 driver can run normally on a GICv4 hardware.
Though, the GICv4-only feature won't be used."
I've a few grammatical quibbles, plus I think s/reporting/supporting/ in the title.
So how about:
Quoted 8 lines
Subject: xen/arm: gic-v3: Allow Xen to run on hardware supporting GICv4
GICv4 is an extension of GICv3 (see 1.1 in ARM IHI 0069A) which means that the GICv3 driver can run normally on GICv4 hardware.
The GICv4-only features currently won't be used.
S-o-b: etc
I'm fine with this commit message.
Regards,
Signature · 1 line
Julien Grall
Ian Campbell
AppliedRe: [PATCH 2/2] xen/arm: gic-v3: Allow Xen to run on hardware reporting GICv4
Quoted 21 lines · Julien Grall
Quoted 20 lines · Ian Campbell
Quoted 6 lines · Julien Grall
What about:
"The GICv4 is an extension of GICv3 (see 1.1 in ARM IHI 0069A) which means that the GICv3 driver can run normally on a GICv4 hardware.
Though, the GICv4-only feature won't be used."
I've a few grammatical quibbles, plus I think s/reporting/supporting/ in
the title.So how about:
Subject: xen/arm: gic-v3: Allow Xen to run on hardware supporting GICv4
GICv4 is an extension of GICv3 (see 1.1 in ARM IHI 0069A) which means that
the GICv3 driver can run normally on GICv4 hardware.
Quoted 5 lines
Quoted 3 lines
The GICv4-only features currently won't be used.
S-o-b: etc
I'm fine with this commit message.
Applied both to staging, thanks.
Hi Ian,
I think this series is all acked. Would it be possible to merge it in unstable?
Regards,
Quoted 15 lines · Julien Grall
Hi all,
This small patch series allow Xen to run on platform reporting GICv4 in the GIC*_PIDR2.
Sincerely yours,
Julien Grall (2):
xen/arm: gic-v3: Clean-up the GIC*_PIDR2_* definitions xen/arm: gic-v3: Allow Xen to run on hardware reporting GICv4xen/arch/arm/gic-v3.c | 8 ++++---- xen/include/asm-arm/gic_v3_defs.h | 13 +++++-------- 2 files changed, 9 insertions(+), 12 deletions(-)
Signature · 1 line
Julien Grall