1. 21 7月, 2016 5 次提交
    • J
      Assign addresses to USB devices · bf182078
      Ján Tomko 提交于
      Automatically assign addresses to USB devices.
      
      Just like reserving, this is only done for newly defined domains.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1215968
      bf182078
    • J
      Reserve existing USB addresses · ddd31fd7
      Ján Tomko 提交于
      Check if they fit on the USB controllers the domain has,
      and error out if two devices try to use the same address.
      ddd31fd7
    • J
      Add functions for adding USB hubs to addrs · 2f081351
      Ján Tomko 提交于
      Walk through all the usb hubs in the domain definition
      that have a USB address specified, create the
      corresponding structures in the virDomainUSBAddressSet
      and mark the port it occupies as used.
      2f081351
    • J
      Add functions for adding USB controllers to addrs · 6b3e4e2b
      Ján Tomko 提交于
      Walk through all the usb controllers in the domain definition
      and create the corresponding structures in the virDomainUSBAddressSet.
      6b3e4e2b
    • J
      Introduce virDomainUSBAddressSet · 82c142b3
      Ján Tomko 提交于
      A new type to track USB addresses.
      
      Every <controller type='usb' index='i'/> is represented by an
      object of type virDomainUSBAddressHub located at buses[i].
      
      Each of these hubs has up to 'nports' ports.
      If a port is occupied, it has the corresponding bit set in
      the 'ports' bitmap, e.g. port 1 would have the 0th bit set.
      If there is a hub on this port, then hubs[i] will point
      to this hub.
      82c142b3
  2. 18 7月, 2016 1 次提交
    • J
      Store USB port path as an array of integers · f820d5bf
      Ján Tomko 提交于
      In preparation to tracking which USB addresses are occupied.
      Introduce two helper functions for printing the port path
      as a string and appending it to a virBuffer.
      f820d5bf
  3. 21 5月, 2016 1 次提交
    • L
      qemu: auto-assign addresses when <address type='pci'/> is specified · c026f8f1
      Laine Stump 提交于
      Rather than only assigning a PCI address when no address is given at
      all, also do it when the config says that the address type is 'pci',
      but it gives no address (virDeviceInfoPCIAddressWanted()).
      
      There are also several places after parsing but prior to address
      assignment where code previously expected that any info with address
      type='pci' would have a *valid* PCI address, which isn't always the
      case - now we check not only for type='pci', but also for a valid
      address (virDeviceInfoPCIAddressPresent()).
      
      The test case added in this patch was directly copied from Cole's patch titled:
      
          qemu: Wire up address type=pci auto_allocate
      c026f8f1
  4. 02 5月, 2016 1 次提交
    • M
      Change virDevicePCIAddress to virPCIDeviceAddress · c36b1f7b
      Martin Kletzander 提交于
      We had both and the only difference was that the latter also included
      information about multifunction setting.  The problem with that was that
      we couldn't use functions made for only one of the structs (e.g.
      parsing).  To consolidate those two structs, use the one in virpci.h,
      include that in domain_conf.h and add the multifunction member in it.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      c36b1f7b
  5. 15 4月, 2016 6 次提交
    • L
      conf: new pci controller model pcie-expander-bus · bc07251f
      Laine Stump 提交于
      This controller provides a single PCIe port on a new root. It is
      similar to pci-expander-bus, intended to provide a bus that can be
      associated with a guest-identifiable NUMA node, but is for
      machinetypes with PCIe rather than PCI (e.g. q35-based machinetypes).
      
      Aside from PCIe vs. PCI, the other main difference is that a
      pci-expander-bus has a companion pci-bridge that is automatically
      attached along with it, but pcie-expander-bus has only a single port,
      and that port will only connect to a pcie-root-port, or to a
      pcie-switch-upstream-port. In order for the bus to be of any use in
      the guest, it must have either a pcie-root-port or a
      pcie-switch-upstream-port attached (and one or more
      pcie-switch-downstream-ports attached to the
      pcie-switch-upstream-port).
      bc07251f
    • L
      conf: new pci controller model pci-expander-bus · 52f3d0a4
      Laine Stump 提交于
      This is a standard PCI root bus (not a bridge) that can be added to a
      440fx-based domain. Although it uses a PCI slot, this is *not* how it
      is connected into the PCI bus hierarchy, but is only used for
      control. Each pci-expander-bus provides 32 slots (0-31) that can
      accept hotplug of standard PCI devices.
      
      The usefulness of pci-expander-bus relative to a pci-bridge is that
      the NUMA node of the bus can be specified with the <node> subelement
      of <target>. This gives guest-side visibility to the NUMA node of
      attached devices (presuming that management apps only assign a device
      to a bus that has a NUMA node number matching the node number of the
      device on the host).
      
      Each pci-expander-bus also has a "busNr" attribute. The expander-bus
      itself will take the busNr specified, and all buses that are connected
      to this bus (including the pci-bridge that is automatically added to
      any expander bus of model "pxb" (see the next commit)) will use
      busNr+1, busNr+2, etc, and the pci-root (or the expander-bus with next
      lower busNr) will use bus numbers lower than busNr.
      52f3d0a4
    • L
      conf: utility function to convert PCI controller model into connect type · a0616ee8
      Laine Stump 提交于
      There are two places in qemu_domain_address.c where we have a switch
      statement to convert PCI controller models
      (VIR_DOMAIN_CONTROLLER_MODEL_PCI*) into the connection type flag that
      is matched when looking for an upstream connection for that model of
      controller (VIR_PCI_CONNECT_TYPE_*). This patch makes a utility
      function in conf/domain_addr.c to do that, so that when a new PCI
      controller is added, we only need to add the new model-->connect-type
      in a single place.
      a0616ee8
    • L
      conf/qemu: change the way VIR_PCI_CONNECT_TYPE_* flags work · d1cc4605
      Laine Stump 提交于
      The flags used to determine which devices could be plugged into which
      controllers were quite confusing, as they tried to create classes of
      connections, then put particular devices into possibly multiple
      classes, while sometimes setting multiple flags for the controllers
      themselves. The attempt to have a single flag indicate, e.g. that a
      root-port or a switch-downstream-port could connect was not only
      confusing, it was leading to a situation where it would be impossible
      to specify exactly the right combinations for a new controller.
      
      The solution is for the VIR_PCI_CONNECT_TYPE_* flags to have a 1:1
      correspondence with each type of PCI controller, plus a flag for a PCI
      endpoint device and another for a PCIe endpoint device (the only
      exception to this is that pci-bridge and pcie-expander-bus controllers
      have their upstream connection classified as
      VIR_PCI_CONNECT_TYPE_PCI_DEVICE since they can be plugged into
      *exactly* the same ports as any endpoint device).  Each device then
      has a single flag for connect type (plus the HOTPLUG flag if that
      device can e hotplugged), and each controller sets the CONNECT bits
      for all controllers that can be plugged into it, as well as for either
      type of endpoint device that can be plugged in (and the HOTPLUG flag
      if it can accept hotplugged devices).
      
      With this change, it is *slightly* easier to understand the matching
      of connections (as long as you remember that the flag for a
      device/upstream-facing connection of a controller is the same as that
      device's type, while the flags for a controller's downstream
      connections is the OR of all device types that can be plugged into
      that controller). More importantly, it will be possible to correctly
      specify what can be plugged into a pcie-switch-expander-bus, when
      support for it is added.
      d1cc4605
    • L
      conf: allow use of slot 0 in a dmi-to-pci-bridge · 0d668434
      Laine Stump 提交于
      When support for dmi-to-pci-bridge was added, it was assumed that,
      just as with the pci-root bus, slot 0 was reserved. This is not the
      case - it can be used to connect a device just like any other slot, so
      remove the restriction and update the test cases that auto-assign an
      address on a dmi-to-pci-bridge.
      0d668434
    • L
      conf: use #define instead of literal for highest slot in upstream port · 6d0902a5
      Laine Stump 提交于
      Every other maxSlot was either set to 0 or to
      VIR_PCI_ADDRESS_SLOT_LAST, but this one was for some reason set to the
      literal value 31 (which is the same as VIR_PCI_ADDRESS_SLOT_LAST).
      This makes them all consistent.
      6d0902a5
  6. 17 12月, 2015 2 次提交
  7. 10 8月, 2015 3 次提交
    • L
      conf: new pcie-controller model "pcie-switch-downstream-port" · 76379a6e
      Laine Stump 提交于
      This controller can be connected only to a port on a
      pcie-switch-upstream-port. It provides a single hotpluggable port that
      will accept any PCI or PCIe device, as well as any device requiring a
      pcie-*-port (the only current example of such a device is the
      pcie-switch-upstream-port).
      76379a6e
    • L
      conf: new pci controller model "pcie-switch-upstream-port" · 38ea9515
      Laine Stump 提交于
      This controller can be connected only to a pcie-root-port or a
      pcie-switch-downstream-port (which will be added in a later patch),
      which is the reason for the new connect type
      VIR_PCI_CONNECT_TYPE_PCIE_PORT. A pcie-switch-upstream-port provides
      32 ports (slot=0 to slot=31) on the downstream side, which can only
      have pci controllers of model "pcie-switch-downstream-port" plugged
      into them, which is the reason for the other new connect type
      VIR_PCI_CONNECT_TYPE_PCIE_SWITCH.
      38ea9515
    • L
      conf: new pci controller model "pcie-root-port" · dce3b8be
      Laine Stump 提交于
      This controller can be connected (at domain startup time only - not
      hotpluggable) only to a port on the pcie root complex ("pcie-root" in
      libvirt config), hence the new connect type
      VIR_PCI_CONNECT_TYPE_PCIE_ROOT. It provides a hotpluggable port that
      will accept any PCI or PCIe device.
      
      New attributes must be added to the controller <target> subelement for
      this - chassis and port are guest-visible option values that will be
      set by libvirt with values derived from the controller's index and pci
      address information.
      dce3b8be
  8. 25 7月, 2015 1 次提交
    • L
      conf: pay attention to bus minSlot/maxSlot when autoassigning PCI addresses · d4cf72af
      Laine Stump 提交于
      The function that auto-assigns PCI addresses was written with the
      hardcoded assumptions that any PCI bus would have slots available
      starting at 1 and ending at 31. This isn't true for many types of
      controllers (some have a single slot/port at 0, some have slots/ports
      from 0 to 31). This patch updates that function to remove the
      hardcoded assumptions. It will properly find/assign addresses for
      devices that can only connect to pcie-(root|downstream)-port (which
      have minSlot/maxSlot of 0/0) or a pcie-switch-upstream-port (0/31).
      
      It still will not auto-create a new bus of the proper kind for these
      connections when one doesn't exist, that task is for another day.
      d4cf72af
  9. 27 6月, 2015 2 次提交
    • L
      qemu: ignore assumptions about hotplug requirement when address is from config · 9a12b6cd
      Laine Stump 提交于
      Certain PCI buses don't support hotplug, and when automatically
      assigning PCI addresses for devices, libvirt is very conservative in
      its assumptions about whether or not a device will need to be
      hotplugged/unplugged in the future. But if the user manually assigns
      an address, they likely are aware of any hotplug requirements of the
      device (or at least they should be).
      
      In short, after this patch, automatically PCI address assignment will
      assume that the device must be plugged in to a hot-pluggable slot, but
      manually assignment can place the device in any bus that is
      compatible, regardless of whether or not it supports hotplug. If the
      user makes a mistake and plugs the device into a bus that doesn't
      support hotplug, then later tries to do a hot-unplug, qemu will give
      an appropriate error.
      
      (in the future we may want to add a "hotpluggable" attribute to all
      devices, with default being "yes" for autoassign, and "no" for manual
      assign).
      9a12b6cd
    • L
      qemu: always permit PCI devices to be manually assigned to a PCIe bus · 1e15be1b
      Laine Stump 提交于
      When support for the pcie-root and dmi-to-pci-bridge buses on a Q35
      machinetype was added, I was concerned that even though qemu at the
      time allowed plugging a PCI device into a PCIe port, that it might not
      be supported in the future. To prevent painful backtracking in the
      possible future where this happened, I disallowed such connections
      except in a few specific cases requested by qemu developers (indicated
      in the code with the flag VIR_PCI_CONNECT_TYPE_EITHER_IF_CONFIG).
      
      Now that a couple years have passed, there is a clear message from
      qemu that there is no danger in allowing PCI devices to be plugged
      into PCIe ports. This patch eliminates
      VIR_PCI_CONNECT_TYPE_EITHER_IF_CONFIG and changes the code to always
      allow PCI->PCIe or PCIe->PCI connection *when the PCI address is
      specified in the config. (For newly added devices that haven't yet
      been given a PCI address, the auto-placement still prefers using the
      correct type of bus).
      1e15be1b
  10. 08 4月, 2015 1 次提交
    • M
      virDomainVirtioSerialAddrSetFree: Fix memleak · 8d971cec
      Michal Privoznik 提交于
      ==19015== 8 bytes in 1 blocks are definitely lost in loss record 34 of 1,049
      ==19015==    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==19015==    by 0x4C2C32F: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==19015==    by 0x52AD888: virReallocN (viralloc.c:245)
      ==19015==    by 0x52AD97E: virExpandN (viralloc.c:294)
      ==19015==    by 0x52ADC51: virInsertElementsN (viralloc.c:436)
      ==19015==    by 0x5335864: virDomainVirtioSerialAddrSetAddController (domain_addr.c:816)
      ==19015==    by 0x53358E0: virDomainVirtioSerialAddrSetAddControllers (domain_addr.c:839)
      ==19015==    by 0x1DD5513B: qemuDomainAssignVirtioSerialAddresses (qemu_command.c:1422)
      ==19015==    by 0x1DD55A6E: qemuDomainAssignAddresses (qemu_command.c:1711)
      ==19015==    by 0x1DDA5818: qemuProcessStart (qemu_process.c:4616)
      ==19015==    by 0x1DDF1807: qemuDomainObjStart (qemu_driver.c:7265)
      ==19015==    by 0x1DDF1A66: qemuDomainCreateWithFlags (qemu_driver.c:7320)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      8d971cec
  11. 02 4月, 2015 2 次提交
  12. 23 6月, 2014 1 次提交
  13. 21 6月, 2014 1 次提交
  14. 14 5月, 2014 1 次提交
    • R
      qemu: extract common PCI handling functions · 353cf370
      Roman Bogorodskiy 提交于
      Move sharable PCI handling functions to domain_addr.[ch], and
      change theirs prefix from 'qemu' to 'vir':
      
       - virDomainPCIAddressAsString;
       - virDomainPCIAddressBusSetModel;
       - virDomainPCIAddressEnsureAddr;
       - virDomainPCIAddressFlagsCompatible;
       - virDomainPCIAddressGetNextSlot;
       - virDomainPCIAddressReleaseSlot;
       - virDomainPCIAddressReserveAddr;
       - virDomainPCIAddressReserveNextSlot;
       - virDomainPCIAddressReserveSlot;
       - virDomainPCIAddressSetFree;
       - virDomainPCIAddressSetGrow;
       - virDomainPCIAddressSlotInUse;
       - virDomainPCIAddressValidate;
      
      The only change here is function names, the implementation itself
      stays untouched.
      
      Extract common allocation code from DomainPCIAddressSetCreate
      into virDomainPCIAddressSetAlloc.
      353cf370