1. 05 7月, 2016 10 次提交
    • C
      ppc: simplify ppc_hash64_hpte_page_shift_noslb() · 1f0252e6
      Cédric Le Goater 提交于
      The segment page shift parameter is never used. Let's remove it.
      Signed-off-by: NCédric Le Goater <clg@kaod.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      1f0252e6
    • A
      spapr_pci/spapr_pci_vfio: Support Dynamic DMA Windows (DDW) · ae4de14c
      Alexey Kardashevskiy 提交于
      This adds support for Dynamic DMA Windows (DDW) option defined by
      the SPAPR specification which allows to have additional DMA window(s)
      
      The "ddw" property is enabled by default on a PHB but for compatibility
      the pseries-2.6 machine and older disable it.
      This also creates a single DMA window for the older machines to
      maintain backward migration.
      
      This implements DDW for PHB with emulated and VFIO devices. The host
      kernel support is required. The advertised IOMMU page sizes are 4K and
      64K; 16M pages are supported but not advertised by default, in order to
      enable them, the user has to specify "pgsz" property for PHB and
      enable huge pages for RAM.
      
      The existing linux guests try creating one additional huge DMA window
      with 64K or 16MB pages and map the entire guest RAM to. If succeeded,
      the guest switches to dma_direct_ops and never calls TCE hypercalls
      (H_PUT_TCE,...) again. This enables VFIO devices to use the entire RAM
      and not waste time on map/unmap later. This adds a "dma64_win_addr"
      property which is a bus address for the 64bit window and by default
      set to 0x800.0000.0000.0000 as this is what the modern POWER8 hardware
      uses and this allows having emulated and VFIO devices on the same bus.
      
      This adds 4 RTAS handlers:
      * ibm,query-pe-dma-window
      * ibm,create-pe-dma-window
      * ibm,remove-pe-dma-window
      * ibm,reset-pe-dma-window
      These are registered from type_init() callback.
      
      These RTAS handlers are implemented in a separate file to avoid polluting
      spapr_iommu.c with PCI.
      
      This changes sPAPRPHBState::dma_liobn to an array to allow 2 LIOBNs
      and updates all references to dma_liobn. However this does not add
      64bit LIOBN to the migration stream as in fact even 32bit LIOBN is
      rather pointless there (as it is a PHB property and the management
      software can/should pass LIOBNs via CLI) but we keep it for the backward
      migration support.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      ae4de14c
    • A
      vfio/spapr: Create DMA window dynamically (SPAPR IOMMU v2) · 2e4109de
      Alexey Kardashevskiy 提交于
      New VFIO_SPAPR_TCE_v2_IOMMU type supports dynamic DMA window management.
      This adds ability to VFIO common code to dynamically allocate/remove
      DMA windows in the host kernel when new VFIO container is added/removed.
      
      This adds a helper to vfio_listener_region_add which makes
      VFIO_IOMMU_SPAPR_TCE_CREATE ioctl and adds just created IOMMU into
      the host IOMMU list; the opposite action is taken in
      vfio_listener_region_del.
      
      When creating a new window, this uses heuristic to decide on the TCE table
      levels number.
      
      This should cause no guest visible change in behavior.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      [dwg: Added some casts to prevent printf() warnings on certain targets
       where the kernel headers' __u64 doesn't match uint64_t or PRIx64]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      2e4109de
    • A
      vfio: Add host side DMA window capabilities · f4ec5e26
      Alexey Kardashevskiy 提交于
      There are going to be multiple IOMMUs per a container. This moves
      the single host IOMMU parameter set to a list of VFIOHostDMAWindow.
      
      This should cause no behavioral change and will be used later by
      the SPAPR TCE IOMMU v2 which will also add a vfio_host_win_del() helper.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      f4ec5e26
    • A
      vfio: spapr: Add DMA memory preregistering (SPAPR IOMMU v2) · 318f67ce
      Alexey Kardashevskiy 提交于
      This makes use of the new "memory registering" feature. The idea is
      to provide the userspace ability to notify the host kernel about pages
      which are going to be used for DMA. Having this information, the host
      kernel can pin them all once per user process, do locked pages
      accounting (once) and not spent time on doing that in real time with
      possible failures which cannot be handled nicely in some cases.
      
      This adds a prereg memory listener which listens on address_space_memory
      and notifies a VFIO container about memory which needs to be
      pinned/unpinned. VFIO MMIO regions (i.e. "skip dump" regions) are skipped.
      
      The feature is only enabled for SPAPR IOMMU v2. The host kernel changes
      are required. Since v2 does not need/support VFIO_IOMMU_ENABLE, this does
      not call it when v2 is detected and enabled.
      
      This enforces guest RAM blocks to be host page size aligned; however
      this is not new as KVM already requires memory slots to be host page
      size aligned.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      [dwg: Fix compile error on 32-bit host]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      318f67ce
    • A
      spapr_iommu: Realloc guest visible TCE table when starting/stopping listening · 606b5498
      Alexey Kardashevskiy 提交于
      The sPAPR TCE tables manage 2 copies when VFIO is using an IOMMU -
      a guest view of the table and a hardware TCE table. If there is no VFIO
      presense in the address space, then just the guest view is used, if
      this is the case, it is allocated in the KVM. However since there is no
      support yet for VFIO in KVM TCE hypercalls, when we start using VFIO,
      we need to move the guest view from KVM to the userspace; and we need
      to do this for every IOMMU on a bus with VFIO devices.
      
      This implements the callbacks for the sPAPR IOMMU - notify_started()
      reallocated the guest view to the user space, notify_stopped() does
      the opposite.
      
      This removes explicit spapr_tce_set_need_vfio() call from PCI hotplug
      path as the new callbacks do this better - they notify IOMMU at
      the exact moment when the configuration is changed, and this also
      includes the case of PCI hot unplug.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Acked-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      606b5498
    • G
      ppc: simplify max_smt initialization in ppc_cpu_realizefn() · c4e6c423
      Greg Kurz 提交于
      kvmppc_smt_threads() returns 1 if KVM is not enabled.
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      c4e6c423
    • B
      spapr: Ensure thread0 of CPU core is always realized first · 7093645a
      Bharata B Rao 提交于
      During CPU core realization, we create all the thread objects and parent
      them to the core object in a loop. However, the realization of thread
      objects is done separately by walking the threads of a core using
      object_child_foreach(). With this, there is no guarantee on the order
      in which the child thread objects get realized. Since CPU device tree
      properties are currently derived from the CPU thread object, we assume
      thread0 of the core to be the representative thread of the core when
      creating device tree properties for the core. If thread0 is not the
      first thread that gets realized, then we would end up having an
      incorrect dt_id for the core and this causes hotplug failures from
      the guest.
      
      Fix this by realizing each thread object by walking the core's thread
      object list thereby ensuring that thread0 and other threads are always
      realized in the correct order.
      
      Future TODO: CPU DT nodes are per-core properties and we should
      ideally base the creation of CPU DT nodes on core objects rather than
      the thread objects.
      Signed-off-by: NBharata B Rao <bharata@linux.vnet.ibm.com>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      7093645a
    • A
      ppc: Fix xsrdpi, xvrdpi and xvrspi rounding · 158c87e5
      Anton Blanchard 提交于
      xsrdpi, xvrdpi and xvrspi use the round ties away method, not round
      nearest even.
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      158c87e5
    • P
      Merge remote-tracking branch 'remotes/kraxel/tags/pull-seabios-20160704-3' into staging · 11659423
      Peter Maydell 提交于
      Revert "bios: Add fast variant of SeaBIOS for use with -kernel on x86."
      
      # gpg: Signature made Mon 04 Jul 2016 16:24:55 BST
      # gpg:                using RSA key 0x4CB6D8EED3E87138
      # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
      # gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
      # gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
      # Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138
      
      * remotes/kraxel/tags/pull-seabios-20160704-3:
        Revert "bios: Add fast variant of SeaBIOS for use with -kernel on x86."
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      11659423
  2. 04 7月, 2016 30 次提交