1. 02 9月, 2013 2 次提交
    • A
      spapr-pci: rework MSI/MSIX · f1c2dc7c
      Alexey Kardashevskiy 提交于
      On the sPAPR platform a guest allocates MSI/MSIX vectors via RTAS
      hypercalls which return global IRQ numbers to a guest so it only
      operates with those and never touches MSIMessage.
      
      Therefore MSIMessage handling is completely hidden in QEMU.
      
      Previously every sPAPR PCI host bridge implemented its own MSI window
      to catch msi_notify()/msix_notify() calls from QEMU devices (virtio-pci
      or vfio) and route them to the guest via qemu_pulse_irq().
      MSIMessage used to be encoded as:
      	.addr - address within the PHB MSI window;
      	.data - the device index on PHB plus vector number.
      The MSI MR write function translated this MSIMessage to a global IRQ
      number and called qemu_pulse_irq().
      
      However the total number of IRQs is not really big (at the moment it is
      1024 IRQs starting from 4096) and even 16bit data field of MSIMessage
      seems to be enough to store an IRQ number there.
      
      This simplifies MSI handling in sPAPR PHB. Specifically, this does:
      1. remove a MSI window from a PHB;
      2. add a single memory region for all MSIs to sPAPREnvironment
      and spapr_pci_msi_init() to initialize it;
      3. encode MSIMessage as:
          * .addr - a fixed address of SPAPR_PCI_MSI_WINDOW==0x40000000000ULL;
          * .data as an IRQ number.
      4. change IRQ allocator to align first IRQ number in a block for MSI.
      MSI uses lower bits to specify the vector number so the first IRQ has to
      be aligned. MSIX does not need any special allocator though.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NAnthony Liguori <aliguori@us.ibm.com>
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      f1c2dc7c
    • A
      spapr-pci: fix config space access to support bridges · 5dac82ce
      Alexey Kardashevskiy 提交于
      spapr-pci config space accessors use find_dev() to find a PCI device.
      However find_dev() only searched on a primary bus and did not do
      recursive search through secondary buses so config space access was not
      possible for devices other that on a primary bus.
      
      This fixed find_dev() by using the PCI API pci_find_device() function.
      This effectively enabled pci bridges on spapr.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      5dac82ce
  2. 30 7月, 2013 1 次提交
  3. 29 7月, 2013 2 次提交
  4. 25 7月, 2013 1 次提交
  5. 12 7月, 2013 1 次提交
    • S
      spapr: Fix compiler warnings for some versions of gcc · 9a39970d
      Stefan Weil 提交于
      i686-w64-mingw32-gcc (GCC) 4.6.3 from Debian wheezy reports these warnings:
      
      hw/ppc/spapr_hcall.c:188:1: warning:
       control reaches end of non-void function [-Wreturn-type]
      
      hw/ppc/spapr_pci.c:454:1: warning:
       control reaches end of non-void function [-Wreturn-type]
      
      Both warnings are fixed by using g_assert_not_reached instead of assert.
      A second line with assert(0) in spapr_pci.c which did not raise a compiler
      warning was modified, too, because g_assert_not_reached documents the
      purpose of that statement and is not removed in release builds.
      Signed-off-by: NStefan Weil <sw@weilnetz.de>
      Acked-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      9a39970d
  6. 08 7月, 2013 1 次提交
    • D
      pci: Replace pci_find_domain() with more general pci_root_bus_path() · 568f0690
      David Gibson 提交于
      pci_find_domain() is used in a number of places where we want an id for a
      whole PCI domain (i.e. the subtree under a PCI root bus).  The trouble is
      that many platforms may support multiple independent host bridges with no
      hardware supplied notion of domain number.
      
      This patch, therefore, replaces calls to pci_find_domain() with calls to
      a new pci_root_bus_path() returning a string.  The new call is implemented
      in terms of a new callback in the host bridge class, so it can be defined
      in some way that's well defined for the platform.  When no callback is
      available we fall back on the qbus name.
      
      Most current uses of pci_find_domain() are for error or informational
      messages, so the change in identifiers should be harmless.  The exception
      is pci_get_dev_path(), whose results form part of migration streams.  To
      maintain compatibility with old migration streams, the PIIX PCI host is
      altered to always supply "0000" for this path, which matches the old domain
      number (since the code didn't actually support domains other than 0).
      
      For the pseries (spapr) PCI bridge we use a different platform-unique
      identifier (pseries machines can routinely have dozens of PCI host
      bridges).  Theoretically that breaks migration streams, but given that we
      don't yet have migration support for pseries, it doesn't matter.
      
      Any other machines that have working migration support including PCI
      devices will need to be updated to maintain migration stream compatibility.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      568f0690
  7. 04 7月, 2013 3 次提交
  8. 01 7月, 2013 1 次提交
    • A
      spapr-rtas: add CPU argument to RTAS calls · 210b580b
      Anthony Liguori 提交于
      RTAS is a hypervisor provided binary blob that a guest loads and
      calls into to execute certain functions.  It's similar to the
      vsyscall page in Linux or the short lived VMCI paravirt interface
      from VMware.
      
      The QEMU implementation of the RTAS blob is simply a passthrough
      that proxies all RTAS calls to the hypervisor via an hypercall.
      
      While we pass a CPU argument for hypercall handling in QEMU, we
      don't pass it for RTAS calls.  Since some RTAs calls require
      making hypercalls (normally RTAS is implemented as guest code) we
      have nasty hacks to allow that.
      
      Add a CPU argument to RTAS call handling so we can more easily
      invoke hypercalls just as guest code would.
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      210b580b
  9. 20 6月, 2013 3 次提交
  10. 09 4月, 2013 2 次提交
  11. 27 3月, 2013 1 次提交
  12. 22 3月, 2013 1 次提交
    • D
      pseries: Remove "busname" property for PCI host bridge · 89dfd6e1
      David Gibson 提交于
      Currently the "spapr-pci-host-bridge" device has a "busname" property which
      can be used to override the default assignment of qbus names for the bus
      subordinate to the PHB.  We use that for the default primary PCI bus, to
      make libvirt happy, which expects there to be a bus named simply "pci".
      The default qdev core logic would name the bus "pci.0", and the pseries
      code would otherwise name it "pci@800000020000000" which is the name it
      is given in the device tree based on its BUID.
      
      The "busname" property is rather clunky though, so this patch simplifies
      things by just using a special case hack for the default PHB, setting
      busname to "pci" when index=0.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      89dfd6e1
  13. 01 3月, 2013 1 次提交
    • P
      hw: include hw header files with full paths · 83c9f4ca
      Paolo Bonzini 提交于
      Done with this script:
      
      cd hw
      for i in `find . -name '*.h' | sed 's/^..//'`; do
        echo '\,^#.*include.*["<]'$i'[">], s,'$i',hw/&,'
      done | sed -i -f - `find . -type f`
      
      This is so that paths remain valid as files are moved.
      
      Instead, files in hw/dataplane are referenced with the relative path.
      We know they are not going to move to include/, and they are the only
      include files that are in subdirectories _and_ move.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      83c9f4ca
  14. 26 1月, 2013 1 次提交
    • D
      pseries: Improve handling of multiple PCI host bridges · caae58cb
      David Gibson 提交于
      Multiple - even many - PCI host bridges (i.e. PCI domains) are very
      common on real PAPR compliant hardware.  For reasons related to the
      PAPR specified IOMMU interfaces, PCI device assignment with VFIO will
      generally require at least two (virtual) PHBs and possibly more
      depending on which devices are assigned.
      
      At the moment the qemu PAPR PCI code will not deal with this well,
      leaving several crucial parameters of PHBs other than the default one
      uninitialized.  This patch reworks the code to allow this.
      
      Every PHB needs a unique BUID (Bus Unit Identifier, the id used for
      the PAPR PCI related interfaces) and a unique LIOBN (Logical IO Bus
      Number, the id used for the PAPR IOMMU related interfaces).  In
      addition they need windows in CPU real address space to access PCI
      memory space, PCI IO space and MSIs.  Properties are added to the PCI
      host bridge qdevice to allow configuration of all these.
      
      To simplify configuration of multiple PHBs for common cases, a
      convenience "index" property is also added.  This can be set instead
      of the low-level properties, and will generate suitable values for the
      other parameters, different for each index value.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      caae58cb
  15. 22 1月, 2013 1 次提交
  16. 19 12月, 2012 1 次提交
  17. 17 12月, 2012 2 次提交
  18. 27 11月, 2012 1 次提交
  19. 01 11月, 2012 1 次提交
  20. 29 10月, 2012 1 次提交
  21. 23 10月, 2012 1 次提交
    • A
      Rename target_phys_addr_t to hwaddr · a8170e5e
      Avi Kivity 提交于
      target_phys_addr_t is unwieldly, violates the C standard (_t suffixes are
      reserved) and its purpose doesn't match the name (most target_phys_addr_t
      addresses are not target specific).  Replace it with a finger-friendly,
      standards conformant hwaddr.
      
      Outstanding patchsets can be fixed up with the command
      
        git rebase -i --exec 'find -name "*.[ch]"
                              | xargs s/target_phys_addr_t/hwaddr/g' origin
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      a8170e5e
  22. 04 10月, 2012 2 次提交
    • D
      pseries: Remove XICS irq type enum type · ff9d2afa
      David Gibson 提交于
      Currently the XICS interrupt controller emulation uses a custom enum to
      specify whether a given interrupt is level-sensitive or message-triggered.
      This enum makes life awkward for saving the state, and isn't particularly
      useful since there are only two possibilities.  This patch replaces the
      enum with a simple bool.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      ff9d2afa
    • D
      pseries: Reset emulated PCI TCE tables on system reset · eddeed26
      David Gibson 提交于
      The emulated PCI host bridge on the pseries machine incorporates an IOMMU
      (PAPR TCE table).  Currently the mappings in this IOMMU are not cleared
      when we reset the system.  This patch fixes this bug.  To do this it adds
      a new reset function to the IOMMU emulation code.  The VIO devices already
      reset their TCE tables, but they do so by destroying and re-creating their
      DMA context.  This doesn't work for the PCI host bridge, because the
      infrastructure for PCI IOMMUs has already copied/cached the DMA pointer
      context into the subordinate PCI device structures.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      eddeed26
  23. 22 8月, 2012 3 次提交
  24. 16 8月, 2012 6 次提交