VirtualBox

Changeset 79096 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Jun 12, 2019 7:22:59 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
131258
Message:

VMM/CPUM: Nested VMX: bugref:9180 Add CPUMSetGuestNmiBlocking for upcoming changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp

    r78981 r79096  
    28142814
    28152815/**
     2816 * Sets blocking delivery of NMIs to the guest.
     2817 *
     2818 * @param   pVCpu   The cross context virtual CPU structure.
     2819 * @param   fBlock  Whether NMIs are blocked or not.
     2820 */
     2821VMM_INT_DECL(void) CPUMSetGuestNmiBlocking(PVMCPU pVCpu, bool fBlock)
     2822{
     2823#ifndef IN_RC
     2824    /*
     2825     * Set the state of guest-NMI blocking in any of the following cases:
     2826     *   - We're not executing a nested-guest.
     2827     *   - We're executing an SVM nested-guest[1].
     2828     *   - We're executing a VMX nested-guest without virtual-NMIs enabled.
     2829     *
     2830     * [1] -- SVM does not support virtual-NMIs or virtual-NMI blocking.
     2831     *        SVM hypervisors must track NMI blocking themselves by intercepting
     2832     *        the IRET instruction after injection of an NMI.
     2833     */
     2834    PCPUMCTX pCtx = &pVCpu->cpum.s.Guest;
     2835    if (   !CPUMIsGuestInNestedHwvirtMode(pCtx)
     2836        ||  CPUMIsGuestInSvmNestedHwVirtMode(pCtx)
     2837        || !CPUMIsGuestVmxPinCtlsSet(pVCpu, pCtx, VMX_PIN_CTLS_VIRT_NMI))
     2838    {
     2839        if (fBlock)
     2840        {
     2841            if (!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_BLOCK_NMIS))
     2842                VMCPU_FF_SET(pVCpu, VMCPU_FF_BLOCK_NMIS);
     2843        }
     2844        else
     2845        {
     2846            if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_BLOCK_NMIS))
     2847                VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_BLOCK_NMIS);
     2848        }
     2849        return;
     2850    }
     2851
     2852    /*
     2853     * Set the state of virtual-NMI blocking, if we are executing a
     2854     * VMX nested-guest with virtual-NMIs enabled.
     2855     */
     2856    return CPUMSetGuestVmxVirtNmiBlocking(pVCpu, pCtx, fBlock);
     2857#else
     2858    if (fBlock)
     2859        VMCPU_FF_SET(pVCpu, VMCPU_FF_BLOCK_NMIS);
     2860    else
     2861        VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_BLOCK_NMIS);
     2862#endif
     2863}
     2864
     2865
     2866/**
    28162867 * Checks whether the SVM nested-guest has physical interrupts enabled.
    28172868 *
Note: See TracChangeset for help on using the changeset viewer.

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