VirtualBox

Changeset 90247 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Jul 19, 2021 7:04:28 PM (4 years ago)
Author:
vboxsync
Message:

DevIchAc97: Don't try setup streams with BDBAR=0 as that upsets the IOMMU. bugref:9890

File:
1 edited

Legend:

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

    r90178 r90247  
    20302030     *       up to and we cannot really make much of a plan out of it.
    20312031     */
     2032    uint8_t const  bLvi     = pStream->Regs.lvi % AC97_MAX_BDLE /* paranoia */;
     2033    uint8_t const  bCiv     = pStream->Regs.civ % AC97_MAX_BDLE /* paranoia */;
     2034    uint32_t const uAddrBdl = pStream->Regs.bdbar;
     2035
     2036    /* Linux does this a number of times while probing/whatever the device. The
     2037       IOMMU usually does allow us to read address zero, so let's skip and hope
     2038       for a better config before the guest actually wants to play/record.
     2039       (Note that bLvi and bCiv are also zero then, but I'm not entirely sure if
     2040       that can be taken to mean anything as such, as it still indicates that
     2041       BDLE00 is valid (LVI == last valid index).) */
     2042    /** @todo Instead of refusing to read address zero, we should probably allow
     2043     * reading address zero if explicitly programmed.  But, too much work now. */
     2044    if (uAddrBdl != 0)
     2045        LogFlowFunc(("bdbar=%#x bLvi=%#x bCiv=%#x\n", uAddrBdl, bLvi, bCiv));
     2046    else
     2047    {
     2048        LogFunc(("Invalid stream #%u: bdbar=%#x bLvi=%#x bCiv=%#x (%s)\n", pStreamCC->u8SD, uAddrBdl, bLvi, bCiv,
     2049                 PDMAudioStrmCfgToString(&Cfg, szTmp, sizeof(szTmp))));
     2050        return VERR_OUT_OF_RANGE;
     2051    }
     2052
    20322053    AC97BDLE aBdl[AC97_MAX_BDLE];
    20332054    RT_ZERO(aBdl);
    2034     PDMDevHlpPCIPhysRead(pDevIns, pStream->Regs.bdbar, aBdl, sizeof(aBdl));
    2035 
    2036     uint8_t const bLvi          = pStream->Regs.lvi % AC97_MAX_BDLE /* paranoia */;
    2037     uint8_t const bCiv          = pStream->Regs.civ % AC97_MAX_BDLE /* paranoia */;
     2055    PDMDevHlpPCIPhysRead(pDevIns, uAddrBdl, aBdl, sizeof(aBdl));
     2056
    20382057    uint32_t      cSamplesMax   = 0;
    20392058    uint32_t      cSamplesMin   = UINT32_MAX;
     
    20432062    for (uintptr_t i = bCiv; ; cBuffers++)
    20442063    {
     2064        Log2Func(("BDLE%02u: %#x LB %#x; %#x\n", i, aBdl[i].addr, aBdl[i].ctl_len & AC97_BD_LEN_MASK, aBdl[i].ctl_len >> 16));
    20452065        cSamplesTotal += aBdl[i].ctl_len & AC97_BD_LEN_MASK;
    20462066        cSamplesCur   += aBdl[i].ctl_len & AC97_BD_LEN_MASK;
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