Changeset 71611 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Apr 2, 2018 12:08:09 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 121638
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
r71607 r71611 1950 1950 */ 1951 1951 case VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE: 1952 if (VBoxVBVAExHSIsEnabled(&pVdma->CmdVbva)) 1953 { 1954 if (pVdma->CrSrvInfo.pfnGuestCtl) 1955 return pVdma->CrSrvInfo.pfnGuestCtl(pVdma->CrSrvInfo.hSvr, 1956 (uint8_t RT_UNTRUSTED_VOLATILE_GUEST *)pCmd->u.cmd.pvCmd, 1957 pCmd->u.cmd.cbCmd); 1958 1959 /* Unexpected. */ 1960 WARN(("VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE in HGCM-less mode\n")); 1961 } 1962 else 1963 WARN(("VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE for disabled vdma VBVA\n")); 1964 return VERR_INVALID_STATE; 1952 ASSERT_GUEST_LOGREL_RETURN(VBoxVBVAExHSIsEnabled(&pVdma->CmdVbva), VERR_INVALID_STATE); 1953 ASSERT_GUEST_LOGREL_RETURN(pVdma->CrSrvInfo.pfnGuestCtl, VERR_INVALID_STATE); 1954 return pVdma->CrSrvInfo.pfnGuestCtl(pVdma->CrSrvInfo.hSvr, 1955 (uint8_t RT_UNTRUSTED_VOLATILE_GUEST *)pCmd->u.cmd.pvCmd, 1956 pCmd->u.cmd.cbCmd); 1965 1957 1966 1958 /* … … 1968 1960 */ 1969 1961 case VBVAEXHOSTCTL_TYPE_GHH_RESIZE: 1970 if (VBoxVBVAExHSIsEnabled(&pVdma->CmdVbva)) 1962 { 1963 ASSERT_GUEST_RETURN(VBoxVBVAExHSIsEnabled(&pVdma->CmdVbva), VERR_INVALID_STATE); 1964 uint32_t cbCmd = pCmd->u.cmd.cbCmd; 1965 ASSERT_GUEST_LOGREL_MSG_RETURN( !(cbCmd % sizeof(VBOXCMDVBVA_RESIZE_ENTRY)) 1966 && cbCmd > 0, 1967 ("cbCmd=%#x\n", cbCmd), VERR_INVALID_PARAMETER); 1968 1969 uint32_t const cElements = cbCmd / sizeof(VBOXCMDVBVA_RESIZE_ENTRY); 1970 VBOXCMDVBVA_RESIZE RT_UNTRUSTED_VOLATILE_GUEST *pResize 1971 = (VBOXCMDVBVA_RESIZE RT_UNTRUSTED_VOLATILE_GUEST *)pCmd->u.cmd.pvCmd; 1972 for (uint32_t i = 0; i < cElements; ++i) 1971 1973 { 1972 uint32_t cbCmd = pCmd->u.cmd.cbCmd; 1973 if ( !(cbCmd % sizeof(VBOXCMDVBVA_RESIZE_ENTRY)) 1974 && cbCmd > 0) 1975 { 1976 uint32_t cElements = cbCmd / sizeof(VBOXCMDVBVA_RESIZE_ENTRY); 1977 VBOXCMDVBVA_RESIZE RT_UNTRUSTED_VOLATILE_GUEST *pResize 1978 = (VBOXCMDVBVA_RESIZE RT_UNTRUSTED_VOLATILE_GUEST *)pCmd->u.cmd.pvCmd; 1979 for (uint32_t i = 0; i < cElements; ++i) 1980 { 1981 VBOXCMDVBVA_RESIZE_ENTRY RT_UNTRUSTED_VOLATILE_GUEST *pEntry = &pResize->aEntries[i]; 1982 int rc = vboxVDMACrGuestCtlResizeEntryProcess(pVdma, pEntry); 1983 if (RT_FAILURE(rc)) 1984 { 1985 WARN(("vboxVDMACrGuestCtlResizeEntryProcess failed %Rrc\n", rc)); 1986 return rc; 1987 } 1988 } 1989 return VINF_SUCCESS; 1990 } 1991 else 1992 WARN(("invalid buffer size: cbCmd=%#x\n", cbCmd)); 1993 return VERR_INVALID_PARAMETER; 1974 VBOXCMDVBVA_RESIZE_ENTRY RT_UNTRUSTED_VOLATILE_GUEST *pEntry = &pResize->aEntries[i]; 1975 int rc = vboxVDMACrGuestCtlResizeEntryProcess(pVdma, pEntry); 1976 ASSERT_GUEST_LOGREL_MSG_RC_RETURN(rc, ("vboxVDMACrGuestCtlResizeEntryProcess failed for #%u: %Rrc\n", i, rc), rc); 1994 1977 } 1995 WARN(("VBVAEXHOSTCTL_TYPE_GHH_RESIZE for disabled vdma VBVA\n"));1996 return VERR_INVALID_STATE;1978 return VINF_SUCCESS; 1979 } 1997 1980 1998 1981 /* … … 2002 1985 case VBVAEXHOSTCTL_TYPE_GHH_ENABLE_PAUSED: 2003 1986 { 1987 ASSERT_GUEST(pCmd->u.cmd.cbCmd == sizeof(VBVAENABLE)); 1988 2004 1989 VBVAENABLE RT_UNTRUSTED_VOLATILE_GUEST *pEnable = (VBVAENABLE RT_UNTRUSTED_VOLATILE_GUEST *)pCmd->u.cmd.pvCmd; 2005 Assert(pCmd->u.cmd.cbCmd == sizeof(VBVAENABLE));2006 2007 1990 uint32_t const u32Offset = pEnable->u32Offset; 2008 1991 RT_UNTRUSTED_NONVOLATILE_COPY_FENCE(); 2009 1992 2010 1993 int rc = vdmaVBVAEnableProcess(pVdma, u32Offset); 2011 if (RT_SUCCESS(rc)) 1994 ASSERT_GUEST_MSG_RC_RETURN(rc, ("vdmaVBVAEnableProcess -> %Rrc\n", rc), rc); 1995 1996 if (enmType == VBVAEXHOSTCTL_TYPE_GHH_ENABLE_PAUSED) 2012 1997 { 2013 if (enmType != VBVAEXHOSTCTL_TYPE_GHH_ENABLE_PAUSED)2014 return VINF_SUCCESS;2015 2016 1998 rc = VBoxVBVAExHPPause(&pVdma->CmdVbva); 2017 if (RT_SUCCESS(rc)) 2018 return VINF_SUCCESS; 2019 WARN(("VBoxVBVAExHPPause failed %Rrc\n", rc)); 1999 ASSERT_GUEST_MSG_RC_RETURN(rc, ("VBoxVBVAExHPPause -> %Rrc\n", rc), rc); 2020 2000 } 2021 else 2022 WARN(("vdmaVBVAEnableProcess failed %Rrc\n", rc)); 2023 return rc; 2001 return VINF_SUCCESS; 2024 2002 } 2025 2003 … … 2030 2008 { 2031 2009 int rc = vdmaVBVADisableProcess(pVdma, true /* fDoHgcmEnable */); 2032 if (RT_FAILURE(rc)) 2033 { 2034 WARN(("vdmaVBVADisableProcess failed %Rrc\n", rc)); 2035 return rc; 2036 } 2010 ASSERT_GUEST_MSG_RC_RETURN(rc, ("vdmaVBVADisableProcess -> %Rrc\n", rc), rc); 2037 2011 2038 2012 /* do vgaUpdateDisplayAll right away */ … … 2044 2018 2045 2019 default: 2046 WARN(("unexpected ctl type %Rrc\n", pCmd->enmType));2020 ASSERT_GUEST_LOGREL_MSG_FAILED(("unexpected ctl type %d\n", enmType)); 2047 2021 return VERR_INVALID_PARAMETER; 2048 2022 } … … 2184 2158 * @thread VDMA 2185 2159 */ 2186 static int8_t vboxVDMACrCmdVbvaProcessCmdData(struct VBOXVDMAHOST *pVdma, const VBOXCMDVBVA_HDR RT_UNTRUSTED_VOLATILE_GUEST *pCmd,2187 uint32_t cbCmd)2160 static int8_t vboxVDMACrCmdVbvaProcessCmdData(struct VBOXVDMAHOST *pVdma, 2161 const VBOXCMDVBVA_HDR RT_UNTRUSTED_VOLATILE_GUEST *pCmd, uint32_t cbCmd) 2188 2162 { 2189 2163 uint8_t bOpCode = pCmd->u8OpCode;
Note:
See TracChangeset
for help on using the changeset viewer.