1. 25 6月, 2020 21 次提交
  2. 24 6月, 2020 3 次提交
    • M
      trace/simple: Fix unauthorized enable · db25d56c
      Markus Armbruster 提交于
      st_set_trace_file() accidentally enables tracing.  It's called
      unconditionally during startup, which is why QEMU built with the
      simple trace backend always writes a trace file "trace-$PID".
      
      This has been broken for quite a while.  I didn't track down the exact
      commit.
      
      Fix st_set_trace_file() to restore the state.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-id: 20200527065613.25322-1-armbru@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      db25d56c
    • P
      scripts/tracetool: Update maintainer email address · f892b494
      Philippe Mathieu-Daudé 提交于
      There is an effort in progress to generate a QEMU Python
      package. As I'm not sure this old email is still valid,
      update it to not produce package with broken maintainer
      email.
      
      Patch created mechanically by running:
      
       $ sed -i 's,\(__email__ *= "\)stefanha@linux.vnet.ibm.com",\1stefanha@redhat.com",' \
               $(git grep -l 'email.*stefanha@linux.vnet.ibm.com')
      Signed-off-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Message-id: 20200511082816.696-1-philmd@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      f892b494
    • P
      Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200623' into staging · d4b78317
      Peter Maydell 提交于
      target-arm queue:
       * util/oslib-posix : qemu_init_exec_dir implementation for Mac
       * target/arm: Last parts of neon decodetree conversion
       * hw/arm/virt: Add 5.0 HW compat props
       * hw/watchdog/cmsdk-apb-watchdog: Add trace event for lock status
       * mps2: Add CMSDK APB watchdog, FPGAIO block, S2I devices and I2C devices
       * mps2: Add some unimplemented-device stubs for audio and GPIO
       * mps2-tz: Use the ARM SBCon two-wire serial bus interface
       * target/arm: Check supported KVM features globally (not per vCPU)
       * tests/qtest/arm-cpu-features: Add feature setting tests
       * arm/virt: Add memory hot remove support
      
      # gpg: Signature made Tue 23 Jun 2020 12:38:31 BST
      # gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
      # gpg:                issuer "peter.maydell@linaro.org"
      # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate]
      # gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [ultimate]
      # gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate]
      # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE
      
      * remotes/pmaydell/tags/pull-target-arm-20200623: (42 commits)
        arm/virt: Add memory hot remove support
        tests/qtest/arm-cpu-features: Add feature setting tests
        target/arm: Check supported KVM features globally (not per vCPU)
        hw/arm/mps2-tz: Use the ARM SBCon two-wire serial bus interface
        hw/arm/mps2: Add audio I2S interface as unimplemented device
        hw/arm/mps2: Add I2C devices
        hw/arm/mps2: Add SPI devices
        hw/arm/mps2: Map the FPGA I/O block
        hw/arm/mps2: Add CMSDK AHB GPIO peripherals as unimplemented devices
        hw/arm/mps2: Add CMSDK APB watchdog device
        hw/arm/mps2: Rename CMSDK AHB peripheral region
        hw/arm/mps2: Document CMSDK/FPGA APB subsystem sections
        hw/arm: Use TYPE_VERSATILE_I2C instead of hardcoded string
        hw/i2c: Add header for ARM SBCon two-wire serial bus interface
        hw/i2c/versatile_i2c: Add SCL/SDA definitions
        hw/i2c/versatile_i2c: Add definitions for register addresses
        hw/watchdog/cmsdk-apb-watchdog: Add trace event for lock status
        target/arm: Remove dead code relating to SABA and UABA
        target/arm: Remove unnecessary gen_io_end() calls
        target/arm: Move some functions used only in translate-neon.inc.c to that file
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      d4b78317
  3. 23 6月, 2020 16 次提交
    • M
      sd/milkymist-memcard: Fix error API violation · 953cd661
      Markus Armbruster 提交于
      The Error ** argument must be NULL, &error_abort, &error_fatal, or a
      pointer to a variable containing NULL.  Passing an argument of the
      latter kind twice without clearing it in between is wrong: if the
      first call sets an error, it no longer points to NULL for the second
      call.
      
      milkymist_memcard_realize() is wrong that way: it passes &err to
      qdev_prop_set_drive_err() and qdev_realize_and_unref().  Currently
      harmless, because the latter uses it only as first argument of
      error_propagate().
      
      Making qdev_prop_set_drive_err() fail involves abuse of -global.
      Leave handling that to qdev_prop_set_drive(), like we do elsewhere.
      
      Cc: Michael Walle <michael@walle.cc>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200622094227.1271650-17-armbru@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      953cd661
    • M
      sd/pxa2xx_mmci: Don't crash on pxa2xx_mmci_init() error · 17d26ac6
      Markus Armbruster 提交于
      On error, pxa2xx_mmci_init() reports to stderr and returns NULL.
      Callers don't check for errors.  Machines akita, borzoi, mainstone,
      spitz, terrier, tosa, and z2 crash shortly after, like this:
      
          $ qemu-system-aarch64 -M akita -drive if=sd,readonly=on
          qemu-system-aarch64: failed to init SD card: Cannot use read-only drive as SD card
          Segmentation fault (core dumped)
      
      Machines connex and verdex reach the check for orphaned drives first:
      
          $ aarch64-softmmu/qemu-system-aarch64 -M connex -drive if=sd,readonly=on -accel qtest
          qemu-system-aarch64: failed to init SD card: Cannot use read-only drive as SD card
          qemu-system-aarch64: -drive if=sd,readonly=on: machine type does not support if=sd,bus=0,unit=0
      
      Make pxa2xx_mmci_init() fail cleanly right away.
      
      Cc: Andrzej Zaborowski <balrogg@gmail.com>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Cc: qemu-arm@nongnu.org
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-Id: <20200622094227.1271650-16-armbru@redhat.com>
      17d26ac6
    • M
      arm/aspeed: Drop aspeed_board_init_flashes() parameter @errp · c20b4ccc
      Markus Armbruster 提交于
      We always pass &error_abort.  Drop the parameter, use &error_abort
      directly.
      
      Cc: Cédric Le Goater <clg@kaod.org>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Cc: Andrew Jeffery <andrew@aj.id.au>
      Cc: Joel Stanley <joel@jms.id.au>
      Cc: qemu-arm@nongnu.org
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NCédric Le Goater <clg@kaod.org>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-Id: <20200622094227.1271650-15-armbru@redhat.com>
      c20b4ccc
    • M
      qdev: Make qdev_prop_set_drive() match the other helpers · 934df912
      Markus Armbruster 提交于
      qdev_prop_set_drive() can fail.  None of the other qdev_prop_set_FOO()
      can; they abort on error.
      
      To clean up this inconsistency, rename qdev_prop_set_drive() to
      qdev_prop_set_drive_err(), and create a qdev_prop_set_drive() that
      aborts on error.
      
      Coccinelle script to update callers:
      
          @ depends on !(file in "hw/core/qdev-properties-system.c")@
          expression dev, name, value;
          symbol error_abort;
          @@
          -    qdev_prop_set_drive(dev, name, value, &error_abort);
          +    qdev_prop_set_drive(dev, name, value);
      
          @@
          expression dev, name, value, errp;
          @@
          -    qdev_prop_set_drive(dev, name, value, errp);
          +    qdev_prop_set_drive_err(dev, name, value, errp);
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-Id: <20200622094227.1271650-14-armbru@redhat.com>
      934df912
    • M
      qdev: Reject chardev property override · 9572a787
      Markus Armbruster 提交于
      qdev_prop_set_chr() screws up when the property already has a non-null
      value: it neglects to release the old value.  Both the old and the new
      backend become attached to the same device.  Unlike for block devices
      (see previous commit), this can't be observed from the monitor (I
      think).
      
      Example: -serial null -chardev null,id=chr0 -global isa-serial.chardev=chr0
      
      Special case: attempting to use the same backend both times crashes:
      
          $ qemu-system-x86_64 --nodefaults -serial null -global isa-serial.chardev=serial0
          Unexpected error in qemu_chr_fe_init() at /work/armbru/qemu/chardev/char-fe.c:220:
          qemu-system-x86_64: Device 'serial0' is in use
          Aborted (core dumped)
      
      Yet another example: -device with multiple chardev=... (but not
      device_add, which silently drops all but the last duplicate property).
      
      Perhaps chardev property override could be made to work.  Perhaps it
      should.  I can't afford the time to figure this out now.  What I can
      do reject usage that leaves backends in unhealthy states.  For what
      it's worth, we've long done the same for netdev properties.
      
      Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200622094227.1271650-13-armbru@redhat.com>
      9572a787
    • M
      qdev: Reject drive property override · 84b0475c
      Markus Armbruster 提交于
      qdev_prop_set_drive() screws up when the property already has a
      non-null value: it neglects to release the old value.  Both the old
      and the new backend become attached to the same device.
      
      Example (taken from iotest 172): -fda ... -drive if=none,... -global
      floppy.drive=none0.
      
      Special case: attempting to use the same backend both times fails.
      Example (also from iotest 172): -fda ... -global floppy.drive=floppy0.
      
      Yet another example: -device with multiple drive=... (but not
      device_add, which silently drops all but the last duplicate property).
      
      Perhaps drive property override could be made to work.  Perhaps it
      should.  I can't afford the time to figure this out now.  What I can
      do is reject usage that leaves backends in unhealthy states.  For what
      it's worth, we've long done the same for netdev properties.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200622094227.1271650-12-armbru@redhat.com>
      84b0475c
    • M
      qdev: Improve netdev property override error a bit · 1bc13336
      Markus Armbruster 提交于
      qdev_prop_set_netdev() fails when the property already has a non-null
      value.  Seems to go back to commit 30c367ed
      "qdev-properties-system.c: Allow vlan or netdev for -device, not
      both", v1.7.0.  Board code doesn't expect failure, and crashes:
      
          $ qemu-system-x86_64 --nodefaults -nic user -netdev user,id=nic0 -global e1000.netdev=nic0
          Unexpected error in error_set_from_qdev_prop_error() at /work/armbru/qemu/hw/core/qdev-properties.c:1101:
          qemu-system-x86_64: Property 'e1000.netdev' doesn't take value '__org.qemu.nic0
          '
          Aborted (core dumped)
      
      -device and device_add handle the failure:
      
          $ qemu-system-x86_64 -nodefaults -netdev user,id=net0 -netdev user,id=net1 -device e1000,netdev=net0,netdev=net1
          qemu-system-x86_64: -device e1000,netdev=net0,netdev=net1: Property 'e1000.netdev' doesn't take value 'net1'
          $ qemu-system-x86_64 -nodefaults -S -display none -monitor stdio -netdev user,id=net0 -netdev user,id=net1 -global e1000.netdev=net0
          QEMU 5.0.50 monitor - type 'help' for more information
          (qemu) qemu-system-x86_64: warning: netdev net0 has no peer
          qemu-system-x86_64: warning: netdev net1 has no peer
          device_add e1000,netdev=net1
          Error: Property 'e1000.netdev' doesn't take value 'net1'
      
      Perhaps netdev property override could be made to work.  Perhaps it
      should.  I'm not the right guy to figure this out.  What I can do is
      improve the error message a bit:
      
          (qemu) device_add e1000,netdev=net1
          Error: -global e1000.netdev=... conflicts with netdev=net1
      
      Cc: Jason Wang <jasowang@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200622094227.1271650-11-armbru@redhat.com>
      1bc13336
    • M
      qdev: Eliminate get_pointer(), set_pointer() · 466c2983
      Markus Armbruster 提交于
      We stopped using get_pointer() and set_pointer() for netdev in commit
      23120b13 "net: don't use set/get_pointer() in set/get_netdev()"
      (v2.3.0), and for chardev in commit becdfa00 "char: replace PROP_CHR
      with CharBackend" (v2.8.0).  With only the drive user left, they're
      not helpful anymore.  Eliminate.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200622094227.1271650-10-armbru@redhat.com>
      466c2983
    • M
      blockdev: Deprecate -drive with bogus interface type · a1b40bda
      Markus Armbruster 提交于
      Drives with interface types other than if=none are for onboard
      devices.  Unfortunately, any such drives the board doesn't pick up can
      still be used with -device, like this:
      
          $ qemu-system-x86_64 -nodefaults -display none -S -drive if=floppy,id=bogus,unit=7 -device ide-cd,drive=bogus -monitor stdio
          QEMU 5.0.50 monitor - type 'help' for more information
          (qemu) info block
          bogus: [not inserted]
      	Attached to:      /machine/peripheral-anon/device[0]
      	Removable device: not locked, tray closed
          (qemu) info qtree
          bus: main-system-bus
            type System
            [...]
      	    bus: ide.1
      	      type IDE
      	      dev: ide-cd, id ""
      --->		drive = "bogus"
      		[...]
      		unit = 0 (0x0)
            [...]
      
      This kind of abuse has always worked.  Deprecate it:
      
          qemu-system-x86_64: -drive if=floppy,id=bogus,unit=7: warning: bogus if=floppy is deprecated, use if=none
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200622094227.1271650-9-armbru@redhat.com>
      a1b40bda
    • M
      docs/qdev-device-use.txt: Update section "Default Devices" · 63d5dfbe
      Markus Armbruster 提交于
      Resynchronize the table of default device suppressions with vl.c's
      default_list[].
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200622094227.1271650-8-armbru@redhat.com>
      63d5dfbe
    • M
      fdc: Deprecate configuring floppies with -global isa-fdc · 4a27a638
      Markus Armbruster 提交于
      Deprecate
      
          -global isa-fdc.driveA=...
          -global isa-fdc.driveB=...
      
      in favour of
      
          -device floppy,unit=0,drive=...
          -device floppy,unit=1,drive=...
      
      Same for the other floppy controller devices.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Acked-by: NJohn Snow <jsnow@redhat.com>
      Message-Id: <20200622094227.1271650-7-armbru@redhat.com>
      4a27a638
    • M
      fdc: Open-code fdctrl_init_isa() · fed2c173
      Markus Armbruster 提交于
      Helper function fdctrl_init_isa() is less than helpful: one of three
      places creating "isa-fdc" devices use it.  Open-code it there, and
      drop the function.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-Id: <20200622094227.1271650-6-armbru@redhat.com>
      fed2c173
    • M
      fdc: Reject clash between -drive if=floppy and -global isa-fdc · 6172e067
      Markus Armbruster 提交于
      The floppy controller devices desugar their drive properties into
      floppy devices (since commit a92bd191 "fdc: Move qdev properties to
      FloppyDrive", v2.8.0).  This involves some bad magic in
      fdctrl_connect_drives(), and exists for backward compatibility.
      
      The functions for boards to create floppy controller devices
      fdctrl_init_isa(), fdctrl_init_sysbus(), and sun4m_fdctrl_init()
      desugar -drive if=floppy to these floppy controller drive properties.
      
      If you use both -drive if=floppy (or its -fda / -fdb sugar) and
      -global isa-fdc for the same floppy device, -global silently loses the
      conflict, and both backends involved end up with the floppy device
      frontend attached, as demonstrated by iotest 172 (see commit before
      previous).  This is wrong.
      
      Desugar -drive if=floppy straight to floppy devices instead, with
      helper fdctrl_init_drives().  The conflict now gets rejected cleanly:
      first, fdctrl_connect_drives() creates the floppy for the controller's
      property, then fdctrl_init_drives() attempts to create the floppy for
      -drive if=floppy, but fails because the unit is already in use.
      
      Output of iotest 172 changes in three ways:
      
      1. The clash gets rejected.
      
      2. In one test case, "info qtree" has the floppy devices swapped, and
         "info block" has their QOM paths swapped.  This is because the
         floppy device for -fda now gets created after the one for -global
         isa-fdc.driveB.
      
      3. The error message for -global floppy.drive=floppy0 changes.  Before
         the patch, we set isa-fdc.driveA to -fda's block backend, then
         create the floppy device for it, then move the backend from
         isa-fdc.driveA to floppy.drive.  Floppy creation fails when
         applying -global floppy.drive=floppy0, because floppy0 is still
         attached to isa-fdc.  After the patch, we create the floppy for
         -fda, then set its drive property to floppy0.  Now floppy creation
         succeeds, but setting the drive property fails, because -global
         already set it.  Yes, this is exasperatingly complicated.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200622094227.1271650-5-armbru@redhat.com>
      6172e067
    • M
      iotests/172: Cover -global floppy.drive=... · 02b83f7d
      Markus Armbruster 提交于
      Use of -global to set a default backend for non-singleton devices is a
      bad idea.  But as long as we permit it, we better test it.
      
      Test output demonstrates we screw up when -global floppy clashes with
      -fda or with -device floppy: according to "info qtree", only the
      latter backend is attached, but according to "info block", both are.
      Here's the clash with -device:
      
          Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global floppy.drive=none0 -device floppy,drive=none1,unit=0
      
                    dev: isa-fdc, id ""
                      [...]
                      driveA = ""
                      driveB = ""
                      [...]
                      bus: floppy-bus.0
                        type floppy-bus
                        dev: floppy, id ""
                          unit = 0 (0x0)
      --->                drive = "none1"
          [...]
          none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
      --->    Attached to:      /machine/peripheral-anon/device[0]
              Cache mode:       writeback
      
          none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
      --->    Attached to:      /machine/peripheral-anon/device[0]
              Removable device: not locked, tray closed
              Cache mode:       writeback
      
      /machine/peripheral-anon/device[0] is the floppy created with -device.
      
      Test output further demonstrates the "Drive 'FOO' is already in use
      because it has been automatically connected to another device" error
      message can be misleading.  With '-fda "" -global
      floppy.drive=floppy0', it's in use because -global reuses -fda's
      backend.  There is no other device involved.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200622094227.1271650-4-armbru@redhat.com>
      02b83f7d
    • M
      iotests/172: Cover empty filename and multiple use of drives · 20171739
      Markus Armbruster 提交于
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200622094227.1271650-3-armbru@redhat.com>
      20171739
    • M
      iotests/172: Include "info block" in test output · 6a1a6433
      Markus Armbruster 提交于
      The additional output demonstrates we screw up when -global isa-fdc
      clashes with -drive if=floppy or its sugared forms: according to "info
      qtree", only the latter backend is attached, but according to "info
      block", both are.  For instance:
      
          Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global isa-fdc.driveA=none0
      
      	      dev: isa-fdc, id ""
      	        [...]
      		driveA = ""
      		driveB = ""
                      [...]
                      bus: floppy-bus.0
                        type floppy-bus
                        dev: floppy, id ""
                          unit = 0 (0x0)
      --->                drive = "floppy0"
          [...]
          floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
      --->    Attached to:      /machine/unattached/device[15]
              Removable device: not locked, tray closed
              Cache mode:       writeback
      
          none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
      --->    Attached to:      /machine/unattached/device[14]
              Cache mode:       writeback
      
      /machine/unattached/device[15] is floppy, and
      /machine/unattached/device[14] is isa-fdc.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200622094227.1271650-2-armbru@redhat.com>
      6a1a6433