{"id":170,"date":"2017-02-19T04:50:41","date_gmt":"2017-02-19T04:50:41","guid":{"rendered":"http:\/\/blog.warbel.net\/?p=170"},"modified":"2017-02-20T10:31:27","modified_gmt":"2017-02-20T10:31:27","slug":"enabling-pci-passthrough-of-hauppauge-quadhd-pcie-tv-tuner-card-with-a-marvell-88se9230-sata-controller","status":"publish","type":"post","link":"https:\/\/blog.warbel.net\/index.php\/2017\/02\/19\/enabling-pci-passthrough-of-hauppauge-quadhd-pcie-tv-tuner-card-with-a-marvell-88se9230-sata-controller\/","title":{"rendered":"Enabling PCI passthrough of Hauppauge QuadHD PCIe TV Tuner Card with a Marvell 88SE9230 SATA controller"},"content":{"rendered":"<h1>Background:<\/h1>\n<p>As the title suggests, this is a complex problem that I&#8217;ve had to work with. The goal has been to create a virtual machine running MythTV that can utilise the PCIe tuner card on the hypervisor.<\/p>\n<p>The first step in the process was to compile and install the latest kernel image (at the time of writing this was 4.9.9). This was necessary as the kernel version that ships with Ubuntu 16.04 (version 4.4.0.xx) \u00a0does not have the most recent drivers that the tuner needs to function. This step I completed successfully and for more information, please see my previous posts.<\/p>\n<p>Unfortunately, enabling iommu in the kernel activated a bug in the additional PCIe SATA card I have installed in the hypervisor that stopped the whole system from booting. More on that in a minute.<\/p>\n<p><strong>Affected Hardware:<\/strong><\/p>\n<p>Startech PEXSAT34RH 4-Port PCI Express 2.0 SATA Controller Card with a Marvell 88SE9230 chipset.<br \/>\nHauppauge QuadHD PCIe TV Tuner Card.<br \/>\nIntel S1200SPL motherboard with a\u00a0AXXRMM4LITE RMM4 module installed.<\/p>\n<p>PCI devices identified as through lspci as:<\/p>\n<pre>05:00.0 Multimedia video controller: Conexant Systems, Inc. CX23887\/8 PCIe Broadcast Audio and Video Decoder with 3D Comb (rev 04)\r\n06:00.0 Multimedia video controller: Conexant Systems, Inc. CX23887\/8 PCIe Broadcast Audio and Video Decoder with 3D Comb (rev 04)\r\n02:00.0 SATA controller: Marvell Technology Group Ltd. 88SE9230 PCIe SATA 6Gb\/s Controller (rev 11)<\/pre>\n<h2>Partial resolution:<\/h2>\n<p>The first step was to enable iommu in the kernel without breaking the SATA controller card. the solution was to the enable iommu and set it to passthrough mode. This can be achieved on a Ubuntu system by editing \/etc\/default\/grub and adding intel_iommu=on iommu=pt to the linux default settings: For my system it now looks like this:<\/p>\n<pre>GRUB_CMDLINE_LINUX_DEFAULT=\"nomodeset intel_iommu=on iommu=pt\"<\/pre>\n<p>At the command line, run sudo update-grub and reboot.<\/p>\n<p>The rest of the process, that includes adding the hardware to the VM host and enabling the pci_stub kernel module can be found in previous posts on my blog.<\/p>\n<p>The only difficulties I encountered, and didn&#8217;t mention in my last blog post, was ensuring that the PCIe devices do not share IRQs. To check, I cross-referenced the output of:<br \/>\n:$ find \/sys\/kernel\/iommu_groups\/ -type l<br \/>\nwith<br \/>\n:$ lscpi<br \/>\nI could confirm that the DVB-T tuner card had two interrupts, and did not share them with any other hardware device. More on that <a href=\"http:\/\/vfio.blogspot.com.au\/2015\/05\/vfio-gpu-how-to-series-part-3-host.html\">here<\/a>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-174\" src=\"http:\/\/blog.warbel.net\/wp-content\/uploads\/2017\/02\/iommu_groups.jpg\" alt=\"\" width=\"439\" height=\"394\" srcset=\"https:\/\/blog.warbel.net\/wp-content\/uploads\/2017\/02\/iommu_groups.jpg 439w, https:\/\/blog.warbel.net\/wp-content\/uploads\/2017\/02\/iommu_groups-300x269.jpg 300w, https:\/\/blog.warbel.net\/wp-content\/uploads\/2017\/02\/iommu_groups-334x300.jpg 334w\" sizes=\"auto, (max-width: 439px) 100vw, 439px\" \/><\/p>\n<h1>Continuing problems:<\/h1>\n<p>After finally managing to get the PCI pass through function working which I verified by checking dmesg on the VM. I launched mythtv-setup and configured the tuner cards. MythTV successfully added them and I could add them to a video source. Unfortunately the system crashed when it tried to do an initial tune.<br \/>\nThe console on the KVM host output the error:<br \/>\n<strong>vfio-pci pcie bus error severity=(uncorrected _Fatal), type=unaccessible,id=500(unregistered Agent ID)<\/strong><br \/>\nAnd the console on the virtual machine output the error:<br \/>\n<strong>mpeg risc op code<\/strong><br \/>\nand then promptly crashed.<\/p>\n<p>Thankfully I have a backup single USB tuner, however it seems that the quest continues to get the tuner working properly.<\/p>\n<h1>Further reading:<\/h1>\n<p><strong>IOMMU Bug in the 88SE9230 Chipset:<\/strong><br \/>\n<a href=\"https:\/\/lime-technology.com\/forum\/index.php?topic=54410.0\">https:\/\/lime-technology.com\/forum\/index.php?topic=54410.0<\/a><br \/>\n<a href=\"http:\/\/lime-technology.com\/forum\/index.php?topic=40683\">http:\/\/lime-technology.com\/forum\/index.php?topic=40683<\/a><br \/>\n<a href=\"https:\/\/lime-technology.com\/forum\/index.php?topic=33511.0\">https:\/\/lime-technology.com\/forum\/index.php?topic=33511.0<\/a><br \/>\n<a href=\"https:\/\/www.startech.com\/Cards-Adapters\/HDD-Controllers\/SATA-Cards\/4-Port-PCI-Express-SATA-6Gbps-RAID-Controller-Card~PEXSAT34RH#dnlds\">Product Website<\/a><\/p>\n<p><strong>PCI Passthrough<\/strong>:<br \/>\n<a href=\"http:\/\/vfio.blogspot.com.au\/2015\/05\/vfio-gpu-how-to-series-part-3-host.html\">http:\/\/vfio.blogspot.com.au\/2015\/05\/vfio-gpu-how-to-series-part-3-host.html<\/a><\/p>\n<p><strong>Hauppauge QuadHD PCIe TV Tuner Card:<br \/>\n<\/strong><a href=\"https:\/\/www.linuxtv.org\/wiki\/index.php\/Hauppauge_WinTV-quadHD_(DVB-T\/T2\/C)#Making_it_Work\">LinuxTV Page<\/a><br \/>\n<a href=\"http:\/\/hauppauge.com\/site\/products\/data_quadhd.html\">Product Website<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Background: As the title suggests, this is a complex problem that I&#8217;ve had to work with. The goal has been to create a virtual machine running MythTV that can utilise the PCIe tuner card on the hypervisor. The first step &hellip; <a href=\"https:\/\/blog.warbel.net\/index.php\/2017\/02\/19\/enabling-pci-passthrough-of-hauppauge-quadhd-pcie-tv-tuner-card-with-a-marvell-88se9230-sata-controller\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-170","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts\/170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/comments?post=170"}],"version-history":[{"count":5,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts\/170\/revisions"}],"predecessor-version":[{"id":186,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts\/170\/revisions\/186"}],"wp:attachment":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/media?parent=170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/categories?post=170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/tags?post=170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}