1. 19 10月, 2015 1 次提交
  2. 18 9月, 2015 1 次提交
    • M
      Fix bad error handling after memory_region_init_ram() · f8ed85ac
      Markus Armbruster 提交于
      Symptom:
      
          $ qemu-system-x86_64 -m 10000000
          Unexpected error in ram_block_add() at /work/armbru/qemu/exec.c:1456:
          upstream-qemu: cannot set up guest memory 'pc.ram': Cannot allocate memory
          Aborted (core dumped)
      
      Root cause: commit ef701d7b screwed up handling of out-of-memory
      conditions.  Before the commit, we report the error and exit(1), in
      one place, ram_block_add().  The commit lifts the error handling up
      the call chain some, to three places.  Fine.  Except it uses
      &error_abort in these places, changing the behavior from exit(1) to
      abort(), and thus undoing the work of commit 39228250 "exec: Don't
      abort when we can't allocate guest memory".
      
      The three places are:
      
      * memory_region_init_ram()
      
        Commit 49946538 (right after commit ef701d7b) lifted the error
        handling further, through memory_region_init_ram(), multiplying the
        incorrect use of &error_abort.  Later on, imitation of existing
        (bad) code may have created more.
      
      * memory_region_init_ram_ptr()
      
        The &error_abort is still there.
      
      * memory_region_init_rom_device()
      
        Doesn't need fixing, because commit 33e0eb52 (soon after commit
        ef701d7b) lifted the error handling further, and in the process
        changed it from &error_abort to passing it up the call chain.
        Correct, because the callers are realize() methods.
      
      Fix the error handling after memory_region_init_ram() with a
      Coccinelle semantic patch:
      
          @r@
          expression mr, owner, name, size, err;
          position p;
          @@
                  memory_region_init_ram(mr, owner, name, size,
          (
          -                              &error_abort
          +                              &error_fatal
          |
                                         err@p
          )
                                        );
          @script:python@
              p << r.p;
          @@
          print "%s:%s:%s" % (p[0].file, p[0].line, p[0].column)
      
      When the last argument is &error_abort, it gets replaced by
      &error_fatal.  This is the fix.
      
      If the last argument is anything else, its position is reported.  This
      lets us check the fix is complete.  Four positions get reported:
      
      * ram_backend_memory_alloc()
      
        Error is passed up the call chain, ultimately through
        user_creatable_complete().  As far as I can tell, it's callers all
        handle the error sanely.
      
      * fsl_imx25_realize(), fsl_imx31_realize(), dp8393x_realize()
      
        DeviceClass.realize() methods, errors handled sanely further up the
        call chain.
      
      We're good.  Test case again behaves:
      
          $ qemu-system-x86_64 -m 10000000
          qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory
          [Exit 1 ]
      
      The next commits will repair the rest of commit ef701d7b's damage.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1441983105-26376-3-git-send-email-armbru@redhat.com>
      Reviewed-by: NPeter Crosthwaite <crosthwaite.peter@gmail.com>
      f8ed85ac
  3. 16 9月, 2015 1 次提交
  4. 11 9月, 2015 1 次提交
  5. 10 9月, 2015 2 次提交
    • L
      hw/pci: fix pci_update_mappings() trace events · 0f288f85
      Laszlo Ersek 提交于
      The current trace prototypes and (matching) trace calls lead to
      "unorthodox" PCI BDF notation in at least the stderr trace backend. For
      example, the four BARs of a QXL video card at 00:01.0 (bus 0, slot 1,
      function 0) are traced like this (PID and timestamps removed):
      
        pci_update_mappings_add d=0x7f14a73bf890 00:00.1 0,0x84000000+0x4000000
        pci_update_mappings_add d=0x7f14a73bf890 00:00.1 1,0x80000000+0x4000000
        pci_update_mappings_add d=0x7f14a73bf890 00:00.1 2,0x88200000+0x2000
        pci_update_mappings_add d=0x7f14a73bf890 00:00.1 3,0xd060+0x20
      
      The slot and function values are in reverse order.
      
      Stick with the conventional BDF notation.
      
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Don Koch <dkoch@verizon.com>
      Cc: qemu-trivial@nongnu.org
      Fixes: 7828d750Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      0f288f85
    • B
      pci: Fix pci_device_iommu_address_space() bus propagation · 5af2ae23
      Benjamin Herrenschmidt 提交于
      he current code walks up the bus tree for an iommu, however it passes
      to the iommu_fn() callback the bus/devfn of the immediate child of
      the level where the callback was found, rather than the original
      bus/devfn where the search started from.
      
      This prevents iommu's like POWER8 (and in fact also Q35) to properly
      provide an address space for a subset of devices that aren't immediate
      children of the iommu.
      
      PCIe carries the originator bdfn acccross to the iommu on all DMA
      transactions, so we must be able to properly identify devices at all
      levels.
      
      This changes the function pci_device_iommu_address_space() to pass
      the original pointers to the iommu_fn() callback instead.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      
      5af2ae23
  6. 07 9月, 2015 1 次提交
    • P
      hw/pci: Use pow2ceil() rather than hand-calculation · 9bff5d81
      Peter Maydell 提交于
      A couple of places in hw/pci use an inline calculation to round a
      size up to the next largest power of 2. We have a utility routine
      for this, so use it.
      
      (The behaviour of the old code is different if the size value
      is 0 -- it would leave it as 0 rather than rounding up to 1,
      but in both cases we know the size can't be 0.
      In the case where the size value had bit 31 set, the old code
      would invoke undefined behaviour; the new code will give a
      result of 0. Presumably that could never happen either.)
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Message-id: 1437741192-20955-2-git-send-email-peter.maydell@linaro.org
      9bff5d81
  7. 13 8月, 2015 1 次提交
  8. 20 7月, 2015 1 次提交
  9. 08 7月, 2015 1 次提交
  10. 24 6月, 2015 1 次提交
  11. 23 6月, 2015 3 次提交
  12. 22 6月, 2015 1 次提交
  13. 12 6月, 2015 1 次提交
  14. 04 6月, 2015 6 次提交
  15. 02 6月, 2015 2 次提交
    • J
      xen: don't allow guest to control MSI mask register · 7611dae8
      Jan Beulich 提交于
      It's being used by the hypervisor. For now simply mimic a device not
      capable of masking, and fully emulate any accesses a guest may issue
      nevertheless as simple reads/writes without side effects.
      
      This is XSA-129.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Reviewed-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      7611dae8
    • M
      monitor: Use trad. command interface for HMP pcie_aer_inject_error · 04e00c92
      Markus Armbruster 提交于
      All QMP commands use the "new" handler interface (mhandler.cmd_new).
      Most HMP commands still use the traditional interface (mhandler.cmd),
      but a few use the "new" one.  Complicates handle_user_command() for no
      gain, so I'm converting these to the traditional interface.
      
      pcie_aer_inject_error's implementation is split into the
      hmp_pcie_aer_inject_error() and pcie_aer_inject_error_print().  The
      former is a peculiar crossbreed between HMP and QMP handler.  On
      success, it works like a QMP handler: store QDict through ret_data
      parameter, return 0.  Printing the QDict is left to
      pcie_aer_inject_error_print().  On failure, it works more like an HMP
      handler: print error to monitor, return negative number.
      
      To convert to the traditional interface, turn
      pcie_aer_inject_error_print() into a command handler wrapping around
      hmp_pcie_aer_inject_error().  By convention, this command handler
      should be called hmp_pcie_aer_inject_error(), so rename the existing
      hmp_pcie_aer_inject_error() to do_pcie_aer_inject_error().
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      04e00c92
  16. 01 6月, 2015 1 次提交
  17. 06 5月, 2015 1 次提交
    • E
      qapi: Drop inline nested structs in query-pci · 9fa02cd1
      Eric Blake 提交于
      A future patch will be using a 'name':{dictionary} entry in the
      QAPI schema to specify a default value for an optional argument
      (see previous commit message for more details why); but existing
      use of inline nested structs conflicts with that goal. This patch
      fixes one of only two commands relying on nested types, by
      breaking the nesting into an explicit type; it means that the
      type is now boxed instead of unboxed in C code, but the QMP wire
      format is unaffected by this change.
      
      Prefer the safer g_new0() while making the conversion, and reduce
      some long lines.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      9fa02cd1
  18. 28 4月, 2015 3 次提交
  19. 26 4月, 2015 1 次提交
    • P
      Switch non-CPU callers from ld/st*_phys to address_space_ld/st* · 42874d3a
      Peter Maydell 提交于
      Switch all the uses of ld/st*_phys to address_space_ld/st*,
      except for those cases where the address space is the CPU's
      (ie cs->as). This was done with the following script which
      generates a Coccinelle patch.
      
      A few over-80-columns lines in the result were rewrapped by
      hand where Coccinelle failed to do the wrapping automatically,
      as well as one location where it didn't put a line-continuation
      '\' when wrapping lines on a change made to a match inside
      a macro definition.
      
      ===begin===
      #!/bin/sh -e
      # Usage:
      # ./ldst-phys.spatch.sh > ldst-phys.spatch
      # spatch -sp_file ldst-phys.spatch -dir . | sed -e '/^+/s/\t/        /g' > out.patch
      # patch -p1 < out.patch
      
      for FN in ub uw_le uw_be l_le l_be q_le q_be uw l q; do
      cat <<EOF
      @ cpu_matches_ld_${FN} @
      expression E1,E2;
      identifier as;
      @@
      
      ld${FN}_phys(E1->as,E2)
      
      @ other_matches_ld_${FN} depends on !cpu_matches_ld_${FN} @
      expression E1,E2;
      @@
      
      -ld${FN}_phys(E1,E2)
      +address_space_ld${FN}(E1,E2, MEMTXATTRS_UNSPECIFIED, NULL)
      
      EOF
      
      done
      
      for FN in b w_le w_be l_le l_be q_le q_be w l q; do
      cat <<EOF
      @ cpu_matches_st_${FN} @
      expression E1,E2,E3;
      identifier as;
      @@
      
      st${FN}_phys(E1->as,E2,E3)
      
      @ other_matches_st_${FN} depends on !cpu_matches_st_${FN} @
      expression E1,E2,E3;
      @@
      
      -st${FN}_phys(E1,E2,E3)
      +address_space_st${FN}(E1,E2,E3, MEMTXATTRS_UNSPECIFIED, NULL)
      
      EOF
      
      done
      ===endit===
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NEdgar E. Iglesias <edgar.iglesias@xilinx.com>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      42874d3a
  20. 13 4月, 2015 1 次提交
    • T
      pci: Fix crash with illegal "-net nic, model=xxx" option · 4d0ecde4
      Thomas Huth 提交于
      Current QEMU crashes when specifying an illegal model with the
      "-net nic,model=xxx" option, e.g.:
      
       $ qemu-system-x86_64 -net nic,model=n/a
       qemu-system-x86_64: Unsupported NIC model: n/a
      
       Program received signal SIGSEGV, Segmentation fault.
      
      The gdb backtrace looks like this:
      
      0x0000555555965fe0 in error_get_pretty (err=0x0) at util/error.c:152
      152	    return err->msg;
      (gdb) bt
       0  0x0000555555965fe0 in error_get_pretty (err=0x0) at util/error.c:152
       1  0x0000555555965ffd in error_report_err (err=0x0) at util/error.c:157
       2  0x0000555555809c90 in pci_nic_init_nofail (nd=0x555555e49860 <nd_table>, rootbus=0x5555564409b0,
          default_model=0x55555598c37b "e1000", default_devaddr=0x0) at hw/pci/pci.c:1663
       3  0x0000555555691e42 in pc_nic_init (isa_bus=0x555556f71900, pci_bus=0x5555564409b0)
          at hw/i386/pc.c:1506
       4  0x000055555569396b in pc_init1 (machine=0x5555562abbf0, pci_enabled=1, kvmclock_enabled=1)
          at hw/i386/pc_piix.c:248
       5  0x0000555555693d27 in pc_init_pci (machine=0x5555562abbf0) at hw/i386/pc_piix.c:310
       6  0x000055555572ddf5 in main (argc=3, argv=0x7fffffffe018, envp=0x7fffffffe038) at vl.c:4226
      
      The problem is that pci_nic_init_nofail() does not check whether the err
      parameter from pci_nic_init has been set up and thus passes a NULL pointer
      to error_report_err(). Fix it by correctly checking the err parameter.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      4d0ecde4
  21. 18 3月, 2015 5 次提交
  22. 12 3月, 2015 1 次提交
  23. 11 3月, 2015 1 次提交
  24. 01 3月, 2015 2 次提交