Posts by DaisyF8

    And something to add : How to add unique passthrough hardware/folders


    I only found this out afterwards, so only editing the xml would be more difficult. You need to use UI and edit xml.


    The tricky bit is that in the xml the virtual addressing for the passthrough "hardware"" needs to be unique. This is in every device-entry handeled by this line :

    Code
    <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>

    I tried changing for instance slot or bus to a random number but if you get it wrong (not unique or not conforming to general linux rules) the entire device-entry gets removed.


    So what you can do is first use the UI to add a "mapped" folder in the xml. This way you get an entry with a unique address. And then you change accessmode "mapped" to "passthrough" and add two lines like in my post above.

    Code
          <driver type='virtiofs' queue='1024'/>
          <binary path='/usr/lib/qemu/virtiofsd'/>

    Also, to mount automatically use this in /etc/fstab :

    Code
    shared_folder_tag            /mnt/mount_here       virtiofs     defaults 0 0

    I did manage to passthrough a folder using the method described in ryecoaaron 's link, with editing the xml and inserting the Memorybacking and Filesystem entries.


    Only thing that threw me for a loop for a second is that when you use the UI to create a passthrough link, in the xml the accesmode is set as "mapped" instead as "passthrough", and I don't need mapped.


    So my fix was to not use the UI and just do it all in the xml while the VM is down:


    Code
         <filesystem type='mount' accessmode='passthrough'>
          <driver type='virtiofs' queue='1024'/>
          <binary path='/usr/lib/qemu/virtiofsd'/>
          <source dir='/srv/dev-disk/shared_folder'/>
          <target dir='shared_folder_tag'/>
          <alias name='fs0'/>
          <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
        </filesystem>

    After that in the VM create a mountpoint mount_here (with correct permissions, read section mapped, passthrough, squash in link) and mount the tag :


    Code
    mount -t virtiofs shared_folder_tag /mnt/mount_here


    EDIT : see my post below concerning unique hardware addressing.