VirtualBox

Ignore:
Timestamp:
Apr 29, 2020 3:20:29 PM (5 years ago)
Author:
vboxsync
Message:

AMD IOMMU: bugref:9654 Bits.

File:
1 edited

Legend:

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

    r84075 r84086  
    18511851} IOMMU_STATUS_T;
    18521852AssertCompileSize(IOMMU_STATUS_T, 8);
     1853#define IOMMU_STATUS_VALID_MASK     UINT64_C(0x0000000000079fff)
     1854#define IOMMU_STATUS_RW1C_MASK      UINT64_C(0x0000000000068e67)
    18531855
    18541856/**
     
    27292731
    27302732
     2733/**
     2734 * Writes the Status Register (64-bit).
     2735 */
     2736static VBOXSTRICTRC iommuAmdStatus_w(PPDMDEVINS pDevIns, PIOMMU pThis, uint32_t iReg, uint64_t u64Value)
     2737{
     2738    RT_NOREF(pDevIns, iReg);
     2739
     2740    /* Mask out all unrecognized bits. */
     2741    u64Value &= IOMMU_STATUS_VALID_MASK;
     2742
     2743    /*
     2744     * Compute RW1C (read-only, write-1-to-clear) bits and preserve the rest (which are read-only).
     2745     * Writing 0 to an RW1C bit has no effect. Writing 1 to an RW1C bit, clears the bit if it's already 1.
     2746     */
     2747    IOMMU_STATUS_T const OldStatus = iommuAmdGetStatus(pThis);
     2748    uint64_t const fOldRw1cBits = (OldStatus.u64 &  IOMMU_STATUS_RW1C_MASK);
     2749    uint64_t const fOldRoBits   = (OldStatus.u64 & ~IOMMU_STATUS_RW1C_MASK);
     2750    uint64_t const fNewRw1cBits = (u64Value      &  IOMMU_STATUS_RW1C_MASK);
     2751
     2752    uint64_t const uNewStatus = (fOldRw1cBits & ~fNewRw1cBits) | fOldRoBits;
     2753
     2754    /* Update the register. */
     2755    ASMAtomicWriteU64(&pThis->Status.u64, uNewStatus);
     2756    return VINF_SUCCESS;
     2757}
     2758
     2759
    27312760#if 0
    27322761/**
     
    28432872        case IOMMU_MMIO_EVT_LOG_TAIL_PTR:        return iommuAmdEvtLogTailPtr_w(pDevIns, pThis, off, uValue);
    28442873
    2845         case IOMMU_MMIO_OFF_STATUS:
     2874        case IOMMU_MMIO_OFF_STATUS:              return iommuAmdStatus_w(pDevIns, pThis, off, uValue);
    28462875
    28472876        case IOMMU_MMIO_OFF_PPR_LOG_HEAD_PTR:
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