Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cache helpers #1606

Merged
merged 4 commits into from
Jun 21, 2017
Merged

Update cache helpers #1606

merged 4 commits into from
Jun 21, 2017

Conversation

jenswi-linaro
Copy link
Contributor

No description provided.

@jenswi-linaro
Copy link
Contributor Author

Travis error is due to checkpatch warnings, fixing those warning would make future syncs with the ARM-TF cache helpers a bit more difficult.

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My R-b for the 3 first commits (few minor comments).
For the 4th "core: update cache helpers": 2 comments but my R-b would already apply to the sequences and core registers/instruction set. Cross-checked with arm docs and a-tf sources. very nice integration, thanks.

@@ -120,11 +115,6 @@
mcr p15, 0, r0, c7, c1, 0
.endm

.macro write_bpiall
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor about sorting, write_bpiall should remain here (with instr. fix:).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, I don't understand. Please explain.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my mistake :( discard my comment, I just understood the register sorting.

@@ -260,7 +260,7 @@ END_FUNC reset
assert_flat_mapped_range (\vbase), (\line)
ldr r0, =(\vbase)
ldr r1, =(\vend)
bl arm_cl1_d_cleanbyva
bl dcache_clean_range
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add sub r1, r1, r0

@@ -506,7 +506,8 @@ UNWIND( .cantunwind)

#if defined (CFG_BOOT_SECONDARY_REQUEST)
/* if L1 is not invalidated before, do it here */
bl arm_cl1_d_invbysetway
mov r0, #DCACHE_OP_INV
bl dcache_op_all
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should invalidate only the inner (louis), no ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, I don't know. On the other hand this is done once during boot so it's not that much time that can be saved by doing it only to louis.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

invalidating all data cache could be harmful to other running cores, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll change to dcache_op_louis(). @yanyan-wrs, do you agree?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. maybe we should ask some imx maintainers to test this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%grep -l CFG_BOOT_SECONDARY_REQUEST **/*.mk
core/arch/arm/plat-imx/conf.mk
core/arch/arm/plat-ls/conf.mk
core/arch/arm/plat-zynq7k/conf.mk
mk/config.mk

So any of plat-imx, plat-ls or plat-zynq7k should be useful.
Any volunteers/comments, @yanyan-wrs , @sorenb-xlnx , @b49020 ?

.endm

.macro write_dcimvac reg
/* Data cache clean by MVA */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: s/clean/invalidate/

@jenswi-linaro
Copy link
Contributor Author

Addressing review comments (except the one about not moving write_bpiall).

@jenswi-linaro
Copy link
Contributor Author

update

@etienne-lms
Copy link
Contributor

Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>

@jenswi-linaro
Copy link
Contributor Author

I'll assume that everyone is happy with this and squash and rebase in 2 days.

@@ -504,7 +508,8 @@ UNWIND( .cantunwind)

#if defined (CFG_BOOT_SECONDARY_REQUEST)
/* if L1 is not invalidated before, do it here */
bl arm_cl1_d_invbysetway
mov r0, #DCACHE_OP_INV
bl dcache_op_louis
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, late comment after reading back this.
Actually, i even think this should invalidate only the L1 (dcache_op_level1), not the L2 (in case it is in the inner) that might be used by other running cores.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it makes more sense.

@etienne-lms
Copy link
Contributor

Just a minor comment about sorting in core/arch/arm/include/arm32_macros.S.
The ARM documentation usually lists (sorts) the CP15 registers by indices (N,M,O,P) in "cN, M, cO, P", instead of sorting by (M, N, O, P) as proposed in 2nd commit.
I think the a32_macros.S just better use the ARM docs sort scheme.

@jenswi-linaro
Copy link
Contributor Author

I'm not proposing any sorting order in the 2nd commit, I'm just correcting some deviations from the comment about the sorting. The main reason for a sorting order is to avoid the problem with conflicts when adding functions at the end. Other than that I don't care, but I'm not too happy about changing the sorting order as it doubtless will cause conflicts when rebasing these patches.

When you write "cN, M, cO, P" what is what? I'm asking since the instructions are written as p15, A, rX, cB, cC, D.

@etienne-lms
Copy link
Contributor

When you write "cN, M, cO, P" what is what? I'm asking since the instructions are written as p15, A, rX, cB, cC, D.

I meant registers targeted by instructions based on "p15, A, rX, cB, cC, D" are sorted by (B, A, C, D) in the literature. (up to my experience at least)

@jenswi-linaro
Copy link
Contributor Author

@etienne-lms are you OK with the current state or do we need more changes?

@etienne-lms
Copy link
Contributor

@jenswi-linaro: yes, current state of the PR is fine to me (Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>). late reply, connection issues from home :( this afternoon

Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Sorts macros and fixes the macro write_bpial

Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Updates AArch64 and ARMv7 cache helpers from lib/aarch32/cache_helpers.S
and lib/aarch64/cache_helpers.S in ARM-TF,
https://github.com/ARM-software/arm-trusted-firmware/tree/2bd26faf62411c75111fea4b23c542865383b068

The imported routines only covers the inner cache. Already present ARMv7
cache routines are replaced by the new equivalent routines. The AArch64
routines are updated with the resent changes in ARM-TF.

The imported files are modified to better fit into OP-TEE, some
functions and defines are renamed.

Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (Hikey AArch{32,64} pager)
Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (Juno AArch{32,64} pager)
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
@jenswi-linaro
Copy link
Contributor Author

Tags applied.

@jforissier jforissier merged commit 13f187f into OP-TEE:master Jun 21, 2017
@jenswi-linaro jenswi-linaro deleted the cache_helpers branch June 22, 2017 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants