1. 03 7月, 2018 9 次提交
  2. 27 6月, 2018 1 次提交
  3. 22 6月, 2018 3 次提交
    • D
      spapr: Don't rewrite mmu capabilities in KVM mode · e5ca28ec
      David Gibson 提交于
      Currently during KVM initialization on POWER, kvm_fixup_page_sizes()
      rewrites a bunch of information in the cpu state to reflect the
      capabilities of the host MMU and KVM.  This overwrites the information
      that's already there reflecting how the TCG implementation of the MMU will
      operate.
      
      This means that we can get guest-visibly different behaviour between KVM
      and TCG (and between different KVM implementations).  That's bad.  It also
      prevents migration between KVM and TCG.
      
      The pseries machine type now has filtering of the pagesizes it allows the
      guest to use which means it can present a consistent model of the MMU
      across all accelerators.
      
      So, we can now replace kvm_fixup_page_sizes() with kvm_check_mmu() which
      merely verifies that the expected cpu model can be faithfully handled by
      KVM, rather than updating the cpu model to match KVM.
      
      We call kvm_check_mmu() from the spapr cpu reset code.  This is a hack:
      conceptually it makes more sense where fixup_page_sizes() was - in the KVM
      cpu init path.  However, doing that would require moving the platform's
      pagesize filtering much earlier, which would require a lot of work making
      further adjustments.  There wouldn't be a lot of concrete point to doing
      that, since the only KVM implementation which has the awkward MMU
      restrictions is KVM HV, which can only work with an spapr guest anyway.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NCédric Le Goater <clg@kaod.org>
      e5ca28ec
    • D
      target/ppc: Add ppc_hash64_filter_pagesizes() · 27f00f0a
      David Gibson 提交于
      The paravirtualized PAPR platform sometimes needs to restrict the guest to
      using only some of the page sizes actually supported by the host's MMU.
      At the moment this is handled in KVM specific code, but for consistency we
      want to apply the same limitations to all accelerators.
      
      This makes a start on this by providing a helper function in the cpu code
      to allow platform code to remove some of the cpu's page size definitions
      via a caller supplied callback.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NCédric Le Goater <clg@kaod.org>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      27f00f0a
    • D
      spapr: Use maximum page size capability to simplify memory backend checking · 123eec65
      David Gibson 提交于
      The way we used to handle KVM allowable guest pagesizes for PAPR guests
      required some convoluted checking of memory attached to the guest.
      
      The allowable pagesizes advertised to the guest cpus depended on the memory
      which was attached at boot, but then we needed to ensure that any memory
      later hotplugged didn't change which pagesizes were allowed.
      
      Now that we have an explicit machine option to control the allowable
      maximum pagesize we can simplify this.  We just check all memory backends
      against that declared pagesize.  We check base and cold-plugged memory at
      reset time, and hotplugged memory at pre_plug() time.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NCédric Le Goater <clg@kaod.org>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      123eec65
  4. 21 6月, 2018 4 次提交
    • B
      target/ppc: Add missing opcode for icbt on PPC440 · 0c8d8c8b
      BALATON Zoltan 提交于
      According to PPC440 User Manual PPC440 has multiple opcodes for icbt
      instruction: one for compatibility with older cores and two 440
      specific opcodes one of which is defined in BookE. QEMU only
      implements two of these, add the missing one.
      Signed-off-by: NBALATON Zoltan <balaton@eik.bme.hu>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      0c8d8c8b
    • J
      fpu_helper.c: fix helper_fpscr_clrbit() function · 88d8d555
      John Arbuckle 提交于
      Fix the helper_fpscr_clrbit() function so it correctly sets the FEX
      and VX bits.
      
      Determining the value for the Floating Point Status and Control
      Register's (FPSCR) FEX bit is suppose to be done like this:
      
      FEX = (VX & VE) | (OX & OE) | (UX & UE) | (ZX & ZE) | (XX & XE))
      
      It is described as "the logical OR of all the floating-point exception
      bits masked by their respective enable bits". It was not implemented
      correctly. The value of FEX would stay on even when all other bits
      were set to off.
      
      The VX bit is described as "the logical OR of all of the invalid
      operation exceptions". This bit was also not implemented correctly. It
      too would stay on when all the other bits were set to off.
      
      My main source of information is an IBM document called:
      
      PowerPC Microprocessor Family:
      The Programming Environments for 32-Bit Microprocessors
      
      Page 62 is where the FPSCR information is located.
      
      This is an older copy than the one I use but it is still very useful:
      https://www.pdfdrive.net/powerpc-microprocessor-family-the-programming-environments-for-32-e3087633.html
      
      I use a G3 and G5 iMac to compare bit values with QEMU. This patch
      fixed all the problems I was having with these bits.
      Signed-off-by: NJohn Arbuckle <programmingkidx@gmail.com>
      [dwg: Re-wrapped commit message]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      88d8d555
    • D
      target/ppc: Add kvmppc_hpt_needs_host_contiguous_pages() helper · 24c6863c
      David Gibson 提交于
      KVM HV has a restriction that for HPT mode guests, guest pages must be hpa
      contiguous as well as gpa contiguous.  We have to account for that in
      various places.  We determine whether we're subject to this restriction
      from the SMMU information exposed by KVM.
      
      Planned cleanups to the way we handle this will require knowing whether
      this restriction is in play in wider parts of the code.  So, expose a
      helper function which returns it.
      
      This does mean some redundant calls to kvm_get_smmu_info(), but they'll go
      away again with future cleanups.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NCédric Le Goater <clg@kaod.org>
      24c6863c
    • D
      target/ppc: Allow cpu compatiblity checks based on type, not instance · ad99d04c
      David Gibson 提交于
      ppc_check_compat() is used in a number of places to check if a cpu object
      supports a certain compatiblity mode, subject to various constraints.
      
      It takes a PowerPCCPU *, however it really only depends on the cpu's class.
      We have upcoming cases where it would be useful to make compatibility
      checks before we fully instantiate the cpu objects.
      
      ppc_type_check_compat() will now make an equivalent check, but based on a
      CPU's QOM typename instead of an instantiated CPU object.
      
      We make use of the new interface in several places in spapr, where we're
      essentially making a global check, rather than one specific to a particular
      cpu.  This avoids some ugly uses of first_cpu to grab a "representative"
      instance.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NCédric Le Goater <clg@kaod.org>
      ad99d04c
  5. 16 6月, 2018 3 次提交
  6. 12 6月, 2018 5 次提交
  7. 02 6月, 2018 1 次提交
  8. 01 6月, 2018 2 次提交
  9. 31 5月, 2018 1 次提交
  10. 29 5月, 2018 1 次提交
  11. 19 5月, 2018 1 次提交
  12. 18 5月, 2018 1 次提交
  13. 11 5月, 2018 1 次提交
  14. 10 5月, 2018 1 次提交
  15. 04 5月, 2018 6 次提交
    • M
      qobject: Replace qobject_incref/QINCREF qobject_decref/QDECREF · cb3e7f08
      Marc-André Lureau 提交于
      Now that we can safely call QOBJECT() on QObject * as well as its
      subtypes, we can have macros qobject_ref() / qobject_unref() that work
      everywhere instead of having to use QINCREF() / QDECREF() for QObject
      and qobject_incref() / qobject_decref() for its subtypes.
      
      The replacement is mechanical, except I broke a long line, and added a
      cast in monitor_qmp_cleanup_req_queue_locked().  Unlike
      qobject_decref(), qobject_unref() doesn't accept void *.
      
      Note that the new macros evaluate their argument exactly once, thus no
      need to shout them.
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20180419150145.24795-4-marcandre.lureau@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      [Rebased, semantic conflict resolved, commit message improved]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      cb3e7f08
    • G
      target/ppc: always set PPC_MEM_TLBIE in pre 2.8 migration hack · bce00964
      Greg Kurz 提交于
      The pseries-2.7 and older machine types require CPUPPCState::insns_flags
      to be strictly equal between source and destination. This checking is
      abusive and breaks migration of KVM guests when the host CPU models
      are different, even if they are compatible enough to allow the guest
      to run transparently. This buggy behaviour was fixed for pseries-2.8
      and we added some hacks to allow backward migration of older machine
      types. These hacks assume that the CPU belongs to the POWER8 family,
      which was true for most KVM based setup we cared about at the time.
      But now POWER9 systems are coming, and backward migration of pre 2.8
      guests running in POWER8 architected mode from a POWER9 host to a
      POWER8 host is broken:
      
      qemu-system-ppc64: error while loading state for instance 0x0 of device
       'cpu'
      qemu-system-ppc64: load of migration failed: Invalid argument
      
      This happens because POWER9 doesn't set PPC_MEM_TLBIE in insns_flags,
      while POWER8 does. Let's force PPC_MEM_TLBIE in the migration hack to
      fix the issue. This is an acceptable hack because these old machine
      types only support CPU models that do set PPC_MEM_TLBIE.
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      bce00964
    • D
      spapr: Move PAPR mode cpu setup fully to spapr code · da20aed1
      David Gibson 提交于
      cpu_ppc_set_papr() does several things:
          1) it sets up the virtual hypervisor interface
          2) it prevents the cpu from ever entering hypervisor mode
          3) it tells KVM that we're emulating a cpu in PAPR mode
      and 4) it configures the LPCR and AMOR (hypervisor privileged registers)
             so that TCG will behave correctly for PAPR guests, without
             attempting to emulate the cpu in hypervisor mode
      
      (1) & (2) make sense for any virtual hypervisor (if another one ever
      exists).
      
      (3) belongs more properly in the machine type specific to a PAPR guest, so
      move it to spapr_cpu_init().  While we're at it, remove an ugly test on
      kvm_enabled() by making kvmppc_set_papr() a safe no-op on non-KVM.
      
      (4) also belongs more properly in the machine type specific code.  (4) is
      done by mangling the default values of the SPRs, so that they will be set
      correctly at reset time.  Manipulating usually-static parameters of the cpu
      model like this is kind of ugly, especially since the values used really
      have more to do with the platform than the cpu.
      
      The spapr code already has places for PAPR specific initializations of
      register state in spapr_cpu_reset(), so move this handling there.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NCédric Le Goater <clg@kaod.org>
      Tested-by: NCédric Le Goater <clg@kaod.org>
      da20aed1
    • D
      target/ppc: Delay initialization of LPCR_UPRT for secondary cpus · f00bed95
      David Gibson 提交于
      In cpu_ppc_set_papr() the UPRT and GTSE bits of the LPCR default value are
      initialized based on on ppc64_radix_guest().  Which seems reasonable,
      except that ppc64_radix_guest() is based on spapr->patb_entry which is
      only set up in spapr_machine_reset, called _after_ cpu_ppc_set_papr() for
      boot cpus.  Well, and the fact that modifying the SPR default value for an
      instance rather than a class is kind of yucky.
      
      The initialization here is really only necessary or valid for
      hotplugged cpus; the base cpu initialization already sets a value
      that's good enough for the boot cpus until the guest uses an hcall to
      configure it's preferred MMU mode.
      
      So, move this initialization to the rtas_start_cpu() path, at which point
      ppc64_radix_guest() will have a sensible value, to make sure secondary cpus
      come up in an MMU mode matching the existing cpus.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NCédric Le Goater <clg@kaod.org>
      Tested-by: NCédric Le Goater <clg@kaod.org>
      f00bed95
    • D
      target/ppc: Add ppc_store_lpcr() helper · 5ad55315
      David Gibson 提交于
      There are some fields in the cpu state which need to be updated when the
      LPCR register is changed, which is done by ppc_hash64_update_rmls() and
      ppc_hash64_update_vrma().  Code which alters env->spr[SPR_LPCR] needs to
      call them afterwards to make sure the state is up to date.
      
      That's easy to get wrong.  The normal way of dealing with sitautions like
      that is to use a helper which both updates the basic register value and the
      derived state.
      
      So, do that.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NCédric Le Goater <clg@kaod.org>
      Tested-by: NCédric Le Goater <clg@kaod.org>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      5ad55315
    • D
      spapr: Remove support for explicitly allocated RMAs · 090052aa
      David Gibson 提交于
      Current POWER cpus allow for a VRMA, a special mapping which describes a
      guest's view of memory when in real mode (MMU off, from the guest's point
      of view).  Older cpus didn't have that which meant that to support a guest
      a special host-contiguous region of memory was needed to give the guest its
      Real Mode Area (RMA).
      
      KVM used to provide special calls to allocate a contiguous RMA for those
      cases.  This was useful in the early days of KVM on Power to allow it to be
      tested on PowerPC 970 chips as used in Macintosh G5 machines.  Now, those
      machines are so old as to be almost irrelevant.
      
      The normal qemu deprecation process would require this to be marked
      deprecated then removed in 2 releases.  However, this can only be used
      with corresponding support in the host kernel - which was dropped
      years ago (in c17b98cf "KVM: PPC: Book3S HV: Remove code for PPC970
      processors" of 2014-12-03 to be precise).  Therefore it should be ok
      to drop this immediately.
      
      Just to be clear this only affects *KVM HV* guests with PowerPC 970,
      and those already require an ancient host kernel.  TCG and KVM PR
      guests with PowerPC 970 should still work.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Acked-by: NThomas Huth <thuth@redhat.com>
      090052aa