VirtualBox

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


Ignore:
Timestamp:
Feb 13, 2019 1:57:14 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128819
Message:

DevVGA,PCI,PGM: Hacks for making it possible to load saved states of the VBoxSVGA device with the 'wrong' BAR layout. bugref:9359

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r77289 r77299  
    55555555static DECLCALLBACK(int) vgaR3PciRegionLoadChangeHook(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion,
    55565556                                                      uint64_t cbRegion, PCIADDRESSSPACE enmType,
    5557                                                       PFNPCIIOREGIONOLDSETTER pfnOldSetter)
     5557                                                      PFNPCIIOREGIONOLDSETTER pfnOldSetter, PFNPCIIOREGIONSWAP pfnSwapRegions)
    55585558{
    55595559    PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
    55605560
    55615561# ifdef VBOX_WITH_VMSVGA
    5562     /*
    5563      * The VMSVGA changed the default FIFO size from 128KB to 2MB after 5.1.
    5564      */
    55655562    if (pThis->fVMSVGAEnabled)
    55665563    {
     5564        /*
     5565         * We messed up BAR order for the hybrid devices in 6.0 (see #9359).
     5566         * It should have been compatible with the VBox VGA device and had the
     5567         * VRAM region first and I/O second, but instead the I/O region ended
     5568         * up first and VRAM second like the VMSVGA device.
     5569         *
     5570         * So, we have to detect that here and reconfigure the memory regions.
     5571         * Region numbers are used in our (and the PCI bus') interfaction with
     5572         * PGM, so PGM needs to be informed too.
     5573         */
     5574        if (   iRegion == 0
     5575            && iRegion == pThis->pciRegions.iVRAM
     5576            && (enmType & PCI_ADDRESS_SPACE_IO))
     5577        {
     5578            LogRel(("VGA: Detected old BAR config, making adjustments.\n"));
     5579
     5580            /* Update the entries. */
     5581            pThis->pciRegions.iIO   = 0;
     5582            pThis->pciRegions.iVRAM = 1;
     5583
     5584            /* Update PGM on the region number change so it won't barf when restoring state. */
     5585            AssertLogRelReturn(pDevIns->CTX_SUFF(pHlp)->pfnMMIOExChangeRegionNo, VERR_VERSION_MISMATCH);
     5586            int rc = pDevIns->CTX_SUFF(pHlp)->pfnMMIOExChangeRegionNo(pDevIns, pPciDev, 0, 1);
     5587            AssertLogRelRCReturn(rc, rc);
     5588
     5589            /* Update the calling PCI device. */
     5590            AssertLogRelReturn(pfnSwapRegions, VERR_INTERNAL_ERROR_2);
     5591            rc = pfnSwapRegions(pPciDev, 0, 1);
     5592            AssertLogRelRCReturn(rc, rc);
     5593
     5594            return rc;
     5595        }
     5596
     5597        /*
     5598         * The VMSVGA changed the default FIFO size from 128KB to 2MB after 5.1.
     5599         */
    55675600        if (iRegion == pThis->pciRegions.iFIFO)
    55685601        {
     
    55915624
    55925625        }
     5626
    55935627        /* Emulate callbacks for 5.1 and older saved states by recursion. */
    5594         else if (iRegion == UINT32_MAX)
     5628        if (iRegion == UINT32_MAX)
    55955629        {
    5596             int rc = vgaR3PciRegionLoadChangeHook(pDevIns, pPciDev, pThis->pciRegions.iFIFO, VMSVGA_FIFO_SIZE_OLD, PCI_ADDRESS_SPACE_MEM, NULL);
     5630            int rc = vgaR3PciRegionLoadChangeHook(pDevIns, pPciDev, pThis->pciRegions.iFIFO, VMSVGA_FIFO_SIZE_OLD,
     5631                                                  PCI_ADDRESS_SPACE_MEM, NULL, NULL);
    55975632            if (RT_SUCCESS(rc))
    55985633                rc = pfnOldSetter(pPciDev, pThis->pciRegions.iFIFO, VMSVGA_FIFO_SIZE_OLD, PCI_ADDRESS_SPACE_MEM);
     
    62596294    Log(("VMSVGA: VMSVGAPciId   = %d\n", pThis->fVMSVGAPciId));
    62606295
    6261     rc = CFGMR3QueryBoolDef(pCfg, "VMSVGAPciBarLayout", &pThis->fVMSVGAPciBarLayout, false);
     6296    rc = CFGMR3QueryBoolDef(pCfg, "VMSVGAPciBarLayout", &pThis->fVMSVGAPciBarLayout, pThis->fVMSVGAPciId);
    62626297    AssertLogRelRCReturn(rc, rc);
    62636298    Log(("VMSVGA: VMSVGAPciBarLayout = %d\n", pThis->fVMSVGAPciBarLayout));
     
    62826317        pThis->pciRegions.iIO   = 0;
    62836318        pThis->pciRegions.iVRAM = 1;
    6284         pThis->pciRegions.iFIFO = 2;
    62856319    }
    62866320    else
     
    62886322        pThis->pciRegions.iVRAM = 0;
    62896323        pThis->pciRegions.iIO   = 1;
    6290         pThis->pciRegions.iFIFO = 2;
    6291     }
     6324    }
     6325    pThis->pciRegions.iFIFO = 2;
    62926326#else
    62936327    pThis->pciRegions.iVRAM = 0;
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