Skip to content
Snippets Groups Projects
  1. Apr 26, 2017
    • David Gibson's avatar
      target/ppc: Style fixes · c364946d
      David Gibson authored
      
      This makes a small step fixing one of many style problems that exist in
      the older ppc code.  This removes spaces between function (or macro) name
      and the following '('.
      
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      c364946d
    • Bernhard Kaindl's avatar
      e500,book3s: mfspr 259: Register mapped/aliased SPRG3 user read · b1c897d5
      Bernhard Kaindl authored
      
      This patch registers mfspr 259 for Book3S and e500 family cores
      following this research:
      
      mfspr 259 provides read-only mapped user access to SPRG3(SPR 275) according to:
      
      - PowerISA 2.02, Book III (documents implementation starting with POWER4+ @ p20)
      - IBM PowerPC 970MP RISC Microprocessor User's Manual v2.1, page 48
      - Amit Singh: "Mac OS X Internals: A Systems Approach" on 970 and 970FX cores:
        He demonstrates mfspr 259 reading TLS data from Mac OS X on G5 on page 588
      - NXP documents it in the Core Reference Manuals of: e500, e500mc and e5500
      - getcpu() of the 32 & 64-bit Book3S Linux vDSOs use it to read the core number
      
      mfspr 259 does not appear to be implemented in these cores according to:
      
      - 74xx series: MPC7410/MPC7400 and MPC7450 RISC Microprocessor Reference Manuals
      - 4xx series:  PPC440 Processor User's Manual, Revision 1.09 by AMCC
      - 750 series:  IBM PowerPC 750CL RISC Microprocessor User's Manual
      - e200 series: e200z4 Power Architectureâ Core Reference Manual
      
      Implementation: gen_spr_usprg3() is called from init_proc_book3s_common()
      (covers the 970 and POWER cores) and init_proc_e500() (covers the e500 family)
      to register spr_read_ureg() in the same way which it already provides
      the mapped SPR access for SPR_USPRG4-7 in gen_spr_usprgh() for cores
      which have the same read-only mapped SPRG register access for SPRG4-7.
      
      Verified using Linux by pinning a thread to a core and checking sched_getcpu()
      using qemu-system-ppc64 -M pseries -cpu POWER8 using MTTCG on a x86_64 host.
      
      Signed-off-by: default avatarBernhard Kaindl <bernhard.kaindl@thalesgroup.com>
      Reviewed-by: default avatarStefan Resch <stefan.resch@thalesgroup.com>
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      b1c897d5
    • Suraj Jitindar Singh's avatar
      target/ppc: Flush TLB on write to PIDR · 31b2b0f8
      Suraj Jitindar Singh authored
      
      The PIDR (process id register) is used to store the id of the currently
      running process, which is used to select the process table entry used to
      perform address translation. This means that when we write to this register
      all the translations in the TLB become outdated as they are for a
      previously running process. Thus when this register is written to we need
      to invalidate the TLB entries to ensure stale entries aren't used to
      to perform translation for the new process, which would result in at best
      segfaults or alternatively just random memory being accessed.
      
      Signed-off-by: default avatarSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Reviewed-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      [dwg: Fixed compile error for 32-bit targets]
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      31b2b0f8
    • Anton Blanchard's avatar
      target/ppc: Fix size of struct PPCElfPrstatus · b88290cd
      Anton Blanchard authored
      
      gdb refuses to parse QEMU memory dumps because struct PPCElfPrstatus
      is the wrong size. Fix it.
      
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Fixes: e62fbc54 ("target-ppc: dump-guest-memory support")
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      b88290cd
    • Cédric Le Goater's avatar
      ppc/xics: introduce an 'intc' backlink under PowerPCCPU · ad5d1add
      Cédric Le Goater authored
      
      Today, the ICPState array of the sPAPR machine is indexed with
      'cpu_index' of the CPUState. This numbering of CPUs is internal to
      QEMU and the guest only knows about what is exposed in the device
      tree, that is the 'cpu_dt_id'. This is why sPAPR uses the helper
      xics_get_cpu_index_by_dt_id() to do the mapping in a couple of places.
      
      To provide a more generic XICS layer, we need to abstract the IRQ
      'server' number and remove any assumption made on its nature. It
      should not be used as a 'cpu_index' for lookups like xics_cpu_setup()
      and xics_cpu_destroy() do.
      
      To reach that goal, we choose to introduce a generic 'intc' backlink
      under PowerPCCPU, and let the machine core init routine do the
      ICPState lookup. The resulting object is passed on to xics_cpu_setup()
      which does the store under PowerPCCPU. The IRQ 'server' number in XICS
      is now generic. sPAPR uses 'cpu_dt_id' and PowerNV will use 'PIR'
      number.
      
      This also has the benefit of simplifying the sPAPR hcall routines
      which do not need to do any ICPState lookups anymore.
      
      Signed-off-by: default avatarCédric Le Goater <clg@kaod.org>
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      ad5d1add
    • Suraj Jitindar Singh's avatar
      target/ppc: Add ibm,processor-radix-AP-encodings for TCG · ccd531b9
      Suraj Jitindar Singh authored
      
      The ibm,processor-radix-AP-encodings device tree property of the cpu node
      is used to specify the radix mode supported page sizes of the processor
      to the guest os. Contained in the top 3 bits of the msb is the actual
      page size (AP) encoding associated with the corresponding radix mode
      supported page size. Add this property for a TCG guest, note the TCG code
      is capable of translating any format so just add the 4 default page sizes.
      
      The ibm,processor-radix-AP-encodings device tree property is defined as:
      One to n cells in ascending order of radix mode supported page sizes
      encoded as BE ints (32bit on ppc) in the form:
      0bxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
      - 0bxxx -> AP encoding
      - 0byyyyyyyyyyyyyyyyyyyyyyyyyyyyy -> supported page size encoded as a shift
      
      Signed-off-by: default avatarSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      ccd531b9
    • Alexey Kardashevskiy's avatar
      target-ppc/kvm: Enable in-kernel TCE acceleration for multi-tce · 3dc410ae
      Alexey Kardashevskiy authored
      
      This enables in-kernel handling of H_PUT_TCE_INDIRECT and
      H_STUFF_TCE hypercalls. The host kernel support is there since v4.6,
      in particular d3695aa4f452
      ("KVM: PPC: Add support for multiple-TCE hcalls").
      
      H_PUT_TCE is already accelerated and does not need any special enablement.
      
      Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      3dc410ae
    • Suraj Jitindar Singh's avatar
      target/ppc: Implement H_REGISTER_PROCESS_TABLE H_CALL · b4db5413
      Suraj Jitindar Singh authored
      
      The H_REGISTER_PROCESS_TABLE H_CALL is used by a guest to indicate to the
      hypervisor where in memory its process table is and how translation should
      be performed using this process table.
      
      Provide the implementation of this H_CALL for a guest.
      
      We first check for invalid flags, then parse the flags to determine the
      operation, and then check the other parameters for valid values based on
      the operation (register new table/deregister table/maintain registration).
      The process table is then stored in the appropriate location and registered
      with the hypervisor (if running under KVM), and the LPCR_[UPRT/GTSE] bits
      are updated as required.
      
      Signed-off-by: default avatarSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Signed-off-by: default avatarSam Bobroff <sam.bobroff@au1.ibm.com>
      [dwg: Correct missing prototype and uninitialized variable]
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      b4db5413
    • Sam Bobroff's avatar
      target-ppc: support KVM_CAP_PPC_MMU_RADIX, KVM_CAP_PPC_MMU_HASH_V3 · cf1c4cce
      Sam Bobroff authored
      
      Query and cache the value of two new KVM capabilities that indicate
      KVM's support for new radix and hash modes of the MMU.
      
      Signed-off-by: default avatarSam Bobroff <sam.bobroff@au1.ibm.com>
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      cf1c4cce
    • Sam Bobroff's avatar
      spapr: Add ibm,processor-radix-AP-encodings to the device tree · c64abd1f
      Sam Bobroff authored
      
      Use the new ioctl, KVM_PPC_GET_RMMU_INFO, to fetch radix MMU
      information from KVM and present the page encodings in the device tree
      under ibm,processor-radix-AP-encodings. This provides page size
      information to the guest which is necessary for it to use radix mode.
      
      Signed-off-by: default avatarSam Bobroff <sam.bobroff@au1.ibm.com>
      [dwg: Compile fix for 32-bit targets, style nit fix]
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      c64abd1f
    • Alexey Kardashevskiy's avatar
      target-ppc: kvm: make use of KVM_CREATE_SPAPR_TCE_64 · d6ee2a7c
      Alexey Kardashevskiy authored
      
      KVM_CAP_SPAPR_TCE capability allows creating TCE tables in KVM which
      allows having in-kernel acceleration for H_PUT_TCE_xxx hypercalls.
      However it only supports 32bit DMA windows at zero bus offset.
      
      There is a new KVM_CAP_SPAPR_TCE_64 capability which supports 64bit
      window size, variable page size and bus offset.
      
      This makes use of the new capability. The kernel headers are already
      updated as the kernel support went in to v4.6.
      
      Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      d6ee2a7c
    • Sam Bobroff's avatar
      target/ppc: Improve accuracy of guest HTM availability on P8s · f3d9f303
      Sam Bobroff authored
      
      On Power8 hosts it is currently theoretically possible for QEMU/KVM-HV guests
      to receive a ibm,pa-features property indicating that HTM support is available
      when it is not.  The situation would occur if the platform firmware of
      a Power8 host cleared the HTM bit of the ibm,pa-features property.
      QEMU would query KVM for the availability of HTM, which will return no
      support, but workaround code in kvm_arch_init_vcpu() would then
      re-enable it because KVM_HV is in use and the processor is P8.
      
      This patch adjusts the workaround in kvm_arch_init_vcpu() so that it does not
      enable HTM (in the above case) unless the host kernel indicates to the QEMU
      process, via the auxiliary vector, that userspace can use HTM (via the HWCAP2
      bit KVM_FEATURE2_HTM).
      
      The reason to use the value from the auxiliary vector is that it is
      set based only on what the host kernel found in the ibm,pa-features
      HTM bit at boot time.
      
      Signed-off-by: default avatarSam Bobroff <sam.bobroff@au1.ibm.com>
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      f3d9f303
  2. Apr 25, 2017
  3. Apr 21, 2017
  4. Apr 20, 2017
  5. Apr 10, 2017
  6. Apr 02, 2017
  7. Mar 31, 2017
  8. Mar 28, 2017
  9. Mar 24, 2017
  10. Mar 23, 2017
  11. Mar 20, 2017
    • Peter Maydell's avatar
      arm: Fix APSR writes via M profile MSR · b28b3377
      Peter Maydell authored
      
      Our implementation of writes to the APSR for M-profile via the MSR
      instruction was badly broken.
      
      First and worst, we had the sense wrong on the test of bit 2 of the
      SYSm field -- this is supposed to request an APSR write if bit 2 is 0
      but we were doing it if bit 2 was 1.  This bug was introduced in
      commit 58117c9b, so hasn't been in a QEMU release.
      
      Secondly, the choice of exactly which parts of APSR should be written
      is defined by bits in the 'mask' field.  We were not passing these
      through from instruction decode, making it impossible to check them
      in the helper.
      
      Pass the mask bits through from the instruction decode to the helper
      function and process them appropriately; fix the wrong sense of the
      SYSm bit 2 check.
      
      Invalid mask values and invalid combinations of mask and register
      number are UNPREDICTABLE; we choose to treat them as if the mask
      values were valid.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1487616072-9226-5-git-send-email-peter.maydell@linaro.org
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      b28b3377
    • Peter Maydell's avatar
      arm: Enforce should-be-1 bits in MRS decoding · 3d54026f
      Peter Maydell authored
      
      The MRS instruction requires that bits [19..16] are all 1s, and for
      A/R profile also that bits [7..0] are all 0s.  At this point in the
      decode tree we have checked all of the rest of the instruction but
      were allowing these to be any value.  If these bits are not set then
      the result is architecturally UNPREDICTABLE, but choosing to UNDEF is
      more helpful to the user and avoids unexpected odd behaviour if the
      encodings are used for some purpose in future architecture versions.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-id: 1487616072-9226-4-git-send-email-peter.maydell@linaro.org
      3d54026f
    • Peter Maydell's avatar
      arm: Don't decode MRS(banked) or MSR(banked) for M profile · 43ac6574
      Peter Maydell authored
      
      M profile doesn't have the MSR(banked) and MRS(banked) instructions
      and uses the encodings for different kinds of M-profile MRS/MSR.
      Guard the relevant bits of the decode logic to make sure we don't
      accidentally fall into them by accident on M-profile.
      
      (The bit being checked for this (bit 5) is part of the SYSm field on
      M-profile, but since no currently allocated system registers have
      encodings with bit 5 of SYSm set, this hasn't been a problem in
      practice.)
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-id: 1487616072-9226-3-git-send-email-peter.maydell@linaro.org
      43ac6574
Loading