1. 31 10月, 2016 1 次提交
  2. 27 9月, 2016 1 次提交
    • A
      cpus: pass CPUState to run_on_cpu helpers · e0eeb4a2
      Alex Bennée 提交于
      CPUState is a fairly common pointer to pass to these helpers. This means
      if you need other arguments for the async_run_on_cpu case you end up
      having to do a g_malloc to stuff additional data into the routine. For
      the current users this isn't a massive deal but for MTTCG this gets
      cumbersome when the only other parameter is often an address.
      
      This adds the typedef run_on_cpu_func for helper functions which has an
      explicit CPUState * passed as the first parameter. All the users of
      run_on_cpu and async_run_on_cpu have had their helpers updated to use
      CPUState where available.
      Signed-off-by: NAlex Bennée <alex.bennee@linaro.org>
      [Sergey Fedorov:
       - eliminate more CPUState in user data;
       - remove unnecessary user data passing;
       - fix target-s390x/kvm.c and target-s390x/misc_helper.c]
      Signed-off-by: NSergey Fedorov <sergey.fedorov@linaro.org>
      Acked-by: David Gibson <david@gibson.dropbear.id.au> (ppc parts)
      Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> (s390 parts)
      Signed-off-by: NAlex Bennée <alex.bennee@linaro.org>
      Message-Id: <1470158864-17651-3-git-send-email-alex.bennee@linaro.org>
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e0eeb4a2
  3. 23 9月, 2016 2 次提交
  4. 05 7月, 2016 1 次提交
  5. 22 6月, 2016 1 次提交
    • A
      powerpc/mm: Update the WIMG check during H_ENTER · c1175907
      Aneesh Kumar K.V 提交于
      Support for 0 value for memeory coherence is optional and with ppc64
      we can always enable memory coherence. Linux kernel did that during
      the development of 4.7 kernel. But that resulted in failure in Qemu
      in H_ENTER hcall due to below check. The mentioned change was reverted
      in the kernel and kernel right now enable memory coherence only if
      cache inhibited is not set. Nevertheless update qemu WIMG flag check
      to cover the case where we enable memory coherence along with cache
      inhibited flag.
      
      In order to handle older and newer kernel version consider both Cache
      inhibitted and (cache inhibitted | memory conference) as valid values
      for wimg flags.
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      c1175907
  6. 14 6月, 2016 3 次提交
  7. 30 5月, 2016 1 次提交
    • B
      ppc: Do some batching of TCG tlb flushes · cd0c6f47
      Benjamin Herrenschmidt 提交于
      On ppc64 especially, we flush the tlb on any slbie or tlbie instruction.
      
      However, those instructions often come in bursts of 3 or more (context
      switch will favor a series of slbie's for example to an slbia if the
      SLB has less than a certain number of entries in it, and tlbie's can
      happen in a series, with PAPR, H_BULK_REMOVE can remove up to 4 entries
      at a time.
      
      Doing a tlb_flush() each time is a waste of time. We end up doing a memset
      of the whole TLB, reloading it for the next instruction, memset'ing again,
      etc...
      
      Those instructions don't have to take effect immediately. For slbie, they
      can wait for the next context synchronizing event. For tlbie, the next
      tlbsync.
      
      This implements batching by keeping a flag that indicates that we have a
      TLB in need of flushing. We check it on interrupts, rfi's, isync's and
      tlbsync and flush the TLB if needed.
      
      This reduces the number of tlb_flush() on a boot to a ubuntu installer
      first dialog screen from roughly 360K down to 36K.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      [clg: added a 'CPUPPCState *' variable in h_remove() and
            h_bulk_remove() ]
      Signed-off-by: NCédric Le Goater <clg@kaod.org>
      [dwg: removed spurious whitespace change, use 0/1 not true/false
            consistently, since tlb_need_flush has int type]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      cd0c6f47
  8. 19 5月, 2016 3 次提交
  9. 05 4月, 2016 1 次提交
  10. 23 3月, 2016 1 次提交
    • M
      include/qemu/osdep.h: Don't include qapi/error.h · da34e65c
      Markus Armbruster 提交于
      Commit 57cb38b3 included qapi/error.h into qemu/osdep.h to get the
      Error typedef.  Since then, we've moved to include qemu/osdep.h
      everywhere.  Its file comment explains: "To avoid getting into
      possible circular include dependencies, this file should not include
      any other QEMU headers, with the exceptions of config-host.h,
      compiler.h, os-posix.h and os-win32.h, all of which are doing a
      similar job to this file and are under similar constraints."
      qapi/error.h doesn't do a similar job, and it doesn't adhere to
      similar constraints: it includes qapi-types.h.  That's in excess of
      100KiB of crap most .c files don't actually need.
      
      Add the typedef to qemu/typedefs.h, and include that instead of
      qapi/error.h.  Include qapi/error.h in .c files that need it and don't
      get it now.  Include qapi-types.h in qom/object.h for uint16List.
      
      Update scripts/clean-includes accordingly.  Update it further to match
      reality: replace config.h by config-target.h, add sysemu/os-posix.h,
      sysemu/os-win32.h.  Update the list of includes in the qemu/osdep.h
      comment quoted above similarly.
      
      This reduces the number of objects depending on qapi/error.h from "all
      of them" to less than a third.  Unfortunately, the number depending on
      qapi-types.h shrinks only a little.  More work is needed for that one.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      [Fix compilation without the spice devel packages. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      da34e65c
  11. 16 3月, 2016 1 次提交
    • D
      target-ppc: Eliminate kvmppc_kern_htab global · c18ad9a5
      David Gibson 提交于
      fa48b432 "target-ppc: Remove hack for ppc_hash64_load_hpte*() with HV KVM"
      purports to remove a hack in the handling of hash page tables (HPTs)
      managed by KVM instead of qemu.  However, it actually went in the wrong
      direction.
      
      That patch requires anything looking for an external HPT (that is one not
      managed by the guest itself) to check both env->external_htab (for a qemu
      managed HPT) and kvmppc_kern_htab (for a KVM managed HPT).  That's a
      problem because kvmppc_kern_htab is local to mmu-hash64.c, but some places
      which need to check for an external HPT are outside that, such as
      kvm_arch_get_registers().  The latter was subtly broken by the earlier
      patch such that gdbstub can no longer access memory.
      
      Basically a KVM managed HPT is much more like a qemu managed HPT than it is
      like a guest managed HPT, so the original "hack" was actually on the right
      track.
      
      This partially reverts fa48b432, so we again mark a KVM managed external HPT
      by putting a special but non-NULL value in env->external_htab.  It then
      goes further, using that marker to eliminate the kvmppc_kern_htab global
      entirely.  The ppc_hash64_set_external_hpt() helper function is extended
      to set that marker if passed a NULL value (if you're setting an external
      HPT, but don't have an actual HPT to set, the assumption is that it must
      be a KVM managed HPT).
      
      This also has some flow-on changes to the HPT access helpers, required by
      the above changes.
      Reported-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Reviewed-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      Tested-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      c18ad9a5
  12. 25 2月, 2016 1 次提交
    • T
      hw/ppc/spapr: Implement the h_page_init hypercall · 3240dd9a
      Thomas Huth 提交于
      This hypercall either initializes a page with zeros, or copies
      another page.
      According to LoPAPR, the i-cache of the page should also be
      flushed if using H_ICACHE_INVALIDATE or H_ICACHE_SYNCHRONIZE,
      and the d-cache should be synchronized to the RAM if the
      H_ICACHE_SYNCHRONIZE flag is used. For this, two new functions
      are introduced, kvmppc_dcbst_range() and kvmppc_icbi()_range, which
      use the corresponding assembler instructions to flush the caches
      if running with KVM on Power. If the code runs with TCG instead,
      the code only uses tb_flush(), assuming that this will be
      enough for synchronization.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      3240dd9a
  13. 17 2月, 2016 3 次提交
  14. 30 1月, 2016 6 次提交
  15. 29 1月, 2016 1 次提交
    • P
      ppc: Clean up includes · 0d75590d
      Peter Maydell 提交于
      Clean up includes so that osdep.h is included first and headers
      which it implies are not included manually.
      
      This commit was created with scripts/clean-includes.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1453832250-766-6-git-send-email-peter.maydell@linaro.org
      0d75590d
  16. 23 9月, 2015 2 次提交
    • B
      spapr: Support ibm,dynamic-reconfiguration-memory · 03d196b7
      Bharata B Rao 提交于
      Parse ibm,architecture.vec table obtained from the guest and enable
      memory node configuration via ibm,dynamic-reconfiguration-memory if guest
      supports it. This is in preparation to support memory hotplug for
      sPAPR guests.
      
      This changes the way memory node configuration is done. Currently all
      memory nodes are built upfront. But after this patch, only memory@0 node
      for RMA is built upfront. Guest kernel boots with just that and rest of
      the memory nodes (via memory@XXX or ibm,dynamic-reconfiguration-memory)
      are built when guest does ibm,client-architecture-support call.
      
      Note: This patch needs a SLOF enhancement which is already part of
      SLOF binary in QEMU.
      Signed-off-by: NBharata B Rao <bharata@linux.vnet.ibm.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      03d196b7
    • T
      ppc/spapr: Use qemu_log_mask() for hcall_dprintf() · aaf87c66
      Thomas Huth 提交于
      To see the output of the hcall_dprintf statements, you currently have
      to enable the DEBUG_SPAPR_HCALLS macro in include/hw/ppc/spapr.h.
      This is ugly because a) not every user who wants to debug guest
      problems can or wants to recompile QEMU to be able to see such issues,
      and b) since this macro is disabled by default, the code in the
      hcall_dprintf() brackets tends to bitrot until somebody temporarily
      enables that macro again.
      Since the hcall_dprintf statements except one indicate guest
      problems, let's always use qemu_log_mask(LOG_GUEST_ERROR, ...) for
      this macro instead. One spot indicated an unimplemented host feature,
      so this is changed into qemu_log_mask(LOG_UNIMP, ...) instead. Now
      it's possible to see all those messages by simply adding the CLI
      parameter "-d guest_errors,unimp", without the need to re-compile
      the binary.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      aaf87c66
  17. 07 7月, 2015 2 次提交
    • D
      spapr: Remove obsolete ram_limit field from sPAPRMachineState · fb164994
      David Gibson 提交于
      The ram_limit field was imported from sPAPREnvironment where it predates
      the machine's ram size being available generically from machine->ram_size.
      
      Worse, the existing code was inconsistent about where it got the ram size
      from.  Sometimes it used spapr->ram_limit, sometimes the global 'ram_size'
      and sometimes a local 'ram_size' masking the global.
      
      This cleans up the code to consistently use machine->ram_size, eliminating
      spapr->ram_limit in the process.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      fb164994
    • D
      spapr: Merge sPAPREnvironment into sPAPRMachineState · 28e02042
      David Gibson 提交于
      The code for -machine pseries maintains a global sPAPREnvironment structure
      which keeps track of general state information about the guest platform.
      This predates the existence of the MachineState structure, but performs
      basically the same function.
      
      Now that we have the generic MachineState, fold sPAPREnvironment into
      sPAPRMachineState, the pseries specific subclass of MachineState.
      
      This is mostly a matter of search and replace, although a few places which
      relied on the global spapr variable are changed to find the structure via
      qdev_get_machine().
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      28e02042
  18. 09 3月, 2015 1 次提交
  19. 08 9月, 2014 1 次提交
  20. 08 7月, 2014 1 次提交
  21. 16 6月, 2014 4 次提交
    • A
      spapr_hcall: Add address-translation-mode-on-interrupt resource in H_SET_MODE · d5ac4f54
      Alexey Kardashevskiy 提交于
      This adds handling of the RESOURCE_ADDR_TRANS_MODE resource from
      the H_SET_MODE, for POWER8 (PowerISA 2.07) only.
      
      This defines AIL flags for LPCR special register.
      
      This changes @excp_prefix according to the mode, takes effect in TCG.
      
      This turns support of a new capability PPC2_ISA207S flag for TCG.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NTom Musta <tommusta@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      d5ac4f54
    • A
      spapr_hcall: Split h_set_mode() · c4015bbd
      Alexey Kardashevskiy 提交于
      This moves H_SET_MODE_RESOURCE_LE handler to a separate function
      as there are other "resources" coming and this is going to become ugly.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NTom Musta <tommusta@gmail.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      c4015bbd
    • A
      spapr: Implement processor compatibility in ibm, client-architecture-support · 3794d548
      Alexey Kardashevskiy 提交于
      Modern Linux kernels support last POWERPC CPUs so when a kernel boots,
      in most cases it can find a matching cpu_spec in the kernel's cpu_specs
      list. However if the kernel is quite old, it may be missing a definition
      of the actual CPU. To provide an ability for old kernels to work on modern
      hardware, a Processor Compatibility Mode has been introduced
      by the PowerISA specification.
      
      >From the hardware prospective, it is supported by the Processor
      Compatibility Register (PCR) which is defined in PowerISA. The register
      enables one of the compatibility modes (2.05/2.06/2.07).
      Since PCR is a hypervisor privileged register and cannot be
      directly accessed from the guest, the mode selection is done via
      ibm,client-architecture-support (CAS) RTAS call using which the guest
      specifies what "raw" and "architected" CPU versions it supports.
      QEMU works out the best match, changes a "cpu-version" property of
      every CPU and notifies the guest about the change by setting these
      properties in the buffer passed as a response on a custom H_CAS hypercall.
      
      This implements ibm,client-architecture-support parameters parsing
      (now only for PVRs) and cooks the device tree diff with new values for
      "cpu-version", "ibm,ppc-interrupt-server#s" and
      "ibm,ppc-interrupt-server#s" properties.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      3794d548
    • A
      spapr: Add ibm, client-architecture-support call · 2a6593cb
      Alexey Kardashevskiy 提交于
      The PAPR+ specification defines a ibm,client-architecture-support (CAS)
      RTAS call which purpose is to provide a negotiation mechanism for
      the guest and the hypervisor to work out the best compatibility parameters.
      During the negotiation process, the guest provides an array of various
      options and capabilities which it supports, the hypervisor adjusts
      the device tree and (optionally) reboots the guest.
      
      At the moment the Linux guest calls CAS method at early boot so SLOF
      gets called. SLOF allocates a memory buffer for the device tree changes
      and calls a custom KVMPPC_H_CAS hypercall. QEMU parses the options,
      composes a diff for the device tree, copies it to the buffer provided
      by SLOF and returns to SLOF. SLOF updates the device tree and returns
      control to the guest kernel. Only then the Linux guest parses the device
      tree so it is possible to avoid unnecessary reboot in most cases.
      
      The device tree diff is a header with an update format version
      (defined as 1 in this patch) followed by a device tree with the properties
      which require update.
      
      If QEMU detects that it has to reboot the guest, it silently does so
      as the guest expects reboot to happen because this is usual pHyp firmware
      behavior.
      
      This defines custom KVMPPC_H_CAS hypercall. The current SLOF already
      has support for it.
      
      This implements stub which returns very basic tree (root node,
      no properties) to the guest.
      
      As the return buffer does not contain any change, no change in behavior is
      expected.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      2a6593cb
  22. 20 3月, 2014 2 次提交