1. 27 7月, 2020 5 次提交
    • H
      hw/pci-host: save/restore pci host config register · 2ebc2121
      Hogan Wang 提交于
      The pci host config register is used to save PCI address for
      read/write config data. If guest writes a value to config register,
      and then QEMU pauses the vcpu to migrate, after the migration, the guest
      will continue to write pci config data, and the write data will be ignored
      because of new qemu process losing the config register state.
      
      To trigger the bug:
      1. guest is booting in seabios.
      2. guest enables the SMRAM in seabios:piix4_apmc_smm_setup, and then
         expects to disable the SMRAM by pci_config_writeb.
      3. after guest writes the pci host config register, QEMU pauses vcpu
         to finish migration.
      4. guest write of config data(0x0A) fails to disable the SMRAM because
         the config register state is lost.
      5. guest continues to boot and crashes in ipxe option ROM due to SMRAM
         in enabled state.
      
      Example Reproducer:
      
      step 1. Make modifications to seabios and qemu for increase reproduction
      efficiency, write 0xf0 to 0x402 port notify qemu to stop vcpu after
      0x0cf8 port wrote i440 configure register. qemu stop vcpu when catch
      0x402 port wrote 0xf0.
      
      seabios:/src/hw/pci.c
      @@ -52,6 +52,11 @@ void pci_config_writeb(u16 bdf, u32 addr, u8 val)
               writeb(mmconfig_addr(bdf, addr), val);
           } else {
               outl(ioconfig_cmd(bdf, addr), PORT_PCI_CMD);
      +       if (bdf == 0 && addr == 0x72 && val == 0xa) {
      +            dprintf(1, "stop vcpu\n");
      +            outb(0xf0, 0x402); // notify qemu to stop vcpu
      +            dprintf(1, "resume vcpu\n");
      +        }
               outb(val, PORT_PCI_DATA + (addr & 3));
           }
       }
      
      qemu:hw/char/debugcon.c
      @@ -60,6 +61,9 @@ static void debugcon_ioport_write(void *opaque, hwaddr addr, uint64_t val,
           printf(" [debugcon: write addr=0x%04" HWADDR_PRIx " val=0x%02" PRIx64 "]\n", addr, val);
       #endif
      
      +    if (ch == 0xf0) {
      +        vm_stop(RUN_STATE_PAUSED);
      +    }
           /* XXX this blocks entire thread. Rewrite to use
            * qemu_chr_fe_write and background I/O callbacks */
           qemu_chr_fe_write_all(&s->chr, &ch, 1);
      
      step 2. start vm1 by the following command line, and then vm stopped.
      $ qemu-system-x86_64 -machine pc-i440fx-5.0,accel=kvm\
       -netdev tap,ifname=tap-test,id=hostnet0,vhost=on,downscript=no,script=no\
       -device virtio-net-pci,netdev=hostnet0,id=net0,bus=pci.0,addr=0x13,bootindex=3\
       -device cirrus-vga,id=video0,vgamem_mb=16,bus=pci.0,addr=0x2\
       -chardev file,id=seabios,path=/var/log/test.seabios,append=on\
       -device isa-debugcon,iobase=0x402,chardev=seabios\
       -monitor stdio
      
      step 3. start vm2 to accept vm1 state.
      $ qemu-system-x86_64 -machine pc-i440fx-5.0,accel=kvm\
       -netdev tap,ifname=tap-test1,id=hostnet0,vhost=on,downscript=no,script=no\
       -device virtio-net-pci,netdev=hostnet0,id=net0,bus=pci.0,addr=0x13,bootindex=3\
       -device cirrus-vga,id=video0,vgamem_mb=16,bus=pci.0,addr=0x2\
       -chardev file,id=seabios,path=/var/log/test.seabios,append=on\
       -device isa-debugcon,iobase=0x402,chardev=seabios\
       -monitor stdio \
       -incoming tcp:127.0.0.1:8000
      
      step 4. execute the following qmp command in vm1 to migrate.
      (qemu) migrate tcp:127.0.0.1:8000
      
      step 5. execute the following qmp command in vm2 to resume vcpu.
      (qemu) cont
      Before this patch, we get KVM "emulation failure" error on vm2.
      This patch fixes it.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NHogan Wang <hogan.wang@huawei.com>
      Message-Id: <20200727084621.3279-1-hogan.wang@huawei.com>
      Reported-by: N"Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      2ebc2121
    • D
      virtio-mem-pci: force virtio version 1 · c22aba19
      David Hildenbrand 提交于
      Trying to run simple virtio-mem-pci examples currently fails with
          qemu-system-x86_64: -device virtio-mem-pci,id=vm0,memdev=mem0,node=0,
          requested-size=300M: device is modern-only, use disable-legacy=on
      due to the added safety checks in 9b3a35ec ("virtio: verify that legacy
      support is not accidentally on").
      
      As noted by Conny, we have to force virtio version 1. While at it, use
      qdev_realize() to set the parent bus and realize - like most other
      virtio-*-pci implementations.
      
      Fixes: 0b9a2443 ("virtio-pci: Proxy for virtio-mem")
      Reviewed-by: NCornelia Huck <cohuck@redhat.com>
      Cc: Cornelia Huck <cohuck@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Signed-off-by: NDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200727115905.129397-1-david@redhat.com>
      Cc: qemu-stable@nongnu.org
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      c22aba19
    • P
      Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-5.1-20200727' into staging · 4215d341
      Peter Maydell 提交于
      ppc patch queue 2020-07-27
      
      Only one patch in this batch, but it fixes a fairly important
      regression, so we want it in qemu-5.1
      
      # gpg: Signature made Mon 27 Jul 2020 06:51:57 BST
      # gpg:                using RSA key 75F46586AE61A66CC44E87DC6C38CACA20D9B392
      # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>" [full]
      # gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>" [full]
      # gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>" [full]
      # gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>" [unknown]
      # Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392
      
      * remotes/dgibson/tags/ppc-for-5.1-20200727:
        pseries: fix kvmppc_set_fwnmi()
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      4215d341
    • L
      pseries: fix kvmppc_set_fwnmi() · aef92d87
      Laurent Vivier 提交于
      QEMU issues the ioctl(KVM_CAP_PPC_FWNMI) on the first vCPU.
      
      If the first vCPU is currently running, the vCPU mutex is held
      and the ioctl() cannot be done and waits until the mutex is released.
      This never happens and the VM is stuck.
      
      To avoid this deadlock, issue the ioctl on the same vCPU doing the
      RTAS call.
      
      The problem can be reproduced by booting a guest with several vCPUs
      (the probability to have the problem is (n - 1) / n,  n = # of CPUs),
      and then by triggering a kernel crash with "echo c >/proc/sysrq-trigger".
      
      On the reboot, the kernel hangs after:
      
      ...
      [    0.000000] -----------------------------------------------------
      [    0.000000] ppc64_pft_size    = 0x0
      [    0.000000] phys_mem_size     = 0x48000000
      [    0.000000] dcache_bsize      = 0x80
      [    0.000000] icache_bsize      = 0x80
      [    0.000000] cpu_features      = 0x0001c06f8f4f91a7
      [    0.000000]   possible        = 0x0003fbffcf5fb1a7
      [    0.000000]   always          = 0x00000003800081a1
      [    0.000000] cpu_user_features = 0xdc0065c2 0xaee00000
      [    0.000000] mmu_features      = 0x3c006041
      [    0.000000] firmware_features = 0x00000085455a445f
      [    0.000000] physical_start    = 0x8000000
      [    0.000000] -----------------------------------------------------
      [    0.000000] numa:   NODE_DATA [mem 0x47f33c80-0x47f3ffff]
      
      Fixes: ec010c00 ("ppc/spapr: KVM FWNMI should not be enabled until guest requests it")
      Cc: npiggin@gmail.com
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Message-Id: <20200724083533.281700-1-lvivier@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      aef92d87
    • P
      Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20200725' into staging · 194f8ca8
      Peter Maydell 提交于
      Fix some cputlb commentary
      Fix an hppa temporary leak
      Fix an i386 translation issue with loop insns
      
      # gpg: Signature made Sat 25 Jul 2020 17:03:59 BST
      # 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-tcg-20200725:
        target/i386: Save cc_op before loop insns
        target/hppa: Free some temps in do_sub
        tcg: update comments for save_iotlb_data in cputlb
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      194f8ca8
  2. 26 7月, 2020 3 次提交
  3. 25 7月, 2020 6 次提交
  4. 24 7月, 2020 11 次提交
  5. 23 7月, 2020 7 次提交
  6. 22 7月, 2020 8 次提交