<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=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        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:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
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
        {mso-style-priority:99;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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 bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><a name="_____replyseparator"></a><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Florescu, Andreea [mailto:fandree@amazon.com]
<br>
<b>Sent:</b> Tuesday, November 19, 2019 6:47 PM<br>
<b>To:</b> rust-vmm ML <rust-vmm@lists.opendev.org><br>
<b>Subject:</b> [Rust-VMM] Device implementation in rust-vmm<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">Hey everyone,<o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">A couple of weeks ago we merged a trait for DeviceIo. This is very similar to what we have in CrosVM/Firecracker under the name IoBus and serves the same purpose. You can check the commit that introduced
 the trait for more context [1].<o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">With this trait merged we can now implement simple legacy devices such as the serial console. I added a PR [2] for this, but it is still very much work in progress. This PR started another conversation
 regarding where to place the device emulation.<o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">As far as I know we have two options:<o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">- each device in its own crate/repository<o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">- all commonly used devices in vm-device<o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">We touched on this topic during the Bucharest rust-vmm meetup as well. Each of these options come with disadvantages. The one that I was mostly concerned about is bloating the vm-device with lots
 of devices that are not needed by all the VMMs using rust-vmm. There are ways to work around this problem, so during the meetup we agreed on adding device emulation in vm-device for now. If we get to the point where vm-device becomes unmanageable ( too many
 devices making the code hard to audit), we can move the device emulation out of the crate.<o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">For people that didn't attend the meetup, what do you think about having the device emulation in vm-device?<o:p></o:p></span></p>
<p><b><i><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></i></b></p>
<p><b><i><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">If you read my original proposal for vm-device(</span></i></b><a href="https://github.com/rust-vmm/community/issues/33">https://github.com/rust-vmm/community/issues/33</a><b><i><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">)
 I was not going to mix those together in one crate instead I’m going to separate the common part from concrete devices. I believe it‘s still true for most of the devices we concerned: Virtio/PCI/vfio all have(or will have) their own crates, it’s nature to
 put the concrete devices there or in new crates if new layers are desirable for them. Putting the concrete device in vm-device, for example, putting a concrete PCI device in vm-device, can result circular reference:  vm-device(concreate PCI device) -> vm-pci
 -> vm-device(base device). I’m not strongly opposing you doing this for legacy and very simple device emulations like serial-console(not virtio-console),  since we should have very limited number of them and no circular reference  it’s OK to put them in vm-device
 temporarily, though I tend to have a separate crate to hold those legacy ones.<o:p></o:p></span></i></b></p>
<p><b><i><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></i></b></p>
<p><b><i><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Besides the two options you mentioned, there is third option that putting all the concrete devices in one new crate, with rust features to select specific devices.<o:p></o:p></span></i></b></p>
<p><b><i><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></i></b></p>
<p><b><i><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Thanks,<o:p></o:p></span></i></b></p>
<p><b><i><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Chao<o:p></o:p></span></i></b></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">Andreea<o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">[1] <a href="https://github.com/rust-vmm/vm-device/commit/21910a148a290fcebec98bf11df4410ef35662d1">
https://github.com/rust-vmm/vm-device/commit/21910a148a290fcebec98bf11df4410ef35662d1</a><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">[2] <a href="https://github.com/rust-vmm/vm-device/pull/15">
https://github.com/rust-vmm/vm-device/pull/15</a><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"><br>
Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.<o:p></o:p></span></p>
</div>
</div>
</body>
</html>