<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>I spend the last days trying to get as much info as I could about Ryzen from authoritative sources. <span style="font-size: 12pt;">Reelevant for us (Virtualization and Passthrough) are the followings:</span></p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">1) GENERAL RYZEN SUPPORT IN LINUX</span></p>
<p><span style="font-size: 12pt;">You need a really recent Linux Kernel to get Ryzen to work at all. Popular mainstream Linux distributions are plagued with problems because they aren't using the very latest. As things looks, I suppose that many distributions
 could end up mid term releases specifically for Ryzen support:</span></p>
<p><span style="font-size: 12pt;"><a href="https://www.servethehome.com/amd-ryzen-with-ubuntu-here-is-what-you-have-to-do-to-fix-constant-crashes/" class="OWAAutoLink" id="LPlnk161866" previewremoved="true">https://www.servethehome.com/amd-ryzen-with-ubuntu-here-is-what-you-have-to-do-to-fix-constant-crashes/</a><br>
<a href="https://www.servethehome.com/stop-constant-centos-7-3-crashes-amd-ryzen-using-kernel-4-10/" class="OWAAutoLink" id="LPlnk484065" previewremoved="true">https://www.servethehome.com/stop-constant-centos-7-3-crashes-amd-ryzen-using-kernel-4-10/</a><br>
<br>
<br>
</span></p>
<p><span style="font-size: 12pt;">2) AMD AVIC (<span>AMD Virtual Interrupt Controller)</span><br>
</span></p>
<p><span style="font-size: 12pt;">According to The Stilt (A guy extremely know in enthusiasts circles, with a lot of in-depth </span><span style="font-size: 12pt;">knowledge about AMD platforms</span><span style="font-size: 12pt;">), </span><span style="font-size: 12pt;">AMD
 AVIC will be supported by all Ryzen models. </span><span style="font-size: 12pt;">I suppose that this should also apply to the future
</span><span style="font-size: 12pt;">Ryzen 3 and 5.</span><br>
</p>
<p>AVIC is AMD counterpart to Intel APICv, for APIC Virtualization. Intel provides this feature since Ivy Bridge-E, but only in the LGA 2011/2011-3 platform. HEDT Core i7s based on those platforms also include it, but no consumer LGA 1155/1150/1151 Processor
 has it (Including Xeons E3).</p>
<p>More technical info about AVIC here:</p>
<p><a href="https://es.slideshare.net/xen_com_mgr/introduction-of-amd-virtual-interrupt-controller" class="OWAAutoLink" id="LPlnk467020" previewremoved="true">https://es.slideshare.net/xen_com_mgr/introduction-of-amd-virtual-interrupt-controller</a><br>
</p>
<p><br>
</p>
<p>AVIC should be supported since Linux Kernel 4.7:</p>
<p><a href="http://www.phoronix.com/scan.php?page=news_item&px=KVM-AVIC-Linux-4.7" class="OWAAutoLink" id="LPlnk953641" previewremoved="true">http://www.phoronix.com/scan.php?page=news_item&px=KVM-AVIC-Linux-4.7</a><br>
</p>
<p>It may required to be manually enabled, but no idea if that is still the case. According to this:</p>
<p><a href="https://lkml.org/lkml/2016/3/4/746" class="OWAAutoLink" id="LPlnk779736" previewremoved="true">https://lkml.org/lkml/2016/3/4/746</a><br>
<br>
</p>
<p></p>
<div>Currently, this patch series does not enable AVIC by default.</div>
<div>Users can enable SVM AVIC by specifying avic=1 during insmod kvm-amd.</div>
<p></p>
<p><br>
</p>
<p><br>
</p>
<p>Also worthy of mention regarding AVIC, is that with APICv, it was required to NOT enable the hv-vapic HyperV Enlightnement in QEMU to use it because it seems that VMs with Windows defaults to hv-vapic and ignores the APIC Virtualization support, thus in
 platforms with APICv it performed worse with hv-vapic enabled than without. Since I have absolutely no idea how AVIC is supposed to be enabled and put to work in QEMU (Besides the previously mentioned avic=1 for kvm_amd Kernel Module), I don't know if you
 need to do that or something else. I'm not even sure if you are required to disable/not enable hv-vapic.</p>
<p><br>
</p>
<p><br>
</p>
<p>3) AMD-Vi/IOMMU</p>
<p><span style="font-size: 12pt;">The IOMMU seems to work out of the box.</span></p>
<p><span style="font-size: 12pt;">I believe that you still have to manually enable it with a Kernel Parameter like amd_iommu=on, iommu=1, iommu=pt or something like that. No idea on specifics.</span><br>
</p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">4) Devices FLR</span></p>
<p><span style="font-size: 12pt;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">Sadly, none of the interesing integrated
 devices <span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
(The two SATA Controllers, the two USB Controllers, and Azalia Audio) </span>supports FLR, all shows FLReset- in lspci -vvv</span><br>
</span></p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">5) IOMMU Groups/PCIe ACS</span></p>
<p>Patrick from ServeTheHome provided lspci -vvv, lspci-t and <span>find /sys/kernel/iommu_groups/ outputs from his
<span>ASUS PRIME B350-PLUS:<br>
<a href="https://forums.servethehome.com/index.php?threads/amd-ryzen-7-1700x-linux-benchmarks.13537/page-2#post-130063" class="OWAAutoLink" id="LPlnk656132" previewremoved="true">https://forums.servethehome.com/index.php?threads/amd-ryzen-7-1700x-linux-benchmarks.13537/page-2#post-130063</a><br>
</span></span></p>
<p><span><span><a href="https://www.asus.com/us/Motherboards/PRIME-B350-PLUS/" class="OWAAutoLink" id="LPlnk205084" previewremoved="true">https://www.asus.com/us/Motherboards/PRIME-B350-PLUS/</a></span><br>
</span></p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">...so it was possible to me to build a composite PCIe Topology, also basing myself on the little info available of Motherboards Block Diagrams. The results are here:</span><br>
</p>
<p><span><br>
</span></p>
<p><span><a href="http://imgur.com/a/36pAT" class="OWAAutoLink" id="LPlnk968469" previewremoved="true">http://imgur.com/a/36pAT</a></span></p>
<p><span><br>
</span></p>
<p><span><br>
</span><span style="font-size: 12pt;">Don't panic, IOMMU Groups are ugly, but not as bad as it</span><span style="font-size: 12pt;"> seems. So far, it seems that the topology works in a sort of Host Bridge/PCI Bridge
</span><span style="font-size: 12pt;">pairing </span><span style="font-size: 12pt;">which are always grouped together, and there is isolation between those pairs (So at the very top level, PCIe ACS seems to be working)</span><span style="font-size: 12pt;">.
 Where things go wrong, is that there is no isolation below them, so all the Devices attached to a PCI Bridge </span><span style="font-size: 12pt;">gets grouped together</span><span style="font-size: 12pt;">.</span><span><br>
</span></p>
<p><span style="font-size: 12pt;">In that tree, the Video Card is currently sitting at the PCIe 16x Slot made with 4 PCIe 2.0 Lanes coming from the Chipset, so it is packed in the ugly Group 0 with all the Chipset devices. However, previously he had it in the
 main PCIe 16x Slot (Currently occupied with a Intel XL710 NIC, Group 2), so it should have been easily passthroughed. In a Motherboard with a X370 Chipset that allows bifurcation of the main 16 PCIe Lanes into 8x/8x, according to my calculations, it should
 create another PCI Bridge below one of the "unused" Host Bridges (Like 00:04.x) in its own exclusive Group, thus for two Video Cards in the Processor PCIe Slots you may have full isolation even at this early stage.</span><br>
</p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">Since there is a lack of technical documentation at this stage, there is no info regarding if PCIe ACS should be a feature or not.</span><br>
</p>
<p><span style="font-size: 12pt;">It could be possible that there is incomplete Firmware support, like this:</span><br>
</p>
<p><a href="https://www.redhat.com/archives/vfio-users/2016-September/msg00070.html" class="OWAAutoLink" id="LPlnk856347" previewremoved="true">https://www.redhat.com/archives/vfio-users/2016-September/msg00070.html</a><br>
</p>
<p>Or that there is an errata, like in Skylake and Kaby Lake Chipsets.</p>
<p><br>
</p>
<p>If you want me to relay a request to someone with Ryzen Hardware, tell me exactly what they should type in case that you want a PCI Registers dump or whatever.</p>
<p><br>
</p>
<p><br>
</p>
<p>6) Passthrough</p>
<p>No confirmed successfully passthrough attempts at this point, but things are looking good for a single Video Card. It would also be interesing to know if the grouping unfriendly devices works with the ACS override patch/hack or is a dead end.</p>
<p><br>
</p>
<p><br>
</p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">Overally, Ryzen has a lot of potential. It has AVIC and decent isolation
 between Processor PCIe Slots that consumer Intel platforms does not have. The Ryzen 7 1700 also allows you to play with 8 Cores at an affordable price, which was something that we were severely needing.</span><br>
</p>
<p></p>
<p style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
Ryzen AM4 platform interesing potential is in the fact that you have two USB Controllers and two SATA Controllers, one in the Processor and another in the Chipset, so with a Ryzen 7 1700 with 8 Cores and these integrated controllers, you could literally make
 a two person multiseat computer with minimum effort (X370 with two Video Cards, maybe a Sound Card and a third cheap host Video Card, and you're done). Sadly, current isolation means that you can't pass the integrated controllers. I really expect this to be
 fixeable, or I will be rather dissapointed.<br>
</p>
<p style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<br>
</p>
<p style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<br>
</p>
<p></p>
</div>
</body>
</html>