Skip to content

arm: ARMv8.1- and v8.4-PMU, ID reg cleanup, [H]ACTLR2

Peter Maydell qemu-arm qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest21 patches 8 repliesIn review
  2. v113 patches 23 repliesSuperseded

Changes in v2 from the cover letter

* now rebased on master, so patch 1 fixes up an extra new use of isar_feature_jazelle
* patch 2 is new: take_aarch32_exception should check aa32_pan, not aa64_pan
* minor fixups per review comments (mostly using 64-bit versions of extract/deposit where appropriate)
* added code to get values of ID registers from KVM
* when I added that code I ran into a bunch of problems which stemmed from our using the 32-bit DBGDIDR as the source of truth about numbers of breakpoints etc, which then breaks if the host KVM CPU is AArch64-only, so some patches clean that up
* patch 18 fixes a cut-n-paste error I noticed where we were reading entirely the wrong register in aa32_pan and aa32_ats1e1
* patch 19 adds an isar_feature test to replace an opencoded examination of an ID register field
* patch 20 uses FIELD_EX32 for 32-bit ID registers rather than FIELD_EX64
* patch 21 implements ACTLR2 and HACTLR2

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/21target/arm: Add _aa32_ to isar_feature functions testing 32-bit ID registerslinux-user/elfload.c target/arm/cpu.c target/arm/cpu.h +3 more+21 -120 replies
2/21target/arm: Check aa32_pan in take_aarch32_exception(), not aa64_pantarget/arm/helper.c+1 -11 reply
3/21target/arm: Add isar_feature_any_fp16 and document naming/usage conventionstarget/arm/cpu.h target/arm/vfp_helper.c+19 -20 replies
4/21target/arm: Define and use any_predinv isar_feature testtarget/arm/cpu.h target/arm/helper.c+6 -80 replies
5/21target/arm: Factor out PMU register definitionstarget/arm/helper.c+82 -760 replies
6/21target/arm: Add and use FIELD definitions for ID_AA64DFR0_EL1target/arm/cpu.c target/arm/cpu.h target/arm/helper.c+14 -40 replies
7/21target/arm: Use FIELD macros for clearing ID_DFR0 PERFMON fieldtarget/arm/cpu.c+1 -10 replies
8/21target/arm: Define an aa32_pmu_8_1 isar feature test functionhw/intc/armv7m_nvic.c target/arm/cpu.c target/arm/cpu.h +2 more+28 -220 replies
9/21target/arm: Add _aa64_ and _any_ versions of pmu_8_1 isar checkstarget/arm/cpu.c target/arm/cpu.h target/arm/cpu64.c +1 more+25 -110 replies
10/21target/arm: Stop assuming DBGDIDR always existstarget/arm/cpu.h target/arm/debug_helper.c target/arm/helper.c +1 more+57 -191 reply
11/21target/arm: Move DBGDIDR into ARMISARegisterstarget/arm/cpu.c target/arm/cpu.h target/arm/cpu64.c +2 more+12 -121 reply
12/21target/arm: Read debug-related ID registers from KVMtarget/arm/cpu.h target/arm/kvm32.c target/arm/kvm64.c+49 -01 reply
13/21target/arm: Implement ARMv8.1-PMU extensiontarget/arm/helper.c+30 -20 replies
14/21target/arm: Implement ARMv8.4-PMU extensiontarget/arm/cpu.h target/arm/helper.c+39 -10 replies
15/21target/arm: Provide ARMv8.4-PMU in '-cpu max'target/arm/cpu64.c+8 -00 replies
16/21target/arm: Correct definition of PMCRDPtarget/arm/helper.c+2 -10 replies
17/21target/arm: Correct handling of PMCR_EL0.LC bittarget/arm/helper.c+9 -40 replies
18/21target/arm: Test correct register in aa32_pan and aa32_ats1e1 checkshw/intc/armv7m_nvic.c target/arm/cpu.c target/arm/cpu.h +4 more+110 -831 reply
19/21target/arm: Use isar_feature function for testing AA32HPD featuretarget/arm/cpu.h target/arm/helper.c+7 -21 reply
20/21target/arm: Use FIELD_EX32 for testing 32-bit fieldstarget/arm/cpu.h+9 -91 reply
21/21target/arm: Correctly implement ACTLR2, HACTLR2target/arm/cpu.c target/arm/cpu.h target/arm/cpu64.c +1 more+33 -91 reply

Reviews trailers per patch

All 21 patches have a Reviewed-by or Acked-by.

PatchPhilippe Mathieu-DaudéRichard Henderson
1/21R-b R-b
2/21R-b
3/21R-b R-b
4/21R-b R-b
5/21R-b R-b
6/21R-b R-b
7/21R-b R-b
8/21R-b
9/21R-b R-b
10/21R-b
11/21R-b
12/21R-b
13/21R-b
14/21R-b
15/21R-b
16/21R-b R-b
17/21R-b R-b
18/21R-b
19/21R-b
20/21R-b
21/21R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/21] arm: ARMv8.1- and v8.4-PMU, ID reg cleanup, [H]ACTLR2

This patchset implements the ARMv8.1-PMU and ARMv8.4-PMU architecture extensions. These are fairly small changes on top of the basic PMUv3 we already implement, and in fact we already had most of the v8.1-PMU functionality implemented but unadvertised.

In the course of doing this, I found that our naming and use of isar_feature ID register test functions was slightly inconsistent, so the first few patches straighten this out and align on an _aa32_/_aa64_/_any_ convention for which ID registers to test.

The ARMv8.1-PMU extension requires:
* the evtCount field in PMETYPER<n>_EL0 is 16 bits, not 10
* MDCR_EL2.HPMD allows event counting to be disabled at EL2
* two new required events, STALL_FRONTEND and STALL_BACKEND
* ID register bits in ID_AA64DFR0_EL1 and ID_DFR0
We already implement all of that except the new events; for QEMU our CPU never "stalls" in that sense, so we can just implement them as always-reads-zero.

The ARMv8.4-PMU extension adds:
* one new required event, STALL (again, reads-as-zero)
* one new system register PMMIR_EL1, which provides information about the PMU implementation. Since the only currently defined field in it relates to an event we don't provide, we can validly implement the register as RAZ.

Two patches fix some bugs I discovered while running this through Eric's recent kvm-unit-tests PMU tests:
* we had the wrong definition of the PMCR.DP bit position
* we incorrectly implemented PMCR.LC as RAZ/WI

I also fix some random minor bugs I noticed while cleaning up the ID register handling.

Finally there's an implementation of ACTLR2 and HACTLR2 sysregs; these are pretty trivial but required from Armv8.2 onward. This is strictly speaking unrelated to perf, but the patch depends on all the preceding cleanup stuff.

I don't generally use the perf emulation, so testing would be welcome from people who do.

Changes v1->v2:
* now rebased on master, so patch 1 fixes up an extra new use of isar_feature_jazelle
* patch 2 is new: take_aarch32_exception should check aa32_pan, not aa64_pan
* minor fixups per review comments (mostly using 64-bit versions of extract/deposit where appropriate)
* added code to get values of ID registers from KVM
* when I added that code I ran into a bunch of problems which stemmed from our using the 32-bit DBGDIDR as the source of truth about numbers of breakpoints etc, which then breaks if the host KVM CPU is AArch64-only, so some patches clean that up
* patch 18 fixes a cut-n-paste error I noticed where we were reading entirely the wrong register in aa32_pan and aa32_ats1e1
* patch 19 adds an isar_feature test to replace an opencoded examination of an ID register field
* patch 20 uses FIELD_EX32 for 32-bit ID registers rather than FIELD_EX64
* patch 21 implements ACTLR2 and HACTLR2

Patches 1, 3-9, and 13-17 have already been reviewed; 2, 10-12, and 18-21 are new in v2.

thanks
-- PMM

Peter Maydell (21):
target/arm: Add _aa32_ to isar_feature functions testing 32-bit ID
registers
target/arm: Check aa32_pan in take_aarch32_exception(), not aa64_pan target/arm: Add isar_feature_any_fp16 and document naming/usage
conventions
target/arm: Define and use any_predinv isar_feature test target/arm: Factor out PMU register definitions target/arm: Add and use FIELD definitions for ID_AA64DFR0_EL1 target/arm: Use FIELD macros for clearing ID_DFR0 PERFMON field target/arm: Define an aa32_pmu_8_1 isar feature test function target/arm: Add _aa64_ and _any_ versions of pmu_8_1 isar checks target/arm: Stop assuming DBGDIDR always exists target/arm: Move DBGDIDR into ARMISARegisters
target/arm: Read debug-related ID registers from KVM target/arm: Implement ARMv8.1-PMU extension
target/arm: Implement ARMv8.4-PMU extension
target/arm: Provide ARMv8.4-PMU in '-cpu max'
target/arm: Correct definition of PMCRDP
target/arm: Correct handling of PMCR_EL0.LC bit target/arm: Test correct register in aa32_pan and aa32_ats1e1 checks target/arm: Use isar_feature function for testing AA32HPD feature target/arm: Use FIELD_EX32 for testing 32-bit fields target/arm: Correctly implement ACTLR2, HACTLR2

 target/arm/cpu.h          | 143 +++++++++++++++---
 target/arm/internals.h    |  44 +++++-
 hw/intc/armv7m_nvic.c     |  10 +-
 linux-user/elfload.c      |   4 +-
 target/arm/cpu.c          | 150 +++++++++---------
 target/arm/cpu64.c        |  58 ++++---
 target/arm/debug_helper.c |   6 +-
 target/arm/helper.c       | 311 ++++++++++++++++++++++----------------
 target/arm/kvm32.c        |  25 +++
 target/arm/kvm64.c        |  46 ++++++
 target/arm/translate.c    |   6 +-
 target/arm/vfp_helper.c   |   2 +-
 12 files changed, 544 insertions(+), 261 deletions(-)
Signature · 1 line
2.20.1