linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V6 0/2] coresight: trbe: Enable ACPI based devices
@ 2023-08-29 13:54 Anshuman Khandual
  2023-08-29 13:54 ` [PATCH V6 1/2] coresight: trbe: Add a representative coresight_platform_data for TRBE Anshuman Khandual
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Anshuman Khandual @ 2023-08-29 13:54 UTC (permalink / raw)
  To: linux-arm-kernel, suzuki.poulose
  Cc: Anshuman Khandual, Sami Mujawar, Catalin Marinas, Will Deacon,
	Mark Rutland, Mike Leach, Leo Yan, Alexander Shishkin,
	James Clark, coresight, linux-kernel

These are remaining coresight patches after fixing the merge conflict which
applies on coresight/next coresight-next-v6.6.

Changes in V6:

- Fixed te merge conflict

Changes in V5:

https://lore.kernel.org/all/20230817055405.249630-1-anshuman.khandual@arm.com/

- Detected zeroed parsed GSI as a mismatch but handled all zero scenario
- Changed condition check from 'if (ret < 0)' into a 'if (ret)'
- Dropped pr_warn() message after platform_device_register()

Changes in V4:

https://lore.kernel.org/all/20230808082247.383405-1-anshuman.khandual@arm.com/

- Added in-code comment for arm_trbe_device_probe()
- Reverted back using IS_ENABLED() for SPE PMU platform device
- Replaced #ifdef with IS_ENABLED() for TRBE platform device
- Protected arm_trbe_acpi_match with ACPI_PTR() - preventing a build failure
  when CONFIG_ACPI is not enabled
- Added __maybe_unused for arm_acpi_register_pmu_device() and dropped config
  checks with IS_ENABLED()

Changes in V3:

https://lore.kernel.org/all/20230803055652.1322801-1-anshuman.khandual@arm.com/

- Changed ARMV8_TRBE_PDEV_NAME from "arm-trbe-acpi" into "arm,trbe"
- Dropped local variable 'matched'
- Replaced 'matched' with 'valid gsi' as being already matched once
- Moved find_acpi_cpu_topology_hetero_id() outside conditional check

Changes in V2:

https://lore.kernel.org/all/20230801094052.750416-1-anshuman.khandual@arm.com/

- Refactored arm_spe_acpi_register_device() in a separate patch
- Renamed trbe_acpi_resources as trbe_resources
- Renamed trbe_acpi_dev as trbe_dev

Changes in V1:

https://lore.kernel.org/all/20230728112733.359620-1-anshuman.khandual@arm.com/

Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: James Clark <james.clark@arm.com>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org

Anshuman Khandual (2):
  coresight: trbe: Add a representative coresight_platform_data for TRBE
  coresight: trbe: Enable ACPI based TRBE devices

 drivers/hwtracing/coresight/coresight-trbe.c | 23 ++++++++++++++++++--
 drivers/hwtracing/coresight/coresight-trbe.h |  2 ++
 2 files changed, 23 insertions(+), 2 deletions(-)

-- 
2.25.1


_______________________________________________
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] 5+ messages in thread

* [PATCH V6 1/2] coresight: trbe: Add a representative coresight_platform_data for TRBE
  2023-08-29 13:54 [PATCH V6 0/2] coresight: trbe: Enable ACPI based devices Anshuman Khandual
@ 2023-08-29 13:54 ` Anshuman Khandual
  2023-08-29 13:54 ` [PATCH V6 2/2] coresight: trbe: Enable ACPI based TRBE devices Anshuman Khandual
  2023-08-30  9:02 ` [PATCH V6 0/2] coresight: trbe: Enable ACPI based devices Suzuki K Poulose
  2 siblings, 0 replies; 5+ messages in thread
From: Anshuman Khandual @ 2023-08-29 13:54 UTC (permalink / raw)
  To: linux-arm-kernel, suzuki.poulose
  Cc: Anshuman Khandual, Sami Mujawar, Catalin Marinas, Will Deacon,
	Mark Rutland, Mike Leach, Leo Yan, Alexander Shishkin,
	James Clark, coresight, linux-kernel

TRBE coresight devices do not need regular connections information, as the
paths get built between all percpu source and their respective percpu sink
devices. Please refer 'commit 2cd87a7b293d ("coresight: core: Add support
for dedicated percpu sinks")' which added support for percpu sink devices.

coresight_register() expect device connections via the platform_data. TRBE
devices do not have any graph connections and thus is empty. With upcoming
ACPI support for TRBE, we do not get a real acpi_device and thus
coresight_get_platform_dat() will end up in failures. Hence this allocates
a zeroed coresight_platform_data structure and assigns that back into the
device.

Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 drivers/hwtracing/coresight/coresight-trbe.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
index e20c1c6acc73..97b9e72965e6 100644
--- a/drivers/hwtracing/coresight/coresight-trbe.c
+++ b/drivers/hwtracing/coresight/coresight-trbe.c
@@ -1253,8 +1253,18 @@ static void arm_trbe_register_coresight_cpu(struct trbe_drvdata *drvdata, int cp
 	desc.name = devm_kasprintf(dev, GFP_KERNEL, "trbe%d", cpu);
 	if (!desc.name)
 		goto cpu_clear;
-
-	desc.pdata = coresight_get_platform_data(dev);
+	/*
+	 * TRBE coresight devices do not need regular connections
+	 * information, as the paths get built between all percpu
+	 * source and their respective percpu sink devices. Though
+	 * coresight_register() expect device connections via the
+	 * platform_data, which TRBE devices do not have. As they
+	 * are not real ACPI devices, coresight_get_platform_data()
+	 * ends up failing. Instead let's allocate a dummy zeroed
+	 * coresight_platform_data structure and assign that back
+	 * into the device for that purpose.
+	 */
+	desc.pdata = devm_kzalloc(dev, sizeof(*desc.pdata), GFP_KERNEL);
 	if (IS_ERR(desc.pdata))
 		goto cpu_clear;
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH V6 2/2] coresight: trbe: Enable ACPI based TRBE devices
  2023-08-29 13:54 [PATCH V6 0/2] coresight: trbe: Enable ACPI based devices Anshuman Khandual
  2023-08-29 13:54 ` [PATCH V6 1/2] coresight: trbe: Add a representative coresight_platform_data for TRBE Anshuman Khandual
@ 2023-08-29 13:54 ` Anshuman Khandual
  2023-08-30  9:02 ` [PATCH V6 0/2] coresight: trbe: Enable ACPI based devices Suzuki K Poulose
  2 siblings, 0 replies; 5+ messages in thread
From: Anshuman Khandual @ 2023-08-29 13:54 UTC (permalink / raw)
  To: linux-arm-kernel, suzuki.poulose
  Cc: Anshuman Khandual, Sami Mujawar, Catalin Marinas, Will Deacon,
	Mark Rutland, Mike Leach, Leo Yan, Alexander Shishkin,
	James Clark, coresight, linux-kernel

This detects and enables ACPI based TRBE devices via the dummy platform
device created earlier for this purpose.

Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 drivers/hwtracing/coresight/coresight-trbe.c | 9 +++++++++
 drivers/hwtracing/coresight/coresight-trbe.h | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
index 97b9e72965e6..a3954be7b1f3 100644
--- a/drivers/hwtracing/coresight/coresight-trbe.c
+++ b/drivers/hwtracing/coresight/coresight-trbe.c
@@ -1546,7 +1546,16 @@ static const struct of_device_id arm_trbe_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, arm_trbe_of_match);
 
+#ifdef CONFIG_ACPI
+static const struct platform_device_id arm_trbe_acpi_match[] = {
+	{ ARMV8_TRBE_PDEV_NAME, 0 },
+	{ }
+};
+MODULE_DEVICE_TABLE(platform, arm_trbe_acpi_match);
+#endif
+
 static struct platform_driver arm_trbe_driver = {
+	.id_table = ACPI_PTR(arm_trbe_acpi_match),
 	.driver	= {
 		.name = DRVNAME,
 		.of_match_table = of_match_ptr(arm_trbe_of_match),
diff --git a/drivers/hwtracing/coresight/coresight-trbe.h b/drivers/hwtracing/coresight/coresight-trbe.h
index e915e749be55..45202c48acce 100644
--- a/drivers/hwtracing/coresight/coresight-trbe.h
+++ b/drivers/hwtracing/coresight/coresight-trbe.h
@@ -7,11 +7,13 @@
  *
  * Author: Anshuman Khandual <anshuman.khandual@arm.com>
  */
+#include <linux/acpi.h>
 #include <linux/coresight.h>
 #include <linux/device.h>
 #include <linux/irq.h>
 #include <linux/kernel.h>
 #include <linux/of.h>
+#include <linux/perf/arm_pmu.h>
 #include <linux/platform_device.h>
 #include <linux/smp.h>
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH V6 0/2] coresight: trbe: Enable ACPI based devices
  2023-08-29 13:54 [PATCH V6 0/2] coresight: trbe: Enable ACPI based devices Anshuman Khandual
  2023-08-29 13:54 ` [PATCH V6 1/2] coresight: trbe: Add a representative coresight_platform_data for TRBE Anshuman Khandual
  2023-08-29 13:54 ` [PATCH V6 2/2] coresight: trbe: Enable ACPI based TRBE devices Anshuman Khandual
@ 2023-08-30  9:02 ` Suzuki K Poulose
  2023-08-30 11:42   ` Anshuman Khandual
  2 siblings, 1 reply; 5+ messages in thread
From: Suzuki K Poulose @ 2023-08-30  9:02 UTC (permalink / raw)
  To: Anshuman Khandual, linux-arm-kernel, Will Deacon
  Cc: Sami Mujawar, Catalin Marinas, Will Deacon, Mark Rutland,
	Mike Leach, Leo Yan, Alexander Shishkin, James Clark, coresight,
	linux-kernel

Hi Will

On 29/08/2023 14:54, Anshuman Khandual wrote:
> These are remaining coresight patches after fixing the merge conflict which
> applies on coresight/next coresight-next-v6.6.
> 
> Changes in V6:
> 
> - Fixed te merge conflict
> 


Please could you confirm if the commits [0] in your for-next/perf branch
are stable ? Accordingly I could merge these patches on top of your
commits and send them to Greg.

[0] https://git.kernel.org/will/c/1aa3d0274a4a

Suzuki


> Changes in V5:
> 
> https://lore.kernel.org/all/20230817055405.249630-1-anshuman.khandual@arm.com/
> 
> - Detected zeroed parsed GSI as a mismatch but handled all zero scenario
> - Changed condition check from 'if (ret < 0)' into a 'if (ret)'
> - Dropped pr_warn() message after platform_device_register()
> 
> Changes in V4:
> 
> https://lore.kernel.org/all/20230808082247.383405-1-anshuman.khandual@arm.com/
> 
> - Added in-code comment for arm_trbe_device_probe()
> - Reverted back using IS_ENABLED() for SPE PMU platform device
> - Replaced #ifdef with IS_ENABLED() for TRBE platform device
> - Protected arm_trbe_acpi_match with ACPI_PTR() - preventing a build failure
>    when CONFIG_ACPI is not enabled
> - Added __maybe_unused for arm_acpi_register_pmu_device() and dropped config
>    checks with IS_ENABLED()
> 
> Changes in V3:
> 
> https://lore.kernel.org/all/20230803055652.1322801-1-anshuman.khandual@arm.com/
> 
> - Changed ARMV8_TRBE_PDEV_NAME from "arm-trbe-acpi" into "arm,trbe"
> - Dropped local variable 'matched'
> - Replaced 'matched' with 'valid gsi' as being already matched once
> - Moved find_acpi_cpu_topology_hetero_id() outside conditional check
> 
> Changes in V2:
> 
> https://lore.kernel.org/all/20230801094052.750416-1-anshuman.khandual@arm.com/
> 
> - Refactored arm_spe_acpi_register_device() in a separate patch
> - Renamed trbe_acpi_resources as trbe_resources
> - Renamed trbe_acpi_dev as trbe_dev
> 
> Changes in V1:
> 
> https://lore.kernel.org/all/20230728112733.359620-1-anshuman.khandual@arm.com/
> 
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> Cc: Mike Leach <mike.leach@linaro.org>
> Cc: Leo Yan <leo.yan@linaro.org>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: James Clark <james.clark@arm.com>
> Cc: coresight@lists.linaro.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> 
> Anshuman Khandual (2):
>    coresight: trbe: Add a representative coresight_platform_data for TRBE
>    coresight: trbe: Enable ACPI based TRBE devices
> 
>   drivers/hwtracing/coresight/coresight-trbe.c | 23 ++++++++++++++++++--
>   drivers/hwtracing/coresight/coresight-trbe.h |  2 ++
>   2 files changed, 23 insertions(+), 2 deletions(-)
> 


_______________________________________________
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] 5+ messages in thread

* Re: [PATCH V6 0/2] coresight: trbe: Enable ACPI based devices
  2023-08-30  9:02 ` [PATCH V6 0/2] coresight: trbe: Enable ACPI based devices Suzuki K Poulose
@ 2023-08-30 11:42   ` Anshuman Khandual
  0 siblings, 0 replies; 5+ messages in thread
From: Anshuman Khandual @ 2023-08-30 11:42 UTC (permalink / raw)
  To: Suzuki K Poulose, linux-arm-kernel, Will Deacon
  Cc: Sami Mujawar, Catalin Marinas, Mark Rutland, Mike Leach,
	Alexander Shishkin, coresight, linux-kernel

On 8/30/23 14:32, Suzuki K Poulose wrote:
> Hi Will
> 
> On 29/08/2023 14:54, Anshuman Khandual wrote:
>> These are remaining coresight patches after fixing the merge conflict which
>> applies on coresight/next coresight-next-v6.6.
>>
>> Changes in V6:
>>
>> - Fixed te merge conflict
>>
> 
> 
> Please could you confirm if the commits [0] in your for-next/perf branch
> are stable ? Accordingly I could merge these patches on top of your
> commits and send them to Greg.
> 
> [0] https://git.kernel.org/will/c/1aa3d0274a4a

Both these patches are already in the mainline kernel.

commit 1aa3d0274a4aac338ee45a3dfc3b17c944bcc2bc
Author: Anshuman Khandual <anshuman.khandual@arm.com>
Date:   Thu Aug 17 11:24:03 2023 +0530

    arm_pmu: acpi: Add a representative platform device for TRBE
    
    ACPI TRBE does not have a HID for identification which could create and add
    a platform device into the platform bus. Also without a platform device, it
    cannot be probed and bound to a platform driver.
    
    This creates a dummy platform device for TRBE after ascertaining that ACPI
    provides required interrupts uniformly across all cpus on the system. This
    device gets created inside drivers/perf/arm_pmu_acpi.c to accommodate TRBE
    being built as a module.
    
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Link: https://lore.kernel.org/r/20230817055405.249630-3-anshuman.khandual@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>

commit 81e5ee471609848ee1ebf3beb2a46788113fe0eb
Author: Anshuman Khandual <anshuman.khandual@arm.com>
Date:   Thu Aug 17 11:24:02 2023 +0530

    arm_pmu: acpi: Refactor arm_spe_acpi_register_device()
    
    Sanity checking all the GICC tables for same interrupt number, and ensuring
    a homogeneous ACPI based machine, could be used for other platform devices
    as well. Hence this refactors arm_spe_acpi_register_device() into a common
    helper arm_acpi_register_pmu_device().
    
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-kernel@vger.kernel.org
    Co-developed-by: Will Deacon <will@kernel.org>
    Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Link: https://lore.kernel.org/r/20230817055405.249630-2-anshuman.khandual@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>

_______________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2023-08-30 11:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-29 13:54 [PATCH V6 0/2] coresight: trbe: Enable ACPI based devices Anshuman Khandual
2023-08-29 13:54 ` [PATCH V6 1/2] coresight: trbe: Add a representative coresight_platform_data for TRBE Anshuman Khandual
2023-08-29 13:54 ` [PATCH V6 2/2] coresight: trbe: Enable ACPI based TRBE devices Anshuman Khandual
2023-08-30  9:02 ` [PATCH V6 0/2] coresight: trbe: Enable ACPI based devices Suzuki K Poulose
2023-08-30 11:42   ` Anshuman Khandual

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).