VirtualBox

Changeset 99735 in vbox


Ignore:
Timestamp:
May 10, 2023 5:29:47 PM (17 months ago)
Author:
vboxsync
Message:

VMM/NEMR3Native-darwin-armv8: Set and clear the PPI interrupt of the vTimer if activated, bugref:10390

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/NEMR3Native-darwin-armv8.cpp

    r99576 r99735  
    4040#include <VBox/vmm/iem.h>
    4141#include <VBox/vmm/em.h>
    42 #include <VBox/vmm/apic.h>
     42#include <VBox/vmm/gic.h>
    4343#include <VBox/vmm/pdm.h>
    44 #include <VBox/vmm/hm.h>
    45 #include <VBox/vmm/hm_vmx.h>
    4644#include <VBox/vmm/dbgftrace.h>
    4745#include <VBox/vmm/gcm.h>
     
    6866*   Defined Constants And Macros                                                                                                 *
    6967*********************************************************************************************************************************/
     68
     69
     70/** @todo The vTimer PPI for the virt platform, make it configurable. */
     71#define NEM_DARWIN_VTIMER_GIC_PPI_IRQ           11
    7072
    7173
     
    10841086            return nemR3DarwinHandleExitException(pVM, pVCpu, pExit);
    10851087        case HV_EXIT_REASON_VTIMER_ACTIVATED:
    1086             /** @todo Set interrupt. */
    1087             return VINF_EM_RESCHEDULE;
     1088            pVCpu->nem.s.fVTimerActivated = true;
     1089            return GICPpiSet(pVCpu, NEM_DARWIN_VTIMER_GIC_PPI_IRQ, true /*fAsserted*/);
    10881090        default:
    10891091            AssertReleaseFailed();
     
    11351137    int rc = nemR3DarwinExportGuestState(pVM, pVCpu);
    11361138    AssertRCReturn(rc, rc);
     1139
     1140    /* Check whether the vTimer interrupt was handled by the guest and we can unmask the vTimer. */
     1141    if (pVCpu->nem.s.fVTimerActivated)
     1142    {
     1143        /* Read the CNTV_CTL_EL0 register. */
     1144        uint64_t u64CntvCtl = 0;
     1145
     1146        hv_return_t hrc = hv_vcpu_get_sys_reg(pVCpu->nem.s.hVCpu, HV_SYS_REG_CNTV_CTL_EL0, &u64CntvCtl);
     1147        AssertRCReturn(hrc == HV_SUCCESS, VERR_NEM_IPE_9);
     1148
     1149        if (   (u64CntvCtl & (ARMV8_CNTV_CTL_EL0_AARCH64_ENABLE | ARMV8_CNTV_CTL_EL0_AARCH64_IMASK | ARMV8_CNTV_CTL_EL0_AARCH64_ISTATUS))
     1150            != (ARMV8_CNTV_CTL_EL0_AARCH64_ENABLE | ARMV8_CNTV_CTL_EL0_AARCH64_ISTATUS))
     1151        {
     1152            /* Clear the interrupt. */
     1153            GICPpiSet(pVCpu, NEM_DARWIN_VTIMER_GIC_PPI_IRQ, false /*fAsserted*/);
     1154
     1155            pVCpu->nem.s.fVTimerActivated = false;
     1156            hrc = hv_vcpu_set_vtimer_mask(pVCpu->nem.s.hVCpu, false /*vtimer_is_masked*/);
     1157            AssertReturn(hrc == HV_SUCCESS, VERR_NEM_IPE_9);
     1158        }
     1159    }
    11371160
    11381161    /* Set the pending interrupt state. */
  • trunk/src/VBox/VMM/include/NEMInternal.h

    r99557 r99735  
    483483    /** Flag whether an event is pending. */
    484484    bool                        fEventPending;
     485    /** Flag whether the vTimer got activated and is masked. */
     486    bool                        fVTimerActivated;
    485487# else
    486488    /** The vCPU handle associated with the EMT executing this vCPU. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette