VirtualBox

Changeset 88503 in vbox


Ignore:
Timestamp:
Apr 14, 2021 11:43:28 AM (4 years ago)
Author:
vboxsync
Message:

DevHda: Just use the ring-3 task (hCorbDmaTask) when ring-0 needs to do CORB DMA stuff. The codec is not yet suitable from ring-0, nor does it see sufficient action to warrant putting it in ring-0, and this approach should unload the EMT a tiny bit more. bugref:9890

Location:
trunk/src/VBox/Devices
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DevHda.cpp

    r88502 r88503  
    667667#endif /* IN_RING3 */
    668668
     669#ifdef IN_RING3 /* Codec is not yet kosher enough for ring-0.  @bugref{9890c64} */
     670
    669671/**
    670672 * Synchronizes the CORB / RIRB buffers between internal <-> device state.
     
    679681 * @todo r=andy Break this up into two functions?
    680682 */
    681 static int hdaCmdSync(PPDMDEVINS pDevIns, PHDASTATE pThis, bool fLocal)
     683static int hdaR3CmdSync(PPDMDEVINS pDevIns, PHDASTATE pThis, bool fLocal)
    682684{
    683685    int rc = VINF_SUCCESS;
     
    765767 * @param   pThisCC             The ring-0 HDA device state.
    766768 */
    767 static int hdaCORBCmdProcess(PPDMDEVINS pDevIns, PHDASTATE pThis, PHDASTATECC pThisCC)
     769static int hdaR3CORBCmdProcess(PPDMDEVINS pDevIns, PHDASTATE pThis, PHDASTATECC pThisCC)
    768770{
    769771    Log3Func(("ENTER CORB(RP:%x, WP:%x) RIRBWP:%x\n", HDA_REG(pThis, CORBRP), HDA_REG(pThis, CORBWP), HDA_REG(pThis, RIRBWP)));
     
    777779    Assert(pThis->cbCorbBuf);
    778780
    779     int rc = hdaCmdSync(pDevIns, pThis, true /* Sync from guest */);
     781    int rc = hdaR3CmdSync(pDevIns, pThis, true /* Sync from guest */);
    780782    AssertRCReturn(rc, rc);
    781783
     
    791793    uint8_t        corbRp       = HDA_REG(pThis, CORBRP);
    792794    uint8_t        rirbWp       = HDA_REG(pThis, RIRBWP);
    793 
    794 #ifndef IN_RING3
    795     /*
    796      * Check t
    797      */
    798 #endif
    799795
    800796    /*
     
    891887     * Write out the response.
    892888     */
    893     rc = hdaCmdSync(pDevIns, pThis, false /* Sync to guest */);
     889    rc = hdaR3CmdSync(pDevIns, pThis, false /* Sync to guest */);
    894890    AssertRC(rc);
    895891
    896892    return rc;
    897893}
     894
     895#endif /* IN_RING3 - @bugref{9890c64} */
    898896
    899897#ifdef IN_RING3
     
    909907
    910908    DEVHDA_LOCK(pDevIns, pThis);
    911     hdaCORBCmdProcess(pDevIns, pThis, pThisCC);
     909    hdaR3CORBCmdProcess(pDevIns, pThis, pThisCC);
    912910    DEVHDA_UNLOCK(pDevIns, pThis);
    913911
     
    11441142
    11451143    if (HDA_REG(pThis, CORBCTL) & HDA_CORBCTL_DMA) /* DMA engine started? */
    1146         rc = hdaCORBCmdProcess(pDevIns, pThis, PDMDEVINS_2_DATA_CC(pDevIns, PHDASTATECC));
     1144    {
     1145#ifdef IN_RING3 /** @todo do PDMDevHlpTaskTrigger everywhere? */
     1146        rc = hdaR3CORBCmdProcess(pDevIns, pThis, PDMDEVINS_2_DATA_CC(pDevIns, PHDASTATECC));
     1147#else
     1148        rc = PDMDevHlpTaskTrigger(pDevIns, pThis->hCorbDmaTask);
     1149        if (rc != VINF_SUCCESS && RT_SUCCESS(rc))
     1150            rc = VINF_SUCCESS;
     1151#endif
     1152    }
    11471153    else
    11481154        LogFunc(("CORB DMA not running, skipping\n"));
     
    12111217    AssertRCSuccess(VBOXSTRICTRC_VAL(rc));
    12121218
    1213     return hdaCORBCmdProcess(pDevIns, pThis, PDMDEVINS_2_DATA_CC(pDevIns, PHDASTATECC));
     1219#ifdef IN_RING3 /** @todo do PDMDevHlpTaskTrigger everywhere? */
     1220    return hdaR3CORBCmdProcess(pDevIns, pThis, PDMDEVINS_2_DATA_CC(pDevIns, PHDASTATECC));
     1221#else
     1222    rc = PDMDevHlpTaskTrigger(pDevIns, pThis->hCorbDmaTask);
     1223    return RT_SUCCESS(rc) ? VINF_SUCCESS : rc;
     1224#endif
    12141225}
    12151226
     
    52935304    AssertRCReturn(rc, rc);
    52945305
     5306# if 0 /* Codec is not yet kosher enough for ring-0.  @bugref{9890c64} */
    52955307    /* Construct the R0 codec part. */
    52965308    rc = hdaR0CodecConstruct(pDevIns, &pThis->Codec, &pThisCC->Codec);
    52975309    AssertRCReturn(rc, rc);
     5310# else
     5311    RT_NOREF(pThisCC);
     5312# endif
    52985313
    52995314    return VINF_SUCCESS;
  • trunk/src/VBox/Devices/Audio/DevHda.h

    r88502 r88503  
    219219typedef struct HDASTATER0
    220220{
     221# if 0 /* Codec is not yet kosher enough for ring-0.  @bugref{9890c64} */
    221222    /** Pointer to HDA codec to use. */
    222223    HDACODECR0              Codec;
     224# else
     225    uint32_t                u32Dummy;
     226# endif
    223227} HDASTATER0;
    224228/** Pointer to a ring-0 HDA device state.  */
  • trunk/src/VBox/Devices/Audio/DevHdaCodec.cpp

    r88502 r88503  
    26112611     */
    26122612    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatLookupsR3, STAMTYPE_COUNTER, "Codec/LookupsR0", STAMUNIT_OCCURENCES, "Number of R0 codecLookup calls");
     2613# if 0 /* Codec is not yet kosher enough for ring-0.  @bugref{9890c64} */
    26132614    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatLookupsR0, STAMTYPE_COUNTER, "Codec/LookupsR3", STAMUNIT_OCCURENCES, "Number of R3 codecLookup calls");
     2615# endif
    26142616
    26152617    return rc;
  • trunk/src/VBox/Devices/Audio/DevHdaCodec.h

    r88502 r88503  
    862862    uint8_t    au8Reserveds[CODEC_NODES_MAX];
    863863
     864    STAMCOUNTER StatLookupsR3;
     865#if 0 /* Codec is not yet kosher enough for ring-0.  @bugref{9890c64} */
    864866    STAMCOUNTER StatLookupsR0;
    865     STAMCOUNTER StatLookupsR3;
     867#endif
    866868} HDACODEC;
    867869
  • trunk/src/VBox/Devices/Makefile.kmk

    r88234 r88503  
    12241224        Audio/DevHda.cpp \
    12251225        Audio/DevHdaCommon.cpp \
    1226         Audio/DevHdaCodec.cpp \
    12271226        Audio/DevHdaStream.cpp \
    12281227        Audio/DevIchAc97.cpp
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