git: c7c27e9ebfdb - stable/14 - arm64: Add a macro to find a VM fault address

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Mon, 15 Jul 2024 12:37:57 UTC
The branch stable/14 has been updated by andrew:

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

commit c7c27e9ebfdbd8e46f7af9aeee2a4c407e102981
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-02-21 18:17:47 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-07-15 12:22:07 +0000

    arm64: Add a macro to find a VM fault address
    
    Add a macro to find which bits from far_el2 are needed to be copied
    to get the full intermediate physical address (IPA).
    
    The hpfar_el2 register only contains a 4k aligned fault address. We
    need to include the lower bits from far_el2 if we need the full
    faulting IPA.
    
    (cherry picked from commit b3bbec37ba039a46f7166f6fa3571f38da4253e9)
---
 sys/arm64/include/hypervisor.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/arm64/include/hypervisor.h b/sys/arm64/include/hypervisor.h
index 18f173c77720..85ac5cda7037 100644
--- a/sys/arm64/include/hypervisor.h
+++ b/sys/arm64/include/hypervisor.h
@@ -126,6 +126,8 @@
 /* HPFAR_EL2_FIPA holds the 4k page address */
 #define	HPFAR_EL2_FIPA_ADDR(x)	\
     (HPFAR_EL2_FIPA_GET(x) << 12)
+/* The bits from FAR_EL2 we need to add to HPFAR_EL2_FIPA_ADDR */
+#define	FAR_EL2_HPFAR_PAGE_MASK	(0xffful)
 
 /* ICC_SRE_EL2 */
 #define	ICC_SRE_EL2_SRE		(1UL << 0)