1. 12 3月, 2019 17 次提交
    • F
      target/ppc: Move handling of hardware breakpoints to a separate function · 2cbd1581
      Fabiano Rosas 提交于
      This is in preparation for a refactoring of the kvm_handle_debug
      function in the next patch.
      Signed-off-by: NFabiano Rosas <farosas@linux.ibm.com>
      Message-Id: <20190228225759.21328-4-farosas@linux.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      2cbd1581
    • F
      target/ppc: Move exception vector offset computation into a function · 2586a4d7
      Fabiano Rosas 提交于
      Signed-off-by: NFabiano Rosas <farosas@linux.ibm.com>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Message-Id: <20190228225759.21328-2-farosas@linux.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      2586a4d7
    • S
      target/ppc/spapr: Enable mitigations by default for pseries-4.0 machine type · 2782ad4c
      Suraj Jitindar Singh 提交于
      There are currently 3 mitigations the availability of which is controlled
      by the spapr-caps mechanism, cap-cfpc, cap-sbbc, and cap-ibs. Enable these
      mitigations by default for the pseries-4.0 machine type.
      
      By now machine firmware should have been upgraded to allow these
      settings.
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Message-Id: <20190301044609.9626-3-sjitindarsingh@gmail.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      2782ad4c
    • S
      target/ppc/tcg: make spapr_caps apply cap-[cfpc/sbbc/ibs] non-fatal for tcg · 006e9d36
      Suraj Jitindar Singh 提交于
      The spapr_caps cap-cfpc, cap-sbbc and cap-ibs are used to control the
      availability of certain mitigations to the guest. These haven't been
      implemented under TCG, it is unlikely they ever will be, and it is unclear
      as to whether they even need to be.
      
      As such, make failure to apply these capabilities under TCG non-fatal.
      Instead we print a warning message to the user but still allow the guest
      to continue.
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Message-Id: <20190301044609.9626-2-sjitindarsingh@gmail.com>
      [dwg: Small style fix]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      006e9d36
    • S
      target/ppc/spapr: Add SPAPR_CAP_CCF_ASSIST · 8ff43ee4
      Suraj Jitindar Singh 提交于
      Introduce a new spapr_cap SPAPR_CAP_CCF_ASSIST to be used to indicate
      the requirement for a hw-assisted version of the count cache flush
      workaround.
      
      The count cache flush workaround is a software workaround which can be
      used to flush the count cache on context switch. Some revisions of
      hardware may have a hardware accelerated flush, in which case the
      software flush can be shortened. This cap is used to set the
      availability of such hardware acceleration for the count cache flush
      routine.
      
      The availability of such hardware acceleration is indicated by the
      H_CPU_CHAR_BCCTR_FLUSH_ASSIST flag being set in the characteristics
      returned from the KVM_PPC_GET_CPU_CHAR ioctl.
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Message-Id: <20190301031912.28809-2-sjitindarsingh@gmail.com>
      [dwg: Small style fixes]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      8ff43ee4
    • S
      target/ppc/spapr: Add workaround option to SPAPR_CAP_IBS · 399b2896
      Suraj Jitindar Singh 提交于
      The spapr_cap SPAPR_CAP_IBS is used to indicate the level of capability
      for mitigations for indirect branch speculation. Currently the available
      values are broken (default), fixed-ibs (fixed by serialising indirect
      branches) and fixed-ccd (fixed by diabling the count cache).
      
      Introduce a new value for this capability denoted workaround, meaning that
      software can work around the issue by flushing the count cache on
      context switch. This option is available if the hypervisor sets the
      H_CPU_BEHAV_FLUSH_COUNT_CACHE flag in the cpu behaviours returned from
      the KVM_PPC_GET_CPU_CHAR ioctl.
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Message-Id: <20190301031912.28809-1-sjitindarsingh@gmail.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      399b2896
    • S
      target/ppc/spapr: Enable the large decrementer for pseries-4.0 · edaa7995
      Suraj Jitindar Singh 提交于
      Enable the large decrementer by default for the pseries-4.0 machine type.
      It is disabled again by default_caps_with_cpu() for pre-POWER9 cpus
      since they don't support the large decrementer.
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Message-Id: <20190301024317.22137-4-sjitindarsingh@gmail.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      edaa7995
    • S
      target/ppc: Implement large decrementer support for KVM · 7d050527
      Suraj Jitindar Singh 提交于
      Implement support to allow KVM guests to take advantage of the large
      decrementer introduced on POWER9 cpus.
      
      To determine if the host can support the requested large decrementer
      size, we check it matches that specified in the ibm,dec-bits device-tree
      property. We also need to enable it in KVM by setting the LPCR_LD bit in
      the LPCR. Note that to do this we need to try and set the bit, then read
      it back to check the host allowed us to set it, if so we can use it but
      if we were unable to set it the host cannot support it and we must not
      use the large decrementer.
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Signed-off-by: NCédric Le Goater <clg@kaod.org>
      Message-Id: <20190301024317.22137-3-sjitindarsingh@gmail.com>
      [dwg: Small style fixes]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      7d050527
    • S
      target/ppc: Implement large decrementer support for TCG · a8dafa52
      Suraj Jitindar Singh 提交于
      Prior to POWER9 the decrementer was a 32-bit register which decremented
      with each tick of the timebase. From POWER9 onwards the decrementer can
      be set to operate in a mode called large decrementer where it acts as a
      n-bit decrementing register which is visible as a 64-bit register, that
      is the value of the decrementer is sign extended to 64 bits (where n is
      implementation dependant).
      
      The mode in which the decrementer operates is controlled by the LPCR_LD
      bit in the logical paritition control register (LPCR).
      
      >From POWER9 onwards the HDEC (hypervisor decrementer) was enlarged to
      h-bits, also sign extended to 64 bits (where h is implementation
      dependant). Note this isn't configurable and is always enabled.
      
      On POWER9 the large decrementer and hdec are both 56 bits, as
      represented by the lrg_decr_bits cpu class property. Since they are the
      same size we only add one property for now, which could be extended in
      the case they ever differ in the future.
      
      We also add the lrg_decr_bits property for POWER5+/7/8 since it is used
      to determine the size of the hdec, which is only generated on the
      POWER5+ processor and later. On these processors it is 32 bits.
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Signed-off-by: NCédric Le Goater <clg@kaod.org>
      Message-Id: <20190301024317.22137-2-sjitindarsingh@gmail.com>
      [dwg: Small style fixes]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      a8dafa52
    • S
      target/ppc/spapr: Add SPAPR_CAP_LARGE_DECREMENTER · c982f5cf
      Suraj Jitindar Singh 提交于
      Add spapr_cap SPAPR_CAP_LARGE_DECREMENTER to be used to control the
      availability of the large decrementer for a guest.
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Message-Id: <20190301024317.22137-1-sjitindarsingh@gmail.com>
      [dwg: Trivial style fix]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      c982f5cf
    • G
      Revert "spapr: support memory unplug for qtest" · c65ecfe2
      Greg Kurz 提交于
      Commit b8165118 broke CPU hotplug tests for old machine types:
      
      $ QTEST_QEMU_BINARY=ppc64-softmmu/qemu-system-ppc64 ./tests/cpu-plug-test -m=slow
      /ppc64/cpu-plug/pseries-3.1/device-add/2x3x1&maxcpus=6: OK
      /ppc64/cpu-plug/pseries-2.12-sxxm/device-add/2x3x1&maxcpus=6: OK
      /ppc64/cpu-plug/pseries-3.0/device-add/2x3x1&maxcpus=6: OK
      /ppc64/cpu-plug/pseries-2.10/device-add/2x3x1&maxcpus=6: OK
      /ppc64/cpu-plug/pseries-2.11/device-add/2x3x1&maxcpus=6: OK
      /ppc64/cpu-plug/pseries-2.12/device-add/2x3x1&maxcpus=6: OK
      /ppc64/cpu-plug/pseries-2.9/device-add/2x3x1&maxcpus=6: OK
      /ppc64/cpu-plug/pseries-2.7/device-add/2x3x1&maxcpus=6: **
      ERROR:/home/thuth/devel/qemu/hw/ppc/spapr_events.c:313:rtas_event_log_to_source: assertion failed: (source->enabled)
      Broken pipe
      /home/thuth/devel/qemu/tests/libqtest.c:143: kill_qemu() detected QEMU death from signal 6 (Aborted) (core dumped)
      Aborted (core dumped)
      
      The approach of faking the availability of OV5_HP_EVT causes the
      code to assume the hotplug event source is enabled, which is wrong
      for older machines.
      
      We've now fixed CAS under qtest with a different approach.  Therefore,
      this reverts commit b8165118.
      
      A subsequent patch will address the problem of CAS under qtest from
      a different angle.
      Reported-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Message-Id: <155146875097.147873.1732264036668112686.stgit@bahia.lan>
      Tested-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      c65ecfe2
    • G
      spapr: Simulate CAS for qtest · 23ff81bd
      Greg Kurz 提交于
      The RTAS event hotplug code for machine types 2.8 and newer depends on
      the CAS negotiated ov5 in order to work properly. However, there's no
      CAS when running under qtest. There has been a tentative to trick the
      code by faking the OV5_HP_EVT bit, but it turned out to break other
      assumptions in the code and the change got reverted.
      
      Go for a more general approach and simulate a CAS when running under
      qtest. For simplicity, this pseudo CAS simple simulates the case where
      the guest supports the same features as the machine. It is done at
      reset time, just before we reset the DRCs, which could potentially
      exercise the unplug code.
      
      This allows to test unplug on spapr with both older and newer machine
      types.
      Suggested-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Message-Id: <155146875704.147873.10563808578795890265.stgit@bahia.lan>
      Tested-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      23ff81bd
    • A
      vfio/spapr: Rename local systempagesize variable · 3cdd801b
      Alexey Kardashevskiy 提交于
      The "systempagesize" name suggests that it is the host system page size
      while it is the smallest page size of memory backing the guest RAM so
      let's rename it to stop confusion. This should cause no behavioral change.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Message-Id: <20190227085149.38596-4-aik@ozlabs.ru>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      3cdd801b
    • A
      vfio/spapr: Fix indirect levels calculation · 16107998
      Alexey Kardashevskiy 提交于
      The current code assumes that we can address more bits on a PCI bus
      for DMA than we really can but there is no way knowing the actual limit.
      
      This makes a better guess for the number of levels and if the kernel
      fails to allocate that, this increases the level numbers till succeeded
      or reached the 64bit limit.
      
      This adds levels to the trace point.
      
      This may cause the kernel to warn about failed allocation:
         [65122.837458] Failed to allocate a TCE memory, level shift=28
      which might happen if MAX_ORDER is not large enough as it can vary:
      https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/Kconfig?h=v5.0-rc2#n727Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Message-Id: <20190227085149.38596-3-aik@ozlabs.ru>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      16107998
    • P
      Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging · 377b155b
      Peter Maydell 提交于
      * allow building QEMU without TCG or KVM support (Anthony)
      * update AMD IOMMU copyright (David)
      * compilation fixes for GCC and BSDs (Alexey, David, Paolo, Philippe)
      * coalesced I/O bugfix (Jagannathan)
      * Processor Tracing cpuid fix (Luwei)
      * Kconfig fixes (Paolo, David)
      * Cleanups (Paolo, Wei)
      * PVH vs. multiboot fix (Stefano)
      * LSI bugfixes (Sven)
      * elf2dmp Coverity fix (Victor)
      * scsi-disk fix (Zhengui)
      * authorization support for chardev TLS (Daniel)
      
      # gpg: Signature made Mon 11 Mar 2019 16:12:00 GMT
      # gpg:                using RSA key BFFBD25F78C7AE83
      # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
      # gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
      # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
      #      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83
      
      * remotes/bonzini/tags/for-upstream: (31 commits)
        qemugdb: fix licensing
        chardev: add support for authorization for TLS clients
        qom: cpu: destroy work_mutex in cpu_common_finalize
        exec.c: refactor function flatview_add_to_dispatch()
        lsi: 810/895A are always little endian
        lsi: return dfifo value
        lsi: use SCSI phase names instead of numbers in trace
        lsi: use enum type for s->msg_action
        lsi: use enum type for s->waiting
        lsi: use ldn_le_p()/stn_le_p()
        scsi-disk: Fix crash if request is invaild or disk is no medium
        configure: Disable W^X on OpenBSD
        oslib-posix: Ignore fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure
        accel: Allow to build QEMU without TCG or KVM support
        build: clean trace/generated-helpers.c
        build: remove unnecessary assignments from Makefile.target
        build: get rid of target-obj-y
        update copyright notice
        lsi: check if SIGP bit is already set in Wait reselect
        lsi: implement basic SBCL functionality
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      377b155b
    • P
      Merge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-mar-11-2019' into staging · c8761809
      Peter Maydell 提交于
      MIPS queue for March 11th, 2019
      
      # gpg: Signature made Mon 11 Mar 2019 14:16:09 GMT
      # gpg:                using RSA key D4972A8967F75A65
      # gpg: Good signature from "Aleksandar Markovic <amarkovic@wavecomp.com>" [unknown]
      # gpg: WARNING: This key is not certified with a trusted signature!
      # gpg:          There is no indication that the signature belongs to the owner.
      # Primary key fingerprint: 8526 FBF1 5DA3 811F 4A01  DD75 D497 2A89 67F7 5A65
      
      * remotes/amarkovic/tags/mips-queue-mar-11-2019:
        target/mips: Add tests for a variety of MSA integer subtract instructions
        target/mips: Add tests for a variety of MSA integer multiply instructions
        target/mips: Add tests for a variety of MSA integer dot product instructions
        target/mips: Add tests for a variety of MSA integer divide instructions
        target/mips: Add tests for a variety of MSA integer average instructions
        tests/tcg: target/mips: Rename two header files for consistency
        tests/tcg: target/mips: Correct preambles of test source files
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      c8761809
    • P
      Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20190311' into staging · 208d92df
      Peter Maydell 提交于
      s390x update:
      - clean up LowCore definition
      - first part of vector instruction support for tcg
      
      # gpg: Signature made Mon 11 Mar 2019 08:59:02 GMT
      # gpg:                using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF
      # gpg:                issuer "cohuck@redhat.com"
      # gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" [unknown]
      # gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>" [full]
      # gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>" [full]
      # gpg:                 aka "Cornelia Huck <cohuck@kernel.org>" [unknown]
      # gpg:                 aka "Cornelia Huck <cohuck@redhat.com>" [unknown]
      # Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF
      
      * remotes/cohuck/tags/s390x-20190311: (33 commits)
        s390x/tcg: Implement VECTOR UNPACK *
        s390x/tcg: Implement VECTOR STORE WITH LENGTH
        s390x/tcg: Implement VECTOR STORE MULTIPLE
        s390x/tcg: Implement VECTOR STORE ELEMENT
        s390x/tcg: Implement VECTOR STORE
        s390x/tcg: Provide probe_write_access helper
        s390x/tcg: Implement VECTOR SIGN EXTEND TO DOUBLEWORD
        s390x/tcg: Implement VECTOR SELECT
        s390x/tcg: Implement VECTOR SCATTER ELEMENT
        s390x/tcg: Implement VECTOR REPLICATE IMMEDIATE
        s390x/tcg: Implement VECTOR REPLICATE
        s390x/tcg: Implement VECTOR PERMUTE DOUBLEWORD IMMEDIATE
        s390x/tcg: Implement VECTOR PERMUTE
        s390x/tcg: Implement VECTOR PACK *
        s390x/tcg: Implement VECTOR MERGE (HIGH|LOW)
        s390x/tcg: Implement VECTOR LOAD WITH LENGTH
        s390x/tcg: Implement VECTOR LOAD VR FROM GRS DISJOINT
        s390x/tcg: Implement VECTOR LOAD VR ELEMENT FROM GR
        s390x/tcg: Implement VECTOR LOAD TO BLOCK BOUNDARY
        s390x/tcg: Implement VECTOR LOAD MULTIPLE
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      208d92df
  2. 11 3月, 2019 23 次提交