Skip to content
Snippets Groups Projects
  1. Mar 19, 2020
  2. Mar 18, 2020
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20200317' into staging · 0a4833b3
      Peter Maydell authored
      
      Fix tcg/i386 bug vs sari_vec.
      Fix tcg-runtime-gvec.c vs i386 without avx.
      
      # gpg: Signature made Tue 17 Mar 2020 18:58:14 GMT
      # gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
      # gpg:                issuer "richard.henderson@linaro.org"
      # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full]
      # Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F
      
      * remotes/rth/tags/pull-tcg-20200317:
        tcg: Remove tcg-runtime-gvec.c DO_CMP0
        tcg: Tidy tcg-runtime-gvec.c DUP*
        tcg: Tidy tcg-runtime-gvec.c types
        tcg: Remove CONFIG_VECTOR16
        tcg/i386: Bound shift count expanding sari_vec
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      0a4833b3
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-and-gdbstub-170320-1' into staging · 92148134
      Peter Maydell authored
      
      Testing and gdbstub updates:
      
        - docker updates for VirGL
        - re-factor gdbstub for static GDBState
        - re-factor gdbstub for dynamic arrays
        - add SVE support to arm gdbstub
        - add some guest debug tests to check-tcg
        - add aarch64 userspace register tests
        - remove packet size limit to gdbstub
        - simplify gdbstub monitor code
        - report vContSupported in gdbstub to use proper single-step
      
      # gpg: Signature made Tue 17 Mar 2020 17:47:46 GMT
      # gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
      # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full]
      # Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44
      
      * remotes/stsquad/tags/pull-testing-and-gdbstub-170320-1: (28 commits)
        gdbstub: Fix single-step issue by confirming 'vContSupported+' feature to gdb
        gdbstub: do not split gdb_monitor_write payload
        gdbstub: change GDBState.last_packet to GByteArray
        tests/tcg/aarch64: add test-sve-ioctl guest-debug test
        tests/tcg/aarch64: add SVE iotcl test
        tests/tcg/aarch64: add a gdbstub testcase for SVE registers
        tests/guest-debug: add a simple test runner
        configure: allow user to specify what gdb to use
        tests/tcg/aarch64: userspace system register test
        target/arm: don't bother with id_aa64pfr0_read for USER_ONLY
        target/arm: generate xml description of our SVE registers
        target/arm: default SVE length to 64 bytes for linux-user
        target/arm: explicitly encode regnum in our XML
        target/arm: prepare for multiple dynamic XMLs
        gdbstub: extend GByteArray to read register helpers
        target/i386: use gdb_get_reg helpers
        target/m68k: use gdb_get_reg helpers
        target/arm: use gdb_get_reg helpers
        gdbstub: add helper for 128 bit registers
        gdbstub: move mem_buf to GDBState and use GByteArray
        ...
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      92148134
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2020-03-17' into staging · cf4b6440
      Peter Maydell authored
      
      Error reporting patches for 2020-03-17
      
      # gpg: Signature made Tue 17 Mar 2020 16:30:49 GMT
      # gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
      # gpg:                issuer "armbru@redhat.com"
      # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
      # gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
      # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653
      
      * remotes/armbru/tags/pull-error-2020-03-17:
        hw/sd/ssi-sd: fix error handling in ssi_sd_realize
        xen-block: Use one Error * variable instead of two
        hw/misc/ivshmem: Use one Error * variable instead of two
        Use &error_abort instead of separate assert()
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      cf4b6440
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-5.0-20200317' into staging · b319df55
      Peter Maydell authored
      
      ppc patch queue 2020-03-17
      
      Here's my final pull request for the qemu-5.0 soft freeze.  Sorry this
      is just under the wire - I hit some last minute problems that took a
      while to fix up and retest.
      
      Highlights are:
       * Numerous fixes for the FWNMI feature
       * A handful of cleanups to the device tree construction code
       * Numerous fixes for the spapr-vscsi device
       * A number of fixes and cleanups for real mode (MMU off) softmmu
         handling
       * Fixes for handling of the PAPR RMA
       * Better handling of hotplug/unplug events during boot
       * Assorted other fixes
      
      # gpg: Signature made Tue 17 Mar 2020 09:55:07 GMT
      # gpg:                using RSA key 75F46586AE61A66CC44E87DC6C38CACA20D9B392
      # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>" [full]
      # gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>" [full]
      # gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>" [full]
      # gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>" [unknown]
      # Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392
      
      * remotes/dgibson/tags/ppc-for-5.0-20200317: (45 commits)
        pseries: Update SLOF firmware image
        ppc/spapr: Ignore common "ibm,nmi-interlock" Linux bug
        ppc/spapr: Implement FWNMI System Reset delivery
        target/ppc: allow ppc_cpu_do_system_reset to take an alternate vector
        ppc/spapr: Allow FWNMI on TCG
        ppc/spapr: Fix FWNMI machine check interrupt delivery
        ppc/spapr: Add FWNMI System Reset state
        ppc/spapr: Change FWNMI names
        ppc/spapr: Fix FWNMI machine check failure handling
        spapr: Rename DT functions to newer naming convention
        spapr: Move creation of ibm,architecture-vec-5 property
        spapr: Move creation of ibm,dynamic-reconfiguration-memory dt node
        spapr/rtas: Reserve space for RTAS blob and log
        pseries: Update SLOF firmware image
        ppc/spapr: Move GPRs setup to one place
        target/ppc: Fix rlwinm on ppc64
        spapr/xive: use SPAPR_IRQ_IPI to define IPI ranges exposed to the guest
        hw/scsi/spapr_vscsi: Convert debug fprintf() to trace event
        hw/scsi/spapr_vscsi: Prevent buffer overflow
        hw/scsi/spapr_vscsi: Do not mix SRP IU size with DMA buffer size
        ...
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      b319df55
  3. Mar 17, 2020
    • Babu Moger's avatar
      hw/i386: Rename apicid_from_topo_ids to x86_apicid_from_topo_ids · 3c6712ec
      Babu Moger authored
      
      For consistency rename apicid_from_topo_ids to x86_apicid_from_topo_ids.
      No functional change.
      
      Signed-off-by: default avatarBabu Moger <babu.moger@amd.com>
      Reviewed-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Message-Id: <158396720748.58170.5335409429390890145.stgit@naples-babu.amd.com>
      3c6712ec
    • Babu Moger's avatar
      hw/i386: Update structures to save the number of nodes per package · c24a41bb
      Babu Moger authored
      
      Update structures X86CPUTopoIDs and CPUX86State to hold the number of
      nodes per package. This is required to build EPYC mode topology.
      
      Signed-off-by: default avatarBabu Moger <babu.moger@amd.com>
      Reviewed-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Message-Id: <158396720035.58170.1973738805301006456.stgit@naples-babu.amd.com>
      c24a41bb
    • Babu Moger's avatar
      hw/i386: Remove unnecessary initialization in x86_cpu_new · 156778a0
      Babu Moger authored
      
      The function pc_cpu_pre_plug takes care of initialization of CPUX86State.
      So, remove the initialization here.
      
      Suggested-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Signed-off-by: default avatarBabu Moger <babu.moger@amd.com>
      Reviewed-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Message-Id: <158396719336.58170.11951852360759449871.stgit@naples-babu.amd.com>
      156778a0
    • Babu Moger's avatar
      machine: Add SMP Sockets in CpuTopology · 8cb30e3a
      Babu Moger authored
      
      Store the  smp sockets in CpuTopology. The socket information required to
      build the apic id in EPYC mode. Right now socket information is not passed
      to down when decoding the apic id. Add the socket information here.
      
      Signed-off-by: default avatarBabu Moger <babu.moger@amd.com>
      Reviewed-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Reviewed-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Message-Id: <158396718647.58170.2278448323151215741.stgit@naples-babu.amd.com>
      8cb30e3a
    • Babu Moger's avatar
      hw/i386: Consolidate topology functions · f20dec0b
      Babu Moger authored
      
      Now that we have all the parameters in X86CPUTopoInfo, we can just
      pass the structure to calculate the offsets and width.
      
      Signed-off-by: default avatarBabu Moger <babu.moger@amd.com>
      Reviewed-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Message-Id: <158396717953.58170.5628042059144117669.stgit@naples-babu.amd.com>
      f20dec0b
    • Babu Moger's avatar
      hw/i386: Introduce X86CPUTopoInfo to contain topology info · 53a5e7bd
      Babu Moger authored
      
      This is an effort to re-arrange few data structure for better readability.
      
      1. Add X86CPUTopoInfo which will have all the topology informations
         required to build the cpu topology. There is no functional changes.
      
      2. Introduce init_topo_info to initialize X86CPUTopoInfo members from
         X86MachineState.
      
      3. Update x86 unit tests for new calling convention with parameter X86CPUTopoInfo
      
      There is no functional changes.
      
      Signed-off-by: default avatarBabu Moger <babu.moger@amd.com>
      Message-Id: <158396717251.58170.4499717831243474938.stgit@naples-babu.amd.com>
      53a5e7bd
    • Peter Maydell's avatar
      cpu: Use DeviceClass reset instead of a special CPUClass reset · 781c67ca
      Peter Maydell authored
      
      The CPUClass has a 'reset' method.  This is a legacy from when
      TYPE_CPU used not to inherit from TYPE_DEVICE.  We don't need it any
      more, as we can simply use the TYPE_DEVICE reset.  The 'cpu_reset()'
      function is kept as the API which most places use to reset a CPU; it
      is now a wrapper which calls device_cold_reset() and then the
      tracepoint function.
      
      This change should not cause CPU objects to be reset more often
      than they are at the moment, because:
       * nobody is directly calling device_cold_reset() or
         qdev_reset_all() on CPU objects
       * no CPU object is on a qbus, so they will not be reset either
         by somebody calling qbus_reset_all()/bus_cold_reset(), or
         by the main "reset sysbus and everything in the qbus tree"
         reset that most devices are reset by
      
      Note that this does not change the need for each machine or whatever
      to use qemu_register_reset() to arrange to call cpu_reset() -- that
      is necessary because CPU objects are not on any qbus, so they don't
      get reset when the qbus tree rooted at the sysbus bus is reset, and
      this isn't being changed here.
      
      All the changes to the files under target/ were made using the
      included Coccinelle script, except:
      
      (1) the deletion of the now-inaccurate and not terribly useful
      "CPUClass::reset" comments was done with a perl one-liner afterwards:
        perl -n -i -e '/ CPUClass::reset/ or print' target/*/*.c
      
      (2) this bit of the s390 change was done by hand, because the
      Coccinelle script is not sophisticated enough to handle the
      parent_reset call being inside another function:
      
      | @@ -96,8 +96,9 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type type)
      |     S390CPU *cpu = S390_CPU(s);
      |     S390CPUClass *scc = S390_CPU_GET_CLASS(cpu);
      |     CPUS390XState *env = &cpu->env;
      |+    DeviceState *dev = DEVICE(s);
      |
      |-    scc->parent_reset(s);
      |+    scc->parent_reset(dev);
      |     cpu->env.sigp_order = 0;
      |     s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu);
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Message-Id: <20200303100511.5498-1-peter.maydell@linaro.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Tested-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      781c67ca
    • Dr. David Alan Gilbert's avatar
      machine/memory encryption: Disable mem merge · 4ba59be1
      Dr. David Alan Gilbert authored
      When a host is running with memory encryption, the memory isn't visible
      to the host kernel; attempts to merge that memory are futile because
      what it's really comparing is encrypted memory, usually encrypted
      with different keys.
      
      Automatically turn mem-merge off when memory encryption is specified.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1796356
      
      
      
      Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20200130175046.85850-1-dgilbert@redhat.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      4ba59be1
    • Babu Moger's avatar
      hw/i386: Rename X86CPUTopoInfo structure to X86CPUTopoIDs · dcf08bc6
      Babu Moger authored
      
      Rename few data structures related to X86 topology.  X86CPUTopoIDs will
      have individual arch ids. Next patch introduces X86CPUTopoInfo which will
      have all topology information(like cores, threads etc..).
      
      Signed-off-by: default avatarBabu Moger <babu.moger@amd.com>
      Reviewed-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <158326541877.40452.17535023236841538507.stgit@naples-babu.amd.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      dcf08bc6
    • Moger, Babu's avatar
      i386: Add 2nd Generation AMD EPYC processors · 143c30d4
      Moger, Babu authored
      Adds the support for 2nd Gen AMD EPYC Processors. The model display
      name will be EPYC-Rome.
      
      Adds the following new feature bits on top of the feature bits from the
      first generation EPYC models.
      perfctr-core : core performance counter extensions support. Enables the VM to
                     use extended performance counter support. It enables six
                     programmable counters instead of four counters.
      clzero       : instruction zeroes out the 64 byte cache line specified in RAX.
      xsaveerptr   : XSAVE, XSAVE, FXSAVEOPT, XSAVEC, XSAVES always save error
                     pointers and FXRSTOR, XRSTOR, XRSTORS always restore error
                     pointers.
      wbnoinvd     : Write back and do not invalidate cache
      ibpb         : Indirect Branch Prediction Barrier
      amd-stibp    : Single Thread Indirect Branch Predictor
      clwb         : Cache Line Write Back and Retain
      xsaves       : XSAVES, XRSTORS and IA32_XSS support
      rdpid        : Read Processor ID instruction support
      umip         : User-Mode Instruction Prevention support
      
      The  Reference documents are available at
      https://developer.amd.com/wp-content/resources/55803_0.54-PUB.pdf
      https://www.amd.com/system/files/TechDocs/24594.pdf
      
      
      
      Depends on following kernel commits:
      40bc47b08b6e ("kvm: x86: Enumerate support for CLZERO instruction")
      504ce1954fba ("KVM: x86: Expose XSAVEERPTR to the guest")
      6d61e3c32248 ("kvm: x86: Expose RDPID in KVM_GET_SUPPORTED_CPUID")
      52297436199d ("kvm: svm: Update svm_xsaves_supported")
      
      Signed-off-by: default avatarBabu Moger <babu.moger@amd.com>
      Message-Id: <157314966312.23828.17684821666338093910.stgit@naples-babu.amd.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      143c30d4
    • Moger, Babu's avatar
      i386: Add missing cpu feature bits in EPYC model · a16e8dbc
      Moger, Babu authored
      
      Adds the following missing CPUID bits:
      perfctr-core : core performance counter extensions support. Enables the VM
                     to use extended performance counter support. It enables six
                     programmable counters instead of 4 counters.
      clzero       : instruction zeroes out the 64 byte cache line specified in RAX.
      xsaveerptr   : XSAVE, XSAVE, FXSAVEOPT, XSAVEC, XSAVES always save error
                     pointers and FXRSTOR, XRSTOR, XRSTORS always restore error
                     pointers.
      ibpb         : Indirect Branch Prediction Barrie.
      xsaves       : XSAVES, XRSTORS and IA32_XSS supported.
      
      Depends on following kernel commits:
      40bc47b08b6e ("kvm: x86: Enumerate support for CLZERO instruction")
      504ce1954fba ("KVM: x86: Expose XSAVEERPTR to the guest")
      52297436199d ("kvm: svm: Update svm_xsaves_supported")
      
      These new features will be added in EPYC-v3. The -cpu help output after the change.
      x86 EPYC-v1               AMD EPYC Processor
      x86 EPYC-v2               AMD EPYC Processor (with IBPB)
      x86 EPYC-v3               AMD EPYC Processor
      
      Signed-off-by: default avatarBabu Moger <babu.moger@amd.com>
      Message-Id: <157314965662.23828.3063243729449408327.stgit@naples-babu.amd.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      a16e8dbc
    • Tao Xu's avatar
      target/i386: Add new property note to versioned CPU models · c63938df
      Tao Xu authored
      
      Add additional information for -cpu help to indicate the changes in this
      version of CPU model.
      
      Suggested-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: default avatarTao Xu <tao3.xu@intel.com>
      Message-Id: <20200212081328.7385-4-tao3.xu@intel.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      c63938df
    • Tao Xu's avatar
      target/i386: Add Denverton-v2 (no MPX) CPU model · ab0c942c
      Tao Xu authored
      
      Because MPX is being removed from the linux kernel, remove MPX feature
      from Denverton.
      
      Signed-off-by: default avatarTao Xu <tao3.xu@intel.com>
      Message-Id: <20200212081328.7385-2-tao3.xu@intel.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      ab0c942c
    • Cleber Rosa's avatar
      tests/docker: make "buildah bud" output similar to "docker build" · a51d6a54
      Cleber Rosa authored
      
      Podman users will most often be using buildah to build containers.
      Among the differences between "buildah bud|build-using-dockerfile" and
      a traditional "docker build" is that buildah does not run a container
      during build.
      
      To the best of my knowledge and experiments, this means that runtime
      variables, such as ENV from one base image will not propagate into
      another.  The end result is that the location for the cross compiler
      binaries, defined in the base "qemu/debian9-mxe" image, are not passed
      through this image.  Consequently, the cross compilers are not on PATH
      and the build fails.
      
      Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>
      Acked-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-Id: <20200312193616.438922-3-crosa@redhat.com>
      Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>
      a51d6a54
    • Cleber Rosa's avatar
      tests/docker: add CentOS 8 Dockerfile · e631eb2e
      Cleber Rosa authored
      
      Which is currenly missing, and will be referenced later in the
      contributed CI playbooks.
      
      Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-Id: <20200312193616.438922-2-crosa@redhat.com>
      Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>
      e631eb2e
    • Cleber Rosa's avatar
      Acceptance tests: add make targets to download images · 4ec49f0f
      Cleber Rosa authored
      
      The newly introduced "boot linux" tests make use of Linux images that
      are larger than usual, and fall into what Avocado calls "vmimages",
      and can be referred to by name, version and architecture.
      
      The images can be downloaded automatically during the test. But, to
      make for more reliable test results, this introduces a target that
      will download the vmimages for the architectures that have been
      configured and are available for the currently used distro (Fedora
      31).
      
      Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>
      Reviewed-by: default avatarWillian Rampazzo <willianr@redhat.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      [Cleber: implemented suggestions by Alex, download message, check-venv target]
      Message-Id: <20200317141654.29355-4-crosa@redhat.com>
      Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>
      4ec49f0f
    • Cleber Rosa's avatar
      Acceptance test: add "boot_linux" tests · 6fd52d67
      Cleber Rosa authored
      
      This acceptance test, validates that a full blown Linux guest can
      successfully boot in QEMU.  In this specific case, the guest chosen is
      Fedora version 31.
      
       * x86_64, pc-i440fx and pc-q35 machine types, with TCG and KVM as
         accelerators
      
       * aarch64 and virt machine type, with TCG and KVM as accelerators
      
       * ppc64 and pseries machine type with TCG as accelerator
      
       * s390x and s390-ccw-virtio machine type with TCG as accelerator
      
      The Avocado vmimage utils library is used to download and cache the
      Linux guest images, and from those images a snapshot image is created
      and given to QEMU.  If a qemu-img binary is available in the build
      directory, it's used to create the snapshot image, so that matching
      qemu-system-* and qemu-img are used in the same test run.  If qemu-img
      is not available in the build tree, one is attempted to be found
      installed system-wide (in the $PATH).  If qemu-img is not found in the
      build dir or in the $PATH, the test is canceled.
      
      The method for checking the successful boot is based on "cloudinit"
      and its "phone home" feature.  The guest is given an ISO image with
      the location of the phone home server, and the information to post
      (the instance ID).  Upon receiving the correct information, from the
      guest, the test is considered to have PASSed.
      
      This test is currently limited to user mode networking only, and
      instructs the guest to connect to the "router" address that is hard
      coded in QEMU.
      
      To create the cloudinit ISO image that will be used to configure the
      guest, the pycdlib library is also required and has been added as
      requirement to the virtual environment created by "check-venv".
      
      The console output is read by a separate thread, by means of the
      Avocado datadrainer utility module.
      
      Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>
      Reviewed-by: default avatarWainer dos Santos Moschetta <wainersm@redhat.com>
      Reviewed-by: default avatarWillian Rampazzo <willianr@redhat.com>
      Tested-by: default avatarWillian Rampazzo <willianr@redhat.com>
      Message-Id: <20200317141654.29355-3-crosa@redhat.com>
      Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>
      6fd52d67
    • Cleber Rosa's avatar
      Acceptance tests: introduce BUILD_DIR and SOURCE_DIR · b44513b1
      Cleber Rosa authored
      
      Some tests may benefit from using resources from a build directory.
      This introduces three variables that can help tests find resources in
      those directories.
      
      First, a BUILD_DIR is assumed to exist, given that the primary form of
      running the acceptance tests is from a build directory (which may or
      may not be the same as the source tree, that is, the SOURCE_DIR).
      
      If the directory containing the acceptance tests happens to be a link
      to a directory, it's assumed to it points to the source tree
      (SOURCE_DIR), which is the behavior defined on the QEMU Makefiles.  If
      the directory containing the acceptance tests is not a link, then a
      in-tree build is assumed, and the BUILD_DIR and SOURCE_DIR have the
      same value.
      
      Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>
      Reviewed-by: default avatarWainer dos Santos Moschetta <wainersm@redhat.com>
      Tested-by: default avatarWainer dos Santos Moschetta <wainersm@redhat.com>
      Reviewed-by: default avatarWillian Rampazzo <willianr@redhat.com>
      Tested-by: default avatarWillian Rampazzo <willianr@redhat.com>
      Message-Id: <20200317141654.29355-2-crosa@redhat.com>
      Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>
      b44513b1
    • Oksana Vohchana's avatar
      python/qemu/qmp.py: QMP debug with VM label · 566054a0
      Oksana Vohchana authored
      
      QEMUMachine writes some messages to the default logger.
      But it sometimes hard to read the output if we have requests to
      more than one VM.
      This patch adds a label to the logger in the debug mode.
      
      Signed-off-by: default avatarOksana Vohchana <ovoshcha@redhat.com>
      Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
      Reviewed-by: default avatarWainer dos Santos Moschetta <wainersm@redhat.com>
      Reviewed-by: default avatarCleber Rosa <crosa@redhat.com>
      Message-Id: <20200316103203.10046-1-ovoshcha@redhat.com>
      Signed-off-by: default avatarCleber Rosa <crosa@redhat.com>
      566054a0
    • Eric Blake's avatar
      net: Track netdevs in NetClientState rather than QemuOpt · 08712fcb
      Eric Blake authored
      
      As mentioned in the previous patch, our use of QemuOpt group "netdev"
      has two purposes: collect the CLI arguments, and serve as a witness
      for monitor hotplug actions.  As the latter didn't use anything but an
      id, it felt rather unclean to have to touch QemuOpts at all when going
      through QMP, so let's instead track things with a bool field in
      NetClientState.
      
      Suggested-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20200317201711.322764-3-eblake@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      08712fcb
    • Eric Blake's avatar
      net: Complete qapi-fication of netdev_add · db2a380c
      Eric Blake authored
      
      We've had all the required pieces for doing a type-safe representation
      of netdev_add as a flat union for quite some time now (since
      0e55c381 in v2.7.0, released in 2016), but did not make the final
      switch to using it because of concern about whether a command-line
      regression in accepting "1" in place of 1 for integer arguments would
      be problematic.  Back then, we did not have the deprecation cycle to
      allow us to make progress.  But now that we have waited so long, other
      problems have crept in: for example, our desire to add
      qemu-storage-daemon is hampered by the inability to express net
      objects, and we are unable to introspect what we actually accept.
      Additionally, our round-trip through QemuOpts silently eats any
      argument that expands to an array, rendering dnssearch, hostfwd, and
      guestfwd useless through QMP:
      
      {"execute": "netdev_add", "arguments": { "id": "netdev0",
        "type": "user", "dnssearch": [
          { "str": "8.8.8.8" }, { "str": "8.8.4.4" }
        ]}}
      
      So without further ado, let's turn on proper QAPI.  netdev_add() was a
      trivial wrapper around net_client_init(), which did a few steps prior
      to calling net_client_init1(); with this patch, we now skip directly
      to net_client_init1().  In addition to fixing array parameters, the
      following additional differences occur:
      
      -  {"execute": "netdev_add", "arguments": {"type": "help"}}
      no longer attempts to print help to stdout and exit.  Bug fix, broken
      in 547203ea 'net: List available netdevs with "-netdev help"',
      v2.12.0.
      
      -  {"execute": "netdev_add", "arguments': {... "ipv6-net": "..." }}
      no longer attempts to desugar the undocumented ipv6-net magic string
      into the proper "ipv6-prefix" and "ipv6-prefixlen".  Undocumented
      misfeature, introduced in commit 7aac531e "qapi-schema, qemu-options
      & slirp: Adding Qemu options for IPv6 addresses", v2.6.0.
      
      -  {'execute':'netdev_add',
           'arguments':{'id':'net2', 'type':'hubport', 'hubid':"2"}}
         {"error": {"class": "GenericError", "desc": "Invalid parameter type for 'hubid', expected: integer"}}
      Used to succeed: since our command line treats everything as strings,
      our not-so-round-trip conversion from QAPI -> QemuOpts -> QAPI lost
      the original typing and turned everything into a string; now that we
      skip the QemuOpts, the JSON input has to match the exact QAPI type.
      But this stricter QMP is desirable, and introspection is sufficient
      for any affected applications to make sure they use it correctly.
      
      In qmp_netdev_add(), we still have to create a QemuOpts object so that
      qmp_netdev_del() will be able to remove a hotplugged network device;
      but the opts->head remains empty since we now manage all parsing
      through the QAPI object rather than QemuOpts; a separate patch will
      address the abuse of QemuOpts as a witness for whether a
      NetClientState is a netdev.  In the meantime, our argument that we are
      okay requires auditing all uses of option group "netdev":
      
      - qemu_netdev_opts: option group definition, empty .desc[]
      - CLI (CLI netdev parsing ends before monitors start, so while
        monitors can mess with CLI netdevs, CLI cannot mess with
        monitor netdevs):
        - main() case QEMU_OPTION_netdev: store CLI definition
        - main() case QEMU_OPTION_readconfig, case QEMU_OPTION_writeconfig:
        similar, dealing only with CLI
        - net_init_clients(): Pass CLI to net_client_init()
      - Monitor:
        - hmp_netdev_add(): straightforward parse into net_client_init()
        - qmp_netdev_add(): subject of this patch, used to add full
        object to option group, now just adds bare-bones id
        - qmp_netdev_del(), netdev_del_completion(): check the option group
        solely for id, as a 'is this a netdev' predicate
      
      Reported-by: default avatarAlex Kirillov <lekiravi@yandex-team.ru>
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20200317201711.322764-2-eblake@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      [Commit message typo fixed]
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      db2a380c
    • Marc-André Lureau's avatar
      qmp: constify QmpCommand and list · f0ccc00b
      Marc-André Lureau authored
      
      Since 0b69f6f7 "qapi: remove
      qmp_unregister_command()", the command list can be declared const.
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: default avatarDamien Hedde <damien.hedde@greensocs.com>
      Message-Id: <20200316171824.2319695-1-marcandre.lureau@redhat.com>
      [Rebased]
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      f0ccc00b
    • Markus Armbruster's avatar
      qapi: Mark deprecated QMP parts with feature 'deprecated' · df4097ae
      Markus Armbruster authored
      
      Add feature 'deprecated' to the deprecated QMP commands, so their
      deprecation becomes visible in output of query-qmp-schema.  Looks like
      this:
      
          {"name": "query-cpus",
           "ret-type": "[164]",
           "meta-type": "command",
           "arg-type": "0",
      ---> "features": ["deprecated"]}
      
      Management applications could conceivably use this for static
      checking.
      
      The deprecated commands are change, cpu-add, migrate-set-cache-size,
      migrate_set_downtime, migrate_set_speed, query-cpus, query-events,
      query-migrate-cache-size.
      
      The deprecated command arguments are block-commit arguments @base and
      @top, and block_set_io_throttle, blockdev-change-medium,
      blockdev-close-tray, blockdev-open-tray, eject argument @device.
      
      The deprecated command results are query-cpus-fast result @arch,
      query-block result @dirty-bitmaps, query-named-block-nodes result
      @encryption_key_missing and result @dirty-bitmaps's member @status.
      Same for query-block result @inserted, which mirrors
      query-named-block-nodes.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200317115459.31821-27-armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      df4097ae
    • Markus Armbruster's avatar
      qapi: New special feature flag "deprecated" · f965e8fe
      Markus Armbruster authored
      
      Unlike regular feature flags, the new special feature flag
      "deprecated" is recognized by the QAPI generator.  For now, it's only
      permitted with commands, events, and struct members.  It will be put
      to use shortly.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200317115459.31821-26-armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      [Doc typo fixed]
      f965e8fe
    • Markus Armbruster's avatar
      qapi: Replace qmp_dispatch()'s TODO comment by an explanation · 4a883738
      Markus Armbruster authored
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20200317115459.31821-25-armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      4a883738
    • Markus Armbruster's avatar
      qapi: Simplify how qmp_dispatch() gets the request ID · a62c6174
      Markus Armbruster authored
      
      We convert the request object to a QDict twice: first in
      qmp_dispatch() to get the request ID, and then again in
      qmp_dispatch_check_obj(), which converts to QDict, then checks and
      returns it.  We can't get the request ID from the latter, because it's
      null when the qdict flunks the checks.
      
      Move the checked conversion to QDict from qmp_dispatch_check_obj() to
      qmp_dispatch(), and drop the duplicate there.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20200317115459.31821-24-armbru@redhat.com>
      a62c6174
    • Markus Armbruster's avatar
      qapi: Simplify how qmp_dispatch() deals with QCO_NO_SUCCESS_RESP · d3226035
      Markus Armbruster authored
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20200317115459.31821-23-armbru@redhat.com>
      d3226035
Loading