Changeset 87371 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Jan 22, 2021 2:42:17 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 142356
- Location:
- trunk/src/VBox/VMM/VMMR3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
r87127 r87371 1831 1831 Assert(idxBus < RT_ELEMENTS(pVM->pdm.s.aPciBuses)); 1832 1832 PPDMPCIBUS pBus = &pVM->pdm.s.aPciBuses[idxBus]; 1833 1834 RTGCPHYS GCPhysOut;1835 1833 uint16_t const uDevId = PCIBDF_MAKE(pBus->iBus, pPciDev->uDevFn); 1836 int rc = pIommu->pfnMemAccess(pDevInsIommu, uDevId, GCPhys, cbRead, PDMIOMMU_MEM_F_READ, &GCPhysOut); 1837 if (RT_SUCCESS(rc)) 1838 GCPhys = GCPhysOut; 1839 else 1834 int rc = VINF_SUCCESS; 1835 while (cbRead > 0) 1840 1836 { 1841 Log(("pdmR3DevHlp_PCIPhysRead: IOMMU translation failed. uDevId=%#x GCPhys=%#RGp cb=%u rc=%Rrc\n", uDevId, GCPhys, 1842 cbRead, rc)); 1843 return rc; 1837 RTGCPHYS GCPhysOut; 1838 size_t cbContig; 1839 rc = pIommu->pfnMemAccess(pDevInsIommu, uDevId, GCPhys, cbRead, PDMIOMMU_MEM_F_READ, &GCPhysOut, &cbContig); 1840 if (RT_SUCCESS(rc)) 1841 { 1842 /** @todo Handle strict return codes from PGMPhysRead. */ 1843 rc = pDevIns->pHlpR3->pfnPhysRead(pDevIns, GCPhysOut, pvBuf, cbContig, fFlags); 1844 if (RT_SUCCESS(rc)) 1845 { 1846 cbRead -= cbContig; 1847 pvBuf = (void *)((uintptr_t)pvBuf + cbContig); 1848 GCPhys += cbContig; 1849 } 1850 else 1851 break; 1852 } 1853 else 1854 { 1855 AssertMsgFailed(("Here\n")); 1856 Log(("pdmR3DevHlp_PCIPhysRead: IOMMU translation failed. uDevId=%#x GCPhys=%#RGp cb=%u rc=%Rrc\n", uDevId, GCPhys, 1857 cbRead, rc)); 1858 break; 1859 } 1844 1860 } 1861 return rc; 1845 1862 } 1846 1863 #endif … … 1885 1902 Assert(idxBus < RT_ELEMENTS(pVM->pdm.s.aPciBuses)); 1886 1903 PPDMPCIBUS pBus = &pVM->pdm.s.aPciBuses[idxBus]; 1887 1888 RTGCPHYS GCPhysOut;1889 1904 uint16_t const uDevId = PCIBDF_MAKE(pBus->iBus, pPciDev->uDevFn); 1890 int rc = pIommu->pfnMemAccess(pDevInsIommu, uDevId, GCPhys, cbWrite, PDMIOMMU_MEM_F_WRITE, &GCPhysOut); 1891 if (RT_SUCCESS(rc)) 1892 GCPhys = GCPhysOut; 1893 else 1905 int rc = VINF_SUCCESS; 1906 while (cbWrite > 0) 1894 1907 { 1895 Log(("pdmR3DevHlp_PCIPhysWrite: IOMMU translation failed. uDevId=%#x GCPhys=%#RGp cb=%u rc=%Rrc\n", uDevId, GCPhys, 1896 cbWrite, rc)); 1897 return rc; 1908 RTGCPHYS GCPhysOut; 1909 size_t cbContig; 1910 rc = pIommu->pfnMemAccess(pDevInsIommu, uDevId, GCPhys, cbWrite, PDMIOMMU_MEM_F_WRITE, &GCPhysOut, &cbContig); 1911 if (RT_SUCCESS(rc)) 1912 { 1913 /** @todo Handle strict return codes from PGMPhysWrite. */ 1914 rc = pDevIns->pHlpR3->pfnPhysWrite(pDevIns, GCPhysOut, pvBuf, cbContig, fFlags); 1915 if (RT_SUCCESS(rc)) 1916 { 1917 cbWrite -= cbContig; 1918 pvBuf = (const void *)((uintptr_t)pvBuf + cbContig); 1919 GCPhys += cbContig; 1920 } 1921 else 1922 break; 1923 } 1924 else 1925 { 1926 Log(("pdmR3DevHlp_PCIPhysWrite: IOMMU translation failed. uDevId=%#x GCPhys=%#RGp cb=%u rc=%Rrc\n", uDevId, GCPhys, 1927 cbWrite, rc)); 1928 break; 1929 } 1898 1930 } 1931 return rc; 1899 1932 } 1900 1933 #endif … … 1936 1969 Assert(idxBus < RT_ELEMENTS(pVM->pdm.s.aPciBuses)); 1937 1970 PPDMPCIBUS pBus = &pVM->pdm.s.aPciBuses[idxBus]; 1938 1971 uint16_t const uDevId = PCIBDF_MAKE(pBus->iBus, pPciDev->uDevFn); 1939 1972 RTGCPHYS GCPhysOut; 1940 uint16_t const uDevId = PCIBDF_MAKE(pBus->iBus, pPciDev->uDevFn); 1941 int rc = pIommu->pfnMemAccess(pDevInsIommu, uDevId, GCPhys, X86_PAGE_SIZE, PDMIOMMU_MEM_F_WRITE, &GCPhysOut); 1973 size_t cbContig; 1974 int rc = pIommu->pfnMemAccess(pDevInsIommu, uDevId, GCPhys & X86_PAGE_BASE_MASK, X86_PAGE_SIZE, PDMIOMMU_MEM_F_WRITE, 1975 &GCPhysOut, &cbContig); 1942 1976 if (RT_SUCCESS(rc)) 1977 { 1943 1978 GCPhys = GCPhysOut; 1979 Assert(cbContig == X86_PAGE_SIZE); 1980 } 1944 1981 else 1945 1982 { … … 1986 2023 Assert(idxBus < RT_ELEMENTS(pVM->pdm.s.aPciBuses)); 1987 2024 PPDMPCIBUS pBus = &pVM->pdm.s.aPciBuses[idxBus]; 1988 2025 uint16_t const uDevId = PCIBDF_MAKE(pBus->iBus, pPciDev->uDevFn); 1989 2026 RTGCPHYS GCPhysOut; 1990 uint16_t const uDevId = PCIBDF_MAKE(pBus->iBus, pPciDev->uDevFn); 1991 int rc = pIommu->pfnMemAccess(pDevInsIommu, uDevId, GCPhys, X86_PAGE_SIZE, PDMIOMMU_MEM_F_READ, &GCPhysOut); 2027 size_t cbContig; 2028 int rc = pIommu->pfnMemAccess(pDevInsIommu, uDevId, GCPhys & X86_PAGE_BASE_MASK, X86_PAGE_SIZE, PDMIOMMU_MEM_F_READ, 2029 &GCPhysOut, &cbContig); 1992 2030 if (RT_SUCCESS(rc)) 2031 { 1993 2032 GCPhys = GCPhysOut; 2033 Assert(cbContig == X86_PAGE_SIZE); 2034 } 1994 2035 else 1995 2036 { -
trunk/src/VBox/VMM/VMMR3/PDMDevHlpTracing.cpp
r86661 r87371 429 429 Assert(idxBus < RT_ELEMENTS(pVM->pdm.s.aPciBuses)); 430 430 PPDMPCIBUS pBus = &pVM->pdm.s.aPciBuses[idxBus]; 431 432 RTGCPHYS GCPhysOut;433 431 uint16_t const uDevId = PCIBDF_MAKE(pBus->iBus, pPciDev->uDevFn); 434 int rc = pIommu->pfnMemAccess(pDevInsIommu, uDevId, GCPhys, cbRead, PDMIOMMU_MEM_F_READ, &GCPhysOut); 435 if (RT_SUCCESS(rc)) 436 GCPhys = GCPhysOut; 437 else 432 int rc = VINF_SUCCESS; 433 while (cbRead > 0) 438 434 { 439 Log(("pdmR3DevHlp_PCIPhysRead: IOMMU translation failed. uDevId=%#x GCPhys=%#RGp cb=%u rc=%Rrc\n", uDevId, GCPhys, 440 cbRead, rc)); 441 return rc; 435 RTGCPHYS GCPhysOut; 436 size_t cbContig; 437 rc = pIommu->pfnMemAccess(pDevInsIommu, uDevId, GCPhys, cbRead, PDMIOMMU_MEM_F_READ, &GCPhysOut, &cbContig); 438 if (RT_SUCCESS(rc)) 439 { 440 /** @todo Handle strict return codes from PGMPhysRead. */ 441 rc = pDevIns->pHlpR3->pfnPhysRead(pDevIns, GCPhysOut, pvBuf, cbRead, fFlags); 442 if (RT_SUCCESS(rc)) 443 { 444 cbRead -= cbContig; 445 pvBuf = (void *)((uintptr_t)pvBuf + cbContig); 446 GCPhys += cbContig; 447 } 448 else 449 break; 450 } 451 else 452 { 453 Log(("pdmR3DevHlp_PCIPhysRead: IOMMU translation failed. uDevId=%#x GCPhys=%#RGp cb=%u rc=%Rrc\n", uDevId, GCPhys, 454 cbRead, rc)); 455 break; 456 } 442 457 } 443 444 GCPhys = GCPhysOut; 458 return rc; 445 459 } 446 460 #endif … … 485 499 Assert(idxBus < RT_ELEMENTS(pVM->pdm.s.aPciBuses)); 486 500 PPDMPCIBUS pBus = &pVM->pdm.s.aPciBuses[idxBus]; 487 488 RTGCPHYS GCPhysOut;489 501 uint16_t const uDevId = PCIBDF_MAKE(pBus->iBus, pPciDev->uDevFn); 490 int rc = pIommu->pfnMemAccess(pDevInsIommu, uDevId, GCPhys, cbWrite, PDMIOMMU_MEM_F_WRITE, & GCPhysOut); 491 if (RT_SUCCESS(rc)) 492 GCPhys = GCPhysOut; 493 else 502 int rc = VINF_SUCCESS; 503 while (cbWrite > 0) 494 504 { 495 Log(("pdmR3DevHlp_PCIPhysRead: IOMMU translation failed. uDevId=%#x GCPhys=%#RGp cb=%u rc=%Rrc\n", uDevId, GCPhys, 496 cbWrite, rc)); 497 return rc; 505 RTGCPHYS GCPhysOut; 506 size_t cbContig; 507 rc = pIommu->pfnMemAccess(pDevInsIommu, uDevId, GCPhys, cbWrite, PDMIOMMU_MEM_F_WRITE, &GCPhysOut, &cbContig); 508 if (RT_SUCCESS(rc)) 509 { 510 /** @todo Handle strict return codes from PGMPhysWrite. */ 511 rc = pDevIns->pHlpR3->pfnPhysWrite(pDevIns, GCPhysOut, pvBuf, cbContig, fFlags); 512 if (RT_SUCCESS(rc)) 513 { 514 cbWrite -= cbContig; 515 pvBuf = (const void *)((uintptr_t)pvBuf + cbContig); 516 GCPhys += cbContig; 517 } 518 else 519 break; 520 } 521 else 522 { 523 Log(("pdmR3DevHlp_PCIPhysWrite: IOMMU translation failed. uDevId=%#x GCPhys=%#RGp cb=%u rc=%Rrc\n", uDevId, GCPhys, 524 cbWrite, rc)); 525 break; 526 } 498 527 } 499 500 GCPhys = GCPhysOut; 528 return rc; 501 529 } 502 530 #endif
Note:
See TracChangeset
for help on using the changeset viewer.