1. 20 6月, 2013 1 次提交
  2. 19 4月, 2013 1 次提交
  3. 16 4月, 2013 1 次提交
    • M
      pci: add pci test device · 22773d60
      Michael S. Tsirkin 提交于
      This device is used for kvm unit tests,
      currently it supports testing performance of ioeventfd.
      Using updated kvm unittest, here's an example output:
              mmio-no-eventfd:pci-mem 8796
              mmio-wildcard-eventfd:pci-mem 3609
              mmio-datamatch-eventfd:pci-mem 3685
              portio-no-eventfd:pci-io 5287
              portio-wildcard-eventfd:pci-io 1762
              portio-datamatch-eventfd:pci-io 1777
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      22773d60
  4. 09 4月, 2013 1 次提交
    • P
      hw: move headers to include/ · 0d09e41a
      Paolo Bonzini 提交于
      Many of these should be cleaned up with proper qdev-/QOM-ification.
      Right now there are many catch-all headers in include/hw/ARCH depending
      on cpu.h, and this makes it necessary to compile these files per-target.
      However, fixing this does not belong in these patches.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0d09e41a
  5. 27 3月, 2013 5 次提交
  6. 25 3月, 2013 1 次提交
  7. 09 1月, 2013 2 次提交
  8. 26 12月, 2012 1 次提交
  9. 19 12月, 2012 2 次提交
  10. 17 12月, 2012 2 次提交
  11. 16 11月, 2012 1 次提交
  12. 29 10月, 2012 2 次提交
  13. 22 10月, 2012 2 次提交
    • A
      pci: honor PCI_COMMAND_MASTER · 1c380f94
      Avi Kivity 提交于
      Currently we ignore PCI_COMMAND_MASTER completely: DMA succeeds even when
      the bit is clear.
      
      Honor PCI_COMMAND_MASTER by inserting a memory region into the device's
      bus master address space, and tying its enable status to PCI_COMMAND_MASTER.
      
      Tested using
      
        setpci -s 03 COMMAND=3
      
      while a ping was running on a NIC in slot 3.  The kernel (Linux) detected
      the stall and recovered after the command
      
        setpci -s 03 COMMAND=7
      
      was issued.
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      1c380f94
    • A
      pci: give each device its own address space · 817dcc53
      Avi Kivity 提交于
      Accesses from different devices can resolve differently
      (depending on bridge settings, iommus, and PCI_COMMAND_MASTER), so
      set up an address space for each device.
      
      Currently iommus are expressed outside the memory API, so this doesn't
      work if an iommu is present.
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      817dcc53
  14. 07 10月, 2012 1 次提交
  15. 19 7月, 2012 2 次提交
    • J
      pci: Add INTx routing notifier · 0ae16251
      Jan Kiszka 提交于
      This per-device notifier shall be triggered by any interrupt router
      along the path of a device's legacy interrupt signal on routing changes.
      For simplicity reasons and as this is a slow path anyway, no further
      details on the routing changes are provided. Instead, the callback is
      expected to use pci_device_route_intx_to_irq to check the effect of the
      change.
      
      Will be used by KVM PCI device assignment and VFIO.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      0ae16251
    • M
      pci: Add pci_device_route_intx_to_irq · 3afa9bb4
      Michael S. Tsirkin 提交于
      Device assigned on KVM needs to know the mode
      (enabled/inverted/disabled) and the IRQ number that a given device
      triggers in the attached interrupt controller.
      
      Add a PCI IRQ path discovery function that walks from a given device to
      the host bridge, and gets this information.  For
      this purpose, a host bridge callback function is introduced:
      route_intx_to_irq. It is so far only implemented by the PIIX3, other
      host bridges can be added later on as required.
      
      Will be used for KVM PCI device assignment and VFIO.
      
      Based on patch by Jan Kiszka, with minor tweaks.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      3afa9bb4
  16. 04 7月, 2012 1 次提交
  17. 28 6月, 2012 3 次提交
    • D
      iommu: Allow PCI to use IOMMU infrastructure · 5fa45de5
      David Gibson 提交于
      This patch adds some hooks to let PCI devices and busses use the new IOMMU
      infrastructure.  When IOMMU support is enabled, each PCI device now
      contains a DMAContext * which is used by the pci_dma_*() wrapper functions.
      
      By default, the contexts are initialized to NULL, assuming no IOMMU.
      However the platform or host bridge code which sets up the PCI bus can use
      pci_setup_iommu() to set a function which will determine the correct
      DMAContext for a given PCI device.
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NEduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      5fa45de5
    • D
      iommu: Make sglists and dma_bdrv helpers use new universal DMA helpers · c65bcef3
      David Gibson 提交于
      dma-helpers.c contains a number of helper functions for doing
      scatter/gather DMA, and various block device related DMA.  Currently,
      these directly access guest memory using cpu_physical_memory_*(),
      assuming no IOMMU translation.
      
      This patch updates this code to use the new universal DMA helper
      functions.  qemu_sglist_init() now takes a DMAContext * to describe
      the DMA address space in which the scatter/gather will take place.
      
      We minimally update the callers qemu_sglist_init() to pass NULL
      (i.e. no translation, same as current behaviour).  Some of those
      callers should pass something else in some cases to allow proper IOMMU
      translation in future, but that will be fixed in later patches.
      
      Cc: Kevin Wolf <kwolf@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      c65bcef3
    • D
      iommu: Add universal DMA helper functions · d86a77f8
      David Gibson 提交于
      Not that long ago, every device implementation using DMA directly
      accessed guest memory using cpu_physical_memory_*().  This meant that
      adding support for a guest visible IOMMU would require changing every
      one of these devices to go through IOMMU translation.
      
      Shortly before qemu 1.0, I made a start on fixing this by providing
      helper functions for PCI DMA.  These are currently just stubs which
      call the direct access functions, but mean that an IOMMU can be
      implemented in one place, rather than for every PCI device.
      
      Clearly, this doesn't help for non PCI devices, which could also be
      IOMMU translated on some platforms.  It is also problematic for the
      devices which have both PCI and non-PCI version (e.g. OHCI, AHCI) - we
      cannot use the the pci_dma_*() functions, because they assume the
      presence of a PCIDevice, but we don't want to have to check between
      pci_dma_*() and cpu_physical_memory_*() every time we do a DMA in the
      device code.
      
      This patch makes the first step on addressing both these problems, by
      introducing new (stub) dma helper functions which can be used for any
      DMA capable device.
      
      These dma functions take a DMAContext *, a new (currently empty)
      variable describing the DMA address space in which the operation is to
      take place.  NULL indicates untranslated DMA directly into guest
      physical address space.  The intention is that in future non-NULL
      values will given information about any necessary IOMMU translation.
      
      DMA using devices must obtain a DMAContext (or, potentially, contexts)
      from their bus or platform.  For now this patch just converts the PCI
      wrappers to be implemented in terms of the universal wrappers,
      converting other drivers can take place over time.
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
      Cc: Richard Henderson <rth@twiddle.net>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      d86a77f8
  18. 22 6月, 2012 1 次提交
  19. 18 6月, 2012 3 次提交
  20. 08 6月, 2012 1 次提交
  21. 22 5月, 2012 1 次提交
    • J
      msix: Introduce vector notifiers · 2cdfe53c
      Jan Kiszka 提交于
      Vector notifiers shall be triggered by the MSI/MSI-X core whenever a
      relevant configuration change is programmed by the guest. In case of
      MSI-X, changes are reported when the effective mask (global &&
      per-vector) alters its state. On unmask, the current vector
      configuration is included in the event report. This allows users - e.g.
      virtio-pci layer - to transfer this information to external MSI-X
      routing subsystems - like vhost + KVM in-kernel irqchip.
      
      This implementation only provides MSI-X support, but extension to MSI is
      feasible and will be provided later on when adding support for KVM PCI
      device assignment.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      2cdfe53c
  22. 16 3月, 2012 2 次提交
    • M
      slotid: add slot id capability · 762833b3
      Michael S. Tsirkin 提交于
      This capability makes it possible for the guest to
      report a unique chassis identifier to the user.
      
      The spec also recommends making chassis indentifier
      persist in eeprom.
      This isn't implemented.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      762833b3
    • M
      shpc: standard hot plug controller · 1dc324d2
      Michael S. Tsirkin 提交于
      This adds support for SHPC interface, as defined by PCI Standard
      Hot-Plug Controller and Subsystem Specification, Rev 1.0
      http://www.pcisig.com/specifications/conventional/pci_hot_plug/SHPC_10
      
      Only SHPC intergrated with a PCI-to-PCI bridge is supported,
      SHPC integrated with a host bridge would need more work.
      
      All main SHPC features are supported:
      - MRL sensor
      - Attention button
      - Attention indicator
      - Power indicator
      
      Wake on hotplug and serr generation are stubbed out but unused
      as we don't have interfaces to generate these events ATM.
      
      One issue that isn't completely resolved is that qemu currently
      expects an "eject" interface, which SHPC does not provide: it merely
      removes the power to device and it's up to the user to remove the device
      from slot. This patch works around that by ejecting the device
      when power is removed and power LED goes off.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      1dc324d2
  23. 15 3月, 2012 2 次提交
  24. 22 2月, 2012 1 次提交
    • M
      pci: add accessors to get/set registers by mask · c9f50cea
      Michael S. Tsirkin 提交于
      pci_regs.h specifies many registers by mask +
      shifted register values.
      There's always some duplication when using such:
      for example to override device type, we would need:
      
      pci_word_test_and_clear_mask(cap + PCI_EXP_FLAGS,
           PCI_EXP_FLAGS_TYPE);
      pci_word_test_and_set_mask(cap + PCI_EXP_FLAGS,
          PCI_EXP_TYPE_ENDPOINT << (ffs(PCI_EXP_FLAGS_TYPE) - 1));
      
      Getting such registers also uses some duplication:
      
      word = pci_get_word(cap + PCI_EXP_FLAGS) & PCI_EXP_FLAGS_TYPE;
      if ((word >> ffs((PCI_EXP_FLAGS_TYPE) - 1)) == PCI_EXP_TYPE_ENDPOINT)
      
      Add API to access such registers in one line:
      pci_set_word_by_mask(cap + PCI_EXP_FLAGS, PCI_EXP_FLAGS_TYPE,
      		     PCI_EXP_TYPE_ENDPOINT)
      
      and
      word = pci_get_word_by_mask(cap + PCI_EXP_FLAGS, PCI_EXP_FLAGS_TYPE)
      if (word == PCI_EXP_TYPE_ENDPOINT)
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      c9f50cea