<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:宋体;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@宋体";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:宋体;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"批注框文本 Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:9.0pt;
        font-family:宋体;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.Char
        {mso-style-name:"批注框文本 Char";
        mso-style-priority:99;
        mso-style-link:批注框文本;
        font-family:宋体;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=ZH-CN link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'>I am doing the same work now.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'>I try to buile my own virtual pci device and as Luo said, I must read all the vmmdev related code.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'>Could you send me some document or demo on virtual pci device?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt'>发件人<span lang=EN-US>:</span></span></b><span lang=EN-US style='font-size:10.0pt'> Huihong Luo [mailto:huisinro@yahoo.com] <br></span><b><span style='font-size:10.0pt'>发送时间<span lang=EN-US>:</span></span></b><span lang=EN-US style='font-size:10.0pt'> 2015</span><span style='font-size:10.0pt'>年<span lang=EN-US>6</span>月<span lang=EN-US>27</span>日<span lang=EN-US> 14:25<br></span><b>收件人<span lang=EN-US>:</span></b><span lang=EN-US> Klaus Espenlaub; vbox-dev@virtualbox.org<br></span><b>主题<span lang=EN-US>:</span></b><span lang=EN-US> Re: [vbox-dev] How add device or driver (PDM) to VirtualBox<o:p></o:p></span></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><div><div id="yui_3_16_0_1_1435385835730_3149"><p class=MsoNormal style='background:white'><span lang=EN-US style='font-family:"Helvetica","sans-serif";color:black'>I think that most likely the OP wants to develop a virtual PCI device, so the guest and the host can communicate with each other, like some kind of pipe system. The guest and the host can read/write to each other through shared memory.<o:p></o:p></span></p></div><div id="yui_3_16_0_1_1435385835730_3150"><p class=MsoNormal style='background:white'><span lang=EN-US style='font-family:"Helvetica","sans-serif";color:black'><o:p> </o:p></span></p></div><div id="yui_3_16_0_1_1435385835730_3152"><p class=MsoNormal style='background:white'><span lang=EN-US style='font-family:"Helvetica","sans-serif";color:black'>If this is indeed the case, one can study vbox's builtin guest/host implementation, basically vbox itself uses a virtual PCI device (Devices/VMMDev/VMMDev.cpp), and then inside Linux guest, there is corresponding VBoxGuest.ko kernel module, which is a PCI driver to interact with the virtual device emulated by vbox. This is how vbox's guest additions work.<o:p></o:p></span></p></div><div id="yui_3_16_0_1_1435385835730_3152"><p class=MsoNormal style='background:white'><span lang=EN-US style='font-family:"Helvetica","sans-serif";color:black'><o:p> </o:p></span></p></div><div id="yui_3_16_0_1_1435385835730_3152"><p class=MsoNormal style='background:white'><span lang=EN-US style='font-family:"Helvetica","sans-serif";color:black'>I have implemented a simple virtual PCI device, like QEMU's pipe. What I can tell you, this is not an easy job, and you have to understand all the concepts, plus a detailed study of vbox source code. <o:p></o:p></span></p></div><p class=MsoNormal style='background:white'><span lang=EN-US style='font-family:"Helvetica","sans-serif";color:black'><o:p> </o:p></span></p><div id="yui_3_16_0_1_1435385835730_2829"><div id="yui_3_16_0_1_1435385835730_2828"><div id="yui_3_16_0_1_1435385835730_2827"><div class=MsoNormal align=center style='text-align:center;background:white'><span lang=EN-US style='font-family:"Helvetica","sans-serif";color:black'><hr size=1 width="100%" align=center></span></div><p class=MsoNormal style='background:white'><b><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'> Klaus Espenlaub <<a href="mailto:klaus.espenlaub@oracle.com">klaus.espenlaub@oracle.com</a>><br><b>To:</b> <a href="mailto:vbox-dev@virtualbox.org">vbox-dev@virtualbox.org</a> <br><b>Sent:</b> Friday, June 26, 2015 6:22 AM<br><b>Subject:</b> Re: [vbox-dev] How add device or driver (PDM) to VirtualBox</span><span lang=EN-US style='font-family:"Helvetica","sans-serif";color:black'><o:p></o:p></span></p></div><div id="yui_3_16_0_1_1435385835730_2830"><p class=MsoNormal style='background:white'><span lang=EN-US style='font-family:"Helvetica","sans-serif";color:black'><br>Marcin,<br><br>On 25.06.2015 10:57, Marcin K wrote:<br>> Hi,<br>><br>> I ask about this before but don't get any answer...<br><br>yes, sorry about that, but right now everyone in the dev team is booked <br>out with super urgent things which have to be finished before 5.0 is <br>released. There's simply not enough time right now for bigger explanations.<br><br>><br>> How add new device/driver to Virtualbox?<br>> Is there a someone who understand how PDM works?<br>><br>> I compile VBoxSampleDevice.cpp and add it to VirtualBox but<br>> system(ubunutu 14) don't show any new device.<br>> To add dll to Virtualbox I use:<br>> VBoxManage setextradata global VBoxInternal/PDM/Devices/[[1]]/Path<br>> g:\VirtualBox\out\win.amd64\release\obj\testingDevice\VBoxSampleDevice.dll<br><br>VBoxSampleDevice.cpp is a totally empty piece of code. It compiles, it <br>loads, but doesn't expose ANY functionality to the VM.<br><br>> Also I try to add device using copy of Virtio device. I copy code<br>> of DevVirtioNet.cpp modify it (change some names), build dll and add to<br>> VirtualBox:<br>> VBoxManage setextradata global VBoxInternal/PDM/Devices/[[3]]/Path<br>> g:\VirtualBox\out\win.amd64\release\obj\testingDevice\testingDevice.dll<br>><br>> But still nothing change in guest system.<br>><br>> In DevVirtioNet.cpp I found a lot of code which set a lot of parameters<br>> connected with PCI. I try understand this code but this take, a lot of time.<br>><br>> I also found that I have to set which driver will be use in system also<br>> in configuration of virtual machine.<br>> I try to set net ethernet cart type but in VBoxManage I found code which<br>> allow using only build in drivers so I can't set "My" modified Virtio<br>> driver.<br>><br>> There is really no instruction or documentation how it's works?<br><br>There are lots of examples, in the form of the various device <br>implementations :)<br><br>Klaus<o:p></o:p></span></p><div><p class=MsoNormal style='margin-bottom:12.0pt;background:white'><span lang=EN-US style='font-family:"Helvetica","sans-serif";color:black'><o:p> </o:p></span></p></div><div id=yqtfd20522><p class=MsoNormal style='background:white'><span lang=EN-US style='font-family:"Helvetica","sans-serif";color:black'><br><br>> I will be really gratefull for any help or instruction how add new<br>> device to VirtualBox.<br>><br>><br>> Best regards,<br>> Marcin<br><br>_______________________________________________<br>vbox-dev mailing list<br><a href="mailto:vbox-dev@virtualbox.org">vbox-dev@virtualbox.org</a><br><a href="https://www.virtualbox.org/mailman/listinfo/vbox-dev" target="_blank">https://www.virtualbox.org/mailman/listinfo/vbox-dev</a><o:p></o:p></span></p></div><p class=MsoNormal style='margin-bottom:12.0pt;background:white'><span lang=EN-US style='font-family:"Helvetica","sans-serif";color:black'><o:p> </o:p></span></p></div></div></div></div></div></body></html>