VirtualBox

Changeset 75151 in vbox for trunk


Ignore:
Timestamp:
Oct 29, 2018 2:30:00 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
126229
Message:

VMM: Nested VMX: bugref:9180 Handle INIT and SIPI VM-exits.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/VMM.cpp

    r74798 r75151  
    113113#include <VBox/vmm/mm.h>
    114114#include <VBox/vmm/nem.h>
     115#include <VBox/vmm/iem.h>
    115116#include <VBox/vmm/iom.h>
    116117#include <VBox/vmm/trpm.h>
     
    15561557
    15571558/**
    1558  * VCPU worker for VMMSendStartupIpi.
     1559 * VCPU worker for VMMR3SendStartupIpi.
    15591560 *
    15601561 * @param   pVM         The cross context VM structure.
     
    15681569
    15691570    /*
    1570      * Active, halt and shutdown states of the processor all block SIPIs.
    1571      * So we can safely discard the SIPI. See Intel spec. 26.6.2 "Activity State".
     1571     * In the INIT state, the target CPU is only responsive to an SIPI.
     1572     * This is also true for when when the CPU is in VMX non-root mode.
     1573     *
     1574     * See AMD spec. 16.5 "Interprocessor Interrupts (IPI)".
     1575     * See Intel spec. 26.6.2 "Activity State".
    15721576     */
    15731577    if (EMGetState(pVCpu) != EMSTATE_WAIT_SIPI)
    1574         return VERR_ACCESS_DENIED;
     1578        return VINF_SUCCESS;
    15751579
    15761580
    15771581    PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu);
     1582    if (CPUMIsGuestInVmxRootMode(pCtx))
     1583    {
     1584        /* If the CPU is in VMX non-root mode we must cause a VM-exit. */
     1585        if (CPUMIsGuestInVmxNonRootMode(pCtx))
     1586            return IEMExecVmxVmexitStartupIpi(pVCpu, uVector);
     1587
     1588        /* If the CPU is in VMX root mode (and not in VMX non-root mode) SIPIs are blocked. */
     1589        return VINF_SUCCESS;
     1590    }
    15781591
    15791592    pCtx->cs.Sel        = uVector << 8;
     
    15971610
    15981611
     1612/**
     1613 * VCPU worker for VMMR3SendInitIpi.
     1614 *
     1615 * @returns VBox status code.
     1616 * @param   pVM         The cross context VM structure.
     1617 * @param   idCpu       Virtual CPU to perform SIPI on.
     1618 */
    15991619static DECLCALLBACK(int) vmmR3SendInitIpi(PVM pVM, VMCPUID idCpu)
    16001620{
     
    16031623
    16041624    Log(("vmmR3SendInitIpi for VCPU %d\n", idCpu));
     1625
     1626    /** @todo r=ramshankar: We should probably block INIT signal when the CPU is in
     1627     *        wait-for-SIPI state. Verify. */
     1628
     1629    /* If the CPU is in VMX non-root mode, INIT signals cause VM-exits. */
     1630    PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu);
     1631    if (CPUMIsGuestInVmxNonRootMode(pCtx))
     1632        return IEMExecVmxVmexitInitIpi(pVCpu);
    16051633
    16061634    /** @todo Figure out how to handle a nested-guest intercepts here for INIT
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