1. 02 2月, 2012 5 次提交
  2. 02 12月, 2011 1 次提交
  3. 31 10月, 2011 4 次提交
    • D
      ppc: Alter CPU state to mask out TCG unimplemented instructions as appropriate · 02d4eae4
      David Gibson 提交于
      The CPU state contains two bitmaps, initialized from the CPU spec
      which describes which instructions are implemented on the CPU.  A
      couple of bits are defined which cover instructions (VSX and DFP)
      which are not currently implemented in TCG.  So far, these are only
      used to handle the case of -cpu host because a KVM guest can use
      the instructions when the host CPU supports them.
      
      However, it's a mild layering violation to simply not include those
      bits in the CPU descriptions for those CPUs that do support them,
      just because we can't handle them in TCG.  This patch corrects the
      situation, so that the instruction bits _are_ shown correctly in the
      cpu spec table, but are masked out from the cpu state in the non-KVM
      case.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      02d4eae4
    • D
      pseries: Correct vmx/dfp handling in both KVM and TCG cases · a7342588
      David Gibson 提交于
      Currently, when KVM is enabled, the pseries machine checks if the host
      CPU supports VMX, VSX and/or DFP instructions and advertises
      accordingly in the guest device tree.  It does this regardless of what
      CPU is selected on the command line.  On the other hand, when in TCG
      mode, it never advertises any of these facilities, even basic VMX
      (Altivec) which is supported in TCG.
      
      Now that we have a -cpu host option for ppc, it is fairly
      straightforward to fix both problems.  This patch changes the -cpu
      host code to override the basic cpu spec derived from the PVR with
      information queried from the host avout VMX, VSX and DFP capability.
      The pseries code then uses the instruction availability advertised in
      the cpu state to set the guest device tree correctly for both the KVM
      and TCG cases.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      a7342588
    • A
      PPC: Bump qemu-system-ppc to 64-bit physical address space · 8b242eba
      Alexander Graf 提交于
      Some 32-bit PPC CPUs can use up to 36 bit of physical address space.
      Treat them accordingly in the qemu-system-ppc binary type.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      8b242eba
    • D
      ppc: First cut implementation of -cpu host · a1e98583
      David Gibson 提交于
      For convenience with kvm, x86 allows the user to specify -cpu host on the
      qemu command line, which means make the guest cpu the same as the host
      cpu.  This patch implements the same option for ppc targets.
      
      For now, this just read the host PVR (Processor Version Register) and
      selects one of our existing CPU specs based on it.  This means that the
      option will not work if the host cpu is not supported by TCG, even if that
      wouldn't matter for use under kvm.
      
      In future, we can extend this in future to override parts of the cpu spec
      based on information obtained from the host (via /proc/cpuinfo, the host
      device tree, or explicit KVM calls).  That will let us handle cases where
      the real kvm-virtualized CPU doesn't behave exactly like the TCG-emulated
      CPU.  With appropriate annotation of the CPU specs we'll also then be able
      to use host cpus under kvm even when there isn't a matching full TCG model.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      a1e98583
  4. 06 10月, 2011 5 次提交
  5. 24 8月, 2011 1 次提交
  6. 07 8月, 2011 1 次提交
  7. 13 7月, 2011 1 次提交
  8. 27 6月, 2011 1 次提交
  9. 17 6月, 2011 2 次提交
    • A
      PPC: move TLBs to their own arrays · 1c53accc
      Alexander Graf 提交于
      Until now, we've created a union over multiple different TLB types and
      allocated that union. While it's a waste of memory (and cache) to allocate
      TLB information for a TLB type with much information when you only need
      little, it also inflicts another issue.
      
      With the new KVM API, we can now share the TLB between KVM and qemu, but
      for that to work we need to have both be in the same layout. We can't just
      stretch it over to fit some internal different TLB representation.
      
      Hence this patch moves all TLB types to their own array, allowing us to only
      address and allocate exactly the boundaries required for the specific TLB
      type at hand.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      1c53accc
    • A
      PPC: E500: Use MAS registers instead of internal TLB representation · d1e256fe
      Alexander Graf 提交于
      The natural format for e500 cores to do TLB manipulation with are the MAS
      registers. Instead of converting them into some internal representation
      and back again when the guest reads them, we can just keep the data
      identical to the way the guest passed it to us.
      
      The main advantage of this approach is that we're getting closer to being
      able to share MMU data with KVM using shared memory, so that we don't need
      to copy lots of MMU data back and forth all the time. For this to work
      however, another patch is required that gets rid of the TLB union, as that
      destroys our memory layout that needs to be identical with the kernel one.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      d1e256fe
  10. 20 5月, 2011 1 次提交
  11. 12 5月, 2011 3 次提交
    • A
      PPC: Implement e500 (FSL) MMU · 01662f3e
      Alexander Graf 提交于
      Most of the code to support e500 style MMUs is already in place, but
      we're missing on some of the special TLB0-TLB1 handling code and slightly
      different TLB modification.
      
      This patch adds support for the FSL style MMU.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      01662f3e
    • A
      PPC: Add another 64 bits to instruction feature mask · a5858d7a
      Alexander Graf 提交于
      To enable quick runtime detection of instruction groups to the currently
      selected CPU emulation, we have a feature mask of what exactly the respective
      instruction supports.
      
      This feature mask is 64 bits long and we just successfully exceeded those 64
      bits. To add more features, we need to think of something.
      
      The easiest solution that came to my mind was to simply add another 64 bits
      that we can also match on. Since the comparison is only done on start of the
      qemu process to generate an internal opcode calling table, we should be fine
      on any performance penalties here.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      a5858d7a
    • A
      PPC: Add GS MSR definition · 71afeb61
      Alexander Graf 提交于
      The BookE specification defines MSR bit 28 as Guest State. Add it
      to the list of MSR macros.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      71afeb61
  12. 10 5月, 2011 1 次提交
  13. 08 5月, 2011 1 次提交
  14. 02 4月, 2011 11 次提交
    • D
      Implement PAPR VPA functions for pSeries shared processor partitions · ed120055
      David Gibson 提交于
      Shared-processor partitions are those where a CPU is time-sliced between
      partitions, rather than being permanently dedicated to a single
      partition.  qemu emulated partitions, since they are just scheduled with
      the qemu user process, behave mostly like shared processor partitions.
      
      In order to better support shared processor partitions (splpar), PAPR
      defines the "VPA" (Virtual Processor Area), a shared memory communication
      channel between the hypervisor and partitions.  There are also two
      additional shared memory communication areas for specialized purposes
      associated with the VPA.
      
      A VPA is not essential for operating an splpar, though it can be necessary
      for obtaining accurate performance measurements in the presence of
      runtime partition switching.
      
      Most importantly, however, the VPA is a prerequisite for PAPR's H_CEDE,
      hypercall, which allows a partition OS to give up it's shared processor
      timeslices to other partitions when idle.
      
      This patch implements the VPA and H_CEDE hypercalls in qemu.  We don't
      implement any of the more advanced statistics which can be communicated
      through the VPA.  However, this is enough to make normal pSeries kernels
      do an effective power-save idle on an emulated pSeries, significantly
      reducing the host load of a qemu emulated pSeries running an idle guest OS.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      ed120055
    • D
      Virtual hash page table handling on pSeries machine · f43e3525
      David Gibson 提交于
      On pSeries logical partitions, excepting the old POWER4-style full system
      partitions, the guest does not have direct access to the hardware page
      table.  Instead, the pagetable exists in hypervisor memory, and the guest
      must manipulate it with hypercalls.
      
      However, our current pSeries emulation more closely resembles the old
      style where the guest must set up and handle the pagetables itself.  This
      patch converts it to act like a modern partition.
      
      This involves two things: first, the hash translation path is modified to
      permit the has table to be stored externally to the emulated machine's
      RAM.  The pSeries machine init code configures the CPUs to use this mode.
      
      Secondly, we emulate the PAPR hypercalls for manipulating the external
      hashed page table.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      f43e3525
    • D
      Add POWER7 support for ppc · 9d52e907
      David Gibson 提交于
      This adds emulation support for the recent POWER7 cpu to qemu.  It's far
      from perfect - it's missing a number of POWER7 features so far, including
      any support for VSX or decimal floating point instructions.  However, it's
      close enough to boot a kernel with the POWER7 PVR.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      9d52e907
    • D
      Support 1T segments on ppc · cdaee006
      David Gibson 提交于
      Traditionally, the "segments" used for the two-stage translation used on
      powerpc MMUs were 256MB in size.  This was the only option on all hash
      page table based 32-bit powerpc cpus, and on the earlier 64-bit hash page
      table based cpus.  However, newer 64-bit cpus also permit 1TB segments
      
      This patch adds support for 1TB segment translation to the qemu code.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      cdaee006
    • D
      Better factor the ppc hash translation path · 256cebe5
      David Gibson 提交于
      Currently the path handling hash page table translation in get_segment()
      has a mix of common and 32 or 64 bit specific code.  However the
      division is not done terribly well which results in a lot of messy code
      flipping between common and divided paths.
      
      This patch improves the organization, consolidating several divided paths
      into one.  This in turn allows simplification of some code in
      get_segment(), removing a number of ugly interim variables.
      
      This new factorization will also make it easier to add support for the 1T
      segments added in newer CPUs.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      256cebe5
    • D
      Use "hash" more consistently in ppc mmu code · fda6a0ec
      David Gibson 提交于
      Currently, get_segment() has a variable called hash.  However it doesn't
      (quite) get the hash value for the ppc hashed page table.  Instead it
      gets the hash shifted - effectively the offset of the hash bucket within
      the hash page table.
      
      As well, as being different to the normal use of plain "hash" in the
      architecture documentation, this usage necessitates some awkward 32/64
      dependent masks and shifts which clutter up the path in get_segment().
      
      This patch alters the code to use raw hash values through get_segment()
      including storing raw hashes instead of pte group offsets in the ctx
      structure.  This cleans up the path noticeably.
      
      This does necessitate 32/64 dependent shifts when the hash values are
      taken out of the ctx structure and used, but those paths already have
      32/64 bit variants so this is less awkward than it was in get_segment().
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      fda6a0ec
    • D
      Parse SDR1 on mtspr instead of at translate time · bb593904
      David Gibson 提交于
      On ppc machines with hash table MMUs, the special purpose register SDR1
      contains both the base address of the encoded size (hashed) page tables.
      
      At present, we interpret the SDR1 value within the address translation
      path.  But because the encodings of the size for 32-bit and 64-bit are
      different this makes for a confusing branch on the MMU type with a bunch
      of curly shifts and masks in the middle of the translate path.
      
      This patch cleans things up by moving the interpretation on SDR1 into the
      helper function handling the write to the register.  This leaves a simple
      pre-sanitized base address and mask for the hash table in the CPUState
      structure which is easier to work with in the translation path.
      
      This makes the translation path more readable.  It addresses the FIXME
      comment currently in the mtsdr1 helper, by validating the SDR1 value during
      interpretation.  Finally it opens the way for emulating a pSeries-style
      partition where the hash table used for translation is not mapped into
      the guests's RAM.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      bb593904
    • D
      Correct ppc popcntb logic, implement popcntw and popcntd · eaabeef2
      David Gibson 提交于
      qemu already includes support for the popcntb instruction introduced
      in POWER5 (although it doesn't actually allow you to choose POWER5).
      
      However, the logic is slightly incorrect: it will generate results
      truncated to 32-bits when the CPU is in 32-bit mode.  This is not
      normal for powerpc - generally arithmetic instructions on a 64-bit
      powerpc cpu will generate full 64 bit results, it's just that only the
      low 32 bits will be significant for condition codes.
      
      This patch corrects this nit, which actually simplifies the code slightly.
      
      In addition, this patch implements the popcntw and popcntd
      instructions added in POWER7, in preparation for allowing POWER7 as an
      emulated CPU.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      eaabeef2
    • D
      Implement PowerPC slbmfee and slbmfev instructions · efdef95f
      David Gibson 提交于
      For a 64-bit PowerPC target, qemu correctly implements translation
      through the segment lookaside buffer.  Likewise it supports the
      slbmte instruction which is used to load entries into the SLB.
      
      However, it does not emulate the slbmfee and slbmfev instructions
      which read SLB entries back into registers.  Because these are
      only occasionally used in guests (mostly for debugging) we get
      away with it.
      
      However, given the recent SLB cleanups, it becomes quite easy to
      implement these, and thereby allow, amongst other things, a guest
      Linux to use xmon's command to dump the SLB.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      efdef95f
    • D
      Add a hook to allow hypercalls to be emulated on PowerPC · d569956e
      David Gibson 提交于
      PowerPC and POWER chips since the POWER4 and 970 have a special
      hypervisor mode, and a corresponding form of the system call
      instruction which traps to the hypervisor.
      
      qemu currently has stub implementations of hypervisor mode.  That
      is, the outline is there to allow qemu to run a PowerPC hypervisor
      under emulation.  There are a number of details missing so this
      won't actually work at present, but the idea is there.
      
      What there is no provision at all, is for qemu to instead emulate
      the hypervisor itself.  That is to have hypercalls trap into qemu
      and their result be emulated from qemu, rather than running
      hypervisor code within the emulated system.
      
      Hypervisor hardware aware KVM implementations are in the works and
      it would  be useful for debugging and development to also allow
      full emulation of the same para-virtualized guests as such a KVM.
      
      Therefore, this patch adds a hook which will allow a machine to
      set up emulation of hypervisor calls.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      d569956e
    • D
      Clean up PowerPC SLB handling code · 81762d6d
      David Gibson 提交于
      Currently the SLB information when emulating a PowerPC 970 is
      storeed in a structure with the unhelpfully named fields 'tmp'
      and 'tmp64'.  While the layout in these fields does match the
      description of the SLB in the architecture document, it is not
      convenient either for looking up the SLB, or for emulating the
      slbmte instruction.
      
      This patch, therefore, reorganizes the SLB entry structure to be
      divided in the the "ESID related" and "VSID related" fields as
      they are divided in instructions accessing the SLB.
      
      In addition to making the code smaller and more readable, this will
      make it easier to implement for the 1TB segments used in more
      recent PowerPC chips.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      81762d6d
  15. 30 10月, 2010 1 次提交
  16. 14 10月, 2010 1 次提交