VirtualBox

Changeset 63648 in vbox for trunk/src/VBox/VMM/include


Ignore:
Timestamp:
Aug 26, 2016 11:44:40 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
110381
Message:

VMM/GIM/HyperV: Add partial support for synthetic interrupt controller (still disabled, i.e. not exposed to guest).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/GIMHvInternal.h

    r62641 r63648  
    476476/** Whether the SIEF page is enabled or not. */
    477477#define MSR_GIM_HV_SIEF_PAGE_IS_ENABLED(a)        RT_BOOL((a) & MSR_GIM_HV_SIEF_PAGE_ENABLE)
     478/** @} */
     479
     480/** @name Hyper-V MSR - Synthetic Interrupt Control (MSR_GIM_HV_CONTROL).
     481 * @{
     482 */
     483/** The SControl enable mask. */
     484#define MSR_GIM_HV_SCONTROL_ENABLE                RT_BIT_64(0)
     485/** Whether SControl is enabled or not. */
     486#define MSR_GIM_HV_SCONTROL_IS_ENABLED(a)         RT_BOOL((a) & MSR_GIM_HV_SCONTROL_ENABLE)
     487/** @} */
     488
     489/** @name Hyper-V MSR - Synthetic Timer Config (MSR_GIM_HV_STIMER_CONFIG).
     490 * @{
     491 */
     492/** The Stimer enable mask. */
     493#define MSR_GIM_HV_STIMER_ENABLE                  RT_BIT_64(0)
     494/** Whether Stimer is enabled or not. */
     495#define MSR_GIM_HV_STIMER_IS_ENABLED(a)           RT_BOOL((a) & MSR_GIM_HV_STIMER_ENABLE)
     496/** The Stimer periodic mask. */
     497#define MSR_GIM_HV_STIMER_PERIODIC                RT_BIT_64(1)
     498/** Whether Stimer is enabled or not. */
     499#define MSR_GIM_HV_STIMER_IS_PERIODIC(a)          RT_BOOL((a) & MSR_GIM_HV_STIMER_PERIODIC)
     500/** The Stimer lazy mask. */
     501#define MSR_GIM_HV_STIMER_LAZY                    RT_BIT_64(2)
     502/** Whether Stimer is enabled or not. */
     503#define MSR_GIM_HV_STIMER_IS_LAZY(a)              RT_BOOL((a) & MSR_GIM_HV_STIMER_LAZY)
     504/** The Stimer auto-enable mask. */
     505#define MSR_GIM_HV_STIMER_AUTO_ENABLE             RT_BIT_64(3)
     506/** Whether Stimer is enabled or not. */
     507#define MSR_GIM_HV_STIMER_IS_AUTO_ENABLED(a)      RT_BOOL((a) & MSR_GIM_HV_STIMER_AUTO_ENABLE)
     508/** The Stimer SINTx mask (bits 16:19). */
     509#define MSR_GIM_HV_STIMER_SINTX                   UINT64_C(0xf0000)
     510/** Gets the Stimer synthetic interrupt source. */
     511#define MSR_GIM_HV_STIMER_GET_SINTX(a)            (((a) >> 16) & 0xf)
     512/** The Stimer valid read/write mask. */
     513#define MSR_GIM_HV_STIMER_RW_VALID                (  MSR_GIM_HV_STIMER_ENABLE | MSR_GIM_HV_STIMER_PERIODIC    \
     514                                                   | MSR_GIM_HV_STIMER_LAZY   | MSR_GIM_HV_STIMER_AUTO_ENABLE \
     515                                                   | MSR_GIM_HV_STIMER_SINTX)
    478516/** @} */
    479517
     
    726764/** Whether the interrupt source is masked. */
    727765#define MSR_GIM_HV_SINT_IS_MASKED(a)                   RT_BOOL((a) & MSR_GIM_HV_SINT_MASKED)
    728 /** Interrupt vector. */
    729 #define MSR_GIM_HV_SINT_VECTOR(a)                      ((a) & UINT64_C(0xff))
     766/** Gets the interrupt vector. */
     767#define MSR_GIM_HV_SINT_GET_VECTOR(a)                  ((a) & UINT64_C(0xff))
     768/** The AutoEoi mask. */
     769#define MSR_GIM_HV_SINT_AUTOEOI                        RT_BIT_64(17)
     770/** Gets whether AutoEoi is enabled for the synthetic interrupt. */
     771#define MSR_GIM_HV_SINT_IS_AUTOEOI(a)                  RT_BOOL((a) & MSR_GIM_HV_SINT_AUTOEOI)
    730772/** @} */
    731773
     
    787829/** SynIC version register. */
    788830#define GIM_HV_SVERSION                           1
    789 /** Number of synthetic interrupt sources. */
     831/** Number of synthetic interrupt sources (warning, fixed in saved-states!). */
    790832#define GIM_HV_SINT_COUNT                         16
    791833/** Lowest valid vector for synthetic interrupt. */
     
    793835/** Highest valid vector for synthetic interrupt. */
    794836#define GIM_HV_SINT_VECTOR_VALID_MAX              255
     837/** Number of synthetic timers. */
     838#define GIM_HV_STIMER_COUNT                       4
    795839/** @} */
    796840
    797841/** @name Hyper-V synthetic interrupt message type.
     842 * See 14.8.2 "SynIC Message Types"
    798843 * @{
    799844 */
     
    11361181
    11371182/**
    1138  * GIM Hyper-V VCPU instance data.
     1183 * Hyper-V per-VCPU synthetic timer.
     1184 */
     1185typedef struct GIMHVSTIMER
     1186{
     1187    /** Synthetic timer object - R0 ptr. */
     1188    PTMTIMERR0                  pTimerR0;
     1189    /** Synthetic timer object - R3 ptr. */
     1190    PTMTIMERR3                  pTimerR3;
     1191    /** Synthetic timer object - RC ptr. */
     1192    PTMTIMERRC                  pTimerRC;
     1193    /** RC alignment padding. */
     1194    RTRCPTR                     uAlignment0;
     1195    /** Virtual CPU ID this timer belongs to (for reverse mapping). */
     1196    VMCPUID                     idCpu;
     1197    /** The index of this timer in the auStimers array (for reverse mapping). */
     1198    uint32_t                    idxStimer;
     1199    /** Synthetic timer config MSR. */
     1200    uint64_t                    uStimerConfigMsr;
     1201    /** Synthetic timer count MSR. */
     1202    uint64_t                    uStimerCountMsr;
     1203    /** Timer description. */
     1204    char                        szTimerDesc[24];
     1205
     1206} GIMHVSTIMER;
     1207/** Pointer to per-VCPU Hyper-V synthetic timer. */
     1208typedef GIMHVSTIMER *PGIMHVSTIMER;
     1209/** Pointer to a const per-VCPU Hyper-V synthetic timer. */
     1210typedef GIMHVSTIMER const *PCGIMHVSTIMER;
     1211AssertCompileSizeAlignment(GIMHVSTIMER, 8);
     1212
     1213/**
     1214 * Hyper-V VCPU instance data.
    11391215 * Changes to this must checked against the padding of the gim union in VMCPU!
    11401216 */
     
    11461222    uint64_t                    uSimpMsr;
    11471223    /** Interrupt source MSRs. */
    1148     uint64_t                    auSintXMsr[GIM_HV_SINT_COUNT];
     1224    uint64_t                    auSintMsrs[GIM_HV_SINT_COUNT];
    11491225    /** Synethtic interrupt events flag page MSR. */
    11501226    uint64_t                    uSiefpMsr;
    11511227    /** APIC-assist page MSR. */
    11521228    uint64_t                    uApicAssistPageMsr;
     1229    /** Synthetic interrupt control MSR. */
     1230    uint64_t                    uSControlMsr;
     1231    /** Synthetic timers. */
     1232    GIMHVSTIMER                 aStimers[GIM_HV_STIMER_COUNT];
     1233    /** @} */
     1234
     1235    /** @name Statistics.
     1236     * @{ */
     1237    STAMCOUNTER                 aStatStimerFired[GIM_HV_STIMER_COUNT];
    11531238    /** @} */
    11541239} GIMHVCPU;
     
    12051290VMM_INT_DECL(VBOXSTRICTRC)      gimHvWriteMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uRawValue);
    12061291
     1292VMM_INT_DECL(void)              gimHvStartStimer(PVMCPU pVCpu, PCGIMHVSTIMER pHvStimer);
     1293
    12071294RT_C_DECLS_END
    12081295
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