VirtualBox

Changeset 82199 in vbox


Ignore:
Timestamp:
Nov 25, 2019 8:54:14 PM (5 years ago)
Author:
vboxsync
Message:

DevVGA: The FIFO shouldn't be prefetchable. Workarounds for old saved state with non-prefetchable VRAM (VMSVGA). bugref:9218

Location:
trunk/src/VBox/Devices/Graphics
Files:
3 edited

Legend:

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

    r82127 r82199  
    52875287
    52885288    Log(("vmsvgaR3PciIORegionFifoMapUnmap: iRegion=%d GCPhysAddress=%RGp cb=%RGp enmType=%d\n", iRegion, GCPhysAddress, cb, enmType));
    5289     AssertReturn(iRegion == pThis->pciRegions.iFIFO && enmType == PCI_ADDRESS_SPACE_MEM_PREFETCH, VERR_INTERNAL_ERROR);
     5289    AssertReturn(   iRegion == pThis->pciRegions.iFIFO
     5290                 && (   enmType == PCI_ADDRESS_SPACE_MEM
     5291                     || (enmType == PCI_ADDRESS_SPACE_MEM_PREFETCH /* got wrong in 6.1.0RC1 */ && pThis->fStateLoaded))
     5292                 , VERR_INTERNAL_ERROR);
    52905293    if (GCPhysAddress != NIL_RTGCPHYS)
    52915294    {
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r82178 r82199  
    56125612    RT_NOREF(pPciDev, cb);
    56135613
    5614     AssertReturn(iRegion == pThis->pciRegions.iVRAM && enmType == PCI_ADDRESS_SPACE_MEM_PREFETCH, VERR_INTERNAL_ERROR);
     5614    AssertReturn(   iRegion == pThis->pciRegions.iVRAM
     5615                 && (   enmType == PCI_ADDRESS_SPACE_MEM_PREFETCH
     5616                     || (enmType == PCI_ADDRESS_SPACE_MEM && pThis->fVMSVGAEnabled && pThis->fStateLoaded))
     5617                 , VERR_INTERNAL_ERROR);
    56155618    Assert(pPciDev == pDevIns->apPciDevs[0]);
    56165619
     
    57245727        if (iRegion == pThis->pciRegions.iFIFO)
    57255728        {
    5726             /* Make sure it's still 32-bit memory.  Ignore fluxtuations in the prefetch flag */
     5729            /* Make sure it's still 32-bit memory.  Ignore fluxtuations in the prefetch flag. */
    57275730            AssertLogRelMsgReturn(!(enmType & (PCI_ADDRESS_SPACE_IO | PCI_ADDRESS_SPACE_BAR64)), ("enmType=%#x\n", enmType),
    57285731                                  VERR_VGA_UNEXPECTED_PCI_REGION_LOAD_CHANGE);
     
    57495752        }
    57505753
     5754        /*
     5755         * VRAM used to be non-prefetchable till 6.1.0, so we end up here when restoring
     5756         * states older than that with 6.1.0 and later.  We just have to check that
     5757         * the size and basic type matches, then return VINF_SUCCESS to ACK it.
     5758         */
     5759        if (iRegion == pThis->pciRegions.iVRAM)
     5760        {
     5761            /* Make sure it's still 32-bit memory.  Ignore fluxtuations in the prefetch flag. */
     5762            AssertLogRelMsgReturn(!(enmType & (PCI_ADDRESS_SPACE_IO | PCI_ADDRESS_SPACE_BAR64)), ("enmType=%#x\n", enmType),
     5763                                  VERR_VGA_UNEXPECTED_PCI_REGION_LOAD_CHANGE);
     5764            /* The size must be the same. */
     5765            AssertLogRelMsgReturn(cbRegion == pThis->vram_size,
     5766                                  ("cbRegion=%#RGp vram_size=%#x\n", cbRegion, pThis->vram_size),
     5767                                  VERR_SSM_LOAD_CONFIG_MISMATCH);
     5768            return VINF_SUCCESS;
     5769        }
     5770
    57515771        /* Emulate callbacks for 5.1 and older saved states by recursion. */
    57525772        if (iRegion == UINT32_MAX)
     
    58085828}
    58095829
     5830
    58105831/**
    58115832 * @callback_method_impl{FNSSMDEVSAVEDONE}
     
    58215842# endif
    58225843}
     5844
    58235845
    58245846/**
     
    58775899
    58785900/**
     5901 * @callback_method_impl{FNSSMDEVLOADPREP}
     5902 */
     5903static DECLCALLBACK(int) vgaR3LoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     5904{
     5905    PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
     5906    RT_NOREF(pSSM);
     5907    pThis->fStateLoaded = true;
     5908    return VINF_SUCCESS;
     5909}
     5910
     5911
     5912/**
    58795913 * @callback_method_impl{FNSSMDEVLOADEXEC}
    58805914 */
     
    58855919    PCPDMDEVHLPR3   pHlp    = pDevIns->pHlpR3;
    58865920    int             rc;
     5921
     5922    pThis->fStateLoaded = true;
    58875923
    58885924    if (uVersion < VGA_SAVEDSTATE_VERSION_ANCIENT || uVersion > VGA_SAVEDSTATE_VERSION)
     
    65876623
    65886624        rc = PDMDevHlpPCIIORegionCreateMmio2Ex(pDevIns, pThis->pciRegions.iFIFO, pThis->svga.cbFIFO,
    6589                                                PCI_ADDRESS_SPACE_MEM_PREFETCH, 0 /*fFlags*/, vmsvgaR3PciIORegionFifoMapUnmap,
     6625                                               PCI_ADDRESS_SPACE_MEM, 0 /*fFlags*/, vmsvgaR3PciIORegionFifoMapUnmap,
    65906626                                               "VMSVGA-FIFO", (void **)&pThisCC->svga.pau32FIFO, &pThis->hMmio2VmSvgaFifo);
    65916627        AssertRCReturn(rc, PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
     
    67966832                                NULL,          vgaR3LiveExec, NULL,
    67976833                                vgaR3SavePrep, vgaR3SaveExec, vgaR3SaveDone,
    6798                                 NULL,          vgaR3LoadExec, vgaR3LoadDone);
     6834                                vgaR3LoadPrep, vgaR3LoadExec, vgaR3LoadDone);
    67996835    AssertRCReturn(rc, rc);
    68006836
  • trunk/src/VBox/Devices/Graphics/DevVGA.h

    r82114 r82199  
    362362    /** Whether 3D is enabled for the VM. */
    363363    bool                        f3DEnabled;
     364    /** Set if state has been restored. */
     365    bool                        fStateLoaded;
    364366#ifdef VBOX_WITH_VMSVGA
    365367    /* Whether the SVGA emulation is enabled or not. */
     
    367369    bool                        fVMSVGAPciId;
    368370    bool                        fVMSVGAPciBarLayout;
    369     bool                        Padding4[4];
     371    bool                        Padding4[3];
    370372#else
    371     bool                        Padding4[3+4];
     373    bool                        Padding4[3+3];
    372374#endif
    373375
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