1. 01 7月, 2019 3 次提交
    • M
      pcie: work around for racy guest init · 110c477c
      Michael S. Tsirkin 提交于
      During boot, linux guests tend to clear all bits in pcie slot status
      register which is used for hotplug.
      If they clear bits that weren't set this is racy and will lose events:
      not a big problem for manual hotplug on bare-metal, but a problem for us.
      
      For example, the following is broken ATM:
      
      /x86_64-softmmu/qemu-system-x86_64 -enable-kvm -S -machine q35  \
          -device pcie-root-port,id=pcie_root_port_0,slot=2,chassis=2,addr=0x2,bus=pcie.0 \
          -device virtio-balloon-pci,id=balloon,bus=pcie_root_port_0 \
          -monitor stdio disk.qcow2
      (qemu)device_del balloon
      (qemu)cont
      
      Balloon isn't deleted as it should.
      
      As a work-around, detect this attempt to clear slot status and revert
      status to what it was before the write.
      
      Note: in theory this can be detected as a duplicate button press
      which cancels the previous press. Does not seem to happen in
      practice as guests seem to only have this bug during init.
      
      Note2: the right thing to do is probably to fix Linux to
      read status before clearing it, and act on the bits that are set.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NMarcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
      Tested-by: NIgor Mammedov <imammedo@redhat.com>
      110c477c
    • M
      pcie: check that slt ctrl changed before deleting · 2841ab43
      Michael S. Tsirkin 提交于
      During boot, linux would sometimes overwrites control of a powered off
      slot before powering it on. Unfortunately QEMU interprets that as a
      power off request and ejects the device.
      
      For example:
      
      /x86_64-softmmu/qemu-system-x86_64 -enable-kvm -S -machine q35  \
          -device pcie-root-port,id=pcie_root_port_0,slot=2,chassis=2,addr=0x2,bus=pcie.0 \
          -monitor stdio disk.qcow2
      (qemu)device_add virtio-balloon-pci,id=balloon,bus=pcie_root_port_0
      (qemu)cont
      
      Balloon is deleted during guest boot.
      
      To fix, save control beforehand and check that power
      or led state actually change before ejecting.
      
      Note: this is more a hack than a solution, ideally we'd
      find a better way to detect ejects, or move away
      from ejects completely and instead monitor whether
      it's safe to delete device due to e.g. its power state.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NMarcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
      Tested-by: NIgor Mammedov <imammedo@redhat.com>
      2841ab43
    • M
      pcie: don't skip multi-mask events · 861dc735
      Michael S. Tsirkin 提交于
      If we are trying to set multiple bits at once, testing that just one of
      them is already set gives a false positive. As a result we won't
      interrupt guest if e.g. presence detection change and attention button
      press are both set. This happens with multi-function device removal.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NMarcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      861dc735
  2. 24 6月, 2019 1 次提交
  3. 21 6月, 2019 3 次提交
  4. 17 6月, 2019 11 次提交
    • P
      hw/intc/arm_gicv3: GICD_TYPER.SecurityExtn is RAZ if GICD_CTLR.DS == 1 · 0edfcc9e
      Peter Maydell 提交于
      The GICv3 specification says that the GICD_TYPER.SecurityExtn bit
      is RAZ if GICD_CTLR.DS is 1. We were incorrectly making it RAZ
      if the security extension is unsupported. "Security extension
      unsupported" always implies GICD_CTLR.DS == 1, but the guest can
      also set DS on a GIC which does support the security extension.
      Fix the condition to correctly check the GICD_CTLR.DS bit.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 20190524124248.28394-3-peter.maydell@linaro.org
      0edfcc9e
    • P
      hw/intc/arm_gicv3: Fix decoding of ID register range · e40f6073
      Peter Maydell 提交于
      The GIC ID registers cover an area 0x30 bytes in size
      (12 registers, 4 bytes each). We were incorrectly decoding
      only the first 0x20 bytes.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-id: 20190524124248.28394-2-peter.maydell@linaro.org
      e40f6073
    • P
      hw/arm: Correctly disable FPU/DSP for some ARMSSE-based boards · a90a862b
      Peter Maydell 提交于
      The SSE-200 hardware has configurable integration settings which
      determine whether its two CPUs have the FPU and DSP:
       * CPU0_FPU (default 0)
       * CPU0_DSP (default 0)
       * CPU1_FPU (default 1)
       * CPU1_DSP (default 1)
      
      Similarly, the IoTKit has settings for its single CPU:
       * CPU0_FPU (default 1)
       * CPU0_DSP (default 1)
      
      Of our four boards that use either the IoTKit or the SSE-200:
       * mps2-an505, mps2-an521 and musca-a use the default settings
       * musca-b1 enables FPU and DSP on both CPUs
      
      Currently QEMU models all these boards using CPUs with
      both FPU and DSP enabled. This means that we are incorrect
      for mps2-an521 and musca-a, which should not have FPU or DSP
      on CPU0.
      
      Create QOM properties on the ARMSSE devices corresponding to the
      default h/w integration settings, and make the Musca-B1 board
      enable FPU and DSP on both CPUs. This fixes the mps2-an521
      and musca-a behaviour, and leaves the musca-b1 and mps2-an505
      behaviour unchanged.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Message-id: 20190517174046.11146-5-peter.maydell@linaro.org
      a90a862b
    • P
      hw/arm/armv7m: Forward "vfp" and "dsp" properties to CPU · e0cf7b81
      Peter Maydell 提交于
      Create "vfp" and "dsp" properties on the armv7m container object
      which will be forwarded to its CPU object, so that SoCs can
      configure whether the CPU has these features.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Message-id: 20190517174046.11146-4-peter.maydell@linaro.org
      e0cf7b81
    • P
      hw/arm/boot: Honour image size field in AArch64 Image format kernels · 5e6dbe1e
      Peter Maydell 提交于
      Since Linux v3.17, the kernel's Image header includes a field image_size,
      which gives the total size of the kernel including unpopulated data
      sections such as the BSS). If this is present, then return it from
      load_aarch64_image() as the true size of the kernel rather than
      just using the size of the Image file itself. This allows the code
      which calculates where to put the initrd to avoid putting it in
      the kernel's BSS area.
      
      This means that we should be able to reliably load kernel images
      which are larger than 128MB without accidentally putting the
      initrd or dtb in locations that clash with the kernel itself.
      
      Fixes: https://bugs.launchpad.net/qemu/+bug/1823998Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Tested-by: NMark Rutland <mark.rutland@arm.com>
      Message-id: 20190516144733.32399-5-peter.maydell@linaro.org
      5e6dbe1e
    • P
      hw/arm/boot: Avoid placing the initrd on top of the kernel · e6b2b20d
      Peter Maydell 提交于
      We currently put the initrd at the smaller of:
       * 128MB into RAM
       * halfway into the RAM
      (with the dtb following it).
      
      However for large kernels this might mean that the kernel
      overlaps the initrd. For some kinds of kernel (self-decompressing
      32-bit kernels, and ELF images with a BSS section at the end)
      we don't know the exact size, but even there we have a
      minimum size. Put the initrd at least further into RAM than
      that. For image formats that can give us an exact kernel size, this
      will mean that we definitely avoid overlaying kernel and initrd.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Tested-by: NMark Rutland <mark.rutland@arm.com>
      Message-id: 20190516144733.32399-4-peter.maydell@linaro.org
      e6b2b20d
    • P
      hw/arm/boot: Diagnose layouts that put initrd or DTB off the end of RAM · 852dc64d
      Peter Maydell 提交于
      We calculate the locations in memory where we want to put the
      initrd and the DTB based on the size of the kernel, since they
      come after it. Add some explicit checks that these aren't off the
      end of RAM entirely.
      
      (At the moment the way we calculate the initrd_start means that
      it can't ever be off the end of RAM, but that will change with
      the next commit.)
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Tested-by: NMark Rutland <mark.rutland@arm.com>
      Message-id: 20190516144733.32399-3-peter.maydell@linaro.org
      852dc64d
    • P
      hw/arm/boot: Don't assume RAM starts at address zero · e70af24b
      Peter Maydell 提交于
      In the Arm kernel/initrd loading code, in some places we make the
      incorrect assumption that info->ram_size can be treated as the
      address of the end of RAM, as for instance when we calculate the
      available space for the initrd using "info->ram_size - info->initrd_start".
      This is wrong, because many Arm boards (including "virt") specify
      a non-zero info->loader_start to indicate that their RAM area
      starts at a non-zero physical address.
      
      Correct the places which make this incorrect assumption.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Tested-by: NMark Rutland <mark.rutland@arm.com>
      Message-id: 20190516144733.32399-2-peter.maydell@linaro.org
      e70af24b
    • G
      q35: fix mmconfig and PCI0._CRS · 4a441836
      Gerd Hoffmann 提交于
      This patch changes the handling of the mmconfig area.  Thanks to the
      pci(e) expander devices we already have the logic to exclude address
      ranges from PCI0._CRS.  We can simply add the mmconfig address range
      to the list get it excluded as well.
      
      With that in place we can go with a fixed pci hole which covers the
      whole area from the end of (low) ram to the ioapic.
      
      This will make the whole logic alot less fragile.  No matter where the
      firmware places the mmconfig xbar, things should work correctly.  The
      guest also gets a bit more PCI address space (seabios boot):
      
          # cat /proc/iomem
          [ ... ]
          7ffdd000-7fffffff : reserved
          80000000-afffffff : PCI Bus 0000:00            <<-- this is new
          b0000000-bfffffff : PCI MMCONFIG 0000 [bus 00-ff]
            b0000000-bfffffff : reserved
          c0000000-febfffff : PCI Bus 0000:00
            f8000000-fbffffff : 0000:00:01.0
          [ ... ]
      
      So this is a guest visible change.
      
      Cc: László Érsek <lersek@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
      Message-Id: <20190607073429.3436-1-kraxel@redhat.com>
      4a441836
    • W
      hw/acpi: extract acpi_add_rom_blob() · 82f76c67
      Wei Yang 提交于
      arm and i386 has almost the same function acpi_add_rom_blob(), except
      giving different FWCfgCallback function.
      
      This patch moves acpi_add_rom_blob() to utils.c by passing
      FWCfgCallback to it.
      Signed-off-by: NWei Yang <richardw.yang@linux.intel.com>
      Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
      
      v7:
        * rebase on top of current master because of conflict
      v6:
        * change author from Igor to Michael
      v5:
        * remove unnecessary header glib/gprintf.h
        * rearrange include header to make it more suitable
      v4:
        * extract -> moves
        * adjust comment in source to make checkpatch happy
      v3:
        * put acpi_add_rom_blob() to hw/acpi/utils.c
      v2:
        * remove unused header in original source file
      Message-Id: <20190610011830.28398-1-richardw.yang@linux.intel.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      82f76c67
    • L
      vhost: fix vhost_log size overflow during migration · 240e647a
      Li Hangjing 提交于
      When a guest which doesn't support multiqueue is migrated with a multi queues
      vhost-user-blk deivce, a crash will occur like:
      
      0 qemu_memfd_alloc (name=<value optimized out>, size=562949953421312, seals=<value optimized out>, fd=0x7f87171fe8b4, errp=0x7f87171fe8a8) at util/memfd.c:153
      1 0x00007f883559d7cf in vhost_log_alloc (size=70368744177664, share=true) at hw/virtio/vhost.c:186
      2 0x00007f88355a0758 in vhost_log_get (listener=0x7f8838bd7940, enable=1) at qemu-2-12/hw/virtio/vhost.c:211
      3 vhost_dev_log_resize (listener=0x7f8838bd7940, enable=1) at hw/virtio/vhost.c:263
      4 vhost_migration_log (listener=0x7f8838bd7940, enable=1) at hw/virtio/vhost.c:787
      5 0x00007f88355463d6 in memory_global_dirty_log_start () at memory.c:2503
      6 0x00007f8835550577 in ram_init_bitmaps (f=0x7f88384ce600, opaque=0x7f8836024098) at migration/ram.c:2173
      7 ram_init_all (f=0x7f88384ce600, opaque=0x7f8836024098) at migration/ram.c:2192
      8 ram_save_setup (f=0x7f88384ce600, opaque=0x7f8836024098) at migration/ram.c:2219
      9 0x00007f88357a419d in qemu_savevm_state_setup (f=0x7f88384ce600) at migration/savevm.c:1002
      10 0x00007f883579fc3e in migration_thread (opaque=0x7f8837530400) at migration/migration.c:2382
      11 0x00007f8832447893 in start_thread () from /lib64/libpthread.so.0
      12 0x00007f8832178bfd in clone () from /lib64/libc.so.6
      
      This is because vhost_get_log_size() returns a overflowed vhost-log size.
      In this function, it uses the uninitialized variable vqs->used_phys and
      vqs->used_size to get the vhost-log size.
      Signed-off-by: NLi Hangjing <lihangjing@baidu.com>
      Reviewed-by: NXie Yongji <xieyongji@baidu.com>
      Reviewed-by: NChai Wen <chaiwen@baidu.com>
      Message-Id: <20190603061524.24076-1-lihangjing@baidu.com>
      Cc: qemu-stable@nongnu.org
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      240e647a
  5. 14 6月, 2019 1 次提交
  6. 13 6月, 2019 7 次提交
  7. 12 6月, 2019 14 次提交