1. 31 10月, 2012 1 次提交
  2. 29 10月, 2012 2 次提交
    • D
      target-ppc: Rework storage of VPA registration state · 1bfb37d1
      David Gibson 提交于
      With PAPR guests, hypercalls allow registration of the Virtual Processor
      Area (VPA), SLB shadow and dispatch trace log (DTL), each of which allow
      for certain communication between the guest and hypervisor.  Currently, we
      store the addresses of the three areas and the size of the dtl in
      CPUPPCState.
      
      The SLB shadow and DTL are variable sized, with the size being retrieved
      from within the registered memory area at the hypercall time.  This size
      can later be overwritten with other information, however, so we need to
      save the size as of registration time.  We already do this for the DTL,
      but not for the SLB shadow, so this patch fixes that.
      
      In addition, we change the storage of the VPA information to use fixed
      size integer types which will make life easier for syncing this data with
      KVM, which we will need in future.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      1bfb37d1
    • D
      pseries: Don't allow duplicate registration of hcalls or RTAS calls · c89d5299
      David Gibson 提交于
      Currently the pseries machine code allows a callback to be registered
      for a hypercall number twice, as long as it's the same callback the second
      time.  We don't test for duplicate registrations of RTAS callbacks at all
      so it will effectively be last registratiojn wins.
      
      This was originally done because it was awkward to ensure that the
      registration happened exactly once, but the code has since been
      restructured so that's no longer the case.
      
      Duplicate registration of a hypercall or RTAS call could well suggest
      a duplicate initialization which could cause other problems, so this patch
      makes duplicate registrations a bug, to prevent the old behaviour from
      hiding other bugs.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      c89d5299
  3. 05 10月, 2012 1 次提交
    • D
      pseries: Don't test for MSR_PR for hypercalls under KVM · efcb9383
      David Gibson 提交于
      PAPR hypercalls should only be invoked from the guest kernel, not guest
      user programs, that is, with MSR[PR]=0.  Currently we check this in
      spapr_hypercall, returning H_PRIVILEGE if MSR[PR]=1.
      
      However, under KVM the state of MSR[PR] is already checked by the host
      kernel before passing the hypercall to qemu, making this check redundant.
      Worse, however, we don't generally synchronize KVM and qemu state on the
      hypercall path, meaning that qemu could incorrectly reject a hypercall
      because it has a stale MSR value.
      
      This patch fixes the problem by moving the privilege test exclusively to
      the TCG hypercall path.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      CC: qemu-stable@nongnu.org
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      efcb9383
  4. 04 10月, 2012 2 次提交
    • D
      pseries: Remove unnecessary locking from PAPR hash table hcalls · 35f9304d
      David Gibson 提交于
      In the paravirtualized environment provided by PAPR, there is a standard
      locking scheme so that hypercalls updating the hash page table from
      different guest threads don't corrupt the haah table state.  We implement
      this HVLOCK bit in out page table hypercalls.  However, it is not necessary
      in our case, since the hypercalls all run in the qemu environment under the
      big qemu lock.
      
      Therefore, this patch removes the locking code.  This has the additional
      advantage of freeing up a hash PTE bit which will be useful for migration
      support.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      35f9304d
    • D
      pseries: Small cleanup to H_CEDE implementation · 1dd08894
      David Gibson 提交于
      The H_CEDE hypercall implementation for the pseries machine doesn't trigger
      quite the right path in the main cpu exec loop.  We should set exit_request
      to pop up one extra level and recheck state, and we should set the
      exception_index to EXCP_HLT (H_CEDE is roughly equivalent to the hlt
      instruction on x86).
      
      In practice, this doesn't really matter except for KVM, and KVM implements
      H_CEDE internally so we never hit this code path.  But we might as well
      get it right, just in case it matters some day.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      1dd08894
  5. 16 9月, 2012 1 次提交
  6. 24 6月, 2012 1 次提交
    • B
      spapr: Add "memop" hypercall · c73e3771
      Benjamin Herrenschmidt 提交于
      This adds a qemu-specific hypervisor call to the pseries machine
      which allows to do what amounts to memmove, memcpy and xor over
      regions of physical memory such as the framebuffer.
      
      This is the simplest way to get usable framebuffer speed from
      SLOF since the framebuffer isn't mapped in the VRMA and so would
      otherwise require an hcall per 8 bytes access.
      
      The performance is still not great but usable, and can be improved
      with a more complex implementation of the hcall itself if needed.
      
      This also adds some documentation for the qemu-specific hypercalls
      that we add to PAPR along with a new qemu,hypertas-functions property
      that mirrors ibm,hypertas-functions and provides some discoverability
      for the new calls.
      
      Note: I chose note to advertise H_RTAS to the guest via that mechanism.
      This is done on purpose, the guest uses the normal RTAS interfaces
      provided by qemu (including SLOF) which internally calls H_RTAS.
      
      We might in the future implement part (or even all) of RTAS inside the
      guest like IBM's firmware does and replace H_RTAS with some finer grained
      set of private hypercalls.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      c73e3771
  7. 02 5月, 2012 1 次提交
  8. 15 3月, 2012 1 次提交
  9. 15 2月, 2012 1 次提交
  10. 06 10月, 2011 3 次提交
    • D
      pseries: Implement hcall-bulk hypervisor interface · a3d0abae
      David Gibson 提交于
      This patch adds support for the H_REMOVE_BULK hypercall on the pseries
      machine.  Strictly speaking this isn't necessarym since the kernel will
      only attempt to use this if hcall-bulk is advertised in the device tree,
      which previously it was not.
      
      Adding this support may give a marginal performance increase, but more
      importantly it reduces the differences between the emulated machine and
      an existing PowerVM or kvm system, both of which already implement
      hcall-bulk.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      a3d0abae
    • D
      pseries: Add real mode debugging hcalls · 827200a2
      David Gibson 提交于
      PAPR systems support several hypercalls intended for use in real mode
      debugging tools.  These implement reads and writes to arbitrary guest
      physical addresses.  This is useful for real mode software because it
      allows access to IO addresses and memory outside the RMA without going
      through the somewhat involved process of setting up the hash page table
      and enabling translation.
      
      We want these so that when we add real IO devices, the SLOF firmware can
      boot from them without having to enter virtual mode.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      827200a2
    • D
      pseries: More complete WIMG validation in H_ENTER code · f73a2575
      David Gibson 提交于
      Currently our implementation of the H_ENTER hypercall, which inserts a
      mapping in the hash page table assumes that only ordinary memory is ever
      mapped, and only permits mapping attribute bits accordingly (WIMG==0010).
      
      However, we intend to start adding emulated IO to the pseries platform
      (and real IO with PCI passthrough on kvm) which means this simple test
      will no longer suffice.
      
      This patch extends the h_enter validation code to check if the given
      address is a RAM address.  If it is it enforces WIMG==0010, otherwise
      it assumes that it is an IO mapping and instead enforces WIMG=010x.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      f73a2575
  11. 30 7月, 2011 1 次提交
    • B
      exec.h cleanup · 3e457172
      Blue Swirl 提交于
      Move softmmu_exec.h include directives from target-*/exec.h to
      target-*/op_helper.c. Move also various other stuff only used in
      op_helper.c there.
      
      Define global env in dyngen-exec.h.
      
      For i386, move wrappers for segment and FPU helpers from user-exec.c
      to op_helper.c. Implement raise_exception_err_env() to handle dynamic
      CPUState. Move the function declarations to cpu.h since they can be
      used outside of op_helper.c context.
      
      LM32, s390x, UniCore32: remove unused cpu_halted(), regs_to_env() and
      env_to_regs().
      
      ARM: make raise_exception() static.
      
      Convert
      #include "exec.h"
      to
      #include "cpu.h"
      #include "dyngen-exec.h"
      and remove now unused target-*/exec.h.
      Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
      3e457172
  12. 13 7月, 2011 1 次提交
  13. 27 6月, 2011 1 次提交
  14. 20 5月, 2011 1 次提交
  15. 10 5月, 2011 1 次提交
  16. 02 4月, 2011 5 次提交
    • 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
      Implement assorted pSeries hcalls and RTAS methods · 821303f5
      David Gibson 提交于
      This patch adds several small utility hypercalls and RTAS methods to
      the pSeries platform emulation.  Specifically:
      
      * 'display-character' rtas call
      
      This just prints a character to the console, it's occasionally used
      for early debug of the OS.  The support includes a hack to make this
      RTAS call respond on the normal token value present on real hardware,
      since some early debugging tools just assume this value without
      checking the device tree.
      
      * 'get-time-of-day' rtas call
      
      This one just takes the host real time, converts to the PAPR described
      format and returns it to the guest.
      
      * 'power-off' rtas call
      
      This one shuts down the emulated system.
      
      * H_DABR hypercall
      
      On pSeries, the DABR debug register is usually a hypervisor resource
      and virtualized through this hypercall.  If the hypercall is not
      present, Linux will under some circumstances attempt to manipulate the
      DABR directly which will fail on this emulated machine.
      
      This stub implementation is enough to stop that behaviour, although it
      doesn't actually implement the requested DABR operations as yet.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      821303f5
    • D
      Implement hcall based RTAS for pSeries machines · 39ac8455
      David Gibson 提交于
      On pSeries machines, operating systems can instantiate "RTAS" (Run-Time
      Abstraction Services), a runtime component of the firmware which implements
      a number of low-level, infrequently used operations.  On logical partitions
      under a hypervisor, many of the RTAS functions require hypervisor
      privilege.  For simplicity, therefore, hypervisor systems typically
      implement the in-partition RTAS as just a tiny wrapper around a hypercall
      which actually implements the various RTAS functions.
      
      This patch implements such a hypercall based RTAS for our emulated pSeries
      machine.  A tiny in-partition "firmware" calls a new hypercall, which
      looks up available RTAS services in a table.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      39ac8455
    • 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
      Start implementing pSeries logical partition machine · 9fdf0c29
      David Gibson 提交于
      This patch adds a "pseries" machine to qemu.  This aims to emulate a
      logical partition on an IBM pSeries machine, compliant to the
      "PowerPC Architecture Platform Requirements" (PAPR) document.
      
      This initial version is quite limited, it implements a basic machine
      and PAPR hypercall emulation.  So far only one hypercall is present -
      H_PUT_TERM_CHAR - so that a (write-only) console is available.
      
      Multiple CPUs are permitted, with SMP entry handled kexec() style.
      
      The machine so far more resembles an old POWER4 style "full system
      partition" rather than a modern LPAR, in that the guest manages the
      page tables directly, rather than via hypercalls.
      
      The machine requires qemu to be configured with --enable-fdt.  The
      machine can (so far) only be booted with -kernel - i.e. no partition
      firmware is provided.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      9fdf0c29