VirtualBox

Changeset 34308 in vbox for trunk


Ignore:
Timestamp:
Nov 24, 2010 11:44:28 AM (14 years ago)
Author:
vboxsync
Message:

Main: PCI passthrough work

Location:
trunk/src/VBox/Main
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MachineImpl.cpp

    r34248 r34308  
    57295729
    57305730
     5731STDMETHODIMP Machine::AttachHostPciDevice(LONG hostAddress, LONG desiredGuestAddress, IContext *eventContext, BOOL tryToUnbind)
     5732{
     5733    return E_NOTIMPL;
     5734}
     5735
     5736STDMETHODIMP Machine::DetachHostPciDevice(LONG hostAddress)
     5737{
     5738    return E_NOTIMPL;
     5739}
     5740
     5741STDMETHODIMP Machine::COMGETTER(PciDeviceAttachments)(ComSafeArrayOut(IPciDeviceAttachment *, aAttachments))
     5742{
     5743    return E_NOTIMPL;
     5744}
     5745
    57315746// public methods for internal purposes
    57325747/////////////////////////////////////////////////////////////////////////////
  • trunk/src/VBox/Main/Makefile.kmk

    r34300 r34308  
    289289        VFSExplorerImpl.cpp \
    290290        MachineImpl.cpp \
     291        PciDeviceAttachmentImpl.cpp \
    291292        SnapshotImpl.cpp \
    292293        MediumImpl.cpp \
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r34252 r34308  
    33713371    </const>
    33723372  </enum>
     3373 
     3374  <interface
     3375     name="IContext" extends="$unknown"
     3376     uuid="7563F4E7-1583-40F7-B4C4-C9BA02CB0AE3"
     3377     wsmap="managed"
     3378     >
     3379    <desc>
     3380      Placeholder class for event contexts.
     3381    </desc>
     3382  </interface>
     3383
     3384
     3385  <interface
     3386     name="IPciAddress" extends="$unknown"
     3387     uuid="D88B324F-DB19-4D3B-A1A9-BF5B127199A8"
     3388     wsmap="struct"
     3389     >
     3390
     3391    <desc>
     3392      Address on the PCI bus.
     3393    </desc>
     3394
     3395    <attribute name="bus" type="short">
     3396      <desc>
     3397        Bus number.
     3398      </desc>
     3399    </attribute>
     3400
     3401    <attribute name="device" type="short">
     3402      <desc>
     3403        Device number.
     3404      </desc>
     3405    </attribute>
     3406
     3407    <attribute name="devFunction" type="short">
     3408      <desc>
     3409        Device function number.
     3410      </desc>
     3411    </attribute>
     3412
     3413    <method name="asLong">
     3414      <desc>
     3415        Convert PCI address into long.
     3416      </desc>
     3417      <param name="result" type="long" dir="return" />
     3418    </method>
     3419   
     3420    <method name="fromLong">
     3421      <desc>
     3422        Make PCI address from long.
     3423      </desc>
     3424      <param name="number" type="long" dir="in" />
     3425    </method>
     3426  </interface>
     3427
     3428    <interface
     3429     name="IPciDeviceAttachment" extends="$unknown"
     3430     uuid="236C708B-8B4B-4500-B662-F0129B68D552"
     3431     wsmap="struct"
     3432     >
     3433
     3434    <desc>
     3435      Information about PCI attachements.
     3436    </desc>
     3437
     3438    <attribute name="name" type="wstring" readonly="yes">
     3439      <desc>
     3440        Device name.
     3441      </desc>
     3442    </attribute>
     3443   
     3444    <attribute name="physicalDevice" type="boolean" readonly="yes">
     3445      <desc>
     3446        If this is physical or virtual device.
     3447      </desc>
     3448    </attribute>
     3449
     3450    <attribute name="hostAddress" type="long" readonly="yes">
     3451      <desc>
     3452        Address of device on the host, applicable only to host devices.
     3453      </desc>
     3454    </attribute>
     3455
     3456    <attribute name="guestAddress" type="long" readonly="yes">
     3457      <desc>
     3458        Address of device on the guest.
     3459      </desc>
     3460    </attribute>
     3461
     3462  </interface>
     3463
    33733464
    33743465  <interface
    33753466     name="IMachine" extends="$unknown"
    3376      uuid="7c05b1c3-c325-46cd-820d-47648d13b7f2"
     3467     uuid="6AEDC0FD-2AE8-4DBC-A659-DAD072383D29"
    33773468     wsmap="managed"
    33783469     >
     
    36893780    </attribute>
    36903781
     3782    <attribute name="pciDeviceAttachments" type="IPciDeviceAttachment" readonly="yes" safearray="yes">
     3783      <desc>Array of PCI devices attached to this machine.</desc>
     3784    </attribute>
     3785
    36913786    <attribute name="USBController" type="IUSBController" readonly="yes">
    36923787      <desc>
     
    45234618    </method>
    45244619
     4620    <method name="attachHostPciDevice">
     4621      <desc>
     4622        Attaches host PCI device with the given (host) PCI address to the
     4623        PCI bus of the virtual machine. Please note, that this operation
     4624        is two phase, as real attachement will happen when VM will start,
     4625        and most information will be delivered as IHostPciDevicePlugEvent
     4626        on IVirtualBox event source.
     4627        <note>
     4628          Not yet implemented.
     4629        </note>
     4630       
     4631        <see>IHostPciDevicePlugEvent</see>
     4632       
     4633        <result name="VBOX_E_INVALID_VM_STATE">
     4634          Virtual machine state is not stopped (PCI hotplug not yet implemented).
     4635        </result>
     4636        <result name="VBOX_E_PDM_ERROR">
     4637          Virtual machine does not have a PCI controller allowing attachment of physical devices.
     4638        </result>
     4639        <result name="VBOX_E_NOT_SUPPORTED">
     4640          Hardware or host OS doesn't allow PCI device passthrought.
     4641        </result>
     4642      </desc>
     4643      <param name="hostAddress" type="long" dir="in">
     4644        <desc>Address of the host PCI device.</desc>
     4645      </param>
     4646      <param name="desiredGuestAddress" type="long" dir="in">
     4647        <desc>Desired position of this device on guest PCI bus.</desc>
     4648      </param>
     4649      <param name="eventContext" type="IContext" dir="in">
     4650        <desc>Context passed into IHostPciDevicePlugEvent event.</desc>
     4651      </param>
     4652      <param name="tryToUnbind" type="boolean" dir="in">
     4653        <desc>If VMM shall try to unbind existing drivers from the
     4654        device before attaching it to the guest.</desc>
     4655      </param>
     4656    </method>
     4657   
     4658    <method name="detachHostPciDevice">
     4659      <desc>
     4660        Detach host PCI device from the virtual machine.
     4661        Also HostPciDevicePlugEvent on IVirtualBox event source
     4662        will be delivered.
     4663       
     4664        <note>
     4665          Not yet implemented.
     4666        </note>
     4667       
     4668        <see>IHostPciDevicePlugEvent</see>
     4669       
     4670        <result name="VBOX_E_INVALID_VM_STATE">
     4671          Virtual machine state is not stopped (PCI hotplug not yet implemented).
     4672        </result>
     4673        <result name="VBOX_E_OBJECT_NOT_FOUND">
     4674          This host device is not attached to this machine.
     4675        </result>
     4676        <result name="VBOX_E_PDM_ERROR">
     4677          Virtual machine does not have a PCI controller allowing attachment of physical devices.
     4678        </result>
     4679        <result name="VBOX_E_NOT_SUPPORTED">
     4680          Hardware or host OS doesn't allow PCI device passthrought.
     4681        </result>
     4682      </desc>
     4683      <param name="hostAddress" type="long" dir="in">
     4684        <desc>Address of the host PCI device.</desc>
     4685      </param>
     4686    </method>
     4687   
    45254688    <method name="getNetworkAdapter" const="yes">
    45264689      <desc>
     
    1421514378  <enum
    1421614379     name="VBoxEventType"
    14217      uuid="e085d0b1-05e6-4f40-a709-b7266fbdb236">
     14380     uuid="FA0D4183-CDCA-428E-A078-BBF5B69CA158">
    1421814381
    1421914382    <desc>
     
    1444714610      </desc>
    1444814611    </const>
     14612    <const name="OnHostPciDevicePlugEvent" value="67">
     14613      <desc>
     14614        See <link to="IHostPciDevicePlugEvent">IHostPciDevicePlugEvent</link>.
     14615      </desc>
     14616    </const>
     14617   
    1444914618    <!-- Last event marker -->
    14450     <const name="Last" value="67">
     14619    <const name="Last" value="68">
    1445114620      <desc>
    1445214621        Must be last event, used for iterations and structures relying on numerical event values.
     
    1568515854  </interface>
    1568615855
     15856  <interface
     15857      name="IHostPciDevicePlugEvent" extends="IMachineEvent"
     15858      waitable="yes"
     15859      uuid="EDD4782B-DB74-43A0-B724-2BAA36F039CC"
     15860      wsmap="managed" autogen="VBoxEvent" id="OnHostPciDevicePlugEvent"
     15861    >
     15862   <desc>
     15863      Notification when host PCI device is plugged/unplugged.
     15864   </desc>
     15865   
     15866   <attribute name="plugged" type="boolean" readonly="yes">
     15867      <desc>
     15868        If device successfully plugged or unplugged.
     15869      </desc>
     15870   </attribute>
     15871
     15872   <attribute name="success" type="boolean" readonly="yes">
     15873      <desc>
     15874        If operation was successful, if false - 'message' attribute
     15875        may be of interest.
     15876      </desc>
     15877   </attribute>
     15878
     15879   <attribute name="attachment" type="IPciDeviceAttachment" readonly="yes">
     15880      <desc>
     15881        Attachment info.
     15882      </desc>
     15883   </attribute>
     15884
     15885   <attribute name="eventContext" type="IContext" readonly="yes">
     15886      <desc>
     15887        Context object, passed into attachHostPciDevice() and
     15888        attachHostPciDevice().
     15889      </desc>
     15890   </attribute>
     15891
     15892   <attribute name="message" type="wstring" readonly="yes">
     15893      <desc>
     15894        Optional error message.
     15895      </desc>
     15896    </attribute>
     15897
     15898  </interface>
     15899
    1568715900  <module name="VBoxSVC" context="LocalServer">
    1568815901    <class name="VirtualBox" uuid="B1A7A4F2-47B9-4A1E-82B2-07CCD5323C3F"
  • trunk/src/VBox/Main/include/MachineImpl.h

    r34010 r34308  
    2424#include "VRDEServerImpl.h"
    2525#include "MediumAttachmentImpl.h"
     26#include "PciDeviceAttachmentImpl.h"
    2627#include "MediumLock.h"
    2728#include "NetworkAdapterImpl.h"
     
    519520    STDMETHOD(QueryLogFilename(ULONG aIdx, BSTR *aName));
    520521    STDMETHOD(ReadLog(ULONG aIdx, LONG64 aOffset, LONG64 aSize, ComSafeArrayOut(BYTE, aData)));
     522    STDMETHOD(AttachHostPciDevice(LONG hostAddress, LONG desiredGuestAddress, IContext *eventContext, BOOL tryToUnbind));
     523    STDMETHOD(DetachHostPciDevice(LONG hostAddress));
     524    STDMETHOD(COMGETTER(PciDeviceAttachments))(ComSafeArrayOut(IPciDeviceAttachment *, aAttachments));
    521525
    522526    // public methods only for internal purposes
     
    860864    typedef std::list< ComObjPtr<StorageController> > StorageControllerList;
    861865    Backupable<StorageControllerList> mStorageControllers;
     866
     867    typedef std::list< ComObjPtr<PciDeviceAttachment> > PciDeviceList;
     868    PciDeviceList mPciDeviceList;
    862869
    863870    friend class SessionMachine;
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