1. 22 6月, 2016 1 次提交
  2. 07 6月, 2016 3 次提交
    • A
      spapr_iommu: Add root memory region · b4b6eb77
      Alexey Kardashevskiy 提交于
      We are going to have multiple DMA windows at different offsets on
      a PCI bus. For the sake of migration, we will have as many TCE table
      objects pre-created as many windows supported.
      So we need a way to map windows dynamically onto a PCI bus
      when migration of a table is completed but at this stage a TCE table
      object does not have access to a PHB to ask it to map a DMA window
      backed by just migrated TCE table.
      
      This adds a "root" memory region (UINT64_MAX long) to the TCE object.
      This new region is mapped on a PCI bus with enabled overlapping as
      there will be one root MR per TCE table, each of them mapped at 0.
      The actual IOMMU memory region is a subregion of the root region and
      a TCE table enables/disables this subregion and maps it at
      the specific offset inside the root MR which is 1:1 mapping of
      a PCI address space.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      b4b6eb77
    • A
      spapr_iommu: Migrate full state · a26fdf39
      Alexey Kardashevskiy 提交于
      The source guest could have reallocated the default TCE table and
      migrate bigger/smaller table. This adds reallocation in post_load()
      if the default table size is different on source and destination.
      
      This adds @bus_offset, @page_shift to the migration stream as
      a subsection so when DDW is added, migration to older machines will
      still be possible. As @bus_offset and @page_shift are not used yet,
      this makes no change in behavior.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      a26fdf39
    • A
      spapr_iommu: Introduce "enabled" state for TCE table · df7625d4
      Alexey Kardashevskiy 提交于
      Currently TCE tables are created once at start and their sizes never
      change. We are going to change that by introducing a Dynamic DMA windows
      support where DMA configuration may change during the guest execution.
      
      This changes spapr_tce_new_table() to create an empty zero-size IOMMU
      memory region (IOMMU MR). Only LIOBN is assigned by the time of creation.
      It still will be called once at the owner object (VIO or PHB) creation.
      
      This introduces an "enabled" state for TCE table objects, some
      helper functions are added:
      - spapr_tce_table_enable() receives TCE table parameters, stores in
      sPAPRTCETable and allocates a guest view of the TCE table
      (in the user space or KVM) and sets the correct size on the IOMMU MR;
      - spapr_tce_table_disable() disposes the table and resets the IOMMU MR
      size; it is made public as the following DDW code will be using it.
      
      This changes the PHB reset handler to do the default DMA initialization
      instead of spapr_phb_realize(). This does not make differenct now but
      later with more than just one DMA window, we will have to remove them all
      and create the default one on a system reset.
      
      No visible change in behaviour is expected except the actual table
      will be reallocated every reset. We might optimize this later.
      
      The other way to implement this would be dynamically create/remove
      the TCE table QOM objects but this would make migration impossible
      as the migration code expects all QOM objects to exist at the receiver
      so we have to have TCE table objects created when migration begins.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      df7625d4
  3. 27 5月, 2016 2 次提交
  4. 19 5月, 2016 1 次提交
  5. 29 1月, 2016 1 次提交
    • P
      ppc: Clean up includes · 0d75590d
      Peter Maydell 提交于
      Clean up includes so that osdep.h is included first and headers
      which it implies are not included manually.
      
      This commit was created with scripts/clean-includes.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1453832250-766-6-git-send-email-peter.maydell@linaro.org
      0d75590d
  6. 23 10月, 2015 2 次提交
    • D
      spapr_iommu: Provide a function to switch a TCE table to allowing VFIO · c10325d6
      David Gibson 提交于
      Because of the way non-VFIO guest IOMMU operations are KVM accelerated, not
      all TCE tables (guest IOMMU contexts) can support VFIO devices.  Currently,
      this is decided at creation time.
      
      To support hotplug of VFIO devices, we need to allow a TCE table which
      previously didn't allow VFIO devices to be switched so that it can.  This
      patch adds an spapr_tce_set_need_vfio() function to do this, by
      reallocating the table in userspace if necessary.
      
      Currently this doesn't allow the KVM acceleration to be re-enabled if all
      the VFIO devices are removed.  That's an optimization for another time.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NLaurent Vivier <lvivier@redhat.com>
      c10325d6
    • D
      spapr_iommu: Rename vfio_accel parameter · 6a81dd17
      David Gibson 提交于
      The vfio_accel parameter used when creating a new TCE table (guest IOMMU
      context) has a confusing name.  What it really means is whether we need the
      TCE table created to be able to support VFIO devices.
      
      VFIO is relevant, because when available we use in-kernel acceleration of
      the TCE table, but that may not work with VFIO devices because updates to
      the table are handled in kernel, bypass qemu and so don't hit qemu's
      infrastructure for keeping the VFIO host IOMMU state in sync with the guest
      IOMMU state.
      
      Rename the parameter to "need_vfio" throughout.  This is a cosmetic change,
      with no impact on the logic.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NLaurent Vivier <lvivier@redhat.com>
      6a81dd17
  7. 07 7月, 2015 3 次提交
  8. 04 6月, 2015 6 次提交
  9. 09 3月, 2015 1 次提交
    • A
      spapr_vio/spapr_iommu: Move VIO bypass where it belongs · ee9a569a
      Alexey Kardashevskiy 提交于
      Instead of tweaking a TCE table device by adding there a bypass flag,
      let's add an alias to RAM and IOMMU memory region, and enable/disable
      those according to the selected bypass mode.
      This way IOMMU memory region can have size of the actual window rather
      than ram_size which is essential for upcoming DDW support.
      
      This moves bypass logic to VIO layer and keeps @bypass flag in TCE table
      for migration compatibility only. This replaces spapr_tce_set_bypass()
      calls with explicit assignment to avoid confusion as the function could
      do something more that just syncing the @bypass flag.
      
      This adds a pointer to VIO device into the sPAPRTCETable struct to provide
      the sPAPRTCETable device a way to update bypass mode for the VIO device.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      ee9a569a
  10. 17 2月, 2015 1 次提交
  11. 07 1月, 2015 1 次提交
    • D
      PPC: Fix crash on spapr_tce_table_finalize() · 5f9490de
      David Gibson 提交于
      spapr_tce_table_finalize() can SEGV if the object was not previously
      realized.  In particular this can be triggered by running
               qemu-system-ppc -device spapr-tce-table,?
      
      The basic problem is that we have mismatched initialization versus
      finalization: spapr_tce_table_finalize() is attempting to undo things that
      are done in spapr_tce_table_realize(), not an instance_init function.
      
      Therefore, replace spapr_tce_table_finalize() with
      spapr_tce_table_unrealize().
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      5f9490de
  12. 29 8月, 2014 1 次提交
  13. 15 7月, 2014 1 次提交
  14. 27 6月, 2014 1 次提交
    • A
      spapr_iommu: Make in-kernel TCE table optional · 9bb62a07
      Alexey Kardashevskiy 提交于
      POWER KVM supports an KVM_CAP_SPAPR_TCE capability which allows allocating
      TCE tables in the host kernel memory and handle H_PUT_TCE requests
      targeted to specific LIOBN (logical bus number) right in the host without
      switching to QEMU. At the moment this is used for emulated devices only
      and the handler only puts TCE to the table. If the in-kernel H_PUT_TCE
      handler finds a LIOBN and corresponding table, it will put a TCE to
      the table and complete hypercall execution. The user space will not be
      notified.
      
      Upcoming VFIO support is going to use the same sPAPRTCETable device class
      so KVM_CAP_SPAPR_TCE is going to be used as well. That means that TCE
      tables for VFIO are going to be allocated in the host as well.
      However VFIO operates with real IOMMU tables and simple copying of
      a TCE to the real hardware TCE table will not work as guest physical
      to host physical address translation is requited.
      
      So until the host kernel gets VFIO support for H_PUT_TCE, we better not
      to register VFIO's TCE in the host.
      
      This adds a place holder for KVM_CAP_SPAPR_TCE_VFIO capability. It is not
      in upstream yet and being discussed so now it is always false which means
      that in-kernel VFIO acceleration is not supported.
      
      This adds a bool @vfio_accel flag to the sPAPRTCETable device telling
      that sPAPRTCETable should not try allocating TCE table in the host kernel
      for VFIO. The flag is false now as at the moment there is no VFIO.
      
      This adds an vfio_accel parameter to spapr_tce_new_table(), the semantic
      is the same. Since there is only emulated PCI and VIO now, the flag is set
      to false. Upcoming VFIO support will set it to true.
      
      This is a preparation patch so no change in behaviour is expected
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      9bb62a07
  15. 16 6月, 2014 8 次提交
  16. 08 5月, 2014 1 次提交
  17. 05 3月, 2014 1 次提交
  18. 02 9月, 2013 1 次提交
  19. 29 7月, 2013 1 次提交
  20. 04 7月, 2013 2 次提交
  21. 20 6月, 2013 1 次提交