The branch main has been updated by andrew:

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

commit 4954ec00c4200d8bfd29875fc13f541942209824
Author:     Andrew Turner <[email protected]>
AuthorDate: 2025-10-02 15:34:43 +0000
Commit:     Andrew Turner <[email protected]>
CommitDate: 2025-10-02 16:21:33 +0000

    arm64/vmm: Save dbgclaimset_el1
    
    It may be used by the guest.
    
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D52803
---
 sys/arm64/vmm/arm64.h   | 1 +
 sys/arm64/vmm/vmm_hyp.c | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/sys/arm64/vmm/arm64.h b/sys/arm64/vmm/arm64.h
index 29279f16d151..334b795832a3 100644
--- a/sys/arm64/vmm/arm64.h
+++ b/sys/arm64/vmm/arm64.h
@@ -87,6 +87,7 @@ struct hypctx {
        uint64_t        pmevcntr_el0[31];
        uint64_t        pmevtyper_el0[31];
 
+       uint64_t        dbgclaimset_el1;
        uint64_t        dbgbcr_el1[16]; /* Debug Breakpoint Control Registers */
        uint64_t        dbgbvr_el1[16]; /* Debug Breakpoint Value Registers */
        uint64_t        dbgwcr_el1[16]; /* Debug Watchpoint Control Registers */
diff --git a/sys/arm64/vmm/vmm_hyp.c b/sys/arm64/vmm/vmm_hyp.c
index b7a621c782b7..b8c6d2ab7a9a 100644
--- a/sys/arm64/vmm/vmm_hyp.c
+++ b/sys/arm64/vmm/vmm_hyp.c
@@ -121,6 +121,8 @@ vmm_hyp_reg_store(struct hypctx *hypctx, struct hyp *hyp, 
bool guest,
                }
        }
 
+       hypctx->dbgclaimset_el1 = READ_SPECIALREG(dbgclaimset_el1);
+
        dfr0 = READ_SPECIALREG(id_aa64dfr0_el1);
        switch (ID_AA64DFR0_BRPs_VAL(dfr0) - 1) {
 #define        STORE_DBG_BRP(x)                                                
\
@@ -394,6 +396,9 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, 
bool guest,
 #undef LOAD_PMU
        }
 
+       WRITE_SPECIALREG(dbgclaimclr_el1, ~0ul);
+       WRITE_SPECIALREG(dbgclaimclr_el1, hypctx->dbgclaimset_el1);
+
        dfr0 = READ_SPECIALREG(id_aa64dfr0_el1);
        switch (ID_AA64DFR0_BRPs_VAL(dfr0) - 1) {
 #define        LOAD_DBG_BRP(x)                                                 
\

Reply via email to