VirtualBox

Changeset 83712 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Apr 16, 2020 5:57:35 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
137222
Message:

AMD IOMMU: bugref:9654 Bits.

File:
1 edited

Legend:

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

    r83711 r83712  
    20722072
    20732073
     2074DECLINLINE(IOMMU_STATUS_T) iommuAmdGetStatus(PCIOMMU pThis)
     2075{
     2076    IOMMU_STATUS_T Status;
     2077    Status.u64 = ASMAtomicReadU64((volatile uint64_t *)&pThis->Status.u64);
     2078    return Status;
     2079}
     2080
     2081
    20742082/**
    20752083 * Logs if the buffer length is invalid.
     
    21312139{
    21322140    RT_NOREF(pDevIns, iReg);
     2141
     2142    /*
     2143     * IOMMU behavior is undefined when software writes this register when event logging is running.
     2144     * In our emulation, we ignore the write entirely.
     2145     * See AMD IOMMU spec. "Event Log Base Address Register".
     2146     */
     2147    IOMMU_STATUS_T const Status = iommuAmdGetStatus(pThis);
     2148    if (Status.n.u1EvtLogRunning)
     2149    {
     2150        Log((IOMMU_LOG_PFX ": Setting EvtLogBar (%#RX64) when event logging is running -> Ignored\n", u64Value));
     2151        return VINF_SUCCESS;
     2152    }
     2153
    21332154    pThis->EvtLogBaseAddr.u64 = u64Value & IOMMU_EVT_LOG_BAR_VALID_MASK;
    21342155    iommuAmdCheckBufferLength(pThis->EvtLogBaseAddr.n.u4EvtLen, __PRETTY_FUNCTION__);
     2156
     2157    /*
     2158     * Writing the event log base address, clears the event log head and tail pointers.
     2159     * See AMD spec. 2.5 "Event Logging".
     2160     */
     2161    pThis->EvtLogHeadPtr.u64 = 0;
     2162    pThis->EvtLogTailPtr.u64 = 0;
     2163
    21352164    return VINF_SUCCESS;
    21362165}
     
    22712300     * See AMD IOMMU spec. 3.3.13 "Command and Event Log Pointer Registers".
    22722301     */
    2273     IOMMU_STATUS_T const Status = pThis->Status;
     2302    IOMMU_STATUS_T const Status = iommuAmdGetStatus(pThis);
    22742303    if (Status.n.u1CmdBufRunning)
    22752304    {
     
    22882317    if (offBuf >= cbBuf)
    22892318    {
    2290         Log((IOMMU_LOG_PFX ": Setting CmdBufHeadPtr (%#RX32) to a value that exceeds buffer length -> Ignored\n", offBuf, cbBuf));
     2319        Log((IOMMU_LOG_PFX ": Setting CmdBufHeadPtr (%#RX32) to a value that exceeds buffer length (%#RX23) -> Ignored\n",
     2320             offBuf, cbBuf));
    22912321        return VINF_SUCCESS;
    22922322    }
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