mbox series

[v4,0/2] arm64: DC {ZVA,GVA,GZVA} shouldn't be used when DCZID_EL0.DZP == 1

Message ID 20211206004736.1520989-1-reijiw@google.com (mailing list archive)
Headers show
Series arm64: DC {ZVA,GVA,GZVA} shouldn't be used when DCZID_EL0.DZP == 1 | expand

Message

Reiji Watanabe Dec. 6, 2021, 12:47 a.m. UTC
DCZID_EL0.DZP indicates whether or not use of DC {ZVA,GVA,GZVA} is
prohibited. However, clear_page(), mte_set_mem_tag_range(), and
mte_zero_clear_page_tags() use those instructions without checking it.

Fix those functions not to use DC {ZVA,GVA,GZVA} when DCZID_EL0.DZP == 1.

v4:
 - Fix mte_zero_clear_page_tags to use stz2g instead of stzg. [Catalin]
 - Fix mte_zero_clear_page_tags to use MTE_GRANULE_SIZE instead
   of 16. [Catalin]

v3: https://lore.kernel.org/all/20211119060927.3185381-1-reijiw@google.com/
 - Use stnp instead of stp in clear_page().

v2: https://lore.kernel.org/all/20211108071149.823570-1-reijiw@google.com/
 - Fix mte_set_mem_tag_range() and mte_zero_clear_page_tags() not to use
   DC {GVA,GZVA} when DCZID_EL0.DZP == 1. [Mark]
 - Fix a typo of the comment in clear_page(). [Mark]
 - Fix a loop of for stp in clear_page() for more consistency with
   the existing loop. [Mark]

v1: https://lore.kernel.org/all/20211026034844.1393437-1-reijiw@google.com/

Reiji Watanabe (2):
  arm64: clear_page() shouldn't use DC ZVA when DCZID_EL0.DZP == 1
  arm64: mte: DC {GVA,GZVA} shouldn't be used when DCZID_EL0.DZP == 1

 arch/arm64/include/asm/mte-kasan.h |  8 +++++---
 arch/arm64/lib/clear_page.S        | 10 ++++++++++
 arch/arm64/lib/mte.S               |  8 +++++++-
 3 files changed, 22 insertions(+), 4 deletions(-)


base-commit: 0fcfb00b28c0b7884635dacf38e46d60bf3d4eb1

Comments

Catalin Marinas Dec. 6, 2021, 5:27 p.m. UTC | #1
On Sun, 5 Dec 2021 16:47:34 -0800, Reiji Watanabe wrote:
> DCZID_EL0.DZP indicates whether or not use of DC {ZVA,GVA,GZVA} is
> prohibited. However, clear_page(), mte_set_mem_tag_range(), and
> mte_zero_clear_page_tags() use those instructions without checking it.
> 
> Fix those functions not to use DC {ZVA,GVA,GZVA} when DCZID_EL0.DZP == 1.
> 
> v4:
>  - Fix mte_zero_clear_page_tags to use stz2g instead of stzg. [Catalin]
>  - Fix mte_zero_clear_page_tags to use MTE_GRANULE_SIZE instead
>    of 16. [Catalin]
> 
> [...]

Applied to arm64 (for-next/cache-ops-dzp), thanks!

[1/2] arm64: clear_page() shouldn't use DC ZVA when DCZID_EL0.DZP == 1
      https://git.kernel.org/arm64/c/f0616abd4e67
[2/2] arm64: mte: DC {GVA,GZVA} shouldn't be used when DCZID_EL0.DZP == 1
      https://git.kernel.org/arm64/c/685e2564daa1