1. 04 3月, 2016 1 次提交
    • P
      loader: Add data swap option to load-elf · 7ef295ea
      Peter Crosthwaite 提交于
      Some CPUs are of an opposite data-endianness to other components in the
      system. Sometimes elfs have the data sections layed out with this CPU
      data-endianness accounting for when loaded via the CPU, so byte swaps
      (relative to other system components) will occur.
      
      The leading example, is ARM's BE32 mode, which is is basically LE with
      address manipulation on half-word and byte accesses to access the
      hw/byte reversed address. This means that word data is invariant
      across LE and BE32. This also means that instructions are still LE.
      The expectation is that the elf will be loaded via the CPU in this
      endianness scheme, which means the data in the elf is reversed at
      compile time.
      
      As QEMU loads via the system memory directly, rather than the CPU, we
      need a mechanism to reverse elf data endianness to implement this
      possibility.
      Reviewed-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NPeter Crosthwaite <crosthwaite.peter@gmail.com>
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      7ef295ea
  2. 25 2月, 2016 5 次提交
  3. 23 2月, 2016 1 次提交
  4. 10 2月, 2016 1 次提交
  5. 09 2月, 2016 2 次提交
    • E
      qom: Swap 'name' next to visitor in ObjectPropertyAccessor · d7bce999
      Eric Blake 提交于
      Similar to the previous patch, it's nice to have all functions
      in the tree that involve a visitor and a name for conversion to
      or from QAPI to consistently stick the 'name' parameter next
      to the Visitor parameter.
      
      Done by manually changing include/qom/object.h and qom/object.c,
      then running this Coccinelle script and touching up the fallout
      (Coccinelle insisted on adding some trailing whitespace).
      
          @ rule1 @
          identifier fn;
          typedef Object, Visitor, Error;
          identifier obj, v, opaque, name, errp;
          @@
           void fn
          - (Object *obj, Visitor *v, void *opaque, const char *name,
          + (Object *obj, Visitor *v, const char *name, void *opaque,
             Error **errp) { ... }
      
          @@
          identifier rule1.fn;
          expression obj, v, opaque, name, errp;
          @@
           fn(obj, v,
          -   opaque, name,
          +   name, opaque,
              errp)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-20-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      d7bce999
    • E
      qapi: Swap visit_* arguments for consistent 'name' placement · 51e72bc1
      Eric Blake 提交于
      JSON uses "name":value, but many of our visitor interfaces were
      called with visit_type_FOO(v, &value, name, errp).  This can be
      a bit confusing to have to mentally swap the parameter order to
      match JSON order.  It's particularly bad for visit_start_struct(),
      where the 'name' parameter is smack in the middle of the
      otherwise-related group of 'obj, kind, size' parameters! It's
      time to do a global swap of the parameter ordering, so that the
      'name' parameter is always immediately after the Visitor argument.
      
      Additional reason in favor of the swap: the existing include/qjson.h
      prefers listing 'name' first in json_prop_*(), and I have plans to
      unify that file with the qapi visitors; listing 'name' first in
      qapi will minimize churn to the (admittedly few) qjson.h clients.
      
      Later patches will then fix docs, object.h, visitor-impl.h, and
      those clients to match.
      
      Done by first patching scripts/qapi*.py by hand to make generated
      files do what I want, then by running the following Coccinelle
      script to affect the rest of the code base:
       $ spatch --sp-file script `git grep -l '\bvisit_' -- '**/*.[ch]'`
      I then had to apply some touchups (Coccinelle insisted on TAB
      indentation in visitor.h, and botched the signature of
      visit_type_enum() by rewriting 'const char *const strings[]' to
      the syntactically invalid 'const char*const[] strings').  The
      movement of parameters is sufficient to provoke compiler errors
      if any callers were missed.
      
          // Part 1: Swap declaration order
          @@
          type TV, TErr, TObj, T1, T2;
          identifier OBJ, ARG1, ARG2;
          @@
           void visit_start_struct
          -(TV v, TObj OBJ, T1 ARG1, const char *name, T2 ARG2, TErr errp)
          +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)
           { ... }
      
          @@
          type bool, TV, T1;
          identifier ARG1;
          @@
           bool visit_optional
          -(TV v, T1 ARG1, const char *name)
          +(TV v, const char *name, T1 ARG1)
           { ... }
      
          @@
          type TV, TErr, TObj, T1;
          identifier OBJ, ARG1;
          @@
           void visit_get_next_type
          -(TV v, TObj OBJ, T1 ARG1, const char *name, TErr errp)
          +(TV v, const char *name, TObj OBJ, T1 ARG1, TErr errp)
           { ... }
      
          @@
          type TV, TErr, TObj, T1, T2;
          identifier OBJ, ARG1, ARG2;
          @@
           void visit_type_enum
          -(TV v, TObj OBJ, T1 ARG1, T2 ARG2, const char *name, TErr errp)
          +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)
           { ... }
      
          @@
          type TV, TErr, TObj;
          identifier OBJ;
          identifier VISIT_TYPE =~ "^visit_type_";
          @@
           void VISIT_TYPE
          -(TV v, TObj OBJ, const char *name, TErr errp)
          +(TV v, const char *name, TObj OBJ, TErr errp)
           { ... }
      
          // Part 2: swap caller order
          @@
          expression V, NAME, OBJ, ARG1, ARG2, ERR;
          identifier VISIT_TYPE =~ "^visit_type_";
          @@
          (
          -visit_start_struct(V, OBJ, ARG1, NAME, ARG2, ERR)
          +visit_start_struct(V, NAME, OBJ, ARG1, ARG2, ERR)
          |
          -visit_optional(V, ARG1, NAME)
          +visit_optional(V, NAME, ARG1)
          |
          -visit_get_next_type(V, OBJ, ARG1, NAME, ERR)
          +visit_get_next_type(V, NAME, OBJ, ARG1, ERR)
          |
          -visit_type_enum(V, OBJ, ARG1, ARG2, NAME, ERR)
          +visit_type_enum(V, NAME, OBJ, ARG1, ARG2, ERR)
          |
          -VISIT_TYPE(V, OBJ, NAME, ERR)
          +VISIT_TYPE(V, NAME, OBJ, ERR)
          )
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-19-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      51e72bc1
  6. 07 2月, 2016 15 次提交
  7. 05 2月, 2016 1 次提交
    • I
      pc: acpi: merge SSDT into DSDT · 41fa5c04
      Igor Mammedov 提交于
      Since both tables are built dynamically now,
      there is no point in keeping ASL in them in separate
      tables.
      So do the same as we do for ARM where we have only
      DSDT table, i.e. move SSDT ASL into DSDT and
      drop SSDT altogether.
      This patch doesn't change moved SSDT ASL in any way,
      but it opens a way to relatively independently simplify
      generated ASL on per device/subsystem basis in
      followup series.
      It also simplifies bios-tables-test where expected
      SSDT blobs could be dropped and only DSDT ones
      have to be maintained.
      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>
      41fa5c04
  8. 04 2月, 2016 1 次提交
  9. 29 1月, 2016 1 次提交
    • P
      x86: Clean up includes · b6a0aa05
      Peter Maydell 提交于
      Clean up includes so that osdep.h is included first and headers
      which it implies are not included manually.
      
      This commit was created with scripts/clean-includes.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1453832250-766-11-git-send-email-peter.maydell@linaro.org
      b6a0aa05
  10. 26 1月, 2016 1 次提交
  11. 22 1月, 2016 1 次提交
  12. 21 1月, 2016 2 次提交
  13. 16 1月, 2016 1 次提交
    • P
      i386: avoid null pointer dereference · 4c1396cb
      P J P 提交于
          Hello,
      
      A null pointer dereference issue was reported by Mr Ling Liu, CC'd here. It
      occurs while doing I/O port write operations via hmp interface. In that,
      'current_cpu' remains null as it is not called from cpu_exec loop, which
      results in the said issue.
      
      Below is a proposed (tested)patch to fix this issue; Does it look okay?
      
      ===
      From ae88a4947fab9a148cd794f8ad2d812e7f5a1d0f Mon Sep 17 00:00:00 2001
      From: Prasad J Pandit <pjp@fedoraproject.org>
      Date: Fri, 18 Dec 2015 11:16:07 +0530
      Subject: [PATCH] i386: avoid null pointer dereference
      
      When I/O port write operation is called from hmp interface,
      'current_cpu' remains null, as it is not called from cpu_exec()
      loop. This leads to a null pointer dereference in vapic_write
      routine. Add check to avoid it.
      Reported-by: NLing Liu <liuling-it@360.cn>
      Signed-off-by: NPrasad J Pandit <pjp@fedoraproject.org>
      Message-Id: <alpine.LFD.2.20.1512181129320.9805@wniryva>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NP J P <ppandit@redhat.com>
      4c1396cb
  14. 15 1月, 2016 1 次提交
  15. 13 1月, 2016 5 次提交
    • M
      error: Clean up errors with embedded newlines (again) · 433672b0
      Markus Armbruster 提交于
      The arguments of error_report() should yield a short error string
      without newlines.
      
      A few places try to print additional help after the error message by
      embedding newlines in the error string.  That's nice, but let's do it
      the right way.  Commit 474c2134 cleaned up some, but they keep coming
      back.  Offenders tracked down with the Coccinelle semantic patch from
      commit 312fd5f2.
      
      Cc: Laszlo Ersek <lersek@redhat.com>
      Cc: Pavel Fedin <p.fedin@samsung.com>
      Signed-off-by: NMarkus Armbruster <armbru@pond.sub.org>
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      433672b0
    • M
      pci-assign: Clean up "Failed to assign" error messages · c3d2d68a
      Markus Armbruster 提交于
      The arguments of error_setg() & friends should yield a short error
      string without newlines.
      
      Two places try to append additional help to the error message by
      embedding newlines in the error string.  That's nice, but let's do it
      the right way, with error_append_hint().
      
      Cc: Laszlo Ersek <lersek@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1450452927-8346-20-git-send-email-armbru@redhat.com>
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      c3d2d68a
    • M
      error: Use error_reportf_err() where it makes obvious sense · c29b77f9
      Markus Armbruster 提交于
      Done with this Coccinelle semantic patch
      
          @@
          expression FMT, E, S;
          expression list ARGS;
          @@
          -    error_report(FMT, ARGS, error_get_pretty(E));
          +    error_reportf_err(E, FMT/*@@@*/, ARGS);
          (
          -    error_free(E);
          |
      	 exit(S);
          |
      	 abort();
          )
      
      followed by a replace of '%s"/*@@@*/' by '"' and some line rewrapping,
      because I can't figure out how to make Coccinelle transform strings.
      
      We now use the error whole instead of just its message obtained with
      error_get_pretty().  This avoids suppressing its hint (see commit
      50b7b000), but I can't see how the errors touched in this commit could
      come with hints.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1450452927-8346-12-git-send-email-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      c29b77f9
    • M
      isa: Clean up error handling around isa_bus_new() · d10e5432
      Markus Armbruster 提交于
      We can have at most one ISA bus.  If you try to create another one,
      isa_bus_new() complains to stderr and returns null.
      
      isa_bus_new() is called in two contexts, machine's init() and device's
      realize() methods.  Since complaining to stderr is not proper in the
      latter context, convert isa_bus_new() to Error.
      
      Machine's init():
      
      * mips_jazz_init(), called from the init() methods of machines
        "magnum" and "pica"
      
      * mips_r4k_init(), the init() method of machine "mips"
      
      * pc_init1() called from the init() methods of non-q35 PC machines
      
      * typhoon_init(), called from clipper_init(), the init() method of
        machine "clipper"
      
      These callers always create the first ISA bus, hence isa_bus_new()
      can't fail.  Simply pass &error_abort.
      
      Device's realize():
      
      * i82378_realize(), of PCI device "i82378"
      
      * ich9_lpc_realize(), of PCI device "ICH9-LPC"
      
      * pci_ebus_realize(), of PCI device "ebus"
      
      * piix3_realize(), of PCI device "pci-piix3", abstract parent of
        "PIIX3" and "PIIX3-xen"
      
      * piix4_realize(), of PCI device "PIIX4"
      
      * vt82c686b_realize(), of PCI device "VT82C686B"
      
      Propagate the error.  Note that these devices are typically created
      only by machine init() methods with qdev_init_nofail() or similar.  If
      we screwed up and created an ISA bus before that call, we now give up
      right away.  Before, we'd hobble on, and typically die in
      isa_bus_irqs().  Similar if someone finds a way to hot-plug one of
      these critters.
      
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: "Hervé Poussineau" <hpoussin@reactos.org>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
      Signed-off-by: NMarkus Armbruster <armbru@pond.sub.org>
      Reviewed-by: NMarcel Apfelbaum <marcel@redhat.com>
      Reviewed-by: NHervé Poussineau <hpoussin@reactos.org>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Message-Id: <1450370121-5768-11-git-send-email-armbru@redhat.com>
      d10e5432
    • M
      Use error_fatal to simplify obvious fatal errors · 007b0657
      Markus Armbruster 提交于
      Done with this Coccinelle semantic patch:
      
          @@
          type T;
          identifier FUN, RET;
          expression list ARGS;
          expression ERR, EC;
          @@
          (
          -    T RET = FUN(ARGS, &ERR);
          +    T RET = FUN(ARGS, &error_fatal);
          |
          -    RET = FUN(ARGS, &ERR);
          +    RET = FUN(ARGS, &error_fatal);
          |
          -    FUN(ARGS, &ERR);
          +    FUN(ARGS, &error_fatal);
          )
          -    if (ERR != NULL) {
          -        error_report_err(ERR);
          -        exit(EC);
          -    }
      
      This is actually a more elegant version of my initial semantic patch
      by courtesy of Eduardo.
      
      It leaves dead Error * variables behind, cleaned up manually.
      
      Cc: qemu-arm@nongnu.org
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      007b0657
  16. 10 1月, 2016 1 次提交