arm-trusted-firmware/fdts
Boyan Karatotev 83ec7e452c perf(amu): greatly simplify AMU context management
The current code is incredibly resilient to updates to the spec and
has worked quite well so far. However, recent implementations expose a
weakness in that this is rather slow. A large part of it is written in
assembly, making it opaque to the compiler for optimisations. The
future proofness requires reading registers that are effectively
`volatile`, making it even harder for the compiler, as well as adding
lots of implicit barriers, making it hard for the microarchitecutre to
optimise as well.

We can make a few assumptions, checked by a few well placed asserts, and
remove a lot of this burden. For a start, at the moment there are 4
group 0 counters with static assignments. Contexting them is a trivial
affair that doesn't need a loop. Similarly, there can only be up to 16
group 1 counters. Contexting them is a bit harder, but we can do with a
single branch with a falling through switch. If/when both of these
change, we have a pair of asserts and the feature detection mechanism to
guard us against pretending that we support something we don't.

We can drop contexting of the offset registers. They are fully
accessible by EL2 and as such are its responsibility to preserve on
powerdown.

Another small thing we can do, is pass the core_pos into the hook.
The caller already knows which core we're running on, we don't need to
call this non-trivial function again.

Finally, knowing this, we don't really need the auxiliary AMUs to be
described by the device tree. Linux doesn't care at the moment, and any
information we need for EL3 can be neatly placed in a simple array.

All of this, combined with lifting the actual saving out of assembly,
reduces the instructions to save the context from 180 to 40, including a
lot fewer branches. The code is also much shorter and easier to read.

Also propagate to aarch32 so that the two don't diverge too much.

Change-Id: Ib62e6e9ba5be7fb9fb8965c8eee148d5598a5361
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
2025-02-25 08:50:46 +00:00
..
a5ds.dts fdts: a5ds: Fix for the system timer issue. 2020-04-17 21:12:15 +01:00
arm_fpga.dts Merge "fix(arm_fpga): Change PL011 UART IRQ" into integration 2021-11-08 16:52:43 +01:00
cca_cot_descriptors.dtsi refactor(fvp): align the NV counter naming 2024-08-07 08:46:30 +01:00
corstone700.dtsi corstone700: splitting the platform support into FVP and FPGA 2020-07-06 16:55:43 +01:00
corstone700_fpga.dts fdts: corstone700: add NXP isp1763 node to device tree 2020-09-07 13:13:04 +01:00
corstone700_fvp.dts corstone700: splitting the platform support into FVP and FPGA 2020-07-06 16:55:43 +01:00
dualroot_cot_descriptors.dtsi refactor(fvp): align the NV counter naming 2024-08-07 08:46:30 +01:00
fvp-base-gicv2-psci.dts refactor(fvp): fdts: consolidate GICv2 base FVP DT files 2022-10-11 16:11:44 +01:00
fvp-base-gicv2.dtsi refactor(fvp): fdts: consolidate GICv2 base FVP DT files 2022-10-11 16:11:44 +01:00
fvp-base-gicv3-psci-1t.dts refactor(fvp): fdts: consolidate GICv3 base FVP DT files 2022-10-11 16:11:39 +01:00
fvp-base-gicv3-psci-dynamiq-2t.dts refactor(fvp): fdts: consolidate GICv3 base FVP DT files 2022-10-11 16:11:39 +01:00
fvp-base-gicv3-psci-dynamiq-common.dtsi FVP: Add support for passing platform's topology to DTS 2020-05-19 13:16:22 +00:00
fvp-base-gicv3-psci-dynamiq.dts refactor(fvp): fdts: consolidate GICv3 base FVP DT files 2022-10-11 16:11:39 +01:00
fvp-base-gicv3-psci.dts refactor(fvp): fdts: consolidate GICv3 base FVP DT files 2022-10-11 16:11:39 +01:00
fvp-base-gicv3.dtsi refactor(fvp): fdts: consolidate GICv3 base FVP DT files 2022-10-11 16:11:39 +01:00
fvp-base-psci-common.dtsi feat(fvp): change size of PCIe memory region 2 2025-02-11 15:10:49 +00:00
fvp-defs-dynamiq.dtsi FVP: Add support for passing platform's topology to DTS 2020-05-19 13:16:22 +00:00
fvp-defs.dtsi feat(fvp): dts: drop 32-bit .dts files 2022-10-11 16:09:35 +01:00
fvp-foundation-gicv2-psci.dts feat(fvp): fdts: add stdout-path to the Foundation FVPs 2024-05-31 11:06:08 +02:00
fvp-foundation-gicv3-psci.dts feat(fvp): fdts: add stdout-path to the Foundation FVPs 2024-05-31 11:06:08 +02:00
fvp-foundation-motherboard.dtsi Remove dtc warnings 2018-04-24 08:30:01 +01:00
fvp-ve-Cortex-A5x1.dts fix(fvp_ve): fdts: Fix vexpress,config-bus subnode names 2022-10-11 16:11:45 +01:00
fvp-ve-Cortex-A7x1.dts feat(fvp): fdts: update rtsm_ve DT files from the Linux kernel 2022-10-11 16:11:44 +01:00
juno-ethosn.dtsi feat(ethos-n): add multiple asset allocators 2023-04-04 11:35:36 +02:00
juno.dts refactor(ethos-n): move build flags to ethosn_npu.mk 2023-08-07 19:13:45 +02:00
morello-coresight.dtsi feat(morello): fdts: add CoreSight DeviceTree bindings 2023-07-04 14:42:59 +01:00
morello-fvp.dts feat(morello): add cpuidle support 2023-09-05 11:44:19 +05:30
morello-soc.dts feat(morello): add cpuidle support 2023-09-05 11:44:19 +05:30
morello.dtsi feat(morello): add support for I2S audio 2023-07-27 15:20:14 +05:30
n1sdp-multi-chip.dts fix(n1sdp): add numa node id for pcie controllers 2022-09-01 15:23:42 +05:30
n1sdp-single-chip.dts fdts: Fix stdout-path in various platforms 2021-01-27 18:05:36 +00:00
n1sdp.dtsi fdts: n1sdp: DTS file for single-chip and multi-chip environment. 2020-07-30 18:44:54 +05:30
rd1ae.dts Merge "fix(rd1ae): fix rd1-ae device tree" into integration 2024-12-09 12:12:01 +01:00
rdv3-defs.dtsi feat(rdv3): add dts files to enable hafnium as BL32 2025-02-05 10:58:38 +00:00
rtsm_ve-motherboard.dtsi feat(fvp): add support for virto-net, virtio-9p and virtio-rng 2023-12-01 15:08:09 +01:00
stm32mp1-cot-descriptors.dtsi refactor(st): align the NV counter naming 2024-08-07 08:46:30 +01:00
stm32mp13-bl2.dtsi feat(st): update STM32MP DT files 2023-10-19 09:45:43 +02:00
stm32mp13-ddr.dtsi feat(stm32mp1-fdts): add DDR support for STM32MP13 2022-03-22 09:09:23 +01:00
stm32mp13-ddr3-1x4Gb-1066-binF.dtsi feat(stm32mp1-fdts): add DDR support for STM32MP13 2022-03-22 09:09:23 +01:00
stm32mp13-fw-config.dtsi feat(stm32mp13-fdts): use STM32MP_DDR_S_SIZE in fw-config 2022-08-17 17:25:45 +02:00
stm32mp13-pinctrl.dtsi feat(st): update STM32MP DT files 2023-10-19 09:45:43 +02:00
stm32mp13xa.dtsi feat(stm32mp1-fdts): add DT files for STM32MP13 2022-03-22 09:09:23 +01:00
stm32mp13xc.dtsi fix(stm32mp13-fdts): cleanup DT files 2022-08-17 17:24:30 +02:00
stm32mp13xd.dtsi feat(stm32mp1-fdts): add DT files for STM32MP13 2022-03-22 09:09:23 +01:00
stm32mp13xf.dtsi fix(stm32mp13-fdts): cleanup DT files 2022-08-17 17:24:30 +02:00
stm32mp15-bl2.dtsi feat(st): update STM32MP DT files 2023-10-19 09:45:43 +02:00
stm32mp15-bl32.dtsi feat(st): update STM32MP DT files 2023-10-19 09:45:43 +02:00
stm32mp15-ddr.dtsi refactor(stm32mp1): remove the support of calibration result 2022-01-05 11:09:59 +01:00
stm32mp15-ddr3-1x2Gb-1066-binG.dtsi feat(stm32mp15-fdts): add support for prtt1x board family 2023-03-06 14:06:49 +01:00
stm32mp15-ddr3-1x4Gb-1066-binG.dtsi refactor(stm32mp1): remove the support of calibration result 2022-01-05 11:09:59 +01:00
stm32mp15-ddr3-2x4Gb-1066-binG.dtsi refactor(stm32mp1): remove the support of calibration result 2022-01-05 11:09:59 +01:00
stm32mp15-ddr3-dhsom-2x4Gb-1066-binG.dtsi refactor(stm32mp1-fdts): drop unused DDR calibration result on DHCOM 2022-07-08 15:26:41 +02:00
stm32mp15-fw-config.dtsi feat(stm32mp15): remove OP-TEE shared mem 2024-05-23 17:44:16 +02:00
stm32mp15-pinctrl.dtsi feat(st): update STM32MP DT files 2023-10-19 09:45:43 +02:00
stm32mp15xc.dtsi fdts: stm32mp1: realign device tree with kernel 2020-09-24 09:07:57 +02:00
stm32mp15xx-dhcom-pdk2.dtsi feat(stm32mp15-fdts): add support for STM32MP157C based DHCOM SoM on PDK2 board 2022-07-08 13:52:40 +02:00
stm32mp15xx-dhcom-som.dtsi fix(stm32mp15-fdts): correct MCO2_PLL4 clock name for DHCOM 2024-11-20 09:37:15 +01:00
stm32mp15xx-dhcor-avenger96.dtsi feat(stm32mp15-fdts): add Avenger96 board with STM32MP157A DHCOR SoM 2022-08-25 22:11:33 +02:00
stm32mp15xx-dhcor-io1v8.dtsi feat(stm32mp15-fdts): add Avenger96 board with STM32MP157A DHCOR SoM 2022-08-25 22:11:33 +02:00
stm32mp15xx-dhcor-som.dtsi feat(stm32mp1-fdts): remove PLL1 settings 2024-06-11 14:02:10 +02:00
stm32mp15xx-dkx.dtsi fix(stm32mp1-fdts): re-enable RTC clock 2024-12-13 16:54:37 +01:00
stm32mp15xx-osd32.dtsi feat(stm32mp1-fdts): remove PLL1 settings 2024-06-11 14:02:10 +02:00
stm32mp15xxaa-pinctrl.dtsi fix(fdts stm32mp1): correct copyright dates 2021-11-05 13:28:55 +01:00
stm32mp15xxab-pinctrl.dtsi fix(fdts stm32mp1): correct copyright dates 2021-11-05 13:28:55 +01:00
stm32mp15xxac-pinctrl.dtsi fix(fdts stm32mp1): correct copyright dates 2021-11-05 13:28:55 +01:00
stm32mp15xxad-pinctrl.dtsi fix(fdts stm32mp1): correct copyright dates 2021-11-05 13:28:55 +01:00
stm32mp25-bl2.dtsi feat(stm32mp2): add BL31 device tree support 2024-10-21 16:03:07 +02:00
stm32mp25-bl31.dtsi feat(stm32mp2): add BL31 device tree support 2024-10-21 16:03:07 +02:00
stm32mp25-ddr.dtsi feat(stm32mp25-fdts): add DDRCTRL and DDRPHY settings in DDR node 2024-10-10 10:10:31 +02:00
stm32mp25-ddr4-2x8Gbits-2x16bits-1200MHz.dtsi feat(fdts): add DDR4 files for STM32MP2 2024-10-10 10:10:31 +02:00
stm32mp25-ddr4-2x16Gbits-2x16bits-1200MHz.dtsi feat(fdts): add DDR4 files for STM32MP2 2024-10-10 10:10:31 +02:00
stm32mp25-fw-config.dtsi feat(stm32mp2): add BL31 device tree support 2024-10-21 16:03:07 +02:00
stm32mp25-lpddr4-1x16Gbits-1x32bits-1200MHz.dtsi feat(stm32mp2-fdts): add LPDDR4 files 2025-01-06 17:49:32 +01:00
stm32mp25-lpddr4-1x32Gbits-1x32bits-1200MHz.dtsi feat(stm32mp2-fdts): add LPDDR4 files 2025-01-06 17:49:32 +01:00
stm32mp25-pinctrl.dtsi fix(stm32mp2-fdts): fix SDMMC slew rate 2025-01-06 17:49:38 +01:00
stm32mp25xc.dtsi feat(stm32mp2-fdts): introduce stm32mp25 SoCs family 2023-09-08 10:56:49 +02:00
stm32mp25xf.dtsi feat(stm32mp2-fdts): introduce stm32mp25 SoCs family 2023-09-08 10:56:49 +02:00
stm32mp25xxai-pinctrl.dtsi feat(stm32mp2-fdts): introduce stm32mp25 pinctrl files 2023-09-08 10:56:49 +02:00
stm32mp25xxak-pinctrl.dtsi feat(stm32mp2-fdts): introduce stm32mp25 pinctrl files 2023-09-08 10:56:49 +02:00
stm32mp25xxal-pinctrl.dtsi feat(stm32mp2-fdts): introduce stm32mp25 pinctrl files 2023-09-08 10:56:49 +02:00
stm32mp131.dtsi refactor(st): use dashes for BSEC node names 2024-01-18 11:30:42 +01:00
stm32mp133.dtsi fix(stm32mp13-fdts): cleanup DT files 2022-08-17 17:24:30 +02:00
stm32mp135.dtsi fix(stm32mp13-fdts): cleanup DT files 2022-08-17 17:24:30 +02:00
stm32mp135f-dk-fw-config.dts feat(stm32mp1-fdts): add support for STM32MP13 DK board 2022-03-22 09:09:23 +01:00
stm32mp135f-dk.dts feat(stm32mp1-fdts): remove RTC clock configuration 2024-06-11 14:02:10 +02:00
stm32mp151.dtsi refactor(st): use dashes for BSEC node names 2024-01-18 11:30:42 +01:00
stm32mp151a-prtt1a-fw-config.dts feat(stm32mp15-fdts): add support for prtt1x board family 2023-03-06 14:06:49 +01:00
stm32mp151a-prtt1a.dts feat(stm32mp1-fdts): move RNG1 to CSI to improve random generation 2024-06-11 11:45:38 +02:00
stm32mp153.dtsi fdts: stm32mp1: realign device tree with kernel 2020-09-24 09:07:57 +02:00
stm32mp157.dtsi fdts: stm32mp1: realign device tree with kernel 2020-09-24 09:07:57 +02:00
stm32mp157a-avenger96-fw-config.dts feat(fdts): add STM32MP1 fw-config DT files 2021-09-07 09:14:05 +02:00
stm32mp157a-avenger96.dts feat(stm32mp1-fdts): remove PLL1 settings 2024-06-11 14:02:10 +02:00
stm32mp157a-dhcor-avenger96-fw-config.dts feat(stm32mp15-fdts): add Avenger96 board with STM32MP157A DHCOR SoM 2022-08-25 22:11:33 +02:00
stm32mp157a-dhcor-avenger96.dts feat(stm32mp15-fdts): add Avenger96 board with STM32MP157A DHCOR SoM 2022-08-25 22:11:33 +02:00
stm32mp157a-dk1-fw-config.dts feat(fdts): add STM32MP1 fw-config DT files 2021-09-07 09:14:05 +02:00
stm32mp157a-dk1.dts feat(st): update STM32MP DT files 2023-10-19 09:45:43 +02:00
stm32mp157a-ed1-fw-config.dts feat(fdts): add STM32MP1 fw-config DT files 2021-09-07 09:14:05 +02:00
stm32mp157a-ev1-fw-config.dts feat(fdts): add STM32MP1 fw-config DT files 2021-09-07 09:14:05 +02:00
stm32mp157c-dhcom-pdk2-fw-config.dts feat(stm32mp15-fdts): add support for STM32MP157C based DHCOM SoM on PDK2 board 2022-07-08 13:52:40 +02:00
stm32mp157c-dhcom-pdk2.dts feat(stm32mp15-fdts): add support for STM32MP157C based DHCOM SoM on PDK2 board 2022-07-08 13:52:40 +02:00
stm32mp157c-dk2-fw-config.dts feat(fdts): add STM32MP1 fw-config DT files 2021-09-07 09:14:05 +02:00
stm32mp157c-dk2.dts feat(st): update STM32MP DT files 2023-10-19 09:45:43 +02:00
stm32mp157c-ed1-fw-config.dts feat(fdts): add STM32MP1 fw-config DT files 2021-09-07 09:14:05 +02:00
stm32mp157c-ed1.dts fix(stm32mp1-fdts): re-enable RTC clock 2024-12-13 16:54:37 +01:00
stm32mp157c-ev1-fw-config.dts feat(fdts): add STM32MP1 fw-config DT files 2021-09-07 09:14:05 +02:00
stm32mp157c-ev1.dts feat(st): update STM32MP DT files 2023-10-19 09:45:43 +02:00
stm32mp157c-lxa-mc1-fw-config.dts feat(fdts): add STM32MP1 fw-config DT files 2021-09-07 09:14:05 +02:00
stm32mp157c-lxa-mc1.dts fix(fdts stm32mp1): correct copyright dates 2021-11-05 13:28:55 +01:00
stm32mp157c-odyssey-fw-config.dts feat(fdts): add STM32MP1 fw-config DT files 2021-09-07 09:14:05 +02:00
stm32mp157c-odyssey-som.dtsi feat(stm32mp1-fdts): remove PLL1 settings 2024-06-11 14:02:10 +02:00
stm32mp157c-odyssey.dts fdts: stm32mp1: add support for the Seeed Odyssey SoM and board 2021-04-21 19:56:10 +02:00
stm32mp157d-dk1-fw-config.dts feat(fdts): add STM32MP1 fw-config DT files 2021-09-07 09:14:05 +02:00
stm32mp157d-ed1-fw-config.dts feat(fdts): add STM32MP1 fw-config DT files 2021-09-07 09:14:05 +02:00
stm32mp157d-ev1-fw-config.dts feat(fdts): add STM32MP1 fw-config DT files 2021-09-07 09:14:05 +02:00
stm32mp157f-dk2-fw-config.dts feat(fdts): add STM32MP1 fw-config DT files 2021-09-07 09:14:05 +02:00
stm32mp157f-ed1-fw-config.dts feat(fdts): add STM32MP1 fw-config DT files 2021-09-07 09:14:05 +02:00
stm32mp157f-ev1-fw-config.dts feat(fdts): add STM32MP1 fw-config DT files 2021-09-07 09:14:05 +02:00
stm32mp251.dtsi feat(stm32mp2-fdts): add memory node 2024-10-10 10:10:31 +02:00
stm32mp253.dtsi feat(stm32mp2-fdts): introduce stm32mp25 SoCs family 2023-09-08 10:56:49 +02:00
stm32mp255.dtsi feat(stm32mp2-fdts): introduce stm32mp25 SoCs family 2023-09-08 10:56:49 +02:00
stm32mp257.dtsi feat(stm32mp2-fdts): introduce stm32mp25 SoCs family 2023-09-08 10:56:49 +02:00
stm32mp257f-dk-ca35tdcid-fw-config.dtsi feat(stm32mp2-fdts): add STM32MP257F-DK board support 2025-01-06 17:49:38 +01:00
stm32mp257f-dk-ca35tdcid-rcc.dtsi feat(stm32mp2-fdts): add STM32MP257F-DK board support 2025-01-06 17:49:38 +01:00
stm32mp257f-dk-fw-config.dts feat(stm32mp2-fdts): add STM32MP257F-DK board support 2025-01-06 17:49:38 +01:00
stm32mp257f-dk.dts feat(stm32mp2-fdts): add STM32MP257F-DK board support 2025-01-06 17:49:38 +01:00
stm32mp257f-ev1-ca35tdcid-fw-config.dtsi feat(stm32mp2): add BL31 device tree support 2024-10-21 16:03:07 +02:00
stm32mp257f-ev1-ca35tdcid-rcc.dtsi feat(stm32mp2-fdts): add clock tree for STM32MP257F-EV1 2024-08-12 15:54:52 +02:00
stm32mp257f-ev1-fw-config.dts feat(stm32mp2-fdts): add fw-config files for STM32MP257F-EV1 2024-08-12 15:54:52 +02:00
stm32mp257f-ev1.dts feat(stm32mp2-fdts): update STM32MP257F-EV1 DT 2024-10-10 10:10:31 +02:00
tbbr_cot_descriptors.dtsi feat(arm): add support for loading CONFIG from BL2 2024-09-27 14:58:58 +01:00
tc-base.dtsi perf(amu): greatly simplify AMU context management 2025-02-25 08:50:46 +00:00
tc-common.dtsi refactor(tc): introduce a new macro ADDRESSIFY() 2024-04-30 14:20:18 +01:00
tc-fpga.dtsi refactor(tc): rename TC_FPGA_ANDROID_IMG_IN_RAM 2025-01-10 10:00:42 +00:00
tc-fvp.dtsi fix(tc): replace vencoder with simple panel for kernel > 6.6 2024-12-05 15:47:33 +00:00
tc2.dts perf(amu): greatly simplify AMU context management 2025-02-25 08:50:46 +00:00
tc3-4-base.dtsi refactor(tc): clarify msc0 DT node 2025-01-29 08:13:35 +00:00
tc3.dts fix(tc): modify DPU configuration in dts for TC4 FPGA 2025-01-09 10:17:24 +00:00
tc4.dts feat(tc): enable Arm SPE for TC4 2025-02-05 14:34:20 +01:00