git: 0cdd0032a769 - main - arm64/vmm: Fix the SPAN check

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Tue, 25 Jun 2024 09:31:30 UTC
The branch main has been updated by andrew:

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

commit 0cdd0032a769a727b0e41298e388853ff59007e8
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-06-25 08:41:57 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-06-25 09:07:19 +0000

    arm64/vmm: Fix the SPAN check
    
    When raising an exception we may need to set the SPSR_EL1.PAN field.
    The check for this was incorrect meaning it would be set when it
    shouldn't be.
    
    Reviewed by:    markj
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D45717
---
 sys/arm64/vmm/vmm_arm64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/arm64/vmm/vmm_arm64.c b/sys/arm64/vmm/vmm_arm64.c
index 1b61871014a7..e5eee47b405b 100644
--- a/sys/arm64/vmm/vmm_arm64.c
+++ b/sys/arm64/vmm/vmm_arm64.c
@@ -1108,7 +1108,7 @@ vmmops_run(void *vcpui, register_t pc, pmap_t pmap, struct vm_eventinfo *evinfo)
 			 * Update fields that may change on exeption entry
 			 * based on how sctlr_el1 is configured.
 			 */
-			if ((hypctx->sctlr_el1 & SCTLR_SPAN) != 0)
+			if ((hypctx->sctlr_el1 & SCTLR_SPAN) == 0)
 				hypctx->tf.tf_spsr |= PSR_PAN;
 			if ((hypctx->sctlr_el1 & SCTLR_DSSBS) == 0)
 				hypctx->tf.tf_spsr &= ~PSR_SSBS;