diff mbox series

[v2] coresight: trbe: Move check for kernel page table isolation from EL0 to probe

Message ID 20220203190159.3145272-1-sudeep.holla@arm.com (mailing list archive)
State New, archived
Headers show
Series [v2] coresight: trbe: Move check for kernel page table isolation from EL0 to probe | expand

Commit Message

Sudeep Holla Feb. 3, 2022, 7:01 p.m. UTC
Currently with the check present in the module initialisation, it shouts
on all the systems irrespective of presence of coresight trace buffer
extensions.

Similar to Arm SPE perf driver, move the check for kernel page table
isolation from  EL0 to the device probe stage instead of the module
initialisation so that it complains only on the systems that support TRBE.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: coresight@lists.linaro.org
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/hwtracing/coresight/coresight-trbe.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

v1[1]->v2:
	- Added comment about trace capture being not possible with kernel
	  page table isolation
[1] https://lore.kernel.org/r/20220201122212.3009461-1-sudeep.holla@arm.com

Comments

Anshuman Khandual Feb. 4, 2022, 2:50 a.m. UTC | #1
On 2/4/22 12:31 AM, Sudeep Holla wrote:
> Currently with the check present in the module initialisation, it shouts
> on all the systems irrespective of presence of coresight trace buffer
> extensions.
> 
> Similar to Arm SPE perf driver, move the check for kernel page table
> isolation from  EL0 to the device probe stage instead of the module
> initialisation so that it complains only on the systems that support TRBE.
> 
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> Cc: Mike Leach <mike.leach@linaro.org>
> Cc: Leo Yan <leo.yan@linaro.org>
> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
> Cc: coresight@lists.linaro.org
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-trbe.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> v1[1]->v2:
> 	- Added comment about trace capture being not possible with kernel
> 	  page table isolation
> [1] https://lore.kernel.org/r/20220201122212.3009461-1-sudeep.holla@arm.com
> 
> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
> index 276862c07e32..3e37a63cb7d2 100644
> --- a/drivers/hwtracing/coresight/coresight-trbe.c
> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
> @@ -1423,6 +1423,12 @@ static int arm_trbe_device_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	int ret;
>  
> +	/* Trace capture is not possible with kernel page table isolation */
> +	if (arm64_kernel_unmapped_at_el0()) {
> +		pr_err("TRBE wouldn't work if kernel gets unmapped at EL0\n");
> +		return -EOPNOTSUPP;
> +	}
> +
>  	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
>  	if (!drvdata)
>  		return -ENOMEM;
> @@ -1484,11 +1490,6 @@ static int __init arm_trbe_init(void)
>  {
>  	int ret;
>  
> -	if (arm64_kernel_unmapped_at_el0()) {
> -		pr_err("TRBE wouldn't work if kernel gets unmapped at EL0\n");
> -		return -EOPNOTSUPP;
> -	}
> -
>  	ret = platform_driver_register(&arm_trbe_driver);
>  	if (!ret)
>  		return 0;
> 

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Suzuki K Poulose Feb. 4, 2022, 12:02 p.m. UTC | #2
On 03/02/2022 19:01, Sudeep Holla wrote:
> Currently with the check present in the module initialisation, it shouts
> on all the systems irrespective of presence of coresight trace buffer
> extensions.
> 
> Similar to Arm SPE perf driver, move the check for kernel page table
> isolation from  EL0 to the device probe stage instead of the module
> initialisation so that it complains only on the systems that support TRBE.
> 
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> Cc: Mike Leach <mike.leach@linaro.org>
> Cc: Leo Yan <leo.yan@linaro.org>
> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
> Cc: coresight@lists.linaro.org
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

Thanks, I have now queued this.

https://git.kernel.org/coresight/c/ebbce265bba164c4f0d5271c277a540bd3b2fd3c

Kind regards
Suzuki
diff mbox series

Patch

diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
index 276862c07e32..3e37a63cb7d2 100644
--- a/drivers/hwtracing/coresight/coresight-trbe.c
+++ b/drivers/hwtracing/coresight/coresight-trbe.c
@@ -1423,6 +1423,12 @@  static int arm_trbe_device_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	int ret;
 
+	/* Trace capture is not possible with kernel page table isolation */
+	if (arm64_kernel_unmapped_at_el0()) {
+		pr_err("TRBE wouldn't work if kernel gets unmapped at EL0\n");
+		return -EOPNOTSUPP;
+	}
+
 	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
 	if (!drvdata)
 		return -ENOMEM;
@@ -1484,11 +1490,6 @@  static int __init arm_trbe_init(void)
 {
 	int ret;
 
-	if (arm64_kernel_unmapped_at_el0()) {
-		pr_err("TRBE wouldn't work if kernel gets unmapped at EL0\n");
-		return -EOPNOTSUPP;
-	}
-
 	ret = platform_driver_register(&arm_trbe_driver);
 	if (!ret)
 		return 0;