1. 06 10月, 2011 7 次提交
    • N
      pseries: use macro for firmware filename · 68722054
      Nishanth Aravamudan 提交于
      For some time we've had a nicely defined macro with the filename for our
      firmware image.  However we didn't actually use it in the place we're
      supposed to.  This patch fixes it.
      Signed-off-by: NNishanth Aravamudan <nacc@us.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      68722054
    • 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
    • D
      pseries: interrupt controller should not have a 'reg' property · 9dfef5aa
      David Gibson 提交于
      The interrupt controller presented in the device tree for the pseries
      machine is manipulated by the guest only through hypervisor calls.  It
      has no real or emulated registers for the guest to access.
      
      However, it currently has a bogus 'reg' property advertising a register
      window.  Moreover, this property has an invalid format, being a 32-bit
      zero, when the #address-cells property on the root bus indicates that it
      needs a 64-bit address.  Since the guest never attempts to manipulate
      the node directly, it works, but it is ugly and can cause warnings when
      manipulating the device tree in other tools (such as future firmware
      versions).
      
      This patch, therefore, corrects the problem by entirely removing the
      interrupt-controller node's 'reg' property.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      9dfef5aa
    • D
      pseries: Add a phandle to the xicp interrupt controller device tree node · 0c103f8e
      David Gibson 提交于
      Future devices we will be adding to the pseries machine (e.g. PCI) will
      need nodes in the device tree which explicitly reference the top-level
      interrupt controller via interrupt-parent or interrupt-map properties.
      
      In order to do this, the interrupt controller node needs an assigned
      phandle.  This patch adds the appropriate property, in preparation.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      0c103f8e
    • A
      PPC: SPAPR: Use KVM function for time info · 0a8b2938
      Alexander Graf 提交于
      One of the things we can't fake on PPC is the timer speed. So
      we need to extract the frequency information from the host and
      put it back into the guest device tree.
      
      Luckily, we already have functions for that from the non-pseries
      targets, so all we need to do is to connect the dots and the guest
      suddenly gets to know its real timer speeds.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      0a8b2938
    • A
      PPC: Enable to use PAPR with PR style KVM · f61b4bed
      Alexander Graf 提交于
      When running PR style KVM, we need to tell the kernel that we want
      to run in PAPR mode now. This means that we need to pass some more
      register information down and enable papr mode. We also need to align
      the HTAB to htab_size boundary.
      
      Using this patch, -M pseries works with kvm even on non-hv kvm
      implementations, as long as the preceding kernel patches are in.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      
      ---
      
      v1 -> v2:
      
        - match on CONFIG_PSERIES
      
      v2 -> v3:
      
        - remove HIOR pieces from PAPR patch (ABI breakage)
      f61b4bed
    • P
      spapr: proper qdevification · 277f9acf
      Paolo Bonzini 提交于
      Right now the spapr devices cannot be instantiated with -device,
      because the IRQs need to be passed to the spapr_*_create functions.
      Do this instead in the bus's init wrapper.
      
      This is particularly important with the conversion from scsi-disk
      to scsi-{cd,hd} that Markus made.  After his patches, if you
      specify a scsi-cd device attached to an if=none drive, the default
      VSCSI controller will not be created and, without qdevification,
      you will not be able to add yours.
      
      NOTE from agraf: added small compile fix
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Cc: Alexander Graf <agraf@suse.de>
      Cc: David Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      277f9acf
  2. 21 8月, 2011 1 次提交
  3. 10 5月, 2011 3 次提交
  4. 08 4月, 2011 2 次提交
    • D
      Delay creation of pseries device tree until reset · a3467baa
      David Gibson 提交于
      At present, the 'pseries' machine creates a flattened device tree in the
      machine->init function to pass to either the guest kernel or to firmware.
      
      However, the machine->init function runs before processing of -device
      command line options, which means that the device tree so created will
      be (incorrectly) missing devices specified that way.
      
      Supplying a correct device tree is, in any case, part of the required
      platform entry conditions.  Therefore, this patch moves the creation and
      loading of the device tree from machine->init to a reset callback.  The
      setup of entry point address and initial register state moves with it,
      which leads to a slight cleanup.
      
      This is not, alas, quite enough to make a fully working reset for pseries.
      For that we would need to reload the firmware images, which on this
      machine are loaded into RAM.  It's a step in the right direction, though.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      a3467baa
    • D
      pseries: Abolish envs array · c7a5c0c9
      David Gibson 提交于
      Currently the pseries machine init code builds up an array, envs, of
      CPUState pointers for all the cpus in the system.  This is kind of
      pointless, given the generic code already has a perfectly good linked list
      of the cpus.
      
      In addition, there are a number of places which assume that the cpu's
      cpu_index field is equal to its index in this array.  This is true in
      practice, because cpu_index values are just assigned sequentially, but
      it's conceptually incorrect and may not always be true.
      
      Therefore, this patch abolishes the envs array, and explicitly uses the
      generic cpu linked list and cpu_index values throughout.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      c7a5c0c9
  5. 02 4月, 2011 14 次提交
    • D
      Add SLOF-based partition firmware for pSeries machine, allowing more boot options · a9f8ad8f
      David Gibson 提交于
      Currently, the emulated pSeries machine requires the use of the
      -kernel parameter in order to explicitly load a guest kernel.  This
      means booting from the virtual disk, cdrom or network is not possible.
      
      This patch addresses this limitation by inserting a within-partition
      firmware image (derived from the "SLOF" free Open Firmware project).
      If -kernel is not specified, qemu will now load the SLOF image, which
      has access to the qemu boot device list through the device tree, and
      can boot from any of the usual virtual devices.
      
      In order to support the new firmware, an extension to the emulated
      machine/hypervisor is necessary.  Unlike Linux, which expects
      multi-CPU entry to be handled kexec() style, the SLOF firmware expects
      only one CPU to be active at entry, and to use a hypervisor RTAS
      method to enable the other CPUs one by one.
      
      This patch also implements this 'start-cpu' method, so that SLOF can
      start the secondary CPUs and marshal them into the kexec() holding
      pattern ready for entry into the guest OS.  Linux should, and in the
      future might directly use the start-cpu method to enable initially
      disabled CPUs, but for now it does require kexec() entry.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      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>
      a9f8ad8f
    • 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
    • B
      Implement PAPR virtual SCSI interface (ibmvscsi) · 6e270446
      Ben Herrenschmidt 提交于
      This patch implements the infrastructure and hypercalls necessary for
      the PAPR specified Virtual SCSI interface.  This is the normal method
      for providing (virtual) disks to PAPR partitions.
      Signed-off-by: NBen Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      6e270446
    • B
      Implement PAPR CRQ hypercalls · b45d63b6
      Ben Herrenschmidt 提交于
      This patch implements the infrastructure and hypercalls necessary for the
      PAPR specified CRQ (Command Request Queue) mechanism.  This general
      request queueing system is used by many of the PAPR virtual IO devices,
      including the virtual scsi adapter.
      Signed-off-by: NBen Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      b45d63b6
    • D
      Implement sPAPR Virtual LAN (ibmveth) · 8d90ad90
      David Gibson 提交于
      This patch implements the PAPR specified Inter Virtual Machine Logical
      LAN; that is the virtual hardware used by the Linux ibmveth driver.
      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>
      8d90ad90
    • D
      Implement TCE translation for sPAPR VIO · ee86dfee
      David Gibson 提交于
      This patch implements the necessary infrastructure and hypercalls for
      sPAPR's TCE (Translation Control Entry) IOMMU mechanism.  This is necessary
      for all virtual IO devices which do DMA (i.e. nearly all of them).
      Signed-off-by: NBen Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      ee86dfee
    • D
      Add (virtual) interrupt to PAPR virtual tty device · 0201e2da
      David Gibson 提交于
      Now that we have implemented the PAPR "xics" virtualized interrupt
      controller, we can add interrupts in PAPR VIO devices.  This patch adds
      interrupt support to the PAPR virtual tty/console device.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      0201e2da
    • D
      Add PAPR H_VIO_SIGNAL hypercall and infrastructure for VIO interrupts · 00dc738d
      David Gibson 提交于
      This patch adds infrastructure to support interrupts from PAPR virtual IO
      devices.  This includes correctly advertising those interrupts in the
      device tree, and implementing the H_VIO_SIGNAL hypercall, used to
      enable and disable individual device interrupts.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      00dc738d
    • D
      Implement the PAPR (pSeries) virtualized interrupt controller (xics) · b5cec4c5
      David Gibson 提交于
      PAPR defines an interrupt control architecture which is logically divided
      into ICS (Interrupt Control Presentation, each unit is responsible for
      presenting interrupts to a particular "interrupt server", i.e. CPU) and
      ICS (Interrupt Control Source, each unit responsible for one or more
      hardware interrupts as numbered globally across the system).  All PAPR
      virtual IO devices expect to deliver interrupts via this mechanism.  In
      Linux, this interrupt controller system is handled by the "xics" driver.
      
      On pSeries systems, access to the interrupt controller is virtualized via
      hypercalls and RTAS methods.  However, the virtualized interface is very
      similar to the underlying interrupt controller hardware, and similar PICs
      exist un-virtualized in some other systems.
      
      This patch implements both the ICP and ICS sides of the PAPR interrupt
      controller.  For now, only the hypercall virtualized interface is provided,
      however it would be relatively straightforward to graft an emulated
      register interface onto the underlying interrupt logic if we want to add
      a machine with a hardware ICS/ICP system in the future.
      
      There are some limitations in this implementation: it is assumed for now
      that only one instance of the ICS exists, although a full xics system can
      have several, each responsible for a different group of hardware irqs.
      ICP/ICS can handle both level-sensitve (LSI) and message signalled (MSI)
      interrupt inputs.  For now, this implementation supports only MSI
      interrupts, since that is used by PAPR virtual IO devices.
      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>
      b5cec4c5
    • 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
      Implement the bus structure for PAPR virtual IO · 4040ab72
      David Gibson 提交于
      This extends the "pseries" (PAPR) machine to include a virtual IO bus
      supporting the PAPR defined hypercall based virtual IO mechanisms.
      
      So far only one VIO device is provided, the vty / vterm, providing
      a full console (polled only, for now).
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      4040ab72
    • 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