1. 30 6月, 2017 7 次提交
    • D
      hw/ppc/spapr.c: consecutive 'spapr->patb_entry = 0' statements · aca8bf9f
      Daniel Henrique Barboza 提交于
      In ppc_spapr_reset(), if the guest is using HPT, the code was executing:
      
          } else {
              spapr->patb_entry = 0;
              spapr_setup_hpt_and_vrma(spapr);
          }
      
      And, at the end of spapr_setup_hpt_and_vrma:
      
          /* We're setting up a hash table, so that means we're not radix */
          spapr->patb_entry = 0;
      
      Resulting in spapr->patb_entry being assigned to 0 twice in a row.
      
      Given that 'spapr_setup_hpt_and_vrma' is also called inside
      'spapr_check_setup_free_hpt' of spapr_hcall.c, this trivial patch removes
      the 'patb_entry = 0' assignment from the 'else' clause inside ppc_spapr_reset
      to avoid this behavior.
      Signed-off-by: NDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      aca8bf9f
    • G
      spapr: fix migration of ICPState objects from/to older QEMU · 46f7afa3
      Greg Kurz 提交于
      Commit 5bc8d26d ("spapr: allocate the ICPState object from under
      sPAPRCPUCore") moved ICPState objects from the machine to CPU cores.
      This is an improvement since we no longer allocate ICPState objects
      that will never be used. But it has the side-effect of breaking
      migration of older machine types from older QEMU versions.
      
      This patch allows spapr to register dummy "icp/server" entries to vmstate.
      These entries use a dedicated VMStateDescription that can swallow and
      discard state of an incoming migration stream, and that don't send anything
      on outgoing migration.
      
      As for real ICPState objects, the instance_id is the cpu_index of the
      corresponding vCPU, which happens to be equal to the generated instance_id
      of older machine types.
      
      The machine can unregister/register these entries when CPUs are dynamically
      plugged/unplugged.
      
      This is only available for pseries-2.9 and older machines, thanks to a
      compat property.
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      46f7afa3
    • B
      spapr: Fix migration of Radix guests · d39c90f5
      Bharata B Rao 提交于
      Fix migration of radix guests by ensuring that we issue
      KVM_PPC_CONFIGURE_V3_MMU for radix case post migration.
      Reported-by: NNageswara R Sastry <rnsastry@linux.vnet.ibm.com>
      Signed-off-by: NBharata B Rao <bharata@linux.vnet.ibm.com>
      Reviewed-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      d39c90f5
    • B
      spapr: Add a "no HPT" encoding to HTAB migration stream · 3a384297
      Bharata B Rao 提交于
      Add a "no HPT" encoding (using value -1) to the HTAB migration
      stream (in the place of HPT size) when the guest doesn't allocate HPT.
      This will help the target side to match target HPT with the source HPT
      and thus enable successful migration.
      Suggested-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NBharata B Rao <bharata@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      3a384297
    • D
      ppc: Rework CPU compatibility testing across migration · d5fc133e
      David Gibson 提交于
      Migrating between different CPU versions is a bit complicated for ppc.
      A long time ago, we ensured identical CPU versions at either end by
      checking the PVR had the same value.  However, this breaks under KVM
      HV, because we always have to use the host's PVR - it's not
      virtualized.  That would mean we couldn't migrate between hosts with
      different PVRs, even if the CPUs are close enough to compatible in
      practice (sometimes identical cores with different surrounding logic
      have different PVRs, so this happens in practice quite often).
      
      So, we removed the PVR check, but instead checked that several flags
      indicating supported instructions matched.  This turns out to be a bad
      idea, because those instruction masks are not architected information, but
      essentially a TCG implementation detail.  So changes to qemu internal CPU
      modelling can break migration - this happened between qemu-2.6 and
      qemu-2.7.  That was addressed by 146c11f1 "target-ppc: Allow eventual
      removal of old migration mistakes".
      
      Now, verification of CPU compatibility across a migration basically doesn't
      happen.  We simply ignore the PVR of the incoming migration, and hope the
      cpu on the destination is close enough to work.
      
      Now that we've cleaned up handling of processor compatibility modes
      for pseries machine type, we can do better.  For new machine types
      (pseries-2.10+) We allow migration if:
      
          * The source and destination PVRs are for the same type of CPU, as
            determined by CPU class's pvr_match function
      OR  * When the source was in a compatibility mode, and the destination CPU
            supports the same compatibility mode
      
      For older machine types we retain the existing behaviour - current CAS
      code will usually set a compat mode which would break backwards
      migration if we made them use the new behaviour. [Fixed from an
      earlier version by Greg Kurz].
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Tested-by: NAndrea Bolognani <abologna@redhat.com>
      d5fc133e
    • D
      pseries: Reset CPU compatibility mode · 66d5c492
      David Gibson 提交于
      Currently, the CPU compatibility mode is set when the cpu is initialized,
      then again when the guest negotiates features.  This means if a guest
      negotiates a compatibility mode, then reboots, that compatibility mode
      will be retained across the reset.
      
      Usually that will get overridden when features are negotiated on the next
      boot, but it's still not really correct.  This patch moves the initial set
      up of the compatibility mode from cpu init to reset time.  The mode *is*
      retained if the reboot was caused by the feature negotiation (it might
      be important in that case, though it's unlikely).
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Tested-by: NAndrea Bolognani <abologna@redhat.com>
      66d5c492
    • D
      pseries: Move CPU compatibility property to machine · 7843c0d6
      David Gibson 提交于
      Server class POWER CPUs have a "compat" property, which is used to set the
      backwards compatibility mode for the processor.  However, this only makes
      sense for machine types which don't give the guest access to hypervisor
      privilege - otherwise the compatibility level is under the guest's control.
      
      To reflect this, this removes the CPU 'compat' property and instead
      creates a 'max-cpu-compat' property on the pseries machine.  Strictly
      speaking this breaks compatibility, but AFAIK the 'compat' option was
      never (directly) used with -device or device_add.
      
      The option was used with -cpu.  So, to maintain compatibility, this
      patch adds a hack to the cpu option parsing to strip out any compat
      options supplied with -cpu and set them on the machine property
      instead of the now deprecated cpu property.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Tested-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Tested-by: NGreg Kurz <groug@kaod.org>
      Tested-by: NAndrea Bolognani <abologna@redhat.com>
      7843c0d6
  2. 28 6月, 2017 3 次提交
  3. 20 6月, 2017 1 次提交
  4. 13 6月, 2017 3 次提交
  5. 09 6月, 2017 1 次提交
  6. 08 6月, 2017 4 次提交
  7. 06 6月, 2017 8 次提交
  8. 25 5月, 2017 3 次提交
    • D
      hw/ppc/spapr.c: recover pending LMB unplug info in spapr_lmb_release · 16ee9980
      Daniel Henrique Barboza 提交于
      When a LMB hot unplug starts, the current DRC LMB status is stored at
      spapr->pending_dimm_unplugs QTAILQ. This queue isn't migrated, thus
      if a migration occurs in the middle of a LMB unplug the
      spapr_lmb_release callback will lost track of the LMB unplug progress.
      
      This patch implements a new recover function spapr_recover_pending_dimm_state
      that is used inside spapr_lmb_release to recover this DRC LMB release
      status that is lost during the migration.
      Signed-off-by: NDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
      [dwg: Minor stylistic changes, simplify error handling]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      16ee9980
    • D
      hw/ppc: removing drc->detach_cb and drc->detach_cb_opaque · 31834723
      Daniel Henrique Barboza 提交于
      The pointer drc->detach_cb is being used as a way of informing
      the detach() function inside spapr_drc.c which cb to execute. This
      information can also be retrieved simply by checking drc->type and
      choosing the right callback based on it. In this context, detach_cb
      is redundant information that must be managed.
      
      After the previous spapr_lmb_release change, no detach_cb_opaques
      are being used by any of the three callbacks functions. This is
      yet another information that is now unused and, on top of that, can't
      be migrated either.
      
      This patch makes the following changes:
      
      - removal of detach_cb_opaque. the 'opaque' argument was removed from
      the callbacks and from the detach() function of sPAPRConnectorClass. The
      attribute detach_cb_opaque of sPAPRConnector was removed.
      
      - removal of detach_cb from the detach() call. The function pointer
      detach_cb of sPAPRConnector was removed. detach() now uses a
      switch(drc->type) to execute the apropriate callback. To achieve this,
      spapr_core_release, spapr_lmb_release and spapr_phb_remove_pci_device_cb
      callbacks were made public to be visible inside detach().
      Signed-off-by: NDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      31834723
    • D
      hw/ppc/spapr.c: adding pending_dimm_unplugs to sPAPRMachineState · 0cffce56
      David Gibson 提交于
      The LMB DRC release callback, spapr_lmb_release(), uses an opaque
      parameter, a sPAPRDIMMState struct that stores the current LMBs that
      are allocated to a DIMM (nr_lmbs). After each call to this callback,
      the nr_lmbs is decremented by one and, when it reaches zero, the callback
      proceeds with the qdev calls to hot unplug the LMB.
      
      Using drc->detach_cb_opaque is problematic because it can't be migrated in
      the future DRC migration work. This patch makes the following changes to
      eliminate the usage of this opaque callback inside spapr_lmb_release:
      
      - sPAPRDIMMState was moved from spapr.c and added to spapr.h. A new
      attribute called 'addr' was added to it. This is used as an unique
      identifier to associate a sPAPRDIMMState to a PCDIMM element.
      
      - sPAPRMachineState now hosts a new QTAILQ called 'pending_dimm_unplugs'.
      This queue of sPAPRDIMMState elements will store the DIMM state of DIMMs
      that are currently going under an unplug process.
      
      - spapr_lmb_release() will now retrieve the nr_lmbs value by getting the
      correspondent sPAPRDIMMState. A helper function called spapr_dimm_get_address
      was created to fetch the address of a PCDIMM device inside spapr_lmb_release.
      When nr_lmbs reaches zero and the callback proceeds with the qdev hot unplug
      calls, the sPAPRDIMMState struct is removed from spapr->pending_dimm_unplugs.
      
      After these changes, the opaque argument for spapr_lmb_release is now
      unused and is passed as NULL inside spapr_del_lmbs. This and the other
      opaque arguments can now be safely removed from the code.
      
      As an additional cleanup made by this patch, the spapr_del_lmbs function
      was merged with spapr_memory_unplug_request. The former was being called
      only by the latter and both were small enough to fit one single function.
      Signed-off-by: NDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
      [dwg: Minor stylistic cleanups]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      0cffce56
  9. 24 5月, 2017 7 次提交
  10. 12 5月, 2017 3 次提交