All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: Check for errata before evaluating cpu features
@ 2018-07-25  8:35 ` Dirk Mueller
  0 siblings, 0 replies; 10+ messages in thread
From: Dirk Mueller @ 2018-07-25  8:35 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-kernel, Catalin Marinas, Will Deacon, Alex Graf,
	Dave Martin, Dirk Mueller, Suzuki K Poulose, Marc Zyngier

Since commit d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
detection to boot-time CPUs") we rely on errata flags being already
populated during feature enumeration. The order of errata and
features was flipped as part of commit ed478b3f9e4a ("arm64:
capabilities: Group handling of features and errata workarounds").

Return to the orginal order of errata and feature evaluation to
ensure errata flags are present during feature evaluation.

Fixes: d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
detection to boot-time CPUs")
CC: Suzuki K Poulose <suzuki.poulose@arm.com>
CC: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Dirk Mueller <dmueller@suse.com>
---
 arch/arm64/kernel/cpufeature.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index f24892a40d2c..c6d80743f4ed 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -1351,9 +1351,9 @@ static void __update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
 
 static void update_cpu_capabilities(u16 scope_mask)
 {
-	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
 	__update_cpu_capabilities(arm64_errata, scope_mask,
 				  "enabling workaround for");
+	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
 }
 
 static int __enable_cpu_capability(void *arg)
@@ -1408,8 +1408,8 @@ __enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
 
 static void __init enable_cpu_capabilities(u16 scope_mask)
 {
-	__enable_cpu_capabilities(arm64_features, scope_mask);
 	__enable_cpu_capabilities(arm64_errata, scope_mask);
+	__enable_cpu_capabilities(arm64_features, scope_mask);
 }
 
 /*
-- 
2.18.0


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

* [PATCH] arm64: Check for errata before evaluating cpu features
@ 2018-07-25  8:35 ` Dirk Mueller
  0 siblings, 0 replies; 10+ messages in thread
From: Dirk Mueller @ 2018-07-25  8:35 UTC (permalink / raw)
  To: linux-arm-kernel

Since commit d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
detection to boot-time CPUs") we rely on errata flags being already
populated during feature enumeration. The order of errata and
features was flipped as part of commit ed478b3f9e4a ("arm64:
capabilities: Group handling of features and errata workarounds").

Return to the orginal order of errata and feature evaluation to
ensure errata flags are present during feature evaluation.

Fixes: d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
detection to boot-time CPUs")
CC: Suzuki K Poulose <suzuki.poulose@arm.com>
CC: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Dirk Mueller <dmueller@suse.com>
---
 arch/arm64/kernel/cpufeature.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index f24892a40d2c..c6d80743f4ed 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -1351,9 +1351,9 @@ static void __update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
 
 static void update_cpu_capabilities(u16 scope_mask)
 {
-	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
 	__update_cpu_capabilities(arm64_errata, scope_mask,
 				  "enabling workaround for");
+	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
 }
 
 static int __enable_cpu_capability(void *arg)
@@ -1408,8 +1408,8 @@ __enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
 
 static void __init enable_cpu_capabilities(u16 scope_mask)
 {
-	__enable_cpu_capabilities(arm64_features, scope_mask);
 	__enable_cpu_capabilities(arm64_errata, scope_mask);
+	__enable_cpu_capabilities(arm64_features, scope_mask);
 }
 
 /*
-- 
2.18.0

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

* Re: [PATCH] arm64: Check for errata before evaluating cpu features
  2018-07-25  8:35 ` Dirk Mueller
@ 2018-07-25  8:51   ` Suzuki K Poulose
  -1 siblings, 0 replies; 10+ messages in thread
From: Suzuki K Poulose @ 2018-07-25  8:51 UTC (permalink / raw)
  To: Dirk Mueller, linux-arm-kernel
  Cc: linux-kernel, Catalin Marinas, Will Deacon, Alex Graf,
	Dave Martin, Marc Zyngier

On 07/25/2018 09:35 AM, Dirk Mueller wrote:
> Since commit d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
> detection to boot-time CPUs") we rely on errata flags being already
> populated during feature enumeration. The order of errata and
> features was flipped as part of commit ed478b3f9e4a ("arm64:
> capabilities: Group handling of features and errata workarounds").
> 
> Return to the orginal order of errata and feature evaluation to
> ensure errata flags are present during feature evaluation.
> 
> Fixes: d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
> detection to boot-time CPUs")
> CC: Suzuki K Poulose <suzuki.poulose@arm.com>
> CC: Marc Zyngier <marc.zyngier@arm.com>
> Signed-off-by: Dirk Mueller <dmueller@suse.com>

It would be good to add "Fixes: ed478b3f9e4a" (instead), just to make
sure this gets fixed everywhere the original problem appears.

> ---
>   arch/arm64/kernel/cpufeature.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index f24892a40d2c..c6d80743f4ed 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -1351,9 +1351,9 @@ static void __update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
>   
>   static void update_cpu_capabilities(u16 scope_mask)
>   {
> -	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
>   	__update_cpu_capabilities(arm64_errata, scope_mask,
>   				  "enabling workaround for");
> +	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
>   }
>   
>   static int __enable_cpu_capability(void *arg)
> @@ -1408,8 +1408,8 @@ __enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
>   
>   static void __init enable_cpu_capabilities(u16 scope_mask)
>   {
> -	__enable_cpu_capabilities(arm64_features, scope_mask);
>   	__enable_cpu_capabilities(arm64_errata, scope_mask);
> +	__enable_cpu_capabilities(arm64_features, scope_mask);

Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>


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

* [PATCH] arm64: Check for errata before evaluating cpu features
@ 2018-07-25  8:51   ` Suzuki K Poulose
  0 siblings, 0 replies; 10+ messages in thread
From: Suzuki K Poulose @ 2018-07-25  8:51 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/25/2018 09:35 AM, Dirk Mueller wrote:
> Since commit d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
> detection to boot-time CPUs") we rely on errata flags being already
> populated during feature enumeration. The order of errata and
> features was flipped as part of commit ed478b3f9e4a ("arm64:
> capabilities: Group handling of features and errata workarounds").
> 
> Return to the orginal order of errata and feature evaluation to
> ensure errata flags are present during feature evaluation.
> 
> Fixes: d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
> detection to boot-time CPUs")
> CC: Suzuki K Poulose <suzuki.poulose@arm.com>
> CC: Marc Zyngier <marc.zyngier@arm.com>
> Signed-off-by: Dirk Mueller <dmueller@suse.com>

It would be good to add "Fixes: ed478b3f9e4a" (instead), just to make
sure this gets fixed everywhere the original problem appears.

> ---
>   arch/arm64/kernel/cpufeature.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index f24892a40d2c..c6d80743f4ed 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -1351,9 +1351,9 @@ static void __update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
>   
>   static void update_cpu_capabilities(u16 scope_mask)
>   {
> -	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
>   	__update_cpu_capabilities(arm64_errata, scope_mask,
>   				  "enabling workaround for");
> +	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
>   }
>   
>   static int __enable_cpu_capability(void *arg)
> @@ -1408,8 +1408,8 @@ __enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
>   
>   static void __init enable_cpu_capabilities(u16 scope_mask)
>   {
> -	__enable_cpu_capabilities(arm64_features, scope_mask);
>   	__enable_cpu_capabilities(arm64_errata, scope_mask);
> +	__enable_cpu_capabilities(arm64_features, scope_mask);

Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>

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

* Re: [PATCH] arm64: Check for errata before evaluating cpu features
  2018-07-25  8:51   ` Suzuki K Poulose
@ 2018-07-25  8:56     ` Dave Martin
  -1 siblings, 0 replies; 10+ messages in thread
From: Dave Martin @ 2018-07-25  8:56 UTC (permalink / raw)
  To: Suzuki K Poulose
  Cc: Dirk Mueller, linux-arm-kernel, Marc Zyngier, Catalin Marinas,
	Will Deacon, linux-kernel, Alex Graf

On Wed, Jul 25, 2018 at 09:51:53AM +0100, Suzuki K Poulose wrote:
> On 07/25/2018 09:35 AM, Dirk Mueller wrote:
> >Since commit d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
> >detection to boot-time CPUs") we rely on errata flags being already
> >populated during feature enumeration. The order of errata and
> >features was flipped as part of commit ed478b3f9e4a ("arm64:
> >capabilities: Group handling of features and errata workarounds").
> >
> >Return to the orginal order of errata and feature evaluation to
> >ensure errata flags are present during feature evaluation.
> >
> >Fixes: d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
> >detection to boot-time CPUs")
> >CC: Suzuki K Poulose <suzuki.poulose@arm.com>
> >CC: Marc Zyngier <marc.zyngier@arm.com>
> >Signed-off-by: Dirk Mueller <dmueller@suse.com>
> 
> It would be good to add "Fixes: ed478b3f9e4a" (instead), just to make
> sure this gets fixed everywhere the original problem appears.
> 
> >---
> >  arch/arm64/kernel/cpufeature.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> >index f24892a40d2c..c6d80743f4ed 100644
> >--- a/arch/arm64/kernel/cpufeature.c
> >+++ b/arch/arm64/kernel/cpufeature.c
> >@@ -1351,9 +1351,9 @@ static void __update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
> >  static void update_cpu_capabilities(u16 scope_mask)
> >  {
> >-	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
> >  	__update_cpu_capabilities(arm64_errata, scope_mask,
> >  				  "enabling workaround for");
> >+	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
> >  }
> >  static int __enable_cpu_capability(void *arg)
> >@@ -1408,8 +1408,8 @@ __enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
> >  static void __init enable_cpu_capabilities(u16 scope_mask)
> >  {
> >-	__enable_cpu_capabilities(arm64_features, scope_mask);
> >  	__enable_cpu_capabilities(arm64_errata, scope_mask);
> >+	__enable_cpu_capabilities(arm64_features, scope_mask);

I forget why these were originally reordered in ed478b3f9e4a.
Was there any real reason for it?

I also notice in that commit that after the detection pass, we set
things up (in update_cpu_capabilities(), enable_cpu_capabilities()) in
the order errata, features.  Does this matter for anything?

Cheers
---Dave

> 
> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH] arm64: Check for errata before evaluating cpu features
@ 2018-07-25  8:56     ` Dave Martin
  0 siblings, 0 replies; 10+ messages in thread
From: Dave Martin @ 2018-07-25  8:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jul 25, 2018 at 09:51:53AM +0100, Suzuki K Poulose wrote:
> On 07/25/2018 09:35 AM, Dirk Mueller wrote:
> >Since commit d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
> >detection to boot-time CPUs") we rely on errata flags being already
> >populated during feature enumeration. The order of errata and
> >features was flipped as part of commit ed478b3f9e4a ("arm64:
> >capabilities: Group handling of features and errata workarounds").
> >
> >Return to the orginal order of errata and feature evaluation to
> >ensure errata flags are present during feature evaluation.
> >
> >Fixes: d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
> >detection to boot-time CPUs")
> >CC: Suzuki K Poulose <suzuki.poulose@arm.com>
> >CC: Marc Zyngier <marc.zyngier@arm.com>
> >Signed-off-by: Dirk Mueller <dmueller@suse.com>
> 
> It would be good to add "Fixes: ed478b3f9e4a" (instead), just to make
> sure this gets fixed everywhere the original problem appears.
> 
> >---
> >  arch/arm64/kernel/cpufeature.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> >index f24892a40d2c..c6d80743f4ed 100644
> >--- a/arch/arm64/kernel/cpufeature.c
> >+++ b/arch/arm64/kernel/cpufeature.c
> >@@ -1351,9 +1351,9 @@ static void __update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
> >  static void update_cpu_capabilities(u16 scope_mask)
> >  {
> >-	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
> >  	__update_cpu_capabilities(arm64_errata, scope_mask,
> >  				  "enabling workaround for");
> >+	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
> >  }
> >  static int __enable_cpu_capability(void *arg)
> >@@ -1408,8 +1408,8 @@ __enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
> >  static void __init enable_cpu_capabilities(u16 scope_mask)
> >  {
> >-	__enable_cpu_capabilities(arm64_features, scope_mask);
> >  	__enable_cpu_capabilities(arm64_errata, scope_mask);
> >+	__enable_cpu_capabilities(arm64_features, scope_mask);

I forget why these were originally reordered in ed478b3f9e4a.
Was there any real reason for it?

I also notice in that commit that after the detection pass, we set
things up (in update_cpu_capabilities(), enable_cpu_capabilities()) in
the order errata, features.  Does this matter for anything?

Cheers
---Dave

> 
> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: Check for errata before evaluating cpu features
  2018-07-25  8:56     ` Dave Martin
@ 2018-07-25  9:28       ` Suzuki K Poulose
  -1 siblings, 0 replies; 10+ messages in thread
From: Suzuki K Poulose @ 2018-07-25  9:28 UTC (permalink / raw)
  To: Dave Martin
  Cc: Dirk Mueller, linux-arm-kernel, Marc Zyngier, Catalin Marinas,
	Will Deacon, linux-kernel, Alex Graf


Dave,

On 07/25/2018 09:56 AM, Dave Martin wrote:
> On Wed, Jul 25, 2018 at 09:51:53AM +0100, Suzuki K Poulose wrote:
>> On 07/25/2018 09:35 AM, Dirk Mueller wrote:
>>> Since commit d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
>>> detection to boot-time CPUs") we rely on errata flags being already
>>> populated during feature enumeration. The order of errata and
>>> features was flipped as part of commit ed478b3f9e4a ("arm64:
>>> capabilities: Group handling of features and errata workarounds").
>>>
>>> Return to the orginal order of errata and feature evaluation to
>>> ensure errata flags are present during feature evaluation.
>>>
>>> Fixes: d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
>>> detection to boot-time CPUs")
>>> CC: Suzuki K Poulose <suzuki.poulose@arm.com>
>>> CC: Marc Zyngier <marc.zyngier@arm.com>
>>> Signed-off-by: Dirk Mueller <dmueller@suse.com>
>>
>> It would be good to add "Fixes: ed478b3f9e4a" (instead), just to make
>> sure this gets fixed everywhere the original problem appears.
>>

> 
> I forget why these were originally reordered in ed478b3f9e4a.
> Was there any real reason for it?

No, there was no real reason for it. We have always detected the cpu
local errata first and all features were system wide. So that ensured
that the errata are detected before features. With the introduction
of cpu local features, it was a random order until we realised this
issue.

That said, this exposes a problem with the current infrastructure
where, if there are local capabilities that depend on other local
capabilities. On a heterogeneous system, there is no guarantee on the
order in which the CPUs turn up and thus detect the capabilities. In
this case, this patch wouldn't work if we were dealing with a
heterogeneous system.

The solution would be to use cpu local and system wide versions
of the same capability and use the cpu-local capabilities to
decide the system capability.

i.e, here KPTI needs two caps :

a) CPU_NEEDS_KPTI - Local CPU capability to detect the local CPU
which needs KPTRI

b) SYSTEM_NEEDS_KPTI - System wide capability, which can be turned
on iff we have CPU_NEEDS_KPTI && !CAVIUM_ERRATA.

> 
> I also notice in that commit that after the detection pass, we set
> things up (in update_cpu_capabilities(), enable_cpu_capabilities()) in
> the order errata, features.  Does this matter for anything?

None that I am aware of. But logically that sounds like a better option.


Suzuki

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

* [PATCH] arm64: Check for errata before evaluating cpu features
@ 2018-07-25  9:28       ` Suzuki K Poulose
  0 siblings, 0 replies; 10+ messages in thread
From: Suzuki K Poulose @ 2018-07-25  9:28 UTC (permalink / raw)
  To: linux-arm-kernel


Dave,

On 07/25/2018 09:56 AM, Dave Martin wrote:
> On Wed, Jul 25, 2018 at 09:51:53AM +0100, Suzuki K Poulose wrote:
>> On 07/25/2018 09:35 AM, Dirk Mueller wrote:
>>> Since commit d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
>>> detection to boot-time CPUs") we rely on errata flags being already
>>> populated during feature enumeration. The order of errata and
>>> features was flipped as part of commit ed478b3f9e4a ("arm64:
>>> capabilities: Group handling of features and errata workarounds").
>>>
>>> Return to the orginal order of errata and feature evaluation to
>>> ensure errata flags are present during feature evaluation.
>>>
>>> Fixes: d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
>>> detection to boot-time CPUs")
>>> CC: Suzuki K Poulose <suzuki.poulose@arm.com>
>>> CC: Marc Zyngier <marc.zyngier@arm.com>
>>> Signed-off-by: Dirk Mueller <dmueller@suse.com>
>>
>> It would be good to add "Fixes: ed478b3f9e4a" (instead), just to make
>> sure this gets fixed everywhere the original problem appears.
>>

> 
> I forget why these were originally reordered in ed478b3f9e4a.
> Was there any real reason for it?

No, there was no real reason for it. We have always detected the cpu
local errata first and all features were system wide. So that ensured
that the errata are detected before features. With the introduction
of cpu local features, it was a random order until we realised this
issue.

That said, this exposes a problem with the current infrastructure
where, if there are local capabilities that depend on other local
capabilities. On a heterogeneous system, there is no guarantee on the
order in which the CPUs turn up and thus detect the capabilities. In
this case, this patch wouldn't work if we were dealing with a
heterogeneous system.

The solution would be to use cpu local and system wide versions
of the same capability and use the cpu-local capabilities to
decide the system capability.

i.e, here KPTI needs two caps :

a) CPU_NEEDS_KPTI - Local CPU capability to detect the local CPU
which needs KPTRI

b) SYSTEM_NEEDS_KPTI - System wide capability, which can be turned
on iff we have CPU_NEEDS_KPTI && !CAVIUM_ERRATA.

> 
> I also notice in that commit that after the detection pass, we set
> things up (in update_cpu_capabilities(), enable_cpu_capabilities()) in
> the order errata, features.  Does this matter for anything?

None that I am aware of. But logically that sounds like a better option.


Suzuki

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

* [PATCH] arm64: Check for errata before evaluating cpu features
@ 2018-07-25 11:10 ` Dirk Mueller
  0 siblings, 0 replies; 10+ messages in thread
From: Dirk Mueller @ 2018-07-25 11:10 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-kernel, Catalin Marinas, Will Deacon, Alex Graf,
	Dave Martin, Dirk Mueller, Suzuki K Poulose, Marc Zyngier

From: Dirk Mueller <dmueller@suse.com>

Since commit d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
detection to boot-time CPUs") we rely on errata flags being already
populated during feature enumeration. The order of errata and
features was flipped as part of commit ed478b3f9e4a ("arm64:
capabilities: Group handling of features and errata workarounds").

Return to the orginal order of errata and feature evaluation to
ensure errata flags are present during feature evaluation.

Fixes: ed478b3f9e4a ("arm64: capabilities: Group handling of
    features and errata workarounds")
CC: Suzuki K Poulose <suzuki.poulose@arm.com>
CC: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Dirk Mueller <dmueller@suse.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 arch/arm64/kernel/cpufeature.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index f24892a40d2c..c6d80743f4ed 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -1351,9 +1351,9 @@ static void __update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
 
 static void update_cpu_capabilities(u16 scope_mask)
 {
-	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
 	__update_cpu_capabilities(arm64_errata, scope_mask,
 				  "enabling workaround for");
+	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
 }
 
 static int __enable_cpu_capability(void *arg)
@@ -1408,8 +1408,8 @@ __enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
 
 static void __init enable_cpu_capabilities(u16 scope_mask)
 {
-	__enable_cpu_capabilities(arm64_features, scope_mask);
 	__enable_cpu_capabilities(arm64_errata, scope_mask);
+	__enable_cpu_capabilities(arm64_features, scope_mask);
 }
 
 /*
-- 
2.18.0


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

* [PATCH] arm64: Check for errata before evaluating cpu features
@ 2018-07-25 11:10 ` Dirk Mueller
  0 siblings, 0 replies; 10+ messages in thread
From: Dirk Mueller @ 2018-07-25 11:10 UTC (permalink / raw)
  To: linux-arm-kernel

From: Dirk Mueller <dmueller@suse.com>

Since commit d3aec8a28be3b8 ("arm64: capabilities: Restrict KPTI
detection to boot-time CPUs") we rely on errata flags being already
populated during feature enumeration. The order of errata and
features was flipped as part of commit ed478b3f9e4a ("arm64:
capabilities: Group handling of features and errata workarounds").

Return to the orginal order of errata and feature evaluation to
ensure errata flags are present during feature evaluation.

Fixes: ed478b3f9e4a ("arm64: capabilities: Group handling of
    features and errata workarounds")
CC: Suzuki K Poulose <suzuki.poulose@arm.com>
CC: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Dirk Mueller <dmueller@suse.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 arch/arm64/kernel/cpufeature.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index f24892a40d2c..c6d80743f4ed 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -1351,9 +1351,9 @@ static void __update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
 
 static void update_cpu_capabilities(u16 scope_mask)
 {
-	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
 	__update_cpu_capabilities(arm64_errata, scope_mask,
 				  "enabling workaround for");
+	__update_cpu_capabilities(arm64_features, scope_mask, "detected:");
 }
 
 static int __enable_cpu_capability(void *arg)
@@ -1408,8 +1408,8 @@ __enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
 
 static void __init enable_cpu_capabilities(u16 scope_mask)
 {
-	__enable_cpu_capabilities(arm64_features, scope_mask);
 	__enable_cpu_capabilities(arm64_errata, scope_mask);
+	__enable_cpu_capabilities(arm64_features, scope_mask);
 }
 
 /*
-- 
2.18.0

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

end of thread, other threads:[~2018-07-25 11:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25  8:35 [PATCH] arm64: Check for errata before evaluating cpu features Dirk Mueller
2018-07-25  8:35 ` Dirk Mueller
2018-07-25  8:51 ` Suzuki K Poulose
2018-07-25  8:51   ` Suzuki K Poulose
2018-07-25  8:56   ` Dave Martin
2018-07-25  8:56     ` Dave Martin
2018-07-25  9:28     ` Suzuki K Poulose
2018-07-25  9:28       ` Suzuki K Poulose
2018-07-25 11:10 Dirk Mueller
2018-07-25 11:10 ` Dirk Mueller

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.