git: 797f1c7c3dea - main - arm64: Flush the spintable release address

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Fri, 10 May 2024 09:30:09 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=797f1c7c3dea51f88fa4c365e75c354a93827ca0

commit 797f1c7c3dea51f88fa4c365e75c354a93827ca0
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-05-03 16:17:25 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-05-10 09:29:24 +0000

    arm64: Flush the spintable release address
    
    Ensure the spintable release address is written back from the cache
    to memory. The other CPUs reading this may not be reading it with the
    cache enabled so ensure it is written to the point of coherency
    before issuing the wakeup sev.
    
    As cpu_dcache_wbinv_range includes the needed barrier remove it from
    the inline asm before the sev instruction.
    
    Reviewed by:    jhibbits, kevans
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D45083
---
 sys/arm64/arm64/mp_machdep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c
index bd13dde9cee0..e9b015443477 100644
--- a/sys/arm64/arm64/mp_machdep.c
+++ b/sys/arm64/arm64/mp_machdep.c
@@ -430,10 +430,10 @@ enable_cpu_spin(uint64_t cpu, vm_paddr_t entry, vm_paddr_t release_paddr)
 		return (ENOMEM);
 
 	*release_addr = entry;
+	cpu_dcache_wbinv_range(release_addr, sizeof(*release_addr));
 	pmap_unmapdev(release_addr, sizeof(*release_addr));
 
 	__asm __volatile(
-	    "dsb sy	\n"
 	    "sev	\n"
 	    ::: "memory");