* [PATCH v5] perf: arm_dsu: Support DSU ACPI devices
@ 2020-09-09 23:29 Tuan Phan
2020-09-10 13:40 ` kernel test robot
0 siblings, 1 reply; 5+ messages in thread
From: Tuan Phan @ 2020-09-09 23:29 UTC (permalink / raw)
Cc: Mark Rutland, suzuki.poulose, linux-kernel, patches, Will Deacon,
linux-arm-kernel
Add support for probing device from ACPI node.
Each DSU ACPI node and its associated cpus are inside a cluster node.
Signed-off-by: Tuan Phan <tuanphan@os.amperecomputing.com>
---
Changes in v5:
- Used CONFIG_ACPI to fix compiling issue.
Changes in v4:
- Addressed Will's comments.
Changes in v3:
- Based on the latest ARM ACPI binding at: https://developer.arm.com/documentation/den0093/c/
Changes in v2:
- Removed IRQF_SHARED.
- Fixed ACPI runtime detection.
drivers/perf/arm_dsu_pmu.c | 61 +++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 55 insertions(+), 6 deletions(-)
diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c
index 96ed93c..68d2891 100644
--- a/drivers/perf/arm_dsu_pmu.c
+++ b/drivers/perf/arm_dsu_pmu.c
@@ -11,6 +11,7 @@
#define DRVNAME PMUNAME "_pmu"
#define pr_fmt(fmt) DRVNAME ": " fmt
+#include <linux/acpi.h>
#include <linux/bitmap.h>
#include <linux/bitops.h>
#include <linux/bug.h>
@@ -603,18 +604,19 @@ static struct dsu_pmu *dsu_pmu_alloc(struct platform_device *pdev)
}
/**
- * dsu_pmu_dt_get_cpus: Get the list of CPUs in the cluster.
+ * dsu_pmu_dt_get_cpus: Get the list of CPUs in the cluster
+ * from device tree.
*/
-static int dsu_pmu_dt_get_cpus(struct device_node *dev, cpumask_t *mask)
+static int dsu_pmu_dt_get_cpus(struct device *dev, cpumask_t *mask)
{
int i = 0, n, cpu;
struct device_node *cpu_node;
- n = of_count_phandle_with_args(dev, "cpus", NULL);
+ n = of_count_phandle_with_args(dev->of_node, "cpus", NULL);
if (n <= 0)
return -ENODEV;
for (; i < n; i++) {
- cpu_node = of_parse_phandle(dev, "cpus", i);
+ cpu_node = of_parse_phandle(dev->of_node, "cpus", i);
if (!cpu_node)
break;
cpu = of_cpu_node_to_id(cpu_node);
@@ -631,6 +633,36 @@ static int dsu_pmu_dt_get_cpus(struct device_node *dev, cpumask_t *mask)
return 0;
}
+/**
+ * dsu_pmu_acpi_get_cpus: Get the list of CPUs in the cluster
+ * from ACPI.
+ */
+static int dsu_pmu_acpi_get_cpus(struct device *dev, cpumask_t *mask)
+{
+#ifdef CONFIG_ACPI
+ int cpu;
+
+ /*
+ * A dsu pmu node is inside a cluster parent node along with cpu nodes.
+ * We need to find out all cpus that have the same parent with this pmu.
+ */
+ for_each_possible_cpu(cpu) {
+ struct acpi_device *acpi_dev;
+ struct device *cpu_dev = get_cpu_device(cpu);
+
+ if (!cpu_dev)
+ continue;
+
+ acpi_dev = ACPI_COMPANION(cpu_dev);
+ if (acpi_dev &&
+ acpi_dev->parent == ACPI_COMPANION(dev)->parent)
+ cpumask_set_cpu(cpu, mask);
+ }
+#endif
+
+ return 0;
+}
+
/*
* dsu_pmu_probe_pmu: Probe the PMU details on a CPU in the cluster.
*/
@@ -676,6 +708,7 @@ static int dsu_pmu_device_probe(struct platform_device *pdev)
{
int irq, rc;
struct dsu_pmu *dsu_pmu;
+ struct fwnode_handle *fwnode = dev_fwnode(&pdev->dev);
char *name;
static atomic_t pmu_idx = ATOMIC_INIT(-1);
@@ -683,7 +716,16 @@ static int dsu_pmu_device_probe(struct platform_device *pdev)
if (IS_ERR(dsu_pmu))
return PTR_ERR(dsu_pmu);
- rc = dsu_pmu_dt_get_cpus(pdev->dev.of_node, &dsu_pmu->associated_cpus);
+ if (IS_ERR_OR_NULL(fwnode))
+ return -ENOENT;
+
+ if (is_of_node(fwnode))
+ rc = dsu_pmu_dt_get_cpus(&pdev->dev, &dsu_pmu->associated_cpus);
+ else if (is_acpi_device_node(fwnode))
+ rc = dsu_pmu_acpi_get_cpus(&pdev->dev, &dsu_pmu->associated_cpus);
+ else
+ return -ENOENT;
+
if (rc) {
dev_warn(&pdev->dev, "Failed to parse the CPUs\n");
return rc;
@@ -752,11 +794,19 @@ static const struct of_device_id dsu_pmu_of_match[] = {
{ .compatible = "arm,dsu-pmu", },
{},
};
+MODULE_DEVICE_TABLE(of, dsu_pmu_of_match);
+
+static const struct acpi_device_id dsu_pmu_acpi_match[] = {
+ { "ARMHD500", 0},
+ {},
+};
+MODULE_DEVICE_TABLE(acpi, dsu_pmu_acpi_match);
static struct platform_driver dsu_pmu_driver = {
.driver = {
.name = DRVNAME,
.of_match_table = of_match_ptr(dsu_pmu_of_match),
+ .acpi_match_table = ACPI_PTR(dsu_pmu_acpi_match),
.suppress_bind_attrs = true,
},
.probe = dsu_pmu_device_probe,
@@ -826,7 +876,6 @@ static void __exit dsu_pmu_exit(void)
module_init(dsu_pmu_init);
module_exit(dsu_pmu_exit);
-MODULE_DEVICE_TABLE(of, dsu_pmu_of_match);
MODULE_DESCRIPTION("Perf driver for ARM DynamIQ Shared Unit");
MODULE_AUTHOR("Suzuki K Poulose <suzuki.poulose@arm.com>");
MODULE_LICENSE("GPL v2");
--
2.7.4
_______________________________________________
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 v5] perf: arm_dsu: Support DSU ACPI devices
2020-09-09 23:29 [PATCH v5] perf: arm_dsu: Support DSU ACPI devices Tuan Phan
@ 2020-09-10 13:40 ` kernel test robot
2020-09-10 19:07 ` Tuan Phan
0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2020-09-10 13:40 UTC (permalink / raw)
To: Tuan Phan
Cc: Mark Rutland, kbuild-all, suzuki.poulose, linux-kernel,
clang-built-linux, patches, Will Deacon, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 2212 bytes --]
Hi Tuan,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.9-rc4 next-20200910]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Tuan-Phan/perf-arm_dsu-Support-DSU-ACPI-devices/20200910-105630
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ab29a807a7ddaa7c84d2f4cb8d29e74e33759072
config: arm64-randconfig-r012-20200909 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 0a5dc7effb191eff740e0e7ae7bd8e1f6bdb3ad9)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/perf/arm_dsu_pmu.c:799:36: warning: unused variable 'dsu_pmu_acpi_match' [-Wunused-const-variable]
static const struct acpi_device_id dsu_pmu_acpi_match[] = {
^
1 warning generated.
# https://github.com/0day-ci/linux/commit/40c3a0c70d4472e2fe1f5364d50939b863874fa1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tuan-Phan/perf-arm_dsu-Support-DSU-ACPI-devices/20200910-105630
git checkout 40c3a0c70d4472e2fe1f5364d50939b863874fa1
vim +/dsu_pmu_acpi_match +799 drivers/perf/arm_dsu_pmu.c
798
> 799 static const struct acpi_device_id dsu_pmu_acpi_match[] = {
800 { "ARMHD500", 0},
801 {},
802 };
803 MODULE_DEVICE_TABLE(acpi, dsu_pmu_acpi_match);
804
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 42410 bytes --]
[-- Attachment #3: Type: text/plain, Size: 176 bytes --]
_______________________________________________
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 v5] perf: arm_dsu: Support DSU ACPI devices
2020-09-10 13:40 ` kernel test robot
@ 2020-09-10 19:07 ` Tuan Phan
2020-09-11 6:33 ` Suzuki K Poulose
0 siblings, 1 reply; 5+ messages in thread
From: Tuan Phan @ 2020-09-10 19:07 UTC (permalink / raw)
Cc: Mark Rutland, Will Deacon, linux-kernel, linux-arm-kernel,
Suzuki K Poulose
Hi Will,
> On Sep 10, 2020, at 6:40 AM, kernel test robot <lkp@intel.com> wrote:
>
> Hi Tuan,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on linus/master]
> [also build test WARNING on v5.9-rc4 next-20200910]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url: https://github.com/0day-ci/linux/commits/Tuan-Phan/perf-arm_dsu-Support-DSU-ACPI-devices/20200910-105630
> base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ab29a807a7ddaa7c84d2f4cb8d29e74e33759072
> config: arm64-randconfig-r012-20200909 (attached as .config)
> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 0a5dc7effb191eff740e0e7ae7bd8e1f6bdb3ad9)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # install arm64 cross compiling tool for clang build
> # apt-get install binutils-aarch64-linux-gnu
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
>>> drivers/perf/arm_dsu_pmu.c:799:36: warning: unused variable 'dsu_pmu_acpi_match' [-Wunused-const-variable]
> static const struct acpi_device_id dsu_pmu_acpi_match[] = {
> ^
> 1 warning generated.
>
Do you need me to fix this warning when CONFIG_ACPI not defined?
Tuan
> # https://github.com/0day-ci/linux/commit/40c3a0c70d4472e2fe1f5364d50939b863874fa1
> git remote add linux-review https://github.com/0day-ci/linux
> git fetch --no-tags linux-review Tuan-Phan/perf-arm_dsu-Support-DSU-ACPI-devices/20200910-105630
> git checkout 40c3a0c70d4472e2fe1f5364d50939b863874fa1
> vim +/dsu_pmu_acpi_match +799 drivers/perf/arm_dsu_pmu.c
>
> 798
>> 799 static const struct acpi_device_id dsu_pmu_acpi_match[] = {
> 800 { "ARMHD500", 0},
> 801 {},
> 802 };
> 803 MODULE_DEVICE_TABLE(acpi, dsu_pmu_acpi_match);
> 804
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> <.config.gz>
_______________________________________________
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 v5] perf: arm_dsu: Support DSU ACPI devices
2020-09-10 19:07 ` Tuan Phan
@ 2020-09-11 6:33 ` Suzuki K Poulose
[not found] ` <05A48968-34CD-41DA-9699-0FC051D8553B@amperemail.onmicrosoft.com>
0 siblings, 1 reply; 5+ messages in thread
From: Suzuki K Poulose @ 2020-09-11 6:33 UTC (permalink / raw)
To: tuanphan; +Cc: mark.rutland, will, linux-kernel, linux-arm-kernel
On 09/10/2020 08:07 PM, Tuan Phan wrote:
> Hi Will,
>
>> On Sep 10, 2020, at 6:40 AM, kernel test robot <lkp@intel.com> wrote:
>>
>> Hi Tuan,
>>
>> Thank you for the patch! Perhaps something to improve:
>>
>> [auto build test WARNING on linus/master]
>> [also build test WARNING on v5.9-rc4 next-20200910]
>> [If your patch is applied to the wrong git tree, kindly drop us a note.
>> And when submitting patch, we suggest to use '--base' as documented in
>> https://git-scm.com/docs/git-format-patch]
>>
>> url: https://github.com/0day-ci/linux/commits/Tuan-Phan/perf-arm_dsu-Support-DSU-ACPI-devices/20200910-105630
>> base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ab29a807a7ddaa7c84d2f4cb8d29e74e33759072
>> config: arm64-randconfig-r012-20200909 (attached as .config)
>> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 0a5dc7effb191eff740e0e7ae7bd8e1f6bdb3ad9)
>> reproduce (this is a W=1 build):
>> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>> chmod +x ~/bin/make.cross
>> # install arm64 cross compiling tool for clang build
>> # apt-get install binutils-aarch64-linux-gnu
>> # save the attached .config to linux build tree
>> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>> All warnings (new ones prefixed by >>):
>>
>>>> drivers/perf/arm_dsu_pmu.c:799:36: warning: unused variable 'dsu_pmu_acpi_match' [-Wunused-const-variable]
>> static const struct acpi_device_id dsu_pmu_acpi_match[] = {
>> ^
>> 1 warning generated.
>>
>
> Do you need me to fix this warning when CONFIG_ACPI not defined?
Yes, please. The kernel should compile fine in any config. Any compiler
warning is not good (unless the compiler is wrong).
Cheers
Suzuki
_______________________________________________
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 v5] perf: arm_dsu: Support DSU ACPI devices
[not found] ` <05A48968-34CD-41DA-9699-0FC051D8553B@amperemail.onmicrosoft.com>
@ 2020-09-15 8:21 ` Suzuki K Poulose
0 siblings, 0 replies; 5+ messages in thread
From: Suzuki K Poulose @ 2020-09-15 8:21 UTC (permalink / raw)
To: tuanphan; +Cc: mark.rutland, will, linux-kernel, linux-arm-kernel
Hi Tuan
On 09/14/2020 05:21 PM, Tuan Phan wrote:
>>>> Reported-by: kernel test robot <lkp@intel.com <mailto:lkp@intel.com>>
>>>>
>>>> All warnings (new ones prefixed by >>):
>>>>
>>>>>> drivers/perf/arm_dsu_pmu.c:799:36: warning: unused variable
>>>>>> 'dsu_pmu_acpi_match' [-Wunused-const-variable]
>>>> static const struct acpi_device_id dsu_pmu_acpi_match[] = {
>>>> ^
>>>> 1 warning generated.
>>>>
>>> Do you need me to fix this warning when CONFIG_ACPI not defined?
>>
>> Yes, please. The kernel should compile fine in any config. Any compiler
>> warning is not good (unless the compiler is wrong).
>
> I will fix it. I asked because with no CONFIG_ACPI, i saw the same
> message on other drivers.
Please could you share the logs here, we could fix them too. Or patches
welcome.
Cheers
Suzuki
_______________________________________________
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:[~2020-09-15 8:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 23:29 [PATCH v5] perf: arm_dsu: Support DSU ACPI devices Tuan Phan
2020-09-10 13:40 ` kernel test robot
2020-09-10 19:07 ` Tuan Phan
2020-09-11 6:33 ` Suzuki K Poulose
[not found] ` <05A48968-34CD-41DA-9699-0FC051D8553B@amperemail.onmicrosoft.com>
2020-09-15 8:21 ` Suzuki K Poulose
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).