Skip to content

arch/armv7ar: use robust code sequences for cache maintenance#9047

Merged
xiaoxiang781216 merged 1 commit intoapache:masterfrom
zyfeier:l2_cache_1
Apr 25, 2023
Merged

arch/armv7ar: use robust code sequences for cache maintenance#9047
xiaoxiang781216 merged 1 commit intoapache:masterfrom
zyfeier:l2_cache_1

Conversation

@zyfeier
Copy link
Copy Markdown
Contributor

@zyfeier zyfeier commented Apr 20, 2023

Summary

Invalidate operations at DDI0246H_l2c310_r3p3_trm:

If there is a stale entry in the L2 cache, the system enables the invalidation of the L1 cache. But before the controller invalidates the L2 cache, it allocates a line from the L2 cache to an L1 cache.

The robust code sequence for invalidation with a non-exclusive cache arrangement is:

  1. InvalLevel2 Address ; forces the address out past level 2
  2. CACHE SYNC ; Ensures completion of the L2 inval
  3. InvalLevel1 Address ; This is broadcast within the cluster
  4. DSB ; Ensure completion of the inval as far as Level 2.

This sequence ensures that, if there is an allocation to L1 after the L1 invalidation, the data picked up is the new data and not stale data from the L2.

Impact

L2 cache

Testing

sabre-6quad:smp

@xiaoxiang781216
Copy link
Copy Markdown
Contributor

@zyfeier please rebase your change.

Invalidate operations at DDI0246H_l2c310_r3p3_trm:
If there is a stale entry in the L2 cache, the system enables the invalidation of
the L1 cache. But before the controller invalidates the L2 cache, it allocates a
line from the L2 cache to an L1 cache.

The robust code sequence for invalidation with a non-exclusive cache arrangement is:
1. InvalLevel2 Address ; forces the address out past level 2
2. CACHE SYNC ; Ensures completion of the L2 inval
3. InvalLevel1 Address ; This is broadcast within the cluster
4. DSB ; Ensure completion of the inval as far as Level 2.

This sequence ensures that, if there is an allocation to L1 after the L1 invalidation, the data
picked up is the new data and not stale data from the L2

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
@masayuki2009
Copy link
Copy Markdown
Contributor

sabre-6quad:smp

@zyfeier
Did you test this PR on a real board (i.e. sabre-6quad board)?

@zyfeier
Copy link
Copy Markdown
Contributor Author

zyfeier commented Apr 24, 2023

sabre-6quad:smp

@zyfeier Did you test this PR on a real board (i.e. sabre-6quad board)?

Yes, test with sabre-6quad board and our bes2003 board.

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.

4 participants