{"id":243,"date":"2009-05-12T05:15:13","date_gmt":"2009-05-12T03:15:13","guid":{"rendered":"http:\/\/raftaman.net\/?p=243"},"modified":"2021-05-15T11:46:42","modified_gmt":"2021-05-15T09:46:42","slug":"assign-hardware-to-domu-with-pciback-as-module","status":"publish","type":"post","link":"https:\/\/possiblelossofprecision.net\/?p=243","title":{"rendered":"Assign hardware to DomU with PCIBack as module [Update]"},"content":{"rendered":"<p>If the Dom0&#8217;s kernel is built with pciback as a module (<code>grep CONFIG_XEN_PCIDEV_BACKEND \/boot\/config-`uname -r`<\/code>), using the kernel command-line parameter <a href=\"http:\/\/www.cl.cam.ac.uk\/research\/srg\/netos\/xen\/readmes\/user\/user.html#SECTION03231200000000000000\">pciback.hide<\/a> won&#8217;t work.<\/p>\n<p>There is of course more than solution how you can <a href=\"http:\/\/wiki.xensource.com\/xenwiki\/Assign_hardware_to_DomU_with_PCIBack_as_module\">assign hardware to a domU<\/a>, but the probably easiest one is to to pass the hide parameter to the pciback module in <code>\/etc\/modprobe.conf<\/code>:<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n&#x5B;...]\r\n # hide (0000:05:02.0)\r\n options pciback hide=(0000:05:02.0)\r\n&#x5B;...]\r\n<\/pre>\n<p>The <a href=\"http:\/\/lists.xensource.com\/archives\/html\/xen-users\/2008-03\/msg00887.html\">xensouce mailing list<\/a> even tells you how to modify your initrd preloading the pciback driver before all others<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n# mkinitrd -f --preload=pciback \/boot\/initrd-$(uname -r).img $(uname -r)\r\n<\/pre>\n<p>Another (maybe more elegant) solution would be assigning the pci devices in a separate init script:<br \/>\n<a href=\"http:\/\/www.bestgrid.org\/index.php\/Xen:_assigning_PCI_devices_to_a_domain\">http:\/\/www.bestgrid.org\/index.php\/Xen:_assigning_PCI_devices_to_a_domain<\/a><br \/>\n <a href=\"http:\/\/projects.arcs.org.au\/trac\/systems\/wiki\/Howto\/PciBack\">http:\/\/projects.arcs.org.au\/trac\/systems\/wiki\/Howto\/PciBack<\/a><\/p>\n<p><b>Update:<\/b> If you want to avoid rebuilding the initial ramdisk manually every time you update your kernel, you may want to put this small script to your <code>\/etc\/rc.local<\/code><\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n\/sbin\/modprobe pciback\r\nBDF=0000:05:02.0\r\n# Unbind a PCI function from its driver as necessary\r\n&#x5B; ! -e \/sys\/bus\/pci\/devices\/$BDF\/driver\/unbind ] || \\\r\n        echo -n $BDF &gt; \/sys\/bus\/pci\/devices\/$BDF\/driver\/unbind\r\n# Add a new slot to the PCI Backend's list\r\necho -n $BDF &gt; \/sys\/bus\/pci\/drivers\/pciback\/new_slot\r\n# Now that the backend is watching for the slot, bind to it\r\necho -n $BDF &gt; \/sys\/bus\/pci\/drivers\/pciback\/bind\r\n<\/pre>\n<p>With the preceding <code>modprobe pciback<\/code> the module doesn&#8217;t have to be preloaded in you initial ramdisk.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If the Dom0&#8217;s kernel is built with pciback as a module (grep CONFIG_XEN_PCIDEV_BACKEND \/boot\/config-`uname -r`), using the kernel command-line parameter pciback.hide won&#8217;t work. There is of course more than solution how you can assign hardware to a domU, but the probably easiest one is to to pass the hide parameter to the pciback module in \/etc\/modprobe.conf: &#x5B;&#8230;] # hide (0000:05:02.0)&#8230; <a href=\"https:\/\/possiblelossofprecision.net\/?p=243\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[13,7,16],"class_list":["post-243","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-centos","tag-fedora","tag-xen"],"_links":{"self":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=243"}],"version-history":[{"count":10,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/243\/revisions"}],"predecessor-version":[{"id":2704,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/243\/revisions\/2704"}],"wp:attachment":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}