xen/arm: remove check for generic timer support for arm64
PATCH 1/1 xen/arm: remove check for generic timer support for arm64
From: Vijaya Kumar K <[email protected]>
arm64 always supports generic timer. So check is not required for arm64. For platforms which supports only aarch64 mode this check always passes and panics
--- xen/arch/arm/time.c | 2 ++ 1 file changed, 2 insertions(+)
xen/arch/arm/time.c +2 -0
@@ -138,8 +138,10 @@ int __init init_xen_time(void)panic ("Timer: Cannot initialize platform timer" );/* Check that this CPU supports the Generic Timer interface */ +#ifdef CONFIG_ARM_32 if ( !cpu_has_gentimer )panic ("CPU does not support the Generic Timer v1 interface" ); +#endif res =dt_property_read_u32 (dev,"clock-frequency" , &rate);if ( res )
Signature · 1 line
1.7.9.5
Hi Vijay,
Quoted 5 lines · On 06/02/2014 09:37 AM, [email protected] wrote:
From: Vijaya Kumar K <[email protected]>
arm64 always supports generic timer. So check is not required for arm64. For platforms which supports only aarch64 mode this check always passes and panics
You should explain why it always panics... i.e On AArch-64 only implementation, this register is RES0.
A link to the ARM ARM section might be also useful.
Quoted 10 lines
Signed-off-by Vijaya Kumar K <[email protected]>--- xen/arch/arm/time.c | 2 ++ 1 file changed, 2 insertions(+)xen/arch/arm/time.c +0
-0
xen/arch/arm/time.c int __init init_xen_time(void) · line 141
Quoted 4 lines
xen/arch/arm/time.c +1
-0@@ -138,8 +138,10 @@ int __init init_xen_time(void)panic ("Timer: Cannot initialize platform timer" );/* Check that this CPU supports the Generic Timer interface */ +#ifdef CONFIG_ARM_32
With this solution, you don't check aarch32 generic timer support on an ARMv8 host.
I think you have to do smth like:
if ( cpu_has_aarch32 && !cpu_has_gentimer )
xen/arch/arm/time.c int __init init_xen_time(void)
Quoted 6 lines
xen/arch/arm/time.c +1
-0if ( !cpu_has_gentimer )panic ("CPU does not support the Generic Timer v1 interface" ); +#endif res =dt_property_read_u32 (dev,"clock-frequency" , &rate);if ( res )
Regards,
Signature · 1 line
Julien Grall
Quoted 5 lines · On Mon, 2014-06-02 at 14:07 +0530, [email protected] wrote:
From: Vijaya Kumar K <[email protected]>
arm64 always supports generic timer. So check is not required for arm64. For platforms which supports only aarch64 mode this check always passes and panics
Ah, because the relevant feature flag/register is 32-bit only.
I'd prefer to see this done in the cpufeature header as:
#ifdef CONFIG_ARM_32
#define cpu_has_gentimer (boot_cpu_feature32(gentimer) == 1)
#else
#define cpu_has_gentimer (1)
#endifrather than adding #ifdef to the common code. Likewise for any similar "always on for aarch64" features.
Thanks,
Ian.
Quoted 21 lines
Signed-off-by Vijaya Kumar K <[email protected]>--- xen/arch/arm/time.c | 2 ++ 1 file changed, 2 insertions(+)xen/arch/arm/time.c +2
-0@@ -138,8 +138,10 @@ int __init init_xen_time(void)panic ("Timer: Cannot initialize platform timer" );/* Check that this CPU supports the Generic Timer interface */ +#ifdef CONFIG_ARM_32 if ( !cpu_has_gentimer )panic ("CPU does not support the Generic Timer v1 interface" ); +#endif res =dt_property_read_u32 (dev,"clock-frequency" , &rate);if ( res )
Quoted 9 lines · Ian Campbell
Quoted 5 lines · On Mon, 2014-06-02 at 14:07 +0530, [email protected] wrote:
From: Vijaya Kumar K <[email protected]>
arm64 always supports generic timer. So check is not required for arm64. For platforms which supports only aarch64 mode this check always passes and panics
Ah, because the relevant feature flag/register is 32-bit only.
Quoted 8 lines
I'd prefer to see this done in the cpufeature header as:
#ifdef CONFIG_ARM_32 #define cpu_has_gentimer (boot_cpu_feature32(gentimer) == 1) #else #define cpu_has_gentimer (1) #endifrather than adding #ifdef to the common code. Likewise for any similar "always on for aarch64" features.
AFAIU, the feature flag exists on ARMv8 platform with aarch32 support. So an ifdef may not be the correct solution here.
Regards,
Signature · 1 line
Julien Grall
Quoted 19 lines · Julien Grall
Quoted 9 lines · Ian Campbell
Quoted 5 lines · On Mon, 2014-06-02 at 14:07 +0530, [email protected] wrote:
From: Vijaya Kumar K <[email protected]>
arm64 always supports generic timer. So check is not required for arm64. For platforms which supports only aarch64 mode this check always passes and panics
Ah, because the relevant feature flag/register is 32-bit only.
Quoted 8 lines
I'd prefer to see this done in the cpufeature header as:
#ifdef CONFIG_ARM_32 #define cpu_has_gentimer (boot_cpu_feature32(gentimer) == 1) #else #define cpu_has_gentimer (1) #endifrather than adding #ifdef to the common code. Likewise for any similar "always on for aarch64" features.
Quoted 2 lines
AFAIU, the feature flag exists on ARMv8 platform with aarch32 support. So an ifdef may not be the correct solution here.
The flag might exist in the AArch32 feature registers (for compat with v7) but AIUI the feature is not actually optional on v8.
Unless you think it is within the ARMv8 spec for a processor to implement generic timers only when running in AArch64 mode and not expose them to AArch32 mode? I don't think that is allowed.
Ian.
Quoted 20 lines · Ian Campbell
Quoted 19 lines · Julien Grall
Quoted 17 lines · Ian Campbell
Quoted 5 lines · On Mon, 2014-06-02 at 14:07 +0530, [email protected] wrote:
From: Vijaya Kumar K <[email protected]>
arm64 always supports generic timer. So check is not required for arm64. For platforms which supports only aarch64 mode this check always passes and panics
Ah, because the relevant feature flag/register is 32-bit only.
I'd prefer to see this done in the cpufeature header as:
#ifdef CONFIG_ARM_32 #define cpu_has_gentimer (boot_cpu_feature32(gentimer) == 1) #else #define cpu_has_gentimer (1) #endifrather than adding #ifdef to the common code. Likewise for any similar "always on for aarch64" features.
Quoted 5 lines
Quoted 2 lines
AFAIU, the feature flag exists on ARMv8 platform with aarch32 support. So an ifdef may not be the correct solution here.
The flag might exist in the AArch32 feature registers (for compat with v7) but AIUI the feature is not actually optional on v8.
The manual says the ARM Generic Timer is an optional extension to an ARMv8 implementation.
Quoted 3 lines
Unless you think it is within the ARMv8 spec for a processor to implement generic timers only when running in AArch64 mode and not expose them to AArch32 mode? I don't think that is allowed.
I can't find anything in the manual about the Generic Timer is required when AArch64 is supported.
Anyway, I think it's harmless to check this bit on ARMv8 which support aarch32.
Regards,
Signature · 1 line
Julien Grall
Quoted 21 lines · Julien Grall
Quoted 20 lines · Ian Campbell
Quoted 19 lines · Julien Grall
Quoted 17 lines · Ian Campbell
Quoted 5 lines · On Mon, 2014-06-02 at 14:07 +0530, [email protected] wrote:
From: Vijaya Kumar K <[email protected]>
arm64 always supports generic timer. So check is not required for arm64. For platforms which supports only aarch64 mode this check always passes and panics
Ah, because the relevant feature flag/register is 32-bit only.
I'd prefer to see this done in the cpufeature header as:
#ifdef CONFIG_ARM_32 #define cpu_has_gentimer (boot_cpu_feature32(gentimer) == 1) #else #define cpu_has_gentimer (1) #endifrather than adding #ifdef to the common code. Likewise for any similar "always on for aarch64" features.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
AFAIU, the feature flag exists on ARMv8 platform with aarch32 support. So an ifdef may not be the correct solution here.
The flag might exist in the AArch32 feature registers (for compat with v7) but AIUI the feature is not actually optional on v8.
The manual says the ARM Generic Timer is an optional extension to an ARMv8 implementation.
So it does. In that case cpu_has_gentimer should turn into a check of ID_PFR1_EL1.GenTimer for arm64 builds.
Ian.
Quoted 25 lines · Ian Campbell
Quoted 24 lines · Julien Grall
Quoted 23 lines · Ian Campbell
Quoted 21 lines · Julien Grall
Quoted 9 lines · Ian Campbell
Quoted 5 lines · On Mon, 2014-06-02 at 14:07 +0530, [email protected] wrote:
From: Vijaya Kumar K <[email protected]>
arm64 always supports generic timer. So check is not required for arm64. For platforms which supports only aarch64 mode this check always passes and panics
Ah, because the relevant feature flag/register is 32-bit only.
Quoted 8 lines
I'd prefer to see this done in the cpufeature header as:
#ifdef CONFIG_ARM_32 #define cpu_has_gentimer (boot_cpu_feature32(gentimer) == 1) #else #define cpu_has_gentimer (1) #endifrather than adding #ifdef to the common code. Likewise for any similar "always on for aarch64" features.
AFAIU, the feature flag exists on ARMv8 platform with aarch32 support. So an ifdef may not be the correct solution here.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
The flag might exist in the AArch32 feature registers (for compat with v7) but AIUI the feature is not actually optional on v8.
The manual says the ARM Generic Timer is an optional extension to an ARMv8 implementation.
So it does. In that case
cpu_has_gentimershould turn into a check of ID_PFR1_EL1.GenTimer for arm64 builds.
This is already the case (without Vijay's patch). But on AArch64-only implementation, this register is RAZ.
It looks like ID_PFR{0,1}_EL1 are only used for ARMv7 and ARMv8 which support 32-bit.
Regards,
Signature · 1 line
Julien Grall
Quoted 32 lines · Julien Grall
Quoted 31 lines · Ian Campbell
Quoted 29 lines · Julien Grall
Quoted 20 lines · Ian Campbell
Quoted 19 lines · Julien Grall
Quoted 17 lines · Ian Campbell
Quoted 5 lines · On Mon, 2014-06-02 at 14:07 +0530, [email protected] wrote:
From: Vijaya Kumar K <[email protected]>
arm64 always supports generic timer. So check is not required for arm64. For platforms which supports only aarch64 mode this check always passes and panics
Ah, because the relevant feature flag/register is 32-bit only.
I'd prefer to see this done in the cpufeature header as:
#ifdef CONFIG_ARM_32 #define cpu_has_gentimer (boot_cpu_feature32(gentimer) == 1) #else #define cpu_has_gentimer (1) #endifrather than adding #ifdef to the common code. Likewise for any similar "always on for aarch64" features.
Quoted 5 lines
Quoted 2 lines
AFAIU, the feature flag exists on ARMv8 platform with aarch32 support. So an ifdef may not be the correct solution here.
The flag might exist in the AArch32 feature registers (for compat with v7) but AIUI the feature is not actually optional on v8.
The manual says the ARM Generic Timer is an optional extension to an ARMv8 implementation.
Quoted 8 lines
Quoted 2 lines
So it does. In that case
cpu_has_gentimershould turn into a check of ID_PFR1_EL1.GenTimer for arm64 builds.This is already the case (without Vijay's patch). But on AArch64-only implementation, this register is RAZ.
It looks like ID_PFR{0,1}_EL1 are only used for ARMv7 and ARMv8 which support 32-bit.
AFAIK, for arm64, irrespective of whether it supports aarch64 or aarch32 or both,
generic timer is required. just because arm64 supports aarch32 it is not required
to check for ID_PFR{0,1}_EL1 register
In foundation model it is working without my patch because it support aarch32 mode
and ID_PFR{0,1}_EL1 has generic timer information. However generic timer is required for aarch64 mode. Hence check is not required for platform that supports aarch32 mode
Quoted 5 lines
Regards,
--
Julien Grall
Quoted 1 line · Vijay Kilari
However generic timer is required for aarch64 mode.
Do you have an ARM ARM reference for that? If true it would indeed simplify things, but I was unable to find a statement along those lines...
Quoted 6 lines · Ian Campbell
Quoted 1 line · Vijay Kilari
However generic timer is required for aarch64 mode.
Do you have an ARM ARM reference for that? If true it would indeed simplify things, but I was unable to find a statement along those lines...
Sorry, I too didn't not get any reference for this.
But in arm64 where Aarch32 is optional, why should one rely on Aarch32 feature register
if generic timer is anyway required for Aarch64
Quoted 3 lines
Quoted 4 lines · Vijay Kilari
Quoted 3 lines · Ian Campbell
Quoted 1 line · Vijay Kilari
However generic timer is required for aarch64 mode.
Quoted 8 lines
Quoted 3 lines
Do you have an ARM ARM reference for that? If true it would indeed simplify things, but I was unable to find a statement along those lines...
Sorry, I too didn't not get any reference for this.
But in arm64 where Aarch32 is optional, why should one rely on Aarch32 feature register
if generic timer is anyway required for Aarch64
We shouldn't, the bug is that we are checking the AArch32 feature register instead of the AArch64 one in this case (see the rest of this thread).
Ian.
Quoted 9 lines · Ian Campbell
Quoted 8 lines · Vijay Kilari
Quoted 6 lines · Ian Campbell
Quoted 1 line · Vijay Kilari
However generic timer is required for aarch64 mode.
Do you have an ARM ARM reference for that? If true it would indeed simplify things, but I was unable to find a statement along those lines...
Quoted 8 lines
Quoted 4 lines
Sorry, I too didn't not get any reference for this.
But in arm64 where Aarch32 is optional, why should one rely on Aarch32 feature register
if generic timer is anyway required for Aarch64We shouldn't, the bug is that we are checking the AArch32 feature register instead of the AArch64 one in this case (see the rest of this thread).
AArch64 doesn't have a similar feature bit in AA64PFR*.
Signature · 1 line
Julien Grall
Quoted 15 lines · Julien Grall
Quoted 14 lines · Ian Campbell
Quoted 12 lines · Vijay Kilari
Quoted 6 lines · Ian Campbell
Quoted 1 line · Vijay Kilari
However generic timer is required for aarch64 mode.
Do you have an ARM ARM reference for that? If true it would indeed simplify things, but I was unable to find a statement along those lines...
Sorry, I too didn't not get any reference for this.
But in arm64 where Aarch32 is optional, why should one rely on Aarch32 feature register
if generic timer is anyway required for Aarch64
Quoted 5 lines
Quoted 3 lines
We shouldn't, the bug is that we are checking the AArch32 feature register instead of the AArch64 one in this case (see the rest of this thread).
AArch64 doesn't have a similar feature bit in AA64PFR*.
Damn, I was looking at ID_PFR (the 32-bit version) again!
If there is no AArch64 feature bit then surely this must be a non-optional extension. Just need to find the actual reference for that!
Ian.
Quoted 6 lines · Ian Campbell
Quoted 1 line · Vijay Kilari
However generic timer is required for aarch64 mode.
Do you have an ARM ARM reference for that? If true it would indeed simplify things, but I was unable to find a statement along those lines...
I'm wondering if this requirement comes from the SBSA.
Regards,
Signature · 1 line
Julien Grall
Quoted 9 lines · Julien Grall
Quoted 6 lines · Ian Campbell
Quoted 1 line · Vijay Kilari
However generic timer is required for aarch64 mode.
Do you have an ARM ARM reference for that? If true it would indeed simplify things, but I was unable to find a statement along those lines...
I'm wondering if this requirement comes from the SBSA.
It's very possible that's where I remember it from. But Xen in general does not require SBSA compliance, so we can't rely on that.
Ian.
Quoted 29 lines · Julien Grall
Quoted 28 lines · Ian Campbell
Quoted 27 lines · Julien Grall
Quoted 25 lines · Ian Campbell
Quoted 19 lines · Julien Grall
Quoted 9 lines · Ian Campbell
Quoted 5 lines · On Mon, 2014-06-02 at 14:07 +0530, [email protected] wrote:
From: Vijaya Kumar K <[email protected]>
arm64 always supports generic timer. So check is not required for arm64. For platforms which supports only aarch64 mode this check always passes and panics
Ah, because the relevant feature flag/register is 32-bit only.
Quoted 8 lines
I'd prefer to see this done in the cpufeature header as:
#ifdef CONFIG_ARM_32 #define cpu_has_gentimer (boot_cpu_feature32(gentimer) == 1) #else #define cpu_has_gentimer (1) #endifrather than adding #ifdef to the common code. Likewise for any similar "always on for aarch64" features.
Quoted 2 lines
AFAIU, the feature flag exists on ARMv8 platform with aarch32 support. So an ifdef may not be the correct solution here.
The flag might exist in the AArch32 feature registers (for compat with v7) but AIUI the feature is not actually optional on v8.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
The manual says the ARM Generic Timer is an optional extension to an ARMv8 implementation.
So it does. In that case
cpu_has_gentimershould turn into a check of ID_PFR1_EL1.GenTimer for arm64 builds.This is already the case (without Vijay's patch).
cpu_has_gentimer uses boot_cpu_feature32 and is therefore only testing for AArch32 features. It should use boot_cpu_feature64 to check for the AArch64 feature instead.
Quoted 5 lines
But on AArch64-only
implementation, this register is RAZ.It looks like ID_PFR{0,1}_EL1 are only used for ARMv7 and ARMv8 which support 32-bit.
Yes, these registers contains AArch32 features. AArch64 features are in ID_AA64PFR0_EL1 et al.
Ian.
Quoted 16 lines · On Mon, 2014-06-02 at 14:07 +0530, [email protected] wrote:
From: Vijaya Kumar K <[email protected]>
arm64 always supports generic timer. So check is not required for arm64. For platforms which supports only aarch64 mode this check always passes and panics
Signed-off-by Vijaya Kumar K <[email protected]>--- xen/arch/arm/time.c | 2 ++ 1 file changed, 2 insertions(+)xen/arch/arm/time.c +0
-0
xen/arch/arm/time.c int __init init_xen_time(void) · line 144
Quoted 7 lines
xen/arch/arm/time.c +2
-0@@ -138,8 +138,10 @@ int __init init_xen_time(void)panic ("Timer: Cannot initialize platform timer" );/* Check that this CPU supports the Generic Timer interface */ +#ifdef CONFIG_ARM_32 if ( !cpu_has_gentimer )panic ("CPU does not support the Generic Timer v1 interface" ); +#endif
Coming at this form a different angle (ignoring feature flags etc), we have by this point already been told by the device tree that a generic timer is present (we panic if we don't find a node). So this check is a bit redundant (I suppose it would catch people with an incorrect DT, but I expect we'd figure that out pretty soon even without this check).
Perhaps we should just remove this check altogether? Or the suggestion to #define it to 1 on arm64 would also work.
Ian.
Quoted 31 lines · Ian Campbell
Quoted 16 lines · On Mon, 2014-06-02 at 14:07 +0530, [email protected] wrote:
From: Vijaya Kumar K <[email protected]>
arm64 always supports generic timer. So check is not required for arm64. For platforms which supports only aarch64 mode this check always passes and panics
Signed-off-by Vijaya Kumar K <[email protected]>--- xen/arch/arm/time.c | 2 ++ 1 file changed, 2 insertions(+)xen/arch/arm/time.c +0
-0xen/arch/arm/time.c int __init init_xen_time(void) · line 144
Quoted 7 lines
xen/arch/arm/time.c +2
-0@@ -138,8 +138,10 @@ int __init init_xen_time(void)panic ("Timer: Cannot initialize platform timer" );/* Check that this CPU supports the Generic Timer interface */ +#ifdef CONFIG_ARM_32 if ( !cpu_has_gentimer )panic ("CPU does not support the Generic Timer v1 interface" ); +#endif Coming at this form a different angle (ignoring feature flags etc), we have by this point already been told by the device tree that a generic timer is present (we panic if we don't find a node). So this check is a bit redundant (I suppose it would catch people with an incorrect DT, but I expect we'd figure that out pretty soon even without this check).
Quoted 2 lines
Perhaps we should just remove this check altogether? Or the suggestion to #define it to 1 on arm64 would also work.
I though about removing this bit... but I'm not sure if ACPI will give us the necessary information for the generic timer.
Regards,
Signature · 1 line
Julien Grall
Quoted 32 lines · Julien Grall
Quoted 31 lines · Ian Campbell
Quoted 16 lines · On Mon, 2014-06-02 at 14:07 +0530, [email protected] wrote:
From: Vijaya Kumar K <[email protected]>
arm64 always supports generic timer. So check is not required for arm64. For platforms which supports only aarch64 mode this check always passes and panics
Signed-off-by Vijaya Kumar K <[email protected]>--- xen/arch/arm/time.c | 2 ++ 1 file changed, 2 insertions(+)xen/arch/arm/time.c +0
-0xen/arch/arm/time.c int __init init_xen_time(void) · line 144
Quoted 7 lines
xen/arch/arm/time.c +2
-0@@ -138,8 +138,10 @@ int __init init_xen_time(void)panic ("Timer: Cannot initialize platform timer" );/* Check that this CPU supports the Generic Timer interface */ +#ifdef CONFIG_ARM_32 if ( !cpu_has_gentimer )panic ("CPU does not support the Generic Timer v1 interface" ); +#endif Coming at this form a different angle (ignoring feature flags etc), we have by this point already been told by the device tree that a generic timer is present (we panic if we don't find a node). So this check is a bit redundant (I suppose it would catch people with an incorrect DT, but I expect we'd figure that out pretty soon even without this check).
Quoted 5 lines
Quoted 2 lines
Perhaps we should just remove this check altogether? Or the suggestion to #define it to 1 on arm64 would also work.
I though about removing this bit... but I'm not sure if ACPI will give us the necessary information for the generic timer.
It had better, since we need it to operate...