VirtualBox

Changeset 62354 in vbox


Ignore:
Timestamp:
Jul 20, 2016 12:19:28 PM (8 years ago)
Author:
vboxsync
Message:

VMM/GIM/HyperV: SynIC: APIC-assist page bits.

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

Legend:

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

    r61771 r62354  
    9393    AssertCompile(sizeof(pVM->gim.s) <= sizeof(pVM->gim.padding));
    9494    AssertCompile(sizeof(pVM->aCpus[0].gim.s) <= sizeof(pVM->aCpus[0].gim.padding));
    95 
    9695
    9796    /*
  • trunk/src/VBox/VMM/VMMR3/GIMHv.cpp

    r61776 r62354  
    869869
    870870/**
     871 * Enables the Hyper-V APIC-assist page.
     872 *
     873 * @returns VBox status code.
     874 * @param   pVM                The cross context VM structure.
     875 * @param   GCPhysTscPage      Where to map the APIC-assist page.
     876 */
     877VMMR3_INT_DECL(int) gimR3HvEnableApicAssistPage(PVM pVM, RTGCPHYS GCPhysApicAssistPage)
     878{
     879    PPDMDEVINSR3    pDevIns = pVM->gim.s.pDevInsR3;
     880    AssertPtrReturn(pDevIns, VERR_GIM_DEVICE_NOT_REGISTERED);
     881
     882    /*
     883     * Map the APIC-assist-page at the specified address.
     884     */
     885    /** @todo this is buggy when large pages are used due to a PGM limitation, see
     886     *        @bugref{7532}. Instead of the overlay style mapping, we just
     887     *               rewrite guest memory directly. */
     888    size_t const cbApicAssistPage = PAGE_SIZE;
     889    void *pvApicAssist = RTMemAllocZ(cbApicAssistPage);
     890    if (RT_LIKELY(pvApicAssist))
     891    {
     892        int rc = PGMPhysSimpleWriteGCPhys(pVM, GCPhysApicAssistPage, pvApicAssist, cbApicAssistPage);
     893        if (RT_SUCCESS(rc))
     894        {
     895            /** @todo Inform APIC. */
     896            LogRel(("GIM: HyperV: Enabled APIC-assist page at %#RGp\n", GCPhysApicAssistPage));
     897        }
     898        else
     899        {
     900            LogRelFunc(("GIM: HyperV: PGMPhysSimpleWriteGCPhys failed. rc=%Rrc\n", rc));
     901            rc = VERR_GIM_OPERATION_FAILED;
     902        }
     903
     904        RTMemFree(pvApicAssist);
     905        return rc;
     906    }
     907
     908    LogRelFunc(("GIM: HyperV: Failed to alloc %u bytes\n", cbApicAssistPage));
     909    return VERR_NO_MEMORY;
     910}
     911
     912
     913/**
     914 * Disables the Hyper-V APIC-assist page.
     915 *
     916 * @returns VBox status code.
     917 * @param   pVM     The cross context VM structure.
     918 */
     919VMMR3_INT_DECL(int) gimR3HvDisableApicAssistPage(PVM pVM)
     920{
     921    LogRel(("GIM: HyperV: Disabled APIC-assist page\n"));
     922    /** @todo inform APIC */
     923    return VINF_SUCCESS;
     924}
     925
     926
     927/**
    871928 * Enables the Hyper-V TSC page.
    872929 *
     
    10021059        pRegion->fMapped = false;
    10031060#endif
    1004         LogRel(("GIM: HyperV: Disabled TSC-page\n"));
     1061        LogRel(("GIM: HyperV: Disabled TSC page\n"));
    10051062
    10061063        TMR3CpuTickParavirtDisable(pVM);
  • trunk/src/VBox/VMM/include/GIMHvInternal.h

    r61544 r62354  
    455455/** @} */
    456456
     457/** @name Hyper-V MSR - APIC-assist page (MSR_GIM_HV_APIC_ASSIST_PAGE).
     458 * @{
     459 */
     460/** Guest-physical page frame number of the APIC-assist page. */
     461#define MSR_GIM_HV_APICASSIST_GUEST_PFN(a)        ((a) >> 12)
     462/** The hypercall enable bit. */
     463#define MSR_GIM_HV_APICASSIST_PAGE_ENABLE_BIT     RT_BIT_64(0)
     464/** Whether the hypercall-page is enabled or not. */
     465#define MSR_GIM_HV_APICASSIST_PAGE_IS_ENABLED(a)  RT_BOOL((a) & MSR_GIM_HV_APICASSIST_PAGE_ENABLE_BIT)
     466/** @} */
     467
     468/**
     469 * Hyper-V APIC-assist (HV_REFERENCE_TSC_PAGE) structure placed in the TSC
     470 * reference page.
     471 */
     472typedef struct GIMHVAPICASSIST
     473{
     474    uint32_t fNoEoiRequired : 1;
     475    uint32_t u31Reserved0   : 31;
     476} GIMHVAPICASSIST;
     477/** Pointer to Hyper-V reference TSC. */
     478typedef GIMHVAPICASSIST *PGIMHVAPICASSIST;
     479/** Pointer to a const Hyper-V reference TSC. */
     480typedef GIMHVAPICASSIST const *PCGIMHVAPICASSIST;
     481AssertCompileSize(GIMHVAPICASSIST, 4);
    457482
    458483/**
     
    11241149VMMR3_INT_DECL(int)             gimR3HvGetDebugSetup(PVM pVM, PGIMDEBUGSETUP pDbgSetup);
    11251150
     1151VMMR3_INT_DECL(int)             gimR3HvDisableApicAssistPage(PVM pVM);
     1152VMMR3_INT_DECL(int)             gimR3HvEnableApicAssistPage(PVM pVM, RTGCPHYS GCPhysTscPage);
    11261153VMMR3_INT_DECL(int)             gimR3HvDisableTscPage(PVM pVM);
    11271154VMMR3_INT_DECL(int)             gimR3HvEnableTscPage(PVM pVM, RTGCPHYS GCPhysTscPage, bool fUseThisTscSeq, uint32_t uTscSeq);
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