Skip to content
Snippets Groups Projects
  1. Apr 10, 2018
    • Peter Maydell's avatar
      linux-user/signal.c: Ensure AArch64 signal frame isn't too small · 7f0f4208
      Peter Maydell authored
      
      The AArch64 signal frame design was extended for SVE in commit
      8c5931de, so that instead of having a fixed setup we
      now add various records to the frame, with some of them possibly
      overflowing into an extra space outside the original 4K reserved
      block in the target_sigcontext.  However, we failed to ensure that we
      always at least allocate the 4K reserved block.  This is ABI, and
      some userspace programs rely on it.  In particular the dash shell
      would segfault if the frame wasn't as big enough.
      
      (Compare the kernel's sigframe_size() function in
      arch/arm64/kernel/signal.c.)
      
      Reported-by: default avatarRichard Henwood <richard.henwood@arm.com>
      Reviewed-by: default avatarLaurent Vivier <laurent@vivier.eu>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Message-id: 20180409140714.26841-1-peter.maydell@linaro.org
      Fixes: https://bugs.launchpad.net/bugs/1761535
      
      
      Fixes: 8c5931de
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      7f0f4208
    • Peter Maydell's avatar
      cpus.c: ensure running CPU recalculates icount deadlines on timer expiry · c52e7132
      Peter Maydell authored
      When we run in TCG icount mode, we calculate the number of instructions
      to execute using tcg_get_icount_limit(), which ensures that we stop
      execution at the next timer deadline. However there is a bug where
      currently we do not recalculate that limit if the guest reprograms
      a timer so that the next deadline moves closer, and so we will
      continue execution until the original limit and fire the timer
      later than we should.
      
      Fix this bug in qemu_timer_notify_cb(): if we are currently running
      a VCPU in icount mode, we simply need to kick it out of the main
      loop and back to tcg_cpu_exec(), where it will recalculate the
      icount limit. If we are not currently running a VCPU, then we
      retain the existing logic for waking up a halted CPU.
      
      Cc: qemu-stable@nongnu.org
      Fixes: https://bugs.launchpad.net/qemu/+bug/1754038
      
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-id: 20180406123838.21249-1-peter.maydell@linaro.org
      c52e7132
    • Peter Maydell's avatar
      target/arm: Report unsupported MPU region sizes more clearly · 8aec759b
      Peter Maydell authored
      
      Currently our PMSAv7 and ARMv7M MPU implementation cannot handle
      MPU region sizes smaller than our TARGET_PAGE_SIZE. However we
      report that in a slightly confusing way:
      
       DRSR[3]: No support for MPU (sub)region alignment of 9 bits. Minimum is 10
      
      The problem is not the alignment of the region, but its size;
      tweak the error message to say so:
       DRSR[3]: No support for MPU (sub)region size of 512 bytes. Minimum is 1024.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-id: 20180405172554.27401-1-peter.maydell@linaro.org
      8aec759b
    • Thomas Huth's avatar
      hw/arm/fsl-imx: Fix introspection problem with fsl-imx6 and fsl-imx7 · f640a591
      Thomas Huth authored
      
      QEMU currently exits unexpectedly when trying to introspect the fsl-imx6
      and fsl-imx7 devices on systems with many SMP CPUs:
      
      $ echo "{'execute':'qmp_capabilities'}"\
             "{'execute':'device-list-properties',"\
             " 'arguments':{'typename':'fsl,imx6'}}" \
             | arm-softmmu/qemu-system-arm -M virt,accel=qtest -qmp stdio -smp 8
      {"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2},
       "package": "build-all"}, "capabilities": []}}
      {"return": {}}
      fsl,imx6: Only 4 CPUs are supported (8 requested)
      
      And:
      
      $ echo "{'execute':'qmp_capabilities'}"\
             "{'execute':'device-list-properties',"\
             " 'arguments':{'typename':'fsl,imx7'}}" \
             | arm-softmmu/qemu-system-arm -M raspi2,accel=qtest -qmp stdio
      {"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2},
       "package": "build-all"}, "capabilities": []}}
      {"return": {}}
      fsl,imx7: Only 2 CPUs are supported (4 requested)
      
      This happens because these devices are doing an exit() from their
      instance_init function - which should never be done since instance_init
      can be called at any time for device introspection! Fix it by moving
      the deadly check into the realize() function instead.
      
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      Message-id: 1522908551-14885-1-git-send-email-thuth@redhat.com
      Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      f640a591
    • Thomas Huth's avatar
      hw/arm/allwinner-a10: Do not use nd_table in instance_init function · 8aabc543
      Thomas Huth authored
      
      The instance_init function of a device can be called at any time, even
      if the device is not going to be used (i.e. not going to be realized).
      So a instance_init function must not do things that could cause QEMU
      to exit, like calling qemu_check_nic_model(&nd_table[0], ...) for example.
      But this is what the instance_init function of the allwinner-a10 device
      is currently doing - and this causes QEMU to quit unexpectedly when
      you run the 'device-list-properties' QMP command for example:
      
      $ echo "{'execute':'qmp_capabilities'}"\
             "{'execute':'device-list-properties',"\
             " 'arguments':{'typename':'allwinner-a10'}}" \
             | arm-softmmu/qemu-system-arm -M mps2-an505,accel=qtest -qmp stdio
      {"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2},
       "package": "build-all"}, "capabilities": []}}
      {"return": {}}
      Unsupported NIC model: lan9118
      
      ... and QEMU quits after printing the last line (which should not happen
      just because of running 'device-list-properties' here).
      
      And with the cubieboard, this even causes QEMU to abort():
      
      $ echo "{'execute':'qmp_capabilities'}"\
             "{'execute':'device-list-properties',"\
             " 'arguments':{'typename':'allwinner-a10'}}" \
             | arm-softmmu/qemu-system-arm -M cubieboard,accel=qtest -qmp stdio
      {"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2},
       "package": "build-all"}, "capabilities": []}}
      {"return": {}}
      Unexpected error in error_set_from_qdev_prop_error() at hw/core/qdev-properties.c:1095:
      Property 'allwinner-emac.netdev' can't take value 'hub0port0', it's in use
      Aborted (core dumped)
      
      To fix the problem we've got to move the offending code to the realize
      function instead.
      
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      Message-id: 1522862420-7484-1-git-send-email-thuth@redhat.com
      Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      8aabc543
    • Peter Maydell's avatar
      hw/sd/bcm2835_sdhost: Don't raise spurious interrupts · f3d9fe8f
      Peter Maydell authored
      
      The Linux bcm2835_sdhost driver doesn't work on QEMU, because our
      model raises spurious data interrupts.  Our function
      bcm2835_sdhost_fifo_run() will flag an interrupt any time it is
      called with s->datacnt == 0, even if the host hasn't actually issued
      a data read or write command yet.  This means that the driver gets a
      spurious data interrupt as soon as it enables IRQs and then does
      something else that causes us to call the fifo_run routine, like
      writing to SDHCFG, and before it does the write to SDCMD to issue the
      read.  The driver's IRQ handler then spins forever complaining that
      there's no data and the SD controller isn't in a state where there's
      going to be any data:
      
      [   41.040738] sdhost-bcm2835 3f202000.mmc: fsm 1, hsts 00000000
      [   41.042059] sdhost-bcm2835 3f202000.mmc: fsm 1, hsts 00000000
      (continues forever).
      
      Move the interrupt flag setting to more plausible places:
       * for BUSY, raise this as soon as a BUSYWAIT command has executed
       * for DATA, raise this when the FIFO has any space free (for a write)
         or any data in it (for a read)
       * for BLOCK, raise this when the data count is 0 and we've
         actually done some reading or writing
      
      This is pure guesswork since the documentation for this hardware is
      not public, but it is sufficient to get the Linux bcm2835_sdhost
      driver to work.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Tested-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      Message-id: 20180319161556.16446-3-peter.maydell@linaro.org
      f3d9fe8f
    • Peter Maydell's avatar
      hw/sd/bcm2835_sdhost: Add tracepoints · b318f326
      Peter Maydell authored
      
      Add some tracepoints to the bcm2835_sdhost driver, to assist
      debugging.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Tested-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      Message-id: 20180319161556.16446-2-peter.maydell@linaro.org
      b318f326
    • Onur Sahin's avatar
      target-arm: Check undefined opcodes for SWP in A32 decoder · c4869ca6
      Onur Sahin authored
      
      Make sure we are not treating architecturally Undefined instructions
      as a SWP, by verifying the opcodes as per section A8.8.229 of ARMv7-A
      specification. Bits [21:20] must be zero for this to be a SWP or SWPB.
      We also choose to UNDEF for the architecturally UNPREDICTABLE case of
      bits [11:8] not being zero.
      
      Signed-off-by: default avatarOnur Sahin <onursahin08@gmail.com>
      [PMM: tweaked commit message]
      Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      c4869ca6
    • Thomas Huth's avatar
      hw/arm/integratorcp: Don't do things that could be fatal in the instance_init · 8720daad
      Thomas Huth authored
      
      An instance_init function must not fail - and might be called multiple times,
      e.g. during device introspection with the 'device-list-properties' QMP
      command. Since the integratorcm device ignores this rule, QEMU currently
      aborts in this case (though it really should not):
      
      echo "{'execute':'qmp_capabilities'}"\
           "{'execute':'device-list-properties',"\
           "'arguments':{'typename':'integrator_core'}}" \
           | arm-softmmu/qemu-system-arm -M integratorcp,accel=qtest -qmp stdio
      {"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2},
       "package": "build-all"}, "capabilities": []}}
      {"return": {}}
      RAMBlock "integrator.flash" already registered, abort!
      Aborted (core dumped)
      
      Move the problematic code to the realize() function instead to fix this
      problem.
      
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      Message-id: 1522906473-11252-1-git-send-email-thuth@redhat.com
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      8720daad
    • Andrey Smirnov's avatar
      hw/arm: Allow manually specified /psci node · c39770cd
      Andrey Smirnov authored
      
      Change the code to avoid exiting QEMU if user provided DTB contains
      manually specified /psci node and skip any /psci related fixups
      instead.
      
      Fixes: 4cbca7d9 ("hw/arm: Move virt's PSCI DT fixup code to
      arm/boot.c")
      
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Reported-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Tested-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Message-id: 20180402205654.14572-1-andrew.smirnov@gmail.com
      Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      c39770cd
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/xtensa/tags/20180409-xtensa' into staging · fb4fe32d
      Peter Maydell authored
      
      Fix file offset for preadv/pwritev linux-user syscalls.
      
      # gpg: Signature made Tue 10 Apr 2018 03:04:24 BST
      # gpg:                using RSA key 51F9CC91F83FA044
      # gpg: Good signature from "Max Filippov <filippov@cadence.com>"
      # gpg:                 aka "Max Filippov <max.filippov@cogentembedded.com>"
      # gpg:                 aka "Max Filippov <jcmvbkbc@gmail.com>"
      # Primary key fingerprint: 2B67 854B 98E5 327D CDEB  17D8 51F9 CC91 F83F A044
      
      * remotes/xtensa/tags/20180409-xtensa:
        linux-user: fix preadv/pwritev offsets
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      fb4fe32d
    • Max Filippov's avatar
      linux-user: fix preadv/pwritev offsets · 9ac22517
      Max Filippov authored
      
      preadv/pwritev accept low and high parts of file offset in two separate
      parameters. When host bitness doesn't match guest bitness these parts
      must be appropriately recombined.
      Introduce target_to_host_low_high that does this recombination and use
      it in preadv/pwritev syscalls.
      
      This fixes glibc testsuite test misc/tst-preadvwritev64.
      
      Reviewed-by: default avatarLaurent Vivier <laurent@vivier.eu>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      9ac22517
  2. Apr 09, 2018
Loading