1. 12 9月, 2019 5 次提交
  2. 11 9月, 2019 6 次提交
  3. 10 9月, 2019 18 次提交
  4. 09 9月, 2019 11 次提交
    • S
      tests: Add a baseline test for multifunction pci device use case · 4ef4ba49
      Shivaprasad G Bhat 提交于
      There are already good number of test cases with hostdevices,
      few have multifunction devices but none having more than one
      than one multifunction cards.
      
      This patch adds a case where there are two multifunction cards
      and two Virtual functions part of the same XML.
      
      0001:01:00.X & 0005:09:00.X - are Multifunction PCI cards.
      0000:06:12.[5|6] - are SRIOV Virtual functions
      
      Future commits will improve on automatically detecting the
      multifunction cards and auto-assinging the addresses
      appropriately.
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      4ef4ba49
    • D
      virpcimock.c: simplify getrealpath() usage · 2d9b8acf
      Daniel Henrique Barboza 提交于
      Previous patch had to add '/sys/kernel/' prefix in opendir() because
      the path, which is being mocked, wasn't being considered due to
      an 'if SYSFS_PCI_PREFIX' guarding the call to getrealpath().
      
      In fact, all current getrealpath() callers are guarding it with a
      conditional to ensure that the function will never be called with
      a non-mocked path. In this case, an extra non-NULL verification is
      needed for the 'newpath' string to use the variable - which is
      counterintuitive, given that getrealpath() will always write the
      'newpath' string in any non-error conditon.
      
      However, simply removing the guard of all getrealpath() instances
      causes an abort in init_env(). This happens because tests will
      execute access() to non-mocked paths even before the
      LIBVIRT_FAKE_ROOT_DIR variable is declared in the test files. We
      don't need 'fakerootdir' to be created at this point though.
      
      This patch does the following changes to simplify getrealpath()
      usage:
      
      - getrealpath() will now guard the init_env() call by checking if
      both fakeroot isn't created and the required path is being mocked.
      This ensures that we're not failing inside init_env() because
      we're too early and LIBVIRT_FAKE_ROOT_DIR wasn't defined yet;
      
      - remove all conditional guards to call getrealpath() from
      access(), virMockStatRedirect(), open(), open_2(), opendir()
      and virFileCanonicalizePath(). As a bonus, remove all ternary
      conditionals with 'newpath';
      
      - a new 'pathPrefixIsMocked()' helper to aggregate all the prefixes
      we're mocking, making it easier to add/remove them. If a prefix
      is added inside this function, we can be sure that all functions
      are mocking them.
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      2d9b8acf
    • S
      tests: Add test case for QEMU pci-hostdev hotplug · 944a35d7
      Shivaprasad G Bhat 提交于
      This patch adds hostdev test cases in qemuhotplugtest.c.
      
      Note: the small tweak inside virpcimock.c was needed because
      the new tests added a code path in which virHostHasIOMMU()
      (virutil.c) started being called, and the mocked '/sys/kernel/'
      prefix that is mocked in virpcimock.c wasn't being considered
      in the opendir() mock. An alternative to avoid these situations
      in virpcimock.c is implemented in the next patch.
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      944a35d7
    • S
      virpcimock: Mock the SRIOV Virtual functions · 5a9dc4a5
      Shivaprasad G Bhat 提交于
      The softlink to physfn is the way to know if the device is
      VF or not. So, the patch softlinks 'physfn' to the parent function.
      The multifunction PCI devices dont have 'physfn' softlinks.
      
      The patch adds few Virtual functions to the mock environment and
      changes the existing VFIO test xmls using the VFs to use the newly
      added VFs for their use case.
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      5a9dc4a5
    • D
      virpcimock.c: mock /dev/vfio · 16c98903
      Daniel Henrique Barboza 提交于
      This patch adds mock of the /dev/vfio path, needed for proper
      implementation of the support for multifunction/multiple devices
      per iommu groups.
      
      To do that, the existing bind and unbind operations were adapted
      to operate with the mocked filesystem as well.
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      16c98903
    • E
      qemu: Adjust max memlock on mdev hotplug · fe39e1b1
      Eric Farman 提交于
      When starting a domain, we use the presence of a vfio-pci or
      mdev hostdev to determine if the memlock maximum needs to be
      increased.  But if we hotplug either of these devices, only the
      vfio-pci path gets that love.  This means that attaching a, say,
      vfio-ccw device will appear to succeed but the device may be
      unusable as the guest may see I/O errors on long CCW chains.
      The host, meanwhile, would be flooded with these messages:
      
        vfio_pin_page_external: Task qemu-system-s39 (11584) RLIMIT_MEMLOCK (65536) exceeded
      
      Let's adjust the maximum memlock value in the mdev hotplug path,
      so that the domain has the same value as if it were started with
      one or more mdev devices in its configuration.
      Signed-off-by: NEric Farman <farman@linux.ibm.com>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Reviewed-by: NPavel Hrdina <phrdina@redhat.com>
      fe39e1b1
    • E
      qemu: Reset the maximum locked memory on hotplug fail · 94714594
      Eric Farman 提交于
      If attaching a PCI hostdev fails, there are several things that
      need to be un-done as part of the cleanup.  One thing that is
      not done is re-calculating/re-setting the maximum amount of locked
      memory for the domain, since we may have changed that.
      
      Let's fix that, just to ensure everything is back the way it was.
      Signed-off-by: NEric Farman <farman@linux.ibm.com>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Reviewed-by: NPavel Hrdina <phrdina@redhat.com>
      94714594
    • E
      qemu: Refactor the max memlock routine · 4b299843
      Eric Farman 提交于
      Let's pull this hunk out into a function, so it can be reused
      in another codepath that needs to do the same thing.
      Signed-off-by: NEric Farman <farman@linux.ibm.com>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Reviewed-by: NPavel Hrdina <phrdina@redhat.com>
      4b299843
    • M
      virhostdev: Don't unref @pcidevs twice · 894f3e0e
      Michal Privoznik 提交于
      In f08e6883 I've made @pcidevs in
      virHostdevReAttachPCIDevices() to be automatically unrefed using
      VIR_AUTOUNREF() but I forgot to remove the line that explicitly
      unrefs the object at the end of the function.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      894f3e0e
    • D
      docs: remove devhelp API docs · 926b7b6e
      Daniel P. Berrangé 提交于
      We currently generate two completely separate API references for the
      libvirt public API. One at 'docs/html/' and one at 'docs/devhelp/'.
      Both are published on the website, but we only link to content in
      the 'docs/html/' pages.
      
      Both are installed in the libvirt-docs sub-RPM, with a full copy
      of the website including 'docs/html/' in /usr/share/docs/libvirt-docs,
      while the 'docs/devhelp/' content goes to /usr/share/gtk-doc/. The
      latter was broken for years until:
      
        commit ca6f6025
        Author: Andrea Bolognani <abologna@redhat.com>
        Date:   Fri May 10 14:54:52 2019 +0200
      
          docs: Introduce $(devhelphtml_generated)
      
          Our XSLT magic generates one Devhelp-compatible HTML file
          per documentation module, but so far we have only shipped
          and installed documentation for virterror.
      
          Now that we have $(modules), however, we can generate the
          list of files the same way we do for regular documentation
          and make sure we always ship and install everything.
      
      That this bug went unnoticed for so long is a sign of how few
      people are using the devhelp docs. The only commits to the devhelp
      code since it was first introduced have been fixing various build
      problems that hit.
      
      The only obvious difference between the two sets of docs is the CSS
      styling in use. Overall devhelp does not look compelling enough to
      justify having two duplicated sets of API docs. Eliminating it will
      reduce the amount of XSL code we are carrying in the tree which is
      an attractive benefit.
      Reviewed-by: NPavel Hrdina <phrdina@redhat.com>
      Reviewed-by: NAndrea Bolognani <abologna@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      926b7b6e
    • D
      qemu_conf.c: introduce qemuAddRemoveSharedDeviceInternal · 807a6dd3
      Daniel Henrique Barboza 提交于
      After the previous commits, qemuAddSharedDevice() and
      qemuRemoveSharedDevice() are now the same code with a different
      flag to call the internal functions.
      
      This patch aggregates the common code into a new function called
      qemuAddRemoveSharedDeviceInternal() to further reduce
      code repetition. Both qemuAddSharedDevice() and
      qemuRemoveSharedDevice() are kept since they are public
      functions used elsewhere.
      
      No functional change was made.
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Reviewed-by: NPavel Hrdina <phrdina@redhat.com>
      807a6dd3