[PATCH 0/8] perf: arm: Make PMUv3 driver available for aarch32

Zaid Al-Bassam posted 8 patches 2 years, 7 months ago
There is a newer version of this series
arch/arm/Kconfig                              |   1 +
arch/arm/include/asm/arm_pmuv3.h              | 238 +++++++++++++++
arch/arm/mm/Kconfig                           |   2 +-
arch/arm64/include/asm/arm_pmuv3.h            | 210 +++++++++++++
arch/arm64/include/asm/perf_event.h           | 249 ----------------
arch/arm64/kernel/Makefile                    |   1 -
drivers/perf/Kconfig                          |  10 +
drivers/perf/Makefile                         |   1 +
.../perf_event.c => drivers/perf/arm_pmuv3.c  | 139 +++------
include/kvm/arm_pmu.h                         |   2 +-
include/linux/perf/arm_pmuv3.h                | 276 ++++++++++++++++++
11 files changed, 773 insertions(+), 356 deletions(-)
create mode 100644 arch/arm/include/asm/arm_pmuv3.h
create mode 100644 arch/arm64/include/asm/arm_pmuv3.h
rename arch/arm64/kernel/perf_event.c => drivers/perf/arm_pmuv3.c (92%)
create mode 100644 include/linux/perf/arm_pmuv3.h
[PATCH 0/8] perf: arm: Make PMUv3 driver available for aarch32
Posted by Zaid Al-Bassam 2 years, 7 months ago
Currently, PMUv3 driver is only available for ARMv8 aarch64
platforms, ARMv8 running in aarch32 mode dont have access to
the driver. This is, especially, a problem for ARMv8 platforms
that only have aarch32 support, like the Cortex-A32.

Make the PMUv3 driver available to arm arch (ARMv8 aarch32) by
moving the PMUv3 driver from arm64 to drivers, that makes the
driver common to both arm and arm64 architectures, then add
PMUv3 arm Support.

The main work in this patchset was made a while back by Marc
Zyngier on a private branch. This patchset rebases Marc's
patches to the latest kernel revision and adds additional
patches to accommodate the changes in the kernel since Marc
wrote the patches.

Marc Zyngier (5):
  arm64: perf: Move PMUv3 driver to drivers/perf
  arm64: perf: Abstract system register accesses away
  ARM: Make CONFIG_CPU_V7 valid for 32bit ARMv8 implementations
  ARM: perf: Allow the use of the PMUv3 driver on 32bit ARM
  ARM: mach-virt: Select PMUv3 driver by default

Zaid Al-Bassam (3):
  perf: pmuv3: Add common defines for the PMU version
  perf: pmuv3: Add wrappers for KVM accesses
  perf: pmuv3: Change GENMASK to GENMASK_ULL

 arch/arm/Kconfig                              |   1 +
 arch/arm/include/asm/arm_pmuv3.h              | 238 +++++++++++++++
 arch/arm/mm/Kconfig                           |   2 +-
 arch/arm64/include/asm/arm_pmuv3.h            | 210 +++++++++++++
 arch/arm64/include/asm/perf_event.h           | 249 ----------------
 arch/arm64/kernel/Makefile                    |   1 -
 drivers/perf/Kconfig                          |  10 +
 drivers/perf/Makefile                         |   1 +
 .../perf_event.c => drivers/perf/arm_pmuv3.c  | 139 +++------
 include/kvm/arm_pmu.h                         |   2 +-
 include/linux/perf/arm_pmuv3.h                | 276 ++++++++++++++++++
 11 files changed, 773 insertions(+), 356 deletions(-)
 create mode 100644 arch/arm/include/asm/arm_pmuv3.h
 create mode 100644 arch/arm64/include/asm/arm_pmuv3.h
 rename arch/arm64/kernel/perf_event.c => drivers/perf/arm_pmuv3.c (92%)
 create mode 100644 include/linux/perf/arm_pmuv3.h

-- 
2.39.0.246.g2a6d74b583-goog
Re: [PATCH 0/8] perf: arm: Make PMUv3 driver available for aarch32
Posted by Marc Zyngier 2 years, 7 months ago
On Thu, 26 Jan 2023 20:44:36 +0000,
Zaid Al-Bassam <zalbassam@google.com> wrote:
> 
> Currently, PMUv3 driver is only available for ARMv8 aarch64
> platforms, ARMv8 running in aarch32 mode dont have access to
> the driver. This is, especially, a problem for ARMv8 platforms
> that only have aarch32 support, like the Cortex-A32.

FWIW, I've pushed out my own interpretation of this series to [1],
including the changes I suggested. The results seems to correctly work
in a 32bit guest on a 64bit host, which is what I (used to) care
about.

Feel free to pick it up.

	M.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=arm/pmuv3

-- 
Without deviation from the norm, progress is not possible.
Re: [PATCH 0/8] perf: arm: Make PMUv3 driver available for aarch32
Posted by Zaid Al-Bassam 2 years, 7 months ago
Thank you Marc for reviewing the change and fixing the issues, I have
picked up your patches and sent out v2. Tested on Cortex-A32.

Best Regards,
Zaid Al-Bassam


On Wed, Feb 8, 2023 at 11:40 AM Marc Zyngier <maz@kernel.org> wrote:
>
> On Thu, 26 Jan 2023 20:44:36 +0000,
> Zaid Al-Bassam <zalbassam@google.com> wrote:
> >
> > Currently, PMUv3 driver is only available for ARMv8 aarch64
> > platforms, ARMv8 running in aarch32 mode dont have access to
> > the driver. This is, especially, a problem for ARMv8 platforms
> > that only have aarch32 support, like the Cortex-A32.
>
> FWIW, I've pushed out my own interpretation of this series to [1],
> including the changes I suggested. The results seems to correctly work
> in a 32bit guest on a 64bit host, which is what I (used to) care
> about.
>
> Feel free to pick it up.
>
>         M.
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=arm/pmuv3
>
> --
> Without deviation from the norm, progress is not possible.
Re: [PATCH 0/8] perf: arm: Make PMUv3 driver available for aarch32
Posted by Florian Fainelli 2 years, 7 months ago
On 2/8/23 08:40, Marc Zyngier wrote:
> On Thu, 26 Jan 2023 20:44:36 +0000,
> Zaid Al-Bassam <zalbassam@google.com> wrote:
>>
>> Currently, PMUv3 driver is only available for ARMv8 aarch64
>> platforms, ARMv8 running in aarch32 mode dont have access to
>> the driver. This is, especially, a problem for ARMv8 platforms
>> that only have aarch32 support, like the Cortex-A32.
> 
> FWIW, I've pushed out my own interpretation of this series to [1],
> including the changes I suggested. The results seems to correctly work
> in a 32bit guest on a 64bit host, which is what I (used to) care
> about.
> 
> Feel free to pick it up.

Tested-by: Florian Fainelli <f.fainelli@gmail.com>

Thanks!
-- 
Florian