VirtualBox

Changeset 86982 in vbox for trunk/src/VBox/Devices/Bus


Ignore:
Timestamp:
Nov 26, 2020 11:29:29 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
141528
Message:

AMD IOMMU: bugref:9654 A bit of cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Bus/DevIommuAmd.cpp

    r86962 r86982  
    4343/** The IOTLB entry magic. */
    4444#define IOMMU_IOTLBE_MAGIC                          0x10acce55
    45 
    46 #ifndef DEBUG_ramshankar
    47 /** Temporary, make permanent later (get rid of define entirely and remove old
    48  *  code). This allow ssub-qword accesses to qword registers. Write accesses
    49  *  seems to work (needs testing one sub-path of the code), Read accesses not yet
    50  *  converted. */
    51 # define IOMMU_NEW_REGISTER_ACCESS
    52 #endif
    5345
    5446
     
    326318    STAMCOUNTER             StatMemBulkWriteRZ;         /**< Number of memory write bulk translation requests in RZ. */
    327319
    328     STAMCOUNTER             StatCmd;                    /**< Number of commands processed. */
     320    STAMCOUNTER             StatCmd;                    /**< Number of commands processed in total. */
    329321    STAMCOUNTER             StatCmdCompWait;            /**< Number of Completion Wait commands processed. */
    330322    STAMCOUNTER             StatCmdInvDte;              /**< Number of Invalidate DTE commands processed. */
     
    347339AssertCompileMemberAlignment(IOMMU, hMmio, 8);
    348340AssertCompileMemberAlignment(IOMMU, IommuBar, 8);
     341AssertCompileMemberAlignment(IOMMU, aDevTabBaseAddrs, 8);
     342AssertCompileMemberAlignment(IOMMU, CmdBufHeadPtr, 8);
     343AssertCompileMemberAlignment(IOMMU, Status, 8);
    349344
    350345/**
     
    555550{
    556551    IOMMU_ASSERT_LOCKED(pDevIns);
    557     Log5Func(("\n"));
     552    Log4Func(("\n"));
    558553
    559554    PIOMMU pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU);
     
    561556    if (Status.n.u1CmdBufRunning)
    562557    {
    563         Log5Func(("Signaling command thread\n"));
     558        Log4Func(("Signaling command thread\n"));
    564559        PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hEvtCmdThread);
    565560    }
     
    783778
    784779
    785 #ifdef IOMMU_NEW_REGISTER_ACCESS
    786780/**
    787781 * Reads the MSI Capability Header Register (32-bit) and the MSI Address (Lo)
     
    813807    return VINF_SUCCESS;
    814808}
    815 #endif
    816809
    817810
     
    869862    return VINF_SUCCESS;
    870863}
    871 
    872 #ifndef IOMMU_NEW_REGISTER_ACCESS
    873 static VBOXSTRICTRC iommuAmdIgnore_w(PPDMDEVINS pDevIns, PIOMMU pThis, uint32_t offReg, uint64_t u64Value)
    874 {
    875     RT_NOREF(pDevIns, pThis, offReg, u64Value);
    876     return VINF_SUCCESS;
    877 }
    878 #endif
    879864
    880865
     
    11671152
    11681153
    1169 #ifndef IOMMU_NEW_REGISTER_ACCESS
    1170 /**
    1171  * Writes the MSI Capability Header Register.
    1172  */
    1173 static VBOXSTRICTRC iommuAmdMsiCapHdr_w(PPDMDEVINS pDevIns, PIOMMU pThis, uint32_t offReg, uint64_t u64Value)
    1174 {
    1175     RT_NOREF(pThis, offReg);
    1176     PPDMPCIDEV pPciDev = pDevIns->apPciDevs[0];
    1177     PDMPCIDEV_ASSERT_VALID(pDevIns, pPciDev);
    1178     MSI_CAP_HDR_T MsiCapHdr;
    1179     MsiCapHdr.u32 = PDMPciDevGetDWord(pPciDev, IOMMU_PCI_OFF_MSI_CAP_HDR);
    1180     MsiCapHdr.n.u1MsiEnable = RT_BOOL(u64Value & IOMMU_MSI_CAP_HDR_MSI_EN_MASK);
    1181     PDMPciDevSetDWord(pPciDev, IOMMU_PCI_OFF_MSI_CAP_HDR, MsiCapHdr.u32);
    1182     return VINF_SUCCESS;
    1183 }
    1184 
    1185 
    1186 /**
    1187  * Writes the MSI Address (Lo) Register (32-bit).
    1188  */
    1189 static VBOXSTRICTRC iommuAmdMsiAddrLo_w(PPDMDEVINS pDevIns, PIOMMU pThis, uint32_t offReg, uint64_t u64Value)
    1190 {
    1191     RT_NOREF(pThis, offReg);
    1192     Assert(!RT_HI_U32(u64Value));
    1193     PPDMPCIDEV pPciDev = pDevIns->apPciDevs[0];
    1194     PDMPCIDEV_ASSERT_VALID(pDevIns, pPciDev);
    1195     PDMPciDevSetDWord(pPciDev, IOMMU_PCI_OFF_MSI_ADDR_LO, u64Value & VBOX_MSI_ADDR_VALID_MASK);
    1196     return VINF_SUCCESS;
    1197 }
    1198 
    1199 
    1200 /**
    1201  * Writes the MSI Address (Hi) Register (32-bit).
    1202  */
    1203 static VBOXSTRICTRC iommuAmdMsiAddrHi_w(PPDMDEVINS pDevIns, PIOMMU pThis, uint32_t offReg, uint64_t u64Value)
    1204 {
    1205     RT_NOREF(pThis, offReg);
    1206     Assert(!RT_HI_U32(u64Value));
    1207     PPDMPCIDEV pPciDev = pDevIns->apPciDevs[0];
    1208     PDMPCIDEV_ASSERT_VALID(pDevIns, pPciDev);
    1209     PDMPciDevSetDWord(pPciDev, IOMMU_PCI_OFF_MSI_ADDR_HI, u64Value);
    1210     return VINF_SUCCESS;
    1211 }
    1212 
    1213 
    1214 /**
    1215  * Writes the MSI Data Register (32-bit).
    1216  */
    1217 static VBOXSTRICTRC iommuAmdMsiData_w(PPDMDEVINS pDevIns, PIOMMU pThis, uint32_t offReg, uint64_t u64Value)
    1218 {
    1219     RT_NOREF(pThis, offReg);
    1220     PPDMPCIDEV pPciDev = pDevIns->apPciDevs[0];
    1221     PDMPCIDEV_ASSERT_VALID(pDevIns, pPciDev);
    1222     PDMPciDevSetDWord(pPciDev, IOMMU_PCI_OFF_MSI_DATA, u64Value & VBOX_MSI_DATA_VALID_MASK);
    1223     return VINF_SUCCESS;
    1224 }
    1225 #else
    12261154/**
    12271155 * Writes the MSI Vector Register 0 (32-bit) and the MSI Vector Register 1 (32-bit).
     
    12931221    return VINF_SUCCESS;
    12941222}
    1295 #endif
    12961223
    12971224
     
    13331260    iommuAmdCmdThreadWakeUpIfNeeded(pDevIns);
    13341261
    1335     Log5Func(("Set CmdBufHeadPtr to %#RX32\n", offBuf));
     1262    Log4Func(("Set CmdBufHeadPtr to %#RX32\n", offBuf));
    13361263    return VINF_SUCCESS;
    13371264}
     
    13741301    iommuAmdCmdThreadWakeUpIfNeeded(pDevIns);
    13751302
    1376     Log5Func(("Set CmdBufTailPtr to %#RX32\n", offBuf));
     1303    Log4Func(("Set CmdBufTailPtr to %#RX32\n", offBuf));
    13771304    return VINF_SUCCESS;
    13781305}
     
    14751402}
    14761403
    1477 #ifdef IOMMU_NEW_REGISTER_ACCESS
     1404
    14781405/**
    14791406 * Register access table 0.
     
    16371564    return pReg;
    16381565}
    1639 #endif
    16401566
    16411567
     
    16601586    AssertMsgReturn(!(off & 3), ("Invalid offset %#x\n", off), VINF_SUCCESS);
    16611587
    1662     Log5Func(("off=%#x cb=%u uValue=%#RX64\n", off, cb, uValue));
    1663 
    1664     PIOMMU pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU);
    1665 #ifndef IOMMU_NEW_REGISTER_ACCESS
    1666     switch (off)
    1667     {
    1668         case IOMMU_MMIO_OFF_DEV_TAB_BAR:         return iommuAmdDevTabBar_w(pDevIns, pThis, off, uValue);
    1669         case IOMMU_MMIO_OFF_CMD_BUF_BAR:         return iommuAmdCmdBufBar_w(pDevIns, pThis, off, uValue);
    1670         case IOMMU_MMIO_OFF_EVT_LOG_BAR:         return iommuAmdEvtLogBar_w(pDevIns, pThis, off, uValue);
    1671         case IOMMU_MMIO_OFF_CTRL:                return iommuAmdCtrl_w(pDevIns, pThis, off, uValue);
    1672         case IOMMU_MMIO_OFF_EXCL_BAR:            return iommuAmdExclRangeBar_w(pDevIns, pThis, off, uValue);
    1673         case IOMMU_MMIO_OFF_EXCL_RANGE_LIMIT:    return iommuAmdExclRangeLimit_w(pDevIns, pThis, off, uValue);
    1674         case IOMMU_MMIO_OFF_EXT_FEAT:            return iommuAmdIgnore_w(pDevIns, pThis, off, uValue);
    1675 
    1676         case IOMMU_MMIO_OFF_PPR_LOG_BAR:         return iommuAmdIgnore_w(pDevIns, pThis, off, uValue);
    1677         case IOMMU_MMIO_OFF_HW_EVT_HI:           return iommuAmdHwEvtHi_w(pDevIns, pThis, off, uValue);
    1678         case IOMMU_MMIO_OFF_HW_EVT_LO:           return iommuAmdHwEvtLo_w(pDevIns, pThis, off, uValue);
    1679         case IOMMU_MMIO_OFF_HW_EVT_STATUS:       return iommuAmdHwEvtStatus_w(pDevIns, pThis, off, uValue);
    1680 
    1681         case IOMMU_MMIO_OFF_GALOG_BAR:
    1682         case IOMMU_MMIO_OFF_GALOG_TAIL_ADDR:     return iommuAmdIgnore_w(pDevIns, pThis, off, uValue);
    1683 
    1684         case IOMMU_MMIO_OFF_PPR_LOG_B_BAR:
    1685         case IOMMU_MMIO_OFF_PPR_EVT_B_BAR:       return iommuAmdIgnore_w(pDevIns, pThis, off, uValue);
    1686 
    1687         case IOMMU_MMIO_OFF_DEV_TAB_SEG_1:
    1688         case IOMMU_MMIO_OFF_DEV_TAB_SEG_2:
    1689         case IOMMU_MMIO_OFF_DEV_TAB_SEG_3:
    1690         case IOMMU_MMIO_OFF_DEV_TAB_SEG_4:
    1691         case IOMMU_MMIO_OFF_DEV_TAB_SEG_5:
    1692         case IOMMU_MMIO_OFF_DEV_TAB_SEG_6:
    1693         case IOMMU_MMIO_OFF_DEV_TAB_SEG_7:       return iommuAmdDevTabSegBar_w(pDevIns, pThis, off, uValue);
    1694 
    1695         case IOMMU_MMIO_OFF_DEV_SPECIFIC_FEAT:
    1696         case IOMMU_MMIO_OFF_DEV_SPECIFIC_CTRL:
    1697         case IOMMU_MMIO_OFF_DEV_SPECIFIC_STATUS: return iommuAmdIgnore_w(pDevIns, pThis, off, uValue);
    1698 
    1699         case IOMMU_MMIO_OFF_MSI_VECTOR_0:
    1700         case IOMMU_MMIO_OFF_MSI_VECTOR_1:        return iommuAmdIgnore_w(pDevIns, pThis, off, uValue);
    1701         case IOMMU_MMIO_OFF_MSI_CAP_HDR:
    1702         {
    1703             VBOXSTRICTRC rcStrict = iommuAmdMsiCapHdr_w(pDevIns, pThis, off, (uint32_t)uValue);
    1704             if (cb == 4 || RT_FAILURE(rcStrict))
    1705                 return rcStrict;
    1706             uValue >>= 32;
    1707             RT_FALL_THRU();
    1708         }
    1709         case IOMMU_MMIO_OFF_MSI_ADDR_LO:         return iommuAmdMsiAddrLo_w(pDevIns, pThis, off, uValue);
    1710         case IOMMU_MMIO_OFF_MSI_ADDR_HI:
    1711         {
    1712             VBOXSTRICTRC rcStrict = iommuAmdMsiAddrHi_w(pDevIns, pThis, off, (uint32_t)uValue);
    1713             if (cb == 4 || RT_FAILURE(rcStrict))
    1714                 return rcStrict;
    1715             uValue >>= 32;
    1716             RT_FALL_THRU();
    1717         }
    1718         case IOMMU_MMIO_OFF_MSI_DATA:            return iommuAmdMsiData_w(pDevIns, pThis, off, uValue);
    1719         case IOMMU_MMIO_OFF_MSI_MAPPING_CAP_HDR: return iommuAmdIgnore_w(pDevIns, pThis, off, uValue);
    1720 
    1721         case IOMMU_MMIO_OFF_PERF_OPT_CTRL:       return iommuAmdIgnore_w(pDevIns, pThis, off, uValue);
    1722 
    1723         case IOMMU_MMIO_OFF_XT_GEN_INTR_CTRL:
    1724         case IOMMU_MMIO_OFF_XT_PPR_INTR_CTRL:
    1725         case IOMMU_MMIO_OFF_XT_GALOG_INT_CTRL:   return iommuAmdIgnore_w(pDevIns, pThis, off, uValue);
    1726 
    1727         case IOMMU_MMIO_OFF_MARC_APER_BAR_0:
    1728         case IOMMU_MMIO_OFF_MARC_APER_RELOC_0:
    1729         case IOMMU_MMIO_OFF_MARC_APER_LEN_0:
    1730         case IOMMU_MMIO_OFF_MARC_APER_BAR_1:
    1731         case IOMMU_MMIO_OFF_MARC_APER_RELOC_1:
    1732         case IOMMU_MMIO_OFF_MARC_APER_LEN_1:
    1733         case IOMMU_MMIO_OFF_MARC_APER_BAR_2:
    1734         case IOMMU_MMIO_OFF_MARC_APER_RELOC_2:
    1735         case IOMMU_MMIO_OFF_MARC_APER_LEN_2:
    1736         case IOMMU_MMIO_OFF_MARC_APER_BAR_3:
    1737         case IOMMU_MMIO_OFF_MARC_APER_RELOC_3:
    1738         case IOMMU_MMIO_OFF_MARC_APER_LEN_3:     return iommuAmdIgnore_w(pDevIns, pThis, off, uValue);
    1739 
    1740         case IOMMU_MMIO_OFF_RSVD_REG:            return iommuAmdIgnore_w(pDevIns, pThis, off, uValue);
    1741 
    1742         case IOMMU_MMIO_OFF_CMD_BUF_HEAD_PTR:    return iommuAmdCmdBufHeadPtr_w(pDevIns, pThis, off, uValue);
    1743         case IOMMU_MMIO_OFF_CMD_BUF_TAIL_PTR:    return iommuAmdCmdBufTailPtr_w(pDevIns, pThis, off, uValue);
    1744         case IOMMU_MMIO_OFF_EVT_LOG_HEAD_PTR:    return iommuAmdEvtLogHeadPtr_w(pDevIns, pThis, off, uValue);
    1745         case IOMMU_MMIO_OFF_EVT_LOG_TAIL_PTR:    return iommuAmdEvtLogTailPtr_w(pDevIns, pThis, off, uValue);
    1746 
    1747         case IOMMU_MMIO_OFF_STATUS:              return iommuAmdStatus_w(pDevIns, pThis, off, uValue);
    1748 
    1749         case IOMMU_MMIO_OFF_PPR_LOG_HEAD_PTR:
    1750         case IOMMU_MMIO_OFF_PPR_LOG_TAIL_PTR:
    1751 
    1752         case IOMMU_MMIO_OFF_GALOG_HEAD_PTR:
    1753         case IOMMU_MMIO_OFF_GALOG_TAIL_PTR:
    1754 
    1755         case IOMMU_MMIO_OFF_PPR_LOG_B_HEAD_PTR:
    1756         case IOMMU_MMIO_OFF_PPR_LOG_B_TAIL_PTR:
    1757 
    1758         case IOMMU_MMIO_OFF_EVT_LOG_B_HEAD_PTR:
    1759         case IOMMU_MMIO_OFF_EVT_LOG_B_TAIL_PTR:  return iommuAmdIgnore_w(pDevIns, pThis, off, uValue);
    1760 
    1761         case IOMMU_MMIO_OFF_PPR_LOG_AUTO_RESP:
    1762         case IOMMU_MMIO_OFF_PPR_LOG_OVERFLOW_EARLY:
    1763         case IOMMU_MMIO_OFF_PPR_LOG_B_OVERFLOW_EARLY:
    1764 
    1765         /* Not implemented. */
    1766         case IOMMU_MMIO_OFF_SMI_FLT_FIRST:
    1767         case IOMMU_MMIO_OFF_SMI_FLT_LAST:
    1768         {
    1769             LogFunc(("Writing unsupported register: SMI filter %u -> Ignored\n", (off - IOMMU_MMIO_OFF_SMI_FLT_FIRST) >> 3));
    1770             return VINF_SUCCESS;
    1771         }
    1772 
    1773         /* Unknown. */
    1774         default:
    1775         {
    1776             LogFunc(("Writing unknown register %u (%#x) with %#RX64 -> Ignored\n", off, off, uValue));
    1777             return VINF_SUCCESS;
    1778         }
    1779     }
    1780 #else
    1781     PCIOMMUREGACC pReg = iommuAmdGetRegAccessForOffset(off);
     1588    Log4Func(("off=%#x cb=%u uValue=%#RX64\n", off, cb, uValue));
     1589
     1590    PIOMMU        pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU);
     1591    PCIOMMUREGACC pReg  = iommuAmdGetRegAccessForOffset(off);
    17821592    if (pReg)
    17831593    { /* likely */ }
     
    18581668    uValue = (uValue << 32) | (u64Read & UINT64_C(0xffffffff));
    18591669    return pReg->pfnWrite(pDevIns, pThis, off - 4, uValue);
    1860 #endif
    18611670}
    18621671
     
    18871696    PIOMMU      pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU);
    18881697    PCPDMPCIDEV pPciDev = pDevIns->apPciDevs[0];
    1889     PDMPCIDEV_ASSERT_VALID(pDevIns, pPciDev);
    1890 
    1891     Log5Func(("off=%#x\n", off));
    1892 
    1893 #ifndef IOMMU_NEW_REGISTER_ACCESS
    1894     /** @todo IOMMU: fine-grained locking? */
    1895     uint64_t uReg;
    1896     switch (off)
    1897     {
    1898         case IOMMU_MMIO_OFF_DEV_TAB_BAR:              uReg = pThis->aDevTabBaseAddrs[0].u64;    break;
    1899         case IOMMU_MMIO_OFF_CMD_BUF_BAR:              uReg = pThis->CmdBufBaseAddr.u64;         break;
    1900         case IOMMU_MMIO_OFF_EVT_LOG_BAR:              uReg = pThis->EvtLogBaseAddr.u64;         break;
    1901         case IOMMU_MMIO_OFF_CTRL:                     uReg = pThis->Ctrl.u64;                   break;
    1902         case IOMMU_MMIO_OFF_EXCL_BAR:                 uReg = pThis->ExclRangeBaseAddr.u64;      break;
    1903         case IOMMU_MMIO_OFF_EXCL_RANGE_LIMIT:         uReg = pThis->ExclRangeLimit.u64;         break;
    1904         case IOMMU_MMIO_OFF_EXT_FEAT:                 uReg = pThis->ExtFeat.u64;                break;
    1905 
    1906         case IOMMU_MMIO_OFF_PPR_LOG_BAR:              uReg = pThis->PprLogBaseAddr.u64;         break;
    1907         case IOMMU_MMIO_OFF_HW_EVT_HI:                uReg = pThis->HwEvtHi.u64;                break;
    1908         case IOMMU_MMIO_OFF_HW_EVT_LO:                uReg = pThis->HwEvtLo;                    break;
    1909         case IOMMU_MMIO_OFF_HW_EVT_STATUS:            uReg = pThis->HwEvtStatus.u64;            break;
    1910 
    1911         case IOMMU_MMIO_OFF_GALOG_BAR:                uReg = pThis->GALogBaseAddr.u64;          break;
    1912         case IOMMU_MMIO_OFF_GALOG_TAIL_ADDR:          uReg = pThis->GALogTailAddr.u64;          break;
    1913 
    1914         case IOMMU_MMIO_OFF_PPR_LOG_B_BAR:            uReg = pThis->PprLogBBaseAddr.u64;        break;
    1915         case IOMMU_MMIO_OFF_PPR_EVT_B_BAR:            uReg = pThis->EvtLogBBaseAddr.u64;        break;
    1916 
    1917         case IOMMU_MMIO_OFF_DEV_TAB_SEG_1:
    1918         case IOMMU_MMIO_OFF_DEV_TAB_SEG_2:
    1919         case IOMMU_MMIO_OFF_DEV_TAB_SEG_3:
    1920         case IOMMU_MMIO_OFF_DEV_TAB_SEG_4:
    1921         case IOMMU_MMIO_OFF_DEV_TAB_SEG_5:
    1922         case IOMMU_MMIO_OFF_DEV_TAB_SEG_6:
    1923         case IOMMU_MMIO_OFF_DEV_TAB_SEG_7:
    1924         {
    1925             uint8_t const offDevTabSeg = (off - IOMMU_MMIO_OFF_DEV_TAB_SEG_FIRST) >> 3;
    1926             uint8_t const idxDevTabSeg = offDevTabSeg + 1;
    1927             Assert(idxDevTabSeg < RT_ELEMENTS(pThis->aDevTabBaseAddrs));
    1928             uReg = pThis->aDevTabBaseAddrs[idxDevTabSeg].u64;
    1929             break;
    1930         }
    1931 
    1932         case IOMMU_MMIO_OFF_DEV_SPECIFIC_FEAT:        uReg = pThis->DevSpecificFeat.u64;        break;
    1933         case IOMMU_MMIO_OFF_DEV_SPECIFIC_CTRL:        uReg = pThis->DevSpecificCtrl.u64;        break;
    1934         case IOMMU_MMIO_OFF_DEV_SPECIFIC_STATUS:      uReg = pThis->DevSpecificStatus.u64;      break;
    1935 
    1936         case IOMMU_MMIO_OFF_MSI_VECTOR_0:             uReg = pThis->MiscInfo.u64;               break;
    1937         case IOMMU_MMIO_OFF_MSI_VECTOR_1:             uReg = pThis->MiscInfo.au32[1];           break;
    1938         case IOMMU_MMIO_OFF_MSI_CAP_HDR:
    1939         {
    1940             uint32_t const uMsiCapHdr = PDMPciDevGetDWord(pPciDev, IOMMU_PCI_OFF_MSI_CAP_HDR);
    1941             uint32_t const uMsiAddrLo = PDMPciDevGetDWord(pPciDev, IOMMU_PCI_OFF_MSI_ADDR_LO);
    1942             uReg = RT_MAKE_U64(uMsiCapHdr, uMsiAddrLo);
    1943             break;
    1944         }
    1945         case IOMMU_MMIO_OFF_MSI_ADDR_LO:
    1946         {
    1947             uReg = PDMPciDevGetDWord(pPciDev, IOMMU_PCI_OFF_MSI_ADDR_LO);
    1948             break;
    1949         }
    1950         case IOMMU_MMIO_OFF_MSI_ADDR_HI:
    1951         {
    1952             uint32_t const uMsiAddrHi = PDMPciDevGetDWord(pPciDev, IOMMU_PCI_OFF_MSI_ADDR_HI);
    1953             uint32_t const uMsiData   = PDMPciDevGetDWord(pPciDev, IOMMU_PCI_OFF_MSI_DATA);
    1954             uReg = RT_MAKE_U64(uMsiAddrHi, uMsiData);
    1955             break;
    1956         }
    1957         case IOMMU_MMIO_OFF_MSI_DATA:
    1958         {
    1959             uReg = PDMPciDevGetDWord(pPciDev, IOMMU_PCI_OFF_MSI_DATA);
    1960             break;
    1961         }
    1962         case IOMMU_MMIO_OFF_MSI_MAPPING_CAP_HDR:
    1963         {
    1964             /*
    1965              * The PCI spec. lists MSI Mapping Capability 08H as related to HyperTransport capability.
    1966              * The AMD IOMMU spec. fails to mention it explicitly and lists values for this register as
    1967              * though HyperTransport is supported. We don't support HyperTransport, we thus just return
    1968              * 0 for this register.
    1969              */
    1970             uReg = RT_MAKE_U64(0, pThis->PerfOptCtrl.u32);
    1971             break;
    1972         }
    1973 
    1974         case IOMMU_MMIO_OFF_PERF_OPT_CTRL:            uReg = pThis->PerfOptCtrl.u32;            break;
    1975 
    1976         case IOMMU_MMIO_OFF_XT_GEN_INTR_CTRL:         uReg = pThis->XtGenIntrCtrl.u64;          break;
    1977         case IOMMU_MMIO_OFF_XT_PPR_INTR_CTRL:         uReg = pThis->XtPprIntrCtrl.u64;          break;
    1978         case IOMMU_MMIO_OFF_XT_GALOG_INT_CTRL:        uReg = pThis->XtGALogIntrCtrl.u64;        break;
    1979 
    1980         case IOMMU_MMIO_OFF_MARC_APER_BAR_0:          uReg = pThis->aMarcApers[0].Base.u64;     break;
    1981         case IOMMU_MMIO_OFF_MARC_APER_RELOC_0:        uReg = pThis->aMarcApers[0].Reloc.u64;    break;
    1982         case IOMMU_MMIO_OFF_MARC_APER_LEN_0:          uReg = pThis->aMarcApers[0].Length.u64;   break;
    1983         case IOMMU_MMIO_OFF_MARC_APER_BAR_1:          uReg = pThis->aMarcApers[1].Base.u64;     break;
    1984         case IOMMU_MMIO_OFF_MARC_APER_RELOC_1:        uReg = pThis->aMarcApers[1].Reloc.u64;    break;
    1985         case IOMMU_MMIO_OFF_MARC_APER_LEN_1:          uReg = pThis->aMarcApers[1].Length.u64;   break;
    1986         case IOMMU_MMIO_OFF_MARC_APER_BAR_2:          uReg = pThis->aMarcApers[2].Base.u64;     break;
    1987         case IOMMU_MMIO_OFF_MARC_APER_RELOC_2:        uReg = pThis->aMarcApers[2].Reloc.u64;    break;
    1988         case IOMMU_MMIO_OFF_MARC_APER_LEN_2:          uReg = pThis->aMarcApers[2].Length.u64;   break;
    1989         case IOMMU_MMIO_OFF_MARC_APER_BAR_3:          uReg = pThis->aMarcApers[3].Base.u64;     break;
    1990         case IOMMU_MMIO_OFF_MARC_APER_RELOC_3:        uReg = pThis->aMarcApers[3].Reloc.u64;    break;
    1991         case IOMMU_MMIO_OFF_MARC_APER_LEN_3:          uReg = pThis->aMarcApers[3].Length.u64;   break;
    1992 
    1993         case IOMMU_MMIO_OFF_RSVD_REG:                 uReg = pThis->RsvdReg;                    break;
    1994 
    1995         case IOMMU_MMIO_OFF_CMD_BUF_HEAD_PTR:         uReg = pThis->CmdBufHeadPtr.u64;          break;
    1996         case IOMMU_MMIO_OFF_CMD_BUF_TAIL_PTR:         uReg = pThis->CmdBufTailPtr.u64;          break;
    1997         case IOMMU_MMIO_OFF_EVT_LOG_HEAD_PTR:         uReg = pThis->EvtLogHeadPtr.u64;          break;
    1998         case IOMMU_MMIO_OFF_EVT_LOG_TAIL_PTR:         uReg = pThis->EvtLogTailPtr.u64;          break;
    1999 
    2000         case IOMMU_MMIO_OFF_STATUS:                   uReg = pThis->Status.u64;                 break;
    2001 
    2002         case IOMMU_MMIO_OFF_PPR_LOG_HEAD_PTR:         uReg = pThis->PprLogHeadPtr.u64;          break;
    2003         case IOMMU_MMIO_OFF_PPR_LOG_TAIL_PTR:         uReg = pThis->PprLogTailPtr.u64;          break;
    2004 
    2005         case IOMMU_MMIO_OFF_GALOG_HEAD_PTR:           uReg = pThis->GALogHeadPtr.u64;           break;
    2006         case IOMMU_MMIO_OFF_GALOG_TAIL_PTR:           uReg = pThis->GALogTailPtr.u64;           break;
    2007 
    2008         case IOMMU_MMIO_OFF_PPR_LOG_B_HEAD_PTR:       uReg = pThis->PprLogBHeadPtr.u64;         break;
    2009         case IOMMU_MMIO_OFF_PPR_LOG_B_TAIL_PTR:       uReg = pThis->PprLogBTailPtr.u64;         break;
    2010 
    2011         case IOMMU_MMIO_OFF_EVT_LOG_B_HEAD_PTR:       uReg = pThis->EvtLogBHeadPtr.u64;         break;
    2012         case IOMMU_MMIO_OFF_EVT_LOG_B_TAIL_PTR:       uReg = pThis->EvtLogBTailPtr.u64;         break;
    2013 
    2014         case IOMMU_MMIO_OFF_PPR_LOG_AUTO_RESP:        uReg = pThis->PprLogAutoResp.u64;         break;
    2015         case IOMMU_MMIO_OFF_PPR_LOG_OVERFLOW_EARLY:   uReg = pThis->PprLogOverflowEarly.u64;    break;
    2016         case IOMMU_MMIO_OFF_PPR_LOG_B_OVERFLOW_EARLY: uReg = pThis->PprLogBOverflowEarly.u64;   break;
    2017 
    2018         /* Not implemented. */
    2019         case IOMMU_MMIO_OFF_SMI_FLT_FIRST:
    2020         case IOMMU_MMIO_OFF_SMI_FLT_LAST:
    2021         {
    2022             LogFunc(("Reading unsupported register: SMI filter %u\n", (off - IOMMU_MMIO_OFF_SMI_FLT_FIRST) >> 3));
    2023             uReg = 0;
    2024             break;
    2025         }
    2026 
    2027         /* Unknown. */
    2028         default:
    2029         {
    2030             LogFunc(("Reading unknown register %u (%#x) -> 0\n", off, off));
    2031             uReg = 0;
    2032             return VINF_IOM_MMIO_UNUSED_00;
    2033         }
    2034     }
    2035 
    2036     *puResult = uReg;
    2037     return VINF_SUCCESS;
    2038 #else
    2039     NOREF(pPciDev);
     1698    PDMPCIDEV_ASSERT_VALID(pDevIns, pPciDev); NOREF(pPciDev);
     1699
     1700    Log4Func(("off=%#x\n", off));
     1701
    20401702    PCIOMMUREGACC pReg = iommuAmdGetRegAccessForOffset(off);
    20411703    if (pReg)
     
    20801742
    20811743    return rcStrict;
    2082 #endif
    20831744}
    20841745
     
    37793440                if (RT_UNLIKELY(pThread->enmState != PDMTHREADSTATE_RUNNING))
    37803441                    break;
    3781                 Log5Func(("Woken up with rc=%Rrc\n", rc));
     3442                Log4Func(("Woken up with rc=%Rrc\n", rc));
    37823443                ASMAtomicWriteBool(&pThis->fCmdThreadSignaled, false);
    37833444            }
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