diff mbox series

[04/11] arm64: cpufeature: Pass capability structure to ->enable callback

Message ID 1515078515-13723-5-git-send-email-will.deacon@arm.com
State Superseded
Headers show
Series arm64 kpti hardening and variant 2 workarounds | expand

Commit Message

Will Deacon Jan. 4, 2018, 3:08 p.m. UTC
In order to invoke the CPU capability ->matches callback from the ->enable
callback for applying local-CPU workarounds, we need a handle on the
capability structure.

This patch passes a pointer to the capability structure to the ->enable
callback.

Signed-off-by: Will Deacon <will.deacon@arm.com>

---
 arch/arm64/kernel/cpufeature.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.1.4

Comments

Suzuki K Poulose Jan. 5, 2018, 10:29 a.m. UTC | #1
On 04/01/18 15:08, Will Deacon wrote:
> In order to invoke the CPU capability ->matches callback from the ->enable

> callback for applying local-CPU workarounds, we need a handle on the

> capability structure.

> 

> This patch passes a pointer to the capability structure to the ->enable

> callback.

> 

> Signed-off-by: Will Deacon <will.deacon@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 e11c11bb5b02..6133c14b9b01 100644

> --- a/arch/arm64/kernel/cpufeature.c

> +++ b/arch/arm64/kernel/cpufeature.c

> @@ -1151,7 +1151,7 @@ void __init enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps)

>   			 * uses an IPI, giving us a PSTATE that disappears when

>   			 * we return.

>   			 */

> -			stop_machine(caps->enable, NULL, cpu_online_mask);

> +			stop_machine(caps->enable, (void *)caps, cpu_online_mask);

>   		}

>   	}

>   }

> @@ -1194,7 +1194,7 @@ verify_local_cpu_features(const struct arm64_cpu_capabilities *caps)

>   			cpu_die_early();

>   		}

>   		if (caps->enable)

> -			caps->enable(NULL);

> +			caps->enable((void *)caps);

>   	}

>   }

>   

> 


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

Patch

diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index e11c11bb5b02..6133c14b9b01 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -1151,7 +1151,7 @@  void __init enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps)
 			 * uses an IPI, giving us a PSTATE that disappears when
 			 * we return.
 			 */
-			stop_machine(caps->enable, NULL, cpu_online_mask);
+			stop_machine(caps->enable, (void *)caps, cpu_online_mask);
 		}
 	}
 }
@@ -1194,7 +1194,7 @@  verify_local_cpu_features(const struct arm64_cpu_capabilities *caps)
 			cpu_die_early();
 		}
 		if (caps->enable)
-			caps->enable(NULL);
+			caps->enable((void *)caps);
 	}
 }