<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 05/19/2016 02:46 PM, Shivaprasad
      bhat wrote:<br>
    </div>
    <blockquote
cite="mid:CAAfHSJsozpG93aLTpkVYUZAeRNEU=G_FhN6RvpKkeFAmjBRdDg@mail.gmail.com"
      type="cite">
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Fri, May 20, 2016 at 12:05 AM,
            Laine Stump <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:laine@laine.org" target="_blank">laine@laine.org</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex"><span
                class="">On 05/18/2016 05:35 PM, Shivaprasad G Bhat
                wrote:<br>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  The hostdevices are the only devices which have
                  dependencies<br>
                  outside of themselves such that, other functions of
                  the PCI<br>
                  card should also have been detached from host driver
                  before<br>
                  attempting the hotplug.<br>
                </blockquote>
                <br>
              </span>
              Are you saying that all the functions on a host device
              must be detached from their host driver, even if you're
              only assigning one or another of them to the guest?<span
                class=""><br>
                <br>
              </span></blockquote>
            <div>Yes. All devices from same iommu group should be
              detached from the host. </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Ah right, I forgot about that. But that is something we already
    don't deal with (currently you can assign a single device from an
    iommu group with many devices, but managed='yes' won't work for it.
    That would require some other sort of managed mode, like
    "managed='group'" or something, but more elaborate managed modes
    have already been NACKed on the list (I posted an RFC patch for
    "managed='detach'" at the request of someone else - it would detach
    the device from the host driver before assignment, but not reattach
    it afterwards. This was deemed inappropriate and unnecessary.)<br>
    <br>
    You may wonder why we don't want to automatically detach all the
    other devices without any clue to do so in the config - it's because
    you can't expect the user to know which devices are in the same
    iommu group as the one you want to assign, and you don't want to
    just automatically/silent detach one that is essential for continued
    operation of the host.<br>
    <br>
    So we really should only detach those devices that are going to be
    assigned to the guest.<br>
    <br>
    <blockquote
cite="mid:CAAfHSJsozpG93aLTpkVYUZAeRNEU=G_FhN6RvpKkeFAmjBRdDg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div>Here, I hope the Card is independent. Otherwise, many
              cards can also</div>
            <div>belong to same iommu group. In such case, manual the
              nodedev-detach for other card functions is necessary.</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex"><span
                class="">
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  <br>
                  This patch moves the detach to the beginning of the
                  hotplug<br>
                  so that the following patch can detach all funtions
                  first before<br>
                  attempting to hotplug any.<br>
                  <br>
                  We need not move the detach for net devices using
                  SRIOV as<br>
                  all SRIOV devices are single function devices.<br>
                </blockquote>
                <br>
                <br>
              </span>
              I'm not sure why that makes any difference. In any case,
              you should detach all the devices that are going to be
              assigned, then assign them all, with the one going to
              function 0 being last.</blockquote>
            <div><br>
            </div>
            <div>There will be only function zero. So I felt its not
              necessary. Are you saying different SRIOV functions(all
              with function zero) be hotplugged as</div>
            <div>different functions of single card in guest ? In that
              case, we would need to do that.</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    I couldn't parse your question, but I wasn't talking about SRIOV in
    particular, just saying that the way multifunction device assignment
    is done in qemu is to assign all the non-0 functions, then assign
    function 0. But that was just an incidental part of the
    conversation. The important part is that you first detach from the
    host all devices to be assigned, then you assign them all.<br>
    <br>
  </body>
</html>