lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <SJ0PR12MB56769D95623AA45135F113A8A01FA@SJ0PR12MB5676.namprd12.prod.outlook.com>
Date: Thu, 25 Sep 2025 17:13:28 +0000
From: Besar Wicaksono <bwicaksono@...dia.com>
To: Suzuki K Poulose <suzuki.poulose@....com>, "will@...nel.org"
	<will@...nel.org>, "robin.murphy@....com" <robin.murphy@....com>,
	"ilkka@...amperecomputing.com" <ilkka@...amperecomputing.com>
CC: "linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "linux-tegra@...r.kernel.org"
	<linux-tegra@...r.kernel.org>, "mark.rutland@....com" <mark.rutland@....com>,
	Thierry Reding <treding@...dia.com>, Jon Hunter <jonathanh@...dia.com>,
	Vikram Sethi <vsethi@...dia.com>, Rich Wiley <rwiley@...dia.com>, Shanker
 Donthineni <sdonthineni@...dia.com>
Subject: RE: [PATCH v2 1/5] perf/arm_cspmu: Add arm_cspmu_acpi_dev_get



> -----Original Message-----
> From: Suzuki K Poulose <suzuki.poulose@....com>
> Sent: Thursday, September 25, 2025 3:31 AM
> To: Besar Wicaksono <bwicaksono@...dia.com>; will@...nel.org;
> robin.murphy@....com; ilkka@...amperecomputing.com
> Cc: linux-arm-kernel@...ts.infradead.org; linux-kernel@...r.kernel.org; linux-
> tegra@...r.kernel.org; mark.rutland@....com; Thierry Reding
> <treding@...dia.com>; Jon Hunter <jonathanh@...dia.com>; Vikram Sethi
> <vsethi@...dia.com>; Rich Wiley <rwiley@...dia.com>; Shanker Donthineni
> <sdonthineni@...dia.com>
> Subject: Re: [PATCH v2 1/5] perf/arm_cspmu: Add arm_cspmu_acpi_dev_get
> 
> External email: Use caution opening links or attachments
> 
> 
> On 23/09/2025 01:18, Besar Wicaksono wrote:
> > Add interface to get ACPI device associated with the
> > PMU. This ACPI device may contain additional properties
> > not covered by the standard properties.
> >
> 
> Ok, but who needs this ? I couldn't see any users in the series.
> Did I miss something ?

NVIDIA will need it to support upcoming PMU devices.
I am still preparing the follow up patch series containing the use case
on these new devices. 

> 
> > Signed-off-by: Besar Wicaksono <bwicaksono@...dia.com>
> > ---
> >   drivers/perf/arm_cspmu/arm_cspmu.c | 22 ++++++++++++++++++++++
> >   drivers/perf/arm_cspmu/arm_cspmu.h |  9 +++++++++
> >   2 files changed, 31 insertions(+)
> >
> > diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c
> b/drivers/perf/arm_cspmu/arm_cspmu.c
> > index efa9b229e701..75b2d80f783e 100644
> > --- a/drivers/perf/arm_cspmu/arm_cspmu.c
> > +++ b/drivers/perf/arm_cspmu/arm_cspmu.c
> > @@ -1090,6 +1090,28 @@ static int arm_cspmu_acpi_get_cpus(struct
> arm_cspmu *cspmu)
> >
> >       return 0;
> >   }
> > +
> > +struct acpi_device *arm_cspmu_acpi_dev_get(const struct arm_cspmu
> *cspmu)
> > +{
> > +     char hid[16];
> > +     char uid[16];
> > +     struct acpi_device *adev;
> > +     const struct acpi_apmt_node *apmt_node;
> > +
> > +     apmt_node = arm_cspmu_apmt_node(cspmu->dev);
> > +     if (!apmt_node || apmt_node->type != ACPI_APMT_NODE_TYPE_ACPI)
> > +             return NULL;
> > +
> > +     memset(hid, 0, sizeof(hid));
> > +     memset(uid, 0, sizeof(uid));
> > +
> > +     memcpy(hid, &apmt_node->inst_primary, sizeof(apmt_node-
> >inst_primary));
> > +     sprintf(uid, "%u", apmt_node->inst_secondary);
> > +
> > +     adev = acpi_dev_get_first_match_dev(hid, uid, -1);
> > +     return adev;
> > +}
> > +EXPORT_SYMBOL_GPL(arm_cspmu_acpi_dev_get);
> >   #else
> >   static int arm_cspmu_acpi_get_cpus(struct arm_cspmu *cspmu)
> >   {
> > diff --git a/drivers/perf/arm_cspmu/arm_cspmu.h
> b/drivers/perf/arm_cspmu/arm_cspmu.h
> > index 19684b76bd96..9c5f11f98acd 100644
> > --- a/drivers/perf/arm_cspmu/arm_cspmu.h
> > +++ b/drivers/perf/arm_cspmu/arm_cspmu.h
> > @@ -8,6 +8,7 @@
> >   #ifndef __ARM_CSPMU_H__
> >   #define __ARM_CSPMU_H__
> >
> > +#include <linux/acpi.h>
> >   #include <linux/bitfield.h>
> >   #include <linux/cpumask.h>
> >   #include <linux/device.h>
> > @@ -222,4 +223,12 @@ int arm_cspmu_impl_register(const struct
> arm_cspmu_impl_match *impl_match);
> >   /* Unregister vendor backend. */
> >   void arm_cspmu_impl_unregister(const struct arm_cspmu_impl_match
> *impl_match);
> >
> > +#if defined(CONFIG_ACPI)
> > +/**
> > + * Get ACPI device associated with the PMU.
> > + * The caller is responsible for calling acpi_dev_put() on the returned device.
> > + */
> > +struct acpi_device *arm_cspmu_acpi_dev_get(const struct arm_cspmu
> *cspmu);
> > +#endif
> If we need this, why not add an empty stub for !CONFIG_ACPI case ?
> Similar to what we do for other cases.

Right, this is an oversight. I thought the ACPI code is not portable. But just found
out linux/acpi.h takes care of it. I will fix it on next version.

Thanks,
Besar

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ