1. 19 1月, 2018 1 次提交
  2. 16 11月, 2017 1 次提交
    • D
      NUMA: Enable adding NUMA node implicitly · 7b8be49d
      Dou Liyang 提交于
      Linux and Windows need ACPI SRAT table to make memory hotplug work properly,
      however currently QEMU doesn't create SRAT table if numa options aren't present
      on CLI.
      
      Which breaks both linux and windows guests in certain conditions:
       * Windows: won't enable memory hotplug without SRAT table at all
       * Linux: if QEMU is started with initial memory all below 4Gb and no SRAT table
         present, guest kernel will use nommu DMA ops, which breaks 32bit hw drivers
         when memory is hotplugged and guest tries to use it with that drivers.
      
      Fix above issues by automatically creating a numa node when QEMU is started with
      memory hotplug enabled but without '-numa' options on CLI.
      (PS: auto-create numa node only for new machine types so not to break migration).
      
      Which would provide SRAT table to guests without explicit -numa options on CLI
      and would allow:
       * Windows: to enable memory hotplug
       * Linux: switch to SWIOTLB DMA ops, to bounce DMA transfers to 32bit allocated
         buffers that legacy drivers/hw can handle.
      
      [Rewritten by Igor]
      Reported-by: NThadeu Lima de Souza Cascardo <cascardo@canonical.com>
      Suggested-by: NIgor Mammedov <imammedo@redhat.com>
      Signed-off-by: NDou Liyang <douly.fnst@cn.fujitsu.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Marcel Apfelbaum <marcel@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Thomas Huth <thuth@redhat.com>
      Cc: Alistair Francis <alistair23@gmail.com>
      Cc: Takao Indoh <indou.takao@jp.fujitsu.com>
      Cc: Izumi Taku <izumi.taku@jp.fujitsu.com>
      Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      7b8be49d
  3. 13 11月, 2017 1 次提交
  4. 10 10月, 2017 1 次提交
  5. 20 9月, 2017 1 次提交
    • I
      numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed · 79e07936
      Igor Mammedov 提交于
      Calculating default node-ids for CPUs in possible_cpu_arch_ids()
      is rather fragile since defaults calculation uses nb_numa_nodes but
      callback might be potentially called early before all -numa CLI
      options are parsed, which would lead to cpus assigned only upto
      nb_numa_nodes at the time possible_cpu_arch_ids() is called.
      
      Issue was introduced by
      (7c88e65d numa: mirror cpu to node mapping in MachineState::possible_cpus)
      and for example CLI:
        -smp 4 -numa node,cpus=0 -numa node
      would set props.node-id in possible_cpus array for every non
      explicitly mapped CPU to the first node.
      
      Issue is not visible to guest nor to mgmt interface due to
        1) implictly mapped cpus are forced to the first node in
           case of partial mapping
        2) in case of default mapping possible_cpu_arch_ids() is
           called after all -numa options are parsed (resulting
           in correct mapping).
      
      However it's fragile to rely on late execution of
      possible_cpu_arch_ids(), therefore add machine specific
      callback that returns node-id for CPU and use it to calculate/
      set defaults at machine_numa_finish_init() time when all -numa
      options are parsed.
      Reported-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1496314408-163972-1-git-send-email-imammedo@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      79e07936
  6. 19 9月, 2017 1 次提交
    • I
      vl.c: convert cpu_model to cpu type and set of global properties before machine_init() · 6063d4c0
      Igor Mammedov 提交于
      All machines that support user specified cpu_model either call
      cpu_generic_init() or cpu_class_by_name()/CPUClass::parse_features
      to parse feature string and to get CPU type to create.
      
      Which leads to code duplication and hard-codding default CPU model
      within machine_foo_init() code. Which makes it impossible to
      get CPU type before machine_init() is run.
      
      So instead of setting default CPUs models and doing parsing in
      target specific machine_foo_init() in various ways, provide
      a generic data driven cpu_model parsing before machine_init()
      is called.
      
      in follow up per target patches, it will allow to:
        * define default CPU type in consistent/generic manner
          per machine type and drop custom code that fallbacks
          to default if cpu_model is NULL
        * drop custom features parsing in targets and do it
          in centralized way.
        * for cases of
            cpu_generic_init(TYPE_BASE/DEFAULT_CPU, "some_cpu")
          replace it with
            cpu_create(machine->cpu_type) || cpu_create(TYPE_FOO)
          depending if CPU type is user settable or not.
          not doing useless parsing and clearly documenting where
          CPU model is user settable or fixed one.
      
      Patch allows machine subclasses to define default CPU type
      per machine class at class_init() time and if that is set
      generic code will parse cpu_model into a MachineState::cpu_type
      which will be used to create CPUs for that machine instance
      and allows gradual per board conversion.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1505318697-77161-4-git-send-email-imammedo@redhat.com>
      Acked-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      6063d4c0
  7. 07 9月, 2017 1 次提交
    • P
      boards.h: Define new flag ignore_memory_transaction_failures · ed860129
      Peter Maydell 提交于
      Define a new MachineClass field ignore_memory_transaction_failures.
      If this is flag is true then the CPU will ignore memory transaction
      failures which should cause the CPU to take an exception due to an
      access to an unassigned physical address; the transaction will
      instead return zero (for a read) or be ignored (for a write).  This
      should be set only by legacy board models which rely on the old
      RAZ/WI behaviour for handling devices that QEMU does not yet model.
      New board models should instead use "unimplemented-device" for all
      memory ranges where the guest will attempt to probe for a device that
      QEMU doesn't implement and a stub device is required.
      
      We need this for ARM boards, where we're about to implement support for
      generating external aborts on memory transaction failures. Too many
      of our legacy board models rely on the RAZ/WI behaviour and we
      would break currently working guests when their "probe for device"
      code provoked an external abort rather than a RAZ.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
      Reviewed-by: NAlistair Francis <alistair.francis@xilinx.com>
      Message-id: 1504626814-23124-2-git-send-email-peter.maydell@linaro.org
      ed860129
  8. 15 7月, 2017 2 次提交
  9. 12 5月, 2017 4 次提交
    • I
      machine: call machine init from wrapper · 482dfe9a
      Igor Mammedov 提交于
      add machine_run_board_init() wrapper that calls machine
      init for now but in follow up patches it will be used
      to run generic machine code that should run before
      machine init.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NAndrew Jones <drjones@redhat.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <1494415802-227633-15-git-send-email-imammedo@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      482dfe9a
    • I
      numa: mirror cpu to node mapping in MachineState::possible_cpus · 7c88e65d
      Igor Mammedov 提交于
      Introduce machine_set_cpu_numa_node() helper that stores
      node mapping for CPU in MachineState::possible_cpus.
      CPU and node it belongs to is specified by 'props' argument.
      
      Patch doesn't remove old way of storing mapping in
      numa_info[X].node_cpu as removing it at the same time
      makes patch rather big. Instead it just mirrors mapping
      in possible_cpus and follow up per target patches will
      switch to possible_cpus and numa_info[X].node_cpu will
      be removed once there isn't any users left.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NAndrew Jones <drjones@redhat.com>
      Message-Id: <1494415802-227633-7-git-send-email-imammedo@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      7c88e65d
    • I
      numa: move source of default CPUs to NUMA node mapping into boards · ea089eeb
      Igor Mammedov 提交于
      Originally CPU threads were by default assigned in
      round-robin fashion. However it was causing issues in
      guest since CPU threads from the same socket/core could
      be placed on different NUMA nodes.
      Commit fb43b73b (pc: fix default VCPU to NUMA node mapping)
      fixed it by grouping threads within a socket on the same node
      introducing cpu_index_to_socket_id() callback and commit
      20bb648d (spapr: Fix default NUMA node allocation for threads)
      reused callback to fix similar issues for SPAPR machine
      even though socket doesn't make much sense there.
      
      As result QEMU ended up having 3 default distribution rules
      used by 3 targets /virt-arm, spapr, pc/.
      
      In effort of moving NUMA mapping for CPUs into possible_cpus,
      generalize default mapping in numa.c by making boards decide
      on default mapping and let them explicitly tell generic
      numa code to which node a CPU thread belongs to by replacing
      cpu_index_to_socket_id() with @cpu_index_to_instance_props()
      which provides default node_id assigned by board to specified
      cpu_index.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <1494415802-227633-2-git-send-email-imammedo@redhat.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      ea089eeb
    • L
      numa: equally distribute memory on nodes · 3bfe5716
      Laurent Vivier 提交于
      When there are more nodes than available memory to put the minimum
      allowed memory by node, all the memory is put on the last node.
      
      This is because we put (ram_size / nb_numa_nodes) &
      ~((1 << mc->numa_mem_align_shift) - 1); on each node, and in this
      case the value is 0. This is particularly true with pseries,
      as the memory must be aligned to 256MB.
      
      To avoid this problem, this patch uses an error diffusion algorithm [1]
      to distribute equally the memory on nodes.
      
      We introduce numa_auto_assign_ram() function in MachineClass
      to keep compatibility between machine type versions.
      The legacy function is used with pseries-2.9, pc-q35-2.9 and
      pc-i440fx-2.9 (and previous), the new one with all others.
      
      Example:
      
      qemu-system-ppc64 -S -nographic  -nodefaults -monitor stdio -m 1G -smp 8 \
                        -numa node -numa node -numa node \
                        -numa node -numa node -numa node
      
      Before:
      
      (qemu) info numa
      6 nodes
      node 0 cpus: 0 6
      node 0 size: 0 MB
      node 1 cpus: 1 7
      node 1 size: 0 MB
      node 2 cpus: 2
      node 2 size: 0 MB
      node 3 cpus: 3
      node 3 size: 0 MB
      node 4 cpus: 4
      node 4 size: 0 MB
      node 5 cpus: 5
      node 5 size: 1024 MB
      
      After:
      (qemu) info numa
      6 nodes
      node 0 cpus: 0 6
      node 0 size: 0 MB
      node 1 cpus: 1 7
      node 1 size: 256 MB
      node 2 cpus: 2
      node 2 size: 0 MB
      node 3 cpus: 3
      node 3 size: 256 MB
      node 4 cpus: 4
      node 4 size: 256 MB
      node 5 cpus: 5
      node 5 size: 256 MB
      
      [1] https://en.wikipedia.org/wiki/Error_diffusionSigned-off-by: NLaurent Vivier <lvivier@redhat.com>
      Message-Id: <20170502162955.1610-2-lvivier@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      [ehabkost: s/ram_size/size/ at numa_default_auto_assign_ram()]
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      3bfe5716
  10. 22 3月, 2017 1 次提交
    • L
      numa,spapr: align default numa node memory size to 256MB · 55641213
      Laurent Vivier 提交于
      Since commit 224245bf ("spapr: Add LMB DR connectors"), NUMA node
      memory size must be aligned to 256MB (SPAPR_MEMORY_BLOCK_SIZE).
      
      But when "-numa" option is provided without "mem" parameter,
      the memory is equally divided between nodes, but 8MB aligned.
      This can be not valid for pseries.
      
      In that case we can have:
      $ ./ppc64-softmmu/qemu-system-ppc64 -m 4G -numa node -numa node -numa node
      qemu-system-ppc64: Node 0 memory size 0x55000000 is not aligned to 256 MiB
      
      With this patch, we have:
      (qemu) info numa
      3 nodes
      node 0 cpus: 0
      node 0 size: 1280 MB
      node 1 cpus:
      node 1 size: 1280 MB
      node 2 cpus:
      node 2 size: 1536 MB
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      55641213
  11. 22 2月, 2017 5 次提交
  12. 24 1月, 2017 1 次提交
  13. 24 10月, 2016 1 次提交
    • P
      cpu: Support a target CPU having a variable page size · 20bccb82
      Peter Maydell 提交于
      Support target CPUs having a page size which isn't knownn
      at compile time. To use this, the CPU implementation should:
       * define TARGET_PAGE_BITS_VARY
       * not define TARGET_PAGE_BITS
       * define TARGET_PAGE_BITS_MIN to the smallest value it
         might possibly want for TARGET_PAGE_BITS
       * call set_preferred_target_page_bits() in its realize
         function to indicate the actual preferred target page
         size for the CPU (and report any error from it)
      
      In CONFIG_USER_ONLY, the CPU implementation should continue
      to define TARGET_PAGE_BITS appropriately for the guest
      OS page size.
      
      Machines which want to take advantage of having the page
      size something larger than TARGET_PAGE_BITS_MIN must
      set the MachineClass minimum_page_bits field to a value
      which they guarantee will be no greater than the preferred
      page size for any CPU they create.
      
      Note that changing the target page size by setting
      minimum_page_bits is a migration compatibility break
      for that machine.
      
      For debugging purposes, attempts to use TARGET_PAGE_SIZE
      before it has been finally confirmed will assert.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      20bccb82
  14. 08 9月, 2016 1 次提交
  15. 08 7月, 2016 1 次提交
  16. 17 6月, 2016 1 次提交
    • I
      QMP: Add query-hotpluggable-cpus · d4633541
      Igor Mammedov 提交于
      It will allow mgmt to query present and hotpluggable CPU objects,
      it is required from a target platform that wishes to support command
      to implement and set MachineClass.query_hotpluggable_cpus callback,
      which will return a list of possible CPU objects with options that
      would be needed for hotplugging possible CPU objects.
      
      There are:
      'type': 'str' - QOM CPU object type for usage with device_add
      'vcpus-count': 'int' - number of logical VCPU threads per
                              CPU object (mgmt needs to know)
      
      and a set of optional fields that are to used for hotplugging a CPU
      objects and would allows mgmt tools to know what/where it could be
      hotplugged;
      [node],[socket],[core],[thread]
      
      For present CPUs there is a 'qom-path' field which would allow mgmt to
      inspect whatever object/abstraction the target platform considers
      as CPU object.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      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>
      d4633541
  17. 21 5月, 2016 2 次提交
  18. 08 4月, 2016 1 次提交
    • G
      Sort the fw_cfg file list · bab47d9a
      Gerd Hoffmann 提交于
      Entries are inserted in filename order instead of being
      appended to the end in case sorting is enabled.
      
      This will avoid any future issues of moving the file creation
      around, it doesn't matter what order they are created now,
      the will always be in filename order.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      
      Added machine type handling for compatibility.  This was
      a fairly complex change, this will preserve the order of fw_cfg
      for older versions no matter what order the firmware files
      actually come in.  A list is kept of the correct legacy order
      and the entries will be inserted based upon their order in
      the list.  Except that some entries are ordered (in a specific
      area of the list) based upon what order they appear on the
      command line.  Special handling is added for those entries.
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      bab47d9a
  19. 23 3月, 2016 1 次提交
  20. 17 3月, 2016 1 次提交
    • E
      machine: Use type_init() to register machine classes · 0e6aac87
      Eduardo Habkost 提交于
      Change all machine_init() users that simply call type_register*()
      to use type_init().
      
      Cc: Evgeny Voevodin <e.voevodin@samsung.com>
      Cc: Maksim Kozlov <m.kozlov@samsung.com>
      Cc: Igor Mitsyanko <i.mitsyanko@gmail.com>
      Cc: Dmitry Solodkiy <d.solodkiy@samsung.com>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Andrzej Zaborowski <balrogg@gmail.com>
      Cc: Michael Walle <michael@walle.cc>
      Cc: "Hervé Poussineau" <hpoussin@reactos.org>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Cc: Leon Alrae <leon.alrae@imgtec.com>
      Cc: Alexander Graf <agraf@suse.de>
      Cc: David Gibson <david@gibson.dropbear.id.au>
      Cc: Blue Swirl <blauwirbel@gmail.com>
      Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Acked-by: NMarcel Apfelbaum <marcel@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Acked-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      0e6aac87
  21. 11 3月, 2016 1 次提交
    • I
      machine: introduce MachineClass.possible_cpu_arch_ids() hook · 3811ef14
      Igor Mammedov 提交于
      on x86 currently range 0..max_cpus is used to generate
      architecture-dependent CPU ID (APIC Id) for each present
      and possible CPUs. However architecture-dependent CPU IDs
      list could be sparse and code that needs to enumerate
      all IDs (ACPI) ended up doing guess work enumerating all
      possible and impossible IDs up to
        apic_id_limit = x86_cpu_apic_id_from_index(max_cpus).
      
      That leads to creation of MADT entries and Processor
      objects in ACPI tables for not possible CPUs.
      Fix it by allowing board specify a concrete list of
      CPU IDs accourding its own rules (which for x86 depends
      on topology). So that code that needs this list could
      request it from board instead of trying to guess
      what IDs are correct on its own.
      
      This interface will also allow to help making AML
      part of CPU hotplug target independent so it could
      be reused for ARM target.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NMarcel Apfelbaum <marcel@redhat.com>
      3811ef14
  22. 28 2月, 2016 1 次提交
  23. 25 2月, 2016 1 次提交
  24. 11 1月, 2016 1 次提交
  25. 22 12月, 2015 1 次提交
  26. 18 12月, 2015 1 次提交
  27. 25 11月, 2015 1 次提交
  28. 17 11月, 2015 1 次提交
  29. 19 9月, 2015 3 次提交