1. 17 9月, 2020 1 次提交
  2. 19 8月, 2020 1 次提交
  3. 10 7月, 2020 1 次提交
    • M
      qom: Put name parameter before value / visitor parameter · 5325cc34
      Markus Armbruster 提交于
      The object_property_set_FOO() setters take property name and value in
      an unusual order:
      
          void object_property_set_FOO(Object *obj, FOO_TYPE value,
                                       const char *name, Error **errp)
      
      Having to pass value before name feels grating.  Swap them.
      
      Same for object_property_set(), object_property_get(), and
      object_property_parse().
      
      Convert callers with this Coccinelle script:
      
          @@
          identifier fun = {
              object_property_get, object_property_parse, object_property_set_str,
              object_property_set_link, object_property_set_bool,
              object_property_set_int, object_property_set_uint, object_property_set,
              object_property_set_qobject
          };
          expression obj, v, name, errp;
          @@
          -    fun(obj, v, name, errp)
          +    fun(obj, name, v, errp)
      
      Chokes on hw/arm/musicpal.c's lcd_refresh() with the unhelpful error
      message "no position information".  Convert that one manually.
      
      Fails to convert hw/arm/armsse.c, because Coccinelle gets confused by
      ARMSSE being used both as typedef and function-like macro there.
      Convert manually.
      
      Fails to convert hw/rx/rx-gdbsim.c, because Coccinelle gets confused
      by RXCPU being used both as typedef and function-like macro there.
      Convert manually.  The other files using RXCPU that way don't need
      conversion.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20200707160613.848843-27-armbru@redhat.com>
      [Straightforwad conflict with commit 2336172d "audio: set default
      value for pcspk.iobase property" resolved]
      5325cc34
  4. 06 7月, 2020 3 次提交
  5. 03 7月, 2020 1 次提交
    • D
      numa: Auto-enable NUMA when any memory devices are possible · 195784a0
      David Hildenbrand 提交于
      Let's auto-enable it also when maxmem is specified but no slots are
      defined. This will result in us properly creating ACPI srat tables,
      indicating the maximum possible PFN to the guest OS. Based on this, e.g.,
      Linux will enable the swiotlb properly.
      
      This avoids having to manually force the switolb on (swiotlb=force) in
      Linux in case we're booting only using DMA memory (e.g., 2GB on x86-64),
      and virtio-mem adds memory later on that really needs the swiotlb to be
      used for DMA.
      
      Let's take care of backwards compatibility if somebody has a setup that
      specifies "maxram" without "slots".
      Reported-by: NAlex Shi <alex.shi@linux.alibaba.com>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Cc: Sergio Lopez <slp@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: qemu-arm@nongnu.org <qemu-arm@nongnu.org>
      Signed-off-by: NDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200626072248.78761-22-david@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      195784a0
  6. 26 6月, 2020 1 次提交
  7. 17 6月, 2020 1 次提交
  8. 16 6月, 2020 3 次提交
    • M
      sysbus: Convert to sysbus_realize() etc. with Coccinelle · 3c6ef471
      Markus Armbruster 提交于
      Convert from qdev_realize(), qdev_realize_and_unref() with null @bus
      argument to sysbus_realize(), sysbus_realize_and_unref().
      
      Coccinelle script:
      
          @@
          expression dev, errp;
          @@
          -    qdev_realize(DEVICE(dev), NULL, errp);
          +    sysbus_realize(SYS_BUS_DEVICE(dev), errp);
      
          @@
          expression sysbus_dev, dev, errp;
          @@
          +    sysbus_dev = SYS_BUS_DEVICE(dev);
          -    qdev_realize_and_unref(dev, NULL, errp);
          +    sysbus_realize_and_unref(sysbus_dev, errp);
          -    sysbus_dev = SYS_BUS_DEVICE(dev);
      
          @@
          expression sysbus_dev, dev, errp;
          expression expr;
          @@
               sysbus_dev = SYS_BUS_DEVICE(dev);
               ... when != dev = expr;
          -    qdev_realize_and_unref(dev, NULL, errp);
          +    sysbus_realize_and_unref(sysbus_dev, errp);
      
          @@
          expression dev, errp;
          @@
          -    qdev_realize_and_unref(DEVICE(dev), NULL, errp);
          +    sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), errp);
      
          @@
          expression dev, errp;
          @@
          -    qdev_realize_and_unref(dev, NULL, errp);
          +    sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), errp);
      
      Whitespace changes minimized manually.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Acked-by: NAlistair Francis <alistair.francis@wdc.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20200610053247.1583243-46-armbru@redhat.com>
      [Conflicts in hw/misc/empty_slot.c and hw/sparc/leon3.c resolved]
      3c6ef471
    • M
      pci: Convert uses of pci_create() etc. with Coccinelle · 9307d06d
      Markus Armbruster 提交于
      Replace
      
          dev = pci_create(bus, type_name);
          ...
          qdev_init_nofail(dev);
      
      by
      
          dev = pci_new(type_name);
          ...
          pci_realize_and_unref(dev, bus, &error_fatal);
      
      and similarly for pci_create_multifunction().
      
      Recent commit "qdev: New qdev_new(), qdev_realize(), etc." explains
      why.
      
      Coccinelle script:
      
          @@
          expression dev, bus, expr;
          expression list args;
          @@
          -    dev = pci_create(bus, args);
          +    dev = pci_new(args);
               ... when != dev = expr
          -    qdev_init_nofail(&dev->qdev);
          +    pci_realize_and_unref(dev, bus, &error_fatal);
      
          @@
          expression dev, bus, expr;
          expression list args;
          expression d;
          @@
          -    dev = pci_create(bus, args);
          +    dev = pci_new(args);
          (
               d = &dev->qdev;
          |
               d = DEVICE(dev);
          )
               ... when != dev = expr
          -    qdev_init_nofail(d);
          +    pci_realize_and_unref(dev, bus, &error_fatal);
      
          @@
          expression dev, bus, expr;
          expression list args;
          @@
          -    dev = pci_create(bus, args);
          +    dev = pci_new(args);
               ... when != dev = expr
          -    qdev_init_nofail(DEVICE(dev));
          +    pci_realize_and_unref(dev, bus, &error_fatal);
      
          @@
          expression dev, bus, expr;
          expression list args;
          @@
          -    dev = DEVICE(pci_create(bus, args));
          +    PCIDevice *pci_dev; // TODO move
          +    pci_dev = pci_new(args);
          +    dev = DEVICE(pci_dev);
               ... when != dev = expr
          -    qdev_init_nofail(dev);
          +    pci_realize_and_unref(pci_dev, bus, &error_fatal);
      
          @@
          expression dev, bus, expr;
          expression list args;
          @@
          -    dev = pci_create_multifunction(bus, args);
          +    dev = pci_new_multifunction(args);
               ... when != dev = expr
          -    qdev_init_nofail(&dev->qdev);
          +    pci_realize_and_unref(dev, bus, &error_fatal);
      
          @@
          expression bus, expr;
          expression list args;
          identifier dev;
          @@
          -    PCIDevice *dev = pci_create_multifunction(bus, args);
          +    PCIDevice *dev = pci_new_multifunction(args);
               ... when != dev = expr
          -    qdev_init_nofail(&dev->qdev);
          +    pci_realize_and_unref(dev, bus, &error_fatal);
      
          @@
          expression dev, bus, expr;
          expression list args;
          @@
          -    dev = pci_create_multifunction(bus, args);
          +    dev = pci_new_multifunction(args);
               ... when != dev = expr
          -    qdev_init_nofail(DEVICE(dev));
          +    pci_realize_and_unref(dev, bus, &error_fatal);
      
      Missing #include "qapi/error.h" added manually, whitespace changes
      minimized manually, @pci_dev declarations moved manually.
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20200610053247.1583243-16-armbru@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      9307d06d
    • M
      qdev: Convert uses of qdev_create() with Coccinelle · 3e80f690
      Markus Armbruster 提交于
      This is the transformation explained in the commit before previous.
      Takes care of just one pattern that needs conversion.  More to come in
      this series.
      
      Coccinelle script:
      
          @ depends on !(file in "hw/arm/highbank.c")@
          expression bus, type_name, dev, expr;
          @@
          -    dev = qdev_create(bus, type_name);
          +    dev = qdev_new(type_name);
               ... when != dev = expr
          -    qdev_init_nofail(dev);
          +    qdev_realize_and_unref(dev, bus, &error_fatal);
      
          @@
          expression bus, type_name, dev, expr;
          identifier DOWN;
          @@
          -    dev = DOWN(qdev_create(bus, type_name));
          +    dev = DOWN(qdev_new(type_name));
               ... when != dev = expr
          -    qdev_init_nofail(DEVICE(dev));
          +    qdev_realize_and_unref(DEVICE(dev), bus, &error_fatal);
      
          @@
          expression bus, type_name, expr;
          identifier dev;
          @@
          -    DeviceState *dev = qdev_create(bus, type_name);
          +    DeviceState *dev = qdev_new(type_name);
               ... when != dev = expr
          -    qdev_init_nofail(dev);
          +    qdev_realize_and_unref(dev, bus, &error_fatal);
      
          @@
          expression bus, type_name, dev, expr, errp;
          symbol true;
          @@
          -    dev = qdev_create(bus, type_name);
          +    dev = qdev_new(type_name);
               ... when != dev = expr
          -    object_property_set_bool(OBJECT(dev), true, "realized", errp);
          +    qdev_realize_and_unref(dev, bus, errp);
      
          @@
          expression bus, type_name, expr, errp;
          identifier dev;
          symbol true;
          @@
          -    DeviceState *dev = qdev_create(bus, type_name);
          +    DeviceState *dev = qdev_new(type_name);
               ... when != dev = expr
          -    object_property_set_bool(OBJECT(dev), true, "realized", errp);
          +    qdev_realize_and_unref(dev, bus, errp);
      
      The first rule exempts hw/arm/highbank.c, because it matches along two
      control flow paths there, with different @type_name.  Covered by the
      next commit's manual conversions.
      
      Missing #include "qapi/error.h" added manually.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20200610053247.1583243-10-armbru@redhat.com>
      [Conflicts in hw/misc/empty_slot.c and hw/sparc/leon3.c resolved]
      3e80f690
  9. 11 6月, 2020 2 次提交
  10. 15 5月, 2020 1 次提交
    • M
      qom: Drop parameter @errp of object_property_add() & friends · d2623129
      Markus Armbruster 提交于
      The only way object_property_add() can fail is when a property with
      the same name already exists.  Since our property names are all
      hardcoded, failure is a programming error, and the appropriate way to
      handle it is passing &error_abort.
      
      Same for its variants, except for object_property_add_child(), which
      additionally fails when the child already has a parent.  Parentage is
      also under program control, so this is a programming error, too.
      
      We have a bit over 500 callers.  Almost half of them pass
      &error_abort, slightly fewer ignore errors, one test case handles
      errors, and the remaining few callers pass them to their own callers.
      
      The previous few commits demonstrated once again that ignoring
      programming errors is a bad idea.
      
      Of the few ones that pass on errors, several violate the Error API.
      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.  ich9_pm_add_properties(), sparc32_ledma_realize(),
      sparc32_dma_realize(), xilinx_axidma_realize(), xilinx_enet_realize()
      are wrong that way.
      
      When the one appropriate choice of argument is &error_abort, letting
      users pick the argument is a bad idea.
      
      Drop parameter @errp and assert the preconditions instead.
      
      There's one exception to "duplicate property name is a programming
      error": the way object_property_add() implements the magic (and
      undocumented) "automatic arrayification".  Don't drop @errp there.
      Instead, rename object_property_add() to object_property_try_add(),
      and add the obvious wrapper object_property_add().
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20200505152926.18877-15-armbru@redhat.com>
      [Two semantic rebase conflicts resolved]
      d2623129
  11. 06 5月, 2020 1 次提交
  12. 04 5月, 2020 1 次提交
  13. 09 3月, 2020 1 次提交
    • P
      hw/i386: Include "hw/mem/nvdimm.h" · 4b997690
      Philippe Mathieu-Daudé 提交于
      All this files use methods/definitions declared in the NVDIMM
      device header. Include it.
      
      This fixes (when modifying unrelated headers):
      
        hw/i386/acpi-build.c:2733:9: error: implicit declaration of function 'nvdimm_build_acpi' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
              nvdimm_build_acpi(table_offsets, tables_blob, tables->linker,
              ^
        hw/i386/pc.c:1996:61: error: use of undeclared identifier 'TYPE_NVDIMM'
          const bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
                                                                  ^
        hw/i386/pc.c:2032:55: error: use of undeclared identifier 'TYPE_NVDIMM'
          bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
                                                            ^
        hw/i386/pc.c:2040:9: error: implicit declaration of function 'nvdimm_plug' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
              nvdimm_plug(ms->nvdimms_state);
              ^
        hw/i386/pc.c:2040:9: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
              nvdimm_plug(ms->nvdimms_state);
              ^
        hw/i386/pc.c:2065:42: error: use of undeclared identifier 'TYPE_NVDIMM'
          if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) {
                                               ^
        hw/i386/pc_i440fx.c:307:9: error: implicit declaration of function 'nvdimm_init_acpi_state' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
              nvdimm_init_acpi_state(machine->nvdimms_state, system_io,
              ^
        hw/i386/pc_q35.c:332:9: error: implicit declaration of function 'nvdimm_init_acpi_state' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
              nvdimm_init_acpi_state(machine->nvdimms_state, system_io,
              ^
      Acked-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
      Message-Id: <20200228114649.12818-17-philmd@redhat.com>
      Signed-off-by: NLaurent Vivier <laurent@vivier.eu>
      4b997690
  14. 07 1月, 2020 1 次提交
  15. 05 1月, 2020 1 次提交
  16. 18 12月, 2019 1 次提交
  17. 14 12月, 2019 1 次提交
  18. 13 12月, 2019 1 次提交
    • E
      virtio-blk: advertise F_WCE (F_FLUSH) if F_CONFIG_WCE is advertised · 5f258577
      Evgeny Yakovlev 提交于
      Virtio spec 1.1 (and earlier), 5.2.5.2 Driver Requirements: Device
      Initialization:
      
      "Devices SHOULD always offer VIRTIO_BLK_F_FLUSH, and MUST offer it if
      they offer VIRTIO_BLK_F_CONFIG_WCE"
      
      Currently F_CONFIG_WCE and F_WCE are not connected to each other.
      Qemu will advertise F_CONFIG_WCE if config-wce argument is
      set for virtio-blk device. And F_WCE is advertised only if
      underlying block backend actually has it's caching enabled.
      
      Fix this by advertising F_WCE if F_CONFIG_WCE is also advertised.
      
      To preserve backwards compatibility with newer machine types make this
      behaviour governed by "x-enable-wce-if-config-wce" virtio-blk-device
      property and introduce hw_compat_4_2 with new property being off by
      default for all machine types <= 4.2 (but don't introduce 4.3
      machine type itself yet).
      Signed-off-by: NEvgeny Yakovlev <wrfsh@yandex-team.ru>
      Message-Id: <1572978137-189218-1-git-send-email-wrfsh@yandex-team.ru>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      5f258577
  19. 19 11月, 2019 1 次提交
    • L
      hw/i386: Move save_tsc_khz from PCMachineClass to X86MachineClass · 2f34ebf2
      Liam Merwick 提交于
      Attempting to migrate a VM using the microvm machine class results in the source
      QEMU aborting with the following message/backtrace:
      
      target/i386/machine.c:955:tsc_khz_needed: Object 0x555556608fa0 is not an
      instance of type generic-pc-machine
      
      abort()
      object_class_dynamic_cast_assert()
      vmstate_save_state_v()
      vmstate_save_state()
      vmstate_save()
      qemu_savevm_state_complete_precopy()
      migration_thread()
      migration_thread()
      migration_thread()
      qemu_thread_start()
      start_thread()
      clone()
      
      The access to the machine class returned by MACHINE_GET_CLASS() in
      tsc_khz_needed() is crashing as it is trying to dereference a different
      type of machine class object (TYPE_PC_MACHINE) to that of this microVM.
      
      This can be resolved by extending the changes in the following commit
      f0bb276b ("hw/i386: split PCMachineState deriving X86MachineState from it")
      and moving the save_tsc_khz field in PCMachineClass to X86MachineClass.
      
      Fixes: f0bb276b ("hw/i386: split PCMachineState deriving X86MachineState from it")
      Signed-off-by: NLiam Merwick <liam.merwick@oracle.com>
      Reviewed-by: NDarren Kenny <darren.kenny@oracle.com>
      Message-Id: <1574075605-25215-1-git-send-email-liam.merwick@oracle.com>
      Reviewed-by: NSergio Lopez <slp@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2f34ebf2
  20. 26 10月, 2019 1 次提交
  21. 25 10月, 2019 1 次提交
  22. 24 10月, 2019 4 次提交
  23. 22 10月, 2019 4 次提交
  24. 21 9月, 2019 1 次提交
    • C
      pc: Add an SMB0 ACPI device to q35 · ebe15582
      Corey Minyard 提交于
      This is so I2C devices can be found in the ACPI namespace.  Currently
      that's only IPMI, but devices can be easily added now.
      
      Adding the devices required some PCI information, and the bus itself
      to be added to the PCMachineState structure.
      
      Note that this only works on Q35, the ACPI for PIIX4 is not capable
      of handling an SMBus device.
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      ebe15582
  25. 21 8月, 2019 1 次提交
  26. 16 8月, 2019 3 次提交
  27. 06 7月, 2019 1 次提交
    • E
      i386: Make unversioned CPU models be aliases · 0788a56b
      Eduardo Habkost 提交于
      This will make unversioned CPU models behavior depend on the
      machine type:
      
      * "pc-*-4.0" and older will not report them as aliases.
        This is done to keep compatibility with older QEMU versions
        after management software starts translating aliases.
      
      * "pc-*-4.1" will translate unversioned CPU models to -v1.
        This is done to keep compatibility with existing management
        software, that still relies on CPU model runnability promises.
      
      * "none" will translate unversioned CPU models to their latest
        version.  This is planned become the default in future machine
        types (probably in pc-*-4.3).
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <20190628002844.24894-8-ehabkost@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      0788a56b