VirtualBox

Changeset 36400 in vbox


Ignore:
Timestamp:
Mar 24, 2011 1:14:26 PM (14 years ago)
Author:
vboxsync
Message:

PCI: work on IOMMU notifications

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/rawpci.h

    r36340 r36400  
    2727#define ___VBox_rawpci_h
    2828
    29 #include <iprt/types.h>
     29#include <VBox/types.h>
     30#include <VBox/sup.h>
    3031
    3132RT_C_DECLS_BEGIN
     
    3536 */
    3637typedef uint32_t PCIRAWDEVHANDLE;
     38
     39/**
     40 * Physical memory action enumeration.
     41 */
     42typedef enum PCIRAWMEMINFOACTION
     43{
     44    /* Pages mapped. */
     45    PCIRAW_MEMINFO_MAP,
     46    /* Pages unmapped. */
     47    PCIRAW_MEMINFO_UNMAP,
     48    /** The usual 32-bit type blow up. */
     49    PCIRAW_MEMINFO_32BIT_HACK = 0x7fffffff
     50} PCIRAWMEMINFOACTION;
     51
     52/**
     53 * Callback to notify raw PCI subsystem about mapping/unmapping of
     54 * host pages to the guest. Typical usecase is to register physical
     55 * RAM pages with IOMMU, so that it could allow DMA for PCI devices
     56 * directly from the guest RAM.
     57 * Region shall be one or more contigous (both host and guest) pages
     58 * of physical memory. 
     59 *
     60 * @param   pVM           VM pointer.
     61 * @param   HostStart     Physical address of region start on the host. 
     62 * @param   GuestStart    Physical address of region start on the guest.
     63 * @param   cMemSize      Region size in bytes.
     64 * @param   Action        Action performed.
     65
     66 */
     67typedef DECLCALLBACK(void) FNRAWPCICONTIGPHYSMEMINFO(PVM pVM, RTHCPHYS HostStart, RTGCPHYS GuestStart, uint64_t cMemSize, PCIRAWMEMINFOACTION Action);
     68typedef FNRAWPCICONTIGPHYSMEMINFO *PFNRAWPCICONTIGPHYSMEMINFO;
    3769
    3870/** Data being part of the VM structure. */
     
    4072{
    4173    /* Shall only be interpreted by the host PCI driver. */
    42     RTR0PTR  pDriverData;
     74    RTR0PTR                     pDriverData;
     75    /* Callback called when mapping of host pages to the guest changes. */
     76    PFNRAWPCICONTIGPHYSMEMINFO  pfnContigMemInfo;
    4377} RAWPCIVM;
    4478typedef RAWPCIVM *PRAWPCIVM;
  • trunk/src/VBox/HostDrivers/VBoxPci/VBoxPci.c

    r36340 r36400  
    8383
    8484DECLINLINE(void) vboxPciDevUnlock(PVBOXRAWPCIINS pThis)
     85{
     86    RTSemFastMutexRelease(pThis->hFastMtx);
     87}
     88
     89DECLINLINE(int) vboxPciVmLock(PVBOXRAWPCIDRVVM pThis)
     90{
     91    int rc = RTSemFastMutexRequest(pThis->hFastMtx);
     92    AssertRC(rc);
     93    return rc;
     94}
     95
     96DECLINLINE(void) vboxPciVmUnlock(PVBOXRAWPCIDRVVM pThis)
    8597{
    8698    RTSemFastMutexRelease(pThis->hFastMtx);
     
    380392
    381393    rc = vboxPciOsDevPowerStateChange(pThis, aState);
    382    
     394
    383395    vboxPciDevUnlock(pThis);
    384396
  • trunk/src/VBox/HostDrivers/VBoxPci/VBoxPciInternal.h

    r36343 r36400  
    100100#ifdef RT_OS_LINUX
    101101# ifdef VBOX_WITH_IOMMU
    102     struct iommu_domain* iommu_domain;
     102    struct iommu_domain* pIommuDomain;
    103103# endif
    104104#endif
     105    int32_t        fFlags;
    105106} VBOXRAWPCIDRVVM;
    106107
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r36260 r36400  
    509509
    510510    if (assignments.size() > 0)
     511    {
    511512        InsertConfigNode(pDevices,     "pciraw",  &pPciDevs);
     513
     514        /*
     515         * Currently, using IOMMU needed for PCI passthrough
     516         * requires RAM preallocation.
     517         * @todo: check if we can lift this requirement
     518         */
     519        PCFGMNODE pRoot = CFGMR3GetParent(pDevices);
     520        Assert(pRoot);
     521        CFGMR3RemoveValue(pRoot, "RamPreAlloc");
     522        CFGMR3InsertInteger(pRoot, "RamPreAlloc",    1);
     523    }
    512524
    513525    for (size_t iDev = 0; iDev < assignments.size(); iDev++)
  • trunk/src/VBox/VMM/VMMR0/GMMR0.cpp

    r35917 r36400  
    151151*******************************************************************************/
    152152#define LOG_GROUP LOG_GROUP_GMM
     153#include <VBox/rawpci.h>
    153154#include <VBox/vmm/vm.h>
    154155#include <VBox/vmm/gmm.h>
     
    20922093                                    pPage->Private.pfn = GMM_PAGE_PFN_UNSHAREABLE;
    20932094                                /* else: NIL_RTHCPHYS nothing */
     2095#if 0
     2096#ifdef VBOX_WITH_PCI_PASSTHROUGH
     2097                                if (pVM->rawpci.s.pfnContigMemInfo)
     2098                                    pVM->rawpci.s.pfnContigMemInfo(pVM, paPages[iPage].HCPhysGCPhys, 0, PAGE_SIZE, PCIRAW_MEMINFO_MAP);
     2099#endif
     2100#endif
    20942101
    20952102                                paPages[iPage].idPage = NIL_GMM_PAGEID;
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