Commit graph

62 commits

Author SHA1 Message Date
Govindraj Raja
ac9f4b4da6 fix(cpus): remove errata setting PF_MODE to conservative
The erratum titled “Disabling of data prefetcher with outstanding
prefetch TLB miss might cause a deadlock” should not be handled within
TF-A. The current workaround attempts to follow option 2 but
misapplies it. Specifically, it statically sets PF_MODE to
conservative, which is not the recommended approach. According to the
erratum documentation, PF_MODE should be configured in conservative
mode only when we disable data prefetcher however this is not done
in TF-A and thus the workaround is not needed in TF-A.

The static setting of PF_MODE in TF-A does not correctly address the
erratum and may introduce unnecessary performance degradation on
platforms that adopt it without fully understanding its implications.

To prevent incorrect or unintended use, the current implementation of
this erratum workaround should be removed from TF-A and not adopted by
platforms.

List of Impacted CPU's with Errata Numbers and reference to SDEN -

Cortex-A78  - 2132060 - https://developer.arm.com/documentation/SDEN1401784/latest
Cortex-A78C - 2132064 - https://developer.arm.com/documentation/SDEN-2004089/latest
Cortex-A710 - 2058056 - https://developer.arm.com/documentation/SDEN-1775101/latest
Cortex-X2   - 2058056 - https://developer.arm.com/documentation/SDEN-1775100/latest
Cortex-X3   - 2070301 - https://developer.arm.com/documentation/SDEN2055130/latest
Neoverse-N2 - 2138953 - https://developer.arm.com/documentation/SDEN-1982442/latest
Neoverse-V1 - 2108267 - https://developer.arm.com/documentation/SDEN-1401781/latest
Neoverse-V2 - 2331132 - https://developer.arm.com/documentation/SDEN-2332927/latest

Change-Id: Icf4048508ae070b2df073cc46c63be058b2779df
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2025-03-31 01:00:27 +01:00
Boyan Karatotev
db5fe4f493 chore(docs): drop the "wfi" from pwr_domain_pwr_down_wfi
To allow for generic handling of a wakeup, this hook is no longer
expected to call wfi itself. Update the name everywhere to reflect this
expectation so that future platform implementers don't get misled.

Change-Id: Ic33f0b6da74592ad6778fd802c2f0b85223af614
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
2025-02-03 14:29:47 +00:00
Boyan Karatotev
2bd3b39767 refactor: panic after calling psci_power_down_wfi()
This function doesn't return and its callers that don't return either
rely on this. Drop the dead attribute and add a panic() after it to make
this expectation explicit. Calling `wfi` in the powerdown sequence is
terminal so even if the function was made to return, there would be no
functional change.

This is useful for a following patch that makes psci_power_down_wfi()
return.

Change-Id: I62ca1ee058b1eaeb046966c795081e01bf45a2eb
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
2025-02-03 14:29:47 +00:00
quic_assethi
f60617d3b1 feat(qti): platform support for qcs615
Change-Id: Ibbe78a196d77530fa9d94d7d12b2f08a4b66d62e
Signed-off-by: Amarinder Singh Sethi <quic_assethi@quicinc.com>
2024-12-13 14:54:22 +05:30
Manish V Badarkhe
cc4f383863 Merge changes from topic "clean-up-errata-compatibility" into integration
* changes:
  refactor(cpus): remove cpu specific errata funcs
  refactor(cpus): directly invoke errata reporter
2024-08-27 16:23:58 +02:00
Jayanth Dodderi Chidanand
42e35d2f8c refactor(cm): convert el1-ctx assembly offset entries to c structure
Currently the EL1 part of the context structure (el1_sysregs_t),
is coupled with feature flags reducing the context memory allocation
for platforms, that don't enable/support all the architectural
features at once.

Similar to the el2 context optimization commit-"d6af234" this patch
further improves this section by converting the assembly context-offset
entries into a c structure. It relies on garbage collection of the
linker removing unreferenced structures from memory, as well as aiding
in readability and future maintenance. Additionally, it eliminates
the #ifs usage in 'context_mgmt.c' source file.

Change-Id: If6075931cec994bc89231241337eccc7042c5ede
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2024-07-26 17:08:12 +01:00
Ryan Everett
3fb52e41fd refactor(cpus): remove cpu specific errata funcs
Errata printing is done directly via generic_errata_report.
This commit removes the unused \_cpu\()_errata_report
functions for all cores, and removes errata_func from cpu_ops.

Change-Id: I04fefbde5f0ff63b1f1cd17c864557a14070d68c
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-07-26 11:19:52 +01:00
Michal Simek
13ff6e9dde chore: remove MULTI_CONSOLE_API references
MULTI_CONSOLE_API have been removed long time ago by commit 5b6ebeec9c
("Remove MULTI_CONSOLE_API flag and references to it") that's why remove
references in platform.mk files and also in one rst which is not valid
anymore.

Change-Id: I45f8e7db0a14ce63de62509100d8159b7aca2657
Signed-off-by: Michal Simek <michal.simek@amd.com>
2023-09-12 15:28:36 +02:00
Juan Pablo Conde
043f38fd50 build(bl32): added check for AARCH32_SP
If AACRH32_SP is not specified, it causes the DEFAULT_LINKER_SCRIPT
variable to be empty, and then the linker takes the variable following
it as if it was the linker script, which is not one. This patch
addresses that issue by requiring the AARCH32_SP variable to be set
before continuing.

Change-Id: I21db7d5bd86b98faaa1a1cd3f985daa592556a2d
Signed-off-by: Juan Pablo Conde <juanpablo.conde@arm.com>
2023-08-24 14:22:34 -05:00
Stephan Gerhold
78aac78ad2 feat(msm8916): add port for MDM9607
The Qualcomm X5 Modem (MDM9607) SoC is very similar to the existing
MSM8916, except for:

  - Single core ARM Cortex-A7
  - No GPU
  - MMU-500 r2p4 instead of r0p0 (need to clear CACHE_LOCK bit)
  - Different default BL31/BL33 address and UART number

Make the existing MSM8916 platform port usable for MDM9607 as well by
adding some minimal if statements where necessary plus the platform
make files for mdm9607.

Change-Id: I4dd02c8e29af6282d8d828c3027c5e333459ba36
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:56:08 +02:00
Stephan Gerhold
d9e565ea80 refactor(msm8916): handle single core platforms
Some Qualcomm modem platforms (MDM*) are quite similar to MSM8916
except that there is just a single CPU core. This requires some special
handling:

 - There is no GPU so the GPU SMMU also does not exist.
 - Looking closely at dumps of the MMIO register regions reveals that
   some of the register addresses are slightly different.

Add the necessary checks for this to allow building for those
platforms.

No functional change for existing platforms.

Change-Id: I0380ac3734876243e970a55d8bec5a8247175343
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:56:08 +02:00
Stephan Gerhold
c28e96cd52 feat(msm8916): add port for MSM8939
The Qualcomm Snapdragon 615 (MSM8939) SoC is very similar to the
existing MSM8916, except for:

  - Two clusters with ARM Cortex-A53 cores
  - CCI-400

Make the existing MSM8916 platform port usable for MSM8939 as well by
adding some minimal if statements where necessary plus the platform
make files for msm8939.

Change-Id: I8cda83dc642f62222f984a42eec14de5df4c11e3
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:56:08 +02:00
Stephan Gerhold
c822d26506 feat(msm8916): power on L2 caches for secondary clusters
On platforms with multiple CPU clusters the L2 cache will be only on
for the cluster of the boot CPU. Add the necessary sequence to power it
up for secondary clusters similar to the CPU boot sequence.

No functional change for platforms with a single cluster. The new code
is discarded entirely in this case.

Change-Id: I3d3bce519a8a10ef5278d74d81acf59123e00454
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:56:08 +02:00
Stephan Gerhold
1240dc7ef1 feat(msm8916): initialize CCI-400 for multiple clusters
The MSM8939 SoC is very similar to MSM8916 but uses an ARM CCI-400
for cache coherence between the two CPU clusters. Add the necessary
code to initialize it with the existing driver.

No functional change for platforms with a single cluster. The CCI
related code is discarded entirely in this case.

Change-Id: I041d60222d8d2aeca53b392934c87280c66b0db0
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:56:04 +02:00
Stephan Gerhold
1d7ed58ff7 refactor(msm8916): handle multiple CPU clusters
Some Qualcomm platforms similar to MSM8916 have multiple CPU clusters.
In this case, some of the hardware blocks are duplicated and must be
configured separately.

Refactor the code to handle additional clusters by introducing loops
and some conditionals.

No functional change for existing single cluster platforms.

Change-Id: I5b4b1ad2a1adde559d5b79b7698afe73733b2e90
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:53:59 +02:00
Stephan Gerhold
cf0a75f04d feat(msm8916): add port for MSM8909
The Qualcomm Snapdragon 210 (MSM8909) SoC is very similar to the
existing MSM8916, except for:

  - ARM Cortex-A7 instead of Cortex-A53 (AArch32-only)
  - MMU-500 r2p0 instead of r0p0 (need to clear CACHE_LOCK bit)
  - Different default BL31 address and UART number

Make the existing MSM8916 platform port usable for MSM8909 as well by
adding some minimal if statements where necessary plus the platform
make files for msm8909.

Change-Id: I8eca5bd8f2486cc2174562fb5de28f8dffa0d874
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:53:58 +02:00
Stephan Gerhold
d9b04423cf feat(msm8916): clear CACHE_LOCK for MMU-500 r2p0+
Newer Qualcomm platforms similar to MSM8916 use MMU-500 r2p0+ instead
of MMU-500 r0p0. On these versions it is necessary to clear the
SMMU_sACR.CACHE_LOCK bit to allow the normal world to write to
SMMU_CBn_ACTLR. Without this Linux shows a warning and is unable to
workaround the errata in MMU-500:

  arm-smmu 1e00000.iommu: Failed to disable prefetcher
    [errata #841119  and #826419], check ACR.CACHE_LOCK

Handle this dynamically at runtime by enabling all the necessary SMMU
clocks and check the IDR7 register for MMU-500 r2p0+. This must be
applied to both SMMUs on the platform: APPS and GPU.

While at it clean up the clock handling: Leave the SMMU clocks on
because the normal world will need it again while booting. But make
sure the vote register of the RPM co-processor does not keep these
clocks always-on. For some reasons some platforms seem to have a
non-zero reset value for GCC_RPM_SMMU_CLOCK_BRANCH_ENA_VOTE.

Change-Id: I34cf7d3f2db977b0930eb6e64a870ecaf02a7573
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:53:58 +02:00
Stephan Gerhold
b9072a340a style(msm8916): add missing braces to while statements
According to the coding style all conditional statements (such as if,
for, while, do) must use braces regardless of the number of the
statements in the body [1].

Fix this for the code inside plat/qti/msm8916.

[1]: https://trustedfirmware-a.readthedocs.io/en/latest/process/coding-style.html#conditional-statement-bodies

Change-Id: I74f2e65aa2b3a65899e37dfd3f481d90fb15531c
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:53:58 +02:00
Wing Li
0a9270abe8 fix(sc7280): update system suspend in OS-initiated mode
This patch fixes system suspend in OS-initiated mode by setting the
value of `last_at_pwrlvl` in the `psci_power_state_t` object to
`PLAT_MAX_PWR_LVL`, which otherwise would result in undefined behavior.

This is conditionally compiled into the build depending on the value of
the `PSCI_OS_INIT_MODE` build option.

Change-Id: Ib9ff606b7eebd8a8224891a0d239a4e13311fe2a
Signed-off-by: Wing Li <wingers@google.com>
2023-07-10 14:13:24 -07:00
Stephan Gerhold
aad23f1a2c feat(msm8916): allow selecting which UART to use
At the moment the msm8916 platform port always uses UART number 2 for
debug output. In some situations it is necessary to change this, either
because only the other UART is exposed on the board or for runtime
debugging, to avoid conflicting with the normal world.

Make the UART to use configurable using QTI_UART_NUM on the make
command line and also add QTI_RUNTIME_UART as an option to keep using
the UART after early boot. The latter is disabled by default since it
requires reserving the UART and related clocks inside the normal world.

Change-Id: I14725f954bbcecebcf317e8601922a3d00f2ec28
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-06-20 18:52:48 +02:00
Stephan Gerhold
45b2bd0acb feat(msm8916): add SP_MIN port for AArch32
Use the new shared msm8916 setup code to allow compiling the minimal
AArch32 Secure Payload (SP_MIN) as simple PSCI implementation.

AArch64 is preferred for the Cortex-A53 cores in MSM8916 but there are
some similar platforms with AArch32-only Cortex-A7 cores that can
benefit from this in future changes.

The AArch32 assembly implementation for msm8916_helpers.S and
uartdm_console.S is a direct port of the AArch64 implementation.
Only plat_get_my_entrypoint is slightly different because there is no
need to handle the "boot remapper" on cold boot for AArch32.

Change-Id: Idf160e86fb3e685fcedec3e051400e6273997b74
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-06-20 18:52:44 +02:00
Stephan Gerhold
25132f7820 refactor(msm8916): detect cold boot in plat_get_my_entrypoint
The msm8916 platform port needs to disable the TCM redirect to the L2
cache as early as possible during cold boot to avoid crashes. Right now
this is done in plat_reset_handler by checking if BL31 was started
through the "boot remapper", which redirects memory accesses around the
fixed CPU reset address (0x0) to the actual link address of BL31. On
AArch64 this is always the case during cold boot, since a CPU reset was
necessary to switch from AArch32 in the initial bootloader to AArch64.

On AArch32, SP_MIN starts running at the real link address immediately,
so the initial cold boot must be detected with a different approach.

To keep the AArch32 and AArch64 implementation of this functionality
consistent, move this functionality to plat_get_my_entrypoint, by
checking if the msm8916_entry_point is still zero or was already
updated for later warm boots by the PSCI code.

Also, avoid entering BL31 twice and instead add the BL31_BASE offset
to the return address in the link register. This allows preserving the
bootloader arguments in x0-x3 because they otherwise get lost.

Change-Id: I90286c6cacf23f44ed7930a3e7e33804ca63c391
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-06-20 18:52:41 +02:00
Stephan Gerhold
6b8f9e16a7 feat(msm8916): add Test Secure Payload (TSP) port
Use the new shared msm8916 setup code to easily allow compiling the
Test Secure Payload (TSP) for the msm8916 platform.

Unlike BL31, TSP only calls msm8916_platform_setup() but not
msm8916_configure() because this is already done in BL31.

Change-Id: I3225ef9e61387d49870e9759ffd5b899a8805961
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-06-20 18:52:37 +02:00
Stephan Gerhold
4181ec8cec build(msm8916): place bl32 directly after bl31
At the moment there are two entirely separate memory regions for BL31
and BL32. However, since BL31 is very small (<= 128 KiB) there is
actually still plenty of space after BL31.

Drop the extra memory region for BL32 and place it directly after BL31
(i.e. BL31_LIMIT). If needed it is still possible to change it on the
make command line.

While at it, move the definitions to the bottom of the make file so
they come immediately before the related add_define calls.

Change-Id: I5184dcc2d89a92f1384508f973d56fd963e7befb
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-06-20 18:52:32 +02:00
Stephan Gerhold
840831b2e0 refactor(msm8916): separate common platform setup code
In preparation of adding BL32 support for the msm8916 platform
(AArch32/SP_MIN and TSP), separate the common platform setup code into
shared msm8916_setup.c and msm8916_config.c files which can be called
from both BL31 and BL32.

msm8916_setup.c contains the relevant shared code for BL31/SP_MIN/TSP,
while msm8916_config.c is cold boot configuration code that is only
relevant for BL31 and SP_MIN (but not TSP).

No functional change.

Change-Id: I055522d5ad8c03dfb8e09236dc47dd383a480e95
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-06-20 18:52:29 +02:00
Wing Li
a43be0f610 fix(sc7280): update pwr_domain_suspend
Change-Id: I0ee6598e9a9a01aea49e05307c68bde9993debba
Signed-off-by: Wing Li <wingers@google.com>
2023-05-31 23:54:19 -07:00
Manish V Badarkhe
41914de338 Merge changes I5bb43cb0,I6aebe2ca,Ib59df16a,I9d037ab2,I9df5a465, ... into integration
* changes:
  fix(msm8916): add timeout for crash console TX flush
  style(msm8916): use size macros
  feat(msm8916): expose more timer frames
  fix(msm8916): drop unneeded initialization of CNTACR
  build(msm8916): disable unneeded workarounds
  fix(msm8916): flush dcache after writing msm8916_entry_point
  fix(msm8916): print \r before \n on UART console
2023-05-09 23:29:52 +02:00
Stephan Gerhold
7e002c8a13 fix(msm8916): add timeout for crash console TX flush
Resetting the UART DM controller while there are still remaining
characters in the FIFO often results in corruption on the UART receiver
side. To avoid this the msm8916 crash console implementation tries to
wait until the TX FIFO is empty.

Unfortunately this might spin forever if the transmitter was disabled
before it has fully finished transmitting. In this case the TXEMT bit
console_uartdm_core_flush is waiting for will never get set.

There seems to be no good way to detect if the transmitter is actually
enabled via the status registers. However, the TX FIFO is fairly small
and should not take too long to get flushed, so fix this by simply
limiting the amount of iterations with a short timeout.

Move the code to console_uartdm_core_init to ensure that this always
happens before resetting the transmitter (also during initialization).

Change-Id: I5bb43cb0b6c029bcd15e253d60d36c0b310e108b
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-05-09 21:46:27 +02:00
Stephan Gerhold
a27e3f7698 style(msm8916): use size macros
Use the pre-defined size macros (SZ_*) for more clarity and to avoid
having to add comments to each size represented by hexadecimal numbers.

Change-Id: I6aebe2caf1365279670955b9b507dec7d7b04457
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-05-09 21:46:18 +02:00
Stephan Gerhold
1781bf1c40 feat(msm8916): expose more timer frames
The memory-mapped generic timer on msm8916 has 7 timer frames, but
currently only one is exposed for usage in the non-secure world.

The platform port is currently only designed to be used as minimal PSCI
implementation, without secure world that could make use of the other
timer frames. Let's make all of them available to the normal world.

If needed this could still be changed later by reserving some timer
frames conditionally to a specific SPD being enabled in the build.

Change-Id: Ib59df16aa1fd3dbc875ab6369c133737830c98c6
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-05-09 21:44:58 +02:00
Stephan Gerhold
d833af3ab5 fix(msm8916): drop unneeded initialization of CNTACR
Normal world software is responsible to initialize CNTACR as needed.
There is no existing software for msm8916 that depends on having this
initialization in BL31 so drop it before anything starts to rely on it.

Related issue: https://github.com/ARM-software/tf-issues/issues/170

Change-Id: I9d037ab218c0c1c8a5d5523722013eba531f4728
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-05-09 21:44:51 +02:00
Stephan Gerhold
4a3e2cb355 build(msm8916): disable unneeded workarounds
The Cortex-A53 cores used in the msm8916 platform are not affected by
CVE-2017-5715 and CVE-2022-23960, so disable the workarounds for them
to drop the unused code from the compiled binary.

Change-Id: I9df5a4657c4fd90702b4db4e82d4ee1a2f60303c
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-05-09 21:44:44 +02:00
Stephan Gerhold
01ba69cd9b fix(msm8916): flush dcache after writing msm8916_entry_point
msm8916_entry_point is read with caches off (and even from two
different physical addresses when read through the "boot remapper"),
so it should be flushed to RAM after writing it.

Change-Id: I5c8193954bb28043b0a46fb2038f629bd8796c74
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-05-09 21:44:37 +02:00
Stephan Gerhold
3fb7e40a21 fix(msm8916): print \r before \n on UART console
UART drivers in TF-A are expected to print \r before \n. Some terminal
emulators expect \r\n as line endings by default so not doing this
causes broken line breaks.

Change-Id: I271a35a7c6907441bc71713b0b6a1da19da96878
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-05-09 21:44:29 +02:00
Elyes Haouas
1b491eead5 fix(tree): correct some typos
found using codespell (https://github.com/codespell-project/codespell).

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Change-Id: I1bfa797e3460adddeefa916bb68e22beddaf6373
2023-05-09 15:57:12 +01:00
Manish Pandey
92e93253e4 Merge changes from topic "psci-osi" into integration
* changes:
  feat(sc7280): add support for PSCI_OS_INIT_MODE
  feat(fvp): enable support for PSCI OS-initiated mode
  feat(psci): update PSCI_FEATURES
  feat(psci): add support for OS-initiated mode
  feat(psci): add support for PSCI_SET_SUSPEND_MODE
  build(psci): add build option for OS-initiated mode
  docs(psci): add design proposal for OS-initiated mode
2023-03-28 12:27:37 +02:00
Andre Przywara
d23acc9e4f refactor(amu): unify ENABLE_AMU and ENABLE_FEAT_AMUv1
So far we have the ENABLE_AMU build option to include AMU register
handling code for enabling and context switch. There is also an
ENABLE_FEAT_AMUv1 option, solely to protect the HAFGRTR_EL2 system
register handling. The latter needs some alignment with the new feature
scheme, but it conceptually overlaps with the ENABLE_AMU option.

Since there is no real need for two separate options, unify both into a
new ENABLE_FEAT_AMU name in a first step. This is mostly just renaming at
this point, a subsequent patch will make use of the new feature handling
scheme.

Change-Id: I97d8a55bdee2ed1e1509fa9f2b09fd0bdd82736e
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-03-27 19:36:00 +01:00
Maulik Shah
e528bbec74 feat(sc7280): add support for PSCI_OS_INIT_MODE
Enable PSCI_OS_INIT_MODE support for sc7280.

Change-Id: If94d59190c0bd876e748cd80b2641ce7616fd817
Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>
2023-03-23 19:27:21 -07:00
Andre Przywara
90118bb5c1 refactor(cpufeat): rename ENABLE_SPE_FOR_LOWER_ELS to ENABLE_SPE_FOR_NS
At the moment we hardcode the SPE functionality to be available on the
non-secure side only, by setting MDCR_EL2.E2PB accordingly.

This should be reflected in the feature selection symbol, so rename that
to ENABLE_SPE_FOR_NS, to make it clearer that SPE is not supported in
the secure world.

Change-Id: I3f9b48eab1a45d6ccfcbb9c90a11eeb66867ad9a
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-03-20 13:37:36 +00:00
Andre Przywara
c2fb8ef66c feat(aarch64): make ID system register reads non-volatile
Our system register access function wrappers are using "volatile"
inline assembly instructions. On the first glance this is a good idea,
since many system registers have side effects, and we don't want the
compiler to optimise or reorder them (what "volatile" prevents).

However this also naturally limits the compiler's freedom to optimise
code better, and those volatile properties don't apply to every type of
system register. One example are the CPU ID registers, which have
constant values, are side-effect free and read-only.

Introduce a new wrapper type that drops the volatile keyword, and use
that for the wrappers instantiating ID register accessors.

This allows the compiler to freely optimise those instructions away, if
their result isn't actually used, which can trigger further
optimisations.

Change-Id: I3c64716ae4f4bf603f0ea57b652bd50bcc67bb0e
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-01-11 16:02:57 +00:00
Bharath N
39fdd3d85d feat(qti): updated soc version for sc7180 and sc7280
SMCCC_GET_SOC_VERSION SMC will return soc id to distinguish
different varaints in sc7180 and sc7280

Signed-off-by: Bharath N <quic_bharn@quicinc.com>
Change-Id: I72ea4bdb8193c816ba249c1e0755784c9b9bb7da
2022-11-03 16:29:13 +05:30
Muhammad Arsath K F
b5959ab029 fix(qti): adding secure rm flag
Adding SECURE rm flag to support INTR_EL3_VALID_RM1 routing model.

Signed-off-by: Muhammad Arsath K F <quic_mkf@quicinc.com>
Change-Id: Ie72d62148e81d3cf7fb05f46124f846cc45d9d41
2022-10-06 06:47:14 +02:00
Saurabh Gorecha
6cc743cf0f feat(plat/qti): fix to support cpu errata
fix to support ARM CPU errata based on core used.

Signed-off-by: Saurabh Gorecha <quic_sgorecha@quicinc.com>
Change-Id: If1a438f98f743435a7a0b683a32ccf14164db37e
2022-07-29 18:15:32 +05:30
Stephan Gerhold
a758c0b65c feat(msm8916): allow booting secondary CPU cores
Add support for the PSCI CPU_ON call to allow booting secondary CPU
cores. On cold boot they need to be booted with a special register
sequence. Also, the "boot remapper" needs to be configured to point to
the BL31_BASE, so the CPUs actually start executing BL31 after reset.

Change-Id: I406c508070ccb046bfdefd51554f12e1db671fd4
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2022-02-03 15:19:26 +01:00
Stephan Gerhold
af6447315c feat(msm8916): setup hardware for non-secure world
Booting e.g. Linux in the non-secure world does not work with the
msm8916 port yet because essential hardware is not made available to
the non-secure world. Add more platform initialization to:

  - Initialize the GICv2 and mark secure interrupts.
    Only secure SGIs/PPIs so far. Override the GICD_PIDR2_GICV2
    register address in platform_def.h to avoid a failing assert()
    because of a (hardware) mistake in Qualcomm's GICv2 implementation.

  - Make a timer frame available to the non-secure world.
    The "Qualcomm Timer" (QTMR) implements the ARM generic timer
    specification, so the standard defines (CNTACR_BASE etc)
    can be used.

  - Make parts of the "APCS" register region available to the
    non-secure world, e.g. for CPU frequency control implemented
    in Linux.

  - Initialize a platform-specific register to route all SMMU context
    bank interrupts to the non-secure interrupt pin, since all control
    of the SMMUs is left up to the non-secure world for now.

Change-Id: Icf676437b8e329dead06658e177107dfd0ba4f9d
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2022-02-03 15:19:26 +01:00
Stephan Gerhold
dddba19a6a feat(msm8916): initial platform port
Introduce the bare mimimum base of the msm8916 BL31 port. This is
pretty much just a standard platform "skeleton" with CPU/memory
initialization and an UART driver. This allows booting into
e.g. U-Boot with working UART output.

Note that the plat/qti/msm8916 port is completely separate and does not
make use of anything in plat/qti/common at the moment. The main reason
for that is that plat/qti/common is heavily focused around having a
binary "qtiseclib" component, while the MSM8916 port is fully
open-source (and therefore somewhat limited to publicly documented
functionality).

In the future it might be possible to re-use some of the open-source
parts in plat/qti/common (e.g. spmi_arb.c or pm_ps_hold.c) but it's
not strictly required for the basic functionality supported so far.

Change-Id: I7b4375df0f947b3bd1e55b0b52b21edb6e6d175b
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2022-02-03 11:56:22 +01:00
Shelley Chen
b8a05116ed feat(plat/qti/sc7280): add support for pmk7325
The qti sc7280 platform uses the pmk7325 PMIC, which has the same
functionality as the pm8998 driver, with the exception of the LC
PON register offsets, which are defined as:

Since it is nearly identical to the pm8998 driver, moving the above
register offset definitions to platform_def.h for the respective SoC
and reusing the rest of the functions defined in the pm8998 driver.
Renaming pm8998 driver to pm_ps_hold to make it more generic.

Change-Id: I0dda3a54579e0bbdd42c247405362a86d0607478
Signed-off-by: Shelley Chen <shchen@chromium.org>
2021-10-12 23:51:59 +02:00
Saurabh Gorecha
46ee50e0b3 feat(plat/qti/sc7280): support for qti sc7280 plat
new qti platform sc7280 support addition

Signed-off-by: Saurabh Gorecha <sgorecha@codeaurora.org>
Change-Id: I3dd99d8744a6c313f7dfbbee7ae2cbd6f21656c1
2021-09-22 10:05:45 +02:00
Saurabh Gorecha
cc35a3771d fix(plat/qti/sc7180): qti smc addition
Adding QTI SIP SMC CALL to detect qti platform supporting ARM 64 SMC
calls or not.

Signed-off-by: Saurabh Gorecha <sgorecha@codeaurora.org>
Change-Id: I3231325a6ffe5aa69856dd25ac2c0a2004484e4b
2021-09-08 01:19:47 +05:30
Julius Werner
de67080fbe qti: spmi_arb: Fix NUM_APID and REG_APID_MAP() argument
The NUM_APID value was derived from kernel device tree sources, but I
made a conversion mistake: the amount of bytes in the APID map is the
total size of the "core" register range (0x1100) minus the offset of the
APID map in that range (0x900). This is of course 0x1100 - 0x900 = 0x800
and not 0x200, so the amount of 4-byte integers it can fit is not 0x80
but 0x200. Fix this and make the math more explicit so it can be more
easily factored out and adjusted if that becomes necessary for a future
SoC.

Also fix a dangerous typo in REG_APID_MAP() where the macro would
reference a random variable `i` rather than its argument (`apid`), and
we just got lucky that the only caller in the current code happened to
pass in a variable called `i` as that argument.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I049dd044fa5aeb65be0e7b12150afd6eb4bac0fa
2021-02-03 15:37:02 -08:00