1. 20 4月, 2017 16 次提交
  2. 07 4月, 2017 1 次提交
  3. 10 3月, 2017 1 次提交
  4. 02 3月, 2017 5 次提交
  5. 01 3月, 2017 2 次提交
    • P
      KVM: PPC: Book3S HV: Don't use ASDR for real-mode HPT faults on POWER9 · 4e5acdc2
      Paul Mackerras 提交于
      In HPT mode on POWER9, the ASDR register is supposed to record
      segment information for hypervisor page faults.  It turns out that
      POWER9 DD1 does not record the page size information in the ASDR
      for faults in guest real mode.  We have the necessary information
      in memory already, so by moving the checks for real mode that already
      existed, we can use the in-memory copy.  Since a load is likely to
      be faster than reading an SPR, we do this unconditionally (not just
      for POWER9 DD1).
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      4e5acdc2
    • P
      KVM: PPC: Book3S HV: Fix software walk of guest process page tables · 70cd4c10
      Paul Mackerras 提交于
      This fixes some bugs in the code that walks the guest's page tables.
      These bugs cause MMIO emulation to fail whenever the guest is in
      virtial mode (MMU on), leading to the guest hanging if it tried to
      access a virtio device.
      
      The first bug was that when reading the guest's process table, we were
      using the whole of arch->process_table, not just the field that contains
      the process table base address.  The second bug was that the mask used
      when reading the process table entry to get the radix tree base address,
      RPDB_MASK, had the wrong value.
      
      Fixes: 9e04ba69 ("KVM: PPC: Book3S HV: Add basic infrastructure for radix guests")
      Fixes: e9983344 ("powerpc/mm/radix: Add partition table format & callback")
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      70cd4c10
  6. 25 2月, 2017 2 次提交
  7. 18 2月, 2017 1 次提交
  8. 17 2月, 2017 3 次提交
  9. 16 2月, 2017 1 次提交
    • D
      KVM: PPC: Book3S HV: Prevent double-free on HPT resize commit path · 5b73d634
      David Gibson 提交于
      resize_hpt_release(), called once the HPT resize of a KVM guest is
      completed (successfully or unsuccessfully) frees the state structure for
      the resize.  It is currently not safe to call with a NULL pointer.
      
      However, one of the error paths in kvm_vm_ioctl_resize_hpt_commit() can
      invoke it with a NULL pointer.  This will occur if userspace improperly
      invokes KVM_PPC_RESIZE_HPT_COMMIT without previously calling
      KVM_PPC_RESIZE_HPT_PREPARE, or if it calls COMMIT twice without an
      intervening PREPARE.
      
      To fix this potential crash bug - and maybe others like it, make it safe
      (and a no-op) to call resize_hpt_release() with a NULL resize pointer.
      
      Found by Dan Carpenter with a static checker.
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      5b73d634
  10. 09 2月, 2017 1 次提交
  11. 07 2月, 2017 1 次提交
  12. 31 1月, 2017 6 次提交
    • D
      KVM: PPC: Book3S HV: Advertise availablity of HPT resizing on KVM HV · 050f2339
      David Gibson 提交于
      This updates the KVM_CAP_SPAPR_RESIZE_HPT capability to advertise the
      presence of in-kernel HPT resizing on KVM HV.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      050f2339
    • D
      KVM: PPC: Book3S HV: KVM-HV HPT resizing implementation · b5baa687
      David Gibson 提交于
      This adds the "guts" of the implementation for the HPT resizing PAPR
      extension.  It has the code to allocate and clear a new HPT, rehash an
      existing HPT's entries into it, and accomplish the switchover for a
      KVM guest from the old HPT to the new one.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      b5baa687
    • D
      KVM: PPC: Book3S HV: Outline of KVM-HV HPT resizing implementation · 5e985969
      David Gibson 提交于
      This adds a not yet working outline of the HPT resizing PAPR
      extension.  Specifically it adds the necessary ioctl() functions,
      their basic steps, the work function which will handle preparation for
      the resize, and synchronization between these, the guest page fault
      path and guest HPT update path.
      
      The actual guts of the implementation isn't here yet, so for now the
      calls will always fail.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      5e985969
    • D
      KVM: PPC: Book3S HV: Create kvmppc_unmap_hpte_helper() · 639e4597
      David Gibson 提交于
      The kvm_unmap_rmapp() function, called from certain MMU notifiers, is used
      to force all guest mappings of a particular host page to be set ABSENT, and
      removed from the reverse mappings.
      
      For HPT resizing, we will have some cases where we want to set just a
      single guest HPTE ABSENT and remove its reverse mappings.  To prepare with
      this, we split out the logic from kvm_unmap_rmapp() to evict a single HPTE,
      moving it to a new helper function.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      639e4597
    • D
      KVM: PPC: Book3S HV: Allow KVM_PPC_ALLOCATE_HTAB ioctl() to change HPT size · f98a8bf9
      David Gibson 提交于
      The KVM_PPC_ALLOCATE_HTAB ioctl() is used to set the size of hashed page
      table (HPT) that userspace expects a guest VM to have, and is also used to
      clear that HPT when necessary (e.g. guest reboot).
      
      At present, once the ioctl() is called for the first time, the HPT size can
      never be changed thereafter - it will be cleared but always sized as from
      the first call.
      
      With upcoming HPT resize implementation, we're going to need to allow
      userspace to resize the HPT at reset (to change it back to the default size
      if the guest changed it).
      
      So, we need to allow this ioctl() to change the HPT size.
      
      This patch also updates Documentation/virtual/kvm/api.txt to reflect
      the new behaviour.  In fact the documentation was already slightly
      incorrect since 572abd56 "KVM: PPC: Book3S HV: Don't fall back to
      smaller HPT size in allocation ioctl"
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      f98a8bf9
    • D
      KVM: PPC: Book3S HV: Split HPT allocation from activation · aae0777f
      David Gibson 提交于
      Currently, kvmppc_alloc_hpt() both allocates a new hashed page table (HPT)
      and sets it up as the active page table for a VM.  For the upcoming HPT
      resize implementation we're going to want to allocate HPTs separately from
      activating them.
      
      So, split the allocation itself out into kvmppc_allocate_hpt() and perform
      the activation with a new kvmppc_set_hpt() function.  Likewise we split
      kvmppc_free_hpt(), which just frees the HPT, from kvmppc_release_hpt()
      which unsets it as an active HPT, then frees it.
      
      We also move the logic to fall back to smaller HPT sizes if the first try
      fails into the single caller which used that behaviour,
      kvmppc_hv_setup_htab_rma().  This introduces a slight semantic change, in
      that previously if the initial attempt at CMA allocation failed, we would
      fall back to attempting smaller sizes with the page allocator.  Now, we
      try first CMA, then the page allocator at each size.  As far as I can tell
      this change should be harmless.
      
      To match, we make kvmppc_free_hpt() just free the actual HPT itself.  The
      call to kvmppc_free_lpid() that was there, we move to the single caller.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      aae0777f