1. 01 3月, 2017 16 次提交
  2. 24 2月, 2017 1 次提交
    • J
      tcg: drop global lock during TCG code execution · 8d04fb55
      Jan Kiszka 提交于
      This finally allows TCG to benefit from the iothread introduction: Drop
      the global mutex while running pure TCG CPU code. Reacquire the lock
      when entering MMIO or PIO emulation, or when leaving the TCG loop.
      
      We have to revert a few optimization for the current TCG threading
      model, namely kicking the TCG thread in qemu_mutex_lock_iothread and not
      kicking it in qemu_cpu_kick. We also need to disable RAM block
      reordering until we have a more efficient locking mechanism at hand.
      
      Still, a Linux x86 UP guest and my Musicpal ARM model boot fine here.
      These numbers demonstrate where we gain something:
      
      20338 jan       20   0  331m  75m 6904 R   99  0.9   0:50.95 qemu-system-arm
      20337 jan       20   0  331m  75m 6904 S   20  0.9   0:26.50 qemu-system-arm
      
      The guest CPU was fully loaded, but the iothread could still run mostly
      independent on a second core. Without the patch we don't get beyond
      
      32206 jan       20   0  330m  73m 7036 R   82  0.9   1:06.00 qemu-system-arm
      32204 jan       20   0  330m  73m 7036 S   21  0.9   0:17.03 qemu-system-arm
      
      We don't benefit significantly, though, when the guest is not fully
      loading a host CPU.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Message-Id: <1439220437-23957-10-git-send-email-fred.konrad@greensocs.com>
      [FK: Rebase, fix qemu_devices_reset deadlock, rm address_space_* mutex]
      Signed-off-by: NKONRAD Frederic <fred.konrad@greensocs.com>
      [EGC: fixed iothread lock for cpu-exec IRQ handling]
      Signed-off-by: NEmilio G. Cota <cota@braap.org>
      [AJB: -smp single-threaded fix, clean commit msg, BQL fixes]
      Signed-off-by: NAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      Reviewed-by: NPranith Kumar <bobby.prani@gmail.com>
      [PM: target-arm changes]
      Acked-by: NPeter Maydell <peter.maydell@linaro.org>
      8d04fb55
  3. 22 2月, 2017 6 次提交
  4. 01 2月, 2017 1 次提交
  5. 31 1月, 2017 10 次提交
    • M
      ppc: switch to constants within BUILD_BUG_ON · 25e6a118
      Michael S. Tsirkin 提交于
      We are switching BUILD_BUG_ON to verify that it's parameter is a
      compile-time constant, and it turns out that some gcc versions
      (specifically gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609) are
      not smart enough to figure it out for expressions involving local
      variables. This is harmless but means that the check is ineffective for
      these platforms.  To fix, replace the variable with macros.
      Reported-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      [dwg: Correct a printf format warning]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      25e6a118
    • L
      spapr: clock should count only if vm is running · 42043e4f
      Laurent Vivier 提交于
      This is a port to ppc of the i386 commit:
          00f4d64e kvmclock: clock should count only if vm is running
      
      We remove timebase_post_load function, and use the VM state
      change handler to save and restore the guest_timebase (on stop
      and continue).
      
      We keep timebase_pre_save to reduce the clock difference on
      migration like in:
          6053a86f kvmclock: reduce kvmclock difference on migration
      
      Time base offset has originally been introduced by commit
          98a8b524 spapr: Add support for time base offset migration
      
      So while VM is paused, the time is stopped. This allows to have
      the same result with date (based on Time Base Register) and
      hwclock (based on "get-time-of-day" RTAS call).
      
      Moreover in TCG mode, the Time Base is always paused, so this
      patch also adjust the behavior between TCG and KVM.
      
      VM state field "time_of_the_day_ns" is now useless but we keep
      it to be able to migrate to older version of the machine.
      
      As vmstate_ppc_timebase structure (with timebase_pre_save() and
      timebase_post_load() functions) was only used by vmstate_spapr,
      we register the VM state change handler only in ppc_spapr_init().
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      42043e4f
    • D
      ppc: Rewrite ppc_get_compat_smt_threads() · 12dbeb16
      David Gibson 提交于
      To continue consolidation of compatibility mode information, this rewrites
      the ppc_get_compat_smt_threads() function using the table of compatiblity
      modes in target-ppc/compat.c.
      
      It's not a direct replacement, the new ppc_compat_max_threads() function
      has simpler semantics - it just returns the number of threads the cpu
      model has, taking into account any compatiblity mode it is in.
      
      This no longer takes into account kvmppc_smt_threads() as the previous
      version did.  That check wasn't useful because we check in
      ppc_cpu_realizefn() that CPUs aren't instantiated with more threads
      than kvm allows (or if we didn't things will already be broken and
      this won't make it any worse).
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      12dbeb16
    • D
      fa325e6c
    • T
      hw/ppc/spapr: Fix boot path of usb-host storage devices · b99260eb
      Thomas Huth 提交于
      When passing through an USB storage device to a pseries guest, it
      is currently not possible to automatically boot from the device
      if the "bootindex" property has been specified, too (e.g. when using
      "-device nec-usb-xhci -device usb-host,hostbus=1,hostaddr=2,bootindex=0"
      at the command line). The problem is that QEMU builds a device tree path
      like "/pci@800000020000000/usb@0/usb-host@1" and passes it to SLOF
      in the /chosen/qemu,boot-list property. SLOF, however, probes the
      USB device, recognizes that it is a storage device and thus changes
      its name to "storage", and additionally adds a child node for the
      SCSI LUN, so the correct boot path in SLOF is something like
      "/pci@800000020000000/usb@0/storage@1/disk@101000000000000" instead.
      So when we detect an USB mass storage device with SCSI interface,
      we've got to adjust the firmware boot-device path properly that
      SLOF can automatically boot from the device.
      
      Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1354177Signed-off-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      b99260eb
    • N
      ppc/spapr: implement H_SIGNAL_SYS_RESET · 1c7ad77e
      Nicholas Piggin 提交于
      The H_SIGNAL_SYS_RESET hcall allows a guest CPU to raise a system reset
      exception on CPUs within the same guest -- all CPUs, all-but-self, or a
      specific CPU (including self).
      
      This has not made its way to a PAPR release yet, but we have an hcall
      number assigned.
      
        H_SIGNAL_SYS_RESET = 0x380
      
        Syntax:
          hcall(uint64 H_SIGNAL_SYS_RESET, int64 target);
      
        Generate a system reset NMI on the threads indicated by target.
      
        Values for target:
          -1 = target all online threads including the caller
          -2 = target all online threads except for the caller
          All other negative values: reserved
          Positive values: The thread to be targeted, obtained from the value
          of the "ibm,ppc-interrupt-server#s" property of the CPU in the OF
          device tree.
      
        Semantics:
          - Invalid target: return H_Parameter.
          - Otherwise: Generate a system reset NMI on target thread(s),
            return H_Success.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      1c7ad77e
    • D
      ppc: Rename cpu_version to compat_pvr · d6e166c0
      David Gibson 提交于
      The 'cpu_version' field in PowerPCCPU is badly named.  It's named after the
      'cpu-version' device tree property where it is advertised, but that meaning
      may not be obvious in most places it appears.
      
      Worse, it doesn't even really correspond to that device tree property.  The
      property contains either the processor's PVR, or, if the CPU is running in
      a compatibility mode, a special "logical PVR" representing which mode.
      
      Rename the cpu_version field, and a number of related variables to
      compat_pvr to make this clearer.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      d6e166c0
    • D
      ppc: Clean up and QOMify hypercall emulation · 1d1be34d
      David Gibson 提交于
      The pseries machine type is a bit unusual in that it runs a paravirtualized
      guest.  The guest expects to interact with a hypervisor, and qemu
      emulates the functions of that hypervisor directly, rather than executing
      hypervisor code within the emulated system.
      
      To implement this in TCG, we need to intercept hypercall instructions and
      direct them to the machine's hypercall handlers, rather than attempting to
      perform a privilege change within TCG.  This is controlled by a global
      hook - cpu_ppc_hypercall.
      
      This cleanup makes the handling a little cleaner and more extensible than
      a single global variable.  Instead, each CPU to have hypercalls intercepted
      has a pointer set to a QOM object implementing a new virtual hypervisor
      interface.  A method in that interface is called by TCG when it sees a
      hypercall instruction.  It's possible we may want to add other methods in
      future.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      1d1be34d
    • D
      pseries: Make cpu_update during CAS unconditional · 5b120785
      David Gibson 提交于
      spapr_h_cas_compose_response() includes a cpu_update parameter which
      controls whether it includes updated information on the CPUs in the device
      tree fragment returned from the ibm,client-architecture-support (CAS) call.
      
      Providing the updated information is essential when CAS has negotiated
      compatibility options which require different cpu information to be
      presented to the guest.  However, it should be safe to provide in other
      cases (it will just override the existing data in the device tree with
      identical data).  This simplifies the code by removing the parameter and
      always providing the cpu update information.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      5b120785
    • D
      pseries: Always use core objects for CPU construction · 0c86d0fd
      David Gibson 提交于
      Currently the pseries machine has two paths for constructing CPUs.  On
      newer machine type versions, which support cpu hotplug, it constructs
      cpu core objects, which in turn construct CPU threads.  For older machine
      versions it individually constructs the CPU threads.
      
      This division is going to make some future changes to the cpu construction
      harder, so this patch unifies them.  Now cpu core objects are always
      created.  This requires some updates to allow core objects to be created
      without a full complement of threads (since older versions allowed a
      number of cpus not a multiple of the threads-per-core).  Likewise it needs
      some changes to the cpu core hot/cold plug path so as not to choke on the
      old machine types without hotplug support.
      
      For good measure, we move the cpu construction to its own subfunction,
      spapr_init_cpus().
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      0c86d0fd
  6. 20 1月, 2017 1 次提交
  7. 01 12月, 2016 1 次提交
    • M
      spapr: fix default DRC state for coldplugged LMBs · 5c0139a8
      Michael Roth 提交于
      Currently we set the initial isolation/allocation state for DRCs
      associated with coldplugged LMBs to ISOLATED/UNUSABLE,
      respectively, under the assumption that the guest will move this
      state to UNISOLATED/USABLE.
      
      In fact, this is only the case for LMBs added via hotplug. For
      coldplugged LMBs, the guest actually assumes the initial state to
      be UNISOLATED/USABLE.
      
      In practice, this only becomes an issue when we attempt to unplug
      one of these LMBs, where the guest kernel will issue an
      rtas-get-sensor-state call to check that the corresponding DRC is
      in an USABLE state before it will release the LMB back to
      QEMU. If the returned state is otherwise, the guest will assume no
      further action is needed, which bypasses the QEMU-side cleanup that
      occurs during the USABLE->UNUSABLE transition. This results in
      LMBs and their corresponding pc-dimm devices to stick around
      indefinitely.
      
      This patch fixes the issue by manually setting DRCs associated with
      cold-plugged LMBs to UNISOLATED/ALLOCATED, but leaving the hotplug
      state untouched. As it turns out, this is analogous to the handling
      for cold-plugged CPUs in spapr_core_plug().
      
      Cc: qemu-ppc@nongnu.org
      Cc: David Gibson <david@gibson.dropbear.id.au>
      Cc: Bharata B Rao <bharata@linux.vnet.ibm.com>
      Cc: Greg Kurz <gkurz@linux.vnet.ibm.com>
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      5c0139a8
  8. 23 11月, 2016 3 次提交
    • D
      spapr: Fix 2.7<->2.8 migration of PCI host bridge · 5c4537bd
      David Gibson 提交于
      daa23699 "spapr_pci: Add a 64-bit MMIO window" subtly broke migration
      from qemu-2.7 to the current version.  It split the device's MMIO
      window into two pieces for 32-bit and 64-bit MMIO.
      
      The patch included backwards compatibility code to convert the old
      property into the new format.  However, the property value was also
      transferred in the migration stream and compared with a (probably
      unwise) VMSTATE_EQUAL.  So, the "raw" value from 2.7 is compared to
      the new style converted value from (pre-)2.8 giving a mismatch and
      migration failure.
      
      Along with the actual field that caused the breakage, there are
      several other ill-advised VMSTATE_EQUAL()s.  To fix forwards
      migration, we read the values in the stream into scratch variables and
      ignore them, instead of comparing for equality.  To fix backwards
      migration, we populate those scratch variables in pre_save() with
      adjusted values to match the old behaviour.
      
      To permit the eventual possibility of removing this cruft from the
      stream, we only include these compatibility fields if a new
      'pre-2.8-migration' property is set.  We clear it on the pseries-2.8
      machine type, which obviously can't be migrated backwards, but set it
      on earlier machine type versions.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      5c4537bd
    • D
      target-ppc: Allow eventual removal of old migration mistakes · 146c11f1
      David Gibson 提交于
      Until very recently, the vmstate for ppc cpus included some poorly
      thought out VMSTATE_EQUAL() components, that can easily break
      migration compatibility, and did so between qemu-2.6 and later
      versions.  A hack was recently added which fixes this migration
      breakage, but it leaves the unhelpful cruft of these fields in the
      migration stream.
      
      This patch adds a new cpu property allowing these fields to be removed
      from the stream entirely.  For the pseries-2.8 machine type - which
      comes after the fix - and for all non-pseries machine types - which
      aren't mature enough to care about cross-version migration - we remove
      the fields from the stream.
      
      For pseries-2.7 and earlier, The migration hack remains in place,
      allowing backwards and forwards migration with the older machine
      types.
      
      This restricts the migration compatibility cruft to older machine
      types, and at least opens the possibility of eventually deprecating
      and removing it entirely.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      146c11f1
    • M
      spapr: migration support for CAS-negotiated option vectors · 62ef3760
      Michael Roth 提交于
      With the additional of the OV5_HP_EVT option vector, we now have
      certain functionality (namely, memory unplug) that checks at run-time
      for whether or not the guest negotiated the option via CAS. Because
      we don't currently migrate these negotiated values, we are unable
      to unplug memory from a guest after it's been migrated until after
      the guest is rebooted and CAS-negotiation is repeated.
      
      This patch fixes this by adding CAS-negotiated options to the
      migration stream. We do this using a subsection, since the
      negotiated value of OV5_HP_EVT is the only option currently needed
      to maintain proper functionality for a running guest.
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      62ef3760
  9. 31 10月, 2016 1 次提交