1. 27 6月, 2014 28 次提交
    • A
      spapr: Remove @next_irq · ba0e5bf8
      Alexey Kardashevskiy 提交于
      This removes @next_irq from sPAPREnvironment which was used in old
      IRQ allocator as XICS is now responsible for IRQs and keeps track of
      allocated IRQs.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      ba0e5bf8
    • A
      spapr: Move interrupt allocator to xics · bee763db
      Alexey Kardashevskiy 提交于
      The current allocator returns IRQ numbers from a pool and does not
      support IRQs reuse in any form as it did not keep track of what it
      previously returned, it only keeps the last returned IRQ. Some use
      cases such as PCI hot(un)plug may require IRQ release and reallocation.
      
      This moves an allocator from SPAPR to XICS.
      
      This switches IRQ users to use new API.
      
      This uses LSI/MSI flags to know if interrupt is allocated.
      
      The interrupt release function will be posted as a separate patch.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      bee763db
    • A
      xics: Disable flags reset on xics reset · a7e519a8
      Alexey Kardashevskiy 提交于
      Since islsi[] array has been merged into the ICSState struct,
      we must not reset flags as they tell if the interrupt is in use.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      a7e519a8
    • A
      xics: Add xics_find_source() · 641c3493
      Alexey Kardashevskiy 提交于
      PAPR allows having multiple interrupt sources such as PHB.
      
      This adds a source lookup function and makes use of it.
      
      Since at the moment QEMU only supports a single source,
      no change in behaviour is expected.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      641c3493
    • A
      xics: Add flags for interrupts · 4af88944
      Alexey Kardashevskiy 提交于
      The existing interrupt allocation scheme in SPAPR assumes that
      interrupts are allocated at the start time, continously and the config
      will not change. However, there are cases when this is not going to work
      such as:
      
      1. migration - we will have to have an ability to choose interrupt
      numbers for devices in the command line and this will create gaps in
      interrupt space.
      
      2. PCI hotplug - interrupts from unplugged device need to be returned
      back to interrupt pool, otherwise we will quickly run out of interrupts.
      
      This replaces a separate lslsi[] array with a byte in the ICSIRQState
      struct and defines "LSI" and "MSI" flags. Neither of these flags set
      signals that the descriptor is not allocated and not in use.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      4af88944
    • S
      spapr: Add RTAS sysparm SPLPAR Characteristics · 3b50d897
      Sam bobroff 提交于
      Add support for the SPLPAR Characteristics parameter to the emulated
      RTAS call ibm,get-system-parameter.
      
      The support provides just enough information to allow "cat
      /proc/powerpc/lparcfg" to succeed without generating a kernel error
      message.
      
      Without this patch the above command will produce the following kernel
      message: arch/powerpc/platforms/pseries/lparcfg.c \
      parse_system_parameter_string Error calling get-system-parameter \
      (0xfffffffd)
      Signed-off-by: NSam Bobroff <sam.bobroff@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      3b50d897
    • S
      spapr: Add RTAS sysparm UUID · b907d7b0
      Sam bobroff 提交于
      Add support for the UUID parameter to the emulated RTAS call
      ibm,get-system-parameter.
      
      Return the guest's UUID as the value for the RTAS UUID system
      parameter, or null (a zero length result) if it is not set.
      Signed-off-by: NSam Bobroff <sam.bobroff@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      b907d7b0
    • S
      spapr: Fix RTAS sysparm DIAGNOSTICS_RUN_MODE · 3052d951
      Sam bobroff 提交于
      This allows the ibm,get-system-parameter RTAS call to succeed for the
      DIAGNOSTICS_RUN_MODE system parameter.
      
      The problem can be seen with "ppc64_cpu --run-mode" from the
      powerpc-utils package which fails before this patch with "Machine does
      not support diagnostic run mode".
      
      This is corrected by using the rtas_st_buffer() function to write to
      the buffer.
      
      The RTAS constants are also moved out into a header file, some new
      constants added and the surrounding code slightly simplified.
      Signed-off-by: NSam Bobroff <sam.bobroff@au1.ibm.com>
      [agraf: remove some commentary]
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      3052d951
    • S
      spapr: Add rtas_st_buffer utility function · ce3fa1ec
      Sam bobroff 提交于
      Add a function to write lengh + data into a buffer as required for the
      emulation of the RTAS ibm,get-system-parameter call.
      
      If the destination is smaller than the source, the write is truncated
      and success is returned. This matches the behaviour of pHyp.
      
      This will be used in following patches.
      Signed-off-by: NSam Bobroff <sam.bobroff@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      ce3fa1ec
    • A
      spapr: Define a 2.1 pseries machine · 6026db45
      Alexey Kardashevskiy 提交于
      This adds a v2.1 machine to support backward compatibility
      for newer macines in the case if they ever be implemented.
      
      This adds a "pseries-2.1" machine as a child of the "pseries"
      machine and only changes visible machine name.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      6026db45
    • A
      spapr: Fix code design style (s/SPAPRMachine/sPAPRMachineState) · 6ca1502e
      Alexey Kardashevskiy 提交于
      Every single sPAPR QOM object has small first "s".
      Most (not all yet) QOM objects have "State" suffix.
      
      This replaces SPAPRMachine with sPAPRMachineState to conform with QEMU
      code style and removes redundant empty line.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      6ca1502e
    • A
      target-ppc: Add support for POWER8 pvr 0x4D0000 · f6c3ebcc
      Alexey Kardashevskiy 提交于
      At the moment QEMU knows about one version of POWER8 CPU with
      PVR 0x4B.0000. This CPU class is defined as "POWER8". The linux
      kernel names it as "POWER8E" which is different from the name QEMU uses.
      
      Now we get another version of POWER8 which is architecturally equivalent
      to POWER8E but has different PVR 0x4D.0000 so QEMU fails to find
      a PPC CPU class on these machines. The linux kernel names these CPUs as
      "POWER8".
      
      This renames the existing "POWER8" to "POWER8E" to be more precise and
      stay in sync with the linux kernel.
      
      This adds a new "POWER8" family which calls POWER8E class init function
      and defines own PVR mask (used to match a CPU class) and desc (used to
      create dynamic version-less CPU class).
      
      This does not change CPU class fw_name attribute as the host POWER8
      firmware keeps using "PowerPC,POWER8" on both POWER8 and POWER8E.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      f6c3ebcc
    • B
      uninorth: Fix PCI hole size · 1be88255
      BALATON Zoltan 提交于
      Fix PCI hole size to match that what is found on real hardware.
      (OpenBIOS already uses the correct length.)
      Signed-off-by: NBALATON Zoltan <balaton@eik.bme.hu>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      1be88255
    • B
      mac99: Add motherboard devices before PCI cards · a0bb2a5f
      BALATON Zoltan 提交于
      Change the order of creating devices for New World Mac emulation so
      that devices on the motherboard are added first and PCI cards (VGA and
      NIC) come later. As a side effect, this also causes OpenBIOS to map
      the motherboard devices into the MMIO space to the same addresses as
      on real hardware and allow clients that hardcode these addresses (e.g.
      MorphOS) to find and use them until OpenBIOS is tought to map devices
      to specific addresses. (On real hardware the graphics and network
      cards are really on separate buses but we don't model that yet.) This
      brings the memory map closer to what is found on PowerMac3,1.
      Signed-off-by: NBALATON Zoltan <balaton@eik.bme.hu>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      a0bb2a5f
    • P
      target-ppc: Remove unused gen_qemu_ld8s() · c99b6f87
      Peter Maydell 提交于
      The gen_qemu_ld8s() function is unused; remove it.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      c99b6f87
    • P
      target-ppc: Remove unused IMM and d extract helpers · b247812e
      Peter Maydell 提交于
      Remove the definition of the IMM and d extract helpers; these seem to have
      been added as part of the initial PPC support in 2003 but never actually
      used.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      b247812e
    • A
      vfio: Enable for SPAPR · 59181263
      Alexey Kardashevskiy 提交于
      This turns the sPAPR support on and enables VFIO container use
      in the kernel.
      
      This extends vfio_connect_container to support VFIO_SPAPR_TCE_IOMMU type
      in the host kernel.
      
      This registers a memory listener which sPAPR IOMMU will notify when
      executing H_PUT_TCE/etc DMA calls. The listener then will notify the host
      kernel about DMA map/unmap operation via VFIO_IOMMU_MAP_DMA/
      VFIO_IOMMU_UNMAP_DMA ioctls.
      
      This executes VFIO_IOMMU_ENABLE ioctl to make sure that the IOMMU is free
      of mappings and can be exclusively given to the user. At the moment SPAPR
      is the only platform requiring this call to be implemented.
      
      Note that the host kernel function implementing VFIO_IOMMU_DISABLE
      is called automatically when container's fd is closed so there is
      no need to call it explicitly from QEMU. We may need to call
      VFIO_IOMMU_DISABLE explicitly in the future for some sort of dynamic
      reconfiguration (PCI hotplug or dynamic IOMMU group management).
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Acked-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      59181263
    • A
      spapr_pci_vfio: Add spapr-pci-vfio-host-bridge to support vfio · 9fc34ada
      Alexey Kardashevskiy 提交于
      The patch adds a spapr-pci-vfio-host-bridge device type
      which is a PCI Host Bridge with VFIO support. The new device
      inherits from the spapr-pci-host-bridge device and adds an "iommu"
      property which is an IOMMU id. This ID represents a minimal entity
      for which IOMMU isolation can be guaranteed. In SPAPR architecture IOMMU
      group is called a Partitionable Endpoint (PE).
      
      Current implementation supports one IOMMU id per QEMU VFIO PHB. Since
      SPAPR allows multiple PHB for no extra cost, this does not seem to
      be a problem. This limitation may change in the future though.
      
      Example of use:
      Configure and Add 3 functions of a multifunctional device to QEMU:
      (the NEC PCI USB card is used as an example here):
      -device spapr-pci-vfio-host-bridge,id=USB,iommu=4,index=7 \
      -device vfio-pci,host=4:0:1.0,addr=1.0,bus=USB,multifunction=true
      -device vfio-pci,host=4:0:1.1,addr=1.1,bus=USB
      -device vfio-pci,host=4:0:1.2,addr=1.2,bus=USB
      
      where:
      * index=7 is a QEMU PHB index (used as source for MMIO/MSI/IO windows
      offset);
      * iommu=4 is an IOMMU id which can be found in sysfs:
      [aik@vpl2 ~]$ cd /sys/bus/pci/devices/0004:00:00.0/
      [aik@vpl2 0004:00:00.0]$ ls -l iommu_group
      lrwxrwxrwx 1 root root 0 Jun  5 12:49 iommu_group -> ../../../kernel/iommu_groups/4
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      9fc34ada
    • A
      vfio: Add vfio_container_ioctl() · 6d8be4c3
      Alexey Kardashevskiy 提交于
      While most operations with VFIO IOMMU driver are generic and used inside
      vfio.c, there are still some operations which only specific VFIO IOMMU
      drivers implement. The first example of it will be reading a DMA window
      start from the host.
      
      This adds a helper which passes an ioctl request to the container's fd.
      
      The helper will check if @req is known. For this, stub is added. This return
      -1 on any requests for now.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Acked-by: NAlex Williamson <alex.williamson@redhat.com>
      Acked-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      6d8be4c3
    • A
      spapr_iommu: Make in-kernel TCE table optional · 9bb62a07
      Alexey Kardashevskiy 提交于
      POWER KVM supports an KVM_CAP_SPAPR_TCE capability which allows allocating
      TCE tables in the host kernel memory and handle H_PUT_TCE requests
      targeted to specific LIOBN (logical bus number) right in the host without
      switching to QEMU. At the moment this is used for emulated devices only
      and the handler only puts TCE to the table. If the in-kernel H_PUT_TCE
      handler finds a LIOBN and corresponding table, it will put a TCE to
      the table and complete hypercall execution. The user space will not be
      notified.
      
      Upcoming VFIO support is going to use the same sPAPRTCETable device class
      so KVM_CAP_SPAPR_TCE is going to be used as well. That means that TCE
      tables for VFIO are going to be allocated in the host as well.
      However VFIO operates with real IOMMU tables and simple copying of
      a TCE to the real hardware TCE table will not work as guest physical
      to host physical address translation is requited.
      
      So until the host kernel gets VFIO support for H_PUT_TCE, we better not
      to register VFIO's TCE in the host.
      
      This adds a place holder for KVM_CAP_SPAPR_TCE_VFIO capability. It is not
      in upstream yet and being discussed so now it is always false which means
      that in-kernel VFIO acceleration is not supported.
      
      This adds a bool @vfio_accel flag to the sPAPRTCETable device telling
      that sPAPRTCETable should not try allocating TCE table in the host kernel
      for VFIO. The flag is false now as at the moment there is no VFIO.
      
      This adds an vfio_accel parameter to spapr_tce_new_table(), the semantic
      is the same. Since there is only emulated PCI and VIO now, the flag is set
      to false. Upcoming VFIO support will set it to true.
      
      This is a preparation patch so no change in behaviour is expected
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      9bb62a07
    • A
      spapr: Fix RTAS token numbers · 3a3b8502
      Alexey Kardashevskiy 提交于
      At the moment spapr_rtas_register() allocates a new token number for every
      new RTAS callback so numbers are not fixed and depend on the number of
      supported RTAS handlers and the exact order of spapr_rtas_register() calls.
      These tokens are copied into the device tree and remain the same during
      the guest lifetime.
      
      When we start another guest to receive a migration, it calls
      spapr_rtas_register() as well. If the number of RTAS handlers or their
      order is different in QEMU on source and destination sides, the "/rtas"
      node in the device tree will differ. Since migration overwrites the device
      tree (as it overwrites the entire RAM), the actual RTAS config on
      the destination side gets broken.
      
      This defines global contant values for every RTAS token which QEMU
      is using today.
      
      This changes spapr_rtas_register() to accept a token number instead of
      allocating one. This changes all users of spapr_rtas_register().
      
      This changes XICS-KVM not to cache tokens registered with KVM as they
      constant now.
      
      This makes TOKEN_BASE global as RTAS_XXX use TOKEN_BASE as
      a base. TOKEN_MAX is moved and renamed too and its value is changed
      to the last token + 1. Boundary checks for token values are adjusted.
      
      This reserves token numbers for "os-term" handlers and PCI hotplug
      which we are working on.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      3a3b8502
    • A
      PPC: Add support for Apple gdb in gdbstub · b3cad3ab
      Alexander Graf 提交于
      The Apple gdbstub protocol is different from the normal gdbstub protocol
      used on PowerPC. Add support for the different variant, so that we can use
      Apple's gdb to debug guest code.
      
      Keep in mind that the switch is a compile time option. We can't detect
      during runtime whether a gdb connecting to us is an upstream gdb or an
      Apple gdb.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      b3cad3ab
    • S
      target-ppc: fixed translation of mcrxr instruction · 294d1292
      Sorav Bansal 提交于
      Fixed bug in gen_mcrxr() in target-ppc/translate.c:
      The XER[SO], XER[OV], and XER[CA] flags are stored in the least
      significant bit (bit 0) of their respective registers. They need
      to be shifted left (by their respective offsets) to generate the final
      XER value. The old translation code for the 'mcrxr' instruction
      was assuming that  the flags are stored in bit 2, and was shifting them
      right (incorrectly)
      Signed-off-by: NSorav Bansal <sbansal@cse.iitd.ernet.in>
      Reviewed-by: NTom Musta <tommusta@gmail.com>
      Tested-by: NTom Musta <tommusta@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      294d1292
    • A
      spapr: Add "qemu, boot-menu" property to /chosen · cc84c0f3
      Avik Sil 提交于
      This is required to enable boot menu display during booting
      Signed-off-by: NAvik Sil <aviksil@linux.vnet.ibm.com>
      Signed-off-by: NNikunj A Dadhania <nikunj@linux.vnet.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      cc84c0f3
    • T
      linux-user: Support HWCAP2 in PowerPC · a60438dd
      Tom Musta 提交于
      Set bits in the AT_HWCAP2 entry of the AUXV.  Specifically, detect and set bits
      for bctar, ISEL and ISA 2.07.
      Signed-off-by: NTom Musta <tommusta@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      a60438dd
    • T
      linux-user: Identify Addition Hardware Capabilities for PowerPC · 0e019746
      Tom Musta 提交于
      Add VSX, DFP and ISA 2.06 to the bits identified in the AT_HWCAP
      entry of the AUXV.
      Signed-off-by: NTom Musta <tommusta@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      0e019746
    • T
      target-ppc: Add DFP to Emulated Instructions Flag · b2f13550
      Tom Musta 提交于
      Decimal Floating Point is emulated, so add it the mask.  This will
      fix the erroneous message:
      
        Warning: Disabling some instructions which are not emulated by TCG (0x0, 0x4)
      Signed-off-by: NTom Musta <tommusta@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      b2f13550
    • T
      linux-user: Correct AUXV Cache Line Sizes for PowerPC · 623e250a
      Tom Musta 提交于
      Set the AT_ICACHEBSIZE and AT_DCACHEBSIZE entries of the AUXV to match the
      CPU model's cache line sizes.  This fixes memory clobbering problems on more
      recent Book 3s implementations; memset(p, 0, N) will use the dcbz instruction
      when N is sufficiently large and many of the newer server CPUs have cache lines
      sizes of 128 bytes.
      Signed-off-by: NTom Musta <tommusta@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      623e250a
  2. 26 6月, 2014 12 次提交