1. 21 2月, 2020 21 次提交
    • C
      hw/ppc/virtex_ml507:fix leak of fdevice tree blob · 438bafca
      Chen Qun 提交于
      The device tree blob returned by load_device_tree is malloced.
      We should free it after cpu_physical_memory_write().
      Reported-by: NEuler Robot <euler.robot@huawei.com>
      Signed-off-by: NChen Qun <kuhn.chenqun@huawei.com>
      Message-Id: <20200218091154.21696-3-kuhn.chenqun@huawei.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      438bafca
    • G
      spapr: Fix handling of unplugged devices during CAS and migration · ab858434
      Greg Kurz 提交于
      We already detect if a device is being hot plugged before CAS to trigger
      a CAS reboot and during migration to migrate the state of the associated
      DRC. But hot unplugging a device is also an asynchronous operation that
      requires the guest to take action. This means that if the guest is migrated
      after the hot unplug event was sent but before it could release the device
      with RTAS, the destination QEMU doesn't know about the pending unplug
      operation and doesn't actually remove the device when the guest finally
      releases it.
      
      Similarly, if the unplug request is fired before CAS, the guest isn't
      notified of the change, just like with hotplug. It ends up booting with
      the device still present in the DT and configures it, just like it was
      never removed. Even weirder, since the event is still queued, it will
      be eventually processed when some other unrelated event is posted to
      the guest.
      
      Enhance spapr_drc_transient() to also return true if an unplug request is
      pending. This fixes the issue at CAS with a CAS reboot request and
      causes the DRC state to be migrated. Some extra care is still needed to
      inform the destination that an unplug request is pending : migrate the
      unplug_requested field of the DRC in an optional subsection. This might
      break backwards migration, but this is still better than ending with
      an inconsistent guest.
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Message-Id: <158169248798.3465937.1108351365840514270.stgit@bahia.lan>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      ab858434
    • G
      spapr: Don't use spapr_drc_needed() in CAS code · 4b63db12
      Greg Kurz 提交于
      We currently don't support hotplug of devices between boot and CAS. If
      this happens a CAS reboot is triggered. We detect this during CAS using
      the spapr_drc_needed() function which is essentially a VMStateDescription
      .needed callback. Even if the condition for CAS reboot happens to be the
      same as for DRC migration, it looks wrong to piggyback a migration helper
      for this.
      
      Introduce a helper with slightly more explicit name and use it in both CAS
      and DRC migration code. Since a subsequent patch will enhance this helper
      to cover the case of hot unplug, let's go for spapr_drc_transient(). While
      here convert spapr_hotplugged_dev_before_cas() to the "transient" wording as
      well.
      
      This doesn't change any behaviour.
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Message-Id: <158169248180.3465937.9531405453362718771.stgit@bahia.lan>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      4b63db12
    • P
      ppc: free 'fdt' after reset the machine · b2fb7a43
      Pan Nengyuan 提交于
      'fdt' forgot to clean both e500 and pnv when we call 'system_reset' on ppc,
      this patch fix it. The leak stacks are as follow:
      
      Direct leak of 4194304 byte(s) in 4 object(s) allocated from:
          #0 0x7fafe37dd970 in __interceptor_calloc (/lib64/libasan.so.5+0xef970)
          #1 0x7fafe2e3149d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5249d)
          #2 0x561876f7f80d in create_device_tree /mnt/sdb/qemu-new/qemu/device_tree.c:40
          #3 0x561876b7ac29 in ppce500_load_device_tree /mnt/sdb/qemu-new/qemu/hw/ppc/e500.c:364
          #4 0x561876b7f437 in ppce500_reset_device_tree /mnt/sdb/qemu-new/qemu/hw/ppc/e500.c:617
          #5 0x56187718b1ae in qemu_devices_reset /mnt/sdb/qemu-new/qemu/hw/core/reset.c:69
          #6 0x561876f6938d in qemu_system_reset /mnt/sdb/qemu-new/qemu/vl.c:1412
          #7 0x561876f6a25b in main_loop_should_exit /mnt/sdb/qemu-new/qemu/vl.c:1645
          #8 0x561876f6a398 in main_loop /mnt/sdb/qemu-new/qemu/vl.c:1679
          #9 0x561876f7da8e in main /mnt/sdb/qemu-new/qemu/vl.c:4438
          #10 0x7fafde16b812 in __libc_start_main ../csu/libc-start.c:308
          #11 0x5618765c055d in _start (/mnt/sdb/qemu-new/qemu/build/ppc64-softmmu/qemu-system-ppc64+0x2b1555d)
      
      Direct leak of 1048576 byte(s) in 1 object(s) allocated from:
          #0 0x7fc0a6f1b970 in __interceptor_calloc (/lib64/libasan.so.5+0xef970)
          #1 0x7fc0a656f49d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5249d)
          #2 0x55eb05acd2ca in pnv_dt_create /mnt/sdb/qemu-new/qemu/hw/ppc/pnv.c:507
          #3 0x55eb05ace5bf in pnv_reset /mnt/sdb/qemu-new/qemu/hw/ppc/pnv.c:578
          #4 0x55eb05f2f395 in qemu_system_reset /mnt/sdb/qemu-new/qemu/vl.c:1410
          #5 0x55eb05f43850 in main /mnt/sdb/qemu-new/qemu/vl.c:4403
          #6 0x7fc0a18a9812 in __libc_start_main ../csu/libc-start.c:308
          #7 0x55eb0558655d in _start (/mnt/sdb/qemu-new/qemu/build/ppc64-softmmu/qemu-system-ppc64+0x2b1555d)
      Reported-by: NEuler Robot <euler.robot@huawei.com>
      Signed-off-by: NPan Nengyuan <pannengyuan@huawei.com>
      Message-Id: <20200214033206.4395-1-pannengyuan@huawei.com>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      b2fb7a43
    • B
      target/ppc/cpu.h: Clean up comments in the struct CPUPPCState definition · ad5db2e7
      BALATON Zoltan 提交于
      The cpu env struct is quite complex but comments supposed to explain
      it in its definition just make it harder to read. Reformat and reword
      some comments to make it clearer and more readable.
      Signed-off-by: NBALATON Zoltan <balaton@eik.bme.hu>
      Message-Id: <8707144ab1ccf9c5c89a39c2d7a0b02307ca25d4.1581888834.git.balaton@eik.bme.hu>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      ad5db2e7
    • B
      target/ppc/cpu.h: Move fpu related members closer in cpu env · b561615d
      BALATON Zoltan 提交于
      Move fp_status and fpscr closer to other floating point and vector
      related members in cpu env definition so they are in one group.
      Signed-off-by: NBALATON Zoltan <balaton@eik.bme.hu>
      Message-Id: <5b50e9e7eec2c383ae878b397d0b2927efc9ea43.1581888834.git.balaton@eik.bme.hu>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      b561615d
    • B
      target/ppc: Fix typo in comments · 92eeb004
      BALATON Zoltan 提交于
      "Deferred" was misspelled as "differed" in some comments, correct this
      typo,
      Signed-off-by: NBALATON Zoltan <balaton@eik.bme.hu>
      Message-Id: <20200214155748.0896B745953@zero.eik.bme.hu>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      92eeb004
    • A
      spapr: Allow changing offset for -kernel image · 87262806
      Alexey Kardashevskiy 提交于
      This allows moving the kernel in the guest memory. The option is useful
      for step debugging (as Linux is linked at 0x0); it also allows loading
      grub which is normally linked to run at 0x20000.
      
      This uses the existing kernel address by default.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Message-Id: <20200203032943.121178-6-aik@ozlabs.ru>
      Reviewed-by: NFabiano Rosas <farosas@linux.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      87262806
    • G
      pnv/phb3: Add missing break statement · e8ead7d5
      Greg Kurz 提交于
      We obviously don't want to print out an error message if addr points to
      a valid register.
      
      Reported-by: Coverity CID 1419391 Missing break in switch
      Fixes: 9ae1329e "ppc/pnv: Add models for POWER8 PHB3 PCIe Host bridge"
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Message-Id: <158153365202.3229002.11521084761048102466.stgit@bahia.lan>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      e8ead7d5
    • G
      pnv/phb4: Fix error path in pnv_pec_realize() · 7cfb999f
      Greg Kurz 提交于
      Obviously, we want to pass &local_err so that we can check it then
      line below, not errp.
      
      Reported-by: Coverity CID 1419395 'Constant' variable guards dead code
      Fixes: 4f9924c4 "ppc/pnv: Add models for POWER9 PHB4 PCIe Host bridge"
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Message-Id: <158153364605.3229002.2796177658957390343.stgit@bahia.lan>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      7cfb999f
    • G
      pnv/phb3: Convert 1u to 1ull · 5a205fcf
      Greg Kurz 提交于
      As reported by Coverity defect CID 1419397, the 'j' variable goes up to
      63 and shouldn't be used to left shift a 32-bit integer.
      
      The result of the operation goes to a 64-bit integer : use a 64-bit
      constant.
      
      Reported-by: Coverity CID 1419397 Bad bit shift operation
      Fixes: 9ae1329e "ppc/pnv: Add models for POWER8 PHB3 PCIe Host bridge"
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Message-Id: <158153364010.3229002.8004283672455615950.stgit@bahia.lan>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      5a205fcf
    • B
      target/ppc/cpu.h: Remove duplicate includes · 19b5c418
      BALATON Zoltan 提交于
      Commit 74433bf0 added some includes but added them twice. Since
      these are guarded against multiple inclusion including them once is
      enough.
      Signed-off-by: NBALATON Zoltan <balaton@eik.bme.hu>
      Message-Id: <20200212223207.5A37574637F@zero.eik.bme.hu>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      19b5c418
    • S
      spapr: Add Hcalls to support PAPR NVDIMM device · b5fca656
      Shivaprasad G Bhat 提交于
      This patch implements few of the necessary hcalls for the nvdimm support.
      
      PAPR semantics is such that each NVDIMM device is comprising of multiple
      SCM(Storage Class Memory) blocks. The guest requests the hypervisor to
      bind each of the SCM blocks of the NVDIMM device using hcalls. There can
      be SCM block unbind requests in case of driver errors or unplug(not
      supported now) use cases. The NVDIMM label read/writes are done through
      hcalls.
      
      Since each virtual NVDIMM device is divided into multiple SCM blocks,
      the bind, unbind, and queries using hcalls on those blocks can come
      independently. This doesn't fit well into the qemu device semantics,
      where the map/unmap are done at the (whole)device/object level granularity.
      The patch doesnt actually bind/unbind on hcalls but let it happen at the
      device_add/del phase itself instead.
      
      The guest kernel makes bind/unbind requests for the virtual NVDIMM device
      at the region level granularity. Without interleaving, each virtual NVDIMM
      device is presented as a separate guest physical address range. So, there
      is no way a partial bind/unbind request can come for the vNVDIMM in a
      hcall for a subset of SCM blocks of a virtual NVDIMM. Hence it is safe to
      do bind/unbind everything during the device_add/del.
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.ibm.com>
      Message-Id: <158131059899.2897.11515211602702956854.stgit@lep8c.aus.stglabs.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      b5fca656
    • S
      spapr: Add NVDIMM device support · ee3a71e3
      Shivaprasad G Bhat 提交于
      Add support for NVDIMM devices for sPAPR. Piggyback on existing nvdimm
      device interface in QEMU to support virtual NVDIMM devices for Power.
      Create the required DT entries for the device (some entries have
      dummy values right now).
      
      The patch creates the required DT node and sends a hotplug
      interrupt to the guest. Guest is expected to undertake the normal
      DR resource add path in response and start issuing PAPR SCM hcalls.
      
      The device support is verified based on the machine version unlike x86.
      
      This is how it can be used ..
      Ex :
      For coldplug, the device to be added in qemu command line as shown below
      -object memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm0,share=yes,size=1073872896
      -device nvdimm,label-size=128k,uuid=75a3cdd7-6a2f-4791-8d15-fe0a920e8e9e,memdev=memnvdimm0,id=nvdimm0,slot=0
      
      For hotplug, the device to be added from monitor as below
      object_add memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm0,share=yes,size=1073872896
      device_add nvdimm,label-size=128k,uuid=75a3cdd7-6a2f-4791-8d15-fe0a920e8e9e,memdev=memnvdimm0,id=nvdimm0,slot=0
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.ibm.com>
      Signed-off-by: NBharata B Rao <bharata@linux.ibm.com>
                     [Early implementation]
      Message-Id: <158131058078.2897.12767731856697459923.stgit@lep8c.aus.stglabs.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      ee3a71e3
    • S
      nvdimm: add uuid property to nvdimm · 6c5627bb
      Shivaprasad G Bhat 提交于
      For ppc64, PAPR requires the nvdimm device to have UUID property
      set in the device tree. Add an option to get it from the user.
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.ibm.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
      Message-Id: <158131056931.2897.14057087440721445976.stgit@lep8c.aus.stglabs.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      6c5627bb
    • S
      mem: move nvdimm_device_list to utilities · 3f350f6b
      Shivaprasad G Bhat 提交于
      nvdimm_device_list is required for parsing the list for devices
      in subsequent patches. Move it to common utility area.
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.ibm.com>
      Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Message-Id: <158131055857.2897.15658377276504711773.stgit@lep8c.aus.stglabs.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      3f350f6b
    • M
      ppc: function to setup latest class options · a7849268
      Michael S. Tsirkin 提交于
      We are going to add more init for the latest machine, so move the setup
      to a function so we don't have to change the DEFINE_SPAPR_MACHINE macro
      each time.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Message-Id: <20200207064628.1196095-1-mst@redhat.com>
      Reviewed-by: NLaurent Vivier <lvivier@redhat.com>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      a7849268
    • L
      ppc/pnv: Fix PCI_EXPRESS dependency · 90118a65
      Laurent Vivier 提交于
      When PHB4 bridge has been added, the dependencies to PCIE_PORT has been
      added to XIVE_SPAPR and indirectly to PSERIES.
      The build of the PowerNV machine is fine while we also build the PSERIES
      machine.
      If we disable the PSERIES machine, the PowerNV build fails because the
      PCI Express files are not built:
      
      /usr/bin/ld: hw/ppc/pnv.o: in function `pnv_chip_power8_pic_print_info':
      .../hw/ppc/pnv.c:623: undefined reference to `pnv_phb3_msi_pic_print_info'
      /usr/bin/ld: hw/ppc/pnv.o: in function `pnv_chip_power9_pic_print_info':
      .../hw/ppc/pnv.c:639: undefined reference to `pnv_phb4_pic_print_info'
      /usr/bin/ld: ../hw/usb/hcd-ehci-pci.o: in function `usb_ehci_pci_write_config':
      .../hw/usb/hcd-ehci-pci.c:129: undefined reference to `pci_default_write_config'
      /usr/bin/ld: ../hw/usb/hcd-ehci-pci.o: in function `usb_ehci_pci_realize':
      .../hw/usb/hcd-ehci-pci.c:68: undefined reference to `pci_allocate_irq'
      /usr/bin/ld: .../hw/usb/hcd-ehci-pci.c:72: undefined reference to `pci_register_bar'
      /usr/bin/ld: ../hw/usb/hcd-ehci-pci.o:(.data.rel+0x50): undefined reference to `vmstate_pci_device'
      
      This patch fixes the problem by adding needed dependencies to POWERNV.
      
      Fixes: 4f9924c4 ("ppc/pnv: Add models for POWER9 PHB4 PCIe Host bridge")
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Message-Id: <20200205232016.588202-3-lvivier@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      90118a65
    • L
      qtest: Fix rtas dependencies · 2c6e918e
      Laurent Vivier 提交于
      qtest "rtas" command is only available with pseries not all ppc64 targets,
      so if I try to compile only powernv machine, the build fails with:
      
        /usr/bin/ld: qtest.o: in function `qtest_process_command':
        .../qtest.c:645: undefined reference to `qtest_rtas_call'
      
      We fix this by enabling rtas command only with pseries machine.
      
      Fixes: eeddd59f ("tests: add RTAS command in the protocol")
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Message-Id: <20200205232016.588202-2-lvivier@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      2c6e918e
    • A
      spapr/rtas: Print message from "ibm,os-term" · a4c3791a
      Alexey Kardashevskiy 提交于
      The "ibm,os-term" RTAS call has a single parameter which is a pointer to
      a message from the guest kernel about the termination cause; this prints
      it.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Message-Id: <20200203032044.118585-1-aik@ozlabs.ru>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      a4c3791a
    • P
      Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-pull-request' into staging · 7afee874
      Peter Maydell 提交于
      Fix memory leak with fdt
      cosmetic change in code and logs
      update mailmap
      
      # gpg: Signature made Wed 19 Feb 2020 10:15:56 GMT
      # gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
      # gpg:                issuer "laurent@vivier.eu"
      # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
      # gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
      # gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
      # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C
      
      * remotes/vivier2/tags/trivial-branch-pull-request:
        hw/xtensa/xtfpga:fix leak of fdevice tree blob
        hw/nios2:fix leak of fdevice tree blob
        hw/net/rocker: Report unimplemented feature with qemu_log_mask(UNIMP)
        hw/block/pflash_cfi02: Remove unneeded variable assignment
        hw/display/qxl: Remove unneeded variable assignment
        contrib/rdmacm-mux: Remove superfluous semicolon
        tests/qtest/libqos/qgraph: Remove superfluous semicolons
        target/i386/whpx: Remove superfluous semicolon
        ui/input-barrier: Remove superfluous semicolon
        hw/vfio/display: Remove superfluous semicolon
        hw/scsi/esp: Remove superfluous semicolon
        hw/m68k/next-cube: Remove superfluous semicolon
        hw/arm/xlnx-versal: Remove superfluous semicolon
        audio/alsaaudio: Remove superfluous semicolons
        scripts/checkpatch.pl: Detect superfluous semicolon in C code
        Report stringified errno in VFIO related errors
        mailmap: Add entry for Yu-Chen Lin
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      7afee874
  2. 20 2月, 2020 1 次提交
    • P
      Merge remote-tracking branch 'remotes/rth/tags/pull-pa-20200218' into staging · 8cd7325f
      Peter Maydell 提交于
      Fixes for Dino and Artist.
      
      # gpg: Signature made Tue 18 Feb 2020 19:35:09 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-pa-20200218:
        hw/hppa/dino: Do not accept accesses to registers 0x818 and 0x82c
        hw/hppa/dino: Fix bitmask for the PCIROR register
        hw/hppa/dino: Fix reg800_keep_bits overrun (CID 1419387 1419393 1419394)
        hw/hppa/dino: Add comments with register name
        hw/display/artist: Remove dead code (CID 1419388 & 1419389)
        hw/display/artist: Avoid drawing line when nothing to display
        hw/display/artist: Delay some variables initialization
        hw/display/artist: Remove pointless initialization
        hw/display/artist: Move trace event to draw_line()
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      8cd7325f
  3. 19 2月, 2020 18 次提交