git: b3bbec37ba03 - main - arm64: Add a macro to find a VM fault address

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Wed, 21 Feb 2024 18:55:52 UTC
The branch main has been updated by andrew:

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

commit b3bbec37ba039a46f7166f6fa3571f38da4253e9
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-02-21 18:17:47 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-02-21 18:55:32 +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.
---
 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)