Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Mar 2022 15:53:37 GMT
From:      D Scott Phillips <scottph@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 2c013d142b14 - stable/13 - arm64: pmap: Mask VA operand in TLBI instructions
Message-ID:  <202203291553.22TFrbhq071345@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by scottph:

URL: https://cgit.FreeBSD.org/src/commit/?id=2c013d142b146ed42d0fe6458ee8a394161ad370

commit 2c013d142b146ed42d0fe6458ee8a394161ad370
Author:     D Scott Phillips <scottph@FreeBSD.org>
AuthorDate: 2022-03-25 16:04:11 +0000
Commit:     D Scott Phillips <scottph@FreeBSD.org>
CommitDate: 2022-03-29 15:47:43 +0000

    arm64: pmap: Mask VA operand in TLBI instructions
    
    Bits 43:0 of the TLBI operand are bits 55:12 of the VA.  Leaving
    bits 63:55 of the VA in bits 51:44 of the operand might wind up
    setting the TTL field (47:44) and accidentally restricting which
    translation levels are flushed in the TLB.
    
    Reviewed By:    andrew
    MFC after:      3 days
    Sponsored by:   Ampere Computing
    Differential Revision:  https://reviews.freebsd.org/D34664
    
    (cherry picked from commit a693a30038278b1ccd3e67b98d76e259ca1b405d)
---
 sys/arm64/arm64/pmap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 26e62c9e3cbb..0183dde11847 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -361,7 +361,8 @@ void (*pmap_invalidate_vpipt_icache)(void);
 #define	COOKIE_TO_EPOCH(cookie)		((int)((u_long)(cookie) >> 32))
 
 #define	TLBI_VA_SHIFT			12
-#define	TLBI_VA(addr)			((addr) >> TLBI_VA_SHIFT)
+#define	TLBI_VA_MASK			((1ul << 44) - 1)
+#define	TLBI_VA(addr)			(((addr) >> TLBI_VA_SHIFT) & TLBI_VA_MASK)
 #define	TLBI_VA_L3_INCR			(L3_SIZE >> TLBI_VA_SHIFT)
 
 static int superpages_enabled = 1;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202203291553.22TFrbhq071345>