1. 17 3月, 2017 2 次提交
  2. 15 12月, 2016 1 次提交
  3. 30 11月, 2016 1 次提交
    • L
      loader: fix handling of custom address spaces when adding ROM blobs · aa6c6ae8
      Laszlo Ersek 提交于
      * Commit 3e76099a ("loader: Allow a custom AddressSpace when loading
        ROMs") introduced the "Rom.as" field:
      
        (1) It modified the utility callers of rom_insert() to take "as" as a
            new parameter from *their* callers, and set "rom->as" from that
            parameter. The functions covered were rom_add_file() and
            rom_add_elf_program().
      
        (2) It also modified rom_insert() itself, to auto-assign
            "&address_space_memory", in case the external caller passed -- and
            the utility caller forwarded -- as=NULL.
      
        Except, commit 3e76099a forgot to update the third utility caller of
        rom_insert(), under point (1), namely rom_add_blob().
      
      * Later, commit 5e774eb3 ("loader: Add AddressSpace loading support
        to uImages") added the load_uimage_as() function, and the
        rom_add_blob_fixed_as() function-like macro, with the necessary changes
        elsewhere to propagate the new "as" parameter to rom_add_blob():
      
          load_uimage_as()
            load_uboot_image()
              rom_add_blob_fixed_as()
                rom_add_blob()
      
        At this point, the signature (and workings) of rom_add_blob() had been
        broken already, and the rom_add_blob_fixed_as() macro passed its "_as"
        parameter to rom_add_blob() as "callback_opaque". Given that the
        "fw_callback" parameter itself was set to NULL (correctly), this did no
        additional damage (the opaque arg would never be used), but ultimately
        it broke the new functionality of load_uimage_as().
      
      * The load_uimage_as() function would be put to use in one of the later
        patches, commit e481a1f6 ("generic-loader: Add a generic loader").
      
      * We can fix this only in a unified patch now. Append "AddressSpace *as"
        to the signature of rom_add_blob(), and handle the new parameter. Pass
        NULL from all current callers, except from rom_add_blob_fixed_as(),
        where "_as" has to be bumped to the proper position.
      
      * Note that rom_add_file() rejects the case when both "mr" and "as" are
        passed in as non-NULL. The action that this is apparently supposed to
        prevent is the
      
          rom->mr = mr;
      
        assignment (that's the only place where the "mr" parameter is used in
        rom_add_file()). In rom_add_blob() though, we have no "mr" parameter,
        and the actions done on the fw_cfg branch:
      
          if (fw_file_name && fw_cfg) {
              if (mc->rom_file_has_mr) {
                  data = rom_set_mr(rom, OBJECT(fw_cfg), devpath);
                  mr = rom->mr;
              } else {
                  data = rom->data;
              }
      
        reflect those that are performed by rom_add_file() too (with mr==NULL):
      
          if (rom->fw_file && fw_cfg) {
              if ((!option_rom || mc->option_rom_has_mr) &&
                  mc->rom_file_has_mr) {
                  data = rom_set_mr(rom, OBJECT(fw_cfg), devpath);
              } else {
                  data = rom->data;
              }
      
        Hence we need no additional restrictions in rom_add_blob().
      
      * Stable is not affected as both problematic commits appeared first in
        v2.8.0-rc0.
      
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Alistair Francis <alistair.francis@xilinx.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: Michael Walle <michael@walle.cc>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Cc: Shannon Zhao <zhaoshenglong@huawei.com>
      Cc: qemu-arm@nongnu.org
      Cc: qemu-devel@nongnu.org
      Fixes: 3e76099a
      Fixes: 5e774eb3Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NAlistair Francis <alistair.francis@xilinx.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      aa6c6ae8
  4. 28 11月, 2016 1 次提交
  5. 23 11月, 2016 7 次提交
  6. 18 11月, 2016 2 次提交
  7. 16 11月, 2016 2 次提交
  8. 15 11月, 2016 19 次提交
  9. 03 11月, 2016 1 次提交
  10. 02 11月, 2016 4 次提交
    • E
      nbd: Implement NBD_CMD_WRITE_ZEROES on server · 1f4d6d18
      Eric Blake 提交于
      Upstream NBD protocol recently added the ability to efficiently
      write zeroes without having to send the zeroes over the wire,
      along with a flag to control whether the client wants to allow
      a hole.
      
      Note that when it comes to requiring full allocation, vs.
      permitting optimizations, the NBD spec intentionally picked a
      different sense for the flag; the rules in qemu are:
      MAY_UNMAP == 0: must write zeroes
      MAY_UNMAP == 1: may use holes if reads will see zeroes
      
      while in NBD, the rules are:
      FLAG_NO_HOLE == 1: must write zeroes
      FLAG_NO_HOLE == 0: may use holes if reads will see zeroes
      
      In all cases, the 'may use holes' scenario is optional (the
      server need not use a hole, and must not use a hole if
      subsequent reads would not see zeroes).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1476469998-28592-16-git-send-email-eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      1f4d6d18
    • E
      nbd: Improve server handling of shutdown requests · b6f5d3b5
      Eric Blake 提交于
      NBD commit 6d34500b clarified how clients and servers are supposed
      to behave before closing a connection. It added NBD_REP_ERR_SHUTDOWN
      (for the server to announce it is about to go away during option
      haggling, so the client should quit sending NBD_OPT_* other than
      NBD_OPT_ABORT) and ESHUTDOWN (for the server to announce it is about
      to go away during transmission, so the client should quit sending
      NBD_CMD_* other than NBD_CMD_DISC).  It also clarified that
      NBD_OPT_ABORT gets a reply, while NBD_CMD_DISC does not.
      
      This patch merely adds the missing reply to NBD_OPT_ABORT and teaches
      the client to recognize server errors.  Actually teaching the server
      to send NBD_REP_ERR_SHUTDOWN or ESHUTDOWN would require knowing that
      the server has been requested to shut down soon (maybe we could do
      that by installing a SIGINT handler in qemu-nbd, which transitions
      from RUNNING to a new state that waits for the client to react,
      rather than just out-right quitting - but that's a bigger task for
      another day).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1476469998-28592-15-git-send-email-eblake@redhat.com>
      [Move dummy ESHUTDOWN to include/qemu/osdep.h. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b6f5d3b5
    • E
      nbd: Support shorter handshake · c203c59a
      Eric Blake 提交于
      The NBD Protocol allows the server and client to mutually agree
      on a shorter handshake (omit the 124 bytes of reserved 0), via
      the server advertising NBD_FLAG_NO_ZEROES and the client
      acknowledging with NBD_FLAG_C_NO_ZEROES (only possible in
      newstyle, whether or not it is fixed newstyle).  It doesn't
      shave much off the wire, but we might as well implement it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NAlex Bligh <alex@alex.org.uk>
      Message-Id: <1476469998-28592-13-git-send-email-eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      c203c59a
    • E
      nbd: Share common option-sending code in client · c8a3a1b6
      Eric Blake 提交于
      Rather than open-coding each option request, it's easier to
      have common helper functions do the work.  That in turn requires
      having convenient packed types for handling option requests
      and replies.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1476469998-28592-9-git-send-email-eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      c8a3a1b6